201 lines
322 KiB
JavaScript
Raw Normal View History

2023-06-29 11:55:02 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository (https://github.com/phibr0/obsidian-dictionary)
*/
var hg=Object.create;var fi=Object.defineProperty,ug=Object.defineProperties,fg=Object.getOwnPropertyDescriptor,dg=Object.getOwnPropertyDescriptors,pg=Object.getOwnPropertyNames,wl=Object.getOwnPropertySymbols,gg=Object.getPrototypeOf,Sl=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable;var Ml=(n,t,e)=>t in n?fi(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,di=(n,t)=>{for(var e in t||(t={}))Sl.call(t,e)&&Ml(n,e,t[e]);if(wl)for(var e of wl(t))mg.call(t,e)&&Ml(n,e,t[e]);return n},pi=(n,t)=>ug(n,dg(t)),Cl=n=>fi(n,"__esModule",{value:!0});var jr=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),bg=(n,t)=>{Cl(n);for(var e in t)fi(n,e,{get:t[e],enumerable:!0})},vg=(n,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pg(t))!Sl.call(n,i)&&i!=="default"&&fi(n,i,{get:()=>t[i],enumerable:!(e=fg(t,i))||e.enumerable});return n},Ae=n=>vg(Cl(fi(n!=null?hg(gg(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var Bh=jr((Va,Wa)=>{(function(n,t){typeof Va=="object"&&typeof Wa!="undefined"?Wa.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.chroma=t())})(Va,function(){"use strict";for(var n=function(h,f,m){return f===void 0&&(f=0),m===void 0&&(m=1),h<f?f:h>m?m:h},t=n,e=function(h){h._clipped=!1,h._unclipped=h.slice(0);for(var f=0;f<=3;f++)f<3?((h[f]<0||h[f]>255)&&(h._clipped=!0),h[f]=t(h[f],0,255)):f===3&&(h[f]=t(h[f],0,1));return h},i={},s=0,r=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];s<r.length;s+=1){var a=r[s];i["[object "+a+"]"]=a.toLowerCase()}var o=function(h){return i[Object.prototype.toString.call(h)]||"object"},l=o,c=function(h,f){return f===void 0&&(f=null),h.length>=3?Array.prototype.slice.call(h):l(h[0])=="object"&&f?f.split("").filter(function(m){return h[0][m]!==void 0}).map(function(m){return h[0][m]}):h[0]},u=o,d=function(h){if(h.length<2)return null;var f=h.length-1;return u(h[f])=="string"?h[f].toLowerCase():null},g=Math.PI,p={clip_rgb:e,limit:n,type:o,unpack:c,last:d,PI:g,TWOPI:g*2,PITHIRD:g/3,DEG2RAD:g/180,RAD2DEG:180/g},b={format:{},autodetect:[]},x=p.last,M=p.clip_rgb,C=p.type,P=b,$=function(){for(var f=[],m=arguments.length;m--;)f[m]=arguments[m];var _=this;if(C(f[0])==="object"&&f[0].constructor&&f[0].constructor===this.constructor)return f[0];var S=x(f),T=!1;if(!S){T=!0,P.sorted||(P.autodetect=P.autodetect.sort(function(j,G){return G.p-j.p}),P.sorted=!0);for(var k=0,D=P.autodetect;k<D.length;k+=1){var L=D[k];if(S=L.test.apply(L,f),S)break}}if(P.format[S]){var I=P.format[S].apply(null,T?f:f.slice(0,-1));_._rgb=M(I)}else throw new Error("unknown format: "+f);_._rgb.length===3&&_._rgb.push(1)};$.prototype.toString=function(){return C(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var R=$,F=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(F.Color,[null].concat(h)))};F.Color=R,F.version="2.4.2";var z=F,N=p.unpack,X=Math.max,U=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var m=N(h,"rgb"),_=m[0],S=m[1],T=m[2];_=_/255,S=S/255,T=T/255;var k=1-X(_,X(S,T)),D=k<1?1/(1-k):0,L=(1-_-k)*D,I=(1-S-k)*D,j=(1-T-k)*D;return[L,I,j,k]},nt=U,ot=p.unpack,st=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=ot(h,"cmyk");var m=h[0],_=h[1],S=h[2],T=h[3],k=h.length>4?h[4]:1;return T===1?[0,0,0,k]:[m>=1?0:255*(1-m)*(1-T),_>=1?0:255*(1-_)*(1-T),S>=1?0:255*(1-S)*(1-T),k]},kt=st,Ft=z,et=R,Ct=b,yt=p.unpack,Qt=p.type,de=nt;et.prototype.cmyk=function(){return de(this._rgb)},Ft.cmyk=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(et,[null].concat(h,["cmyk"])))},Ct.format.cmyk=kt,Ct.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=yt(h,"cmyk"),Qt(h)==="array"&&h.length===4)return"cmyk"}});var rt=p.unpack,Ot=p.last,It=function(h){return Math.round(h*100)/100},Wt=function(){for(var h=[],f=arguments.length;f--;)
<pre><code>`+Z+`
</code></pre>
`;var W=this.options.langPrefix+this.options.escape(y,!0);return`
<pre><code class="`+W+'">'+Z+`
</code></pre>
`},w.prototype.blockquote=function(v){return`<blockquote>
`+v+`</blockquote>
`},w.prototype.html=function(v){return v},w.prototype.heading=function(v,y,A){var E=this.options.headerPrefix+A.toLowerCase().replace(/[^\w]+/g,"-");return"<h"+y+' id="'+E+'">'+v+"</h"+y+`>
`},w.prototype.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},w.prototype.list=function(v,y){var A=y?"ol":"ul";return`
<`+A+`>
`+v+"</"+A+`>
`},w.prototype.listitem=function(v){return"<li>"+v+`</li>
`},w.prototype.paragraph=function(v){return"<p>"+v+`</p>
`},w.prototype.table=function(v,y){return`
<table>
<thead>
`+v+`</thead>
<tbody>
`+y+`</tbody>
</table>
`},w.prototype.tablerow=function(v){return`<tr>
`+v+`</tr>
`},w.prototype.tablecell=function(v,y){var A=y.header?"th":"td",E=y.align?"<"+A+' style="text-align:'+y.align+'">':"<"+A+">";return E+v+"</"+A+`>
`},w.prototype.strong=function(v){return"<strong>"+v+"</strong>"},w.prototype.em=function(v){return"<em>"+v+"</em>"},w.prototype.codespan=function(v){return"<code>"+v+"</code>"},w.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},w.prototype.del=function(v){return"<del>"+v+"</del>"},w.prototype.link=function(v,y,A){if(this.options.sanitize){var E=void 0;try{E=decodeURIComponent(this.options.unescape(v)).replace(/[^\w:]/g,"").toLowerCase()}catch(Z){return A}if(E.indexOf("javascript:")===0||E.indexOf("vbscript:")===0||E.indexOf("data:")===0)return A}var O='<a href="'+v+'"';return y&&(O+=' title="'+y+'"'),O+=">"+A+"</a>",O},w.prototype.image=function(v,y,A){var E='<img src="'+v+'" alt="'+A+'"';return y&&(E+=' title="'+y+'"'),E+=this.options.xhtml?"/>":">",E},w.prototype.text=function(v){return v},w}();var Ot=function(){function w(v,y,A,E){if(A===void 0&&(A=Wt.options),this.staticThis=v,this.links=y,this.options=A,this.renderer=E||this.options.renderer||new rt(this.options),!this.links)throw new Error("InlineLexer requires 'links' parameter.");this.setRules()}return w.output=function(v,y,A){var E=new this(this,y,A);return E.output(v)},w.getRulesBase=function(){if(this.rulesBase)return this.rulesBase;var v={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ <>]+(@|:\/)[^ <>]+)>/,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)([\s\S]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};return v.link=new t(v.link).setGroup("inside",v._inside).setGroup("href",v._href).getRegexp(),v.reflink=new t(v.reflink).setGroup("inside",v._inside).getRegexp(),this.rulesBase=v},w.getRulesPedantic=function(){return this.rulesPedantic?this.rulesPedantic:this.rulesPedantic=Object.assign(Object.assign({},this.getRulesBase()),{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/})},w.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),y=new t(v.escape).setGroup("])","~|])").getRegexp(),A=new t(v.text).setGroup("]|","~]|").setGroup("|","|https?://|").getRegexp();return this.rulesGfm=Object.assign(Object.assign({},v),{escape:y,url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:A})},w.getRulesBreaks=function(){if(this.rulesBreaks)return this.rulesBreaks;var v=this.getRulesGfm(),y=this.getRulesGfm();return this.rulesBreaks=Object.assign(Object.assign({},y),{br:new t(v.br).setGroup("{2,}","*").getRegexp(),text:new t(y.text).setGroup("{2,}","*").getRegexp()})},w.prototype.setRules=function(){this.options.gfm?this.options.breaks?this.rules=this.staticThis.getRulesBreaks():this.rules=this.staticThis.getRulesGfm():this.options.pedantic?this.rules=this.staticThis.getRulesPedantic():this.rules=this.staticThis.getRulesBase(),this.hasRulesGfm=this.rules.url!==void 0},w.prototype.output=function(v){v=v;for(var y,A="";v;){if(y=this.rules.escape.exec(v)){v=v.substring(y[0].length),A+=y[1];continue}if(y=this.rules.autolink.exec(v)){var E=void 0,O=void 0;v=v.substring(y[0].length),y[2]==="@"?(E=this.options.escape(y[1].charAt(6)===":"?this.mangle(y[1].substring(7)):this.mangle(y[1])),O=this.mangle("mailto:")+E):(E=this.options.escape(y[1]),O=E),A+=this.renderer.link(O,null,E);continue}if(!this.inLink&&this.hasRulesGfm&&(y=this.rules.url.exec(v))){var E=void 0,O=void 0;v=v.substring(y[0].length),E=this.options.escape(y[1]),O=E,A+=this.renderer.link(O,null,E);continue}if(y=this.rules.tag.exec(v)){!this.inLink&&/^<a /i.test(y[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(y[0])&&(this.inLink=!1),v=v.substring(y[0].length),A+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(y[0]):this.options.escape(y[0]):y[0];co
`).length-1,A+=E}return A},w.prototype.next=function(){return this.token=this.tokens.pop()},w.prototype.getNextElement=function(){return this.tokens[this.tokens.length-1]},w.prototype.parseText=function(){for(var v=this.token.text,y;(y=this.getNextElement())&&y.type==n.TokenType.text;)v+=`
`+this.next().text;return this.inlineLexer.output(v)},w.prototype.tok=function(){var v,y;switch(this.token.type){case n.TokenType.space:return"";case n.TokenType.paragraph:return this.renderer.paragraph(this.inlineLexer.output(this.token.text));case n.TokenType.text:return this.options.isNoP?this.parseText():this.renderer.paragraph(this.parseText());case n.TokenType.heading:return this.renderer.heading(this.inlineLexer.output(this.token.text),this.token.depth,this.token.text);case n.TokenType.listStart:{for(var A="",E=this.token.ordered;this.next().type!=n.TokenType.listEnd;)A+=this.tok();return this.renderer.list(A,E)}case n.TokenType.listItemStart:{for(var A="";this.next().type!=n.TokenType.listItemEnd;)A+=this.token.type==n.TokenType.text?this.parseText():this.tok();return this.renderer.listitem(A)}case n.TokenType.looseItemStart:{for(var A="";this.next().type!=n.TokenType.listItemEnd;)A+=this.tok();return this.renderer.listitem(A)}case n.TokenType.code:return this.renderer.code(this.token.text,this.token.lang,this.token.escaped,this.token.meta);case n.TokenType.table:{var O="",A="",Z=void 0;Z="";for(var W=0;W<this.token.header.length;W++){var J={header:!0,align:this.token.align[W]},tt=this.inlineLexer.output(this.token.header[W]);Z+=this.renderer.tablecell(tt,J)}O+=this.renderer.tablerow(Z);try{for(var _t=F(this.token.cells),zt=_t.next();!zt.done;zt=_t.next()){var Tt=zt.value;Z="";for(var Nt=0;Nt<Tt.length;Nt++)Z+=this.renderer.tablecell(this.inlineLexer.output(Tt[Nt]),{header:!1,align:this.token.align[Nt]});A+=this.renderer.tablerow(Z)}}catch(pe){v={error:pe}}finally{try{zt&&!zt.done&&(y=_t.return)&&y.call(_t)}finally{if(v)throw v.error}}return this.renderer.table(O,A)}case n.TokenType.blockquoteStart:{for(var A="";this.next().type!=n.TokenType.blockquoteEnd;)A+=this.tok();return this.renderer.blockquote(A)}case n.TokenType.hr:return this.renderer.hr();case n.TokenType.html:{var Ht=!this.token.pre&&!this.options.pedantic?this.inlineLexer.output(this.token.text):this.token.text;return this.renderer.html(Ht)}default:{if(this.simpleRenderers.length){for(var W=0;W<this.simpleRenderers.length;W++)if(this.token.type=="simpleRule"+(W+1))return this.simpleRenderers[W].call(this.renderer,this.token.execArr)}var ae='Token with "'+this.token.type+'" type was not found.';if(this.options.silent)console.log(ae);else throw new Error(ae)}}},w}();var Wt=function(){function w(){}return w.setOptions=function(v){return Object.assign(this.options,v),this},w.setBlockRule=function(v,y){return y===void 0&&(y=function(){return""}),Ut.simpleRules.push(v),this.simpleRenderers.push(y),this},w.parse=function(v,y){y===void 0&&(y=this.options);try{var A=this.callBlockLexer(v,y),E=A.tokens,O=A.links;return this.callParser(E,O,y)}catch(Z){return this.callMe(Z)}},w.debug=function(v,y){y===void 0&&(y=this.options);var A=this.callBlockLexer(v,y),E=A.tokens,O=A.links,Z=E.slice(),W=new It(y);W.simpleRenderers=this.simpleRenderers;var J=W.debug(O,E);return Z=Z.map(function(tt){tt.type=n.TokenType[tt.type]||tt.type;var _t=tt.line;return delete tt.line,_t?Object.assign({line:_t},tt):tt}),{tokens:Z,links:O,result:J}},w.callBlockLexer=function(v,y){if(v===void 0&&(v=""),typeof v!="string")throw new Error("Expected that the 'src' parameter would have a 'string' type, got '"+typeof v+"'");return v=v.replace(/\r\n|\r/g,`
`).replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,`
`).replace(/^ +$/gm,""),Ut.lex(v,y,!0)},w.callParser=function(v,y,A){if(this.simpleRenderers.length){var E=new It(A);return E.simpleRenderers=this.simpleRenderers,E.parse(y,v)}else return It.parse(v,y,A)},w.callMe=function(v){if(v.message+=`
Please report this to https://github.com/ts-stack/markdown`,this.options.silent)return"<p>An error occured:</p><pre>"+this.options.escape(v.message+"",!0)+"</pre>";throw v},w}();Wt.options=new c,Wt.simpleRenderers=[];var Ut=function(){function w(v,y){this.staticThis=v,this.links={},this.tokens=[],this.options=y||Wt.options,this.setRules()}return w.lex=function(v,y,A,E){var O=new this(this,y);return O.getTokens(v,A,E)},w.getRulesBase=function(){if(this.rulesBase)return this.rulesBase;var v={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};v.item=new t(v.item,"gm").setGroup(/bull/g,v.bullet).getRegexp(),v.list=new t(v.list).setGroup(/bull/g,v.bullet).setGroup("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))").setGroup("def","\\n+(?="+v.def.source+")").getRegexp();var y="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";return v.html=new t(v.html).setGroup("comment",/<!--[\s\S]*?-->/).setGroup("closed",/<(tag)[\s\S]+?<\/\1>/).setGroup("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/).setGroup(/tag/g,y).getRegexp(),v.paragraph=new t(v.paragraph).setGroup("hr",v.hr).setGroup("heading",v.heading).setGroup("lheading",v.lheading).setGroup("blockquote",v.blockquote).setGroup("tag","<"+y).setGroup("def",v.def).getRegexp(),this.rulesBase=v},w.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),y=Object.assign(Object.assign({},v),{fences:/^ *(`{3,}|~{3,})[ \.]*((\S+)? *[^\n]*)\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),A=y.fences.source.replace("\\1","\\2"),E=v.list.source.replace("\\1","\\3");return y.paragraph=new t(v.paragraph).setGroup("(?!","(?!"+A+"|"+E+"|").getRegexp(),this.rulesGfm=y},w.getRulesTable=function(){return this.rulesTables?this.rulesTables:this.rulesTables=Object.assign(Object.assign({},this.getRulesGfm()),{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/})},w.prototype.setRules=function(){this.options.gfm?this.options.tables?this.rules=this.staticThis.getRulesTable():this.rules=this.staticThis.getRulesGfm():this.rules=this.staticThis.getRulesBase(),this.hasRulesGfm=this.rules.fences!==void 0,this.hasRulesTables=this.rules.table!==void 0},w.prototype.getTokens=function(v,y,A){var E=v,O;t:for(;E;){if((O=this.rules.newline.exec(E))&&(E=E.substring(O[0].length),O[0].length>1&&this.tokens.push({type:n.TokenType.space})),O=this.rules.code.exec(E)){E=E.substring(O[0].length);var Z=O[0].replace(/^ {4}/gm,"");this.tokens.push({type:n.TokenType.code,text:this.options.pedantic?Z:Z.replace(/\n+$/,"")});continue}if(this.hasRulesGfm&&(O=this.rules.fences.exec(E))){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.code,meta:O[2],lang:O[3],text:O[4]||""});continue}if(O=this.rules.heading.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.heading,depth:O[1].length,text:O[2]});continue}if(y&&this.hasRulesTables&&(O=this.rules.nptable.exec(E))){E=E.substring(O[0].length);for(var W={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},J=0;J<W.align.length;J++)/^ *-+: *$/.test(W.align[J])?W.align[J]="right":/^ *:-+: *$/.test(W.align[J])?W.align[J]="center":/^ *:-+ *$/.test(W.align[J])?W.align[J]="left":W.align[J]=null;for(var tt=O[3].replace(/\n$/,"").split(`
`),J=0;J<tt.length;J++)W.cells[J]=tt[J].split(/ *\| */);this.tokens.push(W);continue}if(O=this.rules.lheading.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.heading,depth:O[2]==="="?1:2,text:O[1]});continue}if(O=this.rules.hr.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.hr});continue}if(O=this.rules.blockquote.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.blockquoteStart});var _t=O[0].replace(/^ *> ?/gm,"");this.getTokens(_t),this.tokens.push({type:n.TokenType.blockquoteEnd});continue}if(O=this.rules.list.exec(E)){E=E.substring(O[0].length);var zt=O[2];this.tokens.push({type:n.TokenType.listStart,ordered:zt.length>1});for(var _t=O[0].match(this.rules.item),Tt=_t.length,Nt=!1,Ht=void 0,ae=void 0,_e=void 0,J=0;J<Tt;J++){var W=_t[J];Ht=W.length,W=W.replace(/^ *([*+-]|\d+\.) +/,""),W.indexOf(`
`)!==-1&&(Ht-=W.length,W=this.options.pedantic?W.replace(/^ {1,4}/gm,""):W.replace(new RegExp("^ {1,"+Ht+"}","gm"),"")),this.options.smartLists&&J!==Tt-1&&(ae=this.staticThis.getRulesBase().bullet.exec(_t[J+1])[0],zt!==ae&&!(zt.length>1&&ae.length>1)&&(E=_t.slice(J+1).join(`
`)+E,J=Tt-1)),_e=Nt||/\n\n(?!\s*$)/.test(W),J!==Tt-1&&(Nt=W.charAt(W.length-1)===`
`,_e||(_e=Nt)),this.tokens.push({type:_e?n.TokenType.looseItemStart:n.TokenType.listItemStart}),this.getTokens(W,!1,A),this.tokens.push({type:n.TokenType.listItemEnd})}this.tokens.push({type:n.TokenType.listEnd});continue}if(O=this.rules.html.exec(E)){E=E.substring(O[0].length);var pe=O[1],_n=pe==="pre"||pe==="script"||pe==="style";this.tokens.push({type:this.options.sanitize?n.TokenType.paragraph:n.TokenType.html,pre:!this.options.sanitizer&&_n,text:O[0]});continue}if(y&&(O=this.rules.def.exec(E))){E=E.substring(O[0].length),this.links[O[1].toLowerCase()]={href:O[2],title:O[3]};continue}if(y&&this.hasRulesTables&&(O=this.rules.table.exec(E))){E=E.substring(O[0].length);for(var W={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},J=0;J<W.align.length;J++)/^ *-+: *$/.test(W.align[J])?W.align[J]="right":/^ *:-+: *$/.test(W.align[J])?W.align[J]="center":/^ *:-+ *$/.test(W.align[J])?W.align[J]="left":W.align[J]=null;for(var tt=O[3].replace(/(?: *\| *)?\n$/,"").split(`
`),J=0;J<tt.length;J++)W.cells[J]=tt[J].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(W);continue}if(this.staticThis.simpleRules.length){for(var tn=this.staticThis.simpleRules,J=0;J<tn.length;J++)if(O=tn[J].exec(E)){E=E.substring(O[0].length);var yn="simpleRule"+(J+1);this.tokens.push({type:yn,execArr:O});continue t}}if(y&&(O=this.rules.paragraph.exec(E))){E=E.substring(O[0].length),O[1].slice(-1)===`
`?this.tokens.push({type:n.TokenType.paragraph,text:O[1].slice(0,-1)}):this.tokens.push({type:this.tokens.length>0?n.TokenType.paragraph:n.TokenType.text,text:O[1]});continue}if(O=this.rules.text.exec(E)){E=E.substring(O[0].length),this.tokens.push({type:n.TokenType.text,text:O[0]});continue}if(E)throw new Error("Infinite loop on byte: "+E.charCodeAt(0)+(", near text '"+E.slice(0,30)+"...'"))}return{tokens:this.tokens,links:this.links}},w}();Ut.simpleRules=[],Ut.rulesBase=null,Ut.rulesGfm=null,Ut.rulesTables=null,n.BlockLexer=Ut,n.ExtendRegexp=t,n.InlineLexer=Ot,n.Marked=Wt,n.MarkedOptions=c,n.Parser=It,n.Renderer=rt,n.escape=o,n.unescape=l,Object.defineProperty(n,"__esModule",{value:!0})})});var Wh=jr(ai=>{"use strict";var Av=ai&&ai.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var r in s)s.hasOwnProperty(r)&&(i[r]=s[r])},n(t,e)};return function(t,e){n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty(ai,"__esModule",{value:!0});ai.Extractor=void 0;var Ya=Vh(),Lv=function(n){Av(t,n);function t(e,i){var s=n.call(this)||this;return s.lowercaseKeys=i??!1,s.reset(e),s}return Object.defineProperty(t.prototype,"tables",{get:function(){return this.extractedTables},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"objects",{get:function(){var e=this;return this.extractedTables.map(function(i){return t.tableToObject(i,e.lowercaseKeys)})},enumerable:!1,configurable:!0}),t.prototype.reset=function(e){e===void 0&&(e="rows"),this.mode=e,this.currentRow=[],this.currentTable=[],this.extractedTables=[]},t.prototype.table=function(e,i){return this.extractedTables.push(this.mode==="rows"?this.currentTable:t.transposeTable(this.currentTable)),this.currentTable=[],n.prototype.table.call(this,e,i)},t.prototype.tablerow=function(e){return this.currentTable.push(this.currentRow),this.currentRow=[],n.prototype.tablerow.call(this,e)},t.prototype.tablecell=function(e,i){return this.currentRow.push(e),n.prototype.tablecell.call(this,e,i)},t.transposeTable=function(e){for(var i=[],s=e.length,r=e[0].length,a=0;a<r;a++){i.push([]);for(var o=0;o<s;o++)i[a].push(e[o][a])}return i},t.tableToObject=function(e,i){var s=e.shift().slice(1),r={};return e.forEach(function(a){var o=a.shift(),l={};a.forEach(function(c,u){l[i?s[u].toLowerCase():s[u]]=c}),r[i?o.toLowerCase():o]=l}),r},t.createExtractor=function(e,i,s){var r=new t(i,s);return Ya.Marked.setOptions({renderer:r}),Ya.Marked.parse(e),r},t.extractObject=function(e,i,s){var r=t.extractAllObjects(e,i,s);return r.length>0?r[0]:null},t.extractAllObjects=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects},t.extractTable=function(e,i,s){var r=t.extractAllTables(e,i,s);return r.length>0?r[0]:null},t.extractAllTables=function(e,i,s){var r=t.createExtractor(e,i,s);return r.tables},t.extract=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects.length>0?JSON.stringify(r.objects[0]):null},t.extractAll=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects.map(function(a){return JSON.stringify(a)})},t}(Ya.Renderer);ai.Extractor=Lv});bg(exports,{default:()=>co});var Oe=Ae(require("obsidian"));function Le(){}var Tl=function(){let n=0;return function(){return n++}}();function vt(n){return n===null||typeof n=="undefined"}function Dt(n){if(Array.isArray&&Array.isArray(n))return!0;let t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function ft(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}var jt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function me(n,t){return jt(n)?n:t}function at(n,t){return typeof n=="undefined"?t:n}var Pl=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,Nr=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function At(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function Mt(n,t,e,i){let s,r,a;if(Dt(n))if(r=n.length,i)for(s=r-1;s>=0
`)>-1?n.split(`
`):n}function ev(n,t){let{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:a,value:o}=r.getLabelAndValue(s);return{chart:n,label:a,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:o,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Mh(n,t){let e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:a,boxHeight:o}=t,l=qt(t.bodyFont),c=qt(t.titleFont),u=qt(t.footerFont),d=r.length,g=s.length,p=i.length,b=ie(t.padding),x=b.height,M=0,C=i.reduce((R,F)=>R+F.before.length+F.lines.length+F.after.length,0);if(C+=n.beforeBody.length+n.afterBody.length,d&&(x+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),C){let R=t.displayColors?Math.max(o,l.lineHeight):l.lineHeight;x+=p*R+(C-p)*l.lineHeight+(C-1)*t.bodySpacing}g&&(x+=t.footerMarginTop+g*u.lineHeight+(g-1)*t.footerSpacing);let P=0,$=function(R){M=Math.max(M,e.measureText(R).width+P)};return e.save(),e.font=c.string,Mt(n.title,$),e.font=l.string,Mt(n.beforeBody.concat(n.afterBody),$),P=t.displayColors?a+2+t.boxPadding:0,Mt(i,R=>{Mt(R.before,$),Mt(R.lines,$),Mt(R.after,$)}),P=0,e.font=u.string,Mt(n.footer,$),e.restore(),M+=b.width,{width:M,height:x}}function nv(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function iv(n,t,e,i){let{x:s,width:r}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+r+a>t.width||n==="right"&&s-r-a<0)return!0}function sv(n,t,e,i){let{x:s,width:r}=e,{width:a,chartArea:{left:o,right:l}}=n,c="center";return i==="center"?c=s<=(o+l)/2?"left":"right":s<=r/2?c="left":s>=a-r/2&&(c="right"),iv(c,n,t,e)&&(c="center"),c}function Ch(n,t,e){let i=e.yAlign||t.yAlign||nv(n,e);return{xAlign:e.xAlign||t.xAlign||sv(n,t,e,i),yAlign:i}}function rv(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function av(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Th(n,t,e,i){let{caretSize:s,caretPadding:r,cornerRadius:a}=n,{xAlign:o,yAlign:l}=e,c=s+r,{topLeft:u,topRight:d,bottomLeft:g,bottomRight:p}=dn(a),b=rv(t,o),x=av(t,l,c);return l==="center"?o==="left"?b+=c:o==="right"&&(b-=c):o==="left"?b-=Math.max(u,g)+s:o==="right"&&(b+=Math.max(d,p)+s),{x:Gt(b,0,i.width-t.width),y:Gt(x,0,i.height-t.height)}}function js(n,t,e){let i=ie(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Ph(n){return Ie([],Ke(n))}function ov(n,t,e){return Ge(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Eh(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var Ns=class extends we{constructor(t){super();this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new ka(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=ov(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),a=i.afterTitle.apply(this,[t]),o=[];return o=Ie(o,Ke(s)),o=Ie(o,Ke(r)),o=Ie(o,Ke(a)),o}getBeforeBody(t,e){return Ph(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){let{callbacks:i}=e,s=[];return Mt(t,r=>{let a={before:[],lines:[],after:[]},o=Eh(i,r);Ie(a.before,Ke(o.beforeLabel.call(this,r))),Ie(a.lines,o.label.call(this,r)),Ie(a.after,Ke(o.aft
type: bar
labels: [${e}]
series:
${i.map(r=>` - title: ${r.dataTitle}
data: [${r.data}]`).join(`
`)}
width: 80%
beginAtZero: true
\`\`\``;n.replaceSelection(s)}function Ga(n,t,e){let i;try{i=qh.Extractor.extractObject(n,t,!1)}catch(a){throw new Yh.Notice("Table malformed"),a}let s=Object.keys(Object.values(i)[0]),r=Object.keys(i).map(a=>({dataTitle:a,data:Object.values(i[a])}));return e&&(r=r.filter(a=>e.contains(a.dataTitle))),{labels:s,dataFields:r}}ue.register(...zh);var Us=class{constructor(t){this.plugin=t}async datasetPrep(t,e,i=!1){var c,u,d,g;let s=[];if(!t.id){let p=[];if(this.plugin.settings.themeable||i){let b=1;for(;;){let x=getComputedStyle(e).getPropertyValue(`--chart-color-${b}`);if(x)p.push(x),b++;else break}}for(let b=0;t.series.length>b;b++)s.push({label:(c=t.series[b].title)!=null?c:"",data:t.series[b].data,backgroundColor:t.labelColors?p.length?Ze(p,t.transparency):Ze(this.plugin.settings.colors,t.transparency):p.length?Ze(p,t.transparency)[b]:Ze(this.plugin.settings.colors,t.transparency)[b],borderColor:t.labelColors?p.length?p:this.plugin.settings.colors:p.length?p[b]:this.plugin.settings.colors[b],borderWidth:1,fill:t.fill?t.stacked?b==0?"origin":"-1":!0:!1,tension:(u=t.tension)!=null?u:0})}let r=t.time?{type:"time",time:{unit:t.time}}:null,a=t.labels,o=getComputedStyle(e).getPropertyValue("--background-modifier-border"),l;return ue.defaults.color=getComputedStyle(e).getPropertyValue("--text-muted"),ue.defaults.font.family=getComputedStyle(e).getPropertyValue("--mermaid-font"),ue.defaults.plugins=pi(di({},ue.defaults.plugins),{legend:pi(di({},ue.defaults.plugins.legend),{display:(d=t.legend)!=null?d:!0,position:(g=t.legendPosition)!=null?g:"top"})}),ue.defaults.layout.padding=t.padding,t.type=="radar"||t.type=="polarArea"?l={type:t.type,data:{labels:a,datasets:s},options:{animation:{duration:0},scales:{r:pi(di({},r),{grid:{color:o},beginAtZero:t.beginAtZero,max:t.rMax,min:t.rMin,ticks:{backdropColor:o}})}}}:t.type=="bar"||t.type=="line"?l={type:t.type,data:{labels:a,datasets:s},options:{animation:{duration:0},indexAxis:t.indexAxis,spanGaps:t.spanGaps,scales:{y:{min:t.yMin,max:t.yMax,reverse:t.yReverse,ticks:{display:t.yTickDisplay,padding:t.yTickPadding},display:t.yDisplay,stacked:t.stacked,beginAtZero:t.beginAtZero,grid:{color:o},title:{display:t.yTitle,text:t.yTitle}},x:pi(di({},r),{min:t.xMin,max:t.xMax,reverse:t.xReverse,ticks:{display:t.xTickDisplay,padding:t.xTickPadding},display:t.xDisplay,stacked:t.stacked,grid:{color:o},title:{display:t.xTitle,text:t.xTitle}})}}}:l={type:t.type,data:{labels:a,datasets:s},options:{animation:{duration:0},spanGaps:t.spanGaps}},{chartOptions:l,width:t.width}}async imageRenderer(t,e){let i=l=>new Promise(c=>setTimeout(c,l)),s=document.createElement("canvas"),r=s.getContext("2d"),a=await this.datasetPrep(await(0,Xs.parseYaml)(t.replace("```chart","").replace("```","").replace(/\t/g," ")),document.body);new ue(r,a.chartOptions),document.body.append(s),await i(250);let o=s.toDataURL(e.format,e.quality);return document.body.removeChild(s),o.substring(o.indexOf(",")+1)}renderRaw(t,e){var s;let i=e.createEl("canvas");if(t.chartOptions)try{let r=new ue(i.getContext("2d"),t.chartOptions);return i.parentElement.style.width=(s=t.width)!=null?s:"100%",i.parentElement.style.margin="auto",r}catch(r){return Je(r,e),null}else try{return new ue(i.getContext("2d"),t)}catch(r){return Je(r,e),null}}async renderFromYaml(t,e,i){this.plugin.app.workspace.onLayoutReady(()=>i.addChild(new Gh(t,e,this,i.sourcePath)))}},Gh=class extends Xs.MarkdownRenderChild{constructor(t,e,i,s){super(e);this.el=e,this.data=t,this.renderer=i,this.ownPath=s,this.changeHandler=this.changeHandler.bind(this),this.reload=this.reload.bind(this)}async onload(){var t,e,i,s;try{let r=await this.renderer.datasetPrep(this.data,this.el),a={};if(this.data.id){let o=[];if(this.renderer.plugin.settings.themeable){let g=1;for(;;){let p=getComputedStyle(this.el).getPropertyValue(`--chart-color-${g}`);if(p)o.push(p),g++;else break}}a.datasets=[];let l;this.data.file&&(l=this.renderer.plugin.app.metadataCache.getFirstLinkpathDest(this.data.file,this.renderer.plugin.app.workspace.getActiveFile().path));let c=(t=this.renderer.plugin.app.metadataC
linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`,Bv=360,Uh="keydown",Js="mousedown",Za="focusin";function ze(n,t){return(t||document).querySelector(n)}function Kh(n){n.preventDefault(),n.stopPropagation()}function Ja(n,t,e,i,s){n.add(t,Uh,function(r){e.indexOf(r.key)>=0&&(s&&Kh(r),i(r))})}var Qa=function(){function n(t){Xa(this,n),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new $v,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Ua(n,[{key:"setOptions",value:function(e){var i=this;if(!e)return;var s=this.settings;function r(c,u,d){for(var g in c)d&&d.indexOf(g)>=0||(u[g]=c[g])}if(e instanceof HTMLElement)s.parent=e;else{s.parent&&e.parent&&s.parent!==e.parent&&(this._events.remove(s.parent),this._popupInited=!1),r(e,s),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var a=e.color||e.colour;a&&this._setColor(a)}var o=s.parent;if(o&&s.popup&&!this._popupInited){var l=function(u){return i.openHandler(u)};this._events.add(o,"click",l),Ja(this._events,o,[" ","Spacebar","Enter"],l),this._popupInited=!0}else e.parent&&!s.popup&&this.show()}},{key:"openHandler",value:function(e){if(this.show()){e&&e.preventDefault(),this.settings.parent.style.pointerEvents="none";var i=e&&e.type===Uh?this._domEdit:this.domElement;setTimeout(function(){return i.focus()},100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(e){var i=e&&e.type,s=!1;if(!e)s=!0;else if(i===Js||i===Za){var r=(this.__containedEvent||0)+100;e.timeStamp>r&&(s=!0)}else Kh(e),s=!0;s&&this.hide()&&(this.settings.parent.style.pointerEvents="",i!==Js&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,i){this.closeHandler(),this.setOptions(e),i&&this.openHandler()}},{key:"setColor",value:function(e,i){this._setColor(e,{silent:i})}},{key:"_setColor",value:function(e,i){if(typeof e=="string"&&(e=e.trim()),!!e){i=i||{};var s=void 0;try{s=new Fv(e)}catch(a){if(i.failSilently)return;throw a}if(!this.settings.alpha){var r=s.hsla;r[3]=1,s.hsla=r}this.colour=this.color=s,this._setHSLA(null,null,null,null,i)}}},{key:"setColour",value:function(e,i){this.setColor(e,i)}},{key:"show",value:function(){var e=this.settings.parent;if(!e)return!1;if(this.domElement){var i=this._toggleDOM(!0);return this._setPosition(),i}var s=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',r=Iv(s);return this.domElement=r,this._domH=ze(".picker_hue",r),this._domSL=ze(".picker_sl",r),this._domA=ze(".picker_alpha",r),this._domEdit=ze(".picker_editor input",r),this._domSample=ze(".picker_sample",r),this._domOkay=ze(".picker_done button",r),this._domCancel=ze(".picker_cancel button",r),r.classList.add("layout_"+this.settings.layout),this.settings.alpha||r.classList.add("no_alpha"),this.settings.editor||r.classList.add("no_editor"),this.settings.cancelButton||r.classList.add("no_cancel"),this._ifPopup(function(){return r.classList.add("popup")}),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var e=this,i=this,s=this.domElement,r=this._events;function a(c
<p class="subDesc svelte-1tlkntj">Set Data Fields (Comma seperated)</p>`,i=Lt(),s=Y("td"),r=Y("input"),a=Lt(),o=Y("br"),l=Lt(),c=Y("input"),q(e,"class","desc svelte-1tlkntj"),q(r,"type","text"),q(r,"placeholder","Name"),q(c,"type","text"),q(c,"placeholder","1, -2, 11, 5"),Vt(c,"margin-top","3px"),q(s,"class","controlElement svelte-1tlkntj")},m(b,x){je(b,t,x),B(t,e),B(t,i),B(t,s),B(s,r),oe(r,n[33].dataTitle),B(s,a),B(s,o),B(s,l),B(s,c),oe(c,n[33].data),u||(d=[Xt(r,"input",g),Xt(c,"input",p)],u=!0)},p(b,x){n=b,x[0]&1024&&r.value!==n[33].dataTitle&&oe(r,n[33].dataTitle),x[0]&1024&&c.value!==n[33].data&&oe(c,n[33].data)},d(b){b&&Ee(t),u=!1,Qe(d)}}}function s_(n){let t,e,i,s,r,a,o,l,c,u,d,g,p,b,x,M,C,P,$,R,F;return{c(){t=Y("hr"),e=Lt(),i=Y("table"),s=Y("tr"),r=Y("td"),r.innerHTML=`<p class="mainDesc svelte-1tlkntj">Line of Best Fit</p>
<p class="subDesc svelte-1tlkntj">Create a line of best fit</p>`,a=Y("td"),o=Y("input"),l=Lt(),c=Y("tr"),u=Y("td"),u.innerHTML=`<p class="mainDesc svelte-1tlkntj">Best Fit Line ID</p>
<p class="subDesc svelte-1tlkntj">The line ID used to create the line of best fit</p>`,d=Y("td"),g=Y("input"),p=Y("br"),b=Lt(),x=Y("tr"),M=Y("td"),M.innerHTML=`<p class="mainDesc svelte-1tlkntj">Line of Best Fit Title</p>
<p class="subDesc svelte-1tlkntj">The title for the line of best fit</p>`,C=Y("td"),P=Y("input"),$=Y("br"),q(r,"class","desc svelte-1tlkntj"),q(o,"type","checkbox"),q(o,"class","task-list-item-checkbox"),Vt(o,"width","16px"),Vt(o,"height","16px"),q(a,"class","controlElement svelte-1tlkntj"),q(u,"class","desc svelte-1tlkntj"),q(g,"type","text"),q(g,"placeholder","0"),Vt(g,"width","26px"),Vt(g,"height","32px"),q(d,"class","controlElement svelte-1tlkntj"),q(M,"class","desc svelte-1tlkntj"),q(P,"type","text"),q(P,"placeholder","Line of Best Fit"),Vt(P,"width","96px"),Vt(P,"height","32px"),q(C,"class","controlElement svelte-1tlkntj"),Vt(i,"width","100%"),q(i,"class","svelte-1tlkntj")},m(z,N){je(z,t,N),je(z,e,N),je(z,i,N),B(i,s),B(s,r),B(s,a),B(a,o),o.checked=n[6],B(i,l),B(i,c),B(c,u),B(c,d),B(d,g),oe(g,n[8]),B(d,p),B(i,b),B(i,x),B(x,M),B(x,C),B(C,P),oe(P,n[7]),B(C,$),R||(F=[Xt(o,"change",n[26]),Xt(g,"input",n[27]),Xt(P,"input",n[28])],R=!0)},p(z,N){N[0]&64&&(o.checked=z[6]),N[0]&256&&g.value!==z[8]&&oe(g,z[8]),N[0]&128&&P.value!==z[7]&&oe(P,z[7])},d(z){z&&Ee(t),z&&Ee(e),z&&Ee(i),R=!1,Qe(F)}}}function r_(n){let t,e,i,s,r,a,o,l,c,u,d,g,p,b,x,M,C,P,$,R,F,z,N,X,U,nt,ot,st,kt,Ft,et,Ct,yt,Qt,de,rt,Ot,It,Wt,Ut,w,v,y,A,E,O,Z,W,J,tt,_t,zt,Tt,Nt,Ht,ae,_e,pe,_n,tn,yn,De,oi,xn,Ln,Ji,li,Rn,Ne,kn,wn,Fn,Qi,en=n[10],se=[];for(let pt=0;pt<en.length;pt+=1)se[pt]=pu(du(n,en,pt));return De=new fu({props:{headerText:"Line of Best Fit (Line chart only)",$$slots:{default:[s_]},$$scope:{ctx:n}}}),{c(){t=Y("div"),e=Y("h3"),e.textContent="Create a new Chart",i=Lt(),s=Y("div"),r=Y("div"),a=Y("table"),o=Y("tr"),l=Y("td"),l.innerHTML=`<p class="mainDesc svelte-1tlkntj">Chart Type</p>
<p class="subDesc svelte-1tlkntj">Choose a Chart Type</p>`,c=Y("td"),u=Y("select"),d=Y("option"),d.textContent="Bar",g=Y("option"),g.textContent="Line",p=Y("option"),p.textContent="Pie",b=Y("option"),b.textContent="Doughnut",x=Y("option"),x.textContent="Radar",M=Y("option"),M.textContent="Polar Area",C=Lt(),P=Y("tr"),$=Y("td"),$.innerHTML=`<p class="mainDesc svelte-1tlkntj">Smoothness</p>
<p class="subDesc svelte-1tlkntj">Changes the smoothness of the Chart</p>`,R=Y("td"),F=Y("input"),z=Lt(),N=Y("tr"),X=Y("td"),X.innerHTML=`<p class="mainDesc svelte-1tlkntj">Width</p>
<p class="subDesc svelte-1tlkntj">Changes the horizontal width</p>`,U=Y("td"),nt=Y("input"),ot=Lt(),st=Y("tr"),kt=Y("td"),kt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Fill</p>
<p class="subDesc svelte-1tlkntj">Fill the underside of the Chart</p>`,Ft=Y("td"),et=Y("input"),Ct=Lt(),yt=Y("tr"),Qt=Y("td"),Qt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Distinct Colors</p>
<p class="subDesc svelte-1tlkntj">Use distinct Colors for each Label</p>`,de=Y("td"),rt=Y("input"),Ot=Lt(),It=Y("tr"),Wt=Y("td"),Wt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Start at Zero</p>
<p class="subDesc svelte-1tlkntj">Don&#39;t cut the graph at the bottom</p>`,Ut=Y("td"),w=Y("input"),v=Lt(),y=Y("hr"),A=Lt(),E=Y("table"),O=Y("tr"),Z=Y("td"),Z.innerHTML=`<p class="mainDesc svelte-1tlkntj">X Axis</p>
<p class="subDesc svelte-1tlkntj">Set Labels (Comma seperated)</p>`,W=Lt(),J=Y("td"),tt=Y("input"),_t=Y("br"),zt=Lt(),Tt=Y("hr"),Nt=Lt(),Ht=Y("table");for(let pt=0;pt<se.length;pt+=1)se[pt].c();ae=Lt(),_e=Y("div"),pe=Y("button"),pe.textContent="Add more",_n=Lt(),tn=Y("hr"),yn=Lt(),hu(De.$$.fragment),oi=Lt(),xn=Y("div"),Ln=Y("div"),Ji=Lt(),li=Y("hr"),Rn=Lt(),Ne=Y("div"),kn=Y("button"),kn.textContent="Insert Chart",q(l,"class","desc svelte-1tlkntj"),d.__value="bar",d.value=d.__value,g.__value="line",g.value=g.__value,p.__value="pie",p.value=p.__value,b.__value="doughnut",b.value=b.__value,x.__value="radar",x.value=x.__value,M.__value="polarArea",M.value=M.__value,q(u,"name","Chart Types"),q(u,"id","chart-types"),q(u,"class","dropdown"),n[0]===void 0&&Ui(()=>n[16].call(u)),q(c,"class","controlElement svelte-1tlkntj"),q($,"class","desc svelte-1tlkntj"),q(F,"type","range"),q(F,"min","0"),q(F,"max","100"),q(F,"class","slider"),q(R,"class","controlElement svelte-1tlkntj"),q(X,"class","desc svelte-1tlkntj"),q(nt,"type","range"),q(nt,"min","20"),q(nt,"max","100"),q(nt,"class","slider"),q(U,"class","controlElement svelte-1tlkntj"),q(kt,"class","desc svelte-1tlkntj"),q(et,"type","checkbox"),q(et,"class","task-list-item-checkbox"),Vt(et,"width","16px"),Vt(et,"height","16px"),q(Ft,"class","controlElement svelte-1tlkntj"),q(Qt,"class","desc svelte-1tlkntj"),q(rt,"type","checkbox"),q(rt,"class","task-list-item-checkbox"),Vt(rt,"width","16px"),Vt(rt,"height","16px"),q(de,"class","controlElement svelte-1tlkntj"),q(Wt,"class","desc svelte-1tlkntj"),q(w,"type","checkbox"),q(w,"class","task-list-item-checkbox"),Vt(w,"width","16px"),Vt(w,"height","16px"),q(Ut,"class","controlElement svelte-1tlkntj"),Vt(a,"width","100%"),q(a,"class","svelte-1tlkntj"),q(Z,"class","desc svelte-1tlkntj"),q(tt,"type","text"),q(tt,"placeholder","Monday, Tuesday, ..."),q(J,"class","controlElement svelte-1tlkntj"),Vt(E,"width","100%"),q(E,"class","svelte-1tlkntj"),q(_e,"class","addMoreButtonContainer svelte-1tlkntj"),Vt(Ht,"width","100%"),q(Ht,"class","svelte-1tlkntj"),q(Ln,"id","preview"),q(xn,"class","chartPreview svelte-1tlkntj"),q(s,"class","modalColumn svelte-1tlkntj"),q(t,"class","chart-modal svelte-1tlkntj"),q(kn,"class","mod-cta"),Vt(Ne,"display","flex"),Vt(Ne,"justify-content","center"),Vt(Ne,"align-items","center")},m(pt,Kt){je(pt,t,Kt),B(t,e),B(t,i),B(t,s),B(s,r),B(r,a),B(a,o),B(o,l),B(o,c),B(c,u),B(u,d),B(u,g),B(u,p),B(u,b),B(u,x),B(u,M),so(u,n[0]),B(a,C),B(a,P),B(P,$),B(P,R),B(R,F),oe(F,n[1]),B(a,z),B(a,N),B(N,X),B(N,U),B(U,nt),oe(nt,n[2]),B(a,ot),B(a,st),B(st,kt),B(st,Ft),B(Ft,et),et.checked=n[3],B(a,Ct),B(a,yt),B(yt,Qt),B(yt,de),B(de,rt),rt.checked=n[4],B(a,Ot),B(a,It),B(It,Wt),B(It,Ut),B(Ut,w),w.checked=n[5],B(r,v),B(r,y),B(r,A),B(r,E),B(E,O),B(O,Z),B(O,W),B(O,J),B(J,tt),oe(tt,n[9]),B(J,_t),B(r,zt),B(r,Tt),B(r,Nt),B(r,Ht);for(let nn=0;nn<se.length;nn+=1)se[nn].m(Ht,null);B(Ht,ae),B(Ht,_e),B(_e,pe),B(r,_n),B(r,tn),B(r,yn),lo(De,r,null),B(s,oi),B(s,xn),B(xn,Ln),n[29](Ln),B(t,Ji),B(t,li),je(pt,Rn,Kt),je(pt,Ne,Kt),B(Ne,kn),wn=!0,Fn||(Qi=[Xt(u,"change",n[16]),Xt(F,"change",n[17]),Xt(F,"input",n[17]),Xt(nt,"change",n[18]),Xt(nt,"input",n[18]),Xt(et,"change",n[19]),Xt(rt,"change",n[20]),Xt(w,"change",n[21]),Xt(tt,"input",n[22]),Xt(pe,"click",n[25]),Xt(kn,"click",n[12])],Fn=!0)},p(pt,Kt){if(Kt[0]&1&&so(u,pt[0]),Kt[0]&2&&oe(F,pt[1]),Kt[0]&4&&oe(nt,pt[2]),Kt[0]&8&&(et.checked=pt[3]),Kt[0]&16&&(rt.checked=pt[4]),Kt[0]&32&&(w.checked=pt[5]),Kt[0]&512&&tt.value!==pt[9]&&oe(tt,pt[9]),Kt[0]&1024){en=pt[10];let le;for(le=0;le<en.length;le+=1){let ts=du(pt,en,le);se[le]?se[le].p(ts,Kt):(se[le]=pu(ts),se[le].c(),se[le].m(Ht,ae))}for(;le<se.length;le+=1)se[le].d(1);se.length=en.length}let nn={};Kt[0]&448|Kt[1]&32&&(nn.$$scope={dirty:Kt,ctx:pt}),De.$set(nn)},i(pt){wn||(Ki(De.$$.fragment,pt),wn=!0)},o(pt){lr(De.$$.fragment,pt),wn=!1},d(pt){pt&&Ee(t),ru(se,pt),cr(De),n[29](null),pt&&Ee(Rn),pt&&Ee(Ne),Fn=!1,Qe(Qi)}}}function a_(n,t,e){let{editor:i}=t,{renderer:s}=t,r=ro(),a="bar",o=null,l=20,c=80,u=!1,d=!1,g=!1,p=!1,b,x="0",M="",C=[{dataTitle:"",data:""}],P,$=
labels: [${M}]
series:
${C.map(rt=>` - title: ${rt.dataTitle}
data: [${rt.data}]`).join(`
`)}
tension: ${l/100}
width: ${c}%
labelColors: ${d}
fill: ${u}
beginAtZero: ${g}
bestFit: ${p}
bestFitTitle: ${b}
bestFitNumber: ${x}`)}if(n.$$.dirty[0]&34816){t:if($)try{R(P,$)}catch(rt){Je(rt,$)}}},[a,l,c,u,d,g,p,b,x,M,C,$,F,i,s,P,z,N,X,U,nt,ot,st,kt,Ft,et,Ct,yt,Qt,de]}var gu=class extends Zi{constructor(t){super();hr(this,t,a_,r_,er,{editor:13,renderer:14},i_,[-1,-1])}},mu=gu;var fr=class extends bu.Modal{constructor(t,e,i,s){super(t);this.settings=i,this.view=e,this.renderer=s}onOpen(){let{contentEl:t,view:e,settings:i,renderer:s}=this;t.empty(),new mu({target:t,props:{editor:e.editor,renderer:s}}).$on("close",()=>this.close())}onClose(){let{contentEl:t}=this;t.empty()}};var vu=Ae(require("obsidian")),_u={chart:'<svg xmlns="http://www.w3.org/2000/svg" fill-opacity="0.0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pie-chart"><path d="M21.21 15.89A10 10 0 1 1 8 2.83"></path><path d="M22 12A10 10 0 0 0 12 2v10z"></path></svg>'},yu=()=>{Object.keys(_u).forEach(n=>{(0,vu.addIcon)(n,_u[n])})};var co=class extends Oe.Plugin{constructor(){super(...arguments);this.postprocessor=async(t,e,i)=>{let s;try{s=await(0,Oe.parseYaml)(t.replace(/ /g," "))}catch(o){Je(o,e);return}if(!s.id&&(!s||!s.type||!s.labels||!s.series)){Je("Missing type, labels or series",e);return}if(s.bestFit===!0&&s.type==="line"){if(s.bestFitNumber!=null)var r=s.series[Number(s.bestFitNumber)].data;else var r=s.series[0].data;let o=s.labels,l=0,c=0,u=0,d=0;for(let x=0;x<r.length;++x)l=l+r[x],c=c+o[x],u=u+r[x]*r[x],d=d+r[x]*o[x];let g=(r.length*d-c*l)/(r.length*u-l*l),p=(c-g*l)/r.length,b=[];for(let x=0;x<o.length;++x)b.push((o[x]-p)/g);if(s.bestFitTitle!=null&&s.bestFitTitle!="undefined")var a=String(s.bestFitTitle);else var a="Line of Best Fit";s.series.push({title:a,data:b})}await this.renderer.renderFromYaml(s,e,i)}}async loadSettings(){this.settings=Object.assign({},Ks,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async onload(){console.log("loading plugin: Obsidian Charts"),await this.loadSettings(),yu(),this.renderer=new Us(this),window.renderChart=this.renderer.renderRaw,this.addSettingTab(new to(this.app,this)),this.addCommand({id:"creation-helper",name:"Insert new Chart",checkCallback:t=>{let e=this.app.workspace.activeLeaf;return e.view instanceof Oe.MarkdownView?(t||new fr(this.app,e.view,this.settings,this.renderer).open(),!0):!1}}),this.addCommand({id:"chart-from-table-column",name:"Create Chart from Table (Column oriented Layout)",editorCheckCallback:(t,e,i)=>{let s=e.getSelection();return i instanceof Oe.MarkdownView&&s.split(`
`).length>=3&&s.split("|").length>=2?(t||qa(e,"columns"),!0):!1}}),this.addCommand({id:"chart-from-table-row",name:"Create Chart from Table (Row oriented Layout)",editorCheckCallback:(t,e,i)=>i instanceof Oe.MarkdownView&&e.getSelection().split(`
`).length>=3&&e.getSelection().split("|").length>=2?(t||qa(e,"rows"),!0):!1}),this.addCommand({id:"chart-to-svg",name:"Create Image from Chart",editorCheckCallback:(t,e,i)=>i instanceof Oe.MarkdownView&&e.getSelection().startsWith("```chart")&&e.getSelection().endsWith("```")?(t||(new Oe.Notice("Rendering Chart..."),Nh(e,this.app,this.renderer,i.file,this.settings)),!0):!1}),this.registerMarkdownCodeBlockProcessor("chart",this.postprocessor),this.registerMarkdownCodeBlockProcessor("advanced-chart",async(t,e)=>this.renderer.renderRaw(await JSON.parse(t),e)),this.registerEvent(this.app.workspace.on("editor-menu",(t,e,i)=>{i&&this.settings.contextMenu&&t.addItem(s=>{s.setTitle("Insert Chart").setIcon("chart").onClick(r=>{new fr(this.app,i,this.settings,this.renderer).open()})})}))}onunload(){console.log("unloading plugin: Obsidian Charts")}};
/*
* @license
*
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
*
* Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
* https://github.com/ts-stack/markdown
*/
/*!
* chartjs-adapter-moment v1.0.0
* https://www.chartjs.org
* (c) 2021 chartjs-adapter-moment Contributors
* Released under the MIT license
*/
/*!
* @kurkle/color v0.2.1
* https://github.com/kurkle/color#readme
* (c) 2022 Jukka Kurkela
* Released under the MIT License
*/
/*!
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*/
/*!
* vanilla-picker v2.12.1
* https://vanilla-picker.js.org
*
* Copyright 2017-2021 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
* Released under the ISC license.
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/**
* @license
*
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
*
* Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
* https://github.com/ts-stack/markdown
*/
/**
* @license
*
* Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
* https://github.com/ts-stack/markdown
*/
/**
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2011-2019, Gregor Aisch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name Gregor Aisch may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -------------------------------------------------------
*
* chroma.js includes colors from colorbrewer2.org, which are released under
* the following license:
*
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
* and The Pennsylvania State University.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* ------------------------------------------------------
*
* Named colors are taken from X11 Color Names.
* http://www.w3.org/TR/css3-color/#svg-color
*
* @preserve
*/