MCPcopy Create free account
hub / github.com/simstudioai/sim / A8

Function A8

apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs:55–55  ·  view source on GitHub ↗
(q,X,V)

Source from the content-addressed store, hash-verified

53`);q.setDefaultAppearance(Y)},QX=function(q,X){var V,K,Q,Y=L2(X),J=L2(q.acroField),G=X.getRectangle(),W=X.getAppearanceCharacteristics(),Z=X.getBorderStyle(),H=(V=Z===null||Z===void 0?void 0:Z.getWidth())!==null&&V!==void 0?V:0,U=I2(W===null||W===void 0?void 0:W.getRotation()),z=r2(G,U),k=z.width,M=z.height,j=j2(o(o({},G),{rotation:U})),B=Y0(0,0,0),L=(K=l0(W===null||W===void 0?void 0:W.getBorderColor()))!==null&&K!==void 0?K:B,O=l0(W===null||W===void 0?void 0:W.getBackgroundColor()),N=l0(W===null||W===void 0?void 0:W.getBackgroundColor(),0.8),R=(Q=Y!==null&&Y!==void 0?Y:J)!==null&&Q!==void 0?Q:B;if(Y)B2(X,R);else B2(q.acroField,R);var v={x:0+H/2,y:0+H/2,width:k-H,height:M-H,thickness:1.5,borderWidth:H,borderColor:L,markColor:R};return{normal:{on:Q0(j,B8(o(o({},v),{color:O,filled:!0}))),off:Q0(j,B8(o(o({},v),{color:O,filled:!1})))},down:{on:Q0(j,B8(o(o({},v),{color:N,filled:!0}))),off:Q0(j,B8(o(o({},v),{color:N,filled:!1})))}}},YX=function(q,X){var V,K,Q,Y=L2(X),J=L2(q.acroField),G=X.getRectangle(),W=X.getAppearanceCharacteristics(),Z=X.getBorderStyle(),H=(V=Z===null||Z===void 0?void 0:Z.getWidth())!==null&&V!==void 0?V:0,U=I2(W===null||W===void 0?void 0:W.getRotation()),z=r2(G,U),k=z.width,M=z.height,j=j2(o(o({},G),{rotation:U})),B=Y0(0,0,0),L=(K=l0(W===null||W===void 0?void 0:W.getBorderColor()))!==null&&K!==void 0?K:B,O=l0(W===null||W===void 0?void 0:W.getBackgroundColor()),N=l0(W===null||W===void 0?void 0:W.getBackgroundColor(),0.8),R=(Q=Y!==null&&Y!==void 0?Y:J)!==null&&Q!==void 0?Q:B;if(Y)B2(X,R);else B2(q.acroField,R);var v={x:k/2,y:M/2,width:k-H,height:M-H,borderWidth:H,borderColor:L,dotColor:R};return{normal:{on:Q0(j,T8(o(o({},v),{color:O,filled:!0}))),off:Q0(j,T8(o(o({},v),{color:O,filled:!1})))},down:{on:Q0(j,T8(o(o({},v),{color:N,filled:!0}))),off:Q0(j,T8(o(o({},v),{color:N,filled:!1})))}}},JX=function(q,X,V){var K,Q,Y,J,G,W=L2(X),Z=L2(q.acroField),H=m6(X),U=m6(q.acroField),z=X.getRectangle(),k=X.getAppearanceCharacteristics(),M=X.getBorderStyle(),j=k===null||k===void 0?void 0:k.getCaptions(),B=(K=j===null||j===void 0?void 0:j.normal)!==null&&K!==void 0?K:"",L=(Y=(Q=j===null||j===void 0?void 0:j.down)!==null&&Q!==void 0?Q:B)!==null&&Y!==void 0?Y:"",O=(J=M===null||M===void 0?void 0:M.getWidth())!==null&&J!==void 0?J:0,N=I2(k===null||k===void 0?void 0:k.getRotation()),R=r2(z,N),v=R.width,w=R.height,$=j2(o(o({},z),{rotation:N})),S=Y0(0,0,0),h=l0(k===null||k===void 0?void 0:k.getBorderColor()),b=l0(k===null||k===void 0?void 0:k.getBackgroundColor()),C=l0(k===null||k===void 0?void 0:k.getBackgroundColor(),0.8),D={x:O,y:O,width:v-O*2,height:w-O*2},l=v8(B,{alignment:v0.Center,fontSize:H!==null&&H!==void 0?H:U,font:V,bounds:D}),u=v8(L,{alignment:v0.Center,fontSize:H!==null&&H!==void 0?H:U,font:V,bounds:D}),q0=Math.min(l.fontSize,u.fontSize),J0=(G=W!==null&&W!==void 0?W:Z)!==null&&G!==void 0?G:S;if(W||H!==void 0)B2(X,J0,V,q0);else B2(q.acroField,J0,V,q0);var r={x:0+O/2,y:0+O/2,width:v-O,height:w-O,borderWidth:O,borderColor:h,textColor:J0,font:V.name,fontSize:q0};return{normal:Q0($,hq(o(o({},r),{color:b,textLines:[l.line]}))),down:Q0($,hq(o(o({},r),{color:C,textLines:[u.line]})))}},GX=function(q,X,V){var K,Q,Y,J,G=L2(X),W=L2(q.acroField),Z=m6(X),H=m6(q.acroField),U=X.getRectangle(),z=X.getAppearanceCharacteristics(),k=X.getBorderStyle(),M=(K=q.getText())!==null&&K!==void 0?K:"",j=(Q=k===null||k===void 0?void 0:k.getWidth())!==null&&Q!==void 0?Q:0,B=I2(z===null||z===void 0?void 0:z.getRotation()),L=r2(U,B),O=L.width,N=L.height,R=j2(o(o({},U),{rotation:B})),v=Y0(0,0,0),w=l0(z===null||z===void 0?void 0:z.getBorderColor()),$=l0(z===null||z===void 0?void 0:z.getBackgroundColor()),S,h,b=q.isCombed()?0:1,C={x:j+b,y:j+b,width:O-(j+b)*2,height:N-(j+b)*2};if(q.isMultiline()){var D=uq(M,{alignment:q.getAlignment(),fontSize:Z!==null&&Z!==void 0?Z:H,font:V,bounds:C});S=D.lines,h=D.fontSize}else if(q.isCombed()){var D=KX(M,{fontSize:Z!==null&&Z!==void 0?Z:H,font:V,bounds:C,cellCount:(Y=q.getMaxLength())!==null&&Y!==void 0?Y:0});S=D.cells,h=D.fontSize}else{var D=v8(M,{alignment:q.getAlignment(),fontSize:Z!==null&&Z!==void 0?Z:H,font:V,bounds:C});S=[D.line],h=D.fontSize}var l=(J=G!==null&&G!==void 0?G:W)!==null&&J!==void 0?J:v;if(G||Z!==void 0)B2(X,l,V,h);else B2(q.acroField,l,V,h);var u={x:0+j/2,y:0+j/2,width:O-j,height:N-j,borderWidth:j!==null&&j!==void 0?j:0,borderColor:w,textColor:l,font:V.name,fontSize:h,color:$,textLines:S,padding:b};return Q0(R,Pq(u))},ZX=function(q,X,V){var K,Q,Y,J=L2(X),G=L2(q.acroField),W=m6(X),Z=m6(q.acroField),H=X.getRectangle(),U=X.getAppearanceCharacteristics(),z=X.getBorderStyle(),k=(K=q.getSelected()[0])!==null&&K!==void 0?K:"",M=(Q=z===null||z===void 0?void 0:z.getWidth())!==null&&Q!==void 0?Q:0,j=I2(U===null||U===void 0?void 0:U.getRotation()),B=r2(H,j),L=B.width,O=B.height,N=j2(o(o({},H),{rotation:j})),R=Y0(0,0,0),v=l0(U===null||U===void 0?void 0:U.getBorderColor()),w=l0(U===null||U===void 0?void 0:U.getBackgroundColor()),$=1,S={x:M+$,y:M+$,width:L-(M+$)*2,height:O-(M+$)*2},h=v8(k,{alignment:v0.Left,fontSize:W!==null&&W!==void 0?W:Z,font:V,bounds:S}),b=h.line,C=h.fontSize,D=(Y=J!==null&&J!==void 0?J:G)!==null&&Y!==void 0?Y:R;if(J||W!==void 0)B2(X,D,V,C);else B2(q.acroField,D,V,C);var l={x:0+M/2,y:0+M/2,width:L-M,height:O-M,borderWidth:M!==null&&M!==void 0?M:0,borderColor:v,textColor:D,font:V.name,fontSize:C,color:w,textLines:[b],padding:$};return Q0(N,Pq(l))},WX=function(q,X,V){var K,Q,Y=L2(X),J=L2(q.acroField),G=m6(X),W=m6(q.acroField),Z=X.getRectangle(),H=X.getAppearanceCharacteristics(),U=X.getBorderStyle(),z=(K=U===null||U===void 0?void 0:U.getWidth())!==null&&K!==void 0?K:0,k=I2(H===null||H===void 0?void 0:H.getRotation()),M=r2(Z,k),j=M.width,B=M.height,L=j2(o(o({},Z),{rotation:k})),O=Y0(0,0,0),N=l0(H===null||H===void 0?void 0:H.getBorderColor()),R=l0(H===null||H===void 0?void 0:H.getBackgroundColor()),v=q.getOptions(),w=q.getSelected();if(q.isSorted())v.sort();var $="";for(var S=0,h=v.length;S<h;S++)if($+=v[S],S<h-1)$+=`
54`;var b=1,C={x:z+b,y:z+b,width:j-(z+b)*2,height:B-(z+b)*2},D=uq($,{alignment:v0.Left,fontSize:G!==null&&G!==void 0?G:W,font:V,bounds:C}),l=D.lines,u=D.fontSize,q0=D.lineHeight,J0=[];for(var S=0,h=l.length;S<h;S++){var r=l[S];if(w.includes(r.text))J0.push(S)}var I0=Y0(0.6,0.7568627450980392,0.8549019607843137),n0=(Q=Y!==null&&Y!==void 0?Y:J)!==null&&Q!==void 0?Q:O;if(Y||G!==void 0)B2(X,n0,V,u);else B2(q.acroField,n0,V,u);return Q0(L,n7({x:0+z/2,y:0+z/2,width:j-z,height:B-z,borderWidth:z!==null&&z!==void 0?z:0,borderColor:N,textColor:n0,font:V.name,fontSize:u,color:R,textLines:l,lineHeight:q0,selectedColor:I0,selectedLines:J0,padding:b}))};var Z3=function(){function q(X,V,K){this.alreadyEmbedded=!1,T(X,"ref",[[a,"PDFRef"]]),T(V,"doc",[[o0,"PDFDocument"]]),T(K,"embedder",[[K8,"PDFPageEmbedder"]]),this.ref=X,this.doc=V,this.width=K.width,this.height=K.height,this.embedder=K}return q.prototype.scale=function(X){return T(X,"factor",["number"]),{width:this.width*X,height:this.height*X}},q.prototype.size=function(){return this.scale(1)},q.prototype.embed=function(){return _(this,void 0,void 0,function(){return c(this,function(X){switch(X.label){case 0:if(this.alreadyEmbedded)return[3,2];return[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:X.sent(),this.alreadyEmbedded=!0,X.label=2;case 2:return[2]}})})},q.of=function(X,V,K){return new q(X,V,K)},q}(),R8=Z3;var W3=function(){function q(X,V,K){this.modified=!0,T(X,"ref",[[a,"PDFRef"]]),T(V,"doc",[[o0,"PDFDocument"]]),T(K,"embedder",[[C6,"CustomFontEmbedder"],[$6,"StandardFontEmbedder"]]),this.ref=X,this.doc=V,this.name=K.fontName,this.embedder=K}return q.prototype.encodeText=function(X){return T(X,"text",["string"]),this.modified=!0,this.embedder.encodeText(X)},q.prototype.widthOfTextAtSize=function(X,V){return T(X,"text",["string"]),T(V,"size",["number"]),this.embedder.widthOfTextAtSize(X,V)},q.prototype.heightAtSize=function(X,V){var K;return T(X,"size",["number"]),F(V===null||V===void 0?void 0:V.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(X,{descender:(K=V===null||V===void 0?void 0:V.descender)!==null&&K!==void 0?K:!0})},q.prototype.sizeAtHeight=function(X){return T(X,"height",["number"]),this.embedder.sizeOfFontAtHeight(X)},q.prototype.getCharacterSet=function(){if(this.embedder instanceof $6)return this.embedder.encoding.supportedCodePoints;else return this.embedder.font.characterSet},q.prototype.embed=function(){return _(this,void 0,void 0,function(){return c(this,function(X){switch(X.label){case 0:if(!this.modified)return[3,2];return[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:X.sent(),this.modified=!1,X.label=2;case 2:return[2]}})})},q.of=function(X,V,K){return new q(X,V,K)},q}(),w0=W3;var H3=function(){function q(X,V,K){T(X,"ref",[[a,"PDFRef"]]),T(V,"doc",[[o0,"PDFDocument"]]),T(K,"embedder",[[q8,"JpegEmbedder"],[X8,"PngEmbedder"]]),this.ref=X,this.doc=V,this.width=K.width,this.height=K.height,this.embedder=K}return q.prototype.scale=function(X){return T(X,"factor",["number"]),{width:this.width*X,height:this.height*X}},q.prototype.scaleToFit=function(X,V){T(X,"width",["number"]),T(V,"height",["number"]);var K=X/this.width,Q=V/this.height,Y=Math.min(K,Q);return this.scale(Y)},q.prototype.size=function(){return this.scale(1)},q.prototype.embed=function(){return _(this,void 0,void 0,function(){var X,V,K;return c(this,function(Q){switch(Q.label){case 0:if(!this.embedder)return[2];if(!this.embedTask)X=this,V=X.doc,K=X.ref,this.embedTask=this.embedder.embedIntoContext(V.context,K);return[4,this.embedTask];case 1:return Q.sent(),this.embedder=void 0,[2]}})})},q.of=function(X,V,K){return new q(X,V,K)},q}(),R5=H3;var T2;(function(q){q[q.Left=0]="Left",q[q.Center=1]="Center",q[q.Right=2]="Right"})(T2||(T2={}));var v2=function(q){F(q===null||q===void 0?void 0:q.x,"options.x",["number"]),F(q===null||q===void 0?void 0:q.y,"options.y",["number"]),F(q===null||q===void 0?void 0:q.width,"options.width",["number"]),F(q===null||q===void 0?void 0:q.height,"options.height",["number"]),F(q===null||q===void 0?void 0:q.textColor,"options.textColor",[[Object,"Color"]]),F(q===null||q===void 0?void 0:q.backgroundColor,"options.backgroundColor",[[Object,"Color"]]),F(q===null||q===void 0?void 0:q.borderColor,"options.borderColor",[[Object,"Color"]]),F(q===null||q===void 0?void 0:q.borderWidth,"options.borderWidth",["number"]),F(q===null||q===void 0?void 0:q.rotate,"options.rotate",[[Object,"Rotation"]])},U3=function(){function q(X,V,K){T(X,"acroField",[[K2,"PDFAcroTerminal"]]),T(V,"ref",[[a,"PDFRef"]]),T(K,"doc",[[o0,"PDFDocument"]]),this.acroField=X,this.ref=V,this.doc=K}return q.prototype.getName=function(){var X;return(X=this.acroField.getFullyQualifiedName())!==null&&X!==void 0?X:""},q.prototype.isReadOnly=function(){return this.acroField.hasFlag(Y2.ReadOnly)},q.prototype.enableReadOnly=function(){this.acroField.setFlagTo(Y2.ReadOnly,!0)},q.prototype.disableReadOnly=function(){this.acroField.setFlagTo(Y2.ReadOnly,!1)},q.prototype.isRequired=function(){return this.acroField.hasFlag(Y2.Required)},q.prototype.enableRequired=function(){this.acroField.setFlagTo(Y2.Required,!0)},q.prototype.disableRequired=function(){this.acroField.setFlagTo(Y2.Required,!1)},q.prototype.isExported=function(){return!this.acroField.hasFlag(Y2.NoExport)},q.prototype.enableExporting=function(){this.acroField.setFlagTo(Y2.NoExport,!1)},q.prototype.disableExporting=function(){this.acroField.setFlagTo(Y2.NoExport,!0)},q.prototype.needsAppearancesUpdate=function(){throw new u0(this.constructor.name,"needsAppearancesUpdate")},q.prototype.defaultUpdateAppearances=function(X){throw new u0(this.constructor.name,"defaultUpdateAppearances")},q.prototype.markAsDirty=function(){this.doc.getForm().markFieldAsDirty(this.ref)},q.prototype.markAsClean=function(){this.doc.getForm().markFieldAsClean(this.ref)},q.prototype.isDirty=function(){return this.doc.getForm().fieldIsDirty(this.ref)},q.prototype.createWidget=function(X){var V,K=X.textColor,Q=X.backgroundColor,Y=X.borderColor,J=X.borderWidth,G=k1(X.rotate),W=X.caption,Z=X.x,H=X.y,U=X.width+J,z=X.height+J,k=Boolean(X.hidden),M=X.page;Y1(G,"degreesAngle",90);var j=M5.create(this.doc.context,this.ref),B=y7({x:Z,y:H,width:U,height:z},J,G);if(j.setRectangle(B),M)j.setP(M);var L=j.getOrCreateAppearanceCharacteristics();if(Q)L.setBackgroundColor($q(Q));if(L.setRotation(G),W)L.setCaptions({normal:W});if(Y)L.setBorderColor($q(Y));var O=j.getOrCreateBorderStyle();if(J!==void 0)O.setWidth(J);if(j.setFlagTo(I5.Print,!0),j.setFlagTo(I5.Hidden,k),j.setFlagTo(I5.Invisible,!1),K){var N=(V=this.acroField.getDefaultAppearance())!==null&&V!==void 0?V:"",R=N+`
55`+E2(K).toString();this.acroField.setDefaultAppearance(R)}return j},q.prototype.updateWidgetAppearanceWithFont=function(X,V,K){var{normal:Q,rollover:Y,down:J}=K;this.updateWidgetAppearances(X,{normal:this.createAppearanceStream(X,Q,V),rollover:Y&&this.createAppearanceStream(X,Y,V),down:J&&this.createAppearanceStream(X,J,V)})},q.prototype.updateOnOffWidgetAppearance=function(X,V,K){var{normal:Q,rollover:Y,down:J}=K;this.updateWidgetAppearances(X,{normal:this.createAppearanceDict(X,Q,V),rollover:Y&&this.createAppearanceDict(X,Y,V),down:J&&this.createAppearanceDict(X,J,V)})},q.prototype.updateWidgetAppearances=function(X,V){var{normal:K,rollover:Q,down:Y}=V;if(X.setNormalAppearance(K),Q)X.setRolloverAppearance(Q);else X.removeRolloverAppearance();if(Y)X.setDownAppearance(Y);else X.removeDownAppearance()},q.prototype.createAppearanceStream=function(X,V,K){var Q,Y=this.acroField.dict.context,J=X.getRectangle(),G=J.width,W=J.height,Z=K&&{Font:(Q={},Q[K.name]=K.ref,Q)},H=Y.formXObject(V,{Resources:Z,BBox:Y.obj([0,0,G,W]),Matrix:Y.obj([1,0,0,1,0,0])}),U=Y.register(H);return U},q.prototype.createImageAppearanceStream=function(X,V,K){var Q,Y,J=this.acroField.dict.context,G=X.getRectangle(),W=X.getAppearanceCharacteristics(),Z=X.getBorderStyle(),H=(Y=Z===null||Z===void 0?void 0:Z.getWidth())!==null&&Y!==void 0?Y:0,U=I2(W===null||W===void 0?void 0:W.getRotation()),z=j2(o(o({},G),{rotation:U})),k=r2(G,U),M=V.scaleToFit(k.width-H*2,k.height-H*2),j={x:H,y:H,width:M.width,height:M.height,rotate:p(0),xSkew:p(0),ySkew:p(0)};if(K===T2.Center)j.x+=(k.width-H*2)/2-M.width/2,j.y+=(k.height-H*2)/2-M.height/2;else if(K===T2.Right)j.x=k.width-H-M.width,j.y=k.height-H-M.height;var B=this.doc.context.addRandomSuffix("Image",10),L=Q0(z,w1(B,j)),O={XObject:(Q={},Q[B]=V.ref,Q)},N=J.formXObject(L,{Resources:O,BBox:J.obj([0,0,G.width,G.height]),Matrix:J.obj([1,0,0,1,0,0])});return J.register(N)},q.prototype.createAppearanceDict=function(X,V,K){var Q=this.acroField.dict.context,Y=this.createAppearanceStream(X,V.on),J=this.createAppearanceStream(X,V.off),G=Q.obj({});return G.set(K,Y),G.set(I.of("Off"),J),G},q}(),d0=U3;var z3=function(q){A(X,q);function X(V,K,Q){var Y=q.call(this,V,K,Q)||this;return T(V,"acroCheckBox",[[K6,"PDFAcroCheckBox"]]),Y.acroField=V,Y}return X.prototype.check=function(){var V,K=(V=this.acroField.getOnValue())!==null&&V!==void 0?V:I.of("Yes");this.markAsDirty(),this.acroField.setValue(K)},X.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(I.of("Off"))},X.prototype.isChecked=function(){var V=this.acroField.getOnValue();return!!V&&V===this.acroField.getValue()},X.prototype.addToPage=function(V,K){var Q,Y,J,G,W,Z;if(T(V,"page",[[y0,"PDFPage"]]),v2(K),!K)K={};if(!("textColor"in K))K.textColor=Y0(0,0,0);if(!("backgroundColor"in K))K.backgroundColor=Y0(1,1,1);if(!("borderColor"in K))K.borderColor=Y0(0,0,0);if(!("borderWidth"in K))K.borderWidth=1;var H=this.createWidget({x:(Q=K.x)!==null&&Q!==void 0?Q:0,y:(Y=K.y)!==null&&Y!==void 0?Y:0,width:(J=K.width)!==null&&J!==void 0?J:50,height:(G=K.height)!==null&&G!==void 0?G:50,textColor:K.textColor,backgroundColor:K.backgroundColor,borderColor:K.borderColor,borderWidth:(W=K.borderWidth)!==null&&W!==void 0?W:0,rotate:(Z=K.rotate)!==null&&Z!==void 0?Z:p(0),hidden:K.hidden,page:V.ref}),U=this.doc.context.register(H.dict);this.acroField.addWidget(U),H.setAppearanceState(I.of("Off")),this.updateWidgetAppearance(H,I.of("Yes")),V.node.addAnnot(U)},X.prototype.needsAppearancesUpdate=function(){var V,K=this.acroField.getWidgets();for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=J.getAppearanceState(),W=(V=J.getAppearances())===null||V===void 0?void 0:V.normal;if(!(W instanceof m))return!0;if(G&&!W.has(G))return!0}return!1},X.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},X.prototype.updateAppearances=function(V){var K;F(V,"provider",[Function]);var Q=this.acroField.getWidgets();for(var Y=0,J=Q.length;Y<J;Y++){var G=Q[Y],W=(K=G.getOnValue())!==null&&K!==void 0?K:I.of("Yes");if(!W)continue;this.updateWidgetAppearance(G,W,V)}this.markAsClean()},X.prototype.updateWidgetAppearance=function(V,K,Q){var Y=Q!==null&&Q!==void 0?Q:QX,J=G2(Y(this,V));this.updateOnOffWidgetAppearance(V,K,J)},X.of=function(V,K,Q){return new X(V,K,Q)},X}(d0),f6=z3;var M3=function(q){A(X,q);function X(V,K,Q){var Y=q.call(this,V,K,Q)||this;return T(V,"acroComboBox",[[Q6,"PDFAcroComboBox"]]),Y.acroField=V,Y}return X.prototype.getOptions=function(){var V=this.acroField.getOptions(),K=Array(V.length);for(var Q=0,Y=K.length;Q<Y;Q++){var J=V[Q],G=J.display,W=J.value;K[Q]=(G!==null&&G!==void 0?G:W).decodeText()}return K},X.prototype.getSelected=function(){var V=this.acroField.getValues(),K=Array(V.length);for(var Q=0,Y=V.length;Q<Y;Q++)K[Q]=V[Q].decodeText();return K},X.prototype.setOptions=function(V){T(V,"options",[Array]);var K=Array(V.length);for(var Q=0,Y=V.length;Q<Y;Q++)K[Q]={value:g.fromText(V[Q])};this.acroField.setOptions(K)},X.prototype.addOptions=function(V){T(V,"options",["string",Array]);var K=Array.isArray(V)?V:[V],Q=this.acroField.getOptions(),Y=Array(K.length);for(var J=0,G=K.length;J<G;J++)Y[J]={value:g.fromText(K[J])};this.acroField.setOptions(Q.concat(Y))},X.prototype.select=function(V,K){if(K===void 0)K=!1;T(V,"options",["string",Array]),T(K,"merge",["boolean"]);var Q=Array.isArray(V)?V:[V],Y=this.getOptions(),J=Q.find(function(U){return!Y.includes(U)});if(J)this.enableEditing();if(this.markAsDirty(),Q.length>1||Q.length===1&&K)this.enableMultiselect();var G=Array(Q.length);for(var W=0,Z=Q.length;W<Z;W++)G[W]=g.fromText(Q[W]);if(K){var H=this.acroField.getValues();this.acroField.setValues(H.concat(G))}else this.acroField.setValues(G)},X.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},X.prototype.setFontSize=function(V){X6(V,"fontSize"),this.acroField.setFontSize(V),this.markAsDirty()},X.prototype.isEditable=function(){return this.acroField.hasFlag(G0.Edit)},X.prototype.enableEditing=function(){this.acroField.setFlagTo(G0.Edit,!0)},X.prototype.disableEditing=function(){this.acroField.setFlagTo(G0.Edit,!1)},X.prototype.isSorted=function(){return this.acroField.hasFlag(G0.Sort)},X.prototype.enableSorting=function(){this.acroField.setFlagTo(G0.Sort,!0)},X.prototype.disableSorting=function(){this.acroField.setFlagTo(G0.Sort,!1)},X.prototype.isMultiselect=function(){return this.acroField.hasFlag(G0.MultiSelect)},X.prototype.enableMultiselect=function(){this.acroField.setFlagTo(G0.MultiSelect,!0)},X.prototype.disableMultiselect=function(){this.acroField.setFlagTo(G0.MultiSelect,!1)},X.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(G0.DoNotSpellCheck)},X.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(G0.DoNotSpellCheck,!1)},X.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(G0.DoNotSpellCheck,!0)},X.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(G0.CommitOnSelChange)},X.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(G0.CommitOnSelChange,!0)},X.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(G0.CommitOnSelChange,!1)},X.prototype.addToPage=function(V,K){var Q,Y,J,G,W,Z,H;if(T(V,"page",[[y0,"PDFPage"]]),v2(K),!K)K={};if(!("textColor"in K))K.textColor=Y0(0,0,0);if(!("backgroundColor"in K))K.backgroundColor=Y0(1,1,1);if(!("borderColor"in K))K.borderColor=Y0(0,0,0);if(!("borderWidth"in K))K.borderWidth=1;var U=this.createWidget({x:(Q=K.x)!==null&&Q!==void 0?Q:0,y:(Y=K.y)!==null&&Y!==void 0?Y:0,width:(J=K.width)!==null&&J!==void 0?J:200,height:(G=K.height)!==null&&G!==void 0?G:50,textColor:K.textColor,backgroundColor:K.backgroundColor,borderColor:K.borderColor,borderWidth:(W=K.borderWidth)!==null&&W!==void 0?W:0,rotate:(Z=K.rotate)!==null&&Z!==void 0?Z:p(0),hidden:K.hidden,page:V.ref}),z=this.doc.context.register(U.dict);this.acroField.addWidget(z);var k=(H=K.font)!==null&&H!==void 0?H:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(U,k),V.node.addAnnot(z)},X.prototype.needsAppearancesUpdate=function(){var V;if(this.isDirty())return!0;var K=this.acroField.getWidgets();for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=((V=J.getAppearances())===null||V===void 0?void 0:V.normal)instanceof E0;if(!G)return!0}return!1},X.prototype.defaultUpdateAppearances=function(V){T(V,"font",[[w0,"PDFFont"]]),this.updateAppearances(V)},X.prototype.updateAppearances=function(V,K){T(V,"font",[[w0,"PDFFont"]]),F(K,"provider",[Function]);var Q=this.acroField.getWidgets();for(var Y=0,J=Q.length;Y<J;Y++){var G=Q[Y];this.updateWidgetAppearance(G,V,K)}this.markAsClean()},X.prototype.updateWidgetAppearance=function(V,K,Q){var Y=Q!==null&&Q!==void 0?Q:ZX,J=G2(Y(this,V,K));this.updateWidgetAppearanceWithFont(V,K,J)},X.of=function(V,K,Q){return new X(V,K,Q)},X}(d0),O5=M3;var k3=function(q){A(X,q);function X(V,K,Q){var Y=q.call(this,V,K,Q)||this;return T(V,"acroListBox",[[W6,"PDFAcroListBox"]]),Y.acroField=V,Y}return X.prototype.getOptions=function(){var V=this.acroField.getOptions(),K=Array(V.length);for(var Q=0,Y=K.length;Q<Y;Q++){var J=V[Q],G=J.display,W=J.value;K[Q]=(G!==null&&G!==void 0?G:W).decodeText()}return K},X.prototype.getSelected=function(){var V=this.acroField.getValues(),K=Array(V.length);for(var Q=0,Y=V.length;Q<Y;Q++)K[Q]=V[Q].decodeText();return K},X.prototype.setOptions=function(V){T(V,"options",[Array]),this.markAsDirty();var K=Array(V.length);for(var Q=0,Y=V.length;Q<Y;Q++)K[Q]={value:g.fromText(V[Q])};this.acroField.setOptions(K)},X.prototype.addOptions=function(V){T(V,"options",["string",Array]),this.markAsDirty();var K=Array.isArray(V)?V:[V],Q=this.acroField.getOptions(),Y=Array(K.length);for(var J=0,G=K.length;J<G;J++)Y[J]={value:g.fromText(K[J])};this.acroField.setOptions(Q.concat(Y))},X.prototype.select=function(V,K){if(K===void 0)K=!1;T(V,"options",["string",Array]),T(K,"merge",["boolean"]);var Q=Array.isArray(V)?V:[V],Y=this.getOptions();if(V7(Q,"option",Y),this.markAsDirty(),Q.length>1||Q.length===1&&K)this.enableMultiselect();var J=Array(Q.length);for(var G=0,W=Q.length;G<W;G++)J[G]=g.fromText(Q[G]);if(K){var Z=this.acroField.getValues();this.acroField.setValues(Z.concat(J))}else this.acroField.setValues(J)},X.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},X.prototype.setFontSize=function(V){X6(V,"fontSize"),this.acroField.setFontSize(V),this.markAsDirty()},X.prototype.isSorted=function(){return this.acroField.hasFlag(G0.Sort)},X.prototype.enableSorting=function(){this.acroField.setFlagTo(G0.Sort,!0)},X.prototype.disableSorting=function(){this.acroField.setFlagTo(G0.Sort,!1)},X.prototype.isMultiselect=function(){return this.acroField.hasFlag(G0.MultiSelect)},X.prototype.enableMultiselect=function(){this.acroField.setFlagTo(G0.MultiSelect,!0)},X.prototype.disableMultiselect=function(){this.acroField.setFlagTo(G0.MultiSelect,!1)},X.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(G0.CommitOnSelChange)},X.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(G0.CommitOnSelChange,!0)},X.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(G0.CommitOnSelChange,!1)},X.prototype.addToPage=function(V,K){var Q,Y,J,G,W,Z,H;if(T(V,"page",[[y0,"PDFPage"]]),v2(K),!K)K={};if(!("textColor"in K))K.textColor=Y0(0,0,0);if(!("backgroundColor"in K))K.backgroundColor=Y0(1,1,1);if(!("borderColor"in K))K.borderColor=Y0(0,0,0);if(!("borderWidth"in K))K.borderWidth=1;var U=this.createWidget({x:(Q=K.x)!==null&&Q!==void 0?Q:0,y:(Y=K.y)!==null&&Y!==void 0?Y:0,width:(J=K.width)!==null&&J!==void 0?J:200,height:(G=K.height)!==null&&G!==void 0?G:100,textColor:K.textColor,backgroundColor:K.backgroundColor,borderColor:K.borderColor,borderWidth:(W=K.borderWidth)!==null&&W!==void 0?W:0,rotate:(Z=K.rotate)!==null&&Z!==void 0?Z:p(0),hidden:K.hidden,page:V.ref}),z=this.doc.context.register(U.dict);this.acroField.addWidget(z);var k=(H=K.font)!==null&&H!==void 0?H:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(U,k),V.node.addAnnot(z)},X.prototype.needsAppearancesUpdate=function(){var V;if(this.isDirty())return!0;var K=this.acroField.getWidgets();for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=((V=J.getAppearances())===null||V===void 0?void 0:V.normal)instanceof E0;if(!G)return!0}return!1},X.prototype.defaultUpdateAppearances=function(V){T(V,"font",[[w0,"PDFFont"]]),this.updateAppearances(V)},X.prototype.updateAppearances=function(V,K){T(V,"font",[[w0,"PDFFont"]]),F(K,"provider",[Function]);var Q=this.acroField.getWidgets();for(var Y=0,J=Q.length;Y<J;Y++){var G=Q[Y];this.updateWidgetAppearance(G,V,K)}this.markAsClean()},X.prototype.updateWidgetAppearance=function(V,K,Q){var Y=Q!==null&&Q!==void 0?Q:WX,J=G2(Y(this,V,K));this.updateWidgetAppearanceWithFont(V,K,J)},X.of=function(V,K,Q){return new X(V,K,Q)},X}(d0),w5=k3;var I3=function(q){A(X,q);function X(V,K,Q){var Y=q.call(this,V,K,Q)||this;return T(V,"acroRadioButton",[[Z6,"PDFAcroRadioButton"]]),Y.acroField=V,Y}return X.prototype.getOptions=function(){var V=this.acroField.getExportValues();if(V){var K=Array(V.length);for(var Q=0,Y=V.length;Q<Y;Q++)K[Q]=V[Q].decodeText();return K}var J=this.acroField.getOnValues(),G=Array(J.length);for(var Q=0,Y=G.length;Q<Y;Q++)G[Q]=J[Q].decodeText();return G},X.prototype.getSelected=function(){var V=this.acroField.getValue();if(V===I.of("Off"))return;var K=this.acroField.getExportValues();if(K){var Q=this.acroField.getOnValues();for(var Y=0,J=Q.length;Y<J;Y++)if(Q[Y]===V)return K[Y].decodeText()}return V.decodeText()},X.prototype.select=function(V){T(V,"option",["string"]);var K=this.getOptions();M2(V,"option",K),this.markAsDirty();var Q=this.acroField.getOnValues(),Y=this.acroField.getExportValues();if(Y){for(var J=0,G=Y.length;J<G;J++)if(Y[J].decodeText()===V)this.acroField.setValue(Q[J])}else for(var J=0,G=Q.length;J<G;J++){var W=Q[J];if(W.decodeText()===V)this.acroField.setValue(W)}},X.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(I.of("Off"))},X.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(f0.NoToggleToOff)},X.prototype.enableOffToggling=function(){this.acroField.setFlagTo(f0.NoToggleToOff,!1)},X.prototype.disableOffToggling=function(){this.acroField.setFlagTo(f0.NoToggleToOff,!0)},X.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(f0.RadiosInUnison)},X.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(f0.RadiosInUnison,!1)},X.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(f0.RadiosInUnison,!0)},X.prototype.addOptionToPage=function(V,K,Q){var Y,J,G,W,Z,H,U,z,k;T(V,"option",["string"]),T(K,"page",[[y0,"PDFPage"]]),v2(Q);var M=this.createWidget({x:(Y=Q===null||Q===void 0?void 0:Q.x)!==null&&Y!==void 0?Y:0,y:(J=Q===null||Q===void 0?void 0:Q.y)!==null&&J!==void 0?J:0,width:(G=Q===null||Q===void 0?void 0:Q.width)!==null&&G!==void 0?G:50,height:(W=Q===null||Q===void 0?void 0:Q.height)!==null&&W!==void 0?W:50,textColor:(Z=Q===null||Q===void 0?void 0:Q.textColor)!==null&&Z!==void 0?Z:Y0(0,0,0),backgroundColor:(H=Q===null||Q===void 0?void 0:Q.backgroundColor)!==null&&H!==void 0?H:Y0(1,1,1),borderColor:(U=Q===null||Q===void 0?void 0:Q.borderColor)!==null&&U!==void 0?U:Y0(0,0,0),borderWidth:(z=Q===null||Q===void 0?void 0:Q.borderWidth)!==null&&z!==void 0?z:1,rotate:(k=Q===null||Q===void 0?void 0:Q.rotate)!==null&&k!==void 0?k:p(0),hidden:Q===null||Q===void 0?void 0:Q.hidden,page:K.ref}),j=this.doc.context.register(M.dict),B=this.acroField.addWidgetWithOpt(j,g.fromText(V),!this.isMutuallyExclusive());M.setAppearanceState(I.of("Off")),this.updateWidgetAppearance(M,B),K.node.addAnnot(j)},X.prototype.needsAppearancesUpdate=function(){var V,K=this.acroField.getWidgets();for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=J.getAppearanceState(),W=(V=J.getAppearances())===null||V===void 0?void 0:V.normal;if(!(W instanceof m))return!0;if(G&&!W.has(G))return!0}return!1},X.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},X.prototype.updateAppearances=function(V){F(V,"provider",[Function]);var K=this.acroField.getWidgets();for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=J.getOnValue();if(!G)continue;this.updateWidgetAppearance(J,G,V)}},X.prototype.updateWidgetAppearance=function(V,K,Q){var Y=Q!==null&&Q!==void 0?Q:YX,J=G2(Y(this,V));this.updateOnOffWidgetAppearance(V,K,J)},X.of=function(V,K,Q){return new X(V,K,Q)},X}(d0),l6=I3;var E3=function(q){A(X,q);function X(V,K,Q){var Y=q.call(this,V,K,Q)||this;return T(V,"acroSignature",[[F6,"PDFAcroSignature"]]),Y.acroField=V,Y}return X.prototype.needsAppearancesUpdate=function(){return!1},X.of=function(V,K,Q){return new X(V,K,Q)},X}(d0),O8=E3;var j3=function(q){A(X,q);function X(V,K,Q){var Y=q.call(this,V,K,Q)||this;return T(V,"acroText",[[J6,"PDFAcroText"]]),Y.acroField=V,Y}return X.prototype.getText=function(){var V=this.acroField.getValue();if(!V&&this.isRichFormatted())throw new e7(this.getName());return V===null||V===void 0?void 0:V.decodeText()},X.prototype.setText=function(V){F(V,"text",["string"]);var K=this.getMaxLength();if(K!==void 0&&V&&V.length>K)throw new XX(V.length,K,this.getName());if(this.markAsDirty(),this.disableRichFormatting(),V)this.acroField.setValue(g.fromText(V));else this.acroField.removeValue()},X.prototype.getAlignment=function(){var V=this.acroField.getQuadding();return V===0?v0.Left:V===1?v0.Center:V===2?v0.Right:v0.Left},X.prototype.setAlignment=function(V){M2(V,"alignment",v0),this.markAsDirty(),this.acroField.setQuadding(V)},X.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},X.prototype.setMaxLength=function(V){if(X2(V,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),V===void 0)this.acroField.removeMaxLength();else{var K=this.getText();if(K&&K.length>V)throw new VX(K.length,V,this.getName());this.acroField.setMaxLength(V)}},X.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},X.prototype.setImage=function(V){var K=this.getAlignment(),Q=K===v0.Center?T2.Center:K===v0.Right?T2.Right:T2.Left,Y=this.acroField.getWidgets();for(var J=0,G=Y.length;J<G;J++){var W=Y[J],Z=this.createImageAppearanceStream(W,V,Q);this.updateWidgetAppearances(W,{normal:Z})}this.markAsClean()},X.prototype.setFontSize=function(V){X6(V,"fontSize"),this.acroField.setFontSize(V),this.markAsDirty()},X.prototype.isMultiline=function(){return this.acroField.hasFlag(j0.Multiline)},X.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(j0.Multiline,!0)},X.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(j0.Multiline,!1)},X.prototype.isPassword=function(){return this.acroField.hasFlag(j0.Password)},X.prototype.enablePassword=function(){this.acroField.setFlagTo(j0.Password,!0)},X.prototype.disablePassword=function(){this.acroField.setFlagTo(j0.Password,!1)},X.prototype.isFileSelector=function(){return this.acroField.hasFlag(j0.FileSelect)},X.prototype.enableFileSelection=function(){this.acroField.setFlagTo(j0.FileSelect,!0)},X.prototype.disableFileSelection=function(){this.acroField.setFlagTo(j0.FileSelect,!1)},X.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(j0.DoNotSpellCheck)},X.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(j0.DoNotSpellCheck,!1)},X.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(j0.DoNotSpellCheck,!0)},X.prototype.isScrollable=function(){return!this.acroField.hasFlag(j0.DoNotScroll)},X.prototype.enableScrolling=function(){this.acroField.setFlagTo(j0.DoNotScroll,!1)},X.prototype.disableScrolling=function(){this.acroField.setFlagTo(j0.DoNotScroll,!0)},X.prototype.isCombed=function(){return this.acroField.hasFlag(j0.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},X.prototype.enableCombing=function(){if(this.getMaxLength()===void 0){var V="PDFTextFields must have a max length in order to be combed";console.warn(V)}this.markAsDirty(),this.disableMultiline(),this.disablePassword(),this.disableFileSelection(),this.acroField.setFlagTo(j0.Comb,!0)},X.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo(j0.Comb,!1)},X.prototype.isRichFormatted=function(){return this.acroField.hasFlag(j0.RichText)},X.prototype.enableRichFormatting=function(){this.acroField.setFlagTo(j0.RichText,!0)},X.prototype.disableRichFormatting=function(){this.acroField.setFlagTo(j0.RichText,!1)},X.prototype.addToPage=function(V,K){var Q,Y,J,G,W,Z,H;if(T(V,"page",[[y0,"PDFPage"]]),v2(K),!K)K={};if(!("textColor"in K))K.textColor=Y0(0,0,0);if(!("backgroundColor"in K))K.backgroundColor=Y0(1,1,1);if(!("borderColor"in K))K.borderColor=Y0(0,0,0);if(!("borderWidth"in K))K.borderWidth=1;var U=this.createWidget({x:(Q=K.x)!==null&&Q!==void 0?Q:0,y:(Y=K.y)!==null&&Y!==void 0?Y:0,width:(J=K.width)!==null&&J!==void 0?J:200,height:(G=K.height)!==null&&G!==void 0?G:50,textColor:K.textColor,backgroundColor:K.backgroundColor,borderColor:K.borderColor,borderWidth:(W=K.borderWidth)!==null&&W!==void 0?W:0,rotate:(Z=K.rotate)!==null&&Z!==void 0?Z:p(0),hidden:K.hidden,page:V.ref}),z=this.doc.context.register(U.dict);this.acroField.addWidget(z);var k=(H=K.font)!==null&&H!==void 0?H:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(U,k),V.node.addAnnot(z)},X.prototype.needsAppearancesUpdate=function(){var V;if(this.isDirty())return!0;var K=this.acroField.getWidgets();for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=((V=J.getAppearances())===null||V===void 0?void 0:V.normal)instanceof E0;if(!G)return!0}return!1},X.prototype.defaultUpdateAppearances=function(V){T(V,"font",[[w0,"PDFFont"]]),this.updateAppearances(V)},X.prototype.updateAppearances=function(V,K){T(V,"font",[[w0,"PDFFont"]]),F(K,"provider",[Function]);var Q=this.acroField.getWidgets();for(var Y=0,J=Q.length;Y<J;Y++){var G=Q[Y];this.updateWidgetAppearance(G,V,K)}this.markAsClean()},X.prototype.updateWidgetAppearance=function(V,K,Q){var Y=Q!==null&&Q!==void 0?Q:GX,J=G2(Y(this,V,K));this.updateWidgetAppearanceWithFont(V,K,J)},X.of=function(V,K,Q){return new X(V,K,Q)},X}(d0),A5=j3;var N5;(function(q){q.Courier="Courier",q.CourierBold="Courier-Bold",q.CourierOblique="Courier-Oblique",q.CourierBoldOblique="Courier-BoldOblique",q.Helvetica="Helvetica",q.HelveticaBold="Helvetica-Bold",q.HelveticaOblique="Helvetica-Oblique",q.HelveticaBoldOblique="Helvetica-BoldOblique",q.TimesRoman="Times-Roman",q.TimesRomanBold="Times-Bold",q.TimesRomanItalic="Times-Italic",q.TimesRomanBoldItalic="Times-BoldItalic",q.Symbol="Symbol",q.ZapfDingbats="ZapfDingbats"})(N5||(N5={}));var L3=function(){function q(X,V){var K=this;this.embedDefaultFont=function(){return K.doc.embedStandardFont(N5.Helvetica)},T(X,"acroForm",[[P6,"PDFAcroForm"]]),T(V,"doc",[[o0,"PDFDocument"]]),this.acroForm=X,this.doc=V,this.dirtyFields=new Set,this.defaultFontCache=m0.populatedBy(this.embedDefaultFont)}return q.prototype.hasXFA=function(){return this.acroForm.dict.has(I.of("XFA"))},q.prototype.deleteXFA=function(){this.acroForm.dict.delete(I.of("XFA"))},q.prototype.getFields=function(){var X=this.acroForm.getAllFields(),V=[];for(var K=0,Q=X.length;K<Q;K++){var Y=X[K],J=Y[0],G=Y[1],W=B3(J,G,this.doc);if(W)V.push(W)}return V},q.prototype.getFieldMaybe=function(X){T(X,"name",["string"]);var V=this.getFields();for(var K=0,Q=V.length;K<Q;K++){var Y=V[K];if(Y.getName()===X)return Y}return},q.prototype.getField=function(X){T(X,"name",["string"]);var V=this.getFieldMaybe(X);if(V)return V;throw new s7(X)},q.prototype.getButton=function(X){T(X,"name",["string"]);var V=this.getField(X);if(V instanceof S5)return V;throw new z6(X,S5,V)},q.prototype.getCheckBox=function(X){T(X,"name",["string"]);var V=this.getField(X);if(V instanceof f6)return V;throw new z6(X,f6,V)},q.prototype.getDropdown=function(X){T(X,"name",["string"]);var V=this.getField(X);if(V instanceof O5)return V;throw new z6(X,O5,V)},q.prototype.getOptionList=function(X){T(X,"name",["string"]);var V=this.getField(X);if(V instanceof w5)return V;throw new z6(X,w5,V)},q.prototype.getRadioGroup=function(X){T(X,"name",["string"]);var V=this.getField(X);if(V instanceof l6)return V;throw new z6(X,l6,V)},q.prototype.getSignature=function(X){T(X,"name",["string"]);var V=this.getField(X);if(V instanceof O8)return V;throw new z6(X,O8,V)},q.prototype.getTextField=function(X){T(X,"name",["string"]);var V=this.getField(X);if(V instanceof A5)return V;throw new z6(X,A5,V)},q.prototype.createButton=function(X){T(X,"name",["string"]);var V=w8(X),K=this.findOrCreateNonTerminals(V.nonTerminal),Q=G6.create(this.doc.context);return Q.setPartialName(V.terminal),A8(K,[Q,Q.ref],V.terminal),S5.of(Q,Q.ref,this.doc)},q.prototype.createCheckBox=function(X){T(X,"name",["string"]);var V=w8(X),K=this.findOrCreateNonTerminals(V.nonTerminal),Q=K6.create(this.doc.context);return Q.setPartialName(V.terminal),A8(K,[Q,Q.ref],V.terminal),f6.of(Q,Q.ref,this.doc)},q.prototype.createDropdown=function(X){T(X,"name",["string"]);var V=w8(X),K=this.findOrCreateNonTerminals(V.nonTerminal),Q=Q6.create(this.doc.context);return Q.setPartialName(V.terminal),A8(K,[Q,Q.ref],V.terminal),O5.of(Q,Q.ref,this.doc)},q.prototype.createOptionList=function(X){T(X,"name",["string"]);var V=w8(X),K=this.findOrCreateNonTerminals(V.nonTerminal),Q=W6.create(this.doc.context);return Q.setPartialName(V.terminal),A8(K,[Q,Q.ref],V.terminal),w5.of(Q,Q.ref,this.doc)},q.prototype.createRadioGroup=function(X){T(X,"name",["string"]);var V=w8(X),K=this.findOrCreateNonTerminals(V.nonTerminal),Q=Z6.create(this.doc.context);return Q.setPartialName(V.terminal),A8(K,[Q,Q.ref],V.terminal),l6.of(Q,Q.ref,this.doc)},q.prototype.createTextField=function(X){T(X,"name",["string"]);var V=w8(X),K=this.findOrCreateNonTerminals(V.nonTerminal),Q=J6.create(this.doc.context);return Q.setPartialName(V.terminal),A8(K,[Q,Q.ref],V.terminal),A5.of(Q,Q.ref,this.doc)},q.prototype.flatten=function(X){if(X===void 0)X={updateFieldAppearances:!0};if(X.updateFieldAppearances)this.updateFieldAppearances();var V=this.getFields();for(var K=0,Q=V.length;K<Q;K++){var Y=V[K],J=Y.acroField.getWidgets();for(var G=0,W=J.length;G<W;G++){var Z=J[G],H=this.findWidgetPage(Z),U=this.findWidgetAppearanceRef(Y,Z),z=H.node.newXObject("FlatWidget",U),k=Z.getRectangle(),M=Q0([B0(),c0(k.x,k.y)],j2(o(o({},k),{rotation:0})),[L8(z),T0()]).filter(Boolean);H.pushOperators.apply(H,M)}this.removeField(Y)}},q.prototype.removeField=function(X){var V=X.acroField.getWidgets(),K=new Set;for(var Q=0,Y=V.length;Q<Y;Q++){var J=V[Q],G=this.findWidgetAppearanceRef(X,J),W=this.findWidgetPage(J);K.add(W),W.node.removeAnnot(G)}K.forEach(function(k){return k.node.removeAnnot(X.ref)}),this.acroForm.removeField(X.acroField);var Z=X.acroField.normalizedEntries().Kids,H=Z.size();for(var U=0;U<H;U++){var z=Z.get(U);if(z instanceof a)this.doc.context.delete(z)}this.doc.context.delete(X.ref)},q.prototype.updateFieldAppearances=function(X){F(X,"font",[[w0,"PDFFont"]]),X=X!==null&&X!==void 0?X:this.getDefaultFont();var V=this.getFields();for(var K=0,Q=V.length;K<Q;K++){var Y=V[K];if(Y.needsAppearancesUpdate())Y.defaultUpdateAppearances(X)}},q.prototype.markFieldAsDirty=function(X){F(X,"fieldRef",[[a,"PDFRef"]]),this.dirtyFields.add(X)},q.prototype.markFieldAsClean=function(X){F(X,"fieldRef",[[a,"PDFRef"]]),this.dirtyFields.delete(X)},q.prototype.fieldIsDirty=function(X){return F(X,"fieldRef",[[a,"PDFRef"]]),this.dirtyFields.has(X)},q.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},q.prototype.findWidgetPage=function(X){var V=X.P(),K=this.doc.getPages().find(function(Y){return Y.ref===V});if(K===void 0){var Q=this.doc.context.getObjectRef(X.dict);if(Q===void 0)throw Error("Could not find PDFRef for PDFObject");if(K=this.doc.findPageForAnnotationRef(Q),K===void 0)throw Error("Could not find page for PDFRef "+Q)}return K},q.prototype.findWidgetAppearanceRef=function(X,V){var K,Q=V.getNormalAppearance();if(Q instanceof m&&(X instanceof f6||X instanceof l6)){var Y=X.acroField.getValue(),J=(K=Q.get(Y))!==null&&K!==void 0?K:Q.get(I.of("Off"));if(J instanceof a)Q=J}if(!(Q instanceof a)){var G=X.getName();throw Error("Failed to extract appearance ref for: "+G)}return Q},q.prototype.findOrCreateNonTerminals=function(X){var V=[this.acroForm];for(var K=0,Q=X.length;K<Q;K++){var Y=X[K];if(!Y)throw new t7(Y);var J=V[0],G=V[1],W=this.findNonTerminal(Y,J);if(W)V=W;else{var Z=Y6.create(this.doc.context);Z.setPartialName(Y),Z.setParent(G);var H=this.doc.context.register(Z.dict);J.addField(H),V=[Z,H]}}return V},q.prototype.findNonTerminal=function(X,V){var K=V instanceof P6?this.acroForm.getFields():Z8(V.Kids());for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=J[0],W=J[1];if(G.getPartialName()===X){if(G instanceof Y6)return[G,W];throw new Dq(X)}}return},q.of=function(X,V){return new q(X,V)},q}(),gq=L3,B3=function(q,X,V){if(q instanceof G6)return S5.of(q,X,V);if(q instanceof K6)return f6.of(q,X,V);if(q instanceof Q6)return O5.of(q,X,V);if(q instanceof W6)return w5.of(q,X,V);if(q instanceof J6)return A5.of(q,X,V);if(q instanceof Z6)return l6.of(q,X,V);if(q instanceof F6)return O8.of(q,X,V);return},w8=function(q){if(q.length===0)throw Error("PDF field names must not be empty strings");var X=q.split(".");for(var V=0,K=X.length;V<K;V++)if(X[V]==="")throw Error('Periods in PDF field names must be separated by at least one character: "'+q+'"');if(X.length===1)return{nonTerminal:[],terminal:X[0]};return{nonTerminal:X.slice(0,X.length-1),terminal:X[X.length-1]}},A8=function(q,X,V){var K=q[0],Q=q[1],Y=X[0],J=X[1],G=K.normalizedEntries(),W=Z8("Kids"in G?G.Kids:G.Fields);for(var Z=0,H=W.length;Z<H;Z++)if(W[Z][0].getPartialName()===V)throw new Dq(V);K.addField(J),Y.setParent(Q)};var HX={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],A0:[2383.94,3370.39],A1:[1683.78,2383.94],A2:[1190.55,1683.78],A3:[841.89,1190.55],A4:[595.28,841.89],A5:[419.53,595.28],A6:[297.64,419.53],A7:[209.76,297.64],A8:[147.4,209.76],A9:[104.88,147.4],A10:[73.7,104.88],B0:[2834.65,4008.19],B1:[2004.09,2834.65],B2:[1417.32,2004.09],B3:[1000.63,1417.32],B4:[708.66,1000.63],B5:[498.9,708.66],B6:[354.33,498.9],B7:[249.45,354.33],B8:[175.75,249.45],B9:[124.72,175.75],B10:[87.87,124.72],C0:[2599.37,3676.54],C1:[1836.85,2599.37],C2:[1298.27,1836.85],C3:[918.43,1298.27],C4:[649.13,918.43],C5:[459.21,649.13],C6:[323.15,459.21],C7:[229.61,323.15],C8:[161.57,229.61],C9:[113.39,161.57],C10:[79.37,113.39],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],Executive:[521.86,756],Folio:[612,936],Legal:[612,1008],Letter:[612,792],Tabloid:[792,1224]};var A1;(function(q){q[q.Fastest=1/0]="Fastest",q[q.Fast=1500]="Fast",q[q.Medium=500]="Medium",q[q.Slow=100]="Slow"})(A1||(A1={}));var T3=function(){function q(X,V,K){this.alreadyEmbedded=!1,this.ref=X,this.doc=V,this.embedder=K}return q.prototype.embed=function(){return _(this,void 0,void 0,function(){var X,V,K,Q,Y;return c(this,function(J){switch(J.label){case 0:if(this.alreadyEmbedded)return[3,2];return[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:if(X=J.sent(),!this.doc.catalog.has(I.of("Names")))this.doc.catalog.set(I.of("Names"),this.doc.context.obj({}));if(V=this.doc.catalog.lookup(I.of("Names"),m),!V.has(I.of("EmbeddedFiles")))V.set(I.of("EmbeddedFiles"),this.doc.context.obj({}));if(K=V.lookup(I.of("EmbeddedFiles"),m),!K.has(I.of("Names")))K.set(I.of("Names"),this.doc.context.obj([]));if(Q=K.lookup(I.of("Names"),i),Q.push(g.fromText(this.embedder.fileName)),Q.push(X),!this.doc.catalog.has(I.of("AF")))this.doc.catalog.set(I.of("AF"),this.doc.context.obj([]));Y=this.doc.catalog.lookup(I.of("AF"),i),Y.push(X),this.alreadyEmbedded=!0,J.label=2;case 2:return[2]}})})},q.of=function(X,V,K){return new q(X,V,K)},q}(),_K=T3;var v3=function(){function q(X,V,K){this.alreadyEmbedded=!1,this.ref=X,this.doc=V,this.embedder=K}return q.prototype.embed=function(){return _(this,void 0,void 0,function(){var X,V,K,Q,Y,J,G;return c(this,function(W){switch(W.label){case 0:if(this.alreadyEmbedded)return[3,2];return X=this.doc,V=X.catalog,K=X.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:if(Q=W.sent(),!V.has(I.of("Names")))V.set(I.of("Names"),K.obj({}));if(Y=V.lookup(I.of("Names"),m),!Y.has(I.of("JavaScript")))Y.set(I.of("JavaScript"),K.obj({}));if(J=Y.lookup(I.of("JavaScript"),m),!J.has(I.of("Names")))J.set(I.of("Names"),K.obj([]));G=J.lookup(I.of("Names"),i),G.push(g.fromText(this.embedder.scriptName)),G.push(Q),this.alreadyEmbedded=!0,W.label=2;case 2:return[2]}})})},q.of=function(X,V,K){return new q(X,V,K)},q}(),xq=v3;var R3=function(){function q(X,V){this.script=X,this.scriptName=V}return q.for=function(X,V){return new q(X,V)},q.prototype.embedIntoContext=function(X,V){return _(this,void 0,void 0,function(){var K;return c(this,function(Q){if(K=X.obj({Type:"Action",S:"JavaScript",JS:g.fromText(this.script)}),V)return X.assign(V,K),[2,V];else return[2,X.register(K)];return[2]})})},q}(),cK=R3;var O3=function(){function q(X,V,K){var Q=this;if(this.defaultWordBreaks=[" "],this.computePages=function(){var Y=[];return Q.catalog.Pages().traverse(function(J,G){if(J instanceof _0){var W=Q.pageMap.get(J);if(!W)W=y0.of(J,G,Q),Q.pageMap.set(J,W);Y.push(W)}}),Y},this.getOrCreateForm=function(){var Y=Q.catalog.getOrCreateAcroForm();return gq.of(Y,Q)},T(X,"context",[[Z5,"PDFContext"]]),T(V,"ignoreEncryption",["boolean"]),this.context=X,this.catalog=X.lookup(X.trailerInfo.Root),this.isEncrypted=!!X.lookup(X.trailerInfo.Encrypt),this.pageCache=m0.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=m0.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!V&&this.isEncrypted)throw new r7;if(K)this.updateInfoDict()}return q.load=function(X,V){if(V===void 0)V={};return _(this,void 0,void 0,function(){var K,Q,Y,J,G,W,Z,H,U,z,k,M;return c(this,function(j){switch(j.label){case 0:return K=V.ignoreEncryption,Q=K===void 0?!1:K,Y=V.parseSpeed,J=Y===void 0?A1.Slow:Y,G=V.throwOnInvalidObject,W=G===void 0?!1:G,Z=V.updateMetadata,H=Z===void 0?!0:Z,U=V.capNumbers,z=U===void 0?!1:U,T(X,"pdf",["string",Uint8Array,ArrayBuffer]),T(Q,"ignoreEncryption",["boolean"]),T(J,"parseSpeed",["number"]),T(W,"throwOnInvalidObject",["boolean"]),k=r6(X),[4,Bq.forBytesWithOptions(k,J,W,z).parseDocument()];case 1:return M=j.sent(),[2,new q(M,Q,H)]}})})},q.create=function(X){if(X===void 0)X={};return _(this,void 0,void 0,function(){var V,K,Q,Y,J,G;return c(this,function(W){return V=X.updateMetadata,K=V===void 0?!0:V,Q=Z5.create(),Y=H8.withContext(Q),J=Q.register(Y),G=W8.withContextAndPages(Q,J),Q.trailerInfo.Root=Q.register(G),[2,new q(Q,!1,K)]})})},q.prototype.registerFontkit=function(X){this.fontkit=X},q.prototype.getForm=function(){var X=this.formCache.access();if(X.hasXFA())console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),X.deleteXFA();return X},q.prototype.getTitle=function(){var X=this.getInfoDict().lookup(I.Title);if(!X)return;return _6(X),X.decodeText()},q.prototype.getAuthor=function(){var X=this.getInfoDict().lookup(I.Author);if(!X)return;return _6(X),X.decodeText()},q.prototype.getSubject=function(){var X=this.getInfoDict().lookup(I.Subject);if(!X)return;return _6(X),X.decodeText()},q.prototype.getKeywords=function(){var X=this.getInfoDict().lookup(I.Keywords);if(!X)return;return _6(X),X.decodeText()},q.prototype.getCreator=function(){var X=this.getInfoDict().lookup(I.Creator);if(!X)return;return _6(X),X.decodeText()},q.prototype.getProducer=function(){var X=this.getInfoDict().lookup(I.Producer);if(!X)return;return _6(X),X.decodeText()},q.prototype.getCreationDate=function(){var X=this.getInfoDict().lookup(I.CreationDate);if(!X)return;return _6(X),X.decodeDate()},q.prototype.getModificationDate=function(){var X=this.getInfoDict().lookup(I.ModDate);if(!X)return;return _6(X),X.decodeDate()},q.prototype.setTitle=function(X,V){T(X,"title",["string"]);var K=I.of("Title");if(this.getInfoDict().set(K,g.fromText(X)),V===null||V===void 0?void 0:V.showInWindowTitleBar){var Q=this.catalog.getOrCreateViewerPreferences();Q.setDisplayDocTitle(!0)}},q.prototype.setAuthor=function(X){T(X,"author",["string"]);var V=I.of("Author");this.getInfoDict().set(V,g.fromText(X))},q.prototype.setSubject=function(X){T(X,"author",["string"]);var V=I.of("Subject");this.getInfoDict().set(V,g.fromText(X))},q.prototype.setKeywords=function(X){T(X,"keywords",[Array]);var V=I.of("Keywords");this.getInfoDict().set(V,g.fromText(X.join(" ")))},q.prototype.setCreator=function(X){T(X,"creator",["string"]);var V=I.of("Creator");this.getInfoDict().set(V,g.fromText(X))},q.prototype.setProducer=function(X){T(X,"creator",["string"]);var V=I.of("Producer");this.getInfoDict().set(V,g.fromText(X))},q.prototype.setLanguage=function(X){T(X,"language",["string"]);var V=I.of("Lang");this.catalog.set(V,K0.of(X))},q.prototype.setCreationDate=function(X){T(X,"creationDate",[[Date,"Date"]]);var V=I.of("CreationDate");this.getInfoDict().set(V,K0.fromDate(X))},q.prototype.setModificationDate=function(X){T(X,"modificationDate",[[Date,"Date"]]);var V=I.of("ModDate");this.getInfoDict().set(V,K0.fromDate(X))},q.prototype.getPageCount=function(){if(this.pageCount===void 0)this.pageCount=this.getPages().length;return this.pageCount},q.prototype.getPages=function(){return this.pageCache.access()},q.prototype.getPage=function(X){var V=this.getPages();return b0(X,"index",0,V.length-1),V[X]},q.prototype.getPageIndices=function(){return M4(0,this.getPageCount())},q.prototype.removePage=function(X){var V=this.getPageCount();if(this.pageCount===0)throw new o7;b0(X,"index",0,V-1),this.catalog.removeLeafNode(X),this.pageCount=V-1},q.prototype.addPage=function(X){return T(X,"page",["undefined",[y0,"PDFPage"],Array]),this.insertPage(this.getPageCount(),X)},q.prototype.insertPage=function(X,V){var K=this.getPageCount();if(b0(X,"index",0,K),T(V,"page",["undefined",[y0,"PDFPage"],Array]),!V||Array.isArray(V)){var Q=Array.isArray(V)?V:HX.A4;V=y0.create(this),V.setSize.apply(V,Q)}else if(V.doc!==this)throw new a7;var Y=this.catalog.insertLeafNode(V.ref,X);return V.node.setParent(Y),this.pageMap.set(V.node,V),this.pageCache.invalidate(),this.pageCount=K+1,V},q.prototype.copyPages=function(X,V){return _(this,void 0,void 0,function(){var K,Q,Y,J,G,W,Z,H;return c(this,function(U){switch(U.label){case 0:return T(X,"srcDoc",[[q,"PDFDocument"]]),T(V,"indices",[Array]),[4,X.flush()];case 1:U.sent(),K=Z1.for(X.context,this.context),Q=X.getPages(),Y=Array(V.length);for(J=0,G=V.length;J<G;J++)W=Q[V[J]],Z=K.copy(W.node),H=this.context.register(Z),Y[J]=y0.of(Z,H,this);return[2,Y]}})})},q.prototype.copy=function(){return _(this,void 0,void 0,function(){var X,V,K,Q;return c(this,function(Y){switch(Y.label){case 0:return[4,q.create()];case 1:return X=Y.sent(),[4,X.copyPages(this,this.getPageIndices())];case 2:V=Y.sent();for(K=0,Q=V.length;K<Q;K++)X.addPage(V[K]);if(this.getAuthor()!==void 0)X.setAuthor(this.getAuthor());if(this.getCreationDate()!==void 0)X.setCreationDate(this.getCreationDate());if(this.getCreator()!==void 0)X.setCreator(this.getCreator());if(this.getModificationDate()!==void 0)X.setModificationDate(this.getModificationDate());if(this.getProducer()!==void 0)X.setProducer(this.getProducer());if(this.getSubject()!==void 0)X.setSubject(this.getSubject());if(this.getTitle()!==void 0)X.setTitle(this.getTitle());return X.defaultWordBreaks=this.defaultWordBreaks,[2,X]}})})},q.prototype.addJavaScript=function(X,V){T(X,"name",["string"]),T(V,"script",["string"]);var K=cK.for(V,X),Q=this.context.nextRef(),Y=xq.of(Q,this,K);this.javaScripts.push(Y)},q.prototype.attach=function(X,V,K){if(K===void 0)K={};return _(this,void 0,void 0,function(){var Q,Y,J,G;return c(this,function(W){return T(X,"attachment",["string",Uint8Array,ArrayBuffer]),T(V,"name",["string"]),F(K.mimeType,"mimeType",["string"]),F(K.description,"description",["string"]),F(K.creationDate,"options.creationDate",[Date]),F(K.modificationDate,"options.modificationDate",[Date]),a0(K.afRelationship,"options.afRelationship",t5),Q=r6(X),Y=Wq.for(Q,V,K),J=this.context.nextRef(),G=_K.of(J,this,Y),this.embeddedFiles.push(G),[2]})})},q.prototype.embedFont=function(X,V){if(V===void 0)V={};return _(this,void 0,void 0,function(){var K,Q,Y,J,G,W,Z,H,U,z;return c(this,function(k){switch(k.label){case 0:if(K=V.subset,Q=K===void 0?!1:K,Y=V.customName,J=V.features,T(X,"font",["string",Uint8Array,ArrayBuffer]),T(Q,"subset",["boolean"]),!e1(X))return[3,1];return G=$6.for(X,Y),[3,7];case 1:if(!I4(X))return[3,6];if(W=r6(X),Z=this.assertFontkit(),!Q)return[3,3];return[4,Zq.for(Z,W,Y,J)];case 2:return H=k.sent(),[3,5];case 3:return[4,C6.for(Z,W,Y,J)];case 4:H=k.sent(),k.label=5;case 5:return G=H,[3,7];case 6:throw TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return U=this.context.nextRef(),z=w0.of(U,this,G),this.fonts.push(z),[2,z]}})})},q.prototype.embedStandardFont=function(X,V){if(T(X,"font",["string"]),!e1(X))throw TypeError("`font` must be one of type `StandardFonts`");var K=$6.for(X,V),Q=this.context.nextRef(),Y=w0.of(Q,this,K);return this.fonts.push(Y),Y},q.prototype.embedJpg=function(X){return _(this,void 0,void 0,function(){var V,K,Q,Y;return c(this,function(J){switch(J.label){case 0:return T(X,"jpg",["string",Uint8Array,ArrayBuffer]),V=r6(X),[4,q8.for(V)];case 1:return K=J.sent(),Q=this.context.nextRef(),Y=R5.of(Q,this,K),this.images.push(Y),[2,Y]}})})},q.prototype.embedPng=function(X){return _(this,void 0,void 0,function(){var V,K,Q,Y;return c(this,function(J){switch(J.label){case 0:return T(X,"png",["string",Uint8Array,ArrayBuffer]),V=r6(X),[4,X8.for(V)];case 1:return K=J.sent(),Q=this.context.nextRef(),Y=R5.of(Q,this,K),this.images.push(Y),[2,Y]}})})},q.prototype.embedPdf=function(X,V){if(V===void 0)V=[0];return _(this,void 0,void 0,function(){var K,Q,Y;return c(this,function(J){switch(J.label){case 0:if(T(X,"pdf",["string",Uint8Array,ArrayBuffer,[q,"PDFDocument"]]),T(V,"indices",[Array]),!(X instanceof q))return[3,1];return Q=X,[3,3];case 1:return[4,q.load(X)];case 2:Q=J.sent(),J.label=3;case 3:return K=Q,Y=k4(K.getPages(),V),[2,this.embedPages(Y)]}})})},q.prototype.embedPage=function(X,V,K){return _(this,void 0,void 0,function(){var Q;return c(this,function(Y){switch(Y.label){case 0:return T(X,"page",[[y0,"PDFPage"]]),[4,this.embedPages([X],[V],[K])];case 1:return Q=Y.sent()[0],[2,Q]}})})},q.prototype.embedPages=function(X,V,K){if(V===void 0)V=[];if(K===void 0)K=[];return _(this,void 0,void 0,function(){var Z,H,Q,Y,J,G,W,Z,H,U,z,k,M,j,B;return c(this,function(L){switch(L.label){case 0:if(X.length===0)return[2,[]];for(Z=0,H=X.length-1;Z<H;Z++)if(Q=X[Z],Y=X[Z+1],Q.node.context!==Y.node.context)throw new G7;J=X[0].node.context,G=J===this.context?function(O){return O}:Z1.for(J,this.context).copy,W=Array(X.length),Z=0,H=X.length,L.label=1;case 1:if(!(Z<H))return[3,4];return U=G(X[Z].node),z=V[Z],k=K[Z],[4,K8.for(U,z,k)];case 2:M=L.sent(),j=this.context.nextRef(),W[Z]=R8.of(j,this,M),L.label=3;case 3:return Z++,[3,1];case 4:return(B=this.embeddedPages).push.apply(B,W),[2,W]}})})},q.prototype.flush=function(){return _(this,void 0,void 0,function(){return c(this,function(X){switch(X.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return X.sent(),[4,this.embedAll(this.images)];case 2:return X.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return X.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return X.sent(),[4,this.embedAll(this.javaScripts)];case 5:return X.sent(),[2]}})})},q.prototype.save=function(X){if(X===void 0)X={};return _(this,void 0,void 0,function(){var V,K,Q,Y,J,G,W,Z,H,U;return c(this,function(z){switch(z.label){case 0:if(V=X.useObjectStreams,K=V===void 0?!0:V,Q=X.addDefaultPage,Y=Q===void 0?!0:Q,J=X.objectsPerTick,G=J===void 0?50:J,W=X.updateFieldAppearances,Z=W===void 0?!0:W,T(K,"useObjectStreams",["boolean"]),T(Y,"addDefaultPage",["boolean"]),T(G,"objectsPerTick",["number"]),T(Z,"updateFieldAppearances",["boolean"]),Y&&this.getPageCount()===0)this.addPage();if(Z){if(H=this.formCache.getValue(),H)H.updateFieldAppearances()}return[4,this.flush()];case 1:return z.sent(),U=K?Jq:o5,[2,U.forContext(this.context,G).serializeToBuffer()]}})})},q.prototype.saveAsBase64=function(X){if(X===void 0)X={};return _(this,void 0,void 0,function(){var V,K,Q,Y,J;return c(this,function(G){switch(G.label){case 0:return V=X.dataUri,K=V===void 0?!1:V,Q=xX(X,["dataUri"]),T(K,"dataUri",["boolean"]),[4,this.save(Q)];case 1:return Y=G.sent(),J=X4(Y),[2,K?"data:application/pdf;base64,"+J:J]}})})},q.prototype.findPageForAnnotationRef=function(X){var V=this.getPages();for(var K=0,Q=V.length;K<Q;K++){var Y=V[K],J=Y.node.Annots();if((J===null||J===void 0?void 0:J.indexOf(X))!==void 0)return Y}return},q.prototype.embedAll=function(X){return _(this,void 0,void 0,function(){var V,K;return c(this,function(Q){switch(Q.label){case 0:V=0,K=X.length,Q.label=1;case 1:if(!(V<K))return[3,4];return[4,X[V].embed()];case 2:Q.sent(),Q.label=3;case 3:return V++,[3,1];case 4:return[2]}})})},q.prototype.updateInfoDict=function(){var X="pdf-lib (https://github.com/Hopding/pdf-lib)",V=new Date,K=this.getInfoDict();if(this.setProducer(X),this.setModificationDate(V),!K.get(I.of("Creator")))this.setCreator(X);if(!K.get(I.of("CreationDate")))this.setCreationDate(V)},q.prototype.getInfoDict=function(){var X=this.context.lookup(this.context.trailerInfo.Info);if(X instanceof m)return X;var V=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(V),V},q.prototype.assertFontkit=function(){if(!this.fontkit)throw new i7;return this.fontkit},q}(),o0=O3;function _6(q){if(!(q instanceof g)&&!(q instanceof K0))throw new A6([g,K0],q)}var S2;(function(q){q.Normal="Normal",q.Multiply="Multiply",q.Screen="Screen",q.Overlay="Overlay",q.Darken="Darken",q.Lighten="Lighten",q.ColorDodge="ColorDodge",q.ColorBurn="ColorBurn",q.HardLight="HardLight",q.SoftLight="SoftLight",q.Difference="Difference",q.Exclusion="Exclusion"})(S2||(S2={}));var w3=function(){function q(X,V,K){this.fontSize=24,this.fontColor=Y0(0,0,0),this.lineHeight=24,this.x=0,this.y=0,T(X,"leafNode",[[_0,"PDFPageLeaf"]]),T(V,"ref",[[a,"PDFRef"]]),T(K,"doc",[[o0,"PDFDocument"]]),this.node=X,this.ref=V,this.doc=K}return q.prototype.setRotation=function(X){var V=k1(X);Y1(V,"degreesAngle",90),this.node.set(I.of("Rotate"),this.doc.context.obj(V))},q.prototype.getRotation=function(){var X=this.node.Rotate();return p(X?X.asNumber():0)},q.prototype.setSize=function(X,V){T(X,"width",["number"]),T(V,"height",["number"]);var K=this.getMediaBox();this.setMediaBox(K.x,K.y,X,V);var Q=this.getCropBox(),Y=this.getBleedBox(),J=this.getTrimBox(),G=this.getArtBox(),W=this.node.CropBox(),Z=this.node.BleedBox(),H=this.node.TrimBox(),U=this.node.ArtBox();if(W&&n5(Q,K))this.setCropBox(K.x,K.y,X,V);if(Z&&n5(Y,K))this.setBleedBox(K.x,K.y,X,V);if(H&&n5(J,K))this.setTrimBox(K.x,K.y,X,V);if(U&&n5(G,K))this.setArtBox(K.x,K.y,X,V)},q.prototype.setWidth=function(X){T(X,"width",["number"]),this.setSize(X,this.getSize().height)},q.prototype.setHeight=function(X){T(X,"height",["number"]),this.setSize(this.getSize().width,X)},q.prototype.setMediaBox=function(X,V,K,Q){T(X,"x",["number"]),T(V,"y",["number"]),T(K,"width",["number"]),T(Q,"height",["number"]);var Y=this.doc.context.obj([X,V,X+K,V+Q]);this.node.set(I.MediaBox,Y)},q.prototype.setCropBox=function(X,V,K,Q){T(X,"x",["number"]),T(V,"y",["number"]),T(K,"width",["number"]),T(Q,"height",["number"]);var Y=this.doc.context.obj([X,V,X+K,V+Q]);this.node.set(I.CropBox,Y)},q.prototype.setBleedBox=function(X,V,K,Q){T(X,"x",["number"]),T(V,"y",["number"]),T(K,"width",["number"]),T(Q,"height",["number"]);var Y=this.doc.context.obj([X,V,X+K,V+Q]);this.node.set(I.BleedBox,Y)},q.prototype.setTrimBox=function(X,V,K,Q){T(X,"x",["number"]),T(V,"y",["number"]),T(K,"width",["number"]),T(Q,"height",["number"]);var Y=this.doc.context.obj([X,V,X+K,V+Q]);this.node.set(I.TrimBox,Y)},q.prototype.setArtBox=function(X,V,K,Q){T(X,"x",["number"]),T(V,"y",["number"]),T(K,"width",["number"]),T(Q,"height",["number"]);var Y=this.doc.context.obj([X,V,X+K,V+Q]);this.node.set(I.ArtBox,Y)},q.prototype.getSize=function(){var X=this.getMediaBox(),V=X.width,K=X.height;return{width:V,height:K}},q.prototype.getWidth=function(){return this.getSize().width},q.prototype.getHeight=function(){return this.getSize().height},q.prototype.getMediaBox=function(){var X=this.node.MediaBox();return X.asRectangle()},q.prototype.getCropBox=function(){var X,V=this.node.CropBox();return(X=V===null||V===void 0?void 0:V.asRectangle())!==null&&X!==void 0?X:this.getMediaBox()},q.prototype.getBleedBox=function(){var X,V=this.node.BleedBox();return(X=V===null||V===void 0?void 0:V.asRectangle())!==null&&X!==void 0?X:this.getCropBox()},q.prototype.getTrimBox=function(){var X,V=this.node.TrimBox();return(X=V===null||V===void 0?void 0:V.asRectangle())!==null&&X!==void 0?X:this.getCropBox()},q.prototype.getArtBox=function(){var X,V=this.node.ArtBox();return(X=V===null||V===void 0?void 0:V.asRectangle())!==null&&X!==void 0?X:this.getCropBox()},q.prototype.translateContent=function(X,V){T(X,"x",["number"]),T(V,"y",["number"]),this.node.normalize(),this.getContentStream();var K=this.createContentStream(B0(),c0(X,V)),Q=this.doc.context.register(K),Y=this.createContentStream(T0()),J=this.doc.context.register(Y);this.node.wrapContentStreams(Q,J)},q.prototype.scale=function(X,V){T(X,"x",["number"]),T(V,"y",["number"]),this.setSize(this.getWidth()*X,this.getHeight()*V),this.scaleContent(X,V),this.scaleAnnotations(X,V)},q.prototype.scaleContent=function(X,V){T(X,"x",["number"]),T(V,"y",["number"]),this.node.normalize(),this.getContentStream();var K=this.createContentStream(B0(),g6(X,V)),Q=this.doc.context.register(K),Y=this.createContentStream(T0()),J=this.doc.context.register(Y);this.node.wrapContentStreams(Q,J)},q.prototype.scaleAnnotations=function(X,V){T(X,"x",["number"]),T(V,"y",["number"]);var K=this.node.Annots();if(!K)return;for(var Q=0;Q<K.size();Q++){var Y=K.lookup(Q);if(Y instanceof m)this.scaleAnnot(Y,X,V)}},q.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},q.prototype.setFont=function(X){T(X,"font",[[w0,"PDFFont"]]),this.font=X,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},q.prototype.setFontSize=function(X){T(X,"fontSize",["number"]),this.fontSize=X},q.prototype.setFontColor=function(X){T(X,"fontColor",[[Object,"Color"]]),this.fontColor=X},q.prototype.setLineHeight=function(X){T(X,"lineHeight",["number"]),this.lineHeight=X},q.prototype.getPosition=function(){return{x:this.x,y:this.y}},q.prototype.getX=function(){return this.x},q.prototype.getY=function(){return this.y},q.prototype.moveTo=function(X,V){T(X,"x",["number"]),T(V,"y",["number"]),this.x=X,this.y=V},q.prototype.moveDown=function(X){T(X,"yDecrease",["number"]),this.y-=X},q.prototype.moveUp=function(X){T(X,"yIncrease",["number"]),this.y+=X},q.prototype.moveLeft=function(X){T(X,"xDecrease",["number"]),this.x-=X},q.prototype.moveRight=function(X){T(X,"xIncrease",["number"]),this.x+=X},q.prototype.pushOperators=function(){var X=[];for(var V=0;V<arguments.length;V++)X[V]=arguments[V];Q1(X,"operator",[[e,"PDFOperator"]]);var K=this.getContentStream();K.push.apply(K,X)},q.prototype.drawText=function(X,V){var K,Q,Y,J,G,W,Z;if(V===void 0)V={};T(X,"text",["string"]),F(V.color,"options.color",[[Object,"Color"]]),X2(V.opacity,"opacity.opacity",0,1),F(V.font,"options.font",[[w0,"PDFFont"]]),F(V.size,"options.size",["number"]),F(V.rotate,"options.rotate",[[Object,"Rotation"]]),F(V.xSkew,"options.xSkew",[[Object,"Rotation"]]),F(V.ySkew,"options.ySkew",[[Object,"Rotation"]]),F(V.x,"options.x",["number"]),F(V.y,"options.y",["number"]),F(V.lineHeight,"options.lineHeight",["number"]),F(V.maxWidth,"options.maxWidth",["number"]),F(V.wordBreaks,"options.wordBreaks",[Array]),a0(V.blendMode,"options.blendMode",S2);var H=this.setOrEmbedFont(V.font),U=H.oldFont,z=H.newFont,k=H.newFontKey,M=V.size||this.fontSize,j=V.wordBreaks||this.doc.defaultWordBreaks,B=function($){return z.widthOfTextAtSize($,M)},L=V.maxWidth===void 0?F8(k6(X)):G4(X,j,V.maxWidth,B),O=Array(L.length);for(var N=0,R=L.length;N<R;N++)O[N]=z.encodeText(L[N]);var v=this.maybeEmbedGraphicsState({opacity:V.opacity,blendMode:V.blendMode}),w=this.getContentStream();if(w.push.apply(w,_7(O,{color:(K=V.color)!==null&&K!==void 0?K:this.fontColor,font:k,size:M,rotate:(Q=V.rotate)!==null&&Q!==void 0?Q:p(0),xSkew:(Y=V.xSkew)!==null&&Y!==void 0?Y:p(0),ySkew:(J=V.ySkew)!==null&&J!==void 0?J:p(0),x:(G=V.x)!==null&&G!==void 0?G:this.x,y:(W=V.y)!==null&&W!==void 0?W:this.y,lineHeight:(Z=V.lineHeight)!==null&&Z!==void 0?Z:this.lineHeight,graphicsState:v})),V.font)if(U)this.setFont(U);else this.resetFont()},q.prototype.drawImage=function(X,V){var K,Q,Y,J,G,W,Z;if(V===void 0)V={};T(X,"image",[[R5,"PDFImage"]]),F(V.x,"options.x",["number"]),F(V.y,"options.y",["number"]),F(V.width,"options.width",["number"]),F(V.height,"options.height",["number"]),F(V.rotate,"options.rotate",[[Object,"Rotation"]]),F(V.xSkew,"options.xSkew",[[Object,"Rotation"]]),F(V.ySkew,"options.ySkew",[[Object,"Rotation"]]),X2(V.opacity,"opacity.opacity",0,1),a0(V.blendMode,"options.blendMode",S2);var H=this.node.newXObject("Image",X.ref),U=this.maybeEmbedGraphicsState({opacity:V.opacity,blendMode:V.blendMode}),z=this.getContentStream();z.push.apply(z,w1(H,{x:(K=V.x)!==null&&K!==void 0?K:this.x,y:(Q=V.y)!==null&&Q!==void 0?Q:this.y,width:(Y=V.width)!==null&&Y!==void 0?Y:X.size().width,height:(J=V.height)!==null&&J!==void 0?J:X.size().height,rotate:(G=V.rotate)!==null&&G!==void 0?G:p(0),xSkew:(W=V.xSkew)!==null&&W!==void 0?W:p(0),ySkew:(Z=V.ySkew)!==null&&Z!==void 0?Z:p(0),graphicsState:U}))},q.prototype.drawPage=function(X,V){var K,Q,Y,J,G;if(V===void 0)V={};T(X,"embeddedPage",[[R8,"PDFEmbeddedPage"]]),F(V.x,"options.x",["number"]),F(V.y,"options.y",["number"]),F(V.xScale,"options.xScale",["number"]),F(V.yScale,"options.yScale",["number"]),F(V.width,"options.width",["number"]),F(V.height,"options.height",["number"]),F(V.rotate,"options.rotate",[[Object,"Rotation"]]),F(V.xSkew,"options.xSkew",[[Object,"Rotation"]]),F(V.ySkew,"options.ySkew",[[Object,"Rotation"]]),X2(V.opacity,"opacity.opacity",0,1),a0(V.blendMode,"options.blendMode",S2);var W=this.node.newXObject("EmbeddedPdfPage",X.ref),Z=this.maybeEmbedGraphicsState({opacity:V.opacity,blendMode:V.blendMode}),H=V.width!==void 0?V.width/X.width:V.xScale!==void 0?V.xScale:1,U=V.height!==void 0?V.height/X.height:V.yScale!==void 0?V.yScale:1,z=this.getContentStream();z.push.apply(z,c7(W,{x:(K=V.x)!==null&&K!==void 0?K:this.x,y:(Q=V.y)!==null&&Q!==void 0?Q:this.y,xScale:H,yScale:U,rotate:(Y=V.rotate)!==null&&Y!==void 0?Y:p(0),xSkew:(J=V.xSkew)!==null&&J!==void 0?J:p(0),ySkew:(G=V.ySkew)!==null&&G!==void 0?G:p(0),graphicsState:Z}))},q.prototype.drawSvgPath=function(X,V){var K,Q,Y,J,G,W,Z,H,U;if(V===void 0)V={};T(X,"path",["string"]),F(V.x,"options.x",["number"]),F(V.y,"options.y",["number"]),F(V.scale,"options.scale",["number"]),F(V.rotate,"options.rotate",[[Object,"Rotation"]]),F(V.borderWidth,"options.borderWidth",["number"]),F(V.color,"options.color",[[Object,"Color"]]),X2(V.opacity,"opacity.opacity",0,1),F(V.borderColor,"options.borderColor",[[Object,"Color"]]),F(V.borderDashArray,"options.borderDashArray",[Array]),F(V.borderDashPhase,"options.borderDashPhase",["number"]),a0(V.borderLineCap,"options.borderLineCap",u6),X2(V.borderOpacity,"options.borderOpacity",0,1),a0(V.blendMode,"options.blendMode",S2);var z=this.maybeEmbedGraphicsState({opacity:V.opacity,borderOpacity:V.borderOpacity,blendMode:V.blendMode});if(!("color"in V)&&!("borderColor"in V))V.borderColor=Y0(0,0,0);var k=this.getContentStream();k.push.apply(k,d7(X,{x:(K=V.x)!==null&&K!==void 0?K:this.x,y:(Q=V.y)!==null&&Q!==void 0?Q:this.y,scale:V.scale,rotate:(Y=V.rotate)!==null&&Y!==void 0?Y:p(0),color:(J=V.color)!==null&&J!==void 0?J:void 0,borderColor:(G=V.borderColor)!==null&&G!==void 0?G:void 0,borderWidth:(W=V.borderWidth)!==null&&W!==void 0?W:0,borderDashArray:(Z=V.borderDashArray)!==null&&Z!==void 0?Z:void 0,borderDashPhase:(H=V.borderDashPhase)!==null&&H!==void 0?H:void 0,borderLineCap:(U=V.borderLineCap)!==null&&U!==void 0?U:void 0,graphicsState:z}))},q.prototype.drawLine=function(X){var V,K,Q,Y,J;T(X.start,"options.start",[[Object,"{ x: number, y: number }"]]),T(X.end,"options.end",[[Object,"{ x: number, y: number }"]]),T(X.start.x,"options.start.x",["number"]),T(X.start.y,"options.start.y",["number"]),T(X.end.x,"options.end.x",["number"]),T(X.end.y,"options.end.y",["number"]),F(X.thickness,"options.thickness",["number"]),F(X.color,"options.color",[[Object,"Color"]]),F(X.dashArray,"options.dashArray",[Array]),F(X.dashPhase,"options.dashPhase",["number"]),a0(X.lineCap,"options.lineCap",u6),X2(X.opacity,"opacity.opacity",0,1),a0(X.blendMode,"options.blendMode",S2);var G=this.maybeEmbedGraphicsState({borderOpacity:X.opacity,blendMode:X.blendMode});if(!("color"in X))X.color=Y0(0,0,0);var W=this.getContentStream();W.push.apply(W,p7({start:X.start,end:X.end,thickness:(V=X.thickness)!==null&&V!==void 0?V:1,color:(K=X.color)!==null&&K!==void 0?K:void 0,dashArray:(Q=X.dashArray)!==null&&Q!==void 0?Q:void 0,dashPhase:(Y=X.dashPhase)!==null&&Y!==void 0?Y:void 0,lineCap:(J=X.lineCap)!==null&&J!==void 0?J:void 0,graphicsState:G}))},q.prototype.drawRectangle=function(X){var V,K,Q,Y,J,G,W,Z,H,U,z,k,M;if(X===void 0)X={};F(X.x,"options.x",["number"]),F(X.y,"options.y",["number"]),F(X.width,"options.width",["number"]),F(X.height,"options.height",["number"]),F(X.rotate,"options.rotate",[[Object,"Rotation"]]),F(X.xSkew,"options.xSkew",[[Object,"Rotation"]]),F(X.ySkew,"options.ySkew",[[Object,"Rotation"]]),F(X.borderWidth,"options.borderWidth",["number"]),F(X.color,"options.color",[[Object,"Color"]]),X2(X.opacity,"opacity.opacity",0,1),F(X.borderColor,"options.borderColor",[[Object,"Color"]]),F(X.borderDashArray,"options.borderDashArray",[Array]),F(X.borderDashPhase,"options.borderDashPhase",["number"]),a0(X.borderLineCap,"options.borderLineCap",u6),X2(X.borderOpacity,"options.borderOpacity",0,1),a0(X.blendMode,"options.blendMode",S2);var j=this.maybeEmbedGraphicsState({opacity:X.opacity,borderOpacity:X.borderOpacity,blendMode:X.blendMode});if(!("color"in X)&&!("borderColor"in X))X.color=Y0(0,0,0);var B=this.getContentStream();B.push.apply(B,b6({x:(V=X.x)!==null&&V!==void 0?V:this.x,y:(K=X.y)!==null&&K!==void 0?K:this.y,width:(Q=X.width)!==null&&Q!==void 0?Q:150,height:(Y=X.height)!==null&&Y!==void 0?Y:100,rotate:(J=X.rotate)!==null&&J!==void 0?J:p(0),xSkew:(G=X.xSkew)!==null&&G!==void 0?G:p(0),ySkew:(W=X.ySkew)!==null&&W!==void 0?W:p(0),borderWidth:(Z=X.borderWidth)!==null&&Z!==void 0?Z:0,color:(H=X.color)!==null&&H!==void 0?H:void 0,borderColor:(U=X.borderColor)!==null&&U!==void 0?U:void 0,borderDashArray:(z=X.borderDashArray)!==null&&z!==void 0?z:void 0,borderDashPhase:(k=X.borderDashPhase)!==null&&k!==void 0?k:void 0,graphicsState:j,borderLineCap:(M=X.borderLineCap)!==null&&M!==void 0?M:void 0}))},q.prototype.drawSquare=function(X){if(X===void 0)X={};var V=X.size;F(V,"size",["number"]),this.drawRectangle(o(o({},X),{width:V,height:V}))},q.prototype.drawEllipse=function(X){var V,K,Q,Y,J,G,W,Z,H,U,z;if(X===void 0)X={};F(X.x,"options.x",["number"]),F(X.y,"options.y",["number"]),F(X.xScale,"options.xScale",["number"]),F(X.yScale,"options.yScale",["number"]),F(X.rotate,"options.rotate",[[Object,"Rotation"]]),F(X.color,"options.color",[[Object,"Color"]]),X2(X.opacity,"opacity.opacity",0,1),F(X.borderColor,"options.borderColor",[[Object,"Color"]]),X2(X.borderOpacity,"options.borderOpacity",0,1),F(X.borderWidth,"options.borderWidth",["number"]),F(X.borderDashArray,"options.borderDashArray",[Array]),F(X.borderDashPhase,"options.borderDashPhase",["number"]),a0(X.borderLineCap,"options.borderLineCap",u6),a0(X.blendMode,"options.blendMode",S2);var k=this.maybeEmbedGraphicsState({opacity:X.opacity,borderOpacity:X.borderOpacity,blendMode:X.blendMode});if(!("color"in X)&&!("borderColor"in X))X.color=Y0(0,0,0);var M=this.getContentStream();M.push.apply(M,O1({x:(V=X.x)!==null&&V!==void 0?V:this.x,y:(K=X.y)!==null&&K!==void 0?K:this.y,xScale:(Q=X.xScale)!==null&&Q!==void 0?Q:100,yScale:(Y=X.yScale)!==null&&Y!==void 0?Y:100,rotate:(J=X.rotate)!==null&&J!==void 0?J:void 0,color:(G=X.color)!==null&&G!==void 0?G:void 0,borderColor:(W=X.borderColor)!==null&&W!==void 0?W:void 0,borderWidth:(Z=X.borderWidth)!==null&&Z!==void 0?Z:0,borderDashArray:(H=X.borderDashArray)!==null&&H!==void 0?H:void 0,borderDashPhase:(U=X.borderDashPhase)!==null&&U!==void 0?U:void 0,borderLineCap:(z=X.borderLineCap)!==null&&z!==void 0?z:void 0,graphicsState:k}))},q.prototype.drawCircle=function(X){if(X===void 0)X={};var V=X.size,K=V===void 0?100:V;F(K,"size",["number"]),this.drawEllipse(o(o({},X),{xScale:K,yScale:K}))},q.prototype.setOrEmbedFont=function(X){var V=this.font,K=this.fontKey;if(X)this.setFont(X);else this.getFont();var Q=this.font,Y=this.fontKey;return{oldFont:V,oldFontKey:K,newFont:Q,newFontKey:Y}},q.prototype.getFont=function(){if(!this.font||!this.fontKey){var X=this.doc.embedStandardFont(N5.Helvetica);this.setFont(X)}return[this.font,this.fontKey]},q.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},q.prototype.getContentStream=function(X){if(X===void 0)X=!0;if(X&&this.contentStream)return this.contentStream;return this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream},q.prototype.createContentStream=function(){var X=[];for(var V=0;V<arguments.length;V++)X[V]=arguments[V];var K=this.doc.context.obj({}),Q=p2.of(K,X);return Q},q.prototype.maybeEmbedGraphicsState=function(X){var{opacity:V,borderOpacity:K,blendMode:Q}=X;if(V===void 0&&K===void 0&&Q===void 0)return;var Y=this.doc.context.obj({Type:"ExtGState",ca:V,CA:K,BM:Q}),J=this.node.newExtGState("GS",Y);return J},q.prototype.scaleAnnot=function(X,V,K){var Q=["RD","CL","Vertices","QuadPoints","L","Rect"];for(var Y=0,J=Q.length;Y<J;Y++){var G=X.lookup(I.of(Q[Y]));if(G instanceof i)G.scalePDFNumbers(V,K)}var W=X.lookup(I.of("InkList"));if(W instanceof i)for(var Y=0,J=W.size();Y<J;Y++){var Z=W.lookup(Y);if(Z instanceof i)Z.scalePDFNumbers(V,K)}},q.of=function(X,V,K){return new q(X,V,K)},q.create=function(X){T(X,"doc",[[o0,"PDFDocument"]]);var V=a.of(-1),K=_0.withContextAndParent(X.context,V),Q=X.context.register(K);return new q(K,Q,X)},q}(),y0=w3;var A3=function(q){A(X,q);function X(V,K,Q){var Y=q.call(this,V,K,Q)||this;return T(V,"acroButton",[[G6,"PDFAcroPushButton"]]),Y.acroField=V,Y}return X.prototype.setImage=function(V,K){if(K===void 0)K=T2.Center;var Q=this.acroField.getWidgets();for(var Y=0,J=Q.length;Y<J;Y++){var G=Q[Y],W=this.createImageAppearanceStream(G,V,K);this.updateWidgetAppearances(G,{normal:W})}this.markAsClean()},X.prototype.setFontSize=function(V){X6(V,"fontSize"),this.acroField.setFontSize(V),this.markAsDirty()},X.prototype.addToPage=function(V,K,Q){var Y,J,G,W,Z,H,U,z,k,M,j;F(V,"text",["string"]),F(K,"page",[[y0,"PDFPage"]]),v2(Q);var B=this.createWidget({x:((Y=Q===null||Q===void 0?void 0:Q.x)!==null&&Y!==void 0?Y:0)-((J=Q===null||Q===void 0?void 0:Q.borderWidth)!==null&&J!==void 0?J:0)/2,y:((G=Q===null||Q===void 0?void 0:Q.y)!==null&&G!==void 0?G:0)-((W=Q===null||Q===void 0?void 0:Q.borderWidth)!==null&&W!==void 0?W:0)/2,width:(Z=Q===null||Q===void 0?void 0:Q.width)!==null&&Z!==void 0?Z:100,height:(H=Q===null||Q===void 0?void 0:Q.height)!==null&&H!==void 0?H:50,textColor:(U=Q===null||Q===void 0?void 0:Q.textColor)!==null&&U!==void 0?U:Y0(0,0,0),backgroundColor:(z=Q===null||Q===void 0?void 0:Q.backgroundColor)!==null&&z!==void 0?z:Y0(0.75,0.75,0.75),borderColor:Q===null||Q===void 0?void 0:Q.borderColor,borderWidth:(k=Q===null||Q===void 0?void 0:Q.borderWidth)!==null&&k!==void 0?k:0,rotate:(M=Q===null||Q===void 0?void 0:Q.rotate)!==null&&M!==void 0?M:p(0),caption:V,hidden:Q===null||Q===void 0?void 0:Q.hidden,page:K.ref}),L=this.doc.context.register(B.dict);this.acroField.addWidget(L);var O=(j=Q===null||Q===void 0?void 0:Q.font)!==null&&j!==void 0?j:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(B,O),K.node.addAnnot(L)},X.prototype.needsAppearancesUpdate=function(){var V;if(this.isDirty())return!0;var K=this.acroField.getWidgets();for(var Q=0,Y=K.length;Q<Y;Q++){var J=K[Q],G=((V=J.getAppearances())===null||V===void 0?void 0:V.normal)instanceof E0;if(!G)return!0}return!1},X.prototype.defaultUpdateAppearances=function(V){T(V,"font",[[w0,"PDFFont"]]),this.updateAppearances(V)},X.prototype.updateAppearances=function(V,K){T(V,"font",[[w0,"PDFFont"]]),F(K,"provider",[Function]);var Q=this.acroField.getWidgets();for(var Y=0,J=Q.length;Y<J;Y++){var G=Q[Y];this.updateWidgetAppearance(G,V,K)}},X.prototype.updateWidgetAppearance=function(V,K,Q){var Y=Q!==null&&Q!==void 0?Q:JX,J=G2(Y(this,V,K));this.updateWidgetAppearanceWithFont(V,K,J)},X.of=function(V,K,Q){return new X(V,K,Q)},X}(d0),S5=A3;if(typeof globalThis.Buffer>"u")globalThis.Buffer=y;if(typeof globalThis.process>"u")globalThis.process=N3;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles["pdf-lib"]=UX;})();

Callers 1

pdf-lib.cjsFile · 0.70

Calls 1

Z8Function · 0.70

Tested by

no test coverage detected