214 lines
364 KiB
JavaScript
214 lines
364 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 ob=Object.create;var Hi=Object.defineProperty,ab=Object.defineProperties,lb=Object.getOwnPropertyDescriptor,cb=Object.getOwnPropertyDescriptors,hb=Object.getOwnPropertyNames,Us=Object.getOwnPropertySymbols,ub=Object.getPrototypeOf,Yo=Object.prototype.hasOwnProperty,Vc=Object.prototype.propertyIsEnumerable;var Yc=(n,t,e)=>t in n?Hi(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Nn=(n,t)=>{for(var e in t||(t={}))Yo.call(t,e)&&Yc(n,e,t[e]);if(Us)for(var e of Us(t))Vc.call(t,e)&&Yc(n,e,t[e]);return n},_i=(n,t)=>ab(n,cb(t)),Xc=n=>Hi(n,"__esModule",{value:!0});var qc=(n,t)=>{var e={};for(var i in n)Yo.call(n,i)&&t.indexOf(i)<0&&(e[i]=n[i]);if(n!=null&&Us)for(var i of Us(n))t.indexOf(i)<0&&Vc.call(n,i)&&(e[i]=n[i]);return e};var Xo=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),fb=(n,t)=>{Xc(n);for(var e in t)Hi(n,e,{get:t[e],enumerable:!0})},db=(n,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hb(t))!Yo.call(n,i)&&i!=="default"&&Hi(n,i,{get:()=>t[i],enumerable:!(e=lb(t,i))||e.enumerable});return n},ze=n=>db(Xc(Hi(n!=null?ob(ub(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var Ku=Xo((qa,Ga)=>{(function(n,t){typeof qa=="object"&&typeof Ga!="undefined"?Ga.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.chroma=t())})(qa,function(){"use strict";for(var n=function(u,d,b){return d===void 0&&(d=0),b===void 0&&(b=1),u<d?d:u>b?b:u},t=n,e=function(u){u._clipped=!1,u._unclipped=u.slice(0);for(var d=0;d<=3;d++)d<3?((u[d]<0||u[d]>255)&&(u._clipped=!0),u[d]=t(u[d],0,255)):d===3&&(u[d]=t(u[d],0,1));return u},i={},s=0,r=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];s<r.length;s+=1){var o=r[s];i["[object "+o+"]"]=o.toLowerCase()}var a=function(u){return i[Object.prototype.toString.call(u)]||"object"},l=a,c=function(u,d){return d===void 0&&(d=null),u.length>=3?Array.prototype.slice.call(u):l(u[0])=="object"&&d?d.split("").filter(function(b){return u[0][b]!==void 0}).map(function(b){return u[0][b]}):u[0]},h=a,f=function(u){if(u.length<2)return null;var d=u.length-1;return h(u[d])=="string"?u[d].toLowerCase():null},g=Math.PI,p={clip_rgb:e,limit:n,type:a,unpack:c,last:f,PI:g,TWOPI:g*2,PITHIRD:g/3,DEG2RAD:g/180,RAD2DEG:180/g},m={format:{},autodetect:[]},y=p.last,S=p.clip_rgb,M=p.type,C=m,F=function(){for(var d=[],b=arguments.length;b--;)d[b]=arguments[b];var _=this;if(M(d[0])==="object"&&d[0].constructor&&d[0].constructor===this.constructor)return d[0];var P=y(d),T=!1;if(!P){T=!0,C.sorted||(C.autodetect=C.autodetect.sort(function(B,q){return q.p-B.p}),C.sorted=!0);for(var w=0,A=C.autodetect;w<A.length;w+=1){var L=A[w];if(P=L.test.apply(L,d),P)break}}if(C.format[P]){var j=C.format[P].apply(null,T?d:d.slice(0,-1));_._rgb=S(j)}else throw new Error("unknown format: "+d);_._rgb.length===3&&_._rgb.push(1)};F.prototype.toString=function(){return M(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var D=F,I=function(){for(var u=[],d=arguments.length;d--;)u[d]=arguments[d];return new(Function.prototype.bind.apply(I.Color,[null].concat(u)))};I.Color=D,I.version="2.4.2";var $=I,N=p.unpack,G=Math.max,U=function(){for(var u=[],d=arguments.length;d--;)u[d]=arguments[d];var b=N(u,"rgb"),_=b[0],P=b[1],T=b[2];_=_/255,P=P/255,T=T/255;var w=1-G(_,G(P,T)),A=w<1?1/(1-w):0,L=(1-_-w)*A,j=(1-P-w)*A,B=(1-T-w)*A;return[L,j,B,w]},it=U,lt=p.unpack,rt=function(){for(var u=[],d=arguments.length;d--;)u[d]=arguments[d];u=lt(u,"cmyk");var b=u[0],_=u[1],P=u[2],T=u[3],w=u.length>4?u[4]:1;return T===1?[0,0,0,w]:[b>=1?0:255*(1-b)*(1-T),_>=1?0:255*(1-_)*(1-T),P>=1?0:255*(1-P)*(1-T),w]},Pt=rt,zt=$,et=D,Et=m,St=p.unpack,re=p.type,ye=it;et.prototype.cmyk=function(){return ye(this._rgb)},zt.cmyk=function(){for(var u=[],d=arguments.length;d--;)u[d]=arguments[d];return new(Function.prototype.bind.apply(et,[null].concat(u,["cmyk"])))},Et.format.cmyk=Pt,Et.autodetect.push({p:2,test:function(){for(var u=[],d=arguments.length;d--;)u[d]=arguments[d];if(u=St(u,"cmyk"),r
|
||
|
<pre><code>`+Z+`
|
||
|
</code></pre>
|
||
|
`;var V=this.options.langPrefix+this.options.escape(x,!0);return`
|
||
|
<pre><code class="`+V+'">'+Z+`
|
||
|
</code></pre>
|
||
|
`},k.prototype.blockquote=function(v){return`<blockquote>
|
||
|
`+v+`</blockquote>
|
||
|
`},k.prototype.html=function(v){return v},k.prototype.heading=function(v,x,R){var E=this.options.headerPrefix+R.toLowerCase().replace(/[^\w]+/g,"-");return"<h"+x+' id="'+E+'">'+v+"</h"+x+`>
|
||
|
`},k.prototype.hr=function(){return this.options.xhtml?`<hr/>
|
||
|
`:`<hr>
|
||
|
`},k.prototype.list=function(v,x){var R=x?"ol":"ul";return`
|
||
|
<`+R+`>
|
||
|
`+v+"</"+R+`>
|
||
|
`},k.prototype.listitem=function(v){return"<li>"+v+`</li>
|
||
|
`},k.prototype.paragraph=function(v){return"<p>"+v+`</p>
|
||
|
`},k.prototype.table=function(v,x){return`
|
||
|
<table>
|
||
|
<thead>
|
||
|
`+v+`</thead>
|
||
|
<tbody>
|
||
|
`+x+`</tbody>
|
||
|
</table>
|
||
|
`},k.prototype.tablerow=function(v){return`<tr>
|
||
|
`+v+`</tr>
|
||
|
`},k.prototype.tablecell=function(v,x){var R=x.header?"th":"td",E=x.align?"<"+R+' style="text-align:'+x.align+'">':"<"+R+">";return E+v+"</"+R+`>
|
||
|
`},k.prototype.strong=function(v){return"<strong>"+v+"</strong>"},k.prototype.em=function(v){return"<em>"+v+"</em>"},k.prototype.codespan=function(v){return"<code>"+v+"</code>"},k.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},k.prototype.del=function(v){return"<del>"+v+"</del>"},k.prototype.link=function(v,x,R){if(this.options.sanitize){var E=void 0;try{E=decodeURIComponent(this.options.unescape(v)).replace(/[^\w:]/g,"").toLowerCase()}catch(Z){return R}if(E.indexOf("javascript:")===0||E.indexOf("vbscript:")===0||E.indexOf("data:")===0)return R}var O='<a href="'+v+'"';return x&&(O+=' title="'+x+'"'),O+=">"+R+"</a>",O},k.prototype.image=function(v,x,R){var E='<img src="'+v+'" alt="'+R+'"';return x&&(E+=' title="'+x+'"'),E+=this.options.xhtml?"/>":">",E},k.prototype.text=function(v){return v},k}();var Lt=function(){function k(v,x,R,E){if(R===void 0&&(R=Ut.options),this.staticThis=v,this.links=x,this.options=R,this.renderer=E||this.options.renderer||new ot(this.options),!this.links)throw new Error("InlineLexer requires 'links' parameter.");this.setRules()}return k.output=function(v,x,R){var E=new this(this,x,R);return E.output(v)},k.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},k.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)\*(?!\*)/})},k.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),x=new t(v.escape).setGroup("])","~|])").getRegexp(),R=new t(v.text).setGroup("]|","~]|").setGroup("|","|https?://|").getRegexp();return this.rulesGfm=Object.assign(Object.assign({},v),{escape:x,url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:R})},k.getRulesBreaks=function(){if(this.rulesBreaks)return this.rulesBreaks;var v=this.getRulesGfm(),x=this.getRulesGfm();return this.rulesBreaks=Object.assign(Object.assign({},x),{br:new t(v.br).setGroup("{2,}","*").getRegexp(),text:new t(x.text).setGroup("{2,}","*").getRegexp()})},k.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},k.prototype.output=function(v){v=v;for(var x,R="";v;){if(x=this.rules.escape.exec(v)){v=v.substring(x[0].length),R+=x[1];continue}if(x=this.rules.autolink.exec(v)){var E=void 0,O=void 0;v=v.substring(x[0].length),x[2]==="@"?(E=this.options.escape(x[1].charAt(6)===":"?this.mangle(x[1].substring(7)):this.mangle(x[1])),O=this.mangle("mailto:")+E):(E=this.options.escape(x[1]),O=E),R+=this.renderer.link(O,null,E);continue}if(!this.inLink&&this.hasRulesGfm&&(x=this.rules.url.exec(v))){var E=void 0,O=void 0;v=v.substring(x[0].length),E=this.options.escape(x[1]),O=E,R+=this.renderer.link(O,null,E);continue}if(x=this.rules.tag.exec(v)){!this.inLink&&/^<a /i.test(x[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(x[0])&&(this.inLink=!1),v=v.substring(x[0].length),R+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(x[0]):this.options.escape(x[0]):x[0];co
|
||
|
`).length-1,R+=E}return R},k.prototype.next=function(){return this.token=this.tokens.pop()},k.prototype.getNextElement=function(){return this.tokens[this.tokens.length-1]},k.prototype.parseText=function(){for(var v=this.token.text,x;(x=this.getNextElement())&&x.type==n.TokenType.text;)v+=`
|
||
|
`+this.next().text;return this.inlineLexer.output(v)},k.prototype.tok=function(){var v,x;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 R="",E=this.token.ordered;this.next().type!=n.TokenType.listEnd;)R+=this.tok();return this.renderer.list(R,E)}case n.TokenType.listItemStart:{for(var R="";this.next().type!=n.TokenType.listItemEnd;)R+=this.token.type==n.TokenType.text?this.parseText():this.tok();return this.renderer.listitem(R)}case n.TokenType.looseItemStart:{for(var R="";this.next().type!=n.TokenType.listItemEnd;)R+=this.tok();return this.renderer.listitem(R)}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="",R="",Z=void 0;Z="";for(var V=0;V<this.token.header.length;V++){var J={header:!0,align:this.token.align[V]},tt=this.inlineLexer.output(this.token.header[V]);Z+=this.renderer.tablecell(tt,J)}O+=this.renderer.tablerow(Z);try{for(var xt=I(this.token.cells),Ht=xt.next();!Ht.done;Ht=xt.next()){var Ot=Ht.value;Z="";for(var Yt=0;Yt<Ot.length;Yt++)Z+=this.renderer.tablecell(this.inlineLexer.output(Ot[Yt]),{header:!1,align:this.token.align[Yt]});R+=this.renderer.tablerow(Z)}}catch(xe){v={error:xe}}finally{try{Ht&&!Ht.done&&(x=xt.return)&&x.call(xt)}finally{if(v)throw v.error}}return this.renderer.table(O,R)}case n.TokenType.blockquoteStart:{for(var R="";this.next().type!=n.TokenType.blockquoteEnd;)R+=this.tok();return this.renderer.blockquote(R)}case n.TokenType.hr:return this.renderer.hr();case n.TokenType.html:{var Xt=!this.token.pre&&!this.options.pedantic?this.inlineLexer.output(this.token.text):this.token.text;return this.renderer.html(Xt)}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 ue='Token with "'+this.token.type+'" type was not found.';if(this.options.silent)console.log(ue);else throw new Error(ue)}}},k}();var Ut=function(){function k(){}return k.setOptions=function(v){return Object.assign(this.options,v),this},k.setBlockRule=function(v,x){return x===void 0&&(x=function(){return""}),Qt.simpleRules.push(v),this.simpleRenderers.push(x),this},k.parse=function(v,x){x===void 0&&(x=this.options);try{var R=this.callBlockLexer(v,x),E=R.tokens,O=R.links;return this.callParser(E,O,x)}catch(Z){return this.callMe(Z)}},k.debug=function(v,x){x===void 0&&(x=this.options);var R=this.callBlockLexer(v,x),E=R.tokens,O=R.links,Z=E.slice(),V=new Bt(x);V.simpleRenderers=this.simpleRenderers;var J=V.debug(O,E);return Z=Z.map(function(tt){tt.type=n.TokenType[tt.type]||tt.type;var xt=tt.line;return delete tt.line,xt?Object.assign({line:xt},tt):tt}),{tokens:Z,links:O,result:J}},k.callBlockLexer=function(v,x){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,x,!0)},k.callParser=function(v,x,R){if(this.simpleRenderers.length){var E=new Bt(R);return E.simpleRenderers=this.simpleRenderers,E.parse(x,v)}else return Bt.parse(v,x,R)},k.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},k}();Ut.options=new c,Ut.simpleRenderers=[];var Qt=function(){function k(v,x){this.staticThis=v,this.links={},this.tokens=[],this.options=x||Ut.options,this.setRules()}return k.lex=function(v,x,R,E){var O=new this(this,x);return O.getTokens(v,R,E)},k.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 x="(?!(?: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,x).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","<"+x).setGroup("def",v.def).getRegexp(),this.rulesBase=v},k.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),x=Object.assign(Object.assign({},v),{fences:/^ *(`{3,}|~{3,})[ \.]*((\S+)? *[^\n]*)\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),R=x.fences.source.replace("\\1","\\2"),E=v.list.source.replace("\\1","\\3");return x.paragraph=new t(v.paragraph).setGroup("(?!","(?!"+R+"|"+E+"|").getRegexp(),this.rulesGfm=x},k.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*/})},k.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},k.prototype.getTokens=function(v,x,R){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(x&&this.hasRulesTables&&(O=this.rules.nptable.exec(E))){E=E.substring(O[0].length);for(var V={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},J=0;J<V.align.length;J++)/^ *-+: *$/.test(V.align[J])?V.align[J]="right":/^ *:-+: *$/.test(V.align[J])?V.align[J]="center":/^ *:-+ *$/.test(V.align[J])?V.align[J]="left":V.align[J]=null;for(var tt=O[3].replace(/\n$/,"").split(`
|
||
|
`),J=0;J<tt.length;J++)V.cells[J]=tt[J].split(/ *\| */);this.tokens.push(V);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 xt=O[0].replace(/^ *> ?/gm,"");this.getTokens(xt),this.tokens.push({type:n.TokenType.blockquoteEnd});continue}if(O=this.rules.list.exec(E)){E=E.substring(O[0].length);var Ht=O[2];this.tokens.push({type:n.TokenType.listStart,ordered:Ht.length>1});for(var xt=O[0].match(this.rules.item),Ot=xt.length,Yt=!1,Xt=void 0,ue=void 0,ke=void 0,J=0;J<Ot;J++){var V=xt[J];Xt=V.length,V=V.replace(/^ *([*+-]|\d+\.) +/,""),V.indexOf(`
|
||
|
`)!==-1&&(Xt-=V.length,V=this.options.pedantic?V.replace(/^ {1,4}/gm,""):V.replace(new RegExp("^ {1,"+Xt+"}","gm"),"")),this.options.smartLists&&J!==Ot-1&&(ue=this.staticThis.getRulesBase().bullet.exec(xt[J+1])[0],Ht!==ue&&!(Ht.length>1&&ue.length>1)&&(E=xt.slice(J+1).join(`
|
||
|
`)+E,J=Ot-1)),ke=Yt||/\n\n(?!\s*$)/.test(V),J!==Ot-1&&(Yt=V.charAt(V.length-1)===`
|
||
|
`,ke||(ke=Yt)),this.tokens.push({type:ke?n.TokenType.looseItemStart:n.TokenType.listItemStart}),this.getTokens(V,!1,R),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 xe=O[1],Rn=xe==="pre"||xe==="script"||xe==="style";this.tokens.push({type:this.options.sanitize?n.TokenType.paragraph:n.TokenType.html,pre:!this.options.sanitizer&&Rn,text:O[0]});continue}if(x&&(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(x&&this.hasRulesTables&&(O=this.rules.table.exec(E))){E=E.substring(O[0].length);for(var V={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},J=0;J<V.align.length;J++)/^ *-+: *$/.test(V.align[J])?V.align[J]="right":/^ *:-+: *$/.test(V.align[J])?V.align[J]="center":/^ *:-+ *$/.test(V.align[J])?V.align[J]="left":V.align[J]=null;for(var tt=O[3].replace(/(?: *\| *)?\n$/,"").split(`
|
||
|
`),J=0;J<tt.length;J++)V.cells[J]=tt[J].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(V);continue}if(this.staticThis.simpleRules.length){for(var un=this.staticThis.simpleRules,J=0;J<un.length;J++)if(O=un[J].exec(E)){E=E.substring(O[0].length);var Ln="simpleRule"+(J+1);this.tokens.push({type:Ln,execArr:O});continue t}}if(x&&(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}},k}();Qt.simpleRules=[],Qt.rulesBase=null,Qt.rulesGfm=null,Qt.rulesTables=null,n.BlockLexer=Qt,n.ExtendRegexp=t,n.InlineLexer=Lt,n.Marked=Ut,n.MarkedOptions=c,n.Parser=Bt,n.Renderer=ot,n.escape=a,n.unescape=l,Object.defineProperty(n,"__esModule",{value:!0})})});var ef=Xo(Ei=>{"use strict";var Dy=Ei&&Ei.__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(Ei,"__esModule",{value:!0});Ei.Extractor=void 0;var Ua=tf(),Ey=function(n){Dy(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,o=0;o<r;o++){i.push([]);for(var a=0;a<s;a++)i[o].push(e[a][o])}return i},t.tableToObject=function(e,i){var s=e.shift().slice(1),r={};return e.forEach(function(o){var a=o.shift(),l={};o.forEach(function(c,h){l[i?s[h].toLowerCase():s[h]]=c}),r[i?a.toLowerCase():a]=l}),r},t.createExtractor=function(e,i,s){var r=new t(i,s);return Ua.Marked.setOptions({renderer:r}),Ua.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(o){return JSON.stringify(o)})},t}(Ua.Renderer);Ei.Extractor=Ey});fb(exports,{default:()=>Ol});var $e=ze(require("obsidian"));function Ee(){}var qo=function(){let n=0;return function(){return n++}}();function ut(n){return n===null||typeof n=="undefined"}function pt(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 at(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 nt(n,t){return typeof n=="undefined"?t:n}var Go=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,Ks=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function wt(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function Ct(n,t,e,i){let s,r,o;if(pt(n))if(r=n.length,i)for(s=r-1;s>=0
|
||
|
`)>-1?n.split(`
|
||
|
`):n}function z_(n,t){let{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Ru(n,t){let e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=Ft(t.bodyFont),c=Ft(t.titleFont),h=Ft(t.footerFont),f=r.length,g=s.length,p=i.length,m=Vt(t.padding),y=m.height,S=0,M=i.reduce((D,I)=>D+I.before.length+I.lines.length+I.after.length,0);if(M+=n.beforeBody.length+n.afterBody.length,f&&(y+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),M){let D=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=p*D+(M-p)*l.lineHeight+(M-1)*t.bodySpacing}g&&(y+=t.footerMarginTop+g*h.lineHeight+(g-1)*t.footerSpacing);let C=0,F=function(D){S=Math.max(S,e.measureText(D).width+C)};return e.save(),e.font=c.string,Ct(n.title,F),e.font=l.string,Ct(n.beforeBody.concat(n.afterBody),F),C=t.displayColors?o+2+t.boxPadding:0,Ct(i,D=>{Ct(D.before,F),Ct(D.lines,F),Ct(D.after,F)}),C=0,e.font=h.string,Ct(n.footer,F),e.restore(),S+=m.width,{width:S,height:y}}function B_(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function N_(n,t,e,i){let{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function H_(n,t,e,i){let{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n,c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),N_(c,n,t,e)&&(c="center"),c}function Lu(n,t,e){let i=e.yAlign||t.yAlign||B_(n,e);return{xAlign:e.xAlign||t.xAlign||H_(n,t,e,i),yAlign:i}}function W_(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function V_(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Fu(n,t,e,i){let{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:h,topRight:f,bottomLeft:g,bottomRight:p}=Le(o),m=W_(t,a),y=V_(t,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(h,g)+s:a==="right"&&(m+=Math.max(f,p)+s),{x:Zt(m,0,i.width-t.width),y:Zt(y,0,i.height-t.height)}}function zr(n,t,e){let i=Vt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Iu(n){return We([],an(n))}function Y_(n,t,e){return Ne(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function $u(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var Br=class extends qt{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 is(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=Y_(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]),o=i.afterTitle.apply(this,[t]),a=[];return a=We(a,an(s)),a=We(a,an(r)),a=We(a,an(o)),a}getBeforeBody(t,e){return Iu(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){let{callbacks:i}=e,s=[];return Ct(t,r=>{let o={before:[],lines:[],after:[]},a=$u(i,r);We(o.before,an(a.beforeLabel.call(this,r))),We(o.lines,a.label.call(this,r)),We(o.after,an(a.aft
|
||
|
`)):Array.isArray(i)?e.push.apply(e,i):ut(e)||t.unshift(""+i)}return t}function Va(n){return!n||["min","max"].indexOf(n)===-1?"max":n}var Tn=n=>n!==void 0;function gy(n,t){let e=new Set(t.map(o=>o.to)),i=new Set(t.map(o=>o.from)),s=new Set([...n.keys()]),r=0;for(;s.size;){let o=my([...s],e);for(let a of o){let l=n.get(a);Tn(l.x)||(l.x=r),s.delete(a)}s.size&&(e.clear(),t.filter(a=>s.has(a.from)).forEach(a=>e.add(a.to)),r++)}return[...n.keys()].filter(o=>!i.has(o)).forEach(o=>{let a=n.get(o);a.column||(a.x=r)}),r}function my(n,t){let e=n.filter(i=>!t.has(i));return e.length?e:n.slice(0,1)}var by=(n,t)=>n.x!==t.x?n.x-t.x:n.y-t.y,Xr=-1;function vy(){return Xr=Xr<100?Xr+1:0,Xr}function Ya(n,t,e=vy()){let i=0;for(let s of n)s.node._visited!==e&&(s.node._visited=e,i+=s.node[t].length+Ya(s.node[t],t,e));return i}var qu=n=>(t,e)=>Ya(t.node[n],n)-Ya(e.node[n],n)||t.node[n].length-e.node[n].length;function Xa(n,t){n.from.sort(qu("from"));for(let e of n.from){let i=e.node;Tn(i.y)||(i.y=t,Xa(i,t)),t=Math.max(i.y+i.out,t)}return t}function ei(n,t){n.to.sort(qu("to"));for(let e of n.to){let i=e.node;Tn(i.y)||(i.y=t,ei(i,t)),t=Math.max(i.y+i.in,t)}return t}function Ms(n,t){return Tn(n.y)?n.y:(n.y=t,t)}function _y(n,t){let e=n.filter(h=>h.x===0),i=n.filter(h=>h.x===t),s=e.filter(h=>!Tn(h.y)),r=i.filter(h=>!Tn(h.y)),o=n.filter(h=>h.x>0&&h.x<t&&!Tn(h.y)),a=e.reduce((h,f)=>Math.max(h,f.y+f.out||0),0),l=i.reduce((h,f)=>Math.max(h,f.y+f.in||0),0),c=0;return a>=l?(s.forEach(h=>{a=Ms(h,a),a=Math.max(a+h.out,ei(h,a))}),r.forEach(h=>{l=Ms(h,l),l=Math.max(l+h.in,ei(h,l))})):(r.forEach(h=>{l=Ms(h,l),l=Math.max(l+h.in,ei(h,l))}),s.forEach(h=>{a=Ms(h,a),a=Math.max(a+h.out,ei(h,a))})),o.forEach(h=>{let f=n.filter(g=>g.x===h.x&&Tn(g.y)).reduce((g,p)=>Math.max(g,p.y+Math.max(p.in,p.out)),0);f=Ms(h,f),f=Math.max(f+h.in,Xa(h,f)),f=Math.max(f+h.out,ei(h,f)),c=Math.max(c,f)}),Math.max(a,l,c)}function yy(n,t){n.sort((o,a)=>Math.max(a.in,a.out)-Math.max(o.in,o.out));let e=n[0];e.y=0;let i=Xa(e,0),s=ei(e,0),r=_y(n,t);return Math.max(i,s,r)}function xy(n,t){let e=0,i=0;for(let s=0;s<=t;s++){let r=i,o=n.filter(a=>a.x===s).sort((a,l)=>a.priority-l.priority);i=o[0].to.filter(a=>a.node.x>s+1).reduce((a,l)=>a+l.flow,0)||0;for(let a of o)a.y=r,r+=Math.max(a.out,a.in);e=Math.max(r,e)}return e}function wy(n,t){let e=1,i=0,s=0,r=0,o=[];n.sort(by);for(let a of n){if(a.y){if(a.x===0)o.push(a.y);else{for(i!==a.x&&(i=a.x,s=0),e=s+1;e<o.length&&!(o[e]>a.y);e++);s=e}a.y+=e*t,e++}r=Math.max(r,a.y+Math.max(a.in,a.out))}return r}function ky(n,t){n.forEach(e=>{let i=Math[t](e.in||e.out,e.out||e.in),s=i<e.in,r=i<e.out,o=0,a=e.from.length;e.from.sort((l,c)=>l.node.y+l.node.out/2-(c.node.y+c.node.out/2)).forEach((l,c)=>{s?l.addY=c*(i-l.flow)/(a-1):(l.addY=o,o+=l.flow)}),o=0,a=e.to.length,e.to.sort((l,c)=>l.node.y+l.node.in/2-(c.node.y+c.node.in/2)).forEach((l,c)=>{r?l.addY=c*(i-l.flow)/(a-1):(l.addY=o,o+=l.flow)})})}function Sy(n,t,e,i){let s=[...n.values()],r=gy(n,t),a=(e?xy(s,r):yy(s,r))*.03,l=wy(s,a);return ky(s,i),{maxX:r,maxY:l}}function My(n){let t=new Map;for(let i=0;i<n.length;i++){let{from:s,to:r,flow:o}=n[i];if(!t.has(s))t.set(s,{key:s,in:0,out:o,from:[],to:[{key:r,flow:o,index:i}]});else{let a=t.get(s);a.out+=o,a.to.push({key:r,flow:o,index:i})}if(!t.has(r))t.set(r,{key:r,in:o,out:0,from:[{key:s,flow:o,index:i}],to:[]});else{let a=t.get(r);a.in+=o,a.from.push({key:s,flow:o,index:i})}}let e=(i,s)=>s.flow-i.flow;return[...t.values()].forEach(i=>{i.from=i.from.sort(e),i.from.forEach(s=>{s.node=t.get(s.key)}),i.to=i.to.sort(e),i.to.forEach(s=>{s.node=t.get(s.key)})}),t}function Gu(n,t,e){for(let i of n)if(i.key===t&&i.index===e)return i.addY;return 0}var Ti=class extends ve{parseObjectData(t,e,i,s){let{from:r="from",to:o="to",flow:a="flow"}=this.options.parsing,l=e.map(({[r]:C,[o]:F,[a]:D})=>({from:C,to:F,flow:D})),{xScale:c,yScale:h}=t,f=[],g=this._nodes=My(l),{column:p,priority:m,size:y}=this.getDataset();if(m)for(let C of g.values())C.key in m&&(C.priority=m[C.key]);if(p)for(let C of g.values())C.key in p&&(C.column=!0,C.x=p[C.key]);let{maxX:S,maxY:M}=Sy(g,l,!!m,Va(y));th
|
||
|
type: bar
|
||
|
labels: [${e}]
|
||
|
series:
|
||
|
${i.map(r=>` - title: ${r.dataTitle}
|
||
|
data: [${r.data}]`).join(`
|
||
|
`)}
|
||
|
width: 80%
|
||
|
beginAtZero: true
|
||
|
\`\`\``;n.replaceSelection(s)}function Za(n,t,e){let i;try{i=sf.Extractor.extractObject(n,t,!1)}catch(o){throw new nf.Notice("Table malformed"),o}let s=Object.keys(Object.values(i)[0]),r=Object.keys(i).map(o=>({dataTitle:o,data:Object.values(i[o])}));return e&&(r=r.filter(o=>e.contains(o.dataTitle))),{labels:s,dataFields:r}}var rf={modes:{point(n,t){return Gr(n,t,{intersect:!0})},nearest(n,t,e){return Ry(n,t,e)},x(n,t,e){return Gr(n,t,{intersect:e.intersect,axis:"x"})},y(n,t,e){return Gr(n,t,{intersect:e.intersect,axis:"y"})}}};function Ja(n,t,e){return(rf.modes[e.mode]||rf.modes.nearest)(n,t,e)}function Oy(n,t,e){return e!=="x"&&e!=="y"?n.inRange(t.x,t.y,"x",!0)||n.inRange(t.x,t.y,"y",!0):n.inRange(t.x,t.y,e,!0)}function Ay(n,t,e){return e==="x"?{x:n.x,y:t.y}:e==="y"?{x:t.x,y:n.y}:t}function Gr(n,t,e){return n.visibleElements.filter(i=>e.intersect?i.inRange(t.x,t.y):Oy(i,t,e.axis))}function Ry(n,t,e){let i=Number.POSITIVE_INFINITY;return Gr(n,t,e).reduce((s,r)=>{let o=r.getCenterPoint(),a=Ay(t,o,e.axis),l=Ke(t,a);return l<i?(s=[r],i=l):l===i&&s.push(r),s},[]).sort((s,r)=>s._index-r._index).slice(0,1)}var Ly=(n,t)=>t>n||n.length>t.length&&n.slice(0,t.length)===t,ni=.001,Ur=(n,t,e)=>Math.min(e,Math.max(t,n));function Fy(n,t,e){for(let i of Object.keys(n))n[i]=Ur(n[i],t,e);return n}function Iy(n,t,e,i){if(!n||!t||e<=0)return!1;let s=i/2;return Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)<=Math.pow(e+s,2)}function of(n,{x:t,y:e,x2:i,y2:s},r,o){let a=o/2,l=n.x>=t-a-ni&&n.x<=i+a+ni,c=n.y>=e-a-ni&&n.y<=s+a+ni;return r==="x"?l:(r==="y"||l)&&c}function Oi(n,t){let{centerX:e,centerY:i}=n.getProps(["centerX","centerY"],t);return{x:e,y:i}}function $y(n,t,e,i=!0){let s=e.split("."),r=0;for(let o of t.split(".")){let a=s[r++];if(parseInt(o,10)<parseInt(a,10))break;if(Ly(a,o)){if(i)throw new Error(`${n} v${e} is not supported. v${t} or newer is required.`);return!1}}return!0}var af=n=>typeof n=="string"&&n.endsWith("%"),lf=n=>parseFloat(n)/100,cf=n=>Ur(lf(n),0,1);function Qa(n,t){return t==="start"?0:t==="end"?n:af(t)?cf(t)*n:n/2}function Dn(n,t,e=!0){return typeof t=="number"?t:af(t)?(e?cf(t):lf(t))*n:n}function jy(n,t){let{x:e,width:i}=n,s=t.textAlign;return s==="center"?e+i/2:s==="end"||s==="right"?e+i:e}function tl(n,t="center"){return at(n)?{x:nt(n.x,t),y:nt(n.y,t)}:(n=nt(n,t),{x:n,y:n})}function hf(n){return n&&(Nt(n.xValue)||Nt(n.yValue))}function Ps(n,t,e,i=!1){let s=e.init;if(s){if(s===!0)return ff(t,i)}else return;return zy(t,i,wt(s,[{chart:n,properties:t,options:e}]))}function uf(n,t,e){let i=!1;return t.forEach(s=>{le(n[s])?(i=!0,e[s]=n[s]):Nt(e[s])&&delete e[s]}),i}function ff({centerX:n,centerY:t},e){return e?{centerX:n,centerY:t,radius:0,width:0,height:0}:{x:n,y:t,x2:n,y2:t,width:0,height:0}}function zy(n,t,e){if(e===!0)return ff(n,t);if(at(e))return e}var el=new Map,By=n=>isNaN(n)||n<=0,Ny=n=>n.reduce(function(t,e){return t+=e.string,t},"");function Kr(n){if(n&&typeof n=="object"){let t=n.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function nl(n,{x:t,y:e},i){i&&(n.translate(t,e),n.rotate(Wt(i)),n.translate(-t,-e))}function En(n,t){if(t&&t.borderWidth)return n.lineCap=t.borderCapStyle,n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset,n.lineJoin=t.borderJoinStyle,n.lineWidth=t.borderWidth,n.strokeStyle=t.borderColor,!0}function Ai(n,t){n.shadowColor=t.backgroundShadowColor,n.shadowBlur=t.shadowBlur,n.shadowOffsetX=t.shadowOffsetX,n.shadowOffsetY=t.shadowOffsetY}function il(n,t){let e=t.content;if(Kr(e))return{width:Dn(e.width,t.width),height:Dn(e.height,t.height)};let i=t.font,s=pt(i)?i.map(l=>Ft(l)):[Ft(i)],r=t.textStrokeWidth,o=pt(e)?e:[e],a=o.join()+Ny(s)+r+(n._measureText?"-spriting":"");return el.has(a)||el.set(a,Xy(n,o,s,r)),el.get(a)}function df(n,t,e){let{x:i,y:s,width:r,height:o}=t;n.save(),Ai(n,e);let a=En(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),en(n,{x:i,y:s,w:r,h:o,radius:Fy(Le(e.borderRadius),0,Math.min(r,o)/2)}),n.closePath(),n.fill(),a&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function Hy(n,t,e){let i=e.content;if(Kr(i)){n.save()
|
||
|
linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`,i1=360,Yf="keydown",io="mousedown",vl="focusin";function Ve(n,t){return(t||document).querySelector(n)}function Xf(n){n.preventDefault(),n.stopPropagation()}function _l(n,t,e,i,s){n.add(t,Yf,function(r){e.indexOf(r.key)>=0&&(s&&Xf(r),i(r))})}var yl=function(){function n(t){gl(this,n),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new t1,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return ml(n,[{key:"setOptions",value:function(e){var i=this;if(!e)return;var s=this.settings;function r(c,h,f){for(var g in c)f&&f.indexOf(g)>=0||(h[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 o=e.color||e.colour;o&&this._setColor(o)}var a=s.parent;if(a&&s.popup&&!this._popupInited){var l=function(h){return i.openHandler(h)};this._events.add(a,"click",l),_l(this._events,a,[" ","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===Yf?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===io||i===vl){var r=(this.__containedEvent||0)+100;e.timeStamp>r&&(s=!0)}else Xf(e),s=!0;s&&this.hide()&&(this.settings.parent.style.pointerEvents="",i!==io&&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 Qx(e)}catch(o){if(i.failSilently)return;throw o}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=e1(s);return this.domElement=r,this._domH=Ve(".picker_hue",r),this._domSL=Ve(".picker_sl",r),this._domA=Ve(".picker_alpha",r),this._domEdit=Ve(".picker_editor input",r),this._domSample=Ve(".picker_sample",r),this._domOkay=Ve(".picker_done button",r),this._domCancel=Ve(".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 o(c
|
||
|
<p class="subDesc svelte-1tlkntj">Set Data Fields (Comma seperated)</p>`,i=It(),s=Y("td"),r=Y("input"),o=It(),a=Y("br"),l=It(),c=Y("input"),X(e,"class","desc svelte-1tlkntj"),X(r,"type","text"),X(r,"placeholder","Name"),X(c,"type","text"),X(c,"placeholder","1, -2, 11, 5"),Gt(c,"margin-top","3px"),X(s,"class","controlElement svelte-1tlkntj")},m(m,y){Xe(m,t,y),z(t,e),z(t,i),z(t,s),z(s,r),de(r,n[33].dataTitle),z(s,o),z(s,a),z(s,l),z(s,c),de(c,n[33].data),h||(f=[Jt(r,"input",g),Jt(c,"input",p)],h=!0)},p(m,y){n=m,y[0]&1024&&r.value!==n[33].dataTitle&&de(r,n[33].dataTitle),y[0]&1024&&c.value!==n[33].data&&de(c,n[33].data)},d(m){m&&Ie(t),h=!1,hn(f)}}}function w1(n){let t,e,i,s,r,o,a,l,c,h,f,g,p,m,y,S,M,C,F,D,I;return{c(){t=Y("hr"),e=It(),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>`,o=Y("td"),a=Y("input"),l=It(),c=Y("tr"),h=Y("td"),h.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>`,f=Y("td"),g=Y("input"),p=Y("br"),m=It(),y=Y("tr"),S=Y("td"),S.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>`,M=Y("td"),C=Y("input"),F=Y("br"),X(r,"class","desc svelte-1tlkntj"),X(a,"type","checkbox"),X(a,"class","task-list-item-checkbox"),Gt(a,"width","16px"),Gt(a,"height","16px"),X(o,"class","controlElement svelte-1tlkntj"),X(h,"class","desc svelte-1tlkntj"),X(g,"type","text"),X(g,"placeholder","0"),Gt(g,"width","26px"),Gt(g,"height","32px"),X(f,"class","controlElement svelte-1tlkntj"),X(S,"class","desc svelte-1tlkntj"),X(C,"type","text"),X(C,"placeholder","Line of Best Fit"),Gt(C,"width","96px"),Gt(C,"height","32px"),X(M,"class","controlElement svelte-1tlkntj"),Gt(i,"width","100%"),X(i,"class","svelte-1tlkntj")},m($,N){Xe($,t,N),Xe($,e,N),Xe($,i,N),z(i,s),z(s,r),z(s,o),z(o,a),a.checked=n[6],z(i,l),z(i,c),z(c,h),z(c,f),z(f,g),de(g,n[8]),z(f,p),z(i,m),z(i,y),z(y,S),z(y,M),z(M,C),de(C,n[7]),z(M,F),D||(I=[Jt(a,"change",n[26]),Jt(g,"input",n[27]),Jt(C,"input",n[28])],D=!0)},p($,N){N[0]&64&&(a.checked=$[6]),N[0]&256&&g.value!==$[8]&&de(g,$[8]),N[0]&128&&C.value!==$[7]&&de(C,$[7])},d($){$&&Ie(t),$&&Ie(e),$&&Ie(i),D=!1,hn(I)}}}function k1(n){let t,e,i,s,r,o,a,l,c,h,f,g,p,m,y,S,M,C,F,D,I,$,N,G,U,it,lt,rt,Pt,zt,et,Et,St,re,ye,ot,Lt,Bt,Ut,Qt,k,v,x,R,E,O,Z,V,J,tt,xt,Ht,Ot,Yt,Xt,ue,ke,xe,Rn,un,Ln,je,$i,Fn,oi,$s,ji,ai,qe,In,$n,li,js,fn=n[10],ce=[];for(let bt=0;bt<fn.length;bt+=1)ce[bt]=ud(hd(n,fn,bt));return je=new cd({props:{headerText:"Line of Best Fit (Line chart only)",$$slots:{default:[w1]},$$scope:{ctx:n}}}),{c(){t=Y("div"),e=Y("h3"),e.textContent="Create a new Chart",i=It(),s=Y("div"),r=Y("div"),o=Y("table"),a=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"),h=Y("select"),f=Y("option"),f.textContent="Bar",g=Y("option"),g.textContent="Line",p=Y("option"),p.textContent="Pie",m=Y("option"),m.textContent="Doughnut",y=Y("option"),y.textContent="Radar",S=Y("option"),S.textContent="Polar Area",M=It(),C=Y("tr"),F=Y("td"),F.innerHTML=`<p class="mainDesc svelte-1tlkntj">Smoothness</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Changes the smoothness of the Chart</p>`,D=Y("td"),I=Y("input"),$=It(),N=Y("tr"),G=Y("td"),G.innerHTML=`<p class="mainDesc svelte-1tlkntj">Width</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Changes the horizontal width</p>`,U=Y("td"),it=Y("input"),lt=It(),rt=Y("tr"),Pt=Y("td"),Pt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Fill</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Fill the underside of the Chart</p>`,zt=Y("td"),et=Y("input"),Et=It(),St=Y("tr"),re=Y("td"),re.innerHTML=`<p class="mainDesc svelte-1tlkntj">Distinct Colors</p>
|
||
|
<p class="subDesc svelte-1tlkntj">Use distinct Colors for each Label</p>`,ye=Y("td"),ot=Y("input"),Lt=It(),Bt=Y("tr"),Ut=Y("td"),Ut.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=Y("td"),k=Y("input"),v=It(),x=Y("hr"),R=It(),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>`,V=It(),J=Y("td"),tt=Y("input"),xt=Y("br"),Ht=It(),Ot=Y("hr"),Yt=It(),Xt=Y("table");for(let bt=0;bt<ce.length;bt+=1)ce[bt].c();ue=It(),ke=Y("div"),xe=Y("button"),xe.textContent="Add more",Rn=It(),un=Y("hr"),Ln=It(),ad(je.$$.fragment),$i=It(),Fn=Y("div"),oi=Y("div"),$s=It(),ji=Y("hr"),ai=It(),qe=Y("div"),In=Y("button"),In.textContent="Insert Chart",X(l,"class","desc svelte-1tlkntj"),f.__value="bar",f.value=f.__value,g.__value="line",g.value=g.__value,p.__value="pie",p.value=p.__value,m.__value="doughnut",m.value=m.__value,y.__value="radar",y.value=y.__value,S.__value="polarArea",S.value=S.__value,X(h,"name","Chart Types"),X(h,"id","chart-types"),X(h,"class","dropdown"),n[0]===void 0&&Ls(()=>n[16].call(h)),X(c,"class","controlElement svelte-1tlkntj"),X(F,"class","desc svelte-1tlkntj"),X(I,"type","range"),X(I,"min","0"),X(I,"max","100"),X(I,"class","slider"),X(D,"class","controlElement svelte-1tlkntj"),X(G,"class","desc svelte-1tlkntj"),X(it,"type","range"),X(it,"min","20"),X(it,"max","100"),X(it,"class","slider"),X(U,"class","controlElement svelte-1tlkntj"),X(Pt,"class","desc svelte-1tlkntj"),X(et,"type","checkbox"),X(et,"class","task-list-item-checkbox"),Gt(et,"width","16px"),Gt(et,"height","16px"),X(zt,"class","controlElement svelte-1tlkntj"),X(re,"class","desc svelte-1tlkntj"),X(ot,"type","checkbox"),X(ot,"class","task-list-item-checkbox"),Gt(ot,"width","16px"),Gt(ot,"height","16px"),X(ye,"class","controlElement svelte-1tlkntj"),X(Ut,"class","desc svelte-1tlkntj"),X(k,"type","checkbox"),X(k,"class","task-list-item-checkbox"),Gt(k,"width","16px"),Gt(k,"height","16px"),X(Qt,"class","controlElement svelte-1tlkntj"),Gt(o,"width","100%"),X(o,"class","svelte-1tlkntj"),X(Z,"class","desc svelte-1tlkntj"),X(tt,"type","text"),X(tt,"placeholder","Monday, Tuesday, ..."),X(J,"class","controlElement svelte-1tlkntj"),Gt(E,"width","100%"),X(E,"class","svelte-1tlkntj"),X(ke,"class","addMoreButtonContainer svelte-1tlkntj"),Gt(Xt,"width","100%"),X(Xt,"class","svelte-1tlkntj"),X(oi,"id","preview"),X(Fn,"class","chartPreview svelte-1tlkntj"),X(s,"class","modalColumn svelte-1tlkntj"),X(t,"class","chart-modal svelte-1tlkntj"),X(In,"class","mod-cta"),Gt(qe,"display","flex"),Gt(qe,"justify-content","center"),Gt(qe,"align-items","center")},m(bt,te){Xe(bt,t,te),z(t,e),z(t,i),z(t,s),z(s,r),z(r,o),z(o,a),z(a,l),z(a,c),z(c,h),z(h,f),z(h,g),z(h,p),z(h,m),z(h,y),z(h,S),Cl(h,n[0]),z(o,M),z(o,C),z(C,F),z(C,D),z(D,I),de(I,n[1]),z(o,$),z(o,N),z(N,G),z(N,U),z(U,it),de(it,n[2]),z(o,lt),z(o,rt),z(rt,Pt),z(rt,zt),z(zt,et),et.checked=n[3],z(o,Et),z(o,St),z(St,re),z(St,ye),z(ye,ot),ot.checked=n[4],z(o,Lt),z(o,Bt),z(Bt,Ut),z(Bt,Qt),z(Qt,k),k.checked=n[5],z(r,v),z(r,x),z(r,R),z(r,E),z(E,O),z(O,Z),z(O,V),z(O,J),z(J,tt),de(tt,n[9]),z(J,xt),z(r,Ht),z(r,Ot),z(r,Yt),z(r,Xt);for(let dn=0;dn<ce.length;dn+=1)ce[dn].m(Xt,null);z(Xt,ue),z(Xt,ke),z(ke,xe),z(r,Rn),z(r,un),z(r,Ln),El(je,r,null),z(s,$i),z(s,Fn),z(Fn,oi),n[29](oi),z(t,$s),z(t,ji),Xe(bt,ai,te),Xe(bt,qe,te),z(qe,In),$n=!0,li||(js=[Jt(h,"change",n[16]),Jt(I,"change",n[17]),Jt(I,"input",n[17]),Jt(it,"change",n[18]),Jt(it,"input",n[18]),Jt(et,"change",n[19]),Jt(ot,"change",n[20]),Jt(k,"change",n[21]),Jt(tt,"input",n[22]),Jt(xe,"click",n[25]),Jt(In,"click",n[12])],li=!0)},p(bt,te){if(te[0]&1&&Cl(h,bt[0]),te[0]&2&&de(I,bt[1]),te[0]&4&&de(it,bt[2]),te[0]&8&&(et.checked=bt[3]),te[0]&16&&(ot.checked=bt[4]),te[0]&32&&(k.checked=bt[5]),te[0]&512&&tt.value!==bt[9]&&de(tt,bt[9]),te[0]&1024){fn=bt[10];let pe;for(pe=0;pe<fn.length;pe+=1){let zs=hd(bt,fn,pe);ce[pe]?ce[pe].p(zs,te):(ce[pe]=ud(zs),ce[pe].c(),ce[pe].m(Xt,ue))}for(;pe<ce.length;pe+=1)ce[pe].d(1);ce.length=fn.length}let dn={};te[0]&448|te[1]&32&&(dn.$$scope={dirty:te,ctx:bt}),je.$set(dn)},i(bt){$n||(Fs(je.$$.fragment,bt),$n=!0)},o(bt){fo(je.$$.fragment,bt),$n=!1},d(bt){bt&&Ie(t),nd(ce,bt),po(je),n[29](null),bt&&Ie(ai),bt&&Ie(qe),li=!1,hn(js)}}}function S1(n,t,e){let{editor:i}=t,{renderer:s}=t,r=Pl(),o="bar",a=null,l=20,c=80,h=!1,f=!1,g=!1,p=!1,m,y="0",S="",M=[{dataTitle:"",data:""}],C,F=
|
||
|
labels: [${S}]
|
||
|
series:
|
||
|
${M.map(ot=>` - title: ${ot.dataTitle}
|
||
|
data: [${ot.data}]`).join(`
|
||
|
`)}
|
||
|
tension: ${l/100}
|
||
|
width: ${c}%
|
||
|
labelColors: ${f}
|
||
|
fill: ${h}
|
||
|
beginAtZero: ${g}
|
||
|
bestFit: ${p}
|
||
|
bestFitTitle: ${m}
|
||
|
bestFitNumber: ${y}`)}if(n.$$.dirty[0]&34816){t:if(F)try{D(C,F)}catch(ot){cn(ot,F)}}},[o,l,c,h,f,g,p,m,y,S,M,F,I,i,s,C,$,N,G,U,it,lt,rt,Pt,zt,et,Et,St,re,ye]}var fd=class extends Is{constructor(t){super();go(this,t,S1,k1,ro,{editor:13,renderer:14},x1,[-1,-1])}},dd=fd;var bo=class extends pd.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 dd({target:t,props:{editor:e.editor,renderer:s}}).$on("close",()=>this.close())}onClose(){let{contentEl:t}=this;t.empty()}};var gd=ze(require("obsidian")),md={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>'},bd=()=>{Object.keys(md).forEach(n=>{(0,gd.addIcon)(n,md[n])})};var Ol=class extends $e.Plugin{constructor(){super(...arguments);this.postprocessor=async(t,e,i)=>{let s;try{s=await(0,$e.parseYaml)(t.replace(/ /g," "))}catch(a){cn(a,e);return}if(!s.id&&(!s||!s.type||!s.labels||!s.series)){cn("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 a=s.labels,l=0,c=0,h=0,f=0;for(let y=0;y<r.length;++y)l=l+r[y],c=c+a[y],h=h+r[y]*r[y],f=f+r[y]*a[y];let g=(r.length*f-c*l)/(r.length*h-l*l),p=(c-g*l)/r.length,m=[];for(let y=0;y<a.length;++y)m.push((a[y]-p)/g);if(s.bestFitTitle!=null&&s.bestFitTitle!="undefined")var o=String(s.bestFitTitle);else var o="Line of Best Fit";s.series.push({title:o,data:m})}await this.renderer.renderFromYaml(s,e,i)}}async loadSettings(){this.settings=Object.assign({},eo,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async onload(){console.log("loading plugin: Charts"),await this.loadSettings(),bd(),this.renderer=new to(this),window.renderChart=this.renderer.renderRaw,this.addSettingTab(new xl(this.app,this)),this.addCommand({id:"creation-helper",name:"Insert new Chart",checkCallback:t=>{let e=this.app.workspace.activeLeaf;return e.view instanceof $e.MarkdownView?(t||new bo(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 $e.MarkdownView&&s.split(`
|
||
|
`).length>=3&&s.split("|").length>=2?(t||Ka(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 $e.MarkdownView&&e.getSelection().split(`
|
||
|
`).length>=3&&e.getSelection().split("|").length>=2?(t||Ka(e,"rows"),!0):!1}),this.addCommand({id:"chart-to-svg",name:"Create Image from Chart",editorCheckCallback:(t,e,i)=>i instanceof $e.MarkdownView&&e.getSelection().startsWith("```chart")&&e.getSelection().endsWith("```")?(t||(new $e.Notice("Rendering Chart..."),Ju(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 bo(this.app,i,this.settings,this.renderer).open()})})}))}onunload(){console.log("unloading plugin: 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
|
||
|
*/
|
||
|
/*!
|
||
|
* chartjs-chart-sankey v0.12.0
|
||
|
* https://github.com/kurkle/chartjs-chart-sankey#readme
|
||
|
* (c) 2022 Jukka Kurkela
|
||
|
* 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.
|
||
|
*/
|
||
|
/*!
|
||
|
* chartjs-plugin-annotation v2.2.1
|
||
|
* https://www.chartjs.org/chartjs-plugin-annotation/index
|
||
|
* (c) 2023 chartjs-plugin-annotation Contributors
|
||
|
* Released under the MIT 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
|
||
|
*/
|