1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5565],{95565:function(t,e,o){o.d(e,{createQuizReportPdf:function(){return r}});var a=o(78713);async function r(t,e,r){let[{PDFDocument:n,rgb:i},c]=await Promise.all([o.e(6730).then(o.bind(o,36730)),Promise.all([o.e(1917),o.e(3604)]).then(o.bind(o,19285))]),l=c.default,s=/[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af]/u.test(JSON.stringify(t)),[h,d]=await Promise.all([e?Promise.resolve(e):fetch(s?"/kylian/fonts/NotoSansCJKsc-Regular.otf":"/kylian/fonts/NotoSans-Regular.ttf").then(async t=>{if(!t.ok)throw Error("PDF font unavailable");return new Uint8Array(await t.arrayBuffer())}),r?Promise.resolve(r):fetch("/kylian/logo-pdf.png").then(async t=>{if(!t.ok)throw Error("PDF logo unavailable");return new Uint8Array(await t.arrayBuffer())})]),f=await n.create();f.registerFontkit(l);let u=await f.embedFont(h,{subset:!1}),w=await f.embedPng(d),g=new Set(u.getCharacterSet()),p=t=>[...t.normalize("NFC").replace(/[ââ]/g,"'")].map(t=>"\n"===t||"\r"===t?t:g.has(t.codePointAt(0)||0)?t:"?").join(""),y=t=>p(t).replace(/\r\n?/g,"\n").split("\n").flatMap((t,e)=>e?["\n",...t.match(/\s+|\S+/gu)||[]]:t.match(/\s+|\S+/gu)||[]),x=(t,e,o)=>{let a=[],r="";for(let n of y(t)){if("\n"===n){a.push(r.trim()),r="";continue}let t=r+n;if(u.widthOfTextAtSize(t,e)<=o){r=t;continue}if(r.trim()&&(a.push(r.trim()),r=""),u.widthOfTextAtSize(n,e)<=o){r=n.trimStart();continue}for(let t of n)u.widthOfTextAtSize(r+t,e)>o&&r&&(a.push(r.trim()),r=""),r+=t}return r.trim()&&a.push(r.trim()),a.length?a:[""]},m=a.H[t.locale],S=i(.08,.12,.19),v=i(.34,.4,.43),T=i(.04,.25,.15),b=i(.38,.32,.62),k=[],C=f.addPage([595.28,841.89]);k.push(C);let P=664.89,z=()=>{C=f.addPage([595.28,841.89]),k.push(C),P=778.89},A=t=>{P-t<65&&z()},E=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10.5,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:S,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5,n=1.43*e;for(let r of x(t,e,503.28-a))A(n),C.drawText(r,{x:46+a,y:P,size:e,font:u,color:o}),P-=n;P-=r};return f.setTitle("".concat(m.reportTitle," - ").concat(t.title)),f.setAuthor("Kylian"),f.setSubject(m.reportTitle),C.drawRectangle({x:0,y:697.89,width:595.28,height:144,color:i(.95,.94,1)}),C.drawRectangle({x:0,y:829.89,width:595.28,height:12,color:T}),C.drawImage(w,{x:46,y:752.89,width:127,height:45.3}),C.drawText(p(m.reportTitle),{x:46,y:723.89,size:10,font:u,color:b}),E(t.title,22,S,0,17),A(106),C.drawRectangle({x:46,y:P-82,width:503.28,height:88,color:i(.91,.96,.92),borderColor:i(.69,.83,.72),borderWidth:.7}),C.drawRectangle({x:46,y:P-82,width:5,height:88,color:T}),C.drawText(p(m.score),{x:63,y:P-22,size:10,font:u,color:T}),C.drawText("".concat(t.score," / ").concat(t.questions.length),{x:63,y:P-63,size:31,font:u,color:T}),P-=102,t.estimatedLevel&&(E("".concat(m.estimatedLevel,": ").concat(t.estimatedLevel),11,T,0,2),E(m.provisional,9,v,0,8)),P-=12,t.questions.forEach((e,o)=>{A(130),C.drawLine({start:{x:46,y:P+11},end:{x:549.28,y:P+11},thickness:.8,color:i(.82,.8,.9)}),E("".concat(m.question," ").concat(o+1),10,b,0,4),E(e.prompt,13,S,0,7),e.options.forEach((t,o)=>{let a=String.fromCharCode(65+o);E("".concat(a,". ").concat(t),10.5,o===e.answer?T:v,12,2)}),P-=5;let a=t.answers[o];E("".concat(m.yourAnswer,": ").concat(void 0===a?m.unanswered:"".concat(String.fromCharCode(65+a),". ").concat(e.options[a])),10,a===e.answer?T:i(.55,.24,.16),0,3),E("".concat(m.correctAnswer,": ").concat(String.fromCharCode(65+e.answer),". ").concat(e.options[e.answer]),10,T,0,3),E("".concat(m.explanation,": ").concat(e.explanation),10,v,0,16)}),k.forEach((t,e)=>{t.drawLine({start:{x:46,y:43},end:{x:549.28,y:43},thickness:.6,color:i(.82,.85,.83)}),t.drawText("Kylian",{x:46,y:27,size:8,font:u,color:v});let o="".concat(e+1," / ").concat(k.length);t.drawText(o,{x:549.28-u.widthOfTextAtSize(o,8),y:27,size:8,font:u,color:v})}),f.save()}}}]);
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.