mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-24 07:41:47 +00:00
69141fcacc
WorkBox's NavigationRoute served the cached SPA shell on window.location.reload(), meaning Pangolin/CF Access never saw the navigation and the app was left stuck showing stale offline data. Unregistering the SW first lets the navigation reach the network so the upstream proxy can run its auth flow. Also rebuilds server/public with corrected sw.js (health excluded from NetworkFirst, /oauth/ and /.well-known/ added to NavigationRoute denylist).
253 lines
54 KiB
JavaScript
253 lines
54 KiB
JavaScript
var ze=Object.defineProperty;var Te=(t,e,r)=>e in t?ze(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var k=(t,e,r)=>Te(t,typeof e!="symbol"?e+"":e,r);function J(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var E=J();function ue(t){E=t}var P={exec:()=>null};function g(t,e=""){let r=typeof t=="string"?t:t.source,i={replace:(n,l)=>{let a=typeof l=="string"?l:l.source;return a=a.replace(m.caret,"$1"),r=r.replace(n,a),i},getRegex:()=>new RegExp(r,e)};return i}var Ae=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Pe=/^(?:[ \t]*(?:\n|$))+/,_e=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ee=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,j=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ce=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,K=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ge=g(de).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Le=g(de).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Y=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ie=/^[^\n]+/,V=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Be=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",V).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),qe=g(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,K).getRegex(),N="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ee=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,De=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ee).replace("tag",N).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe=g(Y).replace("hr",j).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N).getRegex(),je=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fe).getRegex(),te={blockquote:je,code:_e,def:Be,fences:Ee,heading:Ce,hr:j,html:De,lheading:ge,list:qe,newline:Pe,paragraph:fe,table:P,text:Ie},se=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",j).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N).getRegex(),Ze={...te,lheading:Le,table:se,paragraph:g(Y).replace("hr",j).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",se).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N).getRegex()},Me={...te,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ee).replace(/tag/g,"(?!(?: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").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:P,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Y).replace("hr",j).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ge).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},He=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Qe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ke=/^( {2,}|\\)\n(?!\s*$)/,Oe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,I=/[\p{P}\p{S}]/u,G=/[\s\p{P}\p{S}]/u,re=/[^\s\p{P}\p{S}]/u,Ne=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,G).getRegex(),be=/(?!~)[\p{P}\p{S}]/u,Ge=/(?!~)[\s\p{P}\p{S}]/u,We=/(?:[^\s\p{P}\p{S}]|~)/u,Fe=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ae?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xe=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ue=g(xe,"u").replace(/punct/g,I).getRegex(),Xe=g(xe,"u").replace(/punct/g,be).getRegex(),me="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Je=g(me,"gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,G).replace(/punct/g,I).getRegex(),Ke=g(me,"gu").replace(/notPunctSpace/g,We).replace(/punctSpace/g,Ge).replace(/punct/g,be).getRegex(),Ye=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,G).replace(/punct/g,I).getRegex(),Ve=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,I).getRegex(),et="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",tt=g(et,"gu").replace(/notPunctSpace/g,re).replace(/punctSpace/g,G).replace(/punct/g,I).getRegex(),rt=g(/\\(punct)/,"gu").replace(/punct/g,I).getRegex(),nt=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),it=g(ee).replace("(?:-->|$)","-->").getRegex(),st=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",it).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),H=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,lt=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",H).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),we=g(/^!?\[(label)\]\[(ref)\]/).replace("label",H).replace("ref",V).getRegex(),ye=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",V).getRegex(),at=g("reflink|nolink(?!\\()","g").replace("reflink",we).replace("nolink",ye).getRegex(),le=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ne={_backpedal:P,anyPunctuation:rt,autolink:nt,blockSkip:Fe,br:ke,code:Qe,del:P,delLDelim:P,delRDelim:P,emStrongLDelim:Ue,emStrongRDelimAst:Je,emStrongRDelimUnd:Ye,escape:He,link:lt,nolink:ye,punctuation:Ne,reflink:we,reflinkSearch:at,tag:st,text:Oe,url:P},ot={...ne,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",H).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",H).getRegex()},F={...ne,emStrongRDelimAst:Ke,emStrongLDelim:Xe,delLDelim:Ve,delRDelim:tt,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",le).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",le).getRegex()},ct={...F,br:g(ke).replace("{2,}","*").getRegex(),text:g(F.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Z={normal:te,gfm:Ze,pedantic:Me},q={normal:ne,gfm:F,breaks:ct,pedantic:ot},pt={"&":"&","<":"<",">":">",'"':""","'":"'"},ae=t=>pt[t];function S(t,e){if(e){if(m.escapeTest.test(t))return t.replace(m.escapeReplace,ae)}else if(m.escapeTestNoEncode.test(t))return t.replace(m.escapeReplaceNoEncode,ae);return t}function oe(t){try{t=encodeURI(t).replace(m.percentDecode,"%")}catch{return null}return t}function ce(t,e){var l;let r=t.replace(m.findPipe,(a,o,s)=>{let h=!1,c=o;for(;--c>=0&&s[c]==="\\";)h=!h;return h?"|":" |"}),i=r.split(m.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!((l=i.at(-1))!=null&&l.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(m.slashPipe,"|");return i}function z(t,e,r){let i=t.length;if(i===0)return"";let n=0;for(;n<i&&t.charAt(i-n-1)===e;)n++;return t.slice(0,i-n)}function pe(t){let e=t.split(`
|
|
`),r=e.length-1;for(;r>=0&&m.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(`
|
|
`)}function ht(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])r++;else if(t[i]===e[1]&&(r--,r<0))return i;return r>0?-2:-1}function ut(t,e=0){let r=e,i="";for(let n of t)if(n===" "){let l=4-r%4;i+=" ".repeat(l),r+=l}else i+=n,r++;return i}function he(t,e,r,i,n){let l=e.href,a=e.title||null,o=t[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let s={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:l,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,s}function dt(t,e,r){let i=t.match(r.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
|
|
`).map(l=>{let a=l.match(r.other.beginningSpace);if(a===null)return l;let[o]=a;return o.length>=n.length?l.slice(n.length):l}).join(`
|
|
`)}var Q=class{constructor(t){k(this,"options");k(this,"rules");k(this,"lexer");this.options=t||E}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:pe(e[0]),i=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:i}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],i=dt(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let i=z(r,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(r=i.trim())}return{type:"heading",raw:z(e[0],`
|
|
`),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:z(e[0],`
|
|
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=z(e[0],`
|
|
`).split(`
|
|
`),i="",n="",l=[];for(;r.length>0;){let a=!1,o=[],s;for(s=0;s<r.length;s++)if(this.rules.other.blockquoteStart.test(r[s]))o.push(r[s]),a=!0;else if(!a)o.push(r[s]);else break;r=r.slice(s);let h=o.join(`
|
|
`),c=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
${h}`:h,n=n?`${n}
|
|
${c}`:c;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,l,!0),this.lexer.state.top=u,r.length===0)break;let d=l.at(-1);if((d==null?void 0:d.type)==="code")break;if((d==null?void 0:d.type)==="blockquote"){let b=d,p=b.raw+`
|
|
`+r.join(`
|
|
`),w=this.blockquote(p);l[l.length-1]=w,i=i.substring(0,i.length-b.raw.length)+w.raw,n=n.substring(0,n.length-b.text.length)+w.text;break}else if((d==null?void 0:d.type)==="list"){let b=d,p=b.raw+`
|
|
`+r.join(`
|
|
`),w=this.list(p);l[l.length-1]=w,i=i.substring(0,i.length-d.raw.length)+w.raw,n=n.substring(0,n.length-b.raw.length)+w.raw,r=p.substring(l.at(-1).raw.length).split(`
|
|
`);continue}}return{type:"blockquote",raw:i,tokens:l,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim(),i=r.length>1,n={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");let l=this.rules.other.listItemRegex(r),a=!1;for(;t;){let s=!1,h="",c="";if(!(e=l.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let u=ut(e[2].split(`
|
|
`,1)[0],e[1].length),d=t.split(`
|
|
`,1)[0],b=!u.trim(),p=0;if(this.options.pedantic?(p=2,c=u.trimStart()):b?p=e[1].length+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,c=u.slice(p),p+=e[1].length),b&&this.rules.other.blankLine.test(d)&&(h+=d+`
|
|
`,t=t.substring(d.length+1),s=!0),!s){let w=this.rules.other.nextBulletRegex(p),x=this.rules.other.hrRegex(p),y=this.rules.other.fencesBeginRegex(p),R=this.rules.other.headingBeginRegex(p),B=this.rules.other.htmlBeginRegex(p),W=this.rules.other.blockquoteBeginRegex(p);for(;t;){let C=t.split(`
|
|
`,1)[0],A;if(d=C,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),A=d):A=d.replace(this.rules.other.tabCharGlobal," "),y.test(d)||R.test(d)||B.test(d)||W.test(d)||w.test(d)||x.test(d))break;if(A.search(this.rules.other.nonSpaceChar)>=p||!d.trim())c+=`
|
|
`+A.slice(p);else{if(b||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(u)||R.test(u)||x.test(u))break;c+=`
|
|
`+d}b=!d.trim(),h+=C+`
|
|
`,t=t.substring(C.length+1),u=A.slice(p)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),n.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),n.raw+=h}let o=n.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let s of n.items){this.lexer.state.top=!1,s.tokens=this.lexer.blockTokens(s.text,[]);let h=s.tokens[0];if(s.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){s.text=s.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(s.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};s.checked=u.checked,n.loose?s.tokens[0]&&["paragraph","text"].includes(s.tokens[0].type)&&"tokens"in s.tokens[0]&&s.tokens[0].tokens?(s.tokens[0].raw=u.raw+s.tokens[0].raw,s.tokens[0].text=u.raw+s.tokens[0].text,s.tokens[0].tokens.unshift(u)):s.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):s.tokens.unshift(u)}}else s.task&&(s.task=!1);if(!n.loose){let c=s.tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));n.loose=u}}if(n.loose)for(let s of n.items){s.loose=!0;for(let h of s.tokens)h.type==="text"&&(h.type="paragraph")}return n}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=pe(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:z(e[0],`
|
|
`),href:i,title:n}}}table(t){var a;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=ce(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(a=e[3])!=null&&a.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
`):[],l={type:"table",raw:z(e[0],`
|
|
`),header:[],align:[],rows:[]};if(r.length===i.length){for(let o of i)this.rules.other.tableAlignRight.test(o)?l.align.push("right"):this.rules.other.tableAlignCenter.test(o)?l.align.push("center"):this.rules.other.tableAlignLeft.test(o)?l.align.push("left"):l.align.push(null);for(let o=0;o<r.length;o++)l.header.push({text:r[o],tokens:this.lexer.inline(r[o]),header:!0,align:l.align[o]});for(let o of n)l.rows.push(ce(o,l.header.length).map((s,h)=>({text:s,tokens:this.lexer.inline(s),header:!1,align:l.align[h]})));return l}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:z(e[0],`
|
|
`),depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
|
|
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let l=z(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{let l=ht(e[2],"()");if(l===-2)return;if(l>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let i=e[2],n="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(i);l&&(i=l[1],n=l[3])}else n=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i=i.slice(1):i=i.slice(1,-1)),he(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let i=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[i.toLowerCase()];if(!n){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return he(r,n,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!r||this.rules.inline.punctuation.exec(r))){let n=[...i[0]].length-1,l,a,o=n,s=0,h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+n);(i=h.exec(e))!==null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(a=[...l].length,i[3]||i[4]){o+=a;continue}else if((i[5]||i[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let c=[...i[0]][0].length,u=t.slice(0,n+i.index+c+a);if(Math.min(n,a)%2){let b=u.slice(1,-1);return{type:"em",raw:u,text:b,tokens:this.lexer.inlineTokens(b)}}let d=u.slice(2,-2);return{type:"strong",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return i&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let i=this.rules.inline.delLDelim.exec(t);if(i&&(!i[1]||!r||this.rules.inline.punctuation.exec(r))){let n=[...i[0]].length-1,l,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,e=e.slice(-1*t.length+n);(i=s.exec(e))!==null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l||(a=[...l].length,a!==n))continue;if(i[3]||i[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let h=[...i[0]][0].length,c=t.slice(0,n+i.index+h+a),u=c.slice(n,-n);return{type:"del",raw:c,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,i;return e[2]==="@"?(r=e[1],i="mailto:"+r):(r=e[1],i=r),{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let i,n;if(e[2]==="@")i=e[0],n="mailto:"+i;else{let l;do l=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(l!==e[0]);i=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},v=class U{constructor(e){k(this,"tokens");k(this,"options");k(this,"state");k(this,"inlineQueue");k(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||E,this.options.tokenizer=this.options.tokenizer||new Q,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:m,block:Z.normal,inline:q.normal};this.options.pedantic?(r.block=Z.pedantic,r.inline=q.pedantic):this.options.gfm&&(r.block=Z.gfm,this.options.breaks?r.inline=q.breaks:r.inline=q.gfm),this.tokenizer.rules=r}static get rules(){return{block:Z,inline:q}}static lex(e,r){return new U(r).lex(e)}static lexInline(e,r){return new U(r).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
|
|
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let i=this.inlineQueue[r];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],i=!1){var l,a,o;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let s;if((a=(l=this.options.extensions)==null?void 0:l.block)!=null&&a.some(c=>(s=c.call({lexer:this},e,r))?(e=e.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let c=r.at(-1);s.raw.length===1&&c!==void 0?c.raw+=`
|
|
`:r.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
`)?"":`
|
|
`)+s.raw,c.text+=`
|
|
`+s.text,this.inlineQueue.at(-1).src=c.text):r.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
`)?"":`
|
|
`)+s.raw,c.text+=`
|
|
`+s.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},r.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),r.push(s);continue}let h=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(b=>{d=b.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(this.state.top&&(s=this.tokenizer.paragraph(h))){let c=r.at(-1);i&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
`)?"":`
|
|
`)+s.raw,c.text+=`
|
|
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(s),i=h.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
`)?"":`
|
|
`)+s.raw,c.text+=`
|
|
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(s);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var h,c,u,d,b;this.tokenizer.lexer=this;let i=e,n=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)p.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(i))!==null;)i=i.slice(0,n.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(i))!==null;)l=n[2]?n[2].length:0,i=i.slice(0,n.index+l)+"["+"a".repeat(n[0].length-l-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((c=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:c.call({lexer:this},i))??i;let a=!1,o="",s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=""),a=!1;let p;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(x=>(p=x.call({lexer:this},e,r))?(e=e.substring(p.raw.length),r.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let x=r.at(-1);p.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):r.push(p);continue}if(p=this.tokenizer.emStrong(e,i,o)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.del(e,i,o)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),r.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),r.push(p);continue}let w=e;if((b=this.options.extensions)!=null&&b.startInline){let x=1/0,y=e.slice(1),R;this.options.extensions.startInline.forEach(B=>{R=B.call({lexer:this},y),typeof R=="number"&&R>=0&&(x=Math.min(x,R))}),x<1/0&&x>=0&&(w=e.substring(0,x+1))}if(p=this.tokenizer.inlineText(w)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(o=p.raw.slice(-1)),a=!0;let x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):r.push(p);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw new Error(r)}},O=class{constructor(t){k(this,"options");k(this,"parser");this.options=t||E}space(t){return""}code({text:t,lang:e,escaped:r}){var l;let i=(l=(e||"").match(m.notSpaceStart))==null?void 0:l[0],n=t.replace(m.endingNewline,"")+`
|
|
`;return i?'<pre><code class="language-'+S(i)+'">'+(r?n:S(n,!0))+`</code></pre>
|
|
`:"<pre><code>"+(r?n:S(n,!0))+`</code></pre>
|
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
${this.parser.parse(t)}</blockquote>
|
|
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
`}hr(t){return`<hr>
|
|
`}list(t){let e=t.ordered,r=t.start,i="";for(let a=0;a<t.items.length;a++){let o=t.items[a];i+=this.listitem(o)}let n=e?"ol":"ul",l=e&&r!==1?' start="'+r+'"':"";return"<"+n+l+`>
|
|
`+i+"</"+n+`>
|
|
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
`}table(t){let e="",r="";for(let n=0;n<t.header.length;n++)r+=this.tablecell(t.header[n]);e+=this.tablerow({text:r});let i="";for(let n=0;n<t.rows.length;n++){let l=t.rows[n];r="";for(let a=0;a<l.length;a++)r+=this.tablecell(l[a]);i+=this.tablerow({text:r})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
<thead>
|
|
`+e+`</thead>
|
|
`+i+`</table>
|
|
`}tablerow({text:t}){return`<tr>
|
|
${t}</tr>
|
|
`}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
|
|
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${S(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let i=this.parser.parseInline(r),n=oe(t);if(n===null)return i;t=n;let l='<a href="'+t+'"';return e&&(l+=' title="'+S(e)+'"'),l+=">"+i+"</a>",l}image({href:t,title:e,text:r,tokens:i}){i&&(r=this.parser.parseInline(i,this.parser.textRenderer));let n=oe(t);if(n===null)return S(r);t=n;let l=`<img src="${t}" alt="${S(r)}"`;return e&&(l+=` title="${S(e)}"`),l+=">",l}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:S(t.text)}},ie=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},$=class X{constructor(e){k(this,"options");k(this,"renderer");k(this,"textRenderer");this.options=e||E,this.options.renderer=this.options.renderer||new O,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ie}static parse(e,r){return new X(r).parse(e)}static parseInline(e,r){return new X(r).parseInline(e)}parse(e){var i,n;this.renderer.parser=this;let r="";for(let l=0;l<e.length;l++){let a=e[l];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[a.type]){let s=a,h=this.options.extensions.renderers[s.type].call({parser:this},s);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){r+=h||"";continue}}let o=a;switch(o.type){case"space":{r+=this.renderer.space(o);break}case"hr":{r+=this.renderer.hr(o);break}case"heading":{r+=this.renderer.heading(o);break}case"code":{r+=this.renderer.code(o);break}case"table":{r+=this.renderer.table(o);break}case"blockquote":{r+=this.renderer.blockquote(o);break}case"list":{r+=this.renderer.list(o);break}case"checkbox":{r+=this.renderer.checkbox(o);break}case"html":{r+=this.renderer.html(o);break}case"def":{r+=this.renderer.def(o);break}case"paragraph":{r+=this.renderer.paragraph(o);break}case"text":{r+=this.renderer.text(o);break}default:{let s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return r}parseInline(e,r=this.renderer){var n,l;this.renderer.parser=this;let i="";for(let a=0;a<e.length;a++){let o=e[a];if((l=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&l[o.type]){let h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=h||"";continue}}let s=o;switch(s.type){case"escape":{i+=r.text(s);break}case"html":{i+=r.html(s);break}case"link":{i+=r.link(s);break}case"image":{i+=r.image(s);break}case"checkbox":{i+=r.checkbox(s);break}case"strong":{i+=r.strong(s);break}case"em":{i+=r.em(s);break}case"codespan":{i+=r.codespan(s);break}case"br":{i+=r.br(s);break}case"del":{i+=r.del(s);break}case"text":{i+=r.text(s);break}default:{let h='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},M,D=(M=class{constructor(t){k(this,"options");k(this,"block");this.options=t||E}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?v.lex:v.lexInline}provideParser(t=this.block){return t?$.parse:$.parseInline}},k(M,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),k(M,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),M),gt=class{constructor(...t){k(this,"defaults",J());k(this,"options",this.setOptions);k(this,"parse",this.parseMarkdown(!0));k(this,"parseInline",this.parseMarkdown(!1));k(this,"Parser",$);k(this,"Renderer",O);k(this,"TextRenderer",ie);k(this,"Lexer",v);k(this,"Tokenizer",Q);k(this,"Hooks",D);this.use(...t)}walkTokens(t,e){var i,n;let r=[];for(let l of t)switch(r=r.concat(e.call(this,l)),l.type){case"table":{let a=l;for(let o of a.header)r=r.concat(this.walkTokens(o.tokens,e));for(let o of a.rows)for(let s of o)r=r.concat(this.walkTokens(s.tokens,e));break}case"list":{let a=l;r=r.concat(this.walkTokens(a.items,e));break}default:{let a=l;(n=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&n[a.type]?this.defaults.extensions.childTokens[a.type].forEach(o=>{let s=a[o].flat(1/0);r=r.concat(this.walkTokens(s,e))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let l=e.renderers[n.name];l?e.renderers[n.name]=function(...a){let o=n.renderer.apply(this,a);return o===!1&&(o=l.apply(this,a)),o}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=e[n.level];l?l.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),r.renderer){let n=this.defaults.renderer||new O(this.defaults);for(let l in r.renderer){if(!(l in n))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let a=l,o=r.renderer[a],s=n[a];n[a]=(...h)=>{let c=o.apply(n,h);return c===!1&&(c=s.apply(n,h)),c||""}}i.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new Q(this.defaults);for(let l in r.tokenizer){if(!(l in n))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let a=l,o=r.tokenizer[a],s=n[a];n[a]=(...h)=>{let c=o.apply(n,h);return c===!1&&(c=s.apply(n,h)),c}}i.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new D;for(let l in r.hooks){if(!(l in n))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let a=l,o=r.hooks[a],s=n[a];D.passThroughHooks.has(l)?n[a]=h=>{if(this.defaults.async&&D.passThroughHooksRespectAsync.has(l))return(async()=>{let u=await o.call(n,h);return s.call(n,u)})();let c=o.call(n,h);return s.call(n,c)}:n[a]=(...h)=>{if(this.defaults.async)return(async()=>{let u=await o.apply(n,h);return u===!1&&(u=await s.apply(n,h)),u})();let c=o.apply(n,h);return c===!1&&(c=s.apply(n,h)),c}}i.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,l=r.walkTokens;i.walkTokens=function(a){let o=[];return o.push(l.call(this,a)),n&&(o=o.concat(n.call(this,a))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return v.lex(t,e??this.defaults)}parser(t,e){return $.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let i={...r},n={...this.defaults,...i},l=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=t),n.async)return(async()=>{let a=n.hooks?await n.hooks.preprocess(e):e,o=await(n.hooks?await n.hooks.provideLexer(t):t?v.lex:v.lexInline)(a,n),s=n.hooks?await n.hooks.processAllTokens(o):o;n.walkTokens&&await Promise.all(this.walkTokens(s,n.walkTokens));let h=await(n.hooks?await n.hooks.provideParser(t):t?$.parse:$.parseInline)(s,n);return n.hooks?await n.hooks.postprocess(h):h})().catch(l);try{n.hooks&&(e=n.hooks.preprocess(e));let a=(n.hooks?n.hooks.provideLexer(t):t?v.lex:v.lexInline)(e,n);n.hooks&&(a=n.hooks.processAllTokens(a)),n.walkTokens&&this.walkTokens(a,n.walkTokens);let o=(n.hooks?n.hooks.provideParser(t):t?$.parse:$.parseInline)(a,n);return n.hooks&&(o=n.hooks.postprocess(o)),o}catch(a){return l(a)}}}onError(t,e){return r=>{if(r.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+S(r.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(r);throw r}}},_=new gt;function f(t,e){return _.parse(t,e)}f.options=f.setOptions=function(t){return _.setOptions(t),f.defaults=_.defaults,ue(f.defaults),f};f.getDefaults=J;f.defaults=E;f.use=function(...t){return _.use(...t),f.defaults=_.defaults,ue(f.defaults),f};f.walkTokens=function(t,e){return _.walkTokens(t,e)};f.parseInline=_.parseInline;f.Parser=$;f.parser=$.parse;f.Renderer=O;f.TextRenderer=ie;f.Lexer=v;f.lexer=v.lex;f.Tokenizer=Q;f.Hooks=D;f.parse=f;f.options;f.setOptions;f.use;f.walkTokens;f.parseInline;$.parse;v.lex;function T(t){return t?String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""}function ft(t){return t?f.parse(t,{async:!1,breaks:!0}):""}function ve(t){return t?t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")?t:window.location.origin+(t.startsWith("/")?"":"/")+t:""}function L(t){return ve(`/api/photos/${t.photo_id}/original`)}function kt(t){return new Date(t+"T00:00:00").toLocaleDateString("en",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}function bt(t){const e=new Map;for(const r of t)r.entry_date&&(e.has(r.entry_date)||e.set(r.entry_date,[]),e.get(r.entry_date).push(r));return e}function xt(t){var n,l;const e=t.pros_cons;if(!e)return"";const r=((n=e.pros)==null?void 0:n.filter(a=>a.trim()))||[],i=((l=e.cons)==null?void 0:l.filter(a=>a.trim()))||[];return r.length===0&&i.length===0?"":`<div class="verdict-wrap"><div class="verdict-row">
|
|
${r.length>0?`<div class="verdict-card pros"><div class="verdict-label">Loved it</div><ul>${r.map(a=>`<li>${T(a)}</li>`).join("")}</ul></div>`:""}
|
|
${i.length>0?`<div class="verdict-card cons"><div class="verdict-label">Could be better</div><ul>${i.map(a=>`<li>${T(a)}</li>`).join("")}</ul></div>`:""}
|
|
</div></div>`}function mt(t){return t.length===0?"":t.length===1?`<div class="entry-photo-single"><img src="${L(t[0])}" /></div>`:t.length===2?`<div class="entry-photo-duo">${t.map(e=>`<div class="photo-cell"><img src="${L(e)}" /></div>`).join("")}</div>`:`<div class="entry-photo-trio">
|
|
<div class="photo-hero"><img src="${L(t[0])}" /></div>
|
|
<div class="photo-stack">
|
|
<div class="photo-cell"><img src="${L(t[1])}" /></div>
|
|
<div class="photo-cell"><img src="${L(t[2])}" /></div>
|
|
</div>
|
|
</div>`}async function yt(t){const e=(t.entries||[]).filter(p=>p.type!=="skeleton"&&p.type!=="gallery"),r=e.flatMap(p=>p.photos||[]),i=t.cover_image?ve(`/uploads/${t.cover_image}`):r[0]?L(r[0]):"",n=bt(e),l=[...n.keys()].sort(),a=[];let o=1;l.forEach((p,w)=>{n.get(p).forEach((y,R)=>{o++;const B=R===0,W=y.photos||[],C=[y.entry_time,y.location_name].filter(Boolean).join(" · "),A=B?`<div class="day-header">Day ${w+1} · ${kt(p)}</div>`:"",$e=mt(W),Se=xt(y),Re=y.story?`<div class="entry-story">${ft(y.story)}</div>`:"";a.push(`
|
|
<div class="entry-page">
|
|
${A}
|
|
${$e}
|
|
<div class="entry-content">
|
|
${C?`<div class="entry-meta">${T(C)}</div>`:""}
|
|
${y.title?`<h2 class="entry-title">${T(y.title)}</h2>`:""}
|
|
${Re}
|
|
${Se}
|
|
</div>
|
|
</div>
|
|
`)})});const s=o+1,h=`<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<base href="${window.location.origin}/">
|
|
<title>${T(t.title)} — Journey Book</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body { font-family: 'Inter', -apple-system, sans-serif; color: #1A1A1A; font-size: 11pt; line-height: 1.55; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
|
img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
|
|
|
@page { size: A4 landscape; margin: 0; }
|
|
|
|
/* ── Cover ─── */
|
|
.cover-page {
|
|
width: 100%; height: 100vh; position: relative; overflow: hidden;
|
|
background: #0a0a0f; color: white; display: flex; align-items: center; justify-content: center;
|
|
page-break-after: always;
|
|
}
|
|
.cover-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
|
|
.cover-dim { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
|
|
.cover-mesh { position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, rgba(99,102,241,0.2), transparent 50%), radial-gradient(circle at 80% 70%, rgba(236,72,153,0.15), transparent 50%); }
|
|
.cover-content { position: relative; z-index: 2; text-align: center; padding: 60pt; }
|
|
.cover-label { font-size: 9pt; font-weight: 700; letter-spacing: 6pt; text-transform: uppercase; opacity: 0.35; margin-bottom: 24pt; }
|
|
.cover-content h1 { font-size: 56pt; font-weight: 800; letter-spacing: -0.03em; line-height: 0.9; margin-bottom: 10pt; }
|
|
.cover-content .sub { font-size: 14pt; font-weight: 400; opacity: 0.7; margin-bottom: 36pt; }
|
|
.cover-stats { display: flex; gap: 48pt; justify-content: center; }
|
|
.cover-stat-val { font-size: 32pt; font-weight: 800; letter-spacing: -0.02em; }
|
|
.cover-stat-label { font-size: 10pt; text-transform: uppercase; letter-spacing: 2pt; opacity: 0.4; margin-top: 3pt; }
|
|
.cover-footer { position: absolute; bottom: 20pt; left: 0; right: 0; text-align: center; font-size: 9pt; opacity: 0.2; letter-spacing: 3pt; text-transform: uppercase; }
|
|
|
|
/* ── TOC ─── */
|
|
.toc-page {
|
|
width: 100%; height: 100vh; padding: 48pt 64pt; display: flex; flex-direction: column;
|
|
background: white; page-break-after: always;
|
|
}
|
|
.toc-top-label { font-size: 9pt; font-weight: 700; letter-spacing: 5pt; text-transform: uppercase; color: #94a3b8; margin-bottom: 16pt; }
|
|
.toc-title-block h2 { font-size: 36pt; font-weight: 800; letter-spacing: -1pt; color: #0a0a0f; margin-bottom: 4pt; }
|
|
.toc-title-block .sub { font-size: 13pt; color: #71717a; margin-bottom: 24pt; }
|
|
.toc-divider { height: 1pt; background: #e4e4e7; margin: 16pt 0; }
|
|
.toc-body { flex: 1; columns: 2; column-gap: 40pt; }
|
|
.toc-day { break-inside: avoid; margin-bottom: 14pt; }
|
|
.toc-day-label { font-size: 9pt; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #71717a; margin-bottom: 4pt; }
|
|
.toc-entry { display: flex; align-items: baseline; gap: 4pt; font-size: 11pt; color: #3f3f46; margin-bottom: 2pt; }
|
|
.toc-entry .toc-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200pt; }
|
|
.toc-entry .toc-dots { flex: 1; border-bottom: 1pt dotted #d4d4d8; margin: 0 4pt; min-width: 20pt; }
|
|
.toc-entry .toc-page { font-size: 10pt; color: #a1a1aa; font-weight: 500; flex-shrink: 0; }
|
|
.toc-stats { display: flex; gap: 32pt; margin-top: auto; padding-top: 16pt; border-top: 1pt solid #e4e4e7; }
|
|
.toc-stat-val { font-size: 18pt; font-weight: 800; color: #0a0a0f; }
|
|
.toc-stat-label { font-size: 9pt; text-transform: uppercase; letter-spacing: 1pt; color: #94a3b8; }
|
|
|
|
/* ── Entry Page ─── */
|
|
.entry-page {
|
|
width: 100%; min-height: 100vh; padding: 56pt 48pt 48pt;
|
|
page-break-after: always;
|
|
display: flex; flex-direction: column;
|
|
}
|
|
|
|
/* Day header — inline */
|
|
.day-header {
|
|
font-size: 9pt; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
|
|
color: #71717a; text-align: center; margin-bottom: 16pt; position: relative;
|
|
display: flex; align-items: center; gap: 12pt;
|
|
}
|
|
.day-header::before, .day-header::after { content: ''; flex: 1; height: 0.5pt; background: #d4d4d8; }
|
|
|
|
/* Photos */
|
|
.entry-photo-single { border-radius: 8pt; overflow: hidden; margin-bottom: 16pt; height: 55vh; }
|
|
.entry-photo-single img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
.entry-photo-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 6pt; border-radius: 8pt; overflow: hidden; margin-bottom: 16pt; height: 45vh; }
|
|
.entry-photo-trio { display: grid; grid-template-columns: 3fr 2fr; gap: 6pt; border-radius: 8pt; overflow: hidden; margin-bottom: 16pt; height: 50vh; }
|
|
.photo-cell { overflow: hidden; }
|
|
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
.photo-hero { overflow: hidden; }
|
|
.photo-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
.photo-stack { display: flex; flex-direction: column; gap: 6pt; }
|
|
.photo-stack .photo-cell { flex: 1; }
|
|
|
|
/* Entry content */
|
|
.entry-content { flex: 1; }
|
|
.entry-meta { font-size: 10pt; letter-spacing: 0.04em; text-transform: uppercase; color: #71717a; font-weight: 500; margin-bottom: 6pt; }
|
|
h2.entry-title { font-size: 28pt; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 10pt; color: #0a0a0f; }
|
|
.entry-story { font-size: 11pt; line-height: 1.65; color: #3f3f46; }
|
|
.entry-story p { margin: 0 0 8pt; }
|
|
.entry-story strong { font-weight: 600; color: #0a0a0f; }
|
|
.entry-story em { font-style: italic; }
|
|
.entry-story blockquote { margin: 12pt 0; padding-left: 12pt; border-left: 2pt solid #d4d4d8; font-style: italic; color: #52525b; }
|
|
.entry-story ul, .entry-story ol { margin: 8pt 0; padding-left: 16pt; }
|
|
.entry-story li { margin-bottom: 4pt; }
|
|
.entry-story a { color: #2563eb; text-decoration: none; }
|
|
|
|
/* Verdict */
|
|
.verdict-wrap { break-inside: avoid; padding-top: 14pt; }
|
|
.verdict-row { display: flex; gap: 10pt; }
|
|
.verdict-card { flex: 1; padding: 10pt 12pt; border-radius: 6pt; font-size: 9.5pt; }
|
|
.verdict-card.pros { background: #f0fdf4; border: 0.5pt solid #bbf7d0; }
|
|
.verdict-card.cons { background: #fef2f2; border: 0.5pt solid #fecaca; }
|
|
.verdict-label { font-size: 8pt; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6pt; }
|
|
.verdict-card.pros .verdict-label { color: #15803d; }
|
|
.verdict-card.cons .verdict-label { color: #b91c1c; }
|
|
.verdict-card ul { margin: 0; padding: 0; list-style: none; }
|
|
.verdict-card li { padding: 2pt 0; position: relative; padding-left: 10pt; }
|
|
.verdict-card li::before { content: '•'; position: absolute; left: 0; }
|
|
.verdict-card.pros li { color: #14532d; }
|
|
.verdict-card.pros li::before { color: #22c55e; }
|
|
.verdict-card.cons li { color: #7f1d1d; }
|
|
.verdict-card.cons li::before { color: #ef4444; }
|
|
|
|
/* ── Closing ─── */
|
|
.closing-page {
|
|
width: 100%; height: 100vh; display: flex; align-items: center; justify-content: center;
|
|
background: #0a0a0f; color: white; text-align: center; page-break-after: auto;
|
|
}
|
|
.closing-title { font-size: 32pt; font-weight: 300; letter-spacing: -1pt; opacity: 0.6; margin-bottom: 8pt; }
|
|
.closing-sub { font-size: 10pt; opacity: 0.25; letter-spacing: 3pt; text-transform: uppercase; }
|
|
|
|
/* ── Print ─── */
|
|
@media print {
|
|
.print-bar { display: none !important; }
|
|
body { margin: 0; }
|
|
.entry-page { orphans: 3; widows: 3; }
|
|
h2.entry-title { page-break-after: avoid; }
|
|
.verdict-row { page-break-inside: avoid; }
|
|
.entry-photo-single, .entry-photo-duo, .entry-photo-trio { page-break-after: avoid; }
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Page 1: Cover -->
|
|
<div class="cover-page">
|
|
${i?`<div class="cover-bg" style="background-image:url('${i}')"></div>`:""}
|
|
<div class="cover-dim"></div>
|
|
<div class="cover-mesh"></div>
|
|
<div class="cover-content">
|
|
<div class="cover-label">Journey Book</div>
|
|
<h1>${T(t.title)}</h1>
|
|
${t.subtitle?`<div class="sub">${T(t.subtitle)}</div>`:""}
|
|
<div class="cover-stats">
|
|
<div><div class="cover-stat-val">${l.length}</div><div class="cover-stat-label">Days</div></div>
|
|
<div><div class="cover-stat-val">${e.length}</div><div class="cover-stat-label">Entries</div></div>
|
|
<div><div class="cover-stat-val">${r.length}</div><div class="cover-stat-label">Photos</div></div>
|
|
</div>
|
|
</div>
|
|
<div class="cover-footer">Made with TREK</div>
|
|
</div>
|
|
|
|
<!-- Entry Pages -->
|
|
${a.join(`
|
|
`)}
|
|
|
|
<!-- Closing Page -->
|
|
<div class="closing-page">
|
|
<div>
|
|
<div class="closing-title">The End</div>
|
|
<div class="closing-sub">Made with TREK · ${new Date().getFullYear()}</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>`,c=document.createElement("div");c.id="journey-pdf-overlay",c.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,0.75);z-index:9999;display:flex;align-items:center;justify-content:center;padding:8px;",c.onclick=p=>{p.target===c&&c.remove()};const u=document.createElement("div");u.style.cssText="width:100%;max-width:1100px;height:95vh;background:#fff;border-radius:12px;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,0.35);";const d=document.createElement("div");d.style.cssText="display:flex;align-items:center;justify-content:space-between;padding:8px 16px;border-bottom:1px solid #e4e4e7;flex-shrink:0;background:#0f172a;",d.innerHTML=`
|
|
<span style="font-size:12px;color:rgba(255,255,255,0.45);font-weight:500;letter-spacing:0.03em">${T(t.title)} · ${s} pages</span>
|
|
<div style="display:flex;align-items:center;gap:8px">
|
|
<button id="journey-pdf-save" style="min-height:44px;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;font-family:inherit;border:none;background:#fff;color:#0f172a;">Save as PDF</button>
|
|
<button id="journey-pdf-close" style="min-height:44px;padding:10px 16px;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;font-family:inherit;border:1px solid rgba(255,255,255,0.15);background:rgba(255,255,255,0.1);color:rgba(255,255,255,0.7);">Close</button>
|
|
</div>
|
|
`;const b=document.createElement("iframe");b.style.cssText="flex:1;width:100%;border:none;",b.sandbox="allow-same-origin allow-modals allow-scripts",b.srcdoc=h,u.appendChild(d),u.appendChild(b),c.appendChild(u),document.body.appendChild(c),d.querySelector("#journey-pdf-close").onclick=()=>c.remove(),d.querySelector("#journey-pdf-save").onclick=()=>{var p;(p=b.contentWindow)==null||p.print()}}export{yt as downloadJourneyBookPDF};
|