
'use strict';require('earlgrey-runtime/6');let $targ$0;let $targ$1;let $targ$2;let $targ$3;let $targ$17;let fs$0;let path$0;let hljs$0;let dom$0;let CodeSnippet$0;let buche__minus__install$0;fs$0=require("fs");path$0=require("path");hljs$0=require("highlight.js");dom$0=require("earlgrey-runtime/std/dom");if((typeof(document)==="undefined")){$targ$0=undefined;(global["document"]=$targ$0);(void 0);}if((typeof(HTMLElement)==="undefined")){$targ$1=undefined;(global["HTMLElement"]=$targ$1);(void 0);}if((typeof(customElements)==="undefined")){$targ$2=undefined;(global["custom-elements"]=$targ$2);(void 0);}if((typeof(Text)==="undefined")){$targ$3=undefined;(global["Text"]=$targ$3);(void 0);}CodeSnippet$0=(class CodeSnippet extends HTMLElement{ constructor(){let __at___$0;let self$0;super();__at___$0=this;self$0=this;return undefined;} connectedCallback(){let $targ$15;let t0$0;let t0$1;let t0$2;let m$1;let acc$0;let temp$0;let l$0;let m$2;let acc$1;let temp$1;let $targ$4;let $targ$5;let $targ$6;let $targ$7;let $targ$8;let lines$0;let lo$0;let hi$0;let lang__minus__class$0;let $targ$9;let $targ$10;let $targ$11;let $targ$12;let $targ$13;let $targ$14;let __at___$1;let self$1;__at___$1=this;self$1=this;if(__at___$1._done){return null;}$targ$4=__at___$1.getAttribute("src");(__at___$1["filename"]=$targ$4);try{$targ$15=fs$0.readFileSync(__at___$1.filename,"utf8");(__at___$1["contents"]=$targ$15);(void 0);}catch(excv$0){let node$0;let t$0;let m$0$0;let $targ$16;let e$0;e$0=excv$0;m$0$0=__at___$1.childNodes[0];if((m$0$0===(void 0))){$targ$16="";}else{if(getChecker(Text)(m$0$0)){t$0=m$0$0;$targ$16=t$0.textContent;}else{node$0=m$0$0;$targ$16=node$0.innerText;}}(__at___$1["contents"]=$targ$16);(void 0);}$targ$5=(__at___$1.getAttribute("language")||"auto");(__at___$1["language"]=$targ$5);$targ$6=(__at___$1.getAttribute("column")||-1);t0$0=[true,parseFloat($targ$6)];if(t0$0[0]){(__at___$1["column"]=t0$0[1]);}else{___match_error($targ$6,"Number! @column");}(__at___$1["column"]=(__at___$1.column-1));$targ$7=(__at___$1.getAttribute("line")||1);t0$1=[true,parseFloat($targ$7)];if(t0$1[0]){(__at___$1["lineno"]=t0$1[1]);}else{___match_error($targ$7,"Number! @lineno");}(__at___$1["lineno"]=(__at___$1.lineno-1));$targ$8=(__at___$1.getAttribute("context")||0);t0$2=[true,parseFloat($targ$8)];if(t0$2[0]){(__at___$1["context"]=t0$2[1]);}else{___match_error($targ$8,"Number! @context");}acc$0=[];temp$0=null;m$1=null;$1:for(m$1 of __at___$1.contents.split(RegExp("\\n",""))){let line$0;line$0=m$1;temp$0=((""+line$0)+"\n");acc$0.push(temp$0);}lines$0=acc$0;lo$0=Math.max((__at___$1.lineno-__at___$1.context),0);hi$0=Math.min((__at___$1.lineno+__at___$1.context),(lines$0.length-1));lang__minus__class$0=("."+__at___$1.language);$targ$9=dom$0(ENode(["div",".hljs",lang__minus__class$0],({}),[send(lines$0,range(lo$0,(__at___$1.lineno-1))),ENode(["span",".hljs-line-focus"],({}),((__at___$1.column<0)?send(lines$0,__at___$1.lineno):((l$0=send(lines$0,__at___$1.lineno)),[send(l$0,range(0,(__at___$1.column-1))),ENode(["span",".hljs-column-focus"],({}),send(l$0,__at___$1.column)),send(l$0,range((__at___$1.column+1)))]))),send(lines$0,range((__at___$1.lineno+1),hi$0))]));(__at___$1["excerpt"]=$targ$9);$targ$10=hljs$0.highlightBlock(__at___$1.excerpt);(__at___$1["hlExcerpt"]=$targ$10);$targ$11=__at___$1.excerpt;(__at___$1["hlExcerpt"]=$targ$11);acc$1=[];temp$1=null;m$2=null;$2:for(m$2 of range(lo$0,hi$0)){let i$0;i$0=m$2;if(equal(i$0,__at___$1.lineno)){temp$1=ENode(["div",".hljs-lineno-focus"],({}),ENode([],({}),[(i$0+1)]));}else{temp$1=ENode(["div"],({}),ENode([],({}),[(i$0+1)]));}acc$1.push(temp$1);}$targ$12=acc$1;(__at___$1["lineNumbers"]=$targ$12);$targ$13="";(__at___$1["innerHTML"]=$targ$13);__at___$1.appendChild(dom$0(ENode(["code",".filename"],({}),__at___$1.filename)));__at___$1.appendChild(dom$0(ENode(["div",".hljs-box"],({}),[ENode([".hljs-linenos"],({}),__at___$1.lineNumbers),__at___$1.hlExcerpt])));$targ$14=true;(__at___$1["_done"]=$targ$14);return (void 0);}});buche__minus__install$0=(function bucheInstall(){customElements.define("code-snippet",CodeSnippet$0);document.head.appendChild(dom$0(ENode(["link"],({"type":"text/css","rel":"stylesheet","href":path$0.join(__dirname,"style.css")}),[])));return document.head.appendChild(dom$0(ENode(["link"],({"type":"text/css","rel":"stylesheet","href":"../node_modules/highlight.js/styles/github.css"}),[])));});$targ$17=buche__minus__install$0;(exports["bucheInstall"]=$targ$17);(void 0);
//# sourceMappingURL=index.js.map

