Files
my-vault/.obsidian/plugins/templater-obsidian/main.js
T

62 lines
443 KiB
JavaScript
Raw Normal View History

2026-01-05 13:03:55 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var vo=Object.create;var Ir=Object.defineProperty;var bo=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty;var ga=e=>Ir(e,"__esModule",{value:!0});var To=(e,t)=>{ga(e);for(var r in t)Ir(e,r,{get:t[r],enumerable:!0})},Eo=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wo(t))!jo.call(e,i)&&i!=="default"&&Ir(e,i,{get:()=>t[i],enumerable:!(r=bo(t,i))||r.enumerable});return e},$=e=>Eo(ga(Ir(e!=null?vo(ko(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var Aa=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return r=>{for(var i=r.length,n=new Uint8Array((i-(r[i-1]=="=")-(r[i-2]=="="))*3/4|0),a=0,s=0;a<i;){var c=e[r.charCodeAt(a++)],l=e[r.charCodeAt(a++)],h=e[r.charCodeAt(a++)],m=e[r.charCodeAt(a++)];n[s++]=c<<2|l>>4,n[s++]=l<<4|h>>2,n[s++]=h<<6|m}return n}})();To(exports,{default:()=>ta});var er=$(require("obsidian"));var ri=$(require("obsidian"));var te=function(){function e(){}return e.explainIfInvalidTSDocTagName=function(t){if(t[0]!=="@")return'A TSDoc tag name must start with an "@" symbol';if(!e._tsdocTagNameRegExp.test(t))return"A TSDoc tag name must start with a letter and contain only letters and numbers"},e.validateTSDocTagName=function(t){var r=e.explainIfInvalidTSDocTagName(t);if(r)throw new Error(r)},e.explainIfInvalidLinkUrl=function(t){if(t.length===0)return"The URL cannot be empty";if(!e._urlSchemeRegExp.test(t))return'An @link URL must begin with a scheme comprised only of letters and numbers followed by "://". (For general URLs, use an HTML "<a>" tag instead.)';if(!e._urlSchemeAfterRegExp.test(t))return'An @link URL must have at least one character after "://"'},e.explainIfInvalidHtmlName=function(t){if(!e._htmlNameRegExp.test(t))return"An HTML name must be an ASCII letter followed by zero or more letters, digits, or hyphens"},e.validateHtmlName=function(t){var r=e.explainIfInvalidHtmlName(t);if(r)throw new Error(r)},e.explainIfInvalidPackageName=function(t){if(t.length===0)return"The package name cannot be an empty string";if(!e._validPackageNameRegExp.test(t))return"The package name ".concat(JSON.stringify(t)," is not a valid package name")},e.explainIfInvalidImportPath=function(t,r){if(t.length>0){if(t.indexOf("//")>=0)return'An import path must not contain "//"';if(t[t.length-1]==="/")return'An import path must not end with "/"';if(!r&&t[0]==="/")return'An import path must not start with "/" unless prefixed by a package name'}},e.isSystemSelector=function(t){return e._systemSelectors.has(t)},e.explainIfInvalidUnquotedIdentifier=function(t){if(t.length===0)return"The identifier cannot be an empty string";if(e._identifierBadCharRegExp.test(t))return"The identifier cannot non-word characters";if(e._identifierNumberStartRegExp.test(t))return"The identifier must not start with a number"},e.explainIfInvalidUnquotedMemberIdentifier=function(t){var r=e.explainIfInvalidUnquotedIdentifier(t);if(r!==void 0)return r;if(e.isSystemSelector(t))return'The identifier "'.concat(t,'" must be quoted because it is a TSDoc system selector name')},e._tsdocTagNameRegExp=/^@[a-z][a-z0-9]*$/i,e._urlSchemeRegExp=/^[a-z][a-z0-9]*\:\/\//i,e._urlSchemeAfterRegExp=/^[a-z][a-z0-9]*\:\/\/./i,e._htmlNameRegExp=/^[a-z]+[a-z0-9\-]*$/i,e._identifierBadCharRegExp=/[^a-z0-9_$]/i,e._identifierNumberStartRegExp=/^[0-9]/,e._validPackageNameRegExp=/^(?:@[a-z0-9\-_\.]+\/)?[a-z0-9\-_\.]+$/i,e._systemSelectors=new Set(["instance","static","constructor","class","enum","function","interface","namespace","type","variable"]),e}();var Di=function(){function e(){this._docNodeDefinitionsByKind=new Map,this._docNodeDefinitionsByConstructor=new Map}return e.prototype.registerDocNodes=function(t,r){var i=te.explainIfInvalidPackageName(t);if(i)throw new Error("Invalid NPM package name: "+i);for(var n=0,a=r;n<a.length;n++){var s=a[n];if(!e._nodeKindRegExp.test(s.docNodeKind))throw new Error("The DocNode kind ".concat(JSON.stringify(s.docNodeKind)," is not a
`:this.range.toString()},e}();var Do=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function i(){this.constructor=t}t.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),v;(function(e){e.Spacing="Spacing",e.BlockTag="BlockTag",e.CodeSpan_OpeningDelimiter="CodeSpan_OpeningDelimiter",e.CodeSpan_Code="CodeSpan_Code",e.CodeSpan_ClosingDelimiter="CodeSpan_ClosingDelimiter",e.DeclarationReference_PackageName="DeclarationReference_PackageName",e.DeclarationReference_ImportPath="DeclarationReference_ImportPath",e.DeclarationReference_ImportHash="DeclarationReference_ImportHash",e.ErrorText="ErrorText",e.NonstandardText="NonstandardText",e.EscapedText="EscapedText",e.FencedCode_OpeningFence="FencedCode_OpeningFence",e.FencedCode_Language="FencedCode_Language",e.FencedCode_Code="FencedCode_Code",e.FencedCode_ClosingFence="FencedCode_ClosingFence",e.HtmlAttribute_Name="HtmlAttribute_Name",e.HtmlAttribute_Equals="HtmlAttribute_Equals",e.HtmlAttribute_Value="HtmlAttribute_Value",e.HtmlEndTag_OpeningDelimiter="HtmlEndTag_OpeningDelimiter",e.HtmlEndTag_Name="HtmlEndTag_Name",e.HtmlEndTag_ClosingDelimiter="HtmlEndTag_ClosingDelimiter",e.HtmlStartTag_OpeningDelimiter="HtmlStartTag_OpeningDelimiter",e.HtmlStartTag_Name="HtmlStartTag_Name",e.HtmlStartTag_ClosingDelimiter="HtmlStartTag_ClosingDelimiter",e.InlineTag_OpeningDelimiter="InlineTag_OpeningDelimiter",e.InlineTag_TagName="InlineTag_TagName",e.InlineTag_TagContent="InlineTag_TagContent",e.InlineTag_ClosingDelimiter="InlineTag_ClosingDelimiter",e.LinkTag_UrlDestination="LinkTag_UrlDestination",e.LinkTag_Pipe="LinkTag_Pipe",e.LinkTag_LinkText="LinkTag_LinkText",e.MemberIdentifier_LeftQuote="MemberIdentifier_LeftQuote",e.MemberIdentifier_Identifier="MemberIdentifier_Identifier",e.MemberIdentifier_RightQuote="MemberIdentifier_RightQuote",e.MemberReference_Dot="MemberReference_Dot",e.MemberReference_LeftParenthesis="MemberReference_LeftParenthesis",e.MemberReference_Colon="MemberReference_Colon",e.MemberReference_RightParenthesis="MemberReference_RightParenthesis",e.MemberSelector="MemberSelector",e.DocMemberSymbol_LeftBracket="DocMemberSymbol_LeftBracket",e.DocMemberSymbol_RightBracket="DocMemberSymbol_RightBracket",e.ParamBlock_ParameterName="ParamBlock_ParameterName",e.ParamBlock_Hyphen="ParamBlock_Hyphen",e.PlainText="PlainText",e.SoftBreak="SoftBreak"})(v||(v={}));var b=function(e){Do(t,e);function t(r){var i=e.call(this,r)||this;if(r.excerptKind===v.Spacing)for(var n=0,a=r.content.tokens;n<a.length;n++){var s=a[n];switch(s.kind){case f.Spacing:case f.Newline:case f.EndOfInput:break;default:throw new Error("The excerptKind=Spacing but the range contains a non-whitespace token")}}return i._excerptKind=r.excerptKind,i._content=r.content,i}return Object.defineProperty(t.prototype,"kind",{get:function(){return g.Excerpt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excerptKind",{get:function(){return this._excerptKind},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),t}(j);var Mo=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function i(){this.constructor=t}t.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Nr=function(e){Mo(t,e);function t(r){var i=e.call(this,r)||this;return te.validateTSDocTagName(r.tagName),i._tagName=r.tagName,i._tagNameWithUpperCase=r.tagName.toUpperCase(),j.isParsedParameters(r
`,this._emitCommentFraming=!0,this._lineState=ce.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1}return e.prototype.renderComment=function(t,r){this._emitCommentFraming=!0,this._renderCompleteObject(t,r)},e.prototype.renderHtmlTag=function(t,r){this._emitCommentFraming=!1,this._renderCompleteObject(t,r)},e.prototype.renderDeclarationReference=function(t,r){this._emitCommentFraming=!1,this._renderCompleteObject(t,r)},e.prototype._renderCompleteObject=function(t,r){this._output=t,this._lineState=ce.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1,this._renderNode(r),this._writeEnd()},e.prototype._renderNode=function(t){var r=this;if(t!==void 0)switch(t.kind){case g.Block:var i=t;this._ensureLineSkipped(),this._renderNode(i.blockTag),i.blockTag.tagNameWithUpperCase===z.returns.tagNameWithUpperCase&&(this._writeContent(" "),this._hangingParagraph=!0),this._renderNode(i.content);break;case g.BlockTag:var n=t;this._lineState===ce.MiddleOfLine&&this._writeContent(" "),this._writeContent(n.tagName);break;case g.CodeSpan:var a=t;this._writeContent("`"),this._writeContent(a.code),this._writeContent("`");break;case g.Comment:var s=t;this._renderNodes(Ri(Ri(Ri([s.summarySection,s.remarksBlock,s.privateRemarks,s.deprecatedBlock,s.params,s.typeParams,s.returnsBlock],s.customBlocks,!0),s.seeBlocks,!0),[s.inheritDocTag],!1)),s.modifierTagSet.nodes.length>0&&(this._ensureLineSkipped(),this._renderNodes(s.modifierTagSet.nodes));break;case g.DeclarationReference:var c=t;this._writeContent(c.packageName),this._writeContent(c.importPath),(c.packageName!==void 0||c.importPath!==void 0)&&this._writeContent("#"),this._renderNodes(c.memberReferences);break;case g.ErrorText:var l=t;this._writeContent(l.text);break;case g.EscapedText:var h=t;this._writeContent(h.encodedText);break;case g.FencedCode:var m=t;this._ensureAtStartOfLine(),this._writeContent("```"),this._writeContent(m.language),this._writeNewline(),this._writeContent(m.code),this._writeContent("```"),this._writeNewline(),this._writeNewline();break;case g.HtmlAttribute:var _=t;this._writeContent(_.name),this._writeContent(_.spacingAfterName),this._writeContent("="),this._writeContent(_.spacingAfterEquals),this._writeContent(_.value),this._writeContent(_.spacingAfterValue);break;case g.HtmlEndTag:var k=t;this._writeContent("</"),this._writeContent(k.name),this._writeContent(">");break;case g.HtmlStartTag:var F=t;this._writeContent("<"),this._writeContent(F.name),this._writeContent(F.spacingAfterName);for(var O=F.spacingAfterName===void 0||F.spacingAfterName.length===0,U=0,P=F.htmlAttributes;U<P.length;U++){var Y=P[U];O&&this._writeContent(" "),this._renderNode(Y),O=Y.spacingAfterValue===void 0||Y.spacingAfterValue.length===0}this._writeContent(F.selfClosingTag?"/>":">");break;case g.InheritDocTag:var xe=t;this._renderInlineTag(xe,function(){xe.declarationReference&&(r._writeContent(" "),r._renderNode(xe.declarationReference))});break;case g.InlineTag:var ye=t;this._renderInlineTag(ye,function(){ye.tagContent.length>0&&(r._writeContent(" "),r._writeContent(ye.tagContent))});break;case g.LinkTag:var re=t;this._renderInlineTag(re,function(){(re.urlDestination!==void 0||re.codeDestination!==void 0)&&(re.urlDestination!==void 0?(r._writeContent(" "),r._writeContent(re.urlDestination)):re.codeDestination!==void 0&&(r._writeContent(" "),r._renderNode(re.codeDestination))),re.linkText!==void 0&&(r._writeContent(" "),r._writeContent("|"),r._writeContent(" "),r._writeContent(re.linkText))});break;case g.MemberIdentifier:var _t=t;_t.hasQuotes?(this._writeContent('"'),this._writeContent(_t.identifier),this._writeContent('"')):this._writeContent(_t.identifier);break;case g.MemberReference:var Ie=t;Ie.hasDot&&this._writeContent("."),Ie.selector&&this._writeContent("("),Ie.memberSymbol?this._renderNode(Ie.memberSymbol):this._renderNode(Ie.memberIdentifier),Ie.selector&&(this._writeContent(":"),this._renderNode(Ie.selector),this._writeContent(")"));break;case g.MemberSelector:var wi=t;this._writeContent(wi.selector);break;case g.MemberSymbol:var wr=t;this._writeContent(
`?(++r,i=1):++i)}return{line:r,column:i}},e.prototype._validateBounds=function(){if(this.pos<0)throw new Error("TextRange.pos cannot be negative");if(this.end<0)throw new Error("TextRange.end cannot be negative");if(this.end<this.pos)throw new Error("TextRange.end cannot be smaller than TextRange.pos");if(this.pos>this.buffer.length)throw new Error("TextRange.pos cannot exceed the associated text buffer length");if(this.end>this.buffer.length)throw new Error("TextRange.end cannot exceed the associated text buffer length")},e.empty=new e("",0,0),e}();var pr=function(){function e(t){this.messageId=t.messageId,this.unformattedText=t.messageText,this.textRange=t.textRange,this.tokenSequence=t.tokenSequence,this.docNode=t.docNode,this._text=void 0}return e._formatMessageText=function(t,r){if(t||(t="An unknown error occurred"),r.pos!==0||r.end!==0){var i=r.getLocation(r.pos);if(i.line)return"(".concat(i.line,",").concat(i.column,"): ")+t}return t},Object.defineProperty(e.prototype,"text",{get:function(){return this._text===void 0&&(this._text=e._formatMessageText(this.unformattedText,this.textRange)),this._text},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.text},e}();var Vi=function(){function e(){this._messages=[]}return Object.defineProperty(e.prototype,"messages",{get:function(){return this._messages},enumerable:!1,configurable:!0}),e.prototype.addMessage=function(t){this._messages.push(t)},e.prototype.addMessageForTextRange=function(t,r,i){this.addMessage(new pr({messageId:t,messageText:r,textRange:i}))},e.prototype.addMessageForTokenSequence=function(t,r,i,n){this.addMessage(new pr({messageId:t,messageText:r,textRange:i.getContainingTextRange(),tokenSequence:i,docNode:n}))},e.prototype.addMessageForDocErrorText=function(t){var r;t.textExcerpt?r=t.textExcerpt:r=t.errorLocation,this.addMessage(new pr({messageId:t.messageId,messageText:t.errorMessage,textRange:r.getContainingTextRange(),tokenSequence:r,docNode:t}))},e}();var Hi=function(){function e(t,r){this.commentRange=Le.empty,this.lines=[],this.tokens=[],this.configuration=t,this.sourceRange=r,this.docComment=new Mr({configuration:this.configuration}),this.log=new Vi}return e}();var ut=function(){function e(t){this.parserContext=t.parserContext,this._startIndex=t.startIndex,this._endIndex=t.endIndex,this._validateBounds()}return e.createEmpty=function(t){return new e({parserContext:t,startIndex:0,endIndex:0})},Object.defineProperty(e.prototype,"startIndex",{get:function(){return this._startIndex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endIndex",{get:function(){return this._endIndex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tokens",{get:function(){return this.parserContext.tokens.slice(this._startIndex,this._endIndex)},enumerable:!1,configurable:!0}),e.prototype.getNewSequence=function(t,r){return new e({parserContext:this.parserContext,startIndex:t,endIndex:r})},e.prototype.getContainingTextRange=function(){return this.isEmpty()?Le.empty:this.parserContext.sourceRange.getNewRange(this.parserContext.tokens[this._startIndex].range.pos,this.parserContext.tokens[this._endIndex-1].range.end)},e.prototype.isEmpty=function(){return this._startIndex===this._endIndex},e.prototype.toString=function(){return this.tokens.map(function(t){return t.toString()}).join("")},e.prototype._validateBounds=function(){if(this.startIndex<0)throw new Error("TokenSequence.startIndex cannot be negative");if(this.endIndex<0)throw new Error("TokenSequence.endIndex cannot be negative");if(this.endIndex<this.startIndex)throw new Error("TokenSequence.endIndex cannot be smaller than TokenSequence.startIndex");if(this.startIndex>this.parserContext.tokens.length)throw new Error("TokenSequence.startIndex cannot exceed the associated token array");if(this.endIndex>this.parserContext.tokens.length)throw new Error("TokenSequence.endIndex cannot exceed the associated token array")},e}();var ie;(function(e){e[e.BeginComment1=0]="BeginComment1",e[e.BeginComment2=1]="BeginComment2",e[e.CollectingFirstLine=2]="CollectingFirstLine
`?((h!==ie.CollectingFirstLine||c>s)&&m.push(r.getNewRange(s,c)),s=l,c=l,h=ie.AdvancingLine):_==="*"&&F==="/"?(c>s&&m.push(r.getNewRange(s,c)),s=0,c=0,++l,a=l,h=ie.Done):e._whitespaceCharacterRegExp.test(_)||(c=l);break;case ie.AdvancingLine:_==="*"?F==="/"?(s=0,c=0,++l,a=l,h=ie.Done):(F===" "&&++l,s=l,c=l,h=ie.CollectingLine):_===`
`?(m.push(r.getNewRange(k,k)),s=l):e._whitespaceCharacterRegExp.test(_)||(c=l,h=ie.CollectingLine);break}}return t.commentRange=r.getNewRange(n,a),t.lines=m,!0},e._whitespaceCharacterRegExp=/^\s$/,e}();var fr=function(){function e(){}return e.readTokens=function(t){e._ensureInitialized();for(var r=[],i=void 0,n=0,a=t;n<a.length;n++){var s=a[n];e._pushTokensForLine(r,s),i=s}return i?r.push(new wt(f.EndOfInput,i.getNewRange(i.end,i.end),i)):r.push(new wt(f.EndOfInput,Le.empty,Le.empty)),r},e.isPunctuation=function(t){return e._ensureInitialized(),e._punctuationTokens[t]||!1},e._pushTokensForLine=function(t,r){for(var i=r.buffer,n=r.end,a=r.pos,s=void 0,c=a;a<n;){var l=i.charCodeAt(a),h=e._charCodeMap[l];h===void 0&&(h=f.Other),s!==void 0&&h===s&&e._isMultiCharacterToken(s)||(s!==void 0&&t.push(new wt(s,r.getNewRange(c,a),r)),c=a,s=h),++a}s!==void 0&&t.push(new wt(s,r.getNewRange(c,a),r)),t.push(new wt(f.Newline,r.getNewRange(r.end,r.end),r))},e._isMultiCharacterToken=function(t){switch(t){case f.Spacing:case f.AsciiWord:case f.Other:return!0}return!1},e._ensureInitialized=function(){if(!e._charCodeMap){e._charCodeMap={},e._punctuationTokens={};for(var t=e._commonMarkPunctuationCharacters,r=0;r<t.length;++r){var i=t.charCodeAt(r);e._charCodeMap[i]=f.OtherPunctuation}for(var n={"\\":f.Backslash,"<":f.LessThan,">":f.GreaterThan,"=":f.Equals,"'":f.SingleQuote,'"':f.DoubleQuote,"/":f.Slash,"-":f.Hyphen,"@":f.AtSign,"{":f.LeftCurlyBracket,"}":f.RightCurlyBracket,"`":f.Backtick,".":f.Period,":":f.Colon,",":f.Comma,"[":f.LeftSquareBracket,"]":f.RightSquareBracket,"|":f.Pipe,"(":f.LeftParenthesis,")":f.RightParenthesis,"#":f.PoundSymbol,"+":f.Plus,$:f.DollarSign},a=0,s=Object.getOwnPropertyNames(n);a<s.length;a++){var c=s[a];e._charCodeMap[c.charCodeAt(0)]=n[c],e._punctuationTokens[n[c]]=!0}e._punctuationTokens[f.OtherPunctuation]=!0;for(var l=e._wordCharacters,r=0;r<l.length;++r){var i=l.charCodeAt(r);e._charCodeMap[i]=f.AsciiWord}e._charCodeMap[" ".charCodeAt(0)]=f.Spacing,e._charCodeMap[" ".charCodeAt(0)]=f.Spacing}},e._commonMarkPunctuationCharacters="!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~",e._wordCharacters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_",e}();var Ki=function(){function e(t,r){if(this._parserContext=t,this.tokens=t.tokens,r){if(r.parserContext!==this._parserContext)throw new Error("The embeddedTokenSequence must use the same parser context");this._readerStartIndex=r.startIndex,this._readerEndIndex=r.endIndex}else this._readerStartIndex=0,this._readerEndIndex=this.tokens.length;this._currentIndex=this._readerStartIndex,this._accumulatedStartIndex=this._readerStartIndex}return e.prototype.extractAccumulatedSequence=function(){if(this._accumulatedStartIndex===this._currentIndex)throw new Error("Parser assertion failed: The queue should not be empty when extractAccumulatedSequence() is called");var t=new ut({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex});return this._accumulatedStartIndex=this._currentIndex,t},e.prototype.isAccumulatedSequenceEmpty=function(){return this._accumulatedStartIndex===this._currentIndex},e.prototype.tryExtractAccumulatedSequence=function(){if(!this.isAccumulatedSequenceEmpty())return this.extractAccumulatedSequence()},e.prototype.assertAccumulatedSequenceIsEmpty=function(){if(!this.isAccumulatedSequenceEmpty()){var t=new ut({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex}),r=t.tokens.map(function(i){return i.toString()});throw new Error(`Parser assertion failed: The queue should be empty, but it contains:
`+JSON.stringify(r))}},e.prototype.peekToken=function(){return this.tokens[this._currentIndex]},e.prototype.peekTokenKind=function(){return this._currentIndex>=this._readerEndIndex?f.EndOfInput:this.tokens[this._currentIndex].kind},e.prototype.peekTokenAfterKind=function(){return this._currentIndex+1>=this._readerEndIndex?f.EndOfInput:this.tokens[this._currentIndex+1].kind},e.prototype.peekTokenAfterAfterKind=function(){return this._currentIndex+2>=this._readerEndIndex?f.EndOfInput:this.tokens[this._currentIndex+2].kind},e.prototype.readToken=function(){if(this._currentIndex>=this._readerEndIndex)throw new Error("Cannot read past end of stream");var t=this.tokens[this._currentIndex];if(t.kind===f.EndOfInput)throw new Error("The EndOfInput token cannot be read");return this._currentIndex++,t},e.prototype.peekPreviousTokenKind=function(){return this._currentIndex===0?f.EndOfInput:this.tokens[this._currentIndex-1].kind},e.prototype.createMarker=function(){return this._currentIndex},e.prototype.backtrackToMarker=function(t){if(t>this._currentIndex)throw new Error("The marker has expired");this._currentIndex=t,t<this._accumulatedStartIndex&&(this._accumulatedStartIndex=t)},e}();var Qr=function(){return Qr=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Qr.apply(this,arguments)};function hr(e){return e!==void 0&&Object.hasOwnProperty.call(e,"failureMessage")}var ka=function(){function e(t){this._parserContext=t,this._configuration=t.configuration,this._currentSection=t.docComment.summarySection}return e.prototype.parse=function(){for(var t=new Ki(this._parserContext),r=!1;!r;)switch(t.peekTokenKind()){case f.EndOfInput:r=!0;break;case f.Newline:this._pushAccumulatedPlainText(t),t.readToken(),this._pushNode(new $r({parsed:!0,configuration:this._configuration,softBreakExcerpt:t.extractAccumulatedSequence()}));break;case f.Backslash:this._pushAccumulatedPlainText(t),this._pushNode(this._parseBackslashEscape(t));break;case f.AtSign:this._pushAccumulatedPlainText(t),this._parseAndPushBlock(t);break;case f.LeftCurlyBracket:{this._pushAccumulatedPlainText(t);var i=t.createMarker(),n=this._parseInlineTag(t),a=this._parserContext.docComment;if(n instanceof cr){var s=t.createMarker()-1;a.inheritDocTag===void 0?this._parserContext.docComment.inheritDocTag=n:this._pushNode(this._backtrackAndCreateErrorRange(t,i,s,w.ExtraInheritDocTag,"A doc comment cannot have more than one @inheritDoc tag"))}else this._pushNode(n);break}case f.RightCurlyBracket:this._pushAccumulatedPlainText(t),this._pushNode(this._createError(t,w.EscapeRightBrace,'The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag'));break;case f.LessThan:this._pushAccumulatedPlainText(t),t.peekTokenAfterKind()===f.Slash?this._pushNode(this._parseHtmlEndTag(t)):this._pushNode(this._parseHtmlStartTag(t));break;case f.GreaterThan:this._pushAccumulatedPlainText(t),this._pushNode(this._createError(t,w.EscapeGreaterThan,'The ">" character should be escaped using a backslash to avoid confusion with an HTML tag'));break;case f.Backtick:this._pushAccumulatedPlainText(t),t.peekTokenAfterKind()===f.Backtick&&t.peekTokenAfterAfterKind()===f.Backtick?this._pushNode(this._parseFencedCode(t)):this._pushNode(this._parseCodeSpan(t));break;default:t.readToken();break}this._pushAccumulatedPlainText(t),this._performValidationChecks()},e.prototype._performValidationChecks=function(){var t=this._parserContext.docComment;t.deprecatedBlock&&(Jr.hasAnyTextContent(t.deprecatedBlock)||this._parserContext.log.addMessageForTokenSequence(w.MissingDeprecationMessage,"The ".concat(t.deprecatedBlock.blockTag.tagName," block must include a deprecation message,")+" e.g. describing the recommended alternative",t.deprecatedBlock.blockTag.getTokenSequence(),t.deprecatedBlock)),t.inheritDocTag&&(t.remarksBlock&&this._parserContext.log.addMessageForTokenSequence(w.InheritDocIncompatibleTag,'A "'.concat(t.remarksBlock.blockTag.tagName,'" block must not be used, beca
`,e.console_msg))});t.messageEl.appendChild(r)}var C=class extends Error{constructor(t,r){super(t);this.console_msg=r;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}};async function de(e,t){try{return await e()}catch(r){return r instanceof C?le(r):le(new C(t,r instanceof Error?r.message:void 0)),null}}function je(e,t){try{return e()}catch(r){return le(new C(t,r instanceof Error?r.message:void 0)),null}}var me=$(require("obsidian"));function lt(e){return new Promise(t=>window.setTimeout(t,e))}function Ea(){return/(<%(?:-|_)?\s*[*~]{0,1})\+((?:.|\s)*?%>)/g}function Yi(e,t){t=(0,me.normalizePath)(t);let r=e.vault.getAbstractFileByPath(t);if(!r)throw new C(`Folder "${t}" doesn't exist`);if(!(r instanceof me.TFolder))throw new C(`${t} is a file, not a folder`);return r}function pt(e,t){t=(0,me.normalizePath)(t);let r=e.vault.getAbstractFileByPath(t);if(!r)throw new C(`File "${t}" doesn't exist`);if(!(r instanceof me.TFile))throw new C(`${t} is a folder, not a file`);return r}function Re(e,t){let r=Yi(e,t),i=[];return me.Vault.recurseChildren(r,n=>{n instanceof me.TFile&&i.push(n)}),i.sort((n,a)=>n.path.localeCompare(a.path)),i}async function Sa(e,t){return await Promise.all(t.map(async i=>{let n=await e.vault.cachedRead(i);return ic(i,n)}))}function ic(e,t){let r=zi(t),i=new $i(e);return i.description=r.description,i.returns=r.returns,i.arguments=r.arguments,i}function zi(e){let r=new Ui().parseString(e);return{description:nc(r.docComment.summarySection),returns:ac(r.docComment.returnsBlock),arguments:sc(r.docComment.params)}}function nc(e){try{return e.nodes.map(r=>r.getChildNodes().filter(i=>i instanceof Me).map(i=>i.text).join(`
2026-01-05 13:03:55 +08:00
`)).join(`
`)}catch{return console.error("Failed to parse summary section"),""}}function ac(e){if(!e)return"";try{let t=e.content.nodes[0]?.getChildNodes()[0];return t instanceof Me?t.text.trim():""}catch{return""}}function sc(e){try{return e.blocks.map(i=>{let n=i.parameterName,a=i.content.getChildNodes()[0].getChildNodes().filter(s=>s instanceof Me).map(s=>s.text).join(" ");return new Gi(n,a)})}catch{return[]}}function Wi(e,t,r){if(r<0||r===e.length)return;let i=e.splice(t,1)[0];e.splice(r,0,i)}function ft(e){return e.workspace.activeEditor?.file??e.workspace.getActiveFile()}function Xr(e){let t=e.lastIndexOf("/");return t!==-1?e.slice(0,t):""}function ue(e){return e!==null&&typeof e=="object"}function Ca(e){let t=e.toString(),r=t.indexOf("(");return t.substring(r+1,t.indexOf(")")).replace(/ /g,"").split(",")}function Ji(e,t,r){let i=e.instanceOf(HTMLOListElement)?"li":"p",n=e.createEl(i),a=e.createEl("b",{text:t});return n.appendChild(a),n.appendChild(activeDocument.createTextNode(`: ${r}`)),n}function Zr(e,t){if(Object.keys(t).length!==0){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r))if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r],n=t[r];if(Array.isArray(i)||Array.isArray(n)){let a=Array.isArray(i)?i:[i],s=Array.isArray(n)?n:[n];e[r]=a.concat(s).unique()}else ue(i)&&ue(n)?Zr(i,n):n!=null&&n!==""&&(e[r]=n)}else e[r]=t[r]}}function dr(e){let t={},r=(0,me.getFrontMatterInfo)(e);if(r.frontmatter)try{t=(0,me.parseYaml)(r.frontmatter)}catch{return{frontmatter:t,content:e}}return{frontmatter:t,content:e.slice(r.contentStart)}}var ei=$(require("obsidian")),Qi=class extends ei.ConfirmationModal{constructor(t,r,i,n){super(t);this.setTitle(r),this.modalEl.addClass("templater-confirm-dangerous-setting-modal"),this.contentEl.createEl("p",{text:i}),this.contentEl.createEl("p",{text:"Only enable this if you trust the current and future contents of this vault, including files you may later download, copy, or sync from other people.",cls:"mod-warning"}),this.contentEl.createEl("p",{text:"This setting is stored on this device only; enable it separately on each device where you use this vault."});let a;ei.Platform.isMobile?this.addButton(s=>{a=s,s.setButtonText("I understand the risks, enable").setCta().onClick(async()=>{await n()})}):this.addCheckbox("I understand the risks",s=>{a.setDisabled(!s)}).addButton(s=>{a=s,s.setButtonText("Enable").setCta().setDisabled(!0).onClick(async()=>{await n()})}),this.addCancelButton()}};var Ut=$(require("obsidian"));var ti=$(require("obsidian"));var ge;(function(r){r[r.TemplateFiles=0]="TemplateFiles",r[r.ScriptFiles=1]="ScriptFiles"})(ge||(ge={}));var Xe=class extends ti.AbstractInputSuggest{constructor(t,r,i){super(r.app,t);this.inputEl=t;this.plugin=r;this.mode=i}get_folder(t){switch(t){case 0:return this.plugin.settings.templates_folder;case 1:return this.plugin.settings.user_scripts_folder}}get_error_msg(t){switch(t){case 0:return"Templates folder doesn't exist";case 1:return"User Scripts folder doesn't exist"}}getSuggestions(t){let r=je(()=>Re(this.plugin.app,this.get_folder(this.mode)),this.get_error_msg(this.mode));if(!r)return[];let i=[],n=t.toLowerCase();return r.forEach(a=>{a instanceof ti.TFile&&a.extension==="md"&&a.path.toLowerCase().includes(n)&&i.push(a)}),i.slice(0,1e3)}renderSuggestion(t,r){r.setText(t.path)}selectSuggestion(t){this.setValue(t.path),this.inputEl.trigger("input"),this.close()}};var Xi=class extends Ut.Modal{constructor(t,r,i,n){super(t);this.plugin=r;this.onSubmit=n;this.regex=i.regex,this.template=i.template}onOpen(){this.setTitle("File regex template"),this.modalEl.addClass("templater-file-regex-template-modal");let{contentEl:t}=this,r=new Ut.Setting(t).setName("File regex").setDesc("Regex to match on. Tests against full file path relative to the root of the vault, including file extension.").addText(n=>{n.setPlaceholder("File regex").setValue(this.regex).onChange(a=>{this.regex=a})}),i=new Ut.Setting(t).setName("Template").setDesc("Template to apply on match.").addText(n=>{new Xe(n.inputEl,this.plugin,ge.TemplateFiles),n.setPlaceholder("Template").se
> \u2014 ${l}`}catch{return new C("Error generating daily quote"),"Error generating daily quote"}}}generate_random_picture(){return async(t,r,i=!1)=>{try{let n=await this.getRequest(`https://templater-unsplash-2.fly.dev/${r?"?q="+r:""}`).then(s=>s.json),a=n.full;if(t&&!i)if(t.includes("x")){let[s,c]=t.split("x");a=a.concat(`&w=${s}&h=${c}`)}else a=a.concat(`&w=${t}`);return i?`![photo by ${n.photog}(${n.photogUrl}) on Unsplash|${t}](${a})`:`![photo by ${n.photog}(${n.photogUrl}) on Unsplash](${a})`}catch{return new C("Error generating random picture"),"Error generating random picture"}}}generate_request(){return async(t,r)=>{try{let n=(await this.getRequest(t)).json;return r&&n?r.split(".").reduce((a,s)=>{if(Object.prototype.hasOwnProperty.call(a,s))return a[s];throw new Error(`Path ${r} not found in the JSON response`)},n):n}catch(i){throw console.error(i),new C("Error fetching and extracting value")}}}};var dn=class extends he{constructor(){super(...arguments);this.name="hooks";this.event_refs=[]}async create_static_templates(){this.static_functions.set("on_all_templates_executed",this.generate_on_all_templates_executed())}async create_dynamic_templates(){}async teardown(){this.event_refs.forEach(t=>{t.e.offref(t)}),this.event_refs=[]}generate_on_all_templates_executed(){return t=>{let r=this.plugin.app.workspace.on("templater:all-templates-executed",async()=>{await lt(1),t()});r&&this.event_refs.push(r)}}};var mn=class extends he{constructor(){super(...arguments);this.name="frontmatter"}async create_static_templates(){}async create_dynamic_templates(){let t=this.plugin.app.metadataCache.getFileCache(this.config.target_file);this.dynamic_functions=new Map(Object.entries(t?.frontmatter||{}))}async teardown(){}};var He=$(require("obsidian"));var gn=class extends He.Modal{constructor(t,r,i,n,a){super(t);this.prompt_text=r;this.default_value=i;this.multi_line=n;this.select_default_value=a;this.submitted=!1}onOpen(){this.titleEl.setText(this.prompt_text),this.createForm()}onClose(){this.contentEl.empty(),this.submitted||this.reject(new C("Cancelled prompt"))}createForm(){let t=this.contentEl.createDiv();t.addClass("templater-prompt-div");let r;this.multi_line?r=new He.TextAreaComponent(t):r=new He.TextComponent(t);let i=this.contentEl.createDiv();i.addClass("templater-button-div");let n=new He.ButtonComponent(i);n.buttonEl.addClass("mod-cta"),n.setButtonText("Submit").onClick(a=>{this.resolveAndClose(a)}),this.value=this.default_value??"",r.inputEl.addClass("templater-prompt-input"),r.setPlaceholder("Type text here"),r.setValue(this.value),r.onChange(a=>this.value=a),r.inputEl.focus(),this.select_default_value&&r.inputEl.select(),r.inputEl.addEventListener("keydown",a=>this.enterCallback(a))}enterCallback(t){t.isComposing||t.keyCode===229||(this.multi_line?He.Platform.isDesktop&&t.key==="Enter"&&!t.shiftKey&&this.resolveAndClose(t):t.key==="Enter"&&this.resolveAndClose(t))}resolveAndClose(t){this.submitted=!0,t.preventDefault(),this.resolve(this.value),this.close()}async openAndGetValue(t,r){this.resolve=t,this.reject=r,this.open()}};var $a=$(require("obsidian")),An=class extends $a.FuzzySuggestModal{constructor(t,r,i,n,a,s){super(t);this.text_items=r;this.items=i;this.default_value=s;this.submitted=!1;this.containerEl.addClass("templater-suggester-modal"),this.setPlaceholder(n),a&&(this.limit=a)}getItems(){return this.items}onOpen(){super.onOpen(),this.default_value!==void 0&&(this.inputEl.value=this.getItemText(this.default_value),this.inputEl.dispatchEvent(new InputEvent("input")))}onClose(){this.submitted||this.reject(new C("Cancelled prompt"))}selectSuggestion(t,r){this.submitted=!0,this.close(),this.onChooseSuggestion(t,r)}getItemText(t){return this.text_items instanceof Function?this.text_items(t):this.text_items[this.items.indexOf(t)]||"Undefined Text Item"}onChooseItem(t){this.resolve(t)}async openAndGetValue(t,r){this.resolve=t,this.reject=r,this.open()}};var be=$(require("obsidian")),_n=class extends be.Modal{constructor(t,r,i,n,a,s){super(t);this.text_items=r;this.items=i;this.submitted=!1;this.selectedItems=[]
})`)(i,a,n)}catch(l){throw new C(`Failed to load user script at "${t.path}".`,l instanceof Error?l.message:String(l))}let c=n.default??a.exports;if(!c)throw new C(`Failed to load user script at "${t.path}". No exports detected.`);if(typeof c=="function")r.set(t.basename,c);else if(typeof c=="object"&&c!==null){if(!Object.values(c).every(h=>typeof h=="function"))throw new C(`Exported object in "${t.path}" must contain only functions.`);r.set(t.basename,c)}else throw new C(`Invalid export in "${t.path}". Must be a function or object of functions.`)}async generate_object(){let t=await this.generate_user_script_functions();return Object.fromEntries(t)}};var kn=class{constructor(t){this.plugin=t;this.user_system_functions=new bn(t),this.user_script_functions=new wn(t)}async generate_object(t){let r={},i={};return Ve(this.plugin.app).enable_system_commands&&(r=await this.user_system_functions.generate_object(t)),this.plugin.settings.user_scripts_folder&&(i=await this.user_script_functions.generate_object()),{...r,...i}}};var cc=$(require("obsidian")),Ke;(function(r){r[r.INTERNAL=0]="INTERNAL",r[r.USER_INTERNAL=1]="USER_INTERNAL"})(Ke||(Ke={}));var jn=class{constructor(t){this.plugin=t;this.internal_functions=new vn(this.plugin),this.user_functions=new kn(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{app:this.plugin.app,obsidian:cc}}async generate_object(t,r=1){let i={},n=this.additional_functions(),a=await this.internal_functions.generate_object(t),s={};switch(Object.assign(i,n),r){case 0:Object.assign(i,a);break;case 1:s=await this.user_functions.generate_object(t),Object.assign(i,{...a,user:s});break}return i}};var _c={},S,Fe=new Array(32).fill(void 0);Fe.push(void 0,null,!0,!1);function we(e){return Fe[e]}var _r=Fe.length;function uc(e){e<36||(Fe[e]=_r,_r=e)}function Tn(e){let t=we(e);return uc(e),t}var Ya=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Ya.decode();var ai=new Uint8Array;function si(){return ai.byteLength===0&&(ai=new Uint8Array(S.memory.buffer)),ai}function ht(e,t){return Ya.decode(si().subarray(e,e+t))}function dt(e){_r===Fe.length&&Fe.push(Fe.length+1);let t=_r;return _r=Fe[t],Fe[t]=e,t}var Be=0,oi=new TextEncoder("utf-8"),lc=typeof oi.encodeInto=="function"?function(e,t){return oi.encodeInto(e,t)}:function(e,t){let r=oi.encode(e);return t.set(r),{read:e.length,written:r.length}};function rt(e,t,r){if(r===void 0){let c=oi.encode(e),l=t(c.length);return si().subarray(l,l+c.length).set(c),Be=c.length,l}let i=e.length,n=t(i),a=si(),s=0;for(;s<i;s++){let c=e.charCodeAt(s);if(c>127)break;a[n+s]=c}if(s!==i){s!==0&&(e=e.slice(s)),n=r(n,i,i=s+e.length*3);let c=si().subarray(n+s,n+i);s+=lc(e,c).written}return Be=s,n}function pc(e){return e==null}var ci=new Int32Array;function ke(){return ci.byteLength===0&&(ci=new Int32Array(S.memory.buffer)),ci}function En(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let n=e.description;return n==null?"Symbol":`Symbol(${n})`}if(t=="function"){let n=e.name;return typeof n=="string"&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(e)){let n=e.length,a="[";n>0&&(a+=En(e[0]));for(let s=1;s<n;s++)a+=", "+En(e[s]);return a+="]",a}let r=/\[object ([^\]]+)\]/.exec(toString.call(e)),i;if(r.length>1)i=r[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
${e.stack}`:i}function fc(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`);return e.ptr}var ui=32;function hc(e){if(ui==1)throw new Error("out of js stack");return Fe[--ui]=e,ui}function Sn(e,t){try{return e.apply(this,t)}catch(r){S.__wbindgen_exn_store(dt(r))}}var St=class{static __wrap(t){let r=Object.create(St.prototype);return r.ptr=t,r}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();S.__wbg_parserconfig_free(t)}get interpolate(){let t=S.__wbg_get_parserconfig_interpolate(this.ptr);return String.fromCodePoint(t)}set interpolate(t){S.__wbg_set_parserconfig_interpolate(this.ptr,t.codePointAt(0))}get execution(){let t=S.__wbg_get_parserconfig_execution(this.ptr);return String.fromCodePoint(t)}set execution(t){S.__wbg_set_parserconfig_execution(this.ptr,t.codePointAt(0))}get single_whitespace(){let t=S.__wbg_get_parserconfig_single_whitespace(this.ptr);return String.fromCodePoint(t)}set single_whitespace(t){S.__wbg_set_parserconfig_single_whitespace(this.ptr,t.codePointAt(0))}get multiple_whitespace(){let t=S.__wbg_get_parserconfig_multiple_whitespace(this.ptr);return String.fromCodePoint(t)}set multiple_whitespace(t){S.__wbg_set_parserconfig_multiple_whitespace(this.ptr,t.codePointAt(0))}constructor(t,r,i,n,a,s,c){let l=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),h=Be,m=rt(r,S.__wbindgen_malloc,S.__wbindgen_realloc),_=Be,k=rt(c,S.__wbindgen_malloc,S.__wbindgen_realloc),F=Be,O=S.parserconfig_new(l,h,m,_,i.codePointAt(0),n.codePointAt(0),a.codePointAt(0),s.codePointAt(0),k,F);return St.__wrap(O)}get opening_tag(){try{let i=S.__wbindgen_add_to_stack_pointer(-16);S.parserconfig_opening_tag(i,this.ptr);var t=ke()[i/4+0],r=ke()[i/4+1];return ht(t,r)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_free(t,r)}}set opening_tag(t){let r=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),i=Be;S.parserconfig_set_opening_tag(this.ptr,r,i)}get closing_tag(){try{let i=S.__wbindgen_add_to_stack_pointer(-16);S.parserconfig_closing_tag(i,this.ptr);var t=ke()[i/4+0],r=ke()[i/4+1];return ht(t,r)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_free(t,r)}}set closing_tag(t){let r=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),i=Be;S.parserconfig_set_closing_tag(this.ptr,r,i)}get global_var(){try{let i=S.__wbindgen_add_to_stack_pointer(-16);S.parserconfig_global_var(i,this.ptr);var t=ke()[i/4+0],r=ke()[i/4+1];return ht(t,r)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_free(t,r)}}set global_var(t){let r=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),i=Be;S.parserconfig_set_global_var(this.ptr,r,i)}},zt=class{static __wrap(t){let r=Object.create(zt.prototype);return r.ptr=t,r}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();S.__wbg_renderer_free(t)}constructor(t){fc(t,St);var r=t.ptr;t.ptr=0;let i=S.renderer_new(r);return zt.__wrap(i)}render_content(t,r){try{let s=S.__wbindgen_add_to_stack_pointer(-16),c=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),l=Be;S.renderer_render_content(s,this.ptr,c,l,hc(r));var i=ke()[s/4+0],n=ke()[s/4+1],a=ke()[s/4+2];if(a)throw Tn(n);return Tn(i)}finally{S.__wbindgen_add_to_stack_pointer(16),Fe[ui++]=void 0}}};async function dc(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function mc(){let e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(t){Tn(t)},e.wbg.__wbindgen_string_new=function(t,r){let i=ht(t,r);return dt(i)},e.wbg.__wbindgen_string_get=function(t,r){let i=we
${(0,X.stringifyYaml)(F)}---
`),_+=k+h,a.editor.setValue(_),a.editor.setSelection({line:0,ch:0},{line:0,ch:0}),await lt(100),await n.save()}else await this.plugin.app.vault.process(r,_=>{let k="",{content:F,frontmatter:O}=dr(_);return Zr(O,m),Object.keys(O).length>0&&(k+=`---
${(0,X.stringifyYaml)(O)}---
`),k+=F+h,l=k,k});this.plugin.app.workspace.trigger("templater:new-note-from-template",{file:r,content:l}),await this.plugin.editor_handler.jump_to_next_cursor_location(r,!0),this.plugin.settings.jump_to_cursor_after_file_name&&a?.editor&&a.editor.focus(),await this.end_templater_task(i)}async overwrite_active_file_commands(){let t=this.plugin.app.workspace.activeEditor;if(!t||!t.file){le(new C("Active editor is null, can't overwrite content"));return}await this.overwrite_file_commands(t.file,!0)}async overwrite_file_commands(t,r=!1){let{path:i}=t;this.start_templater_task(i);let n=this.create_running_config(t,t,r?3:2),a=await de(async()=>this.read_and_parse_template(n),"Template parsing error, aborting.");if(a==null){await this.end_templater_task(i);return}await this.plugin.app.vault.modify(t,a),this.plugin.app.workspace.trigger("templater:overwrite-file",{file:t,content:a}),await this.plugin.editor_handler.jump_to_next_cursor_location(t,!0),await this.end_templater_task(i)}async process_dynamic_templates(t,r){let i=Ea(),n=activeDocument.createNodeIterator(t,NodeFilter.SHOW_TEXT),a,s=!1,c;for(;a=n.nextNode();){let l=a.nodeValue;if(l!==null){let h=i.exec(l);if(h!==null){let m=this.plugin.app.metadataCache.getFirstLinkpathDest("",r.sourcePath);if(!m||!(m instanceof X.TFile))return;if(!s){s=!0;let _=this.create_running_config(m,m,4);c=await this.functions_generator.generate_object(_,Ke.USER_INTERNAL),this.current_functions_object=c}}for(;h!=null;){let m=h[1]+h[2],_=await de(async()=>await this.parser.parse_commands(m,c),`Command Parsing error in dynamic command '${m}'`);if(_==null)return;let k=i.lastIndex-h[0].length,F=i.lastIndex;l=l.substring(0,k)+_+l.substring(F),i.lastIndex+=_.length-h[0].length,h=i.exec(l)}a.nodeValue=l}}}get_new_file_template_for_folder(t){let r=t;for(;r instanceof X.TFolder;){let i=r,n=this.plugin.settings.folder_templates.find(a=>a.folder==i.path);if(n&&n.template)return n.template;r=r.parent}}get_new_file_template_for_file(t){let r=this.plugin.settings.file_templates.find(i=>new RegExp(i.regex).test(t.path));if(r&&r.template)return r.template}static async on_file_creation(t,r,i){if(!Ve(r).trigger_on_file_creation||!(i instanceof X.TFile)||i.extension!=="md")return;let n=(0,X.normalizePath)(t.plugin.settings.templates_folder);if(i.path.includes(n)&&n!=="/")return;for(let l of t.plugin.settings.ignore_folders_on_creation){let h=(0,X.normalizePath)(l.folder);if(i.path.startsWith(h)&&h!=="")return}if(await lt(300),t.files_with_pending_templates.has(i.path))return;let a=await r.vault.read(i),s=(0,X.getFrontMatterInfo)(a),c=a.length-s.contentStart;if(c==0&&t.plugin.settings.trigger_on_file_creation_mode==="folder"){if(!(i.parent instanceof X.TFolder))return;let l=t.get_new_file_template_for_folder(i.parent);if(!l)return;let h=await de(async()=>pt(r,l),`Couldn't find template ${l}`);if(h==null)return;await t.write_template_to_file(h,i)}else if(c==0&&t.plugin.settings.trigger_on_file_creation_mode==="regex"){let l=t.get_new_file_template_for_file(i);if(!l)return;let h=await de(async()=>pt(r,l),`Couldn't find template ${l}`);if(h==null)return;await t.write_template_to_file(h,i)}else{let l=1e5;i.stat.size<=l?await t.overwrite_file_commands(i):console.debug(`Templater skipped parsing ${i.path} because file size exceeds ${l}`)}}async execute_startup_scripts(){if(!!Ve(this.plugin.app).enable_startup_templates)for(let t of this.plugin.settings.startup_templates){if(!t)continue;let r=je(()=>pt(this.plugin.app,t),`Couldn't find startup template "${t}"`);if(!r)continue;let{path:i}=r;this.start_templater_task(i);let n=this.create_running_config(r,r,5);await de(async()=>this.read_and_parse_template(n),"Startup Template parsing error, aborting."),await this.end_templater_task(i)}}};var Jt=$(require("obsidian"));var li=class{constructor(t,r){this.plugin=t;this.templater=r}async setup(){this.plugin.app.workspace.onLayoutReady(async()=>{if(Ve(this.plugin.app).trigger_on_file_creation&&this.plugin.app.vault.getConfig("openBehavior")==="daily"){let r=this.plugin.app.internalPlugins.getEnabledPluginById("daily-notes");if(
`,s+1))!==-1;n++,a=s);a+=1;let c=t.slice(a,r).length;return{line:n,ch:c}}get_cursor_matches_and_positions(t){let r=/<%\s*tp\.file\.cursor\((?<order>(?:-?[0-9]+(?:\.[0-9]+)?)?)\)\s*%>/g,i=[],n;for(;(n=r.exec(t))!==null;)i.push(n);if(i.length===0)return{};let a=_=>Number(_.groups?.order||0),s=_=>(_.groups?.order??"")===""?"":String(a(_));i.sort((_,k)=>a(_)-a(k));let c=s(i[0]),l=c===""?[i[0]]:i.filter(_=>s(_)===c),h=[],m=0;for(let _ of l){let k=_.index-m;h.push(this.get_editor_position_from_index(t,k)),t=t.slice(0,k)+t.slice(k+_[0].length),m+=_[0].length}return{cursor_matches:l,positions:h}}};var Us=$(require("obsidian"));var yc=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Qa=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],vc="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),is(t.onToken)){var i=t.onToken;t.onToken=function(n){return i.push(n)}}if(is(t.onComment)&&(t.onComment=Pc(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function Pc(e,t){return function(r,i,n,a,s,c){var l={type:r?"Block":"Line",value:i,start:n,end:a};e.locations&&(l.loc=new pi(this,s,c)),e.ranges&&(l.range=[n,a]),t.push(l)}}var Pt=1,It=2,qn=4,os=8,Ln=16,cs=32,fi=64,us=128,Nt=256,yr=512,ls=1024,hi=Pt|It|Nt;function Rn(e,t){return It|(e?qn:0)|(t?os:0)}var di=0,Vn=1,nt=2,ps=3,fs=4,hs=5,ne=function(t,r,i){this.options=t=Cc(t),this.sourceFile=t.sourceFile,this.keywords=gt(bc[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==!0&&(n=Dn[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=gt(n);var a=(n?n+" ":"")+Dn.strict;this.reservedWordsStrict=gt(a),this.reservedWordsStrictBind=gt(a+" "+Dn.strictBind),this.input=String(r),this.containsEsc=!1,i?(this.pos=i,this.lineStart=this.input.lastIndexOf(`
`,i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(_e).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=u.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||t.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?It:Pt),this.regexpState=null,this.privateNameStack=[]},Se={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};ne.prototype.parse=function(){var t=this,r=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return t.parseTopLevel(r)})};Se.inFunction.get=function(){return(this.currentVarScope().flags&It)>0};Se.inGenerator.get=function(){return(this.currentVarScope().flags&os)>0};Se.inAsync.get=function(){return(this.currentVarScope().flags&qn)>0};Se.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],r=t.flags;if(r&(Nt|yr))return!1;if(r&It)return(r&qn)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Se.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Pt)};Se.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&fi)>0||this.options.allowSuperOutsideMethod};Se.allowDirectSuper.get=function(){return(this.currentThisScope().flags&us)>0};Se.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Se.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],r=t.flags;if(r&(Nt|yr)||r&It&&!(r&Ln))return!0}return!1};Se.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&ls||!this.inModule&&t&Pt)};Se.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Nt)>0};ne.extend=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];for(var i=this,n=0;n<t.length;n++)i=t[n](i);return i};ne.parse=function(t,r){return new this(r,t).parse()};ne.parseExpressionAt=function(t,r,i){var n=new this(i,t,r);return n.nextToken(),n.parseExpression()};ne.tokenizer=function(t,r){return new this(r,t)};Object.defineProperties(ne.prototype,Se);var pe=ne.prototype,Ic=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;pe.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){se.lastIndex=e,e+=se.exec(this.input)[0].length;var t=Ic.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){se.lastIndex=e+t[0].length;var r=se.exec(this.input),i=r.index+r[0].length,n=this.input.charAt(i);return n===";"||n==="}"||_e.test(r[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(i+1)==="=")}e+=t[0].length,se.lastIndex=e,e+=se.exec(this.input)[0].length,this.input[e]===";"&&e++}};pe.eat=function(e){return this.type===e?(this.next(),!0):!1};pe.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc};pe.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};pe.catchStackOverflow=function(e){try{return e()}catch(t){if(t instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(t.message)||/\btoo much recursion\b/i.test(t.message)))this.raise(this.start,"Not enough stack space to parse input");else throw t}};pe.expectContextual=function(e){this.eat
`),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
`),cooked:this.value},this.next(),r.tail=this.type===u.backQuote,this.finishNode(r,"TemplateElement")};N.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var i=this.parseTemplateElement({isTagged:t});for(r.quasis=[i];!i.tail;)this.type===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(u.braceR),r.quasis.push(i=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")};N.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===u.name||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===u.star)&&!_e.test(this.input.slice(this.lastTokEnd,this.start))};N.parseObj=function(e,t){var r=this.startNode(),i=!0,n={};for(r.properties=[],this.next();!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(u.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,n,t),r.properties.push(a)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")};N.parseProperty=function(e,t){var r=this.startNode(),i,n,a,s;if(this.options.ecmaVersion>=9&&this.eat(u.ellipsis))return e?(r.argument=this.parseIdent(!1),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(r,"RestElement")):(r.argument=this.parseMaybeAssign(!1,t),this.type===u.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(r,"SpreadElement"));this.options.ecmaVersion>=6&&(r.method=!1,r.shorthand=!1,(e||t)&&(a=this.start,s=this.startLoc),e||(i=this.eat(u.star)));var c=this.containsEsc;return this.parsePropertyName(r),!e&&!c&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(r)?(n=!0,i=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(r)):n=!1,this.parsePropertyValue(r,e,i,n,a,s,t,c),this.finishNode(r,"Property")};N.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var r=e.kind==="get"?0:1;if(e.value.params.length!==r){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};N.parsePropertyValue=function(e,t,r,i,n,a,s,c){(r||i)&&this.type===u.colon&&this.unexpected(),this.eat(u.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===u.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(r,i),e.kind="init"):!t&&!c&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==u.comma&&this.type!==u.braceR&&this.type!==u.eq?((r||i)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((r||i)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=n),t?e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key)):this.type===u.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()};N.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(u.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(u.bracketR),e.key;e.computed=!1}return e.key=this.type===u.num||this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};N.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};N.parseMethod=function(e,t,r){var i=this.startNode(
`;break;default:e+=String.fromCharCode(r);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};q.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(u.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
`&&++this.pos;case`
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};q.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return it(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var r=this.pos-1;this.invalidStringToken(r,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(i,8);return n>255&&(i=i.slice(0,-1),n=parseInt(i,8)),this.pos+=i.length-1,t=this.input.charCodeAt(this.pos),(i!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-i.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return Qt(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};q.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return r===null&&this.invalidStringToken(t,"Bad character escape sequence"),r};q.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(mt(n,i))this.pos+=n<=65535?1:2;else if(n===92){this.containsEsc=!0,e+=this.input.slice(r,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var s=this.readCodePoint();(t?$e:mt)(s,i)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=it(s),r=this.pos}else break;t=!1}return e+this.input.slice(r,this.pos)};q.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=Bn[e]),this.finishToken(t,e)};var ru="8.17.0";ne.acorn={Parser:ne,version:ru,defaultOptions:On,Position:xr,SourceLocation:pi,getLineInfo:as,Node:_i,TokenType:K,tokTypes:u,keywordTypes:Bn,TokContext:Oe,tokContexts:Z,isIdentifierChar:mt,isIdentifierStart:$e,Token:Gn,isNewLine:Qt,lineBreak:_e,lineBreakG:jc,nonASCIIwhitespace:ts};function Yn(e,t){return ne.parse(e,t)}var iu={app:{name:"app",description:"This module exposes the app instance. Prefer to use this over the global app instance."},user:{name:"user",description:"This module exposes custom made scripts, written by yourself within the script file folder location"},config:{name:"config",description:`This module exposes Templater's running configuration.
2026-01-05 13:03:55 +08:00
This is mostly useful when writing scripts requiring some context information.
`,functions:{template_file:{name:"template_file",description:"The `TFile` object representing the template file.",definition:"tp.config.template_file"},target_file:{name:"target_file",description:"The `TFile` object representing the target file where the template will be inserted.",definition:"tp.config.target_file"},run_mode:{name:"run_mode",description:"The `RunMode`, representing the way Templater was launched (Create new from template, Append to active file, ...).",definition:"tp.config.run_mode"},active_file:{name:"active_file",description:"The active file (if existing) when launching Templater.",definition:"tp.config.active_file?"}}},date:{name:"date",description:"This module contains every internal function related to dates.",functions:{now:{name:"now",description:"Retrieves the date.",definition:'tp.date.now(format: string = "YYYY-MM-DD", offset?: number | string, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"offset",description:"Duration to offset the date from. If a number is provided, duration will be added to the date in days. You can also specify the offset as a string using the ISO 8601 format."},{name:"reference",description:"The date to use instead of today's date, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"Date now",example:"<% tp.date.now() %>"},{name:"Date now with format",example:'<% tp.date.now("Do MMMM YYYY") %>'},{name:"Last week",example:'<% tp.date.now("YYYY-MM-DD", -7) %>'},{name:"Next week",example:'<% tp.date.now("YYYY-MM-DD", 7) %>'},{name:"Last month",example:'<% tp.date.now("YYYY-MM-DD", "P-1M") %>'},{name:"Next year",example:'<% tp.date.now("YYYY-MM-DD", "P1Y") %>'},{name:"File's title date + 1 day (tomorrow)",example:'<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>'},{name:"File's title date - 1 day (yesterday)",example:'<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>'}]},tomorrow:{name:"tomorrow",description:"Retrieves tomorrow's date.",definition:'tp.date.tomorrow(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date tomorrow",example:"<% tp.date.tomorrow() %>"},{name:"Date tomorrow with format",example:'<% tp.date.tomorrow("Do MMMM YYYY") %>'}]},yesterday:{name:"yesterday",description:"Retrieves yesterday's date.",definition:'tp.date.yesterday(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date yesterday",example:"<% tp.date.yesterday() %>"},{name:"Date yesterday with format",example:'<% tp.date.yesterday("Do MMMM YYYY") %>'}]},weekday:{name:"weekday",description:"",definition:'tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"weekday",description:"Week day number. If the locale assigns Monday as the first day of the week, `0` will be Monday, `-7` will be last week's day."},{name:"reference",description:"The reference date to use instead of today, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"This week's Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0) %>'},{name:"Next Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 7)
2026-01-05 13:03:55 +08:00
You can navigate between the different cursors using the configured hotkey in Obsidian settings.
`,definition:"tp.file.cursor(order?: number)",args:[{name:"order",description:`The order of the different cursors jump, e.g. it will jump from 1 to 2 to 3, and so on.
If you specify multiple tp.file.cursor with the same order, the editor will switch to multi-cursor.
The order can be any number, including a decimal one, so you can insert a new jump between two existing ones without renumbering them, e.g. 1.5 jumps after 1 and before 2.
`}],examples:[{name:"File cursor",example:"<% tp.file.cursor() %>"},{name:"File multi-cursor",example:"<% tp.file.cursor(1) %>Content<% tp.file.cursor(1) %>"},{name:"File cursor with a decimal order",example:"<% tp.file.cursor(1) %>Content<% tp.file.cursor(1.5) %>Content<% tp.file.cursor(2) %>"}]},cursor_append:{name:"cursor_append",description:"Appends some content after the active cursor in the file.",definition:"tp.file.cursor_append(content: string)",args:[{name:"content",description:"The content to append after the active cursor."}],examples:[{name:"File cursor append",example:'<% tp.file.cursor_append("Some text") %>'}]},exists:{name:"exists",description:"Check to see if a file exists by it's file path. The full path to the file, relative to the Vault and containing the extension, must be provided.",definition:"tp.file.exists(filepath: string)",args:[{name:"filepath",description:"The full file path of the file we want to check existence for."}],examples:[{name:"File existence",example:'<% await tp.file.exists("MyFolder/MyFile.md") %>'},{name:"File existence of current file",example:'<% await tp.file.exists(tp.file.folder(true) + "/" + tp.file.title + ".md") %>'}]},find_tfile:{name:"find_tfile",description:"Search for a file and returns its `TFile` instance.",definition:"tp.file.find_tfile(filename: string)",args:[{name:"filename",description:"The filename we want to search and resolve as a `TFile`."}],examples:[{name:"File find TFile",example:'<% tp.file.find_tfile("MyFile").basename %>'}]},folder:{name:"folder",description:"Retrieves the file's folder name.",definition:"tp.file.folder(absolute: boolean = false)",args:[{name:"absolute",description:"If set to `true`, returns the vault-absolute path of the folder. If `false`, only returns the basename of the folder (the last part). Defaults to `false`."}],examples:[{name:"File folder (Folder)",example:"<% tp.file.folder() %>"},{name:"File folder with vault-absolute path (Path/To/Folder)",example:"<% tp.file.folder(true) %>"}]},include:{name:"include",description:"Includes the file's link content. Templates in the included content will be resolved.",definition:"tp.file.include(include_link: string | TFile)",args:[{name:"include_link",description:'The link to the file to include, e.g. `"[[MyFile]]"`, or a TFile object. Also supports sections or blocks inclusions.'}],examples:[{name:"File include",example:'<% await tp.file.include("[[Template1]]") %>'},{name:"File include TFile",example:'<% await tp.file.include(tp.file.find_tfile("MyFile")) %>'},{name:"File include section",example:'<% await tp.file.include("[[MyFile#Section1]]") %>'},{name:"File include block",example:'<% await tp.file.include("[[MyFile#^block1]]") %>'}]},last_modified_date:{name:"last_modified_date",description:"Retrieves the file's last modification date.",definition:'tp.file.last_modified_date(format: string = "YYYY-MM-DD HH:mm")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD HH:mm"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"File last modified date",example:"<% tp.file.last_modified_date() %>"},{name:"File last modified date with format",example:'<% tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm") %>'}]},move:{name:"move",description:"Moves the file to the desired vault location.",definition:"tp.file.move(new_path: string, file_to_move?: TFile)",args:[{name:"new_path",description:'The new vault relative path of the file, without the file extension. Note: the new path needs to include the folder and the filename, e.g. `"/Notes/MyNote"`.'},{name:"file_to_move",description:"The file to move, defaults to the current file."}],examples:[{name:"File move",example:'<%* await tp.file.move("/A/B/" + tp.file.title) %>'},{name:"File move and rename",example:'<%* await tp.file.move("/A/B/NewTitle") %>'}]},path:{name:"path",description:"Retrieves the file's absolute path on the system.",definition:"tp.file.path(relative: boolean = false)",args:[{name:"relative",description:"If set to `true`, only retrieves the vau
2026-01-05 13:03:55 +08:00
let value = await tp.system.prompt("Please enter a value");
%>
# <% value %>
selected value: <% value %>`}]},suggester:{name:"suggester",description:"Spawns a suggester prompt and returns the user's chosen item.",definition:'tp.system.suggester(text_items: string[] | ((item: T) => string), items: T[], throw_on_cancel: boolean = false, placeholder: string = "", limit?: number = undefined, default_value?: T = undefined)',args:[{name:"text_items",description:"Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation."},{name:"items",description:"Array containing the values of each item in the correct order."},{name:"throw_on_cancel",description:"Throws an error if the prompt is canceled, instead of returning a `null` value."},{name:"placeholder",description:"Placeholder string of the prompt."},{name:"limit",description:"Limit the number of items rendered at once (useful to improve performance when displaying large lists)."},{name:"default_value",description:"Default value to initialize the suggester with."}],examples:[{name:"Suggester",example:'<% await tp.system.suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]) %>'},{name:"Suggester with mapping function (same as above example)",example:'<% await tp.system.suggester((item) => item, ["Happy", "Sad", "Confused"]) %>'},{name:"Suggester for files",example:"[[<% (await tp.system.suggester((item) => item.basename, tp.app.vault.getMarkdownFiles())).basename %>]]"},{name:"Suggester for tags",example:'<% await tp.system.suggester(item => item, Object.keys(tp.app.metadataCache.getTags()).map(x => x.replace("#", ""))) %>'},{name:"Reuse value from suggester",example:`<%*
2026-01-05 13:03:55 +08:00
let selectedValue = await tp.system.suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]);
%>
# <% selectedValue %>
selected value: <% selectedValue %>`},{name:"Default value for the suggester",example:`<%*
let selectedValue = await tp.system.suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"], false, "", undefined, "Confused");
%>
# <% selectedValue %>
selected value: <% selectedValue %>`}]},multi_suggester:{name:"multi_suggester",description:"Spawns a suggester prompt that supports selecting multiple items and returns the user's chosen items.",definition:'tp.system.multi_suggester(text_items: string[] | ((item: T) => string), items: T[], throw_on_cancel: boolean = false, title: string = "", limit?: number = undefined, default_values?: T[] = undefined)',args:[{name:"text_items",description:"Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation."},{name:"items",description:"Array containing the values of each item in the correct order."},{name:"throw_on_cancel",description:"Throws an error if the prompt is canceled, instead of returning a `null` value."},{name:"title",description:"Text placed at the top of the modal."},{name:"limit",description:"Limit the number of items rendered at once (useful to improve performance when displaying large lists)."},{name:"default_values",description:"Default values to initialize the suggester with."}],examples:[{name:"Multi-suggester",example:'<% await tp.system.multi_suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]) %>'},{name:"Multi-suggester with mapping function (same as above example)",example:'<% await tp.system.multi_suggester((item) => item, ["Happy", "Sad", "Confused"]) %>'},{name:"Multi-suggester for files",example:"<% (await tp.system.multi_suggester((item) => item.basename, tp.app.vault.getMarkdownFiles())).map(f => `[[${f.basename}]]`) %>"},{name:"Multi-suggester for tags",example:'<% await tp.system.multi_suggester(item => item, Object.keys(tp.app.metadataCache.getTags()).map(x => x.replace("#", ""))) %>'},{name:"Reuse value from multi-suggester",example:`<%*
2026-01-05 13:03:55 +08:00
let selectedValues = await tp.system.multi_suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]);
%>
# <% selectedValues %>
selected values: <% selectedValues %>`},{name:"Default value for the suggester",example:`<%*
let selectedValue = await tp.system.multi_suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"], false, "", undefined, ["Happy", "Confused"]);
%>
# <% selectedValue %>
selected value: <% selectedValue %>`}]}}},web:{name:"web",description:"This modules contains every internal function related to the web (making web requests).",functions:{daily_quote:{name:"daily_quote",description:"Retrieves and parses a daily quote as a callout. Without arguments it uses the language configured in Obsidian (via `getLanguage()`), falling back to English. English quotes come from `https://github.com/Zachatoo/quotes-database` and Spanish quotes from `https://github.com/wulflo/frases-inventario`.",definition:"tp.web.daily_quote(language?: string)",args:[{name:"language",description:'Optional language code (e.g. `"en"`, `"es"`) selecting the quotes database. Defaults to Obsidian\'s display language, falling back to English when no database is registered for that language.'}],examples:[{name:"Daily quote",example:"<% await tp.web.daily_quote() %>"},{name:"Daily quote in Spanish",example:'<% await tp.web.daily_quote("es") %>'}]},random_picture:{name:"random_picture",description:"Gets a random image from `https://unsplash.com/`.",definition:"tp.web.random_picture(size?: string, query?: string, include_size?: boolean)",args:[{name:"size",description:"Image size in the format `<width>x<height>`."},{name:"query",description:"Limits selection to photos matching a search term. Multiple search terms can be passed separated by a comma."},{name:"include_size",description:"Optional argument to include the specified size in the image link markdown. Defaults to false."}],examples:[{name:"Random picture",example:"<% await tp.web.random_picture() %>"},{name:"Random picture with size",example:'<% await tp.web.random_picture("200x200") %>'},{name:"Random picture with size and query",example:'<% await tp.web.random_picture("200x200", "landscape,water") %>'}]},request:{name:"request",description:"Makes a HTTP request to the specified URL. Optionally, you can specify a path to extract specific data from the response.",definition:"tp.web.request(url: string, path?: string)",args:[{name:"url",description:"The URL to which the HTTP request will be made."},{name:"path",description:"A path within the response JSON to extract specific data."}],examples:[{name:"Simple request",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos/1") %>'},{name:"Request with path",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos", "0.title") %>'}]}}}},Rs={tp:iu};var nu=["app","config","date","file","frontmatter","hooks","obsidian","system","user","web"],au=new Set(nu);function zn(e){return typeof e=="string"&&au.has(e)}function Vs(e){return!!(e.definition||e.returns||e.args)}var Wn=class{constructor(t){this.plugin=t;this.documentation=Rs}get_all_modules_documentation(){let t=this.documentation.tp,r=Object.values(t);return(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)&&(r=r.filter(i=>i.name!=="user")),r.map(i=>(i.queryKey=i.name,i))}async get_all_functions_documentation(t,r){if(t==="app")return this.get_app_functions_documentation(this.plugin.app,r);if(t==="user"){if(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)return;let i=await de(()=>Promise.resolve(Re(this.plugin.app,this.plugin.settings.user_scripts_folder).filter(s=>s.extension==="js")),"User Scripts folder doesn't exist");if(!i||i.length===0)return;let n=su(r);if(n){let s=i.find(c=>c.basename===n.scriptName);return s?ou(this.plugin,s,n.scriptName):[]}let a=await de(()=>Sa(this.plugin.app,i),"Failed to parse user script documentation");return!a||a.length===0?void 0:a.reduce((s,c)=>[...s,{name:c.basename,queryKey:c.basename,definition:"",description:c.description??"",returns:c.returns??"",args:Ks(c.arguments??[]),example:""}],[])}if(!!this.documentation.tp[t].functions)return Object.values(this.documentation.tp[t].functions).map(i=>(i.queryKey=i.name,i))}get_app_functions_documentation(t,r){if(!ue(t))return[];let i=r.split(".");if(i.length===0)return[];let n=t;for(let l=0;l<i.length-1;l++){let h=i[l];if(h in n){let m=n[h];if(!ue(m))return[];n=m}}let a=["tp","app",...i.slice(0,i.length-1)].join("."),s=i.slic
2026-01-05 13:03:55 +08:00
/* nosourcemap */