button.jsvar writer=function(d,k,f){d=void 0===d?"Title":d;k=void 0===k?[]:k;if(f)$.ajax({url:"http://127.0.0.1:"+window.PORT+"/create/pdf",method:"post",data:{texts:k,proxy:window.PROXY||""},dataType:"json"}).done(function(c){console.log(c)}).fail(function(c){console.log("request failed");writer(d,k,void 0)});else{f="";for(var c=0;c<k.length;c++)f+="\n"+k[c];c=window.open();c.document.open();c.document.write("<title>"+d+"</title>");c.document.write("<pre>");c.document.write(escapeHtml(f));c.document.write("</pre>");
c.document.close()}},escapeHtml=function(d){d=d.replace(/&/g,"&");d=d.replace(/</g,"<");d=d.replace(/>/g,">");d=d.replace(/"/g,""");return d=d.replace(/'/g,"'")};
(function(){console.clear();for(var d="",k="",f=0,c=0,r=[],g=[""],h="",A=function(e){e=void 0===e?0:e;for(var a=h+" ",b=1;b<e;b++)a+=" ";return a},x=function(e){e=void 0===e?0:e;0>e&&(e=0);var a=!1;for(2<=c-e&&(a=!0);a&&1<=c-e;){for(var b=h,w=1;w<Math.min(f,c);w++)b+=" ";g.push(b+"\\end{itemize}");--c}f=c;c=e;return[f,c]},y=function(){if(f!==c){for(var e=h,a=1;a<Math.max(f,c);a++)e+=" ";f<c&&g.push(e+"\\begin{itemize}");f>c&&g.push(e+"\\end{itemize}")}},B=function(e){e=void 0===e?1:e;return 1===
e?"\\subsubsection":2===e?(h=" ","\\subsection"):3===e?(h=" ","\\section"):""},C=function(e){e=void 0===e?"":e;var a=document.createElement("div");a.innerHTML=e;e=a.querySelectorAll("strong");for(var b=0;b<e.length;b++){var c=e[b],d=+c.className.split("level-")[1],l=c.innerHTML;c.innerHTML=B(d)+"{"+l+"}"}return a.innerHTML},D=function(e){for(var a=e.querySelectorAll(".formula"),b=0;b<a.length;b++){var c=a[b],d=c.querySelector("annotation");c.innerHTML=" $"+d.innerHTML+"$ "}return e},E=function(a){a=
void 0===a?"":a;var b=document.createElement("div");b.innerHTML=a;a=b.querySelectorAll("a");for(var c=0;c<a.length;c++){var d=a[c],q=d.innerText.trim(),l=d.href,f=q;"hashTag"===d.type&&(f="");q=d.querySelector("img");if(null!==q)if(q.classList.contains("icon"))f="";else{var l=l.split("/"),k=l[l.length-1].split("?"),l="[width=0.9\\linewidth]",g="";2===k.length&&(l="[width="+k[1]+"]");0<q.src.indexOf("gyazo.com/")&&(g=q.src.split("gyazo.com/")[1],g=g.split("/")[0].split(".")[0]);0<g.length&&(f=window.decodeURIComponent(k[0]),
f=[/*h+("%%IMAGE; "+g+"; "+q.src),*/h+"\\begin{figure}[h!]",h+" \\begin{center}",h+(" \\includegraphics"+l+"{"+("./gyazos/"+g+".png")+"}"),h+(" \\caption{"+f+"}"),h+" \\end{center}",h+"\\end{figure}"].join("\n"))}d.innerText=f}return b.innerText},t=function(){var a=r.join("");0<r.length&&0<a.trim().length&&(g.push(h+a),g.push(""),r=[])},m=document.querySelector(".lines").cloneNode(!0),m=function(a){for(var b=a.querySelectorAll("div.table-block"),c=0;c<b.length;c++){var d=$(b[c]);d.find(".line").removeClass("line");
d.find(".indent-mark").remove();d.addClass("line");var f=["\\begin{table}[htb]"," \\begin{center}"],g=d.find(".table-block-start").text(),g=" \\caption{"+g+"}";f.push(g);f.push(" \\begin{tabular}{|l|l|l|l|} \\hline");for(var g=d.find("tr"),k=0;k<g.length;k++){for(var h=$(g[k]).find("td"),m=[],n=0;n<h.length;n++){var p=$(h[n]).text().trim();0<p.length&&m.push(p)}h=" "+m.join(" & ");h+=" \\\\";0===k&&(h+=" \\hline \\hline");k===g.length-1&&(h+=" \\hline");f.push(h)}f.push(" \\end{tabular}");
f.push(" \\end{center}");f.push("\\end{table}");d.html('<div class="text">'+f.join("\n")+"</div>")}return a}(m),m=m.querySelectorAll(".line"),u=!1,z=0,n=1;n<m.length;n++){var b=m[n].querySelector(".text"),a=b.querySelector('img.icon[src="/api/pages/icons/hr/icon"]');if(u&&a)break;if(a)u=!0;else if(u){for(var p=b.querySelectorAll("span.empty-char-index"),a=0;a<p.length;a++){var v=p[a];v.innerText=""}p=b.querySelectorAll("span.backquote");for(a=0;a<p.length;a++)v=p[a],v.innerText=0===a%2?"{\\tt ":
"}";b=D(b);a=b.innerHTML.replace(/<span>/g,"");a=a.replace(/<span.+?>/g,"").replace(/<\/span>/g,"");a=a.replace(/<br.+?>/g,"");a=a.replace(/\n/gi,"").replace(/\t/gi,"").trim();a=C(a);a=E(a);a=a.trim();0===d.length?(d=a,z=n):(b=b.querySelector(".indent-mark"),null!==b&&(b=+b.style.width.split("em")[0]/1.5,a=A(b)+"\\item "+a,x(b)),n===z+1&&a.trim().startsWith("\\item")?(k=a.split("\\item ")[1].trim(),c=f=0):(b=a.trim(),b.startsWith("\\item")||x(0),b.startsWith("\\")?(t(),b.startsWith("\\section")||
b.startsWith("\\subsection")||b.startsWith("\\subsubsection")?(b.startsWith("\\subsection")&&(a=" "+a),b.startsWith("\\subsubsection")&&(a=" "+a),0<g[g.length-1].length&&g.push("")):a=h+a,y(),g.push(a)):(y(),0<b.length&&!b.startsWith("%")?b.endsWith(".")||b.endsWith("\uff0e")||b.endsWith("\u3002")||(b+=PERIOD):t(),r.push(b))))}}t();var abstractBox=["\\begin{abstract}"," "+k,"\\end{abstract}"];head.push("\\title{"+d+"}");head.push("\\begin{document}");0<k.length&&head.push(abstractBox.join("\n"));
head.push(" \\maketitle");titlePage&&head.push(" \\clearpage");g.forEach(function(a){head.push(a)});head.push("\\end{document}");writer(d,head,window.PORT)})();