45 lines
332 KiB
JavaScript
45 lines
332 KiB
JavaScript
|
|
/*
|
||
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
|
|
if you want to view the source, please visit the github repository of this plugin
|
||
|
|
*/
|
||
|
|
|
||
|
|
var ja=Object.create;var Yn=Object.defineProperty;var va=Object.getOwnPropertyDescriptor;var wa=Object.getOwnPropertyNames;var ba=Object.getPrototypeOf,Ea=Object.prototype.hasOwnProperty;var zi=n=>Yn(n,"__esModule",{value:!0});var Ta=(n,e)=>{zi(n);for(var t in e)Yn(n,t,{get:e[t],enumerable:!0})},ka=(n,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of wa(e))!Ea.call(n,r)&&r!=="default"&&Yn(n,r,{get:()=>e[r],enumerable:!(t=va(e,r))||t.enumerable});return n},X=n=>ka(zi(Yn(n!=null?ja(ba(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var Ji=(()=>{for(var n=new Uint8Array(128),e=0;e<64;e++)n[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return t=>{for(var r=t.length,i=new Uint8Array((r-(t[r-1]=="=")-(t[r-2]=="="))*3/4|0),o=0,a=0;o<r;){var l=n[t.charCodeAt(o++)],c=n[t.charCodeAt(o++)],d=n[t.charCodeAt(o++)],m=n[t.charCodeAt(o++)];i[a++]=l<<2|c>>4,i[a++]=c<<4|d>>2,i[a++]=d<<6|m}return i}})();Ta(exports,{default:()=>qi});var Tr=X(require("obsidian"));var L=X(require("obsidian"));var Qi=X(require("obsidian"));function oe(n){let e=new Qi.Notice("",8e3),t=createFragment(r=>{r.createEl("b",{text:"Templater Error"}),r.createEl("span",{text:":"}),r.createEl("br"),r.createEl("span",{text:n.message}),n instanceof P&&n.console_msg&&(r.createEl("br"),r.createEl("span",{text:"Check console for more information"}),console.error("Templater Error:",n.message,`
|
||
|
|
`,n.console_msg))});e.noticeEl.appendChild(t)}var P=class extends Error{constructor(e,t){super(e);this.console_msg=t;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}};async function Se(n,e){try{return await n()}catch(t){return t instanceof P?oe(t):oe(new P(e,t.message)),null}}function Ce(n,e){try{return n()}catch(t){return oe(new P(e,t.message)),null}}var re=function(){function n(){}return n.explainIfInvalidTSDocTagName=function(e){if(e[0]!=="@")return'A TSDoc tag name must start with an "@" symbol';if(!n._tsdocTagNameRegExp.test(e))return"A TSDoc tag name must start with a letter and contain only letters and numbers"},n.validateTSDocTagName=function(e){var t=n.explainIfInvalidTSDocTagName(e);if(t)throw new Error(t)},n.explainIfInvalidLinkUrl=function(e){if(e.length===0)return"The URL cannot be empty";if(!n._urlSchemeRegExp.test(e))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(!n._urlSchemeAfterRegExp.test(e))return'An @link URL must have at least one character after "://"'},n.explainIfInvalidHtmlName=function(e){if(!n._htmlNameRegExp.test(e))return"An HTML name must be an ASCII letter followed by zero or more letters, digits, or hyphens"},n.validateHtmlName=function(e){var t=n.explainIfInvalidHtmlName(e);if(t)throw new Error(t)},n.explainIfInvalidPackageName=function(e){if(e.length===0)return"The package name cannot be an empty string";if(!n._validPackageNameRegExp.test(e))return"The package name ".concat(JSON.stringify(e)," is not a valid package name")},n.explainIfInvalidImportPath=function(e,t){if(e.length>0){if(e.indexOf("//")>=0)return'An import path must not contain "//"';if(e[e.length-1]==="/")return'An import path must not end with "/"';if(!t&&e[0]==="/")return'An import path must not start with "/" unless prefixed by a package name'}},n.isSystemSelector=function(e){return n._systemSelectors.has(e)},n.explainIfInvalidUnquotedIdentifier=function(e){if(e.length===0)return"The identifier cannot be an empty string";if(n._identifierBadCharRegExp.test(e))return"The identifier cannot non-word characters";if(n._identifierNumberStartRegExp.test(e))return"The identifier must not start with a number"},n.explainIfInvalidUnquotedMemberIdentifier=function(e){var t=n.explainIfInvalidUnquotedIdentifier(e);if(t!==void 0)return t;if(n.isSystemSelector(e))return'The identifier "'.concat(e,'" must be quoted because it is a TSDoc system selector name')},n._tsdocTagNameRegExp=/^@[a-z][a-z0-9]*$/i,n._urlSchemeRegExp=/^[a-z][a-z0-9]*\:\/\//i,n._urlSchemeAfterRegExp=/^[a-z][a-z0-9]*\:\/\/./i,n._htmlNameRegExp=/^[a-z]+[a-z0-9\-]*$/i,n._identifierBadCharRegExp=/[^a-z0-9_$]/i,n._identifierNumberStartRegExp=/^[0-9]/,n._validPackageNameRegExp=/^(?:@[a-z0-9\-_\.]+\/)?[a-z0-9\-_\.]+$/i,n._systemSelectors=new Set(["instance","static","constructor","class","enum","function","interface","namespace","type","variable"]),n}();var Nr=function(){function n(){this._docNodeDefinitionsByKind=new Map,this._docNodeDefinitionsByConstructor=new Map}return n.prototype.registerDocNodes=function(e,t){var r=re.explainIfInvalidPackageName(e);if(r)throw new Error("Invalid NPM package name: "+r);for(var i=0,o=t;i<o.length;i++){var a=o[i];if(!n._nodeKindRegExp.test(a.docNodeKind))throw new Error("The DocNode kind ".concat(JSON.stringify(a.docNodeKind)," is not a valid identifier.")+" It must start with an underscore or letter, and be comprised of letters, numbers, and underscores");var l=this._docNodeDefinitionsByKind.get(a.docNodeKind);if(l!==void 0)throw new Error('The DocNode kind "'.concat(a.docNodeKind,'" was already registered')+" by ".concat(l.packageName));if(l=this._docNodeDefinitionsByConstructor.get(a.constructor),l!==void 0)throw new Error("This DocNode constructor was already registered by ".concat(l.packageName)+" as ".concat(l.docNodeKind));var c={docNodeKind:a.docNodeKind,constructor:a.constructor,packageName:e,allowedChildKinds:new Set};this._docNodeDefinitionsByKind.set(a.docNodeKind
|
||
|
|
`:this.range.toString()},n}();var Ma=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),y;(function(n){n.Spacing="Spacing",n.BlockTag="BlockTag",n.CodeSpan_OpeningDelimiter="CodeSpan_OpeningDelimiter",n.CodeSpan_Code="CodeSpan_Code",n.CodeSpan_ClosingDelimiter="CodeSpan_ClosingDelimiter",n.DeclarationReference_PackageName="DeclarationReference_PackageName",n.DeclarationReference_ImportPath="DeclarationReference_ImportPath",n.DeclarationReference_ImportHash="DeclarationReference_ImportHash",n.ErrorText="ErrorText",n.NonstandardText="NonstandardText",n.EscapedText="EscapedText",n.FencedCode_OpeningFence="FencedCode_OpeningFence",n.FencedCode_Language="FencedCode_Language",n.FencedCode_Code="FencedCode_Code",n.FencedCode_ClosingFence="FencedCode_ClosingFence",n.HtmlAttribute_Name="HtmlAttribute_Name",n.HtmlAttribute_Equals="HtmlAttribute_Equals",n.HtmlAttribute_Value="HtmlAttribute_Value",n.HtmlEndTag_OpeningDelimiter="HtmlEndTag_OpeningDelimiter",n.HtmlEndTag_Name="HtmlEndTag_Name",n.HtmlEndTag_ClosingDelimiter="HtmlEndTag_ClosingDelimiter",n.HtmlStartTag_OpeningDelimiter="HtmlStartTag_OpeningDelimiter",n.HtmlStartTag_Name="HtmlStartTag_Name",n.HtmlStartTag_ClosingDelimiter="HtmlStartTag_ClosingDelimiter",n.InlineTag_OpeningDelimiter="InlineTag_OpeningDelimiter",n.InlineTag_TagName="InlineTag_TagName",n.InlineTag_TagContent="InlineTag_TagContent",n.InlineTag_ClosingDelimiter="InlineTag_ClosingDelimiter",n.LinkTag_UrlDestination="LinkTag_UrlDestination",n.LinkTag_Pipe="LinkTag_Pipe",n.LinkTag_LinkText="LinkTag_LinkText",n.MemberIdentifier_LeftQuote="MemberIdentifier_LeftQuote",n.MemberIdentifier_Identifier="MemberIdentifier_Identifier",n.MemberIdentifier_RightQuote="MemberIdentifier_RightQuote",n.MemberReference_Dot="MemberReference_Dot",n.MemberReference_LeftParenthesis="MemberReference_LeftParenthesis",n.MemberReference_Colon="MemberReference_Colon",n.MemberReference_RightParenthesis="MemberReference_RightParenthesis",n.MemberSelector="MemberSelector",n.DocMemberSymbol_LeftBracket="DocMemberSymbol_LeftBracket",n.DocMemberSymbol_RightBracket="DocMemberSymbol_RightBracket",n.ParamBlock_ParameterName="ParamBlock_ParameterName",n.ParamBlock_Hyphen="ParamBlock_Hyphen",n.PlainText="PlainText",n.SoftBreak="SoftBreak"})(y||(y={}));var j=function(n){Ma(e,n);function e(t){var r=n.call(this,t)||this;if(t.excerptKind===y.Spacing)for(var i=0,o=t.content.tokens;i<o.length;i++){var a=o[i];switch(a.kind){case u.Spacing:case u.Newline:case u.EndOfInput:break;default:throw new Error("The excerptKind=Spacing but the range contains a non-whitespace token")}}return r._excerptKind=t.excerptKind,r._content=t.content,r}return Object.defineProperty(e.prototype,"kind",{get:function(){return g.Excerpt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"excerptKind",{get:function(){return this._excerptKind},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),e}(T);var Oa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Un=function(n){Oa(e,n);function e(t){var r=n.call(this,t)||this;return re.validateTSDocTagName(t.tagName),r._tagName=t.tagName,r._tagNameWithUpperCase=t.tagName.toUpperCase(),T.isParsedParameters(t
|
||
|
|
`,this._emitCommentFraming=!0,this._lineState=he.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1}return n.prototype.renderComment=function(e,t){this._emitCommentFraming=!0,this._renderCompleteObject(e,t)},n.prototype.renderHtmlTag=function(e,t){this._emitCommentFraming=!1,this._renderCompleteObject(e,t)},n.prototype.renderDeclarationReference=function(e,t){this._emitCommentFraming=!1,this._renderCompleteObject(e,t)},n.prototype._renderCompleteObject=function(e,t){this._output=e,this._lineState=he.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1,this._renderNode(t),this._writeEnd()},n.prototype._renderNode=function(e){var t=this;if(e!==void 0)switch(e.kind){case g.Block:var r=e;this._ensureLineSkipped(),this._renderNode(r.blockTag),r.blockTag.tagNameWithUpperCase===G.returns.tagNameWithUpperCase&&(this._writeContent(" "),this._hangingParagraph=!0),this._renderNode(r.content);break;case g.BlockTag:var i=e;this._lineState===he.MiddleOfLine&&this._writeContent(" "),this._writeContent(i.tagName);break;case g.CodeSpan:var o=e;this._writeContent("`"),this._writeContent(o.code),this._writeContent("`");break;case g.Comment:var a=e;this._renderNodes(Lr(Lr(Lr([a.summarySection,a.remarksBlock,a.privateRemarks,a.deprecatedBlock,a.params,a.typeParams,a.returnsBlock],a.customBlocks,!0),a.seeBlocks,!0),[a.inheritDocTag],!1)),a.modifierTagSet.nodes.length>0&&(this._ensureLineSkipped(),this._renderNodes(a.modifierTagSet.nodes));break;case g.DeclarationReference:var l=e;this._writeContent(l.packageName),this._writeContent(l.importPath),(l.packageName!==void 0||l.importPath!==void 0)&&this._writeContent("#"),this._renderNodes(l.memberReferences);break;case g.ErrorText:var c=e;this._writeContent(c.text);break;case g.EscapedText:var d=e;this._writeContent(d.encodedText);break;case g.FencedCode:var m=e;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 _=e;this._writeContent(_.name),this._writeContent(_.spacingAfterName),this._writeContent("="),this._writeContent(_.spacingAfterEquals),this._writeContent(_.value),this._writeContent(_.spacingAfterValue);break;case g.HtmlEndTag:var w=e;this._writeContent("</"),this._writeContent(w.name),this._writeContent(">");break;case g.HtmlStartTag:var b=e;this._writeContent("<"),this._writeContent(b.name),this._writeContent(b.spacingAfterName);for(var S=b.spacingAfterName===void 0||b.spacingAfterName.length===0,k=0,E=b.htmlAttributes;k<E.length;k++){var O=E[k];S&&this._writeContent(" "),this._renderNode(O),S=O.spacingAfterValue===void 0||O.spacingAfterValue.length===0}this._writeContent(b.selfClosingTag?"/>":">");break;case g.InheritDocTag:var $=e;this._renderInlineTag($,function(){$.declarationReference&&(t._writeContent(" "),t._renderNode($.declarationReference))});break;case g.InlineTag:var K=e;this._renderInlineTag(K,function(){K.tagContent.length>0&&(t._writeContent(" "),t._writeContent(K.tagContent))});break;case g.LinkTag:var D=e;this._renderInlineTag(D,function(){(D.urlDestination!==void 0||D.codeDestination!==void 0)&&(D.urlDestination!==void 0?(t._writeContent(" "),t._writeContent(D.urlDestination)):D.codeDestination!==void 0&&(t._writeContent(" "),t._renderNode(D.codeDestination))),D.linkText!==void 0&&(t._writeContent(" "),t._writeContent("|"),t._writeContent(" "),t._writeContent(D.linkText))});break;case g.MemberIdentifier:var H=e;H.hasQuotes?(this._writeContent('"'),this._writeContent(H.identifier),this._writeContent('"')):this._writeContent(H.identifier);break;case g.MemberReference:var F=e;F.hasDot&&this._writeContent("."),F.selector&&this._writeContent("("),F.memberSymbol?this._renderNode(F.memberSymbol):this._renderNode(F.memberIdentifier),F.selector&&(this._writeContent(":"),this._renderNode(F.selector),this._writeContent(")"));break;case g.MemberSelector:var J=e;this._writeContent(J.selector);break;case g.MemberSymbol:var te=e;this._writeContent("["),this._renderNode(te.symbolR
|
||
|
|
`?(++t,r=1):++r)}return{line:t,column:r}},n.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")},n.empty=new n("",0,0),n}();var _n=function(){function n(e){this.messageId=e.messageId,this.unformattedText=e.messageText,this.textRange=e.textRange,this.tokenSequence=e.tokenSequence,this.docNode=e.docNode,this._text=void 0}return n._formatMessageText=function(e,t){if(e||(e="An unknown error occurred"),t.pos!==0||t.end!==0){var r=t.getLocation(t.pos);if(r.line)return"(".concat(r.line,",").concat(r.column,"): ")+e}return e},Object.defineProperty(n.prototype,"text",{get:function(){return this._text===void 0&&(this._text=n._formatMessageText(this.unformattedText,this.textRange)),this._text},enumerable:!1,configurable:!0}),n.prototype.toString=function(){return this.text},n}();var Hr=function(){function n(){this._messages=[]}return Object.defineProperty(n.prototype,"messages",{get:function(){return this._messages},enumerable:!1,configurable:!0}),n.prototype.addMessage=function(e){this._messages.push(e)},n.prototype.addMessageForTextRange=function(e,t,r){this.addMessage(new _n({messageId:e,messageText:t,textRange:r}))},n.prototype.addMessageForTokenSequence=function(e,t,r,i){this.addMessage(new _n({messageId:e,messageText:t,textRange:r.getContainingTextRange(),tokenSequence:r,docNode:i}))},n.prototype.addMessageForDocErrorText=function(e){var t;e.textExcerpt?t=e.textExcerpt:t=e.errorLocation,this.addMessage(new _n({messageId:e.messageId,messageText:e.errorMessage,textRange:t.getContainingTextRange(),tokenSequence:t,docNode:e}))},n}();var $r=function(){function n(e,t){this.commentRange=ze.empty,this.lines=[],this.tokens=[],this.configuration=e,this.sourceRange=t,this.docComment=new Wn({configuration:this.configuration}),this.log=new Hr}return n}();var yt=function(){function n(e){this.parserContext=e.parserContext,this._startIndex=e.startIndex,this._endIndex=e.endIndex,this._validateBounds()}return n.createEmpty=function(e){return new n({parserContext:e,startIndex:0,endIndex:0})},Object.defineProperty(n.prototype,"startIndex",{get:function(){return this._startIndex},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"endIndex",{get:function(){return this._endIndex},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tokens",{get:function(){return this.parserContext.tokens.slice(this._startIndex,this._endIndex)},enumerable:!1,configurable:!0}),n.prototype.getNewSequence=function(e,t){return new n({parserContext:this.parserContext,startIndex:e,endIndex:t})},n.prototype.getContainingTextRange=function(){return this.isEmpty()?ze.empty:this.parserContext.sourceRange.getNewRange(this.parserContext.tokens[this._startIndex].range.pos,this.parserContext.tokens[this._endIndex-1].range.end)},n.prototype.isEmpty=function(){return this._startIndex===this._endIndex},n.prototype.toString=function(){return this.tokens.map(function(e){return e.toString()}).join("")},n.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")},n}();var pe;(function(n){n[n.BeginComment1=0]="BeginComment1",n[n.BeginComment2=1]="BeginComment2",n[n.CollectingFirstLine=2]="CollectingFirstLine
|
||
|
|
`?((d!==pe.CollectingFirstLine||l>a)&&m.push(t.getNewRange(a,l)),a=c,l=c,d=pe.AdvancingLine):_==="*"&&b==="/"?(l>a&&m.push(t.getNewRange(a,l)),a=0,l=0,++c,o=c,d=pe.Done):n._whitespaceCharacterRegExp.test(_)||(l=c);break;case pe.AdvancingLine:_==="*"?b==="/"?(a=0,l=0,++c,o=c,d=pe.Done):(b===" "&&++c,a=c,l=c,d=pe.CollectingLine):_===`
|
||
|
|
`?(m.push(t.getNewRange(w,w)),a=c):n._whitespaceCharacterRegExp.test(_)||(l=c,d=pe.CollectingLine);break}}return e.commentRange=t.getNewRange(i,o),e.lines=m,!0},n._whitespaceCharacterRegExp=/^\s$/,n}();var xn=function(){function n(){}return n.readTokens=function(e){n._ensureInitialized();for(var t=[],r=void 0,i=0,o=e;i<o.length;i++){var a=o[i];n._pushTokensForLine(t,a),r=a}return r?t.push(new Nt(u.EndOfInput,r.getNewRange(r.end,r.end),r)):t.push(new Nt(u.EndOfInput,ze.empty,ze.empty)),t},n.isPunctuation=function(e){return n._ensureInitialized(),n._punctuationTokens[e]||!1},n._pushTokensForLine=function(e,t){for(var r=t.buffer,i=t.end,o=t.pos,a=void 0,l=o;o<i;){var c=r.charCodeAt(o),d=n._charCodeMap[c];d===void 0&&(d=u.Other),a!==void 0&&d===a&&n._isMultiCharacterToken(a)||(a!==void 0&&e.push(new Nt(a,t.getNewRange(l,o),t)),l=o,a=d),++o}a!==void 0&&e.push(new Nt(a,t.getNewRange(l,o),t)),e.push(new Nt(u.Newline,t.getNewRange(t.end,t.end),t))},n._isMultiCharacterToken=function(e){switch(e){case u.Spacing:case u.AsciiWord:case u.Other:return!0}return!1},n._ensureInitialized=function(){if(!n._charCodeMap){n._charCodeMap={},n._punctuationTokens={};for(var e=n._commonMarkPunctuationCharacters,t=0;t<e.length;++t){var r=e.charCodeAt(t);n._charCodeMap[r]=u.OtherPunctuation}for(var i={"\\":u.Backslash,"<":u.LessThan,">":u.GreaterThan,"=":u.Equals,"'":u.SingleQuote,'"':u.DoubleQuote,"/":u.Slash,"-":u.Hyphen,"@":u.AtSign,"{":u.LeftCurlyBracket,"}":u.RightCurlyBracket,"`":u.Backtick,".":u.Period,":":u.Colon,",":u.Comma,"[":u.LeftSquareBracket,"]":u.RightSquareBracket,"|":u.Pipe,"(":u.LeftParenthesis,")":u.RightParenthesis,"#":u.PoundSymbol,"+":u.Plus,$:u.DollarSign},o=0,a=Object.getOwnPropertyNames(i);o<a.length;o++){var l=a[o];n._charCodeMap[l.charCodeAt(0)]=i[l],n._punctuationTokens[i[l]]=!0}n._punctuationTokens[u.OtherPunctuation]=!0;for(var c=n._wordCharacters,t=0;t<c.length;++t){var r=c.charCodeAt(t);n._charCodeMap[r]=u.AsciiWord}n._charCodeMap[" ".charCodeAt(0)]=u.Spacing,n._charCodeMap[" ".charCodeAt(0)]=u.Spacing}},n._commonMarkPunctuationCharacters="!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~",n._wordCharacters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_",n}();var Kr=function(){function n(e,t){if(this._parserContext=e,this.tokens=e.tokens,t){if(t.parserContext!==this._parserContext)throw new Error("The embeddedTokenSequence must use the same parser context");this._readerStartIndex=t.startIndex,this._readerEndIndex=t.endIndex}else this._readerStartIndex=0,this._readerEndIndex=this.tokens.length;this._currentIndex=this._readerStartIndex,this._accumulatedStartIndex=this._readerStartIndex}return n.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 e=new yt({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex});return this._accumulatedStartIndex=this._currentIndex,e},n.prototype.isAccumulatedSequenceEmpty=function(){return this._accumulatedStartIndex===this._currentIndex},n.prototype.tryExtractAccumulatedSequence=function(){if(!this.isAccumulatedSequenceEmpty())return this.extractAccumulatedSequence()},n.prototype.assertAccumulatedSequenceIsEmpty=function(){if(!this.isAccumulatedSequenceEmpty()){var e=new yt({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex}),t=e.tokens.map(function(r){return r.toString()});throw new Error(`Parser assertion failed: The queue should be empty, but it contains:
|
||
|
|
`+JSON.stringify(t))}},n.prototype.peekToken=function(){return this.tokens[this._currentIndex]},n.prototype.peekTokenKind=function(){return this._currentIndex>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex].kind},n.prototype.peekTokenAfterKind=function(){return this._currentIndex+1>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex+1].kind},n.prototype.peekTokenAfterAfterKind=function(){return this._currentIndex+2>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex+2].kind},n.prototype.readToken=function(){if(this._currentIndex>=this._readerEndIndex)throw new Error("Cannot read past end of stream");var e=this.tokens[this._currentIndex];if(e.kind===u.EndOfInput)throw new Error("The EndOfInput token cannot be read");return this._currentIndex++,e},n.prototype.peekPreviousTokenKind=function(){return this._currentIndex===0?u.EndOfInput:this.tokens[this._currentIndex-1].kind},n.prototype.createMarker=function(){return this._currentIndex},n.prototype.backtrackToMarker=function(e){if(e>this._currentIndex)throw new Error("The marker has expired");this._currentIndex=e,e<this._accumulatedStartIndex&&(this._accumulatedStartIndex=e)},n}();var pr=function(){return pr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},pr.apply(this,arguments)};function yn(n){return n!==void 0&&Object.hasOwnProperty.call(n,"failureMessage")}var io=function(){function n(e){this._parserContext=e,this._configuration=e.configuration,this._currentSection=e.docComment.summarySection}return n.prototype.parse=function(){for(var e=new Kr(this._parserContext),t=!1;!t;)switch(e.peekTokenKind()){case u.EndOfInput:t=!0;break;case u.Newline:this._pushAccumulatedPlainText(e),e.readToken(),this._pushNode(new ir({parsed:!0,configuration:this._configuration,softBreakExcerpt:e.extractAccumulatedSequence()}));break;case u.Backslash:this._pushAccumulatedPlainText(e),this._pushNode(this._parseBackslashEscape(e));break;case u.AtSign:this._pushAccumulatedPlainText(e),this._parseAndPushBlock(e);break;case u.LeftCurlyBracket:{this._pushAccumulatedPlainText(e);var r=e.createMarker(),i=this._parseInlineTag(e),o=this._parserContext.docComment;if(i instanceof gn){var a=e.createMarker()-1;o.inheritDocTag===void 0?this._parserContext.docComment.inheritDocTag=i:this._pushNode(this._backtrackAndCreateErrorRange(e,r,a,v.ExtraInheritDocTag,"A doc comment cannot have more than one @inheritDoc tag"))}else this._pushNode(i);break}case u.RightCurlyBracket:this._pushAccumulatedPlainText(e),this._pushNode(this._createError(e,v.EscapeRightBrace,'The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag'));break;case u.LessThan:this._pushAccumulatedPlainText(e),e.peekTokenAfterKind()===u.Slash?this._pushNode(this._parseHtmlEndTag(e)):this._pushNode(this._parseHtmlStartTag(e));break;case u.GreaterThan:this._pushAccumulatedPlainText(e),this._pushNode(this._createError(e,v.EscapeGreaterThan,'The ">" character should be escaped using a backslash to avoid confusion with an HTML tag'));break;case u.Backtick:this._pushAccumulatedPlainText(e),e.peekTokenAfterKind()===u.Backtick&&e.peekTokenAfterAfterKind()===u.Backtick?this._pushNode(this._parseFencedCode(e)):this._pushNode(this._parseCodeSpan(e));break;default:e.readToken();break}this._pushAccumulatedPlainText(e),this._performValidationChecks()},n.prototype._performValidationChecks=function(){var e=this._parserContext.docComment;e.deprecatedBlock&&(lr.hasAnyTextContent(e.deprecatedBlock)||this._parserContext.log.addMessageForTokenSequence(v.MissingDeprecationMessage,"The ".concat(e.deprecatedBlock.blockTag.tagName," block must include a deprecation message,")+" e.g. describing the recommended alternative",e.deprecatedBlock.blockTag.getTokenSequence(),e.deprecatedBlock)),e.inheritDocTag&&(e.remarksBlock&&this._parserContext.log.addMessageForTokenSequence(v.InheritDocIncompatibleTag,'A "'.concat(e.remarksBlock.blockTag.tagName,'" block must not be used, beca
|
||
|
|
`)).join(`
|
||
|
|
`)}catch{console.error("Failed to parse summary section")}}function as(n){if(!n)return"";try{return n.content.nodes[0].getChildNodes()[0].text.trim()}catch{return""}}function ss(n){try{return n.blocks.map(r=>{let i=r.parameterName,o=r.content.getChildNodes()[0].getChildNodes().filter(a=>a instanceof Ve).map(a=>a.text).join(" ");return new Ur(i,o)})}catch{return[]}}function Ot(n,e,t){if(t<0||t===n.length)return;let r=n[e];n[e]=n[t],n[t]=r}function vt(n){return n.workspace.activeEditor?.file??n.workspace.getActiveFile()}function lo(n){let e=n.lastIndexOf("/");return e!==-1?n.slice(0,e):""}function jn(n){return n!==null&&typeof n=="object"}function po(n){let e=n.toString(),t=e.indexOf("(");return e.substring(t+1,e.indexOf(")")).replace(/ /g,"").split(",")}function Gr(n,e,t){let r=n instanceof HTMLOListElement?"li":"p",i=n.createEl(r),o=n.createEl("b",{text:e});return i.appendChild(o),i.appendChild(document.createTextNode(`: ${t}`)),i}function ur(n,e){if(Object.keys(e).length!==0){for(let t in e)if(e.hasOwnProperty(t))if(n.hasOwnProperty(t)){let r=n[t],i=e[t];if(Array.isArray(r)||Array.isArray(i)){let o=Array.isArray(r)?r:[r],a=Array.isArray(i)?i:[i];n[t]=o.concat(a).unique()}else jn(r)&&jn(i)?ur(r,i):i!=null&&i!==""&&(n[t]=i)}else n[t]=e[t]}}function vn(n){let e={},t=(0,Te.getFrontMatterInfo)(n);return t.frontmatter&&(e=(0,Te.parseYaml)(t.frontmatter)),{frontmatter:e,content:n.slice(t.contentStart)}}var Bo=X(require("obsidian"));var Mo=X(require("obsidian"));var ie="top",ue="bottom",ce="right",ae="left",fr="auto",wt=[ie,ue,ce,ae],pt="start",Bt="end",uo="clippingParents",dr="viewport",Zt="popper",fo="reference",Wr=wt.reduce(function(n,e){return n.concat([e+"-"+pt,e+"-"+Bt])},[]),mr=[].concat(wt,[fr]).reduce(function(n,e){return n.concat([e,e+"-"+pt,e+"-"+Bt])},[]),cs="beforeRead",ls="read",ps="afterRead",us="beforeMain",fs="main",ds="afterMain",ms="beforeWrite",gs="write",hs="afterWrite",mo=[cs,ls,ps,us,fs,ds,ms,gs,hs];function me(n){return n?(n.nodeName||"").toLowerCase():null}function Z(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Me(n){var e=Z(n).Element;return n instanceof e||n instanceof Element}function fe(n){var e=Z(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function en(n){if(typeof ShadowRoot=="undefined")return!1;var e=Z(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function As(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},o=e.elements[t];!fe(o)||!me(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(a){var l=i[a];l===!1?o.removeAttribute(a):o.setAttribute(a,l===!0?"":l)}))})}function _s(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),l=a.reduce(function(c,d){return c[d]="",c},{});!fe(i)||!me(i)||(Object.assign(i.style,l),Object.keys(o).forEach(function(c){i.removeAttribute(c)}))})}}var go={name:"applyStyles",enabled:!0,phase:"write",fn:As,effect:_s,requires:["computeStyles"]};function ge(n){return n.split("-")[0]}var qe=Math.max,It=Math.min,ut=Math.round;function tn(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function wn(){return!/^((?!chrome|android).)*safari/i.test(tn())}function Oe(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,o=1;e&&fe(n)&&(i=n.offsetWidth>0&&ut(r.width)/n.offsetWidth||1,o=n.offsetHeight>0&&ut(r.height)/n.offsetHeight||1);var a=Me(n)?Z(n):window,l=a.visualViewport,c=!wn()&&t,d=(r.left+(c&&l?l.offsetLeft:0))/i,m=(r.top+(c&&l?l.offsetTop:0))/o,_=r.width/i,w=r.height/o;return{width:_,heigh
|
||
|
|
> \u2014 ${o}`}catch{return new P("Error generating daily quote"),"Error generating daily quote"}}}generate_random_picture(){return async(e,t,r=!1)=>{try{let i=await this.getRequest(`https://templater-unsplash-2.fly.dev/${t?"?q="+t:""}`).then(a=>a.json),o=i.full;if(e&&!r)if(e.includes("x")){let[a,l]=e.split("x");o=o.concat(`&w=${a}&h=${l}`)}else o=o.concat(`&w=${e}`);return r?``:``}catch{return new P("Error generating random picture"),"Error generating random picture"}}}generate_request(){return async(e,t)=>{try{let i=await(await this.getRequest(e)).json;return t&&i?t.split(".").reduce((o,a)=>{if(o&&o.hasOwnProperty(a))return o[a];throw new Error(`Path ${t} not found in the JSON response`)},i):i}catch(r){throw console.error(r),new P("Error fetching and extracting value")}}}};var fi=class extends be{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(e=>{e.e.offref(e)}),this.event_refs=[]}generate_on_all_templates_executed(){return e=>{let t=this.plugin.app.workspace.on("templater:all-templates-executed",async()=>{await jt(1),e()});t&&this.event_refs.push(t)}}};var di=class extends be{constructor(){super(...arguments);this.name="frontmatter"}async create_static_templates(){}async create_dynamic_templates(){let e=this.plugin.app.metadataCache.getFileCache(this.config.target_file);this.dynamic_functions=new Map(Object.entries(e?.frontmatter||{}))}async teardown(){}};var Qe=X(require("obsidian"));var mi=class extends Qe.Modal{constructor(e,t,r,i){super(e);this.prompt_text=t;this.default_value=r;this.multi_line=i;this.submitted=!1}onOpen(){this.titleEl.setText(this.prompt_text),this.createForm()}onClose(){this.contentEl.empty(),this.submitted||this.reject(new P("Cancelled prompt"))}createForm(){let e=this.contentEl.createDiv();e.addClass("templater-prompt-div");let t;this.multi_line?t=new Qe.TextAreaComponent(e):t=new Qe.TextComponent(e);let r=this.contentEl.createDiv();r.addClass("templater-button-div");let i=new Qe.ButtonComponent(r);i.buttonEl.addClass("mod-cta"),i.setButtonText("Submit").onClick(o=>{this.resolveAndClose(o)}),this.value=this.default_value??"",t.inputEl.addClass("templater-prompt-input"),t.setPlaceholder("Type text here"),t.setValue(this.value),t.onChange(o=>this.value=o),t.inputEl.focus(),t.inputEl.addEventListener("keydown",o=>this.enterCallback(o))}enterCallback(e){e.isComposing||e.keyCode===229||(this.multi_line?Qe.Platform.isDesktop&&e.key==="Enter"&&!e.shiftKey&&this.resolveAndClose(e):e.key==="Enter"&&this.resolveAndClose(e))}resolveAndClose(e){this.submitted=!0,e.preventDefault(),this.resolve(this.value),this.close()}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var Uo=X(require("obsidian")),gi=class extends Uo.FuzzySuggestModal{constructor(e,t,r,i,o){super(e);this.text_items=t;this.items=r;this.submitted=!1;this.setPlaceholder(i),o&&(this.limit=o)}getItems(){return this.items}onClose(){this.submitted||this.reject(new P("Cancelled prompt"))}selectSuggestion(e,t){this.submitted=!0,this.close(),this.onChooseSuggestion(e,t)}getItemText(e){return this.text_items instanceof Function?this.text_items(e):this.text_items[this.items.indexOf(e)]||"Undefined Text Item"}onChooseItem(e){this.resolve(e)}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var De=X(require("obsidian")),hi=class extends De.Modal{constructor(e,t,r,i,o){super(e);this.text_items=t;this.items=r;this.submitted=!1;this.selectedItems=[];this.setTitle(i),this.listEl=this.contentEl.createDiv("templater-multisuggester-list");let a=this.contentEl.createDiv("templater-multisuggester-div"),l=new De.TextComponent(a);l.inputEl.addClass("templater-multisuggester-input"),this.suggester=new Go(e,l.inputEl,this.getItemText.bind(this),r,o).onSelect(this.onChooseItem.bind(this
|
||
|
|
})`)(r,o,i)}catch(c){throw new P(`Failed to load user script at "${e.path}".`,c.message)}let l=i.default??o.exports;if(!l)throw new P(`Failed to load user script at "${e.path}". No exports detected.`);if(typeof l=="function")t.set(e.basename,l);else if(typeof l=="object"&&l!==null){if(!Object.values(l).every(d=>typeof d=="function"))throw new P(`Exported object in "${e.path}" must contain only functions.`);t.set(e.basename,l)}else throw new P(`Invalid export in "${e.path}". Must be a function or object of functions.`)}async generate_object(){let e=await this.generate_user_script_functions();return Object.fromEntries(e)}};var vi=class{constructor(e){this.plugin=e;this.user_system_functions=new yi(e),this.user_script_functions=new ji(e)}async generate_object(e){let t={},r={};return this.plugin.settings.enable_system_commands&&(t=await this.user_system_functions.generate_object(e)),this.plugin.settings.user_scripts_folder&&(r=await this.user_script_functions.generate_object()),{...t,...r}}};var Ks=X(require("obsidian")),Xe;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.USER_INTERNAL=1]="USER_INTERNAL"})(Xe||(Xe={}));var wi=class{constructor(e){this.plugin=e;this.internal_functions=new xi(this.plugin),this.user_functions=new vi(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{app:this.plugin.app,obsidian:Ks}}async generate_object(e,t=1){let r={},i=this.additional_functions(),o=await this.internal_functions.generate_object(e),a={};switch(Object.assign(r,i),t){case 0:Object.assign(r,o);break;case 1:a=await this.user_functions.generate_object(e),Object.assign(r,{...o,user:a});break}return r}};var Xs={},M,Ke=new Array(32).fill(void 0);Ke.push(void 0,null,!0,!1);function Pe(n){return Ke[n]}var Nn=Ke.length;function Rs(n){n<36||(Ke[n]=Nn,Nn=n)}function bi(n){let e=Pe(n);return Rs(n),e}var Wo=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Wo.decode();var xr=new Uint8Array;function yr(){return xr.byteLength===0&&(xr=new Uint8Array(M.memory.buffer)),xr}function Et(n,e){return Wo.decode(yr().subarray(n,n+e))}function Tt(n){Nn===Ke.length&&Ke.push(Ke.length+1);let e=Nn;return Nn=Ke[e],Ke[e]=n,e}var Re=0,jr=new TextEncoder("utf-8"),Ys=typeof jr.encodeInto=="function"?function(n,e){return jr.encodeInto(n,e)}:function(n,e){let t=jr.encode(n);return e.set(t),{read:n.length,written:t.length}};function gt(n,e,t){if(t===void 0){let l=jr.encode(n),c=e(l.length);return yr().subarray(c,c+l.length).set(l),Re=l.length,c}let r=n.length,i=e(r),o=yr(),a=0;for(;a<r;a++){let l=n.charCodeAt(a);if(l>127)break;o[i+a]=l}if(a!==r){a!==0&&(n=n.slice(a)),i=t(i,r,r=a+n.length*3);let l=yr().subarray(i+a,i+r);a+=Ys(n,l).written}return Re=a,i}function Us(n){return n==null}var vr=new Int32Array;function Ne(){return vr.byteLength===0&&(vr=new Int32Array(M.memory.buffer)),vr}function Ei(n){let e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){let i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){let i=n.length,o="[";i>0&&(o+=Ei(n[0]));for(let a=1;a<i;a++)o+=", "+Ei(n[a]);return o+="]",o}let t=/\[object ([^\]]+)\]/.exec(toString.call(n)),r;if(t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
|
||
|
|
${n.stack}`:r}function Gs(n,e){if(!(n instanceof e))throw new Error(`expected instance of ${e.name}`);return n.ptr}var wr=32;function Ws(n){if(wr==1)throw new Error("out of js stack");return Ke[--wr]=n,wr}function Ti(n,e){try{return n.apply(this,e)}catch(t){M.__wbindgen_exn_store(Tt(t))}}var Rt=class{static __wrap(e){let t=Object.create(Rt.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();M.__wbg_parserconfig_free(e)}get interpolate(){let e=M.__wbg_get_parserconfig_interpolate(this.ptr);return String.fromCodePoint(e)}set interpolate(e){M.__wbg_set_parserconfig_interpolate(this.ptr,e.codePointAt(0))}get execution(){let e=M.__wbg_get_parserconfig_execution(this.ptr);return String.fromCodePoint(e)}set execution(e){M.__wbg_set_parserconfig_execution(this.ptr,e.codePointAt(0))}get single_whitespace(){let e=M.__wbg_get_parserconfig_single_whitespace(this.ptr);return String.fromCodePoint(e)}set single_whitespace(e){M.__wbg_set_parserconfig_single_whitespace(this.ptr,e.codePointAt(0))}get multiple_whitespace(){let e=M.__wbg_get_parserconfig_multiple_whitespace(this.ptr);return String.fromCodePoint(e)}set multiple_whitespace(e){M.__wbg_set_parserconfig_multiple_whitespace(this.ptr,e.codePointAt(0))}constructor(e,t,r,i,o,a,l){let c=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),d=Re,m=gt(t,M.__wbindgen_malloc,M.__wbindgen_realloc),_=Re,w=gt(l,M.__wbindgen_malloc,M.__wbindgen_realloc),b=Re,S=M.parserconfig_new(c,d,m,_,r.codePointAt(0),i.codePointAt(0),o.codePointAt(0),a.codePointAt(0),w,b);return Rt.__wrap(S)}get opening_tag(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_opening_tag(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return Et(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set opening_tag(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_opening_tag(this.ptr,t,r)}get closing_tag(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_closing_tag(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return Et(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set closing_tag(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_closing_tag(this.ptr,t,r)}get global_var(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_global_var(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return Et(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set global_var(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_global_var(this.ptr,t,r)}},sn=class{static __wrap(e){let t=Object.create(sn.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();M.__wbg_renderer_free(e)}constructor(e){Gs(e,Rt);var t=e.ptr;e.ptr=0;let r=M.renderer_new(t);return sn.__wrap(r)}render_content(e,t){try{let a=M.__wbindgen_add_to_stack_pointer(-16),l=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),c=Re;M.renderer_render_content(a,this.ptr,l,c,Ws(t));var r=Ne()[a/4+0],i=Ne()[a/4+1],o=Ne()[a/4+2];if(o)throw bi(i);return bi(r)}finally{M.__wbindgen_add_to_stack_pointer(16),Ke[wr++]=void 0}}};async function Vs(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.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",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function zs(){let n={};return n.wbg={},n.wbg.__wbindgen_object_drop_ref=function(e){bi(e)},n.wbg.__wbindgen_string_new=function(e,t){let r=Et(e,t);return Tt(r)},n.wbg.__wbindgen_string_get=function(e,t){let r=Pe
|
||
|
|
${(0,de.stringifyYaml)(b)}---
|
||
|
|
`),_+=w+d,o.editor.setValue(_),o.editor.setSelection({line:0,ch:0},{line:0,ch:0}),await jt(100),await i.save()}else await this.plugin.app.vault.process(t,_=>{let w="",{content:b,frontmatter:S}=vn(_);return ur(S,m),Object.keys(S).length>0&&(w+=`---
|
||
|
|
${(0,de.stringifyYaml)(S)}---
|
||
|
|
`),w+=b+d,c=w,w});this.plugin.app.workspace.trigger("templater:new-note-from-template",{file:t,content:c}),await this.plugin.editor_handler.jump_to_next_cursor_location(t,!0),await this.end_templater_task(r)}overwrite_active_file_commands(){let e=this.plugin.app.workspace.activeEditor;if(!e||!e.file){oe(new P("Active editor is null, can't overwrite content"));return}this.overwrite_file_commands(e.file,!0)}async overwrite_file_commands(e,t=!1){let{path:r}=e;this.start_templater_task(r);let i=this.create_running_config(e,e,t?3:2),o=await Se(async()=>this.read_and_parse_template(i),"Template parsing error, aborting.");if(o==null){await this.end_templater_task(r);return}await this.plugin.app.vault.modify(e,o),this.plugin.app.workspace.trigger("templater:overwrite-file",{file:e,content:o}),await this.plugin.editor_handler.jump_to_next_cursor_location(e,!0),await this.end_templater_task(r)}async process_dynamic_templates(e,t){let r=so(),i=document.createNodeIterator(e,NodeFilter.SHOW_TEXT),o,a=!1,l;for(;o=i.nextNode();){let c=o.nodeValue;if(c!==null){let d=r.exec(c);if(d!==null){let m=this.plugin.app.metadataCache.getFirstLinkpathDest("",t.sourcePath);if(!m||!(m instanceof de.TFile))return;if(!a){a=!0;let _=this.create_running_config(m,m,4);l=await this.functions_generator.generate_object(_,Xe.USER_INTERNAL),this.current_functions_object=l}}for(;d!=null;){let m=d[1]+d[2],_=await Se(async()=>await this.parser.parse_commands(m,l),`Command Parsing error in dynamic command '${m}'`);if(_==null)return;let w=r.lastIndex-d[0].length,b=r.lastIndex;c=c.substring(0,w)+_+c.substring(b),r.lastIndex+=_.length-d[0].length,d=r.exec(c)}o.nodeValue=c}}}get_new_file_template_for_folder(e){do{let t=this.plugin.settings.folder_templates.find(r=>r.folder==e.path);if(t&&t.template)return t.template;e=e.parent}while(e)}get_new_file_template_for_file(e){let t=this.plugin.settings.file_templates.find(r=>new RegExp(r.regex).test(e.path));if(t&&t.template)return t.template}static async on_file_creation(e,t,r){if(!(r instanceof de.TFile)||r.extension!=="md")return;let i=(0,de.normalizePath)(e.plugin.settings.templates_folder);if(r.path.includes(i)&&i!=="/"||(await jt(300),e.files_with_pending_templates.has(r.path)))return;let o=await t.vault.read(r),a=(0,de.getFrontMatterInfo)(o),l=o.length-a.contentStart;if(l==0&&e.plugin.settings.enable_folder_templates){let c=e.get_new_file_template_for_folder(r.parent);if(!c)return;let d=await Se(async()=>Mt(t,c),`Couldn't find template ${c}`);if(d==null)return;await e.write_template_to_file(d,r)}else if(l==0&&e.plugin.settings.enable_file_templates){let c=e.get_new_file_template_for_file(r);if(!c)return;let d=await Se(async()=>Mt(t,c),`Couldn't find template ${c}`);if(d==null)return;await e.write_template_to_file(d,r)}else{let c=1e5;r.stat.size<=c?await e.overwrite_file_commands(r):console.log(`Templater skipped parsing ${r.path} because file size exceeds ${c}`)}}async execute_startup_scripts(){for(let e of this.plugin.settings.startup_templates){if(!e)continue;let t=Ce(()=>Mt(this.plugin.app,e),`Couldn't find startup template "${e}"`);if(!t)continue;let{path:r}=t;this.start_templater_task(r);let i=this.create_running_config(t,t,5);await Se(async()=>this.read_and_parse_template(i),"Startup Template parsing error, aborting."),await this.end_templater_task(r)}}};var ln=X(require("obsidian"));var br=class{constructor(e,t,r){this.plugin=e;this.templater=t;this.settings=r}setup(){this.plugin.app.workspace.onLayoutReady(()=>{if(this.settings.trigger_on_file_creation&&this.plugin.app.vault.getConfig("openBehavior")==="daily"){let t=this.plugin.app.internalPlugins.getEnabledPluginById("daily-notes");if(t){let{folder:r,format:i}=t.options,o=(0,ln.normalizePath)(`${r}/${(0,ln.moment)().format(i)}.md`),a=vt(this.plugin.app);a?.path===o&&cn.on_file_creation(this.templater,this.plugin.app,a)}}this.update_trigger_file_on_creation()}),this.update_syntax_highlighting(),this.update_file_menu()}update_syntax_highlighting(){let e=this.plugin.editor_handler.desktopShouldHighlight(),t=this.plugin.editor_handler.mobileShouldHighlight();e
|
||
|
|
`,a+1))!==-1;i++,o=a);o+=1;let l=e.slice(o,t).length;return{line:i,ch:l}}get_cursor_matches_and_positions(e){let t=/<%\s*tp\.file\.cursor\((?<order>[0-9]*)\)\s*%>/g,r=Array.from(e.matchAll(t));if(r.length===0)return{};r.sort((d,m)=>Number(d.groups?.order||0)-Number(m.groups?.order||0));let i=r[0][0],o=r.filter(d=>d[0]===i),a=o[0][1]===""?[o[0]]:o,l=[],c=0;for(let d of a){let m=d.index-c;l.push(this.get_editor_position_from_index(e,m)),e=e.slice(0,m)+e.slice(m+d[0].length),c+=d[0].length}return{cursor_matches:a,positions:l}}};var ea=X(require("obsidian"));var ec={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.
|
||
|
|
|
||
|
|
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\u23AEstring, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [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 referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [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 [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 [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 [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 date referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [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) %>'},{name:"File's title Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>'},{nam
|
||
|
|
|
||
|
|
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.
|
||
|
|
`}],examples:[{name:"File cursor",example:"<% tp.file.cursor() %>"},{name:"File multi-cursor",example:"<% tp.file.cursor(1) %>Content<% tp.file.cursor(1) %>"}]},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 \u23AE 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 vault's relative path."}],examples:[{name:"File path",example:"<% tp.file.path() %>"},{name:"File relative path (relative to vault root)
|
||
|
|
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[] \u23AE ((item: T) => string), items: T[], throw_on_cancel: boolean = false, placeholder: string = "", limit?: number = 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)."}],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:`<%*
|
||
|
|
let selectedValue = await tp.system.suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "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[] \u23AE ((item: T) => string), items: T[], throw_on_cancel: boolean = false, title: string = "", limit?: number = 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)."}],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:`<%*
|
||
|
|
let selectedValues = await tp.system.multi_suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]);
|
||
|
|
%>
|
||
|
|
# <% selectedValues %>
|
||
|
|
selected values: <% selectedValues %>`}]}}},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 the daily quote from `https://github.com/Zachatoo/quotes-database` as a callout.",definition:"tp.web.daily_quote()",examples:[{name:"Daily quote",example:"<% await tp.web.daily_quote() %>"}]},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") %>'}]}}}},Xo={tp:ec};var tc=["app","config","date","file","frontmatter","hooks","obsidian","system","user","web"],nc=new Set(tc);function Zo(n){return typeof n=="string"&&nc.has(n)}function Pi(n){return!!(n.definition||n.returns||n.args)}var Ni=class{constructor(e){this.plugin=e;this.documentation=Xo}get_all_modules_documentation(){let e=this.documentation.tp;return(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)&&(e=Object.values(e).filter(t=>t.name!=="user")),Object.values(e).map(t=>(t.queryKey=t.name,t))}async get_all_functions_documentation(e,t){if(e==="app")return this.get_app_functions_documentation(this.plugin.app,t);if(e==="user"){if(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)return;let r=await Se(async()=>{let i=Je(this.plugin.app,this.plugin.settings.user_scripts_folder).filter(a=>a.extension=="js");return await co(this.plugin.app,i)},"User Scripts folder doesn't exist");return!r||r.length===0?void 0:r.reduce((i,o)=>o.extension!=="js"?i:[...i,{name:o.basename,queryKey:o.basename,definition:"",description:o.description,returns:o.returns,args:o.arguments.reduce((l,c)=>(l[c.name]={name:c.name,description:c.description},l),{}),example:""}],[])}if(!!this.documentation.tp[e].functions)return Object.values(this.documentation.tp[e].functions).map(r=>(r.queryKey=r.name,r))}get_app_functions_documentation(e,t){if(!jn(e))return[];let r=t.split(".");if(r.length===0)return[];let i=e;for(let c=0;c<r.length-1;c++){let d=r[c];if(d in i){if(!jn(i[d]))return[];i=i[d]}}let o=["tp","app",...r.slice(0,r.length-1)].join("."),a=r.slice(0,r.length-1).join("."),l=[];for(let c in i){let d=`${o}.${c}`,m=a?`${a}.${c}`:c;l.push({name:c,queryKey:m,definition:typeof i[c]=="function"?`${d}(${po(i[c])})`:d,description:"",returns:"",example:""})}return l}get_module_documentation(e){return this.documentation.tp[e]}get_function_documentation(e,t){return this.documentation.tp[e].functions[t]}get_argument_documentation(e,t,r){let i=this.get_function_documentation(e,t);return!i||!i.args?null:i.args[r]}};var Mi=class extends ea.EditorSuggest{constructor(e){super(e.app);this.tp_keyword_regex=/tp\.(?<module>[a-z]*)?(?<fn_trigger>\.(?<fn>[a-zA-Z_.]*)?)?$/;this.documenta
|
||
|
|
|
||
|
|
/* nosourcemap */
|