PageSourceSearch

https://toolbreezy.com/_next/static/chunks/21061-9d7d8d9e4bc2027b.js

js toolbreezy.com collected 2026-10-02 01:50:39 UTC 41,094 bytes, 30 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[21061],{21061:(e,t,s)=>{s.r(t),s.d(t,{default:()=>ej,makeListNumberer:()=>em,parseInline:()=>B});var n=s(45993),a=s(75837),r=s(62983),l=s(63414),i=s(30109),o=s(77771),c=s(17832),d=s(44219),h=s(35323),u=s(41945),p=s(73950),m=s(14552),f=s(19914),g=s(35578),b=s(35339),x=s(10974);let k={letter:{label:"Letter (8.5 x 11 in)",w:612,h:792},a4:{label:"A4 (210 x 297 mm)",w:595.28,h:841.89},legal:{label:"Legal (8.5 x 14 in)",w:612,h:1008},a5:{label:"A5 (148 x 210 mm)",w:419.53,h:595.28}},w={narrow:{label:"Narrow (0.5 in)",pt:36},normal:{label:"Normal (1 in)",pt:72},wide:{label:"Wide (1.25 in)",pt:90}},y={sans:{r:"Helvetica",b:"HelveticaBold",i:"HelveticaOblique",bi:"HelveticaBoldOblique",css:'Helvetica, Arial, "Liberation Sans", sans-serif'},serif:{r:"TimesRoman",b:"TimesRomanBold",i:"TimesRomanItalic",bi:"TimesRomanBoldItalic",css:'"Times New Roman", Times, "Liberation Serif", serif'},mono:{r:"Courier",b:"CourierBold",i:"CourierOblique",bi:"CourierBoldOblique",css:'"Courier New", Courier, monospace'}},v={github:{label:"Readme (sans, rules under headings)",bodySerif:!1,headSerif:!1,headScale:[2,1.5,1.25,1.1,1,.92],lineFactor:1.46,gap:1,ruleLevels:[1,2],centerH1:!1,accent:[.05,.35,.72]},report:{label:"Report (serif body, sans headings)",bodySerif:!0,headSerif:!1,headScale:[1.85,1.4,1.2,1.08,1,.94],lineFactor:1.5,gap:1.1,ruleLevels:[1],centerH1:!1,accent:[.11,.3,.55]},manuscript:{label:"Manuscript (serif, roomy, centered title)",bodySerif:!0,headSerif:!0,headScale:[1.75,1.35,1.18,1.06,1,.95],lineFactor:1.78,gap:1.25,ruleLevels:[],centerH1:!0,accent:[.24,.24,.3]},compact:{label:"Compact (tight, for cheat sheets)",bodySerif:!1,headSerif:!1,headScale:[1.55,1.3,1.14,1.05,1,.95],lineFactor:1.28,gap:.66,ruleLevels:[2],centerH1:!1,accent:[.05,.35,.72]}},j=["github","report","manuscript","compact"],N=[.09,.1,.12],z=[.42,.45,.5],S=[.78,.8,.83],M=[.93,.94,.96],$=[.75,.78,.82],C={light:{label:"Light, syntax colored",bg:[.965,.972,.98],colors:{plain:[.13,.15,.18],comment:[.45,.5,.55],string:[.04,.44,.28],number:[.62,.31,.05],keyword:[.63,.1,.44],func:[.15,.31,.75],tag:[.68,.13,.22],attr:[.5,.33,.04],punct:[.35,.38,.42]}},dark:{label:"Dark, syntax colored",bg:[.11,.13,.17],colors:{plain:[.87,.89,.92],comment:[.46,.51,.58],string:[.55,.82,.55],number:[.95,.71,.42],keyword:[.85,.56,.9],func:[.45,.7,1],tag:[.95,.55,.55],attr:[.95,.8,.5],punct:[.66,.71,.77]}},plain:{label:"No color, plain mono",bg:[.955,.96,.97],colors:{plain:[.13,.15,.18],comment:[.13,.15,.18],string:[.13,.15,.18],number:[.13,.15,.18],keyword:[.13,.15,.18],func:[.13,.15,.18],tag:[.13,.15,.18],attr:[.13,.15,.18],punct:[.13,.15,.18]}}},W=["light","dark","plain"],T=[9,10,11,12,14],A=new Set([8364,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,381,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,382,376]),F={"\xa0":" "," ":" "," ":" "," ":" ","​":"","‌":"","\uFEFF":"","\xad":"","‑":"-","‒":"-","―":"-","−":"-","⁃":"-","′":"'","″":'"',ʼ:"'","←":"<-","→":"->","↔":"<->","⇒":"=>","≤":"<=","≥":">=","≠":"!=","●":"•","▪":"•","◦":"•","■":"•","✓":"•","✔":"•"};function R(e){let t=e.trim().replace(/^<|>$/g,"");if(/^(https?:\/\/|mailto:)/i.test(t))return t}function L(e,t){let s=0;for(let n=t;n<e.length;n++){let t=e[n];if("\\"===t){n++;continue}if("("===t)s++;else if(")"===t&&0==--s)return n}return -1}function E(e,t){let s=0;for(let n=t;n<e.length;n++){let t=e[n];if("\\"===t){n++;continue}if("["===t)s++;else if("]"===t&&0==--s)return n}return -1}function B(e,t,s){let n=[],a=!1,r=!1,l=!1,i="",o=()=>{0!==i.length&&(n.push({text:i,bold:a,italic:r,code:!1,strike:l,url:s}),i="")},c=0;for(;c<e.length;){let d=e[c];if(void 0===d)break;if("\\"===d&&c+1<e.length){i+=e[c+1],c+=2;continue}if("`"===d){let t=1;for(;"`"===e[c+t];)t++;let i="`".repeat(t),d=e.indexOf(i,c+t);if(d>0){o(),n.push({text:e.slice(c+t,d).trim(),bold:a,italic:r,code:!0,strike:l,url:s}),c=d+t;continue}}
1if("!"===d&&"["===e[c+1]){let s=E(e,c+1);if(s>0&&"("===e[s+1]){let a=L(e,s+1);if(a>0){o();let r=e.slice(c+2,s).trim();t.images++,n.push({text:r.length>0?`[image: ${r}]`:"[image]",bold:!1,italic:!0,code:!1,strike:!1,faint:!0}),c=a+1;continue}}}if("["===d&&void 0===s){let s=E(e,c);if(s>0&&"("===e[s+1]){let i=L(e,s+1);if(i>0){o();let d=e.slice(c+1,s),h=e.slice(s+2,i).trim(),u=h.search(/\s/);for(let e of(u>0&&(h=h.slice(0,u)),B(d,t,R(h))))n.push({...e,bold:e.bold||a,italic:e.italic||r,strike:e.strike||l});c=i+1;continue}}}if("<"===d){let t=e.indexOf(">",c+1);if(t>0){let s=e.slice(c+1,t),i=R(s);if(i){o(),n.push({text:s,bold:a,italic:r,code:!1,strike:l,url:i}),c=t+1;continue}}}if(("*"===d||"_"===d)&&e[c+1]===d&&(a||e.indexOf(d+d,c+2)>0)){o(),a=!a,c+=2;continue}if("*"===d||"_"===d){let t=e[c-1]??" ",s=e[c+1]??" ",n=/[A-Za-z0-9]/.test(t)&&/[A-Za-z0-9]/.test(s);if(("*"===d||!n)&&(r||e.indexOf(d,c+1)>0)){o(),r=!r,c+=1;continue}}if("~"===d&&"~"===e[c+1]&&(l||e.indexOf("~~",c+2)>0)){o(),l=!l,c+=2;continue}i+=d,c++}return o(),n}let O=/^(?:<!--\s*(?:pdf:)?(?:page-?break|new-?page)\s*-->|\\(?:pagebreak|newpage)|\{\s*page-?break\s*\})$/i,q=/^\s{0,3}(`{3,}|~{3,})[ \t]*([^\s`]*)/,D=/^\s{0,3}(#{1,6})[ \t]*(.*)$/,P=/^\s{0,3}(?:(?:\*[ \t]*){3,}|(?:-[ \t]*){3,}|(?:_[ \t]*){3,})$/,_=/^([ \t]*)([-*+]|\d{1,9}[.)])[ \t]+(.*)$/,H=/^\s{0,3}(?:=+|-{2,})\s*$/,Z=/^\s{0,3}\|?[ \t:|-]*-[ \t:|-]*\|?\s*$/;function I(e){let t=e.trim();return!!(0===t.length||O.test(t)||q.test(e)||D.test(e)||P.test(e)||H.test(e)||/^\s{0,3}>/.test(e)||_.test(e))}function J(e){let t=[],s="";for(let n=0;n<e.length;n++){let a=e[n];if("\\"===a&&"|"===e[n+1]){s+="|",n++;continue}if("|"===a){t.push(s),s="";continue}s+=a??""}return t.push(s),t.length>1&&""===(t[0]??"").trim()&&t.shift(),t.length>1&&""===(t[t.length-1]??"").trim()&&t.pop(),t.map(e=>e.trim())}let U=e=>/^[A-Za-z0-9_.$-]+[ \t]*:/.test(e);function Y(e){return!!(""===e.trim()||/^[ \t]+\S/.test(e)||/^-[ \t]/.test(e))||U(e)}let G=e=>new Set(e.split(/\s+/).filter(Boolean)),V=G(`
2  const let var function return if else for while do switch case break continue new class extends
3  super this typeof instanceof await async try catch finally throw import export from default null
4  undefined true false void delete in of yield static get set interface type enum implements public
5  private protected readonly namespace declare as satisfies keyof infer never unknown any string
6  number boolean object symbol bigint struct impl fn pub mut use mod match where package func defer
7  go chan map range nil int float double char long short unsigned signed sizeof template using
8  namespace virtual override final abstract synchronized volatile transient throws extends
9`),X=G(`
10  def class return if elif else for while in is not and or import from as pass break continue try
11  except finally raise with lambda yield global nonlocal None True False del assert async await
12  self print len range str int float list dict set tuple bool open enumerate zip map filter super
13  end do module require attr_accessor puts nil elsif unless then begin rescue ensure
14`),K=G(`
15  if then else elif fi for while until do done case esac function return export local echo cd ls
16  mkdir rm cp mv cat grep sed awk sudo apt apt-get yum brew npm npx yarn pnpm pip git docker
17  docker-compose kubectl curl wget chmod chown source exit set unset read printf test true false
18  head tail sort uniq find xargs tar zip unzip ssh scp systemctl service make
19`),Q=G(`
20  select from where group by order having join inner left right outer full cross on as insert into
21  values update set delete create table alter drop index view database schema distinct limit offset
22  union all and or not null is like ilike between exists case when then else end primary key foreign
23  references default constraint cascade with returning add column rename truncate grant revoke begin
24  commit rollback transaction asc desc count sum avg min max coalesce cast
25`),ee=G(`
26  important media supports keyframes import charset font-face root hover focus active before after
27  not nth-child first-child last-child inherit initial unset auto none flex grid block 
27inline
28  absolute relative fixed sticky
29`),et=G("true false null yes no on off none version services volumes ports image build environment"),es=G("true false null"),en={line:[],block:["\x3c!--","--\x3e"],quotes:['"',"'"],keywords:new Set,markup:!0,dash:!0};function ea(e,t,s){let n=t+1;for(;n<e.length;){if("\\"===e[n]){n+=2;continue}if(e[n]===s)return n+1;n++}return e.length}let er=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2];function el(e,t,s,n,a){let r=[],l=Math.min(s,Math.max(0,a-24)),i=Math.min(n,Math.max(0,a-24)),o=l,c=[],d=()=>{for(;;){let e=c[c.length-1];if(!e||e.text.trim().length>0)break;o-=e.w,c.pop()}r.push({segs:function(e){let t=[];for(let s of e){let e=t[t.length-1];if(e&&e.slot===s.slot&&e.size===s.size&&e.url===s.url&&e.strike===s.strike&&er(e.color,s.color)&&(void 0===e.chip&&void 0===s.chip||void 0!==e.chip&&void 0!==s.chip&&er(e.chip,s.chip))){e.text+=s.text,e.w+=s.w;continue}t.push({...s})}return t}(c),start:l,width:o-l}),c=[],l=i,o=i};for(let s of e){if(s.br){d();continue}let e=t(s.slot,s.text)*s.size;if(s.space){if(0===c.length)continue;c.push({x:o,w:e,text:s.text,slot:s.slot,size:s.size,color:s.color}),o+=e;continue}if(o+e>a&&c.length>0&&d(),e>a-l){let e=s.text;for(;e.length>0;){let n=Math.max(1,a-o),r=Math.min(e.length,Math.max(1,Math.ceil(n/(.12*s.size))+2)),l=1,i=1,h=r;for(;i<=h;){let a=Math.floor((i+h)/2);t(s.slot,e.slice(0,a))*s.size<=n?(l=a,i=a+1):h=a-1}let u=e.slice(0,l),p=t(s.slot,u)*s.size;c.push({x:o,w:p,text:u,slot:s.slot,size:s.size,color:s.color,url:s.url,chip:s.chip,strike:s.strike}),o+=p,(e=e.slice(l)).length>0&&d()}continue}c.push({x:o,w:e,text:s.text,slot:s.slot,size:s.size,color:s.color,url:s.url,chip:s.chip,strike:s.strike}),o+=e}return d(),r}let ei=(e,t)=>(e-1.16*t)/2+.86*t,eo=[1.35,1.15,.95,.85,.8,.8],ec=[.5,.45,.4,.35,.32,.32];function ed(e,t,s,n){let a=[];for(let r of e){let e,l=t;if(r.code)e=r.bold?"mb":"m",l=.88*t;else if(n.head)e="hb";else{let t=r.italic||!0===n.italicAll;e=r.bold&&t?"bi":r.bold?"b":t?"i":"r"}let i=r.url?s.style.accent:r.faint?z:n.color,o=r.code?M:void 0;for(let[t,s]of r.text.split("\n").entries())for(let n of(t>0&&a.push({text:"",slot:e,size:l,color:i,space:!1,br:!0}),s.split(/( +)/)))0!==n.length&&a.push({text:n,slot:e,size:l,color:i,space:0===n.trim().length,url:r.url,chip:o,strike:r.strike})}return a}function eh(e,t,s,n,a,r){return e.map(e=>{let l=0;"center"===n?l=(a-e.width)/2-e.start:"right"===n&&(l=a-e.width-e.start);let i=ei(t,s),o=e.segs.map(e=>({...e,x:e.x+l,dy:i})),c=[];for(let e of o)e.chip&&c.push({x:e.x-1.2,dy:i-.8*e.size,w:e.w+2.4,h:1.04*e.size,color:e.chip}),e.strike&&c.push({x:e.x,dy:i-.26*e.size,w:e.w,h:Math.max(.5,.055*e.size),color:e.color}),r&&e.url&&c.push({x:e.x,dy:i+.12*e.size,w:e.w,h:Math.max(.4,.04*e.size),color:e.color});return{h:t,segs:o,rects:c}})}let eu=e=>e.reduce((e,t)=>e+t.h,0),ep=["•","-","\xb7"];function em(){let e=[0,0,0,0],t=[null,null,null,null],s=-1,n=!1;return{reset(){e.fill(0),t.fill(null),s=-1,n=!1},next(a,r,l){let i=Math.min(3,a),o=!n||i>s||t[i]!==r;e[i]=o?l??1:(e[i]??0)+1,t[i]=r;for(let s=i+1;s<e.length;s++)e[s]=0,t[s]=null;return s=i,n=!0,e[i]??1}}}function ef(e,t){let s=0,n=0;for(let a of e){if(s+a.h>t)break;s+=a.h,n++}return n}let eg={pageSize:"letter",landscape:!1,margin:"normal",style:"github",size:11,codeTheme:"light",smart:!0,pageNumbers:!1},eb="tb:markdown-to-pdf:v1";async function ex(e,t){let{PDFDocument:n,StandardFonts:a,PDFName:r,PDFString:l,rgb:i}=await s.e(34716).then(s.bind(s,34716)),o=k[t.pageSize],c=t.landscape?o.h:o.w,d=t.landscape?o.w:o.h,h=Math.min(w[t.margin].pt,Math.min(c,d)/3),u=Math.max(120,c-2*h),p=Math.max(120,d-2*h),m=v[t.style],f=m.bodySerif?y.serif:y.sans,g=m.headSerif?y.serif:y.sans,b=await n.create(),j={r:f.r,b:f.b,i:f.i,bi:f.bi,hr:g.r,hb:g.b,m:y.mono.r,mb:y.mono.b},M=new Map,W={};for(let e of Object.keys(j)){let t=j[e],s=M.get(t);s||(s=await b.embedFont(a[t]),M.set(t,s)),W[e]=s}let T=function(e){let t=new Map;return(s,n)=>{let a,r=t.get(s);r||(r=new Map,t.set(s,r));let l=r.get(n);if(void 0!==l)return l;try{a=e[s].widthOfTextAtSize(n,1e3)/1e3}catch{a=.5*n.length}return n.length<=40&&r.set(n,a),a}}(W),R=function(e){let t={images:0,replaced:0,frontMatter:!1},s=e.replace(/\r\n?/g,"\n").split("\n"),n=[];for(let e of s){let s=function(e){let t="",s=0;for(let n of e){let e=F[n];if(void 0!==e){t+=e;continue}let a=n.codePointAt(0)??0;if(a>=32&&a<=126||a>=161&&a<=255||A.has(a)){t+=n;continue}a<32||(s++,t+="?")}return{text:t,replaced:s}}(e.replace(/\t/g,"    "));t.replaced+=s.replaced,n.push(s.text)}let a=[],r=0;if("---"===(n[0]??"").trim()){var l;let e=-1;for(let t=1;t<Math.min(n.length,60);t++){let s=(n[t]??"").trim();if("---"===s||"..."===s){e=t;break}}e>0&&(l=n.slice(1,e)).some(U)&&l.every(Y)&&(t.frontMatter=!0,r=e+1)}let i=e=>B((0,x.aB)(e).replace(/<br\s*\/?>
29/gi,"\n").replace(/<\/?[a-zA-Z][a-zA-Z0-9-]*(?:\s[^<>]*)?\/?>/g,""),t);for(;r<n.length;){let e=n[r]??"",t=e.trim();if(O.test(t)){a.push({kind:"break"}),r++;continue}if(0===t.length){r++;continue}let s=q.exec(e);if(s){let e=s[1]??"```",t=(s[2]??"").toLowerCase(),l=RegExp(`^\\s{0,3}${"~"===e[0]?"~":"`"}{${e.length},}\\s*$`),i=[];for(r++;r<n.length;){let e=n[r]??"";if(l.test(e)){r++;break}i.push(e),r++}a.push({kind:"code",lang:t,lines:i});continue}let l=D.exec(e);if(l&&(l[2]??"").trim().length>0){let e=(l[1]??"#").length,t=(l[2]??"").replace(/[ \t]+#+[ \t]*$/,"");a.push({kind:"heading",level:e,spans:i(t)}),r++;continue}if(P.test(e)){a.push({kind:"hr"}),r++;continue}if(e.includes("|")&&Z.test(n[r+1]??"")&&(n[r+1]??"").includes("|")){let t=J(e),s=J(n[r+1]??"").map(e=>{let t=e.startsWith(":"),s=e.endsWith(":");return t&&s?"center":s?"right":"left"});r+=2;let l=[];for(;r<n.length;){let e=n[r]??"";if(0===e.trim().length||!e.includes("|"))break;l.push(J(e)),r++}let o=t.length,c=e=>{let t=e.slice(0,o);for(;t.length<o;)t.push("");return t};a.push({kind:"table",head:c(t).map(i),rows:l.map(e=>c(e).map(i)),aligns:c(s.map(String)).map(e=>"center"===e||"right"===e?e:"left")});continue}if(/^\s{0,3}>/.test(e)){let e="";for(;r<n.length;){let t=n[r]??"";if(!/^\s{0,3}>/.test(t))break;let s=t;for(;/^\s{0,3}>/.test(s);)s=s.replace(/^\s{0,3}>[ \t]?/,"");0===s.trim().length?(e.trim().length>0&&a.push({kind:"quote",spans:i(e)}),e=""):e=e.length>0?`${e} ${s.trim()}`:s.trim(),r++}e.trim().length>0&&a.push({kind:"quote",spans:i(e)});continue}let o=_.exec(e);if(o){let e=Math.min(3,Math.floor((o[1]??"").length/2)),t=o[2]??"-",s=/\d/.test(t),l=s?Number(t.replace(/[.)]/,"")):null,c=o[3]??"",d=null,h=/^\[([ xX])\]\s+(.*)$/.exec(c);for(h&&(d="x"===(h[1]??" ").toLowerCase()?"[x]":"[ ]",c=h[2]??""),r++;r<n.length;){let e=n[r]??"";if(I(e))break;c+=` ${e.trim()}`,r++}a.push({kind:"item",depth:e,ordered:s,num:null!==l&&Number.isFinite(l)?l:null,task:d,spans:i(c)});continue}let c=/[ ]{2,}$|\\$/.test(e)?`${t.replace(/\\$/,"")}
30`:t;for(r++;r<n.length;){let e=n[r]??"";if(I(e))break;let t=/[ ]{2,}$|\\$/.test(e);c+=(c.endsWith("\n")?"":" ")+e.trim().replace(/\\$/,"")+(t?"\n":""),r++}let d=n[r]??"";if(H.test(d)&&d.trim().length>0){let e=d.trim().startsWith("=")?1:2;a.push({kind:"heading",level:e,spans:i(c.replace(/\n/g," "))}),r++;continue}let h=i(c);h.some(e=>e.text.trim().length>0)&&a.push({kind:"para",spans:h})}return{blocks:a,stats:t}}(e),L={measure:T,style:m,base:t.size,contentW:u,pageContentH:p,code:C[t.codeTheme],smart:t.smart},{units:E,langs:G}=function(e,t){let s=[],n=[],a=em(),r=0;for(let l of e)switch("item"!==l.kind&&a.reset(),l.kind){case"heading":s.push(function(e,t,s){let n=Math.min(6,Math.max(1,e)),a=s.base*(s.style.headScale[n-1]??1),r=1.26*a,l=ed(t,a,s,{head:!0,color:N}),i=1===n&&s.style.centerH1?"center":"left",o=eh(el(l,s.measure,0,0,s.contentW),r,a,i,s.contentW,!1);return s.style.ruleLevels.includes(n)&&o.push({h:.4*a,segs:[],rects:[{x:0,dy:.18*a,w:s.contentW,h:.7,color:S}]}),{lines:o,before:s.base*s.style.gap*(eo[n-1]??.8),after:s.base*s.style.gap*(ec[n-1]??.3),atomic:!0,keepWithNext:!0,isBreak:!1,tag:"head"}}(l.level,l.spans,t));break;case"para":s.push(function(e,t){let s=t.base,n=s*t.style.lineFactor,a=eh(el(ed(e,s,t,{head:!1,color:N}),t.measure,0,0,t.contentW),n,s,"left",t.contentW,!0),r=t.base*t.style.gap*.55;return{lines:a,before:r,after:r,atomic:!1,keepWithNext:!1,isBreak:!1,tag:"text"}}(l.spans,t));break;case"quote":s.push(function(e,t){let s=t.base,n=s*t.style.lineFactor,a=.95*s,r=eh(el(ed(e,s,t,{head:!1,color:[.3,.32,.36],italicAll:!0}),t.measure,a,a,t.contentW),n,s,"left",t.contentW,!0);for(let e of r)e.rects.push({x:0,dy:0,w:2.4,h:e.h,color:$});let l=t.base*t.style.gap*.6;return{lines:r,before:l,after:l,atomic:!1,keepWithNext:!1,isBreak:!1,tag:"text"}}(l.spans,t));break;case"hr":s.push(function(e){let t=.9*e.base,s=e.base*e.style.gap*.7;return{lines:[{h:t,segs:[],rects:[{x:0,dy:t/2,w:e.contentW,h:.8,color:S}]}],before:s,after:s,atomic:!0,keepWithNext:!1,isBreak:!1,tag:"text"}}(t));break;case"break":s.push({lines:[],before:0,after:0,atomic:!0,keepWithNext:!1,isBreak:!0,tag:"text"});break;case"code":{let e=function(e,t){let s=.9*t.base,n=1.34*s,a=.72*s,r=e.lang.length>0?e.lang:function(e){let t=e.slice(0,1200);return/^\s*[{[]/.test(t)&&/"[^"]*"\s*:/.test(t)?"json":/^#!.*\b(bash|sh|zsh)\b/m.test(t)||/^\s*\$ /m.test(t)||/\b(?:sudo|npm i|npm run|yarn add|pnpm add|git clone|apt-get|docker run|chmod)\b/.test(t)?"bash":/^\s*(?:def |class |import |from )\w/m.test(t)&&/:\s*$/m.test(t)?"python":/\b(?:SELECT|INSERT INTO|UPDATE|DELETE FROM)\b/i.test(t)&&/\b(?:FROM|SET|VALUES|WHERE)\b/i.test(t)?"sql":/^\s*</m.test(t)&&/<\/[a-zA-Z]/.test(t)?"html":/^[.#]?[\w-]+\s*\{[^}]*:/m.test(t)?"css":/\b(?:function|const |let |=>|require\(|console\.log|export default)\b/.test(t)?"javascript":/^\s*[\w-]+:\s+\S/m.test(t)&&!/[{};]/.test(t)?"yaml":""}(e.lines.join("\n")),l=function(e){switch(e){case"js":case"jsx":case"mjs":case"cjs":case"javascript":case"ts":case"tsx":case"typescript":case"java":case"c":case"h":case"cpp":case"cc":case"hpp":case"cs":case"csharp":case"go":case"golang":case"rust":case"rs":case"php":case"swift":case"kotlin":case"kt":case"scala":case"dart":case"groovy":return{line:["//"],block:["/*","*/"],quotes:['"',"'","`"],keywords:V};case"json":case"json5":case"jsonc":return{line:["//"],quotes:['"'],keywords:es};case"py":case"python":case"rb":case"ruby":return{line:["#"],quotes:['"',"'"],keywords:X};case"sh":case"bash":case"zsh":case"shell":case"console":case"terminal":case"powershell":case"ps1":return{line:["#"],quotes:['"',"'"],keywords:K};case"yaml":case"yml":case"toml":case"ini":case"cfg":case"conf":case"env":case"dotenv":case"properties":return{line:["#"],quotes:['"',"'"],keywords:et,keyColon:!0,dash:!0};case"sql":case"mysql":case"postgres":case"postgresql":case"sqlite":return{line:["--"],block:["/*","*/"],quotes:["'",'"'],keywords:Q,fold:!0};case"css":case"scss":case"sass":case"less":return{line:["//"],block:["/*","*/"],quotes:['"',"'"],keywords:ee,dash:!0,keyColon:!0};case"html":case"htm":case"xml":case"svg":case"vue":case"svelte":case"jsp":return en;default:return null}}(r),i="diff"===r||"patch"===r,o={block:!1,tag:!1},c=Math.max(40,t.contentW-2*a),d=[];for(let r of e.lines)for(let e of eh(el((i?function(e){let t=e[0]??"";return e.startsWith("+++")||e.startsWith("---")?[{text:e,kind:"comment"}]:"+"===t?[{text:e,kind:"string"}]:"-"===t?[{text:e,kind:"tag"}]:"@"===t?[{text:e,kind:"keyword"}]:/^(?:diff |index |new file|deleted file)/.test(e)?[{text:e,kind:"comment"}]:[{text:e,kind:"plain"}]}(r):l?function(e,t,s){let n=[],a=(e,t)=>{if(0===e.length)return;let s=n[n.length-1];s&&s.kind===t?s.text+=e:n.push({text:e,kind:t})},r=t.dash?/[A-Za-z_$@.#-]/:/[A-Za-z_$@]/,l=t.dash?/[[email protected]]/:/[A-Za-z0-9_$]/,i=0;for(;i<e.length;){if(s.block&&t.block){let r=e.indexOf(t.block[1],i);if(r<0)return a(e.slice(i),"comment"),n;a(e.slice(i,r+t.block[1].length),"comment"),i=r+t.block[1].length,s.block=!1;continue}let o=e[i];if(void 0===o)break;if(t.block&&!s.tag&&e.startsWith(t.block[0],i)){s.block=!0,a(t.block[0],"comment"),i+=t.block[0].length;continue}if(!s.tag){let s=!1;for(let n of t.line)if(e.startsWith(n,i)){a(e.slice(i),"comment"),s=!0;break}if(s)break}if(t.markup){if(!s.tag){if("<"===o){s.tag=!0;let t=i+1;("/"===e[t]||"!"===e[t]||"?"===e[t])&&t++;let n=t;for(;n<e.length&&/[A-Za-z0-9_:.-]/.test(e[n]??"");)n++;a(e.slice(i,n),"tag"),i=n;continue}a(o,"plain"),i++;continue}if(">"===o){a(">","tag"),s.tag=!1,i++;continue}if("/"===o&&">"===e[i+1]){a("/>","tag"),s.tag=!1,i+=2;continue}if(t.quotes.includes(o)){let t=ea(e,i,o);a(e.slice(i,t),"string"),i=t;continue}if(/[A-Za-z_:]/.test(o)){let t=i;for(;t<e.length&&/[A-Za-z0-9_:.-]/.test(e[t]??"");)t++;a(e.slice(i,t),"attr"),i=t;continue}if(/\s/.test(o)){a(o,"plain"),i++;continue}a(o,"punct"),i++;continue}if(t.quotes.includes(o)){let t=ea(e,i,o);a(e.slice(i,t),"string"),i=t;continue}if(/[0-9]/.test(o)){let t=i;for(;t<e.length&&/[0-9a-fA-FxX._]/.test(e[t]??"");)t++;a(e.slice(i,t),"number"),i=t;continue}if(r.test(o)){let s=i;for(;s<e.length&&l.test(e[s]??"");)s++;
30let n=e.slice(i,s),r=t.fold?n.toLowerCase():n,o="plain";if(t.keywords.has(r))o="keyword";else{let n=s;for(;n<e.length&&" "===e[n];)n++;"("===e[n]?o="func":t.keyColon&&":"===e[n]&&0===e.slice(0,i).trim().length&&(o="attr")}a(n,o),i=s;continue}if(/\s/.test(o)){a(o,"plain"),i++;continue}a(o,"punct"),i++}return n}(r,l,o):[{text:r,kind:"plain"}]).map(e=>({text:e.text,slot:"m",size:s,color:t.code.colors[e.kind],space:!1})),t.measure,a,a+1.2*s,c+a),n,s,"left",t.contentW,!1))d.push(e);0===d.length&&d.push({h:n,segs:[],rects:[]});let h=2*a+eu(d),u=t.base*t.style.gap*.7;return{unit:{lines:d,before:u,after:u,atomic:t.smart&&h<=t.pageContentH,keepWithNext:!1,isBreak:!1,tag:"code",bg:{color:t.code.bg,pad:a,inset:5}},lang:r}}(l,t);s.push(e.unit),e.lang.length>0&&n.push(e.lang);break}case"table":for(let e of function(e,t,s){let n=.95*s.base,a=n*Math.max(1.28,.92*s.style.lineFactor),r=.45*n,l=e.head.length;if(0===l)return[];let i=e=>e.reduce((e,t)=>e+s.measure(t.bold?"b":"r",t.text)*n,0),o=[];for(let t=0;t<l;t++){let n=i(e.head[t]??[]);for(let s of e.rows)n=Math.max(n,i(s[t]??[]));o.push(Math.min(n,.6*s.contentW)+2*r)}let c=o.reduce((e,t)=>e+t,0),d=Math.min(38,s.contentW/l),h=o.map(e=>Math.max(d,e/Math.max(1,c)*s.contentW)),u=h.reduce((e,t)=>e+t,0),p=u>0?s.contentW/u:1;for(let e=0;e<l;e++)h[e]=(h[e]??d)*p;let m=[],f=0;for(let e=0;e<l;e++)m.push(f),f+=h[e]??0;let g=(t,i)=>{let o=[],c=1;for(let e=0;e<l;e++){let a=ed((t[e]??[]).map(e=>i?{...e,bold:!0}:e),n,s,{head:!1,color:N}),l=Math.max(20,(h[e]??d)-2*r),u=el(a,s.measure,0,0,l);o.push(u),c=Math.max(c,u.length)}let u=[];for(let t=0;t<c;t++){let s=[],i=[],c=ei(a,n);for(let n=0;n<l;n++){let a=o[n]?.[t];if(!a)continue;let l=Math.max(20,(h[n]??d)-2*r),u=e.aligns[n]??"left",p=0;for(let e of("center"===u?p=(l-a.width)/2-a.start:"right"===u&&(p=l-a.width-a.start),a.segs))s.push({...e,x:e.x+p+(m[n]??0)+r,dy:c}),e.chip&&i.push({x:e.x+p+(m[n]??0)+r-1.2,dy:c-.8*e.size,w:e.w+2.4,h:1.04*e.size,color:e.chip})}u.push({h:a,segs:s,rects:i})}let p=u[u.length-1];return p&&p.rects.push({x:0,dy:p.h-(i?1:.5),w:s.contentW,h:i?.9:.4,color:i?[.55,.58,.62]:S}),u},b=s.base*s.style.gap*.65,x=g(e.head,!0),k=[{lines:x,before:b,after:0,atomic:!0,keepWithNext:!0,isBreak:!1,tag:"table",group:t}];return e.rows.forEach((s,n)=>{k.push({lines:g(s,!1),before:0,after:n===e.rows.length-1?b:0,atomic:!0,keepWithNext:!1,isBreak:!1,tag:"table",group:t,repeat:x})}),k}(l,r++,t))s.push(e);break;case"item":s.push(function(e,t,s){let n=s.base,a=n*s.style.lineFactor,r=e.depth*n*1.45,l=e.task??(e.ordered?`${t}.`:ep[e.depth%3]??"•"),i=e.task?"m":"r",o=s.measure(i,l)*n,c=r+Math.max(o+.4*n,.95*n),d=eh(el(ed(e.spans,n,s,{head:!1,color:N}),s.measure,c,c,s.contentW),a,n,"left",s.contentW,!0),h=d[0];h&&h.segs.unshift({x:r,w:o,text:l,slot:i,size:n,color:e.task?z:N,dy:ei(a,n)});let u=s.base*s.style.gap*.2;return{lines:d,before:u,after:u,atomic:s.smart&&d.length<=3,keepWithNext:!1,isBreak:!1,tag:"text"}}(l,a.next(l.depth,l.ordered,l.num),t))}return{units:s,langs:n}}(R.blocks,L),er=function(e,t){let s=t.margin,n=t.margin,a=t.pageH-t.margin,r=a-n,l=[],i={segs:[],rects:[],links:[]},o=n,c=!1,d=!1,h=0,u=0,p=0,m=new Map,f=()=>{l.push(i),i={segs:[],rects:[],links:[]},o=n,c=!1,l.length>=400&&(d=!0)},g=(e,t)=>{for(let n of e.rects)n.w<=0||n.h<=0||i.rects.push({x:s+n.x,y:t+n.dy,w:n.w,h:n.h,color:n.color});for(let n of e.segs)n.text.trim().length>0&&i.segs.push({x:s+n.x,y:t+n.dy,text:n.text,slot:n.slot,size:n.size,color:n.color}),n.url&&i.links.push({x:s+n.x,y:t+n.dy-.8*n.size,w:n.w,h:1.05*n.size,url:n.url});c=!0},b=e=>{for(let t of e)g(t,o),o+=t.h};for(let x=0;x<e.length;x++){let k=e[x];if(!k)continue;if(d)break;if(k.isBreak){c&&f(),p=0;continue}if(0===k.lines.length)continue;let w=k.bg?k.bg.pad:0,y=2*w+eu(k.lines),v=o+(c?Math.max(p,k.before):0);if(c){let e=a-v;y>e&&y<=r&&(k.atomic||k.keepWithNext)?("code"===k.tag&&h++,f(),v=o):!k.atomic&&0===ef(k.lines,e-2*w)&&y<=r?(f(),v=o):t.smart&&!k.atomic&&k.lines.length>=2&&2>ef(k.lines,e-2*w)&&y<=r&&(f(),v=o)}if(t.smart&&k.keepWithNext&&c){let t=e[x+1],s=t&&!t.isBreak?t.lines[0]:void 0;if(s){let e=y+Math.max(k.after,t?.before??0)+s.h;v+e>a&&n+e<=a&&(f(),v=o)}}o=v,k.repeat&&void 0!==k.group&&!c&&m.get(k.group)!==l.length&&b(k.repeat),void 0!==k.group&&void 0===k.repeat&&m.set(k.group,l.length);let j=o;o+=w;for(let e=0;e<k.lines.length;e++){let n=k.lines[e];if(!n)continue;let r=k.lines[e+1],l=t.smart&&!k.atomic&&k.lines.length>=3&&e===k.lines.length-2&&void 0!==r&&o+n.h+r.h+w>a;if((o+n.h+w>a||l)&&c){if(k.bg&&o+w-j>.5&&(i.rects.push({x:s-k.bg.inset,y:j,w:t.contentW+2*k.bg.inset,h:o+w-j,color:k.bg.color}),u++),f(),d)break;k.repeat&&b(k.repeat),j=o,o+=w}g(n,o),o+=n.h}o+=w,k.bg&&o-j>
30.5&&i.rects.push({x:s-k.bg.inset,y:j,w:t.contentW+2*k.bg.inset,h:o-j,color:k.bg.color}),p=k.after}for(l.push(i);l.length>1;){let e=l[l.length-1];if(!e||e.segs.length>0||e.rects.length>0)break;l.pop()}return{pages:l,overflow:d,keptWhole:h,splitCode:u}}(E,{pageW:c,pageH:d,margin:h,contentW:u,smart:t.smart}),eg=er.pages;if(t.pageNumbers){let e=Math.max(7,Math.min(11,t.size-1));for(let t=0;t<eg.length;t++){let s=eg[t];if(!s)continue;let n=`${t+1} of ${eg.length}`,a=T("r",n)*e;s.segs.push({x:(c-a)/2,y:d-.42*h,text:n,slot:"r",size:e,color:z})}}for(let e of eg){let t=b.addPage([c,d]);for(let s of e.rects)s.w<=0||s.h<=0||t.drawRectangle({x:s.x,y:d-s.y-s.h,width:s.w,height:s.h,color:i(s.color[0],s.color[1],s.color[2])});for(let s of e.segs)t.drawText(s.text,{x:s.x,y:d-s.y,size:s.size,font:W[s.slot],color:i(s.color[0],s.color[1],s.color[2])});if(e.links.length>0)try{let s=e.links.map(e=>b.context.register(b.context.obj({Type:"Annot",Subtype:"Link",Rect:[e.x,d-e.y-e.h,e.x+e.w,d-e.y],Border:[0,0,0],A:{Type:"Action",S:"URI",URI:l.of(e.url)}})));t.node.set(r.of("Annots"),b.context.obj(s))}catch{}}let eb=R.blocks.filter(e=>"code"===e.kind).length;return{pages:eg,bytes:await b.save(),overflow:er.overflow,keptWhole:er.keptWhole,splitCode:er.splitCode,images:R.stats.images,replaced:R.stats.replaced,frontMatter:R.stats.frontMatter,langs:Array.from(new Set(G)),codeBlocks:eb,style:m,pageW:c,pageH:d}}let ek=e=>`rgb(${Math.round(255*e[0])}, ${Math.round(255*e[1])}, ${Math.round(255*e[2])})`,ew=/\.(md|markdown|mdown|mkd|mdx|txt|text|rmd)$/i,ey="\x3c!-- pagebreak --\x3e",ev=["# Release notes 2.4\n\nEverything below is ordinary Markdown, so you can watch what the export does with headings,\ntables, lists and code before you paste your own.\n\n## What changed\n\n- Cold start is about a third faster\n- Fixed the crash on an empty config file\n- **Breaking:** the `--legacy` flag is gone\n\n| Setting | Old | New |\n| --- | :-: | --: |\n| Timeout | 30s | 10s |\n| Retries | 3 | 5 |\n\n## Config\n\n```js\n// this block stays in one piece, whatever page it lands on\nconst config = {\n  timeout: 10_000,\n  retries: 5,\n  onFail: (err) => console.warn('retrying', err.message),\n};\n\nexport default config;\n```\n\n> Back up your config before upgrading. It takes a minute.\n",ey,"\n## Rolling back\n\nRun this if the upgrade goes sideways, then read the [notes](https://example.com/notes).\n\n```bash\nnpm install [email protected]\napp config restore --from backup.json\n```\n\n1. Stop the service\n2. Restore the config\n3. Start it again"].join("\n");function ej(){let[e,t]=(0,a.useState)(""),[s,x]=(0,a.useState)(""),[N,z]=(0,a.useState)(eg),[S,M]=(0,a.useState)(null),[$,A]=(0,a.useState)(!1),[F,R]=(0,a.useState)(""),[L,E]=(0,a.useState)(!1),[B,O]=(0,a.useState)(!1),[q,D]=(0,a.useState)(4),[P,_]=(0,a.useState)(560),H=(0,a.useRef)(null),Z=(0,a.useRef)(null),I=(0,a.useRef)(null),J=(0,a.useRef)(0);(0,a.useEffect)(()=>{let e={...eg};try{let t=window.localStorage.getItem(eb);t&&(e={...e,...JSON.parse(t)})}catch{}let t=new URLSearchParams(window.location.search),s=t.get("ps");(0,d.O)(k,s)&&(e.pageSize=s);let n=t.get("mg");(0,d.O)(w,n)&&(e.margin=n);let a=t.get("st");(0,d.O)(v,a)&&(e.style=a);let r=t.get("ct");(0,d.O)(C,r)&&(e.codeTheme=r);let l=Number(t.get("sz"));T.some(e=>e===l)&&(e.size=l),"l"===t.get("or")&&(e.landscape=!0),"1"===t.get("pn")&&(e.pageNumbers=!0),"0"===t.get("sb")&&(e.smart=!1),z(e)},[]),(0,c.Vd)(eb,()=>JSON.stringify(N),[N]);let U=(0,a.useCallback)(()=>{let e=new URLSearchParams({ps:N.pageSize,mg:N.margin,st:N.style,ct:N.codeTheme,sz:String(N.size)});return N.landscape&&e.set("or","l"),N.pageNumbers&&e.set("pn","1"),N.smart||e.set("sb","0"),e},[N]),Y=(0,a.useCallback)(e=>{if(e.length>3e5){t(e.slice(0,3e5)),E(!0);return}t(e),E(!1)},[]),G=(0,a.useCallback)(async e=>{if(!e)return;let t=Array.from(e)[0];if(t){if(!ew.test(t.name)&&!t.type.startsWith("text/")&&""!==t.type)return void R(`"${t.name}" does not look like a Markdown file. Try .md, .markdown or .txt.`);try{let e=await (0,f.G)(t);R(e.note),x(t.name),Y(e.text)}catch(e){R(e instanceof Error?e.message:`"${t.name}" could not be read.`)}}},[Y]);function V(e){z(t=>({...t,...e}))}(0,a.useEffect)(()=>{let e=e=>{let t=e.clipboardData?.files;t&&t.length>0&&(e.preventDefault(),G(t))};return document.addEventListener("paste",e),()=>document.removeEventListener("paste",e)},[G]),(0,a.useEffect)(()=>{let e=I.current;if(!e||"undefined"==typeof ResizeObserver)return;let t=new ResizeObserver(e=>{let t=e[0];t&&_(t.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]),(0,a.useEffect)(()=>
30{if(0===e.trim().length){J.current++,M(null),A(!1);return}let t=++J.current;A(!0);let s=window.setTimeout(()=>{ex(e,N).then(e=>{J.current===t&&(M(e),A(!1))}).catch(e=>{J.current===t&&(M(null),A(!1),R(e instanceof Error?`Could not build the PDF: ${e.message}`:"Could not build the PDF."))})},220);return()=>window.clearTimeout(s)},[e,N]);let X=k[N.pageSize],K=N.landscape?X.h:X.w,Q=N.landscape?X.w:X.h,ee=Math.max(.24,Math.min(1.1,(P-24)/K)),et=v[N.style],es=S?S.pages.length:0;return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)(h.J,{htmlFor:"mdpdf-text",children:"Your Markdown"}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.length.toLocaleString()," characters",s?` from ${s}`:""]})]}),(0,n.jsx)("div",{onDragOver:e=>{e.preventDefault(),O(!0)},onDragLeave:()=>O(!1),onDrop:e=>{e.preventDefault(),O(!1),G(e.dataTransfer.files)},className:(0,m.cn)("rounded-md transition-colors",B?"ring-2 ring-primary ring-offset-2":""),children:(0,n.jsx)(u.T,{id:"mdpdf-text",ref:Z,value:e,onChange:e=>Y(e.target.value),placeholder:"# My README\n\nPaste your Markdown here. Headings, tables, lists, links and fenced code blocks all come through.",className:"min-h-[260px] font-mono text-sm",spellCheck:!1})}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"You can also click to choose a .md file, drag one into the box, or paste a file you copied. Nothing is uploaded either way."}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)(o.$,{variant:"outline",size:"sm",onClick:()=>H.current?.click(),children:[(0,n.jsx)(r.A,{className:"mr-2 h-4 w-4"}),"Choose a .md file"]}),(0,n.jsxs)(o.$,{variant:"outline",size:"sm",onClick:function(){let t=Z.current,s=t?t.selectionStart:e.length,n=e.slice(0,s),a=e.slice(s),r=0===n.length||n.endsWith("\n\n")?"":n.endsWith("\n")?"\n":"\n\n",l=a.startsWith("\n")?"\n":"\n\n",i=`${r}${ey}${l}`;if(Y(n+i+a),t){let e=n.length+i.length;window.setTimeout(()=>{t.focus(),t.setSelectionRange(e,e)},0)}},children:[(0,n.jsx)(l.A,{className:"mr-2 h-4 w-4"}),"Page break here"]}),(0,n.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>Y(ev),children:"Load a sample"}),e.length>0&&(0,n.jsx)(o.$,{variant:"ghost",size:"sm",onClick:function(){t(""),x(""),M(null),R(""),E(!1),D(4),H.current&&(H.current.value="")},children:"Clear"}),(0,n.jsx)("input",{ref:H,type:"file",accept:".md,.markdown,.mdown,.mkd,.mdx,.txt,.text,text/markdown,text/plain",className:"hidden",onChange:e=>{G(e.target.files),H.current&&(H.current.value="")}})]})]}),L&&(0,n.jsxs)("p",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm",children:["Your Markdown was longer than ",3e5.toLocaleString()," characters, so it was truncated at that point. Everything past it is not in the PDF. Split the rest into a second run."]}),F&&(0,n.jsx)("p",{className:"text-sm text-destructive",children:F}),(0,n.jsxs)("div",{className:"grid gap-3 rounded-lg border bg-card p-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,n.jsxs)("div",{className:"space-y-1.5 sm:col-span-2 lg:col-span-3",children:[(0,n.jsx)(h.J,{htmlFor:"mdpdf-style",children:"Document style"}),(0,n.jsx)("select",{id:"mdpdf-style",value:N.style,onChange:e=>V({style:e.target.value}),className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm",children:j.map(e=>(0,n.jsx)("option",{value:e,children:v[e].label},e))})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(h.J,{htmlFor:"mdpdf-size",children:"Page size"}),(0,n.jsx)("select",{id:"mdpdf-size",value:N.pageSize,onChange:e=>V({pageSize:e.target.value}),className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm",children:Object.entries(k).map(([e,t])=>(0,n.jsx)("option",{value:e,children:t.label},e))})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(h.J,{htmlFor:"mdpdf-margin",children:"Margins"}),(0,n.jsx)("select",{id:"mdpdf-margin",value:N.margin,onChange:e=>V({margin:e.target.value}),className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm",children:Object.entries(w).map(([e,t])=>(0,n.jsx)("option",{value:e,children:t.label},e))})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(h.J,{htmlFor:"mdpdf-pt",children:"Body size"}),(0,n.jsx)("select",{id:"mdpdf-pt",value:N.size,onChange:e=>V({size:Number(e.target.value)}),className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm",children:T.map(e=>(0,n.jsxs)("option",{value:e,children:[e," pt"]},e))})]}),(0,n.jsxs)("div",{className:"space-y-1.5 sm:col-span-2 lg:col-span-3",children:[(0,n.jsx)(h.J,{htmlFor:"mdpdf-code",children:"Code blocks"}),(0,n.jsx)("select",{id:"mdpdf-code",value:N.codeTheme,onChange:e=>V({codeTheme:e.target.value}),className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm",children:W.map(e=>(0,n.jsx)("option",{value:e,children:C[e].label},e))})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm sm:col-span-2 lg:col-span-3",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",checked:N.landscape,onCh
30ange:e=>V({landscape:e.target.checked}),className:"h-4 w-4 rounded border-input"}),"Landscape"]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",checked:N.pageNumbers,onChange:e=>V({pageNumbers:e.target.checked}),className:"h-4 w-4 rounded border-input"}),"Add page numbers"]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",checked:N.smart,onChange:e=>V({smart:e.target.checked}),className:"h-4 w-4 rounded border-input"}),"Smart page breaks"]})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground sm:col-span-2 lg:col-span-3",children:"Smart page breaks keep a code block in one piece, hold a heading with the text under it, repeat a table header when the table carries on, and stop a paragraph leaving one line behind. Turn it off to let everything fall wherever it lands."})]}),S?.overflow&&(0,n.jsxs)("p",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm",children:["This document runs past ",400," pages, so the PDF stops there. A smaller body size, narrower margins, or splitting the file will bring it back under the limit."]}),S&&(S.images>0||S.replaced>0||S.frontMatter)&&(0,n.jsxs)("div",{className:"space-y-2 rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm",children:[S.images>0&&(0,n.jsxs)("p",{children:[S.images," image reference",1===S.images?"":"s"," came through as the alt text in brackets. Pictures are not fetched, because that would mean sending your document somewhere."]}),S.frontMatter&&(0,n.jsx)("p",{children:"The front matter block at the top was left out of the PDF."}),S.replaced>0&&(0,n.jsxs)("p",{children:[S.replaced.toLocaleString()," character",1===S.replaced?"":"s"," came out as a question mark. The typefaces a PDF guarantees cover Latin letters only, so Chinese, Japanese, Greek, Cyrillic and emoji cannot be drawn."]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,n.jsxs)(o.$,{onClick:function(){S&&(0,b.WN)(new Blob([S.bytes.slice()],{type:"application/pdf"}),function(e,t){let s=e.replace(/\.[^.]+$/,"").trim();if(s.length>0)return`${s}.pdf`;let n=/^\s{0,3}#{1,6}[ \t]*(.+)$/m.exec(t),a=(n?.[1]??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return a.length>0?`${a}.pdf`:"document.pdf"}(s,e))},disabled:$||!S,children:[(0,n.jsx)(i.A,{className:"mr-2 h-4 w-4"}),$?"Typesetting...":"Download PDF"]}),S&&!$&&(0,n.jsxs)("span",{className:"text-sm text-muted-foreground",children:[es," page",1===es?"":"s",", ",(0,g.z3)(S.bytes.length)]})]}),S&&!$&&S.codeBlocks>0&&(0,n.jsxs)("p",{className:"rounded-md border bg-muted/40 p-3 text-sm",children:[S.codeBlocks," code block",1===S.codeBlocks?"":"s",S.langs.length>0?` (${S.langs.slice(0,5).join(", ")})`:""," drawn as real selectable text, colored token by token.",N.smart&&S.keptWhole>0?` ${S.keptWhole} block${1===S.keptWhole?" was":"s were"} moved to the next page rather than sliced.`:"",S.splitCode>0?` ${S.splitCode} block${1===S.splitCode?" is":"s are"} taller than one page, so ${1===S.splitCode?"it carries":"they carry"} over.`:""]}),S&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,n.jsx)(h.J,{children:"Preview"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"These are the actual pages of the PDF, redrawn every time you change a setting."})]}),(0,n.jsxs)("div",{ref:I,className:"max-h-[46rem] overflow-auto rounded-lg border bg-muted/40 p-3",children:[(0,n.jsx)("div",{className:"mx-auto flex w-fit flex-col items-center gap-4",children:S.pages.slice(0,q).map((e,t)=>(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"relative overflow-hidden bg-white shadow-sm ring-1 ring-black/10",style:{width:K*ee,height:Q*ee},children:[e.rects.map((e,t)=>(0,n.jsx)("div",{className:"absolute",style:{left:e.x*ee,top:e.y*ee,width:e.w*ee,height:Math.max(.5,e.h*ee),background:ek(e.color)}},`r${t}`)),e.segs.map((e,t)=>{let s=function(e,t){let s=t.bodySerif?y.serif:y.sans,n=t.headSerif?y.serif:y.sans;switch(e){case"b":return{family:s.css,weight:700,italic:!1};case"i":return{family:s.css,weight:400,italic:!0};case"bi":return{family:s.css,weight:700,italic:!0};case"hr":return{family:n.css,weight:400,italic:!1};case"hb":return{family:n.css,weight:700,italic:!1};case"m":return{family:y.mono.css,weight:400,italic:!1};case"mb":return{family:y.mono.css,weight:700,italic:!1};default:return{family:s.css,weight:400,italic:!1}}}(e.slot,et);return(0,n.jsx)("span",{className:"absolute",style:{left:e.x*ee,top:(e.y-.86*e.size)*ee,fontSize:e.size*ee,lineHeight:1,whiteSpace:"pre",fontFamily:s.family,fontWeight:s.weight,fontStyle:s.italic?"italic":"normal",color:ek(e.color)},children:e.text},`s${t}`)})]}),(0,n.jsxs)("p",{className:"text-center text-xs text-muted-foreground",children:["Page ",t+1]})]},t))}),S.pages.length>q&&(0,n.jsx)("div",{className:"mt-3 text-center",children:(0,n.jsxs)(o.$,{variant:"outline",size:"sm",onClick:()=>D(e=>e+4),children:["Show more pages (",S.pages.length-q," left)"]})})]})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your Markdown is parsed, typeset and written into a PDF inside this browser tab. It is never uploaded, there is no sign-up, no watermark and no daily limit."}),(0,n.jsx)(p.ToolActions,{getParams:U,title:"Markdown to PDF Converter"})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.