195 lines
316 KiB
JavaScript
195 lines
316 KiB
JavaScript
|
/*
|
||
|
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 Xp=Object.create;var li=Object.defineProperty,Kp=Object.defineProperties,Zp=Object.getOwnPropertyDescriptor,Jp=Object.getOwnPropertyDescriptors,Qp=Object.getOwnPropertyNames,al=Object.getOwnPropertySymbols,tg=Object.getPrototypeOf,ol=Object.prototype.hasOwnProperty,eg=Object.prototype.propertyIsEnumerable;var ll=(n,t,e)=>t in n?li(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ci=(n,t)=>{for(var e in t||(t={}))ol.call(t,e)&&ll(n,e,t[e]);if(al)for(var e of al(t))eg.call(t,e)&&ll(n,e,t[e]);return n},hi=(n,t)=>Kp(n,Jp(t)),cl=n=>li(n,"__esModule",{value:!0});var Sr=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),ng=(n,t)=>{cl(n);for(var e in t)li(n,e,{get:t[e],enumerable:!0})},ig=(n,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qp(t))!ol.call(n,i)&&i!=="default"&&li(n,i,{get:()=>t[i],enumerable:!(e=Zp(t,i))||e.enumerable});return n},De=n=>ig(cl(li(n!=null?Xp(tg(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var wh=Sr((Ta,Pa)=>{(function(n,t){typeof Ta=="object"&&typeof Pa!="undefined"?Pa.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.chroma=t())})(Ta,function(){"use strict";for(var n=function(h,f,g){return f===void 0&&(f=0),g===void 0&&(g=1),h<f?f:h>g?g: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(g){return h[0][g]!==void 0}).map(function(g){return h[0][g]}):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},m=Math.PI,p={clip_rgb:e,limit:n,type:o,unpack:c,last:d,PI:m,TWOPI:m*2,PITHIRD:m/3,DEG2RAD:m/180,RAD2DEG:180/m},b={format:{},autodetect:[]},k=p.last,M=p.clip_rgb,T=p.type,R=b,$=function(){for(var f=[],g=arguments.length;g--;)f[g]=arguments[g];var _=this;if(T(f[0])==="object"&&f[0].constructor&&f[0].constructor===this.constructor)return f[0];var S=k(f),C=!1;if(!S){C=!0,R.sorted||(R.autodetect=R.autodetect.sort(function(B,W){return W.p-B.p}),R.sorted=!0);for(var x=0,E=R.autodetect;x<E.length;x+=1){var A=E[x];if(S=A.test.apply(A,f),S)break}}if(R.format[S]){var I=R.format[S].apply(null,C?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 T(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var L=$,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=L,F.version="2.4.2";var z=F,H=p.unpack,G=Math.max,q=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=H(h,"rgb"),_=g[0],S=g[1],C=g[2];_=_/255,S=S/255,C=C/255;var x=1-G(_,G(S,C)),E=x<1?1/(1-x):0,A=(1-_-x)*E,I=(1-S-x)*E,B=(1-C-x)*E;return[A,I,B,x]},et=q,ot=p.unpack,st=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=ot(h,"cmyk");var g=h[0],_=h[1],S=h[2],C=h[3],x=h.length>4?h[4]:1;return C===1?[0,0,0,x]:[g>=1?0:255*(1-g)*(1-C),_>=1?0:255*(1-_)*(1-C),S>=1?0:255*(1-S)*(1-C),x]},wt=st,rt=z,U=L,_t=b,Ct=p.unpack,se=p.type,we=et;U.prototype.cmyk=function(){return we(this._rgb)},rt.cmyk=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(U,[null].concat(h,["cmyk"])))},_t.format.cmyk=wt,_t.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Ct(h,"cmyk"),se(h)==="array"&&h.length===4)return"cmyk"}});var It=p.unpack,Wt=p.last,jt=function(h){return Math.round(h*100)/100},Nt=function(){for(var h=[],f=arguments.length;f--;)h[f
|
||
|
<pre><code>`+K+`
|
||
|
</code></pre>
|
||
|
`;var V=this.options.langPrefix+this.options.escape(y,!0);return`
|
||
|
<pre><code class="`+V+'">'+K+`
|
||
|
</code></pre>
|
||
|
`},w.prototype.blockquote=function(v){return`<blockquote>
|
||
|
`+v+`</blockquote>
|
||
|
`},w.prototype.html=function(v){return v},w.prototype.heading=function(v,y,D){var P=this.options.headerPrefix+D.toLowerCase().replace(/[^\w]+/g,"-");return"<h"+y+' id="'+P+'">'+v+"</h"+y+`>
|
||
|
`},w.prototype.hr=function(){return this.options.xhtml?`<hr/>
|
||
|
`:`<hr>
|
||
|
`},w.prototype.list=function(v,y){var D=y?"ol":"ul";return`
|
||
|
<`+D+`>
|
||
|
`+v+"</"+D+`>
|
||
|
`},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 D=y.header?"th":"td",P=y.align?"<"+D+' style="text-align:'+y.align+'">':"<"+D+">";return P+v+"</"+D+`>
|
||
|
`},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,D){if(this.options.sanitize){var P=void 0;try{P=decodeURIComponent(this.options.unescape(v)).replace(/[^\w:]/g,"").toLowerCase()}catch(K){return D}if(P.indexOf("javascript:")===0||P.indexOf("vbscript:")===0||P.indexOf("data:")===0)return D}var O='<a href="'+v+'"';return y&&(O+=' title="'+y+'"'),O+=">"+D+"</a>",O},w.prototype.image=function(v,y,D){var P='<img src="'+v+'" alt="'+D+'"';return y&&(P+=' title="'+y+'"'),P+=this.options.xhtml?"/>":">",P},w.prototype.text=function(v){return v},w}();var Wt=function(){function w(v,y,D,P){if(D===void 0&&(D=Nt.options),this.staticThis=v,this.links=y,this.options=D,this.renderer=P||this.options.renderer||new It(this.options),!this.links)throw new Error("InlineLexer requires 'links' parameter.");this.setRules()}return w.output=function(v,y,D){var P=new this(this,y,D);return P.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(),D=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:D})},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,D="";v;){if(y=this.rules.escape.exec(v)){v=v.substring(y[0].length),D+=y[1];continue}if(y=this.rules.autolink.exec(v)){var P=void 0,O=void 0;v=v.substring(y[0].length),y[2]==="@"?(P=this.options.escape(y[1].charAt(6)===":"?this.mangle(y[1].substring(7)):this.mangle(y[1])),O=this.mangle("mailto:")+P):(P=this.options.escape(y[1]),O=P),D+=this.renderer.link(O,null,P);continue}if(!this.inLink&&this.hasRulesGfm&&(y=this.rules.url.exec(v))){var P=void 0,O=void 0;v=v.substring(y[0].length),P=this.options.escape(y[1]),O=P,D+=this.renderer.link(O,null,P);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),D+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(y[0]):this.options.escape(y[0]):y[0];co
|
||
|
`).length-1,D+=P}return D},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 D="",P=this.token.ordered;this.next().type!=n.TokenType.listEnd;)D+=this.tok();return this.renderer.list(D,P)}case n.TokenType.listItemStart:{for(var D="";this.next().type!=n.TokenType.listItemEnd;)D+=this.token.type==n.TokenType.text?this.parseText():this.tok();return this.renderer.listitem(D)}case n.TokenType.looseItemStart:{for(var D="";this.next().type!=n.TokenType.listItemEnd;)D+=this.tok();return this.renderer.listitem(D)}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="",D="",K=void 0;K="";for(var V=0;V<this.token.header.length;V++){var Z={header:!0,align:this.token.align[V]},Q=this.inlineLexer.output(this.token.header[V]);K+=this.renderer.tablecell(Q,Z)}O+=this.renderer.tablerow(K);try{for(var vt=F(this.token.cells),Rt=vt.next();!Rt.done;Rt=vt.next()){var Tt=Rt.value;K="";for(var zt=0;zt<Tt.length;zt++)K+=this.renderer.tablecell(this.inlineLexer.output(Tt[zt]),{header:!1,align:this.token.align[zt]});D+=this.renderer.tablerow(K)}}catch(fe){v={error:fe}}finally{try{Rt&&!Rt.done&&(y=vt.return)&&y.call(vt)}finally{if(v)throw v.error}}return this.renderer.table(O,D)}case n.TokenType.blockquoteStart:{for(var D="";this.next().type!=n.TokenType.blockquoteEnd;)D+=this.tok();return this.renderer.blockquote(D)}case n.TokenType.hr:return this.renderer.hr();case n.TokenType.html:{var Bt=!this.token.pre&&!this.options.pedantic?this.inlineLexer.output(this.token.text):this.token.text;return this.renderer.html(Bt)}default:{if(this.simpleRenderers.length){for(var V=0;V<this.simpleRenderers.length;V++)if(this.token.type=="simpleRule"+(V+1))return this.simpleRenderers[V].call(this.renderer,this.token.execArr)}var re='Token with "'+this.token.type+'" type was not found.';if(this.options.silent)console.log(re);else throw new Error(re)}}},w}();var Nt=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""}),qt.simpleRules.push(v),this.simpleRenderers.push(y),this},w.parse=function(v,y){y===void 0&&(y=this.options);try{var D=this.callBlockLexer(v,y),P=D.tokens,O=D.links;return this.callParser(P,O,y)}catch(K){return this.callMe(K)}},w.debug=function(v,y){y===void 0&&(y=this.options);var D=this.callBlockLexer(v,y),P=D.tokens,O=D.links,K=P.slice(),V=new jt(y);V.simpleRenderers=this.simpleRenderers;var Z=V.debug(O,P);return K=K.map(function(Q){Q.type=n.TokenType[Q.type]||Q.type;var vt=Q.line;return delete Q.line,vt?Object.assign({line:vt},Q):Q}),{tokens:K,links:O,result:Z}},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,""),qt.lex(v,y,!0)},w.callParser=function(v,y,D){if(this.simpleRenderers.length){var P=new jt(D);return P.simpleRenderers=this.simpleRenderers,P.parse(y,v)}else return jt.parse(v,y,D)},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}();Nt.options=new c,Nt.simpleRenderers=[];var qt=function(){function w(v,y){this.staticThis=v,this.links={},this.tokens=[],this.options=y||Nt.options,this.setRules()}return w.lex=function(v,y,D,P){var O=new this(this,y);return O.getTokens(v,D,P)},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+|$)/}),D=y.fences.source.replace("\\1","\\2"),P=v.list.source.replace("\\1","\\3");return y.paragraph=new t(v.paragraph).setGroup("(?!","(?!"+D+"|"+P+"|").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,D){var P=v,O;t:for(;P;){if((O=this.rules.newline.exec(P))&&(P=P.substring(O[0].length),O[0].length>1&&this.tokens.push({type:n.TokenType.space})),O=this.rules.code.exec(P)){P=P.substring(O[0].length);var K=O[0].replace(/^ {4}/gm,"");this.tokens.push({type:n.TokenType.code,text:this.options.pedantic?K:K.replace(/\n+$/,"")});continue}if(this.hasRulesGfm&&(O=this.rules.fences.exec(P))){P=P.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(P)){P=P.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(P))){P=P.substring(O[0].length);for(var V={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},Z=0;Z<V.align.length;Z++)/^ *-+: *$/.test(V.align[Z])?V.align[Z]="right":/^ *:-+: *$/.test(V.align[Z])?V.align[Z]="center":/^ *:-+ *$/.test(V.align[Z])?V.align[Z]="left":V.align[Z]=null;for(var Q=O[3].replace(/\n$/,"").split(`
|
||
|
`),Z=0;Z<Q.length;Z++)V.cells[Z]=Q[Z].split(/ *\| */);this.tokens.push(V);continue}if(O=this.rules.lheading.exec(P)){P=P.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(P)){P=P.substring(O[0].length),this.tokens.push({type:n.TokenType.hr});continue}if(O=this.rules.blockquote.exec(P)){P=P.substring(O[0].length),this.tokens.push({type:n.TokenType.blockquoteStart});var vt=O[0].replace(/^ *> ?/gm,"");this.getTokens(vt),this.tokens.push({type:n.TokenType.blockquoteEnd});continue}if(O=this.rules.list.exec(P)){P=P.substring(O[0].length);var Rt=O[2];this.tokens.push({type:n.TokenType.listStart,ordered:Rt.length>1});for(var vt=O[0].match(this.rules.item),Tt=vt.length,zt=!1,Bt=void 0,re=void 0,be=void 0,Z=0;Z<Tt;Z++){var V=vt[Z];Bt=V.length,V=V.replace(/^ *([*+-]|\d+\.) +/,""),V.indexOf(`
|
||
|
`)!==-1&&(Bt-=V.length,V=this.options.pedantic?V.replace(/^ {1,4}/gm,""):V.replace(new RegExp("^ {1,"+Bt+"}","gm"),"")),this.options.smartLists&&Z!==Tt-1&&(re=this.staticThis.getRulesBase().bullet.exec(vt[Z+1])[0],Rt!==re&&!(Rt.length>1&&re.length>1)&&(P=vt.slice(Z+1).join(`
|
||
|
`)+P,Z=Tt-1)),be=zt||/\n\n(?!\s*$)/.test(V),Z!==Tt-1&&(zt=V.charAt(V.length-1)===`
|
||
|
`,be||(be=zt)),this.tokens.push({type:be?n.TokenType.looseItemStart:n.TokenType.listItemStart}),this.getTokens(V,!1,D),this.tokens.push({type:n.TokenType.listItemEnd})}this.tokens.push({type:n.TokenType.listEnd});continue}if(O=this.rules.html.exec(P)){P=P.substring(O[0].length);var fe=O[1],mn=fe==="pre"||fe==="script"||fe==="style";this.tokens.push({type:this.options.sanitize?n.TokenType.paragraph:n.TokenType.html,pre:!this.options.sanitizer&&mn,text:O[0]});continue}if(y&&(O=this.rules.def.exec(P))){P=P.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(P))){P=P.substring(O[0].length);for(var V={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},Z=0;Z<V.align.length;Z++)/^ *-+: *$/.test(V.align[Z])?V.align[Z]="right":/^ *:-+: *$/.test(V.align[Z])?V.align[Z]="center":/^ *:-+ *$/.test(V.align[Z])?V.align[Z]="left":V.align[Z]=null;for(var Q=O[3].replace(/(?: *\| *)?\n$/,"").split(`
|
||
|
`),Z=0;Z<Q.length;Z++)V.cells[Z]=Q[Z].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(V);continue}if(this.staticThis.simpleRules.length){for(var Ee=this.staticThis.simpleRules,Z=0;Z<Ee.length;Z++)if(O=Ee[Z].exec(P)){P=P.substring(O[0].length);var Be="simpleRule"+(Z+1);this.tokens.push({type:Be,execArr:O});continue t}}if(y&&(O=this.rules.paragraph.exec(P))){P=P.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(P)){P=P.substring(O[0].length),this.tokens.push({type:n.TokenType.text,text:O[0]});continue}if(P)throw new Error("Infinite loop on byte: "+P.charCodeAt(0)+(", near text '"+P.slice(0,30)+"...'"))}return{tokens:this.tokens,links:this.links}},w}();qt.simpleRules=[],qt.rulesBase=null,qt.rulesGfm=null,qt.rulesTables=null,n.BlockLexer=qt,n.ExtendRegexp=t,n.InlineLexer=Wt,n.Marked=Nt,n.MarkedOptions=c,n.Parser=jt,n.Renderer=It,n.escape=o,n.unescape=l,Object.defineProperty(n,"__esModule",{value:!0})})});var Th=Sr(Qn=>{"use strict";var bv=Qn&&Qn.__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(Qn,"__esModule",{value:!0});Qn.Extractor=void 0;var Oa=Ch(),vv=function(n){bv(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 Oa.Marked.setOptions({renderer:r}),Oa.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}(Oa.Renderer);Qn.Extractor=vv});ng(exports,{default:()=>Ga});var Oe=De(require("obsidian"));function Ae(){}var hl=function(){let n=0;return function(){return n++}}();function bt(n){return n===null||typeof n=="undefined"}function Et(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 $t=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function pe(n,t){return $t(n)?n:t}function at(n,t){return typeof n=="undefined"?t:n}var ul=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,Mr=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function Dt(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(Et(n))if(r=n.length,i)for(s=r-1;s>=0
|
||
|
`)>-1?n.split(`
|
||
|
`):n}function j0(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 lh(n,t){let e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:a,boxHeight:o}=t,l=Vt(t.bodyFont),c=Vt(t.titleFont),u=Vt(t.footerFont),d=r.length,m=s.length,p=i.length,b=te(t.padding),k=b.height,M=0,T=i.reduce((L,F)=>L+F.before.length+F.lines.length+F.after.length,0);if(T+=n.beforeBody.length+n.afterBody.length,d&&(k+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),T){let L=t.displayColors?Math.max(o,l.lineHeight):l.lineHeight;k+=p*L+(T-p)*l.lineHeight+(T-1)*t.bodySpacing}m&&(k+=t.footerMarginTop+m*u.lineHeight+(m-1)*t.footerSpacing);let R=0,$=function(L){M=Math.max(M,e.measureText(L).width+R)};return e.save(),e.font=c.string,Mt(n.title,$),e.font=l.string,Mt(n.beforeBody.concat(n.afterBody),$),R=t.displayColors?a+2+t.boxPadding:0,Mt(i,L=>{Mt(L.before,$),Mt(L.lines,$),Mt(L.after,$)}),R=0,e.font=u.string,Mt(n.footer,$),e.restore(),M+=b.width,{width:M,height:k}}function N0(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function H0(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 V0(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"),H0(c,n,t,e)&&(c="center"),c}function ch(n,t,e){let i=e.yAlign||t.yAlign||N0(n,e);return{xAlign:e.xAlign||t.xAlign||V0(n,t,e,i),yAlign:i}}function W0(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Y0(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function hh(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:m,bottomRight:p}=cn(a),b=W0(t,o),k=Y0(t,l,c);return l==="center"?o==="left"?b+=c:o==="right"&&(b-=c):o==="left"?b-=Math.max(u,m)+s:o==="right"&&(b+=Math.max(d,p)+s),{x:Yt(b,0,i.width-t.width),y:Yt(k,0,i.height-t.height)}}function As(n,t,e){let i=te(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function uh(n){return Ie([],Xe(n))}function G0(n,t,e){return Ge(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function fh(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var Ls=class extends xe{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 aa(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=G0(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,Xe(s)),o=Ie(o,Xe(r)),o=Ie(o,Xe(a)),o}getBeforeBody(t,e){return uh(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){let{callbacks:i}=e,s=[];return Mt(t,r=>{let a={before:[],lines:[],after:[]},o=fh(i,r);Ie(a.before,Xe(o.beforeLabel.call(this,r))),Ie(a.lines,o.label.call(this,r)),Ie(a.after,Xe(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 Da(n,t,e){let i;try{i=Oh.Extractor.extractObject(n,t,!1)}catch(a){throw new Ph.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}}le.register(...xh);var Ns=class{constructor(t){this.plugin=t}async datasetPrep(t,e,i=!1){var c,u,d,m;let s=[];if(!t.id){let p=[];if(this.plugin.settings.themeable||i){let b=1;for(;;){let k=getComputedStyle(e).getPropertyValue(`--chart-color-${b}`);if(k)p.push(k),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?Ke(p,t.transparency):Ke(this.plugin.settings.colors,t.transparency):p.length?Ke(p,t.transparency)[b]:Ke(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 le.defaults.color=getComputedStyle(e).getPropertyValue("--text-muted"),le.defaults.font.family=getComputedStyle(e).getPropertyValue("--mermaid-font"),le.defaults.plugins=hi(ci({},le.defaults.plugins),{legend:hi(ci({},le.defaults.plugins.legend),{display:(d=t.legend)!=null?d:!0,position:(m=t.legendPosition)!=null?m:"top"})}),le.defaults.layout.padding=t.padding,t.type=="radar"||t.type=="polarArea"?l={type:t.type,data:{labels:a,datasets:s},options:{scales:{r:hi(ci({},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:{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:hi(ci({},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:{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,js.parseYaml)(t.replace("```chart","").replace("```","").replace(/\t/g," ")),document.body);new le(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 le(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 Ze(r,e),null}else try{return new le(i.getContext("2d"),t)}catch(r){return Ze(r,e),null}}async renderFromYaml(t,e,i){this.plugin.app.workspace.onLayoutReady(()=>i.addChild(new Eh(t,e,this,i.sourcePath)))}},Eh=class extends js.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 m=1;for(;;){let p=getComputedStyle(this.el).getPropertyValue(`--chart-color-${m}`);if(p)o.push(p),m++;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.metadataCache.getFileCache(l!=null?l:this.renderer.plugin.app.vault.getAbstrac
|
||
|
linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`,Sv=360,Ah="keydown",Ws="mousedown",Fa="focusin";function $e(n,t){return(t||document).querySelector(n)}function Lh(n){n.preventDefault(),n.stopPropagation()}function Ia(n,t,e,i,s){n.add(t,Ah,function(r){e.indexOf(r.key)>=0&&(s&&Lh(r),i(r))})}var $a=function(){function n(t){Aa(this,n),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new xv,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return La(n,[{key:"setOptions",value:function(e){var i=this;if(!e)return;var s=this.settings;function r(c,u,d){for(var m in c)d&&d.indexOf(m)>=0||(u[m]=c[m])}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),Ia(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===Ah?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===Ws||i===Fa){var r=(this.__containedEvent||0)+100;e.timeStamp>r&&(s=!0)}else Lh(e),s=!0;s&&this.hide()&&(this.settings.parent.style.pointerEvents="",i!==Ws&&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 yv(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=wv(s);return this.domElement=r,this._domH=$e(".picker_hue",r),this._domSL=$e(".picker_sl",r),this._domA=$e(".picker_alpha",r),this._domEdit=$e(".picker_editor input",r),this._domSample=$e(".picker_sample",r),this._domOkay=$e(".picker_done button",r),this._domCancel=$e(".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=Gt(),s=tt("td"),r=tt("input"),a=Gt(),o=tt("br"),l=Gt(),c=tt("input"),it(e,"class","desc svelte-1tlkntj"),it(r,"type","text"),it(r,"placeholder","Name"),it(c,"type","text"),it(c,"placeholder","1, -2, 11, 5"),ue(c,"margin-top","3px"),it(s,"class","controlElement svelte-1tlkntj")},m(b,k){Ni(b,t,k),Y(t,e),Y(t,i),Y(t,s),Y(s,r),Pe(r,n[27].dataTitle),Y(s,a),Y(s,o),Y(s,l),Y(s,c),Pe(c,n[27].data),u||(d=[he(r,"input",m),he(c,"input",p)],u=!0)},p(b,k){n=b,k&128&&r.value!==n[27].dataTitle&&Pe(r,n[27].dataTitle),k&128&&c.value!==n[27].data&&Pe(c,n[27].data)},d(b){b&&ei(t),u=!1,gn(d)}}}function Hv(n){let t,e,i,s,r,a,o,l,c,u,d,m,p,b,k,M,T,R,$,L,F,z,H,G,q,et,ot,st,wt,rt,U,_t,Ct,se,we,It,Wt,jt,Nt,qt,w,v,y,D,P,O,K,V,Z,Q,vt,Rt,Tt,zt,Bt,re,be,fe,mn,Ee,Be,ni,ii,Tn,je,bn,Pn,si,Je=n[7],ee=[];for(let yt=0;yt<Je.length;yt+=1)ee[yt]=qh(Gh(n,Je,yt));return{c(){t=tt("div"),e=tt("h3"),e.textContent="Create a new Chart",i=Gt(),s=tt("div"),r=tt("div"),a=tt("table"),o=tt("tr"),l=tt("td"),l.innerHTML=`<p class="mainDesc svelte-1tlkntj">Chart Type</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Choose a Chart Type</p>`,c=tt("td"),u=tt("select"),d=tt("option"),d.textContent="Bar",m=tt("option"),m.textContent="Line",p=tt("option"),p.textContent="Pie",b=tt("option"),b.textContent="Doughnut",k=tt("option"),k.textContent="Radar",M=tt("option"),M.textContent="Polar Area",T=Gt(),R=tt("tr"),$=tt("td"),$.innerHTML=`<p class="mainDesc svelte-1tlkntj">Smoothness</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Changes the smoothness of the Chart</p>`,L=tt("td"),F=tt("input"),z=Gt(),H=tt("tr"),G=tt("td"),G.innerHTML=`<p class="mainDesc svelte-1tlkntj">Width</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Changes the horizontal width</p>`,q=tt("td"),et=tt("input"),ot=Gt(),st=tt("tr"),wt=tt("td"),wt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Fill</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Fill the underside of the Chart</p>`,rt=tt("td"),U=tt("input"),_t=Gt(),Ct=tt("tr"),se=tt("td"),se.innerHTML=`<p class="mainDesc svelte-1tlkntj">Distinct Colors</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Use distinct Colors for each Label</p>`,we=tt("td"),It=tt("input"),Wt=Gt(),jt=tt("tr"),Nt=tt("td"),Nt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Start at Zero</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Don't cut the graph at the bottom</p>`,qt=tt("td"),w=tt("input"),v=Gt(),y=tt("hr"),D=Gt(),P=tt("table"),O=tt("tr"),K=tt("td"),K.innerHTML=`<p class="mainDesc svelte-1tlkntj">X Axis</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Set Labels (Comma seperated)</p>`,V=Gt(),Z=tt("td"),Q=tt("input"),vt=tt("br"),Rt=Gt(),Tt=tt("hr"),zt=Gt(),Bt=tt("table");for(let yt=0;yt<ee.length;yt+=1)ee[yt].c();re=Gt(),be=tt("div"),fe=tt("button"),fe.textContent="Add more",mn=Gt(),Ee=tt("div"),Be=tt("div"),ni=Gt(),ii=tt("hr"),Tn=Gt(),je=tt("div"),bn=tt("button"),bn.textContent="Insert Chart",it(l,"class","desc svelte-1tlkntj"),d.__value="bar",d.value=d.__value,m.__value="line",m.value=m.__value,p.__value="pie",p.value=p.__value,b.__value="doughnut",b.value=b.__value,k.__value="radar",k.value=k.__value,M.__value="polarArea",M.value=M.__value,it(u,"name","Chart Types"),it(u,"id","chart-types"),it(u,"class","dropdown"),n[0]===void 0&&Yi(()=>n[13].call(u)),it(c,"class","controlElement svelte-1tlkntj"),it($,"class","desc svelte-1tlkntj"),it(F,"type","range"),it(F,"min","0"),it(F,"max","100"),it(F,"class","slider"),it(L,"class","controlElement svelte-1tlkntj"),it(G,"class","desc svelte-1tlkntj"),it(et,"type","range"),it(et,"min","20"),it(et,"max","100"),it(et,"class","slider"),it(q,"class","controlElement svelte-1tlkntj"),it(wt,"class","desc svelte-1tlkntj"),it(U,"type","checkbox"),it(U,"class","task-list-item-checkbox"),ue(U,"width","16px"),ue(U,"height","16px"),it(rt,"class","controlElement svelte-1tlkntj"),it(se,"class","desc svelte-1tlkntj"),it(It,"type","checkbox"),it(It,"class","task-list-item-checkbox"),ue(It,"width","16px"),ue(It,"height","16px"),it(we,"class","controlElement svelte-1tlkntj"),it(Nt,"class","desc svelte-1tlkntj"),it(w,"type","checkbox"),it(w,"class","task-list-item-checkbox"),ue(w,"width","16px"),ue(w,"height","16px"),it(qt,"class","controlElement svelte-1tlkntj"),ue(a,"width","100%"),it(a,"class","svelte-1tlkntj"),it(K,"class","desc svelte-1tlkntj"),it(Q,"type","text"),it(Q,"placeholder","Monday, Tuesday, ..."),it(Z,"class","controlElement svelte-1tlkntj"),ue(P,"width","100%"),it(P,"class","svelte-1tlkntj"),it(be,"class","addMoreButtonContainer svelte-1tlkntj"),ue(Bt,"width","100%"),it(Bt,"class","svelte-1tlkntj"),it(Be,"id","preview"),it(Ee,"class","chartPreview svelte-1tlkntj"),it(s,"class","modalColumn svelte-1tlkntj"),it(t,"class","chart-modal svelte-1tlkntj"),it(bn,"class","mod-cta"),ue(je,"display","flex"),ue(je,"justify-content","center"),ue(je,"align-items","center")},m(yt,ne){Ni(yt,t,ne),Y(t,e),Y(t,i),Y(t,s),Y(s,r),Y(r,a),Y(a,o),Y(o,l),Y(o,c),Y(c,u),Y(u,d),Y(u,m),Y(u,p),Y(u,b),Y(u,k),Y(u,M),Na(u,n[0]),Y(a,T),Y(a,R),Y(R,$),Y(R,L),Y(L,F),Pe(F,n[1]),Y(a,z),Y(a,H),Y(H,G),Y(H,q),Y(q,et),Pe(et,n[2]),Y(a,ot),Y(a,st),Y(st,wt),Y(st,rt),Y(rt,U),U.checked=n[3],Y(a,_t),Y(a,Ct),Y(Ct,se),Y(Ct,we),Y(we,It),It.checked=n[4],Y(a,Wt),Y(a,jt),Y(jt,Nt),Y(jt,qt),Y(qt,w),w.checked=n[5],Y(r,v),Y(r,y),Y(r,D),Y(r,P),Y(P,O),Y(O,K),Y(O,V),Y(O,Z),Y(Z,Q),Pe(Q,n[6]),Y(Z,vt),Y(r,Rt),Y(r,Tt),Y(r,zt),Y(r,Bt);for(let Ut=0;Ut<ee.length;Ut+=1)ee[Ut].m(Bt,null);Y(Bt,re),Y(Bt,be),Y(be,fe),Y(s,mn),Y(s,Ee),Y(Ee,Be),n[23](Be),Y(t,ni),Y(t,ii),Ni(yt,Tn,ne),Ni(yt,je,ne),Y(je,bn),Pn||(si=[he(u,"change",n[13]),he(F,"change",n[14]),he(F,"input",n[14]),he(et,"change",n[15]),he(et,"input",n[15]),he(U,"change",n[16]),he(It,"change",n[17]),he(w,"change",n[18]),he(Q,"input",n[19]),he(fe,"click",n[22]),he(bn,"click",n[9])],Pn=!0)},p(yt,[ne]){if(ne&1&&Na(u,yt[0]),ne&2&&Pe(F,yt[1]),ne&4&&Pe(et,yt[2]),ne&8&&(U.checked=yt[3]),ne&16&&(It.checked=yt[4]),ne&32&&(w.checked=yt[5]),ne&64&&Q.value!==yt[6]&&Pe(Q,yt[6]),ne&128){Je=yt[7];let Ut;for(Ut=0;Ut<Je.length;Ut+=1){let Gi=Gh(yt,Je,Ut);ee[Ut]?ee[Ut].p(Gi,ne):(ee[Ut]=qh(Gi),ee[Ut].c(),ee[Ut].m(Bt,re))}for(;Ut<ee.length;Ut+=1)ee[Ut].d(1);ee.length=Je.length}},i:ti,o:ti,d(yt){yt&&ei(t),jh(ee,yt),n[23](null),yt&&ei(Tn),yt&&ei(je),Pn=!1,gn(si)}}}function Vv(n,t,e){let{editor:i}=t,{renderer:s}=t,r=Ha(),a="bar",o=null,l=20,c=80,u=!1,d=!1,m=!1,p="",b=[{dataTitle:"",data:""}],k,M=null,T=(0,Xs.debounce)(async(rt,U)=>{var _t;o&&o.destroy(),(_t=M.lastElementChild)===null||_t===void 0||_t.remove(),o=s.renderRaw(await s.datasetPrep((0,Xs.parseYaml)(rt),U),U)},500,!0);function R(){let rt=i.getDoc(),U=rt.getCursor();o.
|
||
|
labels: [${p}]
|
||
|
series:
|
||
|
${b.map(rt=>` - title: ${rt.dataTitle}
|
||
|
data: [${rt.data}]`).join(`
|
||
|
`)}
|
||
|
tension: ${l/100}
|
||
|
width: ${c}%
|
||
|
labelColors: ${d}
|
||
|
fill: ${u}
|
||
|
beginAtZero: ${m}`)}if(n.$$.dirty&4352){t:if(M)try{T(k,M)}catch(rt){Ze(rt,M)}}},[a,l,c,u,d,m,p,b,M,R,i,s,k,$,L,F,z,H,G,q,et,ot,st,wt]}var Uh=class extends Ya{constructor(t){super();Yh(this,t,Vv,Hv,Ih,{editor:10,renderer:11},Nv)}},Xh=Uh;var Ks=class extends Kh.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 Xh({target:t,props:{editor:e.editor,renderer:s}}).$on("close",()=>this.close())}onClose(){let{contentEl:t}=this;t.empty()}};var Zh=De(require("obsidian")),Jh={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>'},Qh=()=>{Object.keys(Jh).forEach(n=>{(0,Zh.addIcon)(n,Jh[n])})};var Ga=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(r){Ze(r,e);return}if(!s.id&&(!s||!s.type||!s.labels||!s.series)){Ze("Missing type, labels or series",e);return}await this.renderer.renderFromYaml(s,e,i)}}async loadSettings(){this.settings=Object.assign({},Hs,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async onload(){console.log("loading plugin: Obsidian Charts"),await this.loadSettings(),Qh(),this.renderer=new Ns(this),window.renderChart=this.renderer.renderRaw,this.addSettingTab(new za(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 Ks(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||Ea(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||Ea(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..."),Sh(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 Ks(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
|
||
|
*/
|