survey-pdf 2.5.21 → 2.5.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/survey.pdf.min.js CHANGED
@@ -44,4 +44,4 @@
44
44
  * @license
45
45
  *
46
46
  * ====================================================================
47
- */(function(o){var i,t,e,r,n,a,s,u,l,f,d,b,x,P,S,O,et,K,V,X;i=(function(){return function(w){return W.prototype=w,new W};function W(){}})(),f=function(w){var g,C,v,B,E,I,M;for(C=0,v=w.length,g=void 0,B=!1,I=!1;!B&&C!==v;)g=w[C]=w[C].trimLeft(),g&&(B=!0),C++;for(C=v-1;v&&!I&&C!==-1;)g=w[C]=w[C].trimRight(),g&&(I=!0),C--;for(E=/\s+$/g,M=!0,C=0;C!==v;)w[C]!="\u2028"&&(g=w[C].replace(/\s+/g," "),M&&(g=g.trimLeft()),g&&(M=E.test(g)),w[C]=g),C++;return w},d=function(w,g,C,v){return this.pdf=w,this.x=g,this.y=C,this.settings=v,this.watchFunctions=[],this.init(),this},b=function(w){var g,C,v;for(g=void 0,v=w.split(","),C=v.shift();!g&&C;)g=e[C.trim().toLowerCase()],C=v.shift();return g},x=function(w){w=w==="auto"?"0px":w,w.indexOf("em")>-1&&!isNaN(Number(w.replace("em","")))&&(w=Number(w.replace("em",""))*18.719+"px"),w.indexOf("pt")>-1&&!isNaN(Number(w.replace("pt","")))&&(w=Number(w.replace("pt",""))*1.333+"px");var g,C,v;return C=void 0,g=16,v=P[w],v||(v={"xx-small":9,"x-small":11,small:13,medium:16,large:19,"x-large":23,"xx-large":28,auto:0}[w],v!==C||(v=parseFloat(w))?P[w]=v/g:(v=w.match(/([\d\.]+)(px)/),Array.isArray(v)&&v.length===3?P[w]=parseFloat(v[1])/g:P[w]=1))},l=function(w){var g,C,v;return v=(function(B){var E;return E=(function(I){return document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(I,null):I.currentStyle?I.currentStyle:I.style})(B),function(I){return I=I.replace(/-\D/g,function(M){return M.charAt(1).toUpperCase()}),E[I]}})(w),g={},C=void 0,g["font-family"]=b(v("font-family"))||"times",g["font-style"]=r[v("font-style")]||"normal",g["text-align"]=n[v("text-align")]||"left",C=a[v("font-weight")]||"normal",C==="bold"&&(g["font-style"]==="normal"?g["font-style"]=C:g["font-style"]=C+g["font-style"]),g["font-size"]=x(v("font-size"))||1,g["line-height"]=x(v("line-height"))||1,g.display=v("display")==="inline"?"inline":"block",C=g.display==="block",g["margin-top"]=C&&x(v("margin-top"))||0,g["margin-bottom"]=C&&x(v("margin-bottom"))||0,g["padding-top"]=C&&x(v("padding-top"))||0,g["padding-bottom"]=C&&x(v("padding-bottom"))||0,g["margin-left"]=C&&x(v("margin-left"))||0,g["margin-right"]=C&&x(v("margin-right"))||0,g["padding-left"]=C&&x(v("padding-left"))||0,g["padding-right"]=C&&x(v("padding-right"))||0,g["page-break-before"]=v("page-break-before")||"auto",g.float=s[v("cssFloat")]||"none",g.clear=u[v("clear")]||"none",g.color=v("color"),g},S=function(w,g,C){var v,B,E,I,M;if(E=!1,B=void 0,I=void 0,v=C["#"+w.id],v)if(typeof v=="function")E=v(w,g);else for(B=0,I=v.length;!E&&B!==I;)E=v[B](w,g),B++;if(v=C[w.nodeName],!E&&v)if(typeof v=="function")E=v(w,g);else for(B=0,I=v.length;!E&&B!==I;)E=v[B](w,g),B++;for(M=typeof w.className=="string"?w.className.split(" "):[],B=0;B<M.length;B++)if(v=C["."+M[B]],!E&&v)if(typeof v=="function")E=v(w,g);else for(B=0,I=v.length;!E&&B!==I;)E=v[B](w,g),B++;return E},X=function(w,g){var C,v,B,E,I,M,U,q,G;C=[],v=[],B=0,G=0;for(var E=0;E<w.rows[0].cells.length;E++)G+=w.rows[0].cells[E].colSpan;for(U=w.clientWidth;B<G;){q=w.rows[0].cells[B];for(var E=0;E<q.colSpan;E++)v[B+E]={name:q.textContent.toLowerCase().replace(/\s+/g,"")+"_"+E,prompt:q.textContent.replace(/\r?\n/g,""),width:q.clientWidth/U*g.settings.width/q.colSpan};B+=E}for(B=1;B<w.rows.length;){for(M=w.rows[B],I={},E=0;E<M.cells.length;)I[v[E].name]=M.cells[E].textContent.replace(/\r?\n/g,""),E++;C.push(I),B++}return{rows:C,headers:v}};var bt={SCRIPT:1,STYLE:1,NOSCRIPT:1,OBJECT:1,EMBED:1,SELECT:1},Ot=1;t=function(w,g,C){var v,B,E,I,M,U,q,G;for(B=w.childNodes,v=void 0,E=l(w),M=E.display==="block",M&&(g.setBlockBoundary(),g.setBlockStyle(E)),I=0,U=B.length;I<U;){if(v=B[I],typeof v=="object"){if(g.executeWatchFunctions(v),v.nodeType===1&&v.nodeName==="HEADER"){var Y=v,$=g.pdf.margins_doc.top;g.pdf.internal.events.subscribe("addPage",function(yt){g.y=$,t(Y,g,C),g.pdf.margins_doc.top=g.y+10,g.y+=10},!1)}if(v.nodeType===8&&v.nodeName==="#comment")~v.textContent.indexOf("ADD_PAGE")&&(g.pdf.addPage(),g.y=g.pdf.margins_doc.top);else if(v.nodeType===1&&!bt[v.nodeName]){var k;if(v.nodeName==="IMG"){var j=v.getAttribute("src");k=O[g.pdf.sHashCode&&g.pdf.sHashCode(j)||j]}if(k){g.pdf.internal.pageSize.getHeight()-g.pdf.margins_doc.bottom<g.y+v.height&&g.y>g.pdf.margins_doc.top&&(g.pdf.addPage(),g.y=g.pdf.margins_doc.top,g.executeWatchFunctions(v));var z=l(v),it=g.x,at=12/g.pdf.internal.scaleFactor,st=(z["margin-left"]+z["padding-left"])*at,ct=(z["margin-right"]+z["padding-right"])*at,ft=(z["margin-top"]+z["padding-top"])*at,gt=(z["margin-bottom"]+z["padding-bottom"])*at;z.float!==void 0&&z.float==="right"?it+=g.settings.width-v.width-ct:it+=st,g.pdf.addImage(k,it,g.y+ft,v.width,v.height),k=void 0,z.float==="right"||z.float==="left"?(g.watchFunctions.push(function(yt,L,Ft,c){return g.y>=L?(g.x+=yt,g.settings.width+=Ft,!0):c&&c.nodeType===1&&!bt[c.nodeName]&&g.x+c.width>g.pdf.margins_doc.left+g.pdf.margins_doc.width?(g.x+=yt,g.y=L,g.settings.width+=Ft,!0):!1}.bind(this,z.float==="left"?-v.width-st-ct:0,g.y+v.height+ft+gt,v.width)),g.watchFunctions.push(function(yt,L,Ft){return g.y<yt&&L===g.pdf.internal.getNumberOfPages()?Ft.nodeType===1&&l(Ft).clear==="both"?(g.y=yt,!0):!1:!0}.bind(this,g.y+v.height,g.pdf.internal.getNumberOfPages())),g.settings.width-=v.width+st+ct,z.float==="left"&&(g.x+=v.width+st+ct)):g.y+=v.height+ft+gt}else if(v.nodeName==="TABLE")g.pdf.autoTable?(g.y+=10,g.pdf.autoTable({theme:"grid",html:v,startY:g.y,styles:{font:g.pdf.getFont().fontName,fontSize:g.pdf.getFontSize(),textColor:g.pdf.getTextColor()},margin:{top:g.pdf.margins_doc.top,left:g.x,right:g.pdf.internal.pageSize.getWidth()-(g.x+g.settings.width),bottom:g.pdf.margins_doc.bottom}}),g.y=g.pdf.lastAutoTable.finalY):(q=X(v,g),g.y+=10,g.pdf.table(g.x,g.y,q.rows,q.headers,{autoSize:!1,printHeaders:C.printHeaders,margins:g.pdf.margins_doc,css:l(v)}),g.y=g.pdf.internal.__cell__.lastCell.y+g.pdf.internal.__cell__.lastCell.height);else if(v.nodeName==="OL"||v.nodeName==="UL")Ot=1,S(v,g,C)||t(v,g,C),g.y+=10;else if(v.nodeName==="LI"){var rt=g.x;g.x+=20/g.pdf.internal.scaleFactor,g.y+=3,S(v,g,C)||t(v,g,C),g.x=rt}else v.nodeName==="BR"?(g.y+=E["font-size"]*g.pdf.internal.scaleFactor,g.addText("\u2028",i(E))):S(v,g,C)||t(v,g,C)}else if(v.nodeType===3){var Bt=v.nodeValue;if(v.nodeValue&&v.parentNode.nodeName==="LI")if(v.parentNode.parentNode.nodeName==="OL")Bt=Ot+++". "+Bt;else{var xt=E["font-size"],qt=(3-xt*.75)*g.pdf.internal.scaleFactor,kt=xt*.75*g.pdf.internal.scaleFactor,Rt=xt*1.74/g.pdf.internal.scaleFactor;G=function(L,Ft){this.pdf.circle(L+qt,Ft+kt,Rt,"FD")}}v.ownerDocument.body.compareDocumentPosition(v)&16&&g.addText(Bt,E)}else typeof v=="string"&&g.addText(v,E)}I++}if(C.outY=g.y,M)return g.setBlockBoundary(G)},O={},et=function(w,g,C,v){var B=w.getElementsByTagName("img"),E=B.length,I,M=0;function U(){g.pdf.internal.events.publish("imagesLoaded"),v(I)}function q(G,Y,$){if(G){var k=new Image;I=++M,k.crossOrigin="",k.onerror=k.onload=function(){if(k.complete&&(k.src.indexOf("data:image/")===0&&(k.width=Y||k.width||0,k.height=$||k.height||0),k.width+k.height)){var j=g.pdf.sHashCode&&g.pdf.sHashCode(G)||G;O[j]=O[j]||k}--M||U()},k.src=G}}for(;E--;)q(B[E].getAttribute("src"),B[E].width,B[E].height);return M||U()},K=function(w,g,C){var v=w.getElementsByTagName("footer");if(v.length>0){v=v[0];var B=g.pdf.internal.write,E=g.y;g.pdf.internal.write=function(){},t(v,g,C);var I=Math.ceil(g.y-E)+5;g.y=E,g.pdf.internal.write=B,g.pdf.margins_doc.bottom+=I;for(var M=function(Y){var $=Y!==void 0?Y.pageNumber:1,k=g.y;g.y=g.pdf.internal.pageSize.getHeight()-g.pdf.margins_doc.bottom,g.pdf.margins_doc.bottom-=I;for(var j=v.getElementsByTagName("span"),z=0;z<j.length;++z)(" "+j[z].className+" ").replace(/[\n\t]/g," ").indexOf(" pageCounter ")>-1&&(j[z].innerHTML=$),(" "+j[z].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&(j[z].innerHTML="###jsPDFVarTotalPages###");t(v,g,C),g.pdf.margins_doc.bottom+=I,g.y=k},U=v.getElementsByTagName("span"),q=0;q<U.length;++q)(" "+U[q].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&g.pdf.internal.events.subscribe("htmlRenderingFinished",g.pdf.putTotalPages.bind(g.pdf,"###jsPDFVarTotalPages###"),!0);g.pdf.internal.events.subscribe("addPage",M,!1),M(),bt.FOOTER=1}},V=function(w,g,C,v,B,E){if(!g)return!1;typeof g!="string"&&!g.parentNode&&(g=""+g.innerHTML),typeof g=="string"&&(g=(function($){var k,j,z,it;return z="jsPDFhtmlText"+Date.now().toString()+(Math.random()*1e3).toFixed(0),it="position: absolute !important;clip: rect(1px 1px 1px 1px); /* IE6, IE7 */clip: rect(1px, 1px, 1px, 1px);padding:0 !important;border:0 !important;height: 1px !important;width: 1px !important; top:auto;left:-100px;overflow: hidden;",j=document.createElement("div"),j.className="sjs-pdf-hidden-html-div",j.style.cssText=it,j.innerHTML='<iframe style="height:1px;width:1px" name="'+z+'" />',document.body.appendChild(j),k=window.frames[z],k.document.open(),k.document.writeln($),k.document.close(),k.document.body})(g.replace(/<\/?script[^>]*?>/gi,"")));for(var I=Object.keys(w.getFontList()),M=0;M<I.length;++M){var U=I[M],q=U.toLowerCase();e[q]||(e[q]=U)}var G=new d(w,C,v,B),Y;return et.call(this,g,G,B.elementHandlers,function($){K(g,G,B.elementHandlers),t(g,G,B.elementHandlers),G.pdf.internal.events.publish("htmlRenderingFinished"),Y=G.dispose(),typeof E=="function"?E(Y):$&&console.error("jsPDF Warning: rendering issues? provide a callback to fromHTML!")}),Y||{x:G.x,y:G.y}},d.prototype.init=function(){return this.paragraph={text:[],style:[]},this.pdf.internal.write("q")},d.prototype.dispose=function(){return this.pdf.internal.write("Q"),{x:this.x,y:this.y,ready:!0}},d.prototype.executeWatchFunctions=function(W){var w=!1,g=[];if(this.watchFunctions.length>0){for(var C=0;C<this.watchFunctions.length;++C)this.watchFunctions[C](W)===!0?w=!0:g.push(this.watchFunctions[C]);this.watchFunctions=g}return w},d.prototype.splitFragmentsIntoLines=function(W,w){var g,C,v,B,E,I,M,U,q,G,Y,$,k;C=12,q=this.pdf.internal.scaleFactor,v=void 0,U=void 0,B=void 0,k=void 0,M=void 0,I=void 0,E=void 0,G=[],Y=[G],g=0,$=this.settings.width;const j=this.pdf.getFont().fontName,z=this.pdf.getFont().fontStyle;for(;W.length;)if(B=W.shift(),k=w.shift(),B)if(v=k["font-family"],U=k["font-style"],this.pdf.setFont(v,U),M={textIndent:g,fontSize:k["font-size"]*C},I=this.pdf.getStringUnitWidth(B,M)*M.fontSize/q,B=="\u2028")G=[],Y.push(G);else if(g+I>$){for(E=this.pdf.splitTextToSize(B,$,M),G.push([E.shift(),k]);E.length;)G=[[E.shift(),k]],Y.push(G);g=this.pdf.getStringUnitWidth(G[0][0],M)*M.fontSize/q}else G.push([B,k]),g+=I;if(k["text-align"]!==void 0&&(k["text-align"]==="center"||k["text-align"]==="right"||k["text-align"]==="justify"))for(var it=0;it<Y.length;++it){var at=this.pdf.getStringUnitWidth(Y[it][0][0],M)*M.fontSize/q;it>0&&(Y[it][0][1]=i(Y[it][0][1]));var st=$-at;if(k["text-align"]==="right")Y[it][0][1]["margin-left"]=st;else if(k["text-align"]==="center")Y[it][0][1]["margin-left"]=st/2;else if(k["text-align"]==="justify"){var ct=Y[it][0][0].split(" ").length-1;Y[it][0][1]["word-spacing"]=st/ct,it===Y.length-1&&(Y[it][0][1]["word-spacing"]=0)}}return this.pdf.setFont(j,z),Y},d.prototype.RenderTextFragment=function(W,w){var g,C,v;if(v=0,g=12,this.pdf.internal.pageSize.getHeight()-this.pdf.margins_doc.bottom<this.y+this.pdf.internal.getFontSize()){this.pdf.internal.write("ET","Q","Q");const U=this.pdf.getCurrentPageInfo().pageNumber;this.pdf.getNumberOfPages()===U?this.pdf.addPage():this.pdf.setPage(U+1),this.y=this.pdf.margins_doc.top,this.pdf.internal.write("q","q","BT",this.getPdfColor(w.color),this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td"),v=Math.max(v,w["line-height"],w["font-size"]),this.pdf.internal.write(0,(-1*g*v).toFixed(2),"Td")}C=this.pdf.internal.getFont(w["font-family"],w["font-style"]);var B=this.getPdfColor(w.color);B!==this.lastTextColor&&(this.pdf.internal.write(B),this.lastTextColor=B),w["word-spacing"]!==void 0&&w["word-spacing"]>0&&this.pdf.internal.write(w["word-spacing"].toFixed(2),"Tw");var E=function(U,q){for(var G=q.metadata.Unicode.widths,Y=["","0","00","000","0000"],$=[""],k=0,j=U.length,z;k<j;++k){if(z=q.metadata.characterToGlyph(U.charCodeAt(k)),q.metadata.glyIdsUsed.push(z),q.metadata.toUnicode[z]=U.charCodeAt(k),G.indexOf(z)==-1&&(G.push(z),G.push([parseInt(q.metadata.widthOfGlyph(z),10)])),z=="0")return $.join("");z=z.toString(16),$.push(Y[4-z.length],z)}return $.join("")},I=function(G,q){var G=G||"",Y="",$=0,k,j="",z=q.encoding;if(q.encoding!=="Identity-H")return G;for(j=G,$=0;$<j.length;$+=1)q.metadata.hasOwnProperty("cmap")&&(k=q.metadata.cmap.unicode.codeMap[j[$].charCodeAt(0)]),k||j[$].charCodeAt(0)<256&&q.metadata.hasOwnProperty("Unicode")?Y+=j[$]:Y+="";var it="";return parseInt(q.id.slice(1))<14||z==="WinAnsiEncoding"?it=this.pdf.internal.pdfEscape(Y,key).split("").map(function(at){return at.charCodeAt(0).toString(16)}).join(""):z==="Identity-H"&&(it=E(Y,q)),it},M="";C.encoding!=="Identity-H"?M="("+this.pdf.internal.pdfEscape(W)+")":M="<"+I(W,C)+">",this.pdf.internal.write("/"+C.id,(g*w["font-size"]).toFixed(2),"Tf",M+" Tj"),w["word-spacing"]!==void 0&&this.pdf.internal.write(0,"Tw")},d.prototype.getPdfColor=function(W){var w,g,C,v,B=/rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/,E=B.exec(W);if(E!=null)g=parseInt(E[1]),C=parseInt(E[2]),v=parseInt(E[3]);else{if(typeof W=="string"&&W.charAt(0)!="#"){var I=new RGBColor(W);I.ok?W=I.toHex():W="#000000"}g=W.substring(1,3),g=parseInt(g,16),C=W.substring(3,5),C=parseInt(C,16),v=W.substring(5,7),v=parseInt(v,16)}if(typeof g=="string"&&/^#[0-9A-Fa-f]{6}$/.test(g)){var M=parseInt(g.substr(1),16);g=M>>16&255,C=M>>8&255,v=M&255}var U=this.f3;return g===0&&C===0&&v===0||typeof C>"u"?w=U(g/255)+" g":w=[U(g/255),U(C/255),U(v/255),"rg"].join(" "),w},d.prototype.f3=function(W){return W.toFixed(3)},d.prototype.renderParagraph=function(W){var w,g,C,v,B,E,I,M,U,q,G,Y,$,k;if(v=f(this.paragraph.text),$=this.paragraph.style,w=this.paragraph.blockstyle,this.paragraph.priorblockstyle,this.paragraph={text:[],style:[],blockstyle:{},priorblockstyle:w},!!v.join("").trim()){M=this.splitFragmentsIntoLines(v,$),I=void 0,U=void 0,g=12,C=g/this.pdf.internal.scaleFactor,this.priorMarginBottom=this.priorMarginBottom||0,Y=(Math.max((w["margin-top"]||0)-this.priorMarginBottom,0)+(w["padding-top"]||0))*C,G=((w["margin-bottom"]||0)+(w["padding-bottom"]||0))*C,this.priorMarginBottom=w["margin-bottom"]||0,w["page-break-before"]==="always"&&(this.pdf.addPage(),this.y=0,Y=((w["margin-top"]||0)+(w["padding-top"]||0))*C),q=this.pdf.internal.write,B=void 0,E=void 0,this.y+=Y,q("q","BT 0 g",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td");for(var j=0;M.length;){for(I=M.shift(),U=0,B=0,E=I.length;B!==E;)I[B][0].trim()&&(U=Math.max(U,I[B][1]["line-height"],I[B][1]["font-size"]),k=I[B][1]["font-size"]*7),B++;var z=0,it=0;I[0][1]["margin-left"]!==void 0&&I[0][1]["margin-left"]>0&&(it=this.pdf.internal.getCoordinateString(I[0][1]["margin-left"]),z=it-j,j=it);var at=Math.max(w["margin-left"]||0,0)*C;for(q(z+at,(-1*g*U).toFixed(2),"Td"),B=0,E=I.length;B!==E;)I[B][0]&&this.RenderTextFragment(I[B][0],I[B][1]),B++;if(this.y+=U*C,this.executeWatchFunctions(I[0][1])&&M.length>0){var st=[],ct=[];M.forEach(function(ft){for(var gt=0,rt=ft.length;gt!==rt;)ft[gt][0]&&(st.push(ft[gt][0]+" "),ct.push(ft[gt][1])),++gt}),M=this.splitFragmentsIntoLines(f(st),ct),q("ET","Q"),q("q","BT 0 g",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td")}}return W&&typeof W=="function"&&W.call(this,this.x-9,this.y-k/2),q("ET","Q"),this.y+=G}},d.prototype.setBlockBoundary=function(W){return this.renderParagraph(W)},d.prototype.setBlockStyle=function(W){return this.paragraph.blockstyle=W},d.prototype.addText=function(W,w){return this.paragraph.text.push(W),this.paragraph.style.push(w)},e={helvetica:"helvetica","sans-serif":"helvetica","times new roman":"times",serif:"times",times:"times",monospace:"courier",courier:"courier"},a={100:"normal",200:"normal",300:"normal",400:"normal",500:"bold",600:"bold",700:"bold",800:"bold",900:"bold",normal:"normal",bold:"bold",bolder:"bold",lighter:"normal"},r={normal:"normal",italic:"italic",oblique:"italic"},n={left:"left",right:"right",center:"center",justify:"justify"},s={none:"none",right:"right",left:"left"},u={none:"none",both:"both"},P={normal:1},o.fromHTML=function(W,w,g,C,v,B){return this.margins_doc=B||{top:0,bottom:0},C||(C={}),C.elementHandlers||(C.elementHandlers={}),V(this,W,isNaN(w)?4:w,isNaN(g)?4:g,C,v)}})(Wt.jsPDF.API);var Xt=(function(){function o(i){var t=this;this._base64Normal=void 0,this._base64Bold=void 0,typeof i.orientation>"u"?typeof i.format>"u"||i.format[0]<i.format[1]?this._orientation="p":this._orientation="l":this._orientation=i.orientation,this._format=i.format||"a4",Array.isArray(this._format)&&(this._format=this._format.map(function(e){return e*o.MM_TO_PT})),this._fontSize=i.fontSize||o.FONT_SIZE,i.fontName?this._fontName=i.fontName:!o.SEGOE_BOLD&&!o.SEGOE_NORMAL?this._fontName=h.STANDARD_FONT:this._fontName="segoe",typeof i.fontName<"u"&&(typeof i.base64Normal<"u"||typeof i.base64Bold<"u")?(this._base64Normal=i.base64Normal||i.base64Bold,this._base64Bold=i.base64Bold||i.base64Normal):this.fontName==="segoe"&&(this._base64Normal=o.SEGOE_NORMAL,this._base64Bold=o.SEGOE_BOLD),this._margins=h.clone(i.margins),typeof this._margins>"u"&&(this._margins={}),typeof this._margins.top>"u"&&(this._margins.top=10),typeof this._margins.bot>"u"&&(this._margins.bot=10),typeof this._margins.left>"u"&&(this._margins.left=10),typeof this._margins.right>"u"&&(this._margins.right=10),Object.keys(this._margins).forEach(function(e){t._margins[e]=t._margins[e]*o.MM_TO_PT}),this._htmlRenderAs=i.htmlRenderAs||"auto",this._matrixRenderAs=i.matrixRenderAs||"auto",this._readonlyRenderAs=i.readonlyRenderAs||"auto",this._compress=i.compress||!1,this._applyImageFit=i.applyImageFit||!1,this._useLegacyBooleanRendering=i.useLegacyBooleanRendering||!1,this._isRTL=i.isRTL||!1,this._tagboxSelectedChoicesOnly=i.tagboxSelectedChoicesOnly||!1}return Object.defineProperty(o.prototype,"leftTopPoint",{get:function(){return{xLeft:this.margins.left,yTop:this.margins.top}},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontSize",{get:function(){return this._fontSize},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontName",{get:function(){return this._fontName},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"base64Normal",{get:function(){return this._base64Normal},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"base64Bold",{get:function(){return this._base64Bold},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"useCustomFontInHtml",{get:function(){return this._useCustomFontInHtml},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"margins",{get:function(){return this._margins},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"format",{get:function(){return this._format},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"orientation",{get:function(){return this._orientation},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"htmlRenderAs",{get:function(){return this._htmlRenderAs},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"matrixRenderAs",{get:function(){return this._matrixRenderAs},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"readonlyRenderAs",{get:function(){return this._readonlyRenderAs},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"compress",{get:function(){return this._compress},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"applyImageFit",{get:function(){return this._applyImageFit},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"useLegacyBooleanRendering",{get:function(){return this._useLegacyBooleanRendering},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"isRTL",{get:function(){return this._isRTL},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"tagboxSelectedChoicesOnly",{get:function(){return this._tagboxSelectedChoicesOnly},enumerable:!1,configurable:!0}),o.MM_TO_PT=72/25.4,o.FONT_SIZE=14,o})(),Lt=(function(o){H(i,o);function i(t){t===void 0&&(t={});var e=o.call(this,t)||this,r={orientation:e.orientation,unit:"pt",format:e.format,compress:e.compress};return e._doc=new Wt.jsPDF(r),typeof e.base64Normal<"u"&&!h.isFontExist(e,e.fontName)&&(i.addFont(e.fontName,e.base64Normal,"normal"),i.addFont(e.fontName,e.base64Bold,"bold"),e._doc=new Wt.jsPDF(r)),ri(e._doc),e._useCustomFontInHtml=t.useCustomFontInHtml&&h.isFontExist(e,e.fontName),e._helperDoc=new Wt.jsPDF(r),e._doc.setFont(e.fontName),e._helperDoc.setFont(e.fontName),e._doc.setFontSize(e.fontSize),e._helperDoc.setFontSize(e.fontSize),e._fontStyle="normal",e.marginsStack=[],e}return i.addFont=function(t,e,r){var n=i.customFonts[t];n||(n={},i.customFonts[t]=n),n[r]=e;var a=function(){var s=i.customFonts[t];if(s&&s[r]){var u="".concat(t,"-").concat(r,".ttf");this.addFileToVFS(u,s[r]),this.addFont(u,t,r)}};Wt.jsPDF.API.events.push(["addFonts",a])},Object.defineProperty(i.prototype,"doc",{get:function(){return this._doc},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"helperDoc",{get:function(){return this._helperDoc},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontName",{get:function(){return this._fontName},set:function(t){this._fontName=t,this._doc.setFont(t),this._helperDoc.setFont(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize=t,this._doc.setFontSize(t),this._helperDoc.setFontSize(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle=t,this._doc.setFont(this._fontName,t),this._helperDoc.setFont(this._fontName,t)},enumerable:!1,configurable:!0}),i.prototype.measureText=function(t,e,r){var n=this;t===void 0&&(t=1),e===void 0&&(e=this._fontStyle),r===void 0&&(r=this._fontSize);var a=this._helperDoc.getFontSize();this._helperDoc.setFontSize(r),this._helperDoc.setFont(this._fontName,e);var s=this._helperDoc.getLineHeight()/this._helperDoc.internal.scaleFactor,u=0;return typeof t=="number"?u=s*t:(t=typeof t=="string"?t:h.getLocString(t),u=t.split("").reduce(function(l,f){return l+n._helperDoc.getTextWidth(f)},0)),this._helperDoc.setFontSize(a),this._helperDoc.setFont(this._fontName,"normal"),{width:u,height:s}},Object.defineProperty(i.prototype,"unitWidth",{get:function(){return this.measureText().width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"unitHeight",{get:function(){return this.measureText().height},enumerable:!1,configurable:!0}),i.prototype.pushMargins=function(t,e){this.marginsStack.push({left:this.margins.left,right:this.margins.right}),typeof t<"u"&&(this.margins.left=t),typeof e<"u"&&(this.margins.right=e)},i.prototype.popMargins=function(){var t=this.marginsStack.pop();this.margins.left=t.left,this.margins.right=t.right},Object.defineProperty(i.prototype,"paperWidth",{get:function(){return this.doc.internal.pageSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"paperHeight",{get:function(){return this.doc.internal.pageSize.height},enumerable:!1,configurable:!0}),i.prototype.getNumberOfPages=function(){return this.doc.getNumberOfPages()},i.prototype.addPage=function(){this.doc.addPage()},i.prototype.getCurrentPageIndex=function(){return this.doc.getCurrentPageInfo().pageNumber-1},i.prototype.setPage=function(t){this.doc.setPage(t+1)},i.customFonts={},i})(Xt);function oi(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Et={},fe,qe;function ai(){return qe||(qe=1,fe=function(i,t,e,r){var n=e?e.call(r,i,t):void 0;if(n!==void 0)return!!n;if(i===t)return!0;if(typeof i!="object"||!i||typeof t!="object"||!t)return!1;var a=Object.keys(i),s=Object.keys(t);if(a.length!==s.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(t),l=0;l<a.length;l++){var f=a[l];if(!u(f))return!1;var d=i[f],b=t[f];if(n=e?e.call(r,d,b,f):void 0,n===!1||n===void 0&&d!==b)return!1}return!0}),fe}var ze;function si(){if(ze)return Et;ze=1,Object.defineProperty(Et,"__esModule",{value:!0});var o=ai();function i(s){return s===void 0?-1:s.height}var t=(function(){function s(u,l){this.intervalTree=u,this.records=[],this.height=0,this.key=l.low,this.max=l.high,this.records.push(l)}return s.prototype.getNodeHigh=function(){for(var u=this.records[0].high,l=1;l<this.records.length;l++)this.records[l].high>u&&(u=this.records[l].high);return u},s.prototype.updateHeight=function(){this.height=Math.max(i(this.left),i(this.right))+1},s.prototype.updateMaxOfParents=function(){if(this!==void 0){var u=this.getNodeHigh();this.left!==void 0&&this.right!==void 0?this.max=Math.max(Math.max(this.left.max,this.right.max),u):this.left!==void 0&&this.right===void 0?this.max=Math.max(this.left.max,u):this.left===void 0&&this.right!==void 0?this.max=Math.max(this.right.max,u):this.max=u,this.parent&&this.parent.updateMaxOfParents()}},s.prototype._updateMaxAfterRightRotate=function(){var u=this.parent,l=u.left,f=l.getNodeHigh();l.left===void 0&&l.right!==void 0?l.max=Math.max(f,l.right.max):l.left!==void 0&&l.right===void 0?l.max=Math.max(f,l.left.max):l.left===void 0&&l.right===void 0?l.max=f:l.max=Math.max(Math.max(l.left.max,l.right.max),f);var d=this.getNodeHigh();this.left===void 0&&this.right!==void 0?this.max=Math.max(d,this.right.max):this.left!==void 0&&this.right===void 0?this.max=Math.max(d,this.left.max):this.left===void 0&&this.right===void 0?this.max=d:this.max=Math.max(Math.max(this.left.max,this.right.max),d),u.max=Math.max(Math.max(u.left.max,u.right.max),u.getNodeHigh())},s.prototype._updateMaxAfterLeftRotate=function(){var u=this.parent,l=u.right,f=l.getNodeHigh();l.left===void 0&&l.right!==void 0?l.max=Math.max(f,l.right.max):l.left!==void 0&&l.right===void 0?l.max=Math.max(f,l.left.max):l.left===void 0&&l.right===void 0?l.max=f:l.max=Math.max(Math.max(l.left.max,l.right.max),f);var d=this.getNodeHigh();this.left===void 0&&this.right!==void 0?this.max=Math.max(d,this.right.max):this.left!==void 0&&this.right===void 0?this.max=Math.max(d,this.left.max):this.left===void 0&&this.right===void 0?this.max=d:this.max=Math.max(Math.max(this.left.max,this.right.max),d),u.max=Math.max(Math.max(u.left.max,l.max),u.getNodeHigh())},s.prototype._leftRotate=function(){var u=this.right;u.parent=this.parent,u.parent===void 0?this.intervalTree.root=u:u.parent.left===this?u.parent.left=u:u.parent.right===this&&(u.parent.right=u),this.right=u.left,this.right!==void 0&&(this.right.parent=this),u.left=this,this.parent=u,this.updateHeight(),u.updateHeight()},s.prototype._rightRotate=function(){var u=this.left;u.parent=this.parent,u.parent===void 0?this.intervalTree.root=u:u.parent.left===this?u.parent.left=u:u.parent.right===this&&(u.parent.right=u),this.left=u.right,this.left!==void 0&&(this.left.parent=this),u.right=this,this.parent=u,this.updateHeight(),u.updateHeight()},s.prototype._rebalance=function(){if(i(this.left)>=2+i(this.right)){var u=this.left;i(u.left)>=i(u.right)?(this._rightRotate(),this._updateMaxAfterRightRotate()):(u._leftRotate(),this._rightRotate(),this._updateMaxAfterRightRotate())}else if(i(this.right)>=2+i(this.left)){var l=this.right;i(l.right)>=i(l.left)?(this._leftRotate(),this._updateMaxAfterLeftRotate()):(l._rightRotate(),this._leftRotate(),this._updateMaxAfterLeftRotate())}},s.prototype.insert=function(u){u.low<this.key?this.left===void 0?(this.left=new s(this.intervalTree,u),this.left.parent=this):this.left.insert(u):this.right===void 0?(this.right=new s(this.intervalTree,u),this.right.parent=this):this.right.insert(u),this.max<u.high&&(this.max=u.high),this.updateHeight(),this._rebalance()},s.prototype._getOverlappingRecords=function(u,l,f){if(u.key<=f&&l<=u.getNodeHigh()){for(var d=[],b=0;b<u.records.length;b++)u.records[b].high>=l&&d.push(u.records[b]);return d}return[]},s.prototype.search=function(u,l){if(this===void 0)return[];var f=[],d=[],b=[];return u>this.max?[]:(this.left!==void 0&&this.left.max>=u&&(f=this.left.search(u,l)),d=this._getOverlappingRecords(this,u,l),l<this.key?f.concat(d):(this.right!==void 0&&(b=this.right.search(u,l)),f.concat(d,b)))},s.prototype.searchExisting=function(u){if(this!==void 0){if(this.key===u)return this;if(u<this.key){if(this.left!==void 0)return this.left.searchExisting(u)}else if(this.right!==void 0)return this.right.searchExisting(u)}},s.prototype._minValue=function(){return this.left===void 0?this:this.left._minValue()},s.prototype.remove=function(u){var l=this.parent;if(u.key<this.key)return this.left!==void 0?this.left.remove(u):void 0;if(u.key>this.key)return this.right!==void 0?this.right.remove(u):void 0;if(this.left!==void 0&&this.right!==void 0){var f=this.right._minValue();return this.key=f.key,this.records=f.records,this.right.remove(this)}else{if(l.left===this)return this.right!==void 0?(l.left=this.right,this.right.parent=l):(l.left=this.left,this.left!==void 0&&(this.left.parent=l)),l.updateMaxOfParents(),l.updateHeight(),l._rebalance(),this;if(l.right===this)return this.right!==void 0?(l.right=this.right,this.right.parent=l):(l.right=this.left,this.left!==void 0&&(this.left.parent=l)),l.updateMaxOfParents(),l.updateHeight(),l._rebalance(),this}},s})();Et.Node=t;var e=(function(){function s(){this.count=0}return s.prototype.insert=function(u){if(u.low>u.high)throw new Error("`low` value must be lower or equal to `high` value");if(this.root===void 0)return this.root=new t(this,u),this.count++,!0;var l=this.root.searchExisting(u.low);if(l!==void 0){for(var f=0;f<l.records.length;f++)if(o(l.records[f],u))return!1;return l.records.push(u),u.high>l.max&&(l.max=u.high,l.parent&&l.parent.updateMaxOfParents()),this.count++,!0}else return this.root.insert(u),this.count++,!0},s.prototype.search=function(u,l){return this.root===void 0?[]:this.root.search(u,l)},s.prototype.remove=function(u){if(this.root===void 0)return!1;var l=this.root.searchExisting(u.low);if(l===void 0)return!1;if(l.records.length>1){for(var f=void 0,d=0;d<l.records.length;d++)if(o(l.records[d],u)){f=l.records[d],l.records.splice(d,1);break}if(f){if(f=void 0,u.high===l.max){var b=l.getNodeHigh();l.left!==void 0&&l.right!==void 0?l.max=Math.max(Math.max(l.left.max,l.right.max),b):l.left!==void 0&&l.right===void 0?l.max=Math.max(l.left.max,b):l.left===void 0&&l.right!==void 0?l.max=Math.max(l.right.max,b):l.max=b,l.parent&&l.parent.updateMaxOfParents()}return this.count--,!0}else return!1}else if(l.records.length===1)if(o(l.records[0],u))if(this.root.key===l.key){var x=new t(this,{low:u.low,high:u.low});x.left=this.root,this.root.parent=x;var P=this.root.remove(l);return this.root=x.left,this.root!==void 0&&(this.root.parent=void 0),P?(P=void 0,this.count--,!0):!1}else{var P=this.root.remove(l);return P?(P=void 0,this.count--,!0):!1}else return!1;else return!1},s.prototype.inOrder=function(){return new n(this.root)},s.prototype.preOrder=function(){return new a(this.root)},s})();Et.IntervalTree=e;var r=(function(){function s(){this.tree=new e}return s.prototype.insert=function(u,l,f){return this.tree.insert({low:u,high:l,data:f})},s.prototype.remove=function(u,l,f){return this.tree.remove({low:u,high:l,data:f})},s.prototype.search=function(u,l){return this.tree.search(u,l).map(function(f){return f.data})},s.prototype.inOrder=function(){return this.tree.inOrder()},s.prototype.preOrder=function(){return this.tree.preOrder()},Object.defineProperty(s.prototype,"count",{get:function(){return this.tree.count},enumerable:!0,configurable:!0}),s})();Et.default=r;var n=(function(){function s(u){this.stack=[],u!==void 0&&this.push(u)}return s.prototype.next=function(){return this.currentNode===void 0?{done:!0,value:void 0}:this.i<this.currentNode.records.length?{done:!1,value:this.currentNode.records[this.i++]}:(this.currentNode.right!==void 0?this.push(this.currentNode.right):this.pop(),this.next())},s.prototype.push=function(u){for(this.currentNode=u,this.i=0;this.currentNode.left!==void 0;)this.stack.push(this.currentNode),this.currentNode=this.currentNode.left},s.prototype.pop=function(){this.currentNode=this.stack.pop(),this.i=0},s})();Et.InOrder=n,typeof Symbol=="function"&&(n.prototype[Symbol.iterator]=function(){return this});var a=(function(){function s(u){this.stack=[],this.i=0,this.currentNode=u}return s.prototype.next=function(){return this.currentNode===void 0?{done:!0,value:void 0}:this.i<this.currentNode.records.length?{done:!1,value:this.currentNode.records[this.i++]}:(this.currentNode.right!==void 0&&this.push(this.currentNode.right),this.currentNode.left!==void 0&&this.push(this.currentNode.left),this.pop(),this.next())},s.prototype.push=function(u){this.stack.push(u)},s.prototype.pop=function(){this.currentNode=this.stack.pop(),this.i=0},s})();return Et.PreOrder=a,typeof Symbol=="function"&&(a.prototype[Symbol.iterator]=function(){return this}),Et}var li=si(),ui=oi(li),de=(function(){function o(){}return o.findBotInterval=function(i,t,e,r){var n=i.search(t,e);return n.push({pageIndex:0,xLeft:r.margins.left,xRight:r.margins.left,yBot:r.margins.top,absBot:r.margins.top}),n.reduce(function(a,s){return Math.abs(s.xRight-t)<h.EPSILON||Math.abs(s.xLeft-e)<h.EPSILON||s.pageIndex<a.pageIndex?a:s.pageIndex>a.pageIndex||s.yBot>a.yBot?s:a},n[n.length-1])},o.addPack=function(i,t,e){for(var r=i.length;r<=t;r++)i.push([]);i[t].push(e)},o.pack=function(i,t){var e=t.paperHeight-t.margins.top-t.margins.bot,r=[];i.forEach(function(u){r.push([]),u.forEach(function(l){var f;l.height>e+h.EPSILON?(f=r[r.length-1]).push.apply(f,l.unfold()):r[r.length-1].push(l)})}),r.forEach(function(u){u.sort(function(l,f){return l.yTop<f.yTop?-1:l.yTop>f.yTop||l.xLeft>f.xLeft?1:l.xLeft<f.xLeft?-1:0})});var n=0,a=[],s=t.paperHeight-t.margins.bot;return r.forEach(function(u){var l=new ui,f=0;u.forEach(function(d){var b=o.findBotInterval(l,d.xLeft,d.xRight,t),x=b.pageIndex,P=b.yBot,S=b.absBot,O=d.height;d.yTop=P+d.yTop-S,(Math.abs(d.yTop-t.margins.top)>h.EPSILON&&d.yTop+O>s+h.EPSILON||d.isPageBreak)&&(d.yTop=t.margins.top,x++,f=Math.max(f,x)),l.insert(d.xLeft,d.xRight,{pageIndex:x,xLeft:d.xLeft,xRight:d.xRight,yBot:d.yTop+O,absBot:d.yBot}),d.yBot=d.yTop+O,o.addPack(a,n+x,d)}),n+=f+1}),a},o})();A.HorizontalAlign=void 0,(function(o){o.NotSet="notset",o.Left="left",o.Center="center",o.Right="right"})(A.HorizontalAlign||(A.HorizontalAlign={})),A.VerticalAlign=void 0,(function(o){o.NotSet="notset",o.Top="top",o.Middle="middle",o.Bottom="bottom"})(A.VerticalAlign||(A.VerticalAlign={}));var Zt=(function(){function o(i,t,e,r,n){this.packs=i,this.controller=t,this._rect=e,this._countPages=r,this._pageNumber=n}return Object.defineProperty(o.prototype,"pageCount",{get:function(){return this._countPages},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"countPages",{get:function(){return this._countPages},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"pageNumber",{get:function(){return this._pageNumber},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rect",{get:function(){return this._rect},enumerable:!1,configurable:!0}),o.prototype.alignRect=function(i,t){typeof i.margins>"u"?i.margins={left:0,right:0,top:0,bot:0}:(typeof i.margins.left>"u"&&(i.margins.left=0),typeof i.margins.right>"u"&&(i.margins.right=0),typeof i.margins.top>"u"&&(i.margins.top=0),typeof i.margins.bot>"u"&&(i.margins.bot=0)),typeof i.rect>"u"&&((typeof i.horizontalAlign>"u"||i.horizontalAlign===A.HorizontalAlign.NotSet)&&(i.horizontalAlign=A.HorizontalAlign.Center),(typeof i.verticalAlign>"u"||i.verticalAlign===A.VerticalAlign.NotSet)&&(i.verticalAlign=A.VerticalAlign.Middle));var e=h.clone(this.rect);if(typeof i.horizontalAlign<"u")switch(i.horizontalAlign){case A.HorizontalAlign.Left:e.xLeft=this.rect.xLeft+i.margins.left,e.xRight=Math.min(this.rect.xRight-i.margins.right,this.rect.xLeft+i.margins.left+t.width);break;case A.HorizontalAlign.Center:e.xLeft=Math.max(this.rect.xLeft+i.margins.left,(this.rect.xLeft+this.rect.xRight-t.width)/2),e.xRight=Math.min(this.rect.xRight-i.margins.right,(this.rect.xLeft+this.rect.xRight+t.width)/2);break;case A.HorizontalAlign.Right:e.xLeft=Math.max(this.rect.xLeft+i.margins.left,this.rect.xRight-i.margins.right-t.width),e.xRight=this.rect.xRight-i.margins.right;break}else e.xLeft=i.rect.xLeft||this.rect.xLeft,e.xRight=i.rect.xRight||this.rect.xRight;if(typeof i.verticalAlign<"u")switch(i.verticalAlign){case A.VerticalAlign.Top:e.yTop=this.rect.yTop+i.margins.top,e.yBot=Math.min(this.rect.yBot-i.margins.bot,this.rect.yTop+i.margins.top+t.height);break;case A.VerticalAlign.Middle:e.yTop=Math.max(this.rect.yTop+i.margins.top,(this.rect.yTop+this.rect.yBot-t.height)/2),e.yBot=Math.min(this.rect.yBot-i.margins.bot,(this.rect.yTop+this.rect.yBot+t.height)/2);break;case A.VerticalAlign.Bottom:e.yTop=Math.max(this.rect.yTop+i.margins.top,this.rect.yBot-i.margins.bot-t.height),e.yBot=this.rect.yBot-i.margins.bot;break}else e.yTop=i.rect.yTop||this.rect.yTop,e.yBot=i.rect.yBot||this.rect.yBot;return e},o.prototype.drawText=function(i){i=h.clone(i),typeof i.fontSize>"u"&&(i.fontSize=Xt.FONT_SIZE),typeof i.isBold>"u"&&(i.isBold=!1);var t=this.controller.measureText(i.text,i.isBold?"bold":"normal",i.fontSize),e=this.alignRect(i,t);i.isBold?this.packs.push(new jt(null,this.controller,e,i.text)):this.packs.push(new nt(null,this.controller,e,i.text)),this.packs[this.packs.length-1].fontSize=i.fontSize},o.prototype.drawImage=function(i){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){switch(a.label){case 0:return i=h.clone(i),typeof i.width>"u"&&(i.width=this.rect.xRight-this.rect.xLeft),typeof i.height>"u"&&(i.height=this.rect.yBot-this.rect.yTop),t={width:i.width,height:i.height},e=this.alignRect(i,t),this.controller.pushMargins(0,0),n=(r=this.packs).push,[4,h.createImageFlat(h.createPoint(e,!0,!0),null,this.controller,{link:i.base64,width:e.xRight-e.xLeft,height:e.yBot-e.yTop,objectFit:i.imageFit},!!i.imageFit||this.controller.applyImageFit)];case 1:return n.apply(r,[a.sent()]),this.controller.popMargins(),[2]}})})},o})(),At=(function(o){H(i,o);function i(){return o!==null&&o.apply(this,arguments)||this}return i.prototype.unshift=function(t){this.hasFunc(t)||(this.callbacks==null&&(this.callbacks=new Array),this.callbacks.unshift(t))},i.prototype.fire=function(t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:if(this.callbacks==null)return[2];r=0,n.label=1;case 1:return r<this.callbacks.length?[4,this.callbacks[r](t,e)]:[3,4];case 2:n.sent(),n.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},i})(tt.EventBase),pe=(function(){function o(){}return o.process_header_events=function(i,t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:i.haveCommercialLicense||i.onRenderHeader.add(function(a,s){s.drawText({text:"SurveyJS PDF | Please purchase a SurveyJS PDF developer license to use it in your app | https://surveyjs.io/Buy",fontSize:10})}),r=0,n.label=1;case 1:return r<e.length?[4,i.onRenderHeader.fire(i,new Zt(e[r],t,h.createHeaderRect(t),e.length,r+1))]:[3,5];case 2:return n.sent(),[4,i.onRenderFooter.fire(i,new Zt(e[r],t,h.createFooterRect(t),e.length,r+1))];case 3:n.sent(),n.label=4;case 4:return r++,[3,1];case 5:return[2]}})})},o})(),Ge=(function(o){H(i,o);function i(t,e){var r=o.call(this,t)||this;return r.onRenderHeader=new At,r.onRenderFooter=new At,r.onRenderQuestion=new At,r.onRenderPanel=new At,r.onRenderPage=new At,r.onDocControllerCreated=new tt.EventBase,r.onRenderCheckItemAcroform=new At,r.onRenderRadioGroupWrapAcroform=new At,r.onRenderRadioItemAcroform=new At,typeof e>"u"&&(e={}),r.questionsOnPageMode=="inputPerPage"&&(r.questionsOnPageMode="standard"),r.options=h.clone(e),r}return Object.defineProperty(i.prototype,"haveCommercialLicense",{get:function(){var t=Je.hasLicense;return!!t&&t(2)},set:function(t){console.error("As of v1.9.101, the haveCommercialLicense property is not supported. To activate your license, use the setLicenseKey(key) method as shown on the following page: https://surveyjs.io/remove-alert-banner")},enumerable:!1,configurable:!0}),i.prototype.getUpdatedCheckItemAcroformOptions=function(t){this.onRenderCheckItemAcroform.fire(this,t)},i.prototype.getUpdatedRadioGroupWrapOptions=function(t){this.onRenderRadioGroupWrapAcroform.fire(this,t)},i.prototype.getUpdatedRadioItemAcroformOptions=function(t){this.onRenderRadioItemAcroform.fire(this,t)},i.prototype.correctBricksPosition=function(t,e){t.isRTL&&e.forEach(function(r){r.forEach(function(n){n.translateX(function(a,s){var u=t.paperWidth-a-s;return{xLeft:a+u,xRight:s+u}})})})},i.prototype.renderSurvey=function(t){return F(this,void 0,void 0,function(){var e,r,n,a;return T(this,function(s){switch(s.label){case 0:return this.visiblePages.forEach(function(u){return u.onFirstRendering()}),[4,Dt.generateFlats(this,t)];case 1:return e=s.sent(),this.correctBricksPosition(t,e),r=de.pack(e,t),[4,pe.process_header_events(this,t,r)];case 2:s.sent(),n=0,s.label=3;case 3:if(!(n<r.length))return[3,8];a=0,s.label=4;case 4:return a<r[n].length?(t.getNumberOfPages()===n&&t.addPage(),t.setPage(n),[4,r[n][a].render()]):[3,7];case 5:s.sent(),s.label=6;case 6:return a++,[3,4];case 7:return n++,[3,3];case 8:return h.clear(),[2]}})})},i.prototype.save=function(){return F(this,arguments,void 0,function(t){var e,r,n=this;return t===void 0&&(t="survey_result.pdf"),T(this,function(a){switch(a.label){case 0:return i.currentlySaving?[3,2]:(e=new Lt(this.options),this.onDocControllerCreated.fire(this,{controller:e}),i.currentlySaving=!0,h.fixFont(e),[4,this.renderSurvey(e)]);case 1:return a.sent(),r=e.doc.save(t,{returnPromise:!0}),r.then(function(){i.currentlySaving=!1;var s=i.saveQueue.shift();s&&s()}),[2,r];case 2:i.saveQueue.push(function(){n.save(t)}),a.label=3;case 3:return[2]}})})},i.prototype.raw=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return e=new Lt(this.options),this.onDocControllerCreated.fire(this,{controller:e}),h.fixFont(e),[4,this.renderSurvey(e)];case 1:return r.sent(),[2,e.doc.output(t)]}})})},i.currentlySaving=!1,i.saveQueue=[],i})(tt.SurveyModel),It=(function(o){H(i,o);function i(t,e,r,n){var a=o.call(this,n.question,t,e)||this;return a.fieldName=r,a.context=n,a.question=a.context.question,a.textColor=a.formBorderColor,a}return i.prototype.getShouldRenderReadOnly=function(){return this.context.readOnly&&h.getReadonlyRenderAs(this.question,this.controller)!=="acroform"||this.controller.compress},i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){return t=new this.controller.doc.AcroFormCheckBox,e=h.formScale(this.controller,this),r={},r.maxFontSize=this.height*e*i.FONT_SIZE_SCALE,r.caption=i.CHECKMARK_READONLY_SYMBOL,r.textAlign="center",r.fieldName=this.fieldName,r.readOnly=this.context.readOnly,r.color=this.formBorderColor,r.value=this.context.checked?"On":!1,r.AS=this.context.checked?"/On":"/Off",r.context=this.context,r.Rect=h.createAcroformRect(h.scaleRect(this,e)),this.controller.doc.addField(t),(n=this.question.survey)===null||n===void 0||n.getUpdatedCheckItemAcroformOptions(r),t.maxFontSize=r.maxFontSize,t.caption=r.caption,t.textAlign=r.textAlign,t.fieldName=r.fieldName,t.readOnly=r.readOnly,t.color=r.color,t.value=r.value,t.AS=r.AS,t.Rect=r.Rect,h.renderFlatBorders(this.controller,this),[2]})})},i.prototype.renderReadOnly=function(){return F(this,void 0,void 0,function(){var t,e,r,n,a;return T(this,function(s){switch(s.label){case 0:return h.renderFlatBorders(this.controller,this),this.context.checked?(t=h.createPoint(this,!0,!0),e=this.controller.fontName,this.controller.fontName=i.CHECKMARK_READONLY_FONT,r=this.controller.fontSize,this.controller.fontSize=r*i.CHECKMARK_READONLY_FONT_SIZE_SCALE,n=this.controller.measureText(i.CHECKMARK_READONLY_SYMBOL),t.xLeft+=this.width/2-n.width/2,t.yTop+=this.height/2-n.height/2,[4,h.createTextFlat(t,this.question,this.controller,i.CHECKMARK_READONLY_SYMBOL,nt)]):[3,3];case 1:return a=s.sent(),a.unfold()[0].textColor=this.textColor,this.controller.fontSize=r,[4,a.render()];case 2:s.sent(),this.controller.fontName=e,s.label=3;case 3:return[2]}})})},i.FONT_SIZE_SCALE=.7,i.CHECKMARK_READONLY_SYMBOL="3",i.CHECKMARK_READONLY_FONT="zapfdingbats",i.CHECKMARK_READONLY_FONT_SIZE_SCALE=1-Math.E/10,i})(mt),ge=(function(o){H(i,o);function i(t,e,r){return o.call(this,e,r,t.id,{question:t,readOnly:t.isReadOnly,checked:t.booleanValue})||this}return i})(It),je=(function(){function o(i,t,e){this.name=i,this.controller=t,this.context=e}return o.prototype.addToPdf=function(i){var t;this._radioGroup=new this.controller.doc.AcroFormRadioButton;var e={};e.fieldName=this.name,e.readOnly=this.readOnly,e.color=i,e.context=this.context,(t=this.context.question.survey)===null||t===void 0||t.getUpdatedRadioGroupWrapOptions(e),this._radioGroup.fieldName=e.fieldName,this._radioGroup.readOnly=e.readOnly,this._radioGroup.color=e.color,this._radioGroup.value="",this.controller.doc.addField(this._radioGroup)},Object.defineProperty(o.prototype,"radioGroup",{get:function(){return this._radioGroup},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"readOnly",{get:function(){return this.context.readOnly},enumerable:!1,configurable:!0}),o})(),Jt=(function(o){H(i,o);function i(t,e,r,n){var a=o.call(this,r.question,t,e)||this;return a.context=r,a.radioGroupWrap=n,a.textColor=a.formBorderColor,a}return i.prototype.getShouldRenderReadOnly=function(){return this.radioGroupWrap.readOnly&&h.getReadonlyRenderAs(this.question,this.controller)!=="acroform"||this.controller.compress},i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){return this.context.index==0&&this.radioGroupWrap.addToPdf(this.formBorderColor),t={},t.fieldName=this.radioGroupWrap.name+"index"+this.context.index,e=h.formScale(this.controller,this),t.Rect=h.createAcroformRect(h.scaleRect(this,e)),t.color=this.formBorderColor,t.appearance=this.controller.doc.AcroForm.Appearance.RadioButton.Circle,t.radioGroup=this.radioGroupWrap.radioGroup,t.context=this.context,(n=this.context.question.survey)===null||n===void 0||n.getUpdatedRadioItemAcroformOptions(t),r=this.radioGroupWrap.radioGroup.createOption(t.fieldName),this.context.checked?(t.AS||(r.AS="/"+t.fieldName),this.radioGroupWrap.radioGroup.value||(this.radioGroupWrap.radioGroup.value=t.fieldName)):t.AS||(t.AS="/Off"),r.Rect=t.Rect,r.color=t.color,h.renderFlatBorders(this.controller,this),this.radioGroupWrap.radioGroup.setAppearance(t.appearance),[2]})})},i.prototype.renderReadOnly=function(){return F(this,void 0,void 0,function(){var t,e,r,n,a;return T(this,function(s){switch(s.label){case 0:return h.renderFlatBorders(this.controller,this),this.context.checked?(t=h.createPoint(this,!0,!0),e=this.controller.fontSize,r=this.controller.fontName,this.controller.fontName=i.RADIOMARKER_READONLY_FONT,this.controller.fontSize=e*i.RADIOMARKER_READONLY_FONT_SIZE_SCALE,n=this.controller.measureText(i.RADIOMARKER_READONLY_SYMBOL),t.xLeft+=this.width/2-n.width/2,t.yTop+=this.height/2-n.height/2,[4,h.createTextFlat(t,this.question,this.controller,i.RADIOMARKER_READONLY_SYMBOL,nt)]):[3,3];case 1:return a=s.sent(),a.unfold()[0].textColor=this.textColor,[4,a.render()];case 2:s.sent(),this.controller.fontSize=e,this.controller.fontName=r,s.label=3;case 3:return[2]}})})},i.RADIOMARKER_READONLY_SYMBOL="l",i.RADIOMARKER_READONLY_FONT="zapfdingbats",i.RADIOMARKER_READONLY_FONT_SIZE_SCALE=1-(2+Math.E)/10,i})(mt),$t=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateItemComment=function(t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=this.question.getCommentTextAreaModel(e),[4,h.createCommentFlat(t,this.question,this.controller,{fieldName:r.id,rows:h.OTHER_ROWS_COUNT,value:r.getTextValue(),shouldRenderBorders:tt.settings.readOnlyCommentRenderMode==="textarea",isReadOnly:this.question.isReadOnly,isMultiline:!0})];case 1:return[2,n.sent()]}})})},i.prototype.generateFlatComposite=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d,b,x;return T(this,function(P){switch(P.label){case 0:return n=new D,a=h.createRect(t,this.controller.unitWidth,this.controller.unitHeight),s=this.generateFlatItem(h.moveRect(h.scaleRect(a,h.SELECT_ITEM_FLAT_SCALE),t.xLeft),e,r),n.addBrick(s),u=h.clone(t),u.xLeft=s.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,e.locText.renderedHtml===null?[3,2]:(f=(l=n).addBrick,[4,h.createTextFlat(u,this.question,this.controller,e.locText,nt)]);case 1:f.apply(l,[P.sent()]),P.label=2;case 2:return e.isCommentShowing?(d=h.createPoint(n,!0,!1),d.yTop+=this.controller.unitHeight*h.GAP_BETWEEN_ROWS,x=(b=n).addBrick,[4,this.generateItemComment(d,e)]):[3,4];case 3:x.apply(b,[P.sent()]),P.label=4;case 4:return[2,n]}})})},i.prototype.getVisibleChoices=function(){return this.question.visibleChoices},i.prototype.getColCount=function(){return this.question.colCount},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a;return T(this,function(s){switch(s.label){case 0:return e=this.getColCount(),r=this.getVisibleChoices(),n=e,e!=0?[3,1]:(n=Math.floor(h.getPageAvailableWidth(this.controller)/this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width)||1,r.length<n&&(n=r.length),[3,3]);case 1:return e>1?(n=h.getColumnWidth(this.controller,e)<this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width?1:e,n!=e?[3,3]:[4,this.generateColumns(t)]):[3,3];case 2:return[2,s.sent()];case 3:return n!=1?[3,5]:[4,this.generateVerticallyItems(t,r)];case 4:return a=s.sent(),[3,7];case 5:return[4,this.generateHorisontallyItems(t,n)];case 6:a=s.sent(),s.label=7;case 7:return[2,a]}})})},i.prototype.generateRows=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u,l,f,d,b,x,P,S,O;return T(this,function(et){switch(et.label){case 0:r=this.getVisibleChoices(),n=h.clone(t),a=((O=e[0])!==null&&O!==void 0?O:[]).length,s=[],u=0,l=e,et.label=1;case 1:if(!(u<l.length))return[3,7];f=l[u],d=new D,b=0,et.label=2;case 2:return b<f.length?(x=f[b],this.controller.pushMargins(),h.setColumnMargins(this.controller,a,b),n.xLeft=this.controller.margins.left,[4,this.generateFlatComposite(n,x,r.indexOf(x))]):[3,5];case 3:P=et.sent(),d.addBrick(P),this.controller.popMargins(),et.label=4;case 4:return b++,[3,2];case 5:S=h.createRowlineFlat(h.createPoint(d),this.controller),n.yTop=S.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,s.push(d,S),et.label=6;case 6:return u++,[3,1];case 7:return[2,s]}})})},i.prototype.generateVerticallyItems=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s;return T(this,function(u){switch(u.label){case 0:r=h.clone(t),n=[],a=0,u.label=1;case 1:return a<e.length?[4,this.generateFlatComposite(r,e[a],a)]:[3,4];case 2:s=u.sent(),r.yTop=s.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,n.push(s),u.label=3;case 3:return a++,[3,1];case 4:return[2,n]}})})},i.prototype.generateColumns=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f;return T(this,function(d){switch(d.label){case 0:for(e=this.question.columns,r=e.reduce(function(b,x){return Math.max(b,x.length)},0),n=[],a=0;a<r;a++){for(s=[],u=0,l=e;u<l.length;u++)f=l[u],f[a]&&s.push(f[a]);n.push(s)}return[4,this.generateRows(t,n)];case 1:return[2,d.sent()]}})})},i.prototype.generateHorisontallyItems=function(t,e){return F(this,void 0,void 0,function(){var r,n;return T(this,function(a){switch(a.label){case 0:return r=[],n=this.getVisibleChoices(),n.forEach(function(s,u){var l=Math.floor(u/e),f=u%e;r[l]||(r[l]=[]),r[l][f]=s}),[4,this.generateRows(t,r)];case 1:return[2,a.sent()]}})})},i})(ot),Nt=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.isItemSelected=function(t,e){return typeof e>"u"?t===this.question.otherItem?this.question.isOtherSelected:t.value===this.question.value||typeof this.question.isItemSelected<"u"&&this.question.isItemSelected(t):e},i.prototype.generateFlatItem=function(t,e,r,n,a,s){s===void 0&&(s={}),r===0?(this.radioGroupWrap=new je(this.question.id+(typeof n>"u"?"":n),this.controller,vt({readOnly:this.question.isReadOnly,question:this.question},s)),this.question.pdfRadioGroupWrap=this.radioGroupWrap):typeof this.radioGroupWrap>"u"&&(this.radioGroupWrap=this.question.pdfRadioGroupWrap);var u=this.isItemSelected(e,a);return new Jt(this.controller,t,{question:this.question,index:r,checked:u,item:e},this.radioGroupWrap)},i})($t);Q.getInstance().register("radiogroup",Nt),Q.getInstance().register("buttongroup",Nt);var me=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:return e=new D,r=this.controller.unitHeight,n=new ge(this.question,this.controller,h.moveRect(h.scaleRect(h.createRect(t,r,r),h.SELECT_ITEM_FLAT_SCALE),t.xLeft)),e.addBrick(n),a=h.clone(t),a.xLeft=n.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,s=this.question.isIndeterminate?null:this.question.booleanValue?this.question.locLabelTrue:this.question.locLabelFalse,s!==null&&s.renderedHtml!==null?(l=(u=e).addBrick,[4,h.createTextFlat(a,this.question,this.controller,s,nt)]):[3,2];case 1:l.apply(u,[f.sent()]),f.label=2;case 2:return[2,[e]]}})})},i})(ot),hi=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.buildItems(),n}return i.prototype.buildItems=function(){var t=this.question,e=new tt.ItemValue(t.valueFalse!==void 0?t.valueFalse:!1),r=new tt.ItemValue(t.valueTrue!==void 0?t.valueTrue:!0);e.locOwner=t,e.setLocText(t.locLabelFalse),r.locOwner=t,r.setLocText(t.locLabelTrue),this.items=[e,r]},i.prototype.getVisibleChoices=function(){return this.items},i.prototype.getColCount=function(){return 0},i})(Nt);Q.getInstance().register("boolean",hi),Q.getInstance().register("boolean-checkbox",me);var ye=(function(o){H(i,o);function i(t,e,r,n,a){return o.call(this,e,r,t.id+"index"+a,{question:t,readOnly:t.isReadOnly||!n.isEnabled,item:n,checked:t.isItemSelected(n),index:a})||this}return i})(It),te=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatItem=function(t,e,r){return new ye(this.question,this.controller,t,e,r)},i})($t),ci=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.getVisibleChoices=function(){return this.controller.tagboxSelectedChoicesOnly?this.question.selectedChoices:o.prototype.getVisibleChoices.call(this)},i})(te);Q.getInstance().register("tagbox",ci),Q.getInstance().register("checkbox",te);var ve=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){return e=Q.getInstance().create(this.survey,this.question,this.controller,this.question.getType()),[2,e.generateFlatsContent(t)]})})},i})(ot);Q.getInstance().register("custom_model",ve);var be=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,h.createCommentFlat(t,this.question,this.controller,{rows:this.question.rows,isReadOnly:this.question.isReadOnly,isMultiline:!0,fieldName:this.question.id,placeholder:h.getLocString(this.question.locPlaceHolder),shouldRenderBorders:tt.settings.readOnlyCommentRenderMode==="textarea",value:this.question.value})];case 1:return[2,[e.sent()]]}})})},i})(ot);Q.getInstance().register("comment",be);var Fe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.controller=e,n.question=t,n}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r=this;return T(this,function(n){return t=new this.controller.doc.AcroFormComboBox,t.fieldName=this.question.id,t.Rect=h.createAcroformRect(h.scaleRect(this,h.formScale(this.controller,this))),t.edit=!1,t.color=this.textColor,e=[],this.question.showOptionsCaption&&e.push(this.getCorrectedText(this.question.optionsCaption)),this.question.visibleChoices.forEach(function(a){e.push(r.getCorrectedText(h.getLocString(a.locText)))}),t.setOptions(e),t.fontName=this.controller.fontName,t.fontSize=this.fontSize,t.readOnly=this.question.isReadOnly,t.isUnicode=h.isCustomFont(this.controller,t.fontName),t.V=this.getCorrectedText(this.question.readOnlyText||""),this.controller.doc.addField(t),h.renderFlatBorders(this.controller,this),[2]})})},i})(mt),Te=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateItemComment=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return e=this.question.getCommentTextAreaModel(this.question.selectedItem),[4,h.createCommentFlat(t,this.question,this.controller,{fieldName:e.id,rows:h.OTHER_ROWS_COUNT,value:e.getTextValue(),shouldRenderBorders:tt.settings.readOnlyCommentRenderMode==="textarea",isReadOnly:this.question.isReadOnly,isMultiline:!0})];case 1:return[2,r.sent()]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:return this.shouldRenderAsComment?[3,1]:(r=new Fe(this.question,this.controller,h.createTextFieldRect(t,this.controller)),[3,3]);case 1:return[4,h.createCommentFlat(t,this.question,this.controller,{fieldName:this.question.id,shouldRenderBorders:tt.settings.readOnlyTextRenderMode==="input",value:this.question.readOnlyText||"",isReadOnly:this.question.isReadOnly,placeholder:h.getLocString(this.question.locPlaceholder)})];case 2:r=l.sent(),l.label=3;case 3:return e=r,n=new D(e),this.question.isShowingChoiceComment?(a=h.createPoint(n),a.yTop+=this.controller.unitHeight*h.GAP_BETWEEN_ROWS,u=(s=n).addBrick,[4,this.generateItemComment(a)]):[3,5];case 4:u.apply(s,[l.sent()]),l.label=5;case 5:return[2,[n]]}})})},i})(ot);Q.getInstance().register("dropdown",Te);var xe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,h.createCommentFlat(t,this.question,this.controller,{value:this.question.displayValue,isReadOnly:!0,fieldName:this.question.id,shouldRenderBorders:tt.settings.readOnlyTextRenderMode==="input"})];case 1:return[2,[e.sent()]]}})})},i})(ot);Q.getInstance().register("expression",xe);var Re=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatItem=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:return n=D.bind,[4,h.createLinkFlat(t,this.question,this.controller,e.name===void 0?"image":e.name,typeof e.content=="string"?e.content:"")];case 1:return r=new(n.apply(D,[void 0,l.sent()])),h.canPreviewImage(this.question,e,e.content)?(a=h.createPoint(r),a.yTop+=this.controller.unitHeight*i.IMAGE_GAP_SCALE,u=(s=r).addBrick,[4,h.createImageFlat(a,this.question,this.controller,{link:e.content,width:e.imageSize.width,height:e.imageSize.height,objectFit:i.DEFAULT_IMAGE_FIT})]):[3,3];case 2:u.apply(s,[l.sent()]),l.label=3;case 3:return[2,r]}})})},i.prototype.addLine=function(t,e,r,n){r!==n.length-1&&(t[t.length-1].addBrick(h.createRowlineFlat(e,this.controller)),e.yTop+=h.EPSILON,t.push(new D))},i.prototype.getImagePreviewContentWidth=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){return[2,Math.max(t.imageSize.width,i.TEXT_MIN_SCALE*this.controller.unitWidth)]})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b,x,x;return T(this,function(P){switch(P.label){case 0:return e=this.question.showPreview?this.question.previewValue:this.question.value,!e||e.length===0?[4,h.createTextFlat(t,this.question,this.controller,this.question.noFileChosenCaption,nt)]:[3,2];case 1:return[2,[P.sent()]];case 2:r=[new D],n=h.clone(t),a=n.yTop,s=0,P.label=3;case 3:return s<e.length?(u=vt({},e[s]),l=h.canPreviewImage(this.question,u,u.content),l?(f=u,[4,h.getCorrectedImageSize(this.controller,{imageWidth:this.question.imageWidth,imageHeight:this.question.imageHeight,imageLink:e[s].content,defaultImageWidth:200,defaultImageHeight:150})]):[3,5]):[3,12];case 4:f.imageSize=P.sent(),P.label=5;case 5:return d=this.controller.paperWidth-this.controller.margins.right-n.xLeft,l?[4,this.getImagePreviewContentWidth(u)]:[3,8];case 6:return b=P.sent(),d<b&&(n.xLeft=t.xLeft,n.yTop=a,this.addLine(r,n,s,e)),this.controller.pushMargins(n.xLeft,this.controller.paperWidth-n.xLeft-b),[4,this.generateFlatItem(n,u)];case 7:return x=P.sent(),r[r.length-1].addBrick(x),n.xLeft+=x.width,a=Math.max(a,x.yBot),this.controller.popMargins(),[3,10];case 8:return d<this.controller.unitWidth&&(n.xLeft=t.xLeft,n.yTop=a,this.addLine(r,n,s,e)),[4,this.generateFlatItem(n,u)];case 9:x=P.sent(),r[r.length-1].addBrick(x),n.xLeft+=x.xRight-x.xLeft,a=Math.max(a,x.yBot),P.label=10;case 10:n.xLeft+=this.controller.unitWidth,P.label=11;case 11:return s++,[3,3];case 12:return[2,r]}})})},i.IMAGE_GAP_SCALE=.195,i.TEXT_MIN_SCALE=5,i.DEFAULT_IMAGE_FIT="contain",i})(ot);Q.getInstance().register("file",Re);var we=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n}return i.prototype.chooseRender=function(t){return/<[^>]*style[^<]*>/.test(t)||/<[^>]*table[^<]*>/.test(t)||/&\w+;/.test(t)?"image":"standard"},i.prototype.correctHtml=function(t){return i.correctHtmlRules.forEach(function(e){t=t.replace(e.searchRegExp,e.replaceString)}),t},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b;return T(this,function(x){switch(x.label){case 0:return e=this.question.renderAs,h.hasDocument?(e==="auto"&&(e=this.controller.htmlRenderAs),e==="auto"&&(e=this.chooseRender(h.getLocString(this.question.locHtml))),r=h.createHtmlContainerBlock(h.getLocString(this.question.locHtml),this.controller,e),e!=="image"?[3,3]:(n=h.getPageAvailableWidth(this.controller),[4,h.htmlToImage(r,n,this.controller)])):[2,[new Ht(h.createRect(t,0,0))]];case 1:return a=x.sent(),s=a.url,u=a.aspect,l=n/u,[4,h.createImageFlat(t,this.question,this.controller,{link:s,width:n,height:l})];case 2:return[2,[x.sent()]];case 3:return d=(f=h).splitHtmlRect,b=[this.controller],[4,h.createHTMLFlat(t,this.question,this.controller,this.correctHtml(r))];case 4:return[2,[d.apply(f,b.concat([x.sent()]))]]}})})},i.correctHtmlRules=[{searchRegExp:/(<\/?br\s*?\/?\s*?>\s*){2,}/g,replaceString:"<br>"}],i})(ot);tt.Serializer.removeProperty("html","renderAs"),tt.Serializer.addProperty("html",{name:"renderAs",default:"auto",visible:!1,choices:["auto","standard","image"]}),Q.getInstance().register("html",we);var Pe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.getCorrectImageSize=function(){return F(this,void 0,void 0,function(){return T(this,function(t){switch(t.label){case 0:return[4,h.getCorrectedImageSize(this.controller,{imageWidth:this.question.imageWidth,imageHeight:this.question.imageHeight,imageLink:this.question.imageLink})];case 1:return[2,t.sent()]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return[4,this.getCorrectImageSize()];case 1:return e=r.sent(),[4,h.createImageFlat(t,this.question,this.controller,{link:this.question.imageLink,width:e.width,height:e.height})];case 2:return[2,[r.sent()]]}})})},i})(ot);Q.getInstance().register("image",Pe);var Ce=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatItem=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return n=h.getPageAvailableWidth(this.controller),[4,h.createImageFlat(t,this.question,this.controller,{link:e.imageLink,width:n,height:n/h.IMAGEPICKER_RATIO,objectFit:this.question.imageFit})];case 1:return a=b.sent(),s=new D(a),u=h.createPoint(s),this.question.showLabel?[4,h.createTextFlat(u,this.question,this.controller,e.text||e.value,nt)]:[3,3];case 2:l=b.sent(),s.addBrick(l),u=h.createPoint(l),b.label=3;case 3:return f=this.controller.unitHeight,d=h.createRect(u,n,f),this.question.multiSelect?s.addBrick(new It(this.controller,d,this.question.id+"index"+r,{readOnly:this.question.isReadOnly||!e.isEnabled,question:this.question,item:e,checked:this.question.value.indexOf(e.value)!==-1,index:r})):s.addBrick(this.radio.generateFlatItem(d,e,r)),[2,s]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b,x,P;return T(this,function(S){switch(S.label){case 0:this.radio=this.question.multiSelect?null:new Nt(this.survey,this.question,this.controller),e=[new D],r=h.getImagePickerAvailableWidth(this.controller)/h.IMAGEPICKER_COUNT,n=~~(h.getPageAvailableWidth(this.controller)/r)||1,a=this.question.visibleChoices.length,n=n<=a?n:a,s=~~Math.ceil(a/n),u=h.clone(t),l=0,S.label=1;case 1:if(!(l<s))return[3,7];f=u.yTop,this.controller.pushMargins(),d=this.controller.margins.left,b=0,S.label=2;case 2:return b<n?(x=l*n+b,x==a?[3,5]:(this.controller.margins.left=d,this.controller.margins.right=this.controller.paperWidth-d-r,d=this.controller.paperWidth-this.controller.margins.right+this.controller.unitWidth,u.xLeft=this.controller.margins.left,[4,this.generateFlatItem(u,this.question.visibleChoices[x],x)])):[3,5];case 3:P=S.sent(),e[e.length-1].addBrick(P),f=Math.max(f,P.yBot),S.label=4;case 4:return b++,[3,2];case 5:this.controller.popMargins(),u.xLeft=t.xLeft,u.yTop=f,l!==s-1&&(e[e.length-1].addBrick(h.createRowlineFlat(u,this.controller)),u.yTop+=h.EPSILON,e.push(new D)),S.label=6;case 6:return l++,[3,1];case 7:return[2,e]}})})},i})(ot);Q.getInstance().register("imagepicker",Ce);var _e=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:e=[],r=h.clone(t),n=0,a=this.question.panels,l.label=1;case 1:return n<a.length?(s=a[n],[4,Dt.generateFlatsPanel(this.survey,this.controller,s,r)]):[3,4];case 2:u=l.sent(),u.length!==0&&(r.yTop=h.mergeRects.apply(h,u).yBot,r.yTop+=this.controller.unitHeight*i.GAP_BETWEEN_PANELS,e.push.apply(e,u)),l.label=3;case 3:return n++,[3,1];case 4:return[2,e]}})})},i.GAP_BETWEEN_PANELS=.75,i})(ot);Q.getInstance().register("paneldynamic",_e);var Be=(function(o){H(i,o);function i(t,e,r,n){var a=o.call(this,t,e,r)||this;return a.mark=n,a.question=t,a.textColor=a.formBorderColor,a}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){switch(a.label){case 0:return h.renderFlatBorders(this.controller,this),t=h.createPoint(this,!0,!0),e=this.controller.fontSize,this.controller.fontSize=e*It.CHECKMARK_READONLY_FONT_SIZE_SCALE,r=this.controller.measureText(this.mark),t.xLeft+=this.width/2-r.width/2,t.yTop+=this.height/2-r.height/2,[4,h.createTextFlat(t,this.question,this.controller,this.mark,nt)];case 1:return n=a.sent(),n.unfold()[0].textColor=this.textColor,this.controller.fontSize=e,[4,n.render()];case 2:return a.sent(),[2]}})})},i})(mt),Ve=(function(o){H(i,o);function i(t,e,r,n,a){var s=o.call(this,void 0,t,e)||this;return s.color=r,s.renderWidth=n,s.renderHeight=a,s}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r;return T(this,function(n){return t=this.controller.doc.getFillColor(),this.controller.doc.setFillColor(this.color||"black"),this.controller.doc.rect(this.xLeft,this.yTop,(e=this.renderWidth)!==null&&e!==void 0?e:this.width,(r=this.renderHeight)!==null&&r!==void 0?r:this.height,"F"),this.controller.doc.setFillColor(t),[2]})})},i})(mt),Ee=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatComposite=function(t,e,r){return F(this,arguments,void 0,function(n,a,s,u){var l,f,d,b,x;return u===void 0&&(u=!1),T(this,function(P){switch(P.label){case 0:return l=h.createRect(n,this.controller.unitWidth,this.controller.unitHeight),f=h.moveRect(h.scaleRect(l,h.SELECT_ITEM_FLAT_SCALE),n.xLeft),d=new Be(this.question,this.controller,f,u?"-":this.question.getNumberByIndex(s)),b=h.clone(n),b.xLeft=d.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,[4,h.createTextFlat(b,this.question,this.controller,a.locText,nt)];case 1:return x=P.sent(),[2,new D(d,x)]}})})},i.prototype.generateChoicesColumn=function(t,e){return F(this,arguments,void 0,function(r,n,a){var s,u,l,f;return a===void 0&&(a=!1),T(this,function(d){switch(d.label){case 0:s=h.clone(r),u=[],l=0,d.label=1;case 1:return l<n.length?[4,this.generateFlatComposite(s,n[l],l,a)]:[3,4];case 2:f=d.sent(),s.yTop=f.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,u.push(f),d.label=3;case 3:return l++,[3,1];case 4:return[2,u]}})})},i.prototype.generateSelectToRankItemsVertically=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return e=h.clone(t),r=[],this.question.rankingChoices.length===0?[3,2]:(a=(n=r.push).apply,s=[r],[4,this.generateChoicesColumn(e,this.question.rankingChoices)]);case 1:a.apply(n,s.concat([b.sent()])),e.yTop=r[r.length-1].yBot+2*(h.GAP_BETWEEN_ROWS*this.controller.unitHeight),b.label=2;case 2:return u=h.createRect({xLeft:e.xLeft,yTop:e.yTop-h.GAP_BETWEEN_ROWS*this.controller.unitHeight-.5},this.controller.paperWidth-this.controller.margins.right-e.xLeft,1),r.push(new Ve(this.controller,u,h.FORM_BORDER_COLOR)),f=(l=r.push).apply,d=[r],[4,this.generateChoicesColumn(e,this.question.unRankingChoices,!0)];case 3:return f.apply(l,d.concat([b.sent()])),[2,r]}})})},i.prototype.generateSelectToRankItemsHorizontally=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b,x,P,S;return T(this,function(O){switch(O.label){case 0:e=2,r=h.clone(t),n=[],a=Math.max(this.question.unRankingChoices.length,this.question.rankingChoices.length),s=new D,u=0,O.label=1;case 1:if(!(u<a))return[3,8];l=0,f=0,d=[this.question.unRankingChoices[u],this.question.rankingChoices[u]],O.label=2;case 2:return f<d.length?(b=d[f],b?(this.controller.pushMargins(this.controller.margins.left,this.controller.margins.right),h.setColumnMargins(this.controller,e,l),r.xLeft=this.controller.margins.left,[4,this.generateFlatComposite(r,b,u,l==0)]):[3,4]):[3,6];case 3:x=O.sent(),s.addBrick(x),this.controller.popMargins(),O.label=4;case 4:l++,O.label=5;case 5:return f++,[3,2];case 6:P=h.createRowlineFlat(h.createPoint(s),this.controller),n.push(s,P),S=h.createRect({xLeft:this.controller.margins.left+h.getPageAvailableWidth(this.controller)/2-.5,yTop:r.yTop},0,0),s.addBrick(new Ve(this.controller,S,h.FORM_BORDER_COLOR,1,P.yBot-r.yTop+(u!==a-1?h.GAP_BETWEEN_ROWS*this.controller.unitHeight:0))),r.yTop=P.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,s=new D,O.label=7;case 7:return u++,[3,1];case 8:return[2,n]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){return this.question.selectToRankEnabled?this.question.selectToRankAreasLayout=="vertical"?[2,this.generateSelectToRankItemsVertically(t)]:[2,this.generateSelectToRankItemsHorizontally(t)]:[2,this.generateChoicesColumn(t,this.question.rankingChoices)]})})},i})(ot);Q.getInstance().register("ranking",Ee);var Ae=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.questionRating=e,n}return i.prototype.generateFlatHorisontalComposite=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return n=h.getRatingItemText(this.questionRating,r,e.locText),this.controller.pushMargins(),a=this.controller.unitWidth/2,this.controller.margins.left+=a,this.controller.margins.right+=a,s=h.clone(t),s.xLeft+=a,l=D.bind,[4,h.createBoldTextFlat(s,this.questionRating,this.controller,n)];case 1:return u=new(l.apply(D,[void 0,b.sent()])),this.controller.popMargins(),f=u.width,f<h.getRatingMinWidth(this.controller)?(u.xLeft+=(h.getRatingMinWidth(this.controller)-f)/2-a,f=h.getRatingMinWidth(this.controller)):f+=this.controller.unitWidth,d=h.createPoint(u),d.xLeft=t.xLeft,u.addBrick(this.generateFlatItem(h.createRect(d,f,this.controller.unitHeight),e,r,void 0,this.question.value==e.value)),[2,u]}})})},i.prototype.generateFlatComposite=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d,b;return T(this,function(x){switch(x.label){case 0:return n=new D,a=h.createRect(t,this.controller.unitHeight,this.controller.unitHeight),s=this.generateFlatItem(h.moveRect(h.scaleRect(a,h.SELECT_ITEM_FLAT_SCALE),t.xLeft),e,r,void 0,this.question.value==e.value),n.addBrick(s),u=h.clone(t),u.xLeft=s.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,l=h.getRatingItemText(this.questionRating,r,e.locText),f=l==null,f?[3,2]:(b=(d=n).addBrick,[4,h.createTextFlat(u,this.question,this.controller,l,nt)]);case 1:f=b.apply(d,[x.sent()]),x.label=2;case 2:return[2,n]}})})},i.prototype.generateHorisontallyItems=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s;return T(this,function(u){switch(u.label){case 0:e=[new D],r=h.clone(t),n=0,u.label=1;case 1:return n<this.questionRating.visibleRateValues.length?[4,this.generateFlatHorisontalComposite(r,this.questionRating.visibleRateValues[n],n)]:[3,4];case 2:a=u.sent(),e[e.length-1].addBrick(a),s=this.controller.paperWidth-this.controller.margins.right-a.xRight,h.getRatingMinWidth(this.controller)<=s+h.EPSILON?r.xLeft=a.xRight:(r.xLeft=t.xLeft,r.yTop=a.yBot,n!==this.questionRating.visibleRateValues.length-1&&(e[e.length-1].addBrick(h.createRowlineFlat(r,this.controller)),r.yTop+=h.EPSILON,e.push(new D))),u.label=3;case 3:return n++,[3,1];case 4:return[2,e]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n;return T(this,function(a){for(e=!1,r=0;r<this.questionRating.visibleRateValues.length;r++)n=h.getRatingItemText(this.questionRating,r,this.questionRating.visibleRateValues[r].locText),this.controller.measureText(n).width>this.controller.measureText(h.RATING_COLUMN_WIDTH).width&&(e=!0);return[2,e?this.generateVerticallyItems(t,this.questionRating.visibleRateValues):this.generateHorisontallyItems(t)]})})},i})(Nt);Q.getInstance().register("rating",Ae);var Se=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,u,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:return e=h.clone(t),this.question.sliderType!=="single"?[3,2]:(u=this.getOptionsByValue(this.question.value),[4,this.generateInputBrick(e,u)]);case 1:return r=f.sent(),[2,[r]];case 2:if(this.question.sliderType!=="range")return[3,7];n=new D,a=0,f.label=3;case 3:return a<this.question.value.length?(s=this.question.value[a],u=this.getOptionsByValue(s),[4,this.generateColumnInput(e,u,2,a)]):[3,6];case 4:l=f.sent(),n.addBrick(l),f.label=5;case 5:return a++,[3,3];case 6:return[2,[n]];case 7:return[2]}})})},i.prototype.getOptionsByValue=function(t){var e=this.question,r=e.id,n=e.isReadOnly;return{fieldName:r,inputType:"number",value:t,isReadOnly:n,shouldRenderBorders:!0}},i.prototype.generateInputBrick=function(t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return this.shouldRenderAsComment?[3,1]:(r=h.createTextFieldRect(t,this.controller),[2,new Vt(this.question,this.controller,r,vt({},e))]);case 1:return[4,h.createCommentFlat(t,this.question,this.controller,vt({},e))];case 2:return[2,n.sent()]}})})},i.prototype.generateColumnInput=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s;return T(this,function(u){switch(u.label){case 0:return this.controller.pushMargins(),h.setColumnMargins(this.controller,r,n),a=h.clone(t),a.xLeft=this.controller.margins.left,[4,this.generateInputBrick(a,e)];case 1:return s=u.sent(),this.controller.popMargins(),[2,s]}})})},i})(ot);Q.getInstance().register("slider",Se);var Le=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return Object.defineProperty(i.prototype,"signatureSize",{get:function(){if(!this._signatureSize){var t=h.pxToPt(this.question.signatureWidth),e=h.pxToPt(this.question.signatureHeight),r=h.getPageAvailableWidth(this.controller);if(t>r){var n=r;e*=n/t,t=n}this._signatureSize={width:t,height:e}}return this._signatureSize},enumerable:!1,configurable:!0}),i.prototype.generateBackgroundImage=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,h.createImageFlat(t,this.question,this.controller,vt(vt({link:this.question.backgroundImage},this.signatureSize),{objectFit:"cover"}),!0)];case 1:return[2,e.sent()]}})})},i.prototype.getSignImageUrl=function(){return this.question.storeDataAsText||!this.question.loadedData?this.question.value:this.question.loadedData},i.prototype.generateSign=function(t){return F(this,void 0,void 0,function(){var e,r=this;return T(this,function(n){switch(n.label){case 0:return this.question.value?[4,h.createImageFlat(t,this.question,this.controller,vt({link:this.getSignImageUrl()},this.signatureSize),!1)]:[3,2];case 1:return e=n.sent(),[3,3];case 2:e=new Ht(h.createRect(t,this.signatureSize.width,this.signatureSize.height)),n.label=3;case 3:return i.BORDER_STYLE!=="none"&&(e.afterRenderCallback=function(){var a={height:e.width,width:e.width,yTop:e.yTop,yBot:e.yBot,xLeft:e.xLeft,xRight:e.xRight,formBorderColor:e.formBorderColor,rounded:!1,outside:!0,dashStyle:i.BORDER_STYLE=="dashed"?{dashArray:[5],dashPhase:0}:void 0};h.renderFlatBorders(r.controller,a)}),[2,e]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s;return T(this,function(u){switch(u.label){case 0:return e=new D,this.question.backgroundImage?(n=(r=e).addBrick,[4,this.generateBackgroundImage(t)]):[3,2];case 1:n.apply(r,[u.sent()]),u.label=2;case 2:return s=(a=e).addBrick,[4,this.generateSign(t)];case 3:return s.apply(a,[u.sent()]),[2,[e]]}})})},i.BORDER_STYLE="dashed",i})(ot);Q.getInstance().register("signaturepad",Le);var Ie=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:return e={fieldName:this.question.id,inputType:this.question.inputType,value:this.question.inputValue,isReadOnly:this.question.isReadOnly,shouldRenderBorders:tt.settings.readOnlyTextRenderMode==="input",placeholder:h.getLocString(this.question.locPlaceHolder)},this.shouldRenderAsComment?[4,h.createCommentFlat(t,this.question,this.controller,vt({rows:i.MULTILINE_TEXT_ROWS_COUNT,isMultiline:!0},e))]:(r=h.createTextFieldRect(t,this.controller),[2,[new Vt(this.question,this.controller,r,vt({},e))]]);case 1:return[2,[n.sent()]]}})})},i.MULTILINE_TEXT_ROWS_COUNT=1,i})(ot);Q.getInstance().register("text",Ie);var Ne=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsHeader=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:e=[],r=h.clone(t),this.question.hasRows&&(r.xLeft+=this.rowTitleWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS),n=0,l.label=1;case 1:return n<this.question.visibleColumns.length?(this.controller.pushMargins(),this.controller.margins.left=r.xLeft,this.controller.margins.right+=h.getPageAvailableWidth(this.controller)-this.columnWidth,s=(a=e).push,[4,h.createBoldTextFlat(r,this.question,this.controller,this.question.visibleColumns[n].locText)]):[3,4];case 2:s.apply(a,[l.sent()]),r.xLeft+=this.columnWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.popMargins(),l.label=3;case 3:return n++,[3,1];case 4:return u=new(D.bind.apply(D,_t([void 0],e,!1))),[2,[u,h.createRowlineFlat(h.createPoint(u),this.controller)]]}})})},i.prototype.generateFlatsRows=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:r=[],n=h.clone(t),a=0,l.label=1;case 1:return a<this.question.visibleRows.length?(s="row"+a,[4,new fi(this.survey,this.question,this.controller,this.question.visibleRows[a],a,s,a==0,e,this.rowTitleWidth,this.columnWidth).generateFlatsContent(n)]):[3,4];case 2:u=l.sent(),n=h.createPoint(h.mergeRects.apply(h,u)),n.yTop+=this.controller.unitHeight*i.GAP_BETWEEN_ROWS,r.push.apply(r,u),l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},i.prototype.calculateColumnsWidthes=function(){var t=h.getPageAvailableWidth(this.controller);this.question.hasRows&&this.question.rowTitleWidth?(this.controller.pushMargins(),this.rowTitleWidth=h.parseWidth(this.question.rowTitleWidth,t),this.controller.margins.left+=this.rowTitleWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.columnWidth=h.getColumnWidth(this.controller,this.question.visibleColumns.length),this.controller.popMargins()):this.columnWidth=this.rowTitleWidth=h.getColumnWidth(this.controller,this.question.visibleColumns.length+(this.question.hasRows?1:0))},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:return this.calculateColumnsWidthes(),e=this.question.renderAs==="list"||this.controller.matrixRenderAs==="list"||this.columnWidth<this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width,r=h.clone(t),n=[],!e&&this.question.showHeader&&this.question.visibleColumns.length!=0?[4,this.generateFlatsHeader(r)]:[3,2];case 1:a=f.sent(),r=h.createPoint(h.mergeRects.apply(h,a)),r.yTop+=i.GAP_BETWEEN_ROWS*this.controller.unitHeight,n.push.apply(n,a),f.label=2;case 2:return u=(s=n.push).apply,l=[n],[4,this.generateFlatsRows(r,e)];case 3:return u.apply(s,l.concat([f.sent()])),[2,n]}})})},i.GAP_BETWEEN_ROWS=.5,i})(ot),fi=(function(){function o(i,t,e,r,n,a,s,u,l,f){s===void 0&&(s=!1),u===void 0&&(u=!1),this.survey=i,this.question=t,this.controller=e,this.row=r,this.rowIndex=n,this.key=a,this.isFirst=s,this.isVertical=u,this.rowTitleWidth=l,this.columnWidth=f}return o.prototype.generateFlatsContent=function(i){return F(this,void 0,void 0,function(){var t;return T(this,function(e){switch(e.label){case 0:return this.isVertical?[4,this.generateFlatsVerticallyCells(i)]:[3,2];case 1:return t=e.sent(),[3,4];case 2:return[4,this.generateFlatsHorizontallyCells(i)];case 3:t=e.sent(),e.label=4;case 4:return[2,t]}})})},o.prototype.generateFlatItem=function(i,t,e,r,n){n===void 0&&(n={});var a=this.question.id+r,s=this.row.isChecked(t);return this.question.isMultiSelect?new It(this.controller,i,a+"index"+e,{question:this.question,index:e,checked:s,item:t,readOnly:this.question.isReadOnly}):(e===0?(this.radioGroupWrap=new je(a,this.controller,vt({readOnly:this.question.isReadOnly,question:this.question},n)),this.question.pdfRadioGroupWrap=this.radioGroupWrap):typeof this.radioGroupWrap>"u"&&(this.radioGroupWrap=this.question.pdfRadioGroupWrap),new Jt(this.controller,i,{question:this.question,index:e,checked:s,item:t},this.radioGroupWrap))},o.prototype.generateTextComposite=function(i,t,e){return F(this,void 0,void 0,function(){var r,n,a,s;return T(this,function(u){switch(u.label){case 0:return r=h.clone(i),n=h.createRect(r,h.getPageAvailableWidth(this.controller),this.controller.unitHeight),a=this.generateFlatItem(n,t,e,this.key,{row:this.row,rowIndex:this.rowIndex}),r.yTop=a.yBot+this.controller.unitHeight*h.GAP_BETWEEN_ITEM_TEXT,[4,h.createTextFlat(r,this.question,this.controller,this.question.getCellDisplayLocText(this.row.name,t),nt)];case 1:return s=u.sent(),[2,new D(a,s)]}})})},o.prototype.generateItemComposite=function(i,t,e){return F(this,void 0,void 0,function(){var r,n,a,s;return T(this,function(u){switch(u.label){case 0:return r=h.clone(i),n=h.createRect(r,this.controller.unitHeight,this.controller.unitHeight),a=this.generateFlatItem(h.moveRect(h.scaleRect(n,h.SELECT_ITEM_FLAT_SCALE),n.xLeft),t,e,this.key,{row:this.row,rowIndex:this.rowIndex}),r.xLeft=a.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,[4,h.createTextFlat(r,this.question,this.controller,t.locText,nt)];case 1:return s=u.sent(),[2,new D(a,s)]}})})},o.prototype.generateFlatsHorizontallyCells=function(i){return F(this,void 0,void 0,function(){var t,e,r,n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return t=[],e=h.clone(i),this.question.hasRows?(this.controller.pushMargins(),e.xLeft=this.controller.margins.left,this.controller.margins.right+=h.getPageAvailableWidth(this.controller)-this.rowTitleWidth,n=(r=t).push,[4,h.createTextFlat(e,this.question,this.controller,this.row.locText,nt)]):[3,2];case 1:n.apply(r,[b.sent()]),e.xLeft+=this.rowTitleWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.popMargins(),b.label=2;case 2:a=0,b.label=3;case 3:return a<this.question.visibleColumns.length?(s=this.question.visibleColumns[a],this.row.value==s.value,this.controller.pushMargins(),this.controller.margins.left=e.xLeft,this.controller.margins.right+=h.getPageAvailableWidth(this.controller)-this.columnWidth,this.question.hasCellText?(l=(u=t).push,[4,this.generateTextComposite(e,s,a)]):[3,5]):[3,8];case 4:return l.apply(u,[b.sent()]),[3,6];case 5:f=h.createRect(e,this.controller.unitHeight,this.controller.unitHeight),t.push(this.generateFlatItem(h.moveRect(h.scaleRect(f,h.SELECT_ITEM_FLAT_SCALE),e.xLeft),s,a,this.key,{row:this.row,rowIndex:this.rowIndex})),b.label=6;case 6:e.xLeft+=this.columnWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.popMargins(),b.label=7;case 7:return a++,[3,3];case 8:return d=new(D.bind.apply(D,_t([void 0],t,!1))),[2,[d,h.createRowlineFlat(h.createPoint(d),this.controller)]]}})})},o.prototype.generateFlatsVerticallyCells=function(i){return F(this,void 0,void 0,function(){var t,e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:return t=[],e=h.clone(i),this.question.hasRows?[4,h.createTextFlat(e,this.question,this.controller,this.row.locText,nt)]:[3,2];case 1:r=l.sent(),e.yTop=r.yBot+ot.CONTENT_GAP_VERT_SCALE*this.controller.unitHeight,t.push(r),l.label=2;case 2:return a=(n=t.push).apply,s=[t],[4,this.generateVerticallyItems(e,this.question.visibleColumns)];case 3:return a.apply(n,s.concat([l.sent()])),u=new(D.bind.apply(D,_t([void 0],t,!1))),[2,[u,h.createRowlineFlat(h.createPoint(u),this.controller)]]}})})},o.prototype.generateVerticallyItems=function(i,t){return F(this,void 0,void 0,function(){var e,r,n,a;return T(this,function(s){switch(s.label){case 0:e=h.clone(i),r=[],n=0,s.label=1;case 1:return n<t.length?[4,(this.question.hasCellText?this.generateTextComposite:this.generateItemComposite).call(this,e,t[n],n)]:[3,4];case 2:a=s.sent(),e.yTop=a.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,r.push(a),s.label=3;case 3:return n++,[3,1];case 4:return[2,r]}})})},o})();tt.Serializer.removeProperty("matrix","renderAs"),tt.Serializer.addProperty("matrix",{name:"renderAs",default:"auto",visible:!1,choices:["auto","list"]}),Q.getInstance().register("matrix",Ne);var ee=(function(o){H(i,o);function i(t,e,r,n){n===void 0&&(n=!0);var a=o.call(this,t,e,r)||this;return a.survey=t,a.isMultiple=n,a.question=e,a}return Object.defineProperty(i.prototype,"visibleRows",{get:function(){return this.visibleRowsValue||(this.visibleRowsValue=this.question.renderedTable.rows.filter(function(t){return t.visible})),this.visibleRowsValue},enumerable:!1,configurable:!0}),i.prototype.generateFlatsCellTitle=function(t,e){return F(this,void 0,void 0,function(){var r,n,a;return T(this,function(s){switch(s.label){case 0:return r=new D,a=(n=r).addBrick,[4,h.createTextFlat(t,this.question,this.controller,e,nt)];case 1:return a.apply(n,[s.sent()]),[2,r]}})})},i.prototype.generateFlatsCell=function(t,e,r){return F(this,arguments,void 0,function(n,a,s,u){var l,f,d,b,x,P,S,O,et,K;return u===void 0&&(u=!0),T(this,function(V){switch(V.label){case 0:return l=new D,a.hasQuestion?s=="footer"&&!a.question.isAnswered?[3,4]:[3,1]:[3,5];case 1:return u&&a.isChoice?(f=Q.getInstance().create(this.survey,a.question,this.controller,a.question.getType()),d=h.moveRect(h.scaleRect(h.createRect(n,this.controller.unitHeight,this.controller.unitHeight),h.SELECT_ITEM_FLAT_SCALE),n.xLeft),l.addBrick(f.generateFlatItem(d,a.item,a.choiceIndex)),[3,4]):[3,2];case 2:return a.question.titleLocation=h.TITLE_LOCATION_MATRIX,x=(b=l.addBrick).apply,P=[l],[4,h.generateQuestionFlats(this.survey,this.controller,a.question,n)];case 3:x.apply(b,P.concat([V.sent()])),V.label=4;case 4:return[3,9];case 5:return a.hasTitle?s!="header"?[3,7]:(O=(S=l).addBrick,[4,h.createBoldTextFlat(n,this.question,this.controller,a.locTitle)]):[3,9];case 6:return O.apply(S,[V.sent()]),[3,9];case 7:return K=(et=l).addBrick,[4,h.createTextFlat(n,this.question,this.controller,a.locTitle,nt)];case 8:K.apply(et,[V.sent()]),V.label=9;case 9:return[2,l]}})})},Object.defineProperty(i.prototype,"hasDetailPanel",{get:function(){var t=this;return this.visibleRows.some(function(e){return e.row&&t.question.hasDetailPanel(e.row)})},enumerable:!1,configurable:!0}),i.prototype.ignoreCell=function(t,e,r,n){return n===void 0&&(n=!0),!n&&r=="footer"&&t.hasQuestion&&!t.question.isAnswered?!0:!(t.hasQuestion||t.hasTitle||this.isMultiple&&(this.hasDetailPanel?e==1:e==0))},i.prototype.getRowLocation=function(t){return t===this.question.renderedTable.headerRow?"header":this.question.renderedTable.footerRow===t?"footer":void 0},i.prototype.generateFlatsRowHorisontal=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:n=new D,a=h.clone(t),s=this.controller.paperWidth-this.controller.margins.left+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.pushMargins(),u=0,l=this.getRowLocation(e),f=0,b.label=1;case 1:return f<e.cells.length?this.ignoreCell(e.cells[f],f,l)?[3,3]:(this.controller.margins.left=this.controller.paperWidth-s+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.margins.right=this.controller.paperWidth-this.controller.margins.left-r[u],s=this.controller.margins.right,a.xLeft=this.controller.margins.left,[4,this.generateFlatsCell(a,e.cells[f],l)]):[3,4];case 2:d=b.sent(),d.isEmpty||n.addBrick(d),u++,b.label=3;case 3:return f++,[3,1];case 4:return this.controller.popMargins(),[2,n]}})})},i.prototype.generateFlatsRowVertical=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u,l,f,d,b,x;return T(this,function(P){switch(P.label){case 0:r=new D,n=h.clone(t),a=this.getRowLocation(e),s=0,P.label=1;case 1:return s<e.cells.length?this.ignoreCell(e.cells[s],s,a,!1)?[3,5]:this.question.renderedTable.showHeader&&(!this.isMultiple||s>0)&&(!((x=(b=e.cells[s].cell)===null||b===void 0?void 0:b.column)===null||x===void 0)&&x.locTitle)?(l=(u=r).addBrick,[4,this.generateFlatsCellTitle(n,e.cells[s].cell.column.locTitle)]):[3,3]:[3,6];case 2:l.apply(u,[P.sent()]),n.yTop=r.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,P.label=3;case 3:return d=(f=r).addBrick,[4,this.generateFlatsCell(n,e.cells[s],a,!1)];case 4:d.apply(f,[P.sent()]),n.yTop=r.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,P.label=5;case 5:return s++,[3,1];case 6:return[2,r]}})})},i.prototype.getAvalableWidth=function(t){return h.getPageAvailableWidth(this.controller)-(t-1)*this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS},i.prototype.calculateColumnWidth=function(t,e){for(var r=this,n=this.getAvalableWidth(e),a=n,s=e,u=[],l=[],f=t[0].cells.filter(function(P,S){return!r.ignoreCell(P,S)}),d=0;d<e;d++){var b=h.parseWidth(f[d].width,n,e)||0;a-=b,b!==0?s--:l.push(f[d]),u.push(b)}if(s===0)return u;var x=this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width;return l.sort(function(P,S){var O=h.parseWidth(P.minWidth,n,e)||0,et=h.parseWidth(S.minWidth,n,e)||0;return et>O?1:-1}).forEach(function(P){var S=a/s,O=h.parseWidth(P.minWidth,n,e)||0;O>S&&O>x&&(a-=O,s--),u[f.indexOf(P)]=Math.max(x,O,S)}),u},i.prototype.generateOneRow=function(t,e,r,n){return F(this,void 0,void 0,function(){return T(this,function(a){switch(a.label){case 0:return r?[4,this.generateFlatsRowHorisontal(t,e,n)]:[3,2];case 1:return[2,a.sent()];case 2:return[4,this.generateFlatsRowVertical(t,e)];case 3:return[2,a.sent()]}})})},i.prototype.generateFlatsRows=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s,u,l,f,d,b,x,P,S;return T(this,function(O){switch(O.label){case 0:a=h.clone(t),s=[],u=0,O.label=1;case 1:return u<e.length?[4,this.generateOneRow(a,e[u],n,this.calculateColumnWidth(e,r))]:[3,6];case 2:if(l=O.sent(),l.isEmpty&&!(e[u].row&&e[u].row.hasPanel))return[3,5];if(l.isEmpty||(u!==e.length-1&&(a.yTop=l.yBot,l.addBrick(h.createRowlineFlat(a,this.controller))),s.push(l),a.yTop=l.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight),!(e[u].row&&e[u].row.hasPanel))return[3,5];for(e[u].row.showDetailPanel(),f=e[u].row.detailPanel,d=0;d<f.questions.length;d++)f.questions[d].id+="_"+u;return[4,Dt.generateFlatsPanel(this.survey,this.controller,f,a)];case 3:return b=O.sent(),x=new D,x.addBrick.apply(x,b),a.yTop=x.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,s.push(x),u!==e.length-1&&this.question.renderedTable.showHeader&&n?[4,this.generateOneRow(a,e[0],n,this.calculateColumnWidth(e,r))]:[3,5];case 4:P=O.sent(),S=x.yBot,P.isEmpty||(S=P.yBot,s.push(P)),a.yTop=S+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,O.label=5;case 5:return u++,[3,1];case 6:return[2,s]}})})},i.prototype.calculateIsWide=function(t,e){var r=[];if(t.showHeader&&r.push(t.headerRow),r.push.apply(r,this.visibleRows),r.length===0)return!0;var n=this.calculateColumnWidth(r,e).reduce(function(a,s){return a+=s},0);return this.question.renderAs!=="list"&&this.controller.matrixRenderAs!=="list"&&Math.floor(n)<=Math.floor(this.getAvalableWidth(e))},i.prototype.getRowsToRender=function(t,e,r){var n=[],a=this.visibleRows;return t.showHeader&&r&&n.push(t.headerRow),n.push.apply(n,a),t.hasRemoveRows&&e&&n.pop(),t.showFooter&&n.push(t.footerRow),n},i.prototype.getColCount=function(t,e){var r=this;return e[0]?e[0].cells.filter(function(n,a){return!r.ignoreCell(n,a)}).length:t.showHeader&&t.headerRow?t.headerRow.cells.length:t.showFooter&&t.footerRow?t.footerRow.cells.length:0},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s;return T(this,function(u){switch(u.label){case 0:return e=this.question.renderedTable,r=this.question.columnLayout==="vertical",n=this.getColCount(e,this.visibleRows),n===0&&!this.hasDetailPanel?[2,[new D(h.createRowlineFlat(t,this.controller))]]:(a=this.calculateIsWide(e,n),a||(this.question.isMobile=!0,r=!1,e=this.question.renderedTable,this.visibleRowsValue=void 0,n=this.getColCount(e,this.visibleRows)),s=this.getRowsToRender(e,r,a),[4,this.generateFlatsRows(t,s,n,a)]);case 1:return[2,u.sent()]}})})},i.GAP_BETWEEN_ROWS=.5,i})(ot);tt.Serializer.removeProperty("matrixdropdown","renderAs"),tt.Serializer.addProperty("matrixdropdown",{name:"renderAs",default:"auto",visible:!1,choices:["auto","list"]}),Q.getInstance().register("matrixdropdown",ee);var Oe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r,!1)||this;return n.survey=t,n}return i})(ee);tt.Serializer.removeProperty("matrixdynamic","renderAs"),tt.Serializer.addProperty("matrixdynamic",{name:"renderAs",default:"auto",visible:!1,choices:["auto","list"]}),Q.getInstance().register("matrixdynamic",Oe);var ke=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.getVisibleRows=function(){return this.question.getRows().filter(function(t){return t.isVisible})},i.prototype.generateFlatItem=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s,u,l,f,d,b,x;return T(this,function(P){switch(P.label){case 0:return a=h.getPageAvailableWidth(this.controller),this.controller.pushMargins(),this.controller.margins.right=this.controller.paperWidth-this.controller.margins.left-a*h.MULTIPLETEXT_TEXT_PERS,u=D.bind,[4,h.createBoldTextFlat(t,this.question,this.controller,n.locTitle)];case 1:return s=new(u.apply(D,[void 0,P.sent()])),this.controller.popMargins(),l=Q.getInstance().create(this.survey,n.editor,this.controller,"text"),f=h.createTextFieldRect({xLeft:t.xLeft+a*h.MULTIPLETEXT_TEXT_PERS,yTop:t.yTop},this.controller),b=(d=s.addBrick).apply,x=[s],[4,l.generateFlatsContent(f)];case 2:return b.apply(d,x.concat([P.sent()])),[2,s]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:e=[],r=h.clone(t),n=this.getVisibleRows(),a=0,f.label=1;case 1:if(!(a<n.length))return[3,7];e.push(new D),s=r.yTop,this.controller.pushMargins(),u=0,f.label=2;case 2:return u<n[a].cells.length?(this.controller.pushMargins(),h.setColumnMargins(this.controller,this.question.colCount,u),r.xLeft=this.controller.margins.left,[4,this.generateFlatItem(r,a,u,n[a].cells[u].item)]):[3,5];case 3:l=f.sent(),e[e.length-1].addBrick(l),s=Math.max(s,l.yBot),this.controller.popMargins(),f.label=4;case 4:return u++,[3,2];case 5:this.controller.popMargins(),r.xLeft=t.xLeft,r.yTop=s,e[e.length-1].addBrick(h.createRowlineFlat(r,this.controller)),r.yTop+=h.EPSILON,r.yTop+=this.controller.unitHeight*i.ROWS_GAP_SCALE,f.label=6;case 6:return a++,[3,1];case 7:return[2,e]}})})},i.ROWS_GAP_SCALE=.195,i})(ot);Q.getInstance().register("multipletext",ke);var Ue=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r(e.helperDoc,t,0,0))||this;return n.renderFunc=r,n}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t=this;return T(this,function(e){switch(e.label){case 0:return[4,new Promise(function(r){t.renderFunc(t.controller.doc,t.question,t.xLeft,t.yTop),r()})];case 1:return e.sent(),[2]}})})},i})(mt);tt.checkLibraryVersion("".concat("2.5.21"),"survey-pdf");var di=(function(o){H(i,o);function i(){return o!==null&&o.apply(this,arguments)||this}return i.prototype._getImageInfo=function(t){return F(this,void 0,void 0,function(){var e,r,n,a=this;return T(this,function(s){switch(s.label){case 0:return e=72/96,r=new Image,r.crossOrigin="anonymous",[4,new Promise(function(u,l){r.onload=function(){var f=document.createElement("canvas"),d=f.getContext("2d");f.height=r.naturalHeight,f.width=r.naturalWidth,d?.drawImage(r,0,0);var b=f.toDataURL();u({data:b,width:r.naturalWidth*e,height:r.naturalHeight*e,id:a.getImageId()})},r.onerror=function(){l()},r.src=t})];case 1:return n=s.sent(),[2,n]}})})},i.prototype.getCoverCanvasOptions=function(t,e,r,n){var a=t/e,s=r/n,u,l;return s>a?(u=r,l=r/a):(l=n,u=n*a),{canvasWidth:r,canvasHeight:n,imageX:(r-u)/2,imageY:(n-l)/2,imageWidth:u,imageHeight:l}},i.prototype.applyImageFit=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s,u,l;return T(this,function(f){switch(f.label){case 0:if(e!="cover")return[3,5];f.label=1;case 1:return f.trys.push([1,3,,4]),a=new Image,!t.width||!t.height||!t.data||!r||!n?[2,t]:(a.src=t.data instanceof Uint8Array?URL.createObjectURL(new Blob([t.data])):t.data,[4,a.decode()]);case 2:return f.sent(),s=this.getCoverCanvasOptions(t.width,t.height,r,n),u=document.createElement("canvas"),l=u.getContext("2d"),u.width=s.canvasWidth,u.height=s.canvasHeight,l?.drawImage(a,s.imageX,s.imageY,s.imageWidth,s.imageHeight),[2,{data:u.toDataURL(),width:r,height:n}];case 3:return f.sent(),[2,t];case 4:return[3,6];case 5:return[2,o.prototype.applyImageFit.call(this,t,e,r,n)];case 6:return[2]}})})},i})(De);ni(new di),A.BooleanItemBrick=ge,A.CheckItemBrick=It,A.CheckboxItemBrick=ye,A.CompositeBrick=D,A.CustomBrick=Ue,A.DocController=Lt,A.DocOptions=Xt,A.DrawCanvas=Zt,A.DropdownBrick=Fe,A.EmptyBrick=Ht,A.EventHandler=pe,A.FlatBoolean=me,A.FlatCheckbox=te,A.FlatComment=be,A.FlatCustomModel=ve,A.FlatDropdown=Te,A.FlatExpression=xe,A.FlatFile=Re,A.FlatHTML=we,A.FlatImage=Pe,A.FlatImagePicker=Ce,A.FlatMatrix=Ne,A.FlatMatrixDynamic=Oe,A.FlatMatrixMultiple=ee,A.FlatMultipleText=ke,A.FlatPanelDynamic=_e,A.FlatQuestion=ot,A.FlatQuestionDefault=se,A.FlatRadiogroup=Nt,A.FlatRanking=Ee,A.FlatRating=Ae,A.FlatRepository=Q,A.FlatSelectBase=$t,A.FlatSignaturePad=Le,A.FlatSlider=Se,A.FlatSurvey=Dt,A.FlatTextbox=Ie,A.HTMLBrick=ue,A.ImageBrick=he,A.LinkBrick=Qt,A.PagePacker=de,A.PdfBrick=mt,A.RadioItemBrick=Jt,A.RankingItemBrick=Be,A.RowlineBrick=Kt,A.SurveyHelper=h,A.SurveyPDF=Ge,A.TextBoldBrick=jt,A.TextBrick=nt,A.TextFieldBrick=Vt,A.TitlePanelBrick=le}));
47
+ */(function(o){var i,t,e,r,n,a,s,u,l,f,d,b,x,P,S,O,et,K,V,X;i=(function(){return function(w){return W.prototype=w,new W};function W(){}})(),f=function(w){var g,C,v,B,E,I,M;for(C=0,v=w.length,g=void 0,B=!1,I=!1;!B&&C!==v;)g=w[C]=w[C].trimLeft(),g&&(B=!0),C++;for(C=v-1;v&&!I&&C!==-1;)g=w[C]=w[C].trimRight(),g&&(I=!0),C--;for(E=/\s+$/g,M=!0,C=0;C!==v;)w[C]!="\u2028"&&(g=w[C].replace(/\s+/g," "),M&&(g=g.trimLeft()),g&&(M=E.test(g)),w[C]=g),C++;return w},d=function(w,g,C,v){return this.pdf=w,this.x=g,this.y=C,this.settings=v,this.watchFunctions=[],this.init(),this},b=function(w){var g,C,v;for(g=void 0,v=w.split(","),C=v.shift();!g&&C;)g=e[C.trim().toLowerCase()],C=v.shift();return g},x=function(w){w=w==="auto"?"0px":w,w.indexOf("em")>-1&&!isNaN(Number(w.replace("em","")))&&(w=Number(w.replace("em",""))*18.719+"px"),w.indexOf("pt")>-1&&!isNaN(Number(w.replace("pt","")))&&(w=Number(w.replace("pt",""))*1.333+"px");var g,C,v;return C=void 0,g=16,v=P[w],v||(v={"xx-small":9,"x-small":11,small:13,medium:16,large:19,"x-large":23,"xx-large":28,auto:0}[w],v!==C||(v=parseFloat(w))?P[w]=v/g:(v=w.match(/([\d\.]+)(px)/),Array.isArray(v)&&v.length===3?P[w]=parseFloat(v[1])/g:P[w]=1))},l=function(w){var g,C,v;return v=(function(B){var E;return E=(function(I){return document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(I,null):I.currentStyle?I.currentStyle:I.style})(B),function(I){return I=I.replace(/-\D/g,function(M){return M.charAt(1).toUpperCase()}),E[I]}})(w),g={},C=void 0,g["font-family"]=b(v("font-family"))||"times",g["font-style"]=r[v("font-style")]||"normal",g["text-align"]=n[v("text-align")]||"left",C=a[v("font-weight")]||"normal",C==="bold"&&(g["font-style"]==="normal"?g["font-style"]=C:g["font-style"]=C+g["font-style"]),g["font-size"]=x(v("font-size"))||1,g["line-height"]=x(v("line-height"))||1,g.display=v("display")==="inline"?"inline":"block",C=g.display==="block",g["margin-top"]=C&&x(v("margin-top"))||0,g["margin-bottom"]=C&&x(v("margin-bottom"))||0,g["padding-top"]=C&&x(v("padding-top"))||0,g["padding-bottom"]=C&&x(v("padding-bottom"))||0,g["margin-left"]=C&&x(v("margin-left"))||0,g["margin-right"]=C&&x(v("margin-right"))||0,g["padding-left"]=C&&x(v("padding-left"))||0,g["padding-right"]=C&&x(v("padding-right"))||0,g["page-break-before"]=v("page-break-before")||"auto",g.float=s[v("cssFloat")]||"none",g.clear=u[v("clear")]||"none",g.color=v("color"),g},S=function(w,g,C){var v,B,E,I,M;if(E=!1,B=void 0,I=void 0,v=C["#"+w.id],v)if(typeof v=="function")E=v(w,g);else for(B=0,I=v.length;!E&&B!==I;)E=v[B](w,g),B++;if(v=C[w.nodeName],!E&&v)if(typeof v=="function")E=v(w,g);else for(B=0,I=v.length;!E&&B!==I;)E=v[B](w,g),B++;for(M=typeof w.className=="string"?w.className.split(" "):[],B=0;B<M.length;B++)if(v=C["."+M[B]],!E&&v)if(typeof v=="function")E=v(w,g);else for(B=0,I=v.length;!E&&B!==I;)E=v[B](w,g),B++;return E},X=function(w,g){var C,v,B,E,I,M,U,q,G;C=[],v=[],B=0,G=0;for(var E=0;E<w.rows[0].cells.length;E++)G+=w.rows[0].cells[E].colSpan;for(U=w.clientWidth;B<G;){q=w.rows[0].cells[B];for(var E=0;E<q.colSpan;E++)v[B+E]={name:q.textContent.toLowerCase().replace(/\s+/g,"")+"_"+E,prompt:q.textContent.replace(/\r?\n/g,""),width:q.clientWidth/U*g.settings.width/q.colSpan};B+=E}for(B=1;B<w.rows.length;){for(M=w.rows[B],I={},E=0;E<M.cells.length;)I[v[E].name]=M.cells[E].textContent.replace(/\r?\n/g,""),E++;C.push(I),B++}return{rows:C,headers:v}};var bt={SCRIPT:1,STYLE:1,NOSCRIPT:1,OBJECT:1,EMBED:1,SELECT:1},Ot=1;t=function(w,g,C){var v,B,E,I,M,U,q,G;for(B=w.childNodes,v=void 0,E=l(w),M=E.display==="block",M&&(g.setBlockBoundary(),g.setBlockStyle(E)),I=0,U=B.length;I<U;){if(v=B[I],typeof v=="object"){if(g.executeWatchFunctions(v),v.nodeType===1&&v.nodeName==="HEADER"){var Y=v,$=g.pdf.margins_doc.top;g.pdf.internal.events.subscribe("addPage",function(yt){g.y=$,t(Y,g,C),g.pdf.margins_doc.top=g.y+10,g.y+=10},!1)}if(v.nodeType===8&&v.nodeName==="#comment")~v.textContent.indexOf("ADD_PAGE")&&(g.pdf.addPage(),g.y=g.pdf.margins_doc.top);else if(v.nodeType===1&&!bt[v.nodeName]){var k;if(v.nodeName==="IMG"){var j=v.getAttribute("src");k=O[g.pdf.sHashCode&&g.pdf.sHashCode(j)||j]}if(k){g.pdf.internal.pageSize.getHeight()-g.pdf.margins_doc.bottom<g.y+v.height&&g.y>g.pdf.margins_doc.top&&(g.pdf.addPage(),g.y=g.pdf.margins_doc.top,g.executeWatchFunctions(v));var z=l(v),it=g.x,at=12/g.pdf.internal.scaleFactor,st=(z["margin-left"]+z["padding-left"])*at,ct=(z["margin-right"]+z["padding-right"])*at,ft=(z["margin-top"]+z["padding-top"])*at,gt=(z["margin-bottom"]+z["padding-bottom"])*at;z.float!==void 0&&z.float==="right"?it+=g.settings.width-v.width-ct:it+=st,g.pdf.addImage(k,it,g.y+ft,v.width,v.height),k=void 0,z.float==="right"||z.float==="left"?(g.watchFunctions.push(function(yt,L,Ft,c){return g.y>=L?(g.x+=yt,g.settings.width+=Ft,!0):c&&c.nodeType===1&&!bt[c.nodeName]&&g.x+c.width>g.pdf.margins_doc.left+g.pdf.margins_doc.width?(g.x+=yt,g.y=L,g.settings.width+=Ft,!0):!1}.bind(this,z.float==="left"?-v.width-st-ct:0,g.y+v.height+ft+gt,v.width)),g.watchFunctions.push(function(yt,L,Ft){return g.y<yt&&L===g.pdf.internal.getNumberOfPages()?Ft.nodeType===1&&l(Ft).clear==="both"?(g.y=yt,!0):!1:!0}.bind(this,g.y+v.height,g.pdf.internal.getNumberOfPages())),g.settings.width-=v.width+st+ct,z.float==="left"&&(g.x+=v.width+st+ct)):g.y+=v.height+ft+gt}else if(v.nodeName==="TABLE")g.pdf.autoTable?(g.y+=10,g.pdf.autoTable({theme:"grid",html:v,startY:g.y,styles:{font:g.pdf.getFont().fontName,fontSize:g.pdf.getFontSize(),textColor:g.pdf.getTextColor()},margin:{top:g.pdf.margins_doc.top,left:g.x,right:g.pdf.internal.pageSize.getWidth()-(g.x+g.settings.width),bottom:g.pdf.margins_doc.bottom}}),g.y=g.pdf.lastAutoTable.finalY):(q=X(v,g),g.y+=10,g.pdf.table(g.x,g.y,q.rows,q.headers,{autoSize:!1,printHeaders:C.printHeaders,margins:g.pdf.margins_doc,css:l(v)}),g.y=g.pdf.internal.__cell__.lastCell.y+g.pdf.internal.__cell__.lastCell.height);else if(v.nodeName==="OL"||v.nodeName==="UL")Ot=1,S(v,g,C)||t(v,g,C),g.y+=10;else if(v.nodeName==="LI"){var rt=g.x;g.x+=20/g.pdf.internal.scaleFactor,g.y+=3,S(v,g,C)||t(v,g,C),g.x=rt}else v.nodeName==="BR"?(g.y+=E["font-size"]*g.pdf.internal.scaleFactor,g.addText("\u2028",i(E))):S(v,g,C)||t(v,g,C)}else if(v.nodeType===3){var Bt=v.nodeValue;if(v.nodeValue&&v.parentNode.nodeName==="LI")if(v.parentNode.parentNode.nodeName==="OL")Bt=Ot+++". "+Bt;else{var xt=E["font-size"],qt=(3-xt*.75)*g.pdf.internal.scaleFactor,kt=xt*.75*g.pdf.internal.scaleFactor,Rt=xt*1.74/g.pdf.internal.scaleFactor;G=function(L,Ft){this.pdf.circle(L+qt,Ft+kt,Rt,"FD")}}v.ownerDocument.body.compareDocumentPosition(v)&16&&g.addText(Bt,E)}else typeof v=="string"&&g.addText(v,E)}I++}if(C.outY=g.y,M)return g.setBlockBoundary(G)},O={},et=function(w,g,C,v){var B=w.getElementsByTagName("img"),E=B.length,I,M=0;function U(){g.pdf.internal.events.publish("imagesLoaded"),v(I)}function q(G,Y,$){if(G){var k=new Image;I=++M,k.crossOrigin="",k.onerror=k.onload=function(){if(k.complete&&(k.src.indexOf("data:image/")===0&&(k.width=Y||k.width||0,k.height=$||k.height||0),k.width+k.height)){var j=g.pdf.sHashCode&&g.pdf.sHashCode(G)||G;O[j]=O[j]||k}--M||U()},k.src=G}}for(;E--;)q(B[E].getAttribute("src"),B[E].width,B[E].height);return M||U()},K=function(w,g,C){var v=w.getElementsByTagName("footer");if(v.length>0){v=v[0];var B=g.pdf.internal.write,E=g.y;g.pdf.internal.write=function(){},t(v,g,C);var I=Math.ceil(g.y-E)+5;g.y=E,g.pdf.internal.write=B,g.pdf.margins_doc.bottom+=I;for(var M=function(Y){var $=Y!==void 0?Y.pageNumber:1,k=g.y;g.y=g.pdf.internal.pageSize.getHeight()-g.pdf.margins_doc.bottom,g.pdf.margins_doc.bottom-=I;for(var j=v.getElementsByTagName("span"),z=0;z<j.length;++z)(" "+j[z].className+" ").replace(/[\n\t]/g," ").indexOf(" pageCounter ")>-1&&(j[z].innerHTML=$),(" "+j[z].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&(j[z].innerHTML="###jsPDFVarTotalPages###");t(v,g,C),g.pdf.margins_doc.bottom+=I,g.y=k},U=v.getElementsByTagName("span"),q=0;q<U.length;++q)(" "+U[q].className+" ").replace(/[\n\t]/g," ").indexOf(" totalPages ")>-1&&g.pdf.internal.events.subscribe("htmlRenderingFinished",g.pdf.putTotalPages.bind(g.pdf,"###jsPDFVarTotalPages###"),!0);g.pdf.internal.events.subscribe("addPage",M,!1),M(),bt.FOOTER=1}},V=function(w,g,C,v,B,E){if(!g)return!1;typeof g!="string"&&!g.parentNode&&(g=""+g.innerHTML),typeof g=="string"&&(g=(function($){var k,j,z,it;return z="jsPDFhtmlText"+Date.now().toString()+(Math.random()*1e3).toFixed(0),it="position: absolute !important;clip: rect(1px 1px 1px 1px); /* IE6, IE7 */clip: rect(1px, 1px, 1px, 1px);padding:0 !important;border:0 !important;height: 1px !important;width: 1px !important; top:auto;left:-100px;overflow: hidden;",j=document.createElement("div"),j.className="sjs-pdf-hidden-html-div",j.style.cssText=it,j.innerHTML='<iframe style="height:1px;width:1px" name="'+z+'" />',document.body.appendChild(j),k=window.frames[z],k.document.open(),k.document.writeln($),k.document.close(),k.document.body})(g.replace(/<\/?script[^>]*?>/gi,"")));for(var I=Object.keys(w.getFontList()),M=0;M<I.length;++M){var U=I[M],q=U.toLowerCase();e[q]||(e[q]=U)}var G=new d(w,C,v,B),Y;return et.call(this,g,G,B.elementHandlers,function($){K(g,G,B.elementHandlers),t(g,G,B.elementHandlers),G.pdf.internal.events.publish("htmlRenderingFinished"),Y=G.dispose(),typeof E=="function"?E(Y):$&&console.error("jsPDF Warning: rendering issues? provide a callback to fromHTML!")}),Y||{x:G.x,y:G.y}},d.prototype.init=function(){return this.paragraph={text:[],style:[]},this.pdf.internal.write("q")},d.prototype.dispose=function(){return this.pdf.internal.write("Q"),{x:this.x,y:this.y,ready:!0}},d.prototype.executeWatchFunctions=function(W){var w=!1,g=[];if(this.watchFunctions.length>0){for(var C=0;C<this.watchFunctions.length;++C)this.watchFunctions[C](W)===!0?w=!0:g.push(this.watchFunctions[C]);this.watchFunctions=g}return w},d.prototype.splitFragmentsIntoLines=function(W,w){var g,C,v,B,E,I,M,U,q,G,Y,$,k;C=12,q=this.pdf.internal.scaleFactor,v=void 0,U=void 0,B=void 0,k=void 0,M=void 0,I=void 0,E=void 0,G=[],Y=[G],g=0,$=this.settings.width;const j=this.pdf.getFont().fontName,z=this.pdf.getFont().fontStyle;for(;W.length;)if(B=W.shift(),k=w.shift(),B)if(v=k["font-family"],U=k["font-style"],this.pdf.setFont(v,U),M={textIndent:g,fontSize:k["font-size"]*C},I=this.pdf.getStringUnitWidth(B,M)*M.fontSize/q,B=="\u2028")G=[],Y.push(G);else if(g+I>$){for(E=this.pdf.splitTextToSize(B,$,M),G.push([E.shift(),k]);E.length;)G=[[E.shift(),k]],Y.push(G);g=this.pdf.getStringUnitWidth(G[0][0],M)*M.fontSize/q}else G.push([B,k]),g+=I;if(k["text-align"]!==void 0&&(k["text-align"]==="center"||k["text-align"]==="right"||k["text-align"]==="justify"))for(var it=0;it<Y.length;++it){var at=this.pdf.getStringUnitWidth(Y[it][0][0],M)*M.fontSize/q;it>0&&(Y[it][0][1]=i(Y[it][0][1]));var st=$-at;if(k["text-align"]==="right")Y[it][0][1]["margin-left"]=st;else if(k["text-align"]==="center")Y[it][0][1]["margin-left"]=st/2;else if(k["text-align"]==="justify"){var ct=Y[it][0][0].split(" ").length-1;Y[it][0][1]["word-spacing"]=st/ct,it===Y.length-1&&(Y[it][0][1]["word-spacing"]=0)}}return this.pdf.setFont(j,z),Y},d.prototype.RenderTextFragment=function(W,w){var g,C,v;if(v=0,g=12,this.pdf.internal.pageSize.getHeight()-this.pdf.margins_doc.bottom<this.y+this.pdf.internal.getFontSize()){this.pdf.internal.write("ET","Q","Q");const U=this.pdf.getCurrentPageInfo().pageNumber;this.pdf.getNumberOfPages()===U?this.pdf.addPage():this.pdf.setPage(U+1),this.y=this.pdf.margins_doc.top,this.pdf.internal.write("q","q","BT",this.getPdfColor(w.color),this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td"),v=Math.max(v,w["line-height"],w["font-size"]),this.pdf.internal.write(0,(-1*g*v).toFixed(2),"Td")}C=this.pdf.internal.getFont(w["font-family"],w["font-style"]);var B=this.getPdfColor(w.color);B!==this.lastTextColor&&(this.pdf.internal.write(B),this.lastTextColor=B),w["word-spacing"]!==void 0&&w["word-spacing"]>0&&this.pdf.internal.write(w["word-spacing"].toFixed(2),"Tw");var E=function(U,q){for(var G=q.metadata.Unicode.widths,Y=["","0","00","000","0000"],$=[""],k=0,j=U.length,z;k<j;++k){if(z=q.metadata.characterToGlyph(U.charCodeAt(k)),q.metadata.glyIdsUsed.push(z),q.metadata.toUnicode[z]=U.charCodeAt(k),G.indexOf(z)==-1&&(G.push(z),G.push([parseInt(q.metadata.widthOfGlyph(z),10)])),z=="0")return $.join("");z=z.toString(16),$.push(Y[4-z.length],z)}return $.join("")},I=function(G,q){var G=G||"",Y="",$=0,k,j="",z=q.encoding;if(q.encoding!=="Identity-H")return G;for(j=G,$=0;$<j.length;$+=1)q.metadata.hasOwnProperty("cmap")&&(k=q.metadata.cmap.unicode.codeMap[j[$].charCodeAt(0)]),k||j[$].charCodeAt(0)<256&&q.metadata.hasOwnProperty("Unicode")?Y+=j[$]:Y+="";var it="";return parseInt(q.id.slice(1))<14||z==="WinAnsiEncoding"?it=this.pdf.internal.pdfEscape(Y,key).split("").map(function(at){return at.charCodeAt(0).toString(16)}).join(""):z==="Identity-H"&&(it=E(Y,q)),it},M="";C.encoding!=="Identity-H"?M="("+this.pdf.internal.pdfEscape(W)+")":M="<"+I(W,C)+">",this.pdf.internal.write("/"+C.id,(g*w["font-size"]).toFixed(2),"Tf",M+" Tj"),w["word-spacing"]!==void 0&&this.pdf.internal.write(0,"Tw")},d.prototype.getPdfColor=function(W){var w,g,C,v,B=/rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/,E=B.exec(W);if(E!=null)g=parseInt(E[1]),C=parseInt(E[2]),v=parseInt(E[3]);else{if(typeof W=="string"&&W.charAt(0)!="#"){var I=new RGBColor(W);I.ok?W=I.toHex():W="#000000"}g=W.substring(1,3),g=parseInt(g,16),C=W.substring(3,5),C=parseInt(C,16),v=W.substring(5,7),v=parseInt(v,16)}if(typeof g=="string"&&/^#[0-9A-Fa-f]{6}$/.test(g)){var M=parseInt(g.substr(1),16);g=M>>16&255,C=M>>8&255,v=M&255}var U=this.f3;return g===0&&C===0&&v===0||typeof C>"u"?w=U(g/255)+" g":w=[U(g/255),U(C/255),U(v/255),"rg"].join(" "),w},d.prototype.f3=function(W){return W.toFixed(3)},d.prototype.renderParagraph=function(W){var w,g,C,v,B,E,I,M,U,q,G,Y,$,k;if(v=f(this.paragraph.text),$=this.paragraph.style,w=this.paragraph.blockstyle,this.paragraph.priorblockstyle,this.paragraph={text:[],style:[],blockstyle:{},priorblockstyle:w},!!v.join("").trim()){M=this.splitFragmentsIntoLines(v,$),I=void 0,U=void 0,g=12,C=g/this.pdf.internal.scaleFactor,this.priorMarginBottom=this.priorMarginBottom||0,Y=(Math.max((w["margin-top"]||0)-this.priorMarginBottom,0)+(w["padding-top"]||0))*C,G=((w["margin-bottom"]||0)+(w["padding-bottom"]||0))*C,this.priorMarginBottom=w["margin-bottom"]||0,w["page-break-before"]==="always"&&(this.pdf.addPage(),this.y=0,Y=((w["margin-top"]||0)+(w["padding-top"]||0))*C),q=this.pdf.internal.write,B=void 0,E=void 0,this.y+=Y,q("q","BT 0 g",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td");for(var j=0;M.length;){for(I=M.shift(),U=0,B=0,E=I.length;B!==E;)I[B][0].trim()&&(U=Math.max(U,I[B][1]["line-height"],I[B][1]["font-size"]),k=I[B][1]["font-size"]*7),B++;var z=0,it=0;I[0][1]["margin-left"]!==void 0&&I[0][1]["margin-left"]>0&&(it=this.pdf.internal.getCoordinateString(I[0][1]["margin-left"]),z=it-j,j=it);var at=Math.max(w["margin-left"]||0,0)*C;for(q(z+at,(-1*g*U).toFixed(2),"Td"),B=0,E=I.length;B!==E;)I[B][0]&&this.RenderTextFragment(I[B][0],I[B][1]),B++;if(this.y+=U*C,this.executeWatchFunctions(I[0][1])&&M.length>0){var st=[],ct=[];M.forEach(function(ft){for(var gt=0,rt=ft.length;gt!==rt;)ft[gt][0]&&(st.push(ft[gt][0]+" "),ct.push(ft[gt][1])),++gt}),M=this.splitFragmentsIntoLines(f(st),ct),q("ET","Q"),q("q","BT 0 g",this.pdf.internal.getCoordinateString(this.x),this.pdf.internal.getVerticalCoordinateString(this.y),"Td")}}return W&&typeof W=="function"&&W.call(this,this.x-9,this.y-k/2),q("ET","Q"),this.y+=G}},d.prototype.setBlockBoundary=function(W){return this.renderParagraph(W)},d.prototype.setBlockStyle=function(W){return this.paragraph.blockstyle=W},d.prototype.addText=function(W,w){return this.paragraph.text.push(W),this.paragraph.style.push(w)},e={helvetica:"helvetica","sans-serif":"helvetica","times new roman":"times",serif:"times",times:"times",monospace:"courier",courier:"courier"},a={100:"normal",200:"normal",300:"normal",400:"normal",500:"bold",600:"bold",700:"bold",800:"bold",900:"bold",normal:"normal",bold:"bold",bolder:"bold",lighter:"normal"},r={normal:"normal",italic:"italic",oblique:"italic"},n={left:"left",right:"right",center:"center",justify:"justify"},s={none:"none",right:"right",left:"left"},u={none:"none",both:"both"},P={normal:1},o.fromHTML=function(W,w,g,C,v,B){return this.margins_doc=B||{top:0,bottom:0},C||(C={}),C.elementHandlers||(C.elementHandlers={}),V(this,W,isNaN(w)?4:w,isNaN(g)?4:g,C,v)}})(Wt.jsPDF.API);var Xt=(function(){function o(i){var t=this;this._base64Normal=void 0,this._base64Bold=void 0,typeof i.orientation>"u"?typeof i.format>"u"||i.format[0]<i.format[1]?this._orientation="p":this._orientation="l":this._orientation=i.orientation,this._format=i.format||"a4",Array.isArray(this._format)&&(this._format=this._format.map(function(e){return e*o.MM_TO_PT})),this._fontSize=i.fontSize||o.FONT_SIZE,i.fontName?this._fontName=i.fontName:!o.SEGOE_BOLD&&!o.SEGOE_NORMAL?this._fontName=h.STANDARD_FONT:this._fontName="segoe",typeof i.fontName<"u"&&(typeof i.base64Normal<"u"||typeof i.base64Bold<"u")?(this._base64Normal=i.base64Normal||i.base64Bold,this._base64Bold=i.base64Bold||i.base64Normal):this.fontName==="segoe"&&(this._base64Normal=o.SEGOE_NORMAL,this._base64Bold=o.SEGOE_BOLD),this._margins=h.clone(i.margins),typeof this._margins>"u"&&(this._margins={}),typeof this._margins.top>"u"&&(this._margins.top=10),typeof this._margins.bot>"u"&&(this._margins.bot=10),typeof this._margins.left>"u"&&(this._margins.left=10),typeof this._margins.right>"u"&&(this._margins.right=10),Object.keys(this._margins).forEach(function(e){t._margins[e]=t._margins[e]*o.MM_TO_PT}),this._htmlRenderAs=i.htmlRenderAs||"auto",this._matrixRenderAs=i.matrixRenderAs||"auto",this._readonlyRenderAs=i.readonlyRenderAs||"auto",this._compress=i.compress||!1,this._applyImageFit=i.applyImageFit||!1,this._useLegacyBooleanRendering=i.useLegacyBooleanRendering||!1,this._isRTL=i.isRTL||!1,this._tagboxSelectedChoicesOnly=i.tagboxSelectedChoicesOnly||!1}return Object.defineProperty(o.prototype,"leftTopPoint",{get:function(){return{xLeft:this.margins.left,yTop:this.margins.top}},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontSize",{get:function(){return this._fontSize},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontName",{get:function(){return this._fontName},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"base64Normal",{get:function(){return this._base64Normal},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"base64Bold",{get:function(){return this._base64Bold},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"useCustomFontInHtml",{get:function(){return this._useCustomFontInHtml},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"margins",{get:function(){return this._margins},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"format",{get:function(){return this._format},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"orientation",{get:function(){return this._orientation},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"htmlRenderAs",{get:function(){return this._htmlRenderAs},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"matrixRenderAs",{get:function(){return this._matrixRenderAs},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"readonlyRenderAs",{get:function(){return this._readonlyRenderAs},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"compress",{get:function(){return this._compress},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"applyImageFit",{get:function(){return this._applyImageFit},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"useLegacyBooleanRendering",{get:function(){return this._useLegacyBooleanRendering},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"isRTL",{get:function(){return this._isRTL},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"tagboxSelectedChoicesOnly",{get:function(){return this._tagboxSelectedChoicesOnly},enumerable:!1,configurable:!0}),o.MM_TO_PT=72/25.4,o.FONT_SIZE=14,o})(),Lt=(function(o){H(i,o);function i(t){t===void 0&&(t={});var e=o.call(this,t)||this,r={orientation:e.orientation,unit:"pt",format:e.format,compress:e.compress};return e._doc=new Wt.jsPDF(r),typeof e.base64Normal<"u"&&!h.isFontExist(e,e.fontName)&&(i.addFont(e.fontName,e.base64Normal,"normal"),i.addFont(e.fontName,e.base64Bold,"bold"),e._doc=new Wt.jsPDF(r)),ri(e._doc),e._useCustomFontInHtml=t.useCustomFontInHtml&&h.isFontExist(e,e.fontName),e._helperDoc=new Wt.jsPDF(r),e._doc.setFont(e.fontName),e._helperDoc.setFont(e.fontName),e._doc.setFontSize(e.fontSize),e._helperDoc.setFontSize(e.fontSize),e._fontStyle="normal",e.marginsStack=[],e}return i.addFont=function(t,e,r){var n=i.customFonts[t];n||(n={},i.customFonts[t]=n),n[r]=e;var a=function(){var s=i.customFonts[t];if(s&&s[r]){var u="".concat(t,"-").concat(r,".ttf");this.addFileToVFS(u,s[r]),this.addFont(u,t,r)}};Wt.jsPDF.API.events.push(["addFonts",a])},Object.defineProperty(i.prototype,"doc",{get:function(){return this._doc},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"helperDoc",{get:function(){return this._helperDoc},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontName",{get:function(){return this._fontName},set:function(t){this._fontName=t,this._doc.setFont(t),this._helperDoc.setFont(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize=t,this._doc.setFontSize(t),this._helperDoc.setFontSize(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle=t,this._doc.setFont(this._fontName,t),this._helperDoc.setFont(this._fontName,t)},enumerable:!1,configurable:!0}),i.prototype.measureText=function(t,e,r){var n=this;t===void 0&&(t=1),e===void 0&&(e=this._fontStyle),r===void 0&&(r=this._fontSize);var a=this._helperDoc.getFontSize();this._helperDoc.setFontSize(r),this._helperDoc.setFont(this._fontName,e);var s=this._helperDoc.getLineHeight()/this._helperDoc.internal.scaleFactor,u=0;return typeof t=="number"?u=s*t:(t=typeof t=="string"?t:h.getLocString(t),u=t.split("").reduce(function(l,f){return l+n._helperDoc.getTextWidth(f)},0)),this._helperDoc.setFontSize(a),this._helperDoc.setFont(this._fontName,"normal"),{width:u,height:s}},Object.defineProperty(i.prototype,"unitWidth",{get:function(){return this.measureText().width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"unitHeight",{get:function(){return this.measureText().height},enumerable:!1,configurable:!0}),i.prototype.pushMargins=function(t,e){this.marginsStack.push({left:this.margins.left,right:this.margins.right}),typeof t<"u"&&(this.margins.left=t),typeof e<"u"&&(this.margins.right=e)},i.prototype.popMargins=function(){var t=this.marginsStack.pop();this.margins.left=t.left,this.margins.right=t.right},Object.defineProperty(i.prototype,"paperWidth",{get:function(){return this.doc.internal.pageSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"paperHeight",{get:function(){return this.doc.internal.pageSize.height},enumerable:!1,configurable:!0}),i.prototype.getNumberOfPages=function(){return this.doc.getNumberOfPages()},i.prototype.addPage=function(){this.doc.addPage()},i.prototype.getCurrentPageIndex=function(){return this.doc.getCurrentPageInfo().pageNumber-1},i.prototype.setPage=function(t){this.doc.setPage(t+1)},i.customFonts={},i})(Xt);function oi(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Et={},fe,qe;function ai(){return qe||(qe=1,fe=function(i,t,e,r){var n=e?e.call(r,i,t):void 0;if(n!==void 0)return!!n;if(i===t)return!0;if(typeof i!="object"||!i||typeof t!="object"||!t)return!1;var a=Object.keys(i),s=Object.keys(t);if(a.length!==s.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(t),l=0;l<a.length;l++){var f=a[l];if(!u(f))return!1;var d=i[f],b=t[f];if(n=e?e.call(r,d,b,f):void 0,n===!1||n===void 0&&d!==b)return!1}return!0}),fe}var ze;function si(){if(ze)return Et;ze=1,Object.defineProperty(Et,"__esModule",{value:!0});var o=ai();function i(s){return s===void 0?-1:s.height}var t=(function(){function s(u,l){this.intervalTree=u,this.records=[],this.height=0,this.key=l.low,this.max=l.high,this.records.push(l)}return s.prototype.getNodeHigh=function(){for(var u=this.records[0].high,l=1;l<this.records.length;l++)this.records[l].high>u&&(u=this.records[l].high);return u},s.prototype.updateHeight=function(){this.height=Math.max(i(this.left),i(this.right))+1},s.prototype.updateMaxOfParents=function(){if(this!==void 0){var u=this.getNodeHigh();this.left!==void 0&&this.right!==void 0?this.max=Math.max(Math.max(this.left.max,this.right.max),u):this.left!==void 0&&this.right===void 0?this.max=Math.max(this.left.max,u):this.left===void 0&&this.right!==void 0?this.max=Math.max(this.right.max,u):this.max=u,this.parent&&this.parent.updateMaxOfParents()}},s.prototype._updateMaxAfterRightRotate=function(){var u=this.parent,l=u.left,f=l.getNodeHigh();l.left===void 0&&l.right!==void 0?l.max=Math.max(f,l.right.max):l.left!==void 0&&l.right===void 0?l.max=Math.max(f,l.left.max):l.left===void 0&&l.right===void 0?l.max=f:l.max=Math.max(Math.max(l.left.max,l.right.max),f);var d=this.getNodeHigh();this.left===void 0&&this.right!==void 0?this.max=Math.max(d,this.right.max):this.left!==void 0&&this.right===void 0?this.max=Math.max(d,this.left.max):this.left===void 0&&this.right===void 0?this.max=d:this.max=Math.max(Math.max(this.left.max,this.right.max),d),u.max=Math.max(Math.max(u.left.max,u.right.max),u.getNodeHigh())},s.prototype._updateMaxAfterLeftRotate=function(){var u=this.parent,l=u.right,f=l.getNodeHigh();l.left===void 0&&l.right!==void 0?l.max=Math.max(f,l.right.max):l.left!==void 0&&l.right===void 0?l.max=Math.max(f,l.left.max):l.left===void 0&&l.right===void 0?l.max=f:l.max=Math.max(Math.max(l.left.max,l.right.max),f);var d=this.getNodeHigh();this.left===void 0&&this.right!==void 0?this.max=Math.max(d,this.right.max):this.left!==void 0&&this.right===void 0?this.max=Math.max(d,this.left.max):this.left===void 0&&this.right===void 0?this.max=d:this.max=Math.max(Math.max(this.left.max,this.right.max),d),u.max=Math.max(Math.max(u.left.max,l.max),u.getNodeHigh())},s.prototype._leftRotate=function(){var u=this.right;u.parent=this.parent,u.parent===void 0?this.intervalTree.root=u:u.parent.left===this?u.parent.left=u:u.parent.right===this&&(u.parent.right=u),this.right=u.left,this.right!==void 0&&(this.right.parent=this),u.left=this,this.parent=u,this.updateHeight(),u.updateHeight()},s.prototype._rightRotate=function(){var u=this.left;u.parent=this.parent,u.parent===void 0?this.intervalTree.root=u:u.parent.left===this?u.parent.left=u:u.parent.right===this&&(u.parent.right=u),this.left=u.right,this.left!==void 0&&(this.left.parent=this),u.right=this,this.parent=u,this.updateHeight(),u.updateHeight()},s.prototype._rebalance=function(){if(i(this.left)>=2+i(this.right)){var u=this.left;i(u.left)>=i(u.right)?(this._rightRotate(),this._updateMaxAfterRightRotate()):(u._leftRotate(),this._rightRotate(),this._updateMaxAfterRightRotate())}else if(i(this.right)>=2+i(this.left)){var l=this.right;i(l.right)>=i(l.left)?(this._leftRotate(),this._updateMaxAfterLeftRotate()):(l._rightRotate(),this._leftRotate(),this._updateMaxAfterLeftRotate())}},s.prototype.insert=function(u){u.low<this.key?this.left===void 0?(this.left=new s(this.intervalTree,u),this.left.parent=this):this.left.insert(u):this.right===void 0?(this.right=new s(this.intervalTree,u),this.right.parent=this):this.right.insert(u),this.max<u.high&&(this.max=u.high),this.updateHeight(),this._rebalance()},s.prototype._getOverlappingRecords=function(u,l,f){if(u.key<=f&&l<=u.getNodeHigh()){for(var d=[],b=0;b<u.records.length;b++)u.records[b].high>=l&&d.push(u.records[b]);return d}return[]},s.prototype.search=function(u,l){if(this===void 0)return[];var f=[],d=[],b=[];return u>this.max?[]:(this.left!==void 0&&this.left.max>=u&&(f=this.left.search(u,l)),d=this._getOverlappingRecords(this,u,l),l<this.key?f.concat(d):(this.right!==void 0&&(b=this.right.search(u,l)),f.concat(d,b)))},s.prototype.searchExisting=function(u){if(this!==void 0){if(this.key===u)return this;if(u<this.key){if(this.left!==void 0)return this.left.searchExisting(u)}else if(this.right!==void 0)return this.right.searchExisting(u)}},s.prototype._minValue=function(){return this.left===void 0?this:this.left._minValue()},s.prototype.remove=function(u){var l=this.parent;if(u.key<this.key)return this.left!==void 0?this.left.remove(u):void 0;if(u.key>this.key)return this.right!==void 0?this.right.remove(u):void 0;if(this.left!==void 0&&this.right!==void 0){var f=this.right._minValue();return this.key=f.key,this.records=f.records,this.right.remove(this)}else{if(l.left===this)return this.right!==void 0?(l.left=this.right,this.right.parent=l):(l.left=this.left,this.left!==void 0&&(this.left.parent=l)),l.updateMaxOfParents(),l.updateHeight(),l._rebalance(),this;if(l.right===this)return this.right!==void 0?(l.right=this.right,this.right.parent=l):(l.right=this.left,this.left!==void 0&&(this.left.parent=l)),l.updateMaxOfParents(),l.updateHeight(),l._rebalance(),this}},s})();Et.Node=t;var e=(function(){function s(){this.count=0}return s.prototype.insert=function(u){if(u.low>u.high)throw new Error("`low` value must be lower or equal to `high` value");if(this.root===void 0)return this.root=new t(this,u),this.count++,!0;var l=this.root.searchExisting(u.low);if(l!==void 0){for(var f=0;f<l.records.length;f++)if(o(l.records[f],u))return!1;return l.records.push(u),u.high>l.max&&(l.max=u.high,l.parent&&l.parent.updateMaxOfParents()),this.count++,!0}else return this.root.insert(u),this.count++,!0},s.prototype.search=function(u,l){return this.root===void 0?[]:this.root.search(u,l)},s.prototype.remove=function(u){if(this.root===void 0)return!1;var l=this.root.searchExisting(u.low);if(l===void 0)return!1;if(l.records.length>1){for(var f=void 0,d=0;d<l.records.length;d++)if(o(l.records[d],u)){f=l.records[d],l.records.splice(d,1);break}if(f){if(f=void 0,u.high===l.max){var b=l.getNodeHigh();l.left!==void 0&&l.right!==void 0?l.max=Math.max(Math.max(l.left.max,l.right.max),b):l.left!==void 0&&l.right===void 0?l.max=Math.max(l.left.max,b):l.left===void 0&&l.right!==void 0?l.max=Math.max(l.right.max,b):l.max=b,l.parent&&l.parent.updateMaxOfParents()}return this.count--,!0}else return!1}else if(l.records.length===1)if(o(l.records[0],u))if(this.root.key===l.key){var x=new t(this,{low:u.low,high:u.low});x.left=this.root,this.root.parent=x;var P=this.root.remove(l);return this.root=x.left,this.root!==void 0&&(this.root.parent=void 0),P?(P=void 0,this.count--,!0):!1}else{var P=this.root.remove(l);return P?(P=void 0,this.count--,!0):!1}else return!1;else return!1},s.prototype.inOrder=function(){return new n(this.root)},s.prototype.preOrder=function(){return new a(this.root)},s})();Et.IntervalTree=e;var r=(function(){function s(){this.tree=new e}return s.prototype.insert=function(u,l,f){return this.tree.insert({low:u,high:l,data:f})},s.prototype.remove=function(u,l,f){return this.tree.remove({low:u,high:l,data:f})},s.prototype.search=function(u,l){return this.tree.search(u,l).map(function(f){return f.data})},s.prototype.inOrder=function(){return this.tree.inOrder()},s.prototype.preOrder=function(){return this.tree.preOrder()},Object.defineProperty(s.prototype,"count",{get:function(){return this.tree.count},enumerable:!0,configurable:!0}),s})();Et.default=r;var n=(function(){function s(u){this.stack=[],u!==void 0&&this.push(u)}return s.prototype.next=function(){return this.currentNode===void 0?{done:!0,value:void 0}:this.i<this.currentNode.records.length?{done:!1,value:this.currentNode.records[this.i++]}:(this.currentNode.right!==void 0?this.push(this.currentNode.right):this.pop(),this.next())},s.prototype.push=function(u){for(this.currentNode=u,this.i=0;this.currentNode.left!==void 0;)this.stack.push(this.currentNode),this.currentNode=this.currentNode.left},s.prototype.pop=function(){this.currentNode=this.stack.pop(),this.i=0},s})();Et.InOrder=n,typeof Symbol=="function"&&(n.prototype[Symbol.iterator]=function(){return this});var a=(function(){function s(u){this.stack=[],this.i=0,this.currentNode=u}return s.prototype.next=function(){return this.currentNode===void 0?{done:!0,value:void 0}:this.i<this.currentNode.records.length?{done:!1,value:this.currentNode.records[this.i++]}:(this.currentNode.right!==void 0&&this.push(this.currentNode.right),this.currentNode.left!==void 0&&this.push(this.currentNode.left),this.pop(),this.next())},s.prototype.push=function(u){this.stack.push(u)},s.prototype.pop=function(){this.currentNode=this.stack.pop(),this.i=0},s})();return Et.PreOrder=a,typeof Symbol=="function"&&(a.prototype[Symbol.iterator]=function(){return this}),Et}var li=si(),ui=oi(li),de=(function(){function o(){}return o.findBotInterval=function(i,t,e,r){var n=i.search(t,e);return n.push({pageIndex:0,xLeft:r.margins.left,xRight:r.margins.left,yBot:r.margins.top,absBot:r.margins.top}),n.reduce(function(a,s){return Math.abs(s.xRight-t)<h.EPSILON||Math.abs(s.xLeft-e)<h.EPSILON||s.pageIndex<a.pageIndex?a:s.pageIndex>a.pageIndex||s.yBot>a.yBot?s:a},n[n.length-1])},o.addPack=function(i,t,e){for(var r=i.length;r<=t;r++)i.push([]);i[t].push(e)},o.pack=function(i,t){var e=t.paperHeight-t.margins.top-t.margins.bot,r=[];i.forEach(function(u){r.push([]),u.forEach(function(l){var f;l.height>e+h.EPSILON?(f=r[r.length-1]).push.apply(f,l.unfold()):r[r.length-1].push(l)})}),r.forEach(function(u){u.sort(function(l,f){return l.yTop<f.yTop?-1:l.yTop>f.yTop||l.xLeft>f.xLeft?1:l.xLeft<f.xLeft?-1:0})});var n=0,a=[],s=t.paperHeight-t.margins.bot;return r.forEach(function(u){var l=new ui,f=0;u.forEach(function(d){var b=o.findBotInterval(l,d.xLeft,d.xRight,t),x=b.pageIndex,P=b.yBot,S=b.absBot,O=d.height;d.yTop=P+d.yTop-S,(Math.abs(d.yTop-t.margins.top)>h.EPSILON&&d.yTop+O>s+h.EPSILON||d.isPageBreak)&&(d.yTop=t.margins.top,x++,f=Math.max(f,x)),l.insert(d.xLeft,d.xRight,{pageIndex:x,xLeft:d.xLeft,xRight:d.xRight,yBot:d.yTop+O,absBot:d.yBot}),d.yBot=d.yTop+O,o.addPack(a,n+x,d)}),n+=f+1}),a},o})();A.HorizontalAlign=void 0,(function(o){o.NotSet="notset",o.Left="left",o.Center="center",o.Right="right"})(A.HorizontalAlign||(A.HorizontalAlign={})),A.VerticalAlign=void 0,(function(o){o.NotSet="notset",o.Top="top",o.Middle="middle",o.Bottom="bottom"})(A.VerticalAlign||(A.VerticalAlign={}));var Zt=(function(){function o(i,t,e,r,n){this.packs=i,this.controller=t,this._rect=e,this._countPages=r,this._pageNumber=n}return Object.defineProperty(o.prototype,"pageCount",{get:function(){return this._countPages},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"countPages",{get:function(){return this._countPages},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"pageNumber",{get:function(){return this._pageNumber},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"rect",{get:function(){return this._rect},enumerable:!1,configurable:!0}),o.prototype.alignRect=function(i,t){typeof i.margins>"u"?i.margins={left:0,right:0,top:0,bot:0}:(typeof i.margins.left>"u"&&(i.margins.left=0),typeof i.margins.right>"u"&&(i.margins.right=0),typeof i.margins.top>"u"&&(i.margins.top=0),typeof i.margins.bot>"u"&&(i.margins.bot=0)),typeof i.rect>"u"&&((typeof i.horizontalAlign>"u"||i.horizontalAlign===A.HorizontalAlign.NotSet)&&(i.horizontalAlign=A.HorizontalAlign.Center),(typeof i.verticalAlign>"u"||i.verticalAlign===A.VerticalAlign.NotSet)&&(i.verticalAlign=A.VerticalAlign.Middle));var e=h.clone(this.rect);if(typeof i.horizontalAlign<"u")switch(i.horizontalAlign){case A.HorizontalAlign.Left:e.xLeft=this.rect.xLeft+i.margins.left,e.xRight=Math.min(this.rect.xRight-i.margins.right,this.rect.xLeft+i.margins.left+t.width);break;case A.HorizontalAlign.Center:e.xLeft=Math.max(this.rect.xLeft+i.margins.left,(this.rect.xLeft+this.rect.xRight-t.width)/2),e.xRight=Math.min(this.rect.xRight-i.margins.right,(this.rect.xLeft+this.rect.xRight+t.width)/2);break;case A.HorizontalAlign.Right:e.xLeft=Math.max(this.rect.xLeft+i.margins.left,this.rect.xRight-i.margins.right-t.width),e.xRight=this.rect.xRight-i.margins.right;break}else e.xLeft=i.rect.xLeft||this.rect.xLeft,e.xRight=i.rect.xRight||this.rect.xRight;if(typeof i.verticalAlign<"u")switch(i.verticalAlign){case A.VerticalAlign.Top:e.yTop=this.rect.yTop+i.margins.top,e.yBot=Math.min(this.rect.yBot-i.margins.bot,this.rect.yTop+i.margins.top+t.height);break;case A.VerticalAlign.Middle:e.yTop=Math.max(this.rect.yTop+i.margins.top,(this.rect.yTop+this.rect.yBot-t.height)/2),e.yBot=Math.min(this.rect.yBot-i.margins.bot,(this.rect.yTop+this.rect.yBot+t.height)/2);break;case A.VerticalAlign.Bottom:e.yTop=Math.max(this.rect.yTop+i.margins.top,this.rect.yBot-i.margins.bot-t.height),e.yBot=this.rect.yBot-i.margins.bot;break}else e.yTop=i.rect.yTop||this.rect.yTop,e.yBot=i.rect.yBot||this.rect.yBot;return e},o.prototype.drawText=function(i){i=h.clone(i),typeof i.fontSize>"u"&&(i.fontSize=Xt.FONT_SIZE),typeof i.isBold>"u"&&(i.isBold=!1);var t=this.controller.measureText(i.text,i.isBold?"bold":"normal",i.fontSize),e=this.alignRect(i,t);i.isBold?this.packs.push(new jt(null,this.controller,e,i.text)):this.packs.push(new nt(null,this.controller,e,i.text)),this.packs[this.packs.length-1].fontSize=i.fontSize},o.prototype.drawImage=function(i){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){switch(a.label){case 0:return i=h.clone(i),typeof i.width>"u"&&(i.width=this.rect.xRight-this.rect.xLeft),typeof i.height>"u"&&(i.height=this.rect.yBot-this.rect.yTop),t={width:i.width,height:i.height},e=this.alignRect(i,t),this.controller.pushMargins(0,0),n=(r=this.packs).push,[4,h.createImageFlat(h.createPoint(e,!0,!0),null,this.controller,{link:i.base64,width:e.xRight-e.xLeft,height:e.yBot-e.yTop,objectFit:i.imageFit},!!i.imageFit||this.controller.applyImageFit)];case 1:return n.apply(r,[a.sent()]),this.controller.popMargins(),[2]}})})},o})(),At=(function(o){H(i,o);function i(){return o!==null&&o.apply(this,arguments)||this}return i.prototype.unshift=function(t){this.hasFunc(t)||(this.callbacks==null&&(this.callbacks=new Array),this.callbacks.unshift(t))},i.prototype.fire=function(t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:if(this.callbacks==null)return[2];r=0,n.label=1;case 1:return r<this.callbacks.length?[4,this.callbacks[r](t,e)]:[3,4];case 2:n.sent(),n.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},i})(tt.EventBase),pe=(function(){function o(){}return o.process_header_events=function(i,t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:i.haveCommercialLicense||i.onRenderHeader.add(function(a,s){s.drawText({text:"SurveyJS PDF | Please purchase a SurveyJS PDF developer license to use it in your app | https://surveyjs.io/Buy",fontSize:10})}),r=0,n.label=1;case 1:return r<e.length?[4,i.onRenderHeader.fire(i,new Zt(e[r],t,h.createHeaderRect(t),e.length,r+1))]:[3,5];case 2:return n.sent(),[4,i.onRenderFooter.fire(i,new Zt(e[r],t,h.createFooterRect(t),e.length,r+1))];case 3:n.sent(),n.label=4;case 4:return r++,[3,1];case 5:return[2]}})})},o})(),Ge=(function(o){H(i,o);function i(t,e){var r=o.call(this,t)||this;return r.onRenderHeader=new At,r.onRenderFooter=new At,r.onRenderQuestion=new At,r.onRenderPanel=new At,r.onRenderPage=new At,r.onDocControllerCreated=new tt.EventBase,r.onRenderCheckItemAcroform=new At,r.onRenderRadioGroupWrapAcroform=new At,r.onRenderRadioItemAcroform=new At,typeof e>"u"&&(e={}),r.questionsOnPageMode=="inputPerPage"&&(r.questionsOnPageMode="standard"),r.options=h.clone(e),r}return Object.defineProperty(i.prototype,"haveCommercialLicense",{get:function(){var t=Je.hasLicense;return!!t&&t(2)},set:function(t){console.error("As of v1.9.101, the haveCommercialLicense property is not supported. To activate your license, use the setLicenseKey(key) method as shown on the following page: https://surveyjs.io/remove-alert-banner")},enumerable:!1,configurable:!0}),i.prototype.getUpdatedCheckItemAcroformOptions=function(t){this.onRenderCheckItemAcroform.fire(this,t)},i.prototype.getUpdatedRadioGroupWrapOptions=function(t){this.onRenderRadioGroupWrapAcroform.fire(this,t)},i.prototype.getUpdatedRadioItemAcroformOptions=function(t){this.onRenderRadioItemAcroform.fire(this,t)},i.prototype.correctBricksPosition=function(t,e){t.isRTL&&e.forEach(function(r){r.forEach(function(n){n.translateX(function(a,s){var u=t.paperWidth-a-s;return{xLeft:a+u,xRight:s+u}})})})},i.prototype.renderSurvey=function(t){return F(this,void 0,void 0,function(){var e,r,n,a;return T(this,function(s){switch(s.label){case 0:return this.visiblePages.forEach(function(u){return u.onFirstRendering()}),[4,Dt.generateFlats(this,t)];case 1:return e=s.sent(),this.correctBricksPosition(t,e),r=de.pack(e,t),[4,pe.process_header_events(this,t,r)];case 2:s.sent(),n=0,s.label=3;case 3:if(!(n<r.length))return[3,8];a=0,s.label=4;case 4:return a<r[n].length?(t.getNumberOfPages()===n&&t.addPage(),t.setPage(n),[4,r[n][a].render()]):[3,7];case 5:s.sent(),s.label=6;case 6:return a++,[3,4];case 7:return n++,[3,3];case 8:return h.clear(),[2]}})})},i.prototype.save=function(){return F(this,arguments,void 0,function(t){var e,r,n=this;return t===void 0&&(t="survey_result.pdf"),T(this,function(a){switch(a.label){case 0:return i.currentlySaving?[3,2]:(e=new Lt(this.options),this.onDocControllerCreated.fire(this,{controller:e}),i.currentlySaving=!0,h.fixFont(e),[4,this.renderSurvey(e)]);case 1:return a.sent(),r=e.doc.save(t,{returnPromise:!0}),r.then(function(){i.currentlySaving=!1;var s=i.saveQueue.shift();s&&s()}),[2,r];case 2:i.saveQueue.push(function(){n.save(t)}),a.label=3;case 3:return[2]}})})},i.prototype.raw=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return e=new Lt(this.options),this.onDocControllerCreated.fire(this,{controller:e}),h.fixFont(e),[4,this.renderSurvey(e)];case 1:return r.sent(),[2,e.doc.output(t)]}})})},i.currentlySaving=!1,i.saveQueue=[],i})(tt.SurveyModel),It=(function(o){H(i,o);function i(t,e,r,n){var a=o.call(this,n.question,t,e)||this;return a.fieldName=r,a.context=n,a.question=a.context.question,a.textColor=a.formBorderColor,a}return i.prototype.getShouldRenderReadOnly=function(){return this.context.readOnly&&h.getReadonlyRenderAs(this.question,this.controller)!=="acroform"||this.controller.compress},i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){return t=new this.controller.doc.AcroFormCheckBox,e=h.formScale(this.controller,this),r={},r.maxFontSize=this.height*e*i.FONT_SIZE_SCALE,r.caption=i.CHECKMARK_READONLY_SYMBOL,r.textAlign="center",r.fieldName=this.fieldName,r.readOnly=this.context.readOnly,r.color=this.formBorderColor,r.value=this.context.checked?"On":!1,r.AS=this.context.checked?"/On":"/Off",r.context=this.context,r.Rect=h.createAcroformRect(h.scaleRect(this,e)),this.controller.doc.addField(t),(n=this.question.survey)===null||n===void 0||n.getUpdatedCheckItemAcroformOptions(r),t.maxFontSize=r.maxFontSize,t.caption=r.caption,t.textAlign=r.textAlign,t.fieldName=r.fieldName,t.readOnly=r.readOnly,t.color=r.color,t.value=r.value,t.AS=r.AS,t.Rect=r.Rect,h.renderFlatBorders(this.controller,this),[2]})})},i.prototype.renderReadOnly=function(){return F(this,void 0,void 0,function(){var t,e,r,n,a;return T(this,function(s){switch(s.label){case 0:return h.renderFlatBorders(this.controller,this),this.context.checked?(t=h.createPoint(this,!0,!0),e=this.controller.fontName,this.controller.fontName=i.CHECKMARK_READONLY_FONT,r=this.controller.fontSize,this.controller.fontSize=r*i.CHECKMARK_READONLY_FONT_SIZE_SCALE,n=this.controller.measureText(i.CHECKMARK_READONLY_SYMBOL),t.xLeft+=this.width/2-n.width/2,t.yTop+=this.height/2-n.height/2,[4,h.createTextFlat(t,this.question,this.controller,i.CHECKMARK_READONLY_SYMBOL,nt)]):[3,3];case 1:return a=s.sent(),a.unfold()[0].textColor=this.textColor,this.controller.fontSize=r,[4,a.render()];case 2:s.sent(),this.controller.fontName=e,s.label=3;case 3:return[2]}})})},i.FONT_SIZE_SCALE=.7,i.CHECKMARK_READONLY_SYMBOL="3",i.CHECKMARK_READONLY_FONT="zapfdingbats",i.CHECKMARK_READONLY_FONT_SIZE_SCALE=1-Math.E/10,i})(mt),ge=(function(o){H(i,o);function i(t,e,r){return o.call(this,e,r,t.id,{question:t,readOnly:t.isReadOnly,checked:t.booleanValue})||this}return i})(It),je=(function(){function o(i,t,e){this.name=i,this.controller=t,this.context=e}return o.prototype.addToPdf=function(i){var t;this._radioGroup=new this.controller.doc.AcroFormRadioButton;var e={};e.fieldName=this.name,e.readOnly=this.readOnly,e.color=i,e.context=this.context,(t=this.context.question.survey)===null||t===void 0||t.getUpdatedRadioGroupWrapOptions(e),this._radioGroup.fieldName=e.fieldName,this._radioGroup.readOnly=e.readOnly,this._radioGroup.color=e.color,this._radioGroup.value="",this.controller.doc.addField(this._radioGroup)},Object.defineProperty(o.prototype,"radioGroup",{get:function(){return this._radioGroup},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"readOnly",{get:function(){return this.context.readOnly},enumerable:!1,configurable:!0}),o})(),Jt=(function(o){H(i,o);function i(t,e,r,n){var a=o.call(this,r.question,t,e)||this;return a.context=r,a.radioGroupWrap=n,a.textColor=a.formBorderColor,a}return i.prototype.getShouldRenderReadOnly=function(){return this.radioGroupWrap.readOnly&&h.getReadonlyRenderAs(this.question,this.controller)!=="acroform"||this.controller.compress},i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){return this.context.index==0&&this.radioGroupWrap.addToPdf(this.formBorderColor),t={},t.fieldName=this.radioGroupWrap.name+"index"+this.context.index,e=h.formScale(this.controller,this),t.Rect=h.createAcroformRect(h.scaleRect(this,e)),t.color=this.formBorderColor,t.appearance=this.controller.doc.AcroForm.Appearance.RadioButton.Circle,t.radioGroup=this.radioGroupWrap.radioGroup,t.context=this.context,(n=this.context.question.survey)===null||n===void 0||n.getUpdatedRadioItemAcroformOptions(t),r=this.radioGroupWrap.radioGroup.createOption(t.fieldName),this.context.checked?(t.AS||(r.AS="/"+t.fieldName),this.radioGroupWrap.radioGroup.value||(this.radioGroupWrap.radioGroup.value=t.fieldName)):t.AS||(t.AS="/Off"),r.Rect=t.Rect,r.color=t.color,h.renderFlatBorders(this.controller,this),this.radioGroupWrap.radioGroup.setAppearance(t.appearance),[2]})})},i.prototype.renderReadOnly=function(){return F(this,void 0,void 0,function(){var t,e,r,n,a;return T(this,function(s){switch(s.label){case 0:return h.renderFlatBorders(this.controller,this),this.context.checked?(t=h.createPoint(this,!0,!0),e=this.controller.fontSize,r=this.controller.fontName,this.controller.fontName=i.RADIOMARKER_READONLY_FONT,this.controller.fontSize=e*i.RADIOMARKER_READONLY_FONT_SIZE_SCALE,n=this.controller.measureText(i.RADIOMARKER_READONLY_SYMBOL),t.xLeft+=this.width/2-n.width/2,t.yTop+=this.height/2-n.height/2,[4,h.createTextFlat(t,this.question,this.controller,i.RADIOMARKER_READONLY_SYMBOL,nt)]):[3,3];case 1:return a=s.sent(),a.unfold()[0].textColor=this.textColor,[4,a.render()];case 2:s.sent(),this.controller.fontSize=e,this.controller.fontName=r,s.label=3;case 3:return[2]}})})},i.RADIOMARKER_READONLY_SYMBOL="l",i.RADIOMARKER_READONLY_FONT="zapfdingbats",i.RADIOMARKER_READONLY_FONT_SIZE_SCALE=1-(2+Math.E)/10,i})(mt),$t=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateItemComment=function(t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=this.question.getCommentTextAreaModel(e),[4,h.createCommentFlat(t,this.question,this.controller,{fieldName:r.id,rows:h.OTHER_ROWS_COUNT,value:r.getTextValue(),shouldRenderBorders:tt.settings.readOnlyCommentRenderMode==="textarea",isReadOnly:this.question.isReadOnly,isMultiline:!0})];case 1:return[2,n.sent()]}})})},i.prototype.generateFlatComposite=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d,b,x;return T(this,function(P){switch(P.label){case 0:return n=new D,a=h.createRect(t,this.controller.unitWidth,this.controller.unitHeight),s=this.generateFlatItem(h.moveRect(h.scaleRect(a,h.SELECT_ITEM_FLAT_SCALE),t.xLeft),e,r),n.addBrick(s),u=h.clone(t),u.xLeft=s.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,e.locText.renderedHtml===null?[3,2]:(f=(l=n).addBrick,[4,h.createTextFlat(u,this.question,this.controller,e.locText,nt)]);case 1:f.apply(l,[P.sent()]),P.label=2;case 2:return e.isCommentShowing?(d=h.createPoint(n,!0,!1),d.yTop+=this.controller.unitHeight*h.GAP_BETWEEN_ROWS,x=(b=n).addBrick,[4,this.generateItemComment(d,e)]):[3,4];case 3:x.apply(b,[P.sent()]),P.label=4;case 4:return[2,n]}})})},i.prototype.getVisibleChoices=function(){return this.question.visibleChoices},i.prototype.getColCount=function(){return this.question.colCount},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a;return T(this,function(s){switch(s.label){case 0:return e=this.getColCount(),r=this.getVisibleChoices(),n=e,e!=0?[3,1]:(n=Math.floor(h.getPageAvailableWidth(this.controller)/this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width)||1,r.length<n&&(n=r.length),[3,3]);case 1:return e>1?(n=h.getColumnWidth(this.controller,e)<this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width?1:e,n!=e?[3,3]:[4,this.generateColumns(t)]):[3,3];case 2:return[2,s.sent()];case 3:return n!=1?[3,5]:[4,this.generateVerticallyItems(t,r)];case 4:return a=s.sent(),[3,7];case 5:return[4,this.generateHorisontallyItems(t,n)];case 6:a=s.sent(),s.label=7;case 7:return[2,a]}})})},i.prototype.generateRows=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u,l,f,d,b,x,P,S,O;return T(this,function(et){switch(et.label){case 0:r=this.getVisibleChoices(),n=h.clone(t),a=((O=e[0])!==null&&O!==void 0?O:[]).length,s=[],u=0,l=e,et.label=1;case 1:if(!(u<l.length))return[3,7];f=l[u],d=new D,b=0,et.label=2;case 2:return b<f.length?(x=f[b],this.controller.pushMargins(),h.setColumnMargins(this.controller,a,b),n.xLeft=this.controller.margins.left,[4,this.generateFlatComposite(n,x,r.indexOf(x))]):[3,5];case 3:P=et.sent(),d.addBrick(P),this.controller.popMargins(),et.label=4;case 4:return b++,[3,2];case 5:S=h.createRowlineFlat(h.createPoint(d),this.controller),n.yTop=S.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,s.push(d,S),et.label=6;case 6:return u++,[3,1];case 7:return[2,s]}})})},i.prototype.generateVerticallyItems=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s;return T(this,function(u){switch(u.label){case 0:r=h.clone(t),n=[],a=0,u.label=1;case 1:return a<e.length?[4,this.generateFlatComposite(r,e[a],a)]:[3,4];case 2:s=u.sent(),r.yTop=s.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,n.push(s),u.label=3;case 3:return a++,[3,1];case 4:return[2,n]}})})},i.prototype.generateColumns=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f;return T(this,function(d){switch(d.label){case 0:for(e=this.question.columns,r=e.reduce(function(b,x){return Math.max(b,x.length)},0),n=[],a=0;a<r;a++){for(s=[],u=0,l=e;u<l.length;u++)f=l[u],f[a]&&s.push(f[a]);n.push(s)}return[4,this.generateRows(t,n)];case 1:return[2,d.sent()]}})})},i.prototype.generateHorisontallyItems=function(t,e){return F(this,void 0,void 0,function(){var r,n;return T(this,function(a){switch(a.label){case 0:return r=[],n=this.getVisibleChoices(),n.forEach(function(s,u){var l=Math.floor(u/e),f=u%e;r[l]||(r[l]=[]),r[l][f]=s}),[4,this.generateRows(t,r)];case 1:return[2,a.sent()]}})})},i})(ot),Nt=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.isItemSelected=function(t,e){return typeof e>"u"?t===this.question.otherItem?this.question.isOtherSelected:t.value===this.question.value||typeof this.question.isItemSelected<"u"&&this.question.isItemSelected(t):e},i.prototype.generateFlatItem=function(t,e,r,n,a,s){s===void 0&&(s={}),r===0?(this.radioGroupWrap=new je(this.question.id+(typeof n>"u"?"":n),this.controller,vt({readOnly:this.question.isReadOnly,question:this.question},s)),this.question.pdfRadioGroupWrap=this.radioGroupWrap):typeof this.radioGroupWrap>"u"&&(this.radioGroupWrap=this.question.pdfRadioGroupWrap);var u=this.isItemSelected(e,a);return new Jt(this.controller,t,{question:this.question,index:r,checked:u,item:e},this.radioGroupWrap)},i})($t);Q.getInstance().register("radiogroup",Nt),Q.getInstance().register("buttongroup",Nt);var me=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:return e=new D,r=this.controller.unitHeight,n=new ge(this.question,this.controller,h.moveRect(h.scaleRect(h.createRect(t,r,r),h.SELECT_ITEM_FLAT_SCALE),t.xLeft)),e.addBrick(n),a=h.clone(t),a.xLeft=n.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,s=this.question.isIndeterminate?null:this.question.booleanValue?this.question.locLabelTrue:this.question.locLabelFalse,s!==null&&s.renderedHtml!==null?(l=(u=e).addBrick,[4,h.createTextFlat(a,this.question,this.controller,s,nt)]):[3,2];case 1:l.apply(u,[f.sent()]),f.label=2;case 2:return[2,[e]]}})})},i})(ot),hi=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.buildItems(),n}return i.prototype.buildItems=function(){var t=this.question,e=new tt.ItemValue(t.valueFalse!==void 0?t.valueFalse:!1),r=new tt.ItemValue(t.valueTrue!==void 0?t.valueTrue:!0);e.locOwner=t,e.setLocText(t.locLabelFalse),r.locOwner=t,r.setLocText(t.locLabelTrue),this.items=[e,r]},i.prototype.getVisibleChoices=function(){return this.items},i.prototype.getColCount=function(){return 0},i})(Nt);Q.getInstance().register("boolean",hi),Q.getInstance().register("boolean-checkbox",me);var ye=(function(o){H(i,o);function i(t,e,r,n,a){return o.call(this,e,r,t.id+"index"+a,{question:t,readOnly:t.isReadOnly||!n.isEnabled,item:n,checked:t.isItemSelected(n),index:a})||this}return i})(It),te=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatItem=function(t,e,r){return new ye(this.question,this.controller,t,e,r)},i})($t),ci=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.getVisibleChoices=function(){return this.controller.tagboxSelectedChoicesOnly?this.question.selectedChoices:o.prototype.getVisibleChoices.call(this)},i})(te);Q.getInstance().register("tagbox",ci),Q.getInstance().register("checkbox",te);var ve=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){return e=Q.getInstance().create(this.survey,this.question,this.controller,this.question.getType()),[2,e.generateFlatsContent(t)]})})},i})(ot);Q.getInstance().register("custom_model",ve);var be=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,h.createCommentFlat(t,this.question,this.controller,{rows:this.question.rows,isReadOnly:this.question.isReadOnly,isMultiline:!0,fieldName:this.question.id,placeholder:h.getLocString(this.question.locPlaceHolder),shouldRenderBorders:tt.settings.readOnlyCommentRenderMode==="textarea",value:this.question.value})];case 1:return[2,[e.sent()]]}})})},i})(ot);Q.getInstance().register("comment",be);var Fe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.controller=e,n.question=t,n}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r=this;return T(this,function(n){return t=new this.controller.doc.AcroFormComboBox,t.fieldName=this.question.id,t.Rect=h.createAcroformRect(h.scaleRect(this,h.formScale(this.controller,this))),t.edit=!1,t.color=this.textColor,e=[],this.question.showOptionsCaption&&e.push(this.getCorrectedText(this.question.optionsCaption)),this.question.visibleChoices.forEach(function(a){e.push(r.getCorrectedText(h.getLocString(a.locText)))}),t.setOptions(e),t.fontName=this.controller.fontName,t.fontSize=this.fontSize,t.readOnly=this.question.isReadOnly,t.isUnicode=h.isCustomFont(this.controller,t.fontName),t.V=this.getCorrectedText(this.question.readOnlyText||""),this.controller.doc.addField(t),h.renderFlatBorders(this.controller,this),[2]})})},i})(mt),Te=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateItemComment=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return e=this.question.getCommentTextAreaModel(this.question.selectedItem),[4,h.createCommentFlat(t,this.question,this.controller,{fieldName:e.id,rows:h.OTHER_ROWS_COUNT,value:e.getTextValue(),shouldRenderBorders:tt.settings.readOnlyCommentRenderMode==="textarea",isReadOnly:this.question.isReadOnly,isMultiline:!0})];case 1:return[2,r.sent()]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:return this.shouldRenderAsComment?[3,1]:(r=new Fe(this.question,this.controller,h.createTextFieldRect(t,this.controller)),[3,3]);case 1:return[4,h.createCommentFlat(t,this.question,this.controller,{fieldName:this.question.id,shouldRenderBorders:tt.settings.readOnlyTextRenderMode==="input",value:this.question.readOnlyText||"",isReadOnly:this.question.isReadOnly,placeholder:h.getLocString(this.question.locPlaceholder)})];case 2:r=l.sent(),l.label=3;case 3:return e=r,n=new D(e),this.question.isShowingChoiceComment?(a=h.createPoint(n),a.yTop+=this.controller.unitHeight*h.GAP_BETWEEN_ROWS,u=(s=n).addBrick,[4,this.generateItemComment(a)]):[3,5];case 4:u.apply(s,[l.sent()]),l.label=5;case 5:return[2,[n]]}})})},i})(ot);Q.getInstance().register("dropdown",Te);var xe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,h.createCommentFlat(t,this.question,this.controller,{value:this.question.displayValue,isReadOnly:!0,fieldName:this.question.id,shouldRenderBorders:tt.settings.readOnlyTextRenderMode==="input"})];case 1:return[2,[e.sent()]]}})})},i})(ot);Q.getInstance().register("expression",xe);var Re=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatItem=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:return n=D.bind,[4,h.createLinkFlat(t,this.question,this.controller,e.name===void 0?"image":e.name,typeof e.content=="string"?e.content:"")];case 1:return r=new(n.apply(D,[void 0,l.sent()])),h.canPreviewImage(this.question,e,e.content)?(a=h.createPoint(r),a.yTop+=this.controller.unitHeight*i.IMAGE_GAP_SCALE,u=(s=r).addBrick,[4,h.createImageFlat(a,this.question,this.controller,{link:e.content,width:e.imageSize.width,height:e.imageSize.height,objectFit:i.DEFAULT_IMAGE_FIT})]):[3,3];case 2:u.apply(s,[l.sent()]),l.label=3;case 3:return[2,r]}})})},i.prototype.addLine=function(t,e,r,n){r!==n.length-1&&(t[t.length-1].addBrick(h.createRowlineFlat(e,this.controller)),e.yTop+=h.EPSILON,t.push(new D))},i.prototype.getImagePreviewContentWidth=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){return[2,Math.max(t.imageSize.width,i.TEXT_MIN_SCALE*this.controller.unitWidth)]})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b,x,x;return T(this,function(P){switch(P.label){case 0:return e=this.question.showPreview?this.question.previewValue:this.question.value,!e||e.length===0?[4,h.createTextFlat(t,this.question,this.controller,this.question.noFileChosenCaption,nt)]:[3,2];case 1:return[2,[P.sent()]];case 2:r=[new D],n=h.clone(t),a=n.yTop,s=0,P.label=3;case 3:return s<e.length?(u=vt({},e[s]),l=h.canPreviewImage(this.question,u,u.content),l?(f=u,[4,h.getCorrectedImageSize(this.controller,{imageWidth:this.question.imageWidth,imageHeight:this.question.imageHeight,imageLink:e[s].content,defaultImageWidth:200,defaultImageHeight:150})]):[3,5]):[3,12];case 4:f.imageSize=P.sent(),P.label=5;case 5:return d=this.controller.paperWidth-this.controller.margins.right-n.xLeft,l?[4,this.getImagePreviewContentWidth(u)]:[3,8];case 6:return b=P.sent(),d<b&&(n.xLeft=t.xLeft,n.yTop=a,this.addLine(r,n,s,e)),this.controller.pushMargins(n.xLeft,this.controller.paperWidth-n.xLeft-b),[4,this.generateFlatItem(n,u)];case 7:return x=P.sent(),r[r.length-1].addBrick(x),n.xLeft+=x.width,a=Math.max(a,x.yBot),this.controller.popMargins(),[3,10];case 8:return d<this.controller.unitWidth&&(n.xLeft=t.xLeft,n.yTop=a,this.addLine(r,n,s,e)),[4,this.generateFlatItem(n,u)];case 9:x=P.sent(),r[r.length-1].addBrick(x),n.xLeft+=x.xRight-x.xLeft,a=Math.max(a,x.yBot),P.label=10;case 10:n.xLeft+=this.controller.unitWidth,P.label=11;case 11:return s++,[3,3];case 12:return[2,r]}})})},i.IMAGE_GAP_SCALE=.195,i.TEXT_MIN_SCALE=5,i.DEFAULT_IMAGE_FIT="contain",i})(ot);Q.getInstance().register("file",Re);var we=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n}return i.prototype.chooseRender=function(t){return/<[^>]*style[^<]*>/.test(t)||/<[^>]*table[^<]*>/.test(t)||/&\w+;/.test(t)?"image":"standard"},i.prototype.correctHtml=function(t){return i.correctHtmlRules.forEach(function(e){t=t.replace(e.searchRegExp,e.replaceString)}),t},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b;return T(this,function(x){switch(x.label){case 0:return e=this.question.renderAs,h.hasDocument?(e==="auto"&&(e=this.controller.htmlRenderAs),e==="auto"&&(e=this.chooseRender(h.getLocString(this.question.locHtml))),r=h.createHtmlContainerBlock(h.getLocString(this.question.locHtml),this.controller,e),e!=="image"?[3,3]:(n=h.getPageAvailableWidth(this.controller),[4,h.htmlToImage(r,n,this.controller)])):[2,[new Ht(h.createRect(t,0,0))]];case 1:return a=x.sent(),s=a.url,u=a.aspect,l=n/u,[4,h.createImageFlat(t,this.question,this.controller,{link:s,width:n,height:l})];case 2:return[2,[x.sent()]];case 3:return d=(f=h).splitHtmlRect,b=[this.controller],[4,h.createHTMLFlat(t,this.question,this.controller,this.correctHtml(r))];case 4:return[2,[d.apply(f,b.concat([x.sent()]))]]}})})},i.correctHtmlRules=[{searchRegExp:/(<\/?br\s*?\/?\s*?>\s*){2,}/g,replaceString:"<br>"}],i})(ot);tt.Serializer.removeProperty("html","renderAs"),tt.Serializer.addProperty("html",{name:"renderAs",default:"auto",visible:!1,choices:["auto","standard","image"]}),Q.getInstance().register("html",we);var Pe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.getCorrectImageSize=function(){return F(this,void 0,void 0,function(){return T(this,function(t){switch(t.label){case 0:return[4,h.getCorrectedImageSize(this.controller,{imageWidth:this.question.imageWidth,imageHeight:this.question.imageHeight,imageLink:this.question.imageLink})];case 1:return[2,t.sent()]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return[4,this.getCorrectImageSize()];case 1:return e=r.sent(),[4,h.createImageFlat(t,this.question,this.controller,{link:this.question.imageLink,width:e.width,height:e.height})];case 2:return[2,[r.sent()]]}})})},i})(ot);Q.getInstance().register("image",Pe);var Ce=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatItem=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return n=h.getPageAvailableWidth(this.controller),[4,h.createImageFlat(t,this.question,this.controller,{link:e.imageLink,width:n,height:n/h.IMAGEPICKER_RATIO,objectFit:this.question.imageFit})];case 1:return a=b.sent(),s=new D(a),u=h.createPoint(s),this.question.showLabel?[4,h.createTextFlat(u,this.question,this.controller,e.text||e.value,nt)]:[3,3];case 2:l=b.sent(),s.addBrick(l),u=h.createPoint(l),b.label=3;case 3:return f=this.controller.unitHeight,d=h.createRect(u,n,f),this.question.multiSelect?s.addBrick(new It(this.controller,d,this.question.id+"index"+r,{readOnly:this.question.isReadOnly||!e.isEnabled,question:this.question,item:e,checked:this.question.value.indexOf(e.value)!==-1,index:r})):s.addBrick(this.radio.generateFlatItem(d,e,r)),[2,s]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b,x,P;return T(this,function(S){switch(S.label){case 0:this.radio=this.question.multiSelect?null:new Nt(this.survey,this.question,this.controller),e=[new D],r=h.getImagePickerAvailableWidth(this.controller)/h.IMAGEPICKER_COUNT,n=~~(h.getPageAvailableWidth(this.controller)/r)||1,a=this.question.visibleChoices.length,n=n<=a?n:a,s=~~Math.ceil(a/n),u=h.clone(t),l=0,S.label=1;case 1:if(!(l<s))return[3,7];f=u.yTop,this.controller.pushMargins(),d=this.controller.margins.left,b=0,S.label=2;case 2:return b<n?(x=l*n+b,x==a?[3,5]:(this.controller.margins.left=d,this.controller.margins.right=this.controller.paperWidth-d-r,d=this.controller.paperWidth-this.controller.margins.right+this.controller.unitWidth,u.xLeft=this.controller.margins.left,[4,this.generateFlatItem(u,this.question.visibleChoices[x],x)])):[3,5];case 3:P=S.sent(),e[e.length-1].addBrick(P),f=Math.max(f,P.yBot),S.label=4;case 4:return b++,[3,2];case 5:this.controller.popMargins(),u.xLeft=t.xLeft,u.yTop=f,l!==s-1&&(e[e.length-1].addBrick(h.createRowlineFlat(u,this.controller)),u.yTop+=h.EPSILON,e.push(new D)),S.label=6;case 6:return l++,[3,1];case 7:return[2,e]}})})},i})(ot);Q.getInstance().register("imagepicker",Ce);var _e=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:e=[],r=h.clone(t),n=0,a=this.question.panels,l.label=1;case 1:return n<a.length?(s=a[n],[4,Dt.generateFlatsPanel(this.survey,this.controller,s,r)]):[3,4];case 2:u=l.sent(),u.length!==0&&(r.yTop=h.mergeRects.apply(h,u).yBot,r.yTop+=this.controller.unitHeight*i.GAP_BETWEEN_PANELS,e.push.apply(e,u)),l.label=3;case 3:return n++,[3,1];case 4:return[2,e]}})})},i.GAP_BETWEEN_PANELS=.75,i})(ot);Q.getInstance().register("paneldynamic",_e);var Be=(function(o){H(i,o);function i(t,e,r,n){var a=o.call(this,t,e,r)||this;return a.mark=n,a.question=t,a.textColor=a.formBorderColor,a}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r,n;return T(this,function(a){switch(a.label){case 0:return h.renderFlatBorders(this.controller,this),t=h.createPoint(this,!0,!0),e=this.controller.fontSize,this.controller.fontSize=e*It.CHECKMARK_READONLY_FONT_SIZE_SCALE,r=this.controller.measureText(this.mark),t.xLeft+=this.width/2-r.width/2,t.yTop+=this.height/2-r.height/2,[4,h.createTextFlat(t,this.question,this.controller,this.mark,nt)];case 1:return n=a.sent(),n.unfold()[0].textColor=this.textColor,this.controller.fontSize=e,[4,n.render()];case 2:return a.sent(),[2]}})})},i})(mt),Ve=(function(o){H(i,o);function i(t,e,r,n,a){var s=o.call(this,void 0,t,e)||this;return s.color=r,s.renderWidth=n,s.renderHeight=a,s}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t,e,r;return T(this,function(n){return t=this.controller.doc.getFillColor(),this.controller.doc.setFillColor(this.color||"black"),this.controller.doc.rect(this.xLeft,this.yTop,(e=this.renderWidth)!==null&&e!==void 0?e:this.width,(r=this.renderHeight)!==null&&r!==void 0?r:this.height,"F"),this.controller.doc.setFillColor(t),[2]})})},i})(mt),Ee=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatComposite=function(t,e,r){return F(this,arguments,void 0,function(n,a,s,u){var l,f,d,b,x;return u===void 0&&(u=!1),T(this,function(P){switch(P.label){case 0:return l=h.createRect(n,this.controller.unitWidth,this.controller.unitHeight),f=h.moveRect(h.scaleRect(l,h.SELECT_ITEM_FLAT_SCALE),n.xLeft),d=new Be(this.question,this.controller,f,u?"-":this.question.getNumberByIndex(s)),b=h.clone(n),b.xLeft=d.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,[4,h.createTextFlat(b,this.question,this.controller,a.locText,nt)];case 1:return x=P.sent(),[2,new D(d,x)]}})})},i.prototype.generateChoicesColumn=function(t,e){return F(this,arguments,void 0,function(r,n,a){var s,u,l,f;return a===void 0&&(a=!1),T(this,function(d){switch(d.label){case 0:s=h.clone(r),u=[],l=0,d.label=1;case 1:return l<n.length?[4,this.generateFlatComposite(s,n[l],l,a)]:[3,4];case 2:f=d.sent(),s.yTop=f.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,u.push(f),d.label=3;case 3:return l++,[3,1];case 4:return[2,u]}})})},i.prototype.generateSelectToRankItemsVertically=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return e=h.clone(t),r=[],this.question.rankingChoices.length===0?[3,2]:(a=(n=r.push).apply,s=[r],[4,this.generateChoicesColumn(e,this.question.rankingChoices)]);case 1:a.apply(n,s.concat([b.sent()])),e.yTop=r[r.length-1].yBot+2*(h.GAP_BETWEEN_ROWS*this.controller.unitHeight),b.label=2;case 2:return u=h.createRect({xLeft:e.xLeft,yTop:e.yTop-h.GAP_BETWEEN_ROWS*this.controller.unitHeight-.5},this.controller.paperWidth-this.controller.margins.right-e.xLeft,1),r.push(new Ve(this.controller,u,h.FORM_BORDER_COLOR)),f=(l=r.push).apply,d=[r],[4,this.generateChoicesColumn(e,this.question.unRankingChoices,!0)];case 3:return f.apply(l,d.concat([b.sent()])),[2,r]}})})},i.prototype.generateSelectToRankItemsHorizontally=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l,f,d,b,x,P,S;return T(this,function(O){switch(O.label){case 0:e=2,r=h.clone(t),n=[],a=Math.max(this.question.unRankingChoices.length,this.question.rankingChoices.length),s=new D,u=0,O.label=1;case 1:if(!(u<a))return[3,8];l=0,f=0,d=[this.question.unRankingChoices[u],this.question.rankingChoices[u]],O.label=2;case 2:return f<d.length?(b=d[f],b?(this.controller.pushMargins(this.controller.margins.left,this.controller.margins.right),h.setColumnMargins(this.controller,e,l),r.xLeft=this.controller.margins.left,[4,this.generateFlatComposite(r,b,u,l==0)]):[3,4]):[3,6];case 3:x=O.sent(),s.addBrick(x),this.controller.popMargins(),O.label=4;case 4:l++,O.label=5;case 5:return f++,[3,2];case 6:P=h.createRowlineFlat(h.createPoint(s),this.controller),n.push(s,P),S=h.createRect({xLeft:this.controller.margins.left+h.getPageAvailableWidth(this.controller)/2-.5,yTop:r.yTop},0,0),s.addBrick(new Ve(this.controller,S,h.FORM_BORDER_COLOR,1,P.yBot-r.yTop+(u!==a-1?h.GAP_BETWEEN_ROWS*this.controller.unitHeight:0))),r.yTop=P.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,s=new D,O.label=7;case 7:return u++,[3,1];case 8:return[2,n]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){return this.question.selectToRankEnabled?this.question.selectToRankAreasLayout=="vertical"?[2,this.generateSelectToRankItemsVertically(t)]:[2,this.generateSelectToRankItemsHorizontally(t)]:[2,this.generateChoicesColumn(t,this.question.rankingChoices)]})})},i})(ot);Q.getInstance().register("ranking",Ee);var Ae=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.questionRating=e,n}return i.prototype.generateFlatHorisontalComposite=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return n=h.getRatingItemText(this.questionRating,r,e.locText),this.controller.pushMargins(),a=this.controller.unitWidth/2,this.controller.margins.left+=a,this.controller.margins.right+=a,s=h.clone(t),s.xLeft+=a,l=D.bind,[4,h.createBoldTextFlat(s,this.questionRating,this.controller,n)];case 1:return u=new(l.apply(D,[void 0,b.sent()])),this.controller.popMargins(),f=u.width,f<h.getRatingMinWidth(this.controller)?(u.xLeft+=(h.getRatingMinWidth(this.controller)-f)/2-a,f=h.getRatingMinWidth(this.controller)):f+=this.controller.unitWidth,d=h.createPoint(u),d.xLeft=t.xLeft,u.addBrick(this.generateFlatItem(h.createRect(d,f,this.controller.unitHeight),e,r,void 0,this.question.value==e.value)),[2,u]}})})},i.prototype.generateFlatComposite=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d,b;return T(this,function(x){switch(x.label){case 0:return n=new D,a=h.createRect(t,this.controller.unitHeight,this.controller.unitHeight),s=this.generateFlatItem(h.moveRect(h.scaleRect(a,h.SELECT_ITEM_FLAT_SCALE),t.xLeft),e,r,void 0,this.question.value==e.value),n.addBrick(s),u=h.clone(t),u.xLeft=s.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,l=h.getRatingItemText(this.questionRating,r,e.locText),f=l==null,f?[3,2]:(b=(d=n).addBrick,[4,h.createTextFlat(u,this.question,this.controller,l,nt)]);case 1:f=b.apply(d,[x.sent()]),x.label=2;case 2:return[2,n]}})})},i.prototype.generateHorisontallyItems=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s;return T(this,function(u){switch(u.label){case 0:e=[new D],r=h.clone(t),n=0,u.label=1;case 1:return n<this.questionRating.visibleRateValues.length?[4,this.generateFlatHorisontalComposite(r,this.questionRating.visibleRateValues[n],n)]:[3,4];case 2:a=u.sent(),e[e.length-1].addBrick(a),s=this.controller.paperWidth-this.controller.margins.right-a.xRight,h.getRatingMinWidth(this.controller)<=s+h.EPSILON?r.xLeft=a.xRight:(r.xLeft=t.xLeft,r.yTop=a.yBot,n!==this.questionRating.visibleRateValues.length-1&&(e[e.length-1].addBrick(h.createRowlineFlat(r,this.controller)),r.yTop+=h.EPSILON,e.push(new D))),u.label=3;case 3:return n++,[3,1];case 4:return[2,e]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n;return T(this,function(a){for(e=!1,r=0;r<this.questionRating.visibleRateValues.length;r++)n=h.getRatingItemText(this.questionRating,r,this.questionRating.visibleRateValues[r].locText),this.controller.measureText(n).width>this.controller.measureText(h.RATING_COLUMN_WIDTH).width&&(e=!0);return[2,e?this.generateVerticallyItems(t,this.questionRating.visibleRateValues):this.generateHorisontallyItems(t)]})})},i})(Nt);Q.getInstance().register("rating",Ae);var Se=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,u,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:return e=h.clone(t),this.question.sliderType!=="single"?[3,2]:(u=this.getOptionsByValue(this.question.value),[4,this.generateInputBrick(e,u)]);case 1:return r=f.sent(),[2,[r]];case 2:if(this.question.sliderType!=="range")return[3,7];n=new D,a=0,f.label=3;case 3:return a<this.question.value.length?(s=this.question.value[a],u=this.getOptionsByValue(s),[4,this.generateColumnInput(e,u,2,a)]):[3,6];case 4:l=f.sent(),n.addBrick(l),f.label=5;case 5:return a++,[3,3];case 6:return[2,[n]];case 7:return[2]}})})},i.prototype.getOptionsByValue=function(t){var e=this.question,r=e.id,n=e.isReadOnly;return{fieldName:r,inputType:"number",value:t,isReadOnly:n,shouldRenderBorders:!0}},i.prototype.generateInputBrick=function(t,e){return F(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return this.shouldRenderAsComment?[3,1]:(r=h.createTextFieldRect(t,this.controller),[2,new Vt(this.question,this.controller,r,vt({},e))]);case 1:return[4,h.createCommentFlat(t,this.question,this.controller,vt({},e))];case 2:return[2,n.sent()]}})})},i.prototype.generateColumnInput=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s;return T(this,function(u){switch(u.label){case 0:return this.controller.pushMargins(),h.setColumnMargins(this.controller,r,n),a=h.clone(t),a.xLeft=this.controller.margins.left,[4,this.generateInputBrick(a,e)];case 1:return s=u.sent(),this.controller.popMargins(),[2,s]}})})},i})(ot);Q.getInstance().register("slider",Se);var Le=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return Object.defineProperty(i.prototype,"signatureSize",{get:function(){if(!this._signatureSize){var t=h.pxToPt(this.question.signatureWidth),e=h.pxToPt(this.question.signatureHeight),r=h.getPageAvailableWidth(this.controller);if(t>r){var n=r;e*=n/t,t=n}this._signatureSize={width:t,height:e}}return this._signatureSize},enumerable:!1,configurable:!0}),i.prototype.generateBackgroundImage=function(t){return F(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,h.createImageFlat(t,this.question,this.controller,vt(vt({link:this.question.backgroundImage},this.signatureSize),{objectFit:"cover"}),!0)];case 1:return[2,e.sent()]}})})},i.prototype.getSignImageUrl=function(){return this.question.storeDataAsText||!this.question.loadedData?this.question.value:this.question.loadedData},i.prototype.generateSign=function(t){return F(this,void 0,void 0,function(){var e,r=this;return T(this,function(n){switch(n.label){case 0:return this.question.value?[4,h.createImageFlat(t,this.question,this.controller,vt({link:this.getSignImageUrl()},this.signatureSize),!1)]:[3,2];case 1:return e=n.sent(),[3,3];case 2:e=new Ht(h.createRect(t,this.signatureSize.width,this.signatureSize.height)),n.label=3;case 3:return i.BORDER_STYLE!=="none"&&(e.afterRenderCallback=function(){var a={height:e.width,width:e.width,yTop:e.yTop,yBot:e.yBot,xLeft:e.xLeft,xRight:e.xRight,formBorderColor:e.formBorderColor,rounded:!1,outside:!0,dashStyle:i.BORDER_STYLE=="dashed"?{dashArray:[5],dashPhase:0}:void 0};h.renderFlatBorders(r.controller,a)}),[2,e]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s;return T(this,function(u){switch(u.label){case 0:return e=new D,this.question.backgroundImage?(n=(r=e).addBrick,[4,this.generateBackgroundImage(t)]):[3,2];case 1:n.apply(r,[u.sent()]),u.label=2;case 2:return s=(a=e).addBrick,[4,this.generateSign(t)];case 3:return s.apply(a,[u.sent()]),[2,[e]]}})})},i.BORDER_STYLE="dashed",i})(ot);Q.getInstance().register("signaturepad",Le);var Ie=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.question=e,n}return i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:return e={fieldName:this.question.id,inputType:this.question.inputType,value:this.question.inputValue,isReadOnly:this.question.isReadOnly,shouldRenderBorders:tt.settings.readOnlyTextRenderMode==="input",placeholder:h.getLocString(this.question.locPlaceHolder)},this.shouldRenderAsComment?[4,h.createCommentFlat(t,this.question,this.controller,vt({rows:i.MULTILINE_TEXT_ROWS_COUNT,isMultiline:!0},e))]:(r=h.createTextFieldRect(t,this.controller),[2,[new Vt(this.question,this.controller,r,vt({},e))]]);case 1:return[2,[n.sent()]]}})})},i.MULTILINE_TEXT_ROWS_COUNT=1,i})(ot);Q.getInstance().register("text",Ie);var Ne=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.generateFlatsHeader=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:e=[],r=h.clone(t),this.question.hasRows&&(r.xLeft+=this.rowTitleWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS),n=0,l.label=1;case 1:return n<this.question.visibleColumns.length?(this.controller.pushMargins(),this.controller.margins.left=r.xLeft,this.controller.margins.right+=h.getPageAvailableWidth(this.controller)-this.columnWidth,s=(a=e).push,[4,h.createBoldTextFlat(r,this.question,this.controller,this.question.visibleColumns[n].locText)]):[3,4];case 2:s.apply(a,[l.sent()]),r.xLeft+=this.columnWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.popMargins(),l.label=3;case 3:return n++,[3,1];case 4:return u=new(D.bind.apply(D,_t([void 0],e,!1))),[2,[u,h.createRowlineFlat(h.createPoint(u),this.controller)]]}})})},i.prototype.generateFlatsRows=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:r=[],n=h.clone(t),a=0,l.label=1;case 1:return a<this.question.visibleRows.length?(s="row"+a,[4,new fi(this.survey,this.question,this.controller,this.question.visibleRows[a],a,s,a==0,e,this.rowTitleWidth,this.columnWidth).generateFlatsContent(n)]):[3,4];case 2:u=l.sent(),n=h.createPoint(h.mergeRects.apply(h,u)),n.yTop+=this.controller.unitHeight*i.GAP_BETWEEN_ROWS,r.push.apply(r,u),l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},i.prototype.calculateColumnsWidthes=function(){var t=h.getPageAvailableWidth(this.controller);this.question.hasRows&&this.question.rowTitleWidth?(this.controller.pushMargins(),this.rowTitleWidth=h.parseWidth(this.question.rowTitleWidth,t),this.controller.margins.left+=this.rowTitleWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.columnWidth=h.getColumnWidth(this.controller,this.question.visibleColumns.length),this.controller.popMargins()):this.columnWidth=this.rowTitleWidth=h.getColumnWidth(this.controller,this.question.visibleColumns.length+(this.question.hasRows?1:0))},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:return this.calculateColumnsWidthes(),e=this.question.renderAs==="list"||this.controller.matrixRenderAs==="list"||this.columnWidth<this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width,r=h.clone(t),n=[],!e&&this.question.showHeader&&this.question.visibleColumns.length!=0?[4,this.generateFlatsHeader(r)]:[3,2];case 1:a=f.sent(),r=h.createPoint(h.mergeRects.apply(h,a)),r.yTop+=i.GAP_BETWEEN_ROWS*this.controller.unitHeight,n.push.apply(n,a),f.label=2;case 2:return u=(s=n.push).apply,l=[n],[4,this.generateFlatsRows(r,e)];case 3:return u.apply(s,l.concat([f.sent()])),[2,n]}})})},i.GAP_BETWEEN_ROWS=.5,i})(ot),fi=(function(){function o(i,t,e,r,n,a,s,u,l,f){s===void 0&&(s=!1),u===void 0&&(u=!1),this.survey=i,this.question=t,this.controller=e,this.row=r,this.rowIndex=n,this.key=a,this.isFirst=s,this.isVertical=u,this.rowTitleWidth=l,this.columnWidth=f}return o.prototype.generateFlatsContent=function(i){return F(this,void 0,void 0,function(){var t;return T(this,function(e){switch(e.label){case 0:return this.isVertical?[4,this.generateFlatsVerticallyCells(i)]:[3,2];case 1:return t=e.sent(),[3,4];case 2:return[4,this.generateFlatsHorizontallyCells(i)];case 3:t=e.sent(),e.label=4;case 4:return[2,t]}})})},o.prototype.generateFlatItem=function(i,t,e,r,n){n===void 0&&(n={});var a=this.question.id+r,s=this.row.isChecked(t);return this.question.isMultiSelect?new It(this.controller,i,a+"index"+e,{question:this.question,index:e,checked:s,item:t,readOnly:this.question.isReadOnly}):(e===0?(this.radioGroupWrap=new je(a,this.controller,vt({readOnly:this.question.isReadOnly,question:this.question},n)),this.question.pdfRadioGroupWrap=this.radioGroupWrap):typeof this.radioGroupWrap>"u"&&(this.radioGroupWrap=this.question.pdfRadioGroupWrap),new Jt(this.controller,i,{question:this.question,index:e,checked:s,item:t},this.radioGroupWrap))},o.prototype.generateTextComposite=function(i,t,e){return F(this,void 0,void 0,function(){var r,n,a,s;return T(this,function(u){switch(u.label){case 0:return r=h.clone(i),n=h.createRect(r,h.getPageAvailableWidth(this.controller),this.controller.unitHeight),a=this.generateFlatItem(n,t,e,this.key,{row:this.row,rowIndex:this.rowIndex}),r.yTop=a.yBot+this.controller.unitHeight*h.GAP_BETWEEN_ITEM_TEXT,[4,h.createTextFlat(r,this.question,this.controller,this.question.getCellDisplayLocText(this.row.name,t),nt)];case 1:return s=u.sent(),[2,new D(a,s)]}})})},o.prototype.generateItemComposite=function(i,t,e){return F(this,void 0,void 0,function(){var r,n,a,s;return T(this,function(u){switch(u.label){case 0:return r=h.clone(i),n=h.createRect(r,this.controller.unitHeight,this.controller.unitHeight),a=this.generateFlatItem(h.moveRect(h.scaleRect(n,h.SELECT_ITEM_FLAT_SCALE),n.xLeft),t,e,this.key,{row:this.row,rowIndex:this.rowIndex}),r.xLeft=a.xRight+this.controller.unitWidth*h.GAP_BETWEEN_ITEM_TEXT,[4,h.createTextFlat(r,this.question,this.controller,t.locText,nt)];case 1:return s=u.sent(),[2,new D(a,s)]}})})},o.prototype.generateFlatsHorizontallyCells=function(i){return F(this,void 0,void 0,function(){var t,e,r,n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:return t=[],e=h.clone(i),this.question.hasRows?(this.controller.pushMargins(),e.xLeft=this.controller.margins.left,this.controller.margins.right+=h.getPageAvailableWidth(this.controller)-this.rowTitleWidth,n=(r=t).push,[4,h.createTextFlat(e,this.question,this.controller,this.row.locText,nt)]):[3,2];case 1:n.apply(r,[b.sent()]),e.xLeft+=this.rowTitleWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.popMargins(),b.label=2;case 2:a=0,b.label=3;case 3:return a<this.question.visibleColumns.length?(s=this.question.visibleColumns[a],this.row.value==s.value,this.controller.pushMargins(),this.controller.margins.left=e.xLeft,this.controller.margins.right+=h.getPageAvailableWidth(this.controller)-this.columnWidth,this.question.hasCellText?(l=(u=t).push,[4,this.generateTextComposite(e,s,a)]):[3,5]):[3,8];case 4:return l.apply(u,[b.sent()]),[3,6];case 5:f=h.createRect(e,this.controller.unitHeight,this.controller.unitHeight),t.push(this.generateFlatItem(h.moveRect(h.scaleRect(f,h.SELECT_ITEM_FLAT_SCALE),e.xLeft),s,a,this.key,{row:this.row,rowIndex:this.rowIndex})),b.label=6;case 6:e.xLeft+=this.columnWidth+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.popMargins(),b.label=7;case 7:return a++,[3,3];case 8:return d=new(D.bind.apply(D,_t([void 0],t,!1))),[2,[d,h.createRowlineFlat(h.createPoint(d),this.controller)]]}})})},o.prototype.generateFlatsVerticallyCells=function(i){return F(this,void 0,void 0,function(){var t,e,r,n,a,s,u;return T(this,function(l){switch(l.label){case 0:return t=[],e=h.clone(i),this.question.hasRows?[4,h.createTextFlat(e,this.question,this.controller,this.row.locText,nt)]:[3,2];case 1:r=l.sent(),e.yTop=r.yBot+ot.CONTENT_GAP_VERT_SCALE*this.controller.unitHeight,t.push(r),l.label=2;case 2:return a=(n=t.push).apply,s=[t],[4,this.generateVerticallyItems(e,this.question.visibleColumns)];case 3:return a.apply(n,s.concat([l.sent()])),u=new(D.bind.apply(D,_t([void 0],t,!1))),[2,[u,h.createRowlineFlat(h.createPoint(u),this.controller)]]}})})},o.prototype.generateVerticallyItems=function(i,t){return F(this,void 0,void 0,function(){var e,r,n,a;return T(this,function(s){switch(s.label){case 0:e=h.clone(i),r=[],n=0,s.label=1;case 1:return n<t.length?[4,(this.question.hasCellText?this.generateTextComposite:this.generateItemComposite).call(this,e,t[n],n)]:[3,4];case 2:a=s.sent(),e.yTop=a.yBot+h.GAP_BETWEEN_ROWS*this.controller.unitHeight,r.push(a),s.label=3;case 3:return n++,[3,1];case 4:return[2,r]}})})},o})();tt.Serializer.removeProperty("matrix","renderAs"),tt.Serializer.addProperty("matrix",{name:"renderAs",default:"auto",visible:!1,choices:["auto","list"]}),Q.getInstance().register("matrix",Ne);var ee=(function(o){H(i,o);function i(t,e,r,n){n===void 0&&(n=!0);var a=o.call(this,t,e,r)||this;return a.survey=t,a.isMultiple=n,a.question=e,a}return Object.defineProperty(i.prototype,"visibleRows",{get:function(){return this.visibleRowsValue||(this.visibleRowsValue=this.question.renderedTable.rows.filter(function(t){return t.visible})),this.visibleRowsValue},enumerable:!1,configurable:!0}),i.prototype.generateFlatsCellTitle=function(t,e){return F(this,void 0,void 0,function(){var r,n,a;return T(this,function(s){switch(s.label){case 0:return r=new D,a=(n=r).addBrick,[4,h.createTextFlat(t,this.question,this.controller,e,nt)];case 1:return a.apply(n,[s.sent()]),[2,r]}})})},i.prototype.generateFlatsCell=function(t,e,r){return F(this,arguments,void 0,function(n,a,s,u){var l,f,d,b,x,P,S,O,et,K;return u===void 0&&(u=!0),T(this,function(V){switch(V.label){case 0:return l=new D,a.hasQuestion?s=="footer"&&!a.question.isAnswered?[3,4]:[3,1]:[3,5];case 1:return u&&a.isChoice?(f=Q.getInstance().create(this.survey,a.question,this.controller,a.question.getType()),d=h.moveRect(h.scaleRect(h.createRect(n,this.controller.unitHeight,this.controller.unitHeight),h.SELECT_ITEM_FLAT_SCALE),n.xLeft),l.addBrick(f.generateFlatItem(d,a.item,a.choiceIndex)),[3,4]):[3,2];case 2:return a.question.titleLocation=h.TITLE_LOCATION_MATRIX,x=(b=l.addBrick).apply,P=[l],[4,h.generateQuestionFlats(this.survey,this.controller,a.question,n)];case 3:x.apply(b,P.concat([V.sent()])),V.label=4;case 4:return[3,9];case 5:return a.hasTitle?s!="header"?[3,7]:(O=(S=l).addBrick,[4,h.createBoldTextFlat(n,this.question,this.controller,a.locTitle)]):[3,9];case 6:return O.apply(S,[V.sent()]),[3,9];case 7:return K=(et=l).addBrick,[4,h.createTextFlat(n,this.question,this.controller,a.locTitle,nt)];case 8:K.apply(et,[V.sent()]),V.label=9;case 9:return[2,l]}})})},Object.defineProperty(i.prototype,"hasDetailPanel",{get:function(){var t=this;return this.visibleRows.some(function(e){return e.row&&t.question.hasDetailPanel(e.row)})},enumerable:!1,configurable:!0}),i.prototype.ignoreCell=function(t,e,r,n){return n===void 0&&(n=!0),!n&&r=="footer"&&t.hasQuestion&&!t.question.isAnswered?!0:!(t.hasQuestion||t.hasTitle||this.isMultiple&&(this.hasDetailPanel?e==1:e==0))},i.prototype.getRowLocation=function(t){return t===this.question.renderedTable.headerRow?"header":this.question.renderedTable.footerRow===t?"footer":void 0},i.prototype.generateFlatsRowHorisontal=function(t,e,r){return F(this,void 0,void 0,function(){var n,a,s,u,l,f,d;return T(this,function(b){switch(b.label){case 0:n=new D,a=h.clone(t),s=this.controller.paperWidth-this.controller.margins.left+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.pushMargins(),u=0,l=this.getRowLocation(e),f=0,b.label=1;case 1:return f<e.cells.length?this.ignoreCell(e.cells[f],f,l)?[3,3]:(this.controller.margins.left=this.controller.paperWidth-s+this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS,this.controller.margins.right=this.controller.paperWidth-this.controller.margins.left-r[u],s=this.controller.margins.right,a.xLeft=this.controller.margins.left,[4,this.generateFlatsCell(a,e.cells[f],l)]):[3,4];case 2:d=b.sent(),d.isEmpty||n.addBrick(d),u++,b.label=3;case 3:return f++,[3,1];case 4:return this.controller.popMargins(),[2,n]}})})},i.prototype.generateFlatsRowVertical=function(t,e){return F(this,void 0,void 0,function(){var r,n,a,s,u,l,f,d,b,x;return T(this,function(P){switch(P.label){case 0:r=new D,n=h.clone(t),a=this.getRowLocation(e),s=0,P.label=1;case 1:return s<e.cells.length?this.ignoreCell(e.cells[s],s,a,!1)?[3,5]:this.question.renderedTable.showHeader&&(!this.isMultiple||s>0)&&(!((x=(b=e.cells[s].cell)===null||b===void 0?void 0:b.column)===null||x===void 0)&&x.locTitle)?(l=(u=r).addBrick,[4,this.generateFlatsCellTitle(n,e.cells[s].cell.column.locTitle)]):[3,3]:[3,6];case 2:l.apply(u,[P.sent()]),n.yTop=r.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,P.label=3;case 3:return d=(f=r).addBrick,[4,this.generateFlatsCell(n,e.cells[s],a,!1)];case 4:d.apply(f,[P.sent()]),n.yTop=r.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,P.label=5;case 5:return s++,[3,1];case 6:return[2,r]}})})},i.prototype.getAvalableWidth=function(t){return h.getPageAvailableWidth(this.controller)-(t-1)*this.controller.unitWidth*h.GAP_BETWEEN_COLUMNS},i.prototype.calculateColumnWidth=function(t,e){for(var r=this,n=this.getAvalableWidth(e),a=n,s=e,u=[],l=[],f=t[0].cells.filter(function(P,S){return!r.ignoreCell(P,S)}),d=0;d<e;d++){var b=h.parseWidth(f[d].width,n,e)||0;a-=b,b!==0?s--:l.push(f[d]),u.push(b)}if(s===0)return u;var x=this.controller.measureText(h.MATRIX_COLUMN_WIDTH).width;return l.sort(function(P,S){var O=h.parseWidth(P.minWidth,n,e)||0,et=h.parseWidth(S.minWidth,n,e)||0;return et>O?1:-1}).forEach(function(P){var S=a/s,O=h.parseWidth(P.minWidth,n,e)||0;O>S&&O>x&&(a-=O,s--),u[f.indexOf(P)]=Math.max(x,O,S)}),u},i.prototype.generateOneRow=function(t,e,r,n){return F(this,void 0,void 0,function(){return T(this,function(a){switch(a.label){case 0:return r?[4,this.generateFlatsRowHorisontal(t,e,n)]:[3,2];case 1:return[2,a.sent()];case 2:return[4,this.generateFlatsRowVertical(t,e)];case 3:return[2,a.sent()]}})})},i.prototype.generateFlatsRows=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s,u,l,f,d,b,x,P,S;return T(this,function(O){switch(O.label){case 0:a=h.clone(t),s=[],u=0,O.label=1;case 1:return u<e.length?[4,this.generateOneRow(a,e[u],n,this.calculateColumnWidth(e,r))]:[3,6];case 2:if(l=O.sent(),l.isEmpty&&!(e[u].row&&e[u].row.hasPanel))return[3,5];if(l.isEmpty||(u!==e.length-1&&(a.yTop=l.yBot,l.addBrick(h.createRowlineFlat(a,this.controller))),s.push(l),a.yTop=l.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight),!(e[u].row&&e[u].row.hasPanel))return[3,5];for(e[u].row.showDetailPanel(),f=e[u].row.detailPanel,d=0;d<f.questions.length;d++)f.questions[d].id+="_"+u;return[4,Dt.generateFlatsPanel(this.survey,this.controller,f,a)];case 3:return b=O.sent(),x=new D,x.addBrick.apply(x,b),a.yTop=x.yBot+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,s.push(x),u!==e.length-1&&this.question.renderedTable.showHeader&&n?[4,this.generateOneRow(a,e[0],n,this.calculateColumnWidth(e,r))]:[3,5];case 4:P=O.sent(),S=x.yBot,P.isEmpty||(S=P.yBot,s.push(P)),a.yTop=S+i.GAP_BETWEEN_ROWS*this.controller.unitHeight,O.label=5;case 5:return u++,[3,1];case 6:return[2,s]}})})},i.prototype.calculateIsWide=function(t,e){var r=[];if(t.showHeader&&r.push(t.headerRow),r.push.apply(r,this.visibleRows),r.length===0)return!0;var n=this.calculateColumnWidth(r,e).reduce(function(a,s){return a+=s},0);return this.question.renderAs!=="list"&&this.controller.matrixRenderAs!=="list"&&Math.floor(n)<=Math.floor(this.getAvalableWidth(e))},i.prototype.getRowsToRender=function(t,e,r){var n=[],a=this.visibleRows;return t.showHeader&&r&&n.push(t.headerRow),n.push.apply(n,a),t.hasRemoveRows&&e&&n.pop(),t.showFooter&&n.push(t.footerRow),n},i.prototype.getColCount=function(t,e){var r=this;return e[0]?e[0].cells.filter(function(n,a){return!r.ignoreCell(n,a)}).length:t.showHeader&&t.headerRow?t.headerRow.cells.length:t.showFooter&&t.footerRow?t.footerRow.cells.length:0},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s;return T(this,function(u){switch(u.label){case 0:return e=this.question.renderedTable,r=this.question.columnLayout==="vertical",n=this.getColCount(e,this.visibleRows),n===0&&!this.hasDetailPanel?[2,[new D(h.createRowlineFlat(t,this.controller))]]:(a=this.calculateIsWide(e,n),a||(this.question.isMobile=!0,r=!1,e=this.question.renderedTable,this.visibleRowsValue=void 0,n=this.getColCount(e,this.visibleRows)),s=this.getRowsToRender(e,r,a),[4,this.generateFlatsRows(t,s,n,a)]);case 1:return[2,u.sent()]}})})},i.GAP_BETWEEN_ROWS=.5,i})(ot);tt.Serializer.removeProperty("matrixdropdown","renderAs"),tt.Serializer.addProperty("matrixdropdown",{name:"renderAs",default:"auto",visible:!1,choices:["auto","list"]}),Q.getInstance().register("matrixdropdown",ee);var Oe=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r,!1)||this;return n.survey=t,n}return i})(ee);tt.Serializer.removeProperty("matrixdynamic","renderAs"),tt.Serializer.addProperty("matrixdynamic",{name:"renderAs",default:"auto",visible:!1,choices:["auto","list"]}),Q.getInstance().register("matrixdynamic",Oe);var ke=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r)||this;return n.survey=t,n.controller=r,n.question=e,n}return i.prototype.getVisibleRows=function(){return this.question.getRows().filter(function(t){return t.isVisible})},i.prototype.generateFlatItem=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s,u,l,f,d,b,x;return T(this,function(P){switch(P.label){case 0:return a=h.getPageAvailableWidth(this.controller),this.controller.pushMargins(),this.controller.margins.right=this.controller.paperWidth-this.controller.margins.left-a*h.MULTIPLETEXT_TEXT_PERS,u=D.bind,[4,h.createBoldTextFlat(t,this.question,this.controller,n.locTitle)];case 1:return s=new(u.apply(D,[void 0,P.sent()])),this.controller.popMargins(),l=Q.getInstance().create(this.survey,n.editor,this.controller,"text"),f=h.createTextFieldRect({xLeft:t.xLeft+a*h.MULTIPLETEXT_TEXT_PERS,yTop:t.yTop},this.controller),b=(d=s.addBrick).apply,x=[s],[4,l.generateFlatsContent(f)];case 2:return b.apply(d,x.concat([P.sent()])),[2,s]}})})},i.prototype.generateFlatsContent=function(t){return F(this,void 0,void 0,function(){var e,r,n,a,s,u,l;return T(this,function(f){switch(f.label){case 0:e=[],r=h.clone(t),n=this.getVisibleRows(),a=0,f.label=1;case 1:if(!(a<n.length))return[3,7];e.push(new D),s=r.yTop,this.controller.pushMargins(),u=0,f.label=2;case 2:return u<n[a].cells.length?(this.controller.pushMargins(),h.setColumnMargins(this.controller,this.question.colCount,u),r.xLeft=this.controller.margins.left,[4,this.generateFlatItem(r,a,u,n[a].cells[u].item)]):[3,5];case 3:l=f.sent(),e[e.length-1].addBrick(l),s=Math.max(s,l.yBot),this.controller.popMargins(),f.label=4;case 4:return u++,[3,2];case 5:this.controller.popMargins(),r.xLeft=t.xLeft,r.yTop=s,e[e.length-1].addBrick(h.createRowlineFlat(r,this.controller)),r.yTop+=h.EPSILON,r.yTop+=this.controller.unitHeight*i.ROWS_GAP_SCALE,f.label=6;case 6:return a++,[3,1];case 7:return[2,e]}})})},i.ROWS_GAP_SCALE=.195,i})(ot);Q.getInstance().register("multipletext",ke);var Ue=(function(o){H(i,o);function i(t,e,r){var n=o.call(this,t,e,r(e.helperDoc,t,0,0))||this;return n.renderFunc=r,n}return i.prototype.renderInteractive=function(){return F(this,void 0,void 0,function(){var t=this;return T(this,function(e){switch(e.label){case 0:return[4,new Promise(function(r){t.renderFunc(t.controller.doc,t.question,t.xLeft,t.yTop),r()})];case 1:return e.sent(),[2]}})})},i})(mt);tt.checkLibraryVersion("".concat("2.5.23"),"survey-pdf");var di=(function(o){H(i,o);function i(){return o!==null&&o.apply(this,arguments)||this}return i.prototype._getImageInfo=function(t){return F(this,void 0,void 0,function(){var e,r,n,a=this;return T(this,function(s){switch(s.label){case 0:return e=72/96,r=new Image,r.crossOrigin="anonymous",[4,new Promise(function(u,l){r.onload=function(){var f=document.createElement("canvas"),d=f.getContext("2d");f.height=r.naturalHeight,f.width=r.naturalWidth,d?.drawImage(r,0,0);var b=f.toDataURL();u({data:b,width:r.naturalWidth*e,height:r.naturalHeight*e,id:a.getImageId()})},r.onerror=function(){l()},r.src=t})];case 1:return n=s.sent(),[2,n]}})})},i.prototype.getCoverCanvasOptions=function(t,e,r,n){var a=t/e,s=r/n,u,l;return s>a?(u=r,l=r/a):(l=n,u=n*a),{canvasWidth:r,canvasHeight:n,imageX:(r-u)/2,imageY:(n-l)/2,imageWidth:u,imageHeight:l}},i.prototype.applyImageFit=function(t,e,r,n){return F(this,void 0,void 0,function(){var a,s,u,l;return T(this,function(f){switch(f.label){case 0:if(e!="cover")return[3,5];f.label=1;case 1:return f.trys.push([1,3,,4]),a=new Image,!t.width||!t.height||!t.data||!r||!n?[2,t]:(a.src=t.data instanceof Uint8Array?URL.createObjectURL(new Blob([t.data])):t.data,[4,a.decode()]);case 2:return f.sent(),s=this.getCoverCanvasOptions(t.width,t.height,r,n),u=document.createElement("canvas"),l=u.getContext("2d"),u.width=s.canvasWidth,u.height=s.canvasHeight,l?.drawImage(a,s.imageX,s.imageY,s.imageWidth,s.imageHeight),[2,{data:u.toDataURL(),width:r,height:n}];case 3:return f.sent(),[2,t];case 4:return[3,6];case 5:return[2,o.prototype.applyImageFit.call(this,t,e,r,n)];case 6:return[2]}})})},i})(De);ni(new di),A.BooleanItemBrick=ge,A.CheckItemBrick=It,A.CheckboxItemBrick=ye,A.CompositeBrick=D,A.CustomBrick=Ue,A.DocController=Lt,A.DocOptions=Xt,A.DrawCanvas=Zt,A.DropdownBrick=Fe,A.EmptyBrick=Ht,A.EventHandler=pe,A.FlatBoolean=me,A.FlatCheckbox=te,A.FlatComment=be,A.FlatCustomModel=ve,A.FlatDropdown=Te,A.FlatExpression=xe,A.FlatFile=Re,A.FlatHTML=we,A.FlatImage=Pe,A.FlatImagePicker=Ce,A.FlatMatrix=Ne,A.FlatMatrixDynamic=Oe,A.FlatMatrixMultiple=ee,A.FlatMultipleText=ke,A.FlatPanelDynamic=_e,A.FlatQuestion=ot,A.FlatQuestionDefault=se,A.FlatRadiogroup=Nt,A.FlatRanking=Ee,A.FlatRating=Ae,A.FlatRepository=Q,A.FlatSelectBase=$t,A.FlatSignaturePad=Le,A.FlatSlider=Se,A.FlatSurvey=Dt,A.FlatTextbox=Ie,A.HTMLBrick=ue,A.ImageBrick=he,A.LinkBrick=Qt,A.PagePacker=de,A.PdfBrick=mt,A.RadioItemBrick=Jt,A.RankingItemBrick=Be,A.RowlineBrick=Kt,A.SurveyHelper=h,A.SurveyPDF=Ge,A.TextBoldBrick=jt,A.TextBrick=nt,A.TextFieldBrick=Vt,A.TitlePanelBrick=le}));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.5.21
2
+ * surveyjs - SurveyJS PDF library v2.5.23
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.5.21
2
+ * surveyjs - SurveyJS PDF library v2.5.23
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -11132,7 +11132,7 @@
11132
11132
  return CustomBrick;
11133
11133
  }(PdfBrick));
11134
11134
 
11135
- SurveyCore.checkLibraryVersion("".concat("2.5.21"), 'survey-pdf');
11135
+ SurveyCore.checkLibraryVersion("".concat("2.5.23"), 'survey-pdf');
11136
11136
 
11137
11137
  var ImageUtils = /** @class */ (function (_super) {
11138
11138
  __extends(ImageUtils, _super);