1import{r as __require,t as __commonJSMin}from"./rolldown-runtime-aKtaBQYM.js";import{r as require_react}from"./vendor-ai-DdAmN5Y6.js";import{Zr as require_react_dom}from"./vendor-chakra-CBqYwq0w.js";var require___vite_browser_external=__commonJSMin(((e,t)=>{t.exports={}})),require_pdf=__commonJSMin(((exports,module)=>{(function(e,t){typeof exports==`object`&&typeof module==`object`?module.exports=e.pdfjsLib=t():typeof define==`function`&&define.amd?define(`pdfjs-dist/build/pdf`,[],()=>e.pdfjsLib=t()):typeof exports==`object`?exports["pdfjs-dist/build/pdf"]=e.pdfjsLib=t():e[`pdfjs-dist/build/pdf`]=e.pdfjsLib=t()})(globalThis,()=>(()=>{var __webpack_modules__=[,((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.RenderingIntentFlag=t.PromiseCapability=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.MAX_IMAGE_SIZE_TO_CACHE=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.BASELINE_FACTOR=t.AnnotationType=t.AnnotationReplyType=t.AnnotationPrefix=t.AnnotationMode=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.assert=d,t.bytesToString=C,t.createValidAbsoluteUrl=p,t.getModificationDate=z,t.getUuid=U,t.getVerbosityLevel=s,t.info=c,t.isArrayBuffer=L,t.isArrayEqual=R,t.isNodeJS=void 0,t.normalizeUnicode=ee,t.objectFromMap=D,t.objectSize=E,t.setVerbosityLevel=o,t.shadow=m,t.string32=T,t.stringToBytes=w,t.stringToPDFString=P,t.stringToUTF8String=F,t.unreachable=u,t.utf8StringToString=I,t.warn=l,t.isNodeJS=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.MAX_IMAGE_SIZE_TO_CACHE=1e7;let n=1.35;t.LINE_FACTOR=n;let r=.35;t.LINE_DESCENT_FACTOR=r,t.BASELINE_FACTOR=r/n,t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},t.AnnotationEditorPrefix=`pdfjs_internal_editor_`,t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15},t.AnnotationEditorParamsType={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23},t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},t.AnnotationReplyType={GROUP:`Group`,REPLY:`R`},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.AnnotationActionEventType={E:`Mouse Enter`,X:`Mouse Exit`,D:`Mouse Down`,U:`Mouse Up`,Fo:`Focus`,Bl:`Blur`,PO:`PageOpen`,PC:`PageClose`,PV:`PageVisible`,PI:`PageInvisible`,K:`Keystroke`,F:`Format`,V:`Validate`,C:`Calculate`},t.DocumentActionEventType={WC:`WillClose`,WS:`WillSave`,DS:`DidSave`,WP:`WillPrint`,DP:`DidPrint`},t.PageActionEventType={O:`PageOpen`,C:`PageClose`};let i={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=i,t.CMapCompressionType={NONE:0,BINARY:1}
1,t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let a=i.WARNINGS;function o(e){Number.isInteger(e)&&(a=e)}function s(){return a}function c(e){a>=i.INFOS&&console.log(`Info: ${e}`)}function l(e){a>=i.WARNINGS&&console.log(`Warning: ${e}`)}function u(e){throw Error(e)}function d(e,t){e||u(t)}function f(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function p(e,t=null,n=null){if(!e)return null;try{if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=F(e)}catch{}let r=t?new URL(e,t):new URL(e);if(f(r))return r}catch{}return null}function m(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}let h=function(){function e(t,n){this.constructor===e&&u(`Cannot initialize BaseException.`),this.message=t,this.name=n}return e.prototype=Error(),e.constructor=e,e}();t.BaseException=h;class g extends h{constructor(e,t){super(e,`PasswordException`),this.code=t}}t.PasswordException=g;class _ extends h{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}}t.UnknownErrorException=_;class v extends h{constructor(e){super(e,`InvalidPDFException`)}}t.InvalidPDFException=v;class y extends h{constructor(e){super(e,`MissingPDFException`)}}t.MissingPDFException=y;class b extends h{constructor(e,t){super(e,`UnexpectedResponseException`),this.status=t}}t.UnexpectedResponseException=b;class x extends h{constructor(e){super(e,`FormatError`)}}t.FormatError=x;class S extends h{constructor(e){super(e,`AbortException`)}}t.AbortException=S;function C(e){(typeof e!=`object`||e?.length===void 0)&&u(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function w(e){typeof e!=`string`&&u(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}function T(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function E(e){return Object.keys(e).length}function D(e){let t=Object.create(null);for(let[n,r]of e)t[n]=r;return t}function O(){let e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function k(){try{return Function(``),!0}catch{return!1}}class A{static get isLittleEndian(){return m(this,`isLittleEndian`,O())}static get isEvalSupported(){return m(this,`isEvalSupported`,k())}static get isOffscreenCanvasSupported(){return m(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get platform(){return typeof navigator>`u`?m(this,`platform`,{isWin:!1,isMac:!1}):m(this,`platform`,{isWin:navigator.platform.includes(`Win`),isMac:navigator.platform.includes(`Mac`)})}static get isCSSRoundSupported(){return m(this,`isCSSRoundSupported`,globalThis.CSS?.supports?.(`width: round(1.5px, 1px)`))}}t.FeatureTest=A;let j=[...Array(256).keys()].map(e=>e.toString(16).padStart(2,`0`));class M{static makeHexColor(e,t,n){return`#${j[e]}${j[t]}${j[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[0],t[1]*=e[0],e[3]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[2],t[2]=n,n=t[1],t[1]=t[3],t[3]=n,e[1]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[2],t[1]*=e[2]),t[0]+=e[4],t[1]+=e[4],t[2]+=e[5],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){let n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){let n=this.applyTransform(e,t),r=this.applyTransform(e.slice(2,4),t),i=this.applyTransform([e[0],e[3]],t),a=this.applyTransform([e[2],e[1]],t);return[Math.min(n[0],r[0],i[0],a[0]),Math.min(n[1],r[1],i[1],a[1]),Math.max(n[0],r[0],i[0],a[0]),Math.max(n[1],r[1],i[1],a[1])]}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){let t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],o=(n+a)/2,s=Math.sqrt((n+a)**2-4*(n*a-i*r))/2,c=o+s||1,l=o-s||1;return[Math.sqrt(c),Math.sqrt(l)]}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static bezierBoundingBox(e,t,n,r,i,a,o,s){let c=[],l=[[],[]],u,d,f,p,m,h,g,_;for(let l=0;l<2;++l){if(l===0?(d=6*e-12*n+6*i,u=-3*e+9*n-9*i+3*o,f=3*n-3*e):(d=6*t-12*r+6*a,u=-3*t+9*r-9*a+3*s,f=3*r-3*t),Math.abs(u)<1e-12){if(Math.abs(d)<1e-12)continue;p=-f/d,0<p&&p<1&&c.push(p);continue}g=d*d-4*f*u,_=Math.sqrt(g),!(g<0)&&(m=(-d+_)/(2*u),0<m&&m<1&&c.push(m),h=(-d-_)/(2*u),0<h&&h<1&&c.push(h))}let v=c.length,y,b=v;for(;v--;)p=c[v],y=1-p,l[0][v]=y*y*y*e+3*y*y*p*n+3*y*p*p*i+p*p*p*o,l[1][v]=y*y*y*t+3*y*y*p*r+3*y*p*p*a+p*p
1*p*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=o,l[1][b+1]=s,l[0].length=l[1].length=b+2,[Math.min(...l[0]),Math.min(...l[1]),Math.max(...l[0]),Math.max(...l[1])]}}t.Util=M;let N=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function P(e){if(e[0]>=`ï`){let t;if(e[0]===`þ`&&e[1]===`ÿ`?t=`utf-16be`:e[0]===`ÿ`&&e[1]===`þ`?t=`utf-16le`:e[0]===`ï`&&e[1]===`»`&&e[2]===`¿`&&(t=`utf-8`),t)try{let n=new TextDecoder(t,{fatal:!0}),r=w(e);return n.decode(r)}catch(e){l(`stringToPDFString: "${e}".`)}}let t=[];for(let n=0,r=e.length;n<r;n++){let r=N[e.charCodeAt(n)];t.push(r?String.fromCharCode(r):e.charAt(n))}return t.join(``)}function F(e){return decodeURIComponent(escape(e))}function I(e){return unescape(encodeURIComponent(e))}function L(e){return typeof e==`object`&&e?.byteLength!==void 0}function R(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function z(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,`0`),e.getUTCDate().toString().padStart(2,`0`),e.getUTCHours().toString().padStart(2,`0`),e.getUTCMinutes().toString().padStart(2,`0`),e.getUTCSeconds().toString().padStart(2,`0`)].join(``)}class B{#e=!1;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.#e=!0,e(t)},this.reject=e=>{this.#e=!0,t(e)}})}get settled(){return this.#e}}t.PromiseCapability=B;let V=null,H=null;function ee(e){return V||(V=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,H=new Map([[`ï¬
`,`ſt`]])),e.replaceAll(V,(e,t,n)=>t?t.normalize(`NFKC`):H.get(n))}function U(){if(typeof crypto<`u`&&typeof crypto?.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);if(typeof crypto<`u`&&typeof crypto?.getRandomValues==`function`)crypto.getRandomValues(e);else for(let t=0;t<32;t++)e[t]=Math.floor(Math.random()*255);return C(e)}t.AnnotationPrefix=`pdfjs_internal_id_`}),((__unused_webpack_module,exports$2,__w_pdfjs_require__)=>{Object.defineProperty(exports$2,"__esModule",{value:!0}),exports$2.RenderTask=exports$2.PDFWorkerUtil=exports$2.PDFWorker=exports$2.PDFPageProxy=exports$2.PDFDocumentProxy=exports$2.PDFDocumentLoadingTask=exports$2.PDFDataRangeTransport=exports$2.LoopbackPort=exports$2.DefaultStandardFontDataFactory=exports$2.DefaultFilterFactory=exports$2.DefaultCanvasFactory=exports$2.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports$2,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports$2.build=void 0,exports$2.getDocument=getDocument,exports$2.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports$2.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports$2.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports$2.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports$2.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(e){if(typeof e==`string`||e instanceof URL?e={url:e}:(0,_util.isArrayBuffer)(e)&&(e={data:e}),typeof e!=`object`)throw Error(`Invalid parameter in getDocument, need parameter object.`);if(!e.url&&!e.data&&!e.range)throw Error(`Invalid parameter object: need either .data, .range or .url`);let t=new PDFDocumentLoadingTask,{docId:n}=t,r=e.url?getUrlProp(e.url):null,i=e.data?getDataProp(e.data):null,a=e.httpHeaders||null,o=e.withCredentials===!0,s=e.password??null,c=e.range instanceof PDFDataRangeTransport?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE,u=e.worker instanceof PDFWorker?e.worker:null,d=e.verbosity,f=typeof e.docBaseUrl==`string`&&!(0,_display_utils.isDataScheme)(e.docBaseUrl)?e.docBaseUrl:null,p=typeof e.cMapUrl==`string`?e.cMapUrl:null,m=e.cMapPacked!==!1,h=e.CMapReaderFactory||DefaultCMapReaderFactory,g=typeof e.standardFontDataUrl==`string`?e.standardFontDataUrl:null,_=e.StandardFontDataFactory||DefaultStandardFontDataFactory,v=e.stopAtErrors!==!0,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=e.isEvalSupported!==!1,x=typeof e.isOffscreenCanvasSupported==`boolean`?e.isOffscreenCanvasSupported:!_util.isNodeJS,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,C=typeof e.disableFontFace==`boolean`?e.disableFontFace:_util.isNodeJS,w=e.fontExtraProperties===!0,T=e.enableXfa===!0,E=e.ownerDocument||globalThis.document,D=e.disableRange===!0,O=e.disableStream===!0,k=e.disableAutoFetch===!0,A=e.pdfBug===!0,j=c?c.length:e.length??NaN,M=typeof e.useSystemFonts==`boolean`?e.useSystemFonts:!_util.isNodeJS&&!C,N=typeof e.useWorkerFetch==`boolean`?e.useWorkerFetch:h===_display_utils.DOMCMapReaderFactory&&_===_display_utils.DOMStandardFontDataFactory&&p&&g&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(g,document.baseURI),P=e.canvasFactory||new DefaultCanvasFactory({ownerDocument:E}),F=e.filterFactory||new DefaultFilterFactory({docId:n,ownerDocument:E}),I=null;(0,_util.setVerbosityLevel)(d);let L={canvasFactory:P,filterFactory:F};if(N||(L.cMapReaderFactory=new h({baseUrl:p,isCompressed:m}),L.standardFontDataFactory=new _({baseUrl:g})),!u){let e={verbosity:d,port:_worker_options.GlobalWorkerOptions.workerPort};u=e.port?PDFWorker.fromPort(e):new PDFWorker(e),t._worker=u}let R={docId:n,apiVersion:`3.11.174`,data:i,password:s,disableAutoFetch:k,rangeChunkSize:l,length:j,docBaseUrl:f,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:C,ignoreErrors:v,isEvalSupported:b,isOffscreenCanvasSupported:x,canvasMaxAreaInBytes:S,fontExtraProperties:w,useSystemFonts:M,cMapUrl:N?p:null,standardFontDataUrl:N?g:null}},z={ignoreErrors:v,isEvalSupported:b,disableFontFace:C,fontExtraProperties:w,enableXfa:T,ownerDocument:E,disableAutoFetch:k,pdfBug:A,styleElement:null};return u.promise.then(function(){if(t.destroyed)throw Error(`Loading aborted`);let e=_fetchDocument(u,R),s=new Promise(function(e){let t;c?t=new _transport_stream.PDFDataTransportStream({length:j,initialData:c.initialData,progressiveDone:c.progressiveDone,contentDispositionFilename:c.contentDispositionFilename,disableRange:D,disableStream:O},c):i||(t=(e=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(e):(0,_display_utils.isValidFetchUrl)(e.url)?new _displayFetch_stream.PDFFetchStream(e):new _displayNetwork.PDFNetworkStream(e))({url:r,length:j,httpHeaders:a,withCredentials:o,rangeChunkSize:l,disableRange:D,disableStream:O})),e(t)}
1);return Promise.all([e,s]).then(function([e,r]){if(t.destroyed)throw Error(`Loading aborted`);let i=new _message_handler.MessageHandler(n,e,u.port);t._transport=new WorkerTransport(i,t,r,z,L),i.send(`Ready`,null)})}).catch(t._capability.reject),t}async function _fetchDocument(e,t){if(e.destroyed)throw Error(`Worker was destroyed`);let n=await e.messageHandler.sendWithPromise(`GetDocRequest`,t,t.data?[t.data.buffer]:null);if(e.destroyed)throw Error(`Worker was destroyed`);return n}function getUrlProp(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(_util.isNodeJS&&typeof e==`string`)return e}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function getDataProp(e){if(_util.isNodeJS&&typeof Buffer<`u`&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return(0,_util.stringToBytes)(e);if(typeof e==`object`&&!isNaN(e?.length)||(0,_util.isArrayBuffer)(e))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${PDFDocumentLoadingTask.#e++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker&&=(this._worker.destroy(),null)}}exports$2.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(let n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then(()=>{for(let n of this._progressListeners)n(e,t)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(let t of this._progressiveReadListeners)t(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)(`Abstract method PDFDataRangeTransport.requestDataRange`)}abort(){}}exports$2.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e,this._transport=t,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(e=>{if(!e)return e;let t=[];for(let n in e)t.push(...e[n]);return t}))})}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,`isPureXfa`,!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}
1getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports$2.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#e=null;#t=!1;constructor(e,t,n,r=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=r?new _display_utils.StatTimer:null,this._pdfBug=r,this.commonObjs=n.commonObjs,this.objs=new PDFObjects,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e=`display`}={}){let t=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,`isPureXfa`,!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:n=`display`,annotationMode:r=_util.AnnotationMode.ENABLE,transform:i=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:s=null,pageColors:c=null,printAnnotationStorage:l=null}){this._stats?.time(`Overall`);let u=this._transport.getRenderingIntent(n,r,l);this.#t=!1,this.#r(),o||=this._transport.getOptionalContentConfig();let d=this._intentStates.get(u.cacheKey);d||(d=Object.create(null),this._intentStates.set(u.cacheKey,d)),d.streamReaderCancelTimeout&&(clearTimeout(d.streamReaderCancelTimeout),d.streamReaderCancelTimeout=null);let f=!!(u.renderingIntent&_util.RenderingIntentFlag.PRINT);d.displayReadyCapability||(d.displayReadyCapability=new _util.PromiseCapability,d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(u));let p=e=>{d.renderTasks.delete(m),(this._maybeCleanupAfterRender||f)&&(this.#t=!0),this.#n(!f),e?(m.capability.reject(e),this._abortOperatorList({intentState:d,reason:e instanceof Error?e:Error(e)})):m.capability.resolve(),this._stats?.timeEnd(`Rendering`),this._stats?.timeEnd(`Overall`)},m=new InternalRenderTask({callback:p,params:{canvasContext:e,viewport:t,transform:i,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:s,operatorList:d.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!f,pdfBug:this._pdfBug,page
1Colors:c});(d.renderTasks||=new Set).add(m);let h=m.task;return Promise.all([d.displayReadyCapability.promise,o]).then(([e,t])=>{if(this.destroyed){p();return}this._stats?.time(`Rendering`),m.initializeGraphics({transparency:e,optionalContentConfig:t}),m.operatorListChanged()}).catch(p),h}getOperatorList({intent:e=`display`,annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:n=null}={}){function r(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(o))}let i=this._transport.getRenderingIntent(e,t,n,!0),a=this._intentStates.get(i.cacheKey);a||(a=Object.create(null),this._intentStates.set(i.cacheKey,a));let o;return a.opListReadCapability||(o=Object.create(null),o.operatorListChanged=r,a.opListReadCapability=new _util.PromiseCapability,(a.renderTasks||=new Set).add(o),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(i)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream(`GetTextContent`,{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(e){return e.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(e=>_xfa_text.XfaText.textContent(e));let t=this.streamTextContent(e);return new Promise(function(e,n){function r(){i.read().then(function({value:t,done:n}){if(n){e(a);return}Object.assign(a.styles,t.styles),a.items.push(...t.items),r()},n)}let i=t.getReader(),a={items:[],styles:Object.create(null)};r()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:Error(`Page was destroyed.`),force:!0}),!t.opListReadCapability)for(let n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,this.#r(),Promise.all(e)}cleanup(e=!1){this.#t=!0;let t=this.#n(!1);return e&&t&&(this._stats&&=new _display_utils.StatTimer),t}#n(e=!1){if(this.#r(),!this.#t||this.destroyed)return!1;if(e)return this.#e=setTimeout(()=>{this.#e=null,this.#n(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#r(){this.#e&&=(clearTimeout(this.#e),null)}_startRenderPage(e,t){let n=this._intentStates.get(t);n&&(this._stats?.timeEnd(`Page Request`),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(let e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#n(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n}){let{map:r,transfers:i}=n,a=this._transport.messageHandler.sendWithStream(`GetOperatorList`,{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:r},i).getReader(),o=this._intentStates.get(t);o.streamReader=a;let s=()=>{a.read().then(({value:e,done:t})=>{if(t){o.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(e,o),s())},e=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(let e of o.renderTasks)e.operatorListChanged();this.#n(!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(e);else if(o.opListReadCapability)o.opListReadCapability.reject(e);else throw e}})};s()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&=(clearTimeout(e.streamReaderCancelTimeout),null),!n){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException){let n=RENDERING_CANCELLED_TIMEOUT;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new _util.AbortException(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports$2.PDFPageProxy=PDFPageProxy;class LoopbackPort{#e=new Set;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let e of this.#e)e.call(this,n)})}addEventListener(e,t){this.#e.add(t)}removeEventListener(e,t){this.#e.delete(t)}terminate(){this.#e.clear()}}exports$2.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports$2.PDFWorkerUtil=PDFWorkerUtil,_util.isNodeJS&&typeof __require==`function`)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc=`./pdf.worker.js`;else if(typeof document==`object`){let e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,`.worker$1$2`))}PDFWorkerUtil.isSameOrigin=function(e,t){let n;try{if(n=new URL(e),!n.origin||n.origin===`null`)return!1}catch{return!1}let r=new URL(t,n);return n.origin===r.origin},PDFWorkerUtil.createCDNWrapper=function(e){let t=`importScripts("${e}");`;return URL.createObjectURL(new Blob([t]))};class PDFWorker{static#e;constructor({name:e=null,port:t=null,verbosity:n=(0,_util.getVerbosityLevel)()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,t){if(PDFWorker.#e?.has(t))throw Error(`Cannot use more than one PDFWorker per port.`);(PDFWorker.#e||=new WeakMap).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new _message_handler.MessageHandler(`main`,`worker`,e),this._messageHandler.on(`ready`,function(){}),this._readyCapability.resolve(),this._messageHandler.send(`configure`,{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:e}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));let t=new Worker(e),n=new _message_handler.MessageHandler(`main`,`worker`,t),r=()=>{t.removeEventListener(`error`,i),n.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(Error(`Worker was destroyed`)):this._setupFakeWorker()},i=()=>{this._webWorker||r()};t.addEventListener(`error`,i),n.on(`test`,e=>{if(t.removeEventListener(`error`,i),this.destroyed){r();return}e?(this._messageHandler=n,this._port=t,this._webWorker=t,this._readyCapability.resolve(),n.send(`configure`,{verbosity:this.verbosity})):(this._setupFakeWorker(),n.destroy(),t.terminate())}),n.on(`ready`,e=>{if(t.removeEventListener(`error`,i),this.destroyed){r();return}try{a()}catch{this._setupFakeWorker()}});let a=()=>{let e=new Uint8Array;n.send(`test`,e,[e.buffer])};a();return}catch{(0,_util.info)(`The worker has been disabled.`)}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||=((0,_util.warn)(`Setting up fake worker.`),!0),PDFWorker._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(Error(`Worker was destroyed`));return}let t=new LoopbackPort;this._port=t;let n=`fake${PDFWorkerUtil.fakeWorkerId++}`,r=new _message_handler.MessageHandler(n+`_worker`,n,t);e.setup(r,t);let i=new _message_handler.MessageHandler(n,n+`_worker`,t);this._messageHandler=i,this._readyCapability.resolve(),i.send(`configure`,{verbosity:this.verbosity})}).catch(e=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&=(this._webWorker.terminate(),null),PDFWorker.#e?.delete(this._port),this._port=null,this._messageHandler&&=(this._messageHandler.destroy(),null)}static fromPort(e){if(!e?.port)throw Error(`PDFWorker.fromPort - invalid method signature.`);let t=this.#e?.get(e.port);
1if(t){if(t._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)(`No "GlobalWorkerOptions.workerSrc" specified.`),PDFWorkerUtil.fallbackWorkerSrc;throw Error(`No "GlobalWorkerOptions.workerSrc" specified.`)}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof __require==`function`){const worker=eval(`require`)(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,`_setupFakeWorkerGlobal`,loader())}}exports$2.PDFWorker=PDFWorker;class WorkerTransport{#e=new Map;#t=new Map;#n=new Map;#r=null;constructor(e,t,n,r,i){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#i(e,t=null){let n=this.#e.get(e);if(n)return n;let r=this.messageHandler.sendWithPromise(e,t);return this.#e.set(e,r),r}get annotationStorage(){return(0,_util.shadow)(this,`annotationStorage`,new _annotation_storage.AnnotationStorage)}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,n=null,r=!1){let i=_util.RenderingIntentFlag.DISPLAY,a=_annotation_storage.SerializableEmpty;switch(e){case`any`:i=_util.RenderingIntentFlag.ANY;break;case`display`:break;case`print`:i=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:i+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:i+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:i+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,a=(i&_util.RenderingIntentFlag.PRINT&&n instanceof _annotation_storage.PrintAnnotationStorage?n:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}return r&&(i+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:i,cacheKey:`${i}_${a.hash}`,annotationStorageSerializable:a}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#r?.reject(Error(`Worker was destroyed during onPassword callback`));let e=[];for(let t of this.#t.values())e.push(t._destroy());this.#t.clear(),this.#n.clear(),this.hasOwnProperty(`annotationStorage`)&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise(`Terminate`,null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException(`Worker was terminated.`)),this.messageHandler&&=(this.messageHandler.destroy(),null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on(`GetReader`,(e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then(function({value:e,done:n}){if(n){t.close();return}(0,_util.assert)(e instanceof ArrayBuffer,`GetReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`ReaderHeadersReady`,e=>{let n=new _util.PromiseCapability,r=this._fullReader;return r.headersReady.then(()=>{(!r.isStreamingSupported||!r.isRangeSupported)&&(this._lastProgress&&t.onProgress?.(this._lastProgress),r.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),n.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})},n.reject),n.promise}),e.on(`GetRangeReader`,(e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let n=this._networkStream.getRangeReader(e.begin,e.end);if(!n){t.close();return}t.onPull=()=>{n.read().then(function({value:e,done:n}){if(n){t.close();return}(0,_util.assert)(e instanceof ArrayBuffer,`GetRangeReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{n.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`GetDoc`,({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))}),e.on(`DocException`,function(e){let n;switch(e.name){case`PasswordException`:n=new _util.PasswordException(e.message,e.code);break;case`InvalidPDFException`:n=new _util.InvalidPDFException(e.message);break;case`MissingPDFException`:n=new _util.MissingPDFException(e.message);break;case`UnexpectedResponseException`:n=new _util.UnexpectedResponseException(e.message,e.status);break;case`UnknownErrorException`:n=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)(`DocException - expected a valid Error.`)}t._capability.reject(n)}),e.on(`PasswordRequest`,e=>{if(this.#r=new _util.PromiseCapability,t.onPassword){let n=e=>{e instanceof Error?this.#r.reject(e):this.#r.resolve({password:e})};try{t.onPassword(n,e.code)}catch(e){this.#r.reject(e)}}else this.#r.reject(new _util.PasswordException(e.message,e.code));return this.#r.promise}),e.on(`DataLoaded`,e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on(`StartRenderPage`,e=>{this.destroyed||this.#t.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}),e.on(`commonobj`,([t,n,r])=>
1{if(!this.destroyed&&!this.commonObjs.has(t))switch(n){case`Font`:let i=this._params;if(`error`in r){let e=r.error;(0,_util.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let a=i.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,o=new _font_loader.FontFaceObject(r,{isEvalSupported:i.isEvalSupported,disableFontFace:i.disableFontFace,ignoreErrors:i.ignoreErrors,inspectFont:a});this.fontLoader.bind(o).catch(n=>e.sendWithPromise(`FontFallback`,{id:t})).finally(()=>{!i.fontExtraProperties&&o.data&&(o.data=null),this.commonObjs.resolve(t,o)});break;case`FontPath`:case`Image`:case`Pattern`:this.commonObjs.resolve(t,r);break;default:throw Error(`Got unknown common object type ${n}`)}}),e.on(`obj`,([e,t,n,r])=>{if(this.destroyed)return;let i=this.#t.get(t);if(!i.objs.has(e))switch(n){case`Image`:if(i.objs.resolve(e,r),r){let e;if(r.bitmap){let{width:t,height:n}=r;e=t*n*4}else e=r.data?.length||0;e>_util.MAX_IMAGE_SIZE_TO_CACHE&&(i._maybeCleanupAfterRender=!0)}break;case`Pattern`:i.objs.resolve(e,r);break;default:throw Error(`Got unknown object type ${n}`)}}),e.on(`DocProgress`,e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})}),e.on(`FetchBuiltInCMap`,e=>this.destroyed?Promise.reject(Error(`Worker was destroyed.`)):this.cMapReaderFactory?this.cMapReaderFactory.fetch(e):Promise.reject(Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),e.on(`FetchStandardFontData`,e=>this.destroyed?Promise.reject(Error(`Worker was destroyed.`)):this.standardFontDataFactory?this.standardFontDataFactory.fetch(e):Promise.reject(Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise(`GetData`,null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfers:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise(`SaveDocument`,{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(Error(`Invalid page request.`));let t=e-1,n=this.#n.get(t);if(n)return n;let r=this.messageHandler.sendWithPromise(`GetPage`,{pageIndex:t}).then(e=>{if(this.destroyed)throw Error(`Transport destroyed`);let n=new PDFPageProxy(t,e,this,this._params.pdfBug);return this.#t.set(t,n),n});return this.#n.set(t,r),r}getPageIndex(e){return typeof e!=`object`||!e||!Number.isInteger(e.num)||e.num<0||!Number.isInteger(e.gen)||e.gen<0?Promise.reject(Error(`Invalid pageIndex request.`)):this.messageHandler.sendWithPromise(`GetPageIndex`,{num:e.num,gen:e.gen})}getAnnotations(e,t){return this.messageHandler.sendWithPromise(`GetAnnotations`,{pageIndex:e,intent:t})}getFieldObjects(){return this.#i(`GetFieldObjects`)}hasJSActions(){return this.#i(`HasJSActions`)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise(`GetCalculationOrderIds`,null)}getDestinations(){return this.messageHandler.sendWithPromise(`GetDestinations`,null)}getDestination(e){return typeof e==`string`?this.messageHandler.sendWithPromise(`GetDestination`,{id:e}):Promise.reject(Error(`Invalid destination request.`))}getPageLabels(){return this.messageHandler.sendWithPromise(`GetPageLabels`,null)}getPageLayout(){return this.messageHandler.sendWithPromise(`GetPageLayout`,null)}getPageMode(){return this.messageHandler.sendWithPromise(`GetPageMode`,null)}getViewerPreferences(){return this.messageHandler.sendWithPromise(`GetViewerPreferences`,null)}getOpenAction(){return this.messageHandler.sendWithPromise(`GetOpenAction`,null)}getAttachments(){return this.messageHandler.sendWithPromise(`GetAttachments`,null)}getDocJSActions(){return this.#i(`GetDocJSActions`)}getPageJSActions(e){return this.messageHandler.sendWithPromise(`GetPageJSActions`,{pageIndex:e})}
1getStructTree(e){return this.messageHandler.sendWithPromise(`GetStructTree`,{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise(`GetOutline`,null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise(`GetOptionalContentConfig`,null).then(e=>new _optional_content_config.OptionalContentConfig(e))}getPermissions(){return this.messageHandler.sendWithPromise(`GetPermissions`,null)}getMetadata(){let e=`GetMetadata`,t=this.#e.get(e);if(t)return t;let n=this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise(`GetMarkInfo`,null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise(`Cleanup`,null);for(let e of this.#t.values())if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){let{disableAutoFetch:e,enableXfa:t}=this._params;return(0,_util.shadow)(this,`loadingParams`,{disableAutoFetch:e,enableXfa:t})}}class PDFObjects{#e=Object.create(null);#t(e){return this.#e[e]||={capability:new _util.PromiseCapability,data:null}}get(e,t=null){if(t){let n=this.#t(e);return n.capability.promise.then(()=>t(n.data)),null}let n=this.#e[e];if(!n?.capability.settled)throw Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){return this.#e[e]?.capability.settled||!1}resolve(e,t=null){let n=this.#t(e);n.data=t,n.capability.resolve()}clear(){for(let e in this.#e){let{data:t}=this.#e[e];t?.bitmap?.close()}this.#e=Object.create(null)}}class RenderTask{#e=null;constructor(e){this.#e=e,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(e=0){this.#e.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this.#e.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this.#e;return e.form||e.canvas&&t?.size>0}}exports$2.RenderTask=RenderTask;class InternalRenderTask{static#e=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:a,pageIndex:o,canvasFactory:s,filterFactory:c,useRequestAnimationFrame:l=!1,pdfBug:u=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=c,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=l===!0&&typeof window<`u`,this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#e.has(this._canvas))throw Error(`Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.`);InternalRenderTask.#e.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:n,viewport:r,transform:i,background:a}=this.params;this.gfx=new _canvas.CanvasGraphics(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:r,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}
1):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback())))}}const version=`3.11.174`;exports$2.version=version;const build=`ce8716743`;exports$2.build=build}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SerializableEmpty=t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var r=n(1),i=n(4),a=n(8);let o=Object.freeze({map:null,hash:``,transfers:void 0});t.SerializableEmpty=o;class s{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){let n=this.#t.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#t.get(e)}remove(e){if(this.#t.delete(e),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor==`function`){for(let e of this.#t.values())if(e instanceof i.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){let n=this.#t.get(e),r=!1;if(n!==void 0)for(let[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this.#t.set(e,t);r&&this.#n(),t instanceof i.AnnotationEditor&&typeof this.onAnnotationEditor==`function`&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#t.has(e)}getAll(){return this.#t.size>0?(0,r.objectFromMap)(this.#t):null}setAll(e){for(let[t,n]of Object.entries(e))this.setValue(t,n)}get size(){return this.#t.size}#n(){this.#e||(this.#e=!0,typeof this.onSetModified==`function`&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified==`function`&&this.onResetModified())}get print(){return new c(this)}get serializable(){if(this.#t.size===0)return o;let e=new Map,t=new a.MurmurHash3_64,n=[],r=Object.create(null),s=!1;for(let[n,a]of this.#t){let o=a instanceof i.AnnotationEditor?a.serialize(!1,r):a;o&&(e.set(n,o),t.update(`${n}:${JSON.stringify(o)}`),s||=!!o.bitmap)}if(s)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfers:n}:o}}t.AnnotationStorage=s;class c extends s{#e;constructor(e){super();let{map:t,hash:n,transfers:r}=e.serializable,i=structuredClone(t,r?{transfer:r}:null);this.#e={map:i,hash:n,transfers:r}}get print(){(0,r.unreachable)(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}}t.PrintAnnotationStorage=c}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditor=void 0;var r=n(5),i=n(1),a=n(6);class o{#e=``;#t=!1;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=this.focusin.bind(this);#c=this.focusout.bind(this);#l=!1;#u=!1;#d=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#f=!1;#p=o._zIndex++;static _borderLineWidth=-1;static _colorManager=new r.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(e){this.constructor===o&&(0,i.unreachable)(`Cannot initialize AnnotationEditor.`),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;let{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:s}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[a,s];let[c,l]=this.parentDimensions;this.x=e.x/c,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,i.shadow)(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new s({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}
1static initialize(e,t=null){if(o._l10nPromise||=new Map([`editor_alt_text_button_label`,`editor_alt_text_edit_button_label`,`editor_alt_text_decorative_tooltip`].map(t=>[t,e.get(t)])),t?.strings)for(let n of t.strings)o._l10nPromise.set(n,e.get(n));if(o._borderLineWidth!==-1)return;let n=getComputedStyle(document.documentElement);o._borderLineWidth=parseFloat(n.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){(0,i.unreachable)(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#f}set _isDraggable(e){this.#f=e,this.div?.classList.toggle(`draggable`,e)}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#p}setParent(e){e!==null&&(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#l?this.#l=!1:this.parent.setSelected(this))}focusout(e){this._focusEventsAllowed&&this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}#m([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this.fixAndSetPosition()}translate(e,t){this.#m(this.parentDimensions,e,t)}translateInPage(e,t){this.#m(this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}drag(e,t){let[n,r]=this.parentDimensions;if(this.x+=e/n,this.y+=t/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:a}=this,[o,s]=this.#h();i+=o,a+=s,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:`nearest`})}#h(){let[e,t]=this.parentDimensions,{_borderLineWidth:n}=o,r=n/e,i=n/t;switch(this.rotation){case 90:return[-r,i];case 180:return[r,i];case 270:return[r,-i];default:return[-r,-i]}}fixAndSetPosition(){let[e,t]=this.pageDimensions,{x:n,y:r,width:i,height:a}=this;switch(i*=e,a*=t,n*=e,r*=t,this.rotation){case 0:n=Math.max(0,Math.min(e-i,n)),r=Math.max(0,Math.min(t-a,r));break;case 90:n=Math.max(0,Math.min(e-a,n)),r=Math.min(t,Math.max(i,r));break;case 180:n=Math.min(e,Math.max(i,n)),r=Math.min(t,Math.max(a,r));break;case 270:n=Math.min(e,Math.max(a,n)),r=Math.max(0,Math.min(t-i,r));break}this.x=n/=e,this.y=r/=t;let[o,s]=this.#h();n+=o,r+=s;let{style:c}=this.div;c.left=`${(100*n).toFixed(2)}%`,c.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static#g(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return o.#g(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return o.#g(e,t,360-this.parentRotation)}#_(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this,r=t*e,a=n*e;return i.FeatureTest.isCSSRoundSupported?[Math.round(r),Math.round(a)]:[r,a]}setDims(e,t){let[n,r]=this.parentDimensions;this.div.style.width=`${(100*e/n).toFixed(2)}%`,this.#a||(this.div.style.height=`${(100*t/r).toFixed(2)}%`),this.#n?.classList.toggle(`small`,e<o.SMALL_EDITOR_SIZE||t<o.SMALL_EDITOR_SIZE)}fixDims(){let{style:e}=this.div,{height:t,width:n}=e,r=n.endsWith(`%`),i=!this.#a&&t.endsWith(`%`);if(r&&i)return;let[a,o]=this.parentDimensions;r||(e.width=`${(100*parseFloat(n)/a).toFixed(2)}%`),!this.#a&&!i&&(e.height=`${(100*parseFloat(t)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#v(){if(this.#o)return;this.#o=document.createElement(`div`),this.#o.classList.add(`resizers`);let e=[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`];this._willKeepAspectRatio||e.push(`topMiddle`,`middleRight`,`bottomMiddle`,`middleLeft`);for(let t of e){let e=document.createElement(`div`);this.#o.append(e),e.classList.add(`resizer`,t),e.addEventListener(`pointerdown`,this.#y.bind(this,t)),e.addEventListener(`contextmenu`,a.noContextMenu)}this.div.prepend(this.#o)}#y(e,t){t.preventDefault();let{isMac:n}=i.FeatureTest.platform;if(t.button!==0||t.ctrlKey&&n)return;let r=this.#b.bind(this,e),a=this._isDraggable;this._isDraggable=!1;let o={passive:!0,capture:!0};window.addEventListener(`pointermove`,r,o);let s=this.x,c=this.y,l=this.width,u=this.height,d=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let p=()=>{this._isDraggable=a,window.removeEventListener(`pointerup`,p),window.removeEventListener(`blur`,p),window.removeEventListener(`pointermove`,r,o),this.parent.div.style.cursor=d,this.div.style.cursor=f;let e=this.x,t=this.y,n=this.width,i=this.height;e===s&&t===c&&n===l&&i===u||this.addCommands({cmd:()=>{this.width=n,this.height=i,this.x=e,this.y=t;let[r,a]=this.parentDimensions;this.setDims(r*n,a*i),this.fixAndSetPosition()},undo:()=>{this.width=l,this.height=u,this.x=s,this.y=c;let[e,t]=this.parentDimensions;this.setDims(e*l,t*u),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener(`pointerup`,p),window.addEventListener(`blur`,p)}#b(e,t){let[n,r]=this.parentDimensions,i=this.x,a=this.y,s=this.width,c=this.height,l=o.MIN_SIZE/n,u=o.MIN_SIZE/r,d=e
1=>Math.round(e*1e4)/1e4,f=this.#_(this.rotation),p=(e,t)=>[f[0]*e+f[2]*t,f[1]*e+f[3]*t],m=this.#_(360-this.rotation),h=(e,t)=>[m[0]*e+m[2]*t,m[1]*e+m[3]*t],g,_,v=!1,y=!1;switch(e){case`topLeft`:v=!0,g=(e,t)=>[0,0],_=(e,t)=>[e,t];break;case`topMiddle`:g=(e,t)=>[e/2,0],_=(e,t)=>[e/2,t];break;case`topRight`:v=!0,g=(e,t)=>[e,0],_=(e,t)=>[0,t];break;case`middleRight`:y=!0,g=(e,t)=>[e,t/2],_=(e,t)=>[0,t/2];break;case`bottomRight`:v=!0,g=(e,t)=>[e,t],_=(e,t)=>[0,0];break;case`bottomMiddle`:g=(e,t)=>[e/2,t],_=(e,t)=>[e/2,0];break;case`bottomLeft`:v=!0,g=(e,t)=>[0,t],_=(e,t)=>[e,0];break;case`middleLeft`:y=!0,g=(e,t)=>[0,t/2],_=(e,t)=>[e,t/2];break}let b=g(s,c),x=_(s,c),S=p(...x),C=d(i+S[0]),w=d(a+S[1]),T=1,E=1,[D,O]=this.screenToPageTranslation(t.movementX,t.movementY);if([D,O]=h(D/n,O/r),v){let e=Math.hypot(s,c);T=E=Math.max(Math.min(Math.hypot(x[0]-b[0]-D,x[1]-b[1]-O)/e,1/s,1/c),l/s,u/c)}else y?T=Math.max(l,Math.min(1,Math.abs(x[0]-b[0]-D)))/s:E=Math.max(u,Math.min(1,Math.abs(x[1]-b[1]-O)))/c;let k=d(s*T),A=d(c*E);S=p(..._(k,A));let j=C-S[0],M=w-S[1];this.width=k,this.height=A,this.x=j,this.y=M,this.setDims(n*k,r*A),this.fixAndSetPosition()}async addAltTextButton(){if(this.#n)return;let e=this.#n=document.createElement(`button`);e.className=`altText`;let t=await o._l10nPromise.get(`editor_alt_text_button_label`);if(e.textContent=t,e.setAttribute(`aria-label`,t),e.tabIndex=`0`,e.addEventListener(`contextmenu`,a.noContextMenu),e.addEventListener(`pointerdown`,e=>e.stopPropagation()),e.addEventListener(`click`,e=>{e.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(t.preventDefault(),this._uiManager.editAltText(this))}),this.#x(),this.div.append(e),!o.SMALL_EDITOR_SIZE){let t=40;o.SMALL_EDITOR_SIZE=Math.min(128,Math.round(e.getBoundingClientRect().width*1.4))}}async#x(){let e=this.#n;if(!e)return;if(!this.#e&&!this.#t){e.classList.remove(`done`),this.#r?.remove();return}o._l10nPromise.get(`editor_alt_text_edit_button_label`).then(t=>{e.setAttribute(`aria-label`,t)});let t=this.#r;if(!t){this.#r=t=document.createElement(`span`),t.className=`tooltip`,t.setAttribute(`role`,`tooltip`);let n=t.id=`alt-text-tooltip-${this.id}`;e.setAttribute(`aria-describedby`,n);let r=100;e.addEventListener(`mouseenter`,()=>{this.#i=setTimeout(()=>{this.#i=null,this.#r.classList.add(`show`),this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,subtype:this.editorType,data:{action:`alt_text_tooltip`}}})},100)}),e.addEventListener(`mouseleave`,()=>{clearTimeout(this.#i),this.#i=null,this.#r?.classList.remove(`show`)})}e.classList.add(`done`),t.innerText=this.#t?await o._l10nPromise.get(`editor_alt_text_decorative_tooltip`):this.#e,t.parentNode||e.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#e,decorative:this.#t}}set altTextData({altText:e,decorative:t}){this.#e===e&&this.#t===t||(this.#e=e,this.#t=t,this.#x())}render(){this.div=document.createElement(`div`),this.div.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute(`id`,this.id),this.div.setAttribute(`tabIndex`,0),this.setInForeground(),this.div.addEventListener(`focusin`,this.#s),this.div.addEventListener(`focusout`,this.#c);let[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);let[n,i]=this.getInitialTranslation();return this.translate(n,i),(0,r.bindEvents)(this,this.div,[`pointerdown`]),this.div}pointerdown(e){let{isMac:t}=i.FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}this.#l=!0,this.#S(e)}#S(e){if(!this._isDraggable)return;let t=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,r;t&&(n={passive:!0,capture:!0},r=e=>{let[t,n]=this.screenToPageTranslation(e.movementX,e.movementY);this._uiManager.dragSelectedEditors(t,n)},window.addEventListener(`pointermove`,r,n));let a=()=>{if(window.removeEventListener(`pointerup`,a),window.removeEventListener(`blur`,a),t&&window.removeEventListener(`pointermove`,r,n),this.#l=!1,!this._uiManager.endDragSession()){let{isMac:t}=i.FeatureTest.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener(`pointerup`,a),window.addEventListener(`blur`,a)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition()}getRect(e,t){let n=this.parentScale,[r,i]=this.pageDimensions,[a,o]=this.pageTranslation,s=e/n,c=t/n,l=this.x*r,u=this.y*i,d=this.width*r,f=this.height*i;switch(this.rotation){case 0:return[l+s+a,i-u-c-f+o,l+s+d+a,i-u-c+o];case 90:return[l+c+a,i-u+s+o,l+c+f+a,i-u+s+d+o];case 180:return[l-s-d+a,i-u+c+o,l-s+a,i-u+c+f+o];case 270:return[l-c-f+a,i-u-s-d+o,l-c+a,i-u-s+o];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#d=!0}disableEditMode(){this.#d=!1}isInEditMode(){return this.#d}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener(`focusin`,this.#s),this.div?.addEventListener(`focusout`,this.#c)}serialize(e=!1,t=null){(0,i.unreachable)(`An editor must be serializable`)}static deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n});r.rotation=e.rotation;let[i,a]=r.pageDimensions,[o,s,c,l]=r.getRectInCurrentCoords(e.rect,a);return r.x=o/i,r.y=s/a,r.width=c/i,r.height=l/a,r}remove(){this.div.removeEventListener(`focusin`,this.#s),this.div.removeEventListener(`focusout`,this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#n?.remove(),this.#n=null,this.#r=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#v(),this.#o.classList.remove(`hidden`))}select(){this.makeResizable(),this.div?.classList.add(`selectedEditor`)}unselect(){this.#o?.classList.add(`hidden`),this.div?.classList.remove(`selectedEditor`),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(e,t){}disableEditing(){this.#n&&(this.#n.hidden=!0)}enableEditing(){this.#n&&(this.#n.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#u}set isEditing(e){this.#u=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#a=!0;let n=e/t,{style:r}=this.div;r.aspectRatio=n,r.height=`auto`}static get MIN_SIZE(){return 16}}t.AnnotationEditor=o;class s extends o{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}
1serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0,t.bindEvents=a,t.opacityToHex=o;var r=n(1),i=n(6);function a(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}function o(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,`0`)}class s{#e=0;getId(){return`${r.AnnotationEditorPrefix}${this.#e++}`}}class c{#e=(0,r.getUuid)();#t=0;#n=null;static get _isSVGFittingCanvas(){let e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>`,t=new OffscreenCanvas(1,3).getContext(`2d`),n=new Image;n.src=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>`;let i=n.decode().then(()=>(t.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,r.shadow)(this,`_isSVGFittingCanvas`,i)}async#r(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let e;if(typeof t==`string`){n.url=t;let r=await fetch(t);if(!r.ok)throw Error(r.statusText);e=await r.blob()}else e=n.file=t;if(e.type===`image/svg+xml`){let t=c._isSVGFittingCanvas,r=new FileReader,i=new Image,a=new Promise((e,a)=>{i.onload=()=>{n.bitmap=i,n.isSvg=!0,e()},r.onload=async()=>{let e=n.svgUrl=r.result;i.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},i.onerror=r.onerror=a});r.readAsDataURL(e),await a}else n.bitmap=await createImageBitmap(e);n.refCounter=1}catch(e){console.error(e),n=null}return this.#n.set(e,n),n&&this.#n.set(n.id,n),n}async getFromFile(e){let{lastModified:t,name:n,size:r,type:i}=e;return this.#r(`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);return t?t.bitmap?(t.refCounter+=1,t):t.file?this.getFromFile(t.file):this.getFromUrl(t.url):null}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);t&&(--t.refCounter,t.refCounter===0&&(t.bitmap=null))}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class l{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,mustExec:n,type:r=NaN,overwriteIfSameType:i=!1,keepUndo:a=!1}){if(n&&e(),this.#t)return;let o={cmd:e,undo:t,type:r};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(o);return}if(i&&this.#e[this.#r].type===r){a&&(o.undo=this.#e[this.#r].undo),this.#e[this.#r]=o;return}let s=this.#r+1;s===this.#n?this.#e.splice(0,1):(this.#r=s,s<this.#e.length&&this.#e.splice(s)),this.#e.push(o)}undo(){this.#r!==-1&&(this.#t=!0,this.#e[this.#r].undo(),this.#t=!1,--this.#r)}redo(){this.#r<this.#e.length-1&&(this.#r+=1,this.#t=!0,this.#e[this.#r].cmd(),this.#t=!1)}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}destroy(){this.#e=null}}t.CommandManager=l;class u{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:t}=r.FeatureTest.platform;for(let[n,r,i={}]of e)for(let e of n){let n=e.startsWith(`mac+`);t&&n?(this.callbacks.set(e.slice(4),{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1))):!t&&!n&&(this.callbacks.set(e,{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1)))}}#e(e){e.altKey&&this.buffer.push(`alt`),e.ctrlKey&&this.buffer.push(`ctrl`),e.metaKey&&this.buffer.push(`meta`),e.shiftKey&&this.buffer.push(`shift`),this.buffer.push(e.key);let t=this.buffer.join(`+`);return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;let n=this.callbacks.get(this.#e(t));if(!n)return;let{callback:r,options:{bubbles:i=!1,args:a=[],checker:o=null}}=n;o&&!o(e,t)||(r.bind(e,...a)(),i||(t.stopPropagation(),t.preventDefault()))}}t.KeyboardManager=u;class d{static _colorsMapping=new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]);get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return(0,i.getColorValues)(e),(0,r.shadow)(this,`_colors`,e)}convert(e){let t=(0,i.getRGB)(e);if(!window.matchMedia(`(forced-colors: active)`).matches)return t;for(let[e,n]of this._colors)if(n.every((e,n)=>e===t[n]))return d._colorsMapping.get(e);return t}getHexCode(e){let t=this._colors.get(e);return t?r.Util.makeHexColor(...t):e}}t.ColorManager=d;class f{#e=null;#t=new Map;#n=new Map;#r=null;#i=null;#a=new l;#o=0;#s=new Set;#c=null;#l=null;#u=new Set;#d=null;#f=new s;#p=!1;#m=!1;#h=null;#g=r.AnnotationEditorType.NONE;#_=new Set;#v=null;#y=this.blur.bind(this);#b=this.focus.bind(this);#x=this.copy.bind(this);#S=this.cut.bind(this);#C=this.paste.bind(this);#w=this.keydown.bind(this);#T=this.onEditingAction.bind(this);#E=this.onPageChanging.bind(this);#D=this.onScaleChanging.bind(this);#O=this.onRotationChanging.bind(this);#k={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#A=[0,0];#j=null;#M=null;#N=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let e=f.prototype,t=e=>{let{activeElement:t}=document;return t&&e.#M.contains(t)&&e.hasSomethingToControl()},n=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return(0,r.shadow)(this,`_keyboardManager`,new u([[[`ctrl+a`,`mac+meta+a`],e.selectAll],[[`ctrl+z`,`mac+meta+z`],e.undo],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],e.redo],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],e.delete],[[`Escape`,`mac+Escape`],e.unselectAll],[[`ArrowLeft`,`mac+ArrowLeft`],e.translateSelectedEditors,{args:[-n,0],checker:t}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e.translateSelectedEditors,{args:[-i,0],checker:t}],[[`ArrowRight`,`mac+ArrowRight`],e.translateSelectedEditors,{args:[n,0],checker:t}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e.translateSelectedEditors,{args:[i,0],checker:t}],[[`ArrowUp`,`mac+ArrowUp`],e.translateSelectedEditors,{args:[0,-n],checker:t}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e.translateSelectedEditors,{args:[0,-i],checker:t}],[[`ArrowDown`,`mac+ArrowDown`],e.translateSelectedEditors,{args:[0,n],checker:t}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e.translateSelectedEditors,{args:[0,i],checker:t}]]))}constructor(e,t,n,r,a,o){this.#M=e,this.#N=t,this.#r=n,this._eventBus=r,this._eventBus._on(`editingaction`,this.#T),this._eventBus._on(`pagechanging`,this.#
1E),this._eventBus._on(`scalechanging`,this.#D),this._eventBus._on(`rotationchanging`,this.#O),this.#i=a.annotationStorage,this.#d=a.filterFactory,this.#v=o,this.viewParameters={realScale:i.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#L(),this.#F(),this._eventBus._off(`editingaction`,this.#T),this._eventBus._off(`pagechanging`,this.#E),this._eventBus._off(`scalechanging`,this.#D),this._eventBus._off(`rotationchanging`,this.#O);for(let e of this.#n.values())e.destroy();this.#n.clear(),this.#t.clear(),this.#u.clear(),this.#e=null,this.#_.clear(),this.#a.destroy(),this.#r.destroy()}get hcmFilter(){return(0,r.shadow)(this,`hcmFilter`,this.#v?this.#d.addHCMFilter(this.#v.foreground,this.#v.background):`none`)}get direction(){return(0,r.shadow)(this,`direction`,getComputedStyle(this.#M).direction)}editAltText(e){this.#r?.editAltText(this,e)}onPageChanging({pageNumber:e}){this.#o=e-1}focusMainContainer(){this.#M.focus()}findParent(e,t){for(let n of this.#n.values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){this.#N.classList.toggle(`noUserSelect`,e)}addShouldRescale(e){this.#u.add(e)}removeShouldRescale(e){this.#u.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*i.PixelsPerInch.PDF_TO_CSS_UNITS;for(let e of this.#u)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}addToAnnotationStorage(e){!e.isEmpty()&&this.#i&&!this.#i.has(e.id)&&this.#i.setValue(e.id,e)}#P(){window.addEventListener(`focus`,this.#b),window.addEventListener(`blur`,this.#y)}#F(){window.removeEventListener(`focus`,this.#b),window.removeEventListener(`blur`,this.#y)}blur(){if(!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#_)if(t.div.contains(e)){this.#h=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#h)return;let[e,t]=this.#h;this.#h=null,t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0}),t.focus()}#I(){window.addEventListener(`keydown`,this.#w,{capture:!0})}#L(){window.removeEventListener(`keydown`,this.#w,{capture:!0})}#R(){document.addEventListener(`copy`,this.#x),document.addEventListener(`cut`,this.#S),document.addEventListener(`paste`,this.#C)}#z(){document.removeEventListener(`copy`,this.#x),document.removeEventListener(`cut`,this.#S),document.removeEventListener(`paste`,this.#C)}addEditListeners(){this.#I(),this.#R()}removeEditListeners(){this.#L(),this.#z()}copy(e){if(e.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let e of this.#_){let n=e.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(t))}cut(e){this.copy(e),this.delete()}paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of this.#l)if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let n=t.getData(`application/pdfjs`);if(!n)return;try{n=JSON.parse(n)}catch(e){(0,r.warn)(`paste: "${e.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let i=this.currentLayer;try{let e=[];for(let t of n){let n=i.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)this.#W(t);this.#K(e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){(0,r.warn)(`paste: "${e.message}".`)}}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||f._keyboardManager.exec(this,e)}onEditingAction(e){[`undo`,`redo`,`delete`,`selectAll`].includes(e.name)&&this[e.name]()}#B(e){Object.entries(e).some(([e,t])=>this.#k[e]!==t)&&this._eventBus.dispatch(`annotationeditorstateschanged`,{source:this,details:Object.assign(this.#k,e)})}#V(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}setEditingState(e){e?(this.#P(),this.#I(),this.#R(),this.#B({isEditing:this.#g!==r.AnnotationEditorType.NONE,isEmpty:this.#G(),hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:this.#a.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#F(),this.#L(),this.#z(),this.#B({isEditing:!1}),this.disableUserSelect(!1))}
vendor: 5,289 bytes, line 1
1registerEditorTypes(e){if(!this.#l){this.#l=e;for(let e of this.#l)this.#V(e.defaultPropertiesToUpdate)}}getId(){return this.#f.getId()}get currentLayer(){return this.#n.get(this.#o)}getLayer(e){return this.#n.get(e)}get currentPageIndex(){return this.#o}addLayer(e){this.#n.set(e.pageIndex,e),this.#p?e.enable():e.disable()}removeLayer(e){this.#n.delete(e.pageIndex)}updateMode(e,t=null){if(this.#g!==e){if(this.#g=e,e===r.AnnotationEditorType.NONE){this.setEditingState(!1),this.#U();return}this.setEditingState(!0),this.#H(),this.unselectAll();for(let t of this.#n.values())t.updateMode(e);if(t){for(let e of this.#t.values())if(e.annotationElementId===t){this.setSelected(e),e.enterInEditMode();break}}}}updateToolbar(e){e!==this.#g&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,mode:e})}updateParams(e,t){if(this.#l){if(e===r.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(e);return}for(let n of this.#_)n.updateParams(e,t);for(let n of this.#l)n.updateDefaultParams(e,t)}}enableWaiting(e=!1){if(this.#m!==e){this.#m=e;for(let t of this.#n.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}#H(){if(!this.#p){this.#p=!0;for(let e of this.#n.values())e.enable()}}#U(){if(this.unselectAll(),this.#p){this.#p=!1;for(let e of this.#n.values())e.disable()}}getEditors(e){let t=[];for(let n of this.#t.values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return this.#t.get(e)}addEditor(e){this.#t.set(e.id,e)}removeEditor(e){this.#t.delete(e.id),this.unselect(e),(!e.annotationElementId||!this.#s.has(e.annotationElementId))&&this.#i?.remove(e.id)}addDeletedAnnotationElement(e){this.#s.add(e.annotationElementId),e.deleted=!0}isDeletedAnnotationElement(e){return this.#s.has(e)}removeDeletedAnnotationElement(e){this.#s.delete(e.annotationElementId),e.deleted=!1}#W(e){let t=this.#n.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){this.#e!==e&&(this.#e=e,e&&this.#V(e.propertiesToUpdate))}toggleSelected(e){if(this.#_.has(e)){this.#_.delete(e),e.unselect(),this.#B({hasSelectedEditor:this.hasSelection});return}this.#_.add(e),e.select(),this.#V(e.propertiesToUpdate),this.#B({hasSelectedEditor:!0})}setSelected(e){for(let t of this.#_)t!==e&&t.unselect();this.#_.clear(),this.#_.add(e),e.select(),this.#V(e.propertiesToUpdate),this.#B({hasSelectedEditor:!0})}isSelected(e){return this.#_.has(e)}unselect(e){e.unselect(),this.#_.delete(e),this.#B({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#_.size!==0}undo(){this.#a.undo(),this.#B({hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#G()})}redo(){this.#a.redo(),this.#B({hasSomethingToUndo:!0,hasSomethingToRedo:this.#a.hasSomethingToRedo(),isEmpty:this.#G()})}addCommands(e){this.#a.add(e),this.#B({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#G()})}#G(){if(this.#t.size===0)return!0;if(this.#t.size===1)for(let e of this.#t.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let e=[...this.#_];this.addCommands({cmd:()=>{for(let t of e)t.remove()},undo:()=>{for(let t of e)this.#W(t)},mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#K(e){this.#_.clear();for(let t of e)t.isEmpty()||(this.#_.add(t),t.select());this.#B({hasSelectedEditor:!0})}selectAll(){for(let e of this.#_)e.commit();this.#K(this.#t.values())}unselectAll(){if(this.#e){this.#e.commitOrRemove();return}if(this.hasSelection){for(let e of this.#_)e.unselect();this.#_.clear(),this.#B({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#A[0]+=e,this.#A[1]+=t;let[r,i]=this.#A,a=[...this.#_],o=1e3;this.#j&&clearTimeout(this.#j),this.#j=setTimeout(()=>{this.#j=null,this.#A[0]=this.#A[1]=0,this.addCommands({cmd:()=>{for(let e of a)this.#t.has(e.id)&&e.translateInPage(r,i)},undo:()=>{for(let e of a)this.#t.has(e.id)&&e.translateInPage(-r,-i)},mustExec:!1})},1e3);for(let n of a)n.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(let e of this.#_)this.#c.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);let e=this.#c;this.#c=null;let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex;if(!t)return!1;let n=(e,t,n,r)=>{if(this.#t.has(e.id)){let i=this.#n.get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#c)for(let n of this.#c.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}isActive(e){return this.#e===e}getActive(){return this.#e}getMode(){return this.#g}get imageManager(){return(0,r.shadow)(this,`imageManager`,new c)}}t.AnnotationEditorUIManager=f}),((e,t,n)=>
1{Object.defineProperty(t,"__esModule",{value:!0}),t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PageViewport=t.PDFDateString=t.DOMStandardFontDataFactory=t.DOMSVGFactory=t.DOMFilterFactory=t.DOMCanvasFactory=t.DOMCMapReaderFactory=void 0,t.deprecated=C,t.getColorValues=O,t.getCurrentTransform=k,t.getCurrentTransformInverse=A,t.getFilenameFromUrl=_,t.getPdfFilenameFromUrl=v,t.getRGB=D,t.getXfaPageViewport=E,t.isDataScheme=h,t.isPdfFile=g,t.isValidFetchUrl=b,t.loadScript=S,t.noContextMenu=x,t.setLayerDimensions=j;var r=n(7),i=n(1);let a=`http://www.w3.org/2000/svg`;class o{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=o;class s extends r.BaseFilterFactory{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u=0;constructor({docId:e,ownerDocument:t=globalThis.document}={}){super(),this.#n=e,this.#r=t}get#d(){return this.#e||=new Map}get#f(){if(!this.#t){let e=this.#r.createElement(`div`),{style:t}=e;t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#r.createElementNS(a,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#t=this.#r.createElementNS(a,`defs`),e.append(n),n.append(this.#t),this.#r.body.append(e)}return this.#t}addFilter(e){if(!e)return`none`;let t=this.#d.get(e);if(t)return t;let n,r,i,a;if(e.length===1){let t=e[0],o=Array(256);for(let e=0;e<256;e++)o[e]=t[e]/255;a=n=r=i=o.join(`,`)}else{let[t,o,s]=e,c=Array(256),l=Array(256),u=Array(256);for(let e=0;e<256;e++)c[e]=t[e]/255,l[e]=o[e]/255,u[e]=s[e]/255;n=c.join(`,`),r=l.join(`,`),i=u.join(`,`),a=`${n}${r}${i}`}if(t=this.#d.get(a),t)return this.#d.set(e,t),t;let o=`g_${this.#n}_transfer_map_${this.#u++}`,s=`url(#${o})`;this.#d.set(e,s),this.#d.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`;if(this.#a===n||(this.#a=n,this.#o=`none`,this.#i?.remove(),!e||!t))return this.#o;let r=this.#_(e);e=i.Util.makeHexColor(...r);let a=this.#_(t);if(t=i.Util.makeHexColor(...a),this.#f.style.color=``,e===`#000000`&&t===`#ffffff`||e===t)return this.#o;let o=Array(256);for(let e=0;e<=255;e++){let t=e/255;o[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}let s=o.join(`,`),c=`g_${this.#n}_hcm_filter`,l=this.#s=this.#m(c);this.#g(s,s,s,l),this.#p(l);let u=(e,t)=>{let n=r[e]/255,i=a[e]/255,o=Array(t+1);for(let e=0;e<=t;e++)o[e]=n+e/t*(i-n);return o.join(`,`)};return this.#g(u(0,5),u(1,5),u(2,5),l),this.#o=`url(#${c})`,this.#o}addHighlightHCMFilter(e,t,n,r){let i=`${e}-${t}-${n}-${r}`;if(this.#c===i||(this.#c=i,this.#l=`none`,this.#s?.remove(),!e||!t))return this.#l;let[a,o]=[e,t].map(this.#_.bind(this)),s=Math.round(.2126*a[0]+.7152*a[1]+.0722*a[2]),c=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),[l,u]=[n,r].map(this.#_.bind(this));c<s&&([s,c,l,u]=[c,s,u,l]),this.#f.style.color=``;let d=(e,t,n)=>{let r=Array(256),i=(c-s)/n,a=e/255,o=(t-e)/(255*n),l=0;for(let e=0;e<=n;e++){let t=Math.round(s+e*i),n=a+e*o;for(let e=l;e<=t;e++)r[e]=n;l=t+1}for(let e=l;e<256;e++)r[e]=r[l-1];return r.join(`,`)},f=`g_${this.#n}_hcm_highlight_filter`,p=this.#s=this.#m(f);return this.#p(p),this.#g(d(l[0],u[0],5),d(l[1],u[1],5),d(l[2],u[2],5),p),this.#l=`url(#${f})`,this.#l}destroy(e=!1){e&&(this.#o||this.#l)||(this.#t&&=(this.#t.parentNode.parentNode.remove(),null),this.#e&&=(this.#e.clear(),null),this.#u=0)}#p(e){let t=this.#r.createElementNS(a,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}#m(e){let t=this.#r.createElementNS(a,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#f.append(t),t}#h(e,t,n){let r=this.#r.createElementNS(a,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#r.createElementNS(a,`feComponentTransfer`);r.append(i),this.#h(i,`feFuncR`,e),this.#h(i,`feFuncG`,t),this.#h(i,`feFuncB`,n)}#_(e){return this.#f.style.color=e,D(getComputedStyle(this.#f).getPropertyValue(`color`))}}t.DOMFilterFactory=s;class c extends r.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super(),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}}t.DOMCanvasFactory=c;async function l(e,t=!1){if(b(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);return t?new Uint8Array(await n.arrayBuffer()):(0,i.stringToBytes)(await n.text())}return new Promise((n,r)=>{let a=new XMLHttpRequest;a.open(`GET`,e,!0),t&&(a.responseType=`arraybuffer`),a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){let e;if(t&&a.response?e=new Uint8Array(a.response):!t&&a.responseText&&(e=(0,i.stringToBytes)(a.responseText)),e){n(e);return}}r(Error(a.statusText))}},a.send(null)})}class u extends r.BaseCMapReaderFactory{_fetchData(e,t){return l(e,this.isCompressed).then(e=>({cMapData:e,compressionType:t}))}}t.DOMCMapReaderFactory=u;class d extends r.BaseStandardFontDataFactory{_fetchData(e){return l(e,!0)}}t.DOMStandardFontDataFactory=d;class f extends r.BaseSVGFactory{_createSVG(e){return document.createElementNS(a,e)}}t.DOMSVGFactory=f;class p{constructor({viewBox:e,scale:t,rotation:n,offsetX:r=0,offsetY:i=0,dontFlip:a=!1}){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=r,this.offsetY=i;let o=(e[2]+e[0])/2,s=(e[3]+e[1])/2,c,l,u,d;switch(n%=360,n<0&&(n+=360),n){case 180:c=-1,l=0,u=0,d=1;break;case 90:c=0,l=1,u=1,d=0;break;case 270:c=0,l=-1,u=-1,d=0;break;case 0:c=1,l=0,u=0,d=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}a&&(u=-u,d=-d);let f,p,m,h;c===0?(f=Math.abs(s-e[1])*t+r,p=Math.abs(o-e[0])*t+i,m=(e[3]-e[1])*t,h=(e[2]-e[0])*t):(f=Math.abs(o-e[0])*t+r,p=Math.abs(s-e[1])*t+i,m=(e[2]-e[0])*t,h=(e[3]-e[1])*t),this.transform=[c*t,l*t,u*t,d*t,f-c*t*o-u*t*s,p-l*t*o-d*t*s],this.width=m,this.height=h}get rawDims(){let{viewBox:e}=this;return(0,i.shadow)(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:r=this.offsetY,dontFlip:i=!1}={}){return new p({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}convertToViewportPoint(e,t){return i.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){let t=i.Util.applyTransform([e[0],e[1]],this.transform),n=i.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return i.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=p;class m extends i.BaseException{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}}t.RenderingCancelledException=m;function h(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function g(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function _(e,t=!1){return t||([e]=e.split(/[#?]/,1)),e.substring(e.lastIndexOf(`/`)+1)}function v(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(h(e))return(0,i.warn)(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,r=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,a=n.exec(e),o=r.exec(a[1])||r.exec(a[2])||r.exec(a[3]);if(o&&(o=o[0],o.includes(`%`)))try{o=r.exec(decodeURIComponent(o))[0]}catch{}return o||t}class y{started=Object.create(null);times=[];time(e){e in this.started&&(0,i.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,i.warn)(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){let e=[],t=0;for(let{name:e}of this.times)t=Math.max(e.length,t);for(let{name:n,start:r,end:i}of this.times)e.push(`${n.padEnd(t)} ${i-r}ms\n`);return e.join(``)}}t.StatTimer=y;function b(e,t){try{let{protocol:n}=t?new URL(e,t):new URL(e);return n===`http:`||n===`https:`}catch{return!1}}function x(e){e.preventDefault()}function S(e,t=!1){return new Promise((n,r)=>{let i=document.createElement(`script`);i.src=e,i.onload=function(e){t&&i.remove(),n(e)},i.onerror=function(){r(Error(`Cannot load script at: ${i.src}`))},(document.head||document.documentElement).append(i)})}function C(e){console.log(`Deprecated API usage: `+e)}let w;class T{static toDateObject(e){if(!e||typeof e!=`string`)return null;w||=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?`);let t=w.exec(e);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;let c=t[7]||`Z`,l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,c===`-`?(a+=l,o+=u):c===`+`&&(a-=l,o-=u),new Date(Date.UTC(n,r,i,a,o,s))}}t.PDFDateString=T;function E(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new p({viewBox:[0,0,parseInt(r),parseInt(i)],scale:t,rotation:n})}function D(e){if(e.startsWith(`#`)){let t=parseInt(e.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return e.startsWith(`rgb(`)?e.slice(4,-1).split(`,`).map(e=>parseInt(e)):e.startsWith(`rgba(`)?e.slice(5,-1).split(`,`).map(e=>parseInt(e)).slice(0,3):((0,i.warn)(`Not a valid color format: "${e}"`),[0,0,0])}function O(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,D(r))}t.remove()}function k(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function A(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function j(e,t,n=!1,r=!0){if(t instanceof p){let{pageWidth:r,pageHeight:a}=t.rawDims,{style:o}=e,s=i.FeatureTest.isCSSRoundSupported,c=`var(--scale-factor) * ${r}px`,l=`var(--scale-factor) * ${a}px`,u=s?`round(${c}, 1px)`:`calc(${c})`,d=s?`round(${l}, 1px)`:`calc(${l})`;!n||t.rotation%180==0?(o.width=u,o.height=d):(o.width=d,o.height=u)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}}),((e,t,n)=>
1{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseFilterFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var r=n(1);class i{constructor(){this.constructor===i&&(0,r.unreachable)(`Cannot initialize BaseFilterFactory.`)}addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addHighlightHCMFilter(e,t,n,r){return`none`}destroy(e=!1){}}t.BaseFilterFactory=i;class a{constructor(){this.constructor===a&&(0,r.unreachable)(`Cannot initialize BaseCanvasFactory.`)}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`)}}reset(e,t,n){if(!e.canvas)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw Error(`Canvas is not specified`);e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,r.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=a;class o{constructor({baseUrl:e=null,isCompressed:t=!0}){this.constructor===o&&(0,r.unreachable)(`Cannot initialize BaseCMapReaderFactory.`),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw Error(`The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.`);if(!e)throw Error(`CMap name must be specified.`);let t=this.baseUrl+e+(this.isCompressed?`.bcmap`:``),n=this.isCompressed?r.CMapCompressionType.BINARY:r.CMapCompressionType.NONE;return this._fetchData(t,n).catch(e=>{throw Error(`Unable to load ${this.isCompressed?`binary `:``}CMap at: ${t}`)})}_fetchData(e,t){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=o;class s{constructor({baseUrl:e=null}){this.constructor===s&&(0,r.unreachable)(`Cannot initialize BaseStandardFontDataFactory.`),this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw Error(`The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.`);if(!e)throw Error(`Font filename must be specified.`);let t=`${this.baseUrl}${e}`;return this._fetchData(t).catch(e=>{throw Error(`Unable to load font data at: ${t}`)})}_fetchData(e){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=s;class c{constructor(){this.constructor===c&&(0,r.unreachable)(`Cannot initialize BaseSVGFactory.`)}create(e,t,n=!1){if(e<=0||t<=0)throw Error(`Invalid SVG dimensions`);let r=this._createSVG(`svg:svg`);return r.setAttribute(`version`,`1.1`),n||(r.setAttribute(`width`,`${e}px`),r.setAttribute(`height`,`${t}px`)),r.setAttribute(`preserveAspectRatio`,`none`),r.setAttribute(`viewBox`,`0 0 ${e} ${t}`),r}createElement(e){if(typeof e!=`string`)throw Error(`Invalid SVG element type`);return this._createSVG(e)}_createSVG(e){(0,r.unreachable)("Abstract method `_createSVG` called.")}}t.BaseSVGFactory=c}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var r=n(1);let i=3285377520,a=4294901760,o=65535;class s{constructor(e){this.h1=e?e&4294967295:i,this.h2=e?e&4294967295:i}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if((0,r.isArrayBuffer)(e))t=e.slice(),n=t.byteLength;else throw Error(`Wrong data format in MurmurHash3_64_update. Input must be a string or array.`);let i=n>>2,s=n-i*4,c=new Uint32Array(t.buffer,0,i),l=0,u=0,d=this.h1,f=this.h2,p=3432918353,m=461845907,h=11601,g=13715;for(let e=0;e<i;e++)e&1?(l=c[e],l=l*p&a|l*h&o,l=l<<15|l>>>17,l=l*m&a|l*g&o,d^=l,d=d<<13|d>>>19,d=d*5+3864292196):(u=c[e],u=u*p&a|u*h&o,u=u<<15|u>>>17,u=u*m&a|u*g&o,f^=u,f=f<<13|f>>>19,f=f*5+3864292196);switch(l=0,s){case 3:l^=t[i*4+2]<<16;case 2:l^=t[i*4+1]<<8;case 1:l^=t[i*4],l=l*p&a|l*h&o,l=l<<15|l>>>17,l=l*m&a|l*g&o,i&1?d^=l:f^=l}this.h1=d,this.h2=f}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&a|e*36045&o,t=t*4283543511&a|((t<<16|e>>>16)*2950163797&a)>>>16,e^=t>>>1,e=e*444984403&a|e*60499&o,t=t*3301882366&a|((t<<16|e>>>16)*3120437893&a)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}}t.MurmurHash3_64=s}),((e,t,n)=>
1{Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var r=n(1);class i{#e=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement));let t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&=(this.styleElement.remove(),null)}async loadSystemFont(e){if(!(!e||this.#e.has(e.loadedName))){if((0,r.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:n,style:i}=e,a=new FontFace(t,n,i);this.addNativeFontFace(a);try{await a.load(),this.#e.add(t)}catch{(0,r.warn)(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}(0,r.unreachable)(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e.systemFontInfo);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw(0,r.warn)(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return(0,r.shadow)(this,`isFontLoadingAPISupported`,e)}get isSyncFontLoadingSupported(){let e=!1;return(r.isNodeJS||typeof navigator<`u`&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),(0,r.shadow)(this,`isSyncFontLoadingSupported`,e)}_queueLoadingCallback(e){function t(){for((0,r.assert)(!i.done,`completeRequest() cannot be called twice.`),i.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,i={done:!1,complete:t,callback:e};return n.push(i),i}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return(0,r.shadow)(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){(0,r.warn)(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=16,m=1482184792,h=n(f,16);for(a=0,o=d.length-3;a<o;a+=4)h=h-m+n(d,a)|0;a<d.length&&(h=h-m+n(d+`XXX`,a)|0),f=i(f,16,4,(0,r.string32)(h));let g=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(f)});`}}`;this.insertRule(g);let _=this._document.createElement(`div`);_.style.visibility=`hidden`,_.style.width=_.style.height=`10px`,_.style.position=`absolute`,_.style.top=_.style.left=`0px`;for(let t of[e.loadedName,d]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,_.append(e)}this._document.body.append(_),u(d,()=>{_.remove(),t.complete()})}}t.FontLoader=i;class a{constructor(e,{isEvalSupported:t=!0,disableFontFace:n=!1,ignoreErrors:r=!1,inspectFont:i=null}){this.compiledGlyphs=Object.create(null);for(let t in e)this[t]=e[t];this.isEvalSupported=t!==!1,this.disableFontFace=n===!0,this.ignoreErrors=r===!0,this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=(0,r.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}return this._inspectFont?.(this,t),n}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n;try{n=e.get(this.loadedName+`_path_`+t)}catch(e){if(!this.ignoreErrors)throw e;
1return(0,r.warn)(`getPathGenerator - ignoring character: "${e}".`),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&r.FeatureTest.isEvalSupported){let e=[];for(let t of n){let n=t.args===void 0?``:t.args.join(`,`);e.push(`c.`,t.cmd,`(`,n,`); 2`)}return this.compiledGlyphs[t]=Function(`c`,`size`,e.join(``))}return this.compiledGlyphs[t]=function(e,t){for(let r of n)r.cmd===`scale`&&(r.args=[t,-t]),e[r.cmd].apply(e,r.args)}}}t.FontFaceObject=a}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeFilterFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var r=n(7),i=n(1);let a=function(e){return new Promise((t,n)=>{require___vite_browser_external().readFile(e,(e,r)=>{if(e||!r){n(Error(e));return}t(new Uint8Array(r))})})};class o extends r.BaseFilterFactory{}t.NodeFilterFactory=o;class s extends r.BaseCanvasFactory{_createCanvas(e,t){return require___vite_browser_external().createCanvas(e,t)}}t.NodeCanvasFactory=s;class c extends r.BaseCMapReaderFactory{_fetchData(e,t){return a(e).then(e=>({cMapData:e,compressionType:t}))}}t.NodeCMapReaderFactory=c;class l extends r.BaseStandardFontDataFactory{_fetchData(e){return a(e)}}t.NodeStandardFontDataFactory=l}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var r=n(1),i=n(6),a=n(12),o=n(13);let s=16,c=100,l=4096,u=15,d=10,f=1e3,p=16;function m(e,t){if(e._removeMirroring)throw Error(`Context is already forwarding operations.`);e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},e.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},e.transform=function(e,n,r,i,a,o){t.transform(e,n,r,i,a,o),this.__originalTransform(e,n,r,i,a,o)},e.setTransform=function(e,n,r,i,a,o){t.setTransform(e,n,r,i,a,o),this.__originalSetTransform(e,n,r,i,a,o)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},e.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},e.bezierCurveTo=function(e,n,r,i,a,o){t.bezierCurveTo(e,n,r,i,a,o),this.__originalBezierCurveTo(e,n,r,i,a,o)},e.rect=function(e,n,r,i){t.rect(e,n,r,i),this.__originalRect(e,n,r,i)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class h{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let r;return this.cache[e]===void 0?(r=this.canvasFactory.create(t,n),this.cache[e]=r):(r=this.cache[e],this.canvasFactory.reset(r,t,n)),r}delete(e){delete this.cache[e]}clear(){for(let e in this.cache){let t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function g(e,t,n,r,a,o,s,c,l,u){let[d,f,p,m,h,g]=(0,i.getCurrentTransform)(e);if(f===0&&p===0){let i=s*d+h,_=Math.round(i),v=c*m+g,y=Math.round(v),b=(s+l)*d+h,x=Math.abs(Math.round(b)-_)||1,S=(c+u)*m+g,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(m),_,y),e.drawImage(t,n,r,a,o,0,0,x,C),e.setTransform(d,f,p,m,h,g),[x,C]}if(d===0&&m===0){let i=c*p+h,_=Math.round(i),v=s*f+g,y=Math.round(v),b=(c+u)*p+h,x=Math.abs(Math.round(b)-_)||1,S=(s+l)*f+g,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(0,Math.sign(f),Math.sign(p),0,_,y),e.drawImage(t,n,r,a,o,0,0,C,x),e.setTransform(d,f,p,m,h,g),[C,x]}e.drawImage(t,n,r,a,o,s,c,l,u);
2let _=Math.hypot(d,f),v=Math.hypot(p,m);return[_*l,v*u]}function _(e){let{width:t,height:n}=e;if(t>f||n>f)return null;let r=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=t+1,o=new Uint8Array(a*(n+1)),s,c,l,u=t+7&-8,d=new Uint8Array(u*n),p=0;for(let t of e.data){let e=128;for(;e>0;)d[p++]=t&e?0:255,e>>=1}let m=0;for(p=0,d[p]!==0&&(o[0]=1,++m),c=1;c<t;c++)d[p]!==d[p+1]&&(o[c]=d[p]?2:1,++m),p++;for(d[p]!==0&&(o[c]=2,++m),s=1;s<n;s++){p=s*u,l=s*a,d[p-u]!==d[p]&&(o[l]=d[p]?1:8,++m);let e=(d[p]?4:0)+(d[p-u]?8:0);for(c=1;c<t;c++)e=(e>>2)+(d[p+1]?4:0)+(d[p-u+1]?8:0),i[e]&&(o[l+c]=i[e],++m),p++;if(d[p-u]!==d[p]&&(o[l+c]=d[p]?2:4,++m),m>r)return null}for(p=u*(n-1),l=s*a,d[p]!==0&&(o[l]=8,++m),c=1;c<t;c++)d[p]!==d[p+1]&&(o[l+c]=d[p]?4:8,++m),p++;if(d[p]!==0&&(o[l+c]=4,++m),m>r)return null;let h=new Int32Array([0,a,-1,0,-a,0,0,0,1]),g=new Path2D;for(s=0;m&&s<=n;s++){let e=s*a,n=e+t;for(;e<n&&!o[e];)e++;if(e===n)continue;g.moveTo(e%a,s);let r=e,i=o[e];do{let t=h[i];do e+=t;while(!o[e]);let n=o[e];n!==5&&n!==10?(i=n,o[e]=0):(i=n&51*i>>4,o[e]&=i>>2|i<<2),g.lineTo(e%a,e/a|0),o[e]||--m}while(r!==e);--s}return d=null,o=null,function(e){e.save(),e.scale(1/t,-1/n),e.translate(0,-n),e.fill(g),e.beginPath(),e.restore()}}class v{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=r.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=r.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=r.TextRenderingMode.FILL,this.textRise=0,this.fillColor=`#000000`,this.strokeColor=`#000000`,this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps=`none`,this.startNewPathAndClipBox([0,0,e,t])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,n){[t,n]=r.Util.applyTransform([t,n],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,t){let n=r.Util.applyTransform(t,e),i=r.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,n[0],i[0]),this.minY=Math.min(this.minY,n[1],i[1]),this.maxX=Math.max(this.maxX,n[0],i[0]),this.maxY=Math.max(this.maxY,n[1],i[1])}updateScalingPathMinMax(e,t){r.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,n,i,a,o,s,c,l,u){let d=r.Util.bezierBoundingBox(t,n,i,a,o,s,c,l);if(u){u[0]=Math.min(u[0],d[0],d[2]),u[1]=Math.max(u[1],d[0],d[2]),u[2]=Math.min(u[2],d[1],d[3]),u[3]=Math.max(u[3],d[1],d[3]);return}this.updateRectMinMax(e,d)}getPathBoundingBox(e=a.PathType.FILL,t=null){let n=[this.minX,this.minY,this.maxX,this.maxY];if(e===a.PathType.STROKE){t||(0,r.unreachable)(`Stroke bounding box must include transform.`);let e=r.Util.singularValueDecompose2dScale(t),i=e[0]*this.lineWidth/2,a=e[1]*this.lineWidth/2;n[0]-=i,n[1]-=a,n[2]+=i,n[3]+=a}return n}updateClipFromPath(){let e=r.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=a.PathType.FILL,t=null){return r.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function y(e,t){if(typeof ImageData<`u`&&t instanceof ImageData){e.putImageData(t,0,0);return}let n=t.height,i=t.width,a=n%16,o=(n-a)/16,s=a===0?o:o+1,c=e.createImageData(i,16),l=0,u,d=t.data,f=c.data,p,m,h,g;if(t.kind===r.ImageKind.GRAYSCALE_1BPP){let t=d.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),g=n.length,_=i+7>>3,v=4294967295,y=r.FeatureTest.isLittleEndian?4278190080:255;for(p=0;p<s;p++){for(h=p<o?16:a,u=0,m=0;m<h;m++){let e=t-l,r=0,a=e>_?i:e*8-7,o=a&-8,s=0,c=0;for(;r<o;r+=8)c=d[l++],n[u++]=c&128?v:y,n[u++]=c&64?v:y,n[u++]=c&32?v:y,n[u++]=c&16?v:y,n[u++]=c&8?v:y,n[u++]=c&4?v:y,n[u++]=c&2?v:y,n[u++]=c&1?v:y;for(;r<a;r++)s===0&&(c=d[l++],s=128),n[u++]=c&s?v:y,s>>=1}for(;u<g;)n[u++]=0;e.putImageData(c,0,p*16)}}else if(t.kind===r.ImageKind.RGBA_32BPP){for(m=0,g=i*16*4,p=0;p<o;p++)f.set(d.subarray(l,l+g)),l+=g,e.putImageData(c,0,m),m+=16;p<s&&(g=i*a*4,f.set(d.subarray(l,l+g)),e.putImageData(c,0,m))}else if(t.kind===r.ImageKind.RGB_24BPP)for(h=16,g=i*h,p=0;p<s;p++){for(p>=o&&(h=a,g=i*h),u=0,m=g;m--;)f[u++]=d[l++],f[u++]=d[l++],f[u++]=d[l++],f[u++]=255;e.putImageData(c,0,p*16)}else throw Error(`bad image kind: ${t.kind}`)}function b(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let n=t.height,r=t.width,i=n%16,a=(n-i)/16,s=i===0?a:a+1,c=e.createImageData(r,16),l=0,u=t.data,d=c.data;for(let t=0;t<s;t++){let n=t<a?16:i;({srcPos:l}=(0,o.convertBlackAndWhiteToRGBA)({src:u,srcPos:l,dest:d,width:r,height:n,nonBlackColor:0})),e.putImageData(c,0,t*16)}}function x(e,t){for(let n of[`strokeStyle`,`fillStyle`,`fillRule`,`globalAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`globalCompositeOperation`,`font`,`filter`])e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function S(e){if(e.strokeStyle=e.fillStyle=`#000000`,e.fillRule=`nonzero`,e.globalAlpha=1,e.lineWidth=1,e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=10,e.globalCompositeOperation=`source-over`,e.font=`10px sans-serif`,e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0),!r.isNodeJS){let{filter:t}=e;t!==`none`&&t!==``&&(e.filter=`none`)}}function C(e,t,n,r){let i=e.length;for(let a=3;a<i;a+=4){let i=e[a];if(i===0)e[a-3]=t,e[a-2]=n,e[a-1]=r;else if(i<255){let o=255-i;e[a-3]=e[a-3]*i+t*o>>8,e[a-2]=e[a-2]*i+n*o>>8,e[a-1]=e[a-1]*i+r*o>>8}}}function w(e,t,n){let r=e.length,i=1/255;for(let i=3;i<r;i+=4){let r=n?n[e[i]]:e[i];t[i]=t[i]*r*.00392156862745098|0}}function T(e,t,n){let r=e.length;for(let i=3;i<r;i+=4){let r=e[i-3]*77+e[i-2]*152+e[i-1]*28;t[i]=n?t[i]*n[r>>8]>>8:t[i]*r>>16}}function E(e,t,n,r,i,a,o,s,c,l,u){let d=!!a,f=d?a[0]:0,p=d?a[1]:0,m=d?a[2]:0,h=i===`Luminosity`?T:w,g=Math.min(r,Math.ceil(1048576/n));for(let i=0;i<r;i+=g){let a=Math.min(g,r-i),_=e.getImageData(s-l,i+(c-u),n,a),v=t.getImageData(s,i+c,n,a);d&&C(_.data,f,p,m),h(_.data,v.data,o),t.putImageData(v,s,i+c)}}function D(e,t,n,r){let i=r[0],a=r[1],o=r[2]-i,s=r[3]-a;o===0||s===0||(E(t.context,n,o,s,t.subtype,t.backdrop,t.transferMap,i,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation=`source-over`,e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore(
2))}function O(e,t){let n=r.Util.singularValueDecompose2dScale(e);n[0]=Math.fround(n[0]),n[1]=Math.fround(n[1]);let a=Math.fround((globalThis.devicePixelRatio||1)*i.PixelsPerInch.PDF_TO_CSS_UNITS);return t===void 0?n[0]<=a||n[1]<=a:t}let k=[`butt`,`round`,`square`],A=[`miter`,`round`,`bevel`],j={},M={};class N{constructor(e,t,n,r,i,{optionalContentConfig:a,markedContentStack:o=null},s,c){this.ctx=e,this.current=new v(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.filterFactory=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new h(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return typeof e==`string`?e.startsWith(`g_`)?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){let a=this.ctx.canvas.width,o=this.ctx.canvas.height,s=this.ctx.fillStyle;if(this.ctx.fillStyle=r||`#ffffff`,this.ctx.fillRect(0,0,a,o),this.ctx.fillStyle=s,n){let e=this.cachedCanvases.getCanvas(`transparent`,a,o);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,i.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),S(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,i.getCurrentTransform)(this.ctx)}executeOperatorList(e,t,n,i){let a=e.argsArray,o=e.fnArray,s=t||0,c=a.length;if(c===s)return s;let l=c-s>10&&typeof n==`function`,u=l?Date.now()+15:0,d=0,f=this.commonObjs,p=this.objs,m;for(;;){if(i!==void 0&&s===i.nextBreakPoint)return i.breakIt(s,n),s;if(m=o[s],m!==r.OPS.dependency)this[m].apply(this,a[s]);else for(let e of a[s]){let t=e.startsWith(`g_`)?f:p;if(!t.has(e))return t.get(e,n),s}if(s++,s===c)return s;if(l&&++d>10){if(Date.now()>u)return n(),s;d=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&=(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width,r=e.height,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=n,s=r,c=`prescale1`,l,u;for(;i>2&&o>1||a>2&&s>1;){let t=o,n=s;i>2&&o>1&&(t=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),i/=o/t),a>2&&s>1&&(n=s>=16384?Math.floor(s/2)-1||1:Math.ceil(s)/2,a/=s/n),l=this.cachedCanvases.getCanvas(c,t,n),u=l.context,u.clearRect(0,0,t,n),u.drawImage(e,0,0,o,s,0,0,t,n),e=l.canvas,o=t,s=n,c=c===`prescale1`?`prescale2`:`prescale1`}return{img:e,paintWidth:o,paintHeight:s}}_createMaskCanvas(e){let t=this.ctx,{width:n,height:o}=e,s=this.current.fillColor,c=this.current.patternFill,l=(0,i.getCurrentTransform)(t),u,d,f,p;if((e.bitmap||e.data)&&e.count>1){let t=e.bitmap||e.data.buffer;d=JSON.stringify(c?l:[l.slice(0,4),s]),u=this._cachedBitmapsMap.get(t),u||(u=new Map,this._cachedBitmapsMap.set(t,u));let n=u.get(d);if(n&&!c)return{canvas:n,offsetX:Math.round(Math.min(l[0],l[2])+l[4]),offsetY:Math.round(Math.min(l[1],l[3])+l[5])};f=n}
vendor: 5,428 bytes, line 2
2f||(p=this.cachedCanvases.getCanvas(`maskCanvas`,n,o),b(p.context,e));let m=r.Util.transform(l,[1/n,0,0,-1/o,0,0]);m=r.Util.transform(m,[1,0,0,1,0,-o]);let h=r.Util.applyTransform([0,0],m),_=r.Util.applyTransform([n,o],m),v=r.Util.normalizeRect([h[0],h[1],_[0],_[1]]),y=Math.round(v[2]-v[0])||1,x=Math.round(v[3]-v[1])||1,S=this.cachedCanvases.getCanvas(`fillCanvas`,y,x),C=S.context,w=Math.min(h[0],_[0]),T=Math.min(h[1],_[1]);C.translate(-w,-T),C.transform(...m),f||(f=this._scaleImage(p.canvas,(0,i.getCurrentTransformInverse)(C)),f=f.img,u&&c&&u.set(d,f)),C.imageSmoothingEnabled=O((0,i.getCurrentTransform)(C),e.interpolate),g(C,f,0,0,f.width,f.height,0,0,n,o),C.globalCompositeOperation=`source-in`;let E=r.Util.transform((0,i.getCurrentTransformInverse)(C),[1,0,0,1,-w,-T]);return C.fillStyle=c?s.getPattern(t,this,E,a.PathType.FILL):s,C.fillRect(0,0,n,o),u&&!c&&(this.cachedCanvases.delete(`fillCanvas`),u.set(d,S.canvas)),{canvas:S.canvas,offsetX:Math.round(w),offsetY:Math.round(T)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=k[e]}setLineJoin(e){this.ctx.lineJoin=A[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){let n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let[t,n]of e)switch(t){case`LW`:this.setLineWidth(n);break;case`LC`:this.setLineCap(n);break;case`LJ`:this.setLineJoin(n);break;case`ML`:this.setMiterLimit(n);break;case`D`:this.setDash(n[0],n[1]);break;case`RI`:this.setRenderingIntent(n);break;case`FL`:this.setFlatness(n);break;case`Font`:this.setFont(n[0],n[1]);break;case`CA`:this.current.strokeAlpha=n;break;case`ca`:this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case`BM`:this.ctx.globalCompositeOperation=n;break;case`SMask`:this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case`TR`:this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error(`beginSMaskMode called while already in smask mode`);let e=this.ctx.canvas.width,t=this.ctx.canvas.height,n=`smaskGroupAt`+this.groupLevel,r=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=r.context;let a=this.ctx;a.setTransform(...(0,i.getCurrentTransform)(this.suspendedCtx)),x(this.suspendedCtx,a),m(a,this.suspendedCtx),this.setGState([[`BM`,`source-over`],[`ca`,1],[`CA`,1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error(`endSMaskMode called while not in smask mode`);this.ctx._removeMirroring(),x(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,n=this.suspendedCtx;D(n,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(x(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),x(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,n,r,i,a){this.ctx.transform(e,t,n,r,i,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){let a=this.ctx,o=this.current,s=o.x,c=o.y,l,u,d=(0,i.getCurrentTransform)(a),f=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,p=f?n.slice(0):null;for(let n=0,i=0,m=e.length;n<m;n++)switch(e[n]|0){case r.OPS.rectangle:s=t[i++],c=t[i++];let e=t[i++],n=t[i++],m=s+e,h=c+n;a.moveTo(s,c),e===0||n===0?a.lineTo(m,h):(a.lineTo(m,c),a.lineTo(m,h),a.lineTo(s,h)),f||o.updateRectMinMax(d,[s,c,m,h]),a.closePath();break;case r.OPS.moveTo:s=t[i++],c=t[i++],a.moveTo(s,c),f||o.updatePathMinMax(d,s,c);break;case r.OPS.lineTo:s=t[i++],c=t[i++],a.lineTo(s,c),f||o.updatePathMinMax(d,s,c);break;case r.OPS.curveTo:l=s,u=c,s=t[i+4],c=t[i+5],a.bezierCurveTo(t[i],t[i+1],t[i+2],t[i+3],s,c),o.updateCurvePathMinMax(d,l,u,t[i],t[i+1],t[i+2],t[i+3],s,c,p),i+=6;break;case r.OPS.curveTo2:l=s,u=c,a.bezierCurveTo(s,c,t[i],t[i+1],t[i+2],t[i+3]),o.updateCurvePathMinMax(d,l,u,s,c,t[i],t[i+1],t[i+2],t[i+3],p),s=t[i+2],c=t[i+3],i+=4;break;case r.OPS.curveTo3:l=s,u=c,s=t[i+2],c=t[i+3],a.bezierCurveTo(t[i],t[i+1],s,c,s,c),o.updateCurvePathMinMax(d,l,u,t[i],t[i+1],s,c,s,c,p),i+=4;break;case r.OPS.closePath:a.closePath();break}f&&o.updateScalingPathMinMax(d,p),o.setCurrentPoint(s,c)}closePath(){this.ctx.closePath()}stroke(e=!0){let t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n==`object`&&n?.getPattern?(t.save(),t.strokeStyle=n.getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.STROKE),this.rescaleAndStroke(!1),t.restore(
2)):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){let t=this.ctx,n=this.current.fillColor,r=this.current.patternFill,o=!1;r&&(t.save(),t.fillStyle=n.getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.FILL),o=!0);let s=this.current.getClippedPathBoundingBox();this.contentVisible&&s!==null&&(this.pendingEOFill?(t.fill(`evenodd`),this.pendingEOFill=!1):t.fill()),o&&t.restore(),e&&this.consumePath(s)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=j}eoClip(){this.pendingClip=M}beginText(){this.current.textMatrix=r.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let e=this.pendingTextPaths,t=this.ctx;if(e===void 0){t.beginPath();return}t.save(),t.beginPath();for(let n of e)t.setTransform(...n.transform),t.translate(n.x,n.y),n.addToPath(t,n.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){let n=this.commonObjs.get(e),i=this.current;if(!n)throw Error(`Can't find font for ${e}`);if(i.fontMatrix=n.fontMatrix||r.FONT_IDENTITY_MATRIX,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&(0,r.warn)(`Invalid font matrix for font `+e),t<0?(t=-t,i.fontDirection=-1):i.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;let a=n.loadedName||`sans-serif`,o=n.systemFontInfo?.css||`"${a}", ${n.fallbackName}`,s=`normal`;n.black?s=`900`:n.bold&&(s=`bold`);let c=n.italic?`italic`:`normal`,l=t;t<16?l=16:t>100&&(l=100),this.current.fontSizeScale=t/l,this.ctx.font=`${c} ${s} ${l}px ${o}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,n,r,i,a){this.current.textMatrix=[e,t,n,r,i,a],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,n,a){let o=this.ctx,s=this.current,c=s.font,l=s.textRenderingMode,u=s.fontSize/s.fontSizeScale,d=l&r.TextRenderingMode.FILL_STROKE_MASK,f=!!(l&r.TextRenderingMode.ADD_TO_PATH_FLAG),p=s.patternFill&&!c.missingFile,m;(c.disableFontFace||f||p)&&(m=c.getPathGenerator(this.commonObjs,e)),c.disableFontFace||p?(o.save(),o.translate(t,n),o.beginPath(),m(o,u),a&&o.setTransform(...a),(d===r.TextRenderingMode.FILL||d===r.TextRenderingMode.FILL_STROKE)&&o.fill(),(d===r.TextRenderingMode.STROKE||d===r.TextRenderingMode.FILL_STROKE)&&o.stroke(),o.restore()):((d===r.TextRenderingMode.FILL||d===r.TextRenderingMode.FILL_STROKE)&&o.fillText(e,t,n),(d===r.TextRenderingMode.STROKE||d===r.TextRenderingMode.FILL_STROKE)&&o.strokeText(e,t,n)),f&&(this.pendingTextPaths||=[]).push({transform:(0,i.getCurrentTransform)(o),x:t,y:n,fontSize:u,addToPath:m})}get isFontSubpixelAAEnabled(){let{context:e}=this.cachedCanvases.getCanvas(`isFontSubpixelAAEnabled`,10,10);e.scale(1.5,1),e.fillText(`I`,0,10);let t=e.getImageData(0,0,10,10).data,n=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){n=!0;break}return(0,r.shadow)(this,`isFontSubpixelAAEnabled`,n)}showText(e){let t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);let o=t.fontSize;if(o===0)return;
2let s=this.ctx,c=t.fontSizeScale,l=t.charSpacing,u=t.wordSpacing,d=t.fontDirection,f=t.textHScale*d,p=e.length,m=n.vertical,h=m?1:-1,g=n.defaultVMetrics,_=o*t.fontMatrix[0],v=t.textRenderingMode===r.TextRenderingMode.FILL&&!n.disableFontFace&&!t.patternFill;s.save(),s.transform(...t.textMatrix),s.translate(t.x,t.y+t.textRise),d>0?s.scale(f,-1):s.scale(f,1);let y;if(t.patternFill){s.save();let e=t.fillColor.getPattern(s,this,(0,i.getCurrentTransformInverse)(s),a.PathType.FILL);y=(0,i.getCurrentTransform)(s),s.restore(),s.fillStyle=e}let b=t.lineWidth,x=t.textMatrixScale;if(x===0||b===0){let e=t.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;(e===r.TextRenderingMode.STROKE||e===r.TextRenderingMode.FILL_STROKE)&&(b=this.getSinglePixelWidth())}else b/=x;if(c!==1&&(s.scale(c,c),b/=c),s.lineWidth=b,n.isInvalidPDFjsFont){let n=[],r=0;for(let t of e)n.push(t.unicode),r+=t.width;s.fillText(n.join(``),0,0),t.x+=r*_*f,s.restore(),this.compose();return}let S=0,C;for(C=0;C<p;++C){let t=e[C];if(typeof t==`number`){S+=h*t*o/1e3;continue}let r=!1,i=(t.isSpace?u:0)+l,a=t.fontChar,f=t.accent,p,b,x=t.width;if(m){let e=t.vmetric||g,n=-(t.vmetric?e[1]:x*.5)*_,r=e[2]*_;x=e?-e[0]:x,p=n/c,b=(S+r)/c}else p=S/c,b=0;if(n.remeasure&&x>0){let e=s.measureText(a).width*1e3/o*c;if(x<e&&this.isFontSubpixelAAEnabled){let t=x/e;r=!0,s.save(),s.scale(t,1),p/=t}else x!==e&&(p+=(x-e)/2e3*o/c)}if(this.contentVisible&&(t.isInFont||n.missingFile)){if(v&&!f)s.fillText(a,p,b);else if(this.paintChar(a,p,b,y),f){let e=p+o*f.offset.x/c,t=b-o*f.offset.y/c;this.paintChar(f.fontChar,e,t,y)}}let w=m?x*_-i*d:x*_+i*d;S+=w,r&&s.restore()}m?t.y-=S:t.x+=S*f,s.restore(),this.compose()}showType3Text(e){let t=this.ctx,n=this.current,i=n.font,a=n.fontSize,o=n.fontDirection,s=i.vertical?1:-1,c=n.charSpacing,l=n.wordSpacing,u=n.textHScale*o,d=n.fontMatrix||r.FONT_IDENTITY_MATRIX,f=e.length,p=n.textRenderingMode===r.TextRenderingMode.INVISIBLE,m,h,g,_;if(!(p||a===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...n.textMatrix),t.translate(n.x,n.y),t.scale(u,o),m=0;m<f;++m){if(h=e[m],typeof h==`number`){_=s*h*a/1e3,this.ctx.translate(_,0),n.x+=_*u;continue}let o=(h.isSpace?l:0)+c,f=i.charProcOperatorList[h.operatorListId];if(!f){(0,r.warn)(`Type3 character "${h.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=h,this.save(),t.scale(a,a),t.transform(...d),this.executeOperatorList(f),this.restore()),g=r.Util.applyTransform([h.width,0],d)[0]*a+o,t.translate(g,0),n.x+=g*u}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,r,i,a){this.ctx.rect(n,r,i-n,a-r),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if(e[0]===`TilingPattern`){let n=e[1],r=this.baseTransform||(0,i.getCurrentTransform)(this.ctx);t=new a.TilingPattern(e,n,this.ctx,{createCanvasGraphics:e=>new N(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},r)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,n){let i=r.Util.makeHexColor(e,t,n);this.ctx.strokeStyle=i,this.current.strokeColor=i}setFillRGBColor(e,t,n){let i=r.Util.makeHexColor(e,t,n);this.ctx.fillStyle=i,this.current.fillColor=i,this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=(0,a.getShadingPattern)(this.getObject(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;let t=this.ctx;this.save(),t.fillStyle=this._getPattern(e).getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.SHADING);let n=(0,i.getCurrentTransformInverse)(t);if(n){let{width:e,height:i}=t.canvas,[a,o,s,c]=r.Util.getAxialAlignedBoundingBox([0,0,e,i],n);this.ctx.fillRect(a,o,s-a,c-o)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore(
2)}beginInlineImage(){(0,r.unreachable)(`Should not call beginInlineImage`)}beginImageData(){(0,r.unreachable)(`Should not call beginImageData`)}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&e.length===6&&this.transform(...e),this.baseTransform=(0,i.getCurrentTransform)(this.ctx),t)){let e=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],e,n),this.current.updateRectMinMax((0,i.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let t=this.ctx;e.isolated||(0,r.info)(`TODO: Support non-isolated groups.`),e.knockout&&(0,r.warn)(`Knockout groups not supported.`);let n=(0,i.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw Error(`Bounding box is required.`);let a=r.Util.getAxialAlignedBoundingBox(e.bbox,(0,i.getCurrentTransform)(t)),o=[0,0,t.canvas.width,t.canvas.height];a=r.Util.intersect(a,o)||[0,0,0,0];let s=Math.floor(a[0]),c=Math.floor(a[1]),u=Math.max(Math.ceil(a[2])-s,1),d=Math.max(Math.ceil(a[3])-c,1),f=1,p=1;u>l&&(f=u/l,u=l),d>l&&(p=d/l,d=l),this.current.startNewPathAndClipBox([0,0,u,d]);let m=`groupAt`+this.groupLevel;e.smask&&(m+=`_smask_`+ this.smaskCounter++%2);let h=this.cachedCanvases.getCanvas(m,u,d),g=h.context;g.scale(1/f,1/p),g.translate(-s,-c),g.transform(...n),e.smask?this.smaskStack.push({canvas:h.canvas,context:g,offsetX:s,offsetY:c,scaleX:f,scaleY:p,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(s,c),t.scale(f,p),t.save()),x(t,g),this.ctx=g,this.setGState([[`BM`,`source-over`],[`ca`,1],[`CA`,1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;let t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let e=(0,i.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);let n=r.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,t,n,a,o){if(this.#e(),S(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&t.length===4){let a=t[2]-t[0],s=t[3]-t[1];if(o&&this.annotationCanvasMap){n=n.slice(),n[4]-=t[0],n[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=a,t[3]=s;let[o,c]=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(this.ctx)),{viewportScale:l}=this,u=Math.ceil(a*this.outputScaleX*l),d=Math.ceil(s*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(u,d);let{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(o,0,0,-c,0,s*c),S(this.ctx)}else S(this.ctx),this.ctx.rect(t[0],t[1],a,s),this.ctx.clip(),this.endPath()}this.current=new v(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;let t=e.count;e=this.getObject(e.data,e),e.count=t;let n=this.ctx,r=this.processingType3;if(r&&(r.compiled===void 0&&(r.compiled=_(e)),r.compiled)){r.compiled(n);return}let i=this._createMaskCanvas(e),a=i.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(a,i.offsetX,i.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,a=0,o,s){if(!this.contentVisible)return;e=this.getObject(e.data,e);let c=this.ctx;c.save();let l=(0,i.getCurrentTransform)(c);c.transform(t,n,a,o,0,0);let u=this._createMaskCanvas(e);c.setTransform(1,0,0,1,u.offsetX-l[4],u.offsetY-l[5]);for(let e=0,i=s.length;e<i;e+=2){let i=r.Util.transform(l,[t,n,a,o,s[e],s[e+1]]),[d,f]=r.Util.applyTransform([0,0],i);c.drawImage(u.canvas,d,f)}
2c.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;let t=this.ctx,n=this.current.fillColor,r=this.current.patternFill;for(let o of e){let{data:e,width:s,height:c,transform:l}=o,u=this.cachedCanvases.getCanvas(`maskCanvas`,s,c),d=u.context;d.save(),b(d,this.getObject(e,o)),d.globalCompositeOperation=`source-in`,d.fillStyle=r?n.getPattern(d,this,(0,i.getCurrentTransformInverse)(t),a.PathType.FILL):n,d.fillRect(0,0,s,c),d.restore(),t.save(),t.transform(...l),t.scale(1,-1),g(t,u.canvas,0,0,s,c,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;let t=this.getObject(e);if(!t){(0,r.warn)(`Dependent image isn't ready yet`);return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,n,i){if(!this.contentVisible)return;let a=this.getObject(e);if(!a){(0,r.warn)(`Dependent image isn't ready yet`);return}let o=a.width,s=a.height,c=[];for(let e=0,r=i.length;e<r;e+=2)c.push({transform:[t,0,0,n,i[e],i[e+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(a,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps!==`none`&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter=`none`),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps===`none`)return e.bitmap;let{bitmap:t,width:n,height:r}=e,i=this.cachedCanvases.getCanvas(`inlineImage`,n,r),a=i.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter=`none`,i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;let t=e.width,n=e.height,a=this.ctx;if(this.save(),!r.isNodeJS){let{filter:e}=a;e!==`none`&&e!==``&&(a.filter=`none`)}a.scale(1/t,-1/n);let o;if(e.bitmap)o=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement==`function`&&e instanceof HTMLElement||!e.data)o=e;else{let r=this.cachedCanvases.getCanvas(`inlineImage`,t,n).context;y(r,e),o=this.applyTransferMapsToCanvas(r)}let s=this._scaleImage(o,(0,i.getCurrentTransformInverse)(a));a.imageSmoothingEnabled=O((0,i.getCurrentTransform)(a),e.interpolate),g(a,s.img,0,0,s.paintWidth,s.paintHeight,0,-n,t,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;let n=this.ctx,r;if(e.bitmap)r=e.bitmap;else{let t=e.width,n=e.height,i=this.cachedCanvases.getCanvas(`inlineImage`,t,n).context;y(i,e),r=this.applyTransferMapsToCanvas(i)}for(let e of t)n.save(),n.transform(...e.transform),n.scale(1,-1),g(n,r,e.x,e.y,e.w,e.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e===`OC`?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){let t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);let n=this.ctx;this.pendingClip&&=(t||(this.pendingClip===M?n.clip(`evenodd`):n.clip()),null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=(0,i.getCurrentTransform)(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:t,b:n,c:r,d:i}=this.ctx.getTransform(),a,o;if(n===0&&r===0){let n=Math.abs(t),r=Math.abs(i);if(n===r)if(e===0)a=o=1/n;else{let t=n*e;a=o=t<1?1/t:1}else if(e===0)a=1/n,o=1/r;else{let t=n*e,i=r*e;a=t<1?1/t:1,o=i<1?1/i:1}}else{let s=Math.abs(t*i-n*r),c=Math.hypot(t,n),l=Math.hypot(r,i);if(e===0)a=l/s,o=c/s;else{let t=e*s;a=l>t?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e){let{ctx:t}=this,{lineWidth:n}=this.current,[r,i]=this.getScaleForStroking();if(t.lineWidth=n||1,r===1&&i===1){t.stroke();return}let a=t.getLineDash();if(e&&t.save(),t.scale(r,i),a.length>
vendor: 4,408 bytes, line 2
20){let e=Math.max(r,i);t.setLineDash(a.map(t=>t/e)),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}t.CanvasGraphics=N;for(let e in r.OPS)N.prototype[e]!==void 0&&(N.prototype[r.OPS[e]]=N.prototype[e])}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=p;var r=n(1),i=n(6);let a={FILL:`Fill`,STROKE:`Stroke`,SHADING:`Shading`};t.PathType=a;function o(e,t){if(!t)return;let n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}class s{constructor(){this.constructor===s&&(0,r.unreachable)(`Cannot initialize BaseShadingPattern.`)}getPattern(){(0,r.unreachable)("Abstract method `getPattern` called.")}}class c extends s{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type===`axial`?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type===`radial`&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(let e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,n,s){let c;if(s===a.STROKE||s===a.FILL){let a=t.current.getClippedPathBoundingBox(s,(0,i.getCurrentTransform)(e))||[0,0,0,0],l=Math.ceil(a[2]-a[0])||1,u=Math.ceil(a[3]-a[1])||1,d=t.cachedCanvases.getCanvas(`pattern`,l,u,!0),f=d.context;f.clearRect(0,0,f.canvas.width,f.canvas.height),f.beginPath(),f.rect(0,0,f.canvas.width,f.canvas.height),f.translate(-a[0],-a[1]),n=r.Util.transform(n,[1,0,0,1,a[0],a[1]]),f.transform(...t.baseTransform),this.matrix&&f.transform(...this.matrix),o(f,this._bbox),f.fillStyle=this._createGradient(f),f.fill(),c=e.createPattern(d.canvas,`no-repeat`);let p=new DOMMatrix(n);c.setTransform(p)}else o(e,this._bbox),c=this._createGradient(e);return c}}function l(e,t,n,r,i,a,o,s){let c=t.coords,l=t.colors,u=e.data,d=e.width*4,f;c[n+1]>c[r+1]&&(f=n,n=r,r=f,f=a,a=o,o=f),c[r+1]>c[i+1]&&(f=r,r=i,i=f,f=o,o=s,s=f),c[n+1]>c[r+1]&&(f=n,n=r,r=f,f=a,a=o,o=f);let p=(c[n]+t.offsetX)*t.scaleX,m=(c[n+1]+t.offsetY)*t.scaleY,h=(c[r]+t.offsetX)*t.scaleX,g=(c[r+1]+t.offsetY)*t.scaleY,_=(c[i]+t.offsetX)*t.scaleX,v=(c[i+1]+t.offsetY)*t.scaleY;if(m>=v)return;let y=l[a],b=l[a+1],x=l[a+2],S=l[o],C=l[o+1],w=l[o+2],T=l[s],E=l[s+1],D=l[s+2],O=Math.round(m),k=Math.round(v),A,j,M,N,P,F,I,L;for(let e=O;e<=k;e++){if(e<g){let t=e<m?0:(m-e)/(m-g);A=p-(p-h)*t,j=y-(y-S)*t,M=b-(b-C)*t,N=x-(x-w)*t}else{let t;t=e>v?1:g===v?0:(g-e)/(g-v),A=h-(h-_)*t,j=S-(S-T)*t,M=C-(C-E)*t,N=w-(w-D)*t}let t;t=e<m?0:e>v?1:(m-e)/(m-v),P=p-(p-_)*t,F=y-(y-T)*t,I=b-(b-E)*t,L=x-(x-D)*t;let n=Math.round(Math.min(A,P)),r=Math.round(Math.max(A,P)),i=d*e+n*4;for(let e=n;e<=r;e++)t=(A-e)/(A-P),t<0?t=0:t>1&&(t=1),u[i++]=j-(j-F)*t|0,u[i++]=M-(M-I)*t|0,u[i++]=N-(N-L)*t|0,u[i++]=255}}function u(e,t,n){let r=t.coords,i=t.colors,a,o;switch(t.type){case`lattice`:let s=t.verticesPerRow,c=Math.floor(r.length/s)-1,u=s-1;for(a=0;a<c;a++){let t=a*s;for(let a=0;a<u;a++,t++)l(e,n,r[t],r[t+1],r[t+s],i[t],i[t+1],i[t+s]),l(e,n,r[t+s+1],r[t+1],r[t+s],i[t+s+1],i[t+1],i[t+s])}break;case`triangles`:for(a=0,o=r.length;a<o;a+=3)l(e,n,r[a],r[a+1],r[a+2],i[a],i[a+1],i[a+2]);break;default:throw Error(`illegal figure`)}}class d extends s{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,n){let r=1.1,i=3e3,a=2,o=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,l=Math.ceil(this._bounds[3])-s,d=Math.min(Math.ceil(Math.abs(c*e[0]*r)),i),f=Math.min(Math.ceil(Math.abs(l*e[1]*r)),i),p=c/d,m=l/f,h={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-s,scaleX:1/p,scaleY:1/m},g=d+4,_=f+4,v=n.getCanvas(`mesh`,g,_,!1),y=v.context,b=y.createImageData(d,f);if(t){let e=b.data;for(let n=0,r=e.length;n<r;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=255}for(let e of this._figures)u(b,e,h);return y.putImageData(b,2,2),{canvas:v.canvas,offsetX:o-2*p,offsetY:s-2*m,scaleX:p,scaleY:m}}getPattern(e,t,n,s){o(e,this._bbox);let c;if(s===a.SHADING)c=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(e));else if(c=r.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix
2){let e=r.Util.singularValueDecompose2dScale(this.matrix);c=[c[0]*e[0],c[1]*e[1]]}let l=this._createMeshCanvas(c,s===a.SHADING?null:this._background,t.cachedCanvases);return s!==a.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(l.offsetX,l.offsetY),e.scale(l.scaleX,l.scaleY),e.createPattern(l.canvas,`no-repeat`)}}class f extends s{getPattern(){return`hotpink`}}function p(e){switch(e[0]){case`RadialAxial`:return new c(e);case`Mesh`:return new d(e);case`Dummy`:return new f}throw Error(`Unknown IR type: ${e[0]}`)}let m={COLORED:1,UNCOLORED:2};class h{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r,i){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=i}createPatternCanvas(e){let t=this.operatorList,n=this.bbox,a=this.xstep,o=this.ystep,s=this.paintType,c=this.tilingType,l=this.color,u=this.canvasGraphicsFactory;(0,r.info)(`TilingType: `+c);let d=n[0],f=n[1],p=n[2],m=n[3],h=r.Util.singularValueDecompose2dScale(this.matrix),g=r.Util.singularValueDecompose2dScale(this.baseTransform),_=[h[0]*g[0],h[1]*g[1]],v=this.getSizeAndScale(a,this.ctx.canvas.width,_[0]),y=this.getSizeAndScale(o,this.ctx.canvas.height,_[1]),b=e.cachedCanvases.getCanvas(`pattern`,v.size,y.size,!0),x=b.context,S=u.createCanvasGraphics(x);S.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(S,s,l);let C=d,w=f,T=p,E=m;return d<0&&(C=0,T+=Math.abs(d)),f<0&&(w=0,E+=Math.abs(f)),x.translate(-(v.scale*C),-(y.scale*w)),S.transform(v.scale,0,0,y.scale,0,0),x.save(),this.clipBbox(S,C,w,T,E),S.baseTransform=(0,i.getCurrentTransform)(S.ctx),S.executeOperatorList(t),S.endDrawing(),{canvas:b.canvas,scaleX:v.scale,scaleY:y.scale,offsetX:C,offsetY:w}}getSizeAndScale(e,t,n){e=Math.abs(e);let r=Math.max(h.MAX_PATTERN_SIZE,t),i=Math.ceil(e*n);return i>=r?i=r:n=i/e,{scale:n,size:i}}clipBbox(e,t,n,r,a){let o=r-t,s=a-n;e.ctx.rect(t,n,o,s),e.current.updateRectMinMax((0,i.getCurrentTransform)(e.ctx),[t,n,r,a]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){let i=e.ctx,a=e.current;switch(t){case m.COLORED:let e=this.ctx;i.fillStyle=e.fillStyle,i.strokeStyle=e.strokeStyle,a.fillColor=e.fillStyle,a.strokeColor=e.strokeStyle;break;case m.UNCOLORED:let o=r.Util.makeHexColor(n[0],n[1],n[2]);i.fillStyle=o,i.strokeStyle=o,a.fillColor=o,a.strokeColor=o;break;default:throw new r.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,n,i){let o=n;i!==a.SHADING&&(o=r.Util.transform(o,t.baseTransform),this.matrix&&(o=r.Util.transform(o,this.matrix)));let s=this.createPatternCanvas(t),c=new DOMMatrix(o);c=c.translate(s.offsetX,s.offsetY),c=c.scale(1/s.scaleX,1/s.scaleY);let l=e.createPattern(s.canvas,`repeat`);return l.setTransform(c),l}}t.TilingPattern=h}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertBlackAndWhiteToRGBA=a,t.convertToRGBA=i,t.grayToRGBA=s;var r=n(1);function i(e){switch(e.kind){case r.ImageKind.GRAYSCALE_1BPP:return a(e);case r.ImageKind.RGB_24BPP:return o(e)}return null}function a({src:e,srcPos:t=0,dest:n,width:i,height:a,nonBlackColor:o=4294967295,inverseDecode:s=!1}){let c=r.FeatureTest.isLittleEndian?4278190080:255,[l,u]=s?[o,c]:[c,o],d=i>>3,f=i&7,p=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<a;r++){for(let r=t+d;t<r;t++){let r=t<p?e[t]:255;n[m++]=r&128?u:l,n[m++]=r&64?u:l,n[m++]=r&32?u:l,n[m++]=r&16?u:l,n[m++]=r&8?u:l,n[m++]=r&4?u:l,n[m++]=r&2?u:l,n[m++]=r&1?u:l}if(f===0)continue;let r=t<p?e[t++]:255;for(let e=0;e<f;e++)n[m++]=r&1<<7-e?u:l}return{srcPos:t,destPos:m}}function o({src:e,srcPos:t=0,dest:n,destPos:i=0,width:a,height:o}){let s=0,c=e.length>>2,l=new Uint32Array(e.buffer,t,c);if(r.FeatureTest.isLittleEndian){for(;s<c-2;
2s+=3,i+=4){let e=l[s],t=l[s+1],r=l[s+2];n[i]=e|4278190080,n[i+1]=e>>>24|t<<8|4278190080,n[i+2]=t>>>16|r<<16|4278190080,n[i+3]=r>>>8|4278190080}for(let t=s*4,r=e.length;t<r;t+=3)n[i++]=e[t]|e[t+1]<<8|e[t+2]<<16|4278190080}else{for(;s<c-2;s+=3,i+=4){let e=l[s],t=l[s+1],r=l[s+2];n[i]=e|255,n[i+1]=e<<24|t>>>8|255,n[i+2]=t<<16|r>>>16|255,n[i+3]=r<<8|255}for(let t=s*4,r=e.length;t<r;t+=3)n[i++]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|255}return{srcPos:t,destPos:i}}function s(e,t){if(r.FeatureTest.isLittleEndian)for(let n=0,r=e.length;n<r;n++)t[n]=e[n]*65793|4278190080;else for(let n=0,r=e.length;n<r;n++)t[n]=e[n]*16843008|255}}),((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;let n=Object.create(null);t.GlobalWorkerOptions=n,n.workerPort=null,n.workerSrc=``}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var r=n(1);let i={UNKNOWN:0,DATA:1,ERROR:2},a={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function o(e){switch(e instanceof Error||typeof e==`object`&&e||(0,r.unreachable)(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new r.AbortException(e.message);case`MissingPDFException`:return new r.MissingPDFException(e.message);case`PasswordException`:return new r.PasswordException(e.message,e.code);case`UnexpectedResponseException`:return new r.UnexpectedResponseException(e.message,e.status);case`UnknownErrorException`:return new r.UnknownErrorException(e.message,e.details);default:return new r.UnknownErrorException(e.message,e.toString())}}class s{constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=e=>{let t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream){this.#t(t);return}if(t.callback){let e=t.callbackId,n=this.callbackCapabilities[e];if(!n)throw Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===i.DATA)n.resolve(t.data);else if(t.callback===i.ERROR)n.reject(o(t.reason));else throw Error(`Unexpected callback case`);return}let r=this.actionHandler[t.action];if(!r)throw Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let e=this.sourceName,a=t.sourceName;new Promise(function(e){e(r(t.data))}).then(function(r){n.postMessage({sourceName:e,targetName:a,callback:i.DATA,callbackId:t.callbackId,data:r})},function(r){n.postMessage({sourceName:e,targetName:a,callback:i.ERROR,callbackId:t.callbackId,reason:o(r)})});return}if(t.streamId){this.#e(t);return}r(t.data)},n.addEventListener(`message`,this._onComObjOnMessage)}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let i=this.callbackId++,a=new r.PromiseCapability;this.callbackCapabilities[i]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},n)}catch(e){a.reject(e)}return a.promise}sendWithStream(e,t,n,i){let s=this.streamId++,c=this.sourceName,l=this.targetName,u=this.comObj;return new ReadableStream({start:n=>{let a=new r.PromiseCapability;return this.streamControllers[s]={controller:n,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},u.postMessage({sourceName:c,targetName:l,action:e,streamId:s,data:t,desiredSize:n.desiredSize},i),a.promise},pull:e=>{let t=new r.PromiseCapability;return this.streamControllers[s].pullCall=t,u.postMessage({sourceName:c,targetName:l,stream:a.PULL,streamId:s,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,r.assert)(e instanceof Error,`cancel must have a valid reason`);let t=new r.PromiseCapability;return this.streamControllers[s].cancelCall=t,this.streamControllers[s].isClosed=!0,u.postMessage({sourceName:c,targetName:l,stream:a.CANCEL,streamId:s,reason:o(e)}),t.promise}},n)}#e(e){let t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,c=this,l=this.actionHandler[e.action],u={enqueue(e,o=1,c){if(this.isCancelled)return;let l=this.desiredSize;this.desiredSize-=o,l>0&&this.desiredSize<=0&&(this.sinkCapability=new r.PromiseCapability,this.ready=this.sinkCapability.promise),s.postMessage({sourceName:n,targetName:i,stream:a.ENQUEUE,streamId:t,chunk:e},c)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:a.CLOSE,streamId:t}),delete c.streamSinks[t])},error(e){(0,r.assert)(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:a.ERROR,streamId:t,reason:o(e)}))},sinkCapability:new r.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};u.sinkCapability.resolve(),u.ready=u.sinkCapability.promise,this.streamSinks[t]=u,new Promise(function(t){t(l(e.data,u))}).then(function(){s.postMessage({sourceName:n,targetName:i,stream:a.START_COMPLETE,streamId:t,success:!0})},function(e){s.postMessage({sourceName:n,targetName:i,stream:a.START_COMPLETE,streamId:t,reason:o(e)})})}#t(e){let t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,c=this.streamControllers[t],l=this.streamSinks[t];switch(e.stream){case a.START_COMPLETE:e.success?c.startCall.resolve():c.startCall.reject(o(e.reason));break;case a.PULL_COMPLETE:e.success?c.pullCall.resolve():c.pullCall.reject(o(e.reason));break;case a.PULL:if(!l){s.postMessage({sourceName:n,targetName:i,stream:a.PULL_COMPLETE,streamId:t,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,new Promise(function(e){e(l.onPull?.())}).then(function(){s.postMessage({sourceName:n,targetName:i,stream:a.PULL_COMPLETE,streamId:t,success:!0})},function(e){s.postMessage({sourceName:n,targetName:i,stream:a.PULL_COMPLETE,streamId:t,reason:o(e)})});break;case a.ENQUEUE:if((0,r.assert)(c,`enqueue should have stream controller`),c.isClosed)break;c.controller.enqueue(e.chunk);break;case a.CLOSE:if((0,r.assert)(c,`close should have stream controller`),c.isClosed)break;c.isClosed=!0,c.controller.close(),this.#n(c,t);break;case a.ERROR:(0,r.assert)(c,`error should have stream controller`),c.controller.error(o(e.reason)),this.#n(c,t);break;case a.CANCEL_COMPLETE:e.success?c.cancelCall.resolve():c.cancelCall.reject(o(e.reason)),this.#n(c,t);break;case a.CANCEL:if(!l)break;new Promise(function(t){t(l.onCancel?.(o(e.reason)))}).then(function(){s.postMessage({sourceName:n,targetName:i,stream:a.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){s.postMessage({sourceName:n,targetName:i,stream:a.CANCEL_COMPLETE,streamId:t,reason:o(e)})}),l.sinkCapability.reject(o(e.reason)),l.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async#n(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener(`message`,this._onComObjOnMessage)}}t.MessageHandler=s}),((e,t,n)=>
2{Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var r=n(1);class i{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}getAll(){return(0,r.objectFromMap)(this.#e)}has(e){return this.#e.has(e)}}t.Metadata=i}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var r=n(1),i=n(8);let a=Symbol(`INTERNAL`);class o{#e=!0;constructor(e,t){this.name=e,this.intent=t}get visible(){return this.#e}_setVisible(e,t){e!==a&&(0,r.unreachable)("Internal method `_setVisible` called."),this.#e=t}}class s{#e=null;#t=new Map;#n=null;#r=null;constructor(e){if(this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(let t of e.groups)this.#t.set(t.id,new o(t.name,t.intent));if(e.baseState===`OFF`)for(let e of this.#t.values())e._setVisible(a,!1);for(let t of e.on)this.#t.get(t)._setVisible(a,!0);for(let t of e.off)this.#t.get(t)._setVisible(a,!1);this.#n=this.getHash()}}#i(e){let t=e.length;if(t<2)return!0;let n=e[0];for(let i=1;i<t;i++){let t=e[i],a;if(Array.isArray(t))a=this.#i(t);else if(this.#t.has(t))a=this.#t.get(t).visible;else return(0,r.warn)(`Optional content group not found: ${t}`),!0;switch(n){case`And`:if(!a)return!1;break;case`Or`:if(a)return!0;break;case`Not`:return!a;default:return!0}}return n===`And`}isVisible(e){if(this.#t.size===0)return!0;if(!e)return(0,r.warn)(`Optional content group not defined.`),!0;if(e.type===`OCG`)return this.#t.has(e.id)?this.#t.get(e.id).visible:((0,r.warn)(`Optional content group not found: ${e.id}`),!0);if(e.type===`OCMD`){if(e.expression)return this.#i(e.expression);if(!e.policy||e.policy===`AnyOn`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}else if(e.policy===`AllOn`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}else if(e.policy===`AnyOff`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}else if(e.policy===`AllOff`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return(0,r.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,r.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){if(!this.#t.has(e)){(0,r.warn)(`Optional content group not found: ${e}`);return}this.#t.get(e)._setVisible(a,!!t),this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?(0,r.objectFromMap)(this.#t):null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new i.MurmurHash3_64;for(let[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}}t.OptionalContentConfig=s}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}
2),t.PDFDataTransportStream=void 0;var r=n(1),i=n(6);class a{constructor({length:e,initialData:t,progressiveDone:n=!1,contentDispositionFilename:i=null,disableRange:a=!1,disableStream:o=!1},s){if((0,r.assert)(s,`PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.`),this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=i,t?.length>0){let e=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=s,this._isStreamingSupported=!o,this._isRangeSupported=!a,this._contentLength=e,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((e,t)=>{this._onReceiveData({begin:e,chunk:t})}),this._pdfDataRangeTransport.addProgressListener((e,t)=>{this._onProgress({loaded:e,total:t})}),this._pdfDataRangeTransport.addProgressiveReadListener(e=>{this._onReceiveData({chunk:e})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:e,chunk:t}){let n=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{let t=this._rangeReaders.some(function(t){return t._begin===e?(t._enqueue(n),!0):!1});(0,r.assert)(t,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){e.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){let t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,r.assert)(!this._fullRequestReader,`PDFDataTransportStream.getFullReader can only be called once.`);let e=this._queuedChunks;return this._queuedChunks=null,new o(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new s(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}t.PDFDataTransportStream=a;class o{constructor(e,t,n=!1,r=null){this._stream=e,this._done=n||!1,this._filename=(0,i.isPdfFile)(r)?r:null,this._queuedChunks=t||[],this._loaded=0;for(let e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||=!0}}class s{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((e,t,n)=>
2{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var r=n(1),i=n(20);function a(e,t,n){return{method:`GET`,headers:e,signal:n.signal,mode:`cors`,credentials:t?`include`:`same-origin`,redirect:`follow`}}function o(e){let t=new Headers;for(let n in e){let r=e[n];r!==void 0&&t.append(n,r)}return t}function s(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,r.warn)(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class c{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,`PDFFetchStream.getFullReader can only be called once.`),this._fullRequestReader=new l(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new u(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}}t.PDFFetchStream=c;class l{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;let t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=new r.PromiseCapability,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._headers=o(this._stream.httpHeaders);let n=t.url;fetch(n,a(this._headers,this._withCredentials,this._abortController)).then(e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,n);this._reader=e.body.getReader(),this._headersCapability.resolve();let t=t=>e.headers.get(t),{allowRangeRequests:a,suggestedLength:o}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new r.AbortException(`Streaming is disabled.`))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:s(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class u{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;let s=e.source;this._withCredentials=s.withCredentials||!1,this._readCapability=new r.PromiseCapability,this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController,this._headers=o(this._stream.httpHeaders),this._headers.append(`Range`,`bytes=${t}-${n-1}`);let c=s.url;fetch(c,a(this._headers,this._withCredentials,this._abortController)).then(e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,c);this._readCapability.resolve(),this._reader=e.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:s(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=c,t.extractFilenameFromHeader=s,t.validateRangeRequestCapabilities=o,t.validateResponseStatus=l;var r=n(1),i=n(21),a=n(6);function o({getResponseHeader:e,isHttp:t,rangeChunkSize:n,disableRange:r}){let i={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e(`Content-Length`),10);return!Number.isInteger(a)||(i.suggestedLength=a,a<=2*n)||r||!t||e(`Accept-Ranges`)!==`bytes`||(e(`Content-Encoding`)||`identity`)!==`identity`||(i.allowRangeRequests=!0),i}function s(e){let t=e(`Content-Disposition`);if(t){let e=(0,i.getFilenameFromContentDispositionHeader)(t);if(e.includes(`%`))try{e=decodeURIComponent(e)}catch{}if((0,a.isPdfFile)(e))return e}return null}function c(e,t){return e===404||e===0&&t.startsWith(`file:`)?new r.MissingPDFException(`Missing PDF "`+t+`".`):new r.UnexpectedResponseException(`Unexpected server response
2(${e}) while retrieving PDF "${t}".`,e)}function l(e){return e===200||e===206}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=i;var r=n(1);function i(e){let t=!0,n=i(`filename\\*`,`i`).exec(e);if(n){n=n[1];let e=c(n);return e=unescape(e),e=l(e),e=u(e),o(e)}if(n=s(e),n)return o(u(n));if(n=i(`filename`,`i`).exec(e),n){n=n[1];let e=c(n);return e=u(e),o(e)}function i(e,t){return RegExp(`(?:^|;)\\s*`+e+`\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)`,t)}function a(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{let i=new TextDecoder(e,{fatal:!0}),a=(0,r.stringToBytes)(n);n=i.decode(a),t=!1}catch{}}return n}function o(e){return t&&/[\x80-\xff]/.test(e)&&(e=a(`utf-8`,e),t&&(e=a(`iso-8859-1`,e))),e}function s(e){let t=[],n,r=i(`filename\\*((?!0\\d)\\d+)(\\*?)`,`ig`);for(;(n=r.exec(e))!==null;){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(e===0)break;continue}t[e]=[r,i]}let a=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=c(r),n&&(r=unescape(r),e===0&&(r=l(r))),a.push(r)}return a.join(``)}function c(e){if(e.startsWith(`"`)){let t=e.slice(1).split(`\\"`);for(let e=0;e<t.length;++e){let n=t[e].indexOf(`"`);n!==-1&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,`$1`)}e=t.join(`"`)}return e}function l(e){let t=e.indexOf(`'`);return t===-1?e:a(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,``))}function u(e){return!e.startsWith(`=?`)||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(e,t,n,r){if(n===`q`||n===`Q`)return r=r.replaceAll(`_`,` `),r=r.replaceAll(/=([0-9a-fA-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))}),a(t,r);try{r=atob(r)}catch{}return a(t,r)})}return``}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNetworkStream=void 0;var r=n(1),i=n(20);let a=200,o=206;function s(e){let t=e.response;return typeof t==`string`?(0,r.stringToBytes)(t).buffer:t}class c{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,n){let r={begin:e,end:t};for(let e in n)r[e]=n[e];return this.request(r)}requestFull(e){return this.request(e)}request(e){let t=new XMLHttpRequest,n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};t.open(`GET`,this.url),t.withCredentials=this.withCredentials;for(let e in this.httpHeaders){let n=this.httpHeaders[e];n!==void 0&&t.setRequestHeader(e,n)}return this.isHttp&&`begin`in e&&`end`in e?(t.setRequestHeader(`Range`,`bytes=${e.begin}-${e.end-1}`),r.expectedStatus=206):r.expectedStatus=200,t.responseType=`arraybuffer`,e.onError&&(t.onerror=function(n){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){let n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){let n=this.pendingRequests[e];if(!n)return;let r=n.xhr;if(r.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),r.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],r.status===0&&this.isHttp){n.onError?.(r.status);return}let i=r.status||200;if(!(i===200&&n.expectedStatus===206)&&i!==n.expectedStatus){n.onError?.(r.status);return}let a=s(r);if(i===206){let e=r.getResponseHeader(`Content-Range`),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);n.onDone({begin:parseInt(t[1],10),chunk:a})}else a?n.onDone({begin:0,chunk:a}):n.onError?.(r.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){let t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class l{constructor(e){this._source=e,this._manager=new c(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){let t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return(0,r.assert)(!this._fullRequestReader,`PDFNetworkStream.getFullReader can only be called once.`),this._fullRequestReader=new u(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){let n=new d(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}}t.PDFNetworkStream=l;class u{constructor(e,t){this._manager=e;let n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(n),this._headersReceivedCapability=new r.PromiseCapability,this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){let e=this._fullRequestId,t=this._manager.getRequestXhr(e),n=e=>t.getResponseHeader(e),{allowRangeRequests:r,suggestedLength:a}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n),this._isRangeSupported&&this._manager.abortRequest
2(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e);for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class d{constructor(e,t,n){this._manager=e;let r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,n,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){let t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var r=n(1),i=n(20);let a=/^file:\/\/\/[a-zA-Z]:\//;function o(e){let t=require___vite_browser_external(),n=t.parse(e);return n.protocol===`file:`||n.host?n:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(n.host||(n.protocol=`file:`),n)}class s{constructor(e){this.source=e,this.url=o(e.url),this.isHttp=this.url.protocol===`http:`||this.url.protocol===`https:`,this.isFsUrl=this.url.protocol===`file:`,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,`PDFNodeStream.getFullReader can only be called once.`),this._fullRequestReader=this.isFsUrl?new p(this):new d(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=this.isFsUrl?new m(this,e,t):new f(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}}t.PDFNodeStream=s;class c{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;let t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=new r.PromiseCapability,this._headersCapability=new r.PromiseCapability}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return e===null?(this._readCapability=new r.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on(`readable`,()=>{this._readCapability.resolve()}),e.on(`end`,()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on(`error`,e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new r.AbortException(`streaming is disabled`)),this._storedError&&this._readableStream.destroy(this._storedError)}}class l{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new r.PromiseCapability;let t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return e===null?(this._readCapability=new r.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on(`readable`,()=>{this._readCapability.resolve()}),e.on(`end`,()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on(`error`,e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function u(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:`GET`,headers:t}}class d extends c{constructor(e){super(e);let t=t=>{if(t.statusCode===404){let e=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e,this._headersCapability.reject(e);return}this._headersCapability.resolve(),this._setReadableStream(t);let n=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:a,suggestedLength:o}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n)};if(this._request=null,this._url.protocol===`http:`){let n=require___vite_browser_external();this._request=n.request(u(this._url,e.httpHeaders),t)}else{let n=require___vite_browser_external();this._request=n.request(u(this._url,e.httpHeaders),t)}this._request.on(`error`,e=>{this._storedError=e,this._headersCapability.reject(e)}),this._request.end()}}class f extends l{constructor(e,t,n){super(e),this._httpHeaders={};for(let t in e.httpHeaders){let n=e.httpHeaders[t];n!==void 0&&(this._httpHeaders[t]=n)}this._httpHeaders.Range=`bytes=${t}-${n-1}`;let i=e=>{if(e.statusCode===404){let e=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e;return}this._setReadableStream(e)};if(this._request=null,this._url.protocol===`http:`){let e=require___vite_browser_external();this._request=e.request(u(this._url,this._httpHeaders),i)}else{let e=require___vite_browser_external();this._request=e.request(u(this._url,this._httpHeaders),i)}this._request.on(`error`,e=>{this._storedError=e}),this._request.end()}}class p extends c{constructor(e){super(e);let t=decodeURIComponent(this._url.path);a.test(this._url.href)&&(t=t.replace(/^\//,``));let n=require___vite_browser_external();
2n.lstat(t,(e,i)=>{if(e){e.code===`ENOENT`&&(e=new r.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,this._headersCapability.reject(e);return}this._contentLength=i.size,this._setReadableStream(n.createReadStream(t)),this._headersCapability.resolve()})}}class m extends l{constructor(e,t,n){super(e);let r=decodeURIComponent(this._url.path);a.test(this._url.href)&&(r=r.replace(/^\//,``));let i=require___vite_browser_external();this._setReadableStream(i.createReadStream(r,{start:t,end:n-1}))}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var r=n(6),i=n(1);let a={fontStyle:`normal`,fontWeight:`normal`,fillColor:`#000000`},o=`http://www.w3.org/XML/1998/namespace`,s=`http://www.w3.org/1999/xlink`,c=[`butt`,`round`,`square`],l=[`miter`,`round`,`bevel`],u=function(e,t=``,n=!1){if(URL.createObjectURL&&typeof Blob<`u`&&!n)return URL.createObjectURL(new Blob([e],{type:t}));let r=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,i=`data:${t};base64,`;for(let t=0,n=e.length;t<n;t+=3){let a=e[t]&255,o=e[t+1]&255,s=e[t+2]&255,c=a>>2,l=(a&3)<<4|o>>4,u=t+1<n?(o&15)<<2|s>>6:64,d=t+2<n?s&63:64;i+=r[c]+r[l]+r[u]+r[d]}return i},d=function(){let e=new Uint8Array([137,80,78,71,13,10,26,10]),t=12,n=new Int32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?3988292384^t>>1&2147483647:t>>1&2147483647;n[e]=t}function r(e,t,r){let i=-1;for(let a=t;a<r;a++){let t=n[(i^e[a])&255];i=i>>>8^t}return i^-1}function a(e,t,n,i){let a=i,o=t.length;n[a]=o>>24&255,n[a+1]=o>>16&255,n[a+2]=o>>8&255,n[a+3]=o&255,a+=4,n[a]=e.charCodeAt(0)&255,n[a+1]=e.charCodeAt(1)&255,n[a+2]=e.charCodeAt(2)&255,n[a+3]=e.charCodeAt(3)&255,a+=4,n.set(t,a),a+=t.length;let s=r(n,i+4,a);n[a]=s>>24&255,n[a+1]=s>>16&255,n[a+2]=s>>8&255,n[a+3]=s&255}function o(e,t,n){let r=1,i=0;for(let a=t;a<n;++a)r=(r+(e[a]&255))%65521,i=(i+r)%65521;return i<<16|r}function s(e){if(!i.isNodeJS)return c(e);try{let t=parseInt(process.versions.node)>=8?e:Buffer.from(e),n=require___vite_browser_external().deflateSync(t,{level:9});return n instanceof Uint8Array?n:new Uint8Array(n)}catch(e){(0,i.warn)(`Not compressing PNG because zlib.deflateSync is unavailable: `+e)}return c(e)}function c(e){let t=e.length,n=65535,r=Math.ceil(t/n),i=new Uint8Array(2+t+r*5+4),a=0;i[a++]=120,i[a++]=156;let s=0;for(;t>n;)i[a++]=0,i[a++]=255,i[a++]=255,i[a++]=0,i[a++]=0,i.set(e.subarray(s,s+n),a),a+=n,s+=n,t-=n;i[a++]=1,i[a++]=t&255,i[a++]=t>>8&255,i[a++]=~t&255,i[a++]=(~t&65535)>>8&255,i.set(e.subarray(s),a),a+=e.length-s;let c=o(e,0,e.length);return i[a++]=c>>24&255,i[a++]=c>>16&255,i[a++]=c>>8&255,i[a++]=c&255,i}function l(t,n,r,o){let c=t.width,l=t.height,d,f,p,m=t.data;switch(n){case i.ImageKind.GRAYSCALE_1BPP:f=0,d=1,p=c+7>>3;break;case i.ImageKind.RGB_24BPP:f=2,d=8,p=c*3;break;case i.ImageKind.RGBA_32BPP:f=6,d=8,p=c*4;break;default:throw Error(`invalid format`)}let h=new Uint8Array((1+p)*l),g=0,_=0;for(let e=0;e<l;++e)h[g++]=0,h.set(m.subarray(_,_+p),g),_+=p,g+=p;if(n===i.ImageKind.GRAYSCALE_1BPP&&o){g=0;for(let e=0;e<l;e++){g++;for(let e=0;e<p;e++)h[g++]^=255}}let v=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,c&255,l>>24&255,l>>16&255,l>>8&255,l&255,d,f,0,0,0]),y=s(h),b=e.length+36+v.length+y.length,x=new Uint8Array(b),S=0;return x.set(e,S),S+=e.length,a(`IHDR`,v,x,S),S+=12+v.length,a(`IDATA`,y,x,S),S+=12+y.length,a(`IEND`,new Uint8Array,x,S),u(x,`image/png`,r)}return function(e,t,n){return l(e,e.kind===void 0?i.ImageKind.GRAYSCALE_1BPP:e.kind,t,n)}}();class f{constructor(){this.fontSizeScale=1,this.fontWeight=a.fontWeight,this.fontSize=0,this.textMatrix=i.IDENTITY_MATRIX,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=i.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=a.fillColor,this.strokeColor=`#000000`,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin=``,this.lineCap=``,this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=``}clone(){return Object.create(this)}setCurrentPoint(e,t){this.x=e,this.y=t}}function p(e){let t=[],n=[];for(let r of e){if(r.fn===`save`){t.push({fnId:92,fn:`group`,items:[]}),n.push(t),t=t.at(-1).items;continue}r.fn===`restore`?t=n.pop():t.push(r)}return t}function m(e){if(Number.isInteger(e))return e.toString();let t=e.toFixed(10),n=t.length-1;if(t[n]!==`0`)return t;do n--;while(t[n]===`0`);return t.substring(0,t[n]===`.`?n:n+1)}function h(e){if(e[4]===0&&e[5]===0){if(e[1]===0&&e[2]===0)return e[0]===1&&e[3]===1?``:`scale(${m(e[0])} ${m(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2])return`rotate(${m(Math.acos(e[0])*180/Math.PI)})`}else if(e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1)return`translate(${m(e[4])} ${m(e[5])})`;return`matrix(${m(e[0])} ${m(e[1])} ${m(e[2])} ${m(e[3])} ${m(e[4])} ${m(e[5])})`}let g=0,_=0,v=0;class y{constructor(e,t,n=!1){(0,r.deprecated)(`The SVG back-end is no longer maintained and *may* be removed in the future.`),this.svgFactory=new r.DOMSVGFactory,this.current=ne
vendor: 5,573 bytes, line 2
2w f,this.transformMatrix=i.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!n,this._operatorIdMapping=[];for(let e in i.OPS)this._operatorIdMapping[i.OPS[e]]=e}getObject(e,t=null){return typeof e==`string`?e.startsWith(`g_`)?this.commonObjs.get(e):this.objs.get(e):t}save(){this.transformStack.push(this.transformMatrix);let e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){let t=e.fnArray,n=e.argsArray;for(let e=0,r=t.length;e<r;e++)if(t[e]===i.OPS.dependency)for(let t of n[e]){let e=t.startsWith(`g_`)?this.commonObjs:this.objs,n=new Promise(n=>{e.get(t,n)});this.current.dependencies.push(n)}return Promise.all(this.current.dependencies)}transform(e,t,n,r,a,o){let s=[e,t,n,r,a,o];this.transformMatrix=i.Util.transform(this.transformMatrix,s),this.tgrp=null}getSVG(e,t){this.viewport=t;let n=this._initialize(t);return this.loadDependencies(e).then(()=>(this.transformMatrix=i.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),n))}convertOpList(e){let t=this._operatorIdMapping,n=e.argsArray,r=e.fnArray,i=[];for(let e=0,a=r.length;e<a;e++){let a=r[e];i.push({fnId:a,fn:t[a],args:n[e]})}return p(i)}executeOpTree(e){for(let t of e){let e=t.fn,n=t.fnId,r=t.args;switch(n|0){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(r);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(r[0],r[1]);break;case i.OPS.setFont:this.setFont(r);break;case i.OPS.showText:this.showText(r[0]);break;case i.OPS.showSpacedText:this.showText(r[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(r[0],r[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(r[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(r[0]);break;case i.OPS.setHScale:this.setHScale(r[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.setTextRise:this.setTextRise(r[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(r[0]);break;case i.OPS.setLineWidth:this.setLineWidth(r[0]);break;case i.OPS.setLineJoin:this.setLineJoin(r[0]);break;case i.OPS.setLineCap:this.setLineCap(r[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(r[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeColorN:this.setStrokeColorN(r);break;case i.OPS.setFillColorN:this.setFillColorN(r);break;case i.OPS.shadingFill:this.shadingFill(r[0]);break;case i.OPS.setDash:this.setDash(r[0],r[1]);break;case i.OPS.setRenderingIntent:this.setRenderingIntent(r[0]);break;case i.OPS.setFlatness:this.setFlatness(r[0]);break;case i.OPS.setGState:this.setGState(r[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip(`nonzero`);break;case i.OPS.eoClip:this.clip(`evenodd`);break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintImageXObject:this.paintImageXObject(r[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(r[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(r[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(r[0],r[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.constructPath:this.constructPath(r[0],r[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,i.warn)(`Unimplemented operator ${e}`);break}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,n,r,i,a){let o=this.current;o.textMatrix=o.lineMatrix=[e,t,n,r,i,a],o.textMatrixScale=Math.hypot(e,t),o.x=o.lineX=0,o.y=o.lineY=0,o.xcoords=[],o.ycoords=[],o.tspan=this.svgFactory.createElement(`svg:tspan`),o.tspan.setAttributeNS(null,`font-family`,o.fontFamily),o.tspan.setAttributeNS(null,`font-size`,`${m(o.fontSize)}px`),o.tspan.setAttributeNS(null,`y`,m(-o.y)),o.txtElement=this.svgFactory.createElement(`svg:text`),o.txtElement.append(o.tspan)}beginText(){let e=this.current;e.x=e.lineX=0,e.y=e.lineY=0,e.textMatrix=i.IDENTITY_MATRIX,e.lineMatrix=i.IDENTITY_MATRIX,e.textMatrixScale=1,e.tspan=this.svgFactory.createElement(`svg:tspan`),e.txtElement=this.svgFactory.createElement(`svg:text`),e.txtgrp=this.svgFactory.createElement(`svg:g`),e.xcoords=[],e.ycoords=[]}moveText(e,t){let n=this.current;n.x=n.lineX+=e,n.y=n.lineY+=t,n.xcoords=[],n.ycoords=[],n.tspan=this.svgFactory.createElement(`svg:tspan`),n.tspan.setAttributeNS(null,`font-family`,n.fontFamily),n.tspan.setAttributeNS(null,`font-size`,`${m(n.fontSize)}px`),n.tspan.setAttributeNS(null,`y`,m(-n.y))}
2showText(e){let t=this.current,n=t.font,r=t.fontSize;if(r===0)return;let o=t.fontSizeScale,s=t.charSpacing,c=t.wordSpacing,l=t.fontDirection,u=t.textHScale*l,d=n.vertical,f=d?1:-1,p=n.defaultVMetrics,g=r*t.fontMatrix[0],_=0;for(let i of e){if(i===null){_+=l*c;continue}else if(typeof i==`number`){_+=f*i*r/1e3;continue}let e=(i.isSpace?c:0)+s,a=i.fontChar,u,m,h=i.width;if(d){let e,t=i.vmetric||p;e=i.vmetric?t[1]:h*.5,e=-e*g;let n=t[2]*g;h=t?-t[0]:h,u=e/o,m=(_+n)/o}else u=_/o,m=0;(i.isInFont||n.missingFile)&&(t.xcoords.push(t.x+u),d&&t.ycoords.push(-t.y+m),t.tspan.textContent+=a);let v=d?h*g-e*l:h*g+e*l;_+=v}t.tspan.setAttributeNS(null,`x`,t.xcoords.map(m).join(` `)),d?t.tspan.setAttributeNS(null,`y`,t.ycoords.map(m).join(` `)):t.tspan.setAttributeNS(null,`y`,m(-t.y)),d?t.y-=_:t.x+=_*u,t.tspan.setAttributeNS(null,`font-family`,t.fontFamily),t.tspan.setAttributeNS(null,`font-size`,`${m(t.fontSize)}px`),t.fontStyle!==a.fontStyle&&t.tspan.setAttributeNS(null,`font-style`,t.fontStyle),t.fontWeight!==a.fontWeight&&t.tspan.setAttributeNS(null,`font-weight`,t.fontWeight);let v=t.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(v===i.TextRenderingMode.FILL||v===i.TextRenderingMode.FILL_STROKE?(t.fillColor!==a.fillColor&&t.tspan.setAttributeNS(null,`fill`,t.fillColor),t.fillAlpha<1&&t.tspan.setAttributeNS(null,`fill-opacity`,t.fillAlpha)):t.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,`fill`,`transparent`):t.tspan.setAttributeNS(null,`fill`,`none`),v===i.TextRenderingMode.STROKE||v===i.TextRenderingMode.FILL_STROKE){let e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let y=t.textMatrix;t.textRise!==0&&(y=y.slice(),y[5]+=t.textRise),t.txtElement.setAttributeNS(null,`transform`,`${h(y)} scale(${m(u)}, -1)`),t.txtElement.setAttributeNS(`http://www.w3.org/XML/1998/namespace`,`xml:space`,`preserve`),t.txtElement.append(t.tspan),t.txtgrp.append(t.txtElement),this._ensureTransformGroup().append(t.txtElement)}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}addFontStyle(e){if(!e.data)throw Error(`addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.`);this.cssStyle||(this.cssStyle=this.svgFactory.createElement(`svg:style`),this.cssStyle.setAttributeNS(null,`type`,`text/css`),this.defs.append(this.cssStyle));let t=u(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${e.loadedName}"; src: url(${t}); }\n`}setFont(e){let t=this.current,n=this.commonObjs.get(e[0]),r=e[1];t.font=n,this.embedFonts&&!n.missingFile&&!this.embeddedFonts[n.loadedName]&&(this.addFontStyle(n),this.embeddedFonts[n.loadedName]=n),t.fontMatrix=n.fontMatrix||i.FONT_IDENTITY_MATRIX;let a=`normal`;n.black?a=`900`:n.bold&&(a=`bold`);let o=n.italic?`italic`:`normal`;r<0?(r=-r,t.fontDirection=-1):t.fontDirection=1,t.fontSize=r,t.fontFamily=n.loadedName,t.fontWeight=a,t.fontStyle=o,t.tspan=this.svgFactory.createElement(`svg:tspan`),t.tspan.setAttributeNS(null,`y`,m(-t.y)),t.xcoords=[],t.ycoords=[]}endText(){let e=this.current;e.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()&&(e.element=e.txtElement,this.clip(`nonzero`),this.endPath())}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=c[e]}setLineJoin(e){this.current.lineJoin=l[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,n){this.current.strokeColor=i.Util.makeHexColor(e,t,n)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,n){this.current.fillColor=i.Util.makeHexColor(e,t,n),this.current.tspan=this.svgFactory.createElement(`svg:tspan`),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){let{width:t,height:n}=this.viewport,r=i.Util.inverseTransform(this.transformMatrix),[a,o,s,c]=i.Util.getAxialAlignedBoundingBox([0,0,t,n],r),l=this.svgFactory.createElement(`svg:rect`);l.setAttributeNS(null,`x`,a),l.setAttributeNS(null,`y`,o),l.setAttributeNS(null,`width`,s-a),l.setAttributeNS(null,`height`,c-o),l.setAttributeNS(null,`fill`,this._makeShadingPattern(e)),this.current.fillAlpha<1&&l.setAttributeNS(null,`fill-opacity`,this.current.fillAlpha),this._ensureTransformGroup().append(l)}_makeColorN_Pattern(e){return e[0]===`TilingPattern`?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){let t=e[1],n=e[2],r=e[3]||i.IDENTITY_MATRIX,[a,o,s,c]=e[4],l=e[5],u=e[6],d=e[7],f=`shading${v++}`,[p,m,h,g]=i.Util.normalizeRect([...i.Util.applyTransform([a,o],r),...i.Util.applyTransform([s,c],r)]),[_,y]=i.Util.singularValueDecompose2dScale(r),b=l*_,x=u*y,S=this.svgFactory.createElement(`svg:pattern`);S.setAttributeNS(null,`id`,f),S.setAttributeNS(null,`patternUnits`,`userSpaceOnUse`),S.setAttributeNS(null,`width`,b),S.setAttributeNS(null,`height`,x),S.setAttributeNS(null,`x`,`${p}`),S.setAttributeNS(null,`y`,`${m}`);let C=this.svg,w=this.transformMatrix,T=this.current.fillColor,E=this.current.strokeColor,D=this.svgFactory.create(h-p,g-m);if(this.svg=D,this.transformMatrix=r,d===2){let e=i.Util.makeHexColor(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(n)),this.svg=C,this.transformMatrix=w,this.current.fillColor=T,this.current.strokeColor=E,S.append(D.childNodes[0]),this.defs.append(S),`url(#${f})`}_makeShadingPattern(e){switch(typeof e==`string`&&(e=this.objs.get(e)),e[0]){case`RadialAxial`:let t=`shading${v++}`,n=e[3],r;switch(e[1]){case`axial`:let n=e[4],i=e[5];r=this.svgFactory.createElement(`svg:linearGradient`),r.setAttributeNS(null,`id`,t),r.setAttributeNS(null,`gradientUnits`,`userSpaceOnUse`),r.setAttributeNS(null,`x1`,n[0]),r.setAttributeNS(null,`y1`,n[1]),r.setAttributeNS(null,`x2`,i[0]),r.setAttributeNS(null,`y2`,i[1]);break;case`radial`:let a=e[4],o=e[5],s=e[6],c=e[7];r=this.svgFactory.createElement(`svg:radialGradient`),r.setAttributeNS(null,`id`,t),r.setAttributeNS(null,`gradientUnits`,`userSpaceOnUse`),r.setAttributeNS(null,`cx`,o[0]),r.setAttributeNS(null,`cy`,o[1]),r.setAttributeNS(null,`r`,c),r.setAttributeNS(null,`fx`,a[0]),r.setAttributeNS(null,`fy`,a[1]),r.setAttributeNS(null,`fr`,s);break;default:throw Error(`Unknown RadialAxial type: ${e[1]}`)}for(let e of n){let t=this.svgFactory.createElement(`svg:stop`);t.setAttributeNS(null,`offset`,e[0]),t.setAttributeNS(null,`stop-color`,e[1]),r.append(t)}return this.defs.append(r),`url(#${t})`;case`Mesh`:return(0,i.warn)(`Unimplemented pattern Mesh`),null;case`Dummy`:return`hotpink`;default:throw Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){let n=this.current,r=n.x,a=n.y,o=[],s=0;for(let n of e)switch(n|0){case i.OPS.rectangle:r=t[s++],a=t[s++];let e=t[s++],n=t[s++],c=r+e,l=a+n;o.push(`M`,m(r),m(a),`L`,m(c),m(a),`L`,m(c),m(l),`L`,m(r),m(l),`Z`);break;case i.OPS.moveTo:r=t[s++],a=t[s++],o.push(`M`,m(r),m(a));break;
2case i.OPS.lineTo:r=t[s++],a=t[s++],o.push(`L`,m(r),m(a));break;case i.OPS.curveTo:r=t[s+4],a=t[s+5],o.push(`C`,m(t[s]),m(t[s+1]),m(t[s+2]),m(t[s+3]),m(r),m(a)),s+=6;break;case i.OPS.curveTo2:o.push(`C`,m(r),m(a),m(t[s]),m(t[s+1]),m(t[s+2]),m(t[s+3])),r=t[s+2],a=t[s+3],s+=4;break;case i.OPS.curveTo3:r=t[s+2],a=t[s+3],o.push(`C`,m(t[s]),m(t[s+1]),m(r),m(a),m(r),m(a)),s+=4;break;case i.OPS.closePath:o.push(`Z`);break}o=o.join(` `),n.path&&e.length>0&&e[0]!==i.OPS.rectangle&&e[0]!==i.OPS.moveTo?o=n.path.getAttributeNS(null,`d`)+o:(n.path=this.svgFactory.createElement(`svg:path`),this._ensureTransformGroup().append(n.path)),n.path.setAttributeNS(null,`d`,o),n.path.setAttributeNS(null,`fill`,`none`),n.element=n.path,n.setCurrentPoint(r,a)}endPath(){let e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element){this.pendingClip=null;return}let t=`clippath${g++}`,n=this.svgFactory.createElement(`svg:clipPath`);n.setAttributeNS(null,`id`,t),n.setAttributeNS(null,`transform`,h(this.transformMatrix));let r=e.element.cloneNode(!0);if(this.pendingClip===`evenodd`?r.setAttributeNS(null,`clip-rule`,`evenodd`):r.setAttributeNS(null,`clip-rule`,`nonzero`),this.pendingClip=null,n.append(r),this.defs.append(n),e.activeClipUrl){e.clipGroup=null;for(let e of this.extraStack)e.clipGroup=null;n.setAttributeNS(null,`clip-path`,e.activeClipUrl)}e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){let e=this.current;if(e.path){let t=`${e.path.getAttributeNS(null,`d`)}Z`;e.path.setAttributeNS(null,`d`,t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let[t,n]of e)switch(t){case`LW`:this.setLineWidth(n);break;case`LC`:this.setLineCap(n);break;case`LJ`:this.setLineJoin(n);break;case`ML`:this.setMiterLimit(n);break;case`D`:this.setDash(n[0],n[1]);break;case`RI`:this.setRenderingIntent(n);break;case`FL`:this.setFlatness(n);break;case`Font`:this.setFont(n);break;case`CA`:this.setStrokeAlpha(n);break;case`ca`:this.setFillAlpha(n);break;default:(0,i.warn)(`Unimplemented graphic state operator ${t}`);break}}fill(){let e=this.current;e.element&&(e.element.setAttributeNS(null,`fill`,e.fillColor),e.element.setAttributeNS(null,`fill-opacity`,e.fillAlpha),this.endPath())}stroke(){let e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,`fill`,`none`),this.endPath())}_setStrokeAttributes(e,t=1){let n=this.current,r=n.dashArray;t!==1&&r.length>0&&(r=r.map(function(e){return t*e})),e.setAttributeNS(null,`stroke`,n.strokeColor),e.setAttributeNS(null,`stroke-opacity`,n.strokeAlpha),e.setAttributeNS(null,`stroke-miterlimit`,m(n.miterLimit)),e.setAttributeNS(null,`stroke-linecap`,n.lineCap),e.setAttributeNS(null,`stroke-linejoin`,n.lineJoin),e.setAttributeNS(null,`stroke-width`,m(t*n.lineWidth)+`px`),e.setAttributeNS(null,`stroke-dasharray`,r.map(m).join(` `)),e.setAttributeNS(null,`stroke-dashoffset`,m(t*n.dashPhase)+`px`)}eoFill(){this.current.element?.setAttributeNS(null,`fill-rule`,`evenodd`),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,`fill-rule`,`evenodd`),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){let e=this.svgFactory.createElement(`svg:rect`);e.setAttributeNS(null,`x`,`0`),e.setAttributeNS(null,`y`,`0`),e.setAttributeNS(null,`width`,`1px`),e.setAttributeNS(null,`height`,`1px`),e.setAttributeNS(null,`fill`,this.current.fillColor),this._ensureTransformGroup().append(e)}paintImageXObject(e){let t=this.getObject(e);if(!t){(0,i.warn)(`Dependent image with object ID ${e} is not ready yet`);return}this.paintInlineImageXObject(t)}paintInlineImageXObject(e,t){let n=e.width,r=e.height,i=d(e,this.forceDataSchema,!!t),a=this.svgFactory.createElement(`svg:rect`);a.setAttributeNS(null,`x`,`0`),a.setAttributeNS(null,`y`,`0`),a.setAttributeNS(null,`width`,m(n)),a.setAttributeNS(null,`height`,m(r)),this.current.element=a,this.clip(`nonzero`);let o=this.svgFactory.createElement(`svg:image`);o.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,i),o.setAttributeNS(null,`x`,`0`),o.setAttributeNS(null,`y`,m(-r)),o.setAttributeNS(null,`width`,m(n)+`px`),o.setAttributeNS(null,`height`,m(r)+`px`),o.setAttributeNS(null,`transform`,`scale(${m(1/n)} ${m(-1/r)})`),t?t.append(o):this._ensureTransformGroup().append(o)}paintImageMaskXObject(e){let t=this.getObject(e.data,e);if(t.bitmap){(0,i.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}let n=this.current,r=t.width,a=t.height,o=n.fillColor;n.maskId=`mask${_++}`;let s=this.svgFactory.createElement(`svg:mask`);s.setAttributeNS(null,`id`,n.maskId);let c=this.svgFactory.createElement(`svg:rect`);c.setAttributeNS(null,`x`,`0`),c.setAttributeNS(null,`y`,`0`),c.setAttributeNS(null,`width`,m(r)),c.setAttributeNS(null,`height`,m(a)),c.setAttributeNS(null,`fill`,o),c.setAttributeNS(null,`mask`,`url(#${n.maskId})`),this.defs.append(s),this._ensureTransformGroup().append(c),this.paintInlineImageXObject(t,s)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&e.length===6&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){let e=t[2]-t[0],n=t[3]-t[1],r=this.svgFactory.createElement(`svg:rect`);r.setAttributeNS(null,`x`,t[0]),r.setAttributeNS(null,`y`,t[1]),r.setAttributeNS(null,`width`,m(e)),r.setAttributeNS(null,`height`,m(n)),this.current.element=r,this.clip(`nonzero`),this.endPath()}}paintFormXObjectEnd(){}_initialize(e){let t=this.svgFactory.create(e.width,e.height),n=this.svgFactory.createElement(`svg:
2defs`);t.append(n),this.defs=n;let r=this.svgFactory.createElement(`svg:g`);return r.setAttributeNS(null,`transform`,h(e.transform)),t.append(r),this.svg=r,t}_ensureClipGroup(){if(!this.current.clipGroup){let e=this.svgFactory.createElement(`svg:g`);e.setAttributeNS(null,`clip-path`,this.current.activeClipUrl),this.svg.append(e),this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement(`svg:g`),this.tgrp.setAttributeNS(null,`transform`,h(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}t.SVGGraphics=y}),((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;class n{static textContent(e){let t=[],r={items:t,styles:Object.create(null)};function i(e){if(!e)return;let r=null,a=e.name;if(a===`#text`)r=e.value;else if(n.shouldBuildText(a))e?.attributes?.textContent?r=e.attributes.textContent:e.value&&(r=e.value);else return;if(r!==null&&t.push({str:r}),e.children)for(let t of e.children)i(t)}return i(e),r}static shouldBuildText(e){return!(e===`textarea`||e===`input`||e===`option`||e===`select`)}}t.XfaText=n}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=h,t.updateTextLayer=g;var r=n(1),i=n(6);let a=1e5,o=30,s=.8,c=new Map;function l(e,t){let n;if(t&&r.FeatureTest.isOffscreenCanvasSupported)n=new OffscreenCanvas(e,e).getContext(`2d`,{alpha:!1});else{let t=document.createElement(`canvas`);t.width=t.height=e,n=t.getContext(`2d`,{alpha:!1})}return n}function u(e,t){let n=c.get(e);if(n)return n;let r=l(30,t);r.font=`30px ${e}`;let i=r.measureText(``),a=i.fontBoundingBoxAscent,o=Math.abs(i.fontBoundingBoxDescent);if(a){let t=a/(a+o);return c.set(e,t),r.canvas.width=r.canvas.height=0,t}r.strokeStyle=`red`,r.clearRect(0,0,30,30),r.strokeText(`g`,0,0);let u=r.getImageData(0,0,30,30).data;o=0;for(let e=u.length-1-3;e>=0;e-=4)if(u[e]>0){o=Math.ceil(e/4/30);break}r.clearRect(0,0,30,30),r.strokeText(`A`,0,30),u=r.getImageData(0,0,30,30).data,a=0;for(let e=0,t=u.length;e<t;e+=4)if(u[e]>0){a=30-Math.floor(e/4/30);break}if(r.canvas.width=r.canvas.height=0,a){let t=a/(a+o);return c.set(e,t),t}return c.set(e,s),s}function d(e,t,n){let i=document.createElement(`span`),a={angle:0,canvasWidth:0,hasText:t.str!==``,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(i);let o=r.Util.transform(e._transform,t.transform),s=Math.atan2(o[1],o[0]),c=n[t.fontName];c.vertical&&(s+=Math.PI/2);let l=Math.hypot(o[2],o[3]),d=l*u(c.fontFamily,e._isOffscreenCanvasSupported),f,p;s===0?(f=o[4],p=o[5]-d):(f=o[4]+d*Math.sin(s),p=o[5]-d*Math.cos(s));let m=`calc(var(--scale-factor)*`,h=i.style;e._container===e._rootContainer?(h.left=`${(100*f/e._pageWidth).toFixed(2)}%`,h.top=`${(100*p/e._pageHeight).toFixed(2)}%`):(h.left=`${m}${f.toFixed(2)}px)`,h.top=`${m}${p.toFixed(2)}px)`),h.fontSize=`${m}${l.toFixed(2)}px)`,h.fontFamily=c.fontFamily,a.fontSize=l,i.setAttribute(`role`,`presentation`),i.textContent=t.str,i.dir=t.dir,e._fontInspectorEnabled&&(i.dataset.fontName=t.fontName),s!==0&&(a.angle=180/Math.PI*s);let g=!1;if(t.str.length>1)g=!0;else if(t.str!==` `&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(g=!0)}g&&(a.canvasWidth=c.vertical?t.height:t.width),e._textDivProperties.set(i,a),e._isReadableStream&&e._layoutText(i)}function f(e){let{div:t,scale:n,properties:r,ctx:i,prevFontSize:a,prevFontFamily:o}=e,{style:s}=t,c=``;if(r.canvasWidth!==0&&r.hasText){let{fontFamily:l}=s,{canvasWidth:u,fontSize:d}=r;(a!==d||o!==l)&&(i.font=`${d*n}px ${l}`,e.prevFontSize=d,e.prevFontFamily=l);let{width:f}=i.measureText(t.textContent);f>0&&(c=`scaleX(${u*n/f})`)}r.angle!==0&&(c=`rotate(${r.angle}deg) ${c}`),c.length>0&&(s.transform=c)}function p(e){if(e._canceled)return;let t=e._textDivs,n=e._capability;if(t.length>1e5){n.resolve();return}if(!e._isReadableStream)for(let n of t)e._layoutText(n);n.resolve()}class m{constructor({textContentSource:e,container:t,viewport:n,textDivs:a,textDivProperties:o,textContentItemsStr:s,isOffscreenCanvasSupported:c}){this._textContentSource=e,this._isReadableStream=e instanceof ReadableStream,this._container=this._rootContainer=t,this._textDivs=a||[],this._textContentItemsStr=s||[],this._isOffscreenCanvasSupported=c,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=o||new WeakMap,this._canceled=!1,this._capability=new r.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:n.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:l(0,c)};let{pageWidth:u,pageHeight:d,pageX:f,pageY:p}=n.rawDims;this._transform=[1,0,0,-1,-f,p+d],this._pageWidth=u,this._pageHeight=d,(0,i.setLayerDimensions)(t,n),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&=(this._reader.cancel(new r.AbortException(`TextLayer task cancelled.`)).catch(()=>{}),null),this._capability.reject(new r.AbortException(`TextLayer task cancelled.`))}_processItems(e,t){for(let n of e){if(n.str===void 0){if(n.type===`beginMarkedContentProps`||n.type===`beginMarkedContent`){let e=this._container;this._container=document.createElement(`span`),this._container.classList.add(`markedContent`),n.id!==null&&this._container.setAttribute(`id`,`${n.id}`),e.append(this._container)}else n.type===`endMarkedContent`&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(n.str),d(this,n,t)}}_layoutText(e){let t=this._layoutTextParams.properties=this._textDivProperties.get(e);if(this._layoutTextParams.div=e,f(this._layoutTextParams),t.hasText&&this._container.append(e),t.hasEOL){let e=document.createElement(`br`);e.setAttribute(`role`,`presentation`),this._container.append(e)}}_render(){let e=new r.PromiseCapability,t=Object.create(null);if(this._isReadableStream){let n=()=>{this._reader.read().then(({value:r,done:i})=>{if(i){e.resolve();return}Object.assign(t,r.styles),this._processItems(r.items,t),n()},e.reject)};this._reader=this._textContentSource.getReader(),n()}else if(this._textContentSource){let{items:t,styles:n}=this._textContentSource;this._processItems(t,n),e.resolve()}else throw Error(`No "textContentSource" parameter specified.`);e.promise.then(()=>{t=null,p(this)},this._capability.reject)}}t.TextLayerRenderTask=m;function h(e){!e.textContentSource&&(e.textContent||e.textContentStream)&&((0,i.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),e.textContentSource=e.textContent||e.textContentStream);let{container:t,viewport:n}=e,r=getComputedStyle(t),a=r.getPropertyValue(`visibility`),o=parseFloat(r.getPropertyValue(`--scale-factor`));a===`visible`&&(!o||Math.abs(o-n.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");let s=new m(e);return s._render(),s}function g({container:e,viewport:t,textDivs:n,textDivProperties:r,isOffscreenCanvasSupported:a,mustRotate:o=!0,mustRescale:s=!0}){if(o&&(0,i.setLayerDimensions)(e,{rotation:t.rotation}),s){let e=l(0,a),i={prevFontSize:null,prevFontFamily:null,div:null,scale:t.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:e};for(let e of n)i.properties=r.get(e),i.div=e,f(i)}}}),((e,t,n)=>
2{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var r=n(1),i=n(4),a=n(28),o=n(33),s=n(6),c=n(34);class l{#e;#t=!1;#n=null;#r=this.pointerup.bind(this);#i=this.pointerdown.bind(this);#a=new Map;#o=!1;#s=!1;#c=!1;#l;static _initialized=!1;constructor({uiManager:e,pageIndex:t,div:n,accessibilityManager:r,annotationLayer:i,viewport:s,l10n:u}){let d=[a.FreeTextEditor,o.InkEditor,c.StampEditor];if(!l._initialized){l._initialized=!0;for(let e of d)e.initialize(u)}e.registerEditorTypes(d),this.#l=e,this.pageIndex=t,this.div=n,this.#e=r,this.#n=i,this.viewport=s,this.#l.addLayer(this)}get isEmpty(){return this.#a.size===0}updateToolbar(e){this.#l.updateToolbar(e)}updateMode(e=this.#l.getMode()){this.#p(),e===r.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),e!==r.AnnotationEditorType.NONE&&(this.div.classList.toggle(`freeTextEditing`,e===r.AnnotationEditorType.FREETEXT),this.div.classList.toggle(`inkEditing`,e===r.AnnotationEditorType.INK),this.div.classList.toggle(`stampEditing`,e===r.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(e){if(!(!e&&this.#l.getMode()!==r.AnnotationEditorType.INK)){if(!e){for(let e of this.#a.values())if(e.isEmpty()){e.setInBackground();return}}this.#d({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(e){this.#l.setEditingState(e)}addCommands(e){this.#l.addCommands(e)}enable(){this.div.style.pointerEvents=`auto`;let e=new Set;for(let t of this.#a.values())t.enableEditing(),t.annotationElementId&&e.add(t.annotationElementId);if(!this.#n)return;let t=this.#n.getEditableAnnotations();for(let n of t){if(n.hide(),this.#l.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}}disable(){this.#c=!0,this.div.style.pointerEvents=`none`;let e=new Set;for(let t of this.#a.values()){if(t.disableEditing(),!t.annotationElementId||t.serialize()!==null){e.add(t.annotationElementId);continue}this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()}if(this.#n){let t=this.#n.getEditableAnnotations();for(let n of t){let{id:t}=n.data;e.has(t)||this.#l.isDeletedAnnotationElement(t)||n.show()}}this.#p(),this.isEmpty&&(this.div.hidden=!0),this.#c=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#l.getActive()!==e&&this.#l.setActiveEditor(e)}enableClick(){this.div.addEventListener(`pointerdown`,this.#i),this.div.addEventListener(`pointerup`,this.#r)}disableClick(){this.div.removeEventListener(`pointerdown`,this.#i),this.div.removeEventListener(`pointerup`,this.#r)}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#l.isDeletedAnnotationElement(t)&&this.#l.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#c&&e.annotationElementId&&this.#l.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#l.removeEditor(e),e.div.contains(document.activeElement)&&setTimeout(()=>{this.#l.focusMainContainer()},0),e.div.remove(),e.isAttachedToDOM=!1,this.#s||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.annotationElementId&&=(this.#l.addDeletedAnnotationElement(e.annotationElementId),i.AnnotationEditor.deleteAnnotationElement(e),null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.changeParent(e),this.#l.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#l.addToAnnotationStorage(e)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&(e._focusEventsAllowed=!1,setTimeout(()=>{e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#l.getId()}#u(e){switch(this.#l.getMode()){case r.AnnotationEditorType.FREETEXT:return new a.FreeTextEditor(e);case r.AnnotationEditorType.INK:return new o.InkEditor(e);case r.AnnotationEditorType.STAMP:return new c.StampEditor(e)}return null}pasteEditor(e,t){this.#l.updateToolbar(e),this.#l.updateMode(e);let{offsetX:n,offsetY:r}=this.#f(),i=this.getNextId(),a=this.#u({parent:this,id:i,x:n,y:r,uiManager:this.#l,isCentered:!0,...t});a&&this.add(a)}deserialize(e){switch(e.annotationType??e.annotationEditorType){case r.AnnotationEditorType.FREETEXT:return a.FreeTextEditor.deserialize(e,this,this.#l);case r.AnnotationEditorType.INK:return o.InkEditor.deserialize(e,this,this.#l);case r.AnnotationEditorType.STAMP:return c.StampEditor.deserialize(e,this,this.#l)}return null}#d(e,t){let n=this.getNextId(),r=this.#u({parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:this.#l,isCentered:t});return r&&this.add(r),r}#f(){let{x:e,y:t,width:n,height:r}=this.div.getBoundingClientRect(),i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(){this.#d(this.#f(),!0)}setSelected(e){this.#l.setSelected(e)}toggleSelected(e){this.#l.toggleSelected(e)}isSelected(e){return this.#l.isSelected(e)}unselect(e){this.#l.unselect(e)}pointerup(e){let{isMac:t}=r.FeatureTest.platform;if(!(e.button!==0||e.ctrlKey&&t)&&e.target===this.div&&this.#o){if(this.#o=!1,!this.#t){this.#t=!0;return}if(this.#l.getMode()===r.AnnotationEditorType.STAMP){this.#l.unselectAll();return}this.#d(e,!1)}}pointerdown(e){if(this.#o){this.#o=!1;return}let{isMac:t}=r.FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;this.#o=!0;let n=this.#l.getActive();this.#t=!n||n.isEmpty()}findNewParent(e,t,n){let r=this.#l.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}destroy(){this.#l.getActive()?.parent===this&&(this.#l.commitOrRemove(),this.#l.setActiveEditor(null));for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#l.removeLayer(this)}#p(){this.#s=!0;for(let e of this.#a.values())e.isEmpty()&&e.remove();this.#s=!1}render({viewport:e}){this.viewport=e,(0,s.setLayerDimensions)(this.div,e);for(let e of this.#l.getEditors(this.pageIndex))this.add(e);this.updateMode()}update({viewport:e}){this.#l.commitOrRemove(),this.viewport=e,(0,s.setLayerDimensions)(this.div,{rotation:e.rotation}),this.updateMode()}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}}t.AnnotationEditorLayer=l}),((e,t,n)=>
2{Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var r=n(1),i=n(5),a=n(4),o=n(29);class s extends a.AnnotationEditor{#e=this.editorDivBlur.bind(this);#t=this.editorDivFocus.bind(this);#n=this.editorDivInput.bind(this);#r=this.editorDivKeydown.bind(this);#i;#a=``;#o=`${this.id}-editor`;#s;#c=null;static _freeTextDefaultContent=``;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let e=s.prototype,t=e=>e.isEmpty(),n=i.AnnotationEditorUIManager.TRANSLATE_SMALL,a=i.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,r.shadow)(this,`_keyboardManager`,new i.KeyboardManager([[[`ctrl+s`,`mac+meta+s`,`ctrl+p`,`mac+meta+p`],e.commitOrRemove,{bubbles:!0}],[[`ctrl+Enter`,`mac+meta+Enter`,`Escape`,`mac+Escape`],e.commitOrRemove],[[`ArrowLeft`,`mac+ArrowLeft`],e._translateEmpty,{args:[-n,0],checker:t}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e._translateEmpty,{args:[-a,0],checker:t}],[[`ArrowRight`,`mac+ArrowRight`],e._translateEmpty,{args:[n,0],checker:t}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e._translateEmpty,{args:[a,0],checker:t}],[[`ArrowUp`,`mac+ArrowUp`],e._translateEmpty,{args:[0,-n],checker:t}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e._translateEmpty,{args:[0,-a],checker:t}],[[`ArrowDown`,`mac+ArrowDown`],e._translateEmpty,{args:[0,n],checker:t}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e._translateEmpty,{args:[0,a],checker:t}]]))}static _type=`freetext`;constructor(e){super({...e,name:`freeTextEditor`}),this.#i=e.color||s._defaultColor||a.AnnotationEditor._defaultLineColor,this.#s=e.fontSize||s._defaultFontSize}static initialize(e){a.AnnotationEditor.initialize(e,{strings:[`free_text2_default_content`,`editor_free_text2_aria_label`]});let t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue(`--freetext-padding`))}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:s._defaultFontSize=t;break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:s._defaultColor=t;break}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:this.#l(t);break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:this.#u(t);break}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,s._defaultFontSize],[r.AnnotationEditorParamsType.FREETEXT_COLOR,s._defaultColor||a.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,this.#s],[r.AnnotationEditorParamsType.FREETEXT_COLOR,this.#i]]}#l(e){let t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#s)*this.parentScale),this.#s=e,this.#f()},n=this.#s;this.addCommands({cmd:()=>{t(e)},undo:()=>{t(n)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#u(e){let t=this.#i;this.addCommands({cmd:()=>{this.#i=this.editorDiv.style.color=e},undo:()=>{this.#i=this.editorDiv.style.color=t},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){let e=this.parentScale;return[-s._internalPadding*e,-(s._internalPadding+this.#s)*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(r.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove(`enabled`),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute(`aria-activedescendant`),this.editorDiv.addEventListener(`keydown`,this.#r),this.editorDiv.addEventListener(`focus`,this.#t),this.editorDiv.addEventListener(`blur`,this.#e),this.editorDiv.addEventListener(`input`,this.#n))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add(`enabled`),this.editorDiv.contentEditable=!1,this.div.setAttribute(`aria-activedescendant`,this.#o),this._isDraggable=!0,this.editorDiv.removeEventListener(`ke
2ydown`,this.#r),this.editorDiv.removeEventListener(`focus`,this.#t),this.editorDiv.removeEventListener(`blur`,this.#e),this.editorDiv.removeEventListener(`input`,this.#n),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add(`freeTextEditing`))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){if(this.width){this.#h();return}this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===``}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add(`freeTextEditing`)),super.remove()}#d(){let e=this.editorDiv.getElementsByTagName(`div`);if(e.length===0)return this.editorDiv.innerText;let t=[];for(let n of e)t.push(n.innerText.replace(/\r\n?|\n/,``));return t.join(` 3`)}#f(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:e,div:t}=this,r=t.style.display;t.style.display=`hidden`,e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#a,t=this.#a=this.#d().trimEnd();if(e===t)return;let n=e=>{if(this.#a=e,!e){this.remove();return}this.#p(),this._uiManager.rebuild(this),this.#f()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#f()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key===`Enter`&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){s._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle(`freeTextEditing`,this.isEmpty())}disableEditing(){this.editorDiv.setAttribute(`role`,`comment`),this.editorDiv.removeAttribute(`aria-multiline`)}enableEditing(){this.editorDiv.setAttribute(`role`,`textbox`),this.editorDiv.setAttribute(`aria-multiline`,!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement(`div`),this.editorDiv.className=`internal`,this.editorDiv.setAttribute(`id`,this.#o),this.enableEditing(),a.AnnotationEditor._l10nPromise.get(`editor_free_text2_aria_label`).then(e=>this.editorDiv?.setAttribute(`aria-label`,e)),a.AnnotationEditor._l10nPromise.get(`free_text2_default_content`).then(e=>this.editorDiv?.setAttribute(`default-content`,e)),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#s}px * var(--scale-factor))`,n.color=this.#i,this.div.append(this.editorDiv),this.overlayDiv=document.createElement(`div`),this.overlayDiv.classList.add(`overlay`,`enabled`),this.div.append(this.overlayDiv),(0,i.bindEvents)(this,this.div,[`dblclick`,`keydown`]),this.width){let[n,r]=this.parentDimensions;if(this.annotationElementId){let{position:i}=this.#c,[a,o]=this.getInitialTranslation();[a,o]=this.pageTranslationToScreen(a,o);let[s,c]=this.pageDimensions,[l,u]=this.pageTranslation,d,f;switch(this.rotation){case 0:d=e+(i[0]-l)/s,f=t+this.height-(i[1]-u)/c;break;case 90:d=e+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[o,-a];break;case 180:d=e-this.width+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[-a,-o];break;case 270:d=e+(i[0]-l-this.height*c)/s,f=t+(i[1]-u-this.width*s)/c,[a,o]=[-o,a];break}this.setAt(d*n,f*r,a,o)}else this.setAt(e*n,t*r,this.width*n,this.height*r);this.#p(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}#p(){if(this.editorDiv.replaceChildren(),this.#a)for(let e of this.#a.split(` 4`)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}get contentDiv(){return this.editorDiv}static deserialize(e,t,n){let i=null;if(e instanceof o.FreeTextAnnotationElement){let{data:{defaultAppearanceData:{fontSize:t,fontColor:n},rect:a,rotation:o,id:s},textContent:c,textPosition:l,parent:{page:{pageNumber:u}}}=e;if(!c||c.length===0)return null;i=e={annotationType:r.AnnotationEditorType.FREETEXT,color:Array.from(n),fontSize:t,value:c.join(` 5`),position:l,pageIndex:u-1,rect:a,rotation:o,id:s,deleted:!1}}let a=super.deserialize(e,t,n);return a.#s=e.fontSize,a.#i=r.Util.makeHexColor(...e.color),a.#a=e.value,a.annotationElementId=e.id||null,a.#c=i,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0}
5;let t=s._internalPadding*this.parentScale,n=this.getRect(t,t),i=a.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#i),o={annotationType:r.AnnotationEditorType.FREETEXT,color:i,fontSize:this.#s,value:this.#a,pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?o:this.annotationElementId&&!this.#m(o)?null:(o.id=this.annotationElementId,o)}#m(e){let{value:t,fontSize:n,color:r,rect:i,pageIndex:a}=this.#c;return e.value!==t||e.fontSize!==n||e.rect.some((e,t)=>Math.abs(e-i[t])>=1)||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==a}#h(e=!1){if(!this.annotationElementId)return;if(this.#f(),!e&&(this.width===0||this.height===0)){setTimeout(()=>this.#h(!0),0);return}let t=s._internalPadding*this.parentScale;this.#c.rect=this.getRect(t,t)}}t.FreeTextEditor=s}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampAnnotationElement=t.InkAnnotationElement=t.FreeTextAnnotationElement=t.AnnotationLayer=void 0;var r=n(1),i=n(6),a=n(3),o=n(30),s=n(31),c=n(32);let l=1e3,u=9,d=new WeakSet;function f(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class p{static create(e){switch(e.data.annotationType){case r.AnnotationType.LINK:return new h(e);case r.AnnotationType.TEXT:return new g(e);case r.AnnotationType.WIDGET:switch(e.data.fieldType){case`Tx`:return new v(e);case`Btn`:return e.data.radioButton?new x(e):e.data.checkBox?new b(e):new S(e);case`Ch`:return new C(e);case`Sig`:return new y(e)}return new _(e);case r.AnnotationType.POPUP:return new w(e);case r.AnnotationType.FREETEXT:return new E(e);case r.AnnotationType.LINE:return new D(e);case r.AnnotationType.SQUARE:return new O(e);case r.AnnotationType.CIRCLE:return new k(e);case r.AnnotationType.POLYLINE:return new A(e);case r.AnnotationType.CARET:return new M(e);case r.AnnotationType.INK:return new N(e);case r.AnnotationType.POLYGON:return new j(e);case r.AnnotationType.HIGHLIGHT:return new P(e);case r.AnnotationType.UNDERLINE:return new F(e);case r.AnnotationType.SQUIGGLY:return new I(e);case r.AnnotationType.STRIKEOUT:return new L(e);case r.AnnotationType.STAMP:return new R(e);case r.AnnotationType.FILEATTACHMENT:return new z(e);default:return new m(e)}}}class m{#e=!1;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:n}){return!!(e?.str||t?.str||n?.str)}get hasPopupData(){return m._hasPopupData(this.data)}_createContainer(e){let{data:t,parent:{page:n,viewport:i}}=this,a=document.createElement(`section`);a.setAttribute(`data-annotation-id`,t.id),this instanceof _||(a.tabIndex=l),a.style.zIndex=this.parent.zIndex++,this.data.popupRef&&a.setAttribute(`aria-haspopup`,`dialog`),t.noRotate&&a.classList.add(`norotate`);let{pageWidth:o,pageHeight:s,pageX:c,pageY:u}=i.rawDims;if(!t.rect||this instanceof w){let{rotation:e}=t;return!t.hasOwnCanvas&&e!==0&&this.setRotation(e,a),a}let{width:d,height:p}=f(t.rect),m=r.Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]);if(!e&&t.borderStyle.width>0){a.style.borderWidth=`${t.borderStyle.width}px`;let e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;if(e>0||n>0){let t=`calc(${e}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;a.style.borderRadius=t}else if(this instanceof x){let e=`calc(${d}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;a.style.borderRadius=e}switch(t.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:a.style.borderStyle=`solid`;break;case r.AnnotationBorderStyleType.DASHED:a.style.borderStyle=`dashed`;break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)(`Unimplemented border style: beveled`);break;
vendor: 2,458 bytes, line 5
5case r.AnnotationBorderStyleType.INSET:(0,r.warn)(`Unimplemented border style: inset`);break;case r.AnnotationBorderStyleType.UNDERLINE:a.style.borderBottomStyle=`solid`;break;default:break}let i=t.borderColor||null;i?(this.#e=!0,a.style.borderColor=r.Util.makeHexColor(i[0]|0,i[1]|0,i[2]|0)):a.style.borderWidth=0}a.style.left=`${100*(m[0]-c)/o}%`,a.style.top=`${100*(m[1]-u)/s}%`;let{rotation:h}=t;return t.hasOwnCanvas||h===0?(a.style.width=`${100*d/o}%`,a.style.height=`${100*p/s}%`):this.setRotation(h,a),a}setRotation(e,t=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:i,height:a}=f(this.data.rect),o,s;e%180==0?(o=100*i/n,s=100*a/r):(o=100*a/n,s=100*i/r),t.style.width=`${o}%`,t.style.height=`${s}%`,t.setAttribute(`data-main-rotation`,(360-e)%360)}get _commonActions(){let e=(e,t,n)=>{let r=n.detail[e],i=r[0],a=r.slice(1);n.target.style[t]=o.ColorConverters[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:o.ColorConverters[`${i}_rgb`](a)})};return(0,r.shadow)(this,`_commonActions`,{display:e=>{let{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:t===1||t===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:t}=e.detail;this.container.style.visibility=t?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e(`bgColor`,`backgroundColor`,t)},fillColor:t=>{e(`fillColor`,`backgroundColor`,t)},fgColor:t=>{e(`fgColor`,`color`,t)},textColor:t=>{e(`textColor`,`color`,t)},borderColor:t=>{e(`borderColor`,`borderColor`,t)},strokeColor:t=>{e(`strokeColor`,`borderColor`,t)},rotation:e=>{let t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){let n=this._commonActions;for(let r of Object.keys(t.detail))(e[r]||n[r])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let n=this._commonActions;for(let[r,i]of Object.entries(t)){let a=n[r];a&&(a({detail:{[r]:i},target:e}),delete t[r])}}
5_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[t,n,r,i]=this.data.rect;if(e.length===1){let[,{x:a,y:o},{x:s,y:c}]=e[0];if(r===a&&i===o&&t===s&&n===c)return}let{style:a}=this.container,o;if(this.#e){let{borderColor:e,borderWidth:t}=a;a.borderWidth=0,o=[`url('data:image/svg+xml;utf8,`,`<svg xmlns="http://www.w3.org/2000/svg"`,` preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add(`hasBorder`)}let s=r-t,c=i-n,{svgFactory:l}=this,u=l.createElement(`svg`);u.classList.add(`quadrilateralsContainer`),u.setAttribute(`width`,0),u.setAttribute(`height`,0);let d=l.createElement(`defs`);u.append(d);let f=l.createElement(`clipPath`),p=`clippath_${this.data.id}`;f.setAttribute(`id`,p),f.setAttribute(`clipPathUnits`,`objectBoundingBox`),d.append(f);for(let[,{x:n,y:r},{x:a,y:u}]of e){let e=l.createElement(`rect`),d=(a-t)/s,p=(i-r)/c,m=(n-a)/s,h=(r-u)/c;e.setAttribute(`x`,d),e.setAttribute(`y`,p),e.setAttribute(`width`,m),e.setAttribute(`height`,h),f.append(e),o?.push(`<rect vector-effect="non-scaling-stroke" x="${d}" y="${p}" width="${m}" height="${h}"/>`)}this.#e&&(o.push(`</g></svg>')`),a.backgroundImage=o.join(``)),this.container.append(u),this.container.style.clipPath=`url(#${p})`}_createPopup(){let{container:e,data:t}=this;e.setAttribute(`aria-haspopup`,`dialog`);let n=new w({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]});this.parent.div.append(n.render())}render(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){let n=[];if(this._fieldObjects){let i=this._fieldObjects[e];if(i)for(let{page:e,id:a,exportValues:o}of i){if(e===-1||a===t)continue;let i=typeof o==`string`?o:null,s=document.querySelector(`[data-element-id="${a}"]`);if(s&&!d.has(s)){(0,r.warn)(`_getElementsByName - element not allowed: ${a}`);continue}n.push({id:a,exportValue:i,domElement:s})}return n}for(let r of document.getElementsByName(e)){let{exportValue:e}=r,i=r.getAttribute(`data-element-id`);i!==t&&d.has(r)&&n.push({id:i,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add(`highlightArea`);else e.classList.add(`highlightArea`)}_editOnDoubleClick(){let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener(`dblclick`,()=>{this.linkService.eventBus?.dispatch(`switchannotationeditormode`,{source:this,mode:e,editId:t})})}}class h extends m{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,n=document.createElement(`a`);n.setAttribute(`data-element-id`,e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.attachment?(this._bindAttachment(n,e.attachment),r=!0):e.setOCGState?(this.#t(n,e.setOCGState),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions[`Mouse Up`]||e.actions[`Mouse Down`])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,``),r=!0)),this.container.classList.add(`linkAnnotation`),r&&this.container.append(n),this.container}#e(){this.container.setAttribute(`data-internal-link`,``)}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t===``)&&this.#e()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#e()}_bindAttachment(e,t){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,t.content,t.filename),!1),this.#e()}#t(e,t){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#e()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl(``);let n=new Map([[`Action`,`onclick`],[`Mouse Up`,`onmouseup`],[`Mouse Down`,`onmousedown`]]);for(let r of Object.keys(t.actions)){let i=n.get(r);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t.id,name:r}}),!1))}e.onclick||=()=>!1,this.#e()}
5_bindResetFormAction(e,t){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl(``)),this.#e(),!this._fieldObjects){(0,r.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();let{fields:e,refs:i,include:a}=t,o=[];if(e.length!==0||i.length!==0){let t=new Set(i);for(let n of e){let e=this._fieldObjects[n]||[];for(let{id:n}of e)t.add(n)}for(let e of Object.values(this._fieldObjects))for(let n of e)t.has(n.id)===a&&o.push(n)}else for(let e of Object.values(this._fieldObjects))o.push(...e);let s=this.annotationStorage,c=[];for(let e of o){let{id:t}=e;switch(c.push(t),e.type){case`text`:{let n=e.defaultValue||``;s.setValue(t,{value:n});break}case`checkbox`:case`radiobutton`:{let n=e.defaultValue===e.exportValues;s.setValue(t,{value:n});break}case`combobox`:case`listbox`:{let n=e.defaultValue||``;s.setValue(t,{value:n});break}default:continue}let n=document.querySelector(`[data-element-id="${t}"]`);if(n){if(!d.has(n)){(0,r.warn)(`_bindResetFormAction - element not allowed: ${t}`);continue}n.dispatchEvent(new Event(`resetform`))}}return this.enableScripting&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:`app`,ids:c,name:`ResetForm`}}),!1}}}class g extends m{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add(`textAnnotation`);let e=document.createElement(`img`);return e.src=this.imageResourcesPath+`annotation-`+this.data.name.toLowerCase()+`.svg`,e.alt=`[{{type}} Annotation]`,e.dataset.l10nId=`text_annotation_type`,e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class _ extends m{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName===`CANVAS`&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){let{isWin:t,isMac:n}=r.FeatureTest.platform;return t&&e.ctrlKey||n&&e.metaKey}_setEventListener(e,t,n,r,i){n.includes(`mouse`)?e.addEventListener(n,e=>{this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(n,e=>{if(n===`blur`){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if(n===`focus`){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e)}})})}_setEventListeners(e,t,n,r){for(let[i,a]of n)(a===`Action`||this.data.actions?.[a])&&((a===`Focus`||a===`Blur`)&&(t||={focused:!1}),this._setEventListener(e,t,i,a,r),a===`Focus`&&!this.data.actions?.Blur?this._setEventListener(e,t,`blur`,`Blur`,null):a===`Blur`&&!this.data.actions?.Focus&&this._setEventListener(e,t,`focus`,`Focus`,null))}_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?`transparent`:r.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){let t=[`left`,`center`,`right`],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,a=e.style,o,s=2,c=e=>Math.round(10*e)/10;if(this.data.multiLine){let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(r.LINE_FACTOR*i))||1);o=Math.min(i,c(t/r.LINE_FACTOR))}else{let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);o=Math.min(i,c(e/r.LINE_FACTOR))}a.fontSize=`calc(${o}px * var(--scale-factor))`,a.color=r.Util.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(a.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute(`required`,!0):e.removeAttribute(`required`),e.setAttribute(`aria-required`,t)}}class v extends _{constructor(e){let t=e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,r){let i=this.annotationStorage;
vendor: 13,001 bytes, lines 5-6
5for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=n),i.setValue(a.id,{[r]:n})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add(`textWidgetAnnotation`);let n=null;if(this.renderForms){let r=e.getValue(t,{value:this.data.fieldValue}),i=r.value||``,a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let o=r.formattedValue||this.data.textContent?.join(` 6`)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,``));let s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement(`textarea`),n.textContent=o??i,this.data.doNotScroll&&(n.style.overflowY=`hidden`)):(n=document.createElement(`input`),n.type=`text`,n.setAttribute(`value`,o??i),this.data.doNotScroll&&(n.style.overflowX=`hidden`)),this.data.hasOwnCanvas&&(n.hidden=!0),d.add(n),n.setAttribute(`data-element-id`,t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=l,this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener(`input`,r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,`value`,r.target.value,`value`),s.formattedValue=null}),n.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue??``;n.value=s.userValue=t,s.formattedValue=null});let c=e=>{let{formattedValue:t}=s;t!=null&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener(`focus`,e=>{if(s.focused)return;let{target:t}=e;s.userValue&&(t.value=s.userValue),s.lastCommittedValue=t.value,s.commitKey=1,s.focused=!0}),n.addEventListener(`updatefromsandbox`,n=>{this.showElementAndHideCanvas(n.target),this._dispatchEventFromSandbox({value(n){s.userValue=n.detail.value??``,e.setValue(t,{value:s.userValue.toString()}),n.target.value=s.userValue},formattedValue(n){let{formattedValue:r}=n.detail;s.formattedValue=r,r!=null&&n.target!==document.activeElement&&(n.target.value=r),e.setValue(t,{formattedValue:r})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{let{charLimit:r}=n.detail,{target:i}=n;if(r===0){i.removeAttribute(`maxLength`);return}i.setAttribute(`maxLength`,r);let a=s.userValue;!a||a.length<=r||(a=a.slice(0,r),i.value=s.userValue=a,e.setValue(t,{value:a}),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:a,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}},n)}),n.addEventListener(`keydown`,e=>{s.commitKey=1;let n=-1;if(e.key===`Escape`?n=0:e.key===`Enter`&&!this.data.multiLine?n=2:e.key===`Tab`&&(s.commitKey=3),n===-1)return;let{value:r}=e.target;s.lastCommittedValue!==r&&(s.lastCommittedValue=r,s.userValue=r,this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))});let r=c;c=null,n.addEventListener(`blur`,e=>{if(!s.focused||!e.relatedTarget)return;s.focused=!1;let{value:n}=e.target;s.userValue=n,s.lastCommittedValue!==n&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:n,willCommit:!0,commitKey:s.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)}),this.data.actions?.Keystroke&&n.addEventListener(`beforeinput`,e=>{s.lastCommittedValue=null;let{data:n,target:r}=e,{value:i,selectionStart:a,selectionEnd:o}=r,c=a,l=o;switch(e.inputType){case`deleteWordBackward`:{let e=i.substring(0,a).match(/\w*[^\w]*$/);e&&(c-=e[0].length);break}case`deleteWordForward`:{let e=i.substring(a).match(/^[^\w]*\w*/);e&&(l+=e[0].length);break}case`deleteContentBackward`:a===o&&--c;break;case`deleteContentForward`:a===o&&(l+=1);break}e.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,change:n||``,willCommit:!1,selStart:c,selEnd:l}})}),this._setEventListeners(n,s,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.value)}if(c&&n.addEventListener(`blur`,c),this.data.comb){let e=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add(`comb`),n.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else n=document.createElement(`div`),n.textContent=this.data.fieldValue,n.style.verticalAlign=`middle`,n.style.display=`table-cell`;return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class y extends _{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class b extends _{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof r==`string`&&(r=r!==`Off`,e.setValue(n,{value:r})),this.container.classList.add(`buttonWidgetAnnotation`,`checkBox`);let i=document.createElement(`input`);return d.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`checkbox`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.setAttribute(`exportValue`,t.exportValue),i.tabIndex=l,i.addEventListener(`change`,r=>{let{name:i,checked:a}=r.target;for(let r of this._getElementsByName(i,n)){let n=a&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:a})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue||`Off`;e.target.checked=n===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value(t){t.target.checked=t.detail.value!==`Off`,e.setValue(n,{value:t.target.checked})}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class x extends _{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`buttonWidgetAnnotation`,`radioButton`);let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;typeof r==`string`&&(r=r!==t.buttonValue,e.setValue(n,{value:r}));let i=document.createElement(`input`);if(d.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`radio`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.tabIndex=l,i.addEventListener(`change`,t=>{let{name:r,checked:i}=t.target;for(let t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue;e.target.checked=n!=null&&n===t.buttonValue}),this.enableScripting&&this.hasJSActions){let r=t.buttonValue;i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value:t=>{let i=r===t.detail.value;for(let r of this._getElementsByName(t.target.name)){let t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class S extends h{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add(`buttonWidgetAnnotation`,`pushButton`),this.data.alternativeText&&(e.title=this.data.alternativeText);let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener(`updatefromsandbox`,e=>{this._dispatchEventFromSandbox({},e)})),e}}class C extends _{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`choiceWidgetAnnotation`);let e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement(`select`);d.add(r),r.setAttribute(`data-element-id`,t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=l;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue;for(let e of r.options)e.selected=e.value===t});for(let e of this.data.options){let t=document.createElement(`option`);t.textContent=e.displayValue,t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute(`selected`,!0),i=!1),r.append(t)}let a=null;if(i){let e=document.createElement(`option`);e.value=` `,e.setAttribute(`hidden`,!0),e.setAttribute(`selected`,!0),r.prepend(e),a=()=>{e.remove(),r.removeEventListener(`input`,a),a=null},r.addEventListener(`input`,a)}let o=e=>{let t=e?`value`:`textContent`,{options:n,multiple:i}=r;return i?Array.prototype.filter.call(n,e=>e.selected).map(e=>e[t]):n.selectedIndex===-1?null:n[n.selectedIndex][t]},s=o(!1),c=e=>{let t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.textContent,exportValue:e.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener(`updatefromsandbox`,n=>{this._dispatchEventFromSandbox({value(n){a?.();let i=n.detail.value,c=new Set(Array.isArray(i)?i:[i]);for(let e of r.options)e.selected=c.has(e.value);e.setValue(t,{value:o(!0)}),s=o(!1)},multipleSelection(e){r.multiple=!0},remove(n){let i=r.options,a=n.detail.remove;i[a].selected=!1,r.remove(a),i.length>0&&Array.prototype.findIndex.call(i,e=>e.selected)===-1&&(i[0].selected=!0),e.setValue(t,{value:o(!0),items:c(n)}),s=o(!1)},clear(n){for(;r.length!==0;)r.remove(0);e.setValue(t,{value:null,items:[]}),s=o(!1)},insert(n){let{index:i,displayValue:a,exportValue:l}=n.detail.insert,u=r.children[i],d=document.createElement(`option`);d.textContent=a,d.value=l,u?u.before(d):r.append(d),e.setValue(t,{value:o(!0),items:c(n)}),s=o(!1)},items(n){let{items:i}=n.detail;for(;r.length!==0;)r.remove(0);for(let e of i){let{displayValue:t,exportValue:n}=e,i=document.createElement(`option`);i.textContent=t,i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:o(!0),items:c(n)}),s=o(!1)},indices(n){let r=new Set(n.detail.indices);for(let e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:o(!0)}),s=o(!1)},editable(e){e.target.disabled=!e.detail.editable}},n)}),r.addEventListener(`input`,n=>{let r=o(!0);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:s,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`],[`input`,`Action`],[`input`,`Validate`]],e=>e.target.value)):r.addEventListener(`input`,function(n){e.setValue(t,{value:o(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class w extends m{constructor(e){let{data:t,elements:n}=e;super(e,{isRenderable:m._hasPopupData(t)}),this.elements=n}render(){this.container.classList.add(`popupAnnotation`);let e=new T({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(let n of this.elements)n.popup=e,t.push(n.data.id),n.addHighlightArea();return this.container.setAttribute(`aria-controls`,t.map(e=>`${r.AnnotationPrefix}${e}`).join(`,`)),this.container}}class T{#e=null;#t=this.#_.bind(this);#n=this.#b.bind(this);#r=this.#y.bind(this);#i=this.#v.bind(this);#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=!1;#f=null;#p=null;#m=null;#h=null;#g=!1;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:a,contentsObj:o,richText:s,parent:c,rect:l,parentRect:u,open:d}){this.#o=e,this.#h=r,this.#s=o,this.#m=s,this.#l=c,this.#a=t,this.#p=l,this.#u=u,this.#c=n;let f=i.PDFDateString.toDateObject(a);f&&(this.#e=c.l10n.get(`annotation_date_string`,{date:f.toLocaleDateString(),time:f.toLocaleTimeString()})),this.trigger=n.flatMap(e=>e.getElementsToTriggerPopup());for(let e of this.trigger)e.addEventListener(`click`,this.#i),e.addEventListener(`mouseenter`,this.#r),e.addEventListener(`mouseleave`,this.#n),e.classList.add(`popupTriggerArea`);
6for(let e of n)e.container?.addEventListener(`keydown`,this.#t);this.#o.hidden=!0,d&&this.#v()}render(){if(this.#f)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:i,pageY:a}}}=this.#l,o=this.#f=document.createElement(`div`);if(o.className=`popup`,this.#a){let e=o.style.outlineColor=r.Util.makeHexColor(...this.#a);if(CSS.supports(`background-color`,`color-mix(in srgb, red 30%, white)`))o.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`;else{let e=.7;o.style.backgroundColor=r.Util.makeHexColor(...this.#a.map(e=>Math.floor(.7*(255-e)+e)))}}let s=document.createElement(`span`);s.className=`header`;let l=document.createElement(`h1`);if(s.append(l),{dir:l.dir,str:l.textContent}=this.#h,o.append(s),this.#e){let e=document.createElement(`span`);e.classList.add(`popupDate`),this.#e.then(t=>{e.textContent=t}),s.append(e)}let u=this.#s,d=this.#m;if(d?.str&&(!u?.str||u.str===d.str))c.XfaLayer.render({xfaHtml:d.html,intent:`richText`,div:o}),o.lastChild.classList.add(`richText`,`popupContent`);else{let e=this._formatContents(u);o.append(e)}let f=!!this.#u,p=f?this.#u:this.#p;for(let e of this.#c)if(!p||r.Util.intersect(e.data.rect,p)!==null){p=e.data.rect,f=!0;break}let m=r.Util.normalizeRect([p[0],e[3]-p[1]+e[1],p[2],e[3]-p[3]+e[1]]),h=f?p[2]-p[0]+5:0,g=m[0]+h,_=m[1],{style:v}=this.#o;v.left=`${100*(g-i)/t}%`,v.top=`${100*(_-a)/n}%`,this.#o.append(o)}_formatContents({str:e,dir:t}){let n=document.createElement(`p`);n.classList.add(`popupContent`),n.dir=t;let r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}return n}#_(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key===`Enter`||e.key===`Escape`&&this.#d)&&this.#v()}#v(){this.#d=!this.#d,this.#d?(this.#y(),this.#o.addEventListener(`click`,this.#i),this.#o.addEventListener(`keydown`,this.#t)):(this.#b(),this.#o.removeEventListener(`click`,this.#i),this.#o.removeEventListener(`keydown`,this.#t))}#y(){this.#f||this.render(),this.isVisible?this.#d&&this.#o.classList.add(`focused`):(this.#o.hidden=!1,this.#o.style.zIndex=parseInt(this.#o.style.zIndex)+1e3)}#b(){this.#o.classList.remove(`focused`),!(this.#d||!this.isVisible)&&(this.#o.hidden=!0,this.#o.style.zIndex=parseInt(this.#o.style.zIndex)-1e3)}forceHide(){this.#g=this.isVisible,this.#g&&(this.#o.hidden=!0)}maybeShow(){this.#g&&(this.#g=!1,this.#o.hidden=!1)}get isVisible(){return this.#o.hidden===!1}}class E extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=r.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add(`freeTextAnnotation`),this.textContent){let e=document.createElement(`div`);e.classList.add(`annotationTextContent`),e.setAttribute(`role`,`comment`);for(let t of this.textContent){let n=document.createElement(`span`);n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}t.FreeTextAnnotationElement=E;class D extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`lineAnnotation`);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=this.#e=this.svgFactory.createElement(`svg:line`);return i.setAttribute(`x1`,e.rect[2]-e.lineCoordinates[0]),i.setAttribute(`y1`,e.rect[3]-e.lineCoordinates[1]),i.setAttribute(`x2`,e.rect[2]-e.lineCoordinates[2]),i.setAttribute(`y2`,e.rect[3]-e.lineCoordinates[3]),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),r.append(i),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class O extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`squareAnnotation`);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:rect`);return a.setAttribute(`x`,i/2),a.setAttribute(`y`,i/2),a.setAttribute(`width`,t-i),a.setAttribute(`height`,n-i),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class k extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`circleAnnotation`);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:ellipse`);return a.setAttribute(`cx`,t/2),a.setAttribute(`cy`,n/2),a.setAttribute(`rx`,t/2-i/2),a.setAttribute(`ry`,n/2-i/2),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class A extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`polylineAnnotation`,this.svgElementName=`svg:polyline`}render(){this.container.classList.add(this.containerClassName);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=[];for(let t of e.vertices){let n=t.x-e.rect[0],r=e.rect[3]-t.y;i.push(n+`,`+r)}i=i.join(` `);let a=this.#e=this.svgFactory.createElement(this.svgElementName);return a.setAttribute(`points`,i),a.setAttribute(`stroke-width`,e.borderStyle.width||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class j extends A{constructor(e){super(e),this.containerClassName=`polygonAnnotation`,this.svgElementName=`svg:polygon`}}class M extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`caretAnnotation`),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
6class N extends m{#e=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`inkAnnotation`,this.svgElementName=`svg:polyline`,this.annotationEditorType=r.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0);for(let t of e.inkLists){let n=[];for(let r of t){let t=r.x-e.rect[0],i=e.rect[3]-r.y;n.push(`${t},${i}`)}n=n.join(` `);let i=this.svgFactory.createElement(this.svgElementName);this.#e.push(i),i.setAttribute(`points`,n),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),!e.popupRef&&this.hasPopupData&&this._createPopup(),r.append(i)}return this.container.append(r),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}t.InkAnnotationElement=N;class P extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`highlightAnnotation`),this.container}}class F extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`underlineAnnotation`),this.container}}class I extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`squigglyAnnotation`),this.container}}class L extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`strikeoutAnnotation`),this.container}}class R extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`stampAnnotation`),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}t.StampAnnotationElement=R;class z extends m{#e=null;constructor(e){super(e,{isRenderable:!0});let{filename:t,content:n}=this.data.file;this.filename=(0,i.getFilenameFromUrl)(t,!0),this.content=n,this.linkService.eventBus?.dispatch(`fileattachmentannotation`,{source:this,filename:t,content:n})}render(){this.container.classList.add(`fileAttachmentAnnotation`);let{container:e,data:t}=this,n;t.hasAppearance||t.fillAlpha===0?n=document.createElement(`div`):(n=document.createElement(`img`),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?`paperclip`:`pushpin`}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener(`dblclick`,this.#t.bind(this)),this.#e=n;let{isMac:i}=r.FeatureTest.platform;return e.addEventListener(`keydown`,e=>{e.key===`Enter`&&(i?e.metaKey:e.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?this._createPopup():n.classList.add(`popupTriggerArea`),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}#t(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class B{#e=null;#t=null;#n=new Map;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,l10n:r,page:i,viewport:a}){this.div=e,this.#e=t,this.#t=n,this.l10n=r,this.page=i,this.viewport=a,this.zIndex=0,this.l10n||=s.NullL10n}#r(e,t){let n=e.firstChild||e;n.id=`${r.AnnotationPrefix}${t}`,this.div.append(e),this.#e?.moveElementInDOM(this.div,e,n,!1)}async render(e){let{annotations:t}=e,n=this.div;(0,i.setLayerDimensions)(n,this.viewport);let o=new Map,s={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||``,renderForms:e.renderForms!==!1,svgFactory:new i.DOMSVGFactory,annotationStorage:e.annotationStorage||new a.AnnotationStorage,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let e of t){if(e.noHTML)continue;let t=e.annotationType===r.AnnotationType.POPUP;if(t){let t=o.get(e.id);if(!t)continue;s.elements=t}else{let{width:t,height:n}=f(e.rect);if(t<=0||n<=0)continue}s.data=e;let n=p.create(s);if(!n.isRenderable)continue;if(!t&&e.popupRef){let t=o.get(e.popupRef);t?t.push(n):o.set(e.popupRef,[n])}n.annotationEditorType>0&&this.#n.set(n.data.id,n);let i=n.render();e.hidden&&(i.style.visibility=`hidden`),this.#r(i,e.id)}this.#i(),await this.l10n.translate(n)}update({viewport:e}){let t=this.div;this.viewport=e,(0,i.setLayerDimensions)(t,{rotation:e.rotation}),this.#i(),t.hidden=!1}#i(){if(!this.#t)return;let e=this.div;for(let[t,n]of this.#t){let r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;let{firstChild:i}=r;i?i.nodeName===`CANVAS`?i.replaceWith(n):i.before(n):r.append(n)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#n.values())}getEditableAnnotation(e){return this.#n.get(e)}}t.AnnotationLayer=B}),((e,t)=>
6{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0;function n(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,`0`)}function r(e){return Math.max(0,Math.min(255,255*e))}class i{static CMYK_G([e,t,n,r]){return[`G`,1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return[`CMYK`,0,0,0,1-e]}static G_RGB([e]){return[`RGB`,e,e,e]}static G_rgb([e]){return e=r(e),[e,e,e]}static G_HTML([e]){let t=n(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return[`G`,.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(r)}static RGB_HTML(e){return`#${e.map(n).join(``)}`}static T_HTML(){return`#00000000`}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return[`RGB`,1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,i]){return[r(1-Math.min(1,e+i)),r(1-Math.min(1,n+i)),r(1-Math.min(1,t+i))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){let r=1-e,i=1-t,a=1-n;return[`CMYK`,r,i,a,Math.min(r,i,a)]}}t.ColorConverters=i}),((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.getL10nFallback=r;let n={of_pages:`of {{pagesCount}}`,page_of_pages:`({{pageNumber}} of {{pagesCount}})`,document_properties_kb:`{{size_kb}} KB ({{size_b}} bytes)`,document_properties_mb:`{{size_mb}} MB ({{size_b}} bytes)`,document_properties_date_string:`{{date}}, {{time}}`,document_properties_page_size_unit_inches:`in`,document_properties_page_size_unit_millimeters:`mm`,document_properties_page_size_orientation_portrait:`portrait`,document_properties_page_size_orientation_landscape:`landscape`,document_properties_page_size_name_a3:`A3`,document_properties_page_size_name_a4:`A4`,document_properties_page_size_name_letter:`Letter`,document_properties_page_size_name_legal:`Legal`,document_properties_page_size_dimension_string:`{{width}} à {{height}} {{unit}} ({{orientation}})`,document_properties_page_size_dimension_name_string:`{{width}} à {{height}} {{unit}} ({{name}}, {{orientation}})`,document_properties_linearized_yes:`Yes`,document_properties_linearized_no:`No`,additional_layers:`Additional Layers`,page_landmark:`Page {{page}}`,thumb_page_title:`Page {{page}}`,thumb_page_canvas:`Thumbnail of Page {{page}}`,find_reached_top:`Reached top of document, continued from bottom`,find_reached_bottom:`Reached end of document, continued from top`,"find_match_count[one]":`{{current}} of {{total}} match`,"find_match_count[other]":`{{current}} of {{total}} matches`,"find_match_count_limit[one]":`More than {{limit}} match`,"find_match_count_limit[other]":`More than {{limit}} matches`,find_not_found:`Phrase not found`,page_scale_width:`Page Width`,page_scale_fit:`Page Fit`,page_scale_auto:`Automatic Zoom`,page_scale_actual:`Actual Size`,page_scale_percent:`{{scale}}%`,loading_error:`An error occurred while loading the PDF.`,invalid_file_error:`Invalid or corrupted PDF file.`,missing_file_error:`Missing PDF file.`,unexpected_response_error:`Unexpected server response.`,rendering_error:`An error occurred while rendering the page.`,annotation_date_string:`{{date}}, {{time}}`,printing_not_supported:`Warning: Printing is not fully supported by this browser.`,printing_not_ready:`Warning: The PDF is not fully loaded for printing.`,web_fonts_disabled:`Web fonts are disabled: unable to use embedded PDF fonts.`,free_text2_default_content:`Start typingâ¦`,editor_free_text2_aria_label:`Text Editor`,editor_ink2_aria_label:`Draw Editor`,editor_ink_canvas_aria_label:`User-created image`,editor_alt_text_button_label:`Alt text`,editor_alt_text_edit_button_label:`Edit alt text`,editor_alt_text_decorative_tooltip:`Marked as decorative`};n.print_progress_percent=`{{progress}}%`;function r(e,t){switch(e){case`find_match_count`:e=`find_match_count[${t.total===1?`one`:`other`}]`;break;case`find_match_count_limit`:e=`find_match_count_limit[${t.limit===1?`one`:`other`}]`;break}return n[e]||``}function i(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,(e,n)=>n in t?t[n]:`{{`+n+`}}`):e}t.NullL10n={async getLanguage(){return`en-us`},async getDirection(){return`ltr`},async get(e,t=null,n=r(e,t)){return i(n,t)},async translate(e){}}}),((e,t,n)=>
6{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var r=n(25);class i{static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:e.attributes.hasOwnProperty(`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null)switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static render(e){let t=e.annotationStorage,n=e.linkService,i=e.xfaHtml,a=e.intent||`display`,o=document.createElement(i.name);i.attributes&&this.setAttributes({html:o,element:i,intent:a,linkService:n});let s=[[i,-1,o]],c=e.div;if(c.append(o),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;c.style.transform=t}a!==`richText`&&c.setAttribute(`class`,`xfaLayer xfaFont`);let l=[];for(;s.length>0;){let[e,i,o]=s.at(-1);if(i+1===e.children.length){s.pop();continue}let c=e.children[++s.at(-1)[1]];if(c===null)continue;let{name:u}=c;if(u===`#text`){let e=document.createTextNode(c.value);l.push(e),o.append(e);continue}let d=c?.attributes?.xmlns?document.createElementNS(c.attributes.xmlns,u):document.createElement(u);if(o.append(d),c.attributes&&this.setAttributes({html:d,element:c,storage:t,intent:a,linkService:n}),c.children&&c.children.length>0)s.push([c,-1,d]);else if(c.value){let e=document.createTextNode(c.value);r.XfaText.shouldBuildText(u)&&l.push(e),d.append(e)}}for(let e of c.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:l}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}}t.XfaLayer=i}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0;var r=n(1),i=n(4),a=n(29),o=n(6),s=n(5);class c extends i.AnnotationEditor{#e=0;#t=0;#n=this.canvasPointermove.bind(this);#r=this.canvasPointerleave.bind(this);#i=this.canvasPointerup.bind(this);#a=this.canvasPointerdown.bind(this);#o=new Path2D;#s=!1;#c=!1;#l=!1;#u=null;#d=0;#f=0;#p=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type=`ink`;constructor(e){super({...e,name:`inkEditor`}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e){i.AnnotationEditor.initialize(e,{strings:[`editor_ink_canvas_aria_label`,`editor_ink2_aria_label`]})}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:c._defaultThickness=t;break;case r.AnnotationEditorParamsType.INK_COLOR:c._defaultColor=t;break;case r.AnnotationEditorParamsType.INK_OPACITY:c._defaultOpacity=t/100;break}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:this.#m(t);break;case r.AnnotationEditorParamsType.INK_COLOR:this.#h(t);break;case r.AnnotationEditorParamsType.INK_OPACITY:this.#g(t);break}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,c._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,c._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(c._defaultOpacity*100)]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||c._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,this.color||c._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??c._defaultOpacity))]]}#m(e){let t=this.thickness;this.addCommands({cmd:()=>{this.thickness=e,this.#z()},undo:()=>{this.thickness=t,this.#z()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#h(e){let t=this.color;this.addCommands({cmd:()=>{this.color=e,this.#E()},undo:()=>
6{this.color=t,this.#E()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#g(e){e/=100;let t=this.opacity;this.addCommands({cmd:()=>{this.opacity=e,this.#E()},undo:()=>{this.opacity=t,this.#E()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#O(),this.#k()),this.isAttachedToDOM||(this.parent.add(this),this.#A()),this.#z()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#u.disconnect(),this.#u=null,super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){let[e,t]=this.parentDimensions,n=this.width*e,r=this.height*t;this.setDimensions(n,r)}enableEditMode(){this.#s||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener(`pointerdown`,this.#a))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove(`editing`),this.canvas.removeEventListener(`pointerdown`,this.#a))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#_(){let{parentRotation:e,parentDimensions:[t,n]}=this;switch(e){case 90:return[0,n,n,t];case 180:return[t,n,t,n];case 270:return[t,0,n,t];default:return[0,0,t,n]}}#v(){let{ctx:e,color:t,opacity:n,thickness:r,parentScale:i,scaleFactor:a}=this;e.lineWidth=r*i/a,e.lineCap=`round`,e.lineJoin=`round`,e.miterLimit=10,e.strokeStyle=`${t}${(0,s.opacityToHex)(n)}`}#y(e,t){this.canvas.addEventListener(`contextmenu`,o.noContextMenu),this.canvas.addEventListener(`pointerleave`,this.#r),this.canvas.addEventListener(`pointermove`,this.#n),this.canvas.addEventListener(`pointerup`,this.#i),this.canvas.removeEventListener(`pointerdown`,this.#a),this.isEditing=!0,this.#l||(this.#l=!0,this.#A(),this.thickness||=c._defaultThickness,this.color||=c._defaultColor||i.AnnotationEditor._defaultLineColor,this.opacity??=c._defaultOpacity),this.currentPath.push([e,t]),this.#c=!1,this.#v(),this.#p=()=>{this.#C(),this.#p&&window.requestAnimationFrame(this.#p)},window.requestAnimationFrame(this.#p)}#b(e,t){let[n,r]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===n&&t===r)return;let i=this.currentPath,a=this.#o;if(i.push([e,t]),this.#c=!0,i.length<=2){a.moveTo(...i[0]),a.lineTo(e,t);return}i.length===3&&(this.#o=a=new Path2D,a.moveTo(...i[0])),this.#w(a,...i.at(-3),...i.at(-2),e,t)}#x(){if(this.currentPath.length===0)return;let e=this.currentPath.at(-1);this.#o.lineTo(...e)}#S(e,t){this.#p=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height),this.#b(e,t),this.#x();let n;if(this.currentPath.length!==1)n=this.#T();else{let r=[e,t];n=[[r,r.slice(),r.slice(),r]]}let r=this.#o,i=this.currentPath;this.currentPath=[],this.#o=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(i),this.paths.push(n),this.bezierPath2D.push(r),this.rebuild()},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#O(),this.#k()),this.#z())},mustExec:!0})}#C(){if(!this.#c)return;this.#c=!1;let e=Math.ceil(this.thickness*this.parentScale),t=this.currentPath.slice(-3),n=t.map(e=>e[0]),r=t.map(e=>e[1]),i=Math.min(...n)-e,a=Math.max(...n)+e,o=Math.min(...r)-e,s=Math.max(...r)+e,{ctx:c}=this;c.save(),c.clearRect(0,0,this.canvas.width,this.canvas.height);for(let e of this.bezierPath2D)c.stroke(e);c.stroke(this.#o),c.restore()}#w(e,t,n,r,i,a,o){let s=(t+r)/2,c=(n+i)/2,l=(r+a)/2,u=(i+o)/2;e.bezierCurveTo(s+2*(r-s)/3,c+2*(i-c)/3,l+2*(r-l)/3,u+2*(i-u)/3,l,u)}#T(){let e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let t=[],n,[r,i]=e[0];for(n=1;n<e.length-2;n++){let[a,o]=e[n],[s,c]=e[n+1],l=(a+s)/2,u=(o+c)/2,d=[r+2*(a-r)/3,i+2*(o-i)/3],f=[l+2*(a-l)/3,u+2*(o-u)/3];t.push([[r,i],d,f,[l,u]]),[r,i]=[l,u]}let[a,o]=e[n],[s,c]=e[n+1],l=[r+2*(a-r)/3,i+2*(o-i)/3],u=[s+2*(a-s)/3,c+2*(o-c)/3];return t.push([[r,i],l,u,[s,c]]),t}#E(){if(this.isEmpty()){this.#M();return}this.#v();let{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#M();for(let e of this.bezierPath2D)t.stroke(e)}commit(){this.#s||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#s=!0,this.div.classList.add(`disabled`),this.#z(!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||this.#s||(this.setInForeground(),e.preventDefault(),e.type!==`mouse`&&this.div.focus(),this.#y(e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),this.#b(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),this.#D(e)}canvasPointerleave(e){this.#D(e)}#D(e){this.canvas.removeEventListener(`pointerleave`,this.#r),this.canvas.removeEventListener(`pointermove`,this.#n),this.canvas.removeEventListener(`pointerup`,this.#i),this.canvas.addEventListener(`pointerdown`,this.#a),setTimeout(()=>{this.canvas.removeEventListener(`contextmenu`,o.noContextMenu)},10),this.#S(e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackgroun
6d()}#O(){this.canvas=document.createElement(`canvas`),this.canvas.width=this.canvas.height=0,this.canvas.className=`inkEditorCanvas`,i.AnnotationEditor._l10nPromise.get(`editor_ink_canvas_aria_label`).then(e=>this.canvas?.setAttribute(`aria-label`,e)),this.div.append(this.canvas),this.ctx=this.canvas.getContext(`2d`)}#k(){this.#u=new ResizeObserver(e=>{let t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)}),this.#u.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#s}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),i.AnnotationEditor._l10nPromise.get(`editor_ink2_aria_label`).then(e=>this.div?.setAttribute(`aria-label`,e));let[n,r,a,o]=this.#_();if(this.setAt(n,r,0,0),this.setDims(a,o),this.#O(),this.width){let[n,r]=this.parentDimensions;this.setAspectRatio(this.width*n,this.height*r),this.setAt(e*n,t*r,this.width*n,this.height*r),this.#l=!0,this.#A(),this.setDims(this.width*n,this.height*r),this.#E(),this.div.classList.add(`disabled`)}else this.div.classList.add(`editing`),this.enableEditMode();return this.#k(),this.div}#A(){if(!this.#l)return;let[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#M()}setDimensions(e,t){let n=Math.round(e),r=Math.round(t);if(this.#d===n&&this.#f===r)return;this.#d=n,this.#f=r,this.canvas.style.visibility=`hidden`;let[i,a]=this.parentDimensions;this.width=e/i,this.height=t/a,this.fixAndSetPosition(),this.#s&&this.#j(e,t),this.#A(),this.#E(),this.canvas.style.visibility=`visible`,this.fixDims()}#j(e,t){let n=this.#R(),r=(e-n)/this.#t,i=(t-n)/this.#e;this.scaleFactor=Math.min(r,i)}#M(){let e=this.#R()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#N(e){let t=new Path2D;for(let n=0,r=e.length;n<r;n++){let[r,i,a,o]=e[n];n===0&&t.moveTo(...r),t.bezierCurveTo(i[0],i[1],a[0],a[1],o[0],o[1])}return t}static#P(e,t,n){let[r,i,a,o]=t;switch(n){case 0:for(let t=0,n=e.length;t<n;t+=2)e[t]+=r,e[t+1]=o-e[t+1];break;case 90:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=e[t+1]+r,e[t+1]=n+i}break;case 180:for(let t=0,n=e.length;t<n;t+=2)e[t]=a-e[t],e[t+1]+=i;break;case 270:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=a-e[t+1],e[t+1]=o-n}break;default:throw Error(`Invalid rotation`)}return e}static#F(e,t,n){let[r,i,a,o]=t;switch(n){case 0:for(let t=0,n=e.length;t<n;t+=2)e[t]-=r,e[t+1]=o-e[t+1];break;case 90:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=e[t+1]-i,e[t+1]=n-r}break;case 180:for(let t=0,n=e.length;t<n;t+=2)e[t]=a-e[t],e[t+1]-=i;break;case 270:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=o-e[t+1],e[t+1]=a-n}break;default:throw Error(`Invalid rotation`)}return e}#I(e,t,n,r){let i=[],a=this.thickness/2,o=e*t+a,s=e*n+a;for(let t of this.paths){let n=[],a=[];for(let r=0,i=t.length;r<i;r++){let[c,l,u,d]=t[r],f=e*c[0]+o,p=e*c[1]+s,m=e*l[0]+o,h=e*l[1]+s,g=e*u[0]+o,_=e*u[1]+s,v=e*d[0]+o,y=e*d[1]+s;r===0&&(n.push(f,p),a.push(f,p)),n.push(m,h,g,_,v,y),a.push(m,h),r===i-1&&a.push(v,y)}i.push({bezier:c.#P(n,r,this.rotation),points:c.#P(a,r,this.rotation)})}return i}#L(){let e=1/0,t=-1/0,n=1/0,i=-1/0;for(let a of this.paths)for(let[o,s,c,l]of a){let a=r.Util.bezierBoundingBox(...o,...s,...c,...l);e=Math.min(e,a[0]),n=Math.min(n,a[1]),t=Math.max(t,a[2]),i=Math.max(i,a[3])}return[e,n,t,i]}#R(){return this.#s?Math.ceil(this.thickness*this.parentScale):0}#z(e=!1){if(this.isEmpty())return;if(!this.#s){this.#E();return}let t=this.#L(),n=this.#R();this.#t=Math.max(i.AnnotationEditor.MIN_SIZE,t[2]-t[0]),this.#e=Math.max(i.AnnotationEditor.MIN_SIZE,t[3]-t[1]);let r=Math.ceil(n+this.#t*this.scaleFactor),a=Math.ceil(n+this.#e*this.scaleFactor),[o,s]=this.parentDimensions;this.width=r/o,this.height=a/s,this.setAspectRatio(r,a);let c=this.translationX,l=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#A(),this.#E(),this.#d=r,this.#f=a,this.setDims(r,a);let u=e?n/this.scaleFactor/2:0;this.translate(c-this.translationX-u,l-this.translationY-u)}static deserialize(e,t,n){if(e instanceof a.InkAnnotationElement)return null;let o=super.deserialize(e,t,n);o.thickness=e.thickness,o.color=r.Util.makeHexColor(...e.color),o.op
6acity=e.opacity;let[s,l]=o.pageDimensions,u=o.width*s,d=o.height*l,f=o.parentScale,p=e.thickness/2;o.#s=!0,o.#d=Math.round(u),o.#f=Math.round(d);let{paths:m,rect:h,rotation:g}=e;for(let{bezier:e}of m){e=c.#F(e,h,g);let t=[];o.paths.push(t);let n=f*(e[0]-p),r=f*(e[1]-p);for(let i=2,a=e.length;i<a;i+=6){let a=f*(e[i]-p),o=f*(e[i+1]-p),s=f*(e[i+2]-p),c=f*(e[i+3]-p),l=f*(e[i+4]-p),u=f*(e[i+5]-p);t.push([[n,r],[a,o],[s,c],[l,u]]),n=l,r=u}let i=this.#N(t);o.bezierPath2D.push(i)}let _=o.#L();return o.#t=Math.max(i.AnnotationEditor.MIN_SIZE,_[2]-_[0]),o.#e=Math.max(i.AnnotationEditor.MIN_SIZE,_[3]-_[1]),o.#j(u,d),o}serialize(){if(this.isEmpty())return null;let e=this.getRect(0,0),t=i.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:r.AnnotationEditorType.INK,color:t,thickness:this.thickness,opacity:this.opacity,paths:this.#I(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}t.InkEditor=c}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampEditor=void 0;var r=n(1),i=n(4),a=n(6),o=n(29);class s extends i.AnnotationEditor{#e=null;#t=null;#n=null;#r=null;#i=null;#a=null;#o=null;#s=null;#c=!1;#l=!1;static _type=`stamp`;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile}static initialize(e){i.AnnotationEditor.initialize(e)}static get supportedTypes(){return(0,r.shadow)(this,`supportedTypes`,[`apng`,`avif`,`bmp`,`gif`,`jpeg`,`png`,`svg+xml`,`webp`,`x-icon`].map(e=>`image/${e}`))}static get supportedTypesStr(){return(0,r.shadow)(this,`supportedTypesStr`,this.supportedTypes.join(`,`))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(r.AnnotationEditorType.STAMP,{bitmapFile:e.getAsFile()})}#u(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#c=e.isSvg),this.#p()}#d(){this.#n=null,this._uiManager.enableWaiting(!1),this.#a&&this.div.focus()}#f(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#u(e,!0)).finally(()=>this.#d());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#u(e)).finally(()=>this.#d());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#u(e)).finally(()=>this.#d());return}let e=document.createElement(`input`);e.type=`file`,e.accept=s.supportedTypesStr,this.#n=new Promise(t=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this.#u(t)}t()}),e.addEventListener(`cancel`,()=>{this.remove(),t()})}).finally(()=>this.#d()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#a?.remove(),this.#a=null,this.#o?.disconnect(),this.#o=null),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#f();return}super.rebuild(),this.div!==null&&(this.#t&&this.#f(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.#e?this.#p():this.#f(),this.width){let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r)}return this.div}#p(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}let[o,s]=this.parentDimensions;this.setDims(t*o/r,n*s/i),this._uiManager.enableWaiting(!1);let c=this.#a=document.createElement(`canvas`);e.append(c),e.hidden=!1,this.#g(t,n),this.#v(),this.#l||=(this.parent.addUndoableEditor(this),!0),this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,subtype:this.editorType,data:{action:`inserted_image`}}}),this.addAltTextButton()}#m(e,t){let[n,r]=this.parentDimensions;this.width=e/n,this.height=t/r,this.setDims(e,t),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#s!==null&&clearTimeout(this.#s);let i=200;this.#s=setTimeout(()=>{this.#s=null,this.#g(e,t)},200)}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=i>=16384?Math.floor(i/2)-1:Math.ceil(i/2)),a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(e,t){e=Math.ceil(e),t=Math.ceil(t);let n=this.#a;if(!n||n.width===e&&n.height===t)return;n.width=e,n.height=t;let r=this.#c?this.#e:this.#h(e,t),i=n.getContext(`2d`);i.filter=this._uiManager.hcmFilter,i.drawImage(r,0,0,r.width,r.height,0,0,e,t)}#_(e){if(e){if(this.#c){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#c){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*a.PixelsPerInch.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*a.PixelsPerInch.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}#v(){this.#o=new ResizeObserver(e=>{let t=e[0].contentRect;t.width&&t.height&&this.#m(t.width,t.height)}),this.#o.observe(this.div)}static deserialize(e,t,n){if(e instanceof o.StampAnnotationElement)return null;let r=super.deserialize(e,t,n),{rect:i,bitmapUrl:a,bitmapId:s,isSvg:c,accessibilityData:l}=e;s&&n.imageManager.isValidId(s)?r.#t=s:r.#r=a,r.#c=c;let[u,d]=r.pageDimensions;return r.width=(i[2]-i[0])/u,r.height=(i[3]-i[1])/d,l&&(r.altTextData=l),r}serialize(e=!1,t=null){if(this.isEmpty())return null;let n={annotationType:r.AnnotationEditorType.STAMP,bitmapId:this.#t,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#c,structTreeParentId:this._structTreeParentId};if(e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.altTextData,n;let{decorative:i,altText:a}=this.altTextData;if(!i&&a&&(n.accessibilityData={type:`Figure`,alt:a}),t===null)return n;t.stamps||=new Map;let o=this.#c?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:o,serialized:n}),n.bitmap=this.#_(!1);else if(this.#c){let e=t.stamps.get(this.#t);o>e.area&&(e.area=o,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}}t.StampEditor=s})],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(t!==void 0)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__w_pdfjs_require__),n.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;
6Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AbortException",{enumerable:!0,get:function(){return t.AbortException}}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return a.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return o.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return s.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"DOMSVGFactory",{enumerable:!0,get:function(){return r.DOMSVGFactory}}),Object.defineProperty(e,"FeatureTest",{enumerable:!0,get:function(){return t.FeatureTest}}),Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return c.GlobalWorkerOptions}}),Object.defineProperty(e,"ImageKind",{enumerable:!0,get:function(){return t.ImageKind}}),Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}}),Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}}),Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}}),Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return n.PDFDataRangeTransport}}),Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return r.PDFDateString}}),Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return n.PDFWorker}}),Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}}),Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}}),Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return r.PixelsPerInch}}),Object.defineProperty(e,"PromiseCapability",{enumerable:!0,get:function(){return t.PromiseCapability}}),Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return r.RenderingCancelledException}}),Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return n.SVGGraphics}}),Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}}),Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}}),Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}}),Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return l.XfaLayer}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return n.build}}),Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}}),Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return n.getDocument}}),Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return r.getFilenameFromUrl}}),Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return r.getPdfFilenameFromUrl}}),Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return r.getXfaPageViewport}}),Object.defineProperty(e,"isDataScheme",{enumerable:!0,get:function(){return r.isDataScheme}}),Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return r.isPdfFile}}),Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return r.loadScript}}),Object.defineProperty(e,"noContextMenu",{enumerable:!0,get:function(){return r.noContextMenu}}),Object.defineProperty(e,"normalizeUnicode",{enumerable:!0,get:function(){return t.normalizeUnicode}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return i.renderTextLayer}}),Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return r.setLayerDimensions}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return i.updateTextLayer}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return n.version}});var t=__w_pdfjs_require__(1),n=__w_pdfjs_require__(2),r=__w_pdfjs_require__(6),i=__w_pdfjs_require__(26),a=__w_pdfjs_require__(27),o=__w_pdfjs_require__(5),s=__w_pdfjs_require__(29),c=__w_pdfjs_require__(14),l=__w_pdfjs_require__(32);let u=`3.11.174`,d=`ce8716743`})(),__webpack_exports__})())})),require_core_min=__commonJSMin((e=>{var t=require_react(),n=require_pdf();function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i,a=r(t),o=r(n);e.AnnotationType=void 0,(i=e.AnnotationType||={})[i.Text=1]=`Text`,i[i.Link=2]=`Link`,i[i.FreeText=3]=`FreeText`,i[i.Line=4]=`Line`,i[i.Square=5]=`Square`,i[i.Circle=6]=`Circle`,i[i.Polygon=7]=`Polygon`,i[i.Polyline=8]=`Polyline`,i[i.Highlight=9]=`Highlight`,i[i.Underline=10]=`Underline`,
6i[i.Squiggly=11]=`Squiggly`,i[i.StrikeOut=12]=`StrikeOut`,i[i.Stamp=13]=`Stamp`,i[i.Caret=14]=`Caret`,i[i.Ink=15]=`Ink`,i[i.Popup=16]=`Popup`,i[i.FileAttachment=17]=`FileAttachment`;var s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},s(e,t)};function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}s(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var l,u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},u.apply(this,arguments)};e.TextDirection=void 0,(l=e.TextDirection||={}).RightToLeft=`RTL`,l.LeftToRight=`LTR`;var d,f=a.createContext({currentTheme:`light`,direction:e.TextDirection.LeftToRight,setCurrentTheme:function(){}}),p=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(` `)},m=typeof window<`u`?a.useLayoutEffect:a.useEffect,h=function(e){var t=a.useRef(null),n=e.once,r=e.threshold,i=e.onVisibilityChanged;return m((function(){var e=t.current;if(e){var a=new IntersectionObserver((function(t){t.forEach((function(t){var r=t.isIntersecting,o=t.intersectionRatio;i({isVisible:r,ratio:o}),r&&n&&(a.unobserve(e),a.disconnect())}))}),{threshold:r||0});return a.observe(e),function(){a.unobserve(e),a.disconnect()}}}),[]),t},g=function(t){var n=t.children,r=t.ignoreDirection,i=r!==void 0&&r,o=t.size,s=o===void 0?24:o,c=a.useContext(f).direction,l=!i&&c===e.TextDirection.RightToLeft,u=`${s||24}px`;return a.createElement(`svg`,{"aria-hidden":`true`,className:p({"rpv-core__icon":!0,"rpv-core__icon--rtl":l}),focusable:`false`,height:u,viewBox:`0 0 24 24`,width:u},n)},_=function(){return a.createElement(g,{size:16},a.createElement(`path`,{d:`M23.5,0.499l-16.5,23l-6.5-6.5`}))},v=function(t){var n=t.children,r=t.testId,i=t.onClick,o=a.useContext(f).direction===e.TextDirection.RightToLeft,s=r?{"data-testid":r}:{};return a.createElement(`button`,u({className:p({"rpv-core__primary-button":!0,"rpv-core__primary-button--rtl":o}),type:`button`,onClick:i},s),n)},y=function(e){var t=e.size,n=t===void 0?`4rem`:t,r=e.testId,i=a.useState(!1),o=i[0],s=i[1],c=r?{"data-testid":r}:{},l=h({onVisibilityChanged:function(e){s(e.isVisible)}});return a.createElement(`div`,u({},c,{className:p({"rpv-core__spinner":!0,"rpv-core__spinner--animating":o}),ref:l,style:{height:n,width:n}}))},b=function(t){var n=t.ariaLabel,r=n===void 0?``:n,i=t.autoFocus,o=i!==void 0&&i,s=t.placeholder,c=s===void 0?``:s,l=t.testId,d=t.type,h=d===void 0?`text`:d,g=t.value,_=g===void 0?``:g,v=t.onChange,y=t.onKeyDown,b=y===void 0?function(){}:y,x=a.useContext(f).direction,S=a.useRef(),C={ref:S,"data-testid":``,"aria-label":r,className:p({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":x===e.TextDirection.RightToLeft}),placeholder:c,value:_,onChange:function(e){return v(e.target.value)},onKeyDown:b};return l&&(C[`data-testid`]=l),m((function(){if(o){var e=S.current;if(e){var t=window.scrollX,n=window.scrollY;e.focus(),window.scrollTo(t,n)}}}),[]),h===`text`?a.createElement(`input`,u({type:`text`},C)):a.createElement(`input`,u({type:`password`},C))};(function(e){e[e.ExitFullScreen=0]=`ExitFullScreen`,e[e.FullScreenChange=1]=`FullScreenChange`,e[e.FullScreenElement=2]=`FullScreenElement`,e[e.FullScreenEnabled=3]=`FullScreenEnabled`,e[e.RequestFullScreen=4]=`RequestFullScreen`})(d||={});var x,S={ExitFullScreen:`exitFullscreen`,FullScreenChange:`fullscreenchange`,FullScreenElement:`fullscreenElement`,FullScreenEnabled:`fullscreenEnabled`,RequestFullScreen:`requestFullscreen`},C={ExitFullScreen:`webkitExitFullscreen`,FullScreenChange:`webkitfullscreenchange`,FullScreenElement:`webkitFullscreenElement`,FullScreenEnabled:`webkitFullscreenEnabled`,RequestFullScreen:`webkitRequestFullscreen`},w={ExitFullScreen:`msExitFullscreen`,FullScreenChange:`msFullscreenChange`,FullScreenElement:`msFullscreenElement`,FullScreenEnabled:`msFullscreenEnabled`,RequestFullScreen:`msRequestFullscreen`},T=typeof window<`u`,E=T&&(d.FullScreenEnabled in document&&S||C.FullScreenEnabled in document&&C||w.FullScreenEnabled in document&&w)||S,D=function(){return T&&E.FullScreenEnabled in document&&!0===document[E.FullScreenEnabled]},O=function(e){return T?e[E.ExitFullScreen]():Promise.resolve({})},k=function(){return T?document[E.FullScreenElement]:null},A=function(e,t){var n=a.useRef(),r=function(){n.current&&clearTimeout(n.current)};return a.useEffect((function(){return function(){return r()}}),[]),a.useCallback((function(){var i=[...arguments];r(),n.current=setTimeout((function(){e.apply(void 0,i)}),t)}),[e,t])},j=function(){var e=a.useRef(!1);return a.useEffect((function(){return e.current=!0,function(){e.current=!1}}),[]),e},M=function(e){var t=a.useRef(e);return a.useEffect((function(){t.current=e}),[e]),t.current};(function(e){e.NotRenderedYet=`NotRenderedYet`,e.Rendering=`Rendering`,e.Rendered=`Rendered`})(x||={});var N,P=-9999,F=function(e){var t=e.doc,n=t.numPages,r=t.loadingTask.docId,i=a.useMemo((function(){return Array(n).fill(null).map((function(e,t){return{pageIndex:t,render
6Status:x.NotRenderedYet,visibility:P}}))}),[r]),o=a.useRef({currentRenderingPage:-1,startRange:0,endRange:n-1,visibilities:i}),s=function(e,t){o.current.visibilities[e].visibility=t};return{getHighestPriorityPage:function(){var e=o.current.visibilities.slice(o.current.startRange,o.current.endRange+1).filter((function(e){return e.visibility>P}));if(!e.length)return-1;for(var t=e[0].pageIndex,r=e[e.length-1].pageIndex,i=e.length,a=0;a<i;a++){if(e[a].renderStatus===x.Rendering)return-1;if(e[a].renderStatus===x.NotRenderedYet)return e[a].pageIndex}return r+1<n&&o.current.visibilities[r+1].renderStatus!==x.Rendered?r+1:t-1>=0&&o.current.visibilities[t-1].renderStatus!==x.Rendered?t-1:-1},isInRange:function(e){return e>=o.current.startRange&&e<=o.current.endRange},markNotRendered:function(){for(var e=0;e<n;e++)o.current.visibilities[e].renderStatus=x.NotRenderedYet},markRendered:function(e){o.current.visibilities[e].renderStatus=x.Rendered},markRendering:function(e){o.current.currentRenderingPage!==-1&&o.current.currentRenderingPage!==e&&o.current.visibilities[o.current.currentRenderingPage].renderStatus===x.Rendering&&(o.current.visibilities[o.current.currentRenderingPage].renderStatus=x.NotRenderedYet),o.current.visibilities[e].renderStatus=x.Rendering,o.current.currentRenderingPage=e},setOutOfRange:function(e){s(e,P)},setRange:function(e,t){o.current.startRange=e,o.current.endRange=t;for(var r=0;r<n;r++)(r<e||r>t)&&(o.current.visibilities[r].visibility=P,o.current.visibilities[r].renderStatus=x.NotRenderedYet)},setVisibility:s}},I={core:{askingPassword:{requirePasswordToOpen:`This document requires a password to open`,submit:`Submit`},wrongPassword:{tryAgain:`The password is wrong. Please try again`},pageLabel:`Page {{pageIndex}}`}},L=a.createContext({l10n:I,setL10n:function(){}}),R=0,z=function(){return R++},B=function(e,t,n){var r=function(e){var r=t.current;if(r){var i=e.target;if(i instanceof Element&&i.shadowRoot){var a=e.composedPath();a.length>0&&!r.contains(a[0])&&n()}else r.contains(i)||n()}};a.useEffect((function(){if(e){var t={capture:!0};return document.addEventListener(`click`,r,t),function(){document.removeEventListener(`click`,r,t)}}}),[])},V=function(e){var t=function(t){t.key===`Escape`&&e()};a.useEffect((function(){return document.addEventListener(`keyup`,t),function(){document.removeEventListener(`keyup`,t)}}),[])},H=function(t){var n=t.ariaControlsSuffix,r=t.children,i=t.closeOnClickOutside,o=t.closeOnEscape,s=t.onToggle,c=a.useRef(),l=a.useContext(f).direction===e.TextDirection.RightToLeft;return a.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow=`hidden`,function(){document.body.style.overflow=e}}),[]),V((function(){c.current&&o&&s()})),B(i,c,s),m((function(){var e=c.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow=`auto`,e.style.maxHeight=`${t}px`)}}),[]),a.createElement(`div`,{"aria-modal":`true`,className:p({"rpv-core__modal-body":!0,"rpv-core__modal-body--rtl":l}),id:`rpv-core__modal-body-${n}`,ref:c,role:`dialog`,tabIndex:-1},r)},ee=function(e){var t=e.children;return a.createElement(`div`,{className:`rpv-core__modal-overlay`},t)};e.ToggleStatus=void 0,(N=e.ToggleStatus||={}).Close=`Close`,N.Open=`Open`,N.Toggle=`Toggle`;var U,te=function(t){var n=a.useState(t),r=n[0],i=n[1];return{opened:r,toggle:function(t){switch(t){case e.ToggleStatus.Close:i(!1);break;case e.ToggleStatus.Open:i(!0);break;case e.ToggleStatus.Toggle:default:i((function(e){return!e}))}}}},ne=function(e){var t=e.content,n=e.isOpened,r=n!==void 0&&n,i=e.target,o=te(r),s=o.opened,c=o.toggle;return a.createElement(a.Fragment,null,i&&i(c,s),s&&t(c))};e.Position=void 0,(U=e.Position||={}).TopLeft=`TOP_LEFT`,U.TopCenter=`TOP_CENTER`,U.TopRight=`TOP_RIGHT`,U.RightTop=`RIGHT_TOP`,U.RightCenter=`RIGHT_CENTER`,U.RightBottom=`RIGHT_BOTTOM`,U.BottomLeft=`BOTTOM_LEFT`,U.BottomCenter=`BOTTOM_CENTER`,U.BottomRight=`BOTTOM_RIGHT`,U.LeftTop=`LEFT_TOP`,U.LeftCenter=`LEFT_CENTER`,U.LeftBottom=`LEFT_BOTTOM`;var re,ie,ae,oe,se,ce,le,ue,de=function(t,n,r,i,a){m((function(){var o=n.current,s=t.current,c=r.current;if(s&&o&&c){var l=c.getBoundingClientRect(),u=function(t,n,r,i){var a=n.getBoundingClientRect(),o=t.getBoundingClientRect(),s=o.height,c=o.width,l=0,u=0;switch(r){case e.Position.TopLeft:l=a.top-s,u=a.left;break;case e.Position.TopCenter:l=a.top-s,u=a.left+a.width/2-c/2;break;case e.Position.TopRight:l=a.top-s,u=a.left+a.width-c;break;case e.Position.RightTop:l=a.top,u=a.left+a.width;break;case e.Position.RightCenter:l=a.top+a.height/2-s/2,u=a.left+a.width;break;case e.Position.RightBottom:l=a.top+a.height-s,u=a.left+a.width;break;case e.Position.BottomLeft:l=a.top+a.height,u=a.left;break;case e.Position.BottomCenter:l=a.top+a.height,u=a.left+a.width/2-c/2;break;case e.Position.BottomRight:l=a.top+a.height,u=a.left+a.width-c;break;case e.Position.LeftTop:l=a.top,u=a.left-c;break;case e.Position.LeftCenter:l=a.top+a.height/2-s/2,u=a.left-c;break;case e.Position.LeftBottom:l=a.top+a.height-s,u=a.left-c}return{left:u+(i.left||0),top:l+(i.top||0)}}(s,o,i,a),d=u.top,f=u.left;s.style.top=`${d-l.top}
6px`,s.style.left=`${f-l.left}px`}}),[])},W=function(t){var n,r=t.customClassName,i=t.position;return a.createElement(`div`,{className:p((n={"rpv-core__arrow":!0,"rpv-core__arrow--tl":i===e.Position.TopLeft,"rpv-core__arrow--tc":i===e.Position.TopCenter,"rpv-core__arrow--tr":i===e.Position.TopRight,"rpv-core__arrow--rt":i===e.Position.RightTop,"rpv-core__arrow--rc":i===e.Position.RightCenter,"rpv-core__arrow--rb":i===e.Position.RightBottom,"rpv-core__arrow--bl":i===e.Position.BottomLeft,"rpv-core__arrow--bc":i===e.Position.BottomCenter,"rpv-core__arrow--br":i===e.Position.BottomRight,"rpv-core__arrow--lt":i===e.Position.LeftTop,"rpv-core__arrow--lc":i===e.Position.LeftCenter,"rpv-core__arrow--lb":i===e.Position.LeftBottom},n[`${r}`]=r!==``,n))})},fe=function(t){var n=t.ariaControlsSuffix,r=t.children,i=t.closeOnClickOutside,o=t.offset,s=t.position,c=t.targetRef,l=t.onClose,u=a.useRef(),d=a.useRef(),h=a.useRef(),g=a.useContext(f).direction===e.TextDirection.RightToLeft;B(i,u,l),de(u,c,h,s,o),m((function(){var e=d.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow=`auto`,e.style.maxHeight=`${t}px`)}}),[]);var _=`rpv-core__popover-body-inner-${n}`;return a.createElement(a.Fragment,null,a.createElement(`div`,{ref:h,style:{left:0,position:`absolute`,top:0}}),a.createElement(`div`,{"aria-describedby":_,className:p({"rpv-core__popover-body":!0,"rpv-core__popover-body--rtl":g}),id:`rpv-core__popover-body-${n}`,ref:u,role:`dialog`,tabIndex:-1},a.createElement(W,{customClassName:`rpv-core__popover-body-arrow`,position:s}),a.createElement(`div`,{id:_,ref:d},r)))},pe=function(e){var t=e.closeOnEscape,n=e.onClose,r=a.useRef();return V((function(){r.current&&t&&n()})),a.createElement(`div`,{className:`rpv-core__popover-overlay`,ref:r})},me=function(t){var n=t.ariaControlsSuffix,r=t.children,i=t.contentRef,o=t.offset,s=t.position,c=t.targetRef,l=a.useRef(),u=a.useContext(f).direction===e.TextDirection.RightToLeft;return de(i,c,l,s,o),a.createElement(a.Fragment,null,a.createElement(`div`,{ref:l,style:{left:0,position:`absolute`,top:0}}),a.createElement(`div`,{className:p({"rpv-core__tooltip-body":!0,"rpv-core__tooltip-body--rtl":u}),id:`rpv-core__tooltip-body-${n}`,ref:i,role:`tooltip`},a.createElement(W,{customClassName:`rpv-core__tooltip-body-arrow`,position:s}),a.createElement(`div`,{className:`rpv-core__tooltip-body-content`},r)))};e.FullScreenMode=void 0,(re=e.FullScreenMode||={}).Normal=`Normal`,re.Entering=`Entering`,re.Entered=`Entered`,re.EnteredCompletely=`EnteredCompletely`,re.Exitting=`Exitting`,re.Exited=`Exited`,e.LayerRenderStatus=void 0,(ie=e.LayerRenderStatus||={})[ie.PreRender=0]=`PreRender`,ie[ie.DidRender=1]=`DidRender`,e.PageMode=void 0,(ae=e.PageMode||={}).Attachments=`UseAttachments`,ae.Bookmarks=`UseOutlines`,ae.ContentGroup=`UseOC`,ae.Default=`UserNone`,ae.FullScreen=`FullScreen`,ae.Thumbnails=`UseThumbs`,e.PasswordStatus=void 0,(oe=e.PasswordStatus||={}).RequiredPassword=`RequiredPassword`,oe.WrongPassword=`WrongPassword`,e.RotateDirection=void 0,(se=e.RotateDirection||={}).Backward=`Backward`,se.Forward=`Forward`,e.ScrollMode=void 0,(ce=e.ScrollMode||={}).Page=`Page`,ce.Horizontal=`Horizontal`,ce.Vertical=`Vertical`,ce.Wrapped=`Wrapped`,e.SpecialZoomLevel=void 0,(le=e.SpecialZoomLevel||={}).ActualSize=`ActualSize`,le.PageFit=`PageFit`,le.PageWidth=`PageWidth`,e.ViewMode=void 0,(ue=e.ViewMode||={}).DualPage=`DualPage`,ue.DualPageWithCover=`DualPageWithCover`,ue.SinglePage=`SinglePage`;var G,he=function(e,t){return e.reduce((function(e,n,r){return r%t?e[e.length-1].push(n):e.push([n]),e}),[])},ge=function(t,n){switch(n[1].name){case`XYZ`:return{bottomOffset:function(e,t){return n[3]===null?t:n[3]},leftOffset:function(e,t){return n[2]===null?0:n[2]},pageIndex:t,scaleTo:n[4]};case`Fit`:case`FitB`:return{bottomOffset:0,leftOffset:0,pageIndex:t,scaleTo:e.SpecialZoomLevel.PageFit};case`FitH`:case`FitBH`:return{bottomOffset:n[2],leftOffset:0,pageIndex:t,scaleTo:e.SpecialZoomLevel.PageWidth};default:return{bottomOffset:0,leftOffset:0,pageIndex:t,scaleTo:1}}},_e=new Map,ve=new Map,ye=function(e,t){return`${e.loadingTask.docId}___${t.num}R${t.gen===0?``:t.gen}`},be=function(e,t,n){_e.set(ye(e,t),n)},xe=function(e,t){if(!e)return Promise.reject(`The document is not loaded yet`);var n=`${e.loadingTask.docId}___${t}`,r=ve.get(n);return r?Promise.resolve(r):new Promise((function(r,i){e.getPage(t+1).then((function(i){ve.set(n,i),i.ref&&be(e,i.ref,t),r(i)}))}))},Se=function(e,t){return new Promise((function(n){new Promise((function(n){typeof t==`string`?e.getDestination(t).then((function(e){n(e)})):n(t)})).then((function(r){if(typeof r[0]==`object`&&r[0]!==null){var i=r[0],a=function(e,t){var n=ye(e,t);return _e.has(n)?_e.get(n):null}(e,i);a===null?e.getPageIndex(i).then((function(r){be(e,i,r),Se(e,t).then((function(e){return n(e)}))})):n(ge(a,r))}else n(ge(r[0],r))}))}))};(function(e){e[e.Solid=1]=`Solid`,e[e.Dashed=2]=`Dashed`,e[e.Beveled=3]=`Beveled`,e[e.Inset=4]=`Inset`,e[e.Underline=5]=`Underline`})(G||={});var K,Ce=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?`),we=function(e,t,n,r){var i=parseInt(e,10);return i>=t&&i<=n?i:r},q=function(e){return e.contentsObj?e.contentsObj.str:e.contents||``},J=function(e){return e.titleObj?e.titleObj.str:e.title||``},Te=function(t){var n=t.annotation,r=a.useContext(f).direction,i=J(n),o=q(n),s=r===e.TextDirection.RightToLeft,c=a.useRef(),l=``;if(n.modificationDate){var u=function(e){var t=Ce.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=we(t[2],1,12,1)-1,i=we(t[3],1,31,1),a=we(t[4],0,23,0),o=we(t[5],0,59,0),s=we(t[6],0,59,0),c=t[7]||`Z`,l=we(t[8],0,23,0),u=we(t[9],0,59,0);switch(c){case`-`:a+=l,o+=u;break;case`+`:a-=l,o-=u}return new Date(Date.UTC(n,r,i,a,o,s))}(n.modificationDate);l=u?`${u.toLocaleDateString()}, ${u.toLocaleTimeString()}`:``}return a.useLayoutEffect((function(){if(c.current){var e=document.querySelector(`[data-annotation-id="${n.id}"]`);if(e){var t=e;return t.style.zIndex+=1,function(){t.style.zIndex=`${parseInt(t.style.zIndex,10)-1}`}}}}),[]),a.createElement(`div`,{ref:c,className:p({"rpv-core__annotation-popup-wrapper":!0,"rpv-core__annotation-popup-wrapper--rtl":s}
6),style:{top:n.annotationType===e.AnnotationType.Popup?``:`100%`}},i&&a.createElement(a.Fragment,null,a.createElement(`div`,{className:p({"rpv-core__annotation-popup-title":!0,"rpv-core__annotation-popup-title--ltr":!s,"rpv-core__annotation-popup-title--rtl":s})},i),a.createElement(`div`,{className:`rpv-core__annotation-popup-date`},l)),o&&a.createElement(`div`,{className:`rpv-core__annotation-popup-content`},o.split(` 7`).map((function(e,t){return a.createElement(a.Fragment,{key:t},e,a.createElement(`br`,null))}))))};(function(e){e.Click=`Click`,e.Hover=`Hover`})(K||={});var Y,X=function(t){var n,r=t.annotation,i=t.children,o=t.ignoreBorder,s=t.hasPopup,c=t.isRenderable,l=t.page,u=t.viewport,d=r.rect,f=function(){var t=te(!1),n=t.opened,r=t.toggle,i=a.useState(K.Hover),o=i[0],s=i[1];return{opened:n,closeOnHover:function(){o===K.Hover&&r(e.ToggleStatus.Close)},openOnHover:function(){o===K.Hover&&r(e.ToggleStatus.Open)},toggleOnClick:function(){switch(o){case K.Click:n&&s(K.Hover),r(e.ToggleStatus.Toggle);break;case K.Hover:s(K.Click),r(e.ToggleStatus.Open)}}}}(),p=f.closeOnHover,m=f.opened,h=f.openOnHover,g=f.toggleOnClick,_=(n=[d[0],l.view[3]+l.view[1]-d[1],d[2],l.view[3]+l.view[1]-d[3]],[Math.min(n[0],n[2]),Math.min(n[1],n[3]),Math.max(n[0],n[2]),Math.max(n[1],n[3])]),v=d[2]-d[0],y=d[3]-d[1],b={borderColor:``,borderRadius:``,borderStyle:``,borderWidth:``};if(!o&&r.borderStyle.width>0){switch(r.borderStyle.style){case G.Dashed:b.borderStyle=`dashed`;break;case G.Solid:b.borderStyle=`solid`;break;case G.Underline:b=Object.assign({borderBottomStyle:`solid`},b);case G.Beveled:case G.Inset:}var x=r.borderStyle.width;b.borderWidth=`${x}px`,r.borderStyle.style!==G.Underline&&(v-=2*x,y-=2*x);var S=r.borderStyle,C=S.horizontalCornerRadius,w=S.verticalCornerRadius;(C>0||w>0)&&(b.borderRadius=`${C}px / ${w}px`),r.color?b.borderColor=`rgb(${0|r.color[0]}, ${0|r.color[1]}, ${0|r.color[2]})`:b.borderWidth=`0`}return a.createElement(a.Fragment,null,c&&i({popup:{opened:m,closeOnHover:p,openOnHover:h,toggleOnClick:g}
7,slot:{attrs:{style:Object.assign({height:`${y}px`,left:`${_[0]}px`,top:`${_[1]}px`,transform:`matrix(${u.transform.join(`,`)})`,transformOrigin:`-${_[0]}px -${_[1]}px`,width:`${v}px`},b)},children:a.createElement(a.Fragment,null,s&&m&&a.createElement(Te,{annotation:r}))}}))},Z=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s);return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--caret`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ee=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s),l=t.rect,d=l[2]-l[0],f=l[3]-l[1],p=t.borderStyle.width;return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--circle`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),a.createElement(`svg`,{height:`${f}px`,preserveAspectRatio:`none`,version:`1.1`,viewBox:`0 0 ${d} ${f}`,width:`${d}px`},a.createElement(`circle`,{cy:f/2,fill:`none`,rx:d/2-p/2,ry:f/2-p/2,stroke:`transparent`,strokeWidth:p||1})),e.slot.children)}))},De=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=J(t),o=q(t),s=!(!1!==t.hasPopup||!i&&!o),c=function(){var e,n,r,i,a=t.file;a&&(e=a.filename,n=a.content,r=typeof n==`string`?``:URL.createObjectURL(new Blob([n],{type:``})),(i=document.createElement(`a`)).style.display=`none`,i.href=r||e,i.setAttribute(`download`,function(e){var t=e.split(`/`).pop();return t?t.split(`#`)[0].split(`?`)[0]:e}(e)),document.body.appendChild(i),i.click(),document.body.removeChild(i),r&&URL.revokeObjectURL(r))};return a.createElement(X,{annotation:t,hasPopup:s,ignoreBorder:!0,isRenderable:!0,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--file-attachment`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onDoubleClick:c,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Oe=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s);return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--free-text`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ke=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=J(t),o=q(t),s=!(!i&&!o),c=!t.parentType||[`Circle`,`Ink`,`Line`,`Polygon`,`PolyLine`,`Square`].indexOf(t.parentType)!==-1;return m((function(){if(t.parentId){var e=document.querySelector(`[data-annotation-id="${t.parentId}"]`),n=document.querySelector(`[data-annotation-id="${t.id}"]`);if(e&&n){var r=parseFloat(e.style.left),i=parseFloat(e.style.top)+parseFloat(e.style.height);n.style.left=`${r}px`,n.style.top=`${i}px`,n.style.transformOrigin=`-${r}px -${i}px`}}}),[]),a.createElement(X,{annotation:t,hasPopup:c,ignoreBorder:!1,isRenderable:s,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--popup`,"data-annotation-id":t.id}),a.createElement(Te,{annotation:t}))}))},Ae=function(t){var n=t.annotation,r=t.childAnnotation,i=t.page,o=t.viewport,s=!1===n.hasPopup,c=J(n),l=q(n),d=!!(n.hasPopup||c||l);if(n.quadPoints&&n.quadPoints.length>0){var f=n.quadPoints.map((function(e){return Object.assign({},n,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return a.createElement(a.Fragment,null,f.map((function(e,t){return a.createElement(Ae,{key:t,annotation:e,childAnnotation:r,page:i,viewport:o})})))}return a.createElement(X,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:d,page:i,viewport:o},(function(t){return a.createElement(a.Fragment,null,a.createElement(`div`,u({},t.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--highlight`,"data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children),r&&r.annotationType===e.AnnotationType.Popup&&t.popup.opened&&a.createElement(ke,{annotation:r,page:i,viewport:o}))}))},je=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s),l=t.rect,d=l[2]-l[0],f=l[3]-l[1],p=t.borderStyle.width;return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--ink`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.inkLists&&t.inkLists.length&&a.createElement(`svg`,{height:`${f}px`,preserveAspectRatio:`none`,version:`1.1`,viewBox:`0 0 ${d} ${f}`,width:`${d}px`},t.inkLists.map((function(e,t){return a.createElement(`polyline`,{key:t,fill:`none`,stroke:`transparent`,strokeWidth:p||1,points:e.map((function(e){return`${e.x-l[0]}
7,${l[3]-e.y}`})).join(` `)})}))),e.slot.children)}))},Q=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s),l=t.rect,d=l[2]-l[0],f=l[3]-l[1],p=t.borderStyle.width;return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--line`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),a.createElement(`svg`,{height:`${f}px`,preserveAspectRatio:`none`,version:`1.1`,viewBox:`0 0 ${d} ${f}`,width:`${d}px`},a.createElement(`line`,{stroke:`transparent`,strokeWidth:p||1,x1:l[2]-t.lineCoordinates[0],x2:l[2]-t.lineCoordinates[2],y1:l[3]-t.lineCoordinates[1],y2:l[3]-t.lineCoordinates[3]})),e.slot.children)}))},Me=/^([^\w]*)(javascript|data|vbscript)/im,$=/&#(\w+)(^\w|;)?/g,Ne=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Pe=/^([^:]+):/gm,Fe=function(e,t){t===void 0&&(t=`about:blank`);var n,r=(n=e||``,n.replace($,(function(e,t){return String.fromCharCode(t)}))).replace(Ne,``).trim();if(!r)return t;var i=r[0];if(i===`.`||i===`/`)return r;var a=r.match(Pe);if(!a)return r;var o=a[0];return Me.test(o)?t:r},Ie=function(e){var t,n=e.annotation,r=e.annotationContainerRef,i=e.doc,o=e.outlines,s=e.page,c=e.pageIndex,l=e.scale,d=e.viewport,f=e.onExecuteNamedAction,p=e.onJumpFromLinkAnnotation,m=e.onJumpToDest,h=a.useRef(),g=o&&o.length&&n.dest&&typeof n.dest==`string`?o.find((function(e){return e.dest===n.dest}))?.title:``,_=!!(n.url||n.dest||n.action||n.unsafeUrl),v={};if(n.url||n.unsafeUrl){var y=Fe(n.url||n.unsafeUrl,``);y?v={"data-target":`external`,href:y,rel:`noopener noreferrer nofollow`,target:n.newWindow?`_blank`:``,title:y}:_=!1}else v={href:``,"data-annotation-link":n.id,onClick:function(e){e.preventDefault(),n.action?f(n.action):Se(i,n.dest).then((function(e){var t=h.current,n=r.current;if(t&&n){var i=t.getBoundingClientRect();n.style.setProperty(`height`,`100%`),n.style.setProperty(`width`,`100%`);var a=n.getBoundingClientRect();n.style.removeProperty(`height`),n.style.removeProperty(`width`);var o=(i.left-a.left)/l;p({bottomOffset:(a.bottom-i.bottom+i.height)/l,label:g,leftOffset:o,pageIndex:c})}m(e)}))}};return g&&(v=Object.assign({},v,{title:g,"aria-label":g})),a.createElement(X,{annotation:n,hasPopup:!1,ignoreBorder:!1,isRenderable:_,page:s,viewport:d},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--link`,"data-annotation-id":n.id,"data-testid":`core__annotation--link-${n.id}`}),a.createElement(`a`,u({ref:h},v)))}))},Le=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s),l=t.rect,d=l[2]-l[0],f=l[3]-l[1],p=t.borderStyle.width;return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--polygon`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&a.createElement(`svg`,{height:`${f}px`,preserveAspectRatio:`none`,version:`1.1`,viewBox:`0 0 ${d} ${f}`,width:`${d}px`},a.createElement(`polygon`,{fill:`none`,stroke:`transparent`,strokeWidth:p||1,points:t.vertices.map((function(e){return`${e.x-l[0]},${l[3]-e.y}`})).join(` `)})),e.slot.children)}))},Re=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s),l=t.rect,d=l[2]-l[0],f=l[3]-l[1],p=t.borderStyle.width;return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--polyline`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&a.createElement(`svg`,{height:`${f}px`,preserveAspectRatio:`none`,version:`1.1`,viewBox:`0 0 ${d} ${f}`,width:`${d}px`},a.createElement(`polyline`,{fill:`none`,stroke:`transparent`,strokeWidth:p||1,points:t.vertices.map((function(e){return`${e.x-l[0]}
7,${l[3]-e.y}`})).join(` `)})),e.slot.children)}))},ze=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s),l=t.rect,d=l[2]-l[0],f=l[3]-l[1],p=t.borderStyle.width;return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--square`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),a.createElement(`svg`,{height:`${f}px`,preserveAspectRatio:`none`,version:`1.1`,viewBox:`0 0 ${d} ${f}`,width:`${d}px`},a.createElement(`rect`,{height:f-p,fill:`none`,stroke:`transparent`,strokeWidth:p||1,x:p/2,y:p/2,width:d-p})),e.slot.children)}))},Be=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s);return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--squiggly`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ve=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s);return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--stamp`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},He=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s);return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--strike-out`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ue=function(){return a.createElement(g,{size:16},a.createElement(`path`,{d:`M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z`}),a.createElement(`path`,{d:`M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25`}),a.createElement(`path`,{d:`M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75`}),a.createElement(`path`,{d:`M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25`}))},We=function(){return a.createElement(g,{size:16},a.createElement(`path`,{d:`M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z`}),a.createElement(`path`,{d:`M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z`}),a.createElement(`path`,{d:`M21.423 5.406L17.415 9.414`}),a.createElement(`path`,{d:`M14.587 6.585L18.607 2.565`}),a.createElement(`path`,{d:`M5.405 21.424L9.413 17.416`}),a.createElement(`path`,{d:`M6.585 14.588L2.577 18.596`}),a.createElement(`path`,{d:`M18.602 21.419L14.595 17.412`}),a.createElement(`path`,{d:`M17.419 14.58L21.428 18.589`}),a.createElement(`path`,{d:`M2.582 5.399L6.588 9.406`}),a.createElement(`path`,{d:`M9.421 6.581L5.412 2.572`}))},Ge=function(){return a.createElement(g,{size:16},a.createElement(`path`,{d:`M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z`}),a.createElement(`path`,{d:`M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z`}))},Ke=function(){return a.createElement(g,{size:16},a.createElement(`path`,{d:`M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z`}),a.createElement(`path`,{d:`M6 4.5L6 0.5`}),a.createElement(`path`,{d:`M18 4.5L18 0.5`}),a.createElement(`path`,{d:`M10 4.5L10 0.5`}),a.createElement(`path`,{d:`M14 4.5L14 0.5`}))},qe=function(){return a.createElement(g,{size:16},a.createElement(`path`,{d:`M17.5 0.498L17.5 23.498`}),a.createElement(`path`,{d:`M10.5 0.498L10.5 23.498`}),a.createElement(`path`,{d:`M23.5.5H6.5a6,6,0,0,0,0,12h4`}))},Je=function(){return a.createElement(g,{size:16},a.createElement(`path`,{d:`M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z`}))},Ye=function(t){var n=t.annotation,r=t.childAnnotation,i=t.page,o=t.viewport,s=!1===n.hasPopup,c=J(n),l=q(n),d=!!(n.hasPopup||c||l),f=n.name?n.name.toLowerCase():``;return a.createElement(X,{annotation:n,hasPopup:s,ignoreBorder:!1,isRenderable:d,page:i,viewport:o},(function(t){return a.createElement(a.Fragment,null,a.createElement(`div`,u({},t.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--text`,"data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),f&&a.createElement(`div`,{className:`rpv-core__annotation-text-icon`},f===`check`&&a.createElement(_,null),f===`comment`&&a.createElement(Ue,null),f===`help`&&a.createElement(We,null),f===`insert`&&a.createElement(Je,null),f===`key`&&a.createElement(Ge,null),f===`note`&&a.createElement(Ke,null),(f===`newparagraph`||f===`paragraph`)&&a.createElement(qe,null)),t.slot.children),r&&r.annotationType===e.AnnotationType.Popup&&t.popup.opened&&a.createElement(ke,{annotation:r,page:i,viewport:o}))}))},Xe=function(e){var t=e.annotation,n=e.page,r=e.viewport,i=!1===t.hasPopup,o=J(t),s=q(t),c=!!(t.hasPopup||o||s);return a.createElement(X,{annotation:t,hasPopup:i,ignoreBorder:!0,isRenderable:c,page:n,viewport:r},(function(e){return a.createElement(`div`,u({},e.slot.attrs,{className:`rpv-core__annotation rpv-core__annotation--underline`,"data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ze=function(t){var n=t.annotations,r=t.doc,i=t.outlines,o=t.page,s=t.pageIndex,c=t.plugins,l=t.rotation,u=t.scale,d=t.onExecuteNamedAction,f=t.onJumpFromLinkAnnotation,p=t.onJumpToDest,h=a.useRef(),g=o.getViewport({rotation:l,scale:u}).clone({dontFlip:!0}),_=n.filter((function(e){return!e.parentId}));return m((function(){var e=h.current;
7e&&c.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:_,container:e,pageIndex:s,rotation:l,scale:u})}))}),[]),a.createElement(`div`,{ref:h,className:`rpv-core__annotation-layer`,"data-testid":`core__annotation-layer-${s}`},_.map((function(t){var c=n.find((function(e){return e.parentId===t.id}));switch(t.annotationType){case e.AnnotationType.Caret:return a.createElement(Z,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Circle:return a.createElement(Ee,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.FileAttachment:return a.createElement(De,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.FreeText:return a.createElement(Oe,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Highlight:return a.createElement(Ae,{key:t.id,annotation:t,childAnnotation:c,page:o,viewport:g});case e.AnnotationType.Ink:return a.createElement(je,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Line:return a.createElement(Q,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Link:return a.createElement(Ie,{key:t.id,annotation:t,annotationContainerRef:h,doc:r,outlines:i,page:o,pageIndex:s,scale:u,viewport:g,onExecuteNamedAction:d,onJumpFromLinkAnnotation:f,onJumpToDest:p});case e.AnnotationType.Polygon:return a.createElement(Le,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Polyline:return a.createElement(Re,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Popup:return a.createElement(ke,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Square:return a.createElement(ze,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Squiggly:return a.createElement(Be,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Stamp:return a.createElement(Ve,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.StrikeOut:return a.createElement(He,{key:t.id,annotation:t,page:o,viewport:g});case e.AnnotationType.Text:return a.createElement(Ye,{key:t.id,annotation:t,childAnnotation:c,page:o,viewport:g});case e.AnnotationType.Underline:return a.createElement(Xe,{key:t.id,annotation:t,page:o,viewport:g});default:return a.createElement(a.Fragment,{key:t.id})}})))},Qe=function(e){var t=e.page,n=e.renderAnnotations,r=j(),i=a.useState({loading:!0,annotations:[]}),o=i[0],s=i[1];return a.useEffect((function(){t.getAnnotations({intent:`display`}).then((function(e){r.current&&s({loading:!1,annotations:e})}))}),[]),o.loading?a.createElement(a.Fragment,null):n(o.annotations)},$e=function(e){var t=e.doc,n=e.outlines,r=e.page,i=e.pageIndex,o=e.plugins,s=e.rotation,c=e.scale,l=e.onExecuteNamedAction,u=e.onJumpFromLinkAnnotation,d=e.onJumpToDest;return a.createElement(Qe,{page:r,renderAnnotations:function(e){return a.createElement(Ze,{annotations:e,doc:t,outlines:n,page:r,pageIndex:i,plugins:o,rotation:s,scale:c,onExecuteNamedAction:l,onJumpFromLinkAnnotation:u,onJumpToDest:d})}})},et=function(e,t){var n=e%t;return n===0?e:Math.floor(e-n)},tt=function(t){var n=t.canvasLayerRef,r=t.height,i=t.page,o=t.pageIndex,s=t.plugins,c=t.rotation,l=t.scale,u=t.width,d=t.onRenderCanvasCompleted,f=a.useRef();return m((function(){var t=f.current;t&&t.cancel();var r=n.current;r.removeAttribute(`data-testid`),s.forEach((function(t){t.onCanvasLayerRender&&t.onCanvasLayerRender({ele:r,pageIndex:o,rotation:c,scale:l,status:e.LayerRenderStatus.PreRender})}));var a=i.getViewport({rotation:c,scale:l}),u=window.devicePixelRatio||1,p=Math.sqrt(16777216/(a.width*a.height)),m=u>p;m?r.style.transform=`scale(1, 1)`:r.style.removeProperty(`transform`);var h=Math.min(p,u),g=function(e,t){var n,r;if(Math.floor(e)===e)return[e,1];var i=1/e;if(i>t)return[1,t];if(Math.floor(i)===i)return[1,i];for(var a=e>1?i:e,o=0,s=1,c=1,l=1;;){var u=o+c,d=s+l;if(d>t)break;a<=u/d?(c=(n=[u,d])[0],l=n[1]):(o=(r=[u,d])[0],s=r[1])}return a<(o/s+c/l)/2?a===e?[o,s]:[s,o]:a===e?[c,l]:[l,c]}(h,8),_=g[0],v=g[1];r.width=et(a.width*h,_),r.height=et(a.height*h,_),r.style.width=`${et(a.width,v)}px`,r.style.height=`${et(a.height,v)}px`,r.hidden=!0;var y=r.getContext(`2d`,{alpha:!1}),b=m||u!==1?[h,0,0,h,0,0]:null;return f.current=i.render({canvasContext:y,transform:b,viewport:
7a}),f.current.promise.then((function(){r.hidden=!1,r.setAttribute(`data-testid`,`core__canvas-layer-${o}`),s.forEach((function(t){t.onCanvasLayerRender&&t.onCanvasLayerRender({ele:r,pageIndex:o,rotation:c,scale:l,status:e.LayerRenderStatus.DidRender})})),d()}),(function(){d()})),function(){r&&(r.width=0,r.height=0)}}),[]),a.createElement(`div`,{className:`rpv-core__canvas-layer`,style:{height:`${r}px`,width:`${u}px`}},a.createElement(`canvas`,{ref:n}))},nt=function(e){var t=e.height,n=e.page,r=e.rotation,i=e.scale,s=e.width,c=a.useRef();return m((function(){var e=c.current,a=n.getViewport({rotation:r,scale:i});n.getOperatorList().then((function(r){(function(){var e=c.current;e&&(e.innerHTML=``)})(),new o.SVGGraphics(n.commonObjs,n.objs).getSVG(r,a).then((function(n){n.style.height=`${t}px`,n.style.width=`${s}px`,e.appendChild(n)}))}))}),[]),a.createElement(`div`,{className:`rpv-core__svg-layer`,ref:c})},rt=function(t){var n=t.containerRef,r=t.page,i=t.pageIndex,s=t.plugins,c=t.rotation,l=t.scale,u=t.onRenderTextCompleted,d=a.useRef(),f=function(){var e=n.current;e&&([].slice.call(e.querySelectorAll(`.rpv-core__text-layer-text`)).forEach((function(t){return e.removeChild(t)})),[].slice.call(e.querySelectorAll(`br[role="presentation"]`)).forEach((function(t){return e.removeChild(t)})))};return m((function(){var t=d.current;t&&t.cancel();var a=n.current;if(a){a.removeAttribute(`data-testid`);var p=r.getViewport({rotation:c,scale:l});return s.forEach((function(t){t.onTextLayerRender&&t.onTextLayerRender({ele:a,pageIndex:i,scale:l,status:e.LayerRenderStatus.PreRender})})),r.getTextContent().then((function(t){f(),d.current=o.renderTextLayer({container:a,textContent:t,textContentSource:t,viewport:p}),d.current.promise.then((function(){a.setAttribute(`data-testid`,`core__text-layer-${i}`),[].slice.call(a.children).forEach((function(e){e.classList.contains(`rpv-core__text-layer-text--not`)||e.classList.add(`rpv-core__text-layer-text`)})),s.forEach((function(t){t.onTextLayerRender&&t.onTextLayerRender({ele:a,pageIndex:i,scale:l,status:e.LayerRenderStatus.DidRender})})),u()}),(function(){a.removeAttribute(`data-testid`),u()}))})),function(){var e;f(),(e=d.current)==null||e.cancel()}}}),[]),a.createElement(`div`,{className:`rpv-core__text-layer`,ref:n})},it=function(t){var n=t.doc,r=t.measureRef,i=t.outlines,o=t.pageIndex,s=t.pageRotation,c=t.pageSize,l=t.plugins,u=t.renderPage,d=t.renderQueueKey,f=t.rotation,m=t.scale,h=t.shouldRender,g=t.viewMode,_=t.onExecuteNamedAction,v=t.onJumpFromLinkAnnotation,b=t.onJumpToDest,x=t.onRenderCompleted,S=t.onRotatePage,C=j(),w=a.useState(null),T=w[0],E=w[1],D=a.useState(!1),O=D[0],k=D[1],A=a.useState(!1),M=A[0],N=A[1],P=a.useRef(),F=a.useRef(),I=Math.abs(f+s)%180==0,L=c.pageWidth*m,R=c.pageHeight*m,z=I?L:R,B=I?R:L,V=(c.rotation+f+s)%360,H=a.useRef(0),ee=u||function(e){return a.createElement(a.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)};return a.useEffect((function(){E(null),k(!1),N(!1)}),[s,f,m]),a.useEffect((function(){h&&C.current&&!T&&xe(n,o).then((function(e){C.current&&(H.current=d,E(e))}))}),[h,T]),a.useEffect((function(){O&&M&&(d===H.current?x(o):(E(null),k(!1),N(!1)))}),[O,M]),a.createElement(`div`,{className:p({"rpv-core__page-layer":!0,"rpv-core__page-layer--dual":g===e.ViewMode.DualPage,"rpv-core__page-layer--dual-cover":g===e.ViewMode.DualPageWithCover,"rpv-core__page-layer--single":g===e.ViewMode.SinglePage}),"data-testid":`core__page-layer-${o}`,ref:r,style:{height:`${B}px`,width:`${z}px`}},T?a.createElement(a.Fragment,null,ee({annotationLayer:{attrs:{},children:a.createElement($e,{doc:n,outlines:i,page:T,pageIndex:o,plugins:l,rotation:V,scale:m,onExecuteNamedAction:_,onJumpFromLinkAnnotation:v,onJumpToDest:b})},canvasLayer:{attrs:{},children:a.createElement(tt,{canvasLayerRef:P,height:B,page:T,pageIndex:o,plugins:l,rotation:V,scale:m,width:z,onRenderCanvasCompleted:function(){C.current&&k(!0)}})},canvasLayerRendered:O,doc:n,height:B,pageIndex:o,rotation:V,scale:m,svgLayer:{attrs:{},children:a.createElement(nt,{height:B,page:T,rotation:V,scale:m,width:z})},textLayer:{attrs:{},children:a.createElement(rt,{containerRef:F,page:T,pageIndex:o,plugins:l,rotation:V,scale:m,onRenderTextCompleted:function(){C.current&&N(!0)}})},textLayerRendered:M,width:z,markRendered:x,onRotatePage:function(e){return S(o,e)}}),l.map((function(e,t){return e.renderPageLayer?a.createElement(a.Fragment,{key:t},e.renderPageLayer({canvasLayerRef:P,canvasLayerRendered:O,doc:n,height:B,pageIndex:o,rotation:V,scale:m,textLayerRef:F,textLayerRendered:M,width:z})):a.createElement(a.Fragment,{key:t})}))):a.createElement(y,{testId:`core__page-layer-loading-${o}`}))},at=function(e,t){var n=t.rect;return e.height!==n.height||e.width!==n.width?n:e};(function(e){e.Horizontal=`Horizontal`,e.Vertical=`Vertical`,e.Both=`Both`})(Y||={});var ot=function(e){return 1-(1-e)**4},st=1e-4,ct={left:0,top:0},lt={capture:!1,passive:!0},ut=function(e){var t=e.elementRef,n=e.enableSmoothScroll,r=e.isRtl,i=e.scrollDirection,o=e.onSmoothScroll,s=a.use
7State(ct),c=s[0],l=s[1],u=a.useState(t.current),d=u[0],f=u[1],p=r?-1:1,h=a.useRef(i);h.current=i;var g=a.useRef(ct),_=a.useRef(!0),v=a.useCallback((function(){_.current=!0,n&&l(g.current),o(!1)}),[]),y=a.useCallback((function(){if(d){switch(h.current){case Y.Horizontal:g.current={left:p*d.scrollLeft,top:0};break;case Y.Both:g.current={left:p*d.scrollLeft,top:d.scrollTop};break;case Y.Vertical:default:g.current={left:0,top:d.scrollTop}}n&&!_.current||l(g.current)}}),[d]);return m((function(){f(t.current)})),m((function(){if(d)return d.addEventListener(`scroll`,y,lt),function(){d.removeEventListener(`scroll`,y,lt)}}),[d]),{scrollOffset:c,scrollTo:a.useCallback((function(e,n){var r=t.current;if(!r)return Promise.resolve();var i={left:0,top:0};switch(h.current){case Y.Horizontal:i.left=p*e.left;break;case Y.Both:i.left=p*e.left,i.top=e.top;break;case Y.Vertical:default:i.top=e.top}return n?(_.current=!1,o(!0),new Promise((function(e,t){(function(e,t,n,r,i,a){i===void 0&&(i=function(e){return e}),a===void 0&&(a=function(){});var o=0,s=0,c=!1;switch(t){case Y.Horizontal:s=e.scrollLeft,o=0;case Y.Both:s=e.scrollLeft,o=e.scrollTop;break;case Y.Vertical:default:s=0,o=e.scrollTop}var l=function(){c||(c=!0,e.scrollLeft=n.left,e.scrollTop=n.top,a())};if(Math.abs(o-n.top)<=st&&t===Y.Vertical)l();else if(Math.abs(s-n.left)<=st&&t===Y.Horizontal)l();else{var u,d=-1,f=s-n.left,p=o-n.top,m=function(a){d===-1&&(d=a);var h=a-d,g=Math.min(h/r,1),_=i(g),v={left:s-f*_,top:o-p*_};switch(t){case Y.Horizontal:e.scrollLeft=v.left;break;case Y.Both:e.scrollLeft=v.left,e.scrollTop=v.top;break;case Y.Vertical:default:e.scrollTop=v.top}Math.abs(v.top-n.top)<=st&&Math.abs(v.left-n.left)<=st&&!c&&(window.cancelAnimationFrame(u),l()),h<r?u=window.requestAnimationFrame(m):window.cancelAnimationFrame(u)};u=window.requestAnimationFrame(m)}})(r,h.current,i,400,ot,(function(){v(),e()}))}))):new Promise((function(e,t){switch(h.current){case Y.Horizontal:r.scrollLeft=i.left;break;case Y.Both:r.scrollLeft=i.left,r.scrollTop=i.top;break;case Y.Vertical:default:r.scrollTop=i.top}e()}))}),[t])}},dt=function(e,t,n){return Math.max(e,Math.min(n,t))},ft=function(t,n){if(n!==e.ViewMode.DualPageWithCover)return 0;if(!function(e){var t=e.length;if(t===1)return!1;for(var n=1;n<t;n++)if(e[n].height!==e[0].height||e[n].width!==e[0].width)return!0;return!1}(t))return 2*t[0].width;var r=he(t.slice(1),2).map((function(e){return e.length===2?e[0].width+e[1].width:e[0].width})),i=[t[0].width].concat(r);return Math.max.apply(Math,i)},pt={left:0,top:0},mt={left:0,top:0},ht={left:0,top:0},gt={left:0,top:0},_t={height:0,width:0},vt={left:0,top:0},yt=`data-virtual-index`,bt=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],xt=function(t){var n=t.enableSmoothScroll,r=t.isRtl,i=t.numberOfItems,o=t.parentRef,s=t.setRenderRange,c=t.sizes,l=t.scrollMode,d=t.viewMode,f=a.useState(!1),p=f[0],h=f[1],g=a.useCallback((function(e){return h(e)}),[]),_=a.useRef(l);_.current=l;var v=a.useRef(d);v.current=d;var y=l===e.ScrollMode.Wrapped||d===e.ViewMode.DualPageWithCover||d===e.ViewMode.DualPage?Y.Both:l===e.ScrollMode.Horizontal?Y.Horizontal:Y.Vertical,b=ut({elementRef:o,enableSmoothScroll:n,isRtl:r,scrollDirection:y,onSmoothScroll:g}),x=b.scrollOffset,S=b.scrollTo,C=function(e){var t=e.elementRef,n=a.useState(t.current),r=n[0],i=n[1],o=a.useRef(!1),s=a.useReducer(at,{height:0,width:0}),c=s[0],l=s[1];return m((function(){t.current!==r&&i(t.current)})),m((function(){if(r&&!o.current){o.current=!0;var e=r.getBoundingClientRect(),t=e.height,n=e.width;l({rect:{height:t,width:n}})}}),[r]),a.useEffect((function(){if(r){var e=new ResizeObserver((function(e,t){e.forEach((function(e){if(e.target===r){var t=e.contentRect,n=t.height,i=t.width;l({rect:{height:n,width:i}})}}))}));return e.observe(r),function(){e.unobserve(r)}}}),[r]),c}({elementRef:o}),w=a.useRef({scrollOffset:vt,measurements:[]});w.current.scrollOffset=x;var T=a.useMemo((function(){return Array(i).fill(-1)}),[]),E=a.useState(T),D=E[0],O=E[1],k=a.useMemo((function(){return new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting?e.intersectionRatio:-1,n=e.target.getAttribute(yt);if(n){var r=parseInt(n,10);0<=r&&r<i&&O((function(e){return e[r]=t,function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0)}))}}))}),{threshold:bt})}),[]),A=a.useMemo((function(){return l===e.ScrollMode.Page&&d===e.ViewMode.SinglePage?function(e,t,n){for(var r=[],i=0;i<e;
7i++){var a={height:Math.max(t.height,n[i].height),width:Math.max(t.width,n[i].width)},o=i===0?gt:r[i-1].end,s={left:o.left+a.width,top:o.top+a.height};r[i]={index:i,start:o,size:a,end:s,visibility:-1}}return r}(i,C,c):d===e.ViewMode.DualPageWithCover?function(t,n,r,i){for(var a=[],o=0,s=0,c=ht,l=0;l<t;l++){var u=l===0?{height:i===e.ScrollMode.Page?Math.max(n.height,r[l].height):r[l].height,width:i===e.ScrollMode.Page?Math.max(n.width,r[l].width):r[l].width}:{height:i===e.ScrollMode.Page?Math.max(n.height,r[l].height):r[l].height,width:Math.max(n.width/2,r[l].width)};i===e.ScrollMode.Page?c=l===0?ht:{left:l%2==0?u.width:0,top:Math.floor((l-1)/2)*u.height+a[0].end.top}:l===0?(c=ht,o=r[0].height,s=0):l%2==1?(c={left:0,top:o+=s},s=l===t-1?r[l].height:Math.max(r[l].height,r[l+1].height)):c={left:a[l-1].end.left,top:o};var d={left:c.left+u.width,top:c.top+u.height};a[l]={index:l,start:c,size:u,end:d,visibility:-1}}return a}(i,C,c,l):d===e.ViewMode.DualPage?function(t,n,r,i){for(var a=[],o=0,s=0,c=mt,l=0;l<t;l++){var u={height:i===e.ScrollMode.Page?Math.max(n.height,r[l].height):r[l].height,width:Math.max(n.width/2,r[l].width)};i===e.ScrollMode.Page?c={left:l%2==0?0:u.width,top:Math.floor(l/2)*u.height}:l%2==0?(c={left:0,top:o+=s},s=l===t-1?r[l].height:Math.max(r[l].height,r[l+1].height)):c={left:a[l-1].end.left,top:o};var d={left:c.left+u.width,top:c.top+u.height};a[l]={index:l,start:c,size:u,end:d,visibility:-1}}return a}(i,C,c,l):function(t,n,r,i){for(var a=[],o=0,s={left:0,top:0},c=0,l=pt,u=0;u<t;u++){var d=r[u];if(u===0)o=d.width,s={left:0,top:0},c=d.height;else switch(i){case e.ScrollMode.Wrapped:(o+=d.width)<n.width?(l={left:a[u-1].end.left,top:s.top},c=Math.max(c,d.height)):(o=d.width,s={left:(l={left:s.left,top:s.top+c}).left,top:l.top},c=d.height);break;case e.ScrollMode.Horizontal:case e.ScrollMode.Vertical:default:l=a[u-1].end}var f={left:l.left+d.width,top:l.top+d.height};a[u]={index:u,start:l,size:d,end:f,visibility:-1}}return a}(i,C,c,l)}),[l,c,d,C]),j=A[i-1]?{height:A[i-1].end.top,width:A[i-1].end.left}:_t;w.current.measurements=A;var M=a.useMemo((function(){var t=function(e,t,n,r){var i=0;switch(e){case Y.Horizontal:i=r.left;break;case Y.Vertical:default:i=r.top}var a=t.length-1,o=function(e,t,n,r){for(;e<=t;){var i=(e+t)/2|0,a=r(i);if(a<n)e=i+1;else{if(!(a>n))return i;t=i-1}}return e>0?e-1:0}(0,a,i,(function(n){switch(e){case Y.Horizontal:return t[n].start.left;case Y.Both:case Y.Vertical:default:return t[n].start.top}}));if(e===Y.Both)for(var s=t[o].start.top;o-1>=0&&t[o-1].start.top===s&&t[o-1].start.left>=r.left;)o--;for(var c=o;c<=a;){var l={top:t[c].start.top-r.top,left:t[c].start.left-r.left},u={height:n.height-l.top,width:n.width-l.left};if(e===Y.Horizontal&&u.width<0||e===Y.Vertical&&u.height<0||e===Y.Both&&(u.width<0||u.height<0))break;c++}return{start:o,end:c}}(y,A,C,x),n=t.start,r=t.end,a=n+D.slice(dt(0,i,n),dt(0,i,r)).reduce((function(e,t,n,r){return t>r[e]?n:e}),0),o=a=dt(0,i-1,a),c=s({endPage:r,numPages:i,startPage:n}),l=c.startPage,u=c.endPage;switch(l=Math.max(l,0),u=Math.min(u,i-1),d){case e.ViewMode.DualPageWithCover:a>0&&(o=a%2==1?a:a-1),l=l===0?0:l%2==1?l:l-1,i-(u=u%2==1?u-1:u)<=2&&(u=i-1);break;case e.ViewMode.DualPage:o=a%2==0?a:a-1,l=l%2==0?l:l-1,u=u%2==1?u:u
7-1;break;case e.ViewMode.SinglePage:default:o=a}return{startPage:l,endPage:u,maxVisbilityIndex:o}}),[A,C,x,d,D]),N=M.startPage,P=M.endPage,F=M.maxVisbilityIndex,I=a.useMemo((function(){for(var e=[],t=function(t){var n=A[t],r=u(u({},n),{visibility:D[t]===void 0?-1:D[t],measureRef:function(e){e&&(e.setAttribute(yt,`${t}`),k.observe(e))}});e.push(r)},n=N;n<=P;n++)t(n);return e}),[N,P,D,A]),L=a.useCallback((function(t,r){var a=w.current.measurements[dt(0,i-1,t)],o=_.current===e.ScrollMode.Page?vt:r;return a?S({left:o.left+a.start.left,top:o.top+a.start.top},n):Promise.resolve()}),[S,n]),R=a.useCallback((function(t,n){var r=w.current.measurements,i=r[t].start,a=r.find((function(e){return e.start.top-i.top>1e-12}));if(!a)return Promise.resolve();var o=a.index;switch(v.current){case e.ViewMode.DualPage:o=o%2==0?o:o+1;break;case e.ViewMode.DualPageWithCover:o=o%2==1?o:o+1}return L(o,n)}),[]),z=a.useCallback((function(t,n){for(var r=w.current.measurements,a=r[t].start,o=t,s=!1,c=i-1;c>=0;c--)if(a.top-r[c].start.top>1e-12){s=!0,o=r[c].index;break}if(!s)return Promise.resolve();switch(v.current){case e.ViewMode.DualPage:o=o%2==0?o:o-1;break;case e.ViewMode.DualPageWithCover:o=o%2==0?o-1:o}return o===t&&(o=t-1),L(o,n)}),[]),B=a.useCallback((function(t,n){if(v.current===e.ViewMode.DualPageWithCover||v.current===e.ViewMode.DualPage)return R(t,n);switch(_.current){case e.ScrollMode.Wrapped:return R(t,n);case e.ScrollMode.Horizontal:case e.ScrollMode.Vertical:default:return L(t+1,n)}}),[]),V=a.useCallback((function(t,n){if(v.current===e.ViewMode.DualPageWithCover||v.current===e.ViewMode.DualPage)return z(t,n);switch(_.current){case e.ScrollMode.Wrapped:return z(t,n);case e.ScrollMode.Horizontal:case e.ScrollMode.Vertical:default:return L(t-1,n)}}),[]),H=a.useCallback((function(){return function(t,n){switch(n){case e.ScrollMode.Horizontal:return{position:`relative`,height:`100%`,width:`${t.width}px`};case e.ScrollMode.Vertical:default:return{position:`relative`,height:`${t.height}px`,width:`100%`}}}(j,_.current)}),[j]),ee=a.useCallback((function(t){return function(t,n,r){return r===e.ScrollMode.Page?{height:`${n.height}px`,width:`100%`,position:`absolute`,top:0,transform:`translateY(${t.start.top}px)`}:{}}(t,C,_.current)}),[C]),U=a.useCallback((function(t){return function(t,n,r,i,a){var o,s,c,l,u,d,f,p=n?`right`:`left`,m=n?-1:1,h=r.length,g=t.start.left*m,_=t.size,v=_.height,y=_.width;if(i===e.ViewMode.DualPageWithCover){var b=a===e.ScrollMode.Page?0:t.start.top;return t.index===0||h%2==0&&t.index===h-1?((o={height:`${v}px`,minWidth:`${ft(r,i)}px`,width:`100%`})[p]=0,o.position=`absolute`,o.top=0,o.transform=`translate(${g}px, ${b}px)`,o):((s={height:`${v}px`,width:`${y}px`})[p]=0,s.position=`absolute`,s.top=0,s.transform=`translate(${g}px, ${b}px)`,s)}if(i===e.ViewMode.DualPage)return(c={height:`${v}px`,width:`${y}px`})[p]=0,c.position=`absolute`,c.top=0,c.transform=`translate(${g}px, ${a===e.ScrollMode.Page?0:t.start.top}px)`,c;switch(a){case e.ScrollMode.Horizontal:return(l={height:`100%`,width:`${y}px`})[p]=0,l.position=`absolute`,l.top=0,l.transform=`translateX(${g}px)`,l;case e.ScrollMode.Page:return(u={height:`${v}px`,width:`${y}px`})[p]=0,u.position=`absolute`,u.top=0,u;case e.ScrollMode.Wrapped:return(d={height:`${v}px`,width:`${y}px`})[p]=0,d.position=`absolute`,d.top=0,d.transform=`translate(${g}px, ${t.start.top}px)`,d;case e.ScrollMode.Vertical:default:return(f={height:`${v}px`,width:`100%`})[p]=0,f.position=`absolute`,f.top=0,f.transform=`translateY(${t.start.top}px)`,f}}(t,r,c,v.current,_.current)}),[r,c]),te=a.useCallback((function(t,n){var r=w.current,a=r.measurements,o=r.scrollOffset,s=a[dt(0,i-1,n)];return s?S(_.current===e.ScrollMode.Page?{left:s.start.left,top:s.start.top}:{left:o.left*t,top:o.top*t},!1):Promise.resolve()}),[]);return a.useEffect((function(){return function(){k.disconnect()}}),[]),{boundingClientRect:C,isSmoothScrolling:p,startPage:N,endPage:P,maxVisbilityIndex:F,virtualItems:I,getContainerStyles:H,getItemContainerStyles:ee,getItemStyles:U,scrollToItem:L,scrollToNextItem:B,scrollToPreviousItem:V,zoom:te}},St=function(t,n,r,i,a,o){var s=r;switch(!0){case a===e.ViewMode.DualPageWithCover&&o>=3:case a===e.ViewMode.DualPage&&o>=3:s=2*r;break;default:s=r}switch(i){case e.SpecialZoomLevel.ActualSize:return 1;case e.SpecialZoomLevel.PageFit:return Math.min((t.clientWidth-17)/s,(t.clientHeight-16)/n);case e.SpecialZoomLevel.PageWidth:return(t.clientWidth-17)/s}},Ct=function(e){var t,n,r=e.getCurrentPage,i=(t=50,n=a.useRef([]),a.useEffect((function(){return function(){n.current=[]}}),[]),{push:function(e){var r=n.current;r.length+1>t&&r.shift(),r.push(e),n.current=r},map:function(e){return n.current.map((function(t){return e(t)}))},pop:function(){var e=n.current;if(e.length===0)return null;var t=e.pop();return n.current=e,t}}),o=function(e){var t=a.useRef([]);return a.useEffect((function(){return function(){t.current=[]}}),[]),{dequeue:function(){var e=t.current;if(e.length===0)return null;var n=e.shift();return t.current=e,n||null},enqueue:function(n){var r=t.current;r.length+1>e&&r.pop(),t.current=[n].concat(r)},map:function(e){return t.current.map((function(t){return e(t)}))}}}(50),s=function(){var e=o.dequeue();return e&&i.push(e),e&&e.pageIndex===r()?s():e},c=function(){var e=i.pop();return e&&o.enqueue(e),e&&e.pageIndex===r()?c():e};return{getNextDestination:s,getPreviousDestination:c,markVisitedDestination:a.useCallback((function(e){i.push(e)}),[])}},wt=function(e){var t=[];return e.map((function(e){t=t.concat(e).concat(function(e){var t=[];return e.items&&e.items.length>0&&(t=t.concat(wt(e.items))),t}(e))})),t},Tt={capture:!1,passive:!0},Et={height:0,width:0},Dt={height:0,width:0},Ot=function(t){var n=t.getCurrentPage,r=t.getCurrentScrollMode,i=t.jumpToPage,o=t.targetRef,s=a.use
7State(e.FullScreenMode.Normal),c=s[0],l=s[1],u=function(){var e=a.useState(Et),t=e[0],n=e[1],r=A((function(){n({height:window.innerHeight,width:window.innerWidth})}),100);return m((function(){return window.addEventListener(`resize`,r,Tt),function(){window.removeEventListener(`resize`,r,Tt)}}),[]),t}(),d=a.useState(Dt),f=d[0],p=d[1],h=a.useRef(Dt),g=a.useRef(n()),_=a.useRef(Dt),v=a.useState(o.current),y=v[0],b=v[1],x=a.useRef();m((function(){o.current!==y&&b(o.current)}),[]),m((function(){if(y){var e=new ResizeObserver((function(e){e.forEach((function(e){var t=e.target.getBoundingClientRect(),n=t.height,r=t.width;p({height:n,width:r})}))}));return e.observe(y),function(){e.unobserve(y),e.disconnect()}}}),[y]);var S=a.useCallback((function(t){var n=k();return n&&n!==t?(l(e.FullScreenMode.Normal),O(n)):Promise.resolve()}),[]),C=a.useCallback((function(t){t&&D()&&(b(t),S(t).then((function(){x.current=t,l(e.FullScreenMode.Entering),function(e){T&&e[E.RequestFullScreen]()}(t)})))}),[]),w=a.useCallback((function(){k()&&(l(e.FullScreenMode.Exitting),O(document))}),[]),j=a.useCallback((function(){y&&k()!==y&&l(e.FullScreenMode.Exitting)}),[y]);return a.useEffect((function(){switch(c){case e.FullScreenMode.Entering:x.current&&(x.current.style.backgroundColor=`var(--rpv-core__full-screen-target-background-color)`),g.current=n(),h.current={height:window.innerHeight,width:window.innerWidth};break;case e.FullScreenMode.Entered:r()===e.ScrollMode.Page?i(g.current).then((function(){l(e.FullScreenMode.EnteredCompletely)})):l(e.FullScreenMode.EnteredCompletely);break;case e.FullScreenMode.Exitting:x.current&&=(x.current.style.backgroundColor=``,null),g.current=n();break;case e.FullScreenMode.Exited:l(e.FullScreenMode.Normal),r()===e.ScrollMode.Page&&i(g.current)}}),[c]),a.useEffect((function(){if(c!==e.FullScreenMode.Normal)return c===e.FullScreenMode.Entering&&u.height===f.height&&u.width===f.width&&u.height>0&&u.width>0&&(_.current.height===0||u.height==_.current.height)?(_.current={height:window.innerHeight,width:window.innerWidth},void l(e.FullScreenMode.Entered)):void(c===e.FullScreenMode.Exitting&&h.current.height===u.height&&h.current.width===u.width&&u.height>0&&u.width>0&&l(e.FullScreenMode.Exited))}),[c,u,f]),a.useEffect((function(){var e;return e=j,T&&document.addEventListener(E.FullScreenChange,e),function(){(function(e){T&&document.removeEventListener(E.FullScreenChange,e)})(j)}}),[y]),{enterFullScreenMode:C,exitFullScreenMode:w,fullScreenMode:c}},kt={buildPageStyles:function(){return{}},transformSize:function(e){return e.size}},At={left:0,top:0},jt=function(t){var n=t.currentFile,r=t.defaultScale,i=t.doc,o=t.enableSmoothScroll,s=t.initialPage,c=t.initialRotation,l=t.initialScale,d=t.pageLayout,h=t.pageSizes,g=t.plugins,_=t.renderPage,v=t.scrollMode,y=t.setRenderRange,b=t.viewMode,x=t.viewerState,S=t.onDocumentLoad,C=t.onOpenFile,w=t.onPageChange,T=t.onRotate,E=t.onRotatePage,D=t.onZoom,O=i.numPages,k=i.loadingTask.docId,N=a.useContext(L).l10n,P=a.useContext(f),I=P.direction===e.TextDirection.RightToLeft,R=a.useRef(),z=a.useRef(),B=a.useState(s),V=B[0],H=B[1],ee=a.useRef(null),U=Ct({getCurrentPage:function(){return q.current.pageIndex}}),te=a.useState(c),ne=te[0],re=te[1],ie=M(ne),ae=a.useState(!1),oe=ae[0],se=ae[1],ce=a.useState(new Map),le=ce[0],ue=ce[1],de=a.useState(v),W=de[0],fe=de[1],pe=M(W),me=a.useState(b),G=me[0],ge=me[1],ye=M(G),be=function(e){var t=j(),n=a.useState([]),r=n[0],i=n[1];return a.useEffect((function(){e.getOutline().then((function(e){t.current&&e!==null&&i(wt(e))}))}),[]),r}(i),Se=a.useState(l),K=Se[0],Ce=Se[1],we=M(K),q=a.useRef(x),J=a.useRef(typeof r==`string`?r:null),Te=a.useRef(-1),Y=a.useRef(-1),X=a.useRef(s),Z=Ot({getCurrentPage:function(){return q.current.pageIndex},getCurrentScrollMode:function(){return q.current.scrollMode},jumpToPage:function(e){return He(e)}
7,targetRef:z}),Ee=a.useState(-1),De=Ee[0],Oe=Ee[1],ke=a.useState(0),Ae=ke[0],je=ke[1],Q=F({doc:i});a.useEffect((function(){return function(){_e.clear(),ve.clear()}}),[k]);var Me=a.useMemo((function(){return Object.assign({},kt,d)}),[]),$=xt({enableSmoothScroll:o,isRtl:I,numberOfItems:O,parentRef:z,scrollMode:W,setRenderRange:y,sizes:a.useMemo((function(){return Array(O).fill(0).map((function(e,t){var n=[h[t].pageHeight,h[t].pageWidth],r=Math.abs(ne)%180==0?{height:n[0],width:n[1]}:{height:n[1],width:n[0]},i={height:r.height*K,width:r.width*K};return Me.transformSize({numPages:O,pageIndex:t,size:i})}))}),[ne,K]),viewMode:G});(function(e){var t=e.targetRef,n=e.onResize;m((function(){var e=new ResizeObserver((function(e){e.forEach((function(e){n(e.target)}))})),r=t.current;if(r)return e.observe(r),function(){e.unobserve(r)}}),[])})({targetRef:z,onResize:A((function(){!J.current||q.current.fullScreenMode!==e.FullScreenMode.Normal||s>0&&X.current===s||Ye(J.current)}),200)});var Ne=function(e){var t=e;g.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),q.current=t},Pe=function(){return z.current},Fe=function(){return q.current},Ie=a.useCallback((function(e){U.markVisitedDestination(e)}),[]),Le=a.useCallback((function(t){var n=t.pageIndex,r=t.bottomOffset,a=t.leftOffset,o=t.scaleTo,s=z.current,c=q.current;return s&&c?new Promise((function(t,l){xe(i,n).then((function(i){var l=i.getViewport({scale:1}),u=0,d=(typeof r==`function`?r(l.width,l.height):r)||0,f=(typeof a==`function`?a(l.width,l.height):a)||0,p=c.scale;switch(o){case e.SpecialZoomLevel.PageFit:u=0,f=0,Ye(e.SpecialZoomLevel.PageFit);break;case e.SpecialZoomLevel.PageWidth:p=St(s,h[n].pageHeight,h[n].pageWidth,e.SpecialZoomLevel.PageWidth,b,O),u=(l.height-d)*p,f*=p,Ye(p);break;default:u=(l.height-d)*p,f*=p}switch(c.scrollMode){case e.ScrollMode.Horizontal:$.scrollToItem(n,{left:f,top:0}).then((function(){t()}));break;case e.ScrollMode.Vertical:default:$.scrollToItem(n,{left:0,top:u}).then((function(){t()}))}}))})):Promise.resolve()}),[]),Re=a.useCallback((function(e){return U.markVisitedDestination(e),Le(e)}),[]),ze=a.useCallback((function(){var e=U.getNextDestination();return e?Le(e):Promise.resolve()}),[]),Be=a.useCallback((function(){var e=U.getPreviousDestination();return e?Le(e):Promise.resolve()}),[]),Ve=a.useCallback((function(){return $.scrollToNextItem(q.current.pageIndex,At)}),[]),He=a.useCallback((function(e){return 0<=e&&e<O?$.scrollToItem(e,At):Promise.resolve()}),[]),Ue=a.useCallback((function(){return $.scrollToPreviousItem(q.current.pageIndex,At)}),[]),We=a.useCallback((function(e){var t,n;(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():``).toLowerCase()===`pdf`&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){t(new Uint8Array(n.result))}})).then((function(t){C(e.name,t)}))}),[C]),Ge=a.useCallback((function(t){var n=t===e.RotateDirection.Backward?-90:90,r=q.current.rotation,a=r===360||r===-360?n:r+n;Q.markNotRendered(),re(a),Ne(u(u({},q.current),{rotation:a})),T({direction:t,doc:i,rotation:a})}),[]),Ke=a.useCallback((function(t,n){var r=n===e.RotateDirection.Backward?-90:90,a=q.current.pagesRotation,o=(a.has(t)?a.get(t):c)+r,s=a.set(t,o);ue(s),se((function(e){return!e})),Ne(u(u({},q.current),{pagesRotation:s,rotatedPage:t})),E({direction:n,doc:i,pageIndex:t,rotation:o}),Q.markRendering(t),Oe(t)}),[]),qe=a.useCallback((function(e){Ne(u(u({},q.current),{scrollMode:e})),fe(e)}),[]),Je=a.useCallback((function(e){Ne(u(u({},q.current),{viewMode:e})),ge(e)}),[]),Ye=a.useCallback((function(e){var t=z.current,n=q.current.pageIndex;if(!(n<0||n>=O)){var r=h[n].pageHeight,a=h[n].pageWidth,o=t?typeof e==`string`?St(t,r,a,e,q.current.viewMode,O):e:1;J.current=typeof e==`string`?e:null,o!==q.current.scale&&(je((function(e){return e+1})),Q.markNotRendered(),Ce(o),D({doc:i,scale:o}),Ne(u(u({},q.current),{scale:o})))}}),[]),Xe=a.useCallback((function(e){Z.enterFullScreenMode(e)}),[]),Ze=a.useCallback((function(){Z.exitFullScreenMode()}),[]);a.useEffect((function(){Ne(u(u({},q.current),{fullScreenMode:Z.fullScreenMode}))}),[Z.fullScreenMode]),a.useEffect((function(){var e={enterFullScreenMode:Xe,exitFullScreenMode:Ze,getPagesContainer:Pe,getViewerState:Fe,jumpToDestination:Re,jumpToNextDestination:ze,jumpToPreviousDestination:Be,jumpToNextPage:Ve,jumpToPreviousPage:Ue,jumpToPage:He,openFile:We,rotate:Ge,rotatePage:Ke,setViewerState:Ne,switchScrollMode:qe,switchViewMode:Je,zoom:Ye};return g.forEach((function(t){t.install&&t.install(e)})),function(){g.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[k]),a.useEffect((function(){S({doc:i,file:n}),g.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:i,file:n})}))}),[k]);
7var Qe,$e,et,tt=$.boundingClientRect;Qe=function(){s&&He(s)},$e=tt.height>0&&tt.width>0,et=a.useRef(!1),m((function(){$e&&!et.current&&(et.current=!0,Qe())}),[Qe,$e]),m((function(){var t=q.current.pageIndex;t>-1&&pe!==W&&$.scrollToItem(t,At).then((function(){Z.fullScreenMode===e.FullScreenMode.EnteredCompletely&&(o||Q.markNotRendered(),Te.current=-1)}))}),[W]),m((function(){var e=q.current.pageIndex;e>-1&&ie!==ne&&$.scrollToItem(e,At)}),[ne]),m((function(){we!=0&&we!=q.current.scale&&$.zoom(q.current.scale/we,q.current.pageIndex).then((function(){Z.fullScreenMode===e.FullScreenMode.EnteredCompletely&&(Y.current=-1)}))}),[K]),m((function(){if(ye!==q.current.viewMode){var e=$.startPage,t=$.endPage,n=$.virtualItems;Q.markNotRendered(),Q.setRange(e,t);for(var r=function(e){var t=n.find((function(t){return t.index===e}));t&&Q.setVisibility(e,t.visibility)},i=e;i<=t;i++)r(i);rt()}}),[G]),m((function(){var e=q.current.pageIndex;e>-1&&ye!==G&&$.scrollToItem(e,At)}),[G]),m((function(){var e=q.current.pageIndex;e>0&&e===s&&X.current===s&&J.current&&(X.current=-1,Ye(J.current))}),[V]),a.useEffect((function(){$.isSmoothScrolling||ee.current!==null&&ee.current===V||(ee.current=V,w({currentPage:V,doc:i}))}),[V,$.isSmoothScrolling]),a.useEffect((function(){Z.fullScreenMode===e.FullScreenMode.Entering&&q.current.scrollMode===e.ScrollMode.Page&&(Te.current=q.current.pageIndex),Z.fullScreenMode===e.FullScreenMode.EnteredCompletely&&q.current.scrollMode===e.ScrollMode.Page&&o&&(Te.current=-1),Z.fullScreenMode===e.FullScreenMode.EnteredCompletely&&J.current&&(Y.current=q.current.pageIndex,Ye(J.current))}),[Z.fullScreenMode]),a.useEffect((function(){if(Z.fullScreenMode!==e.FullScreenMode.Entering&&Z.fullScreenMode!==e.FullScreenMode.Exitting&&!$.isSmoothScrolling){var t=$.startPage,n=$.endPage,r=$.maxVisbilityIndex,i=$.virtualItems,a=r,o=Z.fullScreenMode===e.FullScreenMode.Entered||Z.fullScreenMode===e.FullScreenMode.EnteredCompletely;if(!(o&&a!==Te.current&&Te.current>-1||o&&a!==Y.current&&Y.current>-1)){H(a),Ne(u(u({},q.current),{pageIndex:a})),Q.setRange(t,n);for(var s=function(e){var t=i.find((function(t){return t.index===e}));t&&Q.setVisibility(e,t.visibility)},c=t;c<=n;c++)s(c);rt()}}}),[$.startPage,$.endPage,$.isSmoothScrolling,$.maxVisbilityIndex,Z.fullScreenMode,oe,ne,K]);var nt=a.useCallback((function(e){Q.markRendered(e),rt()}),[Ae]),rt=function(){var e=Q.getHighestPriorityPage();e>-1&&Q.isInRange(e)&&(Q.markRendering(e),Oe(e))},at=function(e){var t=V-1,n=V+1;switch(e){case`FirstPage`:He(0);break;case`LastPage`:He(O-1);break;case`NextPage`:n<O&&He(n);break;case`PrevPage`:t>=0&&He(t)}},ot=a.useCallback((function(){var t=$.virtualItems,n=[];switch(G){case e.ViewMode.DualPage:n=he(t,2);break;case e.ViewMode.DualPageWithCover:t.length&&(n=t[0].index===0?[[t[0]]].concat(he(t.slice(1),2)):he(t,2));break;case e.ViewMode.SinglePage:default:n=he(t,1)}var r=N&&N.core?N.core.pageLabel:`Page {{pageIndex}}`,o={attrs:{className:`rpv-core__inner-container`,"data-testid":`core__inner-container`,ref:R,style:{height:`100%`}},children:a.createElement(a.Fragment,null),subSlot:{attrs:{"data-testid":`core__inner-pages`,className:p({"rpv-core__inner-pages":!0,"rpv-core__inner-pages--horizontal":W===e.ScrollMode.Horizontal,"rpv-core__inner-pages--rtl":I,"rpv-core__inner-pages--single":W===e.ScrollMode.Page,"rpv-core__inner-pages--vertical":W===e.ScrollMode.Vertical,"rpv-core__inner-pages--wrapped":W===e.ScrollMode.Wrapped}),ref:z,style:{height:`100%`,position:`relative`}},children:a.createElement(`div`,{"data-testid":`core__inner-current-page-${V}`,style:Object.assign({"--scale-factor":K},$.getContainerStyles())},n.map((function(t){return a.createElement(`div`,{className:p({"rpv-core__inner-page-container":!0,"rpv-core__inner-page-container--single":W===e.ScrollMode.Page}),style:$.getItemContainerStyles(t[0]),key:`${t[0].index}-${G}`},t.map((function(t){var n=G===e.ViewMode.DualPageWithCover&&(t.index===0||O%2==0&&t.index===O-1);return a.createElement(`div`,{"aria-label":r.replace(`{{pageIndex}}`,`${t.index+1}`),className:p({"rpv-core__inner-page":!0,"rpv-core__inner-page--dual-even":G===e.ViewMode.DualPage&&t.index%2==0,"rpv-core__inner-page--dual-odd":G===e.ViewMode.DualPage&&t.index%2==1,"rpv-core__inner-page--dual-cover":n,"rpv-core__inner-page--dual-cover-even":G===e.ViewMode.DualPageWithCover&&!n&&t.index%2==0,"rpv-core__inner-page--dual-cover-odd":G===e.ViewMode.DualPageWithCover&&!n&&t.index%2==1,"rpv-core__inner-page--single":G===e.ViewMode.SinglePage&&W===e.ScrollMode.Page}),role:`region`,key:`${t.index}-${G}`,style:Object.assign({},$.getItemStyles(t),Me.buildPageStyles({numPages:O,pageIndex:t.index,scrollMode:W,viewMode:G}))},a.createElement(it,{doc:i,measureRef:t.measureRef,outlines:be,pageIndex:t.index,pageRotation:le.has(t.index)?le.get(t.index):0,pageSize:h[t.index],plugins:g,renderPage:_,renderQueueKey:Ae,rotation:ne,scale:K,shouldRender:De===t.index,viewMode:G,onExecuteNamedAction:at,onJumpFromLinkAnnotation:Ie,onJumpToDest:Re,onRenderCompleted:nt,onRotatePage:Ke}))})))})))}};return g.forEach((function(e){e.renderViewer&&(o=e.renderViewer({containerRef:R,doc:i,pagesContainerRef:z,pagesR
7otation:le,pageSizes:h,rotation:ne,slot:o,themeContext:P,jumpToPage:He,openFile:We,rotate:Ge,rotatePage:Ke,switchScrollMode:qe,switchViewMode:Je,zoom:Ye}))})),o}),[g,$]),st=a.useCallback((function(e){return a.createElement(`div`,u({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&st(e.subSlot))}),[]);return st(ot())},Mt=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],Nt=function(t){var n=t.defaultScale,r=t.doc,i=t.render,o=t.scrollMode,s=t.viewMode,c=a.useRef(),l=a.useState({pageSizes:[],scale:0}),u=l[0],d=l[1];return a.useLayoutEffect((function(){var t=Array(r.numPages).fill(0).map((function(e,t){return new Promise((function(e,n){xe(r,t).then((function(t){var n=t.getViewport({scale:1});e({pageHeight:n.height,pageWidth:n.width,rotation:n.rotation})}))}))}));Promise.all(t).then((function(t){var i=c.current;if(i&&t.length!==0){var a=t[0].pageWidth,l=t[0].pageHeight,u=i.parentElement,f=(u.clientWidth-45)/a,p=(u.clientHeight-45)/l,m=f;switch(o){case e.ScrollMode.Horizontal:m=Math.min(f,p);break;case e.ScrollMode.Vertical:default:m=f}var h,g;d({pageSizes:t,scale:n?typeof n==`string`?St(u,l,a,n,s,r.numPages):n:(h=m,(g=Mt.findIndex((function(e){return e>=h})))===-1||g===0?h:Mt[g-1])})}}))}),[r.loadingTask.docId]),u.pageSizes.length===0||u.scale===0?a.createElement(`div`,{className:`rpv-core__page-size-calculator`,"data-testid":`core__page-size-calculating`,ref:c},a.createElement(y,null)):i(u.pageSizes,u.scale)},Pt=function(){},Ft=function(e){function t(t,n){var r=e.call(this)||this;return r.verifyPassword=t,r.passwordStatus=n,r}return c(t,e),t}(Pt),It=function(t){var n=t.passwordStatus,r=t.renderProtectedView,i=t.verifyPassword,o=t.onDocumentAskPassword,s=a.useContext(L).l10n,c=a.useState(``),l=c[0],u=c[1],d=a.useContext(f).direction===e.TextDirection.RightToLeft,m=function(){return i(l)};return a.useEffect((function(){o&&o({verifyPassword:i})}),[]),r?r({passwordStatus:n,verifyPassword:i}):a.createElement(`div`,{className:`rpv-core__asking-password-wrapper`},a.createElement(`div`,{className:p({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":d})},a.createElement(`div`,{className:`rpv-core__asking-password-message`},n===e.PasswordStatus.RequiredPassword&&s.core.askingPassword.requirePasswordToOpen,n===e.PasswordStatus.WrongPassword&&s.core.wrongPassword.tryAgain),a.createElement(`div`,{className:`rpv-core__asking-password-body`},a.createElement(`div`,{className:p({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!d,"rpv-core__asking-password-input--rtl":d})},a.createElement(b,{testId:`core__asking-password-input`,type:`password`,value:l,onChange:u,onKeyDown:function(e){e.key===`Enter`&&m()}})),a.createElement(v,{onClick:m},s.core.askingPassword.submit))))},Lt=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return c(t,e),t}(Pt),Rt=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return c(t,e),t}(Pt),zt=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return c(t,e),t}(Pt),Bt=function(t){var n=t.characterMap,r=t.file,i=t.httpHeaders,s=t.render,c=t.renderError,l=t.renderLoader,u=t.renderProtectedView,d=t.transformGetDocumentParams,m=t.withCredentials,h=t.onDocumentAskPassword,g=a.useContext(f).direction===e.TextDirection.RightToLeft,_=a.useState(new zt(0)),v=_[0],b=_[1],x=a.useRef(``),S=j();return a.useEffect((function(){x.current=``,b(new zt(0));var t=new o.PDFWorker({name:`PDFWorker_${Date.now()}`}),a=Object.assign({httpHeaders:i,withCredentials:m,worker:t},typeof r==`string`?{url:r}:{data:r},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),s=d?d(a):a,c=o.getDocument(s);return c.onPassword=function(t,n){switch(n){case o.PasswordResponses.NEED_PASSWORD:S.current&&b(new Ft(t,e.PasswordStatus.RequiredPassword));break;case o.PasswordResponses.INCORRECT_PASSWORD:S.current&&b(new Ft(t,e.PasswordStatus.WrongPassword))}},c.onProgress=function(e){var t=e.total>0?Math.min(100,100*e.loaded/e.total):100;S.current&&x.current===``&&b(new zt(t))},c.promise.then((function(e){x.current=e.loadingTask.docId,S.current&&b(new Lt(e))}
7),(function(e){return S.current&&!t.destroyed&&b(new Rt({message:e.message||`Cannot load document`,name:e.name}))})),function(){c.destroy(),t.destroy()}}),[r]),v instanceof Ft?a.createElement(It,{passwordStatus:v.passwordStatus,renderProtectedView:u,verifyPassword:v.verifyPassword,onDocumentAskPassword:h}):v instanceof Lt?s(v.doc):v instanceof Rt?c?c(v.error):a.createElement(`div`,{className:p({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":g})},a.createElement(`div`,{className:`rpv-core__doc-error-text`},v.error.message)):a.createElement(`div`,{"data-testid":`core__doc-loading`,className:p({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":g})},l?l(v.percentages):a.createElement(y,null))},Vt=function(e,t){var n=a.useMemo((function(){return e===`auto`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}),[]),r=a.useState(n),i=r[0],o=r[1],s=M(i);return a.useEffect((function(){if(e===`auto`){var t=window.matchMedia(`(prefers-color-scheme: dark)`),n=function(e){o(e.matches?`dark`:`light`)};return t.addEventListener(`change`,n),function(){return t.removeEventListener(`change`,n)}}}),[]),a.useEffect((function(){i!==s&&t&&t(i)}),[i]),a.useEffect((function(){e!==i&&o(e)}),[e]),{currentTheme:i,setCurrentTheme:o}},Ht=function(e){return{startPage:e.startPage-3,endPage:e.endPage+3}};e.Button=function(t){var n=t.children,r=t.testId,i=t.onClick,o=a.useContext(f).direction===e.TextDirection.RightToLeft,s=r?{"data-testid":r}:{};return a.createElement(`button`,u({className:p({"rpv-core__button":!0,"rpv-core__button--rtl":o}),type:`button`,onClick:i},s),n)},e.Icon=g,e.LazyRender=function(e){var t=e.attrs,n=e.children,r=e.testId,i=a.useState(!1),o=i[0],s=i[1],c=r?u(u({},t),{"data-testid":r}):t,l=h({once:!0,onVisibilityChanged:function(e){e.isVisible&&s(!0)}});return a.createElement(`div`,u({ref:l},c),o&&n)},e.LocalizationContext=L,e.Menu=function(t){var n=t.children,r=a.useRef(),i=a.useRef([]),o=a.useContext(f).direction===e.TextDirection.RightToLeft,s=function(e){if(r.current)switch(e.key){case`Tab`:e.preventDefault();break;case`ArrowDown`:e.preventDefault(),c((function(e,t){return t+1}));break;case`ArrowUp`:e.preventDefault(),c((function(e,t){return t-1}));break;case`End`:e.preventDefault(),c((function(e,t){return e.length-1}));break;case`Home`:e.preventDefault(),c((function(e,t){return 0}))}},c=function(e){if(r.current){var t=i.current,n=t.findIndex((function(e){return e.getAttribute(`tabindex`)===`0`})),a=Math.min(t.length-1,Math.max(0,e(t,n)));n>=0&&n<=t.length-1&&t[n].setAttribute(`tabindex`,`-1`),t[a].setAttribute(`tabindex`,`0`),t[a].focus()}};return m((function(){var e=r.current;e&&(i.current=function(e){var t=[];return e.querySelectorAll(`.rpv-core__menu-item[role="menuitem"]`).forEach((function(n){if(n instanceof HTMLElement){var r=n.parentElement;(r===e||window.getComputedStyle(r).display!==`none`)&&t.push(n)}})),t}(e))}),[]),m((function(){return document.addEventListener(`keydown`,s),function(){document.removeEventListener(`keydown`,s)}}),[]),a.createElement(`div`,{ref:r,"aria-orientation":`vertical`,className:p({"rpv-core__menu":!0,"rpv-core__menu--rtl":o}),role:`menu`,tabIndex:0},n)},e.MenuDivider=function(){return a.createElement(`div`,{"aria-orientation":`horizontal`,className:`rpv-core__menu-divider`,role:`separator`})},e.MenuItem=function(t){var n=t.checked,r=n!==void 0&&n,i=t.children,o=t.icon,s=o===void 0?null:o,c=t.isDisabled,l=c!==void 0&&c,d=t.testId,m=t.onClick,h=a.useContext(f).direction===e.TextDirection.RightToLeft,g=d?{"data-testid":d}:{};return a.createElement(`button`,u({className:p({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":l,"rpv-core__menu-item--ltr":!h,"rpv-core__menu-item--rtl":h}),role:`menuitem`,tabIndex:-1,type:`button`,onClick:m},g),a.createElement(`div`,{className:p({"rpv-core__menu-item-icon":!0,"rpv-core__menu-item-icon--ltr":!h,"rpv-core__menu-item-icon--rtl":h})},s),a.createElement(`div`,{className:p({"rpv-core__menu-item-label":!0,"rpv-core__menu-item-label--ltr":!h,"rpv-core__menu-item-label--rtl":h})},i),a.createElement(`div`,{className:p({"rpv-core__menu-item-check":!0,"rpv-core__menu-item-check--ltr":!h,"rpv-core__menu-item-check--rtl":h})},r&&a.createElement(_,null)))},e.MinimalButton=function(t){var n=t.ariaLabel,r=n===void 0?``:n,i=t.ariaKeyShortcuts,o=i===void 0?``:i,s=t.children,c=t.isDisabled,l=c!==void 0&&c,d=t.isSelected,m=d!==void 0&&d,h=t.testId,g=t.onClick,_=a.useContext(f).direction===e.TextDirection.RightToLeft,v=h?{"data-testid":h}:{};return a.createElement(`button`,u({"aria-label":r},o&&{"aria-keyshortcuts":o},l&&{"aria-disabled":!0},{className:p({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":l,"rpv-core__minimal-button--rtl":_,"rpv-core__minimal-button--selected":m}),type:`button`,onClick:g},v),s)}
7,e.Modal=function(e){var t=e.ariaControlsSuffix,n=e.closeOnClickOutside,r=e.closeOnEscape,i=e.content,o=e.isOpened,s=o!==void 0&&o,c=e.target,l=t||`${z()}`;return a.createElement(ne,{target:c?function(e,t){return a.createElement(`div`,{"aria-expanded":t?`true`:`false`,"aria-haspopup":`dialog`,"aria-controls":`rpv-core__modal-body-${l}`},c(e,t))}:null,content:function(e){return a.createElement(ee,null,a.createElement(H,{ariaControlsSuffix:l,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},i(e)))},isOpened:s})},e.Popover=function(e){var t=e.ariaHasPopup,n=t===void 0?`dialog`:t,r=e.ariaControlsSuffix,i=e.closeOnClickOutside,o=e.closeOnEscape,s=e.content,c=e.lockScroll,l=c===void 0||c,u=e.offset,d=e.position,f=e.target,p=te(!1),m=p.opened,h=p.toggle,g=a.useRef(),_=a.useMemo((function(){return r||`${z()}`}),[]);return a.createElement(`div`,{ref:g,"aria-expanded":m?`true`:`false`,"aria-haspopup":n,"aria-controls":`rpv-core__popver-body-${_}`},f(h,m),m&&a.createElement(a.Fragment,null,l&&a.createElement(pe,{closeOnEscape:o,onClose:h}),a.createElement(fe,{ariaControlsSuffix:_,closeOnClickOutside:i,offset:u,position:d,targetRef:g,onClose:h},s(h))))},e.PrimaryButton=v,e.ProgressBar=function(t){var n=t.progress,r=a.useContext(f).direction===e.TextDirection.RightToLeft;return a.createElement(`div`,{className:p({"rpv-core__progress-bar":!0,"rpv-core__progress-bar--rtl":r})},a.createElement(`div`,{className:`rpv-core__progress-bar-progress`,style:{width:`${n}%`}},n,`%`))},e.Separator=function(){return a.createElement(`div`,{className:`rpv-core__separator`})},e.Spinner=y,e.Splitter=function(t){var n=t.constrain,r=a.useContext(f).direction===e.TextDirection.RightToLeft,i=a.useRef(),o=a.useRef(),s=a.useRef(),c=a.useRef(0),l=a.useRef(0),u=a.useRef(0),d=a.useRef(0),p={capture:!0},m=function(e){var t=i.current,a=o.current,l=s.current;if(t&&a&&l){var f=d.current,p=e.clientX-c.current,m=u.current+(r?-p:p),h=t.parentElement.getBoundingClientRect().width,g=100*m/h;if(t.classList.add(`rpv-core__splitter--resizing`),n){var _=h-m-f;if(!n({firstHalfPercentage:g,firstHalfSize:m,secondHalfPercentage:100*_/h,secondHalfSize:_}))return}a.style.width=`${g}%`,document.body.classList.add(`rpv-core__splitter-body--resizing`),a.classList.add(`rpv-core__splitter-sibling--resizing`),l.classList.add(`rpv-core__splitter-sibling--resizing`)}},h=function(e){var t=i.current,n=o.current,r=s.current;t&&n&&r&&(document.body.classList.remove(`rpv-core__splitter-body--resizing`),t.classList.remove(`rpv-core__splitter--resizing`),n.classList.remove(`rpv-core__splitter-sibling--resizing`),r.classList.remove(`rpv-core__splitter-sibling--resizing`),document.removeEventListener(`mousemove`,m,p),document.removeEventListener(`mouseup`,h,p))};return a.useEffect((function(){var e=i.current;e&&(d.current=e.getBoundingClientRect().width,o.current=e.previousElementSibling,s.current=e.nextElementSibling)}),[]),a.createElement(`div`,{ref:i,className:`rpv-core__splitter`,onMouseDown:function(e){var t=o.current;t&&(c.current=e.clientX,l.current=e.clientY,u.current=t.getBoundingClientRect().width,document.addEventListener(`mousemove`,m,p),document.addEventListener(`mouseup`,h,p))}})},e.TextBox=b,e.ThemeContext=f,e.Tooltip=function(t){var n=t.ariaControlsSuffix,r=t.content,i=t.offset,o=t.position,s=t.target,c=te(!1),l=c.opened,u=c.toggle,d=a.useRef(),f=a.useRef(),p=a.useMemo((function(){return n||`${z()}`}),[]);V((function(){d.current&&document.activeElement&&d.current.contains(document.activeElement)&&h()}));var m=function(){u(e.ToggleStatus.Open)},h=function(){u(e.ToggleStatus.Close)};return a.createElement(a.Fragment,null,a.createElement(`div`,{ref:d,"aria-describedby":`rpv-core__tooltip-body-${p}`,onBlur:function(e){e.relatedTarget instanceof HTMLElement&&e.currentTarget.parentElement&&e.currentTarget.parentElement.contains(e.relatedTarget)?f.current&&(f.current.style.display=`none`):h()},onFocus:m,onMouseEnter:m,onMouseLeave:h},s),l&&a.createElement(me,{ariaControlsSuffix:p,contentRef:f,offset:i,position:o,targetRef:d},r()))},e.Viewer=function(t){var n=t.characterMap,r=t.defaultScale,i=t.enableSmoothScroll,o=i===void 0||i,s=t.fileUrl,c=t.httpHeaders,l=c===void 0?{}:c,u=t.initialPage,d=u===void 0?0:u,p=t.pageLayout,m=t.initialRotation,g=m===void 0?0:m,_=t.localization,v=t.plugins,y=v===void 0?[]:v,b=t.renderError,x=t.renderLoader,S=t.renderPage,C=t.renderProtectedView,w=t.scrollMode,T=w===void 0?e.ScrollMode.Vertical:w,E=t.setRenderRange,D=E===void 0?Ht:E,O=t.transformGetDocumentParam
7s,k=t.theme,A=k===void 0?{direction:e.TextDirection.LeftToRight,theme:`light`}:k,j=t.viewMode,N=j===void 0?e.ViewMode.SinglePage:j,P=t.withCredentials,F=P!==void 0&&P,R=t.onDocumentAskPassword,z=t.onDocumentLoad,B=z===void 0?function(){}:z,V=t.onPageChange,H=V===void 0?function(){}:V,ee=t.onRotate,U=ee===void 0?function(){}:ee,te=t.onRotatePage,ne=te===void 0?function(){}:te,re=t.onSwitchTheme,ie=re===void 0?function(){}:re,ae=t.onZoom,oe=ae===void 0?function(){}:ae,se=a.useState({data:s,name:typeof s==`string`?s:``,shouldLoad:!1}),ce=se[0],le=se[1],ue=function(e,t){le({data:t,name:e,shouldLoad:!0})},de=a.useState(!1),W=de[0],fe=de[1],pe=M(ce);a.useEffect((function(){var e=pe.data,t,n,r=typeof(t=s);(n=typeof e)==`string`&&r===`string`&&e===t||n===`object`&&r===`object`&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))||le({data:s,name:typeof s==`string`?s:``,shouldLoad:W})}),[s,W]);var me=h({onVisibilityChanged:function(e){fe(e.isVisible),e.isVisible&&le((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),G=typeof A==`string`?{direction:e.TextDirection.LeftToRight,theme:A}:A,he=a.useState(_||I),ge=he[0],_e=he[1],ve={l10n:ge,setL10n:_e},ye=Object.assign({},{direction:G.direction},Vt(G.theme||`light`,ie));return a.useEffect((function(){_&&_e(_)}),[_]),a.createElement(L.Provider,{value:ve},a.createElement(f.Provider,{value:ye},a.createElement(`div`,{ref:me,className:`rpv-core__viewer rpv-core__viewer--${ye.currentTheme}`,"data-testid":`core__viewer`,style:{height:`100%`,width:`100%`}},ce.shouldLoad&&a.createElement(Bt,{characterMap:n,file:ce.data,httpHeaders:l,render:function(t){return a.createElement(Nt,{defaultScale:r,doc:t,render:function(n,i){return a.createElement(jt,{currentFile:{data:ce.data,name:ce.name},defaultScale:r,doc:t,enableSmoothScroll:o,initialPage:d,initialRotation:g,initialScale:i,pageLayout:p,pageSizes:n,plugins:y,renderPage:S,scrollMode:T,setRenderRange:D,viewMode:N,viewerState:{file:ce,fullScreenMode:e.FullScreenMode.Normal,pageIndex:-1,pageHeight:n[0].pageHeight,pageWidth:n[0].pageWidth,pagesRotation:new Map,rotation:g,scale:i,scrollMode:T,viewMode:N},onDocumentLoad:B,onOpenFile:ue,onPageChange:H,onRotate:U,onRotatePage:ne,onZoom:oe})},scrollMode:T,viewMode:N})},renderError:b,renderLoader:x,renderProtectedView:C,transformGetDocumentParams:O,withCredentials:F,onDocumentAskPassword:R}))))},e.Worker=function(e){var t=e.children,n=e.workerUrl;return o.GlobalWorkerOptions.workerSrc=n,a.createElement(a.Fragment,null,t)},e.chunk=he,e.classNames=p,e.createStore=function(e){var t=e||{},n={},r=function(e,r){var i;t=u(u({},t),((i={})[e]=r,i)),(n[e]||[]).forEach((function(n){return n(t[e])}))},i=function(e){return t[e]};return{subscribe:function(e,t){n[e]=(n[e]||[]).concat(t)},unsubscribe:function(e,t){n[e]=(n[e]||[]).filter((function(e){return e!==t}))},update:function(e,t){r(e,t)},updateCurrentValue:function(e,t){var n=i(e);n!==void 0&&r(e,t(n))},get:function(e){return i(e)}}},e.getDestination=Se,e.getPage=xe,e.isFullScreenEnabled=D,e.isMac=function(){return typeof window<`u`&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},e.useDebounceCallback=A,e.useIntersectionObserver=h,e.useIsMounted=j,e.useIsomorphicLayoutEffect=m,e.usePrevious=M,e.useRenderQueue=F})),require_lib$17=__commonJSMin(((e,t)=>{t.exports=require_core_min()})),scriptRel=`modulepreload`,assetsURL=function(e){return`/`+e},seen={},__vitePreload=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=assetsURL(t,n),t in seen)return;seen[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:scriptRel,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n
7)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},pdf_worker_min_default=`/assets/pdf.worker.min-DKQKFyKK.js`,isNodeJS=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),BBOX_INIT=[1/0,1/0,-1/0,-1/0],F32_BBOX_INIT=new Float32Array(BBOX_INIT),FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],SVG_NS=`http://www.w3.org/2000/svg`,RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},AnnotationPrefix=`pdfjs_internal_id_`,AnnotationEditorPrefix=`pdfjs_internal_editor_`,AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},AnnotationEditorParamsType={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},VerbosityLevel={ERRORS:0,WARNINGS:1,INFOS:5},OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},DrawOPS={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},verbosity=VerbosityLevel.WARNINGS;function setVerbosityLevel(e){Number.isInteger(e)&&(verbosity=e)}function getVerbosityLevel(){return verbosity}function info(e){verbosity>=VerbosityLevel.INFOS&&console.info(`Info: ${e}`)}function warn(e){verbosity>=VerbosityLevel.WARNINGS&&console.warn(`Warning: ${e}`)}function unreachable(e){throw Error(e)}function assert(e,t){e||unreachable(t)}
vendor: 17,187 bytes, line 7
7function _isValidProtocol(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function createValidAbsoluteUrl(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=stringToUTF8String(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return _isValidProtocol(r)?r:null}function updateUrlHash(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&createValidAbsoluteUrl(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function stripPath(e){return e.substring(e.lastIndexOf(`/`)+1)}function shadow(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var BaseException=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),PasswordException=class extends BaseException{constructor(e,t){super(e,`PasswordException`),this.code=t}},UnknownErrorException=class extends BaseException{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},InvalidPDFException=class extends BaseException{constructor(e){super(e,`InvalidPDFException`)}},ResponseException=class extends BaseException{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},FormatError=class extends BaseException{constructor(e){super(e,`FormatError`)}},AbortException=class extends BaseException{constructor(e){super(e,`AbortException`)}};function bytesToString(e){(typeof e!=`object`||e?.length===void 0)&&unreachable(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function stringToBytes(e){typeof e!=`string`&&unreachable(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}var FeatureTest=class{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let t=new Uint32Array(e.buffer,0,1);return shadow(this,`isLittleEndian`,t[0]===1)}static get isOffscreenCanvasSupported(){return shadow(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return shadow(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return shadow(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return shadow(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return shadow(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported?e=new OffscreenCanvas(1,1).getContext(`2d`):typeof document<`u`&&(e=document.createElement(`canvas`).getContext(`2d`)),shadow(this,`isCanvasFilterSupported`,e?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>`u`)return shadow(this,`isAlphaColorInputSupported`,!1);let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,shadow(this,`isAlphaColorInputSupported`,e.value!==`#ff0000`)}static get isBackdropFilterSupported(){return shadow(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},Util=class{static get hexNums(){return shadow(this,`hexNums`,Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static#e(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}static#t(e,t,n,r,i,a,o,s,c,l,u,d){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,n,r,i,a,o,s,-u/l,d);return}let f=l**2-4*u*c;if(f<0)return;let p=Math.sqrt(f),m=2*c;this.#e(e,t,n,r,i,a,o,s,(-l+p)/m,d),this.#e(e,t,n,r,i,a,o,s,(-l-p)/m,d)}static bezierBoundingBox(e,t,n,r,i,a,o,s,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,s),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,s),this.#t(e,n,i,o,t,r,a,s,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),c),this.#t(e,n,i,o,t,r,a,s,3*(-t+3*(r-a)+s),6*(t-2*r+a),3*(r-t),c)}};function stringToUTF8String(e){return decodeURIComponent(escape(e))}var NormalizeRegex=null,NormalizationMap=null;function normalizeUnicode(e){return NormalizeRegex||(NormalizeRegex=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,NormalizationMap=new Map([[`ï¬
`,`ſt`]])),e.replaceAll(NormalizeRegex,(e,t,n)=>t?t.normalize(`NFKC`):NormalizationMap.get(n))}function getUuid(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),bytesToString(e)}function _isValidExplicitDest(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}var makeArr=()=>[],makeMap=()=>new Map,makeObj=()=>Object.create(null),makeSet=()=>new Set;typeof Iterator.prototype.join!=`function`&&(Iterator.prototype.join=function(e){return[...this].join(e)});function MathClamp(e,t,n){return Math.min(Math.max(e,t),n)}var PageViewport=class e{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=a,n*=t;let s=(e[2]+e[0])/2,c=(e[3]+e[1])/2,l,u,d,f;switch(r%=360,r<0&&(r+=360),r){case 180:l=-1,u=0,d=0,f=1;break;case 90:l=0,u=1,d=1,f=0;break;case 270:l=0,u=-1,d=-1,f=0;break;case 0:l=1,u=0,d=0,f=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}o&&(d=-d,f=-f);let p,m,h,g;l===0?(p=Math.abs(c-e[1])*n+i,m=Math.abs(s-e[0])*n+a,h=(e[3]-e[1])*n,g=(e[2]-e[0])*n):(p=Math.abs(s-e[0])*n+i,m=Math.abs(c-e[1])*n+a,h=(e[2]-e[0])*n,g=(e[3]-e[1])*n),this.transform=[l*n,u*n,d*n,f*n,p-l*n*s-d*n*c,m-u*n*s-f*n*c],this.width=h,this.height=g}get rawDims(){let e=this.viewBox;return shadow(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:t=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new e({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:n,offsetX:r,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){let n=[e,t];return Util.applyTransform(n,this.transform),n}convertToPdfPoint(e,t){let n=[e,t];return Util.applyInverseTransform(n,this.transform),n}},XfaText=class e{static textContent(t){let n=[],r={items:n,styles:Object.create(null)};function i(t){if(!t)return;let r=null,a=t.name;if(a===`#text`)r=t.value;else if(e.shouldBuildText(a))t?.attributes?.textContent?r=t.attributes.textContent:t.value&&(r=t.value);else return;if(r!==null&&n.push({str:r}),t.children)for(let e of t.children)i(e)}return i(t),r}static shouldBuildText(e){return!(e===`textarea`||e===`input`||e===`option`||e===`select`)}},disallowedRichTextStyleRegExp=/url\(|image-set\(/i,disallowedEventHandlerAttrRegExp=/^on/i,XfaLayer=class{static get _allowedHtmlElements(){return shadow(this,`_allowedHtmlElements`,new Set([`a`,`b`,`br`,`button`,`div`,`i`,`img`,`input`,`label`,`li`,`ol`,`option`,`p`,`select`,`span`,`sub`,`sup`,`textarea`,`ul`]))}static get _allowedSvgElements(){return shadow(this,`_allowedSvgElements`,new Set([`ellipse`,`line`,`path`,`rect`,`svg`]))}static get _allowedRichTextElements(){return shadow(this,`_allowedRichTextElements`,new Set([`a`,`b`,`br`,`div`,`i`,`li`,`ol`,`p`,`span`,`sub`,`sup`,`ul`]))}static get _allowedRichTextAttributes(){return shadow(this,`_allowedRichTextAttributes`,new Set([`class`,`dir`,`style`]))}static get _allowedRichTextStyles(){return shadow(this,`_allowedRichTextStyles`,new Set(`color.font.fontFamily.fontSize.fontStretch.fontStyle.fontWeight.kerningMode.letterSpacing.lineHeight.margin.marginBottom.marginLeft.marginRight.marginTop.orphans.paddingLeft.paddingRight.breakAfter.breakBefore.breakInside.tabInterval.tabStop.textAlign.textDecoration.textIndent.transform.verticalAlign.widows`.split(`.`)))}static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null&&!disallowedEventHandlerAttrRegExp.test(t)&&!(r===`richText`&&!this._allowedRichTextAttributes.has(t)))switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:if(r===`richText`){let t=this._allowedRichTextStyles;for(let[r,i]of Object.entries(n))t.has(r)&&!disallowedRichTextStyleRegExp.test(i)&&(e.style[r]=i)}else Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i?.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static#e(e,t,n){return n===`richText`?!t&&this._allowedRichTextElements.has(e)?document.createElement(e):null:t?t===SVG_NS&&this._allowedSvgElements.has(e)?document.createElementNS(SVG_NS,e):null:this._allowedHtmlElements.has(e)?document.createElement(e):null}static render(e){let t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||`display`,a=this.#e(r.name,r.attributes?.xmlns,i)??document.createElement(`div`);r.attributes&&this.setAttributes({html:a,element:r,intent:i,linkService:n});let o=i!==`richText`,s=e.div;if(s.append(a),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;s.style.transform=t}o&&s.setAttribute(`class`,`xfaLayer xfaFont`);let c=[];if(r.children.length===0){if(r.value){let e=document.createTextNode(r.value);a.append(e),o&&XfaText.shouldBuildText(r.name)&&c.push(e)}return{textDivs:c}}let l=[[r,-1,a]];for(;l.length>0;){let[e,r,a]=l.at(-1);if(r+1===e.children.length){l.pop();continue}let s=e.children[++l.at(-1)[1]];if(s===null)continue;let{name:u}=s;if(u===`#text`){let e=document.createTextNode(s.value);c.push(e),a.append(e);continue}let d=this.#e(u,s.attributes?.xmlns,i);if(d){if(a.append(d),s.attributes&&this.setAttributes({html:d,element:s,storage:t,intent:i,linkService:n}),s.children?.length>0)l.push([s,-1,d]);else if(s.value){let e=document.createTextNode(s.value);o&&XfaText.shouldBuildText(u)&&c.push(e),d.append(e)}}}for(let e of s.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:c}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}static getPageViewport(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new PageViewport({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}},PixelsPerInch=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function fetchData(e,t=`text`){if(isValidFetchUrl(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);switch(t){case`blob`:return n.blob();case`bytes`:return n.bytes();case`json`:return n.json()}return n.text()}return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.responseType=t===`bytes`?`arraybuffer`:t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case`bytes`:n(new Uint8Array(i.response));return;case`blob`:case`json`:n(i.response);return}n(i.responseText);return}r(Error(i.statusText))}},i.send(null)})}var RenderingCancelledException=class extends BaseException{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}};function isDataScheme(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function isPdfFile(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function getFilenameFromUrl(e){return[e]=e.split(/[#?]/,1),stripPath(e)}function getPdfFilenameFromUrl(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(isDataScheme(e))return warn(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=(e=>{try{return new URL(e)}catch{}try{return new URL(decodeURIComponent(e))}catch{}try{return new URL(e,`https://foo.bar`)}catch{}try{return new URL(decodeURIComponent(e),`https://foo.bar`)}catch{}return null})(e);if(!n)return t;let r=e=>{try{let t=decodeURIComponent(e);return t.includes(`/`)&&(t=stripPath(t),t.length===4&&i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=stripPath(n.pathname);if(i.test(a))return r(a);if(n.searchParams.size>0){let e=e=>[...e].findLast(e=>i.test(e)),t=e(n.searchParams.values())??e(n.searchParams.keys());if(t)return r(t)}if(n.hash){let{hash:e}=n,t=-1;for(let{index:n}of e.matchAll(/\.pdf\b/gi))t=n;if(t>0){let n=t;for(;n>0&&!`/?#=`.includes(e[n-1]);)n--;if(n<t)return r(e.slice(n,t+4))}}return t}var StatTimer=class{#e=new Map;times=[];time(e){this.#e.has(e)&&warn(`Timer is already running for ${e}`),this.#e.set(e,Date.now())}timeEnd(e){this.#e.has(e)||warn(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.#e.get(e),end:Date.now()}),this.#e.delete(e)}toString(){let e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}
7ms\n`).join(``)}};function isValidFetchUrl(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test(n?.protocol??``)}function noContextMenu(e){e.preventDefault()}function stopEvent(e){e.preventDefault(),e.stopPropagation()}var PDFDateString=class{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!=`string`)return null;this.#e||=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?`);let t=this.#e.exec(e);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;let c=t[7]||`Z`,l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,c===`-`?(a+=l,o+=u):c===`+`&&(a-=l,o-=u),new Date(Date.UTC(n,r,i,a,o,s))}};function getRGBA(e){if(e.startsWith(`#`)){let t=e.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(e.startsWith(`rgb(`)){let[t,n,r]=e.slice(4,-1).split(`,`).map(e=>parseInt(e,10));return[t,n,r,1]}if(e.startsWith(`rgba(`)){let t=e.slice(5,-1).split(`,`);return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}let t=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!==`none`?parseFloat(t[4]):1]:null}function getRGB(e){let t=getRGBA(e);return t?t.slice(0,3):(warn(`Not a valid color format: "${e}"`),[0,0,0])}function getColorValues(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,t.style.colorScheme=`only light`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,getRGB(r))}t.remove()}function getCurrentTransform(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function getCurrentTransformInverse(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function setLayerDimensions(e,t,n=!1,r=!0){if(t instanceof PageViewport){let{pageWidth:r,pageHeight:i}=t.rawDims,{style:a}=e,o=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-x))`,s=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-y))`;!n||t.rotation%180==0?(a.width=o,a.height=s):(a.width=s,a.height=o)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}var OutputScale=class e{constructor(){let{pixelRatio:t}=e;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,n,r,i,a=-1){let o=1/0,s=1/0,c=1/0;r=e.capPixels(r,a),r>0&&(o=Math.sqrt(r/(t*n))),i!==-1&&(s=i/t,c=i/n);let l=Math.min(o,s,c);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},SupportedImageMimeTypes=[`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`],ColorScheme=class{static get isDarkMode(){return shadow(this,`isDarkMode`,!!window?.matchMedia?.(`(prefers-color-scheme: dark)`).matches)}},CSSConstants=class{static get commentForegroundColor(){let e=document.createElement(`span`);e.classList.add(`comment`,`sidebar`);let{style:t}=e;t.width=t.height=`0`,t.display=`none`,t.color=`var(--comment-fg-color)`,document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),shadow(this,`commentForegroundColor`,getRGB(n))}};function applyOpacity(e,t){t=MathClamp(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function RGBToHSL(e,t){let n=e[0]/255,r=e[1]/255,i=e[2]/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)t[0]=t[1]=0;else{let e=a-o;switch(t[1]=s<.5?e/(a+o):e/(2-a-o),a){case n:t[0]=((r-i)/e+(r<i?6:0))*60;break;case r:t[0]=((i-n)/e+2)*60;break;case i:t[0]=((n-r)/e+4)*60;break}}t[2]=s}function HSLToRGB(e,t){let n=e[0],r=e[1],i=e[2],a=(1-Math.abs(2*i-1))*r,o=a*(1-Math.abs(n/60%2-1)),s=i-a/2;switch(Math.floor(n/60)){case 0:t[0]=a+s,t[1]=o+s,t[2]=s;break;case 1:t[0]=o+s,t[1]=a+s,t[2]=s;break;case 2:t[0]=s,t[1]=a+s,t[2]=o+s;break;case 3:t[0]=s,t[1]=o+s,t[2]=a+s;break;case 4:t[0]=o+s,t[1]=s,t[2]=a+s;break;
vendor: 98,652 bytes, line 7
7case 5:case 6:t[0]=a+s,t[1]=s,t[2]=o+s;break}}function computeLuminance(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function contrastRatio(e,t,n){HSLToRGB(e,n),n.map(computeLuminance);let r=.2126*n[0]+.7152*n[1]+.0722*n[2];HSLToRGB(t,n),n.map(computeLuminance);let i=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)}var contrastCache=new Map;function findContrastColor(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=contrastCache.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);RGBToHSL(e,o);let s=i.subarray(6,9);RGBToHSL(t,s);let c=s[2]<.5,l=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),contrastRatio(o,s,a)<l){let e,t;c?(e=o[2],t=1):(e=0,t=o[2]);let n=.005;for(;t-e>.005;){let n=o[2]=(e+t)/2;c===contrastRatio(o,s,a)<l?e=n:t=n}o[2]=c?t:e}return HSLToRGB(o,a),r=Util.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),contrastCache.set(n,r),r}function renderRichText({html:e,dir:t,className:n},r){let i=document.createDocumentFragment();if(typeof e==`string`){let n=document.createElement(`p`);n.dir=t||`auto`;let r=e.split(/\r\n?|\n/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}i.append(n)}else XfaLayer.render({xfaHtml:e,div:i,intent:`richText`});i.firstElementChild.classList.add(`richText`,n),r.append(i)}function makePathFromDrawOPS(e){let t=new Path2D;if(!e)return t;for(let n=0,r=e.length;n<r;)switch(e[n++]){case DrawOPS.moveTo:t.moveTo(e[n++],e[n++]);break;case DrawOPS.lineTo:t.lineTo(e[n++],e[n++]);break;case DrawOPS.curveTo:t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);break;case DrawOPS.quadraticCurveTo:t.quadraticCurveTo(e[n++],e[n++],e[n++],e[n++]);break;case DrawOPS.closePath:t.closePath();break;default:warn(`Unrecognized drawing path operator: ${e[n-1]}`);break}return t}var EditorToolbar=class e{#e=null;#t=null;#n;#r=null;#i=null;#a=null;#o=null;#s=null;static#c=null;constructor(t){this.#n=t,e.#c||=Object.freeze({freetext:`pdfjs-editor-remove-freetext-button`,highlight:`pdfjs-editor-remove-highlight-button`,ink:`pdfjs-editor-remove-ink-button`,stamp:`pdfjs-editor-remove-stamp-button`,signature:`pdfjs-editor-remove-signature-button`})}render(){let t=this.#e=document.createElement(`div`);t.classList.add(`editToolbar`,`hidden`),t.setAttribute(`role`,`toolbar`);let n=this.#n._uiManager._signal;n instanceof AbortSignal&&!n.aborted&&(t.addEventListener(`contextmenu`,noContextMenu,{signal:n}),t.addEventListener(`pointerdown`,e.#l,{signal:n}));let r=this.#r=document.createElement(`div`);r.className=`buttons`,t.append(r);let i=this.#n.toolbarPosition;if(i){let{style:e}=t;e.insetInlineEnd=`${100*(this.#n._uiManager.direction===`ltr`?1-i[0]:i[0])}%`,e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#e}static#l(e){e.stopPropagation()}#u(e){this.#n._focusEventsAllowed=!1,stopEvent(e)}#d(e){this.#n._focusEventsAllowed=!0,stopEvent(e)}#f(e){let t=this.#n._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener(`focusin`,this.#u.bind(this),{capture:!0,signal:t}),e.addEventListener(`focusout`,this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener(`contextmenu`,noContextMenu,{signal:t}),!0)}hide(){this.#e.classList.add(`hidden`),this.#t?.hideDropdown()}show(){this.#e.classList.remove(`hidden`),this.#i?.shown(),this.#a?.shown()}addDeleteButton(){let{editorType:t,_uiManager:n}=this.#n,r=document.createElement(`button`);r.classList.add(`basic`,`deleteButton`),r.tabIndex=0,r.setAttribute(`data-l10n-id`,e.#c[t]),this.#f(r)&&r.addEventListener(`click`,e=>{n.delete()},{signal:n._signal}),this.#r.append(r)}get#p(){let e=document.createElement(`div`);return e.className=`divider`,e}async addAltText(e){let t=await e.render();this.#f(t),this.#r.append(t,this.#p),this.#i=e}addComment(e,t=null){if(this.#a)return;let n=e.renderForToolbar();if(!n)return;this.#f(n);let r=this.#o=this.#p;t?(this.#r.insertBefore(n,t),this.#r.insertBefore(r,t)):this.#r.append(n,r),this.#a=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let t=e.renderButton();this.#f(t),this.#r.append(t,this.#p)}async addEditSignatureButton(e){let t=this.#s=await e.renderEditButton(this.#n);this.#f(t),this.#r.append(t,this.#p)}removeButton(e){switch(e){case`comment`:this.#a?.removeToolbarCommentButton(),this.#a=null,this.#o?.remove(),this.#o=null;break}}async addButton(e,t){switch(e){case`colorPicker`:t&&this.addColorPicker(t);break;case`altText`:t&&await this.addAltText(t);break;case`editSignature`:t&&await this.addEditSignatureButton(t);break;case`delete`:this.addDeleteButton();break;case`comment`:t&&this.addComment(t);break}}async addButtonBefore(e,t,n){if(!t&&e===`comment`)return;let r=this.#r.querySelector(n);r&&e===`comment`&&this.addComment(t,r)}updateEditSignatureButton(e){this.#s&&(this.#s.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}},FloatingToolbar=class{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){let e=this.#t=document.createElement(`div`);e.className=`editToolbar`,e.setAttribute(`role`,`toolbar`),e.dir=this.#n.direction;let t=this.#n._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener(`contextmenu`,noContextMenu,{signal:t});let n=this.#e=document.createElement(`div`);return n.className=`buttons`,e.append(n),this.#n.hasCommentManager()&&this.#a(`commentButton`,`pdfjs-comment-floating-button`,`pdfjs-comment-floating-button-label`,()=>{this.#n.commentSelection(`floating_button`)}),this.#a(`highlightButton`,`pdfjs-highlight-floating-button1`,`pdfjs-highlight-floating-button-label`,()=>{this.#n.highlightSelection(`floating_button`)}),e}#i(e,t){let n=0,r=0;for(let i of e){let e=i.y+i.height;if(e<n)continue;let a=i.x+(t?i.width:0);if(e>n){r=a,n=e;continue}t?a>r&&(r=a):a<r&&(r=a)}return[t?1-r:r,n]}show(e,t,n){let[r,i]=this.#i(t,n),{style:a}=this.#t||=this.#r();e.append(this.#t),a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#a(e,t,n,r){let i=document.createElement(`button`);i.classList.add(`basic`,e),i.tabIndex=0,i.setAttribute(`data-l10n-id`,t);let a=document.createElement(`span`);i.append(a),a.className=`visuallyHidden`,a.setAttribute(`data-l10n-id`,n);let o=this.#n._signal;o instanceof AbortSignal&&!o.aborted&&(i.addEventListener(`contextmenu`,noContextMenu,{signal:o}),i.addEventListener(`click`,r,{signal:o})),this.#e.append(i)}},internalOpt=Object.freeze({internal:`59968104-cc61-4cf9-b570-014b35b3709c`});function bindEvents(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}var CurrentPointers=class e{static#e=NaN;static#t=null;static#n=NaN;static#r=null;static initializeAndAddPointerId(t){(e.#t||=new Set).add(t)}static setPointer(t,n){e.#e||=n,e.#r??=t}static setTimeStamp(t){e.#n=t}static isSamePointerId(t){return e.#e===t}static isSamePointerIdOrRemove(t){return e.#e===t?!0:(e.#t?.delete(t),!1)}static isSamePointerType(t){return e.#r===t}static isInitializedAndDifferentPointerType(t){return e.#r!==null&&!e.isSamePointerType(t)}static isSameTimeStamp(t){return e.#n===t}static isUsingMultiplePointers(){return e.#t?.size>=1}static clearPointerType(){e.#r=null}static clearPointerIds(){e.#e=NaN,e.#t=null}static clearTimeStamp(){e.#n=NaN}},IdManager=class{#e=0;get id(){return`${AnnotationEditorPrefix}${this.#e++}`}},ImageManager=class e{#e=getUuid();#t=0;#n=null;static get _isSVGFittingCanvas(){let e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${SVG_NS}"><rect width="1" height="1" style="fill:red;"/></svg>`,t=new OffscreenCanvas(1,3).getContext(`2d`,{willReadFrequently:!0}),n=new Image;n.src=e;let r=n.decode().then(()=>(t.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return shadow(this,`_isSVGFittingCanvas`,r)}async#r(t,n){this.#n||=new Map;let r=this.#n.get(t);if(r===null)return null;if(r?.bitmap)return r.refCounter+=1,r;try{r||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let t;if(typeof n==`string`?(r.url=n,t=await fetchData(n,`blob`)):n instanceof File?t=r.file=n:n instanceof Blob&&(t=n),t.type===`image/svg+xml`){let n=e._isSVGFittingCanvas,i=new FileReader,a=new Image,o=new Promise((e,t)=>{a.onload=()=>{r.bitmap=a,r.isSvg=!0,e()},i.onload=async()=>{let e=r.svgUrl=i.result;a.src=await n?`${e}#svgView(preserveAspectRatio(none))`:e},a.onerror=i.onerror=t});i.readAsDataURL(t),await o}else r.bitmap=await createImageBitmap(t);r.refCounter=1}catch(e){warn(e),r=null}return this.#n.set(t,r),r&&this.#n.set(r.id,r),r}async getFromFile(e){let{lastModified:t,name:n,size:r,type:i}=e;return this.#r(`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,t){let n=await t;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;let r=new OffscreenCanvas(t.width,t.height);return r.getContext(`2d`).drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t||(--t.refCounter,t.refCounter!==0))return;let{bitmap:n}=t;if(!t.url&&!t.file){let e=new OffscreenCanvas(n.width,n.height);e.getContext(`bitmaprenderer`).transferFromImageBitmap(n),t.blobPromise=e.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}},CommandManager=class{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(r&&e(),this.#t)return;let s={cmd:e,undo:t,post:n,type:i};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(s);return}if(a&&this.#e[this.#r].type===i){o&&(s.undo=this.#e[this.#r].undo),this.#e[this.#r]=s;return}let c=this.#r+1;c===this.#n?this.#e.splice(0,1):(this.#r=c,c<this.#e.length&&this.#e.splice(c)),this.#e.push(s)}undo(){if(this.#r===-1)return;this.#t=!0;let{undo:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1,--this.#r}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;let{cmd:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let t=this.#r;t>=0;t--)if(this.#e[t].type!==e){this.#e.splice(t+1,this.#r-t),this.#r=t;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}},KeyboardManager=class e{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:n}=FeatureTest.platform;for(let[r,i,a={}]of t){let t=r.some(e=>e.startsWith(`mac+`));for(let o of r){let r=o;if(t){let e=o.startsWith(`mac+`);if(n!==e)continue;e&&(r=o.slice(4))}let[s,c]=e.#e(r);s!==null&&this.callbacks.getOrInsertComputed(s,makeArr).push({callback:i,options:a,modifiers:c})}}}static#e(t){let n=null,r=0;for(let i of t.split(`+`)){if(i=i.trim(),!i)continue;let a=i.toUpperCase(),o=e[a];if(o){r|=o;continue}if(n!==null){warn(`KeyboardManager: multiple keys in shortcut "${t}"`);break}n=a===`SPACE`?` `:i}return n===null&&warn(`KeyboardManager: no key found in shortcut "${t}"`),[n,r]}static#t(e){let t=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);return t?t[1]?.toLowerCase()??t[2]:null}exec(t,n){let r=this.callbacks.get(n.key);if(!r){if(/^[a-z]$/i.test(n.key))return;let t=e.#t(n.code);if(t===null||t===n.key||(r=this.callbacks.get(t),!r))return}let i=(n.altKey?e.ALT:0)|(n.ctrlKey?e.CTRL:0)|(n.metaKey?e.META:0)|(n.shiftKey?e.SHIFT:0),a=r.find(e=>e.modifiers===i);if(!a)return;let{callback:o,options:{bubbles:s=!1,args:c=[],checker:l=null}}=a;l&&!l(t,n)||(o.bind(t,...c,n)(),s||stopEvent(n))}},ColorManager=class e{static _colorsMapping=new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]);get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return getColorValues(e),shadow(this,`_colors`,e)}convert(t){let n=getRGB(t);if(!window.matchMedia(`(forced-colors: active)`).matches)return n;for(let[t,r]of this._colors)if(r.every((e,t)=>e===n[t]))return e._colorsMapping.get(t);return n}getHexCode(e){let t=this._colors.get(e);return t?Util.makeHexColor(...t):e}},AnnotationEditorUIManager=class e{#e=new AbortController;#t=null;#n=null;#r=new Map;#i=new Map;#a=null;#o=null;#s=null;#c=null;#l=null;#u=new CommandManager;#d=null;#f=null;#p=null;#m=0;#h=new Set;#g=null;#_=null;#v=new Set;_editorUndoBar=null;#y=!1;#b=!1;#x=!1;#S=null;#C=null;#w=null;#T=null;#E=!1;#D=null;#O=new IdManager;#k=!1;#A=!1;#j=!1;#M=null;#N=null;#P=null;#F=null;#I=null;#L=AnnotationEditorType.NONE;#R=new Set;#z=null;#B=null;#V=null;#H=null;#U=null;#W={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#G=[0,0];#K=null;#q=null;#J=null;#Y=null;#X=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.#q.contains(document.activeElement)&&document.activeElement.tagName!==`BUTTON`&&e.hasSomethingToControl(),r=(e,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!==`text`&&e!==`number`}return!0},i=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return shadow(this,`_keyboardManager`,new KeyboardManager([[[`ctrl+a`,`mac+meta+a`],t.selectAll,{checker:r}],[[`ctrl+z`,`mac+meta+z`],t.undo,{checker:r}],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],t.redo,{checker:r}],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],t.delete,{checker:r}],[[`Enter`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#q.contains(t)&&!e.isEnterHandled}],[[`Space`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#q.contains(document.activeElement)}],[[`Escape`],t.unselectAll],[[`ArrowLeft`],t.translateSelectedEditors,{args:[-i,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t.translateSelectedEditors,{args:[-a,0],checker:n}],[[`ArrowRight`],t.translateSelectedEditors,{args:[i,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t.translateSelectedEditors,{args:[a,0],checker:n}],[[`ArrowUp`],t.translateSelectedEditors,{args:[0,-i],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t.translateSelectedEditors,{args:[0,-a],checker:n}],[[`ArrowDown`],t.translateSelectedEditors,{args:[0,i],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t.translateSelectedEditors,{args:[0,a],checker:n}]]))}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this._signal=this.#e.signal;this.#q=e,this.#J=t,this.#Y=n,this.#s=r,this.#d=i,this.#B=a,this.#U=s,this._eventBus=o;let _={signal:g,...internalOpt};o.on(`editingaction`,this.onEditingAction.bind(this),_),o.on(`pagechanging`,this.onPageChanging.bind(this),_),o.on(`scalechanging`,this.onScaleChanging.bind(this),_),o.on(`rotationchanging`,this.onRotationChanging.bind(this),_),o.on(`setpreference`,this.onSetPreference.bind(this),_),o.on(`switchannotationeditorparams`,e=>this.updateParams(e.type,e.value),_),window.addEventListener(`pointerdown`,()=>{this.#A=!0},{capture:!0,signal:g}),window.addEventListener(`pointerup`,()=>{this.#A=!1},{capture:!0,signal:g}),window.addEventListener(`beforeunload`,this.endCurrentEditing.bind(this),{capture:!0,signal:g}),this.#ne(),this.#le(),this.#ae(),this.#c=s.annotationStorage,this.#S=s.filterFactory,this.#V=c,this.#T=l||null,this.#y=u,this.#b=d,this.#x=f,this.#I=p||null,this.viewParameters={realScale:PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=h!==!1,i?.setSidebarUiManager(this)}destroy(){this.#X?.resolve(),this.#X=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#i.values())e.destroy();this.#i.clear(),this.#r.clear(),this.#v.clear(),this.#F?.clear(),this.#t=null,this.#R.clear(),this.#u.destroy(),this.#s?.destroy(),this.#d?.destroy(),this.#B?.destroy(),this.#D?.hide(),this.#D=null,this.#P?.destroy(),this.#P=null,this.#n=null,this.#C&&=(clearTimeout(this.#C),null),this.#K&&=(clearTimeout(this.#K),null),this._editorUndoBar?.destroy(),this.#U=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#I}get useNewAltTextFlow(){return this.#b}get useNewAltTextWhenAddingImage(){return this.#x}get hcmFilter(){return shadow(this,`hcmFilter`,this.#V?this.#S.addHCMFilter(this.#V.foreground,this.#V.background):`none`)}get direction(){return shadow(this,`direction`,getComputedStyle(this.#q).direction)}get _highlightColors(){return shadow(this,`_highlightColors`,this.#T?new Map(this.#T.split(`,`).map(e=>(e=e.split(`=`).map(e=>e.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return shadow(this,`highlightColors`,null);let t=new Map,n=!!this.#V;for(let[r,i]of e){let e=r.endsWith(`_HCM`);if(n&&e){t.set(r.replace(`_HCM`,``),i);continue}!n&&!e&&t.set(r,i)}return shadow(this,`highlightColors`,t)}get highlightColorNames(){return shadow(this,`highlightColorNames`,this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#p=e}setMainHighlightColorPicker(e){this.#P=e}editAltText(e,t=!1){this.#s?.editAltText(this,e,t)}hasCommentManager(){return!!this.#d}editComment(e,t,n,r){this.#d?.showDialog(this,e,t,n,r)}selectComment(e,t){(this.#i.get(e)?.getEditorByUID(t))?.toggleComment(!0,!0)}updateComment(e){this.#d?.updateComment(e.getData())}updatePopupColor(e){this.#d?.updatePopupColor(e)}removeComment(e){this.#d?.removeComments([e.uid])}deleteComment(e,t){let n=()=>{e.comment=t};this.addCommands({cmd:()=>{this._editorUndoBar?.show(n,`comment`),this.toggleComment(null),e.comment=null},undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){this.#d?.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){return e&&this.#d?.makeCommentColor(e,t)||null}getCommentDialogElement(){return this.#d?.dialogElement||null}async waitForEditorsRendered(e){if(this.#i.has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),r=n=>{n.pageNumber===e&&(this._eventBus.off(`editorsrendered`,r),t())};this._eventBus.on(`editorsrendered`,r,internalOpt),await n}getSignature(e){this.#B?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#B}switchToMode(e,t){this._eventBus.on(`annotationeditormodechanged`,t,{once:!0,signal:this._signal,...internalOpt}),this._eventBus.dispatch(`showannotationeditorui`,{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch(`setpreference`,{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case`enableNewAltTextWhenAddingImage`:this.#x=t;break}}onPageChanging({pageNumber:e}){this.#m=e-1}deletePage(e){for(let t of this.getEditors(e))t.remove();this.#i.delete(e),this.#m===e&&(this.#m=0)}focusMainContainer(){this.#q.focus()}findParent(e,t){for(let n of this.#i.values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){this.#J.classList.toggle(`noUserSelect`,e)}addShouldRescale(e){this.#v.add(e)}removeShouldRescale(e){this.#v.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*PixelsPerInch.PDF_TO_CSS_UNITS;for(let e of this.#v)e.onScaleChanging();this.#p?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#Z({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Q(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let t of this.#i.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=``,t=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=n,s=n.toString(),c=this.#Z(n).closest(`.textLayer`),l=this.getSelectionBoxes(c);if(!l)return;n.empty();let u=this.#Q(c),d=this.#L===AnnotationEditorType.NONE,f=()=>{let n=u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o,text:s});d&&this.showAllEditors(`highlight`,!0,!0),t&&n?.editComment()};if(d){this.switchToMode(AnnotationEditorType.HIGHLIGHT,f);return}f()}commentSelection(e=``){this.highlightSelection(e,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#$(){let e=document.getSelection();if(!e||e.isCollapsed)return;let t=this.#Z(e).closest(`.textLayer`),n=this.getSelectionBoxes(t);n&&(this.#D||=new FloatingToolbar(this),this.#D.show(t,n,this.direction===`ltr`))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#c)return null;let t=`${AnnotationEditorPrefix}${e}`,n=this.#c.getRawValue(t);return n&&this.#c.remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&this.#c&&!this.#c.has(e.id)&&this.#c.setValue(e.id,e)}a11yAlert(e,t=null){let n=this.#Y;n&&(n.setAttribute(`data-l10n-id`,e),t?n.setAttribute(`data-l10n-args`,JSON.stringify(t)):n.removeAttribute(`data-l10n-args`))}#ee(){let e=document.getSelection();if(!e||e.isCollapsed){this.#z&&(this.#D?.hide(),this.#z=null,this.#ue({hasSelectedText:!1}));return}let{anchorNode:t}=e;if(t===this.#z)return;let n=this.#Z(e).closest(`.textLayer`);if(!n){this.#z&&(this.#D?.hide(),this.#z=null,this.#ue({hasSelectedText:!1}));return}if(this.#D?.hide(),this.#z=t,this.#ue({hasSelectedText:!0}),!(this.#L!==AnnotationEditorType.HIGHLIGHT&&this.#L!==AnnotationEditorType.NONE)&&(this.#L===AnnotationEditorType.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),this.#E=this.isShiftKeyDown,!this.isShiftKeyDown)){let e=this.#L===AnnotationEditorType.HIGHLIGHT?this.#Q(n):null;if(e?.toggleDrawing(),this.#A){let t=new AbortController,n=this.combinedSignal(t),r=n=>{n.type===`pointerup`&&n.button!==0||(t.abort(),e?.toggleDrawing(!0),n.type===`pointerup`&&this.#te(`main_toolbar`))};window.addEventListener(`pointerup`,r,{signal:n}),window.addEventListener(`blur`,r,{signal:n})}else e?.toggleDrawing(!0),this.#te(`main_toolbar`)}}#te(e=``){this.#L===AnnotationEditorType.HIGHLIGHT?this.highlightSelection(e):this.#y&&this.#$()}#ne(){document.addEventListener(`selectionchange`,this.#ee.bind(this),{signal:this._signal})}#re(){if(this.#w)return;this.#w=new AbortController;let e=this.combinedSignal(this.#w);window.addEventListener(`focus`,this.focus.bind(this),{signal:e}),window.addEventListener(`blur`,this.blur.bind(this),{signal:e})}#ie(){this.#w?.abort(),this.#w=null}blur(){if(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#te(`main_toolbar`)),!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#R)if(t.div.contains(e)){this.#N=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#N)return;let[e,t]=this.#N;this.#N=null,t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}#ae(){if(this.#M)return;this.#M=new AbortController;let e=this.combinedSignal(this.#M);window.addEventListener(`keydown`,this.keydown.bind(this),{signal:e}),window.addEventListener(`keyup`,this.keyup.bind(this),{signal:e})}#oe(){this.#M?.abort(),this.#M=null}#se(){if(this.#f)return;this.#f=new AbortController;let e=this.combinedSignal(this.#f);document.addEventListener(`copy`,this.copy.bind(this),{signal:e}),document.addEventListener(`cut`,this.cut.bind(this),{signal:e}),document.addEventListener(`paste`,this.paste.bind(this),{signal:e})}#ce(){this.#f?.abort(),this.#f=null}#le(){let e=this._signal;document.addEventListener(`dragover`,this.dragOver.bind(this),{signal:e}),document.addEventListener(`drop`,this.drop.bind(this),{signal:e})}addEditListeners(){this.#ae(),this.setEditingState(!0)}removeEditListeners(){this.#oe(),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of this.#_)if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect=`copy`,e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of this.#_)if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let e of this.#R){let n=e.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of this.#_)if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let n=t.getData(`application/pdfjs`);if(!n)return;try{n=JSON.parse(n)}catch(e){warn(`paste: "${e.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let r=this.currentLayer;try{let e=[];for(let t of n){let n=await r.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)this.#me(t);this.#_e(e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){warn(`paste: "${e.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key===`Shift`&&(this.isShiftKeyDown=!0),this.#L!==AnnotationEditorType.NONE&&!this.isEditorHandlingKeyboard&&e._keyboardManager.exec(this,t)}keyup(e){this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#te(`main_toolbar`)))}onEditingAction({name:e}){switch(e){case`undo`:case`redo`:case`delete`:case`selectAll`:this[e]();break;case`highlightSelection`:this.highlightSelection(`context_menu`);break;case`commentSelection`:this.commentSelection(`context_menu`);break}}updatePageIndex(e,t){for(let n of this.#o.get(e)||[])n.pageIndex=t;let n=this.#a.get(e);n&&(n.pageIndex=t,this.#i.set(t,n),this.#k?n.enable():n.disable())}startUpdatePages(){this.#a=new Map(this.#i),this.#i.clear();let e=this.#o=new Map,t=t=>{e.getOrInsertComputed(t.pageIndex,makeArr).push(t)};for(let e of this.#r.values())t(e);for(let[e,n]of this.#c)e.startsWith(AnnotationEditorPrefix)&&!this.#r.has(e)&&Number.isInteger(n?.pageIndex)&&t(n)}endUpdatePages(){this.#a=null,this.#o=null}clonePage(e,t){for(let n of this.getEditors(e)){let e=n.serialize(n.mode!==AnnotationEditorType.HIGHLIGHT);e&&(e.pageIndex=t,e.id=this.getId(),e.isClone=!0,delete e.popupRef,this.#c.setValue(e.id,e))}}findClonesForPage(e){let t=[],{pageIndex:n}=e;for(let[r,i]of this.#c)i.pageIndex===n&&i.isClone&&(this.#c.remove(r),t.push(e.deserialize(i).then(t=>{t&&(t.isClone=!0,e.addOrRebuild(t))})));return Promise.all(t)}#ue(e){Object.entries(e).some(([e,t])=>this.#W[e]!==t)&&(this._eventBus.dispatch(`editingstateschanged`,{source:this,details:Object.assign(this.#W,e)}),this.#L===AnnotationEditorType.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#de([[AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]]))}#de(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}setEditingState(e){e?(this.#re(),this.#se(),this.#ue({isEditing:this.#L!==AnnotationEditorType.NONE,isEmpty:this.#ge(),hasSomethingToUndo:this.#u.hasSomethingToUndo(),hasSomethingToRedo:this.#u.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ie(),this.#ce(),this.#ue({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#_){this.#_=e;for(let e of this.#_)this.#de(e.defaultPropertiesToUpdate)}}getId(){return this.#O.id}get currentLayer(){return this.#i.get(this.#m)}getLayer(e){return this.#i.get(e)}get currentPageIndex(){return this.#m}addLayer(e){this.#i.set(e.pageIndex,e),this.#k?e.enable():e.disable()}removeLayer(e){this.#i.delete(e.pageIndex)}async updateMode(e,t=null,n=!1,r=!1,i=!1,a=!1){if(this.#L!==e&&!(this.#X&&(await this.#X.promise,!this.#X))){if(this.#X=Promise.withResolvers(),this.#p?.commitOrRemove(),this.#L===AnnotationEditorType.POPUP&&this.#d?.hideSidebar(),this.#d?.destroyPopup(),this.#L=e,e===AnnotationEditorType.NONE){this.setEditingState(!1),this.#pe();for(let e of this.#r.values())e.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#X.resolve();return}for(let e of this.#r.values())e.addStandaloneCommentButton();e===AnnotationEditorType.SIGNATURE&&await this.#B?.loadSignatures(),n&&CurrentPointers.clearPointerType(),this.setEditingState(!0),await this.#fe(),this.unselectAll();for(let t of this.#i.values())t.updateMode(e);if(e===AnnotationEditorType.POPUP){this.#n||=await this.#U.getAnnotationsByType(new Set(this.#_.map(e=>e._editorType)));let e=new Set,t=[];for(let n of this.#r.values()){let{annotationElementId:r,hasComment:i,deleted:a}=n;r&&e.add(r),i&&!a&&t.push(n.getData())}for(let n of this.#n){let{id:r,popupRef:i,contentsObj:a}=n;i&&a?.str&&!e.has(r)&&!this.#h.has(r)&&t.push(n)}this.#d?.showSidebar(t)}if(!t){r&&this.addNewEditorFromKeyboard(),this.#X.resolve();return}for(let e of this.#r.values())e.uid===t?(this.setSelected(e),a?e.editComment():i?e.enterInEditMode():e.focus()):e.unselect();this.#X.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#L&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,...e})}updateParams(e,t){if(this.#_){switch(e){case AnnotationEditorParamsType.CREATE:this.currentLayer.addNewEditor(t);return;case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:{type:`highlight`,action:`toggle_visibility`}}}),(this.#H||=new Map).set(e,t),this.showAllEditors(`highlight`,t);break}if(this.hasSelection)for(let n of this.#R)n.updateParams(e,t);else for(let n of this.#_)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(let n of this.#r.values())n.editorType===e&&n.show(t);(this.#H?.get(AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#de([[AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#j!==e){this.#j=e;for(let t of this.#i.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}async#fe(){if(!this.#k){this.#k=!0;let e=[];for(let t of this.#i.values())e.push(t.enable());await Promise.all(e);for(let e of this.#r.values())e.enable()}}#pe(){if(this.unselectAll(),this.#k){this.#k=!1;for(let e of this.#i.values())e.disable();for(let e of this.#r.values())e.disable()}}*getEditors(e){for(let t of this.#r.values())t.pageIndex===e&&(yield t)}getEditor(e){return this.#r.get(e)}addEditor(e){this.#r.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#C&&clearTimeout(this.#C),this.#C=setTimeout(()=>{this.focusMainContainer(),this.#C=null},0)),this.#r.delete(e.id),e.annotationElementId&&this.#F?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#h.has(e.annotationElementId))&&this.#c?.remove(e.id)}addDeletedAnnotationElement(e){this.#h.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#h.has(e)}removeDeletedAnnotationElement(e){this.#h.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#me(e){let t=this.#i.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#de(e.propertiesToUpdate))}get#he(){let e=null;for(e of this.#R);return e}updateUI(e){this.#he===e&&this.#de(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#de(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#R.has(e)){this.#R.delete(e),e.unselect(),this.#ue({hasSelectedEditor:this.hasSelection});return}this.#R.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#p?.commitOrRemove();for(let t of this.#R)t!==e&&t.unselect();this.#d?.destroyPopup(),this.#R.clear(),this.#R.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#R.values().next().value}unselect(e){e.unselect(),this.#R.delete(e),this.#ue({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#R.size!==0}get isEnterHandled(){return this.#R.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#u.undo(),this.#ue({hasSomethingToUndo:this.#u.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#ge()}),this._editorUndoBar?.hide()}redo(){this.#u.redo(),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:this.#u.hasSomethingToRedo(),isEmpty:this.#ge()})}addCommands(e){this.#u.add(e),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#ge()})}cleanUndoStack(e){this.#u.cleanType(e)}#ge(){if(this.#r.size===0)return!0;if(this.#r.size===1)for(let e of this.#r.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let t=e?[e]:[...this.#R],n=()=>{this._editorUndoBar?.show(r,t.length===1?t[0].editorType:t.length);for(let e of t)e.remove()},r=()=>{for(let e of t)this.#me(e)};this.addCommands({cmd:n,undo:r,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#_e(e){for(let e of this.#R)e.unselect();this.#R.clear();for(let t of e)t.isEmpty()||(this.#R.add(t),t.select());this.#ue({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#R)e.commit();this.#_e(this.#r.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#L!==AnnotationEditorType.NONE))&&!this.#p?.commitOrRemove()&&(this.#d?.destroyPopup(),this.hasSelection)){for(let e of this.#R)e.unselect();this.#R.clear(),this.#ue({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#G[0]+=e,this.#G[1]+=t;let[r,i]=this.#G,a=[...this.#R],o=1e3;this.#K&&clearTimeout(this.#K),this.#K=setTimeout(()=>{this.#K=null,this.#G[0]=this.#G[1]=0,this.addCommands({cmd:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(r,i),e.translationDone())},undo:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(-r,-i),e.translationDone())},mustExec:!1})},1e3);for(let n of a)n.translateInPage(e,t),n.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#g=new Map;for(let e of this.#R)this.#g.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#g)return!1;this.disableUserSelect(!1);let e=this.#g;this.#g=null;let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex;if(!t)return!1;let n=(e,t,n,r)=>{if(this.#r.has(e.id)){let i=this.#i.get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#g)for(let n of this.#g.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#R.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#L}isEditingMode(){return this.#L!==AnnotationEditorType.NONE}get imageManager(){return shadow(this,`imageManager`,new ImageManager)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;let{x:n,y:r,width:i,height:a}=e.getBoundingClientRect(),o;switch(e.getAttribute(`data-main-rotation`)){case`90`:o=(e,t,o,s)=>({x:(t-r)/a,y:1-(e+o-n)/i,width:s/a,height:o/i});break;case`180`:o=(e,t,o,s)=>({x:1-(e+o-n)/i,y:1-(t+s-r)/a,width:o/i,height:s/a});break;case`270`:o=(e,t,o,s)=>({x:1-(t+s-r)/a,y:(e-n)/i,width:s/a,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-n)/i,y:(t-r)/a,width:o/i,height:s/a});break}let s=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(!n.collapsed)for(let{x:e,y:t,width:r,height:i}of n.getClientRects())r===0||i===0||s.push(o(e,t,r,i))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#l||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#l?.delete(e)}renderAnnotationElement(e){let t=this.#l?.get(e.data.id);if(!t)return;let n=this.#c.getRawValue(t);n&&(this.#L===AnnotationEditorType.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,t,n){let r=this.#F?.get(e);r&&(r.setCanvas(t,n),this.#F.delete(e))}addMissingCanvas(e,t){(this.#F||=new Map).set(e,t)}},AltText=class e{#e=null;#t=!1;#n=null;#r=null;#i=null;#a=null;#o=!1;#s=null;#c=null;#l=null;#u=null;#d=!1;static#f=null;static _l10n=null;constructor(t){this.#c=t,this.#d=t._uiManager.useNewAltTextFlow,e.#f||=Object.freeze({added:`pdfjs-editor-new-alt-text-added-button`,"added-label":`pdfjs-editor-new-alt-text-added-button-label`,missing:`pdfjs-editor-new-alt-text-missing-button`,"missing-label":`pdfjs-editor-new-alt-text-missing-button-label`,review:`pdfjs-editor-new-alt-text-to-review-button`,"review-label":`pdfjs-editor-new-alt-text-to-review-button-label`})}static initialize(t){e._l10n??=t}async render(){let t=this.#n=document.createElement(`button`);t.className=`altText`,t.tabIndex=`0`;let n=this.#r=document.createElement(`span`);t.append(n),this.#d?(t.classList.add(`new`),t.setAttribute(`data-l10n-id`,e.#f.missing),n.setAttribute(`data-l10n-id`,e.#f[`missing-label`])):(t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button`),n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button-label`));let r=this.#c._uiManager._signal;t.addEventListener(`contextmenu`,noContextMenu,{signal:r}),t.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:r});let i=e=>{e.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#d&&this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_clicked`,data:{label:this.#p}})};return t.addEventListener(`click`,i,{capture:!0,signal:r}),t.addEventListener(`keydown`,e=>{e.target===t&&e.key===`Enter`&&(this.#o=!0,i(e))},{signal:r}),await this.#m(),t}get#p(){return this.#e&&`added`||this.#e===null&&this.guessedText&&`review`||`missing`}finish(){this.#n&&(this.#n.focus({focusVisible:this.#o}),this.#o=!1)}isEmpty(){return this.#d?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#d?this.#e!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#e===null&&(this.#l=t,this.#u=await e._l10n.get(`pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer`,{generatedAltText:t}),this.#m())}toggleAltTextBadge(e=!1){if(!this.#d||this.#e){this.#s?.remove(),this.#s=null;return}if(!this.#s){let e=this.#s=document.createElement(`div`);e.className=`noAltTextBadge`,this.#c.div.append(e)}this.#s.classList.toggle(`hidden`,!e)}serialize(e){let t=this.#e;return!e&&this.#l===t&&(t=this.#u),{altText:t,decorative:this.#t,guessedText:this.#l,textWithDisclaimer:this.#u}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:i=!1}){n&&(this.#l=n,this.#u=r),!(this.#e===e&&this.#t===t)&&(i||(this.#e=e,this.#t=t),this.#m())}toggle(e=!1){this.#n&&(!e&&this.#a&&(clearTimeout(this.#a),this.#a=null),this.#n.disabled=!e)}shown(){this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_displayed`,data:{label:this.#p}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#i=null,this.#s?.remove(),this.#s=null}async#m(){let t=this.#n;if(!t)return;if(this.#d){if(t.classList.toggle(`done`,!!this.#e),t.setAttribute(`data-l10n-id`,e.#f[this.#p]),this.#r?.setAttribute(`data-l10n-id`,e.#f[`${this.#p}-label`]),!this.#e){this.#i?.remove();return}}else{if(!this.#e&&!this.#t){t.classList.remove(`done`),this.#i?.remove();return}t.classList.add(`done`),t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-edit-button`)}let n=this.#i;if(!n){this.#i=n=document.createElement(`span`),n.className=`tooltip`,n.setAttribute(`role`,`tooltip`),n.id=`alt-text-tooltip-${this.#c.id}`;let e=100,r=this.#c._uiManager._signal;r.addEventListener(`abort`,()=>{clearTimeout(this.#a),this.#a=null},{once:!0}),t.addEventListener(`mouseenter`,()=>{this.#a=setTimeout(()=>{this.#a=null,this.#i.classList.add(`show`),this.#c._reportTelemetry({action:`alt_text_tooltip`})},100)},{signal:r}),t.addEventListener(`mouseleave`,()=>{this.#a&&=(clearTimeout(this.#a),null),this.#i?.classList.remove(`show`)},{signal:r})}this.#t?n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-decorative-tooltip`):(n.removeAttribute(`data-l10n-id`),n.textContent=this.#e),n.parentNode||t.append(n),this.#c.getElementForAltText()?.setAttribute(`aria-describedby`,n.id)}},Comment=class{#e=null;#t=null;#n=!1;#r=null;#i=null;#a=null;#o=null;#s=null;#c=!1;#l=null;constructor(e){this.#r=e}renderForToolbar(){let e=this.#t=document.createElement(`button`);return e.className=`comment`,this.#u(e,!1)}renderForStandalone(){let e=this.#e=document.createElement(`button`);e.className=`annotationCommentButton`;let t=this.#r.commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(this.#r._uiManager.direction===`ltr`?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let r=this.#r.commentButtonColor;r&&(n.backgroundColor=r)}return this.#u(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#r.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#r._uiManager.updatePopupColor(this.#r)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#r.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#e)return null;let{x:e,y:t,height:n}=this.#e.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#r.parent.boundingClientRect;return[(e-r)/a,(t+n-i)/o]}set commentPopupPositionInLayer(e){this.#l=e}hasDefaultPopupPosition(){return this.#l===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:t}){this.#e&&(this.#e.classList.toggle(`selected`,e),this.#e.ariaExpanded=t)}#u(e,t){if(!this.#r._uiManager.hasCommentManager())return null;e.tabIndex=`0`,e.ariaHasPopup=`dialog`,t?(e.ariaControls=`commentPopup`,e.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`)):(e.ariaControlsElements=[this.#r._uiManager.getCommentDialogElement()],e.setAttribute(`data-l10n-id`,`pdfjs-editor-add-comment-button`));let n=this.#r._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener(`contextmenu`,noContextMenu,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{this.#r._focusEventsAllowed=!1,stopEvent(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{this.#r._focusEventsAllowed=!0,stopEvent(e)},{capture:!0,signal:n})),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:n});let r=t=>{t.preventDefault(),e===this.#t?this.edit():this.#r.toggleComment(!0)};return e.addEventListener(`click`,r,{capture:!0,signal:n}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(this.#n=!0,r(t))},{signal:n}),e.addEventListener(`pointerenter`,()=>{this.#r.toggleComment(!1,!0)},{signal:n}),e.addEventListener(`pointerleave`,()=>{this.#r.toggleComment(!1,!1)},{signal:n}),e}edit(e){let t=this.commentPopupPositionInLayer,n,r;if(t)[n,r]=t;else{[n,r]=this.#r.commentButtonPosition;let{width:e,height:t,x:i,y:a}=this.#r;n=i+n*e,r=a+r*t}let i=this.#r.parent.boundingClientRect,{x:a,y:o,width:s,height:c}=i;this.#r._uiManager.editComment(this.#r,a+n*s,o+r*c,{...e,parentDimensions:i})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#n}),this.#n=!1)}isDeleted(){return this.#c||this.#o===``}isEmpty(){return this.#o===null}hasBeenEdited(){return this.isDeleted()||this.#o!==this.#i}serialize(){return this.data}get data(){return{text:this.#o,richText:this.#a,date:this.#s,deleted:this.isDeleted()}}set data(e){if(e!==this.#o&&(this.#a=null),e===null){this.#o=``,this.#c=!0;return}this.#o=e,this.#s=new Date,this.#c=!1}restoreData({text:e,richText:t,date:n}){this.#o=e,this.#a=t,this.#s=n,this.#c=!1}setInitialText(e,t=null){this.#i=e,this.data=e,this.#s=null,this.#a=t}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#o=``,this.#a=null,this.#s=null,this.#r=null,this.#n=!1,this.#c=!1}};function preventDefault(e){e.preventDefault()}var MIN_TOUCH_SPAN=1e-4;function stopTouchEvent(e){return e.cancelable?(stopEvent(e),!0):(e.stopPropagation(),!1)}var TouchManager=class{#e;#t=!1;#n=null;#r;#i;#a;#o;#s;#c=!1;#l=null;#u;#d=new Set;#f=null;#p;#m=null;#h=0;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:i=null,onPinchEnd:a=null,onPanning:o=null,signal:s}){this.#e=e,this.#n=n,this.#r=t,this.#i=r,this.#a=i,this.#o=a,this.#s=o,this.#p=new AbortController,this.#u=AbortSignal.any([s,this.#p.signal]),e.addEventListener(`touchstart`,this.#g.bind(this),{passive:!1,signal:this.#u})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/OutputScale.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/OutputScale.pixelRatio}#g(e){if(this.#r?.())return;this.#v(e);let t=this.#d;for(let{identifier:n}of e.changedTouches)t.add(n);if(t.size===1){this.#_();return}if(!this.#m){this.#m=new AbortController;let e=AbortSignal.any([this.#u,this.#m.signal]),t=this.#e,n={signal:e,capture:!1,passive:!1};t.addEventListener(`touchmove`,this.#x.bind(this),n);let r=this.#S.bind(this);t.addEventListener(`touchend`,r,n),t.addEventListener(`touchcancel`,r,n),n.capture=!0,t.addEventListener(`pointerdown`,stopEvent,n),t.addEventListener(`pointermove`,stopEvent,n),t.addEventListener(`pointercancel`,preventDefault,n),t.addEventListener(`pointerup`,preventDefault,n),this.#i?.()}this.#c=stopTouchEvent(e),this.#b(e)}#_(){if(this.#l)return;let e=this.#l=new AbortController,t=AbortSignal.any([this.#u,e.signal]),n=this.#e,r={capture:!0,signal:t,passive:!1},i=e=>{e.pointerType===`touch`&&(this.#l?.abort(),this.#l=null)};n.addEventListener(`pointerdown`,e=>{e.pointerType===`touch`&&(stopEvent(e),i(e))},r),n.addEventListener(`pointerup`,i,r),n.addEventListener(`pointercancel`,i,r)}#v(e){let t=this.#d;if(t.size===0)return;let n=this.#d=new Set;for(let{identifier:r}of e.touches)t.has(r)&&n.add(r)}#y(e){let t=this.#d,n=[];for(let r of e.touches)t.has(r.identifier)&&n.push(r);return n}#b(e){let t=this.#y(e);if(t.length!==2||this.#n?.()){this.#f=null;return}let[n,r]=t;this.#f={touch0X:n.screenX,touch0Y:n.screenY,touch1X:r.screenX,touch1Y:r.screenY,panX:(n.clientX+r.clientX)/2,panY:(n.clientY+r.clientY)/2,screenPanX:(n.screenX+r.screenX)/2,screenPanY:(n.screenY+r.screenY)/2}}#x(e){if(!this.#f)return;let t=this.#y(e);if(t.length!==2)return;let n=this.#c;if(this.#c=stopTouchEvent(e),!this.#c)return;if(!n){this.#b(e);return}let[r,i]=t,{screenX:a,screenY:o}=r,{screenX:s,screenY:c}=i,l=this.#f,{touch0X:u,touch0Y:d,touch1X:f,touch1Y:p,panX:m,panY:h}=l,g=f-u,_=p-d,v=s-a,y=c-o,b=(r.clientX+i.clientX)/2,x=(r.clientY+i.clientY)/2;l.panX=b,l.panY=x;let S=b-m,C=x-h,w=(a+s)/2,T=(o+c)/2,E=Math.hypot(w-l.screenPanX,T-l.screenPanY);l.screenPanX=w,l.screenPanY=T;let D=Math.hypot(v,y),O=Math.hypot(g,_),k=this.#t?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*E;if(D<MIN_TOUCH_SPAN||O<MIN_TOUCH_SPAN||Math.abs(O-D)<=k){(S||C)&&this.#s?.(S,C);return}l.touch0X=a,l.touch0Y=o,l.touch1X=s,l.touch1Y=c;let A=Math.sign(D-O);if(!this.#t){this.#t=!0,this.#h=A,(S||C)&&this.#s?.(S,C);return}if(this.#h){let e=this.#h;if(this.#h=0,A!==e&&Math.abs(D-O)<=2*E){this.#t=!1,(S||C)&&this.#s?.(S,C);return}}this.#a?.([m,h],O,D,S,C)}#S(e){if(this.#v(e),this.#d.size>=2){this.#b(e);return}let t=!!this.#f;this.#C(),this.#d.size===1&&this.#_(),t&&stopTouchEvent(e)}#C(){this.#f=null,this.#t=!1,this.#h=0,this.#c=!1,this.#m&&(this.#m.abort(),this.#m=null,this.#o?.())}destroy(){this.#C(),this.#d.clear(),this.#p?.abort(),this.#p=null,this.#l?.abort(),this.#l=null}},AnnotationEditor=class e{#e=null;#t=null;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=``;#c=null;#l=null;#u=null;#d=null;#f=null;#p=``;#m=!1;#h=null;#g=!1;#_=!1;#v=!1;#y=null;#b=0;#x=0;#S=null;#C=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#w=!1;#T=e._zIndex++;static _borderLineWidth=-1;static _colorManager=new ColorManager;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=e.prototype._resizeWithKeyboard,n=AnnotationEditorUIManager.TRANSLATE_SMALL,r=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,`_resizerKeyboardManager`,new KeyboardManager([[[`ArrowLeft`],t,{args:[-n,0]}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t,{args:[-r,0]}],[[`ArrowRight`],t,{args:[n,0]}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t,{args:[r,0]}],[[`ArrowUp`],t,{args:[0,-n]}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t,{args:[0,-r]}],[[`ArrowDown`],t,{args:[0,n]}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t,{args:[0,r]}],[[`Escape`],e.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[i,a];let[o,s]=this.parentDimensions;this.x=e.x/o,this.y=e.y/s,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return shadow(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new FakeEditor({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(t,n){if(e._l10n??=t,e._l10nAlert??=Object.freeze({highlight:`pdfjs-editor-highlight-added-alert`,freetext:`pdfjs-editor-freetext-added-alert`,ink:`pdfjs-editor-ink-added-alert`,stamp:`pdfjs-editor-stamp-added-alert`,signature:`pdfjs-editor-signature-added-alert`}),e._l10nResizer??=Object.freeze({topLeft:`pdfjs-editor-resizer-top-left`,topMiddle:`pdfjs-editor-resizer-top-middle`,topRight:`pdfjs-editor-resizer-top-right`,middleRight:`pdfjs-editor-resizer-middle-right`,bottomRight:`pdfjs-editor-resizer-bottom-right`,bottomMiddle:`pdfjs-editor-resizer-bottom-middle`,bottomLeft:`pdfjs-editor-resizer-bottom-left`,middleLeft:`pdfjs-editor-resizer-middle-left`}),e._borderLineWidth!==-1)return;let r=getComputedStyle(document.documentElement);e._borderLineWidth=parseFloat(r.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){unreachable(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#w}set _isDraggable(e){this.#w=e,this.div?.classList.toggle(`draggable`,e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#T}setParent(e){e===null?(this.#G(),this.#d?.remove(),this.#d=null):(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#m?this.#m=!1:this.parent.setSelected(this))}focusout(e){this._focusEventsAllowed&&this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}#E([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#E(this.parentDimensions,e,t)}translateInPage(e,t){this.#h||=[this.x,this.y,this.width,this.height],this.#E(this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){this.#h||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this,[s,c]=this.getBaseTranslation();a+=s,o+=c;let{style:l}=n;l.left=`${(100*a).toFixed(2)}%`,l.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o)}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#h&&(this.#h[0]!==this.x||this.#h[1]!==this.y)}get _hasBeenResized(){return!!this.#h&&(this.#h[2]!==this.width||this.#h[3]!==this.height)}getBaseTranslation(){let[t,n]=this.parentDimensions,{_borderLineWidth:r}=e,i=r/t,a=r/n;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,r]}=this,{x:i,y:a,width:o,height:s}=this;if(o*=n,s*=r,i*=n,a*=r,this._mustFixPosition)switch(e){case 0:i=MathClamp(i,0,n-o),a=MathClamp(a,0,r-s);break;case 90:i=MathClamp(i,0,n-s),a=MathClamp(a,o,r);break;case 180:i=MathClamp(i,o,n),a=MathClamp(a,s,r);break;case 270:i=MathClamp(i,s,n),a=MathClamp(a,0,r-o);break}this.x=i/=n,this.y=a/=r;let[c,l]=this.getBaseTranslation();i+=c,a+=l,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}static#D(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(t,n){return e.#D(t,n,this.parentRotation)}pageTranslationToScreen(t,n){return e.#D(t,n,360-this.parentRotation)}#O(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#k(){if(this.#c)return;this.#c=document.createElement(`div`),this.#c.classList.add(`resizers`);let e=this._willKeepAspectRatio?[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`]:[`topLeft`,`topMiddle`,`topRight`,`middleRight`,`bottomRight`,`bottomMiddle`,`bottomLeft`,`middleLeft`],t=this._uiManager._signal;for(let n of e){let e=document.createElement(`div`);this.#c.append(e),e.classList.add(`resizer`,n),e.setAttribute(`data-resizer-name`,n),e.addEventListener(`pointerdown`,this.#A.bind(this,n),{signal:t}),e.addEventListener(`contextmenu`,noContextMenu,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#c)}#A(e,t){t.preventDefault();let{isMac:n}=FeatureTest.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#n?.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,this.#l=[t.screenX,t.screenY];let i=new AbortController,a=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener(`pointermove`,this.#N.bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener(`touchmove`,stopEvent,{passive:!1,signal:a}),window.addEventListener(`contextmenu`,noContextMenu,{signal:a}),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let o=this.parent.div.style.cursor,s=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let c=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=o,this.div.style.cursor=s,this.#M()};window.addEventListener(`pointerup`,c,{signal:a}),window.addEventListener(`blur`,c,{signal:a})}#j(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#M(){if(!this.#u)return;let{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=this.#u;this.#u=null;let i=this.x,a=this.y,o=this.width,s=this.height;i===e&&a===t&&o===n&&s===r||this.addCommands({cmd:this.#j.bind(this,i,a,o,s),undo:this.#j.bind(this,e,t,n,r),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#N(t,n){let[r,i]=this.parentDimensions,a=this.x,o=this.y,s=this.width,c=this.height,l=e.MIN_SIZE/r,u=e.MIN_SIZE/i,d=this.#O(this.rotation),f=(e,t)=>[d[0]*e+d[2]*t,d[1]*e+d[3]*t],p=this.#O(360-this.rotation),m=(e,t)=>[p[0]*e+p[2]*t,p[1]*e+p[3]*t],h,g,_=!1,v=!1;switch(t){case`topLeft`:_=!0,h=(e,t)=>[0,0],g=(e,t)=>[e,t];break;case`topMiddle`:h=(e,t)=>[e/2,0],g=(e,t)=>[e/2,t];break;case`topRight`:_=!0,h=(e,t)=>[e,0],g=(e,t)=>[0,t];break;case`middleRight`:v=!0,h=(e,t)=>[e,t/2],g=(e,t)=>[0,t/2];break;case`bottomRight`:_=!0,h=(e,t)=>[e,t],g=(e,t)=>[0,0];break;case`bottomMiddle`:h=(e,t)=>[e/2,t],g=(e,t)=>[e/2,0];break;case`bottomLeft`:_=!0,h=(e,t)=>[0,t],g=(e,t)=>[e,0];break;case`middleLeft`:v=!0,h=(e,t)=>[0,t/2],g=(e,t)=>[e,t/2];break}let y=h(s,c),b=g(s,c),x=f(...b),S=e._round(a+x[0]),C=e._round(o+x[1]),w=1,T=1,E,D;if(n.fromKeyboard)({deltaX:E,deltaY:D}=n);else{let{screenX:e,screenY:t}=n,[r,i]=this.#l;[E,D]=this.screenToPageTranslation(e-r,t-i),this.#l[0]=e,this.#l[1]=t}if([E,D]=m(E/r,D/i),_){let e=Math.hypot(s,c);w=T=Math.max(Math.min(Math.hypot(b[0]-y[0]-E,b[1]-y[1]-D)/e,1/s,1/c),l/s,u/c)}else v?w=MathClamp(Math.abs(b[0]-y[0]-E),l,1)/s:T=MathClamp(Math.abs(b[1]-y[1]-D),u,1)/c;let O=e._round(s*w),k=e._round(c*T);x=f(...g(O,k));let A=S-x[0],j=C-x[1];this.#h||=[this.x,this.y,this.width,this.height],this.width=O,this.height=k,this.x=A,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#_)return this._editToolbar;this._editToolbar=new EditorToolbar(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton(`comment`,this.addCommentButton()),this._editToolbar.addButton(`delete`),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore(`comment`,this.addCommentButton(),`.deleteButton`)}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton(`comment`)}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){let t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#n||(AltText.initialize(e._l10n),this.#n=new AltText(this),this.#e&&=(this.#n.data=this.#e,null)),this.#n}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#r?.focusButton()}addCommentButton(){return this.canAddComment?this.#r||=new Comment(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#i){this._uiManager.isEditingMode()&&this.#i.classList.remove(`hidden`);return}this.hasComment&&(this.#i=this.#r.renderForStandalone(),this.div.append(this.#i))}}removeStandaloneCommentButton(){this.#r.removeStandaloneCommentButton(),this.#i=null}hideStandaloneCommentButton(){this.#i?.classList.add(`hidden`)}get comment(){if(!this.#r)return null;let{data:{richText:e,text:t,date:n,deleted:r}}=this.#r;return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#r||=new Comment(this),typeof e==`object`&&e?this.#r.restoreData(e):this.#r.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(this.#r||=new Comment(this),this.#r.setInitialText(e,n),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){return this.#r?.hasBeenEdited()}get hasDeletedComment(){return this.#r?.isDeleted()}get hasComment(){return!!this.#r&&!this.#r.isEmpty()&&!this.#r.isDeleted()}async editComment(e){this.#r||=new Comment(this),this.#r.edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){this.#r.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let t=180,n=100,[,,,r]=e.rect,[i]=this.pageDimensions,[a]=this.pageTranslation,o=a+i+1,s=r-100,c=o+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,s,c,r]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){this.#r.data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement(`div`);e.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),e.className=this.name,e.setAttribute(`id`,this.id),e.tabIndex=this.#a?-1:0,e.setAttribute(`role`,`application`),this.defaultL10nId&&e.setAttribute(`data-l10n-id`,this.defaultL10nId),this._isVisible||e.classList.add(`hidden`),this.setInForeground(),this.#z();let[t,n]=this.parentDimensions;this.parentRotation%180!=0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);let[r,i]=this.getInitialTranslation();return this.translate(r,i),bindEvents(this,e,[`keydown`,`pointerdown`,`dblclick`]),this.#B(),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#P(){this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#F(t,n,r){let i=.7,a=r/n*i+1-i;if(a===1)return;let o=this.#O(this.rotation),s=(e,t)=>[o[0]*e+o[2]*t,o[1]*e+o[3]*t],[c,l]=this.parentDimensions,u=this.x,d=this.y,f=this.width,p=this.height,m=e.MIN_SIZE/c,h=e.MIN_SIZE/l;a=Math.max(Math.min(a,1/f,1/p),m/f,h/p);let g=e._round(f*a),_=e._round(p*a);if(g===f&&_===p)return;this.#h||=[u,d,f,p];let v=s(f/2,p/2),y=e._round(u+v[0]),b=e._round(d+v[1]),x=s(g/2,_/2);this.x=y-x[0],this.y=b-x[1],this.width=g,this.height=_,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#I(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#M()}pointerdown(e){let{isMac:t}=FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(this.#m=!0,this._isDraggable){this.#R(e);return}this.#L(e)}#L(e){let{isMac:t}=FeatureTest.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#R(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1,r=new AbortController,i=this._uiManager.combinedSignal(r),a={capture:!0,passive:!1,signal:i},o=e=>{r.abort(),this.#o=null,this.#m=!1,this._uiManager.endDragSession()||this.#L(e),n&&this._onStopDragging()};t&&(this.#b=e.clientX,this.#x=e.clientY,this.#o=e.pointerId,this.#s=e.pointerType,window.addEventListener(`pointermove`,e=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:t,clientY:r,pointerId:i}=e;if(i!==this.#o){stopEvent(e);return}let[a,o]=this.screenToPageTranslation(t-this.#b,r-this.#x);this.#b=t,this.#x=r,this._uiManager.dragSelectedEditors(a,o),this.div.scrollIntoView({block:`nearest`})},a),window.addEventListener(`touchmove`,stopEvent,a),window.addEventListener(`pointerdown`,e=>{e.pointerType===this.#s&&(this.#C||e.isPrimary)&&o(e),stopEvent(e)},a));let s=e=>{if(!this.#o||this.#o===e.pointerId){o(e);return}stopEvent(e)};window.addEventListener(`pointerup`,s,{signal:i}),window.addEventListener(`blur`,s,{signal:i})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let r=this.parentScale,[i,a]=this.pageDimensions,[o,s]=this.pageTranslation,c=e/r,l=t/r,u=this.x*i,d=this.y*a,f=this.width*i,p=this.height*a;switch(n){case 0:return[u+c+o,a-d-l-p+s,u+c+f+o,a-d-l+s];case 90:return[u+l+o,a-d+c+s,u+l+p+o,a-d+c+f+s];case 180:return[u-c-f+o,a-d+l+s,u-c+o,a-d+l+p+s];case 270:return[u-l-p+o,a-d-c-f+s,u-l+o,a-d-c+s];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&e._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#r?.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:a},uid:o,pageIndex:s,creationDate:c,modificationDate:l}=this;return{id:o,pageIndex:s,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:c,modificationDate:n||l,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#_=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#_=!1,!0):!1}isInEditMode(){return this.#_}shouldGetKeyboardEvents(){return this.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:a}=window;return t<a&&r>0&&e<i&&n>0}#z(){if(this.#f||!this.div)return;this.#f=new AbortController;let e=this._uiManager.combinedSignal(this.#f);this.div.addEventListener(`focusin`,this.focusin.bind(this),{signal:e}),this.div.addEventListener(`focusout`,this.focusout.bind(this),{signal:e})}#B(){this.#C||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||(this.#C=new TouchManager({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#P.bind(this),onPinching:this.#F.bind(this),onPinchEnd:this.#I.bind(this),signal:this._uiManager._signal}))}rebuild(){this.#z(),this.#B()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||``}}serialize(e=!1,t=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||``}}static async deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,r.#e=e.accessibilityData,r._isCopy=e.isCopy||!1;let[i,a]=r.pageDimensions,[o,s,c,l]=r.getRectInCurrentCoords(e.rect,a);return r.x=o/i,r.y=s/a,r.width=c/i,r.height=l/a,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.#C?.destroy(),this.#C=null,this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&=(clearTimeout(this.#y),null),this.#G(),this.removeEditToolbar(),this.#S){for(let e of this.#S.values())clearTimeout(e);this.#S=null}this.parent=null,this.#d?.remove(),this.#d=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#k(),this.#c.classList.remove(`hidden`))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction===`ltr`?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,n]}=this,[r,i,a,o]=this.getPDFRect();return[e._round(r+(a-r)*t),e._round(i+(o-i)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#r.commentPopupPositionInLayer}set commentPopupPosition(e){this.#r.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#r.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#r.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#r?.setCommentButtonStates(e)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!==`Enter`)return;this._uiManager.setSelected(this),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let n=this.#c.children;if(!this.#t){this.#t=Array.from(n);let t=this.#V.bind(this),r=this.#H.bind(this),i=this._uiManager._signal;for(let n of this.#t){let a=n.getAttribute(`data-resizer-name`);n.setAttribute(`role`,`spinbutton`),n.addEventListener(`keydown`,t,{signal:i}),n.addEventListener(`blur`,r,{signal:i}),n.addEventListener(`focus`,this.#U.bind(this,a),{signal:i}),n.setAttribute(`data-l10n-id`,e._l10nResizer[a])}}let r=this.#t[0],i=0;for(let e of n){if(e===r)break;i++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==i){if(a<i)for(let e=0;e<i-a;e++)this.#c.append(this.#c.firstElementChild);else if(a>i)for(let e=0;e<a-i;e++)this.#c.firstElementChild.before(this.#c.lastElementChild);let t=0;for(let r of n){let n=this.#t[t++].getAttribute(`data-resizer-name`);r.setAttribute(`data-l10n-id`,e._l10nResizer[n])}}this.#W(0),this.#v=!0,this.#c.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#V(t){e._resizerKeyboardManager.exec(this,t)}#H(e){this.#v&&e.relatedTarget?.parentNode!==this.#c&&this.#G()}#U(e){this.#p=this.#v?e:``}#W(e){if(this.#t)for(let t of this.#t)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#v&&this.#N(this.#p,{deltaX:e,deltaY:t,fromKeyboard:!0})}#G(){this.#v=!1,this.#W(-1),this.#M()}_stopResizingWithKeyboard(){this.#G(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add(`selectedEditor`),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains(`selectedEditor`)&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#c?.classList.add(`hidden`),this.div?.classList.remove(`selectedEditor`),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!==`BUTTON`&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(e){this.#g=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:`added`}}get telemetryFinalData(){return null}_reportTelemetry(t,n=!1){if(n){this.#S||=new Map;let{action:n}=t,r=this.#S.get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(t),this.#S.delete(n),this.#S.size===0&&(this.#S=null)},e._telemetryTimeout),this.#S.set(n,r);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:t}})}show(e=this._isVisible){this.div.classList.toggle(`hidden`,!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#a=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#a=!0}updateFakeAnnotationElement(e){if(!this.#d&&!this.deleted){this.#d=e.addFakeAnnotation(this);return}if(this.deleted){this.#d.remove(),this.#d=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#d.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(`.annotationContent`);if(!t)t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.container.prepend(t);else if(t.nodeName===`CANVAS`){let e=t;t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;t?.nodeName===`DIV`&&t.classList.contains(`annotationContent`)&&t.remove()}},FakeEditor=class extends AnnotationEditor{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},SEED=3285377520,MASK_HIGH=4294901760,MASK_LOW=65535,MurmurHash3_64=class{constructor(e){this.h1=e?e&4294967295:SEED,this.h2=e?e&4294967295:SEED}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw Error(`Invalid data format, must be a string or TypedArray.`);let r=n>>2,i=n-r*4,a=new Uint32Array(t.buffer,0,r),o=0,s=0,c=this.h1,l=this.h2,u=3432918353,d=461845907,f=11601,p=13715;for(let e=0;e<r;e++)e&1?(o=a[e],o=o*u&MASK_HIGH|o*f&MASK_LOW,o=o<<15|o>>>17,o=o*d&MASK_HIGH|o*p&MASK_LOW,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&MASK_HIGH|s*f&MASK_LOW,s=s<<15|s>>>17,s=s*d&MASK_HIGH|s*p&MASK_LOW,l^=s,l=l<<13|l>>>19,l=l*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*u&MASK_HIGH|o*f&MASK_LOW,o=o<<15|o>>>17,o=o*d&MASK_HIGH|o*p&MASK_LOW,r&1?c^=o:l^=o}this.h1=c,this.h2=l}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&MASK_HIGH|e*36045&MASK_LOW,t=t*4283543511&MASK_HIGH|((t<<16|e>>>16)*2950163797&MASK_HIGH)>>>16,e^=t>>>1,e=e*444984403&MASK_HIGH|e*60499&MASK_LOW,t=t*3301882366&MASK_HIGH|((t<<16|e>>>16)*3120437893&MASK_HIGH)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},SerializableEmpty=Object.freeze({map:null,hash:``,transfer:void 0}),AnnotationStorage=class{#e=!1;#t=null;#n=null;#r=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(e,t){let n=this.#r.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#r.get(e)}remove(e){let t=this.#r.get(e);t!==void 0&&(t instanceof AnnotationEditor&&this.#n.delete(t.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),!this.#r.values().some(e=>e instanceof AnnotationEditor)&&this.onAnnotationEditor?.(null))}setValue(e,t){let n=this.#r.get(e),r=!1;if(n!==void 0)for(let[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this.#r.set(e,t);r&&this.#i(),t instanceof AnnotationEditor&&((this.#n||=new Map).set(t.annotationElementId,t),this.onAnnotationEditor?.(t.constructor._type))}has(e){return this.#r.has(e)}get size(){return this.#r.size}#i(){this.#e||(this.#e=!0,this.onSetModified?.())}resetModified(){this.#e&&(this.#e=!1,this.onResetModified?.())}get print(){return new PrintAnnotationStorage(this)}get serializable(){if(this.#r.size===0)return SerializableEmpty;let e=new Map,t=new MurmurHash3_64,n=[],r=Object.create(null),i=!1;for(let[n,a]of this.#r){let o=a instanceof AnnotationEditor?a.serialize(!1,r):a;a.page&&(a.pageIndex=a.page._pageIndex,delete a.page),o&&(e.set(n,o),t.update(`${n}:${JSON.stringify(o)}`),i||=!!o.bitmap)}if(i)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:SerializableEmpty}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let i of this.#r.values()){if(!(i instanceof AnnotationEditor)){i.popup&&(i.popup.deleted?r+=1:n+=1);continue}i.isCommentDeleted?r+=1:i.hasEditedComment&&(n+=1);let a=i.telemetryFinalData;if(!a)continue;let{type:o}=a;t.getOrInsertComputed(o,()=>Object.getPrototypeOf(i).constructor),e||=Object.create(null);let s=e[o]||=new Map;for(let[e,t]of Object.entries(a)){if(e===`type`)continue;let n=s.getOrInsertComputed(e,makeMap);n.set(t,(n.get(t)??0)+1)}}if((r>0||n>0)&&(e||=Object.create(null),e.comments={deleted:r,edited:n}),!e)return null;for(let[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,t){let n=this.#n?.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let t of this.#n.values())t.serialize()&&e.push(t.annotationElementId);let t=``;if(e.length){let n=new MurmurHash3_64;n.update(e.join(`,`)),t=n.hexdigest()}return this.#t={ids:new Set(e),hash:t}}[Symbol.iterator](){return this.#r.entries()}},PrintAnnotationStorage=class extends AnnotationStorage{#e=SerializableEmpty;constructor(e){super();let{serializable:t}=e;if(t===SerializableEmpty)return;let{map:n,hash:r,transfer:i}=t,a=structuredClone(n,i?{transfer:i}:null);this.#e={map:a,hash:r,transfer:[]}}get print(){unreachable(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}get modifiedIds(){return shadow(this,`modifiedIds`,{ids:new Set,hash:``})}},FORCED_DEPENDENCY_LABEL=`__forcedDependency`,{floor,ceil}=Math;function expandBBox(e,t,n,r,i,a){e[t*4+0]=Math.min(e[t*4+0],n),e[t*4+1]=Math.min(e[t*4+1],r),e[t*4+2]=Math.max(e[t*4+2],i),e[t*4+3]=Math.max(e[t*4+3],a)}function scaleCharBBox(e,t,n,r,i){let a;e?(e<0&&(a=i[0],i[0]=i[2],i[2]=a),i[0]*=e,i[2]*=e,t<0&&(a=i[1],i[1]=i[3],i[3]=a),i[1]*=t,i[3]*=t):i.fill(0),i[0]+=n,i[1]+=r,i[2]+=n,i[3]+=r}var EMPTY_BBOX=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],BBoxReader=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===EMPTY_BBOX}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}},ensureDebugMetadata=(e,t)=>e?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),CanvasBBoxTracker=class{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(BBOX_INIT);_pendingBBoxIdx=-1;#r;#i;#a;#o;_savesStack=[];_markedContentStack=[];constructor(e,t){this.#r=e.width,this.#i=e.height,this.#s(t)}growOperationsCount(e){e>=this.#o.length&&this.#s(e,this.#o)}#s(e,t){let n=new ArrayBuffer(e*4);this.#a=new Uint8ClampedArray(n),this.#o=new Uint32Array(n),t&&t.length>0?(this.#o.set(t),this.#o.fill(EMPTY_BBOX,t.length)):this.#o.fill(EMPTY_BBOX)}get clipBox(){return this.#t}save(e){return this.#t={__proto__:this.#t},this._savesStack.push(e),this}restore(e,t){let n=Object.getPrototypeOf(this.#t);if(n===null)return this;this.#t=n;let r=this._savesStack.pop();return r!==void 0&&(t?.(r,e),this.#o[e]=this.#o[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){let n=this._savesStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){let n=this._markedContentStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}pushBaseTransform(e){return this.#e.push(Util.multiplyByDOMMatrix(this.#e.at(-1),e.getTransform())),this}popBaseTransform(){return this.#e.length>1&&this.#e.pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,this.#n.set(BBOX_INIT,0)),this}recordClipBox(e,t,n,r,i,a){let o=Util.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform()),s=BBOX_INIT.slice();Util.axialAlignedBoundingBox([n,i,r,a],o,s);let c=Util.intersect(this.#t,s);return c?(this.#t[0]=c[0],this.#t[1]=c[1],this.#t[2]=c[2],this.#t[3]=c[3]):(this.#t[0]=this.#t[1]=1/0,this.#t[2]=this.#t[3]=-1/0),this}recordBBox(e,t,n,r,i,a){let o=this.#t;if(o[0]===1/0)return this;let s=Util.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform());if(o[0]===-1/0)return Util.axialAlignedBoundingBox([n,i,r,a],s,this.#n),this;let c=BBOX_INIT.slice();return Util.axialAlignedBoundingBox([n,i,r,a],s,c),this.#n[0]=MathClamp(c[0],o[0],this.#n[0]),this.#n[1]=MathClamp(c[1],o[1],this.#n[1]),this.#n[2]=MathClamp(c[2],this.#n[2],o[2]),this.#n[3]=MathClamp(c[3],this.#n[3],o[3]),this}recordFullPageBBox(e){return this.#n[0]=Math.max(0,this.#t[0]),this.#n[1]=Math.max(0,this.#t[1]),this.#n[2]=Math.min(this.#r,this.#t[2]),this.#n[3]=Math.min(this.#i,this.#t[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;let r=floor(this.#n[0]*256/this.#r),i=floor(this.#n[1]*256/this.#i),a=ceil(this.#n[2]*256/this.#r),o=ceil(this.#n[3]*256/this.#i);if(expandBBox(this.#a,e,r,i,a,o),n)for(let t of n)for(let n of t)n!==e&&expandBBox(this.#a,n,r,i,a,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,this.#t[0]=Math.max(this.#t[0],this.#n[0]),this.#t[1]=Math.max(this.#t[1],this.#n[1]),this.#t[2]=Math.min(this.#t[2],this.#n[2]),this.#t[3]=Math.min(this.#t[3],this.#n[3])),this}take(){return new BBoxReader(this.#o,this.#a)}takeDebugMetadata(){throw Error(`Unreachable`)}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}},CanvasDependencyTracker=class{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[FORCED_DEPENDENCY_LABEL]:[]};#n=new Map;#r=new Set;#i=new Map;#a;#o;#s;constructor(e,t=!1){this.#s=e,t&&(this.#a=new Map,this.#o=(e,t)=>{ensureDebugMetadata(this.#a,t).dependencies.add(e)})}get clipBox(){return this.#s.clipBox}growOperationsCount(e){this.#s.growOperationsCount(e)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[FORCED_DEPENDENCY_LABEL]:{__proto__:this.#t[FORCED_DEPENDENCY_LABEL]}},this.#s.save(e),this}restore(e){this.#s.restore(e,this.#o);let t=Object.getPrototypeOf(this.#e);return t===null?this:(this.#e=t,this.#t=Object.getPrototypeOf(this.#t),this)}recordOpenMarker(e){return this.#s.recordOpenMarker(e,this.#o),this}getOpenMarker(){return this.#s.getOpenMarker()}recordCloseMarker(e){return this.#s.recordCloseMarker(e,this.#o),this}beginMarkedContent(e){return this.#s.beginMarkedContent(e),this}endMarkedContent(e){return this.#s.endMarkedContent(e,this.#o),this}pushBaseTransform(e){return this.#s.pushBaseTransform(e),this}popBaseTransform(){return this.#s.popBaseTransform(),this}recordSimpleData(e,t){return this.#e[e]=t,this}recordIncrementalData(e,t){return this.#t[e].push(t),this}resetIncrementalData(e,t){return this.#t[e].length=0,this}recordNamedData(e,t){return this.#n.set(e,t),this}recordSimpleDataFromNamed(e,t,n){this.#e[e]=this.#n.get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(FORCED_DEPENDENCY_LABEL,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in this.#e&&this.recordFutureForcedDependency(t,this.#e[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#r)this.recordFutureForcedDependency(FORCED_DEPENDENCY_LABEL,e);return this}resetBBox(e){return this.#s.resetBBox(e),this}recordClipBox(e,t,n,r,i,a){return this.#s.recordClipBox(e,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#s.recordBBox(e,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){let s=n.bbox,c,l;if(s&&(c=s[2]!==s[0]&&s[3]!==s[1]&&this.#i.get(n),c!==!1&&(l=[0,0,0,0],Util.axialAlignedBoundingBox(s,n.fontMatrix,l),(r!==1||i!==0||a!==0)&&scaleCharBBox(r,-r,i,a,l),c)))return this.recordBBox(e,t,l[0],l[2],l[1],l[3]);if(!o)return this.recordFullPageBBox(e);let u=o();return s&&l&&c===void 0&&(c=l[0]<=i-u.actualBoundingBoxLeft&&l[2]>=i+u.actualBoundingBoxRight&&l[1]<=a-u.actualBoundingBoxAscent&&l[3]>=a+u.actualBoundingBoxDescent,this.#i.set(n,c),c)?this.recordBBox(e,t,l[0],l[2],l[1],l[3]):this.recordBBox(e,t,i-u.actualBoundingBoxLeft,i+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#s.recordFullPageBBox(e),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,t){let n=this.#r,r=this.#e,i=this.#t;for(let e of t)e in this.#e?n.add(r[e]):e in i&&i[e].forEach(n.add,n);return this}recordNamedDependency(e,t){return this.#n.has(t)&&this.#r.add(this.#n.get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[FORCED_DEPENDENCY_LABEL]),this.#a){let t=ensureDebugMetadata(this.#a,e),{dependencies:n}=t;this.#r.forEach(n.add,n),this.#s._savesStack.forEach(n.add,n),this.#s._markedContentStack.forEach(n.add,n),n.delete(e),t.isRenderingOperation=!0}let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.recordOperation(e,t,[this.#r,this.#s._savesStack,this.#s._markedContentStack]),n&&this.#r.clear(),this}recordShowTextOperation(e,t=!1){let n=Array.from(this.#r);this.recordOperation(e,t),this.recordIncrementalData(`sameLineText`,e);for(let e of n)this.recordIncrementalData(`sameLineText`,e);return this}bboxToClipBoxDropOperation(e,t=!1){let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.bboxToClipBoxDropOperation(e),n&&this.#r.clear(),this}take(){return this.#i.clear(),this.#s.take()}takeDebugMetadata(){return this.#a}},CanvasNestedDependencyTracker=class e{#e;#t;#n;#r=0;#i=0;constructor(t,n,r){if(t instanceof e&&t.#n===!!r)return t;this.#e=t,this.#t=n,this.#n=!!r}get clipBox(){return this.#e.clipBox}growOperationsCount(){throw Error(`Unreachable`)}save(e){return this.#i++,this.#e.save(this.#t),this}restore(e){return this.#i>0&&(this.#e.restore(this.#t),this.#i--),this}recordOpenMarker(e){return this.#r++,this}getOpenMarker(){return this.#r>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#r--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,t){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,t){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,t){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this.#e.recordSimpleDataFromNamed(e,t,this.#t),this}recordFutureForcedDependency(e,t){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#n||this.#e.resetBBox(this.#t),this}recordClipBox(e,t,n,r,i,a){return this.#n||this.#e.recordClipBox(this.#t,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#n||this.#e.recordBBox(this.#t,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r,i,a,o){return this.#n||this.#e.recordCharacterBBox(this.#t,t,n,r,i,a,o),this}recordFullPageBBox(e){return this.#n||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,t){return this.#e.recordDependencies(this.#t,t),this}recordNamedDependency(e,t){return this.#e.recordNamedDependency(this.#t,t),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#n||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw Error(`Unreachable`)}takeDebugMetadata(){throw Error(`Unreachable`)}},Dependencies={stroke:[`path`,`transform`,`filter`,`strokeColor`,`strokeAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`dash`],fill:[`path`,`transform`,`filter`,`fillColor`,`fillAlpha`,`globalCompositeOperation`,`SMask`],imageXObject:[`transform`,`SMask`,`filter`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`],rawFillPath:[`filter`,`fillColor`,`fillAlpha`],showText:[`transform`,`leading`,`charSpacing`,`wordSpacing`,`hScale`,`textRise`,`moveText`,`textMatrix`,`font`,`fontObj`,`filter`,`fillColor`,`textRenderingMode`,`SMask`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`,`sameLineText`],transform:[`transform`],transformAndFill:[`transform`,`fillColor`]},CanvasImagesTracker=class e{#e;#t;#n=4;#r=0;#i=new e.#a(this.#n*6);static#a=FeatureTest.isFloat16ArraySupported?Float16Array:Float32Array;constructor(e){this.#e=e.width,this.#t=e.height}record(t,n,r,i){if(this.#r===this.#n){this.#n*=2;let t=new e.#a(this.#n*6);t.set(this.#i),this.#i=t}let a=getCurrentTransform(t),o;if(i[0]!==1/0){let e=BBOX_INIT.slice();Util.axialAlignedBoundingBox([0,-r,n,0],a,e);let t=Util.intersect(i,e);if(!t)return;let[s,c,l,u]=t;if(s!==e[0]||c!==e[1]||l!==e[2]||u!==e[3]){let e=Math.atan2(a[1],a[0]),t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e));if(t<1e-6||n<1e-6||Math.abs(t-n)<1e-6)o=[s,c,s,u,l,c];else{let e=l-s,r=u-c,i=t*t,a=n*n,d=n*t,f=a-i,p=(r*a-e*d)/f;o=[s+(r*d-e*i)/f,c,s,c+p,l,u-p]}}}o||(o=[0,-r,0,0,n,-r],Util.applyTransform(o,a,0),Util.applyTransform(o,a,2),Util.applyTransform(o,a,4)),o[0]/=this.#e,o[1]/=this.#t,o[2]/=this.#e,o[3]/=this.#t,o[4]/=this.#e,o[5]/=this.#t,this.#i.set(o,this.#r*6),this.#r++}take(){return this.#i.subarray(0,this.#r*6)}},CONTROL_CHAR_REGEXP=/\p{Cc}/u;function isCSSString(e){let t=e[0];if(e.length<2||t!==`"`&&t!==`'`||e.at(-1)!==t)return!1;let n=e.length-1;for(let r=1;r<n;r++){let i=e[r];if(i===t||CONTROL_CHAR_REGEXP.test(i)||i===`\\`&&(++r>=n||CONTROL_CHAR_REGEXP.test(e[r])))return!1}return!0}function serializeFontFamily(e){return isCSSString(e)?e:`"${e.replaceAll(/["\\\p{Cc}]/gu,e=>e===`"`||e===`\\`?`\\${e}`:`\\${e.codePointAt(0).toString(16)} `)}"`}var FontLoader=class{#e=new Set;#t=null;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){let t=this.#n();t.insertRule(e,t.cssRules.length)}#n(){if(this.#t)return this.#t;let e=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&e){let{adoptedStyleSheets:t}=this._document;if(t){let n=new e;return t.push(n),this.#t=n}}return this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement)),this.#t=this.styleElement.sheet}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);if(this.nativeFontFaces.clear(),this.#e.clear(),this.#t){let{adoptedStyleSheets:e}=this._document;e?.includes(this.#t)&&(this._document.adoptedStyleSheets=e.filter(e=>e!==this.#t)),this.#t=null}this.styleElement&&=(this.styleElement.remove(),null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||this.#e.has(e.loadedName))){if(assert(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:r,style:i}=e,a=new FontFace(t,r,i);this.addNativeFontFace(a);try{await a.load(),this.#e.add(t),n?.(e)}catch{warn(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}unreachable(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw warn(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return shadow(this,`isFontLoadingAPISupported`,e)}get isSyncFontLoadingSupported(){return shadow(this,`isSyncFontLoadingSupported`,isNodeJS||FeatureTest.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(assert(!r.done,`completeRequest() cannot be called twice.`),r.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,r={done:!1,complete:t,callback:e};return n.push(r),r}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return shadow(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function r(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){warn(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=16,m=1482184792,h=n(f,16);for(a=0,o=d.length-3;a<o;a+=4)h=h-m+n(d,a)|0;a<d.length&&(h=h-m+n(d+`XXX`,a)|0),f=i(f,16,4,r(h));let g=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(f)});`}}`;this.insertRule(g);let _=this._document.createElement(`div`);_.style.visibility=`hidden`,_.style.width=_.style.height=`10px`,_.style.position=`absolute`,_.style.top=_.style.left=`0px`;for(let t of[e.loadedName,d]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,_.append(e)}this._document.body.append(_),u(d,()=>{_.remove(),t.complete()})}},FontFaceObject=class{compiledGlyphs=Object.create(null);#e;
7constructor(e,t=null,n,r){this.#e=e,this._inspectFont=t,n&&(this.charProcOperatorList=n),r&&Object.assign(this,r)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(serializeFontFamily(this.cssFontInfo.fontFamily),this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:${serializeFontFamily(this.cssFontInfo.fontFamily)};${n}src:${e}}`}return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n=this.loadedName+`_path_`+t,r;try{r=e.get(n)}catch(e){warn(`getPathGenerator - ignoring character: "${e}".`)}let i=makePathFromDrawOPS(r?.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=i}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace}set disableFontFace(e){shadow(this,`disableFontFace`,!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}},CSS_FONT_INFO=class{static strings=[`fontFamily`,`fontWeight`,`italicAngle`]},SYSTEM_FONT_INFO=class{static strings=[`css`,`loadedName`,`baseFontName`,`src`]},FONT_INFO=class{static bools=[`black`,`bold`,`disableFontFace`,`fontExtraProperties`,`isInvalidPDFjsFont`,`isType3Font`,`italic`,`missingFile`,`remeasure`,`vertical`];static numbers=[`ascent`,`defaultWidth`,`descent`];static strings=[`fallbackName`,`loadedName`,`mimetype`,`name`];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6},PATTERN_INFO=class{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16},InfoUtils=class{static get decoder(){return shadow(this,`decoder`,new TextDecoder)}static get encoder(){return shadow(this,`encoder`,new TextEncoder)}},CssFontInfo=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){assert(e<CSS_FONT_INFO.strings.length,`Invalid string index`);let{decoder:t}=InfoUtils,n=0;for(let t=0;t<e;t++)n+=this.#t.getUint32(n)+4;let r=this.#t.getUint32(n);return t.decode(new Uint8Array(this.#e,n+4,r))}get fontFamily(){return this.#n(0)}get fontWeight(){return this.#n(1)}get italicAngle(){return this.#n(2)}},SystemFontInfo=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}get guessFallback(){return this.#t.getUint8(0)!==0}#n(e){assert(e<SYSTEM_FONT_INFO.strings.length,`Invalid string index`);let{decoder:t}=InfoUtils,n=5;for(let t=0;t<e;t++)n+=this.#t.getUint32(n)+4;let r=this.#t.getUint32(n);return t.decode(new Uint8Array(this.#e,n+4,r))}get css(){return this.#n(0)}get loadedName(){return this.#n(1)}get baseFontName(){return this.#n(2)}get src(){return this.#n(3)}get style(){let{decoder:e}=InfoUtils,t=1;t+=4+this.#t.getUint32(t);let n=this.#t.getUint32(t),r=e.decode(new Uint8Array(this.#e,t+4,n));t+=4+n;let i=this.#t.getUint32(t);return{style:r,weight:e.decode(new Uint8Array(this.#e,t+4,i))}}},FontInfo=class{#e;#t;constructor({buffer:e,extra:t}){this.#e=e,this.#t=new DataView(e),t&&Object.assign(this,t)}#n(e){assert(e<FONT_INFO.bools.length,`Invalid boolean index`);let t=Math.floor(e/4),n=e*2%8,r=this.#t.getUint8(t)>>n&3;return r===0?void 0:r===2}get black(){return this.#n(0)}get bold(){return this.#n(1)}get disableFontFace(){return this.#n(2)}get fontExtraProperties(){return this.#n(3)}get isInvalidPDFjsFont(){return this.#n(4)}get isType3Font(){return this.#n(5)}get italic(){return this.#n(6)}get missingFile(){return this.#n(7)}get remeasure(){return this.#n(8)}get vertical(){return this.#n(9)}#r(e){return assert(e<FONT_INFO.numbers.length,`Invalid number index`),this.#t.getFloat64(FONT_INFO.OFFSET_NUMBERS+e*8)}get ascent(){return this.#r(0)}get defaultWidth(){return this.#r(1)}get descent(){return this.#r(2)}#i(e,t,n,r){let i=this.#t.getUint8(e);if(i===0)return;assert(i===t,`Invalid array length.`),e+=1;let a=Array(i);for(let t=0;t<i;t++)a[t]=this.#t[n](e,!0),e+=r;return a}get bbox(){return this.#i(FONT_INFO.OFFSET_BBOX,4,`getInt16`,2)}get fontMatrix(){return this.#i(FONT_INFO.OFFSET_FONT_MATRIX,6,`getFloat64`,8)}get defaultVMetrics(){return this.#i(FONT_INFO.OFFSET_DEFAULT_VMETRICS,3,`getInt16`,2)}#a(e){assert(e<FONT_INFO.strings.length,`Invalid string index`);let{decoder:t}=InfoUtils,n=FONT_INFO.OFFSET_STRINGS+4;for(let t=0;t<e;t++)n+=this.#t.getUint32(n)+4;let r=this.#t.getUint32(n);return t.decode(new Uint8Array(this.#e,n+4,r))}get fallbackName(){return this.#a(0)}get loadedName(){return this.#a(1)}get mimetype(){return this.#a(2)}get name(){return this.#a(3)}#o(){let e=FONT_INFO.OFFSET_STRINGS,t=this.#t.getUint32(e);e+=4+t;let n=this.#t.getUint32(e);e+=4+n;let r=this.#t.getUint32(e);e+=4+r;let i=this.#t.getUint32(e);return{offset:e,length:i}}get data(){let{offset:e,length:t}=this.#o();return t===0?void 0:new Uint8Array(this.#e,e+4,t)}clearData(){let{offset:e,length:t}=this.#o();t!==0&&(this.#t.setUint32(e,0),this.#e=new Uint8Array(this.#e,0,e+4).slice().buffer,this.#t=new DataView(this.#e))}get cssFontInfo(){let e=FONT_INFO.OFFSET_STRINGS,t=this.#t.getUint32(e);e+=4+t;let n=this.#t.getUint32(e);e+=4+n;let r=this.#t.getUint32(e);if(r===0)return null;let i=new Uint8Array(r);return i.set(new Uint8Array(this.#e,e+4,r)),new CssFontInfo(i.buffer)}get systemFontInfo(){let e=FONT_INFO.OFFSET_STRINGS,t=this.#t.getUint32(e);e+=4+t;let n=this.#t.getUint32(e);if(n===0)return null;let r=new Uint8Array(n);return r.set(new Uint8Array(this.#e,e+4,n)),new SystemFontInfo(r.buffer)}},PatternInfo=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,t=this.data[PATTERN_INFO.KIND],n=!!this.data[PATTERN_INFO.HAS_BBOX],r=!!this.data[PATTERN_INFO.HAS_BACKGROUND],i=e.getUint32(PATTERN_INFO.N_COORD,!0),a=e.getUint32(PATTERN_INFO.N_COLOR,!0),o=e.getUint32(PATTERN_INFO.N_STOP,!0),s=20,c=new Float32Array(this.buffer,s,i*2);s+=i*8;let l=new Uint8Array(this.buffer,s,a*4);s+=a*4;let u=[];for(let t=0;t<o;++t){let t=e.getFloat32(s,!0);s+=4;let n=e.getUint32(s,!0);s+=4,u.push([t,`#${n.toString(16).padStart(6,`0`)}`])}let d=null;if(n){d=[];for(let t=0;t<4;++t)d.push(e.getFloat32(s,!0)),s+=4}let f=null;
7if(r&&(f=new Uint8Array(this.buffer,s,3),s+=3),t===1)return[`RadialAxial`,`axial`,d,u,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(t===2)return[`RadialAxial`,`radial`,d,u,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(t===3){let e=this.data[PATTERN_INFO.SHADING_TYPE],t=null;if(c.length>0){t=BBOX_INIT.slice();for(let e=0,n=c.length;e<n;e+=2)Util.pointBoundingBox(c[e],c[e+1],t)}return[`Mesh`,e,c,l,i,t,d,f]}throw Error(`Unsupported pattern kind: ${t}`)}},FontPathInfo=class{#e;constructor(e){this.#e=e}get path(){return FeatureTest.isFloat16ArraySupported?new Float16Array(this.#e):new Float32Array(this.#e)}};function getUrlProp(e){if(e instanceof URL)return e;if(typeof e==`string`){if(isNodeJS){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let t=process.getBuiltinModule(`url`);return new URL(t.pathToFileURL(e))}let t=URL.parse(e,window.location);if(t)return t}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function getDataProp(e){if(isNodeJS&&typeof Buffer<`u`&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return stringToBytes(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==`object`&&!isNaN(e?.length))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}function getFactoryUrlProp(e){if(typeof e!=`string`)return null;if(e.endsWith(`/`))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var isRefProxy=e=>typeof e==`object`&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,isNameProxy=e=>typeof e==`object`&&typeof e?.name==`string`,isValidExplicitDest=_isValidExplicitDest.bind(null,isRefProxy,isNameProxy),LoopbackPort=class{#e=new Map;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let[e]of this.#e)e.call(this,n)})}addEventListener(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){let{signal:i}=n;if(i.aborted){warn("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}this.#e.set(t,r)}removeEventListener(e,t){this.#e.get(t)?.(),this.#e.delete(t)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}},CallbackKind={DATA:1,ERROR:2},StreamKind={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function onFn(){}function wrapReason(e){if(e instanceof AbortException||e instanceof InvalidPDFException||e instanceof PasswordException||e instanceof ResponseException||e instanceof UnknownErrorException)return e;switch(e instanceof Error||typeof e==`object`&&e||unreachable(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new AbortException(e.message);case`InvalidPDFException`:return new InvalidPDFException(e.message);case`PasswordException`:return new PasswordException(e.message,e.code);case`ResponseException`:return new ResponseException(e.message,e.status,e.missing);case`UnknownErrorException`:return new UnknownErrorException(e.message,e.details)}return new UnknownErrorException(e.message,e.toString())}var MessageHandler=class{#e=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener(`message`,this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#r(e);return}if(e.callback){let t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===CallbackKind.DATA)n.resolve(e.data);else if(e.callback===CallbackKind.ERROR)n.reject(wrapReason(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.actionHandler[e.action];if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(t){i.postMessage({sourceName:n,targetName:r,callback:CallbackKind.DATA,callbackId:e.callbackId,data:t})},function(t){i.postMessage({sourceName:n,targetName:r,callback:CallbackKind.ERROR,callbackId:e.callbackId,reason:wrapReason(t)})});return}if(e.streamId){this.#n(e);return}t(e.data)}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}
7sendWithPromise(e,t,n){let r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.streamId++,a=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.streamControllers[i]={controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:n.desiredSize},r),c.promise},pull:e=>{let t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:StreamKind.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{assert(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:StreamKind.CANCEL,streamId:i,reason:wrapReason(e)}),t.promise}},n)}#n(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this,o=this.actionHandler[e.action],s={enqueue(e,a=1,o){if(this.isCancelled)return;let s=this.desiredSize;this.desiredSize-=a,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:StreamKind.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:StreamKind.CLOSE,streamId:t}),delete a.streamSinks[t])},error(e){assert(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:StreamKind.ERROR,streamId:t,reason:wrapReason(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,Promise.try(o,e.data,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:StreamKind.START_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:StreamKind.START_COMPLETE,streamId:t,reason:wrapReason(e)})})}#r(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case StreamKind.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(wrapReason(e.reason));break;case StreamKind.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(wrapReason(e.reason));break;case StreamKind.PULL:if(!o){i.postMessage({sourceName:n,targetName:r,stream:StreamKind.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||onFn).then(function(){i.postMessage({sourceName:n,targetName:r,stream:StreamKind.PULL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:StreamKind.PULL_COMPLETE,streamId:t,reason:wrapReason(e)})});break;case StreamKind.ENQUEUE:if(assert(a,`enqueue should have stream controller`),a.isClosed)break;a.controller.enqueue(e.chunk);break;case StreamKind.CLOSE:if(assert(a,`close should have stream controller`),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#i(a,t);break;case StreamKind.ERROR:assert(a,`error should have stream controller`),a.controller.error(wrapReason(e.reason)),this.#i(a,t);break;case StreamKind.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(wrapReason(e.reason)),this.#i(a,t);break;case StreamKind.CANCEL:if(!o)break;let s=wrapReason(e.reason);Promise.try(o.onCancel||onFn,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:StreamKind.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:StreamKind.CANCEL_COMPLETE,streamId:t,reason:wrapReason(e)})}),o.sinkCapability.reject(s),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async#i(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#e?.abort(),this.#e=null}},BaseBinaryDataFactory=class{#e=Object.freeze({cMapUrl:`CMap`,standardFontDataUrl:`font`,wasmUrl:`wasm`});constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case`cMapUrl`:case`standardFontDataUrl`:case`wasmUrl`:break;default:unreachable(`Not implemented: ${e}`)}let n=this[e];if(!n)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let r=`${n}${t}`;return this._fetch(r,e).catch(t=>{throw Error(`Unable to load ${this.#e[e]} data at: ${r}`)})}async _fetch(e,t){unreachable("Abstract method `_fetch` called.")}},DOMBinaryDataFactory=class extends BaseBinaryDataFactory{async _fetch(e,t){let n=await fetchData(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:stringToBytes(n)}},BaseCanvasFactory=class{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`,{willReadFrequently:!this.#e})}}reset({canvas:e},t,n){if(!e)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.width=t,e.height=n}destroy(e){let{canvas:t}=e;if(!t)throw Error(`Canvas is not specified`);t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){unreachable("Abstract method `_createCanvas` called.")}},DOMCanvasFactory=class extends BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},BaseFilterFactory=class{addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addAlphaFilter(e){return`none`}addLuminosityFilter(e){return`none`}addKnockoutFilter(e=0){return`none`}addHighlightHCMFilter(e,t,n,r,i){return`none`}addSelectionHCMFilter(e,t){return`none`}addSelectionFilter(){return`none`}createSelectionStyle(e=null){return null}destroy(e=!1){}},DOMFilterFactory=class extends BaseFilterFactory{#e;#t;#n;#r;#i;#a;#o=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#s(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){let e=this.#i.createElement(`div`),{style:t}=e;t.colorScheme=`only light`,t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#i.createElementNS(SVG_NS,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(SVG_NS,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){if(e.length===1){let t=e[0],n=Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;let r=n.join(`,`);return[r,r,r]}let[t,n,r]=e,i=Array(256),a=Array(256),o=Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,a[e]=n[e]/255,o[e]=r[e]/255;return[i.join(`,`),a.join(`,`),o.join(`,`)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(isDataScheme(e)?warn(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=updateUrlHash(e,``))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return`none`;let t=this.#s.get(e);if(t)return t;let[n,r,i]=this.#u(e),a=e.length===1?n:`${n}${r}${i}`;if(t=this.#s.get(a),t)return this.#s.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#o++}`,s=this.#d(o);this.#s.set(e,s),this.#s.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`,r=`base`,i=this.#c.get(r);
7if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url=`none`,i.filter=null):(i={key:n,url:`none`,filter:null},this.#c.set(r,i)),!e||!t))return i.url;let a=this.#v(e);e=Util.makeHexColor(...a);let o=this.#v(t);if(t=Util.makeHexColor(...o),this.#b(),e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array.from({length:256},(e,t)=>computeLuminance(t/255)).join(`,`),c=`g_${this.#r}_hcm_filter`,l=i.filter=this.#m(c);this.#g(s,s,s,l),this.#p(l);let u=(e,t)=>{let n=a[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return this.#g(u(0,5),u(1,5),u(2,5),l),i.url=this.#d(c),i.url}addSelectionHCMFilter(e,t){return this.addHighlightHCMFilter(`selection`,e,t,`HighlightText`,`Highlight`)}addSelectionFilter(){return this.addHighlightHCMFilter(`selection_default`,`black`,`white`,`HighlightText`,`Highlight`)}createSelectionStyle(e=null){let t=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return t===`none`||!FeatureTest.platform.isFirefox?null:{"backdrop-filter":t,"background-color":`transparent`}}addAlphaFilter(e){let t=this.#s.get(e);if(t)return t;let[n]=this.#u([e]),r=`alpha_${n}`;if(t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_alpha_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#_(n,o),a}addLuminosityFilter(e){let t=this.#s.get(e||`luminosity`);if(t)return t;let n,r;if(e?([n]=this.#u([e]),r=`luminosity_${n}`):r=`luminosity`,t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_luminosity_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#f(o),e&&this.#_(n,o),a}addKnockoutFilter(e=0){let t=e>0?Math.min(1/e,1e6):1e6,n=`knockout_${t}`,r=this.#s.get(n);if(r)return r;let i=`g_${this.#r}_knockout_filter_${this.#o++}`,a=this.#d(i);this.#s.set(n,a);let o=this.#m(i),s=this.#i.createElementNS(SVG_NS,`feComponentTransfer`);o.append(s);let c=this.#i.createElementNS(SVG_NS,`feFuncA`);return c.setAttribute(`type`,`linear`),c.setAttribute(`slope`,`${t}`),c.setAttribute(`intercept`,`0`),s.append(c),a}addHighlightHCMFilter(e,t,n,r,i){let a=`${t}-${n}-${r}-${i}`,o=this.#c.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url=`none`,o.filter=null):(o={key:a,url:`none`,filter:null},this.#c.set(e,o)),!t||!n))return o.url;let[s,c]=[t,n].map(this.#v.bind(this)),l=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[r,i].map(this.#x.bind(this));u<l&&([l,u,d,f]=[u,l,f,d]),this.#b();let p=(e,t,n)=>{let r=Array(256),i=(u-l)/n,a=e/255,o=(t-e)/(255*n),s=0;for(let e=0;e<=n;e++){let t=Math.round(l+e*i),n=a+e*o;for(let e=s;e<=t;e++)r[e]=n;s=t+1}for(let e=s;e<256;e++)r[e]=r[s-1];return r.join(`,`)},m=`g_${this.#r}_hcm_${e}_filter`,h=o.filter=this.#m(m);return this.#p(h),this.#g(p(d[0],f[0],5),p(d[1],f[1],5),p(d[2],f[2],5),h),o.url=this.#d(m),o.url}destroy(e=!1){e&&this.#a?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#a?.clear(),this.#a=null,this.#o=0)}#f(e){let t=this.#i.createElementNS(SVG_NS,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0`),e.append(t)}#p(e){let t=this.#i.createElementNS(SVG_NS,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}#m(e){let t=this.#i.createElementNS(SVG_NS,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#l.append(t),t}#h(e,t,n){let r=this.#i.createElementNS(SVG_NS,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#i.createElementNS(SVG_NS,`feComponentTransfer`);r.append(i),this.#h(i,`feFuncR`,e),this.#h(i,`feFuncG`,t),this.#h(i,`feFuncB`,n)}#_(e,t){let n=this.#i.createElementNS(SVG_NS,`feComponentTransfer`);t.append(n),this.#h(n,`feFuncA`,e)}#v(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,getRGB(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#y(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,getRGBA(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#b(){this.#l.style.color=``,this.#l.style.backgroundColor=``}#x(e){let[t,n,r,i]=this.#y(e);if(i===1)return[t,n,r];let[a,o,s]=this.#v(`Canvas`);return[blend(t,a,i),blend(n,o,i),blend(r,s,i)]}};function blend(e,t,n){return Math.round(n*e+(1-n)*t)}isNodeJS&&warn("Please use the `legacy` build in Node.js environments.");async function node_utils_fetchData(e){let t=await process.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(t)}var NodeFilterFactory=class extends BaseFilterFactory{},NodeCanvasFactory=class extends BaseCanvasFactory{_createCanvas(e,t){return process.getBuiltinModule(`module`).createRequire(import.meta.url)(`@napi-rs/canvas`).createCanvas(e,t)}},NodeBinaryDataFactory=class extends BaseBinaryDataFactory{async _fetch(e,t){return node_utils_fetchData(e)}};function convertBlackAndWhiteToRGBA({src:e,srcPos:t=0,dest:n,width:r,height:i,nonBlackColor:a=4294967295,inverseDecode:o=!1}){let s=FeatureTest.isLittleEndian?4278190080:255,[c,l]=o?[a,s]:[s,a],u=r>>3,d=r&7,f=c^l,p=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<i;++r){for(let r=t+u;t<r;++t,m+=8){let r=e[t];n[m]=c^-(r>>7&1)&f,n[m+1]=c^-(r>>6&1)&f,n[m+2]=c^-(r>>5&1)&f,n[m+3]=c^-(r>>4&1)&f,n[m+4]=c^-(r>>3&1)&f,n[m+5]=c^-(r>>2&1)&f,n[m+6]=c^-(r>>1&1)&f,n[m+7]=c^-(r&1)&f}if(d===0)continue;let r=t<p?e[t++]:255;for(let e=0;e<d;++e,++m)n[m]=c^-(r>>7-e&1)&f}return{srcPos:t,destPos:m}}function convertRGBToRGBA({src:e,srcPos:t=0,dest:n,destPos:r=0,width:i,height:a}){let o=0,s=i*a*3,c=s>>2,l=new Uint32Array(e.buffer,t,c),u=FeatureTest.isLittleEndian?4278190080:255;if(FeatureTest.isLittleEndian){for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e>>>24|t<<8|u,n[r+2]=t>>>16|i<<16|u,n[r+3]=i>>>8|u}for(let i=o*4,a=t+s;i<a;i+=3)n[r++]=e[i]|e[i+1]<<8|e[i+2]<<16|u}else{for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e<<24|t>>>8|u,n[r+2]=t<<16|i>>>16|u,n[r+3]=i<<8|u}for(let i=o*4,a=t+s;i<a;i+=3)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|u}return{srcPos:t+s,destPos:r}}var MESH_WGSL=` 8struct Uniforms { 9 offsetX : f32, 10 offsetY : f32, 11 scaleX : f32, 12 scaleY : f32, 13 paddedWidth : f32, 14 paddedHeight : f32, 15 borderSize : f32, 16 _pad : f32, 17}; 18 19@group(0) @binding(0) var<uniform> u : Uniforms; 20 21struct VertexInput { 22 @location(0) position : vec2<f32>, 23 @location(1) color : vec4<f32>, 24}; 25 26struct VertexOutput { 27 @builtin(position) position : vec4<f32>, 28 @location(0) color : vec3<f32>, 29}; 30 31@vertex
32fn vs_main(in : VertexInput) -> VertexOutput { 33 var out : VertexOutput; 34 let cx = (in.position.x + u.offsetX) * u.scaleX; 35 let cy = (in.position.y + u.offsetY) * u.scaleY; 36 out.position = vec4<f32>( 37 ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0, 38 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0, 39 0.0, 40 1.0 41 ); 42 out.color = in.color.rgb; 43 return out; 44} 45 46@fragment 47fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> { 48 return vec4<f32>(in.color, 1.0); 49} 50`,WebGPU=class{#e=null;#t=null;#n=null;#r=null;async#i(){if(!globalThis.navigator?.gpu)return!1;try{let e=await navigator.gpu.requestAdapter();return e?(this.#r=navigator.gpu.getPreferredCanvasFormat(),this.#t=await e.requestDevice(),!0):!1}catch{return!1}}init(){return this.#e||=this.#i()}get isReady(){return this.#t!==null}loadMeshShader(){if(!this.#t||this.#n)return;let e=this.#t.createShaderModule({code:MESH_WGSL});this.#n=this.#t.createRenderPipeline({layout:`auto`,vertex:{module:e,entryPoint:`vs_main`,buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:`float32x2`}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:`unorm8x4`}]}]},fragment:{module:e,entryPoint:`fs_main`,targets:[{format:this.#r}]},primitive:{topology:`triangle-list`}})}draw(e,t,n,r,i,a,o,s){this.loadMeshShader();let c=this.#t,{offsetX:l,offsetY:u,scaleX:d,scaleY:f}=r,p=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(p,0,e);let m=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(m,0,t);let h=c.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(h,0,new Float32Array([l,u,d,f,a,o,s,0]));let g=c.createBindGroup({layout:this.#n.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:h}}]}),_=new OffscreenCanvas(a,o),v=_.getContext(`webgpu`);v.configure({device:c,format:this.#r,alphaMode:i?`opaque`:`premultiplied`});let y=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},b=c.createCommandEncoder(),x=b.beginRenderPass({colorAttachments:[{view:v.getCurrentTexture().createView(),clearValue:y,loadOp:`clear`,storeOp:`store`}]});return n>0&&(x.setPipeline(this.#n),x.setBindGroup(0,g),x.setVertexBuffer(0,p),x.setVertexBuffer(1,m),x.draw(n)),x.end(),c.queue.submit([b.finish()]),p.destroy(),m.destroy(),h.destroy(),_.transferToImageBitmap()}},_webGPU=new WebGPU;function initGPU(){return _webGPU.init()}function isGPUReady(){return _webGPU.isReady}function loadMeshShader(){_webGPU.loadMeshShader()}function drawMeshWithGPU(e,t,n,r,i,a,o,s){return _webGPU.draw(e,t,n,r,i,a,o,s)}var PathType={FILL:`Fill`,STROKE:`Stroke`,SHADING:`Shading`};function applyBoundingBox(e,t){if(!t)return;let n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}var BaseShadingPattern=class{matrix=null;isModifyingCurrentTransform(){return!1}getPattern(){unreachable("Abstract method `getPattern` called.")}},RadialAxialShadingPattern=class extends BaseShadingPattern{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type===`radial`}areConic(){if(!this.isRadial())return!1;let e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,t=null){let n,r=this._p0,i=this._p1;if(t&&(r=r.slice(),i=i.slice(),Util.applyTransform(r,t),Util.applyTransform(i,t)),this._type===`axial`)n=e.createLinearGradient(r[0],r[1],i[0],i[1]);else if(this._type===`radial`){let a=this._r0,o=this._r1;if(t){let e=new Float32Array(2);Util.singularValueDecompose2dScale(t,e),a*=e[0],o*=e[0]}n=e.createRadialGradient(r[0],r[1],a,i[0],i[1],o)}for(let e of this._colorStops)n.addColorStop(e[0],e[1]);return n}_createReversedGradient(e,t=null){let n=this._p1,r=this._p0;t&&(n=n.slice(),r=r.slice(),Util.applyTransform(n,t),Util.applyTransform(r,t));let i=this._r1,a=this._r0;if(t){let e=new Float32Array(2);Util.singularValueDecompose2dScale(t,e),i*=e[0],a*=e[0]}let o=e.createRadialGradient(n[0],n[1],i,r[0],r[1],a),s=this._colorStops.map(([e,t])=>[1-e,t]).reverse();for(let[e,t]of s)o.addColorStop(e,t);return o}getPattern(e,t,n,r){let i;if(r===PathType.STROKE||r===PathType.FILL){if(this.isOriginBased()){let r=Util.transform(n,t.baseTransform);
50this.matrix&&(r=Util.transform(r,this.matrix));let i=.001,a=Math.hypot(r[0],r[1]),o=Math.hypot(r[2],r[3]),s=(r[0]*r[2]+r[1]*r[3])/(a*o);if(Math.abs(s)<i)if(this.isRadial()){if(Math.abs(a-o)<i)return this._createGradient(e,r)}else return this._createGradient(e,r)}let a=t.current.getClippedPathBoundingBox(r,getCurrentTransform(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,s=Math.ceil(a[3]-a[1])||1,c=t.canvasFactory.create(o,s),l=c.context;l.clearRect(0,0,l.canvas.width,l.canvas.height),l.beginPath(),l.rect(0,0,l.canvas.width,l.canvas.height),l.translate(-a[0],-a[1]),n=Util.transform(n,[1,0,0,1,a[0],a[1]]),l.transform(...t.baseTransform),this.matrix&&l.transform(...this.matrix),applyBoundingBox(l,this._bbox),this.areConic()&&(l.fillStyle=this._createReversedGradient(l),l.fill()),l.fillStyle=this._createGradient(l),l.fill(),i=e.createPattern(c.canvas,`no-repeat`),t.canvasFactory.destroy(c);let u=new DOMMatrix(n);i.setTransform(u)}else this.areConic()&&(e.save(),applyBoundingBox(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-1e10,-1e10,2e10,2e10),e.restore()),applyBoundingBox(e,this._bbox),i=this._createGradient(e);return i}};function drawTriangle(e,t,n,r,i,a,o,s){let c=t.coords,l=t.colors,u=e.data,d=e.width*4,f;c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f),c[r*2+1]>c[i*2+1]&&(f=r,r=i,i=f,f=o,o=s,s=f),c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f);let p=(c[n*2]+t.offsetX)*t.scaleX,m=(c[n*2+1]+t.offsetY)*t.scaleY,h=(c[r*2]+t.offsetX)*t.scaleX,g=(c[r*2+1]+t.offsetY)*t.scaleY,_=(c[i*2]+t.offsetX)*t.scaleX,v=(c[i*2+1]+t.offsetY)*t.scaleY;if(m>=v)return;let y=l[a*4],b=l[a*4+1],x=l[a*4+2],S=l[o*4],C=l[o*4+1],w=l[o*4+2],T=l[s*4],E=l[s*4+1],D=l[s*4+2],O=Math.round(m),k=Math.round(v),A,j,M,N,P,F,I,L;for(let e=O;e<=k;e++){if(e<g){let t=e<m?0:(m-e)/(m-g);A=p-(p-h)*t,j=y-(y-S)*t,M=b-(b-C)*t,N=x-(x-w)*t}else{let t;t=e>v?1:g===v?0:(g-e)/(g-v),A=h-(h-_)*t,j=S-(S-T)*t,M=C-(C-E)*t,N=w-(w-D)*t}let t;t=e<m?0:e>v?1:(m-e)/(m-v),P=p-(p-_)*t,F=y-(y-T)*t,I=b-(b-E)*t,L=x-(x-D)*t;let n=Math.round(Math.min(A,P)),r=Math.round(Math.max(A,P)),i=d*e+n*4;for(let e=n;e<=r;e++)t=(A-e)/(A-P),t<0?t=0:t>1&&(t=1),u[i++]=j-(j-F)*t|0,u[i++]=M-(M-I)*t|0,u[i++]=N-(N-L)*t|0,u[i++]=255}}var MeshShadingPattern=class extends BaseShadingPattern{constructor(e){super(),this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],loadMeshShader()}_createMeshCanvas(e,t,n){let r=1.1,i=3e3,a=2,o=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,l=Math.ceil(this._bounds[3])-s,u=Math.min(Math.ceil(Math.abs(c*e[0]*r)),i)||1,d=Math.min(Math.ceil(Math.abs(l*e[1]*r)),i)||1,f=c?c/u:1,p=l?l/d:1,m={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-s,scaleX:1/f,scaleY:1/p},h=u+4,g=d+4,_=n.create(h,g);if(isGPUReady()&&this._vertexCount>48)_.context.drawImage(drawMeshWithGPU(this._posData,this._colData,this._vertexCount,m,t,h,g,2),0,0);else{let e=_.context.createImageData(u,d);if(t){let n=e.data;for(let e=0,r=n.length;e<r;e+=4)n[e]=t[0],n[e+1]=t[1],n[e+2]=t[2],n[e+3]=255}for(let t=0,n=this._vertexCount;t<n;t+=3)drawTriangle(e,m,t,t+1,t+2,t,t+1,t+2);_.context.putImageData(e,2,2)}return{canvas:_.canvas,offsetX:o-2*f,offsetY:s-2*p,scaleX:f,scaleY:p}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,r){applyBoundingBox(e,this._bbox);let i=new Float32Array(2);if(r===PathType.SHADING)Util.singularValueDecompose2dScale(getCurrentTransform(e),i);else if(this.matrix){Util.singularValueDecompose2dScale(this.matrix,i);let[e,n]=i;Util.singularValueDecompose2dScale(t.baseTransform,i),i[0]*=e,i[1]*=n}else Util.singularValueDecompose2dScale(t.baseTransform,i);let a=this._createMeshCanvas(i,r===PathType.SHADING?null:this._background,t.canvasFactory);r!==PathType.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY);let o=e.createPattern(a.canvas,`no-repeat`);return t.canvasFactory.destroy(a),o}},DummyShadingPattern=class extends BaseShadingPattern{getPattern(){return`hotpink`}};function getShadingPattern(e){switch(e[0]){case`RadialAxial`:return new RadialAxialShadingPattern(e);case`Mesh`:return new MeshShadingPattern(e);case`Dummy`:return new DummyShadingPattern}throw Error(`Unknown IR type: ${e[0]}`)}var PaintType={COLORED:1,UNCOLORED:2},TilingPattern=class e{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.needsIsolation=e[9]??!0,this.ctx=t,this.canvasGraphicsFactory=n,this.baseTransform=r,this.patternBaseMatrix=this.matrix?Util.transform(r,this.matrix
vendor: 1,246 bytes, line 50
50):r}canSkipPatternCanvas([e,t,n,r]){let[i,a,o,s]=this.bbox,c=Math.abs(this.xstep),l=Math.abs(this.ystep);if(e>c+1e-6||t>l+1e-6)return null;let u=Math.floor((n-o)/c)+1,d=Math.ceil((n+e-i)/c)-1,f=Math.floor((r-s)/l)+1,p=Math.ceil((r+t-a)/l)-1;return d<=u&&p<=f?[u,f]:null}updatePatternDims(e,t){let n=Util.inverseTransform(this.patternBaseMatrix),r=[e[0],e[1]],i=[e[2],e[3]];Util.applyTransform(r,n),Util.applyTransform(i,n),t[0]=Math.abs(i[0]-r[0]),t[1]=Math.abs(i[1]-r[1]),t[2]=Math.min(r[0],i[0]),t[3]=Math.min(r[1],i[1])}_renderTileCanvas(e,t,n,r){let[i,a,o,s]=this.bbox,c=e.canvasFactory.create(n.size,r.size),l=c.context,u=this.canvasGraphicsFactory.createCanvasGraphics(l,t);return u.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),l.translate(-n.scale*i,-r.scale*a),u.transform(0,n.scale,0,0,r.scale,0,0),l.save(),u.dependencyTracker?.save(),this.clipBbox(u,i,a,o,s),u.baseTransform=getCurrentTransform(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),u.dependencyTracker?.restore(),l.restore(),c}_getCombinedScales(){let e=new Float32Array(2);Util.singularValueDecompose2dScale(this.matrix,e);let[t,n]=e;return Util.singularValueDecompose2dScale(this.baseTransform,e),[t*e[0],n*e[1]]}
50drawPattern(e,t,n=!1,[r,i],a){let[o,s,c,l]=this.bbox,u=e.dependencyTracker;if(u&&(e.dependencyTracker=new CanvasNestedDependencyTracker(u,a)),e.save(),n?e.ctx.clip(t,`evenodd`):e.ctx.clip(t),e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(r*this.xstep,i*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!==`source-over`||e.inSMaskMode){let t=c-o,n=l-s,[r,i]=this._getCombinedScales(),u=this.getSizeAndScale(t,this.ctx.canvas.width,r),d=this.getSizeAndScale(n,this.ctx.canvas.height,i),f=this._renderTileCanvas(e,a,u,d);e.ctx.drawImage(f.canvas,o,s,t,n),e.canvasFactory.destroy(f)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,o,s,c,l),e.baseTransformStack.push(e.baseTransform),e.baseTransform=getCurrentTransform(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();e.restore(),u&&(e.dependencyTracker=u)}createPatternCanvas(e,t){let[n,r,i,a]=this.bbox,o=i-n,s=a-r,{xstep:c,ystep:l}=this;c=Math.abs(c),l=Math.abs(l),info(`TilingType: `+this.tilingType);let[u,d]=this._getCombinedScales(),f=o,p=s,m=!1,h=!1;Math.ceil(c*u)>
50=Math.ceil(o*u)?f=c:m=!0,Math.ceil(l*d)>=Math.ceil(s*d)?p=l:h=!0;let g=this.getSizeAndScale(f,this.ctx.canvas.width,u),_=this.getSizeAndScale(p,this.ctx.canvas.height,d),v=this._renderTileCanvas(e,t,g,_);if(m||h){let t=v.canvas;m&&(f=c),h&&(p=l);let i=this.getSizeAndScale(f,this.ctx.canvas.width,u),a=this.getSizeAndScale(p,this.ctx.canvas.height,d),g=i.size,_=a.size,y=e.canvasFactory.create(g,_),b=y.context,x=m?Math.floor(o/c):0,S=h?Math.floor(s/l):0;for(let e=0;e<=x;e++)for(let n=0;n<=S;n++)b.drawImage(t,g*e,_*n,g,_,0,0,g,_);return e.canvasFactory.destroy(v),{canvas:y.canvas,canvasEntry:y,scaleX:i.scale,scaleY:a.scale,offsetX:n,offsetY:r}}return{canvas:v.canvas,canvasEntry:v,scaleX:g.scale,scaleY:_.scale,offsetX:n,offsetY:r}}getSizeAndScale(t,n,r){let i=Math.max(e.MAX_PATTERN_SIZE,n),a=Math.ceil(t*r);return a>=i?a=i:r=a/t,{scale:r,size:a}}clipBbox(e,t,n,r,i){let a=r-t,o=i-n,s=new Path2D;s.rect(t,n,a,o),Util.axialAlignedBoundingBox([t,n,r,i],getCurrentTransform(e.ctx),e.current.minMax),e.ctx.clip(s),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,n){let r=e.ctx,i=e.current;switch(i.patternFill=i.patternStroke=!1,t){case PaintType.COLORED:let{fillStyle:e,strokeStyle:a}=this.ctx;r.fillStyle=i.fillColor=e,r.strokeStyle=i.strokeColor=a;break;case PaintType.UNCOLORED:r.fillStyle=r.strokeStyle=n,i.fillColor=i.strokeColor=n;break;default:throw new FormatError(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,r,i){let a=r===PathType.SHADING?n:Util.transform(n,this.patternBaseMatrix),o=this.createPatternCanvas(t,i),s=new DOMMatrix(a);s=s.translate(o.offsetX,o.offsetY),s=s.scale(1/o.scaleX,1/o.scaleY);let c=e.createPattern(o.canvas,`repeat`);return t.canvasFactory.destroy(o.canvasEntry),c.setTransform(s),c}},MIN_FONT_SIZE=16,MAX_FONT_SIZE=100,EXECUTION_TIME=15,EXECUTION_STEPS=10,FULL_CHUNK_HEIGHT=16,XY=new Float32Array(2);function mirrorContextOperations(e,t){if(e._removeMirroring)throw Error(`Context is already forwarding operations.`);let n=new Map;for(let r of[`save`,`restore`,`rotate`,`scale`,`translate`,`transform`,`setTransform`,`resetTransform`,`clip`,`moveTo`,`lineTo`,`bezierCurveTo`,`quadraticCurveTo`,`arc`,`arcTo`,`ellipse`,`rect`,`roundRect`,`closePath`,`beginPath`]){let i=e[r];typeof i!=`function`||typeof t[r]!=`function`||(n.set(r,i),e[r]=function(...e){return t[r](...e),i.apply(this,e)})}e._removeMirroring=()=>{for(let[t,r]of n)e[t]=r;delete e._removeMirroring}}function drawImageAtIntegerCoords(e,t,n,r,i,a,o,s,c,l){let[u,d,f,p,m,h]=getCurrentTransform(e);if(d===0&&f===0){let g=o*u+m,_=Math.round(g),v=s*p+h,y=Math.round(v),b=(o+c)*u+m,x=Math.abs(Math.round(b)-_)||1,S=(s+l)*p+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(Math.sign(u),0,0,Math.sign(p),_,y),e.drawImage(t,n,r,i,a,0,0,x,C),e.setTransform(u,d,f,p,m,h),[x,C]}if(u===0&&p===0){let g=s*f+m,_=Math.round(g),v=o*d+h,y=Math.round(v),b=(s+l)*f+m,x=Math.abs(Math.round(b)-_)||1,S=(o+c)*d+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(0,Math.sign(d),Math.sign(f),0,_,y),e.drawImage(t,n,r,i,a,0,0,C,x),e.setTransform(u,d,f,p,m,h),[C,x]}e.drawImage(t,n,r,i,a,o,s,c,l);let g=Math.hypot(u,d),_=Math.hypot(f,p);return[g*c,_*l]}var CanvasExtraState=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=FONT_IDENTITY_MATRIX;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=TextRenderingMode.FILL;textRise=0;fillColor=`#000000`;strokeColor=`#000000`;tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps=`none`;minMax=F32_BBOX_INIT.slice();constructor(e,t){this.clipBox=new Float32Array([0,0,e,t])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=this.tilingPatternDims?.slice(),e}getPathBoundingBox(e=PathType.FILL,t=null){let n=this.minMax.slice();if(e===PathType.STROKE){t||unreachable(`Stroke bounding box must include transform.`),Util.singularValueDecompose2dScale(t,XY);let e=XY[0]*this.lineWidth/2,r=XY[1]*this.lineWidth/2;n[0]-=e,n[1]-=r,n[2]+=e,n[3]+=r}return n}updateClipFromPath(){let e=Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(F32_BBOX_INIT,0)}getClippedPathBoundingBox(e=PathType.FILL,t=null){return Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}};function putBinaryImageData(e,t){let{width:n,height:r,kind:i}=t,a=r%FULL_CHUNK_HEIGHT,o=(r-a)/FULL_CHUNK_HEIGHT,s=a===0?o:o+1,c=e.createImageData(n,FULL_CHUNK_HEIGHT),l=0,u=t.data,d=c.data,f;if(i===ImageKind.GRAYSCALE_1BPP)for(f=0;f<s;f++)({srcPos:l}=convertBlackAndWhiteToRGBA({src:u,srcPos:l,dest:d,width:n,height:f<o?FULL_CHUNK_HEIGHT:a}
50)),e.putImageData(c,0,f*FULL_CHUNK_HEIGHT);else if(i===ImageKind.RGBA_32BPP){let t=0,r=n*FULL_CHUNK_HEIGHT*4;for(f=0;f<o;f++)d.set(u.subarray(l,l+r)),l+=r,e.putImageData(c,0,t),t+=FULL_CHUNK_HEIGHT;f<s&&(r=n*a*4,d.set(u.subarray(l,l+r)),e.putImageData(c,0,t))}else if(i===ImageKind.RGB_24BPP)for(f=0;f<s;f++)({srcPos:l}=convertRGBToRGBA({src:u,srcPos:l,dest:new Uint32Array(d.buffer),width:n,height:f<o?FULL_CHUNK_HEIGHT:a})),e.putImageData(c,0,f*FULL_CHUNK_HEIGHT);else throw Error(`bad image kind: ${i}`)}function putBinaryImageMask(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let{width:n,height:r}=t,i=r%FULL_CHUNK_HEIGHT,a=(r-i)/FULL_CHUNK_HEIGHT,o=i===0?a:a+1,s=e.createImageData(n,FULL_CHUNK_HEIGHT),c=0,l=t.data,u=s.data;for(let t=0;t<o;t++)({srcPos:c}=convertBlackAndWhiteToRGBA({src:l,srcPos:c,dest:u,width:n,height:t<a?FULL_CHUNK_HEIGHT:i,nonBlackColor:0})),e.putImageData(s,0,t*FULL_CHUNK_HEIGHT)}function copyCtxState(e,t){for(let n of[`strokeStyle`,`fillStyle`,`fillRule`,`globalAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`globalCompositeOperation`,`font`,`filter`])e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function resetCtxToDefault(e){e.strokeStyle=e.fillStyle=`#000000`,e.fillRule=`nonzero`,e.globalAlpha=1,e.lineWidth=1,e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=10,e.globalCompositeOperation=`source-over`,e.font=`10px sans-serif`,e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0);let{filter:t}=e;t!==`none`&&t!==``&&(e.filter=`none`)}function getImageSmoothingEnabled(e,t){if(t)return!0;Util.singularValueDecompose2dScale(e,XY);let n=Math.fround(OutputScale.pixelRatio*PixelsPerInch.PDF_TO_CSS_UNITS);return XY[0]<=n&&XY[1]<=n}var LINE_CAP_STYLES=[`butt`,`round`,`square`],LINE_JOIN_STYLES=[`miter`,`round`,`bevel`],NORMAL_CLIP={},EO_CLIP={},CanvasGraphics=class e{static#e=null;#t=0;#n=0;#r=null;#i=null;#a=null;#o=null;#s=1;#c;#l=null;#u=[];constructor(e,t,n,r,i,{optionalContentConfig:a,markedContentStack:o=null},s,c,l,u){this.ctx=e,this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=l??null,this.imagesTracker=u??null}getObject(e,t,n=null){return typeof t==`string`?(this.dependencyTracker?.recordNamedDependency(e,t),t.startsWith(`g_`)?this.commonObjs.get(t):this.objs.get(t)):n}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){let i=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=r||`#ffffff`,this.ctx.fillRect(0,0,i,a),this.ctx.fillStyle=o,n){let e=this.transparentCanvasEntry=this.canvasFactory.create(i,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=e,this.ctx.save(),this.ctx.transform(...getCurrentTransform(this.compositeCtx))}this.ctx.save(),resetCtxToDefault(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=getCurrentTransform(this.ctx)}executeOperatorList(e,t,n,r,i){let a=e.argsArray,o=e.fnArray,s=t||0,c=a.length;if(c===s)return s;let l=c-s>EXECUTION_STEPS&&typeof n==`function`,u=l?Date.now()+EXECUTION_TIME:0,d=0,f=this.commonObjs,p=this.objs,m,h;for(;;){if(r!==void 0){if(s===r.nextBreakPoint)return r.breakIt(s,n),s;if(r.shouldSkip(s)){if(++s===c)return s;continue}}if(!i||i(s))if(m=o[s],h=a[s]??null,m!==OPS.dependency)h===null?this[m](s):this[m](s,...h);else for(let e of h){this.dependencyTracker?.recordNamedData(e,s);let t=e.startsWith(`g_`)?f:p;if(!t.has(e))return t.get(e,n),s}if(s++,s===c)return s;if(l&&++d>EXECUTION_STEPS){if(Date.now()>u)return n(),s;d=0}}}#d(){for(;this.stateStack.length||this.inSMaskMode;
vendor: 4,356 bytes, line 50
50)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#d();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#u)this.#b(e);this.#u.length=0,this.#r=null,this.#i=null,this.#a=null,this.#o=null,this.#s=1,this.#l=null,this.#n=0,this.#t=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#f()}#f(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width??e.displayWidth,r=e.height??e.displayHeight,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[],s=i,c=a,l=n,u=r;for(;s>2&&l>1||c>2&&u>1;){let e=l,t=u;s>2&&l>1&&(e=Math.ceil(l/2),s/=l/e),c>2&&u>1&&(t=Math.ceil(u/2),c/=u/t),o.push({newWidth:e,newHeight:t}),l=e,u=t}if(o.length===0)return{img:e,paintWidth:n,paintHeight:r,tmpCanvas:null};if(o.length===1){let{newWidth:t,newHeight:i}=o[0],a=this.canvasFactory.create(t,i);return a.context.drawImage(e,0,0,n,r,0,0,t,i),{img:a.canvas,paintWidth:t,paintHeight:i,tmpCanvas:a}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),p=n,m=r,h=e;for(let{newWidth:e,newHeight:t}of o)this.canvasFactory.reset(f,e,t),f.context.drawImage(h,0,0,p,m,0,0,e,t),[d,f]=[f,d],h=d.canvas,p=e,m=t;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:p,paintHeight:m,tmpCanvas:d}}_createMaskCanvas(e,t){let n=this.ctx,{width:r,height:i}=t,a=this.current.fillColor,o=this.current.patternFill,s=getCurrentTransform(n),c,l,u,d;if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;l=JSON.stringify(o?s:[s.slice(0,4),a]),c=this._cachedBitmapsMap.getOrInsertComputed(n,makeMap);let r=c.get(l);if(r&&!o){let t=Math.round(Math.min(s[0],s[2])+s[4]),n=Math.round(Math.min(s[1],s[3])+s[5]);return this.dependencyTracker?.recordDependencies(e,Dependencies.transformAndFill),{canvas:r,offsetX:t,offsetY:n}}u=r}u||(d=this.canvasFactory.create(r,i),putBinaryImageMask(d.context,t));let f=Util.transform(s,[1/r,0,0,-1/i,0,0]);f=Util.transform(f,[1,0,0,1,0,-i]);let p=F32_BBOX_INIT.slice();Util.axialAlignedBoundingBox([0,0,r,i],f,p);let[m,h,g,_]=p,v=Math.round(g-m)||1,y=Math.round(_-h)||1,b=this.canvasFactory.create(v,y),x=b.context,S=m,C=h;x.translate(-S,-C),x.transform(...f);let w=null;if(!u){let e=this._scaleImage(d.canvas,getCurrentTransformInverse(x));u=e.img,w=e.tmpCanvas,u!==d.canvas&&(this.canvasFactory.destroy(d),d=null),c&&o&&(c.set(l,u),w=null,d=null)}x.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(x),t.interpolate),drawImageAtIntegerCoords(x,u,0,0,u.width,u.height,0,0,r,i),w&&this.canvasFactory.destroy(w),d&&this.canvasFactory.destroy(d),x.globalCompositeOperation=`source-in`;let T=Util.transform(getCurrentTransformInverse(x),[1,0,0,1,-S,-C]);return x.fillStyle=o?a.getPattern(n,this,T,PathType.FILL,e):a,x.fillRect(0,0,r,i),c&&!o&&c.set(l,b.canvas),this.dependencyTracker?.recordDependencies(e,Dependencies.transformAndFill),{canvas:b.canvas,canvasEntry:c&&!o?null:b,offsetX:Math.round(S),offsetY:Math.round(C)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData(`lineWidth`,e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData(`lineCap`,e),this.ctx.lineCap=LINE_CAP_STYLES[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData(`lineJoin`,e),this.ctx.lineJoin=LINE_JOIN_STYLES[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData(`miterLimit`,e),this.ctx.miterLimit=t}setDash(e,t,n){this.dependencyTracker?.recordSimpleData(`dash`,e);let r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(t),r.lineDashOffset=n)}
50setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(let[n,r]of t)switch(n){case`LW`:this.setLineWidth(e,r);break;case`LC`:this.setLineCap(e,r);break;case`LJ`:this.setLineJoin(e,r);break;case`ML`:this.setMiterLimit(e,r);break;case`D`:this.setDash(e,r[0],r[1]);break;case`RI`:this.setRenderingIntent(e,r);break;case`FL`:this.setFlatness(e,r);break;case`Font`:this.setFont(e,r[0],r[1]);break;case`CA`:this.dependencyTracker?.recordSimpleData(`strokeAlpha`,e),this.current.strokeAlpha=r;break;case`ca`:this.dependencyTracker?.recordSimpleData(`fillAlpha`,e),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case`BM`:this.dependencyTracker?.recordSimpleData(`globalCompositeOperation`,e),this.ctx.globalCompositeOperation=r;break;case`SMask`:this.dependencyTracker?.recordSimpleData(`SMask`,e),this.current.activeSMask=r?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case`TR`:this.dependencyTracker?.recordSimpleData(`filter`,e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&=(this.canvasFactory.destroy(this.smaskPreparedEntry),null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:t,subtype:n,backdrop:r,transferMap:i}=e,a=n===`Luminosity`||n===`Alpha`&&i;if(!a&&!(n===`Luminosity`&&r)){this.smaskPreparedFor=e;return}let o;if(n===`Luminosity`&&r){let[e,t,n]=getRGBA(r),a=Math.round(.3*e+.59*t+.11*n);o=i?.[a]??a}else o=i?.[0]??0;let s=4,{width:c,height:l}=this.ctx.canvas,u=t.width*t.height,d=c*l<4*u,f=a?{url:n===`Alpha`?this.filterFactory.addAlphaFilter(i):this.filterFactory.addLuminosityFilter(i),subtype:n,transferMap:i}:null,p=n===`Luminosity`?r:null,m,h,g;d?(m=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,c,l,p,f),h=0,g=0):(m=this._bakeSMaskCanvas(t,0,0,t.width,t.height,p,f),h=e.offsetX,g=e.offsetY),this.smaskPreparedEntry=m,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=h,this.smaskPreparedOffsetY=g,this.smaskPreparedOOBAlpha=!d&&o!==0?o:null}_bakeSMaskCanvas(e,t,n,r,i,a,o){!a&&!o&&unreachable(`_bakeSMaskCanvas with neither backdrop nor filter`);let s=this.canvasFactory.create(r,i),c=s.context;if(c.drawImage(e,t,n),a&&(c.globalCompositeOperation=`destination-atop`,c.fillStyle=a,c.fillRect(0,0,r,i)),!o)return s;let l=this.canvasFactory.create(r,i),u=l.context;u.filter=o.url;let d=FeatureTest.isCanvasFilterSupported&&u.filter!==`none`&&u.filter!==``;if(u.drawImage(s.canvas,0,0),FeatureTest.isCanvasFilterSupported&&(u.filter=`none`),!d){let e=u.getImageData(0,0,r,i),{data:t}=e,{transferMap:n}=o;if(o.subtype===`Luminosity`)for(let e=0,r=t.length;e<r;e+=4){let r=.3*t[e]+.59*t[e+1]+.11*t[e+2]+.5|0;t[e]=t[e+1]=t[e+2]=0,t[e+3]=n?.[r]??r}else for(let e=3,r=t.length;e<r;e+=4)t[e]=n[t[e]];u.putImageData(e,0,0)}return this.canvasFactory.destroy(s),l}beginSMaskMode(e){if(this.inSMaskMode)throw Error(`beginSMaskMode called while already in smask mode`);let{width:t,height:n}=this.ctx.canvas,r=this.canvasFactory.create(t,n);this.smaskScratchCanvas=r,this.suspendedCtx=this.ctx;let i=this.ctx=r.context;i.setTransform(this.suspendedCtx.getTransform()),copyCtxState(this.suspendedCtx,i),mirrorContextOperations(i,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[[`BM`,`source-over`]])}endSMaskMode(){if(!this.inSMaskMode)throw Error(`endSMaskMode called while not in smask mode`);this.ctx._removeMirroring(),copyCtxState(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#p(e,t=null,n=1){let{width:r,height:i}=e,a=t??this.canvasFactory.create(r,i),o=a.context;n=Math.round(n*255)/255;let s=n<1;s&&this.#c===void 0&&(this.#c=FeatureTest.isCanvasFilterSupported?new Map:`none`);let c=`none`;if(s&&this.#c instanceof Map&&(c=this.#c.getOrInsertComputed(n,()=>this.filterFactory.addKnockoutFilter(n))),!s||c!==`none`)return t&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,r,i),o.restore(
50)),o.filter=c,o.drawImage(e,0,0),o.filter=`none`,a;let l=e.getContext(`2d`,{willReadFrequently:!0}).getImageData(0,0,r,i),u=o.createImageData(r,i),d=l.data,f=u.data,p=n>0?1/n:1e6;for(let e=3,t=d.length;e<t;e+=4)f[e]=Math.min(Math.round(d[e]*p),255);return o.putImageData(u,0,0),a}#m(e,t,n,r){let i=e?.[t]??null;if(i&&(i.canvas.width!==n||i.canvas.height!==r)&&(this.canvasFactory.destroy(i),i=null),!i)return i=this.canvasFactory.create(n,r),e&&(e[t]=i),i;let a=i.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,n,r),a.restore(),i}#h(e,t,n={}){let{backdropCanvas:r=null,destTransform:i=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:s=null,sourceAlpha:c=1,sourceFilter:l=`none`,knockoutAlpha:u=1}=n,{width:d,height:f}=t,p=this.#p(t,o,u),m=e.globalCompositeOperation;if(e.save(),e.setTransform(...i),e.globalAlpha=1,FeatureTest.isCanvasFilterSupported&&(e.filter=`none`),e.globalCompositeOperation=`destination-out`,e.drawImage(p.canvas,0,0),r){let[t,n]=a,i=this.#m(s,`knockoutBackdropEntry`,d,f),o=i.context;o.drawImage(r,t,n,d,f,0,0,d,f),o.globalCompositeOperation=`destination-in`,o.drawImage(p.canvas,0,0),o.globalCompositeOperation=`source-over`,e.globalCompositeOperation=`destination-over`,e.drawImage(i.canvas,0,0),s||this.canvasFactory.destroy(i)}e.globalCompositeOperation=m,e.globalAlpha=c,FeatureTest.isCanvasFilterSupported&&(e.filter=l??`none`),e.drawImage(t,0,0),e.restore(),o||this.canvasFactory.destroy(p)}#g(e=1){if(this.#t===0||this.#n>0||!this.contentVisible)return!1;this.#n++,this.#s=e;let t=this.#u.at(-1),{canvas:n}=this.ctx,r=this.#m(t,`knockoutTempEntry`,n.width,n.height);this.#r=r;let i=r.context;return i.save(),i.setTransform(this.ctx.getTransform()),copyCtxState(this.ctx,i),this.#o=i.globalCompositeOperation,i.globalCompositeOperation=`source-over`,mirrorContextOperations(i,this.ctx),this.#l=t,this.#i=this.ctx,this.#a=this.suspendedCtx,this.ctx=i,this.inSMaskMode&&(this.suspendedCtx=i),!0}#_(e){if(!e)return;let t=this.#r,n=this.#i,r=this.#a,i=t.context;this.#r=null,this.#i=null,this.#a=null,this.inSMaskMode&&this.suspendedCtx===i&&this.ctx!==i&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=r),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#o,this.#o=null,copyCtxState(this.ctx,n),this.ctx=n;let a=this.#l;this.#l=null;let o=this.#s;this.#s=1;try{this.#h(r??n,t.canvas,{backdropCanvas:a?.backdropCtx?.canvas??null,backdropOffset:a?.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:a?.knockoutMaskEntry??null,poolMeta:a,knockoutAlpha:o})}finally{i.restore(),this.#n--,a||this.canvasFactory.destroy(t)}}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,n=this.suspendedCtx,r=this.#n>0&&n===this.ctx;this.composeSMask(r?null:n,t,this.ctx,e),!r&&(this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(e,t,n,r){let i=r[0],a=r[1],o=r[2]-i,s=r[3]-a;if(o===0||s===0)return;let c=this.smaskPreparedEntry;if(c){let e=i,r=a,l=o,u=s,d=this.smaskPreparedOOBAlpha,f=d!==null;if(f){e=Math.max(i,t.offsetX),r=Math.max(a,t.offsetY);let n=Math.min(i+o,t.offsetX+t.canvas.width),c=Math.min(a+s,t.offsetY+t.canvas.height);l=n-e,u=c-r}if(l>0&&u>0){let t=e-this.smaskPreparedOffsetX,i=r-this.smaskPreparedOffsetY;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let a=new Path2D;a.rect(e,r,l,u),n.clip(a),n.globalCompositeOperation=`destination-in`,n.drawImage(c.canvas,t,i,l,u,e,r,l,u),n.restore()}f&&d<255&&this._applySMaskOOBAlpha(n,i,a,o,s,e,r,e+l,r+u,d)}else this.genericComposeSMask(t,n,o,s,i,a);e&&(e.save(),e.globalAlpha=1,e.globalCompositeOperation=t.blendMode||`source-over`,e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,i,a,o,s,i,a,o,s),e.restore())}_applySMaskOOBAlpha(e,t,n,r,i,a,o,s,c,l){let u=a<s&&o<c;if(u&&a===t&&o===n&&s===t+r&&c===n+i)return;let d=new Path2D;d.rect(t,n,r,i),u&&d.rect(a,o,s-a,c-o),e.save(),e.globalAlpha=l/255,e.setTransform(1,0,0,1,0,0),e.clip(d,`evenodd`),e.globalCompositeOperation=`destination-in`,e.fillStyle=`#000000`,e.fillRect(t,n,r,i),e.restore(
50)}genericComposeSMask(e,t,n,r,i,a){let{context:o,offsetX:s,offsetY:c}=e;t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let l=new Path2D;l.rect(i,a,n,r),t.clip(l),t.globalCompositeOperation=`destination-in`,t.drawImage(o.canvas,i-s,a-c,n,r,i,a,n,r),t.restore()}save(e){this.inSMaskMode&©CtxState(this.ctx,this.suspendedCtx),this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(copyCtxState(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,n,r,i,a,o){this.dependencyTracker?.recordIncrementalData(`transform`,e),this.ctx.transform(t,n,r,i,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n,r){let[i]=n;if(!r){i||=n[0]=new Path2D,t!==OPS.stroke&&t!==OPS.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,i);return}if(this.dependencyTracker!==null){let n=t===OPS.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,r[0]-n,r[2]+n,r[1]-n,r[3]+n).recordDependencies(e,[`transform`])}i instanceof Path2D||(i=n[0]=makePathFromDrawOPS(i)),Util.axialAlignedBoundingBox(r,getCurrentTransform(this.ctx),this.current.minMax);let a=this.current.tilingPatternDims;if(a&&t!==OPS.stroke&&t!==OPS.closeStroke&&this.current.fillColor instanceof TilingPattern){let e=Util.intersect(this.current.clipBox,this.current.minMax);e?this.current.fillColor.updatePatternDims(e,a):this.current.tilingPatternDims=null}this[t](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,n=!0){let r=n&&this.#g(this.current.strokeAlpha),i=this.ctx,a=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof a==`object`&&a?.getPattern){let n=a.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=a.getPattern(i,this,getCurrentTransformInverse(i),PathType.STROKE,e),n){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(n)),t=e}this.rescaleAndStroke(t,!1),i.restore()}else this.rescaleAndStroke(t,!0);this.dependencyTracker?.recordDependencies(e,Dependencies.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(PathType.STROKE,getCurrentTransform(this.ctx))),i.globalAlpha=this.current.fillAlpha,this.#_(r)}closeStroke(e,t){this.stroke(e,t)}fill(e,t,n=!0){let r=n&&this.#g(this.current.fillAlpha),i=this.ctx,a=this.current.fillColor,o=this.current.patternFill,s=!1,c=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(e,Dependencies.fill),o){let o=this.current.tilingPatternDims,l=o&&a.canSkipPatternCanvas(o);if(l){a.drawPattern(this,t,this.pendingEOFill,l,e),this.pendingEOFill=!1,n&&this.consumePath(e,t,c),this.current.tilingPatternDims=null,this.#_(r);return}let u=a.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(e),i.save(),i.fillStyle=a.getPattern(i,this,getCurrentTransformInverse(i),PathType.FILL,e),u){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(u)),t=e}s=!0}this.contentVisible&&c!==null&&(this.pendingEOFill?(i.fill(t,`evenodd`),this.pendingEOFill=!1):i.fill(t)),s&&(i.restore(),this.dependencyTracker?.restore(e)),n&&this.consumePath(e,t,c),this.#_(r)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){let n=this.#g(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t),this.#_(n)}eoFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){let n=this.#g(this.current.fillAlpha);this.ctx.fill(t),this.dependencyTracker?.recordDependencies(e,Dependencies.rawFillPath).recordOperation(e),this.#_(n)}clip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=NORMAL_CLIP}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=EO_CLIP}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData(`sameLineText`).resetIncrementalData(`moveText`,e)}endText(e){let t=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:n}=this;t!==void 0&&n.recordFutureForcedDependency(`textClip`,n.getOpenMarker()).recordFutureForcedDependency(`textClip`,e),n.recordCloseMarker(e)}if(t!==void 0){let e=new Path2D,r=n.getTransform().invertSelf();for(let{transform:n,x:i,y:a,fontSize:o,path:s}of t)s&&e.addPath(s,new DOMMatrix(n).preMultiplySelf(r).translate(i,a).scale(o,-o));n.clip(e)}delete this.pendingTextPaths}setCharSpacing(e,t){this.dependencyTracker?.recordSimpleData(`charSpacing`,e),this.current.charSpacing=t}setWordSpacing(e,t){this.dependencyTracker?.recordSimpleData(`wordSpacing`,e),this.current.wordSpacing=t}setHScale(e,t){this.dependencyTracker?.recordSimpleData(`hScale`,e),this.current.textHScale=t/100}setLeading(e,t){this.dependencyTracker?.recordSimpleData(`leading`,e),this.current.leading=-t}setFont(e,t,n){this.dependencyTracker?.recordSimpleData(`font`,e).recordSimpleDataFromNamed(`fontObj`,t,e);let r=this.commonObjs.get(t),i=this.current;if(!r)throw Error(`Can't find font for ${t}`);
50if(i.fontMatrix=r.fontMatrix||FONT_IDENTITY_MATRIX,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&warn(`Invalid font matrix for font `+t),n<0?(n=-n,i.fontDirection=-1):i.fontDirection=1,this.current.font=r,this.current.fontSize=n,r.isType3Font)return;let a=r.loadedName||`sans-serif`,o=r.systemFontInfo?.css||`"${a}", ${r.fallbackName}`,s=`normal`;r.black?s=`900`:r.bold&&(s=`bold`);let c=r.italic?`italic`:`normal`,l=MathClamp(n,MIN_FONT_SIZE,MAX_FONT_SIZE);this.current.fontSizeScale=n/l,this.ctx.font=`${c} ${s} ${l}px ${o}`}setTextRenderingMode(e,t){this.dependencyTracker?.recordSimpleData(`textRenderingMode`,e),this.current.textRenderingMode=t}setTextRise(e,t){this.dependencyTracker?.recordSimpleData(`textRise`,e),this.current.textRise=t}moveText(e,t,n){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordIncrementalData(`moveText`,e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=n}setLeadingMoveText(e,t,n){this.setLeading(e,-n),this.moveText(e,t,n)}setTextMatrix(e,t){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordSimpleData(`textMatrix`,e);let{current:n}=this;n.textMatrix=t,n.textMatrixScale=Math.hypot(t[0],t[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData(`moveText`,this.dependencyTracker.getSimpleIndex(`leading`)??e)}#v(e,t,n){let r=new Path2D;return r.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),r}paintChar(e,t,n,r,i,a){let o=this.ctx,s=this.current,c=s.font,l=s.textRenderingMode,u=s.fontSize/s.fontSizeScale,d=l&TextRenderingMode.FILL_STROKE_MASK,f=!!(l&TextRenderingMode.ADD_TO_PATH_FLAG),p=s.patternFill&&!c.missingFile,m=s.patternStroke&&!c.missingFile,h;if((c.disableFontFace||f||p||m)&&!c.missingFile&&(h=c.getPathGenerator(this.commonObjs,t)),h&&(c.disableFontFace||p||m)){o.save(),o.translate(n,r),o.scale(u,-u),this.dependencyTracker?.recordCharacterBBox(e,o,c);let t;if(d===TextRenderingMode.FILL||d===TextRenderingMode.FILL_STROKE)if(i){t=o.getTransform(),o.setTransform(...i);let e=this.#v(h,t,i);o.fill(e)}else o.fill(h);if(d===TextRenderingMode.STROKE||d===TextRenderingMode.FILL_STROKE)if(a){t||=o.getTransform(),o.setTransform(...a);let{a:e,b:n,c:r,d:i}=t,s=Util.inverseTransform(a),c=Util.transform([e,n,r,i,0,0],s);Util.singularValueDecompose2dScale(c,XY),o.lineWidth*=Math.max(XY[0],XY[1])/u,o.stroke(this.#v(h,t,a))}else o.lineWidth/=u,o.stroke(h);
50o.restore()}else (d===TextRenderingMode.FILL||d===TextRenderingMode.FILL_STROKE)&&(o.fillText(t,n,r),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t))),(d===TextRenderingMode.STROKE||d===TextRenderingMode.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t)).recordDependencies(e,Dependencies.stroke),o.strokeText(t,n,r));f&&((this.pendingTextPaths||=[]).push({transform:getCurrentTransform(o),x:n,y:r,fontSize:u,path:h}),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r))}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText(`I`,0,10);let n=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let r=!1;for(let e=3;e<n.length;e+=4)if(n[e]>0&&n[e]<255){r=!0;break}return shadow(this,`isFontSubpixelAAEnabled`,r)}showText(e,t){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,Dependencies.showText).resetBBox(e),this.current.textRenderingMode&TextRenderingMode.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency(`textClip`,e).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,r=n.font;if(r.isType3Font){let r=this.#g(n.fillAlpha);this.showType3Text(e,t),this.dependencyTracker?.recordShowTextOperation(e),this.#_(r);return}let i=n.fontSize;if(i===0){this.dependencyTracker?.recordOperation(e);return}let a=this.#g(n.fillAlpha),o=this.ctx,s=n.fontSizeScale,c=n.charSpacing,l=n.wordSpacing,u=n.fontDirection,d=n.textHScale*u,f=t.length,p=r.vertical,m=p?1:-1,h=r.defaultVMetrics,g=i*n.fontMatrix[0],_=n.textRenderingMode===TextRenderingMode.FILL&&!r.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),u>0?o.scale(d,-1):o.scale(d,1);let v,y,b=n.textRenderingMode&TextRenderingMode.FILL_STROKE_MASK,x=b===TextRenderingMode.FILL||b===TextRenderingMode.FILL_STROKE,S=b===TextRenderingMode.STROKE||b===TextRenderingMode.FILL_STROKE,C=n.lineWidth,w=n.textMatrixScale;if(w===0||C===0?S&&(C=this.getSinglePixelWidth()):C/=w,s!==1&&(o.scale(s,s),C/=s),o.lineWidth=C,x&&n.patternFill){o.save();let t=n.fillColor.getPattern(o,this,getCurrentTransformInverse(o),PathType.FILL,e);v=getCurrentTransform(o),o.restore(),o.fillStyle=t}if(S&&n.patternStroke){o.save();let t=n.strokeColor.getPattern(o,this,getCurrentTransformInverse(o),PathType.STROKE,e);y=getCurrentTransform(o),o.restore(),o.strokeStyle=t}if(r.isInvalidPDFjsFont){let r=[],i=0;for(let e of t)r.push(e.unicode),i+=e.width;let s=r.join(``);if(o.fillText(s,0,0),this.dependencyTracker!==null){let t=o.measureText(s);this.dependencyTracker.recordBBox(e,this.ctx,-t.actualBoundingBoxLeft,t.actualBoundingBoxRight,-t.actualBoundingBoxAscent,t.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=i*g*d,o.restore(),this.compose(),this.#_(a);return}let T=0,E;for(E=0;E<f;++E){let n=t[E];if(typeof n==`number`){T+=m*n*i/1e3;continue}let a=!1,d=(n.isSpace?l:0)+c,f=n.fontChar,b=n.accent,x,S,C=n.width;if(p){let e=n.vmetric||h,t=-(n.vmetric?e[1]:C*.5)*g,r=e[2]*g;C=e?-e[0]:C,x=t/s,S=(T+r)/s}else x=T/s,S=0;let w;if(r.remeasure&&C>0){w=o.measureText(f);let e=w.width*1e3/i*s;if(C<e&&this.isFontSubpixelAAEnabled){let t=C/e;a=!0,o.save(),o.scale(t,1),x/=t}else C!==e&&(x+=(C-e)/2e3*i/s)}if(this.contentVisible&&(n.isInFont||r.missingFile)){if(_&&!b)o.fillText(f,x,S),this.dependencyTracker?.recordCharacterBBox(e,o,w?{bbox:null}:r,i/s,x,S,()=>w??o.measureText(f));else if(this.paintChar(e,f,x,S,v,y),b){let t=x+i*b.offset.x/s,n=S-i*b.offset.y/s;this.paintChar(e,b.fontChar,t,n,v,y)}}let D=p?C*g-d*u:C*g+d*u;T+=D,a&&o.restore()}p?n.y-=T:n.x+=T*d,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e),this.#_(a)}showType3Text(e,t){let n=this.ctx,r=this.current,i=r.font,a=r.fontSize,o=r.fontDirection,s=i.vertical?1:-1,c=r.charSpacing,l=r.
50wordSpacing,u=r.textHScale*o,d=r.fontMatrix||FONT_IDENTITY_MATRIX,f=t.length,p=r.textRenderingMode===TextRenderingMode.INVISIBLE,m,h,g,_;if(p||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),r.textMatrix&&n.transform(...r.textMatrix),n.translate(r.x,r.y+r.textRise),n.scale(u,o);let v=this.dependencyTracker;for(this.dependencyTracker=v?new CanvasNestedDependencyTracker(v,e):null,m=0;m<f;++m){if(h=t[m],typeof h==`number`){_=s*h*a/1e3,this.ctx.translate(_,0),r.x+=_*u;continue}let e=(h.isSpace?l:0)+c,o=i.charProcOperatorList.get(h.operatorListId);o?this.contentVisible&&(this.save(),o.fnArray[0]===OPS.setCharWidth&&(r.fillAlpha=r.strokeAlpha=1,n.globalAlpha=1),n.scale(a,a),n.transform(...d),this.executeOperatorList(o),this.restore()):warn(`Type3 character "${h.operatorListId}" is not available.`);let f=[h.width,0];Util.applyTransform(f,d),g=f[0]*a+e,n.translate(g,0),r.x+=g*u}n.restore(),v&&(this.dependencyTracker=v)}setCharWidth(e,t,n){}setCharWidthAndBounds(e,t,n,r,i,a,o){let s=new Path2D;s.rect(r,i,a-r,o-i),this.ctx.clip(s),this.dependencyTracker?.recordBBox(e,this.ctx,r,a,i,o).recordClipBox(e,this.ctx,r,a,i,o),this.endPath(e)}getColorN_Pattern(t,n){let r;if(n[0]===`TilingPattern`){let t=this.baseTransform||getCurrentTransform(this.ctx);r=new TilingPattern(n,this.ctx,{createCanvasGraphics:(t,n)=>new e(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new CanvasNestedDependencyTracker(this.dependencyTracker,n,!0):null)},t)}else r=this._getPattern(t,n[1],n[2]);return r}setStrokeColorN(e,...t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){this.dependencyTracker?.recordSimpleData(`fillColor`,e);let n=this.current.fillColor=this.getColorN_Pattern(e,t);this.current.patternFill=!0,this.current.tilingPatternDims=n instanceof TilingPattern?[0,0,0,0]:null}setStrokeRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}
50setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.ctx.strokeStyle=this.current.strokeColor=`transparent`,this.current.patternStroke=!1}setFillRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.ctx.fillStyle=this.current.fillColor=`transparent`,this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,t,n=null){let r=this.cachedPatterns.getOrInsertComputed(t,()=>getShadingPattern(this.getObject(e,t)));return n&&(r.matrix=n),r}shadingFill(e,t){if(!this.contentVisible)return;let n=this.#g(this.current.fillAlpha),r=this.ctx;this.save(e),r.fillStyle=this._getPattern(e,t).getPattern(r,this,getCurrentTransformInverse(r),PathType.SHADING,e);let i=getCurrentTransformInverse(r);if(i){let{width:e,height:t}=r.canvas,n=F32_BBOX_INIT.slice();Util.axialAlignedBoundingBox([0,0,e,t],i,n);let[a,o,s,c]=n;this.ctx.fillRect(a,o,s-a,c-o)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,Dependencies.transform).recordDependencies(e,Dependencies.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),this.#_(n)}beginInlineImage(){unreachable(`Should not call beginInlineImage`)}beginImageData(){unreachable(`Should not call beginImageData`)}paintFormXObjectBegin(e,t,n){if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=getCurrentTransform(this.ctx),n)){Util.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[t,r,i,a]=n,o=new Path2D;o.rect(t,r,i-t,a-r),this.ctx.clip(o),this.dependencyTracker?.recordClipBox(e,this.ctx,t,i,r,a),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){if(!this.contentVisible)return;this.save(e);let{inSMaskMode:n}=this;n&&(this.endSMaskMode(),this.current.activeSMask=null);let r=this.ctx;if((!t.needsIsolation||!t.isolated&&!t.hasSoftMask)&&!t.knockout&&!t.isGray&&this.#t===0&&r.globalAlpha===1&&r.globalCompositeOperation===`source-over`&&!n){if(t.bbox){let e=new Path2D,[n,i,a,o]=t.bbox;if(e.rect(n,i,a-n,o-i),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}r.clip(e)}this.groupStack.push(null),this.#u.push(null),this.groupLevel++;return}!t.isolated&&!t.knockout&&this.#t===0&&info(`TODO: Fully support non-isolated non-knockout groups.`);let i=getCurrentTransform(r);t.matrix&&r.transform(...t.matrix);let a=[0,0,r.canvas.width,r.canvas.height],o;t.bbox?(o=F32_BBOX_INIT.slice(),Util.axialAlignedBoundingBox(t.bbox,getCurrentTransform(r),o),o=Util.intersect(o,a)||[0,0,0,0]):o=a;let s=Math.floor(o[0]),c=Math.floor(o[1]),l=Math.max(Math.ceil(o[2])-s,1),u=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,l,u]);let d=this.canvasFactory.create(l,u);t.smask&&this.smaskGroupCanvases.push(d);let f=d.context,p=t.knockout&&!t.isolated?r:null,m=!t.isolated&&!t.knockout&&!t.smask&&t.needsIsolation&&this.#t>0,h=t.knockout?this.canvasFactory.create(l,u):null,g=this.#t;t.knockout?this.#t++:this.#t=0,f.translate(-s,-c),f.transform(...i);let _=!t.isolated&&!t.smask&&t.needsIsolation,v=_&&!n&&g===0&&!t.knockout&&!t.isGray&&t.hasSoftMask&&r.globalAlpha===1&&r.globalCompositeOperation===`source-over`&&this.current.transferMaps===`none`;if(_&&(n||v)&&(f.save(),f.setTransform(1,0,0,1,0,0),f.drawImage(r.canvas,-s,-c),f.restore()),t.bbox){let e=new Path2D,[n,r,i,a]=t.bbox;if(e.rect(n,r,i-n,a-r),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}f.clip(e)}t.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:s,offsetY:c,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null}),(!t.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(s,c),r.save()),copyCtxState(r,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies([`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`]).pushBaseTransform(r),this.setGState(e,[[`BM`,`source-over`],[`ca`,1],[`CA`,1],[`TR`,null]]),this.groupStack.push(r),this.#u.push({backdropCtx:p,savedKnockoutLevel:g,offsetX:s,offsetY:c,hasInnerBackdrop:m,replaceBackdrop:v,knockoutMaskEntry:h,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,t){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,r=this.groupStack.pop(),i=this.#u.pop();if(i&&(this.#t=i.savedKnockoutLevel),r===null){this.restore(e);return}if(t.isGray&&this.#y(n),this.ctx=r,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&(this.ctx.restore(
50),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),this.#b(i);else{this.ctx.restore();let t=getCurrentTransform(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...t);let a=F32_BBOX_INIT.slice();Util.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],t,a);let o=this.#u.at(-1);if(this.#t>0)if(i.hasInnerBackdrop){let{width:e,height:a}=n.canvas,o=this.canvasFactory.create(e,a),s=o.context;s.drawImage(r.canvas,i.offsetX,i.offsetY,e,a,0,0,e,a),s.globalCompositeOperation=`source-over`,s.drawImage(n.canvas,0,0);let c=this.#p(n.canvas);s.globalCompositeOperation=`destination-in`,s.drawImage(c.canvas,0,0);let l=this.ctx.globalCompositeOperation,u=this.ctx.globalAlpha,d=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...t),this.ctx.globalAlpha=1,FeatureTest.isCanvasFilterSupported&&(this.ctx.filter=`none`),this.ctx.globalCompositeOperation=`destination-out`,this.ctx.drawImage(c.canvas,0,0),this.ctx.globalCompositeOperation=l,this.ctx.globalAlpha=u,FeatureTest.isCanvasFilterSupported&&(this.ctx.filter=d??`none`),this.ctx.drawImage(o.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(c),this.canvasFactory.destroy(o)}else{let e=o?.backdropCtx??null;this.#h(this.ctx,n.canvas,{backdropCanvas:e?.canvas??null,destTransform:t,backdropOffset:e?[o.offsetX+i.offsetX,o.offsetY+i.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(i.replaceBackdrop){let e=new Path2D;e.rect(0,0,n.canvas.width,n.canvas.height),this.ctx.clip(e),this.ctx.globalCompositeOperation=`copy`}this.ctx.drawImage(n.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.#b(i),this.compose(a)}}#y(e){let{canvas:t}=e,{width:n,height:r}=t;if(FeatureTest.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter=`grayscale(1)`,e.globalAlpha=1,e.globalCompositeOperation=`copy`,e.drawImage(t,0,0),e.restore();return}let i=e.getImageData(0,0,n,r),{data:a}=i;for(let e=0,t=a.length;e<t;e+=4){let t=a[e]*.2126+a[e+1]*.7152+a[e+2]*.0722+.5|0;a[e]=a[e+1]=a[e+2]=t}e.putImageData(i,0,0)}#b(e){e&&(e.knockoutMaskEntry&&=(this.canvasFactory.destroy(e.knockoutMaskEntry),null),e.knockoutTempEntry&&=(this.canvasFactory.destroy(e.knockoutTempEntry),null),e.knockoutBackdropEntry&&=(this.canvasFactory.destroy(e.knockoutBackdropEntry),null))}beginAnnotation(e,t,n,r,i,a,o){if(this.#d(),resetCtxToDefault(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let i=n[2]-n[0],s=n[3]-n[1];if(a&&this.annotationCanvasMap){r=r.slice(),r[4]-=n[0],r[5]-=n[1],Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx),XY);let{viewportScale:e}=this,a=Math.ceil(i*this.outputScaleX*e),c=Math.ceil(s*this.outputScaleY*e);this.annotationCanvas=this.canvasFactory.create(a,c);let{canvas:l,context:u}=this.annotationCanvas;if(o){let e=this.annotationCanvasMap.getOrInsertComputed(t,makeArr);l.setAttribute(`data-canvas-name`,o);let n=e.findIndex(e=>e.getAttribute(`data-canvas-name`)===o);n===-1?e.push(l):e[n]=l}else this.annotationCanvasMap.set(t,l);this.annotationCanvas.savedCtx=this.ctx,this.ctx=u,this.ctx.save(),this.ctx.setTransform(XY[0],0,0,-XY[1],0,s*XY[1]),resetCtxToDefault(this.ctx)}else{resetCtxToDefault(this.ctx),this.endPath(e);let t=new Path2D;t.rect(n[0],n[1],i,s),this.ctx.clip(t)}}this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...r),this.transform(e,...i),this.baseTransform=getCurrentTransform(this.ctx)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),this.#f(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,t){if(!this.contentVisible)return;let n=t.count;t=this.getObject(e,t.data,t),t.count=n;let r=this.#g(this.current.fillAlpha),i=this.ctx,a=this._createMaskCanvas(e,t),o=a.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(o,a.offsetX,a.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(e),i.restore(
50),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),this.#_(r)}paintImageMaskXObjectRepeat(e,t,n,r=0,i=0,a,o){if(!this.contentVisible)return;t=this.getObject(e,t.data,t);let s=this.#g(this.current.fillAlpha),c=this.ctx;c.save();let l=getCurrentTransform(c);c.transform(n,r,i,a,0,0);let u=this._createMaskCanvas(e,t);c.setTransform(1,0,0,1,u.offsetX-l[4],u.offsetY-l[5]),this.dependencyTracker?.resetBBox(e);for(let t=0,s=o.length;t<s;t+=2){let s=Util.transform(l,[n,r,i,a,o[t],o[t+1]]);c.drawImage(u.canvas,s[4],s[5]),this.dependencyTracker?.recordBBox(e,this.ctx,s[4],s[4]+u.canvas.width,s[5],s[5]+u.canvas.height)}c.restore(),u.canvasEntry&&this.canvasFactory.destroy(u.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(e),this.#_(s)}paintImageMaskXObjectGroup(e,t){if(!this.contentVisible)return;let n=this.#g(this.current.fillAlpha),r=this.ctx,i=this.current.fillColor,a=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,Dependencies.transformAndFill);for(let n of t){let{data:t,width:o,height:s,transform:c}=n,l=this.canvasFactory.create(o,s),u=l.context;u.save(),putBinaryImageMask(u,this.getObject(e,t,n)),u.globalCompositeOperation=`source-in`,u.fillStyle=a?i.getPattern(u,this,getCurrentTransformInverse(r),PathType.FILL,e):i,u.fillRect(0,0,o,s),u.restore(),r.save(),r.transform(...c),r.scale(1,-1),drawImageAtIntegerCoords(r,l.canvas,0,0,o,s,0,-1,1,1),this.canvasFactory.destroy(l),this.dependencyTracker?.recordBBox(e,r,0,o,0,s),r.restore()}this.compose(),this.dependencyTracker?.recordOperation(e),this.#_(n)}paintImageXObject(e,t){if(!this.contentVisible)return;let n=this.getObject(e,t);if(!n){warn(`Dependent image isn't ready yet`);return}this.paintInlineImageXObject(e,n)}paintImageXObjectRepeat(e,t,n,r,i){if(!this.contentVisible)return;let a=this.getObject(e,t);if(!a){warn(`Dependent image isn't ready yet`);return}let o=a.width,s=a.height,c=[];for(let e=0,t=i.length;e<t;e+=2)c.push({transform:[n,0,0,r,i[e],i[e+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(e,a,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps!==`none`&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter=`none`),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps===`none`)return{img:e.bitmap,canvasEntry:null};let{bitmap:t,width:n,height:r}=e,i=this.canvasFactory.create(n,r),a=i.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter=`none`,{img:i.canvas,canvasEntry:i}}paintInlineImageXObject(e,t){if(!this.contentVisible)return;let n=t.width,r=t.height,i=this.#g(this.current.fillAlpha),a=this.ctx;this.save(e);let{filter:o}=a;o!==`none`&&o!==``&&(a.filter=`none`),a.scale(1/n,-1/r);let s,c=null;if(t.bitmap){let e=this.applyTransferMapsToBitmap(t);s=e.img,c=e.canvasEntry}else{let e=this.canvasFactory.create(n,r);putBinaryImageData(e.context,t),s=this.applyTransferMapsToCanvas(e.context),c=e}let l=this._scaleImage(s,getCurrentTransformInverse(a));a.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(a),t.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(e).recordBBox(e,a,0,n,-r,0).recordDependencies(e,Dependencies.imageXObject).recordOperation(e),this.imagesTracker?.record(a,n,r,this.dependencyTracker.clipBox)),drawImageAtIntegerCoords(a,l.img,0,0,l.paintWidth,l.paintHeight,0,-r,n,r),l.tmpCanvas&&this.canvasFactory.destroy(l.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(e),this.#_(i)}paintInlineImageXObjectGroup(e,t,n){if(!this.contentVisible)return;let r=this.#g(this.current.fillAlpha),i=this.ctx,a,o=null;if(t.bitmap)a=t.bitmap;else{let e=t.width,n=t.height,r=this.canvasFactory.create(e,n);putBinaryImageData(r.context,t),a=this.applyTransferMapsToCanvas(r.context),o=r}this.dependencyTracker?.resetBBox(e);for(let t of n)i.save(),i.transform(...t.transform),i.scale(1,-1),drawImageAtIntegerCoords(i,a,t.x,t.y,t.w,t.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,i,0,1,-1,0),i.restore();o&&this.canvasFactory.destroy(o),this.dependencyTracker?.recordOperation(e),this.compose(),this.#_(r)}paintSolidColorImageMask(e){if(!this.contentVisible)return;let t=this.#g(this.current.fillAlpha);this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,Dependencies.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),this.#_(t)}markPoint(e,t){}markPointProps(e,t,n){}beginMarkedContent(e,t){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,n){this.dependencyTracker?.beginMarkedContent(e),t===`OC`?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,n){let r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let i=this.ctx;this.pendingClip?(r||(this.pendingClip===EO_CLIP?i.clip(t,`evenodd`):i.clip(t)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency(`clipPath`,e)):this.dependencyTracker?.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=getCurrentTransform(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:t,b:n,c:r,d:i}=this.ctx.getTransform(),a,o;if(n===0&&r===0){let n=Math.abs(t),r=Math.abs(i);if(n===r)if(e===0)a=o=1/n;else{let t=n*e;a=o=t<1?1/t:1}else if(e===0)a=1/n,o=1/r;else{let t=n*e,i=r*e;a=t<1?1/t:1,o=i<1?1/i:1}}else{let s=Math.abs(t*i-n*r),c=Math.hypot(t,n),l=Math.hypot(r,i);if(e===0)a=l/s,o=c/s;else{let t=e*s;a=l>t?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,n){let{ctx:r,current:{lineWidth:i}}=this,[a,o]=this.getScaleForStroking();if(a===o){r.lineWidth=(i||1)*a,r.stroke(t);return}let s=e.#e??=new DOMMatrix,c=r.getLineDash();n&&r.save(),r.scale(a,o),s.a=1/a,s.d=1/o;let l=new Path2D;if(l.addPath(t,s),c.length>0){let e=Math.max(a,o);r.setLineDash(c.map(t=>t/e)),r.lineDashOffset/=e}
50r.lineWidth=i||1,r.stroke(l),n&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(let e in OPS)CanvasGraphics.prototype[e]!==void 0&&(CanvasGraphics.prototype[OPS[e]]=CanvasGraphics.prototype[e]);var BasePDFStream=class{#e=null;#t=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(e,t,n){this._source=e,this.#e=t,this.#t=n}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return assert(!this._fullReader,`BasePDFStream.getFullReader can only be called once.`),this._fullReader=new this.#e(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new this.#t(this,e,t);return this._rangeReaders.add(n),n}cancelAllRequests(e){this._fullReader?.cancel(e);for(let t of new Set(this._rangeReaders))t.cancel(e)}},BasePDFStreamReader=class{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(e){this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){unreachable("Abstract method `read` called")}cancel(e){unreachable("Abstract method `cancel` called")}},BasePDFStreamRangeReader=class{_stream=null;constructor(e,t,n){this._stream=e}async read(){unreachable("Abstract method `read` called")}cancel(e){unreachable("Abstract method `cancel` called")}};function getFilenameFromContentDispositionHeader(e){let t=!0,n=r(`filename\\*`,`i`).exec(e);if(n){n=n[1];let e=s(n);return e=unescape(e),e=c(e),e=l(e),a(e)}if(n=o(e),n)return a(l(n));if(n=r(`filename`,`i`).exec(e),n){n=n[1];let e=s(n);return e=l(e),a(e)}function r(e,t){return RegExp(`(?:^|;)\\s*`+e+`\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)`,t)}function i(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{let r=new TextDecoder(e,{fatal:!0}),i=stringToBytes(n);n=r.decode(i),t=!1}catch{}}return n}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=i(`utf-8`,e),t&&(e=i(`iso-8859-1`,e))),e}function o(e){let t=[],n,i=r(`filename\\*((?!0\\d)\\d+)(\\*?)`,`ig`);for(;(n=i.exec(e))!==null;){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(e===0)break;continue}t[e]=[r,i]}let a=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=s(r),n&&(r=unescape(r),e===0&&(r=c(r))),a.push(r)}return a.join(``)}function s(e){if(e.startsWith(`"`)){let t=e.slice(1).split(`\\"`);for(let e=0;e<t.length;++e){let n=t[e].indexOf(`"`);n!==-1&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,`$1`)}e=t.join(`"`)}return e}function c(e){let t=e.indexOf(`'`);return t===-1?e:i(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,``))}function l(e){return!e.startsWith(`=?`)||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(e,t,n,r){if(n===`q`||n===`Q`)return r=r.replaceAll(`_`,` `),r=r.replaceAll(/=([0-9a-f]{2})/gi,function(e,t){return String.fromCharCode(parseInt(t,16))}),i(t,r);try{r=atob(r)}catch{}return i(t,r)})}return``}function createHeaders(e,t){let n=new Headers;if(!e||!t||typeof t!=`object`)return n;for(let e in t){let r=t[e];r!==void 0&&n.append(e,r)}return n}function trimHeadersEnd(e){let t=e.length;for(;t>0&&e[t-1]!==` `&&/\s/.test(e[t-1]);)t--;return e.slice(0,t)}function getResponseOrigin(e){return URL.parse(e)?.origin??null}function validateRangeRequestCapabilities({responseHeaders:e,isHttp:t,rangeChunkSize:n,disableRange:r}){let i={contentLength:0,isRangeSupported:!1},a=parseInt(e.get(`Content-Length`),10);return!Number.isInteger(a)||(i.contentLength=a,a<=2*n)||r||!t||e.get(`Accept-Ranges`)!==`bytes`||(e.get(`Content-Encoding`)||`identity`)===`identity`&&(i.isRangeSupported=!0),i}function extractFilenameFromHeader(e){let t=e.get(`Content-Disposition`);if(t){let e=getFilenameFromContentDispositionHeader(t);if(e.includes(`%`))try{e=decodeURIComponent(e)}catch{}if(isPdfFile(e))return e}return null}function createResponseError(e,t){return new ResponseException(`Unexpected server response
50(${e}) while retrieving PDF "${t.href}".`,e,e===404||e===0&&t.protocol===`file:`)}function ensureResponseOrigin(e,t){if(e!==t)throw Error(`Expected range response-origin "${e}" to match "${t}".`)}function fetchUrl(e,t,n,r){return fetch(e,{method:`GET`,headers:t,signal:r.signal,mode:`cors`,credentials:n?`include`:`same-origin`,redirect:`follow`})}function ensureResponseStatus(e,t){if(e!==200&&e!==206)throw createResponseError(e,t)}function getArrayBuffer(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw Error(`getArrayBuffer - unexpected data: ${e}`)}var PDFFetchStream=class extends BasePDFStream{_responseOrigin=null;constructor(e){super(e,PDFFetchStreamReader,PDFFetchStreamRangeReader);let{httpHeaders:t,url:n}=e;assert(/https?:/.test(n.protocol),`PDFFetchStream only supports http(s):// URLs.`),this.headers=createHeaders(!0,t)}},PDFFetchStreamReader=class extends BasePDFStreamReader{_abortController=new AbortController;_reader=null;constructor(e){super(e);let{disableRange:t,disableStream:n,rangeChunkSize:r,url:i,withCredentials:a}=e._source;this._isStreamingSupported=!n,fetchUrl(i,new Headers(e.headers),a,this._abortController).then(n=>{e._responseOrigin=getResponseOrigin(n.url),ensureResponseStatus(n.status,i),this._reader=n.body.getReader();let a=n.headers,{contentLength:o,isRangeSupported:s}=validateRangeRequestCapabilities({responseHeaders:a,isHttp:!0,rangeChunkSize:r,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=extractFilenameFromHeader(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new AbortException(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:getArrayBuffer(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},PDFFetchStreamRangeReader=class extends BasePDFStreamRangeReader{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r,withCredentials:i}=e._source,a=new Headers(e.headers);a.append(`Range`,`bytes=${t}-${n-1}`),fetchUrl(r,a,i,this._abortController).then(t=>{ensureResponseOrigin(getResponseOrigin(t.url),e._responseOrigin),ensureResponseStatus(t.status,r),this._reader=t.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};function transport_stream_getArrayBuffer(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function endRequests(){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}var PDFDataTransportStream=class extends BasePDFStream{_progressiveDone=!1;_queuedChunks=[];constructor(e){super(e,PDFDataTransportStreamReader,PDFDataTransportStreamRangeReader);let{pdfDataRangeTransport:t}=e,{initialData:n,progressiveDone:r}=t;if(n?.length>0){let e=transport_stream_getArrayBuffer(n);this._queuedChunks.push(e)}this._progressiveDone=r,t.transportReady(e=>{switch(e.type){case`range`:case`progressiveRead`:this.#e(e.begin,e.chunk);break;case`progressiveDone`:this._fullReader?.progressiveDone(),this._progressiveDone=!0;break}})}#e(e,t){let n=transport_stream_getArrayBuffer(t);if(e===void 0)this._fullReader?this._fullReader._enqueue(n):this._queuedChunks.push(n);else{let t=this._rangeReaders.keys().find(t=>t._begin===e);assert(t,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),t._enqueue(n)}}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onDone=()=>this._rangeReaders.delete(n),this._source.pdfDataRangeTransport.requestDataRange(e,t)),n}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}},PDFDataTransportStreamReader=class extends BasePDFStreamReader{#e=end
50Requests.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(e){super(e);let{pdfDataRangeTransport:t,disableRange:n,disableStream:r}=e._source,{length:i,contentDispositionFilename:a}=t;this._queuedChunks=e._queuedChunks||[];for(let e of this._queuedChunks)this._loaded+=e.byteLength;this._done=e._progressiveDone,this._contentLength=i,this._isStreamingSupported=!r,this._isRangeSupported=!n,isPdfFile(a)&&(this._filename=a),this._headersCapability.resolve();let o=this._loaded;Promise.resolve().then(()=>{o>0&&this._loaded===o&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e()}progressiveDone(){this._done||=!0,this._queuedChunks.length===0&&this.#e()}},PDFDataTransportStreamRangeReader=class extends BasePDFStreamRangeReader{#e=endRequests.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(e,t,n){super(e,t,n),this._begin=t}_enqueue(e){this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),this.#e()),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this.onDone?.()}},OK_RESPONSE=200,PARTIAL_CONTENT_RESPONSE=206;function network_getArrayBuffer(e){return typeof e==`string`?stringToBytes(e).buffer:e}var PDFNetworkStream=class extends BasePDFStream{#e=new WeakMap;_responseOrigin=null;constructor(e){super(e,PDFNetworkStreamReader,PDFNetworkStreamRangeReader);let{httpHeaders:t,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=createHeaders(this.isHttp,t)}_request(e){let t=new XMLHttpRequest,n={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};this.#e.set(t,n),t.open(`GET`,this.url),t.withCredentials=this._source.withCredentials;for(let[e,n]of this.headers)t.setRequestHeader(e,n);return this.isHttp&&`begin`in e&&`end`in e?(t.setRequestHeader(`Range`,`bytes=${e.begin}-${e.end-1}`),n.validateStatus=e=>e===PARTIAL_CONTENT_RESPONSE||e===OK_RESPONSE):n.validateStatus=e=>e===OK_RESPONSE,t.responseType=`arraybuffer`,assert(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>e.onError(t.status),t.onreadystatechange=this.#n.bind(this,t),t.onprogress=this.#t.b
50ind(this,t),t.send(null),t}#t(e,t){this.#e.get(e)?.onProgress?.(t)}#n(e,t){let n=this.#e.get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!this.#e.has(e))return;if(this.#e.delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let r=e.status||OK_RESPONSE;if(!n.validateStatus(r)){n.onError(e.status);return}let i=network_getArrayBuffer(e.response);if(r===PARTIAL_CONTENT_RESPONSE){let t=e.getResponseHeader(`Content-Range`);/bytes \d+-\d+\/\d+/.test(t)?n.onDone(i):(warn(`Missing or invalid "Content-Range" header.`),n.onError(0))}else i?n.onDone(i):n.onError(e.status)}_abortRequest(e){this.#e.has(e)&&(this.#e.delete(e),e.abort())}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}},PDFNetworkStreamReader=class extends BasePDFStreamReader{#e=endRequests.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(e){super(e),this._fullRequestXhr=e._request({onHeadersReceived:this.#t.b
50ind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:this.#i.bind(this)})}#t(){let e=this._stream,{disableRange:t,rangeChunkSize:n}=e._source,r=this._fullRequestXhr;e._responseOrigin=getResponseOrigin(r.responseURL);let i=r.getAllResponseHeaders(),a=new Headers(i?trimHeadersEnd(i.trimStart()).split(/[\r\n]+/).map(e=>{let[t,...n]=e.split(`: `);return[t,n.join(`: `)]}):[]),{contentLength:o,isRangeSupported:s}=validateRangeRequestCapabilities({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:n,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=extractFilenameFromHeader(a),this._isRangeSupported&&e._abortRequest(r),this._headersCapability.resolve()}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&this.#e()}#r(e){this._storedError=createResponseError(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#i(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),this.#e(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}},PDFNetworkStreamRangeReader=class extends BasePDFStreamRangeReader{#e=endRequests.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(e,t,n){super(e,t,n),this._requestXhr=e._request({begin:t,end:n,onHeadersReceived:this.#t.b
50ind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:null})}#t(){let e=getResponseOrigin(this._requestXhr?.responseURL);try{ensureResponseOrigin(e,this._stream._responseOrigin)}catch(e){this._storedError=e,this.#r(0)}}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this.#e(),this.onClosed?.()}#r(e){this._storedError??=createResponseError(e,this._stream.url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};function getReadableStream(e,t=null){let n=process.getBuiltinModule(`fs`),{Readable:r}=process.getBuiltinModule(`stream`),i=n.createReadStream(e,t);return r.toWeb(i)}var PDFNodeStream=class extends BasePDFStream{constructor(e){super(e,PDFNodeStreamReader,PDFNodeStreamRangeReader);let{url:t}=e;assert(t.protocol===`file:`,`PDFNodeStream only supports file:// URLs.`)}},PDFNodeStreamReader=class extends BasePDFStreamReader{_reader=null;constructor(e){super(e);let{disableRange:t,disableStream:n,rangeChunkSize:r,url:i}=e._source;this._isStreamingSupported=!n,process.getBuiltinModule(`fs/promises`).lstat(i).then(e=>{let n=getReadableStream(i);this._reader=n.getReader();let{size:a}=e;this._contentLength=a,this._isRangeSupported=!t&&a>2*r,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new AbortException(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(e=>{e.code===`ENOENT`&&(e=createResponseError(0,i)),this._headersCapability.reject(e)})}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:getArrayBuffer(e),done:!1})}cancel(e){this._reader?.cancel(e)}},PDFNodeStreamRangeReader=class extends BasePDFStreamRangeReader{_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r}=e._source;try{let e=getReadableStream(r,{start:t,end:n-1});this._reader=e.getReader(),this._readCapability.resolve()}catch(e){this._readCapability.reject(e)}}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e)}};function getNetworkStream(e){return isValidFetchUrl(e)?PDFFetchStream:isNodeJS?PDFNodeStream:PDFNetworkStream}var GlobalWorkerOptions=class{static#e=null;static#t=``;static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<`u`&&e instanceof Worker)&&e!==null)throw Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!=`string`)throw Error("Invalid `workerSrc` type.");this.#t=e}},Metadata=class{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}},INTERNAL=Symbol(`INTERNAL`),OptionalContentGroup=class{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:t,intent:n,usage:r,rbGroups:i}){this.#e=!!(e&RenderingIntentFlag.DISPLAY),this.#t=!!(e&RenderingIntentFlag.PRINT),this.name=t,this.intent=n,this.usage=r,this.rbGroups=i}get visible(){if(this.#n)return this.#r;if(!this.#r)return!1;let{print:e,view:t}=this.usage;return this.#e?t?.viewState!==`OFF`:this.#t?e?.printState!==`OFF`:!0}_setVisible(e,t,n=!1){e!==INTERNAL&&unreachable("Internal method `_setVisible` called."),this.#n=n,this.#r=t}get serializable(){return{userSet:this.#n,visible:this.#r}}},OptionalContentConfig=class e{#e=null;#t=new Map;#n=null;#r=null;#i;creator=null;name=null;constructor(e,t=RenderingIntentFlag.DISPLAY,n=null){if(this.#i=e,this.renderingIntent=t,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(let n of e.groups)this.#t.set(n.id,new OptionalContentGroup(t,n));if(n){n.size!==this.#t.size&&unreachable(`Incorrect serialized groupState.`);for(let[e,t]of n)this.#t.get(e)._setVisible(INTERNAL,t.visible,t.userSet)}else{if(e.baseState===`OFF`)for(let e of this.#t.values())e._setVisible(INTERNAL,!1);for(let t of e.on)this.#t.get(t)._setVisible(INTERNAL,!0);for(let t of e.off)this.#t.get(t)._setVisible(INTERNAL,!1)}this.#n=this.getHash()}}#a(e){let t=e.length;if(t<2)return!0;let n=e[0];for(let r=1;r<t;r++){let t=e[r],i;if(Array.isArray(t))i=this.#a(t);else if(this.#t.has(t))i=this.#t.get(t).visible;else return warn(`Optional content group not found: ${t}`),!0;switch(n){case`And`:if(!i)return!1;break;case`Or`:if(i)return!0;break;case`Not`:return!i;default:return!0}}return n===`And`}isVisible(e){if(this.#t.size===0)return!0;
50if(!e)return info(`Optional content group not defined.`),!0;if(e.type===`OCG`)return this.#t.has(e.id)?this.#t.get(e.id).visible:(warn(`Optional content group not found: ${e.id}`),!0);if(e.type===`OCMD`){if(e.expression)return this.#a(e.expression);if(!e.policy||e.policy===`AnyOn`){for(let t of e.ids){if(!this.#t.has(t))return warn(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}else if(e.policy===`AllOn`){for(let t of e.ids){if(!this.#t.has(t))return warn(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}else if(e.policy===`AnyOff`){for(let t of e.ids){if(!this.#t.has(t))return warn(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}else if(e.policy===`AllOff`){for(let t of e.ids){if(!this.#t.has(t))return warn(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return warn(`Unknown optional content policy ${e.policy}.`),!0}return warn(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){let r=this.#t.get(e);if(!r){warn(`Optional content group not found: ${e}`);return}if(n&&t&&r.rbGroups.length)for(let t of r.rbGroups)for(let n of t)n!==e&&this.#t.get(n)?._setVisible(INTERNAL,!1,!0);r._setVisible(INTERNAL,!!t,!0),this.#e=null}setOCGState({state:e,preserveRB:t}){let n;for(let r of e){switch(r){case`ON`:case`OFF`:case`Toggle`:n=r;continue}let e=this.#t.get(r);if(e)switch(n){case`ON`:this.setVisibility(r,!0,t);break;case`OFF`:this.setVisibility(r,!1,t);break;case`Toggle`:this.setVisibility(r,!e.visible,t);break}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new MurmurHash3_64;for(let[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}get serializable(){let e=new Map;for(let[t,n]of this.#t)e.set(t,n.serializable);return{data:this.#i,renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:t,renderingIntent:n,groupState:r}){return new e(t,n,r)}},PagesMapper=class{#e=null;#t=null;#n=0;#r=null;#i=null;get pagesNumber(){return this.#n}set pagesNumber(e){this.#n!==e&&(this.#n=e,this.#e=null,this.#t=null)}#a(){if(this.#e)return;let e=this.#n,t=this.#e=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=n+1;this.#t=new Int32Array(t)}#o(){let e=new Map,t=this.#e;for(let n=0,r=this.#n;n<r;n++){let r=t[n],i=e.get(r);i?i.push(n+1):e.set(r,[n+1])}return e}movePages(e,t,n){this.#a();let r=this.#e,i=t.length,a=new Uint32Array(i),o=0;for(let e=0;e<i;e++){let i=t[e]-1;a[e]=r[i],i<n&&o++}let s=this.#n,c=s-i,l=new Int32Array(s),u=MathClamp(n-o,0,c);for(let t=0,n=0;t<s;t++)e.has(t+1)||(r[n]=r[t],l[n++]=t+1);r.copyWithin(u+i,u,c),r.set(a,u),l.copyWithin(u+i,u,c),l.set(t,u),this.#t=l,r.every((e,t)=>e===t+1)&&(this.#e=null)}deletePages(e){this.#a();let t=this.#e,n=this.#o();this.#i={pageNumberToId:t.slice(),pagesNumber:this.#n,prevPageNumbers:this.#t.slice()};let r=this.#n-e.length;this.#n=r;let i=this.#e=new Uint32Array(r);this.#t=new Int32Array(r);let a=0,o=0;for(let n of e){let e=n-1;e!==a&&(i.set(t.subarray(a,e),o),o+=e-a),a=e+1}a<t.length&&i.set(t.subarray(a),o),this.#s(n,new Set(e))}cancelDelete(){this.#i&&=(this.#e=this.#i.pageNumberToId,this.#n=this.#i.pagesNumber,this.#t=this.#i.prevPageNumbers,null)}cleanSavedData(){this.#i=null}copyPages(e){this.#a(),this.#r={pageNumbers:e,pageIds:e.map(e=>this.#e[e-1])}}cancelCopy(){this.#r=null}pastePages(e){this.#a();let t=this.#e,n=this.#o(),{pageNumbers:r,pageIds:i}=this.#r,a=this.#n+r.length;this.#n=a;let o=this.#e=new Uint32Array(a);this.#t=new Int32Array(a),o.set(t.subarray(0,e),0),o.set(i,e),o.set(t.subarray(e),e+r.length),this.#s(n,null,e,r),this.#r=null}#s(e,t=null,n=-1,r=null){let i=this.#t,a=this.#e,o=n+(r?.length??0),s=new Map;for(let c=0,l=this.#n;c<l;c++){if(c>=n&&c<o){i[c]=-r[c-n];continue}let l=a[c],u=e.get(l),d=s.get(l)||0;if(t&&u)for(;d<u.length&&t.has(u[d]);)d++;i[c]=u?.[d],s.set(l,d+1)}}hasBeenAltered(){return this.#e!==null}#c(e=null){if(!this.#e)return null;let t=new Int32Array(this.#n).fill(-1),n=new Map;if(e)for(let r of e){let e=this.getPageId(r),i=n.get(e)??0;n.set(e,i+1),t[r-1]=i}else for(let e=0,r=this.#n;e<r;e++){let r=this.#e[e],i=n.get(r)??0;n.set(r,i+1),t[e]=i}return t}getPageMappingForSaving(e=null,t=this.#c()){e??=this.#o();let n=0;for(let t of e.values())n=Math.max(n,t.length);let r=Array(n);for(let e=0;e<n;e++)r[e]={document:null,pageIndices:[],includePages:[]};for(let[t,n]of e)for(let e=0,i=n.length;e<i;e++)r[e].includePages.push([t-1,n[e]-1]);for(let{includePages:e,pageIndices:t}of r){e.sort((e,t)=>
50e[0]-t[0]);for(let n=0,r=e.length;n<r;n++)t.push(e[n][1]),e[n]=e[n][0]}return{pageInfos:r,copyLevels:t}}extractPages(e){e=Array.from(e).sort((e,t)=>e-t);let t=new Map;for(let n=0,r=e.length;n<r;n++){let r=this.getPageId(e[n]);t.getOrInsertComputed(r,makeArr).push(n+1)}return this.getPageMappingForSaving(t,this.#c(e))}getPrevPageNumber(e){return this.#t?.[e-1]??0}getPageNumber(e){if(!this.#e)return e;let t=this.#e;for(let n=0,r=this.#n;n<r;n++)if(t[n]===e)return n+1;return 0}getPageId(e){return this.#e?.[e-1]??e}getMapping(){return this.#e?.subarray(0,this.pagesNumber)}},INITIAL_DATA=Symbol(`INITIAL_DATA`),dataObj=()=>({...Promise.withResolvers(),data:INITIAL_DATA}),PDFObjects=class{#e=new Map;get(e,t=null){if(t){let n=this.#e.getOrInsertComputed(e,dataObj);return n.promise.then(()=>t(n.data)),null}let n=this.#e.get(e);if(!n||n.data===INITIAL_DATA)throw Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){let t=this.#e.get(e);return!!t&&t.data!==INITIAL_DATA}delete(e){let t=this.#e.get(e);return!t||t.data===INITIAL_DATA?!1:(this.#e.delete(e),!0)}resolve(e,t=null){let n=this.#e.getOrInsertComputed(e,dataObj);if(n.data!==INITIAL_DATA)throw Error(`Object already resolved ${e}.`);n.data=t,n.resolve()}clear(){for(let{data:e}of this.#e.values())e?.bitmap?.close();this.#e.clear()}*[Symbol.iterator](){for(let[e,{data:t}]of this.#e)t!==INITIAL_DATA&&(yield[e,t])}},MAX_TEXT_DIVS_TO_RENDER=1e5,DEFAULT_FONT_SIZE=30,TextLayer=class e{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#i=null;#a=null;#o=null;#s=0;#c=0;#l=null;#u=null;#d=0;#f=0;#p=Object.create(null);#m=[];#h=null;#g=[];#_=new WeakMap;#v=null;static#y=new Map;static#b=new Map;static#x=new WeakMap;static#S=null;static#C=new Set;constructor({textContentSource:t,images:n,container:r,viewport:i}){if(t instanceof ReadableStream)this.#h=t;else if(typeof t==`object`)this.#h=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error(`No "textContentSource" parameter specified.`);this.#t=this.#u=r,this.#i=n,this.#f=i.scale*OutputScale.pixelRatio,this.#d=i.rotation,this.#o={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:o,pageX:s,pageY:c}=i.rawDims;this.#v=[1,0,0,-1,-s,c+o],this.#c=a,this.#s=o,e.#k(),r.style.setProperty(`--min-font-size`,e.#S),setLayerDimensions(r,i),this.#e.promise.finally(()=>{e.#C.delete(this),this.#o=null,this.#p=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:t}=FeatureTest.platform;return shadow(this,`fontFamilyMap`,new Map([[`sans-serif`,`${e&&t?`Calibri, `:``}sans-serif`],[`monospace`,`${e&&t?`Lucida Console, `:``}monospace`]]))}render(){this.#i&&this.#t.append(this.#i.render());let t=()=>{this.#l.read().then(({value:e,done:n})=>{if(n){this.#e.resolve();return}this.#a??=e.lang,Object.assign(this.#p,e.styles),this.#w(e.items),t()},this.#e.reject)};return this.#l=this.#h.getReader(),e.#C.add(this),t(),this.#e.promise}update({viewport:t,onBefore:n=null}){let r=t.scale*OutputScale.pixelRatio,i=t.rotation;if(i!==this.#d&&(n?.(),this.#d=i,setLayerDimensions(this.#u,{rotation:i})),r!==this.#f){n?.(),this.#f=r;let t={div:null,properties:null,ctx:e.#D(this.#a)};for(let e of this.#g)t.properties=this.#_.get(e),t.div=e,this.#E(t)}}cancel(){let e=new AbortException(`TextLayer task cancelled.`);this.#l?.cancel(e).catch(()=>{}),this.#l=null,this.#e.reject(e)}get textDivs(){return this.#g}get textContentItemsStr(){return this.#m}#w(t){if(this.#n)return;this.#o.ctx??=e.#D(this.#a);let n=this.#g,r=this.#m;for(let e of t){if(n.length>MAX_TEXT_DIVS_TO_RENDER){warn(`Ignoring additional textDivs for performance reasons.`),this.#n=!0;return}if(e.str===void 0){if(e.type===`beginMarkedContentProps`||e.type===`beginMarkedContent`){let t=this.#t;this.#t=document.createElement(`span`),this.#t.classList.add(`markedContent`),e.id&&this.#t.setAttribute(`id`,e.id),e.tag===`Artifact`&&(this.#t.ariaHidden=!0),t.append(this.#t)}else e.type===`endMarkedContent`&&(this.#t=this.#t.parentNode);continue}r.push(e.str),this.#T(e)}}#T(t){let n=document.createElement(`span`),r={angle:0,canvasWidth:0,hasText:t.str!==``,hasEOL:t.hasEOL,fontSize:0};this.#g.push(n);let i=Util.transform(this.#v,t.transform),a=Math.atan2(i[1],i[0]),o=this.#p[t.fontName];o.vertical&&(a+=Math.PI/2);let s=this.#r&&o.fontSubstitution||o.fontFamily;s=e.fontFamilyMap.get(s)||s;let c=Math.hypot(i[2],i[3]),l=c*e.#A(s,o,this.#a),u,d;a===0?(u=i[4],d=i[5]-l):(u=i[4]+l*Math.sin(a),d=i[5]-l*Math.cos(a));let f=n.style;f.left=`${(100*u/this.#c).toFixed(2)}%`,f.top=`${(100*d/this.#s).toFixed(2)}%`,f.setProperty(`--font-height`,`${c.toFixed(2)}px`),f.fontFamily=s,r.fontSize=c,n.setAttribute(`role`,`presentation`),n.textContent=t.str,n.dir=t.dir,this.#r&&(n.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),a!==0&&(r.angle=180/Math.PI*a);let p=!1;if(t.str.length>1)p=!0;else if(t.str!==` `&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(p=!0)}if(p&&(r.canvasWidth=o.vertical?t.height:t.width),this.#_.set(n,r),this.#o.div=n,this.#o.properties=r,this.#
50E(this.#o),r.hasText&&this.#t.append(n),r.hasEOL){let e=document.createElement(`br`);e.setAttribute(`role`,`presentation`),this.#t.append(e)}}#E(t){let{div:n,properties:r,ctx:i}=t,{style:a}=n;if(r.canvasWidth!==0&&r.hasText){let{fontFamily:t}=a,{canvasWidth:o,fontSize:s}=r;e.#O(i,s*this.#f,t);let{width:c}=i.measureText(n.textContent);c>0&&a.setProperty(`--scale-x`,o*this.#f/c)}r.angle!==0&&a.setProperty(`--rotate`,`${r.angle}deg`)}static cleanup(){if(!(this.#C.size>0)){this.#y.clear();for(let{canvas:e}of this.#b.values())e.remove();this.#b.clear()}}static#D(e=null){let t=this.#b.get(e||=``);if(!t){let n=document.createElement(`canvas`);n.style.cssText=`position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal`,n.lang=e,document.body.append(n),t=n.getContext(`2d`,{alpha:!1,willReadFrequently:!0}),this.#b.set(e,t),this.#x.set(t,{size:0,family:``})}return t}static#O(e,t,n){let r=this.#x.get(e);t===r.size&&n===r.family||(e.font=`${t}px ${n}`,r.size=t,r.family=n)}static#k(){if(this.#S!==null)return;let e=document.createElement(`div`);e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize=`1px`,e.style.position=`absolute`,e.textContent=`X`,document.body.append(e),this.#S=e.getBoundingClientRect().height,e.remove()}static#A(e,t,n){let r=this.#y.get(e);if(r)return r;let i=this.#D(n);i.canvas.width=i.canvas.height=DEFAULT_FONT_SIZE,this.#O(i,DEFAULT_FONT_SIZE,e);let a=i.measureText(``),o=a.fontBoundingBoxAscent,s=Math.abs(a.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let c=.8;return o?c=o/(o+s):(FeatureTest.platform.isFirefox&&warn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?c=t.ascent:t.descent&&(c=1+t.descent)),this.#y.set(e,c),c}},RENDERING_CANCELLED_TIMEOUT=100;function getDocument(e={}){let t=new PDFDocumentLoadingTask,{docId:n}=t,r=e.url?getUrlProp(e.url):null,i=e.data?getDataProp(e.data):null,a=e.httpHeaders||null,o=e.withCredentials===!0,s=e.password??null,c=e.range instanceof PDFDataRangeTransport?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:2**16,u=e.worker instanceof PDFWorker?e.worker:null,d=e.verbosity,f=typeof e.docBaseUrl==`string`&&!isDataScheme(e.docBaseUrl)?e.docBaseUrl:null,p=getFactoryUrlProp(e.cMapUrl),m=e.cMapPacked!==!1,h=getFactoryUrlProp(e.iccUrl),g=getFactoryUrlProp(e.standardFontDataUrl),_=getFactoryUrlProp(e.wasmUrl),v=e.stopAtErrors!==!0,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=typeof e.isOffscreenCanvasSupported==`boolean`?e.isOffscreenCanvasSupported:!isNodeJS,x=typeof e.isImageDecoderSupported==`boolean`?e.isImageDecoderSupported:!isNodeJS,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,C=typeof e.disableFontFace==`boolean`?e.disableFontFace:isNodeJS,w=e.fontExtraProperties===!0,T=e.enableXfa===!0,E=e.ownerDocument||globalThis.document,D=e.disableRange===!0,O=e.disableStream===!0,k=e.disableAutoFetch===!0,A=e.pdfBug===!0,j=e.CanvasFactory||(isNodeJS?NodeCanvasFactory:DOMCanvasFactory),M=e.FilterFactory||(isNodeJS?NodeFilterFactory:DOMFilterFactory),N=e.BinaryDataFactory||(isNodeJS?NodeBinaryDataFactory:DOMBinaryDataFactory),P=e.enableHWA===!0,F=e.enableWebGPU===!0?initGPU():Promise.resolve(!1),I=e.useWasm!==!1,L=e.pagesMapper||new PagesMapper,R=typeof e.useSystemFonts==`boolean`?e.useSystemFonts:!isNodeJS&&!C,z=typeof e.useWorkerFetch==`boolean`?e.useWorkerFetch:!!(N===DOMBinaryDataFactory&&p&&m&&g&&_&&isValidFetchUrl(p,document.baseURI)&&isValidFetchUrl(g,document.baseURI)&&isValidFetchUrl(_,document.baseURI)),B=null;setVerbosityLevel(d);let V={canvasFactory:new j({ownerDocument:E,enableHWA:P}),filterFactory:new M({docId:n,ownerDocument:E}),binaryDataFactory:z?null:new N({cMapUrl:p,standardFontDataUrl:g,wasmUrl:_})};u||(u=PDFWorker.create({verbosity:d,port:GlobalWorkerOptions.workerPort}),t._worker=u);let H={docId:n,apiVersion:`6.3.289`,data:i,password:s,disableAutoFetch:k,rangeChunkSize:l,docBaseUrl:f,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:C,ignoreErrors:v,isOffscreenCanvasSupported:b,isImageDecoderSupported:x,canvasMaxAreaInBytes:S,fontExtraProperties:w,useSystemFonts:R,useWasm:I,useWorkerFetch:z,cMapUrl:p,cMapPacked:m,iccUrl:h,standardFontDataUrl:g,wasmUrl:_,hasGPU:!1}},ee={ownerDocument:E,pdfBug:A,styleElement:null,enableHWA:P,loadingParams:{disableAutoFetch:k,enableXfa:T}};return Promise.all([u.promise,F]).then(function([,e]){if(u.destroyed)throw Error(`Worker was destroyed`);H.evaluatorOptions.hasGPU=e;
50let s=u.messageHandler.sendWithPromise(`GetDocRequest`,H,i?[i.buffer]:null),d;if(!i)if(c)d=new PDFDataTransportStream({pdfDataRangeTransport:c,disableRange:D,disableStream:O});else if(r)d=new(getNetworkStream(r))({url:r,httpHeaders:a,withCredentials:o,rangeChunkSize:l,disableRange:D,disableStream:O});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.");return s.then(e=>{if(u.destroyed)throw Error(`Worker was destroyed`);let r=new MessageHandler(n,e,u.port);if(t._transport=new WorkerTransport(r,t,d,ee,V,L),t.destroyed)throw Error(`Loading aborted`);r.send(`Ready`,null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}var PDFDocumentLoadingTask=class e{static#e=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${e.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}},PDFDataRangeTransport=class{#e=Promise.withResolvers();#t=null;constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r}onDataRange(e,t){this.#t({type:`range`,begin:e,chunk:t})}onDataProgressiveRead(e){this.#e.promise.then(()=>{this.#t({type:`progressiveRead`,chunk:e})})}onDataProgressiveDone(){this.#e.promise.then(()=>{this.#t({type:`progressiveDone`})})}transportReady(e){this.#t=e,this.#e.resolve()}requestDataRange(e,t){unreachable(`Abstract method PDFDataRangeTransport.requestDataRange`)}abort(){}},PDFDocumentProxy=class{constructor(e,t){this._pdfInfo=e,this._transport=t}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return shadow(this,`isPureXfa`,!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}
vendor: 4,803 bytes, line 50
50getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e,t=null){return this._transport.extractPages(e,t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(e){return this._transport.getSignatureData(e)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},PDFPageProxy=class e{#e=!1;#t=null;constructor(e,t,n,r,i=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=i?new StatTimer:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new PDFObjects,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#t=r,this.imageCoordinates=null}clone(t){let n=new e(t,this._pageInfo,this._transport,this.#t,this._pdfBug);return n.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(n),n}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new PageViewport({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return shadow(this,`isPureXfa`,!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:t=e.canvas,viewport:n,intent:r=`display`,annotationMode:i=AnnotationMode.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:s=null,annotationCanvasMap:c=null,pageColors:l=null,printAnnotationStorage:u=null,isEditing:d=!1,recordImages:f=!1,recordOperations:p=!1,operationsFilter:m=null}){this._stats?.time(`Overall`);let h=this._transport.getRenderingIntent(r,i,u,d),{renderingIntent:g,cacheKey:_}=h;this.#e=!1,s||=this._transport.getOptionalContentConfig(g);let v=this._intentStates.getOrInsertComputed(_,makeObj);v.streamReaderCancelTimeout&&=(clearTimeout(v.streamReaderCancelTimeout),null);let y=!!(g&RenderingIntentFlag.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(h));let b=!!(this._pdfBug&&globalThis.StepperManager?.enabled),x=!!t&&!this.recordedBBoxes&&(p||b),S=!!t&&!this.imageCoordinates&&f,C=e=>{if(v.renderTasks.delete(E),x){let e=E.gfx?.dependencyTracker.take();e&&(E.stepper?.setOperatorBBoxes(e,E.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=e))}S&&!e&&(this.imageCoordinates=E.gfx?.imagesTracker.take()),y&&(this.#e=!0),this.#n(),e?(E.capability.reject(e),this._abortOperatorList({intentState:v,reason:e instanceof Error?e:Error(e)})):E.capability.resolve(),this._stats&&(this._stats.timeEnd(`Rendering`),this._stats.timeEnd(`Overall`),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats)
50)},w=null,T=null;(x||S)&&(T=new CanvasBBoxTracker(t,v.operatorList.length)),x&&(w=new CanvasDependencyTracker(T,b));let E=new InternalRenderTask({callback:C,params:{canvas:t,canvasContext:e,dependencyTracker:w??T,imagesTracker:S?new CanvasImagesTracker(t):null,viewport:n,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:l,enableHWA:this._transport.enableHWA,operationsFilter:m});(v.renderTasks||=new Set).add(E);let D=E.task;return Promise.all([v.displayReadyCapability.promise,s]).then(([e,t])=>{if(this.destroyed){C();return}if(this._stats?.time(`Rendering`),!(t.renderingIntent&g))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");E.initializeGraphics({transparency:e,optionalContentConfig:t}),E.operatorListChanged()}).catch(C),D}getOperatorList({intent:e=`display`,annotationMode:t=AnnotationMode.ENABLE,printAnnotationStorage:n=null,isEditing:r=!1}={}){function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(s))}let a=this._transport.getRenderingIntent(e,t,n,r,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,makeObj),s;return o.opListReadCapability||(s=Object.create(null),s.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(s),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream(`GetTextContent`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(e){return e.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(e=>XfaText.textContent(e));let t=this.streamTextContent(e),n={items:[],styles:Object.create(null),lang:null};for await(let e of t)n.lang??=e.lang,Object.assign(n.styles,e.styles),n.items.push(...e.items);return n}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:Error(`Page was destroyed.`),force:!0}),!t.opListReadCapability)for(let n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;let t=this.#n();return e&&t&&(this._stats&&=new StatTimer),t}#n(){if(!this.#e||this.destroyed)return!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,t){let n=this._intentStates.get(t);n&&(this._stats?.timeEnd(`Page Request`),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(let e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#n()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:r}){let{map:i,transfer:a}=n,o=this._transport.messageHandler.sendWithStream(`GetOperatorList`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:r},void 0,a).getReader(),s=this._intentStates.get(t);s.streamReader=o;let c=()=>{o.read().then(({value:e,done:t})=>{if(t){s.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(e,s),c())},e=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(let e of s.renderTasks)e.operatorListChanged();this.#n()}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else if(s.opListReadCapability)s.opListReadCapability.reject(e);else throw e}})};c()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&=(clearTimeout(e.streamReaderCancelTimeout),null),!n){if(e.renderTasks.size>0)return;if(t instanceof RenderingCancelledException){let n=RENDERING_CANCELLED_TIMEOUT;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new AbortException(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}},PDFWorker=class e{#e=Promise.withResolvers();#t=null;#n=null;#r=null;static#i=0;static#a=!1;static#o=new WeakMap;static{isNodeJS&&(this.#a=!0,GlobalWorkerOptions.workerSrc||=`./pdf.worker.mjs`),this._isSameOrigin=(e,t)=>{let n=URL.parse(e);if(!n?.origin||n.origin===`null`)return!1;let r=new URL(t,n);return n.origin===r.origin},this._createCDNWrapper=e=>{let t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:`text/javascript`}))}}constructor({name:t=null,port:n=null,verbosity:r=getVerbosityLevel()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=r,n){if(e.#o.has(n))throw Error(`Cannot use more than one PDFWorker per port.`);e.#o.set(n,this),this.#c(n)}else this.#l()}get promise(){return this.#e.promise}#s(){this.#e.resolve(),this.#t.send(`configure`,{verbosity:this.verbosity})}get port(){return this.#n}get messageHandler(){return this.#t}#c(e){this.#n=e,this.#t=new MessageHandler(`main`,`worker`,e),this.#t.on(`ready`,()=>{}),this.#s()}#l(){if(e.#a||e.#d){this.#u();return}let{workerSrc:t}=e;
50try{e._isSameOrigin(window.location,t)||(t=e._createCDNWrapper(new URL(t,window.location).href));let n=new Worker(t,{type:`module`}),r=new MessageHandler(`main`,`worker`,n),i=()=>{a.abort(),r.destroy(),n.terminate(),this.destroyed?this.#e.reject(Error(`Worker was destroyed`)):this.#u()},a=new AbortController;n.addEventListener(`error`,()=>{this.#r||i()},{signal:a.signal}),r.on(`test`,e=>{if(a.abort(),this.destroyed||!e){i();return}this.#t=r,this.#n=n,this.#r=n,this.#s()}),r.on(`ready`,e=>{if(a.abort(),this.destroyed){i();return}try{o()}catch{this.#u()}});let o=()=>{let e=new Uint8Array;r.send(`test`,e,[e.buffer])};o();return}catch{info(`The worker has been disabled.`)}this.#u()}#u(){e.#a||=(warn(`Setting up fake worker.`),!0),e._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#e.reject(Error(`Worker was destroyed`));return}let n=new LoopbackPort;this.#n=n;let r=`fake${e.#i++}`,i=new MessageHandler(r+`_worker`,r,n);t.setup(i,n),this.#t=new MessageHandler(r,r+`_worker`,n),this.#s()}).catch(e=>{this.#e.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this.#r?.terminate(),this.#r=null,e.#o.delete(this.#n),this.#n=null,this.#t?.destroy(),this.#t=null}static create(t){let n=this.#o.get(t?.port);
50if(n){if(n._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new e(t)}static get workerSrc(){if(GlobalWorkerOptions.workerSrc)return GlobalWorkerOptions.workerSrc;throw Error(`No "GlobalWorkerOptions.workerSrc" specified.`)}static get#d(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return shadow(this,`_setupFakeWorkerGlobal`,(async()=>this.#d?this.#d:(await __vitePreload(()=>import(this.workerSrc),[])).WorkerMessageHandler)())}},WorkerTransport=class{downloadInfoCapability=Promise.withResolvers();#e=null;#t=new Map;#n=null;#r=new Map;#i=new Map;#a=new Map;#o=null;constructor(e,t,n,r,i,a){this.messageHandler=e,this.loadingTask=t,this.#n=n,this.commonObjs=new PDFObjects,this.fontLoader=new FontLoader({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.enableHWA=r.enableHWA,this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.binaryDataFactory=i.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){let{_pageIndex:t}=e;this.#r.set(t,e),this.#i.set(t,Promise.resolve(e))}#s(e,t=null){return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))}#c({loaded:e,total:t}){this.loadingTask.onProgress?.({loaded:e,total:t,percent:t?MathClamp(Math.round(e/t*100),0,100):NaN})}get annotationStorage(){return shadow(this,`annotationStorage`,new AnnotationStorage)}getRenderingIntent(e,t=AnnotationMode.ENABLE,n=null,r=!1,i=!1){let a=RenderingIntentFlag.DISPLAY,o=SerializableEmpty;switch(e){case`any`:a=RenderingIntentFlag.ANY;break;case`display`:break;case`print`:a=RenderingIntentFlag.PRINT;break;default:warn(`getRenderingIntent - invalid intent: ${e}`)}let s=a&RenderingIntentFlag.PRINT&&n instanceof PrintAnnotationStorage?n:this.annotationStorage;switch(t){case AnnotationMode.DISABLE:a+=RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case AnnotationMode.ENABLE:break;case AnnotationMode.ENABLE_FORMS:a+=RenderingIntentFlag.ANNOTATIONS_FORMS;break;case AnnotationMode.ENABLE_STORAGE:a+=RenderingIntentFlag.ANNOTATIONS_STORAGE,o=s.serializable;break;default:warn(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(a+=RenderingIntentFlag.IS_EDITING),i&&(a+=RenderingIntentFlag.OPLIST);let{ids:c,hash:l}=s.modifiedIds,u=[a,o.hash,l];return{renderingIntent:a,cacheKey:u.join(`_`),annotationStorageSerializable:o,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#o?.reject(Error(`Worker was destroyed during onPassword callback`));let e=[];for(let t of this.#r.values())e.push(t._destroy());this.#r.clear(),this.#i.clear(),this.#a.clear(),Object.hasOwn(this,`annotationStorage`)&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise(`Terminate`,null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),TextLayer.cleanup(),this.#n?.cancelAllRequests(new AbortException(`Worker was terminated.`)),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on(`GetReader`,(e,t)=>{assert(this.#n,"GetReader - no `BasePDFStream` instance available."),this.#e=this.#n.getFullReader(),this.#e.onProgress=e=>this.#c(e),t.onPull=()=>{this.#e.read().then(function({value:e,done:n}){if(n){t.close();return}assert(e instanceof ArrayBuffer,`GetReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{this.#e.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`ReaderHeadersReady`,async e=>{await this.#e.headersReady;let{isStreamingSupported:t,isRangeSupported:n,contentLength:r}=this.#e;return t&&n&&(this.#e.onProgress=null),{isStreamingSupported:t,isRangeSupported:n,contentLength:r}}),e.on(`GetRangeReader`,(e,t)=>{assert(this.#n,"GetRangeReader - no `BasePDFStream` instance available.");let n=this.#n.getRangeReader(e.begin,e.end);if(!n){t.close();return}t.onPull=()=>{n.read().then(function({value:e,done:n}){if(n){t.close();return}assert(e instanceof ArrayBuffer,`GetRangeReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{n.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`GetDoc`,({pdfInfo:e})=>{this.pagesMapper.pagesNumber=e.numPages,this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))}),e.on(`DocException`,e=>{t._capability.reject(wrapReason(e))}),e.on(`PasswordRequest`,e=>{this.#o=Promise.withResolvers();try{if(!t.onPassword)throw wrapReason(e);t.onPassword(e=>{e instanceof Error?this.#o.reject(e):this.#o.resolve({password:e})},e.code)}catch(e){this.#o.reject(e)}return this.#o.promise}),e.on(`DataLoaded`,e=>{this.#c({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on(`StartRenderPage`,e=>{this.destroyed||this.#r.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}),e.on(`commonobj`,([t,n,r])=>
50{if(this.destroyed||this.commonObjs.has(t))return null;switch(n){case`Font`:if(`error`in r){let e=r.error;warn(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let i=new FontFaceObject(new FontInfo(r),this._params.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,r.charProcOperatorList,r.extra);this.fontLoader.bind(i).catch(()=>e.sendWithPromise(`FontFallback`,{id:t})).finally(()=>{i.fontExtraProperties||i.clearData(),this.commonObjs.resolve(t,i)});break;case`CopyLocalImage`:let{imageRef:a}=r;assert(a,`The imageRef must be defined.`);for(let e of this.#r.values())for(let[,n]of e.objs){if(n?.ref!==a)continue;if(!n.dataLen)return null;let e=structuredClone(n);return this.commonObjs.resolve(t,e),n.dataLen}break;case`FontPath`:this.commonObjs.resolve(t,new FontPathInfo(r));break;case`Image`:this.commonObjs.resolve(t,r);break;case`Pattern`:let o=new PatternInfo(r);this.commonObjs.resolve(t,o.getIR());break;default:throw Error(`Got unknown common object type ${n}`)}return null}),e.on(`obj`,([e,t,n,r])=>{if(this.destroyed)return;let i=this.#r.get(t);if(!i.objs.has(e)){if(i._intentStates.size===0){r?.bitmap?.close();return}switch(n){case`Image`:case`Pattern`:i.objs.resolve(e,r);break;default:throw Error(`Got unknown object type ${n}`)}}}),e.on(`DocProgress`,e=>{this.destroyed||this.#c(e)}),e.on(`FetchBinaryData`,async e=>{if(this.destroyed)throw Error(`Worker was destroyed.`);if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(e)})}getData(){return this.messageHandler.sendWithPromise(`GetData`,null)}saveDocument(){this.annotationStorage.size<=0&&warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise(`SaveDocument`,{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this.#e?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e,t=null){let n={pageInfos:e},r,i=globalThis.ImageBitmap;if(typeof i==`function`){let t=Array.isArray(e)?e:[e];for(let e of t)e?.image instanceof i&&(r||=[]).push(e.image)}if(this.annotationStorage.size>0){let e=this.annotationStorage.serializable,{map:i}=e;e.transfer?.length&&(r?r.push(...e.transfer):r=e.transfer);let a=this.pagesMapper.getMapping();if(a){let e=new Map;for(let[n,r]of i){if(r?.pageIndex!==void 0&&r.pageIndex>=0&&r.pageIndex<a.length){let i=t?.[r.pageIndex]??0,o=a[r.pageIndex]-1;if(o!==r.pageIndex||i!==0){e.set(n,{...r,pageIndex:o,copyLevel:i});continue}}e.set(n,r)}i=e}n.annotationStorage=i}return this.messageHandler.sendWithPromise(`ExtractPages`,n,r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(Error(`Invalid page request.`));let t=e-1,n=this.pagesMapper.getPageId(e)-1,r=this.#i.get(t);if(r)return r;let i=this.messageHandler.sendWithPromise(`GetPage`,{pageIndex:n}).then(e=>{if(this.destroyed)throw Error(`Transport destroyed`);e.refStr&&this.#a.set(e.refStr,n);let r=new PDFPageProxy(t,e,this,this.pagesMapper,this._params.pdfBug);return this.#r.set(t,r),r});return this.#i.set(t,i),i}async getPageIndex(e){if(!isRefProxy(e))throw Error(`Invalid pageIndex request.`);let t=await this.messageHandler.sendWithPromise(`GetPageIndex`,{num:e.num,gen:e.gen}),n=this.pagesMapper.getPageNumber(t+1);if(n===0)throw Error(`GetPageIndex: page has been removed.`);return n-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise(`GetAnnotations`,{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return this.#s(`GetFieldObjects`)}getSignatures(){return this.#s(`GetSignatures`)}getSignatureData(e){return this.messageHandler.sendWithPromise(`GetSignatureData`,e)}hasJSActions(){return this.#s(`HasJSActions`)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise(`GetCalculationOrderIds`,null)}
50getDestinations(){return this.messageHandler.sendWithPromise(`GetDestinations`,null)}getDestination(e){return typeof e==`string`?this.messageHandler.sendWithPromise(`GetDestination`,{id:e}):Promise.reject(Error(`Invalid destination request.`))}getPageLabels(){return this.messageHandler.sendWithPromise(`GetPageLabels`,null)}getPageLayout(){return this.messageHandler.sendWithPromise(`GetPageLayout`,null)}getPageMode(){return this.messageHandler.sendWithPromise(`GetPageMode`,null)}getViewerPreferences(){return this.messageHandler.sendWithPromise(`GetViewerPreferences`,null)}getOpenAction(){return this.messageHandler.sendWithPromise(`GetOpenAction`,null)}getAttachments(){return this.messageHandler.sendWithPromise(`GetAttachments`,null)}getAttachmentContent(e){return this.messageHandler.sendWithPromise(`GetAttachmentContent`,e)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise(`GetAnnotationsByType`,{types:e,pageIndexesToSkip:t})}getDocJSActions(){return this.#s(`GetDocJSActions`)}getPageJSActions(e){return this.messageHandler.sendWithPromise(`GetPageJSActions`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise(`GetStructTree`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise(`GetOutline`,null)}getOptionalContentConfig(e){return this.#s(`GetOptionalContentConfig`).then(t=>new OptionalContentConfig(t,e))}getPermissions(){return this.messageHandler.sendWithPromise(`GetPermissions`,null)}getMetadata(){let e=`GetMetadata`;return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new Metadata(e[1]):null,contentDispositionFilename:this.#e?.filename??null,contentLength:this.#e?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise(`GetMarkInfo`,null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise(`Cleanup`,null);for(let e of this.#r.values())if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0),TextLayer.cleanup()}}cachedPageNumber(e){if(!isRefProxy(e))return null;let t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,n=this.#a.get(t);if(n>=0){let e=this.pagesMapper.getPageNumber(n+1);if(e!==0)return e}return null}},RenderTask=class{_internalRenderTask=null;onContinue=null;onError=null;constructor(e){this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this._internalRenderTask;return e.form||e.canvas&&t?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},InternalRenderTask=class e{#e=null;static#t=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:a,pageIndex:o,canvasFactory:s,filterFactory:c,useRequestAnimationFrame:l=!1,pdfBug:u=!1,pageColors:d=null,enableHWA:f=!1,operationsFilter:p=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=c,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=l===!0&&typeof window<`u`,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=f,this._dependencyTracker=t.dependencyTracker,this._imagesTracker=t.imagesTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:n}){if(this.cancelled)return;
vendor: 4,525 bytes, line 50
50if(this._canvas){if(e.#t.has(this._canvas))throw Error(`Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.`);e.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:r,transform:i,background:a,dependencyTracker:o,imagesTracker:s}=this.params,c=this._canvasContext||this._canvas.getContext(`2d`,{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new CanvasGraphics(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,o,s),this.gfx.beginDrawing({transform:i,viewport:r,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,n=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&=(window.cancelAnimationFrame(this.#e),null),e.#t.delete(this._canvas),t||=new RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,n),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),e.#t.delete(this._canvas),this.callback())))}},version=`6.3.289`,build=`1c8020a7d`,ColorPicker=class e{#e=null;#t=null;#n;#r=null;#i=!1;#a=!1;#o=null;#s;#c=null;#l=null;static#u=null;static get _keyboardManager(){return shadow(this,`_keyboardManager`,new KeyboardManager([[[`Escape`],e.prototype._hideDropdownFromKeyboard],[[`Space`],e.prototype._colorSelectFromKeyboard],[[`ArrowDown`,`ArrowRight`],e.prototype._moveToNext],[[`ArrowUp`,`ArrowLeft`],e.prototype._moveToPrevious],[[`Home`],e.prototype._moveToBeginning],[[`End`],e.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:n=null}){t?(this.#a=!1,this.#o=t):this.#a=!0,this.#l=t?._uiManager||n,this.#s=this.#l._eventBus,this.#n=t?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||`#FFFF98`,e.#u||=Object.freeze({blue:`pdfjs-editor-colorpicker-blue`,green:`pdfjs-editor-colorpicker-green`,pink:`pdfjs-editor-colorpicker-pink`,red:`pdfjs-editor-colorpicker-red`,yellow:`pdfjs-editor-colorpicker-yellow`})}renderButton(){let e=this.#e=document.createElement(`button`);e.className=`colorPicker`,e.tabIndex=`0`,e.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-button`),e.ariaHasPopup=`true`,this.#o&&(e.ariaControls=`${this.#o.id}_colorpicker_dropdown`);let t=this.#l._signal;e.addEventListener(`click`,this.#m.bind(this),{signal:t}),e.addEventListener(`keydown`,this.#p.bind(this),{signal:t});let n=this.#t=document.createElement(`span`);return n.className=`swatch`,n.ariaHidden=`true`,n.style.backgroundColor=this.#n,e.append(n),e}renderMainDropdown(){let e=this.#r=this.#d();return e.ariaOrientation=`horizontal`,e.ariaLabelledBy=`highlightColorPickerLabel`,e}#d(){let t=document.createElement(`div`),n=this.#l._signal;t.addEventListener(`contextmenu`,noContextMenu,{signal:n}),t.className=`dropdown`,t.role=`listbox`,t.ariaMultiSelectable=`false`,t.ariaOrientation=`vertical`,t.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-dropdown`),this.#o&&(t.id=`${this.#o.id}_colorpicker_dropdown`);for(let[r,i]of this.#l.highlightColors){let a=document.createElement(`button`);a.tabIndex=`0`,a.role=`option`,a.setAttribute(`data-color`,i),a.title=r,a.setAttribute(`data-l10n-id`,e.#u[r]);let o=document.createElement(`span`);a.append(o),o.className=`swatch`,o.style.backgroundColor=i,a.ariaSelected=i===this.#n,a.addEventListener(`click`,this.#f.bind(this,i),{signal:n}),t.append(a)}
50return t.addEventListener(`keydown`,this.#p.bind(this),{signal:n}),t}#f(e,t){t.stopPropagation(),this.#s.dispatch(`switchannotationeditorparams`,{source:this,type:AnnotationEditorParamsType.HIGHLIGHT_COLOR,value:e}),this.update(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#m(e);return}let t=e.target.getAttribute(`data-color`);t&&this.#f(t,e)}_moveToNext(e){if(!this.#g){this.#m(e);return}if(e.target===this.#e){this.#r.firstElementChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#r?.firstElementChild||e.target===this.#e){this.#g&&this._hideDropdownFromKeyboard();return}this.#g||this.#m(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#g){this.#m(e);return}this.#r.firstElementChild?.focus()}_moveToEnd(e){if(!this.#g){this.#m(e);return}this.#r.lastElementChild?.focus()}#p(t){e._keyboardManager.exec(this,t)}#m(e){if(this.#g){this.hideDropdown();return}if(this.#i=e.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener(`pointerdown`,this.#h.bind(this),{signal:this.#l.combinedSignal(this.#c)})),this.#e.ariaExpanded=`true`,this.#r){this.#r.classList.remove(`hidden`);return}let t=this.#r=this.#d();this.#e.append(t)}#h(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add(`hidden`),this.#e.ariaExpanded=`false`,this.#c?.abort(),this.#c=null}get#g(){return this.#r&&!this.#r.classList.contains(`hidden`)}_hideDropdownFromKeyboard(){if(!this.#a){if(!this.#g){this.#o?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#i})}}update(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;let t=this.#l.highlightColors.values();for(let n of this.#r.children)n.ariaSelected=t.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}},BasicColorPicker=class e{#e=null;#t=!1;#n=null;#r=null;static#i=null;constructor(t){this.#n=t,this.#r=t._uiManager,e.#i||=Object.freeze({freetext:`pdfjs-editor-color-picker-free-text-input`,ink:`pdfjs-editor-color-picker-ink-input`})}renderButton(){if(this.#e)return this.#e;let{editorType:t,colorType:n,colorAndOpacityType:r,opacityType:i,color:a,opacity:o}=this.#n,s=this.#t=FeatureTest.isAlphaColorInputSupported&&i!==void 0,c=this.#e=document.createElement(`input`);if(c.type=`color`,s){c.setAttribute(`alpha`,``);let e=Util.hexNums[Math.round((o??1)*255)];c.value=(a||`#000000`)+e}else c.value=a||`#000000`;return c.className=`basicColorPicker`,c.tabIndex=0,c.setAttribute(`data-l10n-id`,e.#i[t]),c.addEventListener(`input`,()=>{if(s){let e=getRGBA(c.value);if(!e)return;let[t,a,o,s]=e,l=Util.makeHexColor(t,a,o);r===void 0?(this.#r.updateParams(n,l),this.#r.updateParams(i,s)):this.#r.updateParams(r,{color:l,opacity:s})}else this.#r.updateParams(n,c.value)},{signal:this.#r._signal}),c}update(e){if(this.#e)if(this.#t){let t=Util.hexNums[Math.round(this.#n.opacity*255)];this.#e.value=e+t}else this.#e.value=e}updateOpacity(e){if(!this.#e||!this.#t)return;let t=Util.hexNums[Math.round(e*255)];this.#e.value=this.#n.color+t}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}};function makeColorComp(e){return Math.floor(MathClamp(e,0,1)*255).toString(16).padStart(2,`0`)}function scaleAndClamp(e){return MathClamp(e,0,1)*255}var ColorConverters=class{static CMYK_G([e,t,n,r]){return[`G`,1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return[`CMYK`,0,0,0,1-e]}static G_RGB([e]){return[`RGB`,e,e,e]}static G_rgb([e]){return e=scaleAndClamp(e),[e,e,e]}static G_HTML([e]){let t=makeColorComp(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return[`G`,.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(scaleAndClamp)}static RGB_HTML(e){return`#${e.map(makeColorComp).join(``)}`}static T_HTML(){return`#00000000`}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return[`RGB`,1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,r]){return[scaleAndClamp(1-Math.min(1,e+r)),scaleAndClamp(1-Math.min(1,n+r)),scaleAndClamp(1-Math.min(1,t+r))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){let r=1-e,i=1-t,a=1-n;return[`CMYK`,r,i,a,Math.min(r,i,a)]}},BaseSVGFactory=class{create(e,t,n=!1){if(e<=0||t<=0)throw Error(`Invalid SVG dimensions`);let r=this._createSVG(`svg:svg`);return r.setAttribute(`version`,`1.1`),n||(r.setAttribute(`width`,`${e}px`),r.setAttribute(`height`,`${t}px`)),r.setAttribute(`preserveAspectRatio`,`none`),r.setAttribute(`viewBox`,`0 0 ${e} ${t}`),r}createElement(e){if(typeof e!=`string`)throw Error(`Invalid SVG element type`);return this._createSVG(e)}_createSVG(e){unreachable("Abstract method `_createSVG` called.")}},DOMSVGFactory=class extends BaseSVGFactory{_createSVG(e){return document.createElementNS(SVG_NS,e)}},annotation_layer_DEFAULT_FONT_SIZE=9,GetElementsByNameSet=new WeakSet,TIMEZONE_OFFSET=new Date().getTimezoneOffset()*60*1e3,AnnotationElementFactory=class{static create(e){switch(e.data.annotationType){case AnnotationType.LINK:return new LinkAnnotationElement(e);case AnnotationType.TEXT:return new TextAnnotationElement(e);case AnnotationType.WIDGET:switch(e.data.fieldType){case`Tx`:return new TextWidgetAnnotationElement(e);case`Btn`:return e.data.radioButton?new RadioButtonWidgetAnnotationElement(e):e.data.checkBox?new CheckboxWidgetAnnotationElement(e):new PushButtonWidgetAnnotationElement(e);case`Ch`:return new ChoiceWidgetAnnotationElement(e);case`Sig`:return new SignatureWidgetAnnotationElement(e)}return new WidgetAnnotationElement(e);case AnnotationType.POPUP:return new PopupAnnotationElement(e);case AnnotationType.FREETEXT:return new FreeTextAnnotationElement(e);case AnnotationType.LINE:return new LineAnnotationElement(e);case AnnotationType.SQUARE:return new SquareAnnotationElement(e);case AnnotationType.CIRCLE:return new CircleAnnotationElement(e);case AnnotationType.POLYLINE:return new PolylineAnnotationElement(e);case AnnotationType.CARET:return new CaretAnnotationElement(e);case AnnotationType.INK:return new InkAnnotationElement(e);case AnnotationType.POLYGON:return new PolygonAnnotationElement(e);case AnnotationType.HIGHLIGHT:return new HighlightAnnotationElement(e);case AnnotationType.UNDERLINE:return new UnderlineAnnotationElement(e);case AnnotationType.SQUIGGLY:return new SquigglyAnnotationElement(e);case AnnotationType.STRIKEOUT:return new StrikeOutAnnotationElement(e);case AnnotationType.STAMP:return new StampAnnotationElement(e);case AnnotationType.FILEATTACHMENT:return new FileAttachmentAnnotationElement(e);case AnnotationType.RICHMEDIA:case AnnotationType.SCREEN:case AnnotationType.SOUND:return new MediaAnnotationElement(e);default:return new AnnotationElement(e)}}},AnnotationElement=class e{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,t&&(this.contentElement=this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e?.str||t?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return e._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:e}=this,t=this.annotationStorage?.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
50get commentButtonPosition(){let e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;let{quadPoints:t,inkLists:n,rect:r}=this.data,i=-1/0,a=-1/0;if(t?.length>=8){for(let e=0;e<t.length;e+=8)t[e+1]>a?(a=t[e+1],i=t[e+2]):t[e+1]===a&&(i=Math.max(i,t[e+2]));return[i,a]}if(n?.length>=1){for(let e of n)for(let t=0,n=e.length;t<n;t+=2)e[t+1]>a?(a=e[t+1],i=e[t]):e[t+1]===a&&(i=Math.max(i,e[t]));if(i!==1/0)return[i,a]}return r?[r[2],r[3]]:null}_normalizePoint(e){let{page:{view:t},viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-i)/n,e[1]=100*(e[1]-a)/r,e}get commentText(){let{data:e}=this;return this.annotationStorage.getRawValue(`${AnnotationEditorPrefix}${e.id}`)?.popup?.contents||e.contentsObj?.str||``}set commentText(e){let{data:t}=this,n={deleted:!e,contents:e||``};this.annotationStorage.updateEditor(t.id,{popup:n})||this.annotationStorage.setValue(`${AnnotationEditorPrefix}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:n,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});let{rect:t,popup:n}=e;t&&this.#r(t);let r=this.#n?.popup||this.popup;!r&&n?.text&&(this._createPopup(n),r=this.#n.popup),r&&(r.updateEdited(e),n?.deleted&&(r.remove(),this.#n=null,this.popup=null))}resetEdited(){this.#e&&=(this.#r(this.#e.rect),this.#n?.popup.resetEdited(),null)}#r(e){let{container:{style:t},data:{rect:n,rotation:r},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:a,pageX:o,pageY:s}}}}=this;n?.splice(0,4,...e),t.left=`${100*(e[0]-o)/i}%`,t.top=`${100*(a-e[3]+s)/a}%`,r===0?(t.width=`${100*(e[2]-e[0])/i}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(r)}_createContainer(e){let{data:t,parent:{page:n,viewport:r}}=this,i=document.createElement(`section`);i.setAttribute(`data-annotation-id`,t.id),!(this instanceof WidgetAnnotationElement)&&!(this instanceof LinkAnnotationElement)&&!(this instanceof MediaAnnotationElement)&&(i.tabIndex=0);let{style:a}=i;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add(`norotate`),!t.rect||this instanceof PopupAnnotationElement){let{rotation:e}=t;return!t.hasOwnCanvas&&e!==0&&this.setRotation(e,i),i}let{width:o,height:s}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;let e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;switch((e>0||n>0)&&(a.borderRadius=`calc(${e}px * var(--total-scale-factor)) / calc(${n}px * var(--total-scale-factor))`),t.borderStyle.style){case AnnotationBorderStyleType.SOLID:a.borderStyle=`solid`;break;case AnnotationBorderStyleType.DASHED:a.borderStyle=`dashed`;break;case AnnotationBorderStyleType.BEVELED:warn(`Unimplemented border style: beveled`);break;case AnnotationBorderStyleType.INSET:warn(`Unimplemented border style: inset`);break;case AnnotationBorderStyleType.UNDERLINE:a.borderBottomStyle=`solid`;break;default:break}let r=t.borderColor||null;r?(this.#t=!0,a.borderColor=Util.makeHexColor(...r)):a.borderWidth=0}let c=Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:l,pageHeight:u,pageX:d,pageY:f}=r.rawDims;a.left=`${100*(c[0]-d)/l}%`,a.top=`${100*(c[1]-f)/u}%`;let{rotation:p}=t;return t.hasOwnCanvas||p===0?(a.width=`${100*o/l}%`,a.height=`${100*s/u}%`):this.setRotation(p,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:i,height:a}=this;e%180!=0&&([i,a]=[a,i]),t.style.width=`${100*i/n}%`,t.style.height=`${100*a/r}%`,t.setAttribute(`data-main-rotation`,(360-e)%360)}get _commonActions(){let e=(e,t,n)=>{let r=n.detail[e],i=r[0],a=r.slice(1);n.target.style[t]=ColorConverters[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:ColorConverters[`${i}_rgb`](a)})};return shadow(this,`_commonActions`,{display:e=>{let{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:t===1||t===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:t}=e.detail;this.container.style.visibility=t?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>
50e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e(`bgColor`,`backgroundColor`,t)},fillColor:t=>{e(`fillColor`,`backgroundColor`,t)},fgColor:t=>{e(`fgColor`,`color`,t)},textColor:t=>{e(`textColor`,`color`,t)},borderColor:t=>{e(`borderColor`,`borderColor`,t)},strokeColor:t=>{e(`strokeColor`,`borderColor`,t)},rotation:e=>{let t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){let n=this._commonActions;for(let r of Object.keys(t.detail))(e[r]||n[r])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let n=this._commonActions;for(let[r,i]of Object.entries(t)){let a=n[r];a&&(a({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[t,n,r,i]=this.data.rect.map(Math.fround);if(e.length===8){let[a,o,s,c]=e.subarray(2,6);if(r===a&&i===o&&t===s&&n===c)return}let{style:a}=this.container,o;if(this.#t){let{borderColor:e,borderWidth:t}=a;a.borderWidth=0,o=[`url('data:image/svg+xml;utf8,`,`<svg xmlns="${SVG_NS}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add(`hasBorder`)}let s=r-t,c=i-n,{svgFactory:l}=this,u=l.createElement(`svg`);u.classList.add(`quadrilateralsContainer`),u.setAttribute(`width`,0),u.setAttribute(`height`,0),u.role=`none`;let d=l.createElement(`defs`);u.append(d);let f=l.createElement(`clipPath`),p=`clippath_${this.data.id}`;f.setAttribute(`id`,p),f.setAttribute(`clipPathUnits`,`objectBoundingBox`),d.append(f);for(let n=2,r=e.length;n<r;n+=8){let r=e[n],a=e[n+1],u=e[n+2],d=e[n+3],p=l.createElement(`rect`),m=(u-t)/s,h=(i-a)/c,g=(r-u)/s,_=(a-d)/c;p.setAttribute(`x`,m),p.setAttribute(`y`,h),p.setAttribute(`width`,g),p.setAttribute(`height`,_),f.append(p),o?.push(`<rect vector-effect="non-scaling-stroke" x="${m}" y="${h}" width="${g}" height="${_}"/>`)}this.#t&&(o.push(`</g></svg>')`),a.backgroundImage=o.join(``)),this.container.append(u),this.container.style.clipPath=`url(#${p})`}_createPopup(e=null){let{data:t}=this,n,r;e?(n={str:e.text},r=e.date):(n=t.contentsObj,r=t.modificationDate),this.#n=new PopupAnnotationElement({data:{color:t.color,titleObj:t.titleObj,modificationDate:r,contentsObj:n,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){unreachable("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){let n=[];if(this._fieldObjects){let r=this._fieldObjects.get(e)||[];for(let{page:e,id:i,exportValues:a}of r){if(e===-1||i===t)continue;let r=typeof a==`string`?a:null,o=document.querySelector(`[data-element-id="${i}"]`);if(o&&!GetElementsByNameSet.has(o)){warn(`_getElementsByName - element not allowed: ${i}`);continue}n.push({id:i,exportValue:r,domElement:o})}return n}for(let r of document.getElementsByName(e)){let{exportValue:e}=r,i=r.getAttribute(`data-element-id`);i!==t&&GetElementsByNameSet.has(r)&&n.push({id:i,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add(`highlightArea`);else e.classList.add(`highlightArea`)}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener(`dblclick`,()=>{this.linkService.eventBus?.dispatch(`switchannotationeditormode`,{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}updateOC(e){!this.data.oc||!e||(e.isVisible(this.data.oc)?this.show():this.hide())}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}
50_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?`transparent`:Util.makeHexColor(...t)}},EditorAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className=`editorAnnotation`,this.container}createOrUpdatePopup(){let{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},LinkAnnotationElement=class extends AnnotationElement{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,n=document.createElement(`a`);n.setAttribute(`data-element-id`,e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action,e.overlaidText),r=!0):e.attachment?(this.#t(n,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),r=!0):e.setOCGState?(this.#n(n,e.setOCGState,e.overlaidText),r=!0):e.dest?(this._bindLink(n,e.dest,e.overlaidText),r=!0):(e.actions&&(e.actions.has(`Action`)||e.actions.has(`Mouse Up`)||e.actions.has(`Mouse Down`))&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,``),r=!0)),this.container.classList.add(`linkAnnotation`),r&&(this.contentElement=n,this.container.append(n)),this.container}#e(){this.container.setAttribute(`data-internal-link`,``)}_bindLink(e,t,n=``){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t===``)&&this.#e(),n&&(e.title=n)}_bindNamedAction(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),n&&(e.title=n),this.#e()}#t(e,t,n,r=``,i=null){e.href=this.linkService.getAnchorUrl(``),n.description?e.title=n.description:r&&(e.title=r);let a=async()=>{let e=await this.linkService.getAttachmentContent(t);e&&this.downloadManager?.openOrDownloadData(e,n.filename,i)};e.onclick=()=>(a(),!1),this.#e()}#n(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),n&&(e.title=n),this.#e()}_bindJSAction(e,{actions:t,id:n,overlaidText:r}){e.href=this.linkService.getAnchorUrl(``);let i=new Map([[`Action`,`onclick`],[`Mouse Up`,`onmouseup`],[`Mouse Down`,`onmousedown`]]);for(let r of t.keys()){let t=i.get(r);t&&(e[t]=()=>(this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:n,name:r}}),!1))}r&&(e.title=r),e.onclick||=()=>!1,this.#e()}_bindResetFormAction(e,t){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl(``)),this.#e(),!this._fieldObjects){warn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();let{fields:e,refs:r,include:i}=t,a=[];if(e.length!==0||r.length!==0){let t=new Set(r);for(let n of e){let e=this._fieldObjects.get(n)||[];for(let{id:n}of e)t.add(n)}for(let e of this._fieldObjects.values())for(let n of e)t.has(n.id)===i&&a.push(n)}else for(let e of this._fieldObjects.values())a.push(...e);let o=this.annotationStorage,s=[];for(let e of a){let{id:t}=e;switch(s.push(t),e.type){case`text`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}case`checkbox`:case`radiobutton`:{let n=e.defaultValue===e.exportValues;o.setValue(t,{value:n});break}case`combobox`:case`listbox`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}default:continue}let n=document.querySelector(`[data-element-id="${t}"]`);if(n){if(!GetElementsByNameSet.has(n)){warn(`_bindResetFormAction - element not allowed: ${t}`);continue}n.dispatchEvent(new Event(`resetform`))}}return this.enableScripting&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:`app`,ids:s,name:`ResetForm`}}),!1}}},TextAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add(`textAnnotation`);let e=document.createElement(`img`);return e.src=this.imageResourcesPath+`annotation-`+this.data.name.toLowerCase()+`.svg`,e.setAttribute(`data-l10n-id`,`pdfjs-text-annotation-type`),e.setAttribute(`data-l10n-args`,JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}}
vendor: 1,986 bytes, line 50
50,WidgetAnnotationElement=class extends AnnotationElement{render(){return this.container}_getKeyModifier(e){return FeatureTest.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,r,i){n.includes(`mouse`)?e.addEventListener(n,e=>{this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(n,e=>{if(n===`blur`){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if(n===`focus`){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e)}})})}_setEventListeners(e,t,n,r){let{actions:i}=this.data;for(let[a,o]of n)(o===`Action`||i?.has(o))&&((o===`Focus`||o===`Blur`)&&(t||={focused:!1}),this._setEventListener(e,t,a,o,r),o===`Focus`&&!i?.has(`Blur`)?this._setEventListener(e,t,`blur`,`Blur`,null):o===`Blur`&&!i?.has(`Focus`)&&this._setEventListener(e,t,`focus`,`Focus`,null))}_setTextStyle(e){let t=[`left`,`center`,`right`],{fontColor:n}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||annotation_layer_DEFAULT_FONT_SIZE,i=e.style,a,o=2,s=e=>Math.round(10*e)/10;if(this.data.multiLine){let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(1.35*r))||1);a=Math.min(r,s(t/1.35))}else{let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(r,s(e/1.35))}i.fontSize=`calc(${a}px * var(--total-scale-factor))`,i.color=Util.makeHexColor(...n),this.data.textAlignment!==null&&!this.data.comb&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute(`required`,!0):e.removeAttribute(`required`),e.setAttribute(`aria-required`,t)}},TextWidgetAnnotationElement=class extends WidgetAnnotationElement{constructor(e){let t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,r){let i=this.annotationStorage;
50for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=n),i.setValue(a.id,{[r]:n})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add(`textWidgetAnnotation`);let n=null;if(this.renderForms){let r=e.getValue(t,{value:this.data.fieldValue}),i=r.value||``,a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let o=r.formattedValue||this.data.textContent?.join(` 51`)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,``));let s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement(`textarea`),n.textContent=o??i,this.data.doNotScroll&&(n.style.overflowY=`hidden`)):(n=document.createElement(`input`),n.type=this.data.password?`password`:`text`,n.setAttribute(`value`,o??i),this.data.doNotScroll&&(n.style.overflowX=`hidden`)),this.data.hasOwnCanvas&&(this.container.classList.add(`hasOwnCanvas`),e.has(t)&&this.container.classList.add(`sandboxModified`)),GetElementsByNameSet.add(n),this.contentElement=n,n.setAttribute(`data-element-id`,t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:c,datetimeType:l,timeStep:u}=this.data,d=!!l&&this.enableScripting;c&&(n.title=c),this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener(`input`,r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,`value`,r.target.value,`value`),s.formattedValue=null}),n.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue??``;n.value=s.userValue=t,s.formattedValue=null});let f=e=>{let{formattedValue:t}=s;t!=null&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener(`focus`,e=>{if(s.focused)return;let{target:t}=e;if(d&&(t.type=l,u&&(t.step=u)),s.userValue){let e=s.userValue;if(d)if(l===`time`){let n=new Date(e);t.value=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>e.toString().padStart(2,`0`)).join(`:`)}else t.value=new Date(e-TIMEZONE_OFFSET).toISOString().split(l===`date`?`T`:`.`,1)[0];else t.value=e}s.lastCommittedValue=t.value,s.commitKey=1,this.data.actions?.has(`Focus`)||(s.focused=!0)}),n.addEventListener(`updatefromsandbox`,n=>{this.container.classList.add(`sandboxModified`),this._dispatchEventFromSandbox({value(n){s.userValue=n.detail.value??``,d||e.setValue(t,{value:s.userValue.toString()}),n.target.value=s.userValue},formattedValue(n){let{formattedValue:r}=n.detail;s.formattedValue=r,r!=null&&n.target!==document.activeElement&&(n.target.value=r);let i={formattedValue:r};d&&(i.value=r),e.setValue(t,i)},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{let{charLimit:r}=n.detail,{target:i}=n;if(r===0){i.removeAttribute(`maxLength`);return}i.setAttribute(`maxLength`,r);let a=s.userValue;!a||a.length<=r||(a=a.slice(0,r),i.value=s.userValue=a,e.setValue(t,{value:a}),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:a,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}},n)}),n.addEventListener(`keydown`,e=>{s.commitKey=1;let n=-1;if(e.key===`Escape`?n=0:e.key===`Enter`&&!this.data.multiLine?n=2:e.key===`Tab`&&(s.commitKey=3),n===-1)return;let{value:r}=e.target;s.lastCommittedValue!==r&&(s.lastCommittedValue=r,s.userValue=r,this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))});let r=f;f=null,n.addEventListener(`blur`,e=>{if(!s.focused||!e.relatedTarget)return;this.data.actions?.has(`Blur`)||(s.focused=!1);let{target:n}=e,{value:i}=n;if(d){if(i&&l===`time`){let e=i.split(`:`).map(e=>parseInt(e,10));i=new Date(2e3,0,1,e[0],e[1],e[2]||0).valueOf(),n.step=``}else i.includes(`T`)||(i=`${i}T00:00`),i=new Date(i).valueOf();n.type=`text`}s.userValue=i,s.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,willCommit:!0,commitKey:s.
51commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)}),this.data.actions?.has(`Keystroke`)&&n.addEventListener(`beforeinput`,e=>{s.lastCommittedValue=null;let{data:n,target:r}=e,{value:i,selectionStart:a,selectionEnd:o}=r,c=a,l=o;switch(e.inputType){case`deleteWordBackward`:{let e=/\w/;for(;c>0&&!e.test(i[c-1]);)c--;for(;c>0&&e.test(i[c-1]);)c--;break}case`deleteWordForward`:{let e=i.substring(a).match(/^\W*\w*/);e&&(l+=e[0].length);break}case`deleteContentBackward`:a===o&&--c;break;case`deleteContentForward`:a===o&&(l+=1);break}e.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,change:n||``,willCommit:!1,selStart:c,selEnd:l}})}),this._setEventListeners(n,s,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.value)}if(f&&n.addEventListener(`blur`,f),this.data.comb){let e=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add(`comb`),n.style.setProperty(`--comb-width`,`calc(${e}px * var(--total-scale-factor))`);let t=this.data.textAlignment;if(t===1||t===2){let e=()=>{let e=a-n.value.length;n.style.setProperty(`--comb-offset`,`${t===1?e>>1:e}`)};e();for(let t of[`input`,`blur`,`resetform`,`updatefromsandbox`])n.addEventListener(t,e)}}}else n=document.createElement(`div`),n.textContent=this.data.fieldValue,n.style.verticalAlign=`middle`,n.style.display=`table-cell`,this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},SignatureWidgetAnnotationElement=class extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}},CheckboxWidgetAnnotationElement=class extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof r==`string`&&(r=r!==`Off`,e.setValue(n,{value:r})),this.container.classList.add(`buttonWidgetAnnotation`,`checkBox`);let i=document.createElement(`input`);return GetElementsByNameSet.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`checkbox`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.setAttribute(`exp
51ortValue`,t.exportValue),i.tabIndex=0,i.addEventListener(`change`,r=>{let{name:i,checked:a}=r.target;for(let r of this._getElementsByName(i,n)){let n=a&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:a})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue||`Off`;e.target.checked=n===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value(t){t.target.checked=t.detail.value!==`Off`,e.setValue(n,{value:t.target.checked})}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},RadioButtonWidgetAnnotationElement=class extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`buttonWidgetAnnotation`,`radioButton`);let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.buttonValue!==null&&t.fieldValue===t.buttonValue}).value;if(typeof r==`string`&&(r=r!==t.buttonValue,e.setValue(n,{value:r})),r)for(let r of this._getElementsByName(t.fieldName,n))e.setValue(r.id,{value:!1});let i=document.createElement(`input`);if(GetElementsByNameSet.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`radio`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.tabIndex=0,i.addEventListener(`change`,t=>{let{name:r,checked:i}=t.target;for(let t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue;e.target.checked=n!=null&&n===t.buttonValue}),this.enableScripting&&this.hasJSActions){let r=t.buttonValue;i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value:t=>{let i=r===t.detail.value;for(let r of this._getElementsByName(t.target.name)){let t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)}return this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},PushButtonWidgetAnnotationElement=class extends LinkAnnotationElement{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add(`buttonWidgetAnnotation`,`pushButton`);let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener(`updatefromsandbox`,e=>{this._dispatchEventFromSandbox({},e)})),e}},ChoiceWidgetAnnotationElement=class extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`choiceWidgetAnnotation`);let e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement(`select`);GetElementsByNameSet.add(r),r.setAttribute(`data-element-id`,t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue;for(let e of r.options)e.selected=e.value===t});let a=(e,t)=>{let n=t.replaceAll(` `,`\xA0`);e.textContent=n,n!==t&&e.setAttribute(`display-value`,t)};for(let e of this.data.options){let t=document.createElement(`option`);a(t,e.displayValue),t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute(`selected`,!0),i=!1),r.append(t)}let o=null;if(i){let e=document.createElement(`option`);e.value=` `,e.setAttribute(`hidden`,!0),e.setAttribute(`selected`,!0),r.prepend(e),o=()=>{e.remove(),r.removeEventListener(`input`,o),o=null},r.addEventListener(`input`,o)}let s=e=>{let t=e?`value`:`textContent`,{options:n,multiple:i}=r;return i?Array.prototype.filter.call(n,e=>e.selected).map(e=>e[t]):n.selectedIndex===-1?null:n[n.selectedIndex][t]},c=s(!1),l=e=>{let t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.getAttribute(`display-value`)||e.textContent,exportValue:e.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener(`updatefromsandbox`,n=>{this._dispatchEventFromSandbox({value(n){o?.();let i=n.detail.value,a=new Set(Array.isArray(i)?i:[i]);for(let e of r.options)e.selected=a.has(e.value);
51e.setValue(t,{value:s(!0)}),c=s(!1)},multipleSelection(e){r.multiple=!0},remove(n){let i=r.options,a=n.detail.remove;i[a].selected=!1,r.remove(a),i.length>0&&Array.prototype.findIndex.call(i,e=>e.selected)===-1&&(i[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},clear(n){for(;r.length!==0;)r.remove(0);e.setValue(t,{value:null,items:[]}),c=s(!1)},insert(n){let{index:i,displayValue:o,exportValue:u}=n.detail.insert,d=r.children[i],f=document.createElement(`option`);a(f,o),f.value=u,d?d.before(f):r.append(f),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},items(n){let{items:i}=n.detail;for(;r.length!==0;)r.remove(0);for(let e of i){let{displayValue:t,exportValue:n}=e,i=document.createElement(`option`);a(i,t),i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},indices(n){let r=new Set(n.detail.indices);for(let e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:s(!0)}),c=s(!1)},editable(e){e.target.disabled=!e.detail.editable}},n)}),r.addEventListener(`input`,n=>{let r=s(!0),i=s(!1);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:c,change:i,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`],[`input`,`Action`],[`input`,`Validate`]],e=>e.target.value)):r.addEventListener(`input`,function(n){e.setValue(t,{value:s(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}},PopupAnnotationElement=class extends AnnotationElement{constructor(e){let{data:t,elements:n,parent:r}=e,i=!!r._commentManager;if(super(e,{isRenderable:!i&&AnnotationElement._hasPopupData(t)}),this.elements=n,i&&AnnotationElement._hasPopupData(t)){let e=this.popup=this.#e();for(let t of n)t.popup=e}else this.popup=null}#e(){return new PopupElement({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){let{container:e}=this;e.classList.add(`popupAnnotation`),e.role=`comment`;let t=this.popup=this.#e(),n=[];for(let e of this.elements)e.popup=t,e.container.ariaHasPopup=`dialog`,n.push(e.data.id),e.addHighlightArea();return this.container.setAttribute(`aria-controls`,n.map(e=>`${AnnotationPrefix}${e}`).join(`,`)),this.container}},PopupElement=class{#e=null;#t=this.#P.bind(this);#n=this.#R.bind(this);#r=this.#L.bind(this);#i=this.#I.bind(this);#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=null;#f=!1;#p=null;#m=null;#h=null;#g=null;#_=null;#v=null;#y=null;#b=null;#x=null;#S=null;#C=!1;#w=null;#T=null;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:i,contentsObj:a,richText:o,parent:s,rect:c,parentRect:l,open:u,commentManager:d=null}){this.#o=e,this.#x=r,this.#s=a,this.#b=o,this.#u=s,this.#a=t,this.#y=c,this.#d=l,this.#l=n,this.#e=d,this.#w=n[0],this.#c=PDFDateString.toDateObject(i),this.trigger=n.flatMap(e=>e.getElementsToTriggerPopup()),d||(this.#E(),this.#o.hidden=!0,u&&this.#I())}#E(){if(this.#m)return;this.#m=new AbortController;let{signal:e}=this.#m;for(let t of this.trigger)t.addEventListener(`click`,this.#i,{signal:e}),t.addEventListener(`pointerenter`,this.#r,{signal:e}),t.addEventListener(`pointerleave`,this.#n,{signal:e}),t.classList.add(`popupTriggerArea`);for(let t of this.#l)t.container?.addEventListener(`keydown`,this.#t,{signal:e})}#D(){let e=this.#l.find(e=>e.hasCommentButton);e&&(this.#_=e._normalizePoint(e.commentButtonPosition))}renderCommentButton(){if(this.#g){this.#g.parentNode||this.#w.container.after(this.#g);return}if(this.#_||this.#D(),!this.#_)return;let{signal:e}=this.#m=new AbortController,t=this.#w.hasOwnCommentButton,n=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!t)},r=()=>
vendor: 1,440 bytes, line 51
51{this.#e.toggleCommentPopup(this,!1,!0,!t)},i=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(t){this.#g=this.#w.container;for(let t of this.trigger)t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),t.classList.add(`popupTriggerArea`)}else{let t=this.#g=document.createElement(`button`);t.className=`annotationCommentButton`;let a=this.#w.container;t.style.zIndex=parseInt(a.style.zIndex,10)+1,t.tabIndex=0,t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`),this.#k(),this.#O(),t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),a.after(t)}}#O(){if(this.#w.extraPopupElement&&!this.#w.editor)return;this.#g||this.renderCommentButton();let[e,t]=this.#_,{style:n}=this.#g;n.left=`calc(${e}%)`,n.top=`calc(${t}% - var(--comment-button-dim))`}#k(){this.#w.extraPopupElement||(this.#g||this.renderCommentButton(),this.#g.style.backgroundColor=this.commentButtonColor||``)}get commentButtonColor(){let{color:e,opacity:t}=this.#w.commentData;return e?this.#u._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{this.#g?.focus()},0)}
51getData(){let{richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}=this.#w.commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}}get elementBeforePopup(){return this.#g}get comment(){return this.#T||=this.#w.commentText,this.#T}set comment(e){e!==this.comment&&(this.#w.commentText=this.#T=e)}focus(){this.#w.container?.focus()}get parentBoundingClientRect(){return this.#w.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){this.#g&&(this.#g.classList.toggle(`selected`,e),this.#g.ariaExpanded=t)}setSelectedCommentButton(e){this.#g.classList.toggle(`selected`,e)}get commentPopupPosition(){if(this.#v)return this.#v;let{x:e,y:t,height:n}=this.#g.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#w.layer.getBoundingClientRect();return[(e-r)/a,(t+n-i)/o]}set commentPopupPosition(e){this.#v=e}hasDefaultPopupPosition(){return this.#v===null}get commentButtonPosition(){return this.#_}get commentButtonWidth(){return this.#g.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){let[t,n]=this.#v||this.commentButtonPosition.map(e=>e/100),r=this.parentBoundingClientRect,{x:i,y:a,width:o,height:s}=r;this.#e.showDialog(null,this,i+t*o,a+n*s,{...e,parentDimensions:r})}render(){if(this.#p)return;let e=this.#p=document.createElement(`div`);if(e.className=`popup`,this.#a){let t=e.style.outlineColor=Util.makeHexColor(...this.#a);e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`}let t=document.createElement(`span`);if(t.className=`header`,this.#x?.str){let e=document.createElement(`span`);e.className=`title`,t.append(e),{dir:e.dir,str:e.textContent}=this.#x}if(e.append(t),this.#c){let e=document.createElement(`time`);e.className=`popupDate`,e.setAttribute(`data-l10n-id`,`pdfjs-annotation-date-time-string`),e.setAttribute(`data-l10n-args`,JSON.stringify({dateObj:this.#c.valueOf()})),e.dateTime=this.#c.toISOString(),t.append(e)}renderRichText({html:this.#A||this.#s.str,dir:this.#s?.dir,className:`popupContent`},e),this.#o.append(e)}get#A(){let e=this.#b,t=this.#s;return e?.str&&(!t?.str||t.str===e.str)&&this.#b.html||null}get#j(){return this.#A?.attributes?.style?.fontSize||0}get#M(){return this.#A?.attributes?.style?.color||null}#N(e){let t=[],n={str:e,html:{name:`div`,attributes:{dir:`auto`},children:[{name:`p`,children:t}]}},r={style:{color:this.#M,fontSize:this.#j?`calc(${this.#j}px * var(--total-scale-factor))`:``}};for(let n of e.split(` 52`))t.push({name:`span`,value:n,attributes:r});return n}#P(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key===`Enter`||e.key===`Escape`&&this.#f)&&this.#I()}updateEdited({rect:e,popup:t,deleted:n}){if(this.#e){n?(this.remove(),this.#T=null):t&&(t.deleted?this.remove():(this.#k(),this.#T=t.text)),e&&(this.#_=null,this.#D(),this.#O());return}if(n||t?.deleted){this.remove();return}this.#E(),this.#S||={contentsObj:this.#s,richText:this.#b},e&&(this.#h=null),t&&t.text&&(this.#b=this.#N(t.text),this.#c=PDFDateString.toDateObject(t.date),this.#s=null),this.#p?.remove(),this.#p=null}resetEdited(){this.#S&&({contentsObj:this.#s,richText:this.#b}=this.#S,this.#S=null,this.#p?.remove(),this.#p=null,this.#h=null)}remove(){if(this.#m?.abort(),this.#m=null,this.#p?.remove(),this.#p=null,this.#C=!1,this.#f=!1,this.#g?.remove(),this.#g=null,this.trigger)for(let e of this.trigger)e.classList.remove(`popupTriggerArea`)}#F(){if(this.#h!==null)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:r,pageY:i}}}=this.#u,a=!!this.#d,o=a?this.#d:this.#y;for(let e of this.#l)if(!o||Util.intersect(e.data.rect,o)!==null){o=e.data.rect,a=!0;break}let s=Util.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=a?o[2]-o[0]+5:0,l=s[0]+c,u=s[1];this.#h=[100*(l-r)/t,100*(u-i)/n];let{style:d}=this.#o;d.left=`${this.#h[0]}%`,d.top=`${this.#h[1]}%`}#I(){if(this.#e){this.#e.toggleCommentPopup(this,!1);return}this.#f=!this.#f,this.#f?(this.#L(),this.#o.addEventListener(`click`,this.#i),this.#o.addEventListener(`keydown`,this.#t)):(this.#R(),this.#o.removeEventListener(`click`,this.#i),this.#o.removeEventListener(`ke
52ydown`,this.#t))}#L(){this.#p||this.render(),this.isVisible?this.#f&&this.#o.classList.add(`focused`):(this.#F(),this.#o.hidden=!1,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)+1e3)}#R(){this.#o.classList.remove(`focused`),!(this.#f||!this.isVisible)&&(this.#o.hidden=!0,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)-1e3)}forceHide(){this.#C=this.isVisible,this.#C&&(this.#o.hidden=!0)}maybeShow(){this.#e||(this.#E(),this.#C&&(this.#p||this.#L(),this.#C=!1,this.#o.hidden=!1))}get isVisible(){return!this.#e&&this.#o.hidden===!1}},FreeTextAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add(`freeTextAnnotation`),this.textContent){let e=this.contentElement=document.createElement(`div`);e.classList.add(`annotationTextContent`),e.setAttribute(`role`,`comment`);for(let t of this.textContent){let n=document.createElement(`span`);n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},LineAnnotationElement=class extends AnnotationElement{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`lineAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=this.#e=this.svgFactory.createElement(`svg:line`);return i.setAttribute(`x1`,e.rect[2]-e.lineCoordinates[0]),i.setAttribute(`y1`,e.rect[3]-e.lineCoordinates[1]),i.setAttribute(`x2`,e.rect[2]-e.lineCoordinates[2]),i.setAttribute(`y2`,e.rect[3]-e.lineCoordinates[3]),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),r.append(i),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},SquareAnnotationElement=class extends AnnotationElement{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`squareAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:rect`);return a.setAttribute(`x`,i/2),a.setAttribute(`y`,i/2),a.setAttribute(`width`,t-i),a.setAttribute(`height`,n-i),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},CircleAnnotationElement=class extends AnnotationElement{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`circleAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:ellipse`);return a.setAttribute(`cx`,t/2),a.setAttribute(`cy`,n/2),a.setAttribute(`rx`,t/2-i/2),a.setAttribute(`ry`,n/2-i/2),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},PolylineAnnotationElement=class extends AnnotationElement{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`polylineAnnotation`,this.svgElementName=`svg:polyline`}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:t,borderStyle:n,popupRef:r},width:i,height:a}=this;if(!t)return this.container;let o=this.svgFactory.create(i,a,!0),s=[];for(let n=0,r=t.length;n<r;n+=2){let r=t[n]-e[0],i=e[3]-t[n+1];s.push(`${r},${i}`)}s=s.join(` `);let c=this.#e=this.svgFactory.createElement(this.svgElementName);return c.setAttribute(`points`,s),c.setAttribute(`stroke-width`,n.width||1),c.setAttribute(`stroke`,`transparent`),c.setAttribute(`fill`,`transparent`),o.append(c),this.container.append(o),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},PolygonAnnotationElement=class extends PolylineAnnotationElement{constructor(e){super(e),this.containerClassName=`polygonAnnotation`,this.svgElementName=`svg:polygon`}},CaretAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`caretAnnotation`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}
vendor: 4,389 bytes, line 52
52,InkAnnotationElement=class extends AnnotationElement{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`inkAnnotation`,this.svgElementName=`svg:polyline`,this.annotationEditorType=this.data.it===`InkHighlight`?AnnotationEditorType.HIGHLIGHT:AnnotationEditorType.INK}#n(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:t,inkLists:n,borderStyle:r,popupRef:i}}=this,{transform:a,width:o,height:s}=this.#n(t,e),c=this.svgFactory.create(o,s,!0),l=this.#e=this.svgFactory.createElement(`svg:g`);c.append(l),l.setAttribute(`stroke-width`,r.width||1),l.setAttribute(`stroke-linecap`,`round`),l.setAttribute(`stroke-linejoin`,`round`),l.setAttribute(`stroke-miterlimit`,10),l.setAttribute(`stroke`,`transparent`),l.setAttribute(`fill`,`transparent`),l.setAttribute(`transform`,a);for(let e of n){let t=this.svgFactory.createElement(this.svgElementName);this.#t.push(t),t.setAttribute(`points`,e.join(`,`)),l.append(t)}return!i&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:t,points:n,rect:r}=e,i=this.#e;if(t>=0&&i.setAttribute(`stroke-width`,t||1),n)for(let e=0,t=this.#t.length;e<t;e++)this.#t[e].setAttribute(`points`,n[e].join(`,`));if(r){let{transform:e,width:t,height:n}=this.#n(this.data.rotation,r);i.parentElement.setAttribute(`viewBox`,`0 0 ${t} ${n}`),i.setAttribute(`transform`,e)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add(`highlightArea`)}},HighlightAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=AnnotationEditorType.HIGHLIGHT}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`highlightAnnotation`),this._editOnDoubleClick(),e){let t=document.createElement(`mark`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},UnderlineAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`underlineAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},SquigglyAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`squigglyAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},StrikeOutAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`strikeoutAnnotation`),e){let t=document.createElement(`s`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},StampAnnotationElement=class extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=AnnotationEditorType.STAMP}render(){return this.container.classList.add(`stampAnnotation`),this.container.setAttribute(`role`,`img`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}
52,FileAttachmentAnnotationElement=class extends AnnotationElement{#e=null;constructor(e){super(e,{isRenderable:!0});let{fileId:t,file:n}=this.data;this.filename=n.filename,this.content=n.content,this.fileId=t,this.linkService.eventBus?.dispatch(`fileattachmentannotation`,{source:this,attachmentId:this.fileId,...n})}render(){this.container.classList.add(`fileAttachmentAnnotation`);let{container:e,data:t}=this,n;t.hasAppearance||t.fillAlpha===0?n=document.createElement(`div`):(n=document.createElement(`img`),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?`paperclip`:`pushpin`}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener(`dblclick`,this.#t.bind(this)),this.#e=n;let{isMac:r}=FeatureTest.platform;return e.addEventListener(`keydown`,e=>{e.key===`Enter`&&(r?e.metaKey:e.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add(`popupTriggerArea`),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}async#t(){let{fileId:e,filename:t,content:n}=this,r=await this.linkService.getAttachmentContent(e)||n;r&&this.downloadManager?.openOrDownloadData(r,t)}},MediaAnnotationElement=class extends AnnotationElement{#e=new AbortController;#t=null;#n=null;constructor(e){super(e,{isRenderable:!!e.data.richMedia})}render(){this.container.classList.add(`mediaAnnotation`);let{filename:e}=this.data.richMedia,t=document.createElement(`button`);return t.className=`mediaPlayButton`,t.type=`button`,t.title=t.ariaLabel=e,t.addEventListener(`click`,()=>this.#r(t),{signal:this.#e.signal}),this.container.append(t),this.container}async#r(e){let{fileId:t,filename:n,contentType:r}=this.data.richMedia;e.disabled=!0;let i;try{i=await this.linkService.getAttachmentContent(t)}catch{return}finally{e.disabled=!1}if(!i||!e.isConnected)return;let{signal:a}=this.#e,o=URL.createObjectURL(new Blob([i],{type:r}));this.#t=o;let s=r.startsWith(`audio/`),c=document.createElement(s?`audio`:`video`);if(this.#n=c,c.className=`mediaContent`,this._setBackgroundColor(c),c.src=o,c.title=n,c.controls=!0,c.autoplay=!0,c.tabIndex=0,s){let e=!1,t=!1,n=()=>{c.controls=e||t};this.container.addEventListener(`pointerenter`,()=>{e=!0,n()},{signal:a}),this.container.addEventListener(`pointerleave`,()=>{e=!1,n()},{signal:a}),this.container.addEventListener(`focusin`,()=>{t=!0,n()},{signal:a}),this.container.addEventListener(`focusout`,()=>{t=!1,n()},{signal:a})}c.addEventListener(`emptied`,()=>this.#i(o),{once:!0,signal:a}),e.replaceWith(c),c.play().catch(()=>{})}#i(e=this.#t){e&&e===this.#t&&(URL.revokeObjectURL(e),this.#t=null)}destroy(){this.#e.abort(),this.#n&&=(this.#n.pause(),this.#n.removeAttribute(`src`),this.#n.load(),null),this.#i()}},AnnotationLayer=class e{#e=null;#t=null;#n=null;#r=new Map;#i=null;#a=null;#o=[];#s=!1;zIndex=0;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:r,page:i,viewport:a,structTreeLayer:o,commentManager:s,linkService:c,annotationStorage:l}){this.div=e,this.#e=t,this.#t=n,this.#i=o||null,this.#a=c||null,this.#n=l||new AnnotationStorage,this.page=i,this.viewport=a,this._annotationEditorUIManager=r,this._commentManager=s||null}hasEditableAnnotations(){return this.#r.size>0}async render(e){let{annotations:t,optionalContentConfig:n}=e,r=this.div;setLayerDimensions(r,this.viewport);let i=new Map,a=[],o={data:null,layer:r,linkService:this.#a,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||``,renderForms:e.renderForms!==!1,svgFactory:new DOMSVGFactory,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let e of t){if(e.noHTML)continue;let t=e.annotationType===AnnotationType.POPUP;if(t){let t=i.get(e.id);if(!t)continue;if(!this._commentManager){a.push(e);continue}o.elements=t}else if(e.rect[2]===e.rect[0]||e.rect[3]===e.rect[1])continue;o.data=e;let r=AnnotationElementFactory.create(o);if(!r.isRenderable)continue;t||(this.#o.push(r),e.popupRef&&i.getOrInsertComputed(e.popupRef,makeArr).push(r));let s=r.render();e.hidden&&(s.style.visibility=`hidden`),r.updateOC(n),r._isEditable&&(this.#r.set(r.data.id,r),this._annotationEditorUIManager?.renderAnnotationElement(r))}await this.#c();
52for(let e of a){let t=o.elements=i.get(e.id);o.data=e;let n=AnnotationElementFactory.create(o);if(!n.isRenderable)continue;let r=n.render();n.contentElement.id=`${AnnotationPrefix}${e.id}`,e.hidden&&(r.style.visibility=`hidden`),t.at(-1).container.after(r)}this.#l()}async#c(){if(this.#o.length===0)return;this.div.replaceChildren();let e=[];if(!this.#s){this.#s=!0;for(let{contentElement:t,data:{hidden:n,id:r,oc:i}}of this.#o){let a=t.id=`${AnnotationPrefix}${r}`,o=t.localName===`a`&&!n&&!i;e.push(this.#i?.getAriaAttributes(a,{enableLinkOwnership:o}).then(e=>{if(e)for(let[n,r]of e)t.setAttribute(n,r)}))}}this.#o.sort(({data:{rect:[e,t,n,r]}},{data:{rect:[i,a,o,s]}})=>{if(e===n&&t===r)return 1;if(i===o&&a===s)return-1;let c=r,l=t,u=(t+r)/2,d=s,f=a,p=(a+s)/2;return u>=d&&p<=l?-1:p>=c&&u<=f?1:(e+n)/2-(i+o)/2});let t=document.createDocumentFragment();for(let e of this.#o)t.append(e.container),this._commentManager?(e.extraPopupElement?.popup||e.popup)?.renderCommentButton():e.extraPopupElement&&t.append(e.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),this.#e){let e=await this.#i?.getAnnotationIds();for(let{contentElement:t}of this.#o)e?.has(t.id)||this.#e.addPointerInTextLayer(t,!1)}}async addLinkAnnotations(t){let n={data:null,layer:this.div,linkService:this.#a,svgFactory:new DOMSVGFactory,parent:this};for(let r of t){r.borderStyle||=e._defaultBorderStyle,n.data=r;let t=AnnotationElementFactory.create(n);t.isRenderable&&(t.render(),t.contentElement.id=`${AnnotationPrefix}${r.id}`,this.#o.push(t))}await this.#c()}update({viewport:e,optionalContentConfig:t}){let n=this.div;this.viewport=e,setLayerDimensions(n,{rotation:e.rotation});for(let e of this.#o)e.updateOC(t);this.#l(),n.hidden=!1}destroy(){for(let e of this.#o)e.destroy?.(),this.#e?.removePointerInTextLayer(e.contentElement);this.#o.length=0,this.#r.clear(),this.div.replaceChildren()}#l(){if(!this.#t)return;let e=this.div;for(let[t,n]of this.#t){let r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;if(Array.isArray(n))for(let e of n)e.className=`annotationContent`,e.ariaHidden=!0;else n.className=`annotationContent`,n.ariaHidden=!0;let i=[];for(let e of r.children)e.nodeName===`CANVAS`&&i.push(e);for(let e of i)e.remove();let a=Array.isArray(n)?n[0]:n,{firstChild:o}=r;if(o?o.classList.contains(`annotationContent`)?o.after(a):o.before(a):r.append(a),Array.isArray(n)){let e=a;for(let t=1,r=n.length;t<r;t++)e.after(n[t]),e=n[t]}this.#t.delete(t);let s=this.#r.get(t);s&&(s._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(t,r.id,n),s._hasNoCanvas=!1):s.canvas=n)}}refreshCanvases(){this.#l()}getEditableAnnotations(){return this.#r.values()}getEditableAnnotation(e){return this.#r.get(e)}addFakeAnnotation(e){let{div:t}=this,{id:n,rotation:r}=e,i=new EditorAnnotationElement({data:{id:n,rect:e.getPDFRect(),rotation:r},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:this.#a,annotationStorage:this.#n});return i.render(),i.contentElement.id=`${AnnotationPrefix}${n}`,i.createOrUpdatePopup(),this.#o.push(i),i}removeAnnotation(e){let t=this.#o.findIndex(t=>t.data.id===e);if(t<0)return;let[n]=this.#o.splice(t,1);this.#e?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(let t of e)t.updateFakeAnnotationElement(this);this.#c()}}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}static get _defaultBorderStyle(){return shadow(this,`_defaultBorderStyle`,Object.freeze({width:1,rawWidth:1,style:AnnotationBorderStyleType.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},EOL_PATTERN=/\r\n?|\n/g,FreeTextEditor=class e extends AnnotationEditor{#e=``;#t=`${this.id}-editor`;#n=null;#r;_colorPicker=null;static _freeTextDefaultContent=``;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.isEmpty(),r=AnnotationEditorUIManager.TRANSLATE_SMALL,i=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,`_keyboardManager`,new KeyboardManager([[[`ctrl+s`,`mac+meta+s`,`ctrl+p`,`mac+meta+p`],t.commitOrRemove,{bubbles:!0}],[[`ctrl+Enter`,`mac+meta+Enter`],t.commitOrRemove],[[`Escape`],t.commitOrRemove],[[`ArrowLeft`],t._translateEmpty,{args:[-r,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t._translateEmpty,{args:[-i,0],checker:n}],[[`ArrowRight`],t._translateEmpty,{args:[r,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t._translateEmpty,{args:[i,0],checker:n}],[[`ArrowUp`],t._translateEmpty,{args:[0,-r],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t._translateEmpty,{args:[0,-i],checker:n}],[[`ArrowDown`],t._translateEmpty,{args:[0,r],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t._translateEmpty,{args:[0,i],checker:n}]]))}static _type=`freetext`;static _editorType=AnnotationEditorType.FREETEXT;constructor(t){super({...t,name:`freeTextEditor`}),this.color=t.color||e._defaultColor||AnnotationEditor._defaultLineColor,this.#r=t.fontSize||e._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert(AnnotationEditor._l10nAlert.freetext),this.canAddComment=!1}static initialize(e,t){AnnotationEditor.initialize(e,t);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue(`--freetext-padding`))}static updateDefaultParams(t,n){switch(t){case AnnotationEditorParamsType.FREETEXT_S
vendor: 5,008 bytes, lines 52-53
52IZE:e._defaultFontSize=n;break;case AnnotationEditorParamsType.FREETEXT_COLOR:e._defaultColor=n;break}}updateParams(e,t){switch(e){case AnnotationEditorParamsType.FREETEXT_SIZE:this.#i(t);break;case AnnotationEditorParamsType.FREETEXT_COLOR:this.#a(t);break}}static get defaultPropertiesToUpdate(){return[[AnnotationEditorParamsType.FREETEXT_SIZE,e._defaultFontSize],[AnnotationEditorParamsType.FREETEXT_COLOR,e._defaultColor||AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[AnnotationEditorParamsType.FREETEXT_SIZE,this.#r],[AnnotationEditorParamsType.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new BasicColorPicker(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return AnnotationEditorParamsType.FREETEXT_COLOR}#i(e){let t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--total-scale-factor))`,this.translate(0,-(e-this.#r)*this.parentScale),this.#r=e,this.#s()},n=this.#r;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#a(e){let t=e=>{this.color=e,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){let t=this.parentScale;return[-e._internalPadding*t,-(e._internalPadding+this.#r)*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove(`enabled`),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute(`aria-activedescendant`),this.#n=new AbortController;let e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener(`keydown`,this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener(`focus`,this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener(`blur`,this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener(`input`,this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener(`paste`,this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add(`enabled`),this.editorDiv.contentEditable=!1,this.div.setAttribute(`aria-activedescendant`,this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add(`freetextEditing`),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===``}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add(`freetextEditing`)),super.remove()}#o(){let t=[];this.editorDiv.normalize();let n=null;for(let r of this.editorDiv.childNodes)n?.nodeType===Node.TEXT_NODE&&r.nodeName===`BR`||(t.push(e.#c(r)),n=r);return t.join(` 53`)}#s(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:e,div:t}=this,r=t.style.display,i=t.classList.contains(`hidden`);t.classList.remove(`hidden`),t.style.display=`hidden`,e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r,t.classList.toggle(`hidden`,i)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#e,t=this.#e=this.#o().trimEnd();if(e===t)return;let n=e=>{if(this.#e=e,!e){this.remove();return}this.#l(),this._uiManager.rebuild(this),this.#s()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#s()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key===`Enter`&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(t){e._keyboardManager.exec(this,t)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle(`freetextEditing`,this.isEmpty())}disableEditing(){this.editorDiv.setAttribute(`role`,`comment`),this.editorDiv.removeAttribute(`aria-multiline`)}enableEditing(){this.editorDiv.setAttribute(`role`,`textbox`),this.editorDiv.setAttribute(`aria-multiline`,!0)}get canChangeContent(){return!0}
53render(){if(this.div)return this.div;let e,t;(this._isCopy||this.annotationElementId)&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement(`div`),this.editorDiv.className=`internal`,this.editorDiv.setAttribute(`id`,this.#t),this.editorDiv.setAttribute(`data-l10n-id`,`pdfjs-free-text2`),this.editorDiv.setAttribute(`data-l10n-attrs`,`default-content`),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement(`div`),this.overlayDiv.classList.add(`overlay`,`enabled`),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[n,r]=this.parentDimensions;if(this.annotationElementId){let{position:i}=this._initialData,[a,o]=this.getInitialTranslation();[a,o]=this.pageTranslationToScreen(a,o);let[s,c]=this.pageDimensions,[l,u]=this.pageTranslation,d,f;switch(this.rotation){case 0:d=e+(i[0]-l)/s,f=t+this.height-(i[1]-u)/c;break;case 90:d=e+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[o,-a];break;case 180:d=e-this.width+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[-a,-o];break;case 270:d=e+(i[0]-l-this.height*c)/s,f=t+(i[1]-u-this.width*s)/c,[a,o]=[-o,a];break}this.setAt(d*n,f*r,a,o)}else this._moveAfterPaste(e,t);this.#l(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#c(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(EOL_PATTERN,``)}editorDivPaste(t){let n=t.clipboardData||window.clipboardData,{types:r}=n;if(r.length===1&&r[0]===`text/plain`)return;t.preventDefault();let i=e.#d(n.getData(`text`)||``).replaceAll(EOL_PATTERN,` 54`);if(!i)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let o=a.getRangeAt(0);if(!i.includes(` 55`)){o.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:s,startOffset:c}=o,l=[],u=[];if(s.nodeType===Node.TEXT_NODE){let t=s.parentElement;if(u.push(s.nodeValue.slice(c).replaceAll(EOL_PATTERN,``)),t!==this.editorDiv){let n=l;for(let r of this.editorDiv.childNodes){if(r===t){n=u;continue}n.push(e.#c(r))}}l.push(s.nodeValue.slice(0,c).replaceAll(EOL_PATTERN,``))}else if(s===this.editorDiv){let t=l,n=0;for(let r of this.editorDiv.childNodes)n++===c&&(t=u),t.push(e.#c(r))}this.#e=`${l.join(` 56`)}${i}${u.join(` 57`)}`,this.#l();let d=new Range,f=Math.sumPrecise(l.map(e=>e.length));for(let{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){let t=e.nodeValue.length;if(f<=t){d.setStart(e,f),d.setEnd(e,f);break}f-=t}a.removeAllRanges(),a.addRange(d)}#l(){if(this.editorDiv.replaceChildren(),this.#e)for(let e of this.#e.split(` 58`)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}#u(){return this.#e.replaceAll(`\xA0`,` `)}static#d(e){return e.replaceAll(` `,`\xA0`)}get contentDiv(){return this.editorDiv}getPDFRect(){let t=e._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,n,r){let i=null;if(t instanceof FreeTextAnnotationElement){let{data:{defaultAppearanceData:{fontSize:e,fontColor:n},rect:r,rotation:a,id:o,popupRef:s,richText:c,contentsObj:l,creationDate:u,modificationDate:d},textContent:f,textPosition:p,parent:{page:{pageNumber:m}}}=t;if(!f?.length)return null;i=t={annotationType:AnnotationEditorType.FREETEXT,color:Array.from(n),fontSize:e,value:f.join(` 59`),position:p,pageIndex:m-1,rect:r.slice(0),rotation:a,annotationElementId:o,id:o,deleted:!1,popupRef:s,comment:l?.str||null,richText:c,creationDate:u,modificationDate:d}}let a=await super.deserialize(t,n,r);return a.#r=t.fontSize,a.color=Util.makeHexColor(...t.color),a.#e=e.#d(t.value),a._initialData=i,t.comment&&a.setCommentData(t),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let t=AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:t,fontSize:this.#r,value:this.#u()});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!this.#f(n)?null:(n.id=this.annotationElementId,n)}#f(e){let{value:t,fontSize:n,color:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==i}renderAnnotationElement(e){let t=super.renderAnnotationElement(e);
59if(!t)return null;let{style:n}=t;n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,t.replaceChildren();for(let e of this.#e.split(` 60`)){let n=document.createElement(`div`);n.append(e?document.createTextNode(e):document.createElement(`br`)),t.append(n)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}},DrawingOptions=class{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith(`_`)||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){unreachable(`Not implemented`)}},DrawingEditor=class e extends AnnotationEditor{#e=null;#t;_clipPathId=null;_colorPicker=null;_drawId=null;_drawOutlines=null;_focusDrawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#i=null;static#a=null;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){e.drawOutlines&&(this.#o(e),this.#m())}#o({drawOutlines:e,drawId:t,drawingOptions:n,clipPathId:r}){this._drawOutlines=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(AnnotationEditor._l10nAlert[this.editorType]),t>=0?(this._drawId=t,this._clipPathId=r??null,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties),this.#c(this.parent)):this._drawId=this.#s(e,this.parent),this.#_(e.box)}#s(t,n){let{id:r,clipPathId:i}=n.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=i),this.#c(n),r}#c(e){let t=this._drawOutlines.getFocusSVGProperties(this.#f);t&&(this._focusDrawId=e.drawLayer.drawOutline(t,this._drawOutlines.focusMustRemoveSelfIntersections))}#l(e=this.#f){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e))}#u(e){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,{rootClass:e})}#d(){let{parent:e,_drawId:t,_focusDrawId:n,_isVisible:r}=this;if(!e||t===null)return;let i={hidden:!r};e.drawLayer.updateProperties(t,{rootClass:i}),n!==null&&e.drawLayer.updateProperties(n,{rootClass:i})}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[r,i]of Object.entries(t))n.has(r)?Object.assign(e[r],i):e[r]=i;return e}static getDefaultDrawingOptions(e){unreachable(`Not implemented`)}static get typesMap(){unreachable(`Not implemented`)}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}get#f(){return(this.parentRotation-this._drawRotation+360)%360}static updateDefaultParams(t,n){let r=this.typesMap.get(t);r&&this._defaultDrawingOptions.updateProperty(r,n),this._currentParent&&(e.#n.updateProperty(r,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){let r=this._drawingOptions,i=r[t],a=n=>{r.updateProperty(t,n);let i=this._drawOutlines.updateProperty(t,n);i&&this.#_(i),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:a.bind(this,n),undo:a.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t,n=this.colorAndOpacityType){let r=this.constructor.typesMap.get(this.colorType),i=this._opacityName,a=this._drawingOptions,o=a[r],s=a[i],c=(e,t)=>{a.updateProperty(r,e),a.updateProperty(i,t),this._drawOutlines.updateProperty(r,e),this._drawOutlines.updateProperty(i,t),this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,e,t),undo:c.bind(this,o,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:n,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(this.#g()),{bbox:this.#v()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(this.#g()),{bbox:this.#v()})),this.#l()}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#v()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(this.#g(),this.parentDimensions),{bbox:this.#v()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle(`disabled`,!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle(`disabled`,!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),this.#p(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#m(),this.#_(this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#p()):e&&(this._uiManager.addShouldRescale(this),this.#m(e),t=!this.parent&&this.div?.classList.contains(`selectedEditor`)),super.setParent(e),this.#d(),t&&this.select()}#p(){if(this._drawId===null||!this.parent)return;let{drawLayer:e}=this.parent;e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(e.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()}#m(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){let{drawLayer:t}=this.parent;t.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null&&t.updateParent(this._focusDrawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#s(this._drawOutlines,e),this._clipPathId&&this.#e&&(this.#e.style.clipPath=this._clipPathId)}}#h([e,t,n,r]){let{parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[t,1-e,a/i*n,i/a*r];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,a/i*n,i/a*r];default:return[e,t,n,r]}}#g(){let{x:e,y:t,width:n,height:r,parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[1-t,e,i/a*n,a/i*r];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,i/a*n,a/i*r];default:return[e,t,n,r]}}#_(e){[this.x,this.y,this.width,this.height]=this.#h(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#v(e=this.parentRotation){let{x:t,y:n,width:r,height:i,_drawRotation:a,parentDimensions:[o,s]}=this;switch((a*4+e)/90){case 1:return[1-n-i,t,i,r];case 2:return[1-t-r,1-n-i,r,i];case 3:return[n,1-t-r,i,r];case 4:return[t,n-o/s*r,s/o*i,o/s*r];case 5:return[1-n,t,o/s*r,s/o*i];case 6:return[1-t-s/o*i,1-n,s/o*i,o/s*r];case 7:return[n-o/s*r,1-t-s/o*i,o/s*r,s/o*i];case 8:return[t-r,n-i,r,i];case 9:return[1-n,t-r,i,r];case 10:return[1-t,1-n,r,i];case 11:return[n-i,1-t,i,r];case 12:return[t-s/o*i,n,s/o*i,o/s*r];case 13:return[1-n-o/s*r,t-s/o*i,o/s*r,s/o*i];case 14:return[1-t,1-n-o/s*r,s/o*i,o/s*r];case 15:return[n,1-t,o/s*r,s/o*i];default:return[t,n,r,i]}}rotate(t=this.parentRotation){if(!this.parent||this._drawId===null)return;let n=(t-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#v(t)},this._drawOutlines.updateRotation(n))),this.#l(n)}show(e=this._isVisible){super.show(e),this.#d()}select(){super.select(),this.#u({hovered:!1,selected:!0})}unselect(){super.unselect(),this.#u({selected:!1})}pointerover(){this.isSelected||this.#u({hovered:!0})}pointerleave(){this.isSelected||this.#u({hovered:!1})}onScaleChanging(){if(!this.parent)return;let e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);e&&this.#_(e)}static onScaleChangingWhenDrawing(){}
60render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();this.constructor._hasDrawClass&&n.classList.add(`draw`);let r=this.#e=document.createElement(`div`);return n.append(r),r.setAttribute(`aria-hidden`,`true`),r.className=`internal`,this._clipPathId&&(r.style.clipPath=this._clipPathId),bindEvents(this,r,[`pointerover`,`pointerleave`]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e){unreachable(`Not implemented`)}static _getDrawingTarget(e,{target:t}){return t}static _getPointerCoords({offsetX:e,offsetY:t,clientX:n,clientY:r},i=null){if(!i)return[e,t];let a=n-i.clientX,o=r-i.clientY;switch(this._currentParent.viewport.rotation){case 90:[a,o]=[o,-a];break;case 180:[a,o]=[-a,-o];break;case 270:[a,o]=[-o,a];break}return[i.offsetX+a,i.offsetY+o]}static _addDrawingListeners(e,t){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(t,n,r,i){let{pointerId:a,pointerType:o}=i;if(CurrentPointers.isInitializedAndDifferentPointerType(o))return;let s=this._getDrawingTarget(t,i),[c,l]=this._getPointerCoords(i),{viewport:{rotation:u}}=t,{x:d,y:f,width:p,height:m}=s.getBoundingClientRect(),h=e.#r=new AbortController,g=t.combinedSignal(h);if(CurrentPointers.setPointer(o,a),window.addEventListener(`pointerup`,e=>{CurrentPointers.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:g}),window.addEventListener(`pointercancel`,e=>{CurrentPointers.isSamePointerIdOrRemove(e.pointerId)&&this._endDrawingSession()},{signal:g}),window.addEventListener(`pointerdown`,t=>{CurrentPointers.isSamePointerType(t.pointerType)&&(CurrentPointers.initializeAndAddPointerId(t.pointerId),e.#n.isCancellable()&&(e.#n.removeLastElement(),e.#n.isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener(`contextmenu`,noContextMenu,{signal:g}),s.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:g}),s.addEventListener(`touchmove`,e=>{CurrentPointers.isSameTimeStamp(e.timeStamp)&&stopEvent(e)},{signal:g}),this._addDrawingListeners(s,g),t.toggleDrawing(),n._editorUndoBar?.hide(),e.#n){t.drawLayer.updateProperties(this._currentDrawId,e.#n.startNew(c,l,p,m,u));return}n.updateUIForDefaultProperties(this),e.#n=this.createDrawerInstance({x:c,y:l,box:[d,f,p,m],rotation:u,parent:t,isLTR:r}),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t;let{id:_,clipPathId:v}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#n.defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=_,e.#a=this._hasClipPath?v:null}static _drawMove(t){if(CurrentPointers.isSameTimeStamp(t.timeStamp),!e.#n||!CurrentPointers.isSamePointerId(t.pointerId))return;if(CurrentPointers.isUsingMultiplePointers()){this._endDraw(t);return}let n,r=t.getCoalescedEvents?.();if(r?.length){let i=[];for(let e of r)i.push(...this._getPointerCoords(e,t));n=e.#n.addPoints(i)}else n=e.#n.add(...this._getPointerCoords(t));this._currentParent.drawLayer.updateProperties(this._currentDrawId,n),CurrentPointers.setTimeStamp(t.timeStamp),stopEvent(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#n=null,e.#i=null,e.#a=null,CurrentPointers.clearTimeStamp()),e.#r&&(e.#r.abort(),e.#r=null,CurrentPointers.clearPointerIds())}static _endDraw(t){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),n.drawLayer.updateProperties(this._currentDrawId,t?.target===n.div?e.#n.end(...this._getPointerCoords(t)):e.#n.end()),this.supportMultipleDrawings){let t=e.#n,r=this._currentDrawId,i=t.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(r,t.setLastElement(i))},undo:()=>{n.drawLayer.updateProperties(r,t.removeLastElement())},mustExec:!1,type:AnnotationEditorParamsType.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(AnnotationEditorParamsType.DRAW_STEP),!e.#n.isEmpty()){let{pageDimensions:[r,i],scale:a}=n,o=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:e.#a,drawOutlines:e.#n.getOutlines(r*a,i*a,a,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),o}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,i,a,o){unreachable(`Not implemented`)}static async deserialize(e,t,n){let{rawDims:{pageWidth:r,pageHeight:i,pageX:a,pageY:o}}=t.viewport,s=this.deserializeDraw(a,o,r,i,this._INNER_MARGIN,e,n),c=await super.deserialize(e,t,n);return c.createDrawingOptions(e),c.#o({drawOutlines:s}),c.#m(),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){let[t,n]=this.pageTranslation,[r,i]=this.pageDimensions;return this._drawOutlines.serialize([t,n,r,i],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},Outline=class{static PRECISION=1e-4;focusOutline=null;toSVGPath(){unreachable("Abstract method `toSVGPath` must be implemented.")}get box(){unreachable("Abstract getter `box` must be implemented.")}serialize(e,t){unreachable("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){unreachable("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,t){return null}updateParentDimensions(e,t){return null}serializeQuadPoints(e,t){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,t){return{}}static _rotateBox([e,t,n,r],i){switch(i){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}static _rescale(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o]*r,a[o+1]=n+e[o+1]*i;return a}static _rescaleAndSwap(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o+1]*r,a[o+1]=n+e[o]*i;return a}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let i=0,a=e.length;i<a;i+=2)r[i]=t+e[i],r[i+1]=n+e[i+1];return r}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,r,i){switch(i){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static createBezierPoints(e,t,n,r,i,a){return[(e+5*n)/6,(t+5*r)/6,(5*n+i)/6,(5*r+a)/6,(n+i)/2,(r+a)/2]}},FreeDrawOutliner=class e{#e;#t=[];#n;#r;#i=[];#a=new Float32Array(18);#o;#s;#c;#l;#u;#d;#f=[];static#p=8;static#m=2;static#h=e.#p+e.#m;constructor(t,n,r,i,a,o,s=0){this.#e=r,this.#d=a*i,this.#r=o,this.#a.set([NaN,NaN,NaN,NaN,t,n],6),this.#n=s,this.#l=e.#p*i,this.#c=e.#h*i,this.#u=i,this.#f.push(t,n)}isEmpty(){return isNaN(this.#a[8])}isCancellable(){return this.#f.length<=10}removeLastElement(){return this.#a.fill(NaN),this.#i.length=this.#t.length=this.#f.length=0,{path:{d:``}}}#g(){let e=this.#a.subarray(4,6),t=this.#a.subarray(16,18),[n,r,i,a]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/i,(this.#s+(e[1]-t[1])/2-r)/a,(this.#o+(t[0]-e[0])/2-n)/i,(this.#s+(t[1]-e[1])/2-r)/a]}
vendor: 3,858 bytes, line 60
60add(e,t){this.#o=e,this.#s=t;let[n,r,i,a]=this.#e,[o,s,c,l]=this.#a.subarray(8,12),u=e-c,d=t-l,f=Math.hypot(u,d);if(f<this.#c)return!1;let p=f-this.#l,m=p/f,h=m*u,g=m*d,_=o,v=s;o=c,s=l,c+=h,l+=g,this.#f?.push(e,t);let y=-g/p,b=h/p,x=y*this.#d,S=b*this.#d;return this.#a.set(this.#a.subarray(2,8),0),this.#a.set([c+x,l+S],4),this.#a.set(this.#a.subarray(14,18),12),this.#a.set([c-x,l-S],16),isNaN(this.#a[6])?(this.#i.length===0&&(this.#a.set([o+x,s+S],2),this.#i.push(NaN,NaN,NaN,NaN,(o+x-n)/i,(s+S-r)/a),this.#a.set([o-x,s-S],14),this.#t.push(NaN,NaN,NaN,NaN,(o-x-n)/i,(s-S-r)/a)),this.#a.set([_,v,o,s,c,l],6),!this.isEmpty()):(this.#a.set([_,v,o,s,c,l],6),Math.abs(Math.atan2(v-s,_-o)-Math.atan2(g,h))<Math.PI/2?([o,s,c,l]=this.#a.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/i,((s+l)/2-r)/a),[o,s,_,v]=this.#a.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((_+o)/2-n)/i,((v+s)/2-r)/a),!0):([_,v,o,s,c,l]=this.#a.subarray(0,6),this.#i.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),[c,l,o,s,_,v]=this.#a.subarray(12,18),this.#t.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),!0))}toSVGPath(){if(this.isEmpty())return``;let e=this.#i,t=this.#t;if(isNaN(this.#a[6])&&!this.isEmpty())return this.#_();let n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#y(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new FreeDrawOutline(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#f[e]-r)/a,s[e+1]=(this.#f[e+1]-i)/o;if(s[s.length-2]=(this.#o-r)/a,s[s.length-1]=(this.#s-i)/o,isNaN(n[6])&&!this.isEmpty())return this.#b(s);let c=new Float32Array(this.#i.length+24+this.#t.length),l=e.length;for(let t=0;t<l;t+=2){if(isNaN(e[t])){c[t]=c[t+1]=NaN;continue}c[t]=e[t],c[t+1]=e[t+1]}l=this.#S(c,l);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2){if(isNaN(t[e+n])){c[l]=c[l+1]=NaN,l+=2;continue}c[l]=t[e+n],c[l+1]=t[e+n+1],l+=2}return this.#x(c,l),this.newFreeDrawOutline(c,s,this.#e,this.#u,this.#n,this.#r)}#b(e){let t=this.#a,[n,r,i,a]=this.#e,[o,s,c,l]=this.#g(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-n)/i,(t[3]-r)/a,NaN,NaN,NaN,NaN,(t[4]-n)/i,(t[5]-r)/a,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,(t[16]-n)/i,(t[17]-r)/a,NaN,NaN,NaN,NaN,(t[14]-n)/i,(t[15]-r)/a],0),this.newFreeDrawOutline(u,e,this.#e,this.#u,this.#n,this.#r)}#x(e,t){let n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#S(e,t){let n=this.#a.subarray(4,6),r=this.#a.subarray(16,18),[i,a,o,s]=this.#e,[c,l,u,d]=this.#g();return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-a)/s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-a)/s],t),t+=24}},FreeDrawOutline=class extends Outline{#e;#t=new Float32Array(4);#n;#r;#i;#a;#o;constructor(e,t,n,r,i,a){super(),this.#o=e,this.#i=t,this.#e=n,this.#a=r,this.#n=i,this.#r=a,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#s(a);let[o,s,c,l]=this.#t;for(let t=0,n=e.length;t<n;
60t+=2)e[t]=(e[t]-o)/c,e[t+1]=(e[t+1]-s)/l;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-o)/c,t[e+1]=(t[e+1]-s)/l}toSVGPath(){let e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6){if(isNaN(this.#o[t])){e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`);continue}e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`)}return e.push(`Z`),e.join(` `)}serialize([e,t,n,r],i){let a=n-e,o=r-t,s,c;switch(i){case 0:s=Outline._rescale(this.#o,e,r,a,-o),c=Outline._rescale(this.#i,e,r,a,-o);break;case 90:s=Outline._rescaleAndSwap(this.#o,e,t,a,o),c=Outline._rescaleAndSwap(this.#i,e,t,a,o);break;case 180:s=Outline._rescale(this.#o,n,t,-a,o),c=Outline._rescale(this.#i,n,t,-a,o);break;case 270:s=Outline._rescaleAndSwap(this.#o,n,r,-a,-o),c=Outline._rescaleAndSwap(this.#i,n,r,-a,-o);break}return{outline:Array.from(s),points:[Array.from(c)]}}#s(e){let t=this.#o,n=t[4],r=t[5],i=[n,r,n,r],a=n,o=r,s=n,c=r,l=e?Math.max:Math.min,u=new Float32Array(4);for(let e=6,d=t.length;e<d;e+=6){let d=t[e+4],f=t[e+5];isNaN(t[e])?(Util.pointBoundingBox(d,f,i),o>f?(a=d,o=f):o===f&&(a=l(a,d)),c<f?(s=d,c=f):c===f&&(s=l(s,d))):(u.set(BBOX_INIT,0),Util.bezierBoundingBox(n,r,...t.slice(e,e+6),u),Util.rectBoundingBox(...u,i),o>u[1]?(a=u[0],o=u[1]):o===u[1]&&(a=l(a,u[0])),c<u[3]?(s=u[2],c=u[3]):c===u[3]&&(s=l(s,u[2]))),n=d,r=f}let d=this.#t;d[0]=i[0]-this.#n,d[1]=i[1]-this.#n,d[2]=i[2]-i[0]+2*this.#n,d[3]=i[3]-i[1]+2*this.#n,this.firstPoint=[a,o],this.lastPoint=[s,c]}get box(){return this.#t}newOutliner(e,t,n,r,i,a,o=0){return new FreeDrawOutliner(e,t,n,r,i,a,o)}updateThickness(e){let t=this.getNewOutline(e);return this.#o=t.#o,this.#i=t.#i,this.#t.set(t.#t),this.firstPoint=t.firstPoint,this.lastPoint=t.lastPoint,this.#t}getNewOutline(e,t){let[n,r,i,a]=this.#t,[o,s,c,l]=this.#e,u=i*c,d=a*l,f=n*c+o,p=r*l+s,m=this.#i,h=this.newOutliner(m[0]*u+f,m[1]*d+p,this.#e,this.#a,e,this.#r,t??this.#n);for(let e=2,t=m.length;e<t;e+=2)h.add(m[e]*u+f,m[e+1]*d+p);return h.getOutlines()}};function getHighlightSVGProperties(e){return{bbox:e.box,root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function getHighlightFocusSVGProperties(e,t){let{focusOutline:n}=e;return{bbox:Outline._rotateBox(n.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:n.toSVGPath()}}}var HighlightOutliner=class{#e;#t;#n;#r=[];#i=[];constructor(e,t=0,n=0,r=!0){let i=BBOX_INIT.slice(),a=10**-4;for(let{x:n,y:r,width:o,height:s}of e){let e=Math.floor((n-t)/a)*a,c=Math.ceil((n+o+t)/a)*a,l=Math.floor((r-t)/a)*a,u=Math.ceil((r+s+t)/a)*a,d=[e,l,u,!0],f=[c,l,u,!1];this.#r.push(d,f),Util.rectBoundingBox(e,l,c,u,i)}let o=i[2]-i[0]+2*n,s=i[3]-i[1]+2*n,c=i[0]-n,l=i[1]-n,u=r?-1/0:1/0,d=1/0,f=this.#r.at(r?-1:-2),p=[f[0],f[2]];for(let e of this.#r){let[t,n,i,a]=e;!a&&r?n<d?(d=n,u=t):n===d&&(u=Math.max(u,t)):a&&!r&&(n<d?(d=n,u=t):n===d&&(u=Math.min(u,t))),e[0]=(t-c)/o,e[1]=(n-l)/s,e[2]=(i-l)/s}this.#e=new Float32Array([c,l,o,s]),this.#t=[u,d],this.#n=p}getOutlines(){this.#r.sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);let e=[];for(let t of this.#r)t[3]?(e.push(...this.#l(t)),this.#s(t)):(this.#c(t),e.push(...this.#l(t)));return this.#a(e)}#a(e){let t=[],n=new Set;for(let n of e){let[e,r,i]=n;t.push([e,r,n],[e,i,n])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,r=t.length;e<r;e+=2){let r=t[e][2],i=t[e+1][2];r.push(i),i.push(r),n.add(r),n.add(i)}let r=[],i;for(;n.size>0;){let e=n.values().next().value,[t,a,o,s,c]=e;n.delete(e);let l=t,u=a;for(i=[t,o],r.push(i);;){let e;if(n.has(s))e=s;else if(n.has(c))e=c;else break;n.delete(e),[t,a,o,s,c]=e,l!==t&&(i.push(l,u,t,u===a?a:o),l=t),u=u===a?o:a}i.push(l,u)}return new HighlightOutline(r,this.#e,this.#t,this.#n)}#o(e){let t=this.#i,n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i][0];if(a===e)return i;a<e?n=i+1:r=i-1}return r+1}#s([,e,t]){let n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){let n=this.#o(e);for(let r=n;r<this.#i.length;r++){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}for(let r=n-1;r>=0;r--){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}}#l(e){let[t,n,r]=e,i=[[t,n,r]],a=this.#o(r);for(let e=0;e<a;e++){let[n,r]=this.#i[e];for(let e=0,a=i.length;e<a;e++){let[,o,s]=i[e];if(!(r<=o||s<=n)){if(o>=n){if(s>r)i[e][1]=r;else{if(a===1)return[];i.splice(e,1),e--,a--}continue}i[e][2]=n,s>r&&i.push([t,r,s])}}}return i}},HighlightOutline=class extends Outline{#e;#t=null;#n;constructor(e,t,n,r){super(),this.#n=e,this.#e=t,this.firstPoint=n,this.lastPoint=r}static build(e,t){let n=new HighlightOutliner(e,.001).getOutlines();return n.#t=e,n.focusOutline=new HighlightOutliner(e,.0025,.001,t).getOutlines(),n}get isFree(){return!1}get defaultSVGProperties(){return getHighlightSVGProperties(this)}getFocusSVGProperties(e){return getHighlightFocusSVGProperties(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,t],[n,r]){let i=this.#t,a=new Float32Array(i.length*8),o=0;for(let{x:s,y:c,width:l,height:u}of i){let i=s*n+e,d=(1-c)*r+t;a[o]=a[o+4]=i,a[o+1]=a[o+3]=d,a[o+2]=a[o+6]=i+l*n,a[o+5]=a[o+7]=d-u*r,o+=8}return a}toSVGPath(){let e=[];
60for(let t of this.#n){let[n,r]=t;e.push(`M${n} ${r}`);for(let i=2;i<t.length;i+=2){let a=t[i],o=t[i+1];a===n?(e.push(`V${o}`),r=o):o===r&&(e.push(`H${a}`),n=a)}e.push(`Z`)}return e.join(` `)}serialize([e,t,n,r],i){let a=[],o=n-e,s=r-t;for(let t of this.#n){let n=Array(t.length);for(let i=0;i<t.length;i+=2)n[i]=e+t[i]*o,n[i+1]=r-t[i+1]*s;a.push(n)}return a}get box(){return this.#e}},FreeHighlightOutliner=class extends FreeDrawOutliner{newFreeDrawOutline(e,t,n,r,i,a){return new FreeHighlightOutline(e,t,n,r,i,a)}},FreeHighlightDrawer=class{#e;#t;constructor(e,t,n,r,i,a,o){this.#e=new FreeHighlightOutliner(e,t,n,r,i,a,o),this.#t=i}add(e,t){return this.#e.add(e,t)?{path:{d:this.#e.toSVGPath()}}:null}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)t=this.#e.add(e[n],e[n+1])||t;return t?{path:{d:this.#e.toSVGPath()}}:null}end(e,t){return e===void 0?null:this.add(e,t)}isEmpty(){return this.#e.isEmpty()}isCancellable(){return this.#e.isCancellable()}removeLastElement(){return this.#e.removeLastElement()}updateProperty(e,t){return null}getOutlines(){let e=this.#e.getOutlines();return e.buildFocusOutline(2*this.#t),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:!0},path:{d:this.#e.toSVGPath()}}}},FreeHighlightOutline=class e extends FreeDrawOutline{static#e=1.5;newOutliner(e,t,n,r,i,a,o=0){return new FreeHighlightOutliner(e,t,n,r,i,a,o)}get isFree(){return!0}buildFocusOutline(t){this.focusOutline=this.getNewOutline(t/2+e.#e,.0025)}get defaultSVGProperties(){return getHighlightSVGProperties(this)}getFocusSVGProperties(e){return getHighlightFocusSVGProperties(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,t){if(e!==`thickness`)return null;let n=this.updateThickness(t/2);return this.buildFocusOutline(t),n}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}},HighlightDrawingOptions=class e extends DrawingOptions{constructor(e=null){super(),super.updateProperties(e)}updateSVGProperty(e,t){e!==`thickness`&&super.updateSVGProperty(e,t)}clone(){let t=new e;return t.updateAll(this),t}},HighlightEditor=class e extends DrawingEditor{#e=null;#t=0;#n=null;#r=0;#i=``;#a=``;static _DEFAULT_OPACITY=1;static _DEFAULT_THICKNESS=12;static _defaultDrawingOptions=null;static _type=`highlight`;static _editorType=AnnotationEditorType.HIGHLIGHT;static get _keyboardManager(){let t=e.prototype;return shadow(this,`_keyboardManager`,new KeyboardManager([[[`ArrowLeft`],t._moveCaret,{args:[0]}],[[`ArrowRight`],t._moveCaret,{args:[1]}],[[`ArrowUp`],t._moveCaret,{args:[2]}],[[`ArrowDown`],t._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:`highlightEditor`}),this.#e=e.anchorNode||null,this.#t=e.anchorOffset||0,this.#n=e.focusNode||null,this.#r=e.focusOffset||0,this.#i=e.methodOfCreation||(this._drawOutlines?.isFree?`main_toolbar`:``),this.#a=e.text||``,this._isDraggable=!1,this.defaultL10nId=`pdfjs-editor-highlight-editor`,this.rotate()}static initialize(t,n){AnnotationEditor.initialize(t,n),this._defaultDrawingOptions||=new HighlightDrawingOptions({fill:n.highlightColors?.values().next().value||`#fff066`,"fill-opacity":e._DEFAULT_OPACITY,thickness:e._DEFAULT_THICKNESS})}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get typesMap(){return shadow(this,`typesMap`,new Map([[AnnotationEditorParamsType.HIGHLIGHT_COLOR,`fill`],[AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,`thickness`]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(t){let{boxes:n,drawOutlines:r}=t;!n&&!r||(this._drawingOptions||=t.drawingOptions||e.getDefaultDrawingOptions(),n&&(t={...t,drawOutlines:HighlightOutline.build(n,this._uiManager.direction===`ltr`)}),super._addOutlines(t))}get colorType(){return AnnotationEditorParamsType.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions[`fill-opacity`]}get _opacityName(){return`fill-opacity`}get _drawRotation(){return this._drawOutlines?.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){return!this._drawOutlines?.isFree}get telemetryInitialData(){return{action:`added`,type:this._drawOutlines.isFree?`free_highlight`:`highlight`,color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:this.#i}}get telemetryFinalData(){return{type:`highlight`,color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get(`color`).size}}translateInPage(e,t){}get toolbarPosition(){return this.#o(this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return this.#o(this._drawOutlines.firstPoint)}#o([e,t]){let[n,r,i,a]=this._drawOutlines.box;return[(e-n)/i,(t-r)/a]}updateParams(t,n){switch(t){case AnnotationEditorParamsType.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,e._DEFAULT_OPACITY,t),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(n)},!0);break;case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:super.updateParams(t,n),this._reportTelemetry({action:`thickness_changed`,thickness:n},!0);break}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([AnnotationEditorParamsType.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new ColorPicker({editor:this}),[[`colorPicker`,this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,t){return super.getRect(e,t,this._drawRotation)}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this._reportTelemetry({action:`deleted`}),super.remove()}
60render(){if(this.div)return this.div;let e=super.render();return this.#a&&(e.setAttribute(`aria-label`,this.#a),e.setAttribute(`role`,`mark`)),this._drawOutlines.isFree?e.classList.add(`free`):e.addEventListener(`keydown`,this.#s.bind(this),{signal:this._uiManager._signal}),this.enableEditing(),e}#s(t){e._keyboardManager.exec(this,t)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#c(!0);break;case 1:case 3:this.#c(!1);break}}#c(e){if(!this.#e)return;let t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#n,this.#r)}unselect(){super.unselect(),this._drawOutlines.isFree||this.#c(!1)}static createDrawerInstance({x:e,y:t,box:n,parent:r,isLTR:i}){return new FreeHighlightDrawer(e,t,n,r.scale,this._defaultDrawingOptions.thickness/2,i,.001)}static _getDrawingTarget(e,{target:t}){return t.closest(`.textLayer`)}static _getPointerCoords({x:e,y:t}){return[e,t]}static _addDrawingListeners(e,t){e.classList.add(`free`),t.addEventListener(`abort`,()=>e.classList.remove(`free`),{once:!0}),window.addEventListener(`blur`,()=>this._endDraw(null),{signal:t}),window.addEventListener(`pointerdown`,stopEvent,{capture:!0,passive:!1,signal:t})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:t,opacity:n,thickness:r}){let{_defaultDrawingOptions:i,_DEFAULT_OPACITY:a}=e;this._drawingOptions=e.getDefaultDrawingOptions({fill:Util.makeHexColor(...t),"fill-opacity":n||a,thickness:r||i.thickness})}static deserializeDraw(e,t,n,r,i,a,o){let{quadPoints:s}=a;if(s){let i=[];for(let a=0,o=s.length;a<o;
vendor: 15,751 bytes, line 60
60a+=8)i.push({x:(s[a]-e)/n,y:1-(s[a+1]-t)/r,width:(s[a+2]-s[a])/n,height:(s[a+1]-s[a+5])/r});return HighlightOutline.build(i,o.direction===`ltr`)}let c=a.thickness||this._defaultDrawingOptions.thickness,l=(a.inkLists||a.outlines.points)[0],u=new FreeHighlightOutliner(l[0]-e,r-(l[1]-t),[0,0,n,r],1,c/2,!0,.001);for(let n=0,i=l.length;n<i;n+=2)u.add(l[n]-e,r-(l[n+1]-t));let d=u.getOutlines();return d.buildFocusOutline(c),d}static async deserialize(e,t,n){let r=null;if(e instanceof HighlightAnnotationElement){let{data:{quadPoints:t,rect:n,rotation:i,id:a,color:o,opacity:s,popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:AnnotationEditorType.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}else if(e instanceof InkAnnotationElement){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,borderStyle:{rawWidth:s},popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:AnnotationEditorType.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=super.serialize(e);return Object.assign(t,{color:AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(t.rect,this._drawRotation)}),this.addComment(t),this.annotationElementId&&!this.#l(t)?null:(t.id=this.annotationElementId,t)}#l(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,n)=>e!==t[n])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},InkDrawOutliner=class{#e=new Float64Array(6);#t=new Float64Array(2);#n;#r;#i;#a;#o;#s=``;#c=0;#l=new InkDrawOutline;#u;#d;constructor(e,t,n,r,i,a){this.#u=n,this.#d=r,this.#i=i,this.#a=a,[e,t]=this.#f(e,t);let o=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#r=[{line:o,points:this.#o}],this.#e.set(o,0),this.#t.set([e,t],0)}updateProperty(e,t){e===`stroke-width`&&(this.#a=t)}#f(e,t){return Outline._normalizePoint(e,t,this.#u,this.#d,this.#i)}isEmpty(){return!this.#r?.length}isCancellable(){return this.#o.length<=10}add(e,t){return this.#p(e,t)&&this.toSVGPath(),{path:{d:this.#m()}}}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)this.#p(e[n],e[n+1])&&(t=!0,this.#o.length<=6&&(this.toSVGPath(),t=!1));return t&&this.toSVGPath(),{path:{d:this.#m()}}}#p(e,t){[e,t]=this.#f(e,t),this.#t.set([e,t],0);let[n,r,i,a]=this.#e.subarray(2,6),o=e-i,s=t-a;return Math.hypot(this.#u*o,this.#d*s)<=2?!1:(this.#o.push(e,t),isNaN(n)?(this.#e.set([i,a,e,t],2),this.#n.push(NaN,NaN,NaN,NaN,e,t),!0):(isNaN(this.#e[0])&&this.#n.splice(6,6),this.#e.set([n,r,i,a,e,t],0),this.#n.push(...Outline.createBezierPoints(n,r,i,a,e,t)),!0))}end(e,t){return e!==void 0&&this.#p(e,t)||this.#o.length===2?{path:{d:this.toSVGPath()}}:{path:{d:this.#s}}}startNew(e,t,n,r,i){this.#u=n,this.#d=r,this.#i=i,[e,t]=this.#f(e,t);let a=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#t.set([e,t],0);let o=this.#r.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#r.push({line:a,points:this.#o}),this.#e.set(a,0),this.#c=0,this.toSVGPath(),null}getLastElement(){return this.#r.at(-1)}setLastElement(e){return this.#r?(this.#r.push(e),this.#n=e.line,this.#o=e.points,this.#c=0,{path:{d:this.toSVGPath()}}):this.#l.setLastElement(e)}removeLastElement(){if(!this.#r)return this.#l.removeLastElement();this.#r.pop(),this.#s=``;for(let e=0,t=this.#r.length;e<t;e++){let{line:t,points:n}=this.#r[e];this.#n=t,this.#o=n,this.#c=0,this.toSVGPath()}return{path:{d:this.#s}}}#m(){let e=Outline.svgRound(this.#t[0]),t=Outline.svgRound(this.#t[1]);if(this.#o.length===2){let n=Outline.svgRound(this.#n[4]),r=Outline.svgRound(this.#n[5]);return`${this.#s} M ${n} ${r} L ${e} ${t}`}return`${this.#s} L ${e} ${t}`}toSVGPath(){let e=Outline.svgRound(this.#n[4]),t=Outline.svgRound(this.#n[5]);if(this.#o.length===2)return this.#s=`${this.#s} M ${e} ${t} Z`,this.#s;if(this.#o.length<=6){let n=this.#s.lastIndexOf(`M`);this.#s=`${this.#s.slice(0,n)} M ${e} ${t}`,this.#c=6}if(this.#o.length===4){let e=Outline.svgRound(this.#n[10]),t=Outline.svgRound(this.#n[11]);return this.#s=`${this.#s} L ${e} ${t}`,this.#c=12,this.#s}let n=[];this.#c===0&&(n.push(`M ${e} ${t}`),this.#c=6);for(let e=this.#c,t=this.#n.length;e<t;e+=6){let[t,r,i,a,o,s]=this.#n.slice(e,e+6).map(Outline.svgRound);n.push(`C${t} ${r} ${i} ${a} ${o} ${s}`)}return this.#s+=n.join(` `),this.#c=this.#n.length,this.#s}getOutlines(e,t,n,r){let i=this.#r.at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),this.#l.build(this.#r,e,t,n,this.#i,this.#a,r),this.#e=null,this.#n=null,this.#r=null,this.#s=null,this.#l}get defaultSVGProperties(){return{root:{viewBox:`0 0 10000 10000`},rootClass:{draw:!0},bbox:[0,0,1,1]}}},InkDrawOutline=class extends Outline{#e;#t=0;#n;#r;#i;#a;#o;#s;#c;build(e,t,n,r,i,a,o){this.#i=t,this.#a=n,this.#o=r,this.#s=i,this.#c=a,this.#n=o??0,this.#r=e,this.#d()}get thickness(){return this.#c}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#r){if(e.push(`M${Outline.svgRound(t[4])} ${Outline.svgRound(t[5])}`),t.length===6){e.push(`Z`);continue}if(t.length===12&&isNaN(t[6])){e.push(`L${Outline.svgRound(t[10])} ${Outline.svgRound(t[11])}`);continue}for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map(Outline.svgRound);e.push(`C${r} ${i} ${a} ${o} ${s} ${c}`)}}return e.join(``)}serialize([e,t,n,r],i){let a=[],o=[],[s,c,l,u]=this.#u(),d,f,p,m,h,g,_,v,y;switch(this.#s){case 0:y=Outline._rescale,d=e,f=t+r,p=n,m=-r,h=e+s*n,g=t+(1-c-u)*r,_=e+(s+l)*n,v=t+(1-c)*r;break;case 90:y=Outline._rescaleAndSwap,d=e,f=t,p=n,m=r,h=e+c*n,g=t+s*r,_=e+(c+u)*n,v=t+(s+l)*r;break;case 180:y=Outline._rescale,d=e+n,f=t,p=-n,m=r,h=e+(1-s-l)*n,g=t+c*r,_=e+(1-s)*n,v=t+(c+u)*r;break;case 270:y=Outline._rescaleAndSwap,d=e+n,f=t+r,p=-n,m=-r,h=e+(1-c-u)*n,g=t+(1-s-l)*r,_=e+(1-c)*n,v=t+(1-s)*r;break}for(let{line:e,points:t}of this.#r)a.push(y(e,d,f,p,m,i?Array(e.length):null)),o.push(y(t,d,f,p,m,i?Array(t.length):null));return{lines:a,points:o,rect:[h,g,_,v]}}static deserialize(e,t,n,r,i,{paths:{lines:a,points:o},rotation:s,thickness:c}){let l=[],u,d,f,p,m;switch(s){case 0:m=Outline._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=Outline._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=Outline._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=Outline._rescaleAndSwap,u=t/r+1,d=e/n+1,f=-1/r,p=-1/n;break}if(!a){a=[];for(let e of o){let t=e.length;if(t===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(t===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}let n=new Float32Array(3*(t-2));a.push(n);let[r,i,o,s]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,i],0);for(let a=4;a<t;a+=2){let t=e[a],c=e[a+1];n.set(Outline.createBezierPoints(r,i,o,s,t,c),(a-2)*3),[r,i,o,s]=[o,s,t,c]}}}for(let e=0,t=a.length;e<t;e++)l.push({line:m(a[e].map(e=>e??NaN),u,d,f,p),points:m(o[e].map(e=>e??NaN),u,d,f,p)});let h=new this.prototype.constructor;return h.build(l,n,r,1,s,c,i),h}#l(e=this.#c){let t=this.#n+e/2*this.#o;return this.#s%180==0?[t/this.#i,t/this.#a]:[t/this.#a,t/this.#i]}#u(){let[e,t,n,r]=this.#e,[i,a]=this.#l(0);return[e+i,t+a,n-2*i,r-2*a]}#d(){let e=this.#e=F32_BBOX_INIT.slice();for(let{line:t}of this.#r){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)Util.pointBoundingBox(t[n],t[n+1],e);continue}let n=t[4],r=t[5];for(let i=6,a=t.length;i<a;i+=6){let[a,o,s,c,l,u]=t.subarray(i,i+6);Util.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,n]=this.#l();e[0]=MathClamp(e[0]-t,0,1),e[1]=MathClamp(e[1]-n,0,1),e[2]=MathClamp(e[2]+t,0,1),e[3]=MathClamp(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e===`stroke-width`?this.#f(t):null}#f(e){let[t,n]=this.#l();this.#c=e;let[r,i]=this.#l(),[a,o]=[r-t,i-n],s=this.#e;return s[0]-=a,s[1]-=o,s[2]+=2*a,s[3]+=2*o,s}updateParentDimensions([e,t],n){let[r,i]=this.#l();this.#i=e,this.#a=t,this.#o=n;let[a,o]=this.#l(),s=a-r,c=o-i,l=this.#e;return l[0]-=s,l[1]-=c,l[2]+=2*s,l[3]+=2*c,l}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Outline.svgRound).join(` `)}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(e)} ${Outline.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,n=0,r=0,i=0,a=0,o=0,s=0;switch(this.#t){case 90:r=t/e,i=-e/t,o=e;break;case 180:n=-1,a=-1,o=e,s=t;break;case 270:r=-t/e,i=e/t,s=t;break;default:return``}return`matrix(${n} ${r} ${i} ${a} ${Outline.svgRound(o)} ${Outline.svgRound(s)})`}getPathResizingSVGProperties([e,t,n,r]){let[i,a]=this.#l(),[o,s,c,l]=this.#e;if(Math.abs(c-i)<=Outline.PRECISION||Math.abs(l-a)<=Outline.PRECISION){let i=e+n/2-(o+c/2),a=t+r/2-(s+l/2);return{path:{"transform-origin":`${Outline.svgRound(e)} ${Outline.svgRound(t)}`,transform:`${this.rotationTransform} translate(${i} ${a})`}}}let u=(n-2*i)/(c-2*i),d=(r-2*a)/(l-2*a),f=c/n,p=l/r;return{path:{"transform-origin":`${Outline.svgRound(o)} ${Outline.svgRound(s)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${Outline.svgRound(i)} ${Outline.svgRound(a)}) scale(${u} ${d}) translate(${Outline.svgRound(-i)} ${Outline.svgRound(-a)})`}}}getPathResizedSVGProperties([e,t,n,r]){let[i,a]=this.#l(),o=this.#e,[s,c,l,u]=o;if(o[0]=e,o[1]=t,o[2]=n,o[3]=r,Math.abs(l-i)<=Outline.PRECISION||Math.abs(u-a)<=Outline.PRECISION){let i=e+n/2-(s+l/2),a=t+r/2-(c+u/2);for(let{line:e,points:t}of this.#r)Outline._translate(e,i,a,e),Outline._translate(t,i,a,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(e)} ${Outline.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*i)/(l-2*i),f=(r-2*a)/(u-2*a),p=-d*(s+i)+e+i,m=-f*(c+a)+t+a;if(d!==1||f!==1||p!==0||m!==0)for(let{line:e,points:t}of this.#r)Outline._rescale(e,p,m,d,f,e),Outline._rescale(t,p,m,d,f,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(e)} ${Outline.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[r,i]=n,a=this.#e,o=e-a[0],s=t-a[1];if(this.#i===r&&this.#a===i)for(let{line:e,points:t}of this.#r)Outline._translate(e,o,s,e),Outline._translate(t,o,s,t);else{let e=this.#i/r,t=this.#a/i;this.#i=r,this.#a=i;for(let{line:n,points:r}of this.#r)Outline._rescale(n,o,s,e,t,n),Outline._rescale(r,o,s,e,t,r);a[2]*=e,a[3]*=t}return a[0]=e,a[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Outline.svgRound(e)} ${Outline.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Outline.svgRound(e[0])} ${Outline.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},InkDrawingOptions=class e extends DrawingOptions{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:AnnotationEditor._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":10})}updateSVGProperty(e,t){e===`stroke-width`&&(t??=this[`stroke-width`],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},InkEditor=class e extends DrawingEditor{static _type=`ink`;static _editorType=AnnotationEditorType.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:`inkEditor`}),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){AnnotationEditor.initialize(e,t),this._defaultDrawingOptions=new InkDrawingOptions(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return shadow(this,`typesMap`,new Map([[AnnotationEditorParamsType.INK_THICKNESS,`stroke-width`],[AnnotationEditorParamsType.INK_COLOR,`stroke`],[AnnotationEditorParamsType.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance({x:e,y:t,box:[,,n,r],rotation:i}){return new InkDrawOutliner(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return InkDrawOutline.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof InkAnnotationElement){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,opacity:s,borderStyle:{rawWidth:c},popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},parent:{page:{pageNumber:m}}}=e;r=e={annotationType:AnnotationEditorType.INK,color:Array.from(o),thickness:c,opacity:s,paths:{points:t},boxes:null,pageIndex:m-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}get toolbarButtons(){return this._colorPicker||=new BasicColorPicker(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return AnnotationEditorParamsType.INK_COLOR}get colorAndOpacityType(){return AnnotationEditorParamsType.INK_COLOR_AND_OPACITY}get opacityType(){return AnnotationEditorParamsType.INK_OPACITY}updateParams(e,t){if(e===AnnotationEditorParamsType.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(t.color,t.opacity);return}super.updateParams(e,t)}static updateDefaultParams(e,t){if(e===AnnotationEditorParamsType.INK_COLOR_AND_OPACITY){super.updateDefaultParams(AnnotationEditorParamsType.INK_COLOR,t.color),super.updateDefaultParams(AnnotationEditorParamsType.INK_OPACITY,t.opacity);return}super.updateDefaultParams(e,t)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions[`stroke-opacity`]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty(`stroke-width`),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty(`stroke-width`),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:r}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:Util.makeHexColor(...t),"stroke-width":n,"stroke-opacity":r})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":i,"stroke-width":a}}=this,o=Object.assign(super.serialize(e),{color:AnnotationEditor._colorManager.convert(r),opacity:i,thickness:a,paths:{lines:t,points:n}});return this.addComment(o),e?(o.isCopy=!0,o):this.annotationElementId&&!this.#e(o)?null:(o.id=this.annotationElementId,o)}
60#e(e){let{color:t,thickness:n,opacity:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,n)=>e!==t[n])||e.thickness!==n||e.opacity!==r||e.pageIndex!==i}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions[`stroke-width`],points:t,popup:this.comment}),null}},ContourDrawOutline=class extends InkDrawOutline{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}},BASE_HEADER_LENGTH=8,POINTS_PROPERTIES_NUMBER=3,SignatureExtractor=class{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,r){return n-=e,r-=t,n===0?r>0?0:4:n===1?r+6:2-r}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(-i+s-o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#i(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(i+s+o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#a(e,t,n,r){let i=e.length,a=new Int32Array(i);for(let t=0;t<i;t++)a[t]=+(e[t]<=r);for(let e=1;e<n-1;e++)a[e*t]=a[e*t+t-1]=0;for(let e=0;e<t;e++)a[e]=a[t*n-1-e]=0;let o=1,s,c=[];for(let e=1;e<n-1;e++){s=1;for(let n=1;n<t-1;n++){let r=e*t+n,i=a[r];if(i===0)continue;let l=e,u=n;if(i===1&&a[r-1]===0)o+=1,--u;else if(i>=1&&a[r+1]===0)o+=1,u+=1,i>1&&(s=i);else{i!==1&&(s=Math.abs(i));continue}let d=[n,e],f=u===n+1,p={isHole:f,points:d,id:o,parent:0};c.push(p);let m;for(let e of c)if(e.id===s){m=e;break}m?m.isHole?p.parent=f?m.parent:s:p.parent=f?s:m.parent:p.parent=f?s:0;let h=this.#r(a,t,e,n,l,u,0);if(h===-1){a[r]=-o,a[r]!==1&&(s=Math.abs(a[r]));continue}let g=this.#n[2*h],_=this.#n[2*h+1],v=e+g,y=n+_;l=v,u=y;let b=e,x=n;for(;;){let i=this.#i(a,t,b,x,l,u,1);g=this.#n[2*i],_=this.#n[2*i+1];let c=b+g,f=x+_;d.push(f,c);let p=b*t+x;if(a[p+1]===0?a[p]=-o:a[p]===1&&(a[p]=o),c===e&&f===n&&b===v&&x===y){a[r]!==1&&(s=Math.abs(a[r]));break}else l=b,u=x,b=c,x=f}}}return c}static#o(e,t,n,r){if(n-t<=4){for(let i=t;i<n-2;i+=2)r.push(e[i],e[i+1]);return}let i=e[t],a=e[t+1],o=e[n-4]-i,s=e[n-3]-a,c=Math.hypot(o,s),l=o/c,u=s/c,d=l*a-u*i,f=s/o,p=1/c,m=Math.atan(f),h=Math.cos(m),g=Math.sin(m),_=p*(Math.abs(h)+Math.abs(g)),v=p*(1-_+_**2),y=Math.max(Math.atan(Math.abs(g+h)*v),Math.atan(Math.abs(g-h)*v)),b=0,x=t;for(let r=t+2;r<n-2;r+=2){let t=Math.abs(d-l*e[r+1]+u*e[r]);t>b&&(x=r,b=t)}b>(c*y)**2?(this.#o(e,t,x+2,r),this.#o(e,x,n,r)):r.push(i,a)}static#s(e){let t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,r,i,a){let o=new Float32Array(a**2),s=-2*r**2,c=a>>1;for(let e=0;e<a;e++){let t=(e-c)**2;for(let n=0;n<a;n++)o[e*a+n]=Math.exp((t+(n-c)**2)/s)}let l=new Float32Array(256),u=-2*i**2;for(let e=0;e<256;e++)l[e]=Math.exp(e**2/u);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let s=r*t+i,u=e[s],d=0,m=0;for(let s=0;s<a;s++){let f=r+s-c;if(!(f<0||f>=n))for(let n=0;n<a;n++){let r=i+n-c;if(r<0||r>=t)continue;let p=e[f*t+r],h=o[s*a+n]*l[Math.abs(p-u)];d+=p*h,m+=h}}let h=f[s]=Math.round(d/m);p[h]++}return[f,p]}static#l(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}static#u(e){let t=e.length,n=new Uint8ClampedArray(t>>2),r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t]=e[t<<2];r=Math.max(r,a),i=Math.min(i,a)}let a=255/(r-i);for(let e=0,t=n.length;e<t;e++)n[e]=(n[e]-i)*a;return n}static#d(e){let t,n=-1/0,r=-1/0,i=e.findIndex(e=>e!==0),a=i,o=i;for(t=i;t<256;t++){let i=e[t];i>n&&(t-a>r&&(r=t-a,o=t-1),n=i,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){let t=e,{width:n,height:r}=e,{maxDim:i}=this.#e,a=n,o=r;if(n>i||r>i){let s=n,c=r,l=Math.log2(Math.max(n,r)/i),u=Math.floor(l);l=l===u?u-1:u;for(let n=0;n<l;n++){a=Math.ceil(s/2),o=Math.ceil(c/2);let n=new OffscreenCanvas(a,o);n.getContext(`2d`).drawImage(e,0,0,s,c,0,0,a,o),s=a,c=o,e!==t&&e.close(),e=n.transferToImageBitmap()}let d=Math.min(i/a,i/o);a=Math.round(a*d),o=Math.round(o*d)}let s=new OffscreenCanvas(a,o).getContext(`2d`,{willReadFrequently:!0});s.fillStyle=`white`,s.fillRect(0,0,a,o),s.filter=`grayscale(1)`,s.drawImage(e,0,0,e.width,e.height,0,0,a,o);let c=s.getImageData(0,0,a,o).data;return[this.#u(c),a,o]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:r},i,a,o,s){let c=new OffscreenCanvas(1,1),l=c.getContext(`2d`,{alpha:!1}),u=200,d=l.font=`${n} ${r} 200px ${t}`,{actualBoundingBoxLeft:f,actualBoundingBoxRight:p,actualBoundingBoxAscent:m,actualBoundingBoxDescent:h,fontBoundingBoxAscent:g,fontBoundingBoxDescent:_,width:v}=l.measureText(e),y=1.5,b=Math.ceil(Math.max(Math.abs(f)+Math.abs(p)||0,v)*y),x=Math.ceil(Math.max(Math.abs(m)+Math.abs(h)||200,Math.abs(g)+Math.abs(_)||200)*y);c=new OffscreenCanvas(b,x),l=c.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),l.font=d,l.filter=`grayscale(1)`,l.fillStyle=`white`,l.fillRect(0,0,b,x),l.fillStyle=`black`,l.fillText(e,b*(y-1)/2,x*(3-y)/2);let S=this.#u(l.getImageData(0,0,b,x).data),C=this.#l(S),w=this.#d(C),T=this.#a(S,b,x,w);return this.processDrawnLines({lines:{curves:T,width:b,height:x},pageWidth:i,pageHeight:a,rotation:o,innerMargin:s,mustSmooth:!0,areContours:!0})}static process(e,t,n,r,i){let[a,o,s]=this.#f(e),[c,l]=this.#c(a,o,s,Math.hypot(o,s)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),u=this.#d(l),d=this.#a(c,o,s,u);return this.processDrawnLines({lines:{curves:d,width:o,height:s},pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:a,areContours:o}){r%180!=0&&([t,n]=[n,t]);let{curves:s,width:c,height:l}=e,u=e.thickness??0,d=[],f=Math.min(t/c,n/l),p=f/t,m=f/n,h=[];for(let{points:e}of s){let t=a?this.#s(e):e;if(!t)continue;h.push(t);let n=t.length,r=new Float32Array(n),i=new Float32Array(3*(n===2?2:n-2));if(d.push({line:i,points:r}),n===2){r[0]=t[0]*p,r[1]=t[1]*m,i.set([NaN,NaN,NaN,NaN,r[0],r[1]],0
60);continue}let[o,s,c,l]=t;o*=p,s*=m,c*=p,l*=m,r.set([o,s,c,l],0),i.set([NaN,NaN,NaN,NaN,o,s],0);for(let e=4;e<n;e+=2){let n=r[e]=t[e]*p,a=r[e+1]=t[e+1]*m;i.set(Outline.createBezierPoints(o,s,c,l,n,a),(e-2)*3),[o,s,c,l]=[c,l,n,a]}}if(d.length===0)return null;let g=o?new ContourDrawOutline:new InkDrawOutline;return g.build(d,t,n,1,r,o?0:u,i),{outline:g,newCurves:h,areContours:o,thickness:u,width:c,height:l}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:r,height:i}){let a=1/0,o=-1/0,s=0;for(let t of e){s+=t.length;for(let e=2,n=t.length;e<n;e++){let n=t[e]-t[e-2];a=Math.min(a,n),o=Math.max(o,n)}}let c;c=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let l=e.length,u=BASE_HEADER_LENGTH+POINTS_PROPERTIES_NUMBER*l,d=new Uint32Array(u),f=0;d[f++]=u*Uint32Array.BYTES_PER_ELEMENT+(s-2*l)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=r,d[f++]=i,d[f++]=+!t,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=l,d[f++]=c.BYTES_PER_ELEMENT;for(let t of e)d[f++]=t.length-2,d[f++]=t[0],d[f++]=t[1];let p=new CompressionStream(`deflate-raw`),m=p.writable.getWriter();await m.ready,m.write(d);let h=c.prototype.constructor;for(let t of e){let e=new h(t.length-2);for(let n=2,r=t.length;n<r;n++)e[n-2]=t[n]-t[n-2];m.write(e)}return m.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:n,writable:r}=new DecompressionStream(`deflate-raw`),i=r.getWriter();await i.ready,i.write(t).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let a=null,o=0;for await(let e of n)a||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]),a.set(e,o),o+=e.length;let s=new Uint32Array(a.buffer,0,a.length>>2),c=s[1];if(c!==0)throw Error(`Invalid version: ${c}`);let l=s[2],u=s[3],d=s[4]===0,f=s[5],p=s[6],m=s[7],h=[],g=(BASE_HEADER_LENGTH+POINTS_PROPERTIES_NUMBER*p)*Uint32Array.BYTES_PER_ELEMENT,_;switch(m){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,g);break}o=0;for(let e=0;e<p;e++){let t=s[POINTS_PROPERTIES_NUMBER*e+BASE_HEADER_LENGTH],n=new Float32Array(t+2);h.push(n);for(let t=0;t<POINTS_PROPERTIES_NUMBER-1;t++)n[t]=s[POINTS_PROPERTIES_NUMBER*e+BASE_HEADER_LENGTH+t+1];for(let e=0;e<t;e++)n[e+2]=n[e]+_[o++]}return{areContours:d,thickness:f,outlines:h,width:l,height:u}}catch(e){return warn(`decompressSignature: ${e}`),null}}},SignatureOptions=class e extends DrawingOptions{constructor(){super(),super.updateProperties({fill:AnnotationEditor._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},DrawnSignatureOptions=class e extends InkDrawingOptions{constructor(e){super(e),super.updateProperties({stroke:AnnotationEditor._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},SignatureEditor=class e extends DrawingEditor{#e=!1;#t=null;#n=null;#r=null;static _type=`signature`;static _editorType=AnnotationEditorType.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:`signatureEditor`}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId=`pdfjs-editor-signature-editor1`}static initialize(e,t){AnnotationEditor.initialize(e,t),this._defaultDrawingOptions=new SignatureOptions,this._defaultDrawnSignatureOptions=new DrawnSignatureOptions(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return shadow(this,`typesMap`,new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:`signature`,hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let t=e.get(`hasDescription`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n,{_isCopy:r}=this;if(r&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null)if(this.#n){let{lines:t,mustSmooth:n,areContours:r,description:i,uuid:a,heightInPage:o}=this.#n,{rawDims:{pageWidth:s,pageHeight:c},rotation:l}=this.parent.viewport,u=SignatureExtractor.processDrawnLines({lines:t,pageWidth:s,pageHeight:c,rotation:l,innerMargin:e._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(u,o,i,a)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:``})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:this.#t||``}));return r&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}
vendor: 4,560 bytes, line 60
60=this.#n,a=Math.max(r,i);return{areContours:t,outline:SignatureExtractor.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:a,y:o}=this,{outline:s}=this.#n=t;this.#e=s instanceof ContourDrawOutline,this.description=r;let c;this.#e?c=e.getDefaultDrawingOptions():(c=e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":s.thickness})),this._addOutlines({drawOutlines:s,drawingOptions:c});let[,l]=this.pageDimensions,u=n/l;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return SignatureExtractor.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return SignatureExtractor.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return SignatureExtractor.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=this.#r,i.isCopy=!0):i.lines=t,this.#t&&(i.accessibilityData={type:`Figure`,alt:this.#t}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?ContourDrawOutline.deserialize(e,t,n,r,i,a):InkDrawOutline.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=await super.deserialize(e,t,n);return r.#e=e.areContours,r.description=e.accessibilityData?.alt||``,r.#r=e.uuid,r}},StampEditor=class extends AnnotationEditor{#e=null;#t=null;#n=null;#r=null;#i=null;#a=``;#o=null;#s=!1;#c=null;#l=!1;#u=!1;static _type=`stamp`;static _editorType=AnnotationEditorType.STAMP;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){AnnotationEditor.initialize(e,t)}static isHandlingMimeForPasting(e){return SupportedImageMimeTypes.includes(e)}static paste(e,t){t.pasteEditor({mode:AnnotationEditorType.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:`stamp`,hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get(`hasAltText`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#d(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:`pdfjs.image.image_added`,data:{alt_text_modal:!1,alt_text_type:`empty`}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);
60if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#p(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#d(e,!0)).finally(()=>this.#f());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#d(e)).finally(()=>this.#f());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#d(e)).finally(()=>this.#f());return}let e=document.createElement(`input`);e.type=`file`,e.accept=SupportedImageMimeTypes.join(`,`);let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(t)}n()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&=(clearTimeout(this.#c),null)),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#p();return}super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#s)}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#s||(this.#e?this.#m():this.#p()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,r&&(this.#e=r),this.#s=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#c!==null&&clearTimeout(this.#c);let e=200;this.#c=setTimeout(()=>{this.#c=null,this.#g()},200)}#m(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}this._uiManager.enableWaiting(!1);let o=this.#o=document.createElement(`canvas`);o.setAttribute(`role`,`img`),this.addContainer(o),this.width=t/r,this.height=n/i,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#g(),this.#u||=(this.parent.addUndoableEditor(this),!0),this._reportTelemetry({action:`inserted_image`}),this.#a&&this.div.setAttribute(`aria-description`,this.#a),this.annotationElementId||this._uiManager.a11yAlert(AnnotationEditor._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new OutputScale,o=this.#e,s=r,c=i,l=null;if(t){if(r>t||i>t){let e=Math.min(t/r,t/i);s=Math.floor(r*e),c=Math.floor(i*e)}l=document.createElement(`canvas`);let e=l.width=Math.ceil(s*a.sx),n=l.height=Math.ceil(c*a.sy);this.#l||(o=this.#h(e,n));let u=l.getContext(`2d`);u.filter=this._uiManager.hcmFilter;let d=`white`,f=`#cfcfd8`;this._uiManager.hcmFilter===`none`?ColorScheme.isDarkMode&&(d=`#8f8f9d`,f=`#42414d`):f=`black`;let p=15,m=15*a.sx,h=15*a.sy,g=new OffscreenCanvas(m*2,h*2),_=g.getContext(`2d`);_.fillStyle=d,_.fillRect(0,0,m*2,h*2),_.fillStyle=f,_.fillRect(0,0,m,h),_.fillRect(m,h,m,h),u.fillStyle=u.createPattern(g,`repeat`),u.fillRect(0,0,e,n),u.drawImage(o,0,0,o.width,o.height,0,0,e,n)}let u=null;if(n){let t,n;if(a.symmetric&&o.width<e&&o.height<e)t=o.width,n=o.height;else if(o=this.#e,r>e||i>e){let a=Math.min(e/r,e/i);
vendor: 4,392 bytes, line 60
60t=Math.floor(r*a),n=Math.floor(i*a),this.#l||(o=this.#h(t,n))}let s=new OffscreenCanvas(t,n).getContext(`2d`,{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,n),u={width:t,height:n,data:s.getImageData(0,0,t,n).data}}return{canvas:l,width:s,height:c,imageData:u}}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=Math.ceil(i/2)),a>2*t&&(a=Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(){let[e,t]=this.parentDimensions,{width:n,height:r}=this,i=new OutputScale,a=Math.ceil(n*e*i.sx),o=Math.ceil(r*t*i.sy),s=this.#o;if(!s||s.width===a&&s.height===o)return;s.width=a,s.height=o;let c=this.#l?this.#e:this.#h(a,o),l=s.getContext(`2d`);l.filter=this._uiManager.hcmFilter,l.drawImage(c,0,0,c.width,c.height,0,0,a,o)}#_(e){if(e){if(this.#l){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#l){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*PixelsPerInch.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*PixelsPerInch.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let r=null,i=!1;if(e instanceof StampAnnotationElement){let{data:{rect:a,rotation:o,id:s,structParent:c,popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},container:m,parent:{page:{pageNumber:h}},canvas:g}=e,_,v;g?(delete e.canvas,{id:_,bitmap:v}=n.imageManager.getFromCanvas(m.id,g),g.remove()):(i=!0,e._hasNoCanvas=!0);let y=(await t._structTree.getAriaAttributes(`${AnnotationPrefix}${s}`))?.get(`aria-label`)||``;r=e={annotationType:AnnotationEditorType.STAMP,bitmapId:_,bitmap:v,pageIndex:h-1,rect:a.slice(0),rotation:o,annotationElementId:s,id:s,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:c,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let a=await super.deserialize(e,t,n),{rect:o,bitmap:s,bitmapUrl:c,bitmapId:l,isSvg:u,accessibilityData:d}=e;i?(n.addMissingCanvas(e.id,a),a.#s=!0):l&&n.imageManager.isValidId(l)?(a.#t=l,s&&(a.#e=s)):a.#r=c,a.#l=u;let[f,p]=a.pageDimensions;return a.width=(o[2]-o[0])/f,a.height=(o[3]-o[1])/p,d&&(a.altTextData=d),a._initialData=r,e.comment&&a.setCommentData(e),a.#u=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#l});if(this.addComment(n),e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:r,altText:i}=this.serializeAltText(!1);if(!r&&i&&(n.accessibilityData={type:`Figure`,alt:i}),this.annotationElementId){let e=this.#v(n);return e.isSame?null:(e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;let a=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:a,serialized:n}),n.bitmap=this.#_(!1);else if(this.#l){let e=t.stamps.get(this.#t);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}#v(e){let{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,i=(e.accessibilityData?.alt||``)===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&i,isSameAltText:i}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},AnnotationEditorLayer=class e{#e;#t=!1;#n=null;#r=null;#i=null;#a=new Map;#o=!1;#s=!1;#c=!1;#l=null;#u=null;#d=null;#f=null;#p=null;#m=-1;#h;static _initialized=!1;static#g=new Map([FreeTextEditor,InkEditor,StampEditor,HighlightEditor,SignatureEditor].map(e=>[e._editorType,e]));constructor({uiManager:t,pageIndex:n,div:r,structTreeLayer:i,accessibilityManager:a,annotationLayer:o,drawLayer:s,textLayer:c,viewport:l,l10n:u}){let d=[...e.#g.values()];if(!e._initialized){e._initialized=!0;for(let e of d)e.initialize(u,t)}
60t.registerEditorTypes(d),this.#h=t,this.pageIndex=n,this.div=r,this.#e=a,this.#n=o,this.viewport=l,this.#d=c,this.drawLayer=s,this._structTree=i,this.#h.addLayer(this)}get isEmpty(){return this.#a.size===0}get isInvisible(){return this.isEmpty&&this.#h.getMode()===AnnotationEditorType.NONE}updateToolbar(e){this.#h.updateToolbar(e)}updateMode(t=this.#h.getMode()){switch(this.#S(),t){case AnnotationEditorType.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case AnnotationEditorType.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle(`nonEditing`,!1),t===AnnotationEditorType.POPUP)n.toggle(`commentEditing`,!0);else{n.toggle(`commentEditing`,!1);for(let r of e.#g.values())n.toggle(`${r._type}Editing`,t===r._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#d?.div}setEditingState(e){this.#h.setEditingState(e)}addCommands(e){this.#h.addCommands(e)}cleanUndoStack(e){this.#h.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle(`drawing`,!e)}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#_(){return this.#a.size===0?this.#h.getEditors(this.pageIndex):this.#a.values()}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle(`nonEditing`,!1),this.#p?.abort(),this.#p=null;let e=new Set;for(let t of this.#_)t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#h.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));let t=this.#n;if(t)for(let n of t.getEditableAnnotations()){if(n.hide(),this.#h.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#c=!1,this.#h._eventBus.dispatch(`editorsrendered`,{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#s=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle(`nonEditing`,!0),this.#d&&!this.#p){this.#p=new AbortController;let e=this.#h.combinedSignal(this.#p);this.#d.div.addEventListener(`pointerdown`,e=>{let t=500,{clientX:n,clientY:r,timeStamp:i}=e;if(i-this.#m>500){this.#m=i;return}this.#m=-1;let{classList:a}=this.div;a.toggle(`getElements`,!0);let o=document.elementsFromPoint(n,r);if(a.toggle(`getElements`,!1),!this.div.contains(o[0]))return;let s,c=RegExp(`^${AnnotationEditorPrefix}[0-9]+$`);for(let e of o)if(c.test(e.id)){s=e.id;break}if(!s)return;let l=this.#a.get(s);l?.annotationElementId===null&&(stopEvent(e),l.dblclick(e))},{signal:e,capture:!0})}let t=this.#n,n=[];if(t){let e=new Map,r=new Map;for(let t of this.#_){if(t.disableEditing(),!t.annotationElementId){n.push(t);continue}if(t.serialize()!==null){e.set(t.annotationElementId,t);continue}else r.set(t.annotationElementId,t);this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()}for(let n of t.getEditableAnnotations()){let{id:t}=n.data;if(this.#h.isDeletedAnnotationElement(t)){n.updateEdited({deleted:!0});continue}let i=r.get(t);if(i){i.resetAnnotationElement(n),i.show(!1),n.show();continue}i=e.get(t),i&&(this.#h.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show()}}this.#S(),this.isEmpty&&(this.div.hidden=!0);let{classList:r}=this.div;for(let t of e.#g.values())r.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(n),this.#s=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#h.getActive()!==e&&this.#h.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#f){this.#f=new AbortController;let e=this.#h.combinedSignal(this.#f);this.#d.div.addEventListener(`pointerdown`,this.#v.bind(this),{signal:e}),this.#d.div.classList.add(`highlighting`)}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#d.div.classList.remove(`highlighting`))}#v(e){this.#h.unselectAll();let{target:t}=e;if(t===this.#d.div||(t.getAttribute(`role`)===`img`||t.classList.contains(`endOfContent`)||t.classList.contains(`textLayerImages`)||t.classList.contains(`textLayerImagePlaceholder`))&&this.#d.div.contains(t)){let{isMac:t}=FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t)return;this.#h.showAllEditors(`highlight`,!0,!0),HighlightEditor.startDrawing(this,this.#h,this.#h.direction===`ltr`,e),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;let e=this.#h.combinedSignal(this.#r);this.div.addEventListener(`pointerdown`,this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener(`pointerup`,t,{signal:e}),this.div.addEventListener(`pointercancel`,t,{signal:e})}disableClick(){this.#r?.abort(),this.#r=null}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#h.isDeletedAnnotationElement(t)&&this.#h.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#s&&e.annotationElementId&&this.#h.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#h.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#h.addDeletedAnnotationElement(e),AnnotationEditor.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}
60add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#h.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#h.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#h._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(let t of this.#a.values())if(t.uid===e)return t;return null}get#y(){return e.#g.get(this.#h.getMode())}combinedSignal(e){return this.#h.combinedSignal(e)}#b(e){let t=this.#y;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#h.updateMode(e.mode);let{offsetX:n,offsetY:r}=this.#x(),i=this.#h.getId(),a=this.#b({parent:this,id:i,x:n,y:r,uiManager:this.#h,isCentered:!0,...t});a&&this.add(a)}async deserialize(t){return await e.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#h)||null}createAndAddNewEditor(e,t,n={}){let r=this.#h.getId(),i=this.#b({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#h,isCentered:t,...n});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#h.setSelected(e)}toggleSelected(e){this.#h.toggleSelected(e)}unselect(e){this.#h.unselect(e)}pointerup(e){let{isMac:t}=FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}let n=this.#h.getMode();if(n===AnnotationEditorType.STAMP||n===AnnotationEditorType.POPUP||n===AnnotationEditorType.SIGNATURE){this.#h.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#h.getMode()===AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:t}=FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let n=this.#h.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#h,!1,e);return}this.#h.setCurrentDrawingSession(this),this.#l=new AbortController;let t=this.#h.combinedSignal(this.#l);this.div.addEventListener(`blur`,({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#y.startDrawing(this,this.#h,!1,e)}pause(e){if(e){let{activeElement:e}=document;this.div.contains(e)&&(this.#u=e);return}this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#l?(this.#h.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#u=null,this.#y.endDrawing(e)):null}findNewParent(e,t,n){let r=this.#h.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#h.getActive()?.parent===this&&(this.#h.commitOrRemove(),this.#h.setActiveEditor(null)),this.#i&&=(clearTimeout(this.#i),null);for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#h.removeLayer(this)}#S(){for(let e of this.#a.values())e.isEmpty()&&e.remove()}async render({viewport:e}){this.viewport=e,setLayerDimensions(this.div,e);for(let e of this.#h.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#h.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#h.commitOrRemove(),this.#S();let t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,setLayerDimensions(this.div,{rotation:n}),t!==n)for(let e of this.#a.values())e.rotate(n)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#h.viewParameters.realScale}};function compareTextLayers(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function getTextLayer(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(`.textLayer`):e.parentElement?.closest(`.textLayer`)||null:null}function isPointBefore(e,t,n,r){if(e===n)return t<=r;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}
60function normalizeEdgeBoundary(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains(`textLayer`)||t!==e.childNodes.length)return{container:e,offset:t};let r=e.lastChild;return r?.nodeType===Node.ELEMENT_NODE&&r.classList.contains(`endOfContent`)&&(r=r.previousSibling),!r||!n.contains(r)?null:r.nodeType===Node.TEXT_NODE?{container:r,offset:r.textContent.length}:{container:r,offset:r.childNodes.length}}var DrawLayer=class e{#e=null;#t=new Map;#n=null;#r=null;#i=null;#a=null;#o=new Map;static#s=0;static#c=0;static#l=null;static#u=new Set;static#d=!1;static#f=new Set;static#p=new WeakMap;constructor({filterFactory:t=null,pageColors:n=null,pageIndex:r,textLayer:i=null}){if(this.pageIndex=r,this.#r=t,this.#i=n,i){let t=e.#p.get(i);if(t?.selectionDiv&&(t.selectionDiv.remove(),e.#u.delete(t.selectionDiv)),e.#p.set(i,{drawLayer:this}),e.#f.add(i),this.#n=i,this.#a=new MutationObserver(t=>{if(!(!this.#e||!this.#n?.isConnected||!e.#h())){for(let{addedNodes:n}of t)for(let t of n)if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){e.#_();return}}}),this.#a.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:t}=e.#l;document.addEventListener(`selectionchange`,e.#_.bind(e),{signal:t}),document.addEventListener(`pointerdown`,()=>{e.#d=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{e.#d=!1},{signal:t}),window.addEventListener(`blur`,()=>{e.#d=!1},{signal:t})}}}setParent(t){if(!this.#e){this.#e=t,this.#n?.isConnected&&e.#h()&&e.#_();return}if(this.#e!==t){if(this.#t.size>0)for(let e of this.#t.values())e.remove(),t.append(e);this.#e=t}}static#m(e){let t=this.#p.get(e);t?.selectionDiv&&(t.selectionDiv.remove(),this.#u.delete(t.selectionDiv),t.selectionDiv=null,t.path=null)}static#h(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#g(){return this.#f.keys().filter(e=>e.isConnected).toArray().sort(compareTextLayers)}static#_(){let t=document.getSelection();if(!t||t.isCollapsed){for(let e of this.#u)e.remove();this.#u.clear();return}let n=new WeakMap,r=this.#g(),i=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(n.collapsed)continue;let{startContainer:a,startOffset:o,endContainer:s,endOffset:c}=n,l=getTextLayer(a),u=getTextLayer(s),d=l===null,f=u===null;if(this.#d&&d!==f)return;if(t.rangeCount===1){let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:i}=t,d=getTextLayer(e),f=getTextLayer(r),p=isPointBefore(e,n,r,i);d&&f&&p!==null&&(p?(a=e,o=n,l=d,s=r,c=i,u=f):(a=r,o=i,l=f,s=e,c=n,u=d))}let p=r.filter(e=>n.intersectsNode(e));if(p.length===0)continue;let m=!1;if(l||(l=p[0],a=l,o=0,m=!0),u||(u=p.at(-1),s=u,c=u.childNodes.length,m=!0),s.nodeType===Node.ELEMENT_NODE){if(s.classList.contains(`endOfContent`)){let e=s.previousSibling;if(!e)continue;s=e,c=e.nodeType===Node.TEXT_NODE?e.textContent.length:e.childNodes.length}else if(s.classList.contains(`textLayer`)&&s.childNodes.length===c){let e=normalizeEdgeBoundary(s,c,u);if(!e)continue;s=e.container,c=e.offset}}if(a.nodeType===Node.ELEMENT_NODE){let e=normalizeEdgeBoundary(a,o,l);if(!e)continue;a=e.container,o=e.offset}if(l===u&&!m&&p.includes(l)){i.push([n,l]);continue}for(let e of p){let t=e.firstChild;if(!t)continue;let n=document.createRange();if(e===l?n.setStart(a,o):n.setStartBefore(t),e===u)n.setEnd(s,c);else{let t=e.lastChild;if(!t)continue;if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){let e=t.previousSibling;if(!e)continue;n.setEndAfter(e)}else n.setEndAfter(t)}n.collapsed||i.push([n,e])}}let a=new Set(i.map(e=>e[1]));for(let e of this.#f)a.has(e)||this.#m(e);for(let[t,r]of i){let i=e.#p.get(r);if(!i)continue;let a=n.get(r);if(!a){let e=r.getBoundingClientRect();a=(t,n,r,i)=>({x:(t-e.x)/e.width,y:(n-e.y)/e.height,width:r/e.width,height:i/e.height}),n.set(r,a)}let o=[];for(let{x:e,y:n,width:r,height:i}of t.getClientRects())r===0||i===0||({x:e,y:n,width:r,height:i}=a(e,n,r,i),!(r===1&&i===1)&&o.push(`M${e} ${n} h${r} v${i} h-${r} Z`));if(o.length===0)continue;let s=i.drawLayer,c=i.selectionDiv,l=i.path;if(!c){let t=`clip_selection_${e.#c++}`;c=document.createElement(`div`),c.className=`selection`,c.style.clipPath=`url(#${t})`;let n=s.#r?.createSelectionStyle(s.#i);if(n)for(let[e,t]of Object.entries(n))c.style.setProperty(e,t);let r=e._svgFactory.create(1,1,!0);r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`);let a=e._svgFactory.createElement(`clipPath`);a.setAttribute(`id`,t),a.setAttribute(`clipPathUnits`,`objectBoundingBox`),l=e._svgFactory.createElement(`path`),a.append(l),r.append(a),c.append(r),i.path=l,i.selectionDiv=c}s.#e&&c.parentNode!==s.#e&&(s.#e.append(c),this.#u.add(c)),l.setAttribute(`d`,o.join(` `))}}static get _svgFactory(){return shadow(this,`_svgFactory`,new DOMSVGFactory)}static#v(e,[t,n,r,i]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*r}%`,a.height=`${100*i}%`}#y(){let t=e._svgFactory.create(1,1,!0);return this.#e.append(t),t.setAttribute(`aria-hidden`,`true`),t}#b(t,n){let r=e._svgFactory.createElement(`clipPath`);t.append(r);let i=`clip_${n}`;r.setAttribute(`id`,i),r.setAttribute(`clipPathUnits`,`objectBoundingBox`);let a=e._svgFactory.createElement(`use`);return r.append(a),a.setAttribute(`href`,`#${n}`),a.classList.add(`clip`),i}#x(e,t){for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)}draw(t,n=!1,r=!1){let i=e.#s++,a=this.#y(),o=e._svgFactory.createElement(`defs`);a.append(o);let s=e._svgFactory.createElement(`path`);o.append(s);let c=`path_${i}`;s.setAttribute(`id`,c),s.setAttribute(`vector-effect`,`non-scaling-stroke`),n&&this.#o.set(i,s);let l=r?this.#b(o,c):null,u=e._svgFactory.createElement(`use`);return a.append(u),u.setAttribute(`href`,`#${c}`),this.updateProperties(a,t),this.#t.set(i,a),{id:i,clipPathId:`url(#${l})`}}drawOutline(t,n){let r=e.#s++,i=this.#y(),a=e._svgFactory.createElement(`defs`);i.append(a);let o=e._svgFactory.createElement(`path`);a.append(o);let s=`path_${r}`;o.setAttribute(`id`,s),o.setAttribute(`vector-effect`,`non-scaling-stroke`);let c;if(n){let t=e._svgFactory.createElement(`mask`);a.append(t),c=`mask_${r}`,t.setAttribute(`id`,c),t.setAttribute(`maskUnits`,`objectBoundingBox`);let n=e._svgFactory.createElement(`rect`);t.append(n),n.setAttribute(`width`,`1`),n.setAttribute(`height`,`1`),n.setAttribute(`fill`,`white`);let i=e._svgFactory.createElement(`use`);t.append(i),i.setAttribute(`href`,`#${s}`),i.setAttribute(`stroke`,`none`),i.setAttribute(`fill`,`black`),i.setAttribute(`fill-rule`,`nonzero`),i.classList.add(`mask`)}let l=e._svgFactory.createElement(`use`);i.append(l),l.setAttribute(`href`,`#${s}`),c&&l.setAttribute(`mask`,`url(#${c})`);let u=l.cloneNode();return i.append(u),l.classList.add(`mainOutline`),u.classList.add(`secondaryOutline`),this.updateProperties(i,t),this.#t.set(r,i),r}finalizeDraw(e,t){this.#o.delete(e),this.updateProperties(e,t)}updateProperties(t,n){if(!n)return;let{root:r,bbox:i,rootClass:a,path:o}=n,s=typeof t==`number`?this.#t.get(t):t;if(s){if(r&&this.#x(s,r),i&&e.#v(s,i),a){let{classList:e}=s;for(let[t,n]of Object.entries(a))e.toggle(t,n)}if(o){let e=s.firstElementChild.firstElementChild;this.#x(e,o)}}}updateParent(e,t){if(t===this)return;let n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#o.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();this.#t.clear(),this.#o.clear(),this.#a?.disconnect(),this.#a=null,this.#n&&=(e.#p.get(this.#n)?.drawLayer===this&&(e.#m(this.#n),e.#p.delete(this.#n),e.#f.delete(this.#n),e.#f.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),null)}};function percentage(e){return`${(e*100).toFixed(2)}%`}var TextLayerImages=class e{#e=[];#t=new Map;#n=null;#r=0;#i=0;#a=0;static#o=null;constructor(e,t,n,r){this.#r=e,this.#e=t,this.#i=n.rawDims.pageWidth,this.#a=n.rawDims.pageHeight,this.#n=r}render(){let t=document.createElement(`div`);t.className=`textLayerImages`;for(let e=0;e<this.#e.length;e+=6){let n=this.#s(this.#e.subarray(e,e+6));n&&t.append(n)}return t.addEventListener(`contextmenu`,t=>{if(!(t.target instanceof HTMLCanvasElement))return;let n=t.target,r=this.#t.get(n);if(!r)return;let i=e.#o?.deref();if(i===n)return;i&&(i.width=0,i.height=0),e.#o=new WeakRef(n);let{inverseTransform:a,x1:o,y1:s,width:c,height:l}=r,u=this.#n(),d=Math.ceil(o*u.width),f=Math.ceil(s*u.height),p=Math.floor((o+c/this.#i)*u.width),m=Math.floor((s+l/this.#a)*u.height);n.width=p-d,n.height=m-f;let h=n.getContext(`2d`);h.setTransform(...a),h.translate(-d,-f),h.drawImage(u,0,0)}),t}#s([e,t,n,r,i,a]){let o=Math.hypot((i-e)*this.#i,(a-t)*this.#a),s=Math.hypot((n-e)*this.#i,(r-t)*this.#a);if(o<this.#r||s<this.#r)return null;
60let c=[(i-e)*this.#i/o,(a-t)*this.#a/o,(n-e)*this.#i/s,(r-t)*this.#a/s,0,0],l=Util.inverseTransform(c),u=document.createElement(`canvas`);return u.className=`textLayerImagePlaceholder`,u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:`absolute`,left:percentage(e),top:percentage(t),width:percentage(o/this.#i),height:percentage(s/this.#a),transformOrigin:`0% 0%`,transform:`matrix(${c.join(`,`)})`}),this.#t.set(u,{inverseTransform:l,width:o,height:s,x1:e,y1:t}),u}};globalThis._pdfjsTestingUtils={HighlightOutliner},globalThis.pdfjsLib={AbortException,AnnotationEditorLayer,AnnotationEditorParamsType,AnnotationEditorType,AnnotationEditorUIManager,AnnotationLayer,AnnotationMode,AnnotationType,applyOpacity,build,ColorPicker,createValidAbsoluteUrl,CSSConstants,DOMSVGFactory,DrawLayer,FeatureTest,fetchData,findContrastColor,getDocument,getFilenameFromUrl,getPdfFilenameFromUrl,getRGB,getRGBA,getUuid,GlobalWorkerOptions,ImageKind,InvalidPDFException,isDataScheme,isPdfFile,isValidExplicitDest,makeArr,makeMap,makeObj,makeSet,MathClamp,noContextMenu,normalizeUnicode,OPS,OutputScale,PasswordException,PasswordResponses,PDFDataRangeTransport,PDFDateString,PDFWorker,PermissionFlag,PixelsPerInch,RenderingCancelledException,renderRichText,ResponseException,setLayerDimensions,shadow,SignatureExtractor,stopEvent,SupportedImageMimeTypes,TextLayer,TextLayerImages,TouchManager,updateUrlHash,Util,VerbosityLevel,version,XfaLayer};var require_attachment_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(e){var n=e.files,i=r.useRef(),a=r.useContext(t.LocalizationContext).l10n,o=r.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,s=r.useRef([]),c=a&&a.attachment?a.attachment.clickToDownload:`Click to download`,l=function(e){var t=i.current,n=[].slice.call(t.getElementsByClassName(`rpv-attachment__item`));if(n.length!==0){n.forEach((function(e){return e.setAttribute(`tabindex`,`-1`)}));var r=document.activeElement,a=n[Math.min(n.length-1,Math.max(0,e(n,r)))];a.setAttribute(`tabindex`,`0`),a.focus()}};return t.useIsomorphicLayoutEffect((function(){var e=i.current;if(e){var t=[].slice.call(e.getElementsByClassName(`rpv-attachment__item`));if(s.current=t,t.length>0){var n=t[0];n.focus(),n.setAttribute(`tabindex`,`0`)}}}),[]),r.createElement(`div`,{"data-testid":`attachment__list`,className:t.classNames({"rpv-attachment__list":!0,"rpv-attachment__list--rtl":o}),ref:i,tabIndex:-1,onKeyDown:function(e){switch(e.key){case`ArrowDown`:e.preventDefault(),l((function(e,t){return e.indexOf(t)+1}));break;case`ArrowUp`:e.preventDefault(),l((function(e,t){return e.indexOf(t)-1}));break;case`End`:e.preventDefault(),l((function(e,t){return e.length-1}));break;case`Home`:e.preventDefault(),l((function(e,t){return 0}))}}},n.map((function(e){return r.createElement(`button`,{className:`rpv-attachment__item`,key:e.fileName,tabIndex:-1,title:c,type:`button`,onClick:function(){t=e.fileName,n=e.data,r=typeof n==`string`?``:URL.createObjectURL(new Blob([n],{type:``})),(i=document.createElement(`a`)).style.display=`none`,i.href=r||t,i.setAttribute(`download`,function(e){var t=e.split(`/`).pop();return t?t.split(`#`)[0].split(`?`)[0]:e}(t)),document.body.appendChild(i),i.click(),document.body.removeChild(i),r&&URL.revokeObjectURL(r);return;var t,n,r,i}},e.fileName)})))},a=function(e){var n=e.doc,a=r.useContext(t.LocalizationContext).l10n,o=r.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,s=a&&a.attachment?a.attachment.noAttachment:`There is no attachment`,c=r.useState({files:[],isLoaded:!1}),l=c[0],u=c[1];return r.useEffect((function(){n.getAttachments().then((function(e){u({files:e?Object.keys(e).map((function(t){return{data:e[t].content,fileName:e[t].filename}})):[],isLoaded:!0})}))}),[n]),l.isLoaded?l.files.length===0?r.createElement(`div`,{"data-testid":`attachment__empty`,className:t.classNames({"rpv-attachment__empty":!0,"rpv-attachment__empty--rtl":o})},s):r.createElement(i,{files:l.files}):r.createElement(t.Spinner,null)},o=function(e){var n=e.store,i=r.useState(n.get(`doc`)),o=i[0],s=i[1],c=function(e){s(e)};return r.useEffect((function(){return n.subscribe(`doc`,c),function(){n.unsubscribe(`doc`,c)}}),[]),o?r.createElement(a,{doc:o}):r.createElement(`div`,{className:`rpv-attachment__loader`},r.createElement(t.Spinner,null))};e.attachmentPlugin=function(){var e=r.useMemo((function(){return t.createStore({})}),[]);return{onDocumentLoad:function(t){e.update(`doc`,t.doc)},Attachments:function(){return r.createElement(o,{store:e})}}}})),require_lib$16=__commonJSMin(((e,t)=>{t.exports=require_attachment_min()})),require_bookmark_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,i=n(require_react()),a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)},o=function(){return i.createElement(t.Icon,{size:16},i.createElement(`path`,{d:`M6.427,8.245A.5.5,0,0,1,6.862,7.5H17.138a.5.5,0,0,1,.435.749l-5.139,9a.5.5,0,0,1-.868,0Z`}))},s=function(){return i.createElement(t.Icon,{size:16},i.createElement(`path`,{d:`M9.248,17.572a.5.5,0,0,1-.748-.434V6.862a.5.5,0,0,1,.748-.434l8.992,5.138a.5.5,0,0,1,0,.868Z`}))},c=function(e){var n=e.bookmark,r=e.depth,c=e.doc,u=e.index,d=e.isBookmarkExpanded,f=e.numberOfSiblings,p=e.pathFromRoot,m=e.renderBookmarkItem,h=e.store,g=p?`${p}.${u}
60`:`${u}`,_=i.useMemo((function(){return function(e){var t=e.count,n=e.items;if(t>=0)return!1;var r=n.length;if(r===0)return!1;for(var i=n.concat([]);i.length>0;){var a=i.shift(),o=a.items;a.count&&o&&a.count>0&&o.length>0&&(r+=o.length,i=i.concat(o))}return Math.abs(t)===r}(n)}),[n]),v=h.get(`bookmarkExpandedMap`),y=d?d({bookmark:n,doc:c,depth:r,index:u}):v.has(g)?v.get(g):!_,b=i.useState(y),x=b[0],S=b[1],C=n.items&&n.items.length>0,w=function(){var e=!x;h.updateCurrentValue(`bookmarkExpandedMap`,(function(t){return t.set(g,e)})),S(e)},T=function(){var e=n.dest,r=h.get(`jumpToDestination`);t.getDestination(c,e).then((function(e){r&&r(a({label:n.title},e))}))},E=function(){C&&n.dest&&T()},D=function(){!C&&n.dest&&T()},O=function(e,t){return i.createElement(`div`,{className:`rpv-bookmark__item`,style:{paddingLeft:`${1.25*r}rem`},onClick:e},t)},k=function(e,t){return C?i.createElement(`span`,{className:`rpv-bookmark__toggle`,"data-testid":`bookmark__toggle-${r}-${u}`,onClick:w},x?e:t):i.createElement(`span`,{className:`rpv-bookmark__toggle`})},A=function(e){return n.url?i.createElement(`a`,{className:`rpv-bookmark__title`,href:n.url,rel:`noopener noreferrer nofollow`,target:n.newWindow?`_blank`:``},n.title):i.createElement(`div`,{className:`rpv-bookmark__title`,"aria-label":n.title,onClick:e},n.title)};return i.createElement(`li`,{"aria-expanded":x?`true`:`false`,"aria-label":n.title,"aria-level":r+1,"aria-posinset":u+1,"aria-setsize":f,role:`treeitem`,tabIndex:-1},m?m({bookmark:n,depth:r,hasSubItems:C,index:u,isExpanded:x,path:g,defaultRenderItem:O,defaultRenderTitle:A,defaultRenderToggle:k,onClickItem:D,onClickTitle:E,onToggleSubItems:w}):O(D,i.createElement(i.Fragment,null,k(i.createElement(o,null),i.createElement(s,null)),A(E))),C&&x&&i.createElement(l,{bookmarks:n.items,depth:r+1,doc:c,isBookmarkExpanded:d,isRoot:!1,pathFromRoot:g,renderBookmarkItem:m,store:h}))},l=function(e){var t=e.bookmarks,n=e.depth,r=n===void 0?0:n,a=e.doc,o=e.isBookmarkExpanded,s=e.isRoot,l=e.pathFromRoot,u=e.renderBookmarkItem,d=e.store;return i.createElement(`ul`,{className:`rpv-bookmark__list`,role:s?`tree`:`group`,tabIndex:-1},t.map((function(e,n){return i.createElement(c,{bookmark:e,depth:r,doc:a,index:n,isBookmarkExpanded:o,key:n,numberOfSiblings:t.length,pathFromRoot:l,renderBookmarkItem:u,store:d})})))};(function(e){e[e.Collapse=0]=`Collapse`,e[e.Expand=1]=`Expand`})(r||={});var u=function(e){var t=e.bookmarks,n=e.doc,a=e.isBookmarkExpanded,o=e.renderBookmarkItem,s=e.store,c=i.useRef(),u=function(e){var t=c.current;if(t&&e.target instanceof HTMLElement&&t.contains(e.target))switch(e.key){case`ArrowDown`:e.preventDefault(),f((function(e,t){return e.indexOf(t)+1}));break;case`ArrowLeft`:e.preventDefault(),p(r.Collapse);break;case`ArrowRight`:e.preventDefault(),p(r.Expand);break;case`ArrowUp`:e.preventDefault,f((function(e,t){return e.indexOf(t)-1}));break;case`End`:e.preventDefault(),f((function(e,t){return e.length-1}));break;case` `:case`Enter`:case`Space`:e.preventDefault(),d();break;case`Home`:e.preventDefault(),f((function(e,t){return 0}))}},d=function(){var e=document.activeElement.closest(`.rpv-bookmark__item`).querySelector(`.rpv-bookmark__title`);e&&e.click()},f=function(e){var t=c.current,n=[].slice.call(t.getElementsByClassName(`rpv-bookmark__item`));if(n.length!==0){var r=document.activeElement,i=n[Math.min(n.length-1,Math.max(0,e(n,r)))];r.setAttribute(`tabindex`,`-1`),i.setAttribute(`tabindex`,`0`),i.focus()}},p=function(e){var t=c.current;if([].slice.call(t.getElementsByClassName(`rpv-bookmark__item`)).length!==0){var n=document.activeElement.closest(`.rpv-bookmark__item`),i=e===r.Collapse?`true`:`false`;if(n&&n.parentElement.getAttribute(`aria-expanded`)===i){var a=n.querySelector(`.rpv-bookmark__toggle`);a&&a.click()}}};return i.useEffect((function(){return document.addEventListener(`keydown`,u),function(){document.removeEventListener(`keydown`,u)}}),[]),i.useEffect((function(){var e=c.current;if(e){var t=[].slice.call(e.getElementsByClassName(`rpv-bookmark__item`));t.length>0&&(t[0].focus(),t[0].setAttribute(`tabindex`,`0`))}}),[]),i.createElement(`div`,{ref:c},i.createElement(l,{bookmarks:t,depth:0,doc:n,isBookmarkExpanded:a,isRoot:!0,pathFromRoot:``,renderBookmarkItem:o,store:s}))},d=function(e){var n=e.doc,r=e.isBookmarkExpanded,a=e.renderBookmarkItem,o=e.store,s=i.useContext(t.LocalizationContext).l10n,c=i.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,l=i.useState({isLoaded:!1,items:[]}),d=l[0],f=l[1];return i.useEffect((function(){f({isLoaded:!1,items:[]}),n.getOutline().then((function(e){f({isLoaded:!0,items:e||[]})}
60))}),[n]),d.isLoaded?d.items.length===0?i.createElement(`div`,{"data-testid":`bookmark__empty`,className:t.classNames({"rpv-bookmark__empty":!0,"rpv-bookmark__empty--rtl":c})},s&&s.bookmark?s.bookmark.noBookmark:`There is no bookmark`):i.createElement(`div`,{"data-testid":`bookmark__container`,className:t.classNames({"rpv-bookmark__container":!0,"rpv-bookmark__container--rtl":c})},i.createElement(u,{bookmarks:d.items,doc:n,isBookmarkExpanded:r,renderBookmarkItem:a,store:o})):i.createElement(`div`,{className:`rpv-bookmark__loader`},i.createElement(t.Spinner,null))},f=function(e){var n=e.isBookmarkExpanded,r=e.renderBookmarkItem,a=e.store,o=i.useState(a.get(`doc`)),s=o[0],c=o[1],l=function(e){c(e)};return i.useEffect((function(){return a.subscribe(`doc`,l),function(){a.unsubscribe(`doc`,l)}}),[]),s?i.createElement(d,{doc:s,isBookmarkExpanded:n,renderBookmarkItem:r,store:a}):i.createElement(`div`,{className:`rpv-bookmark__loader`},i.createElement(t.Spinner,null))};e.DownArrowIcon=o,e.RightArrowIcon=s,e.bookmarkPlugin=function(){var e=i.useMemo((function(){return t.createStore({bookmarkExpandedMap:new Map})}),[]);return{install:function(t){e.update(`jumpToDestination`,t.jumpToDestination)},onDocumentLoad:function(t){e.update(`doc`,t.doc)},Bookmarks:function(t){return i.createElement(f,{isBookmarkExpanded:t?.isBookmarkExpanded,renderBookmarkItem:t?.renderBookmarkItem,store:e})}}}})),require_lib$15=__commonJSMin(((e,t)=>{t.exports=require_bookmark_min()})),require_thumbnail_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,i=n(require_react());e.ThumbnailDirection=void 0,(r=e.ThumbnailDirection||={}).Horizontal=`Horizontal`,r.Vertical=`Vertical`;var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)},o=function(e){var n=e.doc,r=e.getPageIndex,a=e.renderSpinner,o=e.store,s=e.width,c=n.numPages,l=r?r({numPages:c}):0,u=Math.max(0,Math.min(l,c-1)),d=o.get(`pagesRotation`)||new Map,f=d.has(u)?d.get(u):0,p=i.useState(``),m=p[0],h=p[1],g=t.useIsMounted(),_=i.useRef(),v=i.useState(o.get(`rotation`)||0),y=v[0],b=v[1],x=i.useState(f),S=x[0],C=x[1],w=i.useState(!1),T=w[0],E=w[1],D=function(e){C(e.has(u)?e.get(u):0)},O=function(e){b(e)},k=t.useIntersectionObserver({onVisibilityChanged:function(e){E(e.isVisible)}});return i.useEffect((function(){if(T){var e=k.current;e&&(h(``),t.getPage(n,u).then((function(t){var n=t.getViewport({scale:1}),r=(n.rotation+y+S)%360,i=Math.abs(y+S)%180==0,a=i?n.width:n.height,o=i?n.height:n.width,c=document.createElement(`canvas`),l=c.getContext(`2d`,{alpha:!1}),u=e.clientWidth,d=e.clientHeight,f=s?s/a:Math.min(u/a,d/o),p=f*a;c.height=f*o,c.width=p,c.style.opacity=`0`;var m=t.getViewport({rotation:r,scale:f});_.current=t.render({canvasContext:l,viewport:m}),_.current.promise.then((function(){g.current&&h(c.toDataURL()),c.width=0,c.height=0}),(function(){}))})))}}),[S,T]),i.useEffect((function(){return o.subscribe(`pagesRotation`,D),o.subscribe(`rotation`,O),function(){o.unsubscribe(`pagesRotation`,D),o.unsubscribe(`rotation`,O)}}),[]),i.useEffect((function(){return function(){var e;(e=_.current)==null||e.cancel()}}),[]),i.createElement(`div`,{ref:k,className:`rpv-thumbnail__cover-inner`,"data-testid":`thumbnail__cover-inner`},m?i.createElement(`img`,{className:`rpv-thumbnail__cover-image`,"data-testid":`thumbnail__cover-image`,src:m}):i.createElement(`div`,{className:`rpv-thumbnail__cover-loader`,"data-testid":`thumbnail__cover-loader`},a?a():i.createElement(t.Spinner,null)))},s=function(e){var n=e.getPageIndex,r=e.renderSpinner,a=e.store,s=e.width,c=i.useState(a.get(`doc`)),l=c[0],u=c[1],d=function(e){u(e)};return i.useEffect((function(){return a.subscribe(`doc`,d),function(){a.unsubscribe(`doc`,d)}}),[]),i.createElement(`div`,{className:`rpv-thumbnail__cover`},l?i.createElement(o,{doc:l,getPageIndex:n,renderSpinner:r,store:a,width:s}):i.createElement(`div`,{className:`rpv-thumbnail__cover-loader`},r?r():i.createElement(t.Spinner,null)))},c=function(){return i.createElement(t.Spinner,null)}
60,l=i.createContext({renderSpinner:c}),u=function(e){var n=e.children,r=e.doc,a=t.useIsMounted(),o=i.useState({loading:!0,labels:[]}),s=o[0],c=o[1];return i.useEffect((function(){r.getPageLabels().then((function(e){a.current&&c({loading:!1,labels:e||[]})}))}),[r.loadingTask.docId]),s.loading?i.createElement(i.Fragment,null):n(s.labels)},d=function(e){var n=e.page,r=e.pageHeight,a=e.pageIndex,o=e.pageWidth,s=e.rotation,c=e.thumbnailHeight,u=e.thumbnailWidth,d=e.onRenderCompleted,f=i.useContext(t.LocalizationContext).l10n,p=i.useRef(),m=i.useState(``),h=m[0],g=m[1],_=f&&f.thumbnail?f.thumbnail.thumbnailLabel:`Thumbnail of page {{pageIndex}}`;return i.useEffect((function(){var e=p.current;e&&e.cancel();var t=document.createElement(`canvas`),i=t.getContext(`2d`,{alpha:!1}),c=u,l=c/(o/r),f=c/o;t.height=l,t.width=c,t.style.height=`${l}px`,t.style.width=`${c}px`;var m=n.getViewport({rotation:s,scale:f});return p.current=n.render({canvasContext:i,viewport:m}),p.current.promise.then((function(){g(t.toDataURL()),d(a)}),(function(){d(a)})),function(){var e;(e=p.current)==null||e.cancel()}}),[s]),h?i.createElement(`img`,{"aria-label":_.replace(`{{pageIndex}}`,`${a+1}`),src:h,height:`${c}px`,width:`${u}px`}):i.useContext(l).renderSpinner()},f=function(e){var n=e.doc,r=e.pageHeight,a=e.pageIndex,o=e.pageRotation,s=e.pageWidth,c=e.rotation,u=e.shouldRender,f=e.thumbnailWidth,p=e.onRenderCompleted,m=e.onVisibilityChanged,h=t.useIsMounted(),g=i.useState({height:r,page:null,viewportRotation:0,width:s}),_=g[0],v=g[1],y=_.page,b=_.height,x=_.width,S=x/b,C=Math.abs(c+o)%180==0,w=C?f:f/S,T=C?f/S:f;i.useEffect((function(){u&&t.getPage(n,a).then((function(e){var t=e.getViewport({scale:1});h.current&&v({height:t.height,page:e,viewportRotation:t.rotation,width:t.width})}))}),[u]);var E=(_.viewportRotation+c+o)%360,D=t.useIntersectionObserver({onVisibilityChanged:function(e){m(a,e)}});return i.createElement(`div`,{className:`rpv-thumbnail__container`,"data-testid":`thumbnail__container-${a}`,ref:D,style:{height:`${T}px`,width:`${w}px`}},y?i.createElement(d,{page:y,pageHeight:C?b:x,pageIndex:a,pageWidth:C?x:b,rotation:E,thumbnailHeight:T,thumbnailWidth:w,onRenderCompleted:p}):i.useContext(l).renderSpinner())},p=function(n){var r=n.currentPage,a=n.doc,o=n.labels,s=n.pagesRotation,c=n.pageHeight,l=n.pageWidth,u=n.renderCurrentPageLabel,d=n.renderThumbnailItem,p=n.rotatedPage,m=n.rotation,h=n.thumbnailDirection,g=n.thumbnailWidth,_=n.viewMode,v=n.onJumpToPage,y=n.onRotatePage,b=a.numPages,x=a.loadingTask.docId,S=i.useRef(null),C=i.useRef([]),w=i.useState(r),T=w[0],E=w[1],D=i.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,O=i.useState(-1),k=O[0],A=O[1],j=t.useIsMounted(),M=t.usePrevious(_),N=i.useRef(!1),P=t.useRenderQueue({doc:a}),F=i.useMemo((function(){return Array(b).fill(0).map((function(e,t){return t}))}),[x]),I=i.useMemo((function(){switch(_){case t.ViewMode.DualPage:return t.chunk(F,2);case t.ViewMode.DualPageWithCover:return[[F[0]]].concat(t.chunk(F.slice(1),2));case t.ViewMode.SinglePage:default:return t.chunk(F,1)}}),[x,_]),L=function(){if(S.current){var e=C.current,t=T+1;t<e.length&&(T>=0&&e[T].setAttribute(`tabindex`,`-1`),E(t))}},R=function(){if(S.current){var e=C.current,t=T-1;t>=0&&(T>=0&&e[T].setAttribute(`tabindex`,`-1`),E(t))}},z=function(){T>=0&&T<b&&v(T)};t.useIsomorphicLayoutEffect((function(){var e=S.current;e&&(C.current=Array.from(e.querySelectorAll(`.rpv-thumbnail__item`)))}),[_]),i.useEffect((function(){var e=C.current;if(!(e.length===0||T<0||T>e.length)){var t=e[T];t.setAttribute(`tabindex`,`0`),t.focus()}}),[T]),t.useIsomorphicLayoutEffect((function(){var t=S.current,n=C.current;if(!(!t||n.length===0||r<0||r>n.length)){var i=n[r].closest(`.rpv-thumbnail__items`);i&&(h===e.ThumbnailDirection.Vertical?function(e,t){var n=e.getBoundingClientRect().top-t.getBoundingClientRect().top,r=e.clientHeight,i=t.clientHeight;n<0?t.scrollTop+=n:n+r<=i||(t.scrollTop+=n+r-i)}(i,t):function(e,t){var n=e.getBoundingClientRect().left-t.getBoundingClientRect().left,r=e.clientWidth,i=t.clientWidth;n<0?t.scrollLeft+=n:n+r<=i||(t.scrollLeft+=n+r-i)}(i,t))}}),[r,h]);var B=i.useCallback((function(e){j.current&&(P.markRendered(e),N.current=!1,H())}),[x]),V=i.useCallback((function(e,t){t.isVisible?P.setVisibility(e,t.ratio):P.setOutOfRange(e),H()}),[x]),H=i.useCallback((function(){if(!N.current){var e=P.getHighestPriorityPage();e>-1&&(P.markRendering(e),N.current=!0,A(e))}}),[x]);return i.useEffect((function(){p>=0&&(P.markRendering(p),N.current=!0,A(p))}),[x,p]),t.useIsomorphicLayoutEffect((function(){M!==_&&(P.markNotRendered(),H())}),[_]),i.createElement(`div`,{ref:S,"data-testid":`thumbnail__list`,className:t.classNames({"rpv-thumbnail__list":!0,"rpv-thumbnail__list--horizontal":h===e.ThumbnailDirection.Horizontal,"rpv-thumbnail__list--rtl":D,"rpv-thumbnail__list--vertical":h===e.ThumbnailDirection.Vertical}),onKeyDown:function(e){switch(e.key){case`ArrowDown`:L();break;case`ArrowUp`:R();break;case`Enter`:z()}}},I.map((function(e,n){var p=!1;switch(_){case t.ViewMode.DualPage:p=r===2*n||r===2*n+1;break;case t.ViewMode.DualPageWithCover:p=r===0&&n===0||n>0&&r===2*n-1||n>0&&r===2*n;break;case t.ViewMode.SinglePage:default:p=r===n}return i.createElement(`div`,{className:t.classNames({"rpv-thumbnail__items":!0,"rpv-thumbnail__items--dual":_===t.ViewMode.DualPage,"rpv-thumbnail__items--dual-cover":_===t.ViewMode.DualPageWithCover,"rpv-thumbnail__items--single":_===t.ViewMode.SinglePage,"rpv-thumbnail__items--selected":p}),key:`${n}___${_}`},e.map((function(e){return function(e){var n=_===t.ViewMode.DualPageWithCover&&(e===0||b%2==0&&e===b-1),p=`${a.loadingTask.docId}___${e}`,h=o.length===b?o[e]:`${e+1}`,x=u?u({currentPage:r,pageIndex:e,numPages:b,pageLabel:h}):h,S=s.has(e)?s.get(e):0,C=i.createElement(f,{doc:a,pageHeight:c,pageIndex:e,pageRotation:S,pageWidth:l,rotation:m,shouldRender:k===e,thumbnailWidth:g,onRenderCompleted:B,onVisibilityChanged:V});return d?d({currentPage:r,key:p,numPages:b,pageIndex:e,renderPageLabel:i.createElement(i.Fragment,null,x),renderPageThumbnail:C,onJumpToPage:function(){return v(e)},onRotatePage:function(t){return y(e,t)}}):i.createElement(`div`,{key:p},i.createElement(`div`,{className:t.classNames({"rpv-thumbnail__item":!0,"rpv-thumbnail__item--dual-even":_===t.ViewMode.DualPage&&e%2==0,"rpv-thumbnail__item--dual-odd":_===t.ViewMode.DualPage&&e%2==1,"rpv-thumbnail__item--dual-cover":n,"rpv-thumbnail__item--dual-cover-even":_===t.ViewMode.DualPageWithCover&&!n&&e%2==0,"rpv-thumbnail__item--dual-cover-odd":_===t.ViewMode.DualPageWithCover&&!n&&e%2==1,"rpv-thumbnail__item--single":_===t.ViewMode.SinglePage,"rpv-thumbnail__item--selected":r===e}),role:`button`,tabIndex:r===e?0:-1,onClick:function(){return v(e)}},C),i.createElement(`div`,{"data-testid":`thumbnail__label-${e}`,className:`rpv-thumbnail__label`},x))}(e)})))}
60)))},m=function(e){var n=e.renderCurrentPageLabel,r=e.renderThumbnailItem,a=e.store,o=e.thumbnailDirection,s=e.thumbnailWidth,c=i.useState(a.get(`doc`)),d=c[0],f=c[1],m=i.useState(a.get(`currentPage`)||0),h=m[0],g=m[1],_=i.useState(a.get(`pageHeight`)||0),v=_[0],y=_[1],b=i.useState(a.get(`pageWidth`)||0),x=b[0],S=b[1],C=i.useState(a.get(`rotation`)||0),w=C[0],T=C[1],E=i.useState(a.get(`pagesRotation`)||new Map),D=E[0],O=E[1],k=i.useState(a.get(`rotatedPage`)||-1),A=k[0],j=k[1],M=i.useState(a.get(`viewMode`)),N=M[0],P=M[1],F=function(e){g(e)},I=function(e){f(e)},L=function(e){y(e)},R=function(e){S(e)},z=function(e){T(e)},B=function(e){O(e)},V=function(e){j(e)},H=function(e){P(e)},ee=function(e){var t=a.get(`jumpToPage`);t&&t(e)},U=function(e,t){a.get(`rotatePage`)(e,t)};return i.useEffect((function(){return a.subscribe(`doc`,I),a.subscribe(`pageHeight`,L),a.subscribe(`pageWidth`,R),a.subscribe(`rotatedPage`,V),a.subscribe(`rotation`,z),a.subscribe(`pagesRotation`,B),a.subscribe(`viewMode`,H),function(){a.unsubscribe(`doc`,I),a.unsubscribe(`pageHeight`,L),a.unsubscribe(`pageWidth`,R),a.unsubscribe(`rotatedPage`,V),a.unsubscribe(`rotation`,z),a.unsubscribe(`pagesRotation`,B),a.unsubscribe(`viewMode`,H)}}),[]),t.useIsomorphicLayoutEffect((function(){return a.subscribe(`currentPage`,F),function(){a.unsubscribe(`currentPage`,F)}}),[]),d?i.createElement(t.LazyRender,{testId:`thumbnail__list-container`,attrs:{className:`rpv-thumbnail__list-container`}},i.createElement(u,{doc:d},(function(e){return i.createElement(p,{currentPage:h,doc:d,labels:e,pagesRotation:D,pageHeight:v,pageWidth:x,renderCurrentPageLabel:n,renderThumbnailItem:r,rotatedPage:A,rotation:w,thumbnailDirection:o,thumbnailWidth:s,viewMode:N,onJumpToPage:ee,onRotatePage:U})}))):i.createElement(`div`,{"data-testid":`thumbnail-list__loader`,className:`rpv-thumbnail__loader`},i.useContext(l).renderSpinner())};e.thumbnailPlugin=function(n){var r=i.useMemo((function(){return t.createStore({rotatePage:function(){},viewMode:t.ViewMode.SinglePage})}),[]),o=i.useState(``),u=o[0],d=o[1];return{install:function(e){r.update(`jumpToPage`,e.jumpToPage),r.update(`rotatePage`,e.rotatePage)},onDocumentLoad:function(e){d(e.doc.loadingTask.docId),r.update(`doc`,e.doc)},onViewerStateChange:function(e){return r.update(`currentPage`,e.pageIndex),r.update(`pagesRotation`,e.pagesRotation),r.update(`pageHeight`,e.pageHeight),r.update(`pageWidth`,e.pageWidth),r.update(`rotation`,e.rotation),r.update(`rotatedPage`,e.rotatedPage),r.update(`viewMode`,e.viewMode),e},Cover:function(e){return i.createElement(s,a({},e,{renderSpinner:n?.renderSpinner,store:r}))},Thumbnails:i.useCallback((function(t){return i.createElement(l.Provider,{value:{renderSpinner:n?.renderSpinner||c}},i.createElement(m,{renderCurrentPageLabel:n?.renderCurrentPageLabel,renderThumbnailItem:t?.renderThumbnailItem,store:r,thumbnailDirection:t?.thumbnailDirection||e.ThumbnailDirection.Vertical,thumbnailWidth:n?.thumbnailWidth||100}))}),[u])}}})),require_lib$14=__commonJSMin(((e,t)=>{t.exports=require_thumbnail_min()})),require_selection_mode_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,i=n(require_react()),a=function(){return i.createElement(t.Icon,{size:16},i.createElement(`path`,{d:`M11.5,5.5v-2C11.5,2.672,12.172,2,13,2s1.5,0.672,1.5,1.5v2 M14.5,11.5v-6C14.5,4.672,15.172,4,16,4 61 c0.828,0,1.5,0.672,1.5,1.5v3 M17.5,13V8.5C17.5,7.672,18.172,7,19,7s1.5,0.672,1.5,1.5v10c0,2.761-2.239,5-5,5h-3.335 62 c-1.712-0.001-3.305-0.876-4.223-2.321C6.22,18.467,4.083,14,4.083,14c-0.378-0.545-0.242-1.292,0.303-1.67 63 c0.446-0.309,1.044-0.281,1.458,0.07L8.5,15.5v-10C8.5,4.672,9.172,4,10,4s1.5,0.672,1.5,1.5v6`}))},o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};e.SelectionMode=void 0,(r=e.SelectionMode||={}).Hand=`Hand`,r.Text=`Text`;var s=function(){return i.createElement(t.Icon,{size:16},i.createElement(`path`,{d:`M13.675,11.671l2.941-2.941c0.195-0.196,0.195-0.512-0.001-0.707C16.563,7.971,16.5,7.931,16.43,7.906 64 L4.168,3.527C3.908,3.434,3.622,3.57,3.529,3.83c-0.039,0.109-0.039,0.228,0,0.336l4.379,12.262
65 c0.093,0.26,0.379,0.396,0.639,0.303c0.07-0.025,0.133-0.065,0.185-0.117l2.943-2.943l6.146,6.146c0.195,0.195,0.512,0.195,0.707,0 66 l1.293-1.293c0.195-0.195,0.195-0.512,0-0.707L13.675,11.671z`}))},c=function(n){var r=n.children,o=n.mode,c=n.onClick,l=i.useContext(t.LocalizationContext).l10n,u=``,d=i.createElement(s,null);switch(o){case e.SelectionMode.Hand:u=l&&l.selectionMode?l.selectionMode.handTool:`Hand tool`,d=i.createElement(a,null);break;case e.SelectionMode.Text:default:u=l&&l.selectionMode?l.selectionMode.textSelectionTool:`Text selection tool`,d=i.createElement(s,null)}return r({icon:d,label:u,onClick:c})},l={left:0,top:8},u=function(n){var r=n.isSelected,a=n.mode,o=n.onClick,s=``;switch(a){case e.SelectionMode.Hand:s=`selection-mode__hand-button`;break;case e.SelectionMode.Text:default:s=`selection-mode__text-button`}return i.createElement(c,{mode:a,onClick:o},(function(e){return i.createElement(t.Tooltip,{ariaControlsSuffix:`selection-mode-switch`,position:t.Position.BottomCenter,target:i.createElement(t.MinimalButton,{ariaLabel:e.label,isSelected:r,testId:s,onClick:e.onClick},e.icon),content:function(){return e.label},offset:l})}))},d=function(e){var t=e.children,n=e.mode,r=e.store,a=n===r.get(`selectionMode`);return(t||function(e){return i.createElement(u,{isSelected:a,mode:e.mode,onClick:e.onClick})})({isSelected:a,mode:n,onClick:function(){return r.update(`selectionMode`,n)}})},f=function(n){var r=n.isSelected,a=n.mode,o=n.onClick,s=``;switch(a){case e.SelectionMode.Hand:s=`selection-mode__hand-menu`;break;case e.SelectionMode.Text:default:s=`selection-mode__text-menu`}return i.createElement(c,{mode:a,onClick:o},(function(e){return i.createElement(t.MenuItem,{checked:r,icon:e.icon,testId:s,onClick:e.onClick},e.label)}))},p=function(t){var n=t.store,r=i.useRef(null),a=i.useState(e.SelectionMode.Text),o=a[0],s=a[1],c=i.useRef({top:0,left:0,x:0,y:0}),l=function(e){var t=r.current;t&&(t.scrollTop=c.current.top-(e.clientY-c.current.y),t.scrollLeft=c.current.left-(e.clientX-c.current.x))},u=function(){var e=r.current;e&&(e.classList.add(`rpv-selection-mode__grab`),e.classList.remove(`rpv-selection-mode__grabbing`),document.removeEventListener(`mousemove`,l),document.removeEventListener(`mouseup`,u))},d=function(t){var n=r.current;n&&o!==e.SelectionMode.Text&&(n.classList.remove(`rpv-selection-mode__grab`),n.classList.add(`rpv-selection-mode__grabbing`),t.preventDefault(),t.stopPropagation(),c.current={left:n.scrollLeft,top:n.scrollTop,x:t.clientX,y:t.clientY},document.addEventListener(`mousemove`,l),document.addEventListener(`mouseup`,u))},f=function(e){r.current=e()},p=function(e){s(e)};return i.useEffect((function(){var t=r.current;if(t)return o===e.SelectionMode.Hand?t.classList.add(`rpv-selection-mode__grab`):t.classList.remove(`rpv-selection-mode__grab`),t.addEventListener(`mousedown`,d),function(){t.removeEventListener(`mousedown`,d)}}),[o]),i.useEffect((function(){return n.subscribe(`getPagesContainer`,f),n.subscribe(`selectionMode`,p),function(){n.unsubscribe(`getPagesContainer`,f),n.unsubscribe(`selectionMode`,p)}}),[]),i.createElement(i.Fragment,null)};e.HandToolIcon=a,e.TextSelectionIcon=s,e.selectionModePlugin=function(n){var r=i.useMemo((function(){return t.createStore()}),[]),a=function(e){return i.createElement(d,o({},e,{store:r}))};return{install:function(t){r.update(`selectionMode`,n&&n.selectionMode?n.selectionMode:e.SelectionMode.Text),r.update(`getPagesContainer`,t.getPagesContainer)},renderViewer:function(e){var t=e.slot;return t.subSlot&&t.subSlot.children&&(t.subSlot.children=i.createElement(i.Fragment,null,i.createElement(p,{store:r}),t.subSlot.children)),t},SwitchSelectionMode:a,SwitchSelectionModeButton:function(e){return i.createElement(a,{mode:e.mode},(function(e){return i.createElement(u,{isSelected:e.isSelected,mode:e.mode,onClick:function(){e.onClick()}})}))},SwitchSelectionModeMenuItem:function(e){return i.createElement(a,{mode:e.mode},(function(t){return i.createElement(f,{isSelected:t.isSelected,mode:t.mode,onClick:function(){t.onClick(),e.onClick()}})}))}}}}
66)),require_lib$13=__commonJSMin(((e,t)=>{t.exports=require_selection_mode_min()})),require_full_screen_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M11.5 23.499L11.5 14.499`}),r.createElement(`path`,{d:`M7.5 18.499L11.5 14.499 15.5 18.499`}),r.createElement(`path`,{d:`M11.5 1.499L11.5 10.499`}),r.createElement(`path`,{d:`M7.5 6.499L11.5 10.499 15.5 6.499`}),r.createElement(`path`,{d:`M20.5 12.499L1.5 12.499`}))},a=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M0.5 12L23.5 12`}),r.createElement(`path`,{d:`M11.5 1L11.5 23`}),r.createElement(`path`,{d:`M8.5 4L11.5 1 14.5 4`}),r.createElement(`path`,{d:`M20.5 9L23.5 12 20.5 15`}),r.createElement(`path`,{d:`M3.5 15L0.5 12 3.5 9`}),r.createElement(`path`,{d:`M14.5 20L11.5 23 8.5 20`}))},o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)},s={left:0,top:8},c=function(e){var n=e.enableShortcuts,i=e.onClick,o=r.useContext(t.LocalizationContext).l10n,c=o&&o.fullScreen?o.fullScreen.enterFullScreen:`Full screen`,l=n?t.isMac()?`Meta+Ctrl+F`:`F11`:``;return r.createElement(t.Tooltip,{ariaControlsSuffix:`full-screen-enter`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaKeyShortcuts:l,ariaLabel:c,isDisabled:!t.isFullScreenEnabled(),testId:`full-screen__enter-button`,onClick:i},r.createElement(a,null)),content:function(){return c},offset:s})},l={left:0,top:8},u=function(e){var n=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.fullScreen?a.fullScreen.exitFullScreen:`Exit full screen`;return r.createElement(t.Tooltip,{ariaControlsSuffix:`full-screen-exit`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaKeyShortcuts:`Esc`,ariaLabel:o,testId:`full-screen__exit-button-with-tooltip`,onClick:n},r.createElement(i,null)),content:function(){return o},offset:l})},d=function(e,n){var i=r.useState(n.get(`fullScreenMode`)),a=i[0],o=i[1],s=r.useCallback((function(e){o(e)}),[]);return r.useEffect((function(){return n.subscribe(`fullScreenMode`,s),function(){n.unsubscribe(`fullScreenMode`,s)}}),[]),{enterFullScreen:function(){var t=n.get(`getPagesContainer`);if(t){var r=e(t());n.get(`enterFullScreenMode`)(r)}},exitFullScreen:function(){n.get(`exitFullScreenMode`)()},isFullScreen:a===t.FullScreenMode.Entering||a===t.FullScreenMode.EnteredCompletely}},f=function(e){var t=e.children,n=e.enableShortcuts,i=e.getFullScreenTarget,a=e.store,o=d(i,a),s=o.enterFullScreen,l=o.exitFullScreen,f=o.isFullScreen;return(t||function(e){return f?r.createElement(u,{onClick:e.onClick}):r.createElement(c,{enableShortcuts:n,onClick:e.onClick})})({onClick:f?l:s})},p=function(e){var n=e.onClick,i=r.useContext(t.LocalizationContext).l10n,o=i&&i.fullScreen?i.fullScreen.enterFullScreen:`Full screen`;return r.createElement(t.MenuItem,{icon:r.createElement(a,null),isDisabled:!t.isFullScreenEnabled(),testId:`full-screen__enter-menu`,onClick:n},o)},m=function(e){var n=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=r.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,s=a&&a.fullScreen?a.fullScreen.exitFullScreen:`Exit full screen`;return r.createElement(`div`,{className:t.classNames({"rpv-full-screen__exit-button":!0,"rpv-full-screen__exit-button--ltr":!o,"rpv-full-screen__exit-button--rtl":o})},r.createElement(t.MinimalButton,{ariaLabel:s,testId:`full-screen__exit-button`,onClick:n},r.createElement(i,null)))},h=function(e){var t=e.children,n=e.getFullScreenTarget,i=e.store,a=d(n,i),o=a.enterFullScreen,s=a.exitFullScreen,c=a.isFullScreen;return c&&(t||function(e){return r.createElement(m,{onClick:e.onClick})})({onClick:c?s:o})},g=function(e){var n=e.store,i=e.onEnterFullScreen,a=e.onExitFullScreen,o=r.useState(n.get(`fullScreenMode`)),s=o[0],c=o[1],l=r.useCallback((function(e){c(e)}),[]);return r.useEffect((function(){switch(s){case t.FullScreenMode.EnteredCompletely:i(n.get(`zoom`));break;case t.FullScreenMode.Exited:a(n.get(`zoom`))}}),[s]),r.useEffect((function(){return n.subscribe(`fullScreenMode`,l),function(){n.unsubscribe(`fullScreenMode`,l)}}),[]),(s===t.FullScreenMode.Entering||s===t.FullScreenMode.Entered)&&r.createElement(`div`,{className:`rpv-full-screen__overlay`},r.createElement(t.Spinner,null))},_=function(e){var n=e.containerRef,i=e.getFullScreenTarget,a=e.store,o=d(i,a).enterFullScreen,s=function(e){if(!e.shiftKey&&!e.altKey&&
66(t.isMac()?e.metaKey&&e.ctrlKey&&e.key===`f`:e.key===`F11`)){var r=n.current;r&&document.activeElement&&r.contains(document.activeElement)&&(e.preventDefault(),o())}};return r.useEffect((function(){if(n.current)return document.addEventListener(`keydown`,s),function(){document.removeEventListener(`keydown`,s)}}),[n.current]),r.createElement(r.Fragment,null)};e.ExitFullScreenIcon=i,e.FullScreenIcon=a,e.fullScreenPlugin=function(e){var n=e?.getFullScreenTarget||function(e){return e},i=r.useMemo((function(){return Object.assign({},{enableShortcuts:!0,onEnterFullScreen:function(){},onExitFullScreen:function(){}},e)}),[]),a=r.useMemo((function(){return t.createStore({enterFullScreenMode:function(){},exitFullScreenMode:function(){},fullScreenMode:t.FullScreenMode.Normal,zoom:function(){}})}),[]),s=function(e){return r.createElement(f,o({},e,{enableShortcuts:i.enableShortcuts,getFullScreenTarget:n,store:a}))},l=function(){return r.createElement(h,{getFullScreenTarget:n,store:a},e?.renderExitFullScreenButton)};return{install:function(e){a.update(`enterFullScreenMode`,e.enterFullScreenMode),a.update(`exitFullScreenMode`,e.exitFullScreenMode),a.update(`getPagesContainer`,e.getPagesContainer),a.update(`zoom`,e.zoom)},onViewerStateChange:function(e){return a.update(`fullScreenMode`,e.fullScreenMode),e},renderViewer:function(e){var t=e.slot;return t.subSlot&&(t.subSlot.children=r.createElement(r.Fragment,null,i.enableShortcuts&&r.createElement(_,{containerRef:e.containerRef,getFullScreenTarget:n,store:a}),r.createElement(g,{store:a,onEnterFullScreen:i.onEnterFullScreen,onExitFullScreen:i.onExitFullScreen}),r.createElement(l,null),t.subSlot.children)),t},EnterFullScreen:s,EnterFullScreenButton:function(){return r.createElement(s,null,(function(e){return r.createElement(c,o({enableShortcuts:i.enableShortcuts},e))}))},EnterFullScreenMenuItem:function(e){return r.createElement(s,null,(function(t){return r.createElement(p,{onClick:function(){t.onClick(),e.onClick()}})}))}}}})),require_lib$12=__commonJSMin(((e,t)=>{t.exports=require_full_screen_min()})),require_get_file_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M5.5,11.5c-.275,0-.341.159-.146.354l6.292,6.293a.5.5,0,0,0,.709,0l6.311-6.275c.2-.193.13-.353-.145-.355L15.5,11.5V1.5a1,1,0,0,0-1-1h-5a1,1,0,0,0-1,1V11a.5.5,0,0,1-.5.5Z`}),r.createElement(`path`,{d:`M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4`}))},a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)},o={left:0,top:8},s=function(e){var n=e.onClick,a=r.useContext(t.LocalizationContext).l10n,s=a&&a.download?a.download.download:`Download`;return r.createElement(t.Tooltip,{ariaControlsSuffix:`get-file`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:s,testId:`get-file__download-button`,onClick:n},r.createElement(i,null)),content:function(){return s},offset:o})},c=function(e,t){var n=document.createElement(`a`);n.style.display=`none`,n.href=e,n.setAttribute(`download`,t),document.body.appendChild(n),n.click(),document.body.removeChild(n)},l=function(e,t,n){var r=URL.createObjectURL(new Blob([e],{type:n}));c(r,t),r&&URL.revokeObjectURL(r)},u=function(e,t){e.getData().then((function(e){/iphone|ipod|ipad/i.test(navigator.userAgent)&&!/CriOS/i.test(navigator.userAgent)?l(e,t,`application/octet-stream`):/iphone|ipod|ipad/i.test(navigator.userAgent)&&/CriOS/i.test(navigator.userAgent)?c(`data:application/pdf;base64,${function(e){return btoa(Array(e.length).fill(``).map((function(t,n){return String.fromCharCode(e[n])})).join(``))}(e)}`,t):l(e,t,`application/pdf`)}))},d=function(e){var t=e.children,n=e.fileNameGenerator,i=e.store,a=r.useState(i.get(`file`)),o=a[0],c=a[1],l=r.useState(i.get(`doc`)),d=l[0],f=l[1],p=function(e){f(e)},m=function(e){c(e)};return r.useEffect((function(){return i.subscribe(`doc`,p),i.subscribe(`file`,m),function(){i.subscribe(`doc`,p),i.unsubscribe(`file`,m)}}),[]),(t||function(e){return r.createElement(s,{onClick:e.onClick})})({onClick:function(){d&&o&&u(d,n(o))}})},f=function(e){var n=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.download?a.download.download:`Download`;return r.createElement(t.MenuItem,{icon:r.createElement(i,null),testId:`get-file__download-menu`,onClick:n},o)};e.DownloadIcon=i,e.getFilePlugin=function(e){var n=r.useMemo((function(){return t.createStore({})}),[]),i=function(e){return e.name?(t=e.name,(n=t.split(`/`).pop())?n.split(`#`)[0].split(`?`)[0]:t):`document.pdf`;var t,n},o=function(t){return r.createElement(d,a({},t,{fileNameGenerator:e&&e.fileNameGenerator||i,store:n}))};return{onDocumentLoad:function(e){n.update(`doc`,e.doc),n.update(`file`,e.file)},Download:o,DownloadButton:function(){return r.createElement(o,null,(function(e){return r.createElement(s,a({},e))}))},DownloadMenuItem:function(e){return r.createElement(o,null,(function(t){return r.createElement(f,{onClick:function(){t.onClick(),e.onClick()}})}))}}}})),require_lib$11=__commonJSMin(((e,t)=>{t.exports=require_get_file_min()})),require_open_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16}
66,r.createElement(`path`,{d:`M18.5,7.5c.275,0,.341-.159.146-.354L12.354.854a.5.5,0,0,0-.708,0L5.354,7.147c-.2.195-.129.354.146.354h3v10a1,1,0,0,0,1,1h5a1,1,0,0,0,1-1V7.5Z`}),r.createElement(`path`,{d:`M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4`}))},a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)},o=function(e){var t=r.useRef(),n=function(){var n=t.current;n&&(n.click(),e.get(`triggerOpenFile`)&&e.update(`triggerOpenFile`,!1))},i=function(e){e&&n()};return r.useEffect((function(){return e.subscribe(`triggerOpenFile`,i),function(){e.unsubscribe(`triggerOpenFile`,i)}}),[]),{inputRef:t,openFile:n}},s={left:0,top:8},c=function(e){var n=e.enableShortcuts,a=e.store,c=e.onClick,l=r.useContext(t.LocalizationContext).l10n,u=l&&l.open?l.open.openFile:`Open file`,d=o(a),f=d.inputRef,p=d.openFile,m=n?t.isMac()?`Meta+O`:`Ctrl+O`:``;return r.createElement(t.Tooltip,{ariaControlsSuffix:`open`,position:t.Position.BottomCenter,target:r.createElement(`div`,{className:`rpv-open__input-wrapper`},r.createElement(`input`,{accept:`.pdf`,ref:f,className:`rpv-open__input`,multiple:!1,tabIndex:-1,title:``,type:`file`,onChange:c}),r.createElement(t.MinimalButton,{ariaKeyShortcuts:m,ariaLabel:u,testId:`open__button`,onClick:p},r.createElement(i,null))),content:function(){return u},offset:s})},l=function(e){var t=e.children,n=e.enableShortcuts,i=e.store;return(t||function(e){return r.createElement(c,{enableShortcuts:n,store:i,onClick:e.onClick})})({onClick:function(e){var t=e.target.files;if(t&&t.length){var n=i.get(`openFile`);n&&n(t[0])}}})},u=function(e){var n=e.store,a=e.onClick,s=r.useContext(t.LocalizationContext).l10n,c=s&&s.open?s.open.openFile:`Open file`,l=o(n),u=l.inputRef,d=l.openFile;return r.createElement(t.MenuItem,{icon:r.createElement(i,null),testId:`open__menu`,onClick:d},r.createElement(`div`,{className:`rpv-open__input-wrapper`},r.createElement(`input`,{accept:`.pdf`,ref:u,className:`rpv-open__input`,multiple:!1,tabIndex:-1,title:``,type:`file`,onChange:a}),c))},d=function(e){var n=e.containerRef,i=e.store,a=function(e){if(!e.shiftKey&&!e.altKey&&e.key===`o`&&(t.isMac()?e.metaKey:e.ctrlKey)){var r=n.current;r&&document.activeElement&&r.contains(document.activeElement)&&(e.preventDefault(),i.update(`triggerOpenFile`,!0))}};return r.useEffect((function(){if(n.current)return document.addEventListener(`keydown`,a),function(){document.removeEventListener(`keydown`,a)}}),[n.current]),r.createElement(r.Fragment,null)};e.OpenFileIcon=i,e.openPlugin=function(e){var n=r.useMemo((function(){return Object.assign({},{enableShortcuts:!0},e)}),[]),i=r.useMemo((function(){return t.createStore({})}),[]),o=function(e){return r.createElement(l,a({enableShortcuts:n.enableShortcuts},e,{store:i}))};return{install:function(e){i.update(`openFile`,e.openFile)},renderViewer:function(e){var t=e.slot,o={children:r.createElement(r.Fragment,null,n.enableShortcuts&&r.createElement(d,{containerRef:e.containerRef,store:i}),t.children)};return a(a({},t),o)},Open:o,OpenButton:function(){return r.createElement(o,null)},OpenMenuItem:function(){return r.createElement(o,null,(function(e){return r.createElement(u,{store:i,onClick:e.onClick})}))}}}})),require_lib$10=__commonJSMin(((e,t)=>{t.exports=require_open_min()})),require_page_navigation_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M2.32,2.966h19.452c0.552,0.001,1,0.449,0.999,1.001c0,0.182-0.05,0.36-0.144,0.516L12.9,20.552 67 c-0.286,0.472-0.901,0.624-1.373,0.338c-0.138-0.084-0.254-0.2-0.338-0.338L1.465,4.483C1.179,4.01,1.331,3.396,1.804,3.11 68 C1.96,3.016,2.138,2.966,2.32,2.966z`}))},a=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M0.541,5.627L11.666,18.2c0.183,0.207,0.499,0.226,0.706,0.043c0.015-0.014,0.03-0.028,0.043-0.043 69 L23.541,5.627`}))},o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)},s=function(e){var n=r.useState(e.get(`currentPage`)||0),i=n[0],a=n[1],o=function(e){a(e)};return t.useIsomorphicLayoutEffect((function(){return e.subscribe(`currentPage`,o),function(){e.unsubscribe(`currentPage`,o)}}),[]),{currentPage:i}},c=function(e){var t=r.useState(e.get(`numberOfPages`)||0),n=t[0],i=t[1],a=function(e){i(e)};return r.useEffect((function(){return e.subscribe(`numberOfPages`,a),function(){e.unsubscribe(`numberOfPages`,a)}}),[]),{numberOfPages:n}},l=function(e){var n=e.store,i=r.useContext(t.LocalizationContext).l10n,a=r.useState(`1`),o=a[0],l=a[1],u=s(n).currentPage,d=c(n).numberOfPages;r.useEffect((function(){return l(`${u+1}`)}),[u]);var f=function(e){var t=n.get(`jumpToPage`);t&&t(e)},p=i&&i.pageNavigation?i.pageNavigation.enterPageNumber:`Enter a page number`;return r.createElement(`span`,{className:`rpv-page-navigation__current-page-input`},r.createElement(t.TextBox,{ariaLabel:p,testId:`page-navigation__current-page-input`,type:`text`,value:o,onChange:l,onKeyDown:function(e){switch(e.key){case`ArrowUp`:(r=u-1)>=0&&(l(`${r+1}`),f(r));break;case`ArrowDown`:(n=u+1)<d&&(l(`${n+1}`),f(n));break;case`Enter`:t=parseInt(o,10),o===``||t<1||t>d?l(`${u+1}`):f(t-1)}var t,n,r}}))},u=function(e){var n=e.children,i=e.doc,a=t.useIsMounted(),o=r.useState({loading:!0,labels:[]}),s=o[0],c=o[1];return r.useEffect((function(){i.getPageLabels().then((function(e){a.current&&c({loading:!1,labels:e||[]})}
69))}),[i.loadingTask.docId]),s.loading?r.createElement(r.Fragment,null):n(s.labels)},d=function(e){var t=e.children,n=e.store,i=function(e){var t=r.useState(e.get(`doc`)),n=t[0],i=t[1],a=function(e){i(e)};return r.useEffect((function(){return e.subscribe(`doc`,a),function(){e.unsubscribe(`doc`,a)}}),[]),n}(n),a=s(n).currentPage,o=c(n).numberOfPages,l=t||function(e){return r.createElement(r.Fragment,null,e.currentPage+1)};return i?r.createElement(u,{doc:i},(function(e){return l({currentPage:a,numberOfPages:o,pageLabel:e.length===o&&o>0?e[a]:``})})):r.createElement(r.Fragment,null)},f=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M21.783,21.034H2.332c-0.552,0-1-0.448-1-1c0-0.182,0.05-0.361,0.144-0.517L11.2,3.448 70 c0.286-0.472,0.901-0.624,1.373-0.338c0.138,0.084,0.254,0.2,0.338,0.338l9.726,16.069c0.286,0.473,0.134,1.087-0.339,1.373 71 C22.143,20.984,21.965,21.034,21.783,21.034z`}))},p={left:0,top:8},m=function(e){var n=e.isDisabled,i=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.pageNavigation?a.pageNavigation.goToFirstPage:`First page`;return r.createElement(t.Tooltip,{ariaControlsSuffix:`page-navigation-first`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:o,isDisabled:n,testId:`page-navigation__first-button`,onClick:i},r.createElement(f,null)),content:function(){return o},offset:p})},h=function(e){var t=e.children,n=e.store;return(t||function(e){return r.createElement(m,{isDisabled:e.isDisabled,onClick:e.onClick})})({isDisabled:s(n).currentPage===0,onClick:function(){var e=n.get(`jumpToPage`);e&&e(0)}})},g=function(e){var n=e.isDisabled,i=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.pageNavigation?a.pageNavigation.goToFirstPage:`First page`;return r.createElement(t.MenuItem,{icon:r.createElement(f,null),isDisabled:n,testId:`page-navigation__first-menu`,onClick:i},o)},_={left:0,top:8},v=function(e){var n=e.isDisabled,a=e.onClick,o=r.useContext(t.LocalizationContext).l10n,s=o&&o.pageNavigation?o.pageNavigation.goToLastPage:`Last page`;return r.createElement(t.Tooltip,{ariaControlsSuffix:`page-navigation-last`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:s,isDisabled:n,testId:`page-navigation__last-button`,onClick:a},r.createElement(i,null)),content:function(){return s},offset:_})},y=function(e){var t=e.children,n=e.store,i=s(n).currentPage,a=c(n).numberOfPages;return(t||function(e){return r.createElement(v,{isDisabled:e.isDisabled,onClick:e.onClick})})({isDisabled:i+1>=a,onClick:function(){var e=n.get(`jumpToPage`);e&&e(a-1)}})},b=function(e){var n=e.isDisabled,a=e.onClick,o=r.useContext(t.LocalizationContext).l10n,s=o&&o.pageNavigation?o.pageNavigation.goToLastPage:`Last page`;return r.createElement(t.MenuItem,{icon:r.createElement(i,null),isDisabled:n,testId:`page-navigation__last-menu`,onClick:a},s)},x={left:0,top:8},S=function(e){var n=e.isDisabled,i=e.onClick,o=r.useContext(t.LocalizationContext).l10n,s=o&&o.pageNavigation?o.pageNavigation.goToNextPage:`Next page`;return r.createElement(t.Tooltip,{ariaControlsSuffix:`page-navigation-next`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:s,isDisabled:n,testId:`page-navigation__next-button`,onClick:i},r.createElement(a,null)),content:function(){return s},offset:x})},C=function(e){var t=e.children,n=e.store;return(t||function(e){return r.createElement(S,{onClick:e.onClick,isDisabled:e.isDisabled})})({isDisabled:s(n).currentPage+1>=c(n).numberOfPages,onClick:function(){var e=n.get(`jumpToNextPage`);e&&e()}})},w=function(e){var n=e.isDisabled,i=e.onClick,o=r.useContext(t.LocalizationContext).l10n,s=o&&o.pageNavigation?o.pageNavigation.goToNextPage:`Next page`;return r.createElement(t.MenuItem,{icon:r.createElement(a,null),isDisabled:n,testId:`page-navigation__next-menu`,onClick:i},s)},T=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M23.535,18.373L12.409,5.8c-0.183-0.207-0.499-0.226-0.706-0.043C11.688,5.77,11.674,5.785,11.66,5.8 72 L0.535,18.373`}))},E={left:0,top:8},D=function(e){var n=e.isDisabled,i=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.pageNavigation?a.pageNavigation.goToPreviousPage:`Previous page`;
72return r.createElement(t.Tooltip,{ariaControlsSuffix:`page-navigation-previous`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:o,isDisabled:n,testId:`page-navigation__previous-button`,onClick:i},r.createElement(T,null)),content:function(){return o},offset:E})},O=function(e){var t=e.store;return(e.children||function(e){return r.createElement(D,{isDisabled:e.isDisabled,onClick:e.onClick})})({isDisabled:s(t).currentPage<=0,onClick:function(){var e=t.get(`jumpToPreviousPage`);e&&e()}})},k=function(e){var n=e.isDisabled,i=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.pageNavigation?a.pageNavigation.goToPreviousPage:`Previous page`;return r.createElement(t.MenuItem,{icon:r.createElement(T,null),isDisabled:n,testId:`page-navigation__previous-menu`,onClick:i},o)},A=function(e){var t=e.children,n=e.store,i=c(n).numberOfPages;return t?t({numberOfPages:i}):r.createElement(r.Fragment,null,i)},j=function(e){var n=e.containerRef,i=e.numPages,a=e.store,o=s(a).currentPage,c=r.useRef(o);c.current=o;var l=r.useRef(!1),u=function(){l.current=!0},d=function(){l.current=!1},f=function(e){var r=n.current,o=l.current||document.activeElement&&r.contains(document.activeElement);if(r&&o){var s,u,d=e.altKey&&e.key===`ArrowDown`||!e.shiftKey&&!e.altKey&&e.key===`PageDown`,f=e.altKey&&e.key===`ArrowUp`||!e.shiftKey&&!e.altKey&&e.key===`PageUp`;if(d)return e.preventDefault(),s=a.get(`jumpToPage`),u=c.current+1,void(s&&u<i&&s(u));if(f)return e.preventDefault(),void function(){var e=a.get(`jumpToPage`),t=c.current-1;e&&t>=0&&e(t)}();if(t.isMac()?e.metaKey&&!e.ctrlKey:e.altKey)switch(e.key){case`ArrowLeft`:e.preventDefault(),function(){var e=a.get(`jumpToPreviousDestination`);e&&e()}();break;case`ArrowRight`:e.preventDefault(),function(){var e=a.get(`jumpToNextDestination`);e&&e()}()}}};return r.useEffect((function(){var e=n.current;if(e)return document.addEventListener(`keydown`,f),e.addEventListener(`mouseenter`,u),e.addEventListener(`mouseleave`,d),function(){document.removeEventListener(`keydown`,f),e.removeEventListener(`mouseenter`,u),e.removeEventListener(`mouseleave`,d)}}),[n.current]),r.createElement(r.Fragment,null)};e.DownArrowIcon=i,e.NextIcon=a,e.PreviousIcon=T,e.UpArrowIcon=f,e.pageNavigationPlugin=function(e){var n=r.useMemo((function(){return Object.assign({},{enableShortcuts:!0},e)}),[]),i=r.useMemo((function(){return t.createStore()}),[]),a=function(e){return r.createElement(h,o({},e,{store:i}))},s=function(e){return r.createElement(y,o({},e,{store:i}))},c=function(e){return r.createElement(C,o({},e,{store:i}))},u=function(e){return r.createElement(O,o({},e,{store:i}))};return{install:function(e){i.update(`jumpToDestination`,e.jumpToDestination),i.update(`jumpToNextDestination`,e.jumpToNextDestination),i.update(`jumpToNextPage`,e.jumpToNextPage),i.update(`jumpToPage`,e.jumpToPage),i.update(`jumpToPreviousDestination`,e.jumpToPreviousDestination),i.update(`jumpToPreviousPage`,e.jumpToPreviousPage)},renderViewer:function(e){var t=e.slot;if(!n.enableShortcuts)return t;var a={children:r.createElement(r.Fragment,null,r.createElement(j,{containerRef:e.containerRef,numPages:e.doc.numPages,store:i}),t.children)};return o(o({},t),a)},onDocumentLoad:function(e){i.update(`doc`,e.doc),i.update(`numberOfPages`,e.doc.numPages)},onViewerStateChange:function(e){return i.update(`currentPage`,e.pageIndex),e},jumpToNextPage:function(){var e=i.get(`jumpToNextPage`);e&&e()},jumpToPage:function(e){var t=i.get(`jumpToPage`);t&&t(e)},jumpToPreviousPage:function(){var e=i.get(`jumpToPreviousPage`);e&&e()},CurrentPageInput:function(){return r.createElement(l,{store:i})},CurrentPageLabel:function(e){return r.createElement(d,o({},e,{store:i}))},GoToFirstPage:a,GoToFirstPageButton:function(){return r.createElement(a,null,(function(e){return r.createElement(m,o({},e))}))},GoToFirstPageMenuItem:function(e){return r.createElement(a,null,(function(t){return r.createElement(g,{isDisabled:t.isDisabled,onClick:function(){t.onClick(),e.onClick()}})}))},GoToLastPage:s,GoToLastPageButton:function(){return r.createElement(s,null,(function(e){return r.createElement(v,o({},e))}))},GoToLastPageMenuItem:function(e){return r.createElement(s,null,(function(t){return r.createElement(b,{isDisabled:t.isDisabled,onClick:function(){t.onClick(),e.onClick()}})}))},GoToNextPage:c,GoToNextPageButton:function(){return r.createElement(c,null,(function(e){return r.createElement(S,o({},e))}))},GoToNextPageMenuItem:function(e){return r.createElement(c,null,(function(t){return r.createElement(w,{isDisabled:t.isDisabled,onClick:function(){t.onClick(),e.onClick()}})}))},GoToPreviousPage:u,GoToPreviousPageButton:function(){return r.createElement(u,null,(function(e){return r.createElement(D,o({},e))}))},GoToPreviousPageMenuItem:function(e){return r.createElement(u,null,(function(t){return r.createElement(k,{isDisabled:t.isDisabled,onClick:function(){t.onClick(),e.onClick()}})}))},NumberOfPages:function(e){return r.createElement(A,o({},e,{store:i}))}}}})),require_lib$9=__commonJSMin(((e,t)=>{t.exports=require_page_navigation_min()})),require_print_min=__commonJSMin((e=>{var t=require_lib$17(),n=require_react(),r=require_react_dom();function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var a,o=i(n),s=function(){return o.createElement(t.Icon,{size:16},o.createElement(`path`,{d:`M7.5,19.499h9 M7.5,16.499h9 M5.5,16.5h-3c-1.103-0.003-1.997-0.897-2-2v-6c0.003-1.103,0.897-1.997,2-2h19 73 c1.103,0.003,1.997,0.897,2,2v6c-0.003,1.103-0.897,1.997-2,2h-3 74 M5.5,4.5v-4h9.586c0.265,0,0.52,0.105,0.707,0.293l2.414,2.414 75 C18.395,3.394,18.5,3.649,18.5,3.914V4.5
76 M18.5,22.5c0,0.552-0.448,1-1,1h-11c-0.552,0-1-0.448-1-1v-9h13V22.5z 77 M3.5,8.499 78 c0.552,0,1,0.448,1,1s-0.448,1-1,1s-1-0.448-1-1S2.948,8.499,3.5,8.499z 79 M14.5,0.499v4h4`}))},c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)},l={left:0,top:8},u=function(e){var n=e.enableShortcuts,r=e.onClick,i=o.useContext(t.LocalizationContext).l10n,a=i&&i.print?i.print.print:`Print`,c=n?t.isMac()?`Meta+P`:`Ctrl+P`:``;return o.createElement(t.Tooltip,{ariaControlsSuffix:`print`,position:t.Position.BottomCenter,target:o.createElement(t.MinimalButton,{ariaKeyShortcuts:c,ariaLabel:a,testId:`print__button`,onClick:r},o.createElement(s,null)),content:function(){return a},offset:l})};(function(e){e.CheckingPermission=`CheckingPermission`,e.Inactive=`Inactive`,e.Preparing=`Preparing`,e.Cancelled=`Cancelled`,e.Ready=`Ready`})(a||={});var d=function(e){var t=e.children,n=e.enableShortcuts,r=e.store;return(t||u)({enableShortcuts:n,onClick:function(){r.update(`printStatus`,a.CheckingPermission)}})},f=function(e){var n=e.doc,r=e.store,i=o.useContext(t.LocalizationContext).l10n,s=o.useState(!0),c=s[0],l=s[1];return o.useEffect((function(){n.getPermissions().then((function(e){e===null||e.includes(4)||e.includes(2048)?r.update(`printStatus`,a.Preparing):l(!1)}))}),[]),c?o.createElement(o.Fragment,null):o.createElement(t.Modal,{ariaControlsSuffix:`print-permission`,closeOnClickOutside:!1,closeOnEscape:!1,content:function(e){return o.createElement(o.Fragment,null,o.createElement(`div`,{className:`rpv-print__permission-body`},i&&i.print?i.print.disallowPrint:`The document does not allow to print`),o.createElement(`div`,{className:`rpv-print__permission-footer`},o.createElement(t.Button,{onClick:function(){e(),r.update(`printStatus`,a.Cancelled)}},i&&i.print?i.print.close:`Close`)))},isOpened:!0})},p=function(e){var n=e.numLoadedPages,r=e.numPages,i=e.onCancel,a=o.useContext(t.LocalizationContext).l10n,s=o.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,c=Math.floor(100*n/r);return o.createElement(`div`,{className:`rpv-print__progress`},o.createElement(`div`,{className:t.classNames({"rpv-print__progress-body":!0,"rpv-print__progress-body--rtl":s})},o.createElement(`div`,{className:`rpv-print__progress-message`},a&&a.print?a.print.preparingDocument:`Preparing document ...`),o.createElement(`div`,{className:`rpv-print__progress-bar`},o.createElement(t.ProgressBar,{progress:c})),o.createElement(t.Button,{onClick:i},a&&a.print?a.print.cancel:`Cancel`)))},m=function(e){var n=e.canvas,r=e.page,i=e.pageHeight,a=e.pageIndex,s=e.pageWidth,c=e.rotation,l=e.onLoad,u=t.useIsMounted(),d=o.useRef(),f=o.useState(``),p=f[0],m=f[1],h=o.useMemo((function(){return typeof process<`u`&&{}.JEST_WORKER_ID!==void 0}),[]);return o.useEffect((function(){var e=d.current;e&&e.cancel();var t=150/72;n.height=Math.floor(i*t),n.width=Math.floor(s*t);var a=n.getContext(`2d`);a.save(),a.fillStyle=`rgb(255, 255, 255)`,a.fillRect(0,0,n.width,n.height),a.restore();var o=r.getViewport({rotation:c,scale:1});d.current=r.render({canvasContext:a,intent:`print`,transform:[t,0,0,t,0,0],viewport:o}),d.current.promise.then((function(){`toBlob`in n&&`createObjectURL`in URL?n.toBlob((function(e){u.current&&m(URL.createObjectURL(e)),h&&l()})):(u.current&&m(n.toDataURL()),h&&l())}),(function(){}))}),[]),p&&o.createElement(`div`,{className:`rpv-print__page`},o.createElement(`img`,{"data-testid":`print__thumbnail-${a}`,src:p,onLoad:function(){h||l()}}))},h=function(e){var n=e.canvas,r=e.doc,i=e.pageIndex,a=e.pageRotation,s=e.pageSize,c=e.rotation,l=e.shouldRender,u=e.onLoad,d=t.useIsMounted(),f=o.useState(null),p=f[0],h=f[1],g=Math.abs(c+a)%180==0;o.useEffect((function(){l&&t.getPage(r,i).then((function(e){d.current&&h(e)}))}),[l]);var _=(s.rotation+c+a)%360;return p&&o.createElement(m,{canvas:n,page:p,pageHeight:g?s.pageHeight:s.pageWidth,pageIndex:i,pageWidth:g?s.pageWidth:s.pageHeight,rotation:_,onLoad:u})},g=function(e){var t=e.doc,n=e.numLoadedPages,i=e.pagesRotation,s=e.pageSizes,c=e.printPages,l=e.printStatus,u=e.rotation,d=e.onCancel,f=e.onLoad,p=o.useMemo((function(){return document.createElement(`canvas`)}),[]),m=o.useMemo((function(){var e=document.querySelector(`.rpv-print__zone`);if(e)return e;var t=document.createElement(`div`);return t.classList.add(`rpv-print__zone`),t.setAttribute(`data-testid`,`print__zone`),document.body.appendChild(t),t}),[]);o.useEffect((function(){l===a.Ready&&(document.documentElement.classList.add(`rpv-print__html-printing`),document.body.classList.add(`rpv-print__body-printing`),window.print());var e=function(){if(l===a.Ready){document.documentElement.classList.remove(`rpv-print__html-printing`),document.body.classList.remove(`rpv-print__body-printing`);var t=document.querySelectorAll(`.rpv-print__zone`);t&&t.forEach((function(e){e.parentElement.removeChild(e)})),p.height=0,p.width=0,document.removeEventListener(`mousemove`,e),d()}};return document.addEventListener(`mousemove`,e),function(){return document.removeEventListener(`mousemove`,e)}}),[l]);var g=s[0].pageHeight,_=s[0].pageWidth;return r.createPortal(o.createElement(o.Fragment,null,c.map((function(e,r){return o.createElement(h,{key:e,canvas:p,doc:t,pageIndex:e,pageRotation:i.has(e)?i.get(e):0,pageSize:s[e],rotation:u,shouldRender:r===n,onLoad:f})})),o.createElement(`style`,{dangerouslySetInnerHTML:{__html:`@page { size: ${_}pt ${g}pt }`}})),m)},_=function(e){var t=e.doc,n=e.pagesRotation,r=e.pageSizes,i=e.renderProgressBar,s=e.rotation,c=e.setPages,l=e.store,u=o.useState(a.Inactive),d=u[0],m=u[1],h=o.useState(0),_=h[0],v=h[1],y=o.useMemo((function(){var e=t.numPages;return c(t).filter((function(t){return t>=0&&t<e}))}),[t,c]),b=y.length,x=function(){v(0),m(a.Inactive)}
79,S=function(e){return m(e)};return o.useEffect((function(){return l.subscribe(`printStatus`,S),function(){l.unsubscribe(`printStatus`,S)}}),[]),o.createElement(o.Fragment,null,d===a.CheckingPermission&&o.createElement(f,{doc:t,store:l}),d===a.Preparing&&(i?i(_,b,x):o.createElement(p,{numLoadedPages:_,numPages:b,onCancel:x})),(d===a.Preparing||d===a.Ready)&&_<=b&&o.createElement(g,{doc:t,numLoadedPages:_,pagesRotation:n,pageSizes:r,printPages:y,printStatus:d,rotation:s,onCancel:x,onLoad:function(){var e=_+1;e<=b&&(v(e),e===b&&m(a.Ready))}}))},v=function(e){var n=e.onClick,r=o.useContext(t.LocalizationContext).l10n,i=r&&r.print?r.print.print:`Print`;return o.createElement(t.MenuItem,{icon:o.createElement(s,null),testId:`print__menu`,onClick:n},i)},y=function(e){var n=e.containerRef,r=e.store,i=function(e){if(!e.shiftKey&&!e.altKey&&e.key===`p`&&(t.isMac()?e.metaKey:e.ctrlKey)){var i=n.current;i&&document.activeElement&&i.contains(document.activeElement)&&(e.preventDefault(),r.update(`printStatus`,a.Preparing))}};return o.useEffect((function(){if(n.current)return document.addEventListener(`keydown`,i),function(){document.removeEventListener(`keydown`,i)}}),[n.current]),o.createElement(o.Fragment,null)};e.PrintIcon=s,e.getAllPagesNumbers=function(e){return Array(e.numPages).fill(0).map((function(e,t){return t}))},e.getCustomPagesNumbers=function(e){return function(t){var n,r=[];return e.replace(/\s+/g,``).split(`,`).forEach((function(e){var t,n,i=e.split(`-`).map((function(e){return parseInt(e,10)})).filter((function(e){return Number.isInteger(e)}));i.length===1?r.push(i[0]-1):i.length===2&&r.push.apply(r,(t=i[0]-1,n=i[1]-1,Array(n-t+1).fill(0).map((function(e,n){return t+n}))))})),(n=r,n.filter((function(e){return n.indexOf(e)===n.lastIndexOf(e)}))).filter((function(e){return e>=0&&e<t.numPages}))}},e.getEvenPagesNumbers=function(e){return Array(e.numPages).fill(0).map((function(e,t){return t})).filter((function(e){return(e+1)%2==0}))},e.getOddPagesNumbers=function(e){return Array(e.numPages).fill(0).map((function(e,t){return t})).filter((function(e){return(e+1)%2==1}))},e.printPlugin=function(e){var n=o.useMemo((function(){return Object.assign({},{enableShortcuts:!0,setPages:function(e){return Array(e.numPages).fill(0).map((function(e,t){return t}))}},e)}),[]),r=o.useMemo((function(){return t.createStore({printStatus:a.Inactive})}),[]),i=function(e){return o.createElement(d,c({enableShortcuts:n.enableShortcuts},e,{store:r}))};return{print:function(){r.update(`printStatus`,a.CheckingPermission)},renderViewer:function(t){var i=t.slot,a={children:o.createElement(o.Fragment,null,n.enableShortcuts&&o.createElement(y,{containerRef:t.containerRef,store:r}),o.createElement(_,{doc:t.doc,pagesRotation:t.pagesRotation,pageSizes:t.pageSizes,renderProgressBar:e?.renderProgressBar,rotation:t.rotation,setPages:n.setPages,store:r}),i.children)};return c(c({},i),a)},Print:i,PrintButton:function(){return o.createElement(i,null,(function(e){return o.createElement(u,c({},e))}))},PrintMenuItem:function(e){return o.createElement(i,null,(function(t){return o.createElement(v,{onClick:function(){t.onClick(),e.onClick()}})}))},setPages:function(e){n.setPages=e}}}})),require_lib$8=__commonJSMin(((e,t)=>{t.exports=require_print_min()})),require_properties_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M12,1.001c6.075,0,11,4.925,11,11s-4.925,11-11,11s-11-4.925-11-11S5.925,1.001,12,1.001z 80 M14.5,17.005H13 81 c-0.552,0-1-0.448-1-1v-6.5c0-0.276-0.224-0.5-0.5-0.5H10 82 M11.745,6.504L11.745,6.504 83 M11.745,6.5c-0.138,0-0.25,0.112-0.25,0.25 84 S11.607,7,11.745,7s0.25-0.112,0.25-0.25S11.883,6.5,11.745,6.5`}))},a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)},o=function(e){var n=e.doc,i=e.render,a=r.useState(),o=a[0],s=a[1];return r.useEffect((function(){n.getMetadata().then((function(e){return Promise.resolve(e)})).then((function(e){return n.getDownloadInfo().then((function(t){return Promise.resolve({fileName:e.contentDispositionFilename||``,info:e.info,length:t.length})}
84))})).then((function(e){s(e)}))}),[]),o?i(o):r.createElement(`div`,{className:`rpv-properties__loader`},r.createElement(t.Spinner,null))},s=function(e){var n=e.label,i=e.value,a=r.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft;return r.createElement(`dl`,{className:t.classNames({"rpv-properties__item":!0,"rpv-properties__item--rtl":a})},r.createElement(`dt`,{className:`rpv-properties__item-label`},n,`:`),r.createElement(`dd`,{className:`rpv-properties__item-value`},i||`-`))},c=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?`),l=function(e,t,n,r){var i=parseInt(e,10);return i>=t&&i<=n?i:r},u=function(e){var n=e.doc,i=e.fileName,a=e.onToggle,u=r.useContext(t.LocalizationContext).l10n,d=function(e){var t=function(e){var t=c.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=l(t[2],1,12,1)-1,i=l(t[3],1,31,1),a=l(t[4],0,23,0),o=l(t[5],0,59,0),s=l(t[6],0,59,0),u=t[7]||`Z`,d=l(t[8],0,23,0),f=l(t[9],0,59,0);switch(u){case`-`:a+=d,o+=f;break;case`+`:a-=d,o-=f}return new Date(Date.UTC(n,r,i,a,o,s))}(e);return t?`${t.toLocaleDateString()}, ${t.toLocaleTimeString()}`:``};return r.createElement(`div`,{className:`rpv-properties__modal`},r.createElement(o,{doc:n,render:function(e){return r.createElement(r.Fragment,null,r.createElement(`div`,{className:`rpv-properties__modal-section`},r.createElement(s,{label:u&&u.properties?u.properties.fileName:`File name`,value:e.fileName||(c=i,l=c.split(`/`).pop(),l?l.split(`#`)[0].split(`?`)[0]:c)}),r.createElement(s,{label:u&&u.properties?u.properties.fileSize:`File size`,value:(a=e.length,o=Math.floor(Math.log(a)/Math.log(1024)),`${(a/1024**o).toFixed(2)} ${[`B`,`kB`,`MB`,`GB`,`TB`][o]}`)})),r.createElement(t.Separator,null),r.createElement(`div`,{className:`rpv-properties__modal-section`},r.createElement(s,{label:u&&u.properties?u.properties.title:`Title`,value:e.info.Title}),r.createElement(s,{label:u&&u.properties?u.properties.author:`Author`,value:e.info.Author}),r.createElement(s,{label:u&&u.properties?u.properties.subject:`Subject`,value:e.info.Subject}),r.createElement(s,{label:u&&u.properties?u.properties.keywords:`Keywords`,value:e.info.Keywords}),r.createElement(s,{label:u&&u.properties?u.properties.creator:`Creator`,value:e.info.Creator}),r.createElement(s,{label:u&&u.properties?u.properties.creationDate:`Creation date`,value:d(e.info.CreationDate)}),r.createElement(s,{label:u&&u.properties?u.properties.modificationDate:`Modification date`,value:d(e.info.ModDate)})),r.createElement(t.Separator,null),r.createElement(`div`,{className:`rpv-properties__modal-section`},r.createElement(s,{label:u&&u.properties?u.properties.pdfProducer:`PDF producer`,value:e.info.Producer}),r.createElement(s,{label:u&&u.properties?u.properties.pdfVersion:`PDF version`,value:e.info.PDFFormatVersion}),r.createElement(s,{label:u&&u.properties?u.properties.pageCount:`Page count`,value:`${n.numPages}`})));var a,o,c,l}}),r.createElement(`div`,{className:`rpv-properties__modal-footer`},r.createElement(t.Button,{onClick:a},u&&u.properties?u.properties.close:`Close`)))},d={left:0,top:8},f=function(e){var n=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.properties?a.properties.showProperties:`Show properties`;return r.createElement(t.Tooltip,{ariaControlsSuffix:`properties`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:o,testId:`properties__button`,onClick:n},r.createElement(i,null)),content:function(){return o},offset:d})},p=function(e){var n=e.children,i=e.store,o=function(e){var t=r.useState(e.get(`doc`)),n=t[0],i=t[1],a=function(e){i(e)};return r.useEffect((function(){return e.subscribe(`doc`,a),function(){e.unsubscribe(`doc`,a)}}),[]),{currentDoc:n}}(i).currentDoc,s=i.get(`fileName`)||``,c=n||function(e){return r.createElement(f,a({},e))};return o?r.createElement(t.Modal,{ariaControlsSuffix:`properties`,target:function(e){return c({onClick:e})},content:function(e){return r.createElement(u,{doc:o,fileName:s,onToggle:e})},closeOnClickOutside:!0,closeOnEscape:!0}):r.createElement(r.Fragment,null)},m=function(e){var n=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.properties?a.properties.showProperties:`Show properties`;return r.createElement(t.MenuItem,{icon:r.createElement(i,null),testId:`properties__menu`,onClick:n},o)};e.InfoIcon=i,e.propertiesPlugin=function(){var e=r.useMemo((function(){return t.createStore({fileName:``})}),[]),n=function(t){return r.createElement(p,a({},t,{store:e}))};return{onDocumentLoad:function(t){e.update(`doc`,t.doc)},onViewerStateChange:function(t){return e.update(`fileName`,t.file.name),t},ShowProperties:n,ShowPropertiesButton:function(){return r.createElement(p,{store:e})},ShowPropertiesMenuItem:function(e){return r.createElement(n,null,(function(e){return r.createElement(m,a({},e))}))}}}})),require_lib$7=__commonJSMin(((e,t)=>{t.exports=require_properties_min()})),require_rotate_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{ignoreDirection:!0,size:16},r.createElement(`path`,{d:`M3.434,10.537c0.141-0.438,0.316-0.864,0.523-1.274 85 M3.069,14.425C3.023,14.053,3,13.679,3,13.305 c0-0.291,0.014-0.579,0.041-0.863
86 M4.389,18.111c-0.341-0.539-0.623-1.112-0.843-1.711 87 M7.163,20.9 c-0.543-0.345-1.048-0.747-1.506-1.2 88 M10.98,22.248c-0.65-0.074-1.29-0.218-1.909-0.431 89 M10,4.25h2 c4.987,0.015,9.017,4.069,9.003,9.055c-0.013,4.581-3.456,8.426-8.008,8.945 90 M13.5,1.75L10,4.25l3.5,2.5`}))},a=function(){return r.createElement(t.Icon,{ignoreDirection:!0,size:16},r.createElement(`path`,{d:`M20.566,10.537c-0.141-0.438-0.316-0.864-0.523-1.274 91 M20.931,14.425C20.977,14.053,21,13.679,21,13.305 c0-0.291-0.014-0.579-0.041-0.863 92 M19.611,18.111c0.341-0.539,0.624-1.114,0.843-1.713 93 M16.837,20.9 c0.543-0.345,1.048-0.747,1.506-1.2 94 M13.02,22.248c0.65-0.074,1.29-0.218,1.909-0.431 95 M14,4.25h-2 c-4.987,0.015-9.017,4.069-9.003,9.055c0.013,4.581,3.456,8.426,8.008,8.945 96 M10.5,1.75l3.5,2.5l-3.5,2.5`}))},o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)},s={left:0,top:8},c=function(e){var n=e.direction,o=e.onClick,c=r.useContext(t.LocalizationContext).l10n,l=c&&c.rotate?c.rotate.rotateBackward:`Rotate counterclockwise`,u=c&&c.rotate?c.rotate.rotateForward:`Rotate clockwise`,d=n===t.RotateDirection.Backward?l:u,f=n===t.RotateDirection.Backward?r.createElement(i,null):r.createElement(a,null);return r.createElement(t.Tooltip,{ariaControlsSuffix:`rotate`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:d,testId:n===t.RotateDirection.Backward?`rotate__backward-button`:`rotate__forward-button`,onClick:o},f),content:function(){return d},offset:s})},l=function(e){var t=e.children,n=e.direction,i=e.store;return(t||function(e){return r.createElement(c,{direction:e.direction,onClick:e.onClick})})({direction:n,onClick:function(){var e=i.get(`rotate`);e&&e(n)}})},u=function(e){var n=e.direction,o=e.onClick,s=r.useContext(t.LocalizationContext).l10n,c=s&&s.rotate?s.rotate.rotateBackward:`Rotate counterclockwise`,l=s&&s.rotate?s.rotate.rotateForward:`Rotate clockwise`,u=n===t.RotateDirection.Backward?c:l,d=n===t.RotateDirection.Backward?r.createElement(i,null):r.createElement(a,null);return r.createElement(t.MenuItem,{icon:d,testId:n===t.RotateDirection.Backward?`rotate__backward-menu`:`rotate__forward-menu`,onClick:o},u)},d=function(e){var t=e.children,n=e.store;return t({onRotatePage:function(e,t){var r=n.get(`rotatePage`);r&&r(e,t)}})};e.RotateBackwardIcon=i,e.RotateForwardIcon=a,e.rotatePlugin=function(){var e=r.useMemo((function(){return t.createStore()}),[]),n=function(t){return r.createElement(l,o({},t,{store:e}))};return{install:function(t){e.update(`rotate`,t.rotate),e.update(`rotatePage`,t.rotatePage)},Rotate:n,RotateBackwardButton:function(){return r.createElement(n,{direction:t.RotateDirection.Backward},(function(e){return r.createElement(c,o({},e))}))},RotateBackwardMenuItem:function(e){return r.createElement(n,{direction:t.RotateDirection.Backward},(function(t){return r.createElement(u,{direction:t.direction,onClick:function(){t.onClick(),e.onClick()}})}))},RotateForwardButton:function(){return r.createElement(n,{direction:t.RotateDirection.Forward},(function(e){return r.createElement(c,o({},e))}))},RotateForwardMenuItem:function(e){return r.createElement(n,{direction:t.RotateDirection.Forward},(function(t){return r.createElement(u,{direction:t.direction,onClick:function(){t.onClick(),e.onClick()}})}))},RotatePage:function(t){return r.createElement(d,o({},t,{store:e}))}}}})),require_lib$6=__commonJSMin(((e,t)=>{t.exports=require_rotate_min()})),require_scroll_mode_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16},r.createElement(`rect`,{x:`0.5`,y:`0.497`,width:`22`,height:`22`,rx:`1`,ry:`1`}),r.createElement(`line`,{x1:`0.5`,y1:`6.497`,x2:`22.5`,y2:`6.497`}),r.createElement(`line`,{x1:`11.5`,y1:`6.497`,x2:`11.5`,y2:`22.497`}))},a=function(){return r.createElement(t.Icon,{size:16},r.createElement(`rect`,{x:`0.5`,y:`0.497`,width:`22`,height:`22`,rx:`1`,ry:`1`}),r.createElement(`line`,{x1:`11.5`,y1:`0.497`,x2:`11.5`,y2:`22.497`}))},o=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M6.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z 97 M14.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z 98 M22.5,21.5 c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z`}))},s=function(){return r.createElement(t.Icon,{size:16},r.createElement(`rect`,{x:`0.5`,y:`0.497`,width:`22`,height:`22`,rx:`1`,ry:`1`}))},c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)},l=function(e,n){e.get(`switchScrollMode`)(n);
98var r=e.get(`viewMode`);n!==t.ScrollMode.Horizontal&&n!==t.ScrollMode.Wrapped||r===t.ViewMode.SinglePage||e.get(`switchViewMode`)(t.ViewMode.SinglePage)},u=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M23.5,5.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V5.5z 99 M23.5,13.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V13.5z 100 M23.5,21.5 c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V21.5z`}))},d=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M10.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z 101 M23.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z 102 M10.5,22.5 c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z 103 M23.5,22.5c0,0.552-0.448,1-1,1 h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z`}))},f=function(e){var n=e.children,i=e.mode,a=e.onClick,c=r.useContext(t.LocalizationContext).l10n,l=``,f=r.createElement(u,null);switch(i){case t.ScrollMode.Horizontal:l=c&&c.scrollMode?c.scrollMode.horizontalScrolling:`Horizontal scrolling`,f=r.createElement(o,null);break;case t.ScrollMode.Page:l=c&&c.scrollMode?c.scrollMode.pageScrolling:`Page scrolling`,f=r.createElement(s,null);break;case t.ScrollMode.Wrapped:l=c&&c.scrollMode?c.scrollMode.wrappedScrolling:`Wrapped scrolling`,f=r.createElement(d,null);break;case t.ScrollMode.Vertical:default:l=c&&c.scrollMode?c.scrollMode.verticalScrolling:`Vertical scrolling`,f=r.createElement(u,null)}return n({icon:f,label:l,onClick:a})},p={left:0,top:8},m=function(e){var n=e.isDisabled,i=e.isSelected,a=e.mode,o=e.onClick,s=``;switch(a){case t.ScrollMode.Horizontal:s=`scroll-mode__horizontal-button`;break;case t.ScrollMode.Page:s=`scroll-mode__page-button`;break;case t.ScrollMode.Wrapped:s=`scroll-mode__wrapped-button`;break;case t.ScrollMode.Vertical:default:s=`scroll-mode__vertical-button`}return r.createElement(f,{mode:a,onClick:o},(function(e){return r.createElement(t.Tooltip,{ariaControlsSuffix:`scroll-mode-switch`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:e.label,isDisabled:n,isSelected:i,testId:s,onClick:e.onClick},e.icon),content:function(){return e.label},offset:p})}))},h=function(e){var n=r.useState(e.get(`scrollMode`)||t.ScrollMode.Vertical),i=n[0],a=n[1],o=function(e){a(e)};return r.useEffect((function(){return e.subscribe(`scrollMode`,o),function(){e.unsubscribe(`scrollMode`,o)}}),[]),{scrollMode:i}},g=function(e){var n=r.useState(e.get(`viewMode`)||t.ViewMode.SinglePage),i=n[0],a=n[1],o=function(e){a(e)};return r.useEffect((function(){return e.subscribe(`viewMode`,o),function(){e.unsubscribe(`viewMode`,o)}}),[]),{viewMode:i}},_=function(e){var n=e.children,i=e.mode,a=e.store,o=g(a).viewMode,s=h(a).scrollMode===i,c=(i===t.ScrollMode.Horizontal||i===t.ScrollMode.Wrapped)&&o!==t.ViewMode.SinglePage;return(n||function(e){return r.createElement(m,{isDisabled:c,isSelected:s,mode:e.mode,onClick:e.onClick})})({isDisabled:c,isSelected:s,mode:i,onClick:function(){l(a,i)}})},v=function(e){var n=e.isDisabled,i=e.isSelected,a=e.mode,o=e.onClick,s=``;switch(a){case t.ScrollMode.Horizontal:s=`scroll-mode__horizontal-menu`;break;case t.ScrollMode.Page:s=`scroll-mode__page-menu`;break;case t.ScrollMode.Wrapped:s=`scroll-mode__wrapped-menu`;break;case t.ScrollMode.Vertical:default:s=`scroll-mode__vertical-menu`}return r.createElement(f,{mode:a,onClick:o},(function(e){return r.createElement(t.MenuItem,{checked:i,icon:e.icon,isDisabled:n,testId:s,onClick:e.onClick},e.label)}))},y=function(e,n){e.get(`switchViewMode`)(n);var r=e.get(`scrollMode`);r!==t.ScrollMode.Horizontal&&r!==t.ScrollMode.Wrapped||n===t.ViewMode.SinglePage||e.get(`switchScrollMode`)(t.ScrollMode.Vertical)},b=function(e){var n=e.children,o=e.mode,c=e.onClick,l=r.useContext(t.LocalizationContext).l10n,u=``,d=r.createElement(s,null);switch(o){case t.ViewMode.DualPage:u=l&&l.scrollMode?l.scrollMode.dualPage:`Dual page`,d=r.createElement(a,null);break;case t.ViewMode.DualPageWithCover:u=l&&l.scrollMode?l.scrollMode.dualPageCover:`Dual page with cover`,d=r.createElement(i,null);break;case t.ViewMode.SinglePage:default:u=l&&l.scrollMode?l.scrollMode.singlePage:`Single page`,d=r.createElement(s,null)}return n({icon:d,label:u,onClick:c})},x={left:0,top:8},S=function(e){var n=e.isDisabled,i=e.isSelected,a=e.mode,o=e.onClick,s=``;switch(a){case t.ViewMode.DualPage:s=`view-mode__dual-button`;break;case t.ViewMode.DualPageWithCover:s=`view-mode__dual-cover-button`;break;case t.ViewMode.SinglePage:default:s=`view-mode__single-button`}return r.createElement(b,{mode:a,onClick:o}
103,(function(e){return r.createElement(t.Tooltip,{ariaControlsSuffix:`view-mode-switch`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:e.label,isDisabled:n,isSelected:i,testId:s,onClick:e.onClick},e.icon),content:function(){return e.label},offset:x})}))},C=function(e){var n=e.children,i=e.mode,a=e.store,o=g(a).viewMode,s=h(a).scrollMode,c=o===i,l=(s===t.ScrollMode.Horizontal||s===t.ScrollMode.Wrapped)&&i!==t.ViewMode.SinglePage;return(n||function(e){return r.createElement(S,{isDisabled:l,isSelected:c,mode:e.mode,onClick:e.onClick})})({isDisabled:l,isSelected:c,mode:i,onClick:function(){y(a,i)}})},w=function(e){var n=e.isDisabled,i=e.isSelected,a=e.mode,o=e.onClick,s=``;switch(a){case t.ViewMode.DualPage:s=`view-mode__dual-menu`;break;case t.ViewMode.DualPageWithCover:s=`view-mode__dual-cover-menu`;break;case t.ViewMode.SinglePage:default:s=`view-mode__single-menu`}return r.createElement(b,{mode:a,onClick:o},(function(e){return r.createElement(t.MenuItem,{checked:i,icon:e.icon,isDisabled:n,testId:s,onClick:e.onClick},e.label)}))};e.DualPageCoverViewModeIcon=i,e.DualPageViewModeIcon=a,e.HorizontalScrollingIcon=o,e.PageScrollingIcon=s,e.VerticalScrollingIcon=u,e.WrappedScrollingIcon=d,e.scrollModePlugin=function(){var e=r.useMemo((function(){return t.createStore({scrollMode:t.ScrollMode.Vertical,viewMode:t.ViewMode.SinglePage,switchScrollMode:function(){},switchViewMode:function(){}})}),[]),n=function(t){return r.createElement(_,c({},t,{store:e}))},i=function(t){return r.createElement(C,c({},t,{store:e}))};return{install:function(t){e.update(`switchScrollMode`,t.switchScrollMode),e.update(`switchViewMode`,t.switchViewMode)},onViewerStateChange:function(t){return e.update(`scrollMode`,t.scrollMode),e.update(`viewMode`,t.viewMode),t},switchScrollMode:function(t){l(e,t)},switchViewMode:function(t){y(e,t)},SwitchScrollMode:n,SwitchScrollModeButton:function(e){return r.createElement(n,{mode:e.mode},(function(e){return r.createElement(m,{isDisabled:e.isDisabled,isSelected:e.isSelected,mode:e.mode,onClick:function(){e.onClick()}})}))},SwitchScrollModeMenuItem:function(e){return r.createElement(n,{mode:e.mode},(function(t){return r.createElement(v,{isDisabled:t.isDisabled,isSelected:t.isSelected,mode:t.mode,onClick:function(){t.onClick(),e.onClick()}})}))},SwitchViewMode:i,SwitchViewModeButton:function(e){return r.createElement(i,{mode:e.mode},(function(e){return r.createElement(S,{isDisabled:e.isDisabled,isSelected:e.isSelected,mode:e.mode,onClick:function(){e.onClick()}})}))},SwitchViewModeMenuItem:function(e){return r.createElement(i,{mode:e.mode},(function(t){return r.createElement(w,{isDisabled:t.isDisabled,isSelected:t.isSelected,mode:t.mode,onClick:function(){t.onClick(),e.onClick()}})}))}}}})),require_lib$5=__commonJSMin(((e,t)=>{t.exports=require_scroll_mode_min()})),require_search_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M0.541,5.627L11.666,18.2c0.183,0.207,0.499,0.226,0.706,0.043c0.015-0.014,0.03-0.028,0.043-0.043 104 L23.541,5.627`}))},a=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M23.535,18.373L12.409,5.8c-0.183-0.207-0.499-0.226-0.706-0.043C11.688,5.77,11.674,5.785,11.66,5.8 105 L0.535,18.373`}))},o=function(){return r.createElement(t.Icon,{ignoreDirection:!0,size:16},r.createElement(`path`,{d:`M10.5,0.5c5.523,0,10,4.477,10,10s-4.477,10-10,10s-10-4.477-10-10S4.977,0.5,10.5,0.5z 106 M23.5,23.5 107 l-5.929-5.929`}))},s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)},c={keyword:``,regExp:RegExp(` `),wholeWords:!1},l=function(e){return{left:`${e.left}%`,top:`${e.top}%`,height:`${e.height}%`,width:`${e.width}%`}},u=function(e){var n=e.index,i=e.area,a=e.onHighlightKeyword,o=r.useRef();return t.useIsomorphicLayoutEffect((function(){var e=o.current;a&&e&&a({highlightEle:e,keyword:i.keyword})}),[]),r.createElement(`div`,{className:`rpv-search__highlight`,"data-index":n,ref:o,style:l(i),title:i.keywordStr.trim()})},d=function(e){var t=e.parentNode;t&&t.removeChild(e)},f=function(e){var t=e.parentNode;if(t){var n=document.createRange();n.selectNodeContents(e),function(e,t){d(e);var n=t.parentNode;n&&n.insertBefore(e,t),d(t)}(n.extractContents(),e),t.normalize()}},p=function(e,t){return e.top<t.top?-1:e.top>t.top?1:e.left<t.left?-1:+(e.left>t.left)},m=function(e){var n=e.numPages,i=e.pageIndex,a=e.renderHighlights,o=e.store,s=e.onHighlightKeyword,d=r.useRef(),m=r.useCallback((function(e){return r.createElement(r.Fragment,null,e.highlightAreas.map((function(e,t){return r.createElement(u,{index:t,key:t,area:e,onHighlightKeyword:s})})))}),[]),h=a||m,g=r.useState(o.get(`matchPosition`)),_=g[0],v=g[1],y=r.useState(o.get(`keyword`)||[c]),b=y[0],x=y[1],S=r.useState({pageIndex:i,scale:1,status:t.LayerRenderStatus.PreRender}),C=S[0],w=S[1],T=r.useRef(null),E=r.useRef([]),D=r.useState([]),O=D[0],k=D[1],A=function(){return!0},j=r.useCallback((function(){return o.get(`targetPageFilter`)||A}),[o.get(`targetPageFilter`)]),M=function(e){var t=E.current;if(t.length===0)return[];var r=[],a=[].slice.call(e.querySelectorAll(`.rpv-core__text-layer-text`)),o=t.map((function(e){return e.char})).join(``);return b.forEach((function(s){var c=s.keyword;if(c.trim()){for(var l,u=s.regExp.flags.indexOf(`g`)===-1?new RegExp(s.regExp,`${s.regExp.flags}g`):s.regExp,d=[];(l=u.exec(o))!==null;)d.push({keyword:u,startIndex:l.index,endIndex:u.lastIndex});d.map((function(e){return{keyword:e.keyword,indexes:t.slice(e.startIndex,e.endIndex)}}
107)).forEach((function(t){var o=t.indexes.reduce((function(e,t){return e[t.spanIndex]=(e[t.spanIndex]||[]).concat([t]),e}),{});Object.values(o).forEach((function(o){if(o.length!==1||o[0].char.trim()!==``){var l=s.wholeWords?o.slice(1,-1):o,u=function(e,t,r,a,o){var s=document.createRange(),c=a.firstChild;if(!c||c.nodeType!==Node.TEXT_NODE)return null;var l=c.textContent.length,u=o[0].charIndexInSpan,d=o.length===1?u:o[o.length-1].charIndexInSpan;if(u>l||d+1>l)return null;s.setStart(c,u),s.setEnd(c,d+1);var p=document.createElement(`span`);s.surroundContents(p);var m=p.getBoundingClientRect(),h=r.getBoundingClientRect(),g=h.height,_=h.width,v=100*(m.left-h.left)/_,y=100*(m.top-h.top)/g,b=100*m.height/g,x=100*m.width/_;return f(p),{keyword:t,keywordStr:e,numPages:n,pageIndex:i,left:v,top:y,height:b,width:x,pageHeight:g,pageWidth:_}}(c,t.keyword,e,a[l[0].spanIndex],l);u&&r.push(u)}}))}))}})),r.sort(p)},N=function(e){e&&e.length>0&&x(e)},P=function(e){return v(e)},F=function(e){if(e.has(i)){var t=e.get(i);t&&w({ele:t.ele,pageIndex:i,scale:t.scale,status:t.status})}},I=function(){return b.length===0||b.length===1&&b[0].keyword.trim()===``};return r.useEffect((function(){if(!I()&&C.status===t.LayerRenderStatus.DidRender&&!E.current.length){var e=C.ele;E.current=[].slice.call(e.querySelectorAll(`.rpv-core__text-layer-text`)).map((function(e){return e.textContent})).reduce((function(e,t,n){return e.concat(t.split(``).map((function(e,t){return{char:e,charIndexInSpan:t,spanIndex:n}})))}),[{char:``,charIndexInSpan:0,spanIndex:0}]).slice(1)}}),[b,C.status]),r.useEffect((function(){if(!I()&&C.ele&&C.status===t.LayerRenderStatus.DidRender&&j()({pageIndex:i,numPages:n})){var e=C.ele;k(M(e))}}),[b,_,C.status,E.current]),r.useEffect((function(){I()&&C.ele&&C.status===t.LayerRenderStatus.DidRender&&k([])}),[b,C.status]),r.useEffect((function(){if(O.length!==0){var e=d.current;if(_.pageIndex===i&&e&&C.status===t.LayerRenderStatus.DidRender){var n=e.querySelector(`.rpv-search__highlight[data-index="${_.matchIndex}"]`);if(n){var r=function(e,t){for(var n=e.offsetTop,r=e.offsetLeft,i=e.parentElement;i&&i!==t;)n+=i.offsetTop,r+=i.offsetLeft,i=i.parentElement;return{left:r,top:n}}(n,e),a=r.left,s=r.top,c=o.get(`jumpToDestination`);c&&(c({pageIndex:i,bottomOffset:(e.getBoundingClientRect().height-s)/C.scale,leftOffset:a/C.scale,scaleTo:C.scale}),T.current&&T.current.classList.remove(`rpv-search__highlight--current`),T.current=n,n.classList.add(`rpv-search__highlight--current`))}}}}),[O,_]),r.useEffect((function(){return o.subscribe(`keyword`,N),o.subscribe(`matchPosition`,P),o.subscribe(`renderStatus`,F),function(){o.unsubscribe(`keyword`,N),o.unsubscribe(`matchPosition`,P),o.unsubscribe(`renderStatus`,F)}}),[]),r.createElement(`div`,{className:`rpv-search__highlights`,"data-testid":`search__highlights-${i}`,ref:d},h({getCssProperties:l,highlightAreas:O}))},h=function(e){var t,n=e.wholeWords?` ${e.keyword} `:e.keyword,r=e.matchCase?`g`:`gi`;return{keyword:e.keyword,regExp:new RegExp((t=n,t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)),r),wholeWords:e.wholeWords||!1}},g=function(e,t,n){return e instanceof RegExp?{keyword:e.source,regExp:e,wholeWords:n||!1}:typeof e==`string`?e===``?c:h({keyword:e,matchCase:t||!1,wholeWords:n||!1}):(t!==void 0&&(e.matchCase=t),n!==void 0&&(e.wholeWords=n),h(e))},_=function(e){var n,i=e.get(`initialKeyword`),a=r.useMemo((function(){if(i&&i.length===1){var e=g(i[0]);return{matchCase:e.regExp.flags.indexOf(`i`)===-1,wholeWords:e.wholeWords}}return{matchCase:!1,wholeWords:!1}}),[]),o=function(e){var t=r.useRef(e.get(`doc`)),n=function(e){t.current=e};return r.useEffect((function(){return e.subscribe(`doc`,n),function(){e.unsubscribe(`doc`,n)}}),[]),t}(e),s=r.useState(i),l=s[0],u=s[1],d=r.useState([]),f=d[0],p=d[1],m=r.useState(0),h=m[0],_=m[1],v=r.useState(a.matchCase),y=v[0],b=v[1],x=r.useRef([]),S=r.useState(a.wholeWords),C=S[0],w=S[1],T=function(){return!0},E=r.useCallback((function(){return e.get(`targetPageFilter`)||T}),[e.get(`targetPageFilter`)]),D=function(e){var t=f.length;if(l.length===0||t===0)return null;var n=e===t+1?1:Math.max(1,Math.min(t,e));return _(n),k(f[n-1])},O=function(e){return u(e===``?[]:[e])},k=function(t){var n=e.get(`jumpToPage`);return n&&n(t.pageIndex),e.update(`matchPosition`,{matchIndex:t.matchIndex,pageIndex:t.pageIndex}),t},A=function(n,r,i){var a=o.current;if(!a)return Promise.resolve([]);var s=a.numPages,c=n.map((function(e){return g(e,r,i)}));return e.update(`keyword`,c),_(0),p([]),new Promise((function(e,n){(x.current.length===0?function(){var e=o.current;if(!e)return Promise.resolve([]);var n=Array(e.numPages).fill(0).map((function(n,r){return t.getPage(e,r).then((function(e){return e.getTextContent()})).then((function(e){var t=e.items.map((function(e){return e.str||``})).join(``);return Promise.resolve({pageContent:t,pageIndex:r})}))}));return Promise.all(n).then((function(e){return e.sort((function(e,t){return e.pageIndex-t.pageIndex})),Promise.resolve(e.map((function(e){return e.pageContent})))}))}().then((function(e){return x.current=e,Promise.resolve(e)})):Promise.resolve(x.current)).then((function(t){var n=[];t.forEach((function(e,t){E()({pageIndex:t,numPages:s}
107)&&c.forEach((function(r){for(var i,a=0;(i=r.regExp.exec(e))!==null;)n.push({keyword:r.regExp,matchIndex:a,pageIndex:t,pageText:e,startIndex:i.index,endIndex:r.regExp.lastIndex}),a++}))})),p(n),n.length>0&&(_(1),k(n[0])),e(n)}))}))};return r.useEffect((function(){x.current=[]}),[o.current]),{clearKeyword:function(){e.update(`keyword`,[c]),O(``),_(0),p([]),b(!1),w(!1)},changeMatchCase:function(e){b(e),l.length>0&&A(l,e,C)},changeWholeWords:function(e){w(e),l.length>0&&A(l,y,e)},currentMatch:h,jumpToMatch:D,jumpToNextMatch:function(){return D(h+1)},jumpToPreviousMatch:function(){return D(h-1)},keywords:l,matchCase:y,numberOfMatches:f.length,wholeWords:C,search:function(){return A(l,y,C)},searchFor:A,setKeywords:u,keyword:l.length===0?``:(n=l[0],n instanceof RegExp?n.source:typeof n==`string`?n:n.keyword),setKeyword:O,setTargetPages:function(t){e.update(`targetPageFilter`,t)}}},v=function(e){var t=e.children,n=e.store,i=_(n),a=r.useState(!1),o=a[0],c=a[1],l=function(e){return c(!0)};return r.useEffect((function(){return n.subscribe(`doc`,l),function(){n.unsubscribe(`doc`,l)}}),[]),t(s(s({},i),{isDocumentLoaded:o}))},y=function(e){var n=e.containerRef,i=e.store,a=r.useRef(!1),o=function(){a.current=!0},s=function(){a.current=!1},c=function(e){var r=n.current;r&&(e.shiftKey||e.altKey||e.key!==`f`||(t.isMac()?e.metaKey&&!e.ctrlKey:e.ctrlKey)&&(a.current||document.activeElement&&r.contains(document.activeElement))&&(e.preventDefault(),i.update(`areShortcutsPressed`,!0)))};return r.useEffect((function(){var e=n.current;if(e)return document.addEventListener(`keydown`,c),e.addEventListener(`mouseenter`,o),e.addEventListener(`mouseleave`,s),function(){document.removeEventListener(`keydown`,c),e.removeEventListener(`mouseenter`,o),e.removeEventListener(`mouseleave`,s)}}),[n.current]),r.createElement(r.Fragment,null)},b={left:0,top:8},x=function(e){var n=e.store,o=e.onToggle,s=r.useContext(t.LocalizationContext).l10n,c=r.useContext(t.ThemeContext).direction,l=r.useState(!1),u=l[0],d=l[1],f=r.useState(!1),p=f[0],m=f[1],h=c===t.TextDirection.RightToLeft,g=_(n),v=g.clearKeyword,y=g.changeMatchCase,x=g.changeWholeWords,S=g.currentMatch,C=g.jumpToNextMatch,w=g.jumpToPreviousMatch,T=g.keyword,E=g.matchCase,D=g.numberOfMatches,O=g.wholeWords,k=g.search,A=g.setKeyword,j=function(e){d(!0),k().then((function(t){d(!1),m(!0),e&&e()}))};r.useEffect((function(){var e=n.get(`initialKeyword`);e&&e.length===1&&T&&j((function(){n.update(`initialKeyword`,[])}))}),[]);var M=s&&s.search?s.search.enterToSearch:`Enter to search`,N=s&&s.search?s.search.previousMatch:`Previous match`,P=s&&s.search?s.search.nextMatch:`Next match`,F=s&&s.search?s.search.close:`Close`;return r.createElement(`div`,{className:`rpv-search__popover`},r.createElement(`div`,{className:`rpv-search__popover-input-counter`},r.createElement(t.TextBox,{ariaLabel:M,autoFocus:!0,placeholder:M,type:`text`,value:T,onChange:function(e){m(!1),A(e)},onKeyDown:function(e){e.key===`Enter`&&T&&(p?C():j())}}),r.createElement(`div`,{className:t.classNames({"rpv-search__popover-counter":!0,"rpv-search__popover-counter--ltr":!h,"rpv-search__popover-counter--rtl":h})},u&&r.createElement(t.Spinner,{testId:`search__popover-searching`,size:`1rem`}),!u&&r.createElement(`span`,{"data-testid":`search__popover-num-matches`},S,`/`,D))),r.createElement(`label`,{className:`rpv-search__popover-label`},r.createElement(`input`,{className:`rpv-search__popover-label-checkbox`,"data-testid":`search__popover-match-case`,checked:E,type:`checkbox`,onChange:function(e){m(!1),y(e.target.checked)}}),` `,s&&s.search?s.search.matchCase:`Match case`),r.createElement(`label`,{className:`rpv-search__popover-label`},r.createElement(`input`,{className:`rpv-search__popover-label-checkbox`,checked:O,"data-testid":`search__popover-whole-words`,type:`checkbox`,onChange:function(e){m(!1),x(e.target.checked)}}),` `,s&&s.search?s.search.wholeWords:`Whole words`),r.createElement(`div`,{className:`rpv-search__popover-footer`},r.createElement(`div`,{className:`rpv-search__popover-footer-item`},r.createElement(t.Tooltip,{ariaControlsSuffix:`search-previous-match`,position:h?t.Position.BottomRight:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:N,isDisabled:S<=1,onClick:w},r.createElement(a,null)),content:function(){return N},offset:b})),r.createElement(`div`,{className:`rpv-search__popover-footer-item`}
107,r.createElement(t.Tooltip,{ariaControlsSuffix:`search-next-match`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:P,isDisabled:S>D-1,onClick:C},r.createElement(i,null)),content:function(){return P},offset:b})),r.createElement(`div`,{className:t.classNames({"rpv-search__popover-footer-button":!0,"rpv-search__popover-footer-button--ltr":!h,"rpv-search__popover-footer-button--rtl":h})},r.createElement(t.Button,{onClick:function(){o(),v()}},F))))},S=function(e){var n=e.children,i=e.onClick,a=r.useContext(t.LocalizationContext).l10n,s=a&&a.search?a.search.search:`Search`;return n({icon:r.createElement(o,null),label:s,onClick:i})},C={left:0,top:8},w=function(e){var n=e.enableShortcuts,i=e.store,a=e.onClick,o=n?t.isMac()?`Meta+F`:`Ctrl+F`:``,s=function(e){e&&a()};return r.useEffect((function(){return i.subscribe(`areShortcutsPressed`,s),function(){i.unsubscribe(`areShortcutsPressed`,s)}}),[]),r.createElement(S,{onClick:a},(function(e){return r.createElement(t.Tooltip,{ariaControlsSuffix:`search-popover`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaKeyShortcuts:o,ariaLabel:e.label,testId:`search__popover-button`,onClick:a},e.icon),content:function(){return e.label},offset:C})}))},T={left:0,top:8},E=function(e){var n=e.children,i=e.enableShortcuts,a=e.store,o=r.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft?t.Position.BottomRight:t.Position.BottomLeft,c=n||function(e){return r.createElement(w,s({enableShortcuts:i,store:a},e))};return r.createElement(t.Popover,{ariaControlsSuffix:`search`,lockScroll:!1,position:o,target:function(e){return c({onClick:e})},content:function(e){return r.createElement(x,{store:a,onToggle:e})},offset:T,closeOnClickOutside:!1,closeOnEscape:!0})},D=function(e){return Array.isArray(e)?e.map((function(e){return g(e)})):[g(e)]};e.NextIcon=i,e.PreviousIcon=a,e.SearchIcon=o,e.searchPlugin=function(e){var n=r.useMemo((function(){return Object.assign({},{enableShortcuts:!0,onHighlightKeyword:function(){}},e)}),[]),i=r.useMemo((function(){return t.createStore({initialKeyword:e&&e.keyword?Array.isArray(e.keyword)?e.keyword:[e.keyword]:[],keyword:e&&e.keyword?D(e.keyword):[c],matchPosition:{matchIndex:-1,pageIndex:-1},renderStatus:new Map})}),[]),a=_(i),o=a.clearKeyword,l=a.jumpToMatch,u=a.jumpToNextMatch,d=a.jumpToPreviousMatch,f=a.searchFor,p=a.setKeywords,h=a.setTargetPages,g=function(e){return r.createElement(E,s({enableShortcuts:n.enableShortcuts},e,{store:i}))};return{install:function(t){var n=e&&e.keyword?Array.isArray(e.keyword)?e.keyword:[e.keyword]:[],r=e&&e.keyword?D(e.keyword):[c];i.update(`initialKeyword`,n),i.update(`jumpToDestination`,t.jumpToDestination),i.update(`jumpToPage`,t.jumpToPage),i.update(`keyword`,r)},renderPageLayer:function(t){return r.createElement(m,{key:t.pageIndex,numPages:t.doc.numPages,pageIndex:t.pageIndex,renderHighlights:e?.renderHighlights,store:i,onHighlightKeyword:n.onHighlightKeyword})},renderViewer:function(e){var t=e.slot;return t.subSlot&&(t.subSlot.children=r.createElement(r.Fragment,null,n.enableShortcuts&&r.createElement(y,{containerRef:e.containerRef,store:i}),t.subSlot.children)),t},uninstall:function(e){var t=i.get(`renderStatus`);t&&t.clear()},onDocumentLoad:function(e){i.update(`doc`,e.doc)},onTextLayerRender:function(e){var t=i.get(`renderStatus`);t&&(t=t.set(e.pageIndex,e),i.update(`renderStatus`,t))},Search:function(e){return r.createElement(v,s({},e,{store:i}))},ShowSearchPopover:g,ShowSearchPopoverButton:function(){return r.createElement(g,null,(function(e){return r.createElement(w,s({enableShortcuts:n.enableShortcuts,store:i},e))}))},clearHighlights:function(){o()},highlight:function(e){var t=Array.isArray(e)?e:[e];return p(t),f(t)},jumpToMatch:l,jumpToNextMatch:u,jumpToPreviousMatch:d,setTargetPages:h}}})),require_lib$4=__commonJSMin(((e,t)=>{t.exports=require_search_min()})),require_theme_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M19.5,15.106l2.4-2.4a1,1,0,0,0,0-1.414l-2.4-2.4V5.5a1,1,0,0,0-1-1H15.106l-2.4-2.4a1,1,0,0,0-1.414,0l-2.4,2.4H5.5a1,1,0,0,0-1,1V8.894l-2.4,2.4a1,1,0,0,0,0,1.414l2.4,2.4V18.5a1,1,0,0,0,1,1H8.894l2.4,2.4a1,1,0,0,0,1.414,0l2.4-2.4H18.5a1,1,0,0,0,1-1Z`}),r.createElement(`path`,{d:`M10,6.349a6,6,0,0,1,0,11.3,6,6,0,1,0,0-11.3Z`}))},a=function(){return r.createElement(t.Icon,{size:16},r.createElement(`path`,{d:`M19.491,15.106l2.4-2.4a1,1,0,0,0,0-1.414l-2.4-2.4V5.5a1,1,0,0,0-1-1H15.1L12.7,2.1a1,1,0,0,0-1.414,0l-2.4,2.4H5.491a1,1,0,0,0-1,1V8.894l-2.4,2.4a1,1,0,0,0,0,1.414l2.4,2.4V18.5a1,1,0,0,0,1,1H8.885l2.4,2.4a1,1,0,0,0,1.414,0l2.4-2.4h3.394a1,1,0,0,0,1-1Z`}),r.createElement(`path`,{d:`M11.491,6c4,0,6,2.686,6,6s-2,6-6,6Z`}))},o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)},s={left:0,top:8},c=function(e){var n=e.onClick,o=r.useContext(t.ThemeContext),c=r.useContext(t.LocalizationContext).l10n,l=o.currentTheme===`dark`,u=c&&c.theme?l?c.theme.switchLightTheme:c.theme.switchDarkTheme:l?`Switch to the light theme`:`Switch to the dark theme`;
107return r.createElement(t.Tooltip,{ariaControlsSuffix:`theme-switch`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaLabel:u,testId:`theme__switch-button`,onClick:n},l?r.createElement(a,null):r.createElement(i,null)),content:function(){return u},offset:s})},l=function(e){var n=e.children,i=r.useContext(t.ThemeContext);return(n||function(e){return r.createElement(c,{onClick:e.onClick})})({onClick:function(){return i.setCurrentTheme(i.currentTheme===`dark`?`light`:`dark`)}})},u=function(e){var n=e.onClick,o=r.useContext(t.ThemeContext),s=r.useContext(t.LocalizationContext).l10n,c=o.currentTheme===`dark`,l=s&&s.theme?c?s.theme.switchLightTheme:s.theme.switchDarkTheme:c?`Switch to the light theme`:`Switch to the dark theme`;return r.createElement(t.MenuItem,{icon:c?r.createElement(a,null):r.createElement(i,null),testId:`theme__switch-menu`,onClick:n},l)};e.DarkIcon=i,e.LightIcon=a,e.themePlugin=function(){var e=function(e){return r.createElement(l,o({},e))};return{SwitchTheme:e,SwitchThemeButton:function(){return r.createElement(e,null,(function(e){return r.createElement(c,o({},e))}))},SwitchThemeMenuItem:function(t){return r.createElement(e,null,(function(e){return r.createElement(u,{onClick:function(){e.onClick(),t.onClick()}})}))}}}})),require_lib$3=__commonJSMin(((e,t)=>{t.exports=require_theme_min()})),require_zoom_min=__commonJSMin((e=>{var t=require_lib$17();function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(require_react()),i=function(){return r.createElement(t.Icon,{ignoreDirection:!0,size:16},r.createElement(`path`,{d:`M10.5,0.499c5.523,0,10,4.477,10,10s-4.477,10-10,10s-10-4.477-10-10S4.977,0.499,10.5,0.499z 108 M23.5,23.499 109 l-5.929-5.929 110 M5.5,10.499h10 111 M10.5,5.499v10`}))},a=function(){return r.createElement(t.Icon,{ignoreDirection:!0,size:16},r.createElement(`path`,{d:`M10.5,0.499c5.523,0,10,4.477,10,10s-4.477,10-10,10s-10-4.477-10-10S4.977,0.499,10.5,0.499z 112 M23.5,23.499 113 l-5.929-5.929 114 M5.5,10.499h10`}))},o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)},s=function(e){var t=r.useState(e.get(`scale`)||0),n=t[0],i=t[1],a=function(e){i(e)};return r.useEffect((function(){return e.subscribe(`scale`,a),function(){e.unsubscribe(`scale`,a)}}),[]),{scale:n}},c=function(e){var t=e.children,n=e.store;return(t||function(e){return r.createElement(r.Fragment,null,`${Math.round(100*e.scale)}%`)})({scale:s(n).scale})},l={passive:!1},u=null,d=function(e){var n=e.pagesContainerRef,i=e.store,a=t.useDebounceCallback((function(e){var t=i.get(`zoom`);t&&t(e)}),40),o=function(e){if(e.ctrlKey){e.preventDefault();var t=e.target.getBoundingClientRect(),n=1-e.deltaY/100,r=e.clientX-t.left,o=e.clientY-t.top,s=i.get(`scale`);a((u||=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`)).createSVGMatrix().translate(r,o).scale(n).translate(-r,-o).scale(s).a)}};return t.useIsomorphicLayoutEffect((function(){var e=n.current;if(e)return e.addEventListener(`wheel`,o,l),function(){e.removeEventListener(`wheel`,o)}}),[]),r.createElement(r.Fragment,null)},f=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],p=function(e){return f.find((function(t){return t>e}))||e},m=function(e){var t=f.findIndex((function(t){return t>=e}));return t===-1||t===0?e:f[t-1]},h=function(e){var n=e.containerRef,i=e.store,a=function(e){if(!e.shiftKey&&!e.altKey&&(t.isMac()?e.metaKey:e.ctrlKey)){var r=n.current;if(r&&document.activeElement&&r.contains(document.activeElement)){var a=i.get(`zoom`);if(a){var o=i.get(`scale`)||1,s=1;switch(e.key){case`-`:s=m(o);break;case`=`:s=p(o);break;case`0`:s=1;break;default:s=o}s!==o&&(e.preventDefault(),a(s))}}}};return r.useEffect((function(){if(n.current)return document.addEventListener(`ke
114ydown`,a),function(){document.removeEventListener(`keydown`,a)}}),[n.current]),r.createElement(r.Fragment,null)},g=[.5,.75,1,1.25,1.5,2,3,4],_={left:0,top:8},v=function(e){var n=e.levels,i=n===void 0?g:n,a=e.scale,o=e.onZoom,s=r.useContext(t.LocalizationContext).l10n,c=r.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,l=s&&s.zoom?s.zoom.zoomDocument:`Zoom document`;return r.createElement(t.Popover,{ariaControlsSuffix:`zoom`,ariaHasPopup:`menu`,position:t.Position.BottomCenter,target:function(e){return r.createElement(t.MinimalButton,{ariaLabel:l,testId:`zoom__popover-target`,onClick:function(){e()}},r.createElement(`span`,{className:`rpv-zoom__popover-target`},r.createElement(`span`,{"data-testid":`zoom__popover-target-scale`,className:t.classNames({"rpv-zoom__popover-target-scale":!0,"rpv-zoom__popover-target-scale--ltr":!c,"rpv-zoom__popover-target-scale--rtl":c})},Math.round(100*a),`%`),r.createElement(`span`,{className:`rpv-zoom__popover-target-arrow`})))},content:function(e){return r.createElement(t.Menu,null,Object.keys(t.SpecialZoomLevel).map((function(n){var i=n;return r.createElement(t.MenuItem,{key:i,onClick:function(){e(),o(i)}},function(e){switch(e){case t.SpecialZoomLevel.ActualSize:return s&&s.zoom?s.zoom.actualSize:`Actual size`;case t.SpecialZoomLevel.PageFit:return s&&s.zoom?s.zoom.pageFit:`Page fit`;case t.SpecialZoomLevel.PageWidth:return s&&s.zoom?s.zoom.pageWidth:`Page width`}}(i))})),r.createElement(t.MenuDivider,null),i.map((function(n){return r.createElement(t.MenuItem,{key:n,onClick:function(){e(),o(n)}},`${Math.round(100*n)}%`)})))},offset:_,closeOnClickOutside:!0,closeOnEscape:!0})},y=function(e){var t=e.children,n=e.levels,i=e.store;return(t||function(e){return r.createElement(v,{levels:n,scale:e.scale,onZoom:e.onZoom})})({scale:s(i).scale,onZoom:function(e){var t=i.get(`zoom`);t&&t(e)}})},b={left:0,top:8},x=function(e){var n=e.enableShortcuts,a=e.onClick,o=r.useContext(t.LocalizationContext).l10n,s=o&&o.zoom?o.zoom.zoomIn:`Zoom in`,c=n?t.isMac()?`Meta+=`:`Ctrl+=`:``;return r.createElement(t.Tooltip,{ariaControlsSuffix:`zoom-in`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaKeyShortcuts:c,ariaLabel:s,testId:`zoom__in-button`,onClick:a},r.createElement(i,null)),content:function(){return s},offset:b})},S=function(e){var t=e.children,n=e.enableShortcuts,r=e.store,i=s(r).scale;return(t||x)({enableShortcuts:n,onClick:function(){var e=r.get(`zoom`);e&&e(p(i))}})},C=function(e){var n=e.onClick,a=r.useContext(t.LocalizationContext).l10n,o=a&&a.zoom?a.zoom.zoomIn:`Zoom in`;return r.createElement(t.MenuItem,{icon:r.createElement(i,null),testId:`zoom__in-menu`,onClick:n},o)},w={left:0,top:8},T=function(e){var n=e.enableShortcuts,i=e.onClick,o=r.useContext(t.LocalizationContext).l10n,s=o&&o.zoom?o.zoom.zoomOut:`Zoom out`,c=n?t.isMac()?`Meta+-`:`Ctrl+-`:``;return r.createElement(t.Tooltip,{ariaControlsSuffix:`zoom-out`,position:t.Position.BottomCenter,target:r.createElement(t.MinimalButton,{ariaKeyShortcuts:c,ariaLabel:s,testId:`zoom__out-button`,onClick:i},r.createElement(a,null)),content:function(){return s},offset:w})},E=function(e){var t=e.children,n=e.enableShortcuts,r=e.store,i=s(r).scale;return(t||T)({enableShortcuts:n,onClick:function(){var e=r.get(`zoom`);e&&e(m(i))}})},D=function(e){var n=e.onClick,i=r.useContext(t.LocalizationContext).l10n,o=i&&i.zoom?i.zoom.zoomOut:`Zoom out`;return r.createElement(t.MenuItem,{icon:r.createElement(a,null),testId:`zoom__out-menu`,onClick:n},o)};e.ZoomInIcon=i,e.ZoomOutIcon=a,e.zoomPlugin=function(e){var n=r.useMemo((function(){return Object.assign({},{enableShortcuts:!0},e)}),[]),i=r.useMemo((function(){return t.createStore({})}),[]),a=function(e){return r.createElement(S,o({enableShortcuts:n.enableShortcuts},e,{store:i}))},s=function(e){return r.createElement(E,o({enableShortcuts:n.enableShortcuts},e,{store:i}))},l=function(e){return r.createElement(y,o({},e,{store:i}))};return{renderViewer:function(e){var t=e.slot;if(!n.enableShortcuts)return t;var a={children:r.createElement(r.Fragment,null,r.createElement(h,{containerRef:e.containerRef,store:i}),r.createElement(d,{pagesContainerRef:e.pagesContainerRef,store:i}),t.children)};return o(o({},t),a)},install:function(e){i.update(`zoom`,e.zoom)},onViewerStateChange:function(e){return i.update(`scale`,e.scale),e},zoomTo:function(e){var t=i.get(`zoom`);t&&t(e)},CurrentScale:function(e){return r.createElement(c,o({},e,{store:i}))},ZoomIn:a,ZoomInButton:function(){return r.createElement(a,null,(function(e){return r.createElement(x,o({},e))}))},ZoomInMenuItem:function(e){return r.createElement(a,null,(function(t){return r.createElement(C,{onClick:function(){t.onClick(),e.onClick()}})}))},ZoomOut:s,ZoomOutButton:function(){return r.createElement(s,null,(function(e){return r.createElement(T,o({},e))}))},ZoomOutMenuItem:function(e){return r.createElement(s,null,(function(t){return r.createElement(D,{onClick:function(){t.onClick(),e.onClick()}})}))},Zoom:l,ZoomPopover:function(e){return r.createElement(l,null,(function(t){return r.createElement(v,o({levels:e?.levels},t))}))}}}})),require_lib$2=__commonJSMin(((e,t)=>{t.exports=require_zoom_min()})),require_toolbar_min=__commonJSMin((e=>
114{var t=require_lib$17(),n=require_lib$13(),r=require_react(),i=require_lib$12(),a=require_lib$11(),o=require_lib$10(),s=require_lib$9(),c=require_lib$8(),l=require_lib$7(),u=require_lib$6(),d=require_lib$5(),f=require_lib$4(),p=require_lib$3(),m=require_lib$2();function h(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var g=h(r),_=function(){return g.createElement(t.Icon,{size:16},g.createElement(`path`,{d:`M12,0.5c1.381,0,2.5,1.119,2.5,2.5S13.381,5.5,12,5.5S9.5,4.381,9.5,3S10.619,0.5,12,0.5z 115 M12,9.5 116 c1.381,0,2.5,1.119,2.5,2.5s-1.119,2.5-2.5,2.5S9.5,13.381,9.5,12S10.619,9.5,12,9.5z 117 M12,18.5c1.381,0,2.5,1.119,2.5,2.5 118 s-1.119,2.5-2.5,2.5S9.5,22.381,9.5,21S10.619,18.5,12,18.5z`}))},v={left:0,top:8},y=function(e){var r=e.toolbarSlot,i=g.useContext(t.LocalizationContext).l10n,a=g.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft?t.Position.BottomLeft:t.Position.BottomRight,o=r.DownloadMenuItem,s=r.EnterFullScreenMenuItem,c=r.GoToFirstPageMenuItem,l=r.GoToLastPageMenuItem,u=r.GoToNextPageMenuItem,d=r.GoToPreviousPageMenuItem,f=r.OpenMenuItem,p=r.PrintMenuItem,m=r.RotateBackwardMenuItem,h=r.RotateForwardMenuItem,y=r.ShowPropertiesMenuItem,b=r.SwitchScrollModeMenuItem,x=r.SwitchSelectionModeMenuItem,S=r.SwitchViewModeMenuItem,C=r.SwitchThemeMenuItem;return g.createElement(t.Popover,{ariaControlsSuffix:`toolbar-more-actions`,ariaHasPopup:`menu`,position:a,target:function(e,n){var r=i&&i.toolbar?i.toolbar.moreActions:`More actions`;return g.createElement(t.Tooltip,{ariaControlsSuffix:`toolbar-more-actions`,position:a,target:g.createElement(t.MinimalButton,{ariaLabel:r,isSelected:n,testId:`toolbar__more-actions-popover-target`,onClick:e},g.createElement(_,null)),content:function(){return r},offset:v})},content:function(e){return g.createElement(t.Menu,null,g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(C,{onClick:e})),g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(s,{onClick:e})),g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(f,null)),g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(p,{onClick:e})),g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(o,{onClick:e})),g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(t.MenuDivider,null)),g.createElement(c,{onClick:e}),g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(d,{onClick:e})),g.createElement(`div`,{className:`rpv-core__display--block rpv-core__display--hidden-medium`},g.createElement(u,{onClick:e})),g.createElement(l,{onClick:e}),g.createElement(t.MenuDivider,null),g.createElement(h,{onClick:e}),g.createElement(m,{onClick:e}),g.createElement(t.MenuDivider,null),g.createElement(x,{mode:n.SelectionMode.Text,onClick:e}),g.createElement(x,{mode:n.SelectionMode.Hand,onClick:e}),g.createElement(t.MenuDivider,null),g.createElement(b,{mode:t.ScrollMode.Page,onClick:e}),g.createElement(b,{mode:t.ScrollMode.Vertical,onClick:e}),g.createElement(b,{mode:t.ScrollMode.Horizontal,onClick:e}),g.createElement(b,{mode:t.ScrollMode.Wrapped,onClick:e}),g.createElement(t.MenuDivider,null),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-small`},g.createElement(S,{mode:t.ViewMode.SinglePage,onClick:e})),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-small`},g.createElement(S,{mode:t.ViewMode.DualPage,onClick:e})),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-small`},g.createElement(S,{mode:t.ViewMode.DualPageWithCover,onClick:e})),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-small`},g.createElement(t.MenuDivider,null)),g.createElement(y,{onClick:e}))},offset:v,closeOnClickOutside:!0,closeOnEscape:!0})},b=function(){return b=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},b.apply(this,arguments)},x=function(e){return function(n){var r=g.useMemo((function(){return e(n)}),[]),i=g.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,a=r.CurrentPageInput,o=r.Download,s=r.EnterFullScreen,c=r.GoToNextPage,l=r.GoToPreviousPage,u=r.NumberOfPages,d=r.Open,f=r.Print,p=r.ShowSearchPopover,m=r.SwitchTheme,h=r.Zoom,_=r.ZoomIn,v=r.ZoomOut;return g.createElement(`div`,{"data-testid":`toolbar`,className:t.classNames({"rpv-toolbar":!0,"rpv-toolbar--rtl":i}),role:`toolbar`,"aria-orientation":`horizontal`},g.createElement(`div`,{className:`rpv-toolbar__left`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(p,null)),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-small`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(l,null))),g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(a,null),g.createElement(`span`,{className:`rpv-toolbar__label`},g.createElement(u,null))),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-small`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(c,null)))),g.createElement(`div`,{className:`rpv-toolbar__center`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(v,null)),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-small`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(h,null))),g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(_,null))),g.createElement(`div`,{className:`rpv-toolbar__right`},g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-medium`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(m,null))),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-medium`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(s,null))),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-medium`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(d,null))),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-medium`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(o,null))),g.createElement(`div`,{className:`rpv-core__display--hidden rpv-core__display--block-medium`},g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(f,null))),g.createElement(`div`,{className:`rpv-toolbar__item`},g.createElement(y,{toolbarSlot:r}
118))))}},S=function(e){var t=e.NumberOfPages;return Object.assign({},e,{NumberOfPages:function(){return g.createElement(g.Fragment,null,`/ `,g.createElement(t,null))}})},C=function(e){return x(S)(e)},w=function(e){var t=e.children,n=e.slot;return(t||C)(n)};e.MoreActionsPopover=y,e.MoreIcon=_,e.toolbarPlugin=function(e){var t=i.fullScreenPlugin(e?e.fullScreenPlugin:{}),r=a.getFilePlugin(e?e.getFilePlugin:{}),h=o.openPlugin(e?e.openPlugin:{}),_=s.pageNavigationPlugin(e?e.pageNavigationPlugin:{}),v=c.printPlugin(e?e.printPlugin:{}),y=l.propertiesPlugin(),S=u.rotatePlugin(),C=d.scrollModePlugin(),T=f.searchPlugin(e?e.searchPlugin:{}),E=n.selectionModePlugin(e?e.selectionModePlugin:{}),D=p.themePlugin(),O=m.zoomPlugin(e?e.zoomPlugin:{}),k=[t,r,h,_,v,y,S,C,T,E,D,O];return{fullScreenPluginInstance:t,getFilePluginInstance:r,openPluginInstance:h,pageNavigationPluginInstance:_,printPluginInstance:v,propertiesPluginInstance:y,rotatePluginInstance:S,scrollModePluginInstance:C,searchPluginInstance:T,selectionModePluginInstance:E,themePluginInstance:D,zoomPluginInstance:O,install:function(e){k.forEac
118h((function(t){t.install&&t.install(e)}))},renderPageLayer:function(e){return g.createElement(g.Fragment,null,k.map((function(t,n){return t.renderPageLayer?g.createElement(g.Fragment,{key:n},t.renderPageLayer(e)):g.createElement(g.Fragment,{key:n})})))},renderViewer:function(e){var t=e.slot;return k.forEach((function(n){n.renderViewer&&(t=n.renderViewer(b(b({},e),{slot:t})))})),t},uninstall:function(e){k.forEach((function(t){t.uninstall&&t.uninstall(e)}))},onDocumentLoad:function(e){k.forEach((function(t){t.onDocumentLoad&&t.onDocumentLoad(e)}))},onAnnotationLayerRender:function(e){k.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender(e)}))},onTextLayerRender:function(e){k.forEach((function(t){t.onTextLayerRender&&t.onTextLayerRender(e)}))},onViewerStateChange:function(e){var t=e;return k.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),t},renderDefaultToolbar:x,Toolbar:g.useCallback((function(e){var n=t.EnterFullScreen,i=t.EnterFullScreenMenuItem,a=r.Download,o=r.DownloadMenuItem,s=h.Open,c=h.OpenMenuItem,l=_.CurrentPageInput,u=_.CurrentPageLabel,d=_.GoToFirstPage,f=_.GoToFirstPageMenuItem,p=_.GoToLastPage,m=_.GoToLastPageMenuItem,x=_.GoToNextPage,k=_.GoToNextPageMenuItem,A=_.GoToPreviousPage,j=_.GoToPreviousPageMenuItem,M=_.NumberOfPages,N=v.Print,P=v.PrintMenuItem,F=y.ShowProperties,I=y.ShowPropertiesMenuItem,L=S.Rotate,R=S.RotateBackwardMenuItem,z=S.RotateForwardMenuItem,B=C.SwitchScrollMode,V=C.SwitchScrollModeMenuItem,H=C.SwitchViewMode,ee=C.SwitchViewModeMenuItem,U=T.Search,te=T.ShowSearchPopover,ne=E.SwitchSelectionMode,re=E.SwitchSelectionModeMenuItem,ie=D.SwitchTheme,ae=D.SwitchThemeMenuItem,oe=O.CurrentScale,se=O.Zoom,ce=O.ZoomIn,le=O.ZoomInMenuItem,ue=O.ZoomOut,de=O.ZoomOutMenuItem;return g.createElement(w,b({},e,{slot:{CurrentPageInput:l,CurrentPageLabel:u,CurrentScale:oe,Download:a,DownloadMenuItem:o,EnterFullScreen:n,EnterFullScreenMenuItem:i,GoToFirstPage:d,GoToFirstPageMenuItem:f,GoToLastPage:p,GoToLastPageMenuItem:m,GoToNextPage:x,GoToNextPageMenuItem:k,GoToPreviousPage:A,GoToPreviousPageMenuItem:j,NumberOfPages:M,Open:s,OpenMenuItem:c,Print:N,PrintMenuItem:P,Rotate:L,RotateBackwardMenuItem:R,RotateForwardMenuItem:z,Search:U,ShowProperties:F,ShowPropertiesMenuItem:I,ShowSearchPopover:te,SwitchScrollMode:B,SwitchScrollModeMenuItem:V,SwitchSelectionMode:ne,SwitchSelectionModeMenuItem:re,SwitchViewMode:H,SwitchViewModeMenuItem:ee,SwitchTheme:ie,SwitchThemeMenuItem:ae,Zoom:se,ZoomIn:ce,ZoomInMenuItem:le,ZoomOut:ue,ZoomOutMenuItem:de}}))}),[])}}})),require_lib$1=__commonJSMin(((e,t)=>{t.exports=require_toolbar_min()})),require_default_layout_min=__commonJSMin((e=>{var t=require_lib$17(),n=require_react(),r=require_lib$16(),i=require_lib$15(),a=require_lib$14(),o=require_lib$1();function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var c=s(n),l=function(){return c.createElement(t.Icon,{size:16},c.createElement(`path`,{d:`M11.5,1.5h11c0.552,0,1,0.448,1,1v20c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h3 119 M11.5,10.5c0,0.55-0.3,0.661-0.659,0.248L8,7.5l-2.844,3.246c-0.363,0.414-0.659,0.3-0.659-0.247v-9c0-0.552,0.448-1,1-1h5 120 c0.552,0,1,0.448,1,1L11.5,10.5z 121 M14.5,6.499h6 122 M14.5,10.499h6 123 M3.5,14.499h17 124 M3.5,18.499h16.497`}))},u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},u.apply(this,arguments)},d=function(){return c.createElement(t.Icon,{size:16},c.createElement(`path`,{d:`M7.618,15.345l8.666-8.666c0.78-0.812,2.071-0.838,2.883-0.058s0.838,2.071,0.058,2.883 125 c-0.019,0.02-0.038,0.039-0.058,0.058L7.461,21.305c-1.593,1.593-4.175,1.592-5.767,0s-1.592-4.175,0-5.767c0,0,0,0,0,0 126 L13.928,3.305c2.189-2.19,5.739-2.19,7.929-0.001s2.19,5.739,0,7.929l0,0L13.192,19.9`}))},f=function(){return c.createElement(t.Icon,{size:16},c.createElement(`path`,{d:`M10.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z 127 M23.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z 128 M10.5,22.5 c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z
129 M23.5,22.5c0,0.552-0.448,1-1,1 h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z`}))},p={left:8,top:0},m={left:-8,top:0},h=function(e){var n=e.attachmentTabContent,r=e.bookmarkTabContent,i=e.store,a=e.thumbnailTabContent,o=e.tabs,s=c.useRef(),u=c.useContext(t.LocalizationContext).l10n,h=c.useState(i.get(`isCurrentTabOpened`)||!1),g=h[0],_=h[1],v=c.useState(Math.max(i.get(`currentTab`)||0,0)),y=v[0],b=v[1],x=c.useContext(t.ThemeContext).direction===t.TextDirection.RightToLeft,S=[{content:a,icon:c.createElement(f,null),title:u&&u.defaultLayout?u.defaultLayout.thumbnail:`Thumbnail`},{content:r,icon:c.createElement(l,null),title:u&&u.defaultLayout?u.defaultLayout.bookmark:`Bookmark`},{content:n,icon:c.createElement(d,null),title:u&&u.defaultLayout?u.defaultLayout.attachment:`Attachment`}],C=o?o(S):S,w=function(e){e>=0&&e<=C.length-1&&(i.update(`isCurrentTabOpened`,!0),b(e))},T=function(e){_(e)};return c.useEffect((function(){return i.subscribe(`currentTab`,w),i.subscribe(`isCurrentTabOpened`,T),function(){i.unsubscribe(`currentTab`,w),i.unsubscribe(`isCurrentTabOpened`,T)}}),[]),C.length===0?c.createElement(c.Fragment,null):c.createElement(c.Fragment,null,c.createElement(`div`,{"data-testid":`default-layout__sidebar`,className:t.classNames({"rpv-default-layout__sidebar":!0,"rpv-default-layout__sidebar--opened":g,"rpv-default-layout__sidebar--ltr":!x,"rpv-default-layout__sidebar--rtl":x}),ref:s},c.createElement(`div`,{className:`rpv-default-layout__sidebar-tabs`},c.createElement(`div`,{className:`rpv-default-layout__sidebar-headers`,role:`tablist`,"aria-orientation":`vertical`},C.map((function(e,n){return c.createElement(`div`,{"aria-controls":`rpv-default-layout__sidebar-content`,"aria-selected":y===n,key:n,className:`rpv-default-layout__sidebar-header`,id:`rpv-default-layout__sidebar-tab-${n}`,role:`tab`},c.createElement(t.Tooltip,{ariaControlsSuffix:`default-layout-sidebar-tab-${n}`,position:x?t.Position.LeftCenter:t.Position.RightCenter,target:c.createElement(t.MinimalButton,{ariaLabel:e.title,isSelected:y===n,onClick:function(){return function(e){if(y===e){i.update(`isCurrentTabOpened`,!i.get(`isCurrentTabOpened`));var t=s.current;t&&t.style.width&&t.style.removeProperty(`width`)}else i.update(`currentTab`,e)}(n)}},e.icon),content:function(){return e.title},offset:x?m:p}))}))),c.createElement(`div`,{"aria-labelledby":`rpv-default-layout__sidebar-tab-${y}`,id:`rpv-default-layout__sidebar-content`,className:t.classNames({"rpv-default-layout__sidebar-content":!0,"rpv-default-layout__sidebar-content--opened":g,"rpv-default-layout__sidebar-content--ltr":!x,"rpv-default-layout__sidebar-content--rtl":x}),role:`tabpanel`,tabIndex:-1},C[y].content))),g&&c.createElement(t.Splitter,{constrain:function(e){return e.firstHalfPercentage>=20&&e.firstHalfPercentage<=80}}))};e.BookmarkIcon=l,e.FileIcon=d,e.ThumbnailIcon=f,e.defaultLayoutPlugin=function(e){var n=c.useMemo((function(){return t.createStore({isCurrentTabOpened:!1,currentTab:0})}),[]),s=r.attachmentPlugin(),l=i.bookmarkPlugin(),d=a.thumbnailPlugin(e?e.thumbnailPlugin:{}),f=o.toolbarPlugin(e?e.toolbarPlugin:{}),p=s.Attachments,m=l.Bookmarks,g=d.Thumbnails,_=f.Toolbar,v=e?e.sidebarTabs:function(e){return e},y=[s,l,d,f];return{attachmentPluginInstance:s,bookmarkPluginInstance:l,thumbnailPluginInstance:d,toolbarPluginInstance:f,activateTab:function(e){n.update(`currentTab`,e)},toggleTab:function(e){var t=n.get(`currentTab`);n.update(`isCurrentTabOpened`,!n.get(`isCurrentTabOpened`)),t!==e&&n.update(`currentTab`,e)},install:function(e){y.forEach((function(t){t.install&&t.install(e)}))},renderPageLayer:function(e){return c.createElement(c.Fragment,null,y.map((function(t,n){return t.renderPageLayer?c.createElement(c.Fragment,{key:n},t.renderPageLayer(e)):c.createElement(c.Fragment,{key:n},c.createElement(c.Fragment,null))})))},renderViewer:function(r){var i=r.slot;y.forEach((function(e){e.renderViewer&&(i=e.renderViewer(u(u({},r),{slot:i})))}));var a=i.subSlot&&i.subSlot.attrs?{className:i.subSlot.attrs.className,"data-testid":i.subSlot.attrs[`data-testid`],ref:i.subSlot.attrs.ref,style:i.subSlot.attrs.style}:{};return i.children=c.createElement(`div`,{className:`rpv-default-layout__container`},c.createElement(`div`,{"data-testid":`default-layout__main`,className:t.classNames({"rpv-default-layout__main":!0,"rpv-default-layout__main--rtl":r.themeContext.direction===t.TextDirection.RightToLeft})},c.createElement(h,{attachmentTabContent:c.createElement(p,null),bookmarkTabContent:c.createElement(m,null),store:n,thumbnailTabContent:c.createElement(g,null),tabs:v}),c.createElement(`div`,{className:`rpv-default-layout__body`,"data-testid":`default-layout__body`},c.createElement(`div`,{className:`rpv-default-layout__toolbar`},e&&e.renderToolbar?e.renderToolbar(_):c.createElement(_,null)),c.createElement(`div`,u({},a),i.subSlot.children))),i.children),i.subSlot.attrs={},i.subSlot.children=c.createElement(c.Fragment,null),i}
129,uninstall:function(e){y.forEach((function(t){t.uninstall&&t.uninstall(e)}))},onDocumentLoad:function(t){y.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad(t)})),e&&e.setInitialTab&&e.setInitialTab(t.doc).then((function(e){n.update(`currentTab`,e),n.update(`isCurrentTabOpened`,!0)}))},onAnnotationLayerRender:function(e){y.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender(e)}))},onTextLayerRender:function(e){y.forEach((function(t){t.onTextLayerRender&&t.onTextLayerRender(e)}))},onViewerStateChange:function(e){var t=e;return y.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),t}}},e.setInitialTabFromPageMode=function(e){return new Promise((function(n,r){e.getPageMode().then((function(e){if(e)switch(e){case t.PageMode.Attachments:n(2);break;case t.PageMode.Bookmarks:n(1);break;case t.PageMode.Thumbnails:n(0);break;default:n(-1)}else n(-1)}))}))}})),require_lib=__commonJSMin(((e,t)=>{t.exports=require_default_layout_min()}));export{getDocument as a,require_lib$17 as c,Util as i,AnnotationMode as n,pdf_worker_min_default as o,GlobalWorkerOptions as r,__vitePreload as s,require_lib as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.