text: import t from"fs";import e from"blob-stream";import i from"react-reconciler";import{unstable_scheduleCallback as r,unstable_cancelCallback as o}from"scheduler";import s,{PDFFont as n}from"@react-pdf/pdfkit";import{Fragment as a}from"react";import h from"yoga-layout-prebuilt";import{mergeDeepWith as l,isNil as d,compose as c,equals as u,type as p,toPairsIn as g,pick as f,pathOr as m,last as y,propEq as b,complement as T,prop as w}from"ramda";import E from"media-engine";import C from"@react-pdf/textkit/renderers/pdf";import v from"@react-pdf/textkit/attributedString";import P from"is-url";import x from"@react-pdf/fontkit";import R from"cross-fetch";import S from"@react-pdf/textkit/layout";import A from"@react-pdf/textkit/engines/linebreaker";import L from"@react-pdf/textkit/engines/justification";import B from"@react-pdf/textkit/engines/textDecoration";import O from"@react-pdf/textkit/engines/scriptItemizer";import M from"@react-pdf/textkit/engines/wordHyphenation";import D from"emoji-regex";import W from"url";import _ from"path";import I from"@react-pdf/png-js";import k from"page-wrapping";const z=t=>t.charAt(0).toUpperCase()+t.slice(1),F=t=>{const e=(t=>/((-)?\d+\.?\d*)%/g.exec(t))(t);if(e){const t=parseFloat(e[1],10),i=t/100;return{value:t,percent:i,absValue:Math.abs(t),absPercent:Math.abs(i)}}return null},N=h.Config.create();N.setPointScaleFactor(0);class G{constructor(){this.parent=null,this.children=[],this.computed=!1,this.layout=h.Node.createWithConfig(N)}appendChild(t){t&&(t.parent=this,this.children.push(t),this.layout.insertChild(t.layout,this.layout.getChildCount()))}appendChildBefore(t,e){const i=this.children.indexOf(e);-1!==i&&t&&(t.parent=this,this.children.splice(i,0,t),this.layout.insertChild(t.layout,i))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.layout.removeChild(t.layout)),t.cleanup()}removeAllChilds(){const t=[...this.children];for(let e=0;e<t.length;e++)t[e].remove()}remove(){this.parent.removeChild(this)}setDimension(t,e){const i=`set${z(t)}`,r=`${i}Percent`,o=F(e);o?this.layout[r](o.value):this.layout[i](e)}setPosition(t,e){const i=F(e);i?this.layout.setPositionPercent(t,i.value):this.layout.setPosition(t,e)}setPadding(t,e){const i=F(e);i?this.layout.setPaddingPercent(t,i.value):this.layout.setPadding(t,e)}setMargin(t,e){const i=F(e);i?this.layout.setMarginPercent(t,i.value):this.layout.setMargin(t,e)}setBorder(t,e){if(F(e))throw new Error("Node: You cannot set percentage border widths");this.layout.setBorder(t,e)}getAbsoluteLayout(){const t=this.parent,e=t&&t.getAbsoluteLayout?t.getAbsoluteLayout():{left:0,top:0};return{left:this.left+e.left,top:this.top+e.top,height:this.height,width:this.width}}copyStyle(t){this.layout.copyStyle(t.layout)}calculateLayout(){this.layout.calculateLayout(),this.computed=!0}isEmpty(){return 0===this.children.length}markDirty(){return this.layout.markDirty()}onAppendDynamically(){}cleanup(){this.children.forEach(t=>t.cleanup()),this.layout.unsetMeasureFunc(),h.Node.destroy(this.layout)}get position(){return this.layout.getPositionType()===h.POSITION_TYPE_ABSOLUTE?"absolute":"relative"}get top(){return this.layout.getComputedTop()||0}get left(){return this.layout.getComputedLeft()||0}get right(){return this.layout.getComputedRight()||0}get bottom(){return this.layout.getComputedBottom()||0}get width(){return this.layout.getComputedWidth()}get minWidth(){return this.layout.getMinWidth().value}get maxWidth(){return this.layout.getMaxWidth().value}get height(){return this.layout.getComputedHeight()}get minHeight(){return this.layout.getMinHeight().value}get maxHeight(){return this.layout.getMaxHeight().value}get paddingTop(){return this.layout.getComputedPadding(h.EDGE_TOP)||0}get paddingRight(){return this.layout.getComputedPadding(h.EDGE_RIGHT)||0}get paddingBottom(){return this.layout.getComputedPadding(h.EDGE_BOTTOM)||0}get paddingLeft(){return this.layout.getComputedPadding(h.EDGE_LEFT)||0}get marginTop(){return this.layout.getComputedMargin(h.EDGE_TOP)||0}get marginRight(){return this.layout.getComputedMargin(h.EDGE_RIGHT)||0}get marginBottom(){return this.layout.getComputedMargin(h.EDGE_BOTTOM)||0}get marginLeft(){return this.layout.getComputedMargin(h.EDGE_LEFT)||0}get borderTopWidth(){return this.layout.getComputedBorder(h.EDGE_TOP)||0}get borderRightWidth(){return this.layout.getComputedBorder(h.EDGE_RIGHT)||0}get borderBottomWidth(){return this.layout.getComputedBorder(h.EDGE_BOTTOM)||0}get borderLeftWidth(){return this.layout.getComputedBorder(h.EDGE_LEFT)||0}get padding(){return{top:this.paddingTop,right:this.paddingRight,bottom:this.paddingBottom,left:this.paddingLeft}}get margin(){return{top:this.marginTop,right:this.marginRight,bottom:this.marginBottom,left:this.marginLeft}}set position(t){this.layout.setPositionType("absolute"===t?h.POSITION_TYPE_ABSOLUTE:h.POSITION_TYPE_RELATIVE)}set top(t){this.setPosition(h.EDGE_TOP,t)}set left(t){this.setPosition(h.EDGE_LEFT,t)}set right(t){this.setPosition(h.EDGE_RIGHT,t)}set bottom(t){this.setPosition(h.EDGE_BOTTOM,t)}set width(t){this.setDimension("width",t)}set minWidth(t){this.setDimension("minWidth",t)}set maxWidth(t){this.setDimension("maxWidth",t)}set height(t){this.setDimension("height",t)}set minHeight(t){this.setDimension("minHeight",t)}set maxHeight(t){this.setDimension("maxHeight",t)}set paddingTop(t){this.setPadding(h.EDGE_TOP,t)}set paddingRight(t){this.setPadding(h.EDGE_RIGHT,t)}set paddingBottom(t){this.setPadding(h.EDGE_BOTTOM,t)}set paddingLeft(t){this.setPadding(h.EDGE_LEFT,t)}set marginTop(t){this.setMargin(h.EDGE_TOP,t)}set marginRight(t){this.setMargin(h.EDGE_RIGHT,t)}set marginBottom(t){this.setMargin(h.EDGE_BOTTOM,t)}set marginLeft(t){this.setMargin(h.EDGE_LEFT,t)}set padding(t){this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t}set margin(t){this.marginTop=t,this.marginRight=t,this.marginBottom=t,this.marginLeft=t}set borderTopWidth(t){this.setBorder(h.EDGE_TOP,t)}set borderRightWidth(t){this.setBorder(h.EDGE_RIGHT,t)}set borderBottomWidth(t){this.setBorder(h.EDGE_BOTTOM,t)}set borderLeftWidth(t){this.setBorder(h.EDGE_LEFT,t)}}const H=(t,e)=>{const i=t=>"alignItems"===t||"alignContent"===t||"alignSelf"===t;switch(e){case"auto":if("alignSelf"===t)return h.ALIGN_AUTO;break;case"flex":return h.DISPLAY_FLEX;case"none":return h.DISPLAY_NONE;case"row":return h.FLEX_DIRECTION_ROW;case"row-reverse":return h.FLEX_DIRECTION_ROW_REVERSE;case"column":return h.FLEX_DIRECTION_COLUMN;case"column-reverse":return h.FLEX_DIRECTION_COLUMN_REVERSE;case"stretch":return h.ALIGN_STRETCH;case"baseline":return h.ALIGN_BASELINE;case"space-around":if("justifyContent"===t)return h.JUSTIFY_SPACE_AROUND;if(i(t))return h.ALIGN_SPACE_AROUND;break;case"space-between":if("justifyContent"===t)return h.JUSTIFY_SPACE_BETWEEN;if(i(t))return h.ALIGN_SPACE_BETWEEN;break;case"around":return h.JUSTIFY_SPACE_AROUND;case"between":return h.JUSTIFY_SPACE_BETWEEN;case"wrap":return h.WRAP_WRAP;case"wrap-reverse":return h.WRAP_WRAP_REVERSE;case"nowrap":return h.WRAP_NO_WRAP;case"flex-start":if("justifyContent"===t)return h.JUSTIFY_FLEX_START;if(i(t))return h.ALIGN_FLEX_START;break;case"flex-end":if("justifyContent"===t)return h.JUSTIFY_FLEX_END;if(i(t))return h.ALIGN_FLEX_END;break;case"center":if("justifyContent"===t)return h.JUSTIFY_CENTER;if(i(t))return h.ALIGN_CENTER;break;default:return e}},j=(t,e)=>{const i=(t=>{const e=/^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw)?$/g.exec(t);return e?{value:parseFloat(e[1],10),unit:e[2]||"pt"}:{value:t,unit:void 0}})(t);switch(i.unit){case"in":return 72*i.value;case"mm":return i.value*(1/25.4)*72;case"cm":return i.value*(1/2.54)*72;case"vh":if(e.isAutoHeight)throw new Error("vh unit not supported in auto-height pages. Please specify page height if you want to use vh.");return i.value*(e.height/100);case"vw":return i.value*(e.width/100);default:return i.value}},U=(t,e)=>t.match(/^border/)&&"string"==typeof e,V=(t,e)=>{const i=(t=>t.match(/(\d+(px|in|mm|cm|pt|vw|vh)?)\s(\S+)\s(\S+)/))(e);if(i){if(t.match(/.Color/))return i[4];if(t.match(/.Style/))return i[3];if(t.match(/.Width/))return i[1];throw new Error(`StyleSheet: Invalid '${e}' for '${t}'`)}return e},X=(t,e)=>t.match(/^(margin)|(padding)/)&&"string"==typeof e,$=(t,e)=>{const i=(t=>t.match(/\d+(px|in|mm|cm|pt|%|vw|vh)?/g))(e);if(i){if(t.match(/.Top/))return i[0];if(t.match(/.Right/))return i[1]||i[0];if(t.match(/.Bottom/))return i[2]||i[0];if(t.match(/.Left/))return i[3]||i[1]||i[0];throw new Error(`StyleSheet: Invalid '${e}' for '${t}'`)}return e},Y={thin:100,hairline:100,ultralight:200,extralight:200,light:300,normal:400,medium:500,semibold:600,demibold:600,bold:700,ultrabold:800,extrabold:800,heavy:900,black:900},J=t=>t.match(/^fontWeight/),q=t=>t?"number"==typeof t?t:Y[t.toLowerCase()]:Y.normal,K=(t,e)=>t.match(/^objectPosition/)&&"string"==typeof e,Z=(t,e)=>{const i=(t=>t.match(/\d+(px|in|mm|cm|pt|%|vw|vh)?/g))(e);if(i){if(t.match(/.X/))return i[0];if(t.match(/.Y/))return i[1];throw new Error(`StyleSheet: Invalid '${e}' for '${t}'`)}return e},Q=(t,e)=>t.match(/^transformOrigin/)&&"string"==typeof e,tt=(t,e)=>{const i=(t=>t.match(/(-?\d+(px|in|mm|cm|pt|%|vw|vh)?)|top|right|bottom|left|center/g))(e);if(i){let r;if(t.match(/.X/))r=i[0];else{if(!t.match(/.Y/))throw new Error(`StyleSheet: Invalid '${e}' for '${t}'`);r=i[1]||i[0]}return(t=>{switch(t){case"top":case"left":return"0%";case"right":case"bottom":return"100%";case"center":return"50%";default:return t}})(r)}return e},et=Object.prototype.hasOwnProperty,it={margin:{marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},marginHorizontal:{marginLeft:!0,marginRight:!0},marginVertical:{marginTop:!0,marginBottom:!0},padding:{paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},paddingHorizontal:{paddingLeft:!0,paddingRight:!0},paddingVertical:{paddingTop:!0,paddingBottom:!0},border:{borderTopColor:!0,borderTopStyle:!0,borderTopWidth:!0,borderRightColor:!0,borderRightStyle:!0,borderRightWidth:!0,borderBottomColor:!0,borderBottomStyle:!0,borderBottomWidth:!0,borderLeftColor:!0,borderLeftStyle:!0,borderLeftWidth:!0},borderTop:{borderTopColor:!0,borderTopStyle:!0,borderTopWidth:!0},borderRight:{borderRightColor:!0,borderRightStyle:!0,borderRightWidth:!0},borderBottom:{borderBottomColor:!0,borderBottomStyle:!0,borderBottomWidth:!0},borderLeft:{borderLeftColor:!0,borderLeftStyle:!0,borderLeftWidth:!0},borderColor:{borderTopColor:!0,borderRightColor:!0,borderBottomColor:!0,borderLeftColor:!0},borderRadius:{borderTopLeftRadius:!0,borderTopRightRadius:!0,borderBottomRightRadius:!0,borderBottomLeftRadius:!0},borderStyle:{borderTopStyle:!0,borderRightStyle:!0,borderBottomStyle:!0,borderLeftStyle:!0},borderWidth:{borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},objectPosition:{objectPositionX:!0,objectPositionY:!0},transformOrigin:{transformOriginX:!0,transformOriginY:!0}},rt=(t,e)=>{const i=(t=>{if(!t)return t;const e=Object.keys(t),i={};for(let r=0;r<e.length;r++){const o=e[r],s=t[o];switch(o){case"display":case"flex":case"flexDirection":case"flexWrap":case"flexFlow":case"flexGrow":case"flexShrink":case"flexBasis":case"justifyContent":case"alignSelf":case"alignItems":case"alignContent":case"order":i[o]=H(o,s);break;case"textAlignVertical":i.verticalAlign="center"===s?"middle":s;break;case"margin":case"marginHorizontal":case"marginVertical":case"padding":case"paddingHorizontal":case"paddingVertical":case"border":case"borderTop":case"borderRight":case"borderBottom":case"borderLeft":case"borderColor":case"borderRadius":case"borderStyle":case"borderWidth":case"objectPosition":case"transformOrigin":{const t=it[o];for(const e in t)et.call(t,e)&&(i[e]=s)}break;default:i[o]=s}}return i})(t),r=Object.keys(i),o={};for(let t=0;t<r.length;t++){const s=r[t],n=i[s];let a;a=U(s,n)?V(s,n):X(s,n)?$(s,n):K(s,n)?Z(s,n):Q(s,n)?tt(s,n):J(s)?q(n):n,o[s]=j(a,e)}return o},ot=t=>{return Array.isArray(t)||(t=[t]),t.reduce((t,e)=>{if(e){const i=Array.isArray(e)?ot(e):e;Object.keys(i).forEach(e=>{null!==i[e]&&void 0!==i[e]&&(t[e]=i[e])})}return t},{})};var st={hairlineWidth:1,create:t=>t,resolve:(t,e)=>t?(t=((t,e)=>Object.keys(t).reduce((i,r)=>/@media/.test(r)?{...i,...E({[r]:t[r]},e)}:{...i,[r]:t[r]},{}))(t=ot(t),e),t=rt(t,e)):null,flatten:ot,absoluteFillObject:{position:"absolute",top:0,left:0,bottom:0,right:0}};const nt={debug(){const t=this.getAbsoluteLayout(),e=this.padding,i=this.margin;this.root.instance.save(),this.debugContent(t,i,e),this.debugPadding(t,i,e),this.debugMargin(t,i),this.debugText(t,i),this.debugOrigin(),this.root.instance.restore()},debugOrigin(){if(this.style.transform){const t=this.origin;this.root.instance.circle(t[0],t[1],3).fill("red").circle(t[0],t[1],5).stroke("red")}},debugText(t,e){const i=Math.round(this.width+e.left+e.right),r=Math.round(this.height+e.top+e.bottom);this.root.instance.fontSize(4).opacity(1).fillColor("black").text(`${i} x ${r}`,t.left-e.left,Math.max(t.top-e.top-4,1))},debugContent(t,e,i){this.root.instance.fillColor("#a1c6e7").opacity(.5).rect(t.left+i.left,t.top+i.top,t.width-i.left-i.right,t.height-i.top-i.bottom).fill()},debugPadding(t,e,i){this.root.instance.fillColor("#c4deb9").opacity(.5),this.root.instance.rect(t.left+i.left,t.top,t.width-i.right-i.left,i.top).fill(),this.root.instance.rect(t.left,t.top,i.left,t.height).fill(),this.root.instance.rect(t.left+t.width-i.right,t.top,i.right,t.height).fill(),this.root.instance.rect(t.left+i.left,t.top+t.height-i.bottom,t.width-i.right-i.left,i.bottom).fill()},debugMargin(t,e){this.root.instance.fillColor("#f8cca1").opacity(.5),this.root.instance.rect(t.left,t.top-e.top,t.width,e.top).fill(),this.root.instance.rect(t.left-e.left,t.top-e.top,e.left,t.height+e.top+e.bottom).fill(),this.root.instance.rect(t.left+t.width,t.top-e.top,e.right,t.height+e.top+e.bottom).fill(),this.root.instance.rect(t.left,t.top+t.height,t.width,e.bottom).fill()}},at=(Math.sqrt(2)-1)/3*4;const ht=(t,e,i,r,o)=>{const{top:s,left:n,width:a,height:h}=e,{borderTopWidth:l,borderRightWidth:d,borderLeftWidth:c}=i;t.moveTo(n+o,s),t.lineTo(n+a-r,s);const u=r*(1-at);t.bezierCurveTo(n+a-u,s,n+a,s+u,n+a,s+r);const p=s+Math.max(l,r);t.lineTo(n+a,p),t.lineTo(n+a-d,p);const g=Math.max(r-d,0),f=Math.max(r-l,0),m=g*(1-at),y=f*(1-at);t.bezierCurveTo(n+a-d,s+l+y,n+a-d-m,s+l,n+a-d-g,s+l),t.lineTo(n+Math.max(o,c),s+l);const b=Math.max(o-c,0),T=Math.max(o-l,0),w=b*(1-at),E=T*(1-at),C=s+Math.max(l,o);t.bezierCurveTo(n+c+w,s+l,n+c,s+l+E,n+c,C),t.lineTo(n,C),t.lineTo(n,s+o);const v=o*(1-at);if(t.bezierCurveTo(n,s+v,n+v,s,n+o,s),t.closePath(),t.clip(),d){const e=-l/d;t.moveTo(n+a/2,e*(-a/2)+s),t.lineTo(n+a,s),t.lineTo(n,s),t.lineTo(n,s+h),t.closePath(),t.clip()}if(c){const e=-l/c;t.moveTo(n+a/2,e*(-a/2)+s),t.lineTo(n,s),t.lineTo(n+a,s),t.lineTo(n+a,s+h),t.closePath(),t.clip()}},lt=(t,e,i,r,o)=>{const{top:s,left:n,width:a}=e,{borderTopColor:h,borderTopWidth:l,borderTopStyle:d,borderRightWidth:c,borderLeftWidth:u}=i,p=o*(1-at),g=r*(1-at);t.moveTo(n,s+Math.max(o,l)),t.bezierCurveTo(n,s+p,n+p,s,n+o,s),t.lineTo(n+a-r,s),t.bezierCurveTo(n+a-g,s,n+a,s+g,n+a,s+r),t.strokeColor(h),t.lineWidth(2*Math.max(c,l,u)),"dashed"===d?t.dash(2*l,{space:1.2*l}):"dotted"===d&&t.dash(l,{space:1.2*l}),t.stroke(),t.undash()},dt=(t,e,i,r,o)=>{const{top:s,left:n,width:a,height:h}=e,{borderTopWidth:l,borderRightWidth:d,borderBottomWidth:c}=i;t.moveTo(n+a,s+r),t.lineTo(n+a,s+h-o);const u=o*(1-at);t.bezierCurveTo(n+a,s+h-u,n+a-u,s+h,n+a-o,s+h);const p=n+a-Math.max(d,o);t.lineTo(p,s+h),t.lineTo(p,s+h-c);const g=Math.max(o-d,0),f=Math.max(o-c,0),m=g*(1-at),y=f*(1-at);t.bezierCurveTo(n+a-d-m,s+h-c,n+a-d,s+h-c-y,n+a-d,s+h-Math.max(o,c)),t.lineTo(n+a-d,s+Math.max(r,l));const b=Math.max(r-d,0),T=Math.max(r-l,0),w=b*(1-at),E=T*(1-at),C=n+a-Math.max(r,d);t.bezierCurveTo(n+a-d,s+l+E,n+a-d-w,s+l,C,s+l),t.lineTo(C,s),t.lineTo(n+a-r,s);const v=r*(1-at);if(t.bezierCurveTo(n+a-v,s,n+a,s+v,n+a,s+r),t.closePath(),t.clip(),l){const e=-l/d;t.moveTo(n+a/2,e*(-a/2)+s),t.lineTo(n+a,s),t.lineTo(n+a,s+h),t.lineTo(n,s+h),t.closePath(),t.clip()}if(c){const e=c/d;t.moveTo(n+a/2,e*(-a/2)+s+h),t.lineTo(n+a,s+h),t.lineTo(n+a,s),t.lineTo(n,s),t.closePath(),t.clip()}},ct=(t,e,i,r,o)=>{const{top:s,left:n,width:a,height:h}=e,{borderRightColor:l,borderRightStyle:d,borderRightWidth:c,borderTopWidth:u,borderBottomWidth:p}=i,g=o*(1-at),f=r*(1-at);t.moveTo(n+a-r,s),t.bezierCurveTo(n+a-f,s,n+a,s+f,n+a,s+r),t.lineTo(n+a,s+h-o),t.bezierCurveTo(n+a,s+h-g,n+a-g,s+h,n+a-o,s+h),t.strokeColor(l),t.lineWidth(2*Math.max(c,u,p)),"dashed"===d?t.dash(2*c,{space:1.2*c}):"dotted"===d&&t.dash(c,{space:1.2*c}),t.stroke(),t.undash()},ut=(t,e,i,r,o)=>{const{top:s,left:n,width:a,height:h}=e,{borderBottomWidth:l,borderRightWidth:d,borderLeftWidth:c}=i;t.moveTo(n+a-o,s+h),t.lineTo(n+r,s+h);const u=r*(1-at);t.bezierCurveTo(n+u,s+h,n,s+h-u,n,s+h-r);const p=s+h-Math.max(l,r);t.lineTo(n,p),t.lineTo(n+c,p);const g=Math.max(r-c,0),f=Math.max(r-l,0),m=g*(1-at),y=f*(1-at);t.bezierCurveTo(n+c,s+h-l-y,n+c+m,s+h-l,n+c+g,s+h-l),t.lineTo(n+a-Math.max(o,d),s+h-l);const b=Math.max(o-d,0),T=Math.max(o-l,0),w=b*(1-at),E=T*(1-at),C=s+h-Math.max(l,o);t.bezierCurveTo(n+a-d-w,s+h-l,n+a-d,s+h-l-E,n+a-d,C),t.lineTo(n+a,C),t.lineTo(n+a,s+h-o);const v=o*(1-at);if(t.bezierCurveTo(n+a,s+h-v,n+a-v,s+h,n+a-o,s+h),t.closePath(),t.clip(),d){const e=l/d;t.moveTo(n+a/2,e*(-a/2)+s+h),t.lineTo(n+a,s+h),t.lineTo(n,s+h),t.lineTo(n,s),t.closePath(),t.clip()}if(c){const e=-l/c;t.moveTo(n+a/2,e*(a/2)+s+h),t.lineTo(n,s+h),t.lineTo(n+a,s+h),t.lineTo(n+a,s),t.closePath(),t.clip()}},pt=(t,e,i,r,o)=>{const{top:s,left:n,width:a,height:h}=e,{borderBottomColor:l,borderBottomStyle:d,borderBottomWidth:c,borderRightWidth:u,borderLeftWidth:p}=i,g=r*(1-at),f=o*(1-at);t.moveTo(n+a,s+h-o),t.bezierCurveTo(n+a,s+h-f,n+a-f,s+h,n+a-o,s+h),t.lineTo(n+r,s+h),t.bezierCurveTo(n+g,s+h,n,s+h-g,n,s+h-r),t.strokeColor(l),t.lineWidth(2*Math.max(c,u,p)),"dashed"===d?t.dash(2*c,{space:1.2*c}):"dotted"===d&&t.dash(c,{space:1.2*c}),t.stroke(),t.undash()},gt=(t,e,i,r,o)=>{const{top:s,left:n,width:a,height:h}=e,{borderTopWidth:l,borderLeftWidth:d,borderBottomWidth:c}=i;t.moveTo(n,s+h-r),t.lineTo(n,s+o);const u=o*(1-at);t.bezierCurveTo(n,s+u,n+u,s,n+o,s);const p=n+Math.max(d,o);t.lineTo(p,s),t.lineTo(p,s+l);const g=Math.max(o-d,0),f=Math.max(o-l,0),m=g*(1-at),y=f*(1-at);t.bezierCurveTo(n+d+m,s+l,n+d,s+l+y,n+d,s+Math.max(o,l)),t.lineTo(n+d,s+h-Math.max(r,c));const b=Math.max(r-d,0),T=Math.max(r-c,0),w=b*(1-at),E=T*(1-at),C=n+Math.max(r,d);t.bezierCurveTo(n+d,s+h-c-E,n+d+w,s+h-c,C,s+h-c),t.lineTo(C,s+h),t.lineTo(n+r,s+h);const v=r*(1-at);if(t.bezierCurveTo(n+v,s+h,n,s+h-v,n,s+h-r),t.closePath(),t.clip(),c){const e=-c/d;t.moveTo(n+a/2,e*(a/2)+s+h),t.lineTo(n,s+h),t.lineTo(n,s),t.lineTo(n+a,s),t.closePath(),t.clip()}if(c){const e=-l/d;t.moveTo(n+a/2,e*(-a/2)+s),t.lineTo(n,s),t.lineTo(n,s+h),t.lineTo(n+a,s+h),t.closePath(),t.clip()}},ft=(t,e,i,r,o)=>{const{top:s,left:n,height:a}=e,{borderLeftColor:h,borderLeftStyle:l,borderLeftWidth:d,borderTopWidth:c,borderBottomWidth:u}=i,p=r*(1-at),g=o*(1-at);t.moveTo(n+r,s+a),t.bezierCurveTo(n+p,s+a,n,s+a-p,n,s+a-r),t.lineTo(n,s+o),t.bezierCurveTo(n,s+g,n+g,s,n+o,s),t.strokeColor(h),t.lineWidth(2*Math.max(d,c,u)),"dashed"===l?t.dash(2*d,{space:1.2*d}):"dotted"===l&&t.dash(d,{space:1.2*d}),t.stroke(),t.undash()};var mt={drawBorders:function(){const{instance:t}=this.root,e=this.getAbsoluteLayout(),{borderTopWidth:i,borderLeftWidth:r,borderRightWidth:o,borderBottomWidth:s}=this,{opacity:n,borderTopLeftRadius:a=0,borderTopRightRadius:h=0,borderBottomLeftRadius:l=0,borderBottomRightRadius:d=0,borderTopColor:c="black",borderTopStyle:u="solid",borderLeftColor:p="black",borderLeftStyle:g="solid",borderRightColor:f="black",borderRightStyle:m="solid",borderBottomColor:y="black",borderBottomStyle:b="solid"}=this.style,T={borderTopColor:c,borderTopWidth:i,borderTopStyle:u,borderLeftColor:p,borderLeftWidth:r,borderLeftStyle:g,borderRightColor:f,borderRightWidth:o,borderRightStyle:m,borderBottomColor:y,borderBottomWidth:s,borderBottomStyle:b,borderTopLeftRadius:a,borderTopRightRadius:h,borderBottomLeftRadius:l,borderBottomRightRadius:d},{width:w,height:E}=e,C=Math.min(h,.5*w,.5*E),v=Math.min(a,.5*w,.5*E),P=Math.min(d,.5*w,.5*E),x=Math.min(l,.5*w,.5*E);t.save(),t.strokeOpacity(n),i&&(t.save(),ht(t,e,T,C,v),lt(t,e,T,C,v),t.restore()),o&&(t.save(),dt(t,e,T,C,P),ct(t,e,T,C,P),t.restore()),s&&(t.save(),ut(t,e,T,x,P),pt(t,e,T,x,P),t.restore()),r&&(t.save(),gt(t,e,T,x,v),ft(t,e,T,x,v),t.restore()),t.restore()}};const yt=(Math.sqrt(2)-1)/3*4,bt={clip(){const{top:t,left:e,width:i,height:r}=this.getAbsoluteLayout(),{borderTopLeftRadius:o=0,borderTopRightRadius:s=0,borderBottomRightRadius:n=0,borderBottomLeftRadius:a=0}=this.style,h=Math.min(s,.5*i,.5*r),l=h*(1-yt);this.root.instance.moveTo(e+h,t),this.root.instance.lineTo(e+i-h,t),this.root.instance.bezierCurveTo(e+i-l,t,e+i,t+l,e+i,t+h);const d=Math.min(n,.5*i,.5*r),c=d*(1-yt);this.root.instance.lineTo(e+i,t+r-d),this.root.instance.bezierCurveTo(e+i,t+r-c,e+i-c,t+r,e+i-d,t+r);const u=Math.min(a,.5*i,.5*r),p=u*(1-yt);this.root.instance.lineTo(e+u,t+r),this.root.instance.bezierCurveTo(e+p,t+r,e,t+r-p,e,t+r-u);const g=Math.min(o,.5*i,.5*r),f=g*(1-yt);this.root.instance.lineTo(e,t+g),this.root.instance.bezierCurveTo(e,t+f,e+f,t,e+g,t),this.root.instance.closePath(),this.root.instance.clip()}},Tt=t=>{const e=/translateX\((-?\d+\.?d*)\)/g.exec(t),i=/translate\((-?\d+\.?d*).*,\s*(-?\d+\.?d*).*\)/g.exec(t);return e&&e[1]?e[1]:i&&i[1]?i[1]:0},wt=t=>{const e=/translateY\((-?\d+\.?\d*)\)/g.exec(t),i=/translate\((-?\d+\.?\d*).*,\s*(-?\d+\.?\d*).*\)/g.exec(t);return e&&e[1]?e[1]:i&&i[2]?i[2]:0},Et=t=>{const e=/scaleX\((-?\d+\.?\d*)\)/g.exec(t),i=/scale\((-?\d+\.?\d*).*,\s*(-?\d+\.?\d*).*\)/g.exec(t);return e&&e[1]?e[1]:i&&i[1]?i[1]:1},Ct=t=>{const e=/scaleY\((-?\d+\.?\d*)\)/g.exec(t),i=/scale\((-?\d+\.?\d*).*,\s*(-?\d+\.?\d*).*\)/g.exec(t);return e&&e[1]?e[1]:i&&i[2]?i[2]:1},vt=(t,e,i)=>{/rotate/g.test(e)?t.root.instance.rotate((t=>{const e=/rotate\((-?\d+.?\d+)(.+)\)/g.exec(t);if(e&&e[1]&&e[2]){const t=e[1];return"rad"===e[2]?180*t/Math.PI:t}return 0})(e),{origin:i}):/scaleX/g.test(e)?t.root.instance.scale(Et(e),1,{origin:i}):/scaleY/g.test(e)?t.root.instance.scale(1,Ct(e),{origin:i}):/scale/g.test(e)?t.root.instance.scale(Et(e),Ct(e),{origin:i}):/translateX/g.test(e)?t.root.instance.translate(Tt(e),1,{origin:i}):/translateY/g.test(e)?t.root.instance.translate(1,wt(e),{origin:i}):/translate/g.test(e)?t.root.instance.translate(Tt(e),wt(e),{origin:i}):/matrix/g.test(e)&&t.root.instance.transform(...(t=>{const e=/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/g.exec(t);return e?e.slice(1,7):null})(e))},Pt={applyTransformations(){let t;const e=/[a-zA-Z]+\([^)]+\)/g,i=this.origin,r=this.style&&this.style.transform||"";for(;null!=(t=e.exec(r));)vt(this,t[0],i)}};const xt="production"!==process.env.NODE_ENV?(t,e,...i)=>{if(void 0===e)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");t||function(t,...e){let i=0;const r="Warning: "+t.replace(/%s/g,()=>e[i++]);"undefined"!=typeof console&&console.error(r);try{throw new Error(r)}catch(t){}}(e,...i)}:()=>{},Rt=(t,e)=>d(e)?t:e,St=t=>t.reduce((t,e)=>l(Rt,t,e),{}),At=c(u("Function"),p),Lt=["color","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","opacity","textDecoration","lineHeight","textAlign","textTransform","visibility","wordSpacing"];class Bt extends G{constructor(t,e){super(),this.root=t,this.style={},this.props=St([this.constructor.defaultProps,Bt.defaultProps,e]),xt(!this.props.styles,'"styles" prop passed instead of "style" prop')}get page(){return this.parent.page}get wrap(){return this.props.wrap}get break(){return this.props.break}get fixed(){return this.props.fixed}get minPresenceAhead(){return this.props.minPresenceAhead}get absolute(){return"absolute"===this.props.style.position}get origin(){const{transformOriginX:t,transformOriginY:e}=this.style,{left:i,top:r,width:o,height:s}=this.getAbsoluteLayout(),n=F(t),a=F(e);return[i+(n?o*n.percent:t),r+(a?s*a.percent:e)]}set break(t){this.props.break=t}appendChild(t){super.appendChild(t),this.root.markDirty()}appendChildBefore(t,e){super.appendChildBefore(t,e),this.root.markDirty()}removeChild(t){super.removeChild(t),this.root.markDirty()}update(t){this.props=St([this.constructor.defaultProps,Bt.defaultProps,t]),this.root.markDirty()}applyProps(){this.style=this.resolveStyles(),g(this.style).map(([t,e])=>{this.applyStyle(t,e)}),this.children.forEach(t=>{t.applyProps&&t.applyProps()})}resolveStyles(){const{size:t,orientation:e,isAutoHeight:i}=this.page,r={orientation:e,isAutoHeight:i,width:t.width,height:t.height},o=st.resolve(this.props.style,r);return{...this.parent?f(Lt,this.parent.style):{},...o}}applyStyle(t,e){if(void 0===e)return;const i=`set${z(t)}`;switch(t){case"marginTop":case"marginRight":case"marginBottom":case"marginLeft":case"paddingTop":case"paddingRight":case"paddingBottom":case"paddingLeft":case"borderTopWidth":case"borderRightWidth":case"borderBottomWidth":case"borderLeftWidth":case"position":case"top":case"right":case"bottom":case"left":case"width":case"height":case"minHeight":case"maxHeight":case"minWidth":case"maxWidth":this[t]=e;break;default:At(this.layout[i])&&this.layout[i](e)}}getLayoutData(){const t=this.getAbsoluteLayout();return{type:this.name,top:t.top,left:t.left,width:t.width,style:this.style,height:t.height,children:this.children.map(t=>t.getLayoutData())}}drawBackgroundColor(){const{backgroundColor:t,opacity:e=1}=this.style,{left:i,top:r,width:o,height:s}=this.getAbsoluteLayout();t&&(this.root.instance.save(),this.clip(),this.root.instance.fillOpacity(e).fillColor(t).rect(i,r,o,s).fill().restore())}clone(){const t=new this.constructor(this.root,this.props);return t.copyStyle(this),t.style=this.style,t}onNodeSplit(t,e){this.calculateLayout(),e.marginTop=0,e.paddingTop=0,e.style.height&&(e.height=this.height-t),this.height=t,this.marginBottom=0,this.paddingBottom=0}async renderChildren(){for(let t=0;t<this.children.length;t++)await this.children[t].render()}}Bt.defaultProps={style:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,transformOriginX:"50%",transformOriginY:"50%"},minPresenceAhead:0},Object.assign(Bt.prototype,nt),Object.assign(Bt.prototype,mt),Object.assign(Bt.prototype,bt),Object.assign(Bt.prototype,Pt);const Ot=(t,e)=>Array.from({length:Math.ceil(t/e)},(t,i)=>i*e),Mt=t=>{const e=F(t);return e?100/e.value:null},Dt={getRulerWidth:()=>13,hasHorizontalRuler(){return this.props.ruler||this.props.horizontalRuler},hasVerticalRuler(){return this.props.ruler||this.props.verticalRuler},getHorizontalSteps(){const t=this.props.horizontalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=Mt(t);if(e){return(this.width-(this.hasVerticalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},getVerticalSteps(){const t=this.props.verticalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=Mt(t);if(e){return(this.height-(this.hasHorizontalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},renderRuler(){const t=this.hasHorizontalRuler(),e=this.hasVerticalRuler();(t||e)&&(this.root.instance.save().lineWidth(.5).fontSize(5).opacity(1),t&&this.drawHorizontalRuler(),e&&this.drawVerticalRuler(),t&&e&&this.root.instance.rect(0,0,12.5,12.5).fill("white"),this.root.instance.restore())},drawHorizontalRuler(){const t=this.hasVerticalRuler()?13:0;this.root.instance.rect(t,0,this.width,13).fill("white").moveTo(this.hasVerticalRuler()?13:0,13).lineTo(this.width,13).stroke("gray");const e=Ot(this.width,this.getHorizontalSteps());e.map(e=>{this.root.instance.moveTo(t+e,0).lineTo(t+e,13).stroke("gray").fillColor("black").text(`${Math.round(e)}`,t+e+1,1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(t+e,13).lineTo(t+e,this.height).stroke("#ababab")})},drawVerticalRuler(){const t=this.hasHorizontalRuler()?13:0;this.root.instance.rect(0,t,13,this.height).fill("white").moveTo(13,this.hasHorizontalRuler()?13:0).lineTo(13,this.height).stroke("gray");const e=Ot(this.height,this.getVerticalSteps());e.map(e=>{this.root.instance.moveTo(0,t+e).lineTo(13,t+e).stroke("gray").fillColor("black").text(`${Math.round(e)}`,1,t+e+1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(13,t+e).lineTo(this.width,t+e).stroke("#ababab")})}};class Wt{constructor(t,e){this.root=t,this.value=e,this.parent=null,this.props={}}get name(){return"TextInstance"}getLayoutData(){return this.value}remove(){this.parent.removeChild(this)}clone(){return new this.constructor(this.root,this.value)}cleanup(){}update(t){this.value=t,this.parent.computed=!1,this.parent.container=null,this.root.markDirty()}}const _t={"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],ID1:[153,243]},It=(t,e="portrait")=>{let i;if("string"==typeof t)i=_t[t.toUpperCase()];else if(Array.isArray(t))i=t;else if("number"==typeof t)i=[t];else{if("object"!=typeof t||!t.width)throw new Error(`Invalid Page size: ${t}`);i=[t.width,t.height]}return"portrait"===e?{width:i[0],height:i[1]}:{width:i[1],height:i[0]}},kt=/^([a-z]+\:(\/\/)?)/i,zt=/^#.+/,Ft=t=>t?Nt(t)?t:"string"!=typeof t||t.match(kt)?t:`http://${t}`:"",Nt=t=>t.match(zt),Gt=t=>{if(!t.src)return;const{top:e,left:i,width:r,height:o}=t.getAbsoluteLayout(),s=Nt(t.src)?"goTo":"link",n=Nt(t.src)?t.src.slice(1):t.src;t.root.instance[s](i,e,r,o,n)},Ht=t=>{if(!t.props.id)return;const{top:e}=t.getAbsoluteLayout();t.root.instance.addNamedDestination(t.props.id,"XYZ",null,e,null)};class jt extends Bt{constructor(t,e){super(t,e),this._size=null}get name(){return"Page"}get document(){return this.parent}get page(){return this}get orientation(){return this.props.orientation}get size(){return this._size?this._size:(this._size=It(this.props.size,this.orientation),this.hasHorizontalRuler()&&(this._size.width+=this.getRulerWidth()),this.hasVerticalRuler()&&(this._size.height+=this.getRulerWidth()),this._size)}get isAutoHeight(){return void 0===this.size.height}resetMargins(){(this.marginTop||this.marginBottom||this.marginLeft||this.marginRight)&&(xt(!1,"Margin values are not allowed on Page element. Use padding instead."),this.marginTop=0,this.marginBottom=0,this.marginLeft=0,this.marginRight=0)}applyProps(){super.applyProps(),this.top=0,this.left=0,this.width=this.size.width,this.resetMargins();const t=this.getRulerWidth();this.hasHorizontalRuler()&&(this.paddingTop=this.paddingTop+t),this.hasVerticalRuler()&&(this.paddingLeft=this.paddingLeft+t)}setPadding(t,e){const i=t===h.EDGE_TOP||t===h.EDGE_BOTTOM?this.size.height:this.size.width,r=F(e);r?this.layout.setPadding(t,i*r.percent):this.layout.setPadding(t,e)}async addDynamicChild(t,e){if(!e)return;const i=Array.isArray(e)?e:[e];for(let e=0;e<i.length;e++){const r=i[e];if(!r)continue;const{type:o,props:s}=r;if("string"==typeof r){const e=new Wt(this.root,r);t.appendChild(e)}else if(o!==a){const e=Ue(r,this.root);await e.onAppendDynamically(),t.appendChild(e),e.applyProps(),await this.addDynamicChild(e,s.children)}else await this.addDynamicChild(t,s.children)}}async renderDynamicNodes(t,e){const i=this.children.slice(0);for(;i.length>0;){const r=i.shift();if((!e||e(r))&&r.props.render){r.removeAllChilds();const e=r.props.render(t);await this.addDynamicChild(r,e),r.fixed||(r.props.render=null)}else r.children&&i.push(...r.children)}}async nodeWillWrap(t){await this.renderDynamicNodes(t),this.calculateLayout()}onNodeSplit(t,e){e.marginTop=0,this.marginBottom=0,this.calculateLayout()}clone(){const t=super.clone();return t._size=this.size,t}update(t){super.update(t),this._size=null}async render(){const{instance:t}=this.root;this.isAutoHeight||(this.height=this.size.height),this.calculateLayout();const e=this.isAutoHeight?this.height:this.size.height;t.addPage({size:[this.size.width,e],margin:0}),Ht(this),this.style.backgroundColor&&t.fillColor(this.style.backgroundColor).rect(0,0,this.size.width,e).fill(),await this.renderChildren(),this.props.debug&&this.debug(),this.renderRuler()}}jt.defaultProps={size:"A4",wrap:!0,orientation:"portrait"},Object.assign(jt.prototype,Dt);class Ut extends Bt{get name(){return"View"}async render(){this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),"hidden"===this.style.overflow&&this.clip(),await this.renderChildren(),this.drawBorders(),Ht(this),this.props.debug&&this.debug(),this.root.instance.restore()}}Ut.defaultProps={wrap:!0};const Vt=async(t,e)=>{const i=await R(t,e),r=await(i.buffer?i.buffer():i.arrayBuffer());return"Buffer"===r.constructor.name?r:Buffer.from(r)},Xt=t=>{const e=t.split(",")[0];return"data:"===e.substring(0,5)&&"base64"===e.split(";")[1]};class $t{constructor(t,e,i,r,o){this.src=t,this.fontFamily=e,this.fontStyle=i||"normal",this.fontWeight=q(r)||400,this.data=null,this.loading=!1,this.options=o}async load(){this.loading=!0;const{postscriptName:t}=this.options;if(Xt(this.src))this.data=x.create(Buffer.from(this.src.split(",")[1],"base64"),t);else if(P(this.src)){const{headers:e,body:i,method:r="GET"}=this.options,o=await Vt(this.src,{method:r,body:i,headers:e});this.data=x.create(o,t)}else this.data=await new Promise((e,i)=>x.open(this.src,t,(t,r)=>t?i(t):e(r)));this.loading=!1}}class Yt{static create(t){return new Yt(t)}constructor(t){this.family=t,this.sources=[]}register({src:t,fontWeight:e,fontStyle:i,...r}){this.sources.push(new $t(t,this.fontFamily,i,e,r))}resolve(t){const{fontWeight:e=400,fontStyle:i="normal"}=t,r=this.sources.filter(t=>t.fontStyle===i),o=r.find(t=>t.fontWeight===e);if(o)return o;let s;if(e>=400&&e<=500){const t=r.filter(t=>t.fontWeight<=e),i=r.filter(t=>t.fontWeight>500);s=r.filter(t=>t.fontWeight>=e&&t.fontWeight<500)[0]||t[t.length-1]||i[0]}const n=r.filter(t=>t.fontWeight<e),a=r.filter(t=>t.fontWeight>e);if(e<400&&(s=n[n.length-1]||a[0]),e>500&&(s=a[0]||n[n.length-1]),!s)throw new Error(`Could not resolve font for ${this.fontFamily}, fontWeight ${e}`);return s}}let Jt;var qt=["Courier","Courier-Bold","Courier-Oblique","Helvetica","Helvetica-Bold","Helvetica-Oblique","Times-Roman","Times-Bold","Times-Italic"];let Kt;let Zt={};const Qt=t=>{const{fontFamily:e}=t;if(qt.includes(e))return null;if(!Zt[e])throw new Error(`Font family not registered: ${e}. Please register it calling Font.register() method.`);return Zt[e].resolve(t)};var te={register:(t,e)=>{"object"==typeof t?e=t:(xt(!1,"Font.register will not longer accept the font source as first argument. Please move it into the data object. For more info refer to https://react-pdf.org/fonts"),e.src=t);const{family:i}=e;if(Zt[i]||(Zt[i]=Yt.create(i)),e.fonts)for(let t=0;t<e.fonts.length;t++)Zt[i].register({family:i,...e.fonts[t]});else Zt[i].register(e)},getRegisteredFonts:()=>Zt,getRegisteredFontFamilies:()=>Object.keys(Zt),getFont:Qt,load:async function(t,e){const{fontFamily:i}=t;if(qt.includes(i))return;const r=Qt(t);r.data||r.loading||await r.load()},clear:function(){Zt={}},reset:function(){for(const t in Zt)Zt.hasOwnProperty(t)&&(Zt[t].data=null)},...{registerEmojiSource:({url:t,format:e="png"})=>{Jt={url:t,format:e}},getEmojiSource:()=>Jt},...{registerHyphenationCallback:t=>{Kt=t},getHyphenationCallback:()=>Kt}};class ee{constructor(t){this.name=t,this.src=n.open(null,t)}layout(t){const[e,i]=this.src.encode(t);return{positions:i,stringIndices:i.map((t,e)=>e),glyphs:e.map((t,e)=>{const r=this.getGlyph(parseInt(t,16));return r.advanceWidth=i[e].advanceWidth,r})}}glyphForCodePoint(t){const e=this.getGlyph(t);return e.advanceWidth=400,e}getGlyph(t){return{id:t,_font:this.src,codePoints:[t],isLigature:!1,name:this.src.font.characterToGlyph(t)}}hasGlyphForCodePoint(t){return".notdef"!==this.src.font.characterToGlyph(t)}get ascent(){return 900}get descent(){switch(this.name){case"Times-Roman":case"Times-Bold":case"Times-Italic":return-220;case"Courier":case"Courier-Bold":case"Courier-Oblique":return-230;default:return-200}}get lineGap(){return 0}get unitsPerEm(){return 1e3}}const ie={},re=[173],oe=m(12,["attributes","fontSize"]),se=()=>ne("Helvetica"),ne=t=>{if(ie[t])return ie[t];const e=new ee(t);return ie[t]=e,e},ae=(t,e)=>!re.includes(t)&&!e.hasGlyphForCodePoint(t)&&se().hasGlyphForCodePoint(t),he=S({linebreaker:A,justification:L,textDecoration:B,scriptItemizer:O,wordHyphenation:M,fontSubstitution:()=>({string:t,runs:e})=>{let i=null,r=null,o=0,s=0;const n=[];for(const a of e){const e="string"==typeof a.attributes.font?ne(a.attributes.font):a.attributes.font;if(0===t.length){n.push({start:0,end:0,attributes:{font:e}});break}for(const h of t.slice(a.start,a.end)){const t=h.codePointAt(),l=ae(t,e)?se():e,d=oe(a);l===i&&d===r&&l.unitsPerEm===i.unitsPerEm||(i&&n.push({start:o,end:s,attributes:{font:i,scale:r/i.unitsPerEm}}),i=l,r=d,o=s),s+=h.length}}if(o<t.length){const r=oe(y(e));n.push({start:o,end:t.length,attributes:{font:i,scale:r/i.unitsPerEm}})}return{string:t,runs:n}}});I.isValid=function(t){try{return!!new I(t)}catch(t){return!1}};const le=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487];class de{constructor(t){if(this.data=null,this.width=null,this.height=null,this.data=t,65496!==t.readUInt16BE(0))throw new Error("SOI not found in JPEG");let e,i=2;for(;i<t.length&&(e=t.readUInt16BE(i),i+=2,!le.includes(e));)i+=t.readUInt16BE(i);if(!le.includes(e))throw new Error("Invalid JPEG.");i+=3,this.height=t.readUInt16BE(i),i+=2,this.width=t.readUInt16BE(i)}}de.isValid=function(t){if(!t||!Buffer.isBuffer(t)||65496!==t.readUInt16BE(0))return!1;let e,i=2;for(;i<t.length&&(e=t.readUInt16BE(i),i+=2,!le.includes(e));)i+=t.readUInt16BE(i);return!!le.includes(e)};const ce=(({limit:t=100}={})=>{let e={},i=[];return{get:t=>e[t],set:(r,o)=>{i.push(r),i.length>t&&delete e[i.shift()],e[r]=o},reset:()=>{e={},i=[]},length:()=>i.length}})({limit:30}),ue=t=>{const{protocol:e,auth:i,host:r,port:o,hostname:s,path:n}=W.parse(t),a=_.resolve(n);if(!(e&&"file:"!==e||i||r||o||s))return a},pe=(e,{safePath:i,allowDangerousPaths:r=!1}={})=>new Promise((o,s)=>{try{const n=ue(e);if(!n)return s(new Error(`Cannot fetch non-local path: ${e}`));if(!r&&((t,{safePath:e="./public"}={})=>{const i=_.resolve(e);return!_.resolve(t).startsWith(i)})(n,{safePath:i}))return s(new Error(`Cannot fetch dangerous local path: ${e}`));t.readFile(n,(t,e)=>t?s(t):o(e))}catch(t){s(t)}});function ge(t,e){switch(e.toLowerCase()){case"jpg":case"jpeg":return new de(t);case"png":return new I(t);default:return null}}const fe=t=>{const e=(t=>{let e;return de.isValid(t)?e="jpg":I.isValid(t)&&(e="png"),e})(t);if(e)return new Promise(i=>i(ge(t,e)))},me=async(t,e)=>{const{uri:i,body:r,headers:o,method:s="GET"}=t,n=ue(i)?await pe(i,e):await(async(t,e)=>{const i=await R(t,e),r=await(i.buffer?i.buffer():i.arrayBuffer());return"Buffer"===r.constructor.name?r:Buffer.from(r)})(i,{body:r,headers:o,method:s});return ge(n,(t=>{const e=137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7],i=255===t[0]&&216===t[1]&&255===t[2];let r="";if(e)r="png";else{if(!i)throw new Error("Not valid image extension");r="jpg"}return r})(n))},ye=(t,{cache:e=!0,...i}={})=>{const r=t.data?t.data.toString():t.uri;if(e&&ce.get(r))return ce.get(r);let o;if(!(o=(({uri:t})=>/^data:image\/[a-zA-Z]*;base64,[^"]*/g.test(t))(t)?(({uri:t})=>{const e=/^data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(t),i=e[1],r=e[2];if(!(t=>{const e=t.toLowerCase();return"jpg"===e||"jpeg"===e||"png"===e})(i))throw new Error(`Base64 image invalid format: ${i}`);return new Promise(t=>t(ge(Buffer.from(r,"base64"),i)))})(t):Buffer.isBuffer(t)?fe(t):"object"==typeof t&&t.data?(t=>{if(t.data&&t.format)return new Promise(e=>e(ge(t.data,t.format)));throw new Error(`Invalid data given for local file: ${JSON.stringify(t)}`)})(t):me(t,i)))throw new Error("Cannot resolve image");return e&&ce.set(r,o),o},be={},Te=D(),we=()=>(t=>(...e)=>t(...e).then(t=>t,t=>t))(ye),Ee=t=>"️"!==t,Ce=t=>{const{url:e,format:i}=te.getEmojiSource();return`${e}${(t=>Array.from(t).filter(Ee).map(t=>t.codePointAt(0).toString(16)).join("-"))(t)}.${i}`},ve=t=>{const e=te.getEmojiSource();if(!e||!e.url)return[];const i=[];let r;for(;r=Te.exec(t);){const t=r[0];if(!be[t]||be[t].loading){const e=Ce(t);be[t]={loading:!0};const r=we();i.push(r({uri:e}).then(e=>{be[t].loading=!1,be[t].data=e.data}))}}return i},Pe=[8232,8233],xe=[t=>t.map(t=>{const e=(t=>Pe.reduce((e,i)=>t.hasGlyphForCodePoint&&t.hasGlyphForCodePoint(i)?e:[...e,String.fromCharCode(i)],[]))(t.attributes.font),i=new RegExp(e.join("|"));return{string:t.string.replace(i,""),attributes:t.attributes}}),t=>{const e=[];for(let i=0;i<t.length;i++){const r=t[i];let o,s=0;for(;o=Te.exec(r.string);){const t=o.index,i=o[0],n=r.attributes.fontSize,a=r.string.slice(s,t+o[0].length);be[i]&&be[i].data?e.push({string:a.replace(o,String.fromCharCode(65532)),attributes:{...r.attributes,attachment:{width:n,height:n,yOffset:Math.floor(.1*n),image:be[i].data}}}):e.push({string:a.replace(o,String.fromCharCode(0)),attributes:r.attributes}),s=t+i.length}s<r.string.length&&e.push({string:r.string.slice(s),attributes:r.attributes})}return e}],Re=b("name","Image"),Se=c(T(d),w("value")),Ae=(t,e)=>{switch(e){case"uppercase":return t.toUpperCase();case"lowercase":return t.toLowerCase();case"capitalize":return(t=>t.replace(/(^|\s)\S/g,t=>t.toUpperCase()))(t);default:return t}},Le=t=>{if(!t)return[{string:""}];let e=[];const{color:i="black",backgroundColor:r,fontFamily:o="Helvetica",fontWeight:s,fontStyle:n,fontSize:a=18,textAlign:h="left",lineHeight:l,textDecoration:d,textDecorationColor:c,textDecorationStyle:u,textTransform:p,letterSpacing:g,textIndent:f,opacity:m}=t.style,y=te.getFont({fontFamily:o,fontWeight:s,fontStyle:n}),b={font:y?y.data:o,color:i,opacity:m,fontSize:a,backgroundColor:r,align:h,indent:f,link:t.src,characterSpacing:g,underlineStyle:u,underline:"underline"===d,underlineColor:c||i,strike:"line-through"===d,strikeStyle:u,strikeColor:c||i,lineHeight:l?l*a:null};t.children.forEach(t=>{Re(t)?e.push({string:String.fromCharCode(65532),attributes:{...b,attachment:{width:t.style.width||a,height:t.style.height||a,image:t.image.data}}}):Se(t)?e.push({string:Ae(t.value,p),attributes:b}):t&&e.push(...Le(t))});for(const t of xe)e=t(e);return e},Be=t=>v.fromFragments(Le(t));class Oe extends Bt{constructor(t,e){super(t,e),this.start=0,this.end=0,this.blocks=null,this.computed=!1,this.attributedString=null,this.layoutOptions={hyphenationPenalty:e.hyphenationPenalty,hyphenationCallback:te.getHyphenationCallback(),shrinkWhitespaceFactor:{before:-.5,after:-.5}},this.layout.setMeasureFunc(this.measureText.bind(this))}get name(){return"Text"}get src(){return Ft(this.props.src||this.props.href)}get lines(){return this.blocks?this.blocks.reduce((t,e)=>[...t,...e],[]).splice(this.start,this.end):[]}get linesHeight(){return this.blocks?this.lines.reduce((t,e)=>t+e.box.height,0):-1}get linesWidth(){return this.blocks?Math.max(...this.lines.map(t=>v.advanceWidth(t))):-1}appendChild(t){t&&(t.parent=this,this.children.push(t),this.computed=!1,this.attributedString=null,this.markDirty())}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.computed=!1,this.attributedString=null,this.markDirty(),t.cleanup())}lineIndexAtHeight(t){let e=0;for(let i=0;i<this.lines.length;i++){const r=this.lines[i];if(e+r.box.height>t)return i;e+=r.box.height}return this.lines.length}heightAtLineIndex(t){let e=0;for(let i=0;i<t;i++){e+=this.lines[i].box.height}return e}layoutText(t,e){if(this.attributedString=Be(this),!this.blocks||this.props.render){const i={x:0,y:0,width:t,height:e||1/0,maxLines:this.style.maxLines,truncateMode:this.style.textOverflow};this.blocks=he(this.attributedString,i,this.layoutOptions)}const i=this.blocks.reduce((t,e)=>t+e.length,0);this.end=i+1,this.computed=!0}measureText(t,e,i,r){return e===h.MEASURE_MODE_EXACTLY?(this.layoutText(t,i),{height:this.linesHeight}):e===h.MEASURE_MODE_AT_MOST?(this.layoutText(t,i),{height:this.linesHeight,width:Math.min(t,this.linesWidth)}):{}}resolveStyles(){const t=super.resolveStyles();return this.parent&&"Text"===this.parent.name&&"relative"===this.parent.style.position&&(t.top=t.top||this.parent.style.top,t.bottom=t.bottom||this.parent.style.bottom,t.position=t.position||"relative"),this.src&&(t.color=t.color||"blue",t.textDecoration=t.textDecoration||"underline"),t}wrapHeight(t){const{orphans:e,widows:i}=this.props,r=this.lines.length,o=t-this.paddingTop,s=this.lineIndexAtHeight(o);return r<e?t:s<e||r<e+i?0:r===e+i?this.heightAtLineIndex(e):r-s<i?t-this.heightAtLineIndex(i-1):t}onNodeSplit(t,e){const i=this.wrapHeight(t),r=this.lineIndexAtHeight(i);e.marginTop=0,e.paddingTop=0,e.start=r,e.attributedString=this.attributedString,this.height=i,this.marginBottom=0,this.paddingBottom=0,this.end=r}clone(){const t=super.clone();return t.layoutEngine=this.layoutEngine,this.blocks&&!this.props.render&&(t.blocks=[...this.blocks]),t}renderText(){const{top:t,left:e}=this.getAbsoluteLayout(),i=this.lines[0]?this.lines[0].box.y:0;this.root.instance.save(),this.root.instance.translate(e+this.padding.left,t+this.padding.top-i),C.render(this.root.instance,[this.lines]),Gt(this),Ht(this),this.root.instance.restore()}async render(){this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.computed||this.layoutText(this.width-this.padding.left-this.padding.right,this.height-this.padding.top-this.padding.bottom),this.renderText(),this.props.debug&&this.debug(),this.root.instance.restore()}}Oe.defaultProps={wrap:!0,widows:2,orphans:2};class Me extends Bt{get name(){return"Note"}appendChild(t){if("TextInstance"!==t.name)throw new Error("Note only accepts string children");t&&(t.parent=this,this.children.push(t))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1)),t.cleanup()}applyProps(){super.applyProps(),this.height=0,this.width=0}async render(){const{top:t,left:e}=this.getAbsoluteLayout(),i=this.children[0]?this.children[0].value:"";this.root.instance.note(e,t,0,0,i)}}Me.defaultProps={};const De=t=>!isNaN(parseFloat(t))&&isFinite(t),We=(t,e,i,r,o,s)=>{const n=t/e,a=i/r,h=F(o),l=F(s),d=h?h.percent:.5,c=l?l.percent:.5;if(n>a){const i=e,r=i*a,n=De(s)?s:0;return{width:r,height:i,xOffset:De(o)?o:(t-r)*d,yOffset:n}}{const i=t,r=i/a,n=De(o)?o:0;return{width:i,height:r,yOffset:De(s)?s:(e-r)*c,xOffset:n}}},_e=(t,e,i,r,o,s)=>{const n=i,a=r,h=F(o),l=F(s),d=h?h.percent:.5,c=l?l.percent:.5;return{width:n,height:a,xOffset:De(o)?o:(t-n)*d,yOffset:De(s)?s:(e-a)*c}},Ie=(t="fill",e,i,r,o,s,n)=>{switch(t){case"contain":return We(e,i,r,o,s,n);case"cover":return((t,e,i,r,o,s)=>{const n=i/r,a=t/e,h=F(o),l=F(s),d=h?h.percent:.5,c=l?l.percent:.5;if(a>n){const i=t,r=i/n,a=De(o)?o:0;return{width:i,height:r,yOffset:De(s)?s:(e-r)*c,xOffset:a}}{const i=e*n;return{width:i,height:e,xOffset:De(o)?o:(t-i)*d,yOffset:De(s)?s:0}}})(e,i,r,o,s,n);case"none":return _e(e,i,r,o,s,n);case"scale-down":return((t,e,i,r,o,s)=>{const n=We(t,e,i,r,o,s),a=_e(t,e,i,r,o,s);return n.width<a.width?n:a})(e,i,r,o,s,n);default:return((t,e,i,r)=>({width:t,height:e,xOffset:F(i)?0:i||0,yOffset:F(r)?0:r||0}))(e,i,s,n)}},ke=10;class ze extends Bt{constructor(t,e){super(t,e),this.image=null,this.layout.setMeasureFunc(this.measureImage.bind(this))}get name(){return"Image"}shouldGrow(){return!!this.style.flexGrow}measureImage(t,e,i,r){const o=this.margin,s=this.page.padding,n=this.page.isAutoHeight?1/0:this.page.size.height-s.top-s.bottom-o.top-o.bottom-ke;if(!this.image)return{width:0,height:0};if(e===h.MEASURE_MODE_EXACTLY&&r===h.MEASURE_MODE_UNDEFINED){const e=t/this.ratio;return{height:Math.min(n,e)}}if(r===h.MEASURE_MODE_EXACTLY&&(e===h.MEASURE_MODE_AT_MOST||e===h.MEASURE_MODE_UNDEFINED))return{width:Math.min(i*this.ratio,t)};if(e===h.MEASURE_MODE_EXACTLY&&r===h.MEASURE_MODE_AT_MOST){const e=t/this.ratio;return{height:Math.min(i,n,e)}}return e===h.MEASURE_MODE_AT_MOST&&r===h.MEASURE_MODE_AT_MOST?this.ratio>1?{width:t,height:Math.min(t/this.ratio,i)}:{width:Math.min(i*this.ratio,t),height:i}:{height:i,width:t}}get ratio(){return this.image.data?this.image.width/this.image.height:1}get src(){const t=this.props.src||this.props.source;return"string"==typeof t?{uri:t}:t}async fetch(){const{cache:t,safePath:e,allowDangerousPaths:i}=this.props;if(this.src)try{const r="function"==typeof this.src?await this.src():this.src;this.image=await ye(r,{cache:t,safePath:e,allowDangerousPaths:i})}catch(t){this.image={width:0,height:0},console.warn(t.message)}else xt(!1,'Image should receive either a "src" or "source" prop')}clone(){const t=super.clone();return t.image=this.image,t}async onAppendDynamically(){await this.fetch()}renderImage(){const t=this.padding,{left:e,top:i}=this.getAbsoluteLayout(),{opacity:r,objectPositionX:o,objectPositionY:s}=this.style;if(this.root.instance.save(),this.clip(),this.image&&this.image.data){const{width:n,height:a,xOffset:h,yOffset:l}=Ie(this.style.objectFit,this.width-t.left-t.right,this.height-t.top-t.bottom,this.image.width,this.image.height,o,s);0!==n&&0!==a?this.root.instance.fillOpacity(r).image(this.image.data,e+t.left+h,i+t.top+l,{width:n,height:a}):xt(!1,`Image with src '${this.props.src}' skipped due to invalid dimensions`)}else xt(!1,`Image skipped because src prop is ${this.props.src}`);this.root.instance.restore()}async render(){Ht(this),this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.renderImage(),this.drawBorders(),this.props.debug&&this.debug(),this.root.instance.restore()}}ze.defaultProps={wrap:!1,cache:!0,style:{}};class Fe{constructor(t,e){this.root=t,this.style={},this.props=e,this.children=[],this.subpages=[]}get name(){return"Document"}appendChild(t){t.parent=this,this.children.push(t)}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1)),t.cleanup()}addMetaData(){const{title:t,author:e,subject:i,keywords:r,creator:o,producer:s}=this.props;t&&(this.root.instance.info.Title=t),e&&(this.root.instance.info.Author=e),i&&(this.root.instance.info.Subject=i),r&&(this.root.instance.info.Keywords=r),this.root.instance.info.Creator=o||"react-pdf",this.root.instance.info.Producer=s||"react-pdf"}async loadFonts(){const t=[],e=this.children.slice(0);for(;e.length>0;){const i=e.shift();i.style&&i.style.fontFamily&&t.push(te.load(i.style,this.root.instance)),i.children&&i.children.forEach(t=>{e.push(t)})}await Promise.all(t)}async loadEmojis(){const t=[],e=this.children.slice(0);for(;e.length>0;){const i=e.shift();"string"==typeof i?t.push(...ve(i)):"string"==typeof i.value?t.push(...ve(i.value)):i.children&&i.children.forEach(t=>{e.push(t)})}await Promise.all(t)}async loadImages(){const t=[],e=this.children.slice(0);for(;e.length>0;){const i=e.shift();"Image"===i.name&&t.push(i.fetch()),i.children&&i.children.forEach(t=>{e.push(t)})}await Promise.all(t)}async loadAssets(){await Promise.all([this.loadFonts(),this.loadImages(),this.loadEmojis()])}applyProps(){this.children.forEach(t=>t.applyProps())}update(t){this.props=t}cleanup(){this.subpages.forEach(t=>t.cleanup())}finish(){this.children.forEach(t=>t.cleanup())}getLayoutData(){return{type:this.name,children:this.subpages.map(t=>t.getLayoutData())}}async wrapPages(){let t=1;const e=[];for(const i of this.children)if(i.wrap){const r=i.isAutoHeight?1/0:i.size.height-(i.style.paddingBottom||0),o=await k(i,r,t);t+=o.length,o.forEach((t,i)=>e.push({page:t,number:i+1,count:o.length}))}else e.push({page:i,number:1,count:1});return e}async renderPages(){const t=await this.wrapPages(),e=t.map(t=>t.page);this.subpages=e;for(let e=0;e<this.subpages.length;e++)this.subpages[e].renderDynamicNodes({pageNumber:e+1,totalPages:t.length,subPageNumber:t[e].number,subPageTotalPages:t[e].count},t=>"Text"===t.name),await this.subpages[e].render();return this.subpages}async render(){try{this.addMetaData(),this.applyProps(),await this.loadAssets(),await this.renderPages(),this.root.instance.end(),te.reset()}catch(t){throw t}}}Fe.defaultProps={author:null,keywords:null,subject:null,title:null};const Ne=["dash","clip","save","path","fill","font","text","rect","scale","moveTo","lineTo","stroke","rotate","circle","lineCap","opacity","ellipse","polygon","restore","lineJoin","fontSize","fillColor","lineWidth","translate","miterLimit","strokeColor","fillOpacity","roundedRect","strokeOpacity","fillAndStroke","bezierCurveTo","quadraticCurveTo"],Ge=function(t){const e=Ne.reduce((i,r)=>({...i,[r]:(...i)=>(t[r](...i),e)}),{});return e.linearGradient=((...e)=>t.linearGradient(...e)),e.radialGradient=((...e)=>t.linearGradient(...e)),e};class He extends Bt{get name(){return"Canvas"}async render(){const{left:t,top:e,width:i,height:r}=this.getAbsoluteLayout(),o=i-this.paddingLeft-this.paddingRight,s=r-this.paddingTop-this.paddingBottom;xt(o&&s,"Canvas element has null width or height. Please provide valid values via the `style` prop in order to correctly render it."),this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.clip(),this.root.instance.translate(t+this.paddingLeft,e+this.paddingTop),this.props.paint&&this.props.paint(Ge(this.root.instance),o,s),this.root.instance.restore(),this.props.debug&&this.debug()}}He.defaultProps={style:{},wrap:!1};const je={ROOT:class{constructor(){this.isDirty=!1,this.document=null,this.instance=null}get name(){return"Root"}appendChild(t){this.document=t}removeChild(){this.document.cleanup(),this.document=null}markDirty(){this.isDirty=!0}cleanup(){this.document.cleanup()}finish(){this.document.finish()}async render(){this.instance=new s({autoFirstPage:!1}),await this.document.render(),this.cleanup(),this.isDirty=!1}},PAGE:jt,TEXT:Oe,LINK:class extends Bt{get name(){return"Link"}get src(){return Ft(this.props.src||this.props.href)}async render(){Gt(this),await this.renderChildren(),this.props.debug&&this.debug()}},VIEW:Ut,NOTE:Me,IMAGE:ze,CANVAS:He,DOCUMENT:Fe,TEXT_INSTANCE:Wt};function Ue(t,e){const{type:i,props:r={}}=t;if(je[i])return new je[i](e,r);throw new Error(`Invalid element of type ${i} passed to PDF renderer`)}const Ve=(t,e)=>{const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(let r=0;r<i.length;r++){const o=i[r];if("render"!==o){if("children"!==o&&t[o]!==e[o]){if("object"==typeof t[o]&&"object"==typeof e[o]&&Ve(t[o],e[o]))continue;return!1}if("children"===o&&("string"==typeof t[o]||"string"==typeof e[o]))return t[o]===e[o]}else if(!t[o]!=!e[o])return!1}return!0},Xe={},$e=i({schedulePassiveEffects:r,cancelPassiveEffects:o,supportsMutation:!0,appendInitialChild(t,e){t.appendChild(e)},createInstance:(t,e,i)=>Ue({type:((t,e)=>"LINK"===t&&("string"==typeof e.children||"number"==typeof e.children||Array.isArray(e.children)||e.render))(t,e)?"TEXT":t,props:e},i),createTextInstance:(t,e)=>Ue({type:"TEXT_INSTANCE",props:t},e),finalizeInitialChildren:(t,e,i)=>!1,getPublicInstance:t=>t,prepareForCommit(){},prepareUpdate:(t,e,i,r)=>!Ve(i,r),resetAfterCommit(){},resetTextContent(t){},getRootHostContext:()=>Xe,getChildHostContext:()=>Xe,shouldSetTextContent:(t,e)=>!1,now:Date.now,useSyncScheduling:!0,appendChild(t,e){t.appendChild(e)},appendChildToContainer(t,e){t.appendChild(e)},insertBefore(t,e,i){t.appendChildBefore(e,i)},removeChild(t,e){t.removeChild(e)},removeChildFromContainer(t,e){t.removeChild(e)},commitTextUpdate(t,e,i){t.update(i)},commitUpdate(t,e,i,r,o){t.update(o)}});var Ye="1.6.13";const Je="VIEW",qe="TEXT",Ke="LINK",Ze="PAGE",Qe="NOTE",ti="IMAGE",ei="DOCUMENT",ii="CANVAS",ri=t=>{const i=Ue({type:"ROOT"}),r=$e.createContainer(i);function o(t={}){if(i.document.props.onRender){const e=i.document.getLayoutData();i.document.props.onRender({...t,layoutData:e})}}function s(t){$e.updateContainer(t,r,null)}return t&&s(t),{isDirty:function(){return i.isDirty},container:i,updateContainer:s,toBuffer:async function(){return await i.render(),o(),i.instance},toBlob:async function(){await i.render();const t=i.instance.pipe(e());return new Promise((e,i)=>{t.on("finish",()=>{try{const r=t.toBlob("application/pdf");o({blob:r}),e(r)}catch(t){i(t)}}),t.on("error",i)})},toString:function(){let t="";return i.render(),new Promise((e,r)=>{try{i.instance.on("data",function(e){t+=e}),i.instance.on("end",function(){o({string:t}),e(t)})}catch(t){r(t)}})}}},oi=async function(t){const e=ri(t),i=await e.toBuffer();return e.container.finish(),i},si=async function(e,i,r){const o=await oi(e),s=t.createWriteStream(i);return o.pipe(s),new Promise((t,e)=>{s.on("finish",()=>{r&&r(o,i),t(o)}),s.on("error",e)})},ni=t=>{throw new Error(`${t} is a web specific API. Or you're either using this component on Node, or your bundler is not loading react-pdf from the appropiate web build.`)},ai=()=>{ni("PDFViewer")},hi=()=>{ni("PDFDownloadLink")},li=()=>{ni("BlobProvider")},di=si;export default{pdf:ri,View:"VIEW",Text:"TEXT",Link:"LINK",Page:"PAGE",Font:te,Note:"NOTE",Image:"IMAGE",Canvas:"CANVAS",version:"1.6.13",Document:"DOCUMENT",StyleSheet:st,PDFRenderer:$e,PDFViewer:ai,BlobProvider:li,PDFDownloadLink:hi,createInstance:Ue,renderToStream:oi,renderToFile:si,render:si};export{oi as renderToStream,si as renderToFile,ai as PDFViewer,hi as PDFDownloadLink,li as BlobProvider,di as render,ri as pdf,Je as View,qe as Text,Ke as Link,Ze as Page,te as Font,Qe as Note,ti as Image,ii as Canvas,Ye as version,ei as Document,st as StyleSheet,$e as PDFRenderer,Ue as createInstance};
  //# sourceMappingURL=react-pdf.es.min.js.map
  