pdfjs-viewer-element 3.2.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/_virtual_pdfjs-viewer-html-Db40JDMA.js +1 -0
- package/dist/images/altText_add.svg +3 -0
- package/dist/images/altText_disclaimer.svg +3 -0
- package/dist/images/altText_done.svg +3 -0
- package/dist/images/altText_spinner.svg +30 -0
- package/dist/images/altText_warning.svg +3 -0
- package/dist/images/annotation-check.svg +11 -0
- package/dist/images/annotation-comment.svg +16 -0
- package/dist/images/annotation-help.svg +26 -0
- package/dist/images/annotation-insert.svg +10 -0
- package/dist/images/annotation-key.svg +11 -0
- package/dist/images/annotation-newparagraph.svg +11 -0
- package/dist/images/annotation-noicon.svg +7 -0
- package/dist/images/annotation-note.svg +42 -0
- package/dist/images/annotation-paperclip.svg +6 -0
- package/dist/images/annotation-paragraph.svg +16 -0
- package/dist/images/annotation-pushpin.svg +7 -0
- package/dist/images/checkmark.svg +5 -0
- package/dist/images/comment-actionsButton.svg +3 -0
- package/dist/images/comment-closeButton.svg +3 -0
- package/dist/images/comment-editButton.svg +8 -0
- package/dist/images/comment-popup-editButton.svg +5 -0
- package/dist/images/cursor-editorFreeHighlight.svg +6 -0
- package/dist/images/cursor-editorFreeText.svg +3 -0
- package/dist/images/cursor-editorInk.svg +4 -0
- package/dist/images/cursor-editorTextHighlight.svg +8 -0
- package/dist/images/editor-toolbar-delete.svg +5 -0
- package/dist/images/editor-toolbar-edit.svg +3 -0
- package/dist/images/findbarButton-next.svg +3 -0
- package/dist/images/findbarButton-previous.svg +3 -0
- package/dist/images/gv-toolbarButton-download.svg +3 -0
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/loading.svg +1 -0
- package/dist/images/messageBar_closingButton.svg +3 -0
- package/dist/images/messageBar_info.svg +3 -0
- package/dist/images/messageBar_warning.svg +3 -0
- package/dist/images/pages_closeButton.svg +3 -0
- package/dist/images/pages_selected.svg +7 -0
- package/dist/images/pages_viewArrow.svg +3 -0
- package/dist/images/pages_viewButton.svg +3 -0
- package/dist/images/secondaryToolbarButton-documentProperties.svg +3 -0
- package/dist/images/secondaryToolbarButton-firstPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-handTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-lastPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCcw.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCw.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollVertical.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
- package/dist/images/secondaryToolbarButton-selectTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadEven.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadNone.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadOdd.svg +3 -0
- package/dist/images/signature-properties-row-check.svg +4 -0
- package/dist/images/toolbarButton-bookmark.svg +3 -0
- package/dist/images/toolbarButton-currentOutlineItem.svg +3 -0
- package/dist/images/toolbarButton-download.svg +4 -0
- package/dist/images/toolbarButton-editorFreeText.svg +5 -0
- package/dist/images/toolbarButton-editorHighlight.svg +6 -0
- package/dist/images/toolbarButton-editorInk.svg +4 -0
- package/dist/images/toolbarButton-editorSignature.svg +6 -0
- package/dist/images/toolbarButton-editorStamp.svg +8 -0
- package/dist/images/toolbarButton-menuArrow.svg +3 -0
- package/dist/images/toolbarButton-openFile.svg +3 -0
- package/dist/images/toolbarButton-pageDown.svg +3 -0
- package/dist/images/toolbarButton-pageUp.svg +3 -0
- package/dist/images/toolbarButton-presentationMode.svg +3 -0
- package/dist/images/toolbarButton-print.svg +3 -0
- package/dist/images/toolbarButton-search.svg +3 -0
- package/dist/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
- package/dist/images/toolbarButton-signaturePropertiesError.svg +7 -0
- package/dist/images/toolbarButton-signaturePropertiesVerified.svg +7 -0
- package/dist/images/toolbarButton-viewAttachments.svg +3 -0
- package/dist/images/toolbarButton-viewLayers.svg +3 -0
- package/dist/images/toolbarButton-viewOutline.svg +3 -0
- package/dist/images/toolbarButton-viewThumbnail.svg +3 -0
- package/dist/images/toolbarButton-viewsManagerToggle.svg +3 -0
- package/dist/images/toolbarButton-zoomIn.svg +3 -0
- package/dist/images/toolbarButton-zoomOut.svg +3 -0
- package/dist/images/treeitem-collapsed.svg +1 -0
- package/dist/images/treeitem-expanded.svg +1 -0
- package/dist/locale-kKW4I85A.js +1 -0
- package/dist/paper-and-ink.css +1 -0
- package/dist/pdf.mjs +28 -0
- package/dist/pdf.worker.min.mjs +28 -1
- package/dist/pdfjs-viewer-element.js +1 -1
- package/dist/viewer.css +1 -0
- package/dist/viewer.mjs +558 -0
- package/package.json +25 -16
- package/types/pdfjs-viewer-element.d.ts +1 -0
- package/dist/locale-DENudnjU.js +0 -1
- package/dist/paper-and-ink-w6df3wtN.js +0 -1
- package/dist/pdf-DRXGYF_W.js +0 -1
- package/dist/viewer-00vA-OlL.js +0 -1
- package/dist/viewer-DVUWiHIQ.js +0 -1
- package/dist/viewer-gf2SDly8.js +0 -1
package/dist/viewer.mjs
ADDED
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
const Ar="auto",Nr=1,Mr=1.1,kr=.1,Br=25,Dr=0,Rr=1.25,Or=40,Fr=5,H={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},N={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4},K={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},M={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},j={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},W={SELECT:0,HAND:1,ZOOM:2},Qi=/\bprint\s*\(/;function Ji(r,t){let e=r.offsetParent;if(!e){console.error("offsetParent is not set -- cannot scroll");return}let i=r.offsetTop+r.clientTop,n=r.offsetLeft+r.clientLeft;for(;e.clientHeight===e.scrollHeight&&e.clientWidth===e.scrollWidth;)if(i+=e.offsetTop,n+=e.offsetLeft,e=e.offsetParent,!e)return;t&&(t.top!==void 0&&(i+=t.top),t.left!==void 0&&(n+=t.left,e.scrollLeft=n)),e.scrollTop=i}function Pe(r,t,e=void 0){const i=function(a){s||(s=window.requestAnimationFrame(function(){s=null;const l=r.scrollLeft,d=n.lastX;l!==d&&(n.right=l>d),n.lastX=l;const h=r.scrollTop,c=n.lastY;h!==c&&(n.down=h>c),n.lastY=h,t(n)}))},n={right:!0,down:!0,lastX:r.scrollLeft,lastY:r.scrollTop,_eventHandler:i};let s=null;return r.addEventListener("scroll",i,{useCapture:!0,signal:e}),e?.addEventListener("abort",()=>window.cancelAnimationFrame(s),{once:!0}),n}function Ct(r){const t=new Map;for(const[e,i]of new URLSearchParams(r))t.set(e.toLowerCase(),i);return t}const _e=/[\x00-\x1F]/g;function gt(r,t=!1){return _e.test(r)?t?r.replaceAll(_e,e=>e==="\0"?"":" "):r.replaceAll("\0",""):r}function Y(r,t,e=0){let i=e,n=r.length-1;if(n<0||!t(r[n]))return r.length;if(t(r[i]))return i;for(;i<n;){const s=i+n>>1,a=r[s];t(a)?n=s:i=s+1}return i}function Ie(r){if(Math.floor(r)===r)return[r,1];const t=1/r,e=8;if(t>e)return[1,e];if(Math.floor(t)===t)return[1,t];const i=r>1?t:r;let n=0,s=1,a=1,o=1;for(;;){const l=n+a,d=s+o;if(d>e)break;i<=l/d?(a=l,o=d):(n=l,s=d)}return i-n/s<a/o-i?i===r?[n,s]:[s,n]:i===r?[a,o]:[o,a]}function Mt(r,t){return r-r%t}function qi({view:r,userUnit:t,rotate:e}){const[i,n,s,a]=r,o=e%180!==0,l=(s-i)/72*t,d=(a-n)/72*t;return{width:o?d:l,height:o?l:d}}function tn(r,t,e){if(r<2)return r;let i=t[r].div,n=i.offsetTop+i.clientTop;n>=e&&(i=t[r-1].div,n=i.offsetTop+i.clientTop);for(let s=r-2;s>=0&&(i=t[s].div,!(i.offsetTop+i.clientTop+i.clientHeight<=n));--s)r=s;return r}function xe({scrollEl:r,views:t,sortByVisibility:e=!1,horizontal:i=!1,rtl:n=!1}){const s=r.scrollTop,a=s+r.clientHeight,o=r.scrollLeft,l=o+r.clientWidth;function d(C){const E=C.div;return E.offsetTop+E.clientTop+E.clientHeight>s}function h(C){const E=C.div,P=E.offsetLeft+E.clientLeft,v=P+E.clientWidth;return n?P<l:v>o}const c=[],u=new Set,f=t.length;let g=Y(t,i?h:d);g>0&&g<f&&!i&&(g=tn(g,t,s));let p=i?l:-1;for(let C=g;C<f;C++){const E=t[C],P=E.div,v=P.offsetLeft+P.clientLeft,_=P.offsetTop+P.clientTop,T=P.clientWidth,D=P.clientHeight,y=v+T,I=_+D;if(p===-1)I>=a&&(p=I);else if((i?v:_)>p)break;if(I<=s||_>=a||y<=o||v>=l)continue;const A=Math.max(0,s-_),R=Math.max(0,o-v),F=A+Math.max(0,I-a),O=R+Math.max(0,y-l),U=(D-F)/D,ot=(T-O)/T,Se=U*ot*100|0;c.push({id:E.id,x:v,y:_,visibleArea:Se===100?null:{minX:R,minY:A,maxX:Math.min(y,l)-v,maxY:Math.min(I,a)-_},view:E,percent:Se,widthPercent:ot*100|0}),u.add(E.id)}const b=c[0],w=c.at(-1);return e&&c.sort(function(C,E){const P=C.percent-E.percent;return Math.abs(P)>.001?-P:C.id-E.id}),{first:b,last:w,views:c,ids:u}}function Le(r){let t=Math.hypot(r.deltaX,r.deltaY);const e=Math.atan2(r.deltaY,r.deltaX);return-.25*Math.PI<e&&e<.75*Math.PI&&(t=-t),t}function en(r){const t=r.deltaMode;let e=Le(r);const i=30,n=30;return t===WheelEvent.DOM_DELTA_PIXEL?e/=i*n:t===WheelEvent.DOM_DELTA_LINE&&(e/=n),e}function kt(r){return Number.isInteger(r)&&r%90===0}function Te(r){return Number.isInteger(r)&&Object.values(M).includes(r)&&r!==M.UNKNOWN}function Ae(r){return Number.isInteger(r)&&Object.values(j).includes(r)&&r!==j.UNKNOWN}function Kt(r){return r.width<=r.height}const nn=new Promise(function(r){window.requestAnimationFrame(r)}),Yt=document.documentElement.style;class sn{#t=null;#e=null;#i=0;#s=null;#a=!0;constructor(t){this.#t=t.classList,this.#s=t.style}get percent(){return this.#i}set percent(t){if(this.#i=t,isNaN(t)){this.#t.add("indeterminate");return}this.#t.remove("indeterminate"),this.#s.setProperty("--progressBar-percent",`${this.#i}%`)}setWidth(t){if(!t)return;const i=t.parentNode.offsetWidth-t.offsetWidth;i>0&&this.#s.setProperty("--progressBar-end-offset",`${i}px`)}setDisableAutoFetch(t=5e3){this.#i===100||isNaN(this.#i)||(this.#e&&clearTimeout(this.#e),this.show(),this.#e=setTimeout(()=>{this.#e=null,this.hide()},t))}hide(){this.#a&&(this.#a=!1,this.#t.add("hidden"))}show(){this.#a||(this.#a=!0,this.#t.remove("hidden"))}}function Ne(){let r=document,t=r.activeElement||r.querySelector(":focus");for(;t?.shadowRoot;)r=t.shadowRoot,t=r.activeElement||r.querySelector(":focus");return t}function Me(r){let t=M.VERTICAL,e=j.NONE;switch(r){case"SinglePage":t=M.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=M.PAGE;case"TwoColumnLeft":e=j.ODD;break;case"TwoPageRight":t=M.PAGE;case"TwoColumnRight":e=j.EVEN;break}return{scrollMode:t,spreadMode:e}}function an(r){switch(r){case"UseNone":return N.NONE;case"UseThumbs":return N.THUMBS;case"UseOutlines":return N.OUTLINE;case"UseAttachments":return N.ATTACHMENTS;case"UseOC":return N.LAYERS}return N.NONE}function tt(r,t,e=null){r.classList.toggle("toggled",t),r.setAttribute("aria-checked",t),e?.classList.toggle("hidden",!t)}function Bt(r,t,e=null){r.classList.toggle("selected",t),r.setAttribute("aria-selected",t),e?.classList.toggle("hidden",!t)}function G(r,t,e=null){r.classList.toggle("toggled",t),r.setAttribute("aria-expanded",t),e?.classList.toggle("hidden",!t)}const Dt=(function(){const r=document.createElement("div");return r.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",r.style.width==="calc(1320px)"?Math.fround:t=>t})();{var Zt=new Map;const{maxTouchPoints:r,platform:t,userAgent:e}=navigator,i=/Android/.test(e);(/\b(?:iPad|iPhone|iPod)(?=;)/.test(e)||t==="MacIntel"&&r>1||i)&&Zt.set("maxCanvasPixels",5242880),i&&Zt.set("useSystemFonts",!1)}const m={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},Qt={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},Jt=new Map([["allowedGlobalEvents",{value:null,kind:m.BROWSER}],["canvasMaxAreaInBytes",{value:-1,kind:m.BROWSER+m.API}],["isInAutomation",{value:!1,kind:m.BROWSER}],["localeProperties",{value:{lang:navigator.language||"en-US"},kind:m.BROWSER}],["maxCanvasDim",{value:32767,kind:m.BROWSER+m.VIEWER}],["nimbusDataStr",{value:"",kind:m.BROWSER}],["supportsCaretBrowsingMode",{value:!1,kind:m.BROWSER}],["supportsDocumentFonts",{value:!0,kind:m.BROWSER}],["supportsDownloading",{value:!0,kind:m.BROWSER}],["supportsIntegratedFind",{value:!1,kind:m.BROWSER}],["supportsMouseWheelZoomCtrlKey",{value:!0,kind:m.BROWSER}],["supportsMouseWheelZoomMetaKey",{value:!0,kind:m.BROWSER}],["supportsPinchToZoom",{value:!0,kind:m.BROWSER}],["supportsPrinting",{value:!0,kind:m.BROWSER}],["toolbarDensity",{value:0,kind:m.BROWSER+m.EVENT_DISPATCH}],["altTextLearnMoreUrl",{value:"",kind:m.VIEWER+m.PREFERENCE}],["annotationEditorMode",{value:0,kind:m.VIEWER+m.PREFERENCE}],["annotationMode",{value:2,kind:m.VIEWER+m.PREFERENCE}],["capCanvasAreaFactor",{value:200,kind:m.VIEWER+m.PREFERENCE}],["commentLearnMoreUrl",{value:"",kind:m.VIEWER+m.PREFERENCE}],["cursorToolOnLoad",{value:0,kind:m.VIEWER+m.PREFERENCE}],["debuggerSrc",{value:"./debugger.mjs",kind:m.VIEWER}],["defaultUrl",{value:"compressed.tracemonkey-pldi-09.pdf",kind:m.VIEWER}],["defaultZoomDelay",{value:400,kind:m.VIEWER+m.PREFERENCE}],["defaultZoomValue",{value:"",kind:m.VIEWER+m.PREFERENCE}],["disableHistory",{value:!1,kind:m.VIEWER}],["disablePageLabels",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["disablePreferences",{value:!1,kind:m.VIEWER}],["enableAltText",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableAltTextModelDownload",{value:!0,kind:m.VIEWER+m.PREFERENCE+m.EVENT_DISPATCH}],["enableAutoLinking",{value:!0,kind:m.VIEWER+m.PREFERENCE}],["enableComment",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableDetailCanvas",{value:!0,kind:m.VIEWER}],["enableGuessAltText",{value:!0,kind:m.VIEWER+m.PREFERENCE+m.EVENT_DISPATCH}],["enableHighlightFloatingButton",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableMerge",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableNewAltTextWhenAddingImage",{value:!0,kind:m.VIEWER+m.PREFERENCE}],["enableNewBadge",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableOptimizedPartialRendering",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enablePermissions",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enablePrintAutoRotate",{value:!0,kind:m.VIEWER+m.PREFERENCE}],["enableScripting",{value:!0,kind:m.VIEWER+m.PREFERENCE}],["enableSelectionRendering",{value:!0,kind:m.VIEWER+m.PREFERENCE}],["enableSignatureEditor",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableSignatureVerification",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableSplitMerge",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["enableUpdatedAddImage",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["externalLinkRel",{value:"noopener noreferrer nofollow",kind:m.VIEWER}],["externalLinkTarget",{value:0,kind:m.VIEWER+m.PREFERENCE}],["highlightEditorColors",{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043",kind:m.VIEWER+m.PREFERENCE}],["historyUpdateUrl",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["ignoreDestinationZoom",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["imageResourcesPath",{value:"./images/",kind:m.VIEWER}],["imagesRightClickMinSize",{value:-1,kind:m.VIEWER+m.PREFERENCE}],["maxCanvasPixels",{value:2**25,kind:m.VIEWER}],["minDurationToUpdateCanvas",{value:500,kind:m.VIEWER}],["forcePageColors",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["pageColorsBackground",{value:"Canvas",kind:m.VIEWER+m.PREFERENCE}],["pageColorsForeground",{value:"CanvasText",kind:m.VIEWER+m.PREFERENCE}],["pdfBugEnabled",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["postMessageAfterPrintCallback",{value:!1,kind:m.VIEWER+m.PREFERENCE}],["printResolution",{value:150,kind:m.VIEWER}],["sandboxBundleSrc",{value:"../build/pdf.sandbox.mjs",kind:m.VIEWER}],["sidebarViewOnLoad",{value:-1,kind:m.VIEWER+m.PREFERENCE}],["scrollModeOnLoad",{value:-1,kind:m.VIEWER+m.PREFERENCE}],["spreadModeOnLoad",{value:-1,kind:m.VIEWER+m.PREFERENCE}],["textLayerMode",{value:1,kind:m.VIEWER+m.PREFERENCE}],["viewerCssTheme",{value:0,kind:m.VIEWER+m.PREFERENCE}],["viewOnLoad",{value:0,kind:m.VIEWER+m.PREFERENCE}],["cMapPacked",{value:!0,kind:m.API}],["cMapUrl",{value:"../web/cmaps/",kind:m.API}],["disableAutoFetch",{value:!1,kind:m.API+m.PREFERENCE}],["disableFontFace",{value:!1,kind:m.API+m.PREFERENCE}],["disableRange",{value:!1,kind:m.API+m.PREFERENCE}],["disableStream",{value:!1,kind:m.API+m.PREFERENCE}],["docBaseUrl",{value:"",kind:m.API}],["enableHWA",{value:!0,kind:m.API+m.PREFERENCE}],["enableWebGPU",{value:!0,kind:m.API+m.PREFERENCE}],["enableXfa",{value:!0,kind:m.API+m.PREFERENCE}],["fontExtraProperties",{value:!1,kind:m.API}],["iccUrl",{value:"../web/iccs/",kind:m.API}],["isOffscreenCanvasSupported",{value:!0,kind:m.API}],["maxImageSize",{value:-1,kind:m.API}],["pdfBug",{value:!1,kind:m.API}],["standardFontDataUrl",{value:"../web/standard_fonts/",kind:m.API}],["useSystemFonts",{value:void 0,kind:m.API,type:Qt.BOOLEAN+Qt.UNDEFINED}],["verbosity",{value:1,kind:m.API}],["wasmUrl",{value:"../web/wasm/",kind:m.API}],["workerPort",{value:null,kind:m.WORKER}],["workerSrc",{value:"../build/pdf.worker.mjs",kind:m.WORKER}]]);class S{static eventBus;static#t=new Map;static{for(const[t,e]of Jt)this.#t.set(t,e.value);for(const[t,e]of Zt)this.#t.set(t,e);this._hasInvokedSet=!1,this._checkDisablePreferences=()=>this.get("disablePreferences")?!0:(this._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)}static get(t){return this.#t.get(t)}static getAll(t=null,e=!1){const i=Object.create(null);for(const[n,s]of Jt)t&&!(t&s.kind)||(i[n]=e?s.value:this.#t.get(n));return i}static set(t,e){this.setAll({[t]:e})}static setAll(t,e=!1){this._hasInvokedSet||=!0;let i;for(const n in t){const s=Jt.get(n),a=t[n];if(!s||!(typeof a==typeof s.value||Qt[(typeof a).toUpperCase()]&s.type))continue;const{kind:o}=s;e&&!(o&m.BROWSER||o&m.PREFERENCE)||(this.eventBus&&o&m.EVENT_DISPATCH&&(i||=new Map).set(n,a),this.#t.set(n,a))}if(i)for(const[n,s]of i)this.eventBus.dispatch(n.toLowerCase(),{source:this,value:s})}}const{AbortException:rn,AnnotationEditorLayer:on,AnnotationEditorParamsType:Z,AnnotationEditorType:B,AnnotationEditorUIManager:ln,AnnotationLayer:dn,AnnotationMode:Q,AnnotationType:ke,applyOpacity:hn,build:Be,ColorPicker:cn,createValidAbsoluteUrl:De,CSSConstants:un,DOMSVGFactory:St,DrawLayer:gn,FeatureTest:Rt,fetchData:Re,findContrastColor:fn,getDocument:pn,getFilenameFromUrl:mn,getPdfFilenameFromUrl:Oe,getRGB:jr,getRGBA:bn,getUuid:wn,GlobalWorkerOptions:Fe,ImageKind:Vr,InvalidPDFException:vn,isDataScheme:En,isPdfFile:je,isValidExplicitDest:yn,makeArr:Ve,makeMap:Cn,makeObj:Ur,makeSet:Hr,MathClamp:Pt,noContextMenu:q,normalizeUnicode:Sn,OPS:zr,OutputScale:lt,PasswordException:Pn,PasswordResponses:_n,PDFDataRangeTransport:Wr,PDFDateString:ft,PDFWorker:In,PermissionFlag:pt,PixelsPerInch:J,RenderingCancelledException:_t,renderRichText:Ue,ResponseException:xn,setLayerDimensions:He,shadow:z,SignatureExtractor:qt,stopEvent:L,SupportedImageMimeTypes:Ot,TextLayer:Ln,TextLayerImages:Tn,TouchManager:An,updateUrlHash:te,Util:dt,VerbosityLevel:$r,version:Ft,XfaLayer:ee}=globalThis.pdfjsLib,ze="83527da5-0ab7-47fb-903f-3d4b1cc75646",x=Object.freeze({internal:ze}),Nn="noopener noreferrer nofollow",et={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class We{externalLinkEnabled=!0;constructor({eventBus:t,externalLinkTarget:e=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=t,this.externalLinkTarget=e,this.externalLinkRel=i,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(t,e=null){this.baseUrl=e,this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setHistory(t){this.pdfHistory=t}get pagesCount(){return this.pdfDocument?.pagesMapper.pagesNumber||0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(t){this.pdfDocument&&(this.pdfViewer.currentPageNumber=t)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(t){this.pdfDocument&&(this.pdfViewer.pagesRotation=t)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(t){if(!this.pdfDocument)return;let e,i,n;if(typeof t=="string"?(e=t,i=await this.pdfDocument.getDestination(t)):(e=null,i=await t),!Array.isArray(i)){console.error(`goToDestination: "${i}" is not a valid destination array, for dest="${t}".`);return}const[s]=i;if(s&&typeof s=="object"){if(n=this.pdfDocument.cachedPageNumber(s),!n)try{n=await this.pdfDocument.getPageIndex(s)+1}catch{console.error(`goToDestination: "${s}" is not a valid page reference, for dest="${t}".`);return}}else Number.isInteger(s)&&(n=s+1);if(!n||n<1||n>this.pagesCount){console.error(`goToDestination: "${n}" is not a valid page number, for dest="${t}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:e,explicitDest:i,pageNumber:n})),this.pdfViewer.scrollPageIntoView({pageNumber:n,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom});const a=new AbortController;this.eventBus.on("textlayerrendered",o=>{o.pageNumber===n&&(o.source.textLayer.div.focus(),a.abort())},{signal:a.signal,...x})}goToPage(t){if(!this.pdfDocument)return;const e=typeof t=="string"&&this.pdfViewer.pageLabelToPageNumber(t)||t|0;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`PDFLinkService.goToPage: "${t}" is not a valid page.`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(e)),this.pdfViewer.scrollPageIntoView({pageNumber:e})}goToXY(t,e,i,n={}){this.pdfViewer.scrollPageIntoView({pageNumber:t,destArray:[null,{name:"XYZ"},e,i],ignoreDestinationZoom:!0,...n})}async getAttachmentContent(t){try{return await this.pdfDocument?.getAttachmentContent(t)}catch(e){e instanceof Pn||console.warn(`Unable to load attachment content: ${e}`)}return null}addLinkAttributes(t,e,i=!1){if(!e||typeof e!="string")throw new Error('A valid "url" parameter must provided.');const n=i?et.BLANK:this.externalLinkTarget,s=this.externalLinkRel;let a=e;const o=URL.parse(e);(o?.username||o?.password)&&(o.username=o.password="",a=o.href),this.externalLinkEnabled?(t.href=e,t.title=a):(t.href="",t.title=`Disabled: ${a}`,t.onclick=()=>!1);let l="";switch(n){case et.NONE:break;case et.SELF:l="_self";break;case et.BLANK:l="_blank";break;case et.PARENT:l="_parent";break;case et.TOP:l="_top";break}t.target=l,t.rel=typeof s=="string"?s:Nn}getDestinationHash(t){if(typeof t=="string"){if(t.length>0)return this.getAnchorUrl("#"+escape(t))}else if(Array.isArray(t)){const e=JSON.stringify(t);if(e.length>0)return this.getAnchorUrl("#"+escape(e))}return this.getAnchorUrl("")}getAnchorUrl(t){return this.baseUrl?this.baseUrl+t:t}setHash(t){if(!this.pdfDocument)return;let e,i;if(t.includes("=")){const n=Ct(t);if(n.has("search")){const s=n.get("search").replaceAll('"',""),a=n.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:a?s:s.match(/\S+/g)})}if(n.has("page")&&(e=n.get("page")|0||1),n.has("zoom")){const s=n.get("zoom").split(","),a=s[0],o=parseFloat(a);a.includes("Fit")?a==="Fit"||a==="FitB"?i=[null,{name:a}]:a==="FitH"||a==="FitBH"||a==="FitV"||a==="FitBV"?i=[null,{name:a},s.length>1?s[1]|0:null]:a==="FitR"?s.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:a},s[1]|0,s[2]|0,s[3]|0,s[4]|0]:console.error(`PDFLinkService.setHash: "${a}" is not a valid zoom value.`):i=[null,{name:"XYZ"},s.length>1?s[1]|0:null,s.length>2?s[2]|0:null,o?o/100:a]}i?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:i,allowNegativeOffset:!0}):e&&(this.page=e),n.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:n.get("pagemode")}),n.has("nameddest")&&this.goToDestination(n.get("nameddest"));return}i=unescape(t);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}if(typeof i=="string"||yn(i)){this.goToDestination(i);return}console.error(`PDFLinkService.setHash: "${unescape(t)}" is not a valid destination.`)}executeNamedAction(t){if(this.pdfDocument){switch(t){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1;break;default:break}this.eventBus.dispatch("namedaction",{source:this,action:t})}}async executeSetOCGState(t){if(!this.pdfDocument)return;const e=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;e===this.pdfDocument&&(i.setOCGState(t),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i))}}class $e extends We{setDocument(t,e=null){}}const Ge={EVENT:"event",TIMEOUT:"timeout"};async function Xe({target:r,name:t,delay:e=0}){if(typeof r!="object"||!(t&&typeof t=="string")||!(Number.isInteger(e)&&e>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:i,resolve:n}=Promise.withResolvers(),s=new AbortController;function a(h){s.abort(),clearTimeout(d),n(h)}const o=r instanceof jt?"on":"addEventListener",l=r instanceof jt?{signal:s.signal,...x}:{signal:s.signal};r[o](t,a.bind(null,Ge.EVENT),l);const d=setTimeout(a.bind(null,Ge.TIMEOUT),e);return i}class jt{#t=Object.create(null);constructor(){Object.seal(this)}on(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){const{signal:a}=i;if(a.aborted){console.error("Cannot use an `aborted` signal.");return}const o=()=>this.off(t,e);n=()=>a.removeEventListener("abort",o),a.addEventListener("abort",o)}(this.#t[t]??=[]).push({listener:e,internal:i?.internal===ze,once:i?.once===!0,rmAbort:n})}off(t,e,i=null){const n=this.#t[t];if(n)for(let s=0,a=n.length;s<a;s++){const o=n[s];if(o.listener===e){o.rmAbort?.(),n.splice(s,1);return}}}dispatch(t,e){const i=this.#t[t];if(!i?.length)return;let n;for(const{listener:s,internal:a,once:o}of i.slice(0)){if(o&&this.off(t,s),!a){(n??=[]).push(s);continue}s(e)}if(n)for(const s of n)s(e)}}class Gr extends jt{#t;#e;#i;constructor(t,e,i){super(),this.#e=t,this.#t=e,this.#i=i}dispatch(t,e){throw new Error("Not implemented: FirefoxEventBus.dispatch")}}class Mn{updateFindControlState(t){}updateFindMatchesCount(t){}initPassiveLoading(){}reportTelemetry(t){}reportText(t){}async createL10n(){throw new Error("Not implemented: createL10n")}createScripting(){throw new Error("Not implemented: createScripting")}createSignatureStorage(){throw new Error("Not implemented: createSignatureStorage")}createSignatureVerifier(){return null}updateEditorStates(t){throw new Error("Not implemented: updateEditorStates")}dispatchGlobalEvent(t){}}class kn{#t=Object.freeze(S.getAll(m.PREFERENCE,!0));#e=null;constructor(){this.#e=this._readFromStorage(this.#t).then(({browserPrefs:t,prefs:e})=>{S._checkDisablePreferences()||S.setAll({...t,...e},!0)})}async _writeToStorage(t){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(t){throw new Error("Not implemented: _readFromStorage")}async reset(){await this.#e,S.setAll(this.#t,!0),await this._writeToStorage(this.#t)}async set(t,e){await this.#e,S.setAll({[t]:e},!0),await this._writeToStorage(S.getAll(m.PREFERENCE))}async get(t){return await this.#e,S.get(t)}get defaults(){return this.#t}get initializedPromise(){return this.#e}}class mt{constructor(t){this.value=t}valueOf(){return this.value}}class V extends mt{constructor(t="???"){super(t)}toString(t){return`{${this.value}}`}}class it extends mt{constructor(t,e={}){super(t),this.opts=e}toString(t){if(t)try{return t.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return this.value.toString(10)}}class at extends mt{static supportsValue(t){if(typeof t=="number"||t instanceof Date)return!0;if(t instanceof mt)return at.supportsValue(t.valueOf());if("Temporal"in globalThis){const e=globalThis.Temporal;if(t instanceof e.Instant||t instanceof e.PlainDateTime||t instanceof e.PlainDate||t instanceof e.PlainMonthDay||t instanceof e.PlainTime||t instanceof e.PlainYearMonth)return!0}return!1}constructor(t,e={}){t instanceof at?(e={...t.opts,...e},t=t.value):t instanceof mt&&(t=t.valueOf()),typeof t=="object"&&"calendarId"in t&&e.calendar===void 0&&(e={...e,calendar:t.calendarId}),super(t),this.opts=e}[Symbol.toPrimitive](t){return t==="string"?this.toString():this.toNumber()}toNumber(){const t=this.value;if(typeof t=="number")return t;if(t instanceof Date)return t.getTime();if("epochMilliseconds"in t)return t.epochMilliseconds;if("toZonedDateTime"in t)return t.toZonedDateTime("UTC").epochMilliseconds;throw new TypeError("Unwrapping a non-number value as a number")}toString(t){if(t)try{return t.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return typeof this.value=="number"||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}}const Ke=100,Bn="\u2068",Dn="\u2069";function Rn(r,t,e){if(e===t||e instanceof it&&t instanceof it&&e.value===t.value)return!0;if(t instanceof it&&typeof e=="string"){let i=r.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value);if(e===i)return!0}return!1}function Ye(r,t,e){return t[e]?bt(r,t[e].value):(r.reportError(new RangeError("No default")),new V)}function ie(r,t){const e=[],i=Object.create(null);for(const n of t)n.type==="narg"?i[n.name]=It(r,n.value):e.push(It(r,n));return{positional:e,named:i}}function It(r,t){switch(t.type){case"str":return t.value;case"num":return new it(t.value,{minimumFractionDigits:t.precision});case"var":return On(r,t);case"mesg":return Fn(r,t);case"term":return jn(r,t);case"func":return Vn(r,t);case"select":return Un(r,t);default:return new V}}function On(r,{name:t}){let e;if(r.params)if(Object.prototype.hasOwnProperty.call(r.params,t))e=r.params[t];else return new V(`$${t}`);else if(r.args&&Object.prototype.hasOwnProperty.call(r.args,t))e=r.args[t];else return r.reportError(new ReferenceError(`Unknown variable: $${t}`)),new V(`$${t}`);if(e instanceof mt)return e;switch(typeof e){case"string":return e;case"number":return new it(e);case"object":if(at.supportsValue(e))return new at(e);default:return r.reportError(new TypeError(`Variable type not supported: $${t}, ${typeof e}`)),new V(`$${t}`)}}function Fn(r,{name:t,attr:e}){const i=r.bundle._messages.get(t);if(!i)return r.reportError(new ReferenceError(`Unknown message: ${t}`)),new V(t);if(e){const n=i.attributes[e];return n?bt(r,n):(r.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new V(`${t}.${e}`))}return i.value?bt(r,i.value):(r.reportError(new ReferenceError(`No value: ${t}`)),new V(t))}function jn(r,{name:t,attr:e,args:i}){const n=`-${t}`,s=r.bundle._terms.get(n);if(!s)return r.reportError(new ReferenceError(`Unknown term: ${n}`)),new V(n);if(e){const o=s.attributes[e];if(o){r.params=ie(r,i).named;const l=bt(r,o);return r.params=null,l}return r.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new V(`${n}.${e}`)}r.params=ie(r,i).named;const a=bt(r,s.value);return r.params=null,a}function Vn(r,{name:t,args:e}){let i=r.bundle._functions[t];if(!i)return r.reportError(new ReferenceError(`Unknown function: ${t}()`)),new V(`${t}()`);if(typeof i!="function")return r.reportError(new TypeError(`Function ${t}() is not callable`)),new V(`${t}()`);try{let n=ie(r,e);return i(n.positional,n.named)}catch(n){return r.reportError(n),new V(`${t}()`)}}function Un(r,{selector:t,variants:e,star:i}){let n=It(r,t);if(n instanceof V)return Ye(r,e,i);for(const s of e){const a=It(r,s.key);if(Rn(r,n,a))return bt(r,s.value)}return Ye(r,e,i)}function Ze(r,t){if(r.dirty.has(t))return r.reportError(new RangeError("Cyclic reference")),new V;r.dirty.add(t);const e=[],i=r.bundle._useIsolating&&t.length>1;for(const n of t){if(typeof n=="string"){e.push(r.bundle._transform(n));continue}if(r.placeables++,r.placeables>Ke)throw r.dirty.delete(t),new RangeError(`Too many placeables expanded: ${r.placeables}, max allowed is ${Ke}`);i&&e.push(Bn),e.push(It(r,n).toString(r)),i&&e.push(Dn)}return r.dirty.delete(t),e.join("")}function bt(r,t){return typeof t=="string"?r.bundle._transform(t):Ze(r,t)}class Hn{constructor(t,e,i){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=t,this.errors=e,this.args=i}reportError(t){if(!this.errors||!(t instanceof Error))throw t;this.errors.push(t)}memoizeIntlObject(t,e){let i=this.bundle._intls.get(t);i||(i={},this.bundle._intls.set(t,i));let n=JSON.stringify(e);return i[n]||(i[n]=new t(this.bundle.locales,e)),i[n]}}function ne(r,t){const e=Object.create(null);for(const[i,n]of Object.entries(r))t.includes(i)&&(e[i]=n.valueOf());return e}const Qe=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function zn(r,t){let e=r[0];if(e instanceof V)return new V(`NUMBER(${e.valueOf()})`);if(e instanceof it)return new it(e.valueOf(),{...e.opts,...ne(t,Qe)});if(e instanceof at)return new it(e.toNumber(),{...ne(t,Qe)});throw new TypeError("Invalid argument to NUMBER")}const Wn=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function $n(r,t){let e=r[0];if(e instanceof V)return new V(`DATETIME(${e.valueOf()})`);if(e instanceof at||e instanceof it)return new at(e,ne(t,Wn));throw new TypeError("Invalid argument to DATETIME")}const Je=new Map;function Gn(r){const t=Array.isArray(r)?r.join(" "):r;let e=Je.get(t);return e===void 0&&(e=new Map,Je.set(t,e)),e}class Xn{constructor(t,{functions:e,useIsolating:i=!0,transform:n=s=>s}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(t)?t:[t],this._functions={NUMBER:zn,DATETIME:$n,...e},this._useIsolating=i,this._transform=n,this._intls=Gn(t)}hasMessage(t){return this._messages.has(t)}getMessage(t){return this._messages.get(t)}addResource(t,{allowOverrides:e=!1}={}){const i=[];for(let n=0;n<t.body.length;n++){let s=t.body[n];if(s.id.startsWith("-")){if(e===!1&&this._terms.has(s.id)){i.push(new Error(`Attempt to override an existing term: "${s.id}"`));continue}this._terms.set(s.id,s)}else{if(e===!1&&this._messages.has(s.id)){i.push(new Error(`Attempt to override an existing message: "${s.id}"`));continue}this._messages.set(s.id,s)}}return i}formatPattern(t,e=null,i=null){if(typeof t=="string")return this._transform(t);let n=new Hn(this,i,e);try{return Ze(n,t).toString(n)}catch(s){if(n.errors&&s instanceof Error)return n.errors.push(s),new V().toString(n);throw s}}}const se=/^(-?[a-zA-Z][\w-]*) *= */gm,qe=/\.([a-zA-Z][\w-]*) *= */y,Kn=/\*?\[/y,ae=/(-?[0-9]+(?:\.([0-9]+))?)/y,Yn=/([a-zA-Z][\w-]*)/y,ti=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,Zn=/^[A-Z][A-Z0-9_-]*$/,Vt=/([^{}\n\r]+)/y,Qn=/([^\\"\n\r]*)/y,ei=/\\([\\"])/y,ii=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,Jn=/^\n+/,ni=/ +$/,qn=/ *\r?\n/g,ts=/( *)$/,es=/{\s*/y,si=/\s*}/y,is=/\[\s*/y,ns=/\s*] */y,ss=/\s*\(\s*/y,as=/\s*->\s*/y,rs=/\s*:\s*/y,os=/\s*,?\s*/y,ls=/\s+/y;class ds{constructor(t){this.body=[],se.lastIndex=0;let e=0;for(;;){let y=se.exec(t);if(y===null)break;e=se.lastIndex;try{this.body.push(l(y[1]))}catch(I){if(I instanceof SyntaxError)continue;throw I}}function i(y){return y.lastIndex=e,y.test(t)}function n(y,I){if(t[e]===y)return e++,!0;if(I)throw new I(`Expected ${y}`);return!1}function s(y,I){if(i(y))return e=y.lastIndex,!0;if(I)throw new I(`Expected ${y.toString()}`);return!1}function a(y){y.lastIndex=e;let I=y.exec(t);if(I===null)throw new SyntaxError(`Expected ${y.toString()}`);return e=y.lastIndex,I}function o(y){return a(y)[1]}function l(y){let I=h(),A=d();if(I===null&&Object.keys(A).length===0)throw new SyntaxError("Expected message value or attributes");return{id:y,value:I,attributes:A}}function d(){let y=Object.create(null);for(;i(qe);){let I=o(qe),A=h();if(A===null)throw new SyntaxError("Expected attribute value");y[I]=A}return y}function h(){let y;if(i(Vt)&&(y=o(Vt)),t[e]==="{"||t[e]==="}")return c(y?[y]:[],1/0);let I=_();return I?y?c([y,I],I.length):(I.value=T(I.value,Jn),c([I],I.length)):y?T(y,ni):null}function c(y=[],I){for(;;){if(i(Vt)){y.push(o(Vt));continue}if(t[e]==="{"){y.push(u());continue}if(t[e]==="}")throw new SyntaxError("Unbalanced closing brace");let O=_();if(O){y.push(O),I=Math.min(I,O.length);continue}break}let A=y.length-1,R=y[A];typeof R=="string"&&(y[A]=T(R,ni));let F=[];for(let O of y)O instanceof ai&&(O=O.value.slice(0,O.value.length-I)),O&&F.push(O);return F}function u(){s(es,SyntaxError);let y=f();if(s(si))return y;if(s(as)){let I=b();return s(si,SyntaxError),{type:"select",selector:y,...I}}throw new SyntaxError("Unclosed placeable")}function f(){if(t[e]==="{")return u();if(i(ti)){let[,y,I,A=null]=a(ti);if(y==="$")return{type:"var",name:I};if(s(ss)){let R=g();if(y==="-")return{type:"term",name:I,attr:A,args:R};if(Zn.test(I))return{type:"func",name:I,args:R};throw new SyntaxError("Function names must be all upper-case")}return y==="-"?{type:"term",name:I,attr:A,args:[]}:{type:"mesg",name:I,attr:A}}return C()}function g(){let y=[];for(;;){switch(t[e]){case")":return e++,y;case void 0:throw new SyntaxError("Unclosed argument list")}y.push(p()),s(os)}}function p(){let y=f();return y.type!=="mesg"?y:s(rs)?{type:"narg",name:y.name,value:C()}:y}function b(){let y=[],I=0,A;for(;i(Kn);){n("*")&&(A=I);let R=w(),F=h();if(F===null)throw new SyntaxError("Expected variant value");y[I++]={key:R,value:F}}if(I===0)return null;if(A===void 0)throw new SyntaxError("Expected default variant");return{variants:y,star:A}}function w(){s(is,SyntaxError);let y;return i(ae)?y=E():y={type:"str",value:o(Yn)},s(ns,SyntaxError),y}function C(){if(i(ae))return E();if(t[e]==='"')return P();throw new SyntaxError("Invalid expression")}function E(){let[,y,I=""]=a(ae),A=I.length;return{type:"num",value:parseFloat(y),precision:A}}function P(){n('"',SyntaxError);let y="";for(;;){if(y+=o(Qn),t[e]==="\\"){y+=v();continue}if(n('"'))return{type:"str",value:y};throw new SyntaxError("Unclosed string literal")}}function v(){if(i(ei))return o(ei);if(i(ii)){let[,y,I]=a(ii),A=parseInt(y||I,16);return A<=55295||57344<=A?String.fromCodePoint(A):"\uFFFD"}throw new SyntaxError("Unknown escape sequence")}function _(){let y=e;switch(s(ls),t[e]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return D(t.slice(y,e))}return t[e-1]===" "?D(t.slice(y,e)):!1}function T(y,I){return y.replace(I,"")}function D(y){let I=y.replace(qn,`
|
|
2
|
+
`),A=ts.exec(y)[1].length;return new ai(I,A)}}}class ai{constructor(t,e){this.value=t,this.length=e}}const hs=/<|&#?\w+;/,cs={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},us={"http://www.w3.org/1999/xhtml":{global:["title","aria-description","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function gs(r,t){const{value:e}=t;if(typeof e=="string")if(r.localName==="title"&&r.namespaceURI==="http://www.w3.org/1999/xhtml")r.textContent=e;else if(!hs.test(e))r.textContent=e;else{const i=r.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");i.innerHTML=e,fs(i.content,r)}ri(t,r)}function fs(r,t){for(const e of r.childNodes)if(e.nodeType!==e.TEXT_NODE){if(e.hasAttribute("data-l10n-name")){const i=ms(t,e);r.replaceChild(i,e);continue}if(ws(e)){const i=bs(e);r.replaceChild(i,e);continue}console.warn(`An element of forbidden type "${e.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),r.replaceChild(re(e),e)}t.textContent="",t.appendChild(r)}function ps(r,t){if(!r)return!1;for(let e of r)if(e.name===t)return!0;return!1}function ri(r,t){const e=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map(i=>i.trim()):null;for(const i of Array.from(t.attributes))oi(i.name,t,e)&&!ps(r.attributes,i.name)&&t.removeAttribute(i.name);if(r.attributes)for(const i of Array.from(r.attributes))oi(i.name,t,e)&&t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value)}function ms(r,t){const e=t.getAttribute("data-l10n-name"),i=r.querySelector(`[data-l10n-name="${e}"]`);if(!i)return console.warn(`An element named "${e}" wasn't found in the source.`),re(t);if(i.localName!==t.localName)return console.warn(`An element named "${e}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${i.localName}).`),re(t);r.removeChild(i);const n=i.cloneNode(!1);return li(t,n)}function bs(r){const t=r.ownerDocument.createElement(r.localName);return li(r,t)}function re(r){return r.ownerDocument.createTextNode(r.textContent)}function ws(r){const t=cs[r.namespaceURI];return t&&t.includes(r.localName)}function oi(r,t,e=null){if(e&&e.includes(r))return!0;const i=us[t.namespaceURI];if(!i)return!1;const n=r.toLowerCase(),s=t.localName;if(i.global.includes(n))return!0;if(!i[s])return!1;if(i[s].includes(n))return!0;if(t.namespaceURI==="http://www.w3.org/1999/xhtml"&&s==="input"&&n==="value"){const a=t.type.toLowerCase();if(a==="submit"||a==="button"||a==="reset")return!0}return!1}function li(r,t){return t.textContent=r.textContent,ri(r,t),t}class di extends Array{static from(t){return t instanceof this?t:new this(t)}}class Xr extends di{constructor(t){if(super(),Symbol.iterator in Object(t))this.iterator=t[Symbol.iterator]();else throw new TypeError("Argument must implement the iteration protocol.")}[Symbol.iterator](){const t=this;let e=0;return{next(){return t.length<=e&&t.push(t.iterator.next()),t[e++]}}}touchNext(t=1){let e=0;for(;e++<t;){const i=this[this.length-1];if(i&&i.done)break;this.push(this.iterator.next())}return this[this.length-1]}}class vs extends di{constructor(t){if(super(),Symbol.asyncIterator in Object(t))this.iterator=t[Symbol.asyncIterator]();else if(Symbol.iterator in Object(t))this.iterator=t[Symbol.iterator]();else throw new TypeError("Argument must implement the iteration protocol.")}[Symbol.asyncIterator](){const t=this;let e=0;return{async next(){return t.length<=e&&t.push(t.iterator.next()),t[e++]}}}async touchNext(t=1){let e=0;for(;e++<t;){const i=this[this.length-1];if(i&&(await i).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class Es{constructor(t=[],e){this.resourceIds=t,this.generateBundles=e,this.onChange(!0)}addResourceIds(t,e=!1){return this.resourceIds.push(...t),this.onChange(e),this.resourceIds.length}removeResourceIds(t){return this.resourceIds=this.resourceIds.filter(e=>!t.includes(e)),this.onChange(),this.resourceIds.length}async formatWithFallback(t,e){const i=[];let n=!1;for await(const s of this.bundles){n=!0;const a=Ss(e,s,t,i);if(a.size===0)break;if(typeof console<"u"){const o=s.locales[0],l=Array.from(a).join(", ");console.warn(`[fluent] Missing translations in ${o}: ${l}`)}}return!n&&typeof console<"u"&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated.
|
|
3
|
+
keys: ${JSON.stringify(t)}.
|
|
4
|
+
resourceIds: ${JSON.stringify(this.resourceIds)}.`),i}formatMessages(t){return this.formatWithFallback(t,Cs)}formatValues(t){return this.formatWithFallback(t,ys)}async formatValue(t,e){const[i]=await this.formatValues([{id:t,args:e}]);return i}handleEvent(){this.onChange()}onChange(t=!1){this.bundles=vs.from(this.generateBundles(this.resourceIds)),t&&this.bundles.touchNext(2)}}function ys(r,t,e,i){return e.value?r.formatPattern(e.value,i,t):null}function Cs(r,t,e,i){const n={value:null,attributes:null};e.value&&(n.value=r.formatPattern(e.value,i,t));let s=Object.keys(e.attributes);if(s.length>0){n.attributes=new Array(s.length);for(let[a,o]of s.entries()){let l=r.formatPattern(e.attributes[o],i,t);n.attributes[a]={name:o,value:l}}}return n}function Ss(r,t,e,i){const n=[],s=new Set;return e.forEach(({id:a,args:o},l)=>{if(i[l]!==void 0)return;let d=t.getMessage(a);if(d){if(n.length=0,i[l]=r(t,n,d,o),n.length>0&&typeof console<"u"){const h=t.locales[0],c=n.join(", ");console.warn(`[fluent][resolver] errors in ${h}/${a}: ${c}.`)}}else s.add(a)}),s}const ht="data-l10n-id",xt="data-l10n-args",Ps=`[${ht}]`;class _s extends Es{constructor(t,e){super(t,e),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[ht,xt]}}onChange(t=!1){super.onChange(t),this.roots&&this.translateRoots()}setAttributes(t,e,i){return t.setAttribute(ht,e),i?t.setAttribute(xt,JSON.stringify(i)):t.removeAttribute(xt),t}getAttributes(t){return{id:t.getAttribute(ht),args:JSON.parse(t.getAttribute(xt)||null)}}connectRoot(t){for(const e of this.roots)if(e===t||e.contains(t)||t.contains(e))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==t.ownerDocument.defaultView)throw new Error(`Cannot connect a root:
|
|
5
|
+
DOMLocalization already has a root from a different window.`)}else this.windowElement=t.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e));this.roots.add(t),this.mutationObserver.observe(t,this.observerConfig)}disconnectRoot(t){return this.roots.delete(t),this.pauseObserving(),this.roots.size===0?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){const t=Array.from(this.roots);return Promise.all(t.map(e=>this.translateFragment(e)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(const t of this.roots)this.mutationObserver.observe(t,this.observerConfig)}translateMutations(t){for(const e of t)switch(e.type){case"attributes":e.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(e.target);break;case"childList":for(const i of e.addedNodes)if(i.nodeType===i.ELEMENT_NODE)if(i.childElementCount)for(const n of this.getTranslatables(i))this.pendingElements.add(n);else i.hasAttribute(ht)&&this.pendingElements.add(i);break}this.pendingElements.size>0&&this.pendingrAF===null&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(t){return this.translateElements(this.getTranslatables(t))}async translateElements(t){if(!t.length)return;const e=t.map(this.getKeysForElement),i=await this.formatMessages(e);return this.applyTranslations(t,i)}applyTranslations(t,e){this.pauseObserving();for(let i=0;i<t.length;i++)e[i]!==void 0&&gs(t[i],e[i]);this.resumeObserving()}getTranslatables(t){const e=Array.from(t.querySelectorAll(Ps));return typeof t.hasAttribute=="function"&&t.hasAttribute(ht)&&e.push(t),e}getKeysForElement(t){return{id:t.getAttribute(ht),args:JSON.parse(t.getAttribute(xt)||null)}}}class $t{#t;#e;#i;#s;constructor({lang:t,isRTL:e},i=null){this.#i=$t.#a(t),this.#s=i,this.#t=e??$t.#n(this.#i)?"rtl":"ltr"}_setL10n(t){this.#s=t}getLanguage(){return this.#i}getDirection(){return this.#t}async get(t,e=null,i){return Array.isArray(t)?(t=t.map(a=>({id:a})),(await this.#s.formatMessages(t)).map(a=>a.value)):(await this.#s.formatMessages([{id:t,args:e}]))[0]?.value||i}async translate(t){(this.#e||=new Set).add(t);try{this.#s.connectRoot(t),await this.#s.translateRoots()}catch{}}async translateOnce(t){try{await this.#s.translateElements([t])}catch(e){console.error("translateOnce:",e)}}async destroy(){if(this.#e){for(const t of this.#e)this.#s.disconnectRoot(t);this.#e.clear(),this.#e=null}this.#s.pauseObserving()}pause(){this.#s.pauseObserving()}resume(){this.#s.resumeObserving()}static#a(t){return t=t?.toLowerCase()||"en-us",{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[t]||t}static#n(t){const e=t.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(e)}}const Kr=null;function Is(){const{isAndroid:r,isLinux:t,isMac:e,isWindows:i}=Rt.platform;return t?"linux":i?"windows":e?"macos":r?"android":"other"}function hi(r,t){const e=new ds(t),i=new Xn(r,{functions:{PLATFORM:Is}}),n=i.addResource(e);return n.length&&console.error("L10n errors",n),i}class st extends $t{constructor(t){super({lang:t});const e=t?st.#t.bind(st,"en-us",this.getLanguage()):st.#s.bind(st,this.getLanguage());this._setL10n(new _s([],e))}static async*#t(t,e){const{baseURL:i,paths:n}=await this.#i(),s=[e];if(t!==e){const o=e.split("-",1)[0];o!==e&&s.push(o),s.push(t)}const a=s.map(o=>[o,this.#e(o,i,n)]);for(const[o,l]of a){const d=await l;d?yield d:o==="en-us"&&(yield this.#a(o))}}static async#e(t,e,i){const n=i[t];if(!n)return null;const s=new URL(n,e),a=await Re(s,"text");return hi(t,a)}static async#i(){try{const{href:t}=document.querySelector('link[type="application/l10n"]'),e=await Re(t,"json");return{baseURL:t.substring(0,t.lastIndexOf("/")+1)||"./",paths:e}}catch{}return{baseURL:"./",paths:Object.create(null)}}static async*#s(t){yield this.#a(t)}static async#a(t){return hi(t,`pdfjs-previous-button =
|
|
6
|
+
.title = Previous Page
|
|
7
|
+
pdfjs-previous-button-label = Previous
|
|
8
|
+
pdfjs-next-button =
|
|
9
|
+
.title = Next Page
|
|
10
|
+
pdfjs-next-button-label = Next
|
|
11
|
+
pdfjs-page-input =
|
|
12
|
+
.title = Page
|
|
13
|
+
pdfjs-of-pages = of { $pagesCount }
|
|
14
|
+
pdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })
|
|
15
|
+
pdfjs-zoom-out-button =
|
|
16
|
+
.title = Zoom Out
|
|
17
|
+
pdfjs-zoom-out-button-label = Zoom Out
|
|
18
|
+
pdfjs-zoom-in-button =
|
|
19
|
+
.title = Zoom In
|
|
20
|
+
pdfjs-zoom-in-button-label = Zoom In
|
|
21
|
+
pdfjs-zoom-select =
|
|
22
|
+
.title = Zoom
|
|
23
|
+
pdfjs-presentation-mode-button =
|
|
24
|
+
.title = Switch to Presentation Mode
|
|
25
|
+
pdfjs-presentation-mode-button-label = Presentation Mode
|
|
26
|
+
pdfjs-open-file-button =
|
|
27
|
+
.title = Open File
|
|
28
|
+
pdfjs-open-file-button-label = Open
|
|
29
|
+
pdfjs-print-button =
|
|
30
|
+
.title = Print
|
|
31
|
+
pdfjs-print-button-label = Print
|
|
32
|
+
pdfjs-save-button =
|
|
33
|
+
.title = Save
|
|
34
|
+
pdfjs-save-button-label = Save
|
|
35
|
+
pdfjs-download-button =
|
|
36
|
+
.title = Download
|
|
37
|
+
pdfjs-download-button-label = Download
|
|
38
|
+
pdfjs-bookmark-button =
|
|
39
|
+
.title = Current Page (View URL from Current Page)
|
|
40
|
+
pdfjs-bookmark-button-label = Current Page
|
|
41
|
+
pdfjs-tools-button =
|
|
42
|
+
.title = Tools
|
|
43
|
+
pdfjs-tools-button-label = Tools
|
|
44
|
+
pdfjs-first-page-button =
|
|
45
|
+
.title = Go to First Page
|
|
46
|
+
pdfjs-first-page-button-label = Go to First Page
|
|
47
|
+
pdfjs-last-page-button =
|
|
48
|
+
.title = Go to Last Page
|
|
49
|
+
pdfjs-last-page-button-label = Go to Last Page
|
|
50
|
+
pdfjs-page-rotate-cw-button =
|
|
51
|
+
.title = Rotate Clockwise
|
|
52
|
+
pdfjs-page-rotate-cw-button-label = Rotate Clockwise
|
|
53
|
+
pdfjs-page-rotate-ccw-button =
|
|
54
|
+
.title = Rotate Counterclockwise
|
|
55
|
+
pdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise
|
|
56
|
+
pdfjs-cursor-text-select-tool-button =
|
|
57
|
+
.title = Enable Text Selection Tool
|
|
58
|
+
pdfjs-cursor-text-select-tool-button-label = Text Selection Tool
|
|
59
|
+
pdfjs-cursor-hand-tool-button =
|
|
60
|
+
.title = Enable Hand Tool
|
|
61
|
+
pdfjs-cursor-hand-tool-button-label = Hand Tool
|
|
62
|
+
pdfjs-scroll-page-button =
|
|
63
|
+
.title = Use Page Scrolling
|
|
64
|
+
pdfjs-scroll-page-button-label = Page Scrolling
|
|
65
|
+
pdfjs-scroll-vertical-button =
|
|
66
|
+
.title = Use Vertical Scrolling
|
|
67
|
+
pdfjs-scroll-vertical-button-label = Vertical Scrolling
|
|
68
|
+
pdfjs-scroll-horizontal-button =
|
|
69
|
+
.title = Use Horizontal Scrolling
|
|
70
|
+
pdfjs-scroll-horizontal-button-label = Horizontal Scrolling
|
|
71
|
+
pdfjs-scroll-wrapped-button =
|
|
72
|
+
.title = Use Wrapped Scrolling
|
|
73
|
+
pdfjs-scroll-wrapped-button-label = Wrapped Scrolling
|
|
74
|
+
pdfjs-spread-none-button =
|
|
75
|
+
.title = Do not join page spreads
|
|
76
|
+
pdfjs-spread-none-button-label = No Spreads
|
|
77
|
+
pdfjs-spread-odd-button =
|
|
78
|
+
.title = Join page spreads starting with odd-numbered pages
|
|
79
|
+
pdfjs-spread-odd-button-label = Odd Spreads
|
|
80
|
+
pdfjs-spread-even-button =
|
|
81
|
+
.title = Join page spreads starting with even-numbered pages
|
|
82
|
+
pdfjs-spread-even-button-label = Even Spreads
|
|
83
|
+
pdfjs-document-properties-button =
|
|
84
|
+
.title = Document Properties\u2026
|
|
85
|
+
pdfjs-document-properties-button-label = Document Properties\u2026
|
|
86
|
+
pdfjs-document-properties-file-name = File name:
|
|
87
|
+
pdfjs-document-properties-file-size = File size:
|
|
88
|
+
pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)
|
|
89
|
+
pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)
|
|
90
|
+
pdfjs-document-properties-title = Title:
|
|
91
|
+
pdfjs-document-properties-author = Author:
|
|
92
|
+
pdfjs-document-properties-subject = Subject:
|
|
93
|
+
pdfjs-document-properties-keywords = Keywords:
|
|
94
|
+
pdfjs-document-properties-creation-date = Creation Date:
|
|
95
|
+
pdfjs-document-properties-modification-date = Modification Date:
|
|
96
|
+
pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
|
|
97
|
+
pdfjs-document-properties-creator = Creator:
|
|
98
|
+
pdfjs-document-properties-producer = PDF Producer:
|
|
99
|
+
pdfjs-document-properties-version = PDF Version:
|
|
100
|
+
pdfjs-document-properties-page-count = Page Count:
|
|
101
|
+
pdfjs-document-properties-page-size = Page Size:
|
|
102
|
+
pdfjs-document-properties-page-size-unit-inches = in
|
|
103
|
+
pdfjs-document-properties-page-size-unit-millimeters = mm
|
|
104
|
+
pdfjs-document-properties-page-size-orientation-portrait = portrait
|
|
105
|
+
pdfjs-document-properties-page-size-orientation-landscape = landscape
|
|
106
|
+
pdfjs-document-properties-page-size-name-a-three = A3
|
|
107
|
+
pdfjs-document-properties-page-size-name-a-four = A4
|
|
108
|
+
pdfjs-document-properties-page-size-name-letter = Letter
|
|
109
|
+
pdfjs-document-properties-page-size-name-legal = Legal
|
|
110
|
+
pdfjs-document-properties-page-size-dimension-string = { $width } \xD7 { $height } { $unit } ({ $orientation })
|
|
111
|
+
pdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $height } { $unit } ({ $name }, { $orientation })
|
|
112
|
+
pdfjs-document-properties-linearized = Fast Web View:
|
|
113
|
+
pdfjs-document-properties-linearized-yes = Yes
|
|
114
|
+
pdfjs-document-properties-linearized-no = No
|
|
115
|
+
pdfjs-document-properties-close-button = Close
|
|
116
|
+
pdfjs-print-progress-message = Preparing document for printing\u2026
|
|
117
|
+
pdfjs-print-progress-percent = { $progress }%
|
|
118
|
+
pdfjs-print-progress-close-button = Cancel
|
|
119
|
+
pdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.
|
|
120
|
+
pdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.
|
|
121
|
+
pdfjs-current-outline-item-button =
|
|
122
|
+
.title = Find Current Outline Item
|
|
123
|
+
pdfjs-current-outline-item-button-label = Current Outline Item
|
|
124
|
+
pdfjs-findbar-button =
|
|
125
|
+
.title = Find in Document
|
|
126
|
+
pdfjs-findbar-button-label = Find
|
|
127
|
+
pdfjs-additional-layers = Additional Layers
|
|
128
|
+
pdfjs-thumb-page-title1 =
|
|
129
|
+
.title = Page { $page } of { $total }
|
|
130
|
+
pdfjs-thumb-page-canvas =
|
|
131
|
+
.aria-label = Thumbnail of Page { $page }
|
|
132
|
+
pdfjs-thumb-page-checkbox1 =
|
|
133
|
+
.title = Select page { $page }
|
|
134
|
+
pdfjs-find-input =
|
|
135
|
+
.title = Find
|
|
136
|
+
.placeholder = Find in document\u2026
|
|
137
|
+
pdfjs-find-previous-button =
|
|
138
|
+
.title = Find the previous occurrence of the phrase
|
|
139
|
+
pdfjs-find-previous-button-label = Previous
|
|
140
|
+
pdfjs-find-next-button =
|
|
141
|
+
.title = Find the next occurrence of the phrase
|
|
142
|
+
pdfjs-find-next-button-label = Next
|
|
143
|
+
pdfjs-find-highlight-checkbox = Highlight All
|
|
144
|
+
pdfjs-find-match-case-checkbox-label = Match Case
|
|
145
|
+
pdfjs-find-match-diacritics-checkbox-label = Match Diacritics
|
|
146
|
+
pdfjs-find-entire-word-checkbox-label = Whole Words
|
|
147
|
+
pdfjs-find-reached-top = Reached top of document, continued from bottom
|
|
148
|
+
pdfjs-find-reached-bottom = Reached end of document, continued from top
|
|
149
|
+
pdfjs-find-match-count =
|
|
150
|
+
{ $total ->
|
|
151
|
+
[one] { $current } of { $total } match
|
|
152
|
+
*[other] { $current } of { $total } matches
|
|
153
|
+
}
|
|
154
|
+
pdfjs-find-match-count-limit =
|
|
155
|
+
{ $limit ->
|
|
156
|
+
[one] More than { $limit } match
|
|
157
|
+
*[other] More than { $limit } matches
|
|
158
|
+
}
|
|
159
|
+
pdfjs-find-not-found = Phrase not found
|
|
160
|
+
pdfjs-page-scale-width = Page Width
|
|
161
|
+
pdfjs-page-scale-fit = Page Fit
|
|
162
|
+
pdfjs-page-scale-auto = Automatic Zoom
|
|
163
|
+
pdfjs-page-scale-actual = Actual Size
|
|
164
|
+
pdfjs-page-scale-percent = { $scale }%
|
|
165
|
+
pdfjs-page-landmark =
|
|
166
|
+
.aria-label = Page { $page }
|
|
167
|
+
pdfjs-loading-error = An error occurred while loading the PDF.
|
|
168
|
+
pdfjs-invalid-file-error = Invalid or corrupted PDF file.
|
|
169
|
+
pdfjs-missing-file-error = Missing PDF file.
|
|
170
|
+
pdfjs-unexpected-response-error = Unexpected server response.
|
|
171
|
+
pdfjs-rendering-error = An error occurred while rendering the page.
|
|
172
|
+
pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
|
|
173
|
+
pdfjs-text-annotation-type =
|
|
174
|
+
.alt = [{ $type } Annotation]
|
|
175
|
+
pdfjs-password-label = Enter the password to open this PDF file.
|
|
176
|
+
pdfjs-password-invalid = Invalid password. Please try again.
|
|
177
|
+
pdfjs-password-ok-button = OK
|
|
178
|
+
pdfjs-password-cancel-button = Cancel
|
|
179
|
+
pdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.
|
|
180
|
+
pdfjs-editor-free-text-button =
|
|
181
|
+
.title = Text
|
|
182
|
+
pdfjs-editor-color-picker-free-text-input =
|
|
183
|
+
.title = Change text color
|
|
184
|
+
pdfjs-editor-free-text-button-label = Text
|
|
185
|
+
pdfjs-editor-ink-button =
|
|
186
|
+
.title = Draw
|
|
187
|
+
pdfjs-editor-color-picker-ink-input =
|
|
188
|
+
.title = Change drawing color
|
|
189
|
+
pdfjs-editor-ink-button-label = Draw
|
|
190
|
+
pdfjs-editor-stamp-button =
|
|
191
|
+
.title = Add or edit images
|
|
192
|
+
pdfjs-editor-stamp-button-label = Add or edit images
|
|
193
|
+
pdfjs-editor-highlight-button =
|
|
194
|
+
.title = Highlight
|
|
195
|
+
pdfjs-editor-highlight-button-label = Highlight
|
|
196
|
+
pdfjs-highlight-floating-button1 =
|
|
197
|
+
.title = Highlight
|
|
198
|
+
.aria-label = Highlight
|
|
199
|
+
pdfjs-highlight-floating-button-label = Highlight
|
|
200
|
+
pdfjs-comment-floating-button =
|
|
201
|
+
.title = Comment
|
|
202
|
+
.aria-label = Comment
|
|
203
|
+
pdfjs-comment-floating-button-label = Comment
|
|
204
|
+
pdfjs-editor-comment-button =
|
|
205
|
+
.title = Comment
|
|
206
|
+
.aria-label = Comment
|
|
207
|
+
pdfjs-editor-comment-button-label = Comment
|
|
208
|
+
pdfjs-editor-signature-button =
|
|
209
|
+
.title = Add signature
|
|
210
|
+
pdfjs-editor-signature-button-label = Add signature
|
|
211
|
+
pdfjs-editor-highlight-editor =
|
|
212
|
+
.aria-label = Highlight editor
|
|
213
|
+
pdfjs-editor-ink-editor =
|
|
214
|
+
.aria-label = Drawing editor
|
|
215
|
+
pdfjs-editor-signature-editor1 =
|
|
216
|
+
.aria-description = Signature editor: { $description }
|
|
217
|
+
pdfjs-editor-stamp-editor =
|
|
218
|
+
.aria-label = Image editor
|
|
219
|
+
pdfjs-editor-remove-ink-button =
|
|
220
|
+
.title = Remove drawing
|
|
221
|
+
pdfjs-editor-remove-freetext-button =
|
|
222
|
+
.title = Remove text
|
|
223
|
+
pdfjs-editor-remove-stamp-button =
|
|
224
|
+
.title = Remove image
|
|
225
|
+
pdfjs-editor-remove-highlight-button =
|
|
226
|
+
.title = Remove highlight
|
|
227
|
+
pdfjs-editor-remove-signature-button =
|
|
228
|
+
.title = Remove signature
|
|
229
|
+
pdfjs-editor-free-text-color-input = Color
|
|
230
|
+
pdfjs-editor-free-text-size-input = Size
|
|
231
|
+
pdfjs-editor-ink-color-input = Color
|
|
232
|
+
pdfjs-editor-ink-thickness-input = Thickness
|
|
233
|
+
pdfjs-editor-ink-opacity-input = Opacity
|
|
234
|
+
pdfjs-editor-stamp-add-image-button =
|
|
235
|
+
.title = Add image
|
|
236
|
+
pdfjs-editor-stamp-add-image-button-label = Add image
|
|
237
|
+
pdfjs-editor-free-highlight-thickness-input = Thickness
|
|
238
|
+
pdfjs-editor-free-highlight-thickness-title =
|
|
239
|
+
.title = Change thickness when highlighting items other than text
|
|
240
|
+
pdfjs-editor-add-signature-container =
|
|
241
|
+
.aria-label = Signature controls and saved signatures
|
|
242
|
+
pdfjs-editor-signature-add-signature-button =
|
|
243
|
+
.title = Add new signature
|
|
244
|
+
pdfjs-editor-signature-add-signature-button-label = Add new signature
|
|
245
|
+
pdfjs-editor-add-saved-signature-button =
|
|
246
|
+
.title = Saved signature: { $description }
|
|
247
|
+
pdfjs-free-text2 =
|
|
248
|
+
.aria-label = Text Editor
|
|
249
|
+
.default-content = Start typing\u2026
|
|
250
|
+
pdfjs-editor-comments-sidebar-title =
|
|
251
|
+
{ $count ->
|
|
252
|
+
[one] Comment
|
|
253
|
+
*[other] Comments
|
|
254
|
+
}
|
|
255
|
+
pdfjs-editor-comments-sidebar-close-button =
|
|
256
|
+
.title = Close the sidebar
|
|
257
|
+
.aria-label = Close the sidebar
|
|
258
|
+
pdfjs-editor-comments-sidebar-close-button-label = Close the sidebar
|
|
259
|
+
pdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment.
|
|
260
|
+
pdfjs-editor-comments-sidebar-no-comments-link = Learn more
|
|
261
|
+
pdfjs-editor-alt-text-button =
|
|
262
|
+
.aria-label = Alt text
|
|
263
|
+
pdfjs-editor-alt-text-button-label = Alt text
|
|
264
|
+
pdfjs-editor-alt-text-edit-button =
|
|
265
|
+
.aria-label = Edit alt text
|
|
266
|
+
pdfjs-editor-alt-text-dialog-label = Choose an option
|
|
267
|
+
pdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.
|
|
268
|
+
pdfjs-editor-alt-text-add-description-label = Add a description
|
|
269
|
+
pdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.
|
|
270
|
+
pdfjs-editor-alt-text-mark-decorative-label = Mark as decorative
|
|
271
|
+
pdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.
|
|
272
|
+
pdfjs-editor-alt-text-cancel-button = Cancel
|
|
273
|
+
pdfjs-editor-alt-text-save-button = Save
|
|
274
|
+
pdfjs-editor-alt-text-decorative-tooltip = Marked as decorative
|
|
275
|
+
pdfjs-editor-alt-text-textarea =
|
|
276
|
+
.placeholder = For example, \u201CA young man sits down at a table to eat a meal\u201D
|
|
277
|
+
pdfjs-editor-resizer-top-left =
|
|
278
|
+
.aria-label = Top left corner \u2014 resize
|
|
279
|
+
pdfjs-editor-resizer-top-middle =
|
|
280
|
+
.aria-label = Top middle \u2014 resize
|
|
281
|
+
pdfjs-editor-resizer-top-right =
|
|
282
|
+
.aria-label = Top right corner \u2014 resize
|
|
283
|
+
pdfjs-editor-resizer-middle-right =
|
|
284
|
+
.aria-label = Middle right \u2014 resize
|
|
285
|
+
pdfjs-editor-resizer-bottom-right =
|
|
286
|
+
.aria-label = Bottom right corner \u2014 resize
|
|
287
|
+
pdfjs-editor-resizer-bottom-middle =
|
|
288
|
+
.aria-label = Bottom middle \u2014 resize
|
|
289
|
+
pdfjs-editor-resizer-bottom-left =
|
|
290
|
+
.aria-label = Bottom left corner \u2014 resize
|
|
291
|
+
pdfjs-editor-resizer-middle-left =
|
|
292
|
+
.aria-label = Middle left \u2014 resize
|
|
293
|
+
pdfjs-editor-highlight-colorpicker-label = Highlight color
|
|
294
|
+
pdfjs-editor-colorpicker-button =
|
|
295
|
+
.title = Change color
|
|
296
|
+
pdfjs-editor-colorpicker-dropdown =
|
|
297
|
+
.aria-label = Color choices
|
|
298
|
+
pdfjs-editor-colorpicker-yellow =
|
|
299
|
+
.title = Yellow
|
|
300
|
+
pdfjs-editor-colorpicker-green =
|
|
301
|
+
.title = Green
|
|
302
|
+
pdfjs-editor-colorpicker-blue =
|
|
303
|
+
.title = Blue
|
|
304
|
+
pdfjs-editor-colorpicker-pink =
|
|
305
|
+
.title = Pink
|
|
306
|
+
pdfjs-editor-colorpicker-red =
|
|
307
|
+
.title = Red
|
|
308
|
+
pdfjs-editor-highlight-show-all-button-label = Show all
|
|
309
|
+
pdfjs-editor-highlight-show-all-button =
|
|
310
|
+
.title = Show all
|
|
311
|
+
pdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)
|
|
312
|
+
pdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)
|
|
313
|
+
pdfjs-editor-new-alt-text-textarea =
|
|
314
|
+
.placeholder = Write your description here\u2026
|
|
315
|
+
pdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.
|
|
316
|
+
pdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.
|
|
317
|
+
pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more
|
|
318
|
+
pdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically
|
|
319
|
+
pdfjs-editor-new-alt-text-not-now-button = Not now
|
|
320
|
+
pdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically
|
|
321
|
+
pdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.
|
|
322
|
+
pdfjs-editor-new-alt-text-error-close-button = Close
|
|
323
|
+
pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
|
|
324
|
+
.aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
|
|
325
|
+
pdfjs-editor-new-alt-text-added-button =
|
|
326
|
+
.aria-label = Alt text added
|
|
327
|
+
pdfjs-editor-new-alt-text-added-button-label = Alt text added
|
|
328
|
+
pdfjs-editor-new-alt-text-missing-button =
|
|
329
|
+
.aria-label = Missing alt text
|
|
330
|
+
pdfjs-editor-new-alt-text-missing-button-label = Missing alt text
|
|
331
|
+
pdfjs-editor-new-alt-text-to-review-button =
|
|
332
|
+
.aria-label = Review alt text
|
|
333
|
+
pdfjs-editor-new-alt-text-to-review-button-label = Review alt text
|
|
334
|
+
pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }
|
|
335
|
+
pdfjs-image-alt-text-settings-button =
|
|
336
|
+
.title = Image alt text settings
|
|
337
|
+
pdfjs-image-alt-text-settings-button-label = Image alt text settings
|
|
338
|
+
pdfjs-editor-alt-text-settings-dialog-label = Image alt text settings
|
|
339
|
+
pdfjs-editor-alt-text-settings-automatic-title = Automatic alt text
|
|
340
|
+
pdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically
|
|
341
|
+
pdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.
|
|
342
|
+
pdfjs-editor-alt-text-settings-editor-title = Alt text editor
|
|
343
|
+
pdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image
|
|
344
|
+
pdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.
|
|
345
|
+
pdfjs-editor-alt-text-settings-close-button = Close
|
|
346
|
+
pdfjs-editor-highlight-added-alert = Highlight added
|
|
347
|
+
pdfjs-editor-freetext-added-alert = Text added
|
|
348
|
+
pdfjs-editor-ink-added-alert = Drawing added
|
|
349
|
+
pdfjs-editor-stamp-added-alert = Image added
|
|
350
|
+
pdfjs-editor-signature-added-alert = Signature added
|
|
351
|
+
pdfjs-editor-undo-bar-message-highlight = Highlight removed
|
|
352
|
+
pdfjs-editor-undo-bar-message-freetext = Text removed
|
|
353
|
+
pdfjs-editor-undo-bar-message-ink = Drawing removed
|
|
354
|
+
pdfjs-editor-undo-bar-message-stamp = Image removed
|
|
355
|
+
pdfjs-editor-undo-bar-message-signature = Signature removed
|
|
356
|
+
pdfjs-editor-undo-bar-message-comment = Comment removed
|
|
357
|
+
pdfjs-editor-undo-bar-message-multiple =
|
|
358
|
+
{ $count ->
|
|
359
|
+
[one] { $count } annotation removed
|
|
360
|
+
*[other] { $count } annotations removed
|
|
361
|
+
}
|
|
362
|
+
pdfjs-editor-undo-bar-undo-button =
|
|
363
|
+
.title = Undo
|
|
364
|
+
pdfjs-editor-undo-bar-undo-button-label = Undo
|
|
365
|
+
pdfjs-editor-undo-bar-close-button =
|
|
366
|
+
.title = Close
|
|
367
|
+
pdfjs-editor-undo-bar-close-button-label = Close
|
|
368
|
+
pdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.
|
|
369
|
+
pdfjs-editor-add-signature-dialog-title = Add a signature
|
|
370
|
+
pdfjs-editor-add-signature-type-button = Type
|
|
371
|
+
.title = Type
|
|
372
|
+
pdfjs-editor-add-signature-draw-button = Draw
|
|
373
|
+
.title = Draw
|
|
374
|
+
pdfjs-editor-add-signature-image-button = Image
|
|
375
|
+
.title = Image
|
|
376
|
+
pdfjs-editor-add-signature-type-input =
|
|
377
|
+
.aria-label = Type your signature
|
|
378
|
+
.placeholder = Type your signature
|
|
379
|
+
pdfjs-editor-add-signature-draw-placeholder = Draw your signature
|
|
380
|
+
pdfjs-editor-add-signature-draw-thickness-range-label = Thickness
|
|
381
|
+
pdfjs-editor-add-signature-draw-thickness-range =
|
|
382
|
+
.title = Drawing thickness: { $thickness }
|
|
383
|
+
pdfjs-editor-add-signature-image-placeholder = Drag a file here to upload
|
|
384
|
+
pdfjs-editor-add-signature-image-browse-link =
|
|
385
|
+
{ PLATFORM() ->
|
|
386
|
+
[macos] Or choose image files
|
|
387
|
+
*[other] Or browse image files
|
|
388
|
+
}
|
|
389
|
+
pdfjs-editor-add-signature-description-label = Description (alt text)
|
|
390
|
+
pdfjs-editor-add-signature-description-input =
|
|
391
|
+
.title = Description (alt text)
|
|
392
|
+
pdfjs-editor-add-signature-description-default-when-drawing = Signature
|
|
393
|
+
pdfjs-editor-add-signature-clear-button-label = Clear signature
|
|
394
|
+
pdfjs-editor-add-signature-clear-button =
|
|
395
|
+
.title = Clear signature
|
|
396
|
+
pdfjs-editor-add-signature-save-checkbox = Save signature
|
|
397
|
+
pdfjs-editor-add-signature-save-warning-message = You\u2019ve reached the limit of 5 saved signatures. Remove one to save more.
|
|
398
|
+
pdfjs-editor-add-signature-image-upload-error-title = Couldn\u2019t upload image
|
|
399
|
+
pdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.
|
|
400
|
+
pdfjs-editor-add-signature-image-no-data-error-title = Can\u2019t convert this image into a signature
|
|
401
|
+
pdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.
|
|
402
|
+
pdfjs-editor-add-signature-error-close-button = Close
|
|
403
|
+
pdfjs-editor-add-signature-cancel-button = Cancel
|
|
404
|
+
pdfjs-editor-add-signature-add-button = Add
|
|
405
|
+
pdfjs-editor-delete-signature-button1 =
|
|
406
|
+
.title = Remove saved signature
|
|
407
|
+
pdfjs-editor-delete-signature-button-label1 = Remove saved signature
|
|
408
|
+
pdfjs-editor-add-signature-edit-button-label = Edit description
|
|
409
|
+
pdfjs-editor-edit-signature-dialog-title = Edit description
|
|
410
|
+
pdfjs-editor-edit-signature-update-button = Update
|
|
411
|
+
pdfjs-show-comment-button =
|
|
412
|
+
.title = Show comment
|
|
413
|
+
pdfjs-editor-edit-comment-popup-button-label = Edit comment
|
|
414
|
+
pdfjs-editor-edit-comment-popup-button =
|
|
415
|
+
.title = Edit comment
|
|
416
|
+
pdfjs-editor-delete-comment-popup-button-label = Remove comment
|
|
417
|
+
pdfjs-editor-delete-comment-popup-button =
|
|
418
|
+
.title = Remove comment
|
|
419
|
+
pdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment
|
|
420
|
+
pdfjs-editor-edit-comment-dialog-save-button-when-editing = Update
|
|
421
|
+
pdfjs-editor-edit-comment-dialog-title-when-adding = Add comment
|
|
422
|
+
pdfjs-editor-edit-comment-dialog-save-button-when-adding = Add
|
|
423
|
+
pdfjs-editor-edit-comment-dialog-text-input =
|
|
424
|
+
.placeholder = Start typing\u2026
|
|
425
|
+
pdfjs-editor-edit-comment-dialog-cancel-button = Cancel
|
|
426
|
+
pdfjs-editor-add-comment-button =
|
|
427
|
+
.title = Add comment
|
|
428
|
+
pdfjs-toggle-views-manager-button1 =
|
|
429
|
+
.title = Manage pages
|
|
430
|
+
pdfjs-toggle-views-manager-notification-button =
|
|
431
|
+
.title = Toggle Sidebar (document contains thumbnails/outline/attachments/layers)
|
|
432
|
+
pdfjs-toggle-views-manager-button1-label = Manage pages
|
|
433
|
+
pdfjs-views-manager-sidebar =
|
|
434
|
+
.aria-label = Sidebar
|
|
435
|
+
pdfjs-views-manager-sidebar-resizer =
|
|
436
|
+
.aria-label = Sidebar resizer
|
|
437
|
+
pdfjs-views-manager-view-selector-button =
|
|
438
|
+
.title = Views
|
|
439
|
+
pdfjs-views-manager-view-selector-button-label = Views
|
|
440
|
+
pdfjs-views-manager-pages-title = Pages
|
|
441
|
+
pdfjs-views-manager-outlines-title1 = Document outline
|
|
442
|
+
.title = Document outline (double-click to expand/collapse all items)
|
|
443
|
+
pdfjs-views-manager-attachments-title = Attachments
|
|
444
|
+
pdfjs-views-manager-layers-title1 = Layers
|
|
445
|
+
.title = Layers (double-click to reset all layers to the default state)
|
|
446
|
+
pdfjs-views-manager-pages-option-label = Pages
|
|
447
|
+
pdfjs-views-manager-outlines-option-label = Document outline
|
|
448
|
+
pdfjs-views-manager-attachments-option-label = Attachments
|
|
449
|
+
pdfjs-views-manager-layers-option-label = Layers
|
|
450
|
+
pdfjs-views-manager-add-file-button =
|
|
451
|
+
.title = Add file
|
|
452
|
+
pdfjs-views-manager-add-file-button-label = Add file
|
|
453
|
+
pdfjs-views-manager-pages-status-action-label =
|
|
454
|
+
{ $count ->
|
|
455
|
+
[one] { $count } selected
|
|
456
|
+
*[other] { $count } selected
|
|
457
|
+
}
|
|
458
|
+
pdfjs-views-manager-pages-status-none-action-label = Select pages
|
|
459
|
+
pdfjs-views-manager-pages-status-action-button-label = Manage
|
|
460
|
+
pdfjs-views-manager-pages-status-copy-button-label = Copy
|
|
461
|
+
pdfjs-views-manager-pages-status-cut-button-label = Cut
|
|
462
|
+
pdfjs-views-manager-pages-status-delete-button-label = Delete
|
|
463
|
+
pdfjs-views-manager-pages-status-export-selected-button-label = Export selected\u2026
|
|
464
|
+
pdfjs-views-manager-status-undo-cut-label =
|
|
465
|
+
{ $count ->
|
|
466
|
+
[one] 1 page cut
|
|
467
|
+
*[other] { $count } pages cut
|
|
468
|
+
}
|
|
469
|
+
pdfjs-views-manager-pages-status-undo-copy-label =
|
|
470
|
+
{ $count ->
|
|
471
|
+
[one] 1 page copied
|
|
472
|
+
*[other] { $count } pages copied
|
|
473
|
+
}
|
|
474
|
+
pdfjs-views-manager-pages-status-undo-delete-label =
|
|
475
|
+
{ $count ->
|
|
476
|
+
[one] 1 page deleted
|
|
477
|
+
*[other] { $count } pages deleted
|
|
478
|
+
}
|
|
479
|
+
pdfjs-views-manager-pages-status-waiting-ready-label = Getting your file ready\u2026
|
|
480
|
+
pdfjs-views-manager-pages-status-waiting-uploading-label = Uploading file\u2026
|
|
481
|
+
pdfjs-views-manager-status-warning-cut-label = Couldn\u2019t cut. Refresh page and try again.
|
|
482
|
+
pdfjs-views-manager-status-warning-copy-label = Couldn\u2019t copy. Refresh page and try again.
|
|
483
|
+
pdfjs-views-manager-status-warning-delete-label = Couldn\u2019t delete. Refresh page and try again.
|
|
484
|
+
pdfjs-views-manager-status-warning-save-label = Couldn\u2019t save. Refresh page and try again.
|
|
485
|
+
pdfjs-views-manager-status-undo-button-label = Undo
|
|
486
|
+
pdfjs-views-manager-status-done-button-label = Done
|
|
487
|
+
pdfjs-views-manager-status-close-button =
|
|
488
|
+
.title = Close
|
|
489
|
+
pdfjs-views-manager-status-close-button-label = Close
|
|
490
|
+
pdfjs-views-manager-paste-button-label = Paste
|
|
491
|
+
pdfjs-views-manager-paste-button-before =
|
|
492
|
+
.title = Paste before the first page
|
|
493
|
+
pdfjs-views-manager-paste-button-after =
|
|
494
|
+
.title = Paste after page { $page }
|
|
495
|
+
pdfjs-new-badge-content = NEW
|
|
496
|
+
pdfjs-views-manager-waiting-for-file = Uploading file\u2026
|
|
497
|
+
pdfjs-digital-signature-properties-button =
|
|
498
|
+
.title = Digital signature properties
|
|
499
|
+
.aria-label = Digital signature properties
|
|
500
|
+
pdfjs-digital-signature-properties-button-label = Digital signature properties
|
|
501
|
+
pdfjs-digital-signature-properties-banner-verified = Document was signed with a valid digital signature
|
|
502
|
+
pdfjs-digital-signature-properties-banner-unknown =
|
|
503
|
+
{ $count ->
|
|
504
|
+
[one] Document signed but { $count } digital signature could not be verified
|
|
505
|
+
*[other] Document signed but { $count } digital signatures could not be verified
|
|
506
|
+
}
|
|
507
|
+
pdfjs-digital-signature-properties-banner-untrusted =
|
|
508
|
+
{ $count ->
|
|
509
|
+
[one] Document signed with { $count } certificate that is not trusted
|
|
510
|
+
*[other] Document signed with { $count } certificates that are not trusted
|
|
511
|
+
}
|
|
512
|
+
pdfjs-digital-signature-properties-banner-expired =
|
|
513
|
+
{ $count ->
|
|
514
|
+
[one] Document signed with { $count } expired certificate
|
|
515
|
+
*[other] Document signed with { $count } expired certificates
|
|
516
|
+
}
|
|
517
|
+
pdfjs-digital-signature-properties-banner-invalid =
|
|
518
|
+
{ $count ->
|
|
519
|
+
[one] Document has { $count } invalid digital signature
|
|
520
|
+
*[other] Document has { $count } invalid digital signatures
|
|
521
|
+
}
|
|
522
|
+
pdfjs-digital-signature-properties-banner-revoked =
|
|
523
|
+
{ $count ->
|
|
524
|
+
[one] Document signed with { $count } revoked certificate
|
|
525
|
+
*[other] Document signed with { $count } revoked certificates
|
|
526
|
+
}
|
|
527
|
+
pdfjs-digital-signature-properties-status-verified = Status: Signature verified
|
|
528
|
+
pdfjs-digital-signature-properties-status-invalid = Status: Signature invalid
|
|
529
|
+
pdfjs-digital-signature-properties-status-unknown = Status: Unable to verify (unsupported)
|
|
530
|
+
pdfjs-digital-signature-properties-certificate-trusted = Certificate: Trusted ({ $issuer })
|
|
531
|
+
pdfjs-digital-signature-properties-certificate-unknown = Certificate: Unavailable
|
|
532
|
+
pdfjs-digital-signature-properties-certificate-untrusted = Certificate: Untrusted
|
|
533
|
+
pdfjs-digital-signature-properties-certificate-untrusted-unknown-issuer = Certificate: Unknown issuer ({ $issuer })
|
|
534
|
+
pdfjs-digital-signature-properties-certificate-untrusted-self-signed = Certificate: Self-signed ({ $issuer })
|
|
535
|
+
pdfjs-digital-signature-properties-certificate-untrusted-untrusted-issuer = Certificate: Untrusted issuer ({ $issuer })
|
|
536
|
+
pdfjs-digital-signature-properties-certificate-expired = Certificate: Expired
|
|
537
|
+
pdfjs-digital-signature-properties-certificate-expired-with-date = Certificate: Expired ({ DATETIME($dateObj, dateStyle: "medium") })
|
|
538
|
+
pdfjs-digital-signature-properties-certificate-revoked = Certificate: Revoked
|
|
539
|
+
pdfjs-digital-signature-properties-view-certificate = View certificate
|
|
540
|
+
pdfjs-digital-signature-properties-reason = Reason: { $reason }
|
|
541
|
+
pdfjs-digital-signature-properties-timestamp = Timestamp: { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
|
|
542
|
+
pdfjs-digital-signature-properties-sub-signatures =
|
|
543
|
+
{ $count ->
|
|
544
|
+
[one] Sub-signature ({ $count })
|
|
545
|
+
*[other] Sub-signatures ({ $count })
|
|
546
|
+
}`)}}var xs;async function Yr(r){const{info:i,metadata:n,contentDispositionFilename:s,contentLength:a}=await r.getMetadata();return{...i,baseURL:"",filesize:a||(await r.getDownloadInfo()).length,filename:s||xs(""),metadata:n?.getRaw(),authors:n?.get("dc:creator"),numPages:r.numPages,URL:""}}class Ls{constructor(t,e){this._ready=new Promise((i,n)=>{import(t).then(a=>{i(a.QuickJSSandbox(new URL(e,location.href).href))}).catch(n)})}async createSandbox(t){(await this._ready).create(t)}async dispatchEventInSandbox(t){const e=await this._ready;setTimeout(()=>e.dispatchEvent(t),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}const oe="pdfjs.signature";class Ts{#t;#e=null;#i=null;constructor(t,e){this.#t=t,this.#i=e}#s(){localStorage.setItem(oe,JSON.stringify(Object.fromEntries(this.#e)))}async getAll(){if(this.#i&&(window.addEventListener("storage",({key:t})=>{t===oe&&(this.#e=null,this.#t?.dispatch("storedsignatureschanged",{source:this}))},{signal:this.#i}),this.#i=null),!this.#e){this.#e=new Map;const t=localStorage.getItem(oe);if(t)for(const[e,i]of Object.entries(JSON.parse(t)))this.#e.set(e,i)}return this.#e}async isFull(){return await this.size()===5}async size(){return(await this.getAll()).size}async create(t){if(await this.isFull())return null;const e=wn();return this.#e.set(e,t),this.#s(),e}async delete(t){const e=await this.getAll();return e.has(t)?(e.delete(t),this.#s(),!0):!1}}function Zr(r){}class As extends kn{async _writeToStorage(t){localStorage.setItem("pdfjs.preferences",JSON.stringify(t))}async _readFromStorage(t){return{prefs:JSON.parse(localStorage.getItem("pdfjs.preferences"))}}}class Ns extends Mn{constructor(){super()}async createL10n(){return new st(S.get("localeProperties")?.lang)}createScripting(){return new Ls(S.get("sandboxBundleSrc"),S.get("wasmUrl"))}createSignatureStorage(t,e){return new Ts(t,e)}createSignatureVerifier(){return null}}class Qr{async isEnabledFor(t){return!1}async deleteModel(t){return null}isReady(t){return!1}guess(t){}toggleService(t,e){}}class Ms{#t=this.#V.bind(this);#e;#i=null;#s;#a;#n;#o;#r;#l;#d;#h=!1;#c;#f=null;#u=null;#b;#g;#m=!1;#p=!1;#S;#E;#v;#y;#_;#w;#P=null;constructor({descriptionContainer:t,dialog:e,imagePreview:i,cancelButton:n,disclaimer:s,notNowButton:a,saveButton:o,textarea:l,learnMore:d,errorCloseButton:h,createAutomaticallyButton:c,downloadModel:u,downloadModelDescription:f,title:g},p,b){this.#s=n,this.#e=c,this.#a=t,this.#n=e,this.#o=s,this.#E=a,this.#b=i,this.#y=l,this.#S=d,this.#_=g,this.#r=u,this.#l=f,this.#v=p,this.#d=b,e.addEventListener("close",this.#B.bind(this)),e.addEventListener("contextmenu",w=>{w.target!==this.#y&&w.preventDefault()}),n.addEventListener("click",this.#t),a.addEventListener("click",this.#t),o.addEventListener("click",this.#R.bind(this)),h.addEventListener("click",()=>{this.#L(!1)}),c.addEventListener("click",async()=>{const w=c.getAttribute("aria-pressed")!=="true";if(this.#i._reportTelemetry({action:"pdfjs.image.alt_text.ai_generation_check",data:{status:w}}),this.#w){const C=await this.#w.mlManager.isEnabledFor("altText");this.#e.disabled=!0,w&&!C?(this.#y.value="",this.#D(),this.#w.setPreference("enableGuessAltText",!0),await this.#w.mlManager.downloadModel("altText"),this.#I("enableAltTextModelDownload",!0)):!w&&C&&(this.#w.setPreference("enableGuessAltText",!1),await this.#w.mlManager.deleteModel("altText"),this.#I("enableAltTextModelDownload",!1)),this.#e.disabled=!1,await this.#w.mlManager.toggleService("altText",w)}this.#x(w,!1)}),l.addEventListener("focus",()=>{this.#p=this.#m,this.#C(!1),this.#A()}),l.addEventListener("blur",()=>{l.value||this.#C(this.#p),this.#A()}),l.addEventListener("input",()=>{this.#A()}),l.addEventListener("keydown",w=>{(w.ctrlKey||w.metaKey)&&w.key==="Enter"&&!o.disabled&&this.#R()}),b.on("enableguessalttext",({value:w})=>{this.#x(w,!1)},x),this.#v.register(e),this.#S.addEventListener("click",()=>{this.#i._reportTelemetry({action:"pdfjs.image.alt_text.info",data:{topic:"alt_text"}})})}#I(t,e){this.#d.dispatch("setpreference",{source:this,name:t,value:e})}#C(t){!this.#w||this.#m===t||(this.#m=t,this.#a.classList.toggle("loading",t))}#L(t){this.#w&&this.#n.classList.toggle("error",t)}async#x(t,e){if(this.#w)if(this.#n.classList.toggle("aiDisabled",!t),this.#e.setAttribute("aria-pressed",t),t){const{altTextLearnMoreUrl:i}=this.#w.mlManager;i&&(this.#S.href=i),this.#F(e)}else this.#C(!1),this.#m=!1,this.#A()}#k(){this.#E.classList.toggle("hidden",!this.#h),this.#s.classList.toggle("hidden",this.#h)}#T(t){!this.#w||this.#f===t||(this.#f=t,this.#n.classList.toggle("noAi",!t),this.#A())}#A(){const t=this.#m||this.#c&&this.#c===this.#y.value;this.#o.hidden=!t;const e=this.#m||!!this.#y.value;this.#u!==e&&(this.#u=e,this.#_.setAttribute("data-l10n-id",e?"pdfjs-editor-new-alt-text-dialog-edit-label":"pdfjs-editor-new-alt-text-dialog-add-label"))}async#F(t){if(this.#m||this.#y.value||t&&this.#P!==null)return;if(this.#c=this.#i.guessedAltText,this.#P===null&&this.#c){this.#M(this.#c);return}this.#C(!0),this.#A();let e=!1;try{const i=await this.#i.mlGuessAltText(this.#g,!1);i&&(this.#c=i,this.#p=this.#m,this.#m&&this.#M(i))}catch(i){console.error(i),e=!0}this.#C(!1),this.#A(),e&&this.#w&&this.#L(!0)}#M(t){!this.#w||this.#y.value||(this.#y.value=t,this.#A())}#D(){this.#r.classList.toggle("hidden",!1);const t=async({detail:{finished:e,total:i,totalLoaded:n}})=>{n=Math.min(.99*i,n);const a=this.#l.ariaValueMax=Math.round(i/1e6),o=this.#l.ariaValueNow=Math.round(n/1e6);if(this.#l.setAttribute("data-l10n-args",JSON.stringify({totalSize:a,downloadedSize:o})),!e||(this.#d.off("loadaiengineprogress",t),this.#r.classList.toggle("hidden",!0),this.#T(!0),!this.#w))return;const{mlManager:l}=this.#w;l.toggleService("altText",!0),this.#x(await l.isEnabledFor("altText"),!0)};this.#d.on("loadaiengineprogress",t,x)}async editAltText(t,e,i){if(this.#i||!e)return;if(i&&e.hasAltTextData()){e.altTextFinish();return}this.#h=i;const{mlManager:n}=t,s=!!n;this.#A(),n&&!n.isReady("altText")?n.hasProgress?this.#D():this.#e.setAttribute("aria-pressed",!1):this.#r.classList.toggle("hidden",!0);const a=n?.isEnabledFor("altText");this.#i=e,this.#w=t,this.#w.removeEditListeners(),{altText:this.#P}=e.altTextData,this.#y.value=this.#P??"";const o=224,l=180;let d,h,c;n?({canvas:d,width:h,height:c,imageData:this.#g}=e.copyCanvas(o,l,!0),s&&this.#x(await a,!0)):{canvas:d,width:h,height:c}=e.copyCanvas(o,l,!1),d.setAttribute("role","presentation");const{style:u}=d;u.width=`${h}px`,u.height=`${c}px`,this.#b.append(d),this.#k(),this.#T(s),this.#L(!1);try{await this.#v.open(this.#n)}catch(f){throw this.#B(),f}}#V(){this.#i.altTextData={cancel:!0};const t=this.#y.value.trim();this.#i._reportTelemetry({action:"pdfjs.image.alt_text.dismiss",data:{alt_text_type:t?"present":"empty",flow:this.#h?"image_add":"alt_text_edit"}}),this.#i._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!0,alt_text_type:"skipped"}}),this.#j()}#j(){this.#v.closeIfActive(this.#n)}#B(){const t=this.#b.firstElementChild;t.remove(),t.width=t.height=0,this.#g=null,this.#C(!1),this.#w?.addEditListeners(),this.#i.altTextFinish(),this.#w?.setSelected(this.#i),this.#i=null,this.#w=null}#O(t){return new Set(t.toLowerCase().split(/[^\p{L}\p{N}]+/gu).filter(e=>!!e))}#R(){const t=this.#y.value.trim();if(this.#i.altTextData={altText:t,decorative:!1},this.#i.altTextData.guessedAltText=this.#c,this.#c&&this.#c!==t){const e=this.#O(this.#c),i=this.#O(t);this.#i._reportTelemetry({action:"pdfjs.image.alt_text.user_edit",data:{total_words:e.size,words_removed:e.difference(i).size,words_added:i.difference(e).size}})}this.#i._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!0,alt_text_type:t?"present":"empty"}}),this.#i._reportTelemetry({action:"pdfjs.image.alt_text.save",data:{alt_text_type:t?"present":"empty",flow:this.#h?"image_add":"alt_text_edit"}}),this.#j()}destroy(){this.#w=null,this.#j()}}class ks{#t;#e;#i;#s;#a;#n;constructor({dialog:t,createModelButton:e,learnMore:i,closeButton:n,showAltTextDialogButton:s},a,o,l){this.#e=t,this.#t=e,this.#n=s,this.#a=a,this.#i=o,this.#s=l;const{altTextLearnMoreUrl:d}=l;d&&(i.href=d),t.addEventListener("contextmenu",q),e.addEventListener("click",async h=>{const c=this.#d("enableGuessAltText",h);await(c?this.#r(!0):this.#l(!0)),await l.toggleService("altText",c),this.#o({type:"stamp",action:"pdfjs.image.alt_text.settings_ai_generation_check",data:{status:c}})}),s.addEventListener("click",h=>{const c=this.#d("enableNewAltTextWhenAddingImage",h);this.#o({type:"stamp",action:"pdfjs.image.alt_text.settings_edit_alt_text_check",data:{status:c}})}),n.addEventListener("click",this.#c.bind(this)),i.addEventListener("click",()=>{this.#o({type:"stamp",action:"pdfjs.image.alt_text.info",data:{topic:"ai_generation"}})}),o.on("enablealttextmodeldownload",({value:h})=>{h?this.#r(!1):this.#l(!1)},x),this.#a.register(t)}#o(t){this.#i.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}async#r(t=!1){t&&(await this.#s.downloadModel("altText"),this.#h("enableGuessAltText",!0),this.#s.toggleService("altText",!0),this.#h("enableAltTextModelDownload",!0))}async#l(t=!1){t&&(await this.#s.deleteModel("altText"),this.#h("enableGuessAltText",!1),this.#h("enableAltTextModelDownload",!1)),this.#t.setAttribute("aria-pressed",!1)}async open({enableGuessAltText:t,enableNewAltTextWhenAddingImage:e}){const{enableAltTextModelDownload:i}=this.#s;this.#t.setAttribute("aria-pressed",i&&t),this.#n.setAttribute("aria-pressed",e),await this.#a.open(this.#e),this.#o({type:"stamp",action:"pdfjs.image.alt_text.settings_displayed"})}#d(t,{target:e}){const i=e.getAttribute("aria-pressed")!=="true";return this.#h(t,i),e.setAttribute("aria-pressed",i),i}#h(t,e){this.#i.dispatch("setpreference",{source:this,name:t,value:e})}#c(){this.#a.closeIfActive(this.#e)}}class Bs{#t=null;#e=null;#i;#s;#a;#n=!1;#o;#r;#l;#d;#h;#c;#f=null;#u=null;#b=null;#g=null;#m;#p=null;constructor({dialog:t,optionDescription:e,optionDecorative:i,textarea:n,cancelButton:s,saveButton:a},o,l,d){this.#s=t,this.#o=e,this.#r=i,this.#h=n,this.#i=s,this.#d=a,this.#l=l,this.#a=d,this.#m=o;const h=this.#_.bind(this);t.addEventListener("close",this.#y.bind(this)),t.addEventListener("contextmenu",c=>{c.target!==this.#h&&c.preventDefault()}),s.addEventListener("click",this.#v.bind(this)),a.addEventListener("click",this.#w.bind(this)),e.addEventListener("change",h),i.addEventListener("change",h),n.addEventListener("keydown",c=>{(c.ctrlKey||c.metaKey)&&c.key==="Enter"&&!a.disabled&&this.#w()}),this.#l.register(t)}#S(){if(this.#b)return;const t=new St,e=this.#b=t.createElement("svg");e.setAttribute("width","0"),e.setAttribute("height","0");const i=t.createElement("defs");e.append(i);const n=t.createElement("mask");i.append(n),n.setAttribute("id","alttext-manager-mask"),n.setAttribute("maskContentUnits","objectBoundingBox");let s=t.createElement("rect");n.append(s),s.setAttribute("fill","white"),s.setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("x","0"),s.setAttribute("y","0"),s=this.#g=t.createElement("rect"),n.append(s),s.setAttribute("fill","black"),this.#s.append(e)}async editAltText(t,e){if(this.#e||!e)return;this.#S(),this.#n=!1,this.#t=new AbortController;const i={signal:this.#t.signal},n=this.#P.bind(this);for(const o of[this.#o,this.#r,this.#h,this.#d,this.#i])o.addEventListener("click",n,i);const{altText:s,decorative:a}=e.altTextData;a===!0?(this.#r.checked=!0,this.#o.checked=!1):(this.#r.checked=!1,this.#o.checked=!0),this.#f=this.#h.value=s?.trim()||"",this.#_(),this.#e=e,this.#c=t,this.#c.removeEditListeners(),this.#u=new AbortController,this.#a.on("resize",this.#E.bind(this),{signal:this.#u.signal,...x});try{await this.#l.open(this.#s),this.#E()}catch(o){throw this.#y(),o}}#E(){if(!this.#e)return;const t=this.#s,{style:e}=t,{x:i,y:n,width:s,height:a}=this.#m.getBoundingClientRect(),{innerWidth:o,innerHeight:l}=window,{width:d,height:h}=t.getBoundingClientRect(),{x:c,y:u,width:f,height:g}=this.#e.getClientDimensions(),p=10,b=this.#c.direction==="ltr",w=Math.max(c,i),C=Math.min(c+f,i+s),E=Math.max(u,n),P=Math.min(u+g,n+a);this.#g.setAttribute("width",`${(C-w)/o}`),this.#g.setAttribute("height",`${(P-E)/l}`),this.#g.setAttribute("x",`${w/o}`),this.#g.setAttribute("y",`${E/l}`);let v=null,_=Math.max(u,0);_+=Math.min(l-(_+h),0),b?c+f+p+d<o?v=c+f+p:c>d+p&&(v=c-d-p):c>d+p?v=c-d-p:c+f+p+d<o&&(v=c+f+p),v===null&&(_=null,v=Math.max(c,0),v+=Math.min(o-(v+d),0),u>h+p?_=u-h-p:u+g+p+h<l&&(_=u+g+p)),_!==null?(t.classList.add("positioned"),b?e.left=`${v}px`:e.right=`${o-v-d}px`,e.top=`${_}px`):(t.classList.remove("positioned"),e.left="",e.top="")}#v(){this.#l.closeIfActive(this.#s)}#y(){this.#e._reportTelemetry(this.#p||{action:"alt_text_cancel",alt_text_keyboard:!this.#n}),this.#p=null,this.#I(),this.#c?.addEditListeners(),this.#u?.abort(),this.#u=null,this.#e.altTextFinish(),this.#e=null,this.#c=null}#_(){this.#h.disabled=this.#r.checked}#w(){const t=this.#h.value.trim(),e=this.#r.checked;this.#e.altTextData={altText:t,decorative:e},this.#p={action:"alt_text_save",alt_text_description:!!t,alt_text_edit:!!this.#f&&this.#f!==t,alt_text_decorative:e,alt_text_keyboard:!this.#n},this.#v()}#P(t){t.detail!==0&&(this.#n=!0,this.#I())}#I(){this.#t?.abort(),this.#t=null}destroy(){this.#c=null,this.#v(),this.#b?.remove(),this.#b=this.#g=null}}class Ds{constructor(t,e){this.eventBus=e,this.#t(t)}#t({editorFreeTextFontSize:t,editorFreeTextColor:e,editorInkColor:i,editorInkThickness:n,editorInkOpacity:s,editorStampAddImage:a,editorFreeHighlightThickness:o,editorHighlightShowAll:l,editorSignatureAddSignature:d}){const{eventBus:h}=this,c=(g,p)=>{h.dispatch("switchannotationeditorparams",{source:this,type:Z[g],value:p})};t.addEventListener("input",function(){c("FREETEXT_SIZE",this.valueAsNumber)}),e.addEventListener("input",function(){c("FREETEXT_COLOR",this.value)});let u,f;if(Rt.isAlphaColorInputSupported){i.setAttribute("alpha",""),s.closest(".editorParamsSetter").remove();let g="#000000",p=1;i.addEventListener("input",function(){const b=bn(this.value);if(!b)return;const[w,C,E,P]=b,v=dt.makeHexColor(w,C,E);g=v,p=P,c("INK_COLOR_AND_OPACITY",{color:v,opacity:P})}),u=b=>{g=b;const w=dt.hexNums[Math.round(p*255)];i.value=g+w},f=b=>{p=b;const w=dt.hexNums[Math.round(p*255)];i.value=g+w}}else i.addEventListener("input",function(){c("INK_COLOR",this.value)}),s.addEventListener("input",function(){c("INK_OPACITY",this.valueAsNumber)}),u=g=>{i.value=g},f=g=>{s.value=g};n.addEventListener("input",function(){c("INK_THICKNESS",this.valueAsNumber)}),a.addEventListener("click",()=>{h.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{action:"pdfjs.image.add_image_click"}}}),c("CREATE")}),o.addEventListener("input",function(){c("HIGHLIGHT_THICKNESS",this.valueAsNumber)}),l.addEventListener("click",function(){const g=this.getAttribute("aria-pressed")==="true";this.setAttribute("aria-pressed",!g),c("HIGHLIGHT_SHOW_ALL",!g)}),d.addEventListener("click",()=>{c("CREATE")}),h.on("annotationeditorparamschanged",g=>{for(const[p,b]of g.details)switch(p){case Z.FREETEXT_SIZE:t.value=b;break;case Z.FREETEXT_COLOR:e.value=b;break;case Z.INK_COLOR:u(b);break;case Z.INK_THICKNESS:n.value=b;break;case Z.INK_OPACITY:f(b);break;case Z.HIGHLIGHT_COLOR:h.dispatch("mainhighlightcolorpickerupdatecolor",{source:this,value:b});break;case Z.HIGHLIGHT_THICKNESS:o.value=b;break;case Z.HIGHLIGHT_FREE:o.disabled=!b;break;case Z.HIGHLIGHT_SHOW_ALL:l.setAttribute("aria-pressed",b);break}},x)}}const Ut=.1;class Gt{#t;#e=0;#i;constructor(t,e,i,n){if(this.#t=e,this.#i=i,!n)return;this.#e=n.getBoundingClientRect().height;const s=new ResizeObserver(a=>{for(const o of a)if(o.target===n){this.#e=Math.floor(o.borderBoxSize[0].blockSize);break}});s.observe(n),t.addEventListener("abort",()=>s.disconnect(),{once:!0})}#s(t,e){const i=t.y,n=t.bottom,s=t.y+t.height/2,a=e.y,o=e.bottom,l=e.y+e.height/2;return i<=l&&l<=n||a<=s&&s<=o}#a(t,e,i,n){const s=t.y+t.height/2;return(n?i>=s:i<=s)&&t.x-Ut<=e&&e<=t.right+Ut}#n(t){return t.top>=this.#e&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}#o(t,e){const{focusNode:i,focusOffset:n}=t,s=document.createRange();s.setStart(i,n),s.setEnd(i,n);const a=s.getBoundingClientRect();return[a.x,e?a.top:a.bottom]}static#r(t,e){if(!document.caretPositionFromPoint){const{startContainer:i,startOffset:n}=document.caretRangeFromPoint(t,e);return{offsetNode:i,offset:n}}return document.caretPositionFromPoint(t,e)}#l(t,e,i,n,s){if(s||=n.getBoundingClientRect(),e<=s.x+Ut){i?t.extend(n.firstChild,0):t.setPosition(n.firstChild,0);return}if(s.right-Ut<=e){const{lastChild:d}=n;i?t.extend(d,d.length):t.setPosition(d,d.length);return}const a=s.y+s.height/2;let o=Gt.#r(e,a),l=o.offsetNode?.parentElement;if(l&&l!==n){const d=document.elementsFromPoint(e,a),h=[];for(const c of d){if(c===n)break;const{style:u}=c;h.push([c,u.visibility]),u.visibility="hidden"}o=Gt.#r(e,a),l=o.offsetNode?.parentElement;for(const[c,u]of h)c.style.visibility=u}if(l!==n){i?t.extend(n.firstChild,0):t.setPosition(n.firstChild,0);return}i?t.extend(o.offsetNode,o.offset):t.setPosition(o.offsetNode,o.offset)}#d(t,e,i,n,s){if(this.#n(n)){this.#l(e,s,t,i,n);return}this.#t.addEventListener("scrollend",this.#l.bind(this,e,s,t,i,null),{once:!0}),i.scrollIntoView()}#h(t,e){for(;;){const i=t.closest(".page"),n=parseInt(i.getAttribute("data-page-number"),10),s=e?n-1:n+1;if(t=this.#i.querySelector(`.page[data-page-number="${s}"] .textLayer`),!t)return null;const a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),o=e?a.lastChild():a.firstChild();if(o)return o}}moveCaret(t,e){const i=document.getSelection();if(i.rangeCount===0)return;const{focusNode:n}=i,s=n.nodeType!==Node.ELEMENT_NODE?n.parentElement:n,a=s.closest(".textLayer");if(!a)return;const o=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);o.currentNode=n;const l=s.getBoundingClientRect();let d=null;const h=(t?o.previousSibling:o.nextSibling).bind(o);for(;h();){const g=o.currentNode.parentElement;if(!this.#s(l,g.getBoundingClientRect())){d=g;break}}if(!d){const g=this.#h(a,t);if(!g)return;if(e){const w=(t?o.firstChild():o.lastChild())||n;i.extend(w,t?0:w.length);const C=document.createRange();C.setStart(g,t?g.length:0),C.setEnd(g,t?g.length:0),i.addRange(C);return}const[p]=this.#o(i,t),{parentElement:b}=g;this.#d(e,i,b,b.getBoundingClientRect(),p);return}const[c,u]=this.#o(i,t),f=d.getBoundingClientRect();if(this.#a(f,c,u,t)){this.#d(e,i,d,f,c);return}for(;h();){const g=o.currentNode.parentElement,p=g.getBoundingClientRect();if(!this.#s(f,p))break;if(this.#a(p,c,u,t)){this.#d(e,i,g,p,c);return}}this.#d(e,i,d,f,c)}}const Rs=400;class ci{#t=0;#e=0;#i;#s=null;#a;#n;#o=!1;#r;#l=0;constructor({sidebar:t,resizer:e,toggleButton:i},n,s,a){this._sidebar=t,this.#i=n===s?-1:1,this.#a=e,this.#n=s;const o=window.getComputedStyle(t);this.#t=this.#e=parseFloat(o.getPropertyValue("--sidebar-width")),e.ariaValueMin=parseFloat(o.getPropertyValue("--sidebar-min-width"))||0,e.ariaValueMax=parseFloat(o.getPropertyValue("--sidebar-max-width"))||1/0,e.ariaValueNow=this.#e,this.#d(),i.addEventListener("click",this.toggle.bind(this)),this._isOpen=!1,t.hidden=!0,a?.addEventListener("abort",this.destroy.bind(this),{once:!0}),this.#r=new ResizeObserver(([{borderBoxSize:[{inlineSize:l}]}])=>{isNaN(this.#l)||(this.#l+=this.#i*(l-this.#e)),this.#h(l)}),this.#r.observe(t)}#d(){const t=this._sidebar.style;let e;const i=()=>{this.#s=null,this._sidebar.classList.remove("resizing"),e?.abort(),e=null,this.#o=!1,this.onStopResizing(),this.#l=NaN};this.#a.addEventListener("pointerdown",n=>{if(e){i();return}this.onStartResizing();const{clientX:s}=n;L(n),this.#l=s,e=new AbortController;const{signal:a}=e,o=this._sidebar;o.classList.add("resizing");const l=o.parentElement.style;l.minWidth=0,window.addEventListener("contextmenu",q,{signal:a}),window.addEventListener("pointermove",d=>{!e||Math.abs(d.clientX-this.#l)<1||(L(d),t.width=`${Math.round(this.#e+this.#i*(d.clientX-this.#l))}px`)},{signal:a,capture:!0}),window.addEventListener("blur",i,{signal:a}),window.addEventListener("pointerup",d=>{e&&(i(),L(d))},{signal:a})}),this.#a.addEventListener("keydown",n=>{const{key:s}=n,a=s==="ArrowLeft";if(a||s==="ArrowRight"){this.#o||(this._sidebar.classList.add("resizing"),this.#o=!0,this.onStartResizing());const l=(n.ctrlKey||n.metaKey?10:1)*(a?-1:1);clearTimeout(this.#s),this.#s=setTimeout(i,Rs),t.width=`${Math.round(this.#e+this.#i*l)}px`,L(n)}})}#h(t){this.#e=t,this.#a.ariaValueNow=Math.round(t),this.#n&&(this._sidebar.parentElement.style.insetInlineStart=`${(this.#t-t).toFixed(3)}px`),this.onResizing(t)}get width(){return this.#e}set width(t){this._sidebar.style.width=`${t}px`}onStartResizing(){}onStopResizing(){}onResizing(t){}toggle(t=!this._isOpen){this._sidebar.hidden=!(this._isOpen=t)}destroy(){this.#r?.disconnect(),this.#r=null}}class rt{#t;#e;#i;static#s=null;constructor(t,e,i,n,s,a,o,l){const d=new Intl.DateTimeFormat(void 0,{dateStyle:"long"});this.dialogElement=t.dialog,this.#t=new Fs(t,s,i,a),this.#e=new js(i,d,a,this.dialogElement),this.#i=new Os(e,i,n,this.#e,d,a,l),this.#e.sidebar=this.#i,rt.#s=o}setSidebarUiManager(t){this.#i.setUIManager(t)}showSidebar(t){this.#i.show(t)}hideSidebar(){this.#i.hide()}removeComments(t){this.#i.removeComments(t)}selectComment(t){this.#i.selectComment(null,t)}addComment(t){this.#i.addComment(t)}updateComment(t){this.#i.updateComment(t)}toggleCommentPopup(t,e,i,n){e&&this.selectComment(t.uid),this.#e.toggle(t,e,i,n)}destroyPopup(){this.#e.destroy()}updatePopupColor(t){this.#e.updateColor(t)}showDialog(t,e,i,n,s){return this.#t.open(t,e,i,n,s)}makeCommentColor(t,e){return rt._makeCommentColor(t,e)}static _makeCommentColor(t,e){return this.#s?null:fn(hn(t,e??1),un.commentForegroundColor)}destroy(){this.#t.destroy(),this.#i.hide(),this.#e.destroy()}}class Os extends ci{#t=null;#e;#i=this.#_.bind(this);#s=this.#w.bind(this);#a;#n;#o;#r;#l;#d;#h;#c;#f=null;#u=null;#b=null;constructor({learnMoreUrl:t,sidebar:e,sidebarResizer:i,commentsList:n,commentCount:s,sidebarTitle:a,closeButton:o,commentToolbarButton:l},d,h,c,u,f,g){super({sidebar:e,resizer:i,toggleButton:l},f,!0,g),this.#l=a,this.#n=n,this.#o=s,this.#d=t,this.#h=h,this.#a=o,this.#c=c,this.#r=u,this.#e=d,o.addEventListener("click",()=>{d.dispatch("switchannotationeditormode",{source:this,mode:B.NONE})});const p=b=>{b.key==="ArrowDown"||b.key==="Home"||b.key==="F6"?(this.#n.firstElementChild.focus(),L(b)):(b.key==="ArrowUp"||b.key==="End")&&(this.#n.lastElementChild.focus(),L(b))};l.addEventListener("keydown",p),e.addEventListener("keydown",p)}setUIManager(t){this.#b=t}show(t){if(this.#f=new WeakMap,this.#u=new Map,this.#t=t,t.sort(this.#P.bind(this)),t.length!==0){const e=document.createDocumentFragment();for(const i of t)e.append(this.#y(i));this.#p(e),this.#n.append(e)}else this.#p();this._sidebar.hidden=!1,this.#e.dispatch("reporttelemetry",{source:this,details:{type:"commentSidebar",data:{numberOfAnnotations:t.length}}})}hide(){this._sidebar.hidden=!0,this.#n.replaceChildren(),this.#f=null,this.#u=null,this.#t=null}removeComments(t){if(!(t.length===0||!this.#u)){if(new Set(this.#u.keys()).difference(new Set(t)).size===0){this.#m();return}for(const e of t)this.#g(e)}}focusComment(t){const e=this.#u.get(t);if(e){this._sidebar.scrollTop=e.offsetTop-this._sidebar.offsetTop;for(const i of this.#n.children)i.classList.toggle("selected",i===e)}}updateComment(t){if(!this.#u)return;const{id:e,creationDate:i,modificationDate:n,richText:s,contentsObj:a,popupRef:o}=t;(!o||!s&&!a?.str)&&this.#g(e);const l=this.#u.get(e);if(!l)return;const d=this.#f.get(l);let h=Y(this.#t,c=>this.#P(c,d)>=0);h>=this.#t.length||(this.#E(l.firstElementChild,n||i),this.#v(l.lastElementChild,s,a),this.#t.splice(h,1),h=Y(this.#t,c=>this.#P(c,t)>=0),this.#t.splice(h,0,t),h>=this.#n.children.length?this.#n.append(l):this.#n.insertBefore(l,this.#n.children[h]))}#g(t){const e=this.#u?.get(t);if(!e)return;const i=this.#f.get(e),n=Y(this.#t,s=>this.#P(s,i)>=0);n>=this.#t.length||(this.#t.splice(n,1),e.remove(),this.#u.delete(t),this.#p())}#m(){this.#n.replaceChildren(),this.#f=new WeakMap,this.#u.clear(),this.#t.length=0,this.#p()}selectComment(t,e=null){if(!this.#u)return;const i=!t;t||=this.#u.get(e);for(const n of this.#n.children)n.classList.toggle("selected",n===t);i&&t?.scrollIntoView({behavior:"instant",block:"center"})}addComment(t){if(this.#u?.has(t.id))return;const{popupRef:e,contentsObj:i}=t;if(!e||!i?.str)return;const n=this.#y(t);if(this.#t.length===0){this.#n.replaceChildren(n),this.#t.push(t),this.#p();return}const s=Y(this.#t,a=>this.#P(a,t)>=0);this.#t.splice(s,0,t),s>=this.#n.children.length?this.#n.append(n):this.#n.insertBefore(n,this.#n.children[s]),this.#p()}#p(t=this.#n){const e=this.#u.size;this.#l.setAttribute("data-l10n-args",JSON.stringify({count:e})),this.#o.textContent=e,e===0&&t.append(this.#S())}#S(){const t=document.createElement("li");t.classList.add("sidebarComment","noComments");const e=document.createElement("div");if(e.className="sidebarCommentText",e.setAttribute("data-l10n-id","pdfjs-editor-comments-sidebar-no-comments1"),t.append(e),this.#d){const i=document.createElement("a");i.setAttribute("data-l10n-id","pdfjs-editor-comments-sidebar-no-comments-link"),i.href=this.#d,i.target="_blank",i.rel="noopener noreferrer",t.append(i)}return t}#E(t,e){e=ft.toDateObject(e),t.dateTime=e.toISOString(),t.textContent=this.#r.format(e)}#v(t,e,i){t.replaceChildren();const n=e?.str&&(!i?.str||e.str===i.str)?e.html:i?.str;Ue({html:n,dir:i?.dir||"auto",className:"richText"},t)}#y(t){const{id:e,creationDate:i,modificationDate:n,richText:s,contentsObj:a,color:o,opacity:l}=t,d=document.createElement("li");d.role="button",d.className="sidebarComment",d.tabIndex=-1,d.style.backgroundColor=o&&rt._makeCommentColor(o,l)||"";const h=document.createElement("time");this.#E(h,n||i);const c=document.createElement("div");return c.className="sidebarCommentText",this.#v(c,s,a),d.append(h,c),d.addEventListener("click",this.#i),d.addEventListener("keydown",this.#s),this.#f.set(d,t),this.#u.set(e,d),d}async#_({currentTarget:t}){if(t.classList.contains("selected")){t.classList.remove("selected"),this.#c._hide();return}const e=this.#f.get(t);if(!e)return;this.#c._hide();const{id:i,pageIndex:n,rect:s}=e,a=n+1,o=this.#b?.waitForEditorsRendered(a);this.#h?.goToXY(a,s[0],s[3],{center:"both"}),this.selectComment(t),await o,this.#b?.selectComment(n,i)}#w(t){const{key:e,currentTarget:i}=t;switch(e){case"ArrowDown":(i.nextElementSibling||this.#n.firstElementChild).focus(),L(t);break;case"ArrowUp":(i.previousElementSibling||this.#n.lastElementChild).focus(),L(t);break;case"Home":this.#n.firstElementChild.focus(),L(t);break;case"End":this.#n.lastElementChild.focus(),L(t);break;case"Enter":case" ":this.#_(t),L(t);break;case"ShiftTab":this.#a.focus(),L(t);break}}#P(t,e){const i=ft.toDateObject(t.modificationDate||t.creationDate),n=ft.toDateObject(e.modificationDate||e.creationDate);return i!==n?i!==null&&n!==null?n-i:i!==null?-1:1:t.pageIndex!==e.pageIndex?t.pageIndex-e.pageIndex:t.rect[3]!==e.rect[3]?e.rect[3]-t.rect[3]:t.rect[0]!==e.rect[0]?t.rect[0]-e.rect[0]:t.rect[1]!==e.rect[1]?e.rect[1]-t.rect[1]:t.rect[2]!==e.rect[2]?t.rect[2]-e.rect[2]:t.id.localeCompare(e.id)}}class Fs{#t;#e;#i;#s="";#a="";#n;#o;#r;#l;#d=0;#h=0;#c=0;#f=0;#u;#b;constructor({dialog:t,toolbar:e,title:i,textInput:n,cancelButton:s,saveButton:a},o,l,d){this.#t=t,this.#n=n,this.#i=o,this.#b=l,this.#r=a,this.#o=i,this.#u=d;const h=this.#p.bind(this);t.addEventListener("close",h),t.addEventListener("contextmenu",f=>{f.target!==this.#n&&f.preventDefault()}),s.addEventListener("click",h),a.addEventListener("click",this.#g.bind(this)),n.addEventListener("input",()=>{a.disabled=n.value===this.#s}),n.addEventListener("keydown",f=>{(f.ctrlKey||f.metaKey)&&f.key==="Enter"&&!a.disabled&&this.#g()});let c;const u=()=>{t.classList.remove("dragging"),c?.abort(),c=null};e.addEventListener("pointerdown",f=>{if(c){u();return}const{clientX:g,clientY:p}=f;L(f),this.#d=g,this.#h=p,c=new AbortController;const{signal:b}=c,{innerHeight:w,innerWidth:C}=window;t.classList.add("dragging"),window.addEventListener("pointermove",E=>{if(!c)return;const{clientX:P,clientY:v}=E;this.#m(this.#c+(P-this.#d)/C,this.#f+(v-this.#h)/w),this.#d=P,this.#h=v,L(E)},{signal:b}),window.addEventListener("blur",u,{signal:b}),window.addEventListener("pointerup",E=>{c&&(u(),L(E))},{signal:b})}),o.register(t)}async open(t,e,i,n,s){e&&(this.#l=t,this.#e=e);const{contentsObj:{str:a},color:o,opacity:l}=e.getData(),{style:d}=this.#t;o?(d.backgroundColor=rt._makeCommentColor(o,l),d.borderColor=dt.makeHexColor(...o)):d.backgroundColor=d.borderColor="",this.#a=a||"";const h=this.#n;h.value=this.#s=this.#a,a?(this.#o.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-title-when-editing"),this.#r.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-save-button-when-editing")):(this.#o.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-title-when-adding"),this.#r.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-save-button-when-adding")),s?.height&&(h.style.height=`${s.height}px`),this.#l?.removeEditListeners(),this.#r.disabled=!0;const c=s?.parentDimensions,{innerHeight:u,innerWidth:f}=window;if(e.hasDefaultPopupPosition()){const{dialogWidth:g,dialogHeight:p}=this._dialogDimensions;if(c){if(this.#u&&i+g>Math.min(c.x+c.width,f)){const w=this.#e.commentButtonWidth;i-=g-w*c.width}else if(!this.#u){const w=this.#e.commentButtonWidth*c.width;i-g<Math.max(0,c.x)?i=Math.max(0,i):i-=g-w}}const b=Math.max(p,s?.height||0);n+b>u&&(n=u-b),n<0&&(n=0)}i=Pt(i/f,0,1),n=Pt(n/u,0,1),this.#m(i,n),await this.#i.open(this.#t),h.focus()}async#g(){this.#e.comment=this.#n.value,this.#p()}get _dialogDimensions(){const t=this.#t,{style:e}=t;e.opacity="0",e.display="block";const{width:i,height:n}=t.getBoundingClientRect();return e.opacity=e.display="",z(this,"_dialogDimensions",{dialogWidth:i,dialogHeight:n})}#m(t,e){this.#c=t,this.#f=e;const{style:i}=this.#t;i.left=`${100*t}%`,i.top=`${100*e}%`}#p(){if(!this.#e)return;const t=this.#n.value!==this.#a;this.#b.dispatch("reporttelemetry",{source:this,details:{type:"comment",data:{edited:t}}}),this.#e?.focusCommentButton(),this.#e=null,this.#n.value=this.#s=this.#a="",this.#i.closeIfActive(this.#t),this.#n.style.height="",this.#l?.addEditListeners(),this.#l=null}destroy(){this.#l=null,this.#e=null,this.#p()}}class js{#t=null;#e;#i;#s;#a=null;#n;#o=null;#r=null;#l=null;#d=0;#h=0;#c=0;#f=0;#u=null;#b=!1;#g=!1;constructor(t,e,i,n){this.#e=t,this.#s=e,this.#n=i,this.#i=n,this.sidebar=null}get _popupWidth(){const t=this.#m(),{style:e}=t;e.opacity="0",e.display="block",document.body.append(t);const i=t.getBoundingClientRect().width;return t.remove(),e.opacity=e.display="",z(this,"_popupWidth",i)}#m(){if(this.#o)return this.#o;const t=this.#o=document.createElement("div");t.className="commentPopup",t.id="commentPopup",t.tabIndex=-1,t.role="dialog",t.ariaModal="false",t.addEventListener("contextmenu",q),t.addEventListener("keydown",f=>{f.key==="Escape"&&(this.toggle(this.#a,!0,!1),this.#u?.focus(),L(f))}),t.addEventListener("click",()=>{t.focus()});const e=document.createElement("div");e.className="commentPopupTop";const i=this.#l=document.createElement("time");i.className="commentPopupTime";const n=this.#t=document.createElement("div");n.className="commentPopupButtons";const s=document.createElement("button");s.classList.add("commentPopupEdit","toolbarButton"),s.tabIndex=0,s.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-popup-button"),s.ariaHasPopup="dialog",s.ariaControlsElements=[this.#i];const a=document.createElement("span");a.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-popup-button-label"),s.append(a),s.addEventListener("click",()=>{const f=this.#a,g=parseFloat(getComputedStyle(this.#r).height);this.toggle(f,!0,!1),f.editComment({height:g})}),s.addEventListener("contextmenu",q);const o=document.createElement("button");o.classList.add("commentPopupDelete","toolbarButton"),o.tabIndex=0,o.setAttribute("data-l10n-id","pdfjs-editor-delete-comment-popup-button");const l=document.createElement("span");l.setAttribute("data-l10n-id","pdfjs-editor-delete-comment-popup-button-label"),o.append(l),o.addEventListener("click",()=>{this.#e.dispatch("reporttelemetry",{source:this,details:{type:"comment",data:{deleted:!0}}});const f=this.#a,g=f.comment;this.destroy(),g?.text?f._uiManager.deleteComment(f,g):f.comment=null,f.focus()}),o.addEventListener("contextmenu",q),n.append(s,o),e.append(i,n);const d=document.createElement("hr"),h=this.#r=document.createElement("div");h.className="commentPopupText",t.append(e,d,h);let c;const u=()=>{t.classList.remove("dragging"),c?.abort(),c=null};return e.addEventListener("pointerdown",f=>{if(c){u();return}const{target:g,clientX:p,clientY:b}=f;if(n.contains(g))return;L(f);const{width:w,height:C}=this.#a.parentBoundingClientRect;this.#d=p,this.#h=b,c=new AbortController;const{signal:E}=c;t.classList.add("dragging"),window.addEventListener("pointermove",P=>{if(!c)return;const{clientX:v,clientY:_}=P;this.#p(this.#c+(v-this.#d)/w,this.#f+(_-this.#h)/C,!1),this.#d=v,this.#h=_,L(P)},{signal:E}),window.addEventListener("blur",u,{signal:E}),window.addEventListener("pointerup",P=>{c&&(u(),L(P))},{signal:E})}),t}updateColor(t){if(this.#a!==t||!this.#g)return;const{color:e,opacity:i}=t.getData();this.#o.style.backgroundColor=e&&rt._makeCommentColor(e,i)||""}_hide(t){const e=this.#m();e.classList.toggle("hidden",!0),e.classList.toggle("selected",!1),(t||this.#a)?.setCommentButtonStates({selected:!1,hasPopup:!1}),this.#a=null,this.#b=!1,this.#g=!1,this.#r.replaceChildren(),this.sidebar.selectComment(null)}toggle(t,e,i=void 0,n=!0){if(!t){this.destroy();return}if(e)i??=this.#a===t?!this.#b||!this.#g:!0;else{if(this.#b)return;i??=!this.#g}if(!i){this._hide(t);return}this.#g=!0,this.#a!==t&&this.#a?.setCommentButtonStates({selected:!1,hasPopup:!1});const s=this.#m();this.#t.classList.toggle("hidden",!n),s.classList.toggle("hidden",!1),s.classList.toggle("selected",e),this.#b=e,this.#a=t,t.setCommentButtonStates({selected:e,hasPopup:!0});const{contentsObj:a,richText:o,creationDate:l,modificationDate:d,color:h,opacity:c}=t.getData();s.style.backgroundColor=h&&rt._makeCommentColor(h,c)||"",this.#r.replaceChildren();const u=o?.str&&(!a?.str||o.str===a.str)?o.html:a?.str;u&&Ue({html:u,dir:a?.dir||"auto",className:"richText"},this.#r),this.#l.textContent=this.#s.format(ft.toDateObject(d||l)),this.#p(...t.commentPopupPosition,t.hasDefaultPopupPosition()),t.elementBeforePopup.after(s),s.addEventListener("focus",({relatedTarget:f})=>{this.#u=f},{once:!0}),e&&setTimeout(()=>s.focus(),0)}#p(t,e,i){if(!i)this.#a.commentPopupPosition=[t,e];else{const s=this.#a.parentBoundingClientRect,a=this._popupWidth/s.width;if(this.#n&&t+a>1||!this.#n&&t-a>=0){const l=this.#a.commentButtonWidth;t-=a-l}const o=.01;this.#n?t=Math.max(t,-s.x/s.width+o):t=Math.min(t,(window.innerWidth-s.x)/s.width-a-o)}this.#c=t,this.#f=e;const{style:n}=this.#o;n.left=`${100*t}%`,n.top=`${100*e}%`}destroy(){this._hide(),this.#o?.remove(),this.#o=this.#r=this.#l=null,this.#d=this.#h=1/0,this.#c=this.#f=0,this.#u=null}}class Vs{#t=new WeakMap;_triggerDownload(t,e,i,n=!1){throw new Error("Not implemented: _triggerDownload")}_getOpenDataUrl(t,e,i=null){throw new Error("Not implemented: _getOpenDataUrl")}downloadData(t,e,i){const n=URL.createObjectURL(new Blob([t],{type:i}));this._triggerDownload(n,n,e,!0)}openOrDownloadData(t,e,i=null){const n=je(e),s=n?"application/pdf":"";if(n){const a=this.#t.getOrInsertComputed(t,()=>URL.createObjectURL(new Blob([t],{type:s})));try{const o=this._getOpenDataUrl(a,e,i);return window.open(o),!0}catch(o){console.error("openOrDownloadData:",o),URL.revokeObjectURL(a),this.#t.delete(t)}}return this.downloadData(t,e,s),!1}download(t,e,i){const n=t?URL.createObjectURL(new Blob([t],{type:"application/pdf"})):null;this._triggerDownload(n,e,i)}}class Us extends Vs{_triggerDownload(t,e,i,n=!1){if(!t&&!n){if(!De(e,"http://example.com"))throw new Error(`_triggerDownload - not a valid URL: ${e}`);t=e+"#pdfjs.action=download"}const s=document.createElement("a");s.href=t,s.target="_parent","download"in s&&(s.download=i),(document.body||document.documentElement).append(s),s.click(),s.remove()}_getOpenDataUrl(t,e,i=null){let n="?file="+encodeURIComponent(t+"#"+e);return i&&(n+=`#${escape(i)}`),n}}class Xt{#t=null;#e;#i=null;#s=null;#a=null;isOpen=!1;#n;#o=null;#r;static#l=Object.freeze({highlight:"pdfjs-editor-undo-bar-message-highlight",freetext:"pdfjs-editor-undo-bar-message-freetext",stamp:"pdfjs-editor-undo-bar-message-stamp",ink:"pdfjs-editor-undo-bar-message-ink",signature:"pdfjs-editor-undo-bar-message-signature",comment:"pdfjs-editor-undo-bar-message-comment",_multiple:"pdfjs-editor-undo-bar-message-multiple"});constructor({container:t,message:e,undoButton:i,closeButton:n},s){this.#e=t,this.#n=e,this.#r=i,this.#t=n,this.#i=s}destroy(){this.#a?.abort(),this.#a=null,this.hide()}show(t,e){if(!this.#a){this.#a=new AbortController;const i={signal:this.#a.signal},n={signal:this.#a.signal,...x},s=this.hide.bind(this);this.#e.addEventListener("contextmenu",q,i),this.#t.addEventListener("click",s,i),this.#i.on("beforeprint",s,n),this.#i.on("download",s,n)}this.hide(),typeof e=="string"?this.#n.setAttribute("data-l10n-id",Xt.#l[e]):(this.#n.setAttribute("data-l10n-id",Xt.#l._multiple),this.#n.setAttribute("data-l10n-args",JSON.stringify({count:e}))),this.isOpen=!0,this.#e.hidden=!1,this.#o=new AbortController,this.#r.addEventListener("click",()=>{t(),this.hide()},{signal:this.#o.signal}),this.#s=setTimeout(()=>{this.#e.contains(document.activeElement)||this.#e.focus(),this.#s=null},100)}hide(){this.isOpen&&(this.isOpen=!1,this.#e.hidden=!0,this.#o?.abort(),this.#o=null,this.#s&&(clearTimeout(this.#s),this.#s=null))}}class Hs{#t=new WeakMap;#e=null;get active(){return this.#e}async register(t,e=!1){if(typeof t!="object")throw new Error("Not enough parameters.");if(this.#t.has(t))throw new Error("The overlay is already registered.");this.#t.set(t,{canForceClose:e}),t.addEventListener("cancel",({target:i})=>{this.#e===i&&(this.#e=null)})}async open(t){if(this.#t.has(t)){if(this.#e){if(this.#e===t)throw new Error("The overlay is already active.");if(this.#t.get(t).canForceClose)await this.close();else throw new Error("Another overlay is currently active.")}}else throw new Error("The overlay does not exist.");this.#e=t,t.showModal()}async close(t=this.#e){if(this.#t.has(t))if(this.#e){if(this.#e!==t)throw new Error("Another overlay is currently active.")}else throw new Error("The overlay is currently not active.");else throw new Error("The overlay does not exist.");t.close(),this.#e=null}async closeIfActive(t){this.#e===t&&await this.close(t)}}class zs{#t=null;#e=null;#i=null;constructor(t,e,i=!1){this.dialog=t.dialog,this.label=t.label,this.input=t.input,this.submitButton=t.submitButton,this.cancelButton=t.cancelButton,this.overlayManager=e,this._isViewerEmbedded=i,this.submitButton.addEventListener("click",this.#s.bind(this)),this.cancelButton.addEventListener("click",this.close.bind(this)),this.input.addEventListener("keydown",n=>{n.keyCode===13&&(this.#s(),n.preventDefault())}),this.overlayManager.register(this.dialog,!0),this.dialog.addEventListener("close",this.#a.bind(this))}async open(){await this.#t?.promise,this.#t=Promise.withResolvers();try{await this.overlayManager.open(this.dialog)}catch(e){throw this.#t.resolve(),e}const t=this.#i===_n.INCORRECT_PASSWORD;(!this._isViewerEmbedded||t)&&this.input.focus(),this.label.setAttribute("data-l10n-id",t?"pdfjs-password-invalid":"pdfjs-password-label")}async close(){this.overlayManager.closeIfActive(this.dialog)}#s(){const t=this.input.value;t?.length>0&&this.#n(t)}#a(){this.#n(new Error("PasswordPrompt cancelled.")),this.#t.resolve()}#n(t){this.#e&&(this.close(),this.input.value="",this.#e(t),this.#e=null)}async setUpdateCallback(t,e){this.#t&&await this.#t.promise,this.#e=t,this.#i=e}}const ui="selected";class le{constructor(t){this.container=t.container,this.eventBus=t.eventBus,this._l10n=t.l10n,this.reset()}reset(){this._pdfDocument=null,this._lastToggleIsShow=!0,this._currentTreeItem=null,this.container.replaceChildren(),this.container.classList.remove("withNesting")}_dispatchEvent(t){throw new Error("Not implemented: _dispatchEvent")}_bindLink(t,e){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(t){return gt(t,!0)||"\u2013"}_addToggleButton(t,e=!1){const i=document.createElement("div");i.className="treeItemToggler",e&&i.classList.add("treeItemsHidden"),t.prepend(i)}_toggleTreeItem(t,e=!1){this._l10n.pause(),this._lastToggleIsShow=e;for(const i of t.querySelectorAll(".treeItemToggler"))i.classList.toggle("treeItemsHidden",!e);this._l10n.resume()}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(t,e,i=!1){i&&(this.container.classList.add("withNesting"),this._lastToggleIsShow=!t.querySelector(".treeItemsHidden"),this.container.addEventListener("click",n=>{const{target:s}=n;if(s.classList.contains("treeItemToggler")&&(L(n),s.classList.toggle("treeItemsHidden"),n.shiftKey)){const a=!s.classList.contains("treeItemsHidden");this._toggleTreeItem(s.parentNode,a)}})),this._l10n.pause(),this.container.append(t),this._l10n.resume(),this._dispatchEvent(e)}render(t){throw new Error("Not implemented: render")}_updateCurrentTreeItem(t=null){this._currentTreeItem&&(this._currentTreeItem.classList.remove(ui),this._currentTreeItem=null),t&&(t.classList.add(ui),this._currentTreeItem=t)}_scrollToCurrentTreeItem(t){if(!t)return;this._l10n.pause();let e=t.parentNode;for(;e&&e!==this.container;)e.classList.contains("treeItem")&&e.firstElementChild?.classList.remove("treeItemsHidden"),e=e.parentNode;this._l10n.resume(),this._updateCurrentTreeItem(t),t.scrollIntoView({behavior:"instant",block:"center",inline:"center",container:"nearest"})}}class Ws extends le{constructor(t){super(t),this.downloadManager=t.downloadManager,this.linkService=t.linkService,this.eventBus.on("fileattachmentannotation",this.#t.bind(this),x)}reset(t=!1){super.reset(),this._attachments=null,t||(this._renderedCapability=Promise.withResolvers()),this._pendingDispatchEvent=!1}async _dispatchEvent(t){this._renderedCapability.resolve(),!(t===0&&!this._pendingDispatchEvent&&(this._pendingDispatchEvent=!0,await Xe({target:this.eventBus,name:"annotationlayerrendered",delay:1e3}),!this._pendingDispatchEvent))&&(this._pendingDispatchEvent=!1,this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:t}))}_bindLink(t,{attachmentId:e,content:i,description:n,filename:s}){n&&(t.title=n);const a=async()=>{const o=e?await this.linkService.getAttachmentContent(e):i;o&&this.downloadManager?.openOrDownloadData(o,s)};t.onclick=()=>(a(),!1)}render({attachments:t,keepRenderedCapability:e=!1}){if(this._attachments&&this.reset(e),this._attachments=t||null,!t){this._dispatchEvent(0);return}const i=document.createDocumentFragment(),n=document.createElement("ul");i.append(n);let s=0;for(const[a,o]of t){const l=document.createElement("li");n.append(l);const d=document.createElement("a");l.append(d),this._bindLink(d,{...o,attachmentId:o.attachmentId??a}),d.textContent=this._normalizeTextContent(o.filename),s++}this._finishRendering(i,s)}#t(t){const e=this._renderedCapability.promise;e.then(()=>{if(e!==this._renderedCapability.promise)return;const i=new Map(this._attachments);i.has(t.filename)||(i.set(t.filename,t),this.render({attachments:i,keepRenderedCapability:!0}))})}}const gi="grab-to-pan-grab";class $s{#t=null;#e=null;#i=null;constructor({element:t}){this.element=t,this.document=t.ownerDocument;const e=this.overlay=document.createElement("div");e.className="grab-to-pan-grabbing"}activate(){this.#t||(this.#t=new AbortController,this.element.addEventListener("mousedown",this.#s.bind(this),{capture:!0,signal:this.#t.signal}),this.element.classList.add(gi))}deactivate(){this.#t&&(this.#t.abort(),this.#t=null,this.#n(),this.element.classList.remove(gi))}ignoreTarget(t){return t.matches("a[href], a[href] *, input, textarea, button, button *, select, option")}#s(t){if(t.button!==0||this.ignoreTarget(t.target))return;if(t.originalTarget)try{t.originalTarget.tagName}catch{return}this.scrollLeftStart=this.element.scrollLeft,this.scrollTopStart=this.element.scrollTop,this.clientXStart=t.clientX,this.clientYStart=t.clientY,this.#e=new AbortController;const e=this.#n.bind(this),i={capture:!0,signal:this.#e.signal};this.document.addEventListener("mousemove",this.#a.bind(this),i),this.document.addEventListener("mouseup",e,i),this.#i=new AbortController,this.element.addEventListener("scroll",e,{capture:!0,signal:this.#i.signal}),L(t);const n=document.activeElement;n&&!n.contains(t.target)&&n.blur()}#a(t){if(this.#i?.abort(),this.#i=null,!(t.buttons&1)){this.#n();return}const e=t.clientX-this.clientXStart,i=t.clientY-this.clientYStart;this.element.scrollTo({top:this.scrollTopStart-i,left:this.scrollLeftStart-e,behavior:"instant"}),this.overlay.parentNode||document.body.append(this.overlay)}#n(){this.#e?.abort(),this.#e=null,this.#i?.abort(),this.#i=null,this.overlay.remove()}}class Gs{#t=W.SELECT;#e=null;constructor({container:t,eventBus:e,cursorToolOnLoad:i=W.SELECT}){this.container=t,this.eventBus=e,this.#s(),Promise.resolve().then(()=>{this.switchTool(i)})}get activeTool(){return this.#t}switchTool(t){this.#e===null&&this.#i(t)}#i(t,e=!1){if(t===this.#t){this.#e!==null&&this.eventBus.dispatch("cursortoolchanged",{source:this,tool:t,disabled:e});return}const i=()=>{switch(this.#t){case W.SELECT:break;case W.HAND:this._handTool.deactivate();break;case W.ZOOM:}};switch(t){case W.SELECT:i();break;case W.HAND:i(),this._handTool.activate();break;case W.ZOOM:default:console.error(`switchTool: "${t}" is an unsupported value.`);return}this.#t=t,this.eventBus.dispatch("cursortoolchanged",{source:this,tool:t,disabled:e})}#s(){const{eventBus:t}=this;t.on("switchcursortool",a=>{a.reset?this.#e!==null&&(e=B.NONE,i=H.NORMAL,s()):this.switchTool(a.tool)},x);let e=B.NONE,i=H.NORMAL;const n=()=>{this.#e??=this.#t,this.#i(W.SELECT,!0)},s=()=>{this.#e!==null&&e===B.NONE&&i===H.NORMAL&&(this.#i(this.#e),this.#e=null)};t.on("annotationeditormodechanged",({mode:a})=>{e=a,a===B.NONE?s():n()},x),t.on("presentationmodechanged",({state:a})=>{i=a,a===H.NORMAL?s():a===H.FULLSCREEN&&n()},x)}get _handTool(){return z(this,"_handTool",new $s({element:this.container}))}}const Xs=["en-us","en-lr","my"],Ks={"8.5x11":"pdfjs-document-properties-page-size-name-letter","8.5x14":"pdfjs-document-properties-page-size-name-legal"},fi={"297x420":"pdfjs-document-properties-page-size-name-a-three","210x297":"pdfjs-document-properties-page-size-name-a-four"};function de(r,t,e){const i=t?r.width:r.height,n=t?r.height:r.width;return e[`${i}x${n}`]}class Ys{#t=null;constructor({dialog:t,fields:e,closeButton:i},n,s,a,o,l){this.dialog=t,this.fields=e,this.overlayManager=n,this.l10n=a,this._fileNameLookup=o,this._titleLookup=l,this.#e(),i.addEventListener("click",this.close.bind(this)),this.overlayManager.register(this.dialog),s.on("pagechanging",d=>{this._currentPageNumber=d.pageNumber},x),s.on("rotationchanging",d=>{this._pagesRotation=d.pagesRotation},x)}async open(){await Promise.all([this.overlayManager.open(this.dialog),this._dataAvailableCapability.promise]);const t=this._currentPageNumber,e=this._pagesRotation;if(this.#t&&t===this.#t._currentPageNumber&&e===this.#t._pagesRotation){this.#i();return}const[{info:i,metadata:n,contentLength:s},a]=await Promise.all([this.pdfDocument.getMetadata(),this.pdfDocument.getPage(t).catch(b=>(console.error(`PDFDocumentProperties - unable to get page ${t}.`,b),null))]),[o,l,d,h,c,u,f]=await Promise.all([this._fileNameLookup(),this.#s(s),this._titleLookup(),this.#n(n?.get("xmp:createdate"),i.CreationDate),this.#n(n?.get("xmp:modifydate"),i.ModDate),this.#a(a,e),this.#o(i.IsLinearized)]);this.#t=Object.freeze({fileName:o,fileSize:l,title:d,author:n?.get("dc:creator")?.join(`
|
|
547
|
+
`)||i.Author,subject:n?.get("dc:subject")?.join(`
|
|
548
|
+
`)||i.Subject,keywords:n?.get("pdf:keywords")||i.Keywords,creationDate:h,modificationDate:c,creator:n?.get("xmp:creatortool")||i.Creator,producer:n?.get("pdf:producer")||i.Producer,version:i.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:u,linearized:f,_currentPageNumber:t,_pagesRotation:e}),this.#i();const{length:g}=await this.pdfDocument.getDownloadInfo();if(s===g)return;const p=Object.assign(Object.create(null),this.#t);p.fileSize=await this.#s(g),this.#t=Object.freeze(p),this.#i()}async close(){this.overlayManager.close(this.dialog)}setDocument(t){this.pdfDocument&&(this.#e(),this.#i()),t&&(this.pdfDocument=t,this._dataAvailableCapability.resolve())}#e(){this.pdfDocument=null,this.#t=null,this._dataAvailableCapability=Promise.withResolvers(),this._currentPageNumber=1,this._pagesRotation=0}#i(){if(!(this.#t&&this.overlayManager.active!==this.dialog))for(const t in this.fields){const e=this.#t?.[t];this.fields[t].textContent=e||e===0?e:"-"}}async#s(t=0){const e=t/1024,i=e/1024;return e?this.l10n.get(i>=1?"pdfjs-document-properties-size-mb":"pdfjs-document-properties-size-kb",{mb:i,kb:e,b:t}):void 0}async#a(t,e){if(!t)return;let i=qi(t);e%180!==0&&(i={width:i.height,height:i.width});const n=Kt(i),s=Xs.includes(this.l10n.getLanguage());let a={width:Math.round(i.width*100)/100,height:Math.round(i.height*100)/100},o={width:Math.round(i.width*25.4*10)/10,height:Math.round(i.height*25.4*10)/10},l=de(a,n,Ks)||de(o,n,fi);if(!l&&!(Number.isInteger(o.width)&&Number.isInteger(o.height))){const g={width:i.width*25.4,height:i.height*25.4},p={width:Math.round(o.width),height:Math.round(o.height)};Math.abs(g.width-p.width)<.1&&Math.abs(g.height-p.height)<.1&&(l=de(p,n,fi),l&&(a={width:Math.round(p.width/25.4*100)/100,height:Math.round(p.height/25.4*100)/100},o=p))}const[{width:d,height:h},c,u,f]=await Promise.all([s?a:o,this.l10n.get(s?"pdfjs-document-properties-page-size-unit-inches":"pdfjs-document-properties-page-size-unit-millimeters"),l&&this.l10n.get(l),this.l10n.get(n?"pdfjs-document-properties-page-size-orientation-portrait":"pdfjs-document-properties-page-size-orientation-landscape")]);return this.l10n.get(u?"pdfjs-document-properties-page-size-dimension-name-string":"pdfjs-document-properties-page-size-dimension-string",{width:d,height:h,unit:c,name:u,orientation:f})}async#n(t,e){const i=Date.parse(t)||ft.toDateObject(e);return i?this.l10n.get("pdfjs-document-properties-date-time-string",{dateObj:i.valueOf()}):void 0}#o(t){return this.l10n.get(t?"pdfjs-document-properties-linearized-yes":"pdfjs-document-properties-linearized-no")}}let pi=null,mi=null;function bi(r,t){mi||=new Intl.Segmenter(void 0,{granularity:"grapheme"});const e=mi.segment(r),i=e.containing(t);if(i.index!==t)return!1;pi||=new Intl.Segmenter(void 0,{granularity:"word"});const n=e.containing(t-1).segment;return pi.segment(n+i.segment).containing(n.length).index===n.length}function Zs(r,t,e){const i=t+e;return(t===0||bi(r,t))&&(i===r.length||bi(r,i))}let ct;function Qs(){if(!ct){const r=[],t=[],e=/^\p{M}$/u;for(let n=0;n<65536;n++){if(n>=55296&&n<=57343)continue;const s=String.fromCharCode(n);if(s.normalize("NFKC")!==s&&!e.test(s)){if(t.length!==2){t[0]=t[1]=n;continue}t[1]+1!==n?(t[0]===t[1]?r.push(String.fromCharCode(t[0])):r.push(`${String.fromCharCode(t[0])}-${String.fromCharCode(t[1])}`),t[0]=t[1]=n):t[1]=n}}const i=r.join("");if(!ct)ct=i;else if(i!==ct){for(let n=1;n<i.length;n++)if(i[n]!==ct[n]){console.log(`Difference at index ${n}: U+${i.charCodeAt(n).toString(16).toUpperCase().padStart(4,"0")}!== U+${ct.charCodeAt(n).toString(16).toUpperCase().padStart(4,"0")}`);break}throw new Error("getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.")}}return ct}const X={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},wi=new Map([["\u2010","-"],["\u2018","'"],["\u2019","'"],["\u201A","'"],["\u201B","'"],["\u201C",'"'],["\u201D",'"'],["\u201E",'"'],["\u201F",'"'],["\xBC","1/4"],["\xBD","1/2"],["\xBE","3/4"]]),vi=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let Ei;const Js=/\p{M}+/gu,qs=/([+^$|])|(\p{P}+)|(\s+)|(\p{M})|(\p{L})/gu,ta=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,yi=new Map,ea="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",ia=new Map;let he=null,ce=null;function Ht(r,t={}){const e=[];let i;for(;(i=ta.exec(r))!==null;){let{index:C}=i;for(const E of i[0]){let P=yi.get(E);P||(P=E.normalize("NFD").length,yi.set(E,P)),e.push([P,C++])}}const n=e.length>0,s=t.ignoreDashEOL??!1;let a;if(!n&&he)a=he;else if(n&&ce)a=ce;else{const C=wi.keys().join(""),E=Qs(),T=[`[${C}]`,`[${E}]`,"(?:\u3099|\u309A)\\n","\\p{M}+(?:-\\n)?","\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})","\\S-\\n","(?:\\p{Ideographic}|[\u3040-\u30FF])\\n","\\n",n?ea:"\\u0000"];a=new RegExp(T.map(D=>`(${D})`).join("|"),"gmu"),n?ce=a:he=a}const o=[];for(;(i=Js.exec(r))!==null;)o.push([i[0].length,i.index]);let l=r.normalize("NFD");const d=[0,0];let h=0,c=0,u=0,f=0,g=0,p=!1;l=l.replace(a,(C,E,P,v,_,T,D,y,I,A,R)=>{if(R-=f,E){const F=wi.get(E),O=F.length;for(let U=1;U<O;U++)d.push(R-u+U,u-U);return u-=O-1,F}if(P){const F=ia.getOrInsertComputed(P,()=>P.normalize("NFKC")),O=F.length;for(let U=1;U<O;U++)d.push(R-u+U,u-U);return u-=O-1,F}if(v)return p=!0,R+g===o[h]?.[1]?++h:(d.push(R-1-u+1,u-1),u-=1,f+=1),d.push(R-u+1,u),f+=1,g+=1,v.charAt(0);if(_){const F=_.endsWith(`
|
|
549
|
+
`),O=F?_.length-2:_.length;p=!0;let U=O;R+g===o[h]?.[1]&&(U-=o[h][0],++h);for(let ot=1;ot<=U;ot++)d.push(R-1-u+ot,u-ot);return u-=U,f+=U,F?(R+=O-1,d.push(R-u+1,1+u),u+=1,f+=1,g+=1,_.slice(0,O)):_}if(T){if(s)return f+=1,g+=1,T.slice(0,-1);const F=T.length-2;return d.push(R-u+F,1+u),u+=1,f+=1,g+=1,T.slice(0,-2)}if(D)return f+=1,g+=1,D.slice(0,-1);if(y){const F=y.length-1;return d.push(R-u+F,u),f+=1,g+=1,y.slice(0,-1)}if(I)return d.push(R-u+1,u-1),u-=1,f+=1,g+=1," ";if(R+g===e[c]?.[1]){const F=e[c][0]-1;++c;for(let O=1;O<=F;O++)d.push(R-(u-O),u-O);u-=F,f+=F}return A}),d.push(l.length,u);const b=new Uint32Array(d.length>>1),w=new Int32Array(d.length>>1);for(let C=0,E=d.length;C<E;C+=2)b[C>>1]=d[C],w[C>>1]=d[C+1];return[l,[b,w],p]}function Ci(r,t,e){if(!r)return[t,e];const[i,n]=r,s=t,a=t+e-1;let o=Y(i,u=>u>=s);i[o]>s&&--o;let l=Y(i,u=>u>=a,o);i[l]>a&&--l;const d=s+n[o],c=a+n[l]+1-d;return[d,c]}class na{#t=null;#e=!0;#i=0;#s=0;#a=null;#n=null;constructor({linkService:t,eventBus:e,delay:i=250,updateMatchesCountOnProgress:n=!0}){this._linkService=t,this._eventBus=e,this.#e=n,this.#i=i,this.onIsPageVisible=null,this.#r(),e.on("find",this.#o.bind(this),x),e.on("findbarclose",this.#y.bind(this),x),e.on("pagesedited",this.#v.bind(this),x)}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#t}setDocument(t){this._pdfDocument&&this.#r(),t&&(this._pdfDocument=t,this._firstPageCapability.resolve())}#o(t){if(!t)return;const e=this._pdfDocument,{type:i}=t;(this.#t===null||this.#d(t))&&(this._dirtyMatch=!0),this.#t=t,i!=="highlightallchange"&&this.#P(X.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||e&&this._pdfDocument!==e)return;this.#f();const n=!this._highlightMatches,s=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#g():i==="again"?(this.#g(),n&&this.#t.highlightAll&&this.#b()):i==="highlightallchange"?(s?this.#g():this._highlightMatches=!0,this.#b()):this.#g():this._findTimeout=setTimeout(()=>{this.#g(),this._findTimeout=null},this.#i)})}scrollMatchIntoView({element:t=null,pageIndex:e=-1,matchIndex:i=-1}){if(!(!this._scrollMatches||!t)){{if(i===-1||i!==this._selected.matchIdx)return;if(e===-1||e!==this._selected.pageIdx)return}this._scrollMatches=!1,t.scrollIntoView({block:"start",inline:"center"})}}#r(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#s=0,this.#t=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this.#a=null,this._firstPageCapability=Promise.withResolvers()}get#l(){const{query:t}=this.#t;return typeof t=="string"?(t!==this._rawQuery&&(this._rawQuery=t,[this._normalizedQuery]=Ht(t)),this._normalizedQuery):(t||[]).filter(e=>!!e).map(e=>Ht(e)[0])}#d(t){const e=t.query,i=this.#t.query,n=typeof e;if(n!==typeof i)return!0;if(n==="string"){if(e!==i)return!0}else if(JSON.stringify(e)!==JSON.stringify(i))return!0;switch(t.type){case"again":const a=this._selected.pageIdx+1,o=this._linkService;return a>=1&&a<=o.pagesCount&&a!==o.page&&!(this.onIsPageVisible?.(a)??!0);case"highlightallchange":return!1}return!0}#h(t,e){const{matchDiacritics:i}=this.#t;let n=!1;const s=(o,l)=>o===t?l:t.startsWith(o)?`${l}[ ]*`:t.endsWith(o)?`[ ]*${l}`:`[ ]*${l}[ ]*`;t=t.replaceAll(qs,(o,l,d,h,c,u)=>l?s(l,RegExp.escape(l)):d?s(d,RegExp.escape(d)):h?"[ ]+":i?c||u:c?vi.has(c.charCodeAt(0))?c:"":e?(n=!0,`${u}\\p{M}*`):u);const a="[ ]*";return t.endsWith(a)&&(t=t.slice(0,t.length-a.length)),i&&e&&(Ei||=String.fromCharCode(...vi),n=!0,t=`${t}(?=[${Ei}]|[^\\p{M}]|$)`),[n,t]}#c(t){if(!this.#t)return;const e=this.#l;if(e.length===0)return;const i=this._pageContents[t],n=this.match(e,i,t),s=this._pageMatches[t]=[],a=this._pageMatchesLength[t]=[],o=this._pageDiffs[t];n?.forEach(({index:d,length:h})=>{const[c,u]=Ci(o,d,h);u&&(s.push(c),a.push(u))}),this.#t.highlightAll&&this.#u(t),this._resumePageIdx===t&&(this._resumePageIdx=null,this.#p());const l=s.length;this._matchesCountTotal+=l,this.#e?l>0&&this.#w():++this.#s===this._linkService.pagesCount&&this.#w()}match(t,e,i){const n=this._hasDiacritics[i];let s=!1;if(typeof t=="string"?[s,t]=this.#h(t,n):t=t.sort().reverse().map(c=>{const[u,f]=this.#h(c,n);return s||=u,`(${f})`}).join("|"),!t)return;const{caseSensitive:a,entireWord:o}=this.#t,l=`g${s?"u":""}${a?"":"i"}`;t=new RegExp(t,l);const d=[];let h;for(;(h=t.exec(e))!==null;)o&&!Zs(e,h.index,h[0].length)||d.push({index:h.index,length:h[0].length});return d}#f(){if(this._extractTextPromises.length>0)return;let t=Promise.resolve();const e={disableNormalization:!0},i=this._pdfDocument;for(let n=0,s=this._linkService.pagesCount;n<s;n++){const{promise:a,resolve:o}=Promise.withResolvers();this._extractTextPromises[n]=a,t=t.then(async()=>{if(i!==this._pdfDocument){o();return}try{const d=await(await i.getPage(n+1)).getTextContent(e);if(i!==this._pdfDocument){o();return}const h=[];for(const c of d.items)h.push(c.str),c.hasEOL&&h.push(`
|
|
550
|
+
`);[this._pageContents[n],this._pageDiffs[n],this._hasDiacritics[n]]=Ht(h.join(""))}catch(l){if(i!==this._pdfDocument){o();return}console.error(`Unable to get text content for page ${n+1}`,l),[this._pageContents[n],this._pageDiffs[n],this._hasDiacritics[n]]=["",null,!1]}o()})}}#u(t){this._scrollMatches&&this._selected.pageIdx===t&&(this._linkService.page=t+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:t})}#b(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#g(){const t=this.#t.findPrevious,e=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=e,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#s=0,this._matchesCountTotal=0,this.#b();for(let a=0;a<i;a++)this._pendingFindMatches.has(a)||(this._pendingFindMatches.add(a),this._extractTextPromises[a].then(()=>{this._pendingFindMatches.delete(a),this.#c(a)}))}if(this.#l.length===0){this.#P(X.FOUND);return}if(this._resumePageIdx)return;const s=this._offset;if(this._pagesToSearch=i,s.matchIdx!==null){const a=this._pageMatches[s.pageIdx].length;if(!t&&s.matchIdx+1<a||t&&s.matchIdx>0){s.matchIdx=t?s.matchIdx-1:s.matchIdx+1,this.#E(!0);return}this.#S(t)}this.#p()}#m(t){const e=this._offset,i=t.length,n=this.#t.findPrevious;return i?(e.matchIdx=n?i-1:0,this.#E(!0),!0):(this.#S(n),e.wrapped&&(e.matchIdx=null,this._pagesToSearch<0)?(this.#E(!1),!0):!1)}#p(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let t=null;do{const e=this._offset.pageIdx;if(t=this._pageMatches[e],!t){this._resumePageIdx=e;break}}while(!this.#m(t))}#S(t){const e=this._offset,i=this._linkService.pagesCount;e.pageIdx=t?e.pageIdx-1:e.pageIdx+1,e.matchIdx=null,this._pagesToSearch--,(e.pageIdx>=i||e.pageIdx<0)&&(e.pageIdx=t?i-1:0,e.wrapped=!0)}#E(t=!1){let e=X.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,t){const n=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,e=i?X.WRAPPED:X.FOUND,n!==-1&&n!==this._selected.pageIdx&&this.#u(n)}this.#P(e,this.#t.findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,this.#u(this._selected.pageIdx))}#v({pagesMapper:t,type:e,pageNumbers:i}){if(this._extractTextPromises.length===0)return;if(e==="copy"){const u=new Map,f=new Map,g=new Map,p=new Map;for(const b of i)u.set(b,this._extractTextPromises[b-1]),f.set(b,this._pageContents[b-1]),g.set(b,this._pageDiffs[b-1]),p.set(b,this._hasDiacritics[b-1]);this.#a={promises:u,contents:f,diffs:g,diacritics:p};return}if(e==="cancelCopy"){this.#a=null;return}if(e==="delete"&&(this.#n={promises:this._extractTextPromises,contents:this._pageContents,diffs:this._pageDiffs,diacritics:this._hasDiacritics}),e==="cancelDelete"){this._extractTextPromises=this.#n.promises,this._pageContents=this.#n.contents,this._pageDiffs=this.#n.diffs,this._hasDiacritics=this.#n.diacritics;return}if(e==="cleanSavedData"){this.#n=null;return}this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx=null,this._dirtyMatch=!0;const n=this._extractTextPromises,s=this._pageContents,a=this._pageDiffs,o=this._hasDiacritics,l=this._extractTextPromises=[],d=this._pageContents=[],h=this._pageDiffs=[],c=this._hasDiacritics=[];for(let u=1,f=t.pagesNumber;u<=f;u++){const g=t.getPrevPageNumber(u);if(g<0){const p=-g;l.push(this.#a?.promises.get(p)||Promise.resolve()),d.push(this.#a?.contents.get(p)??""),h.push(this.#a?.diffs.get(p)??null),c.push(this.#a?.diacritics.get(p)??!1);continue}l.push(n[g-1]||Promise.resolve()),d.push(s[g-1]??""),h.push(a[g-1]??null),c.push(o[g-1]??!1)}this.#t&&this.#g()}#y(t){const e=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||e&&this._pdfDocument!==e||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#P(X.FOUND),this._highlightMatches=!1,this.#b())})}#_(){const{pageIdx:t,matchIdx:e}=this._selected;let i=0,n=this._matchesCountTotal;if(e!==-1){for(let s=0;s<t;s++)i+=this._pageMatches[s]?.length||0;i+=e+1}return(i<1||i>n)&&(i=n=0),{current:i,total:n}}#w(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#_()})}#P(t,e=!1){!this.#e&&(this.#s!==this._linkService.pagesCount||t===X.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:t,previous:e,entireWord:this.#t?.entireWord??null,matchesCount:this.#_(),rawQuery:this.#t?.query??null})}}const sa=1e3;class aa{#t;#e=new ResizeObserver(this.#i.bind(this));opened=!1;constructor(t,e,i){this.bar=t.bar,this.toggleButton=t.toggleButton,this.findField=t.findField,this.highlightAll=t.highlightAllCheckbox,this.caseSensitive=t.caseSensitiveCheckbox,this.matchDiacritics=t.matchDiacriticsCheckbox,this.entireWord=t.entireWordCheckbox,this.findMsg=t.findMsg,this.findResultsCount=t.findResultsCount,this.findPreviousButton=t.findPreviousButton,this.findNextButton=t.findNextButton,this.eventBus=i,this.#t=e;const n=new Map([[this.highlightAll,"highlightallchange"],[this.caseSensitive,"casesensitivitychange"],[this.entireWord,"entirewordchange"],[this.matchDiacritics,"diacriticmatchingchange"]]);this.toggleButton.addEventListener("click",()=>{this.toggle()}),this.findField.addEventListener("input",()=>{this.dispatchEvent("")}),this.bar.addEventListener("keydown",({keyCode:s,shiftKey:a,target:o})=>{switch(s){case 13:o===this.findField?this.dispatchEvent("again",a):n.has(o)&&(o.checked=!o.checked,this.dispatchEvent(n.get(o)));break;case 27:this.close();break}}),this.findPreviousButton.addEventListener("click",()=>{this.dispatchEvent("again",!0)}),this.findNextButton.addEventListener("click",()=>{this.dispatchEvent("again",!1)});for(const[s,a]of n)s.addEventListener("click",()=>{this.dispatchEvent(a)})}reset(){this.updateUIState()}dispatchEvent(t,e=!1){this.eventBus.dispatch("find",{source:this,type:t,query:this.findField.value,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,highlightAll:this.highlightAll.checked,findPrevious:e,matchDiacritics:this.matchDiacritics.checked})}updateUIState(t,e,i){const{findField:n,findMsg:s}=this;let a="",o="";switch(t){case X.FOUND:break;case X.PENDING:o="pending";break;case X.NOT_FOUND:a="pdfjs-find-not-found",o="notFound";break;case X.WRAPPED:a=e?"pdfjs-find-reached-top":"pdfjs-find-reached-bottom";break}n.setAttribute("data-status",o),n.setAttribute("aria-invalid",t===X.NOT_FOUND),s.setAttribute("data-status",o),a?s.setAttribute("data-l10n-id",a):(s.removeAttribute("data-l10n-id"),s.textContent=""),this.updateResultsCount(i)}updateResultsCount({current:t=0,total:e=0}={}){const{findResultsCount:i}=this;if(e>0){const n=sa;i.setAttribute("data-l10n-id",e>n?"pdfjs-find-match-count-limit":"pdfjs-find-match-count"),i.setAttribute("data-l10n-args",JSON.stringify({limit:n,current:t,total:e}))}else i.removeAttribute("data-l10n-id"),i.textContent=""}open(){this.opened||(this.#e.observe(this.#t),this.#e.observe(this.bar),this.opened=!0,G(this.toggleButton,!0,this.bar)),this.findField.select(),this.findField.focus()}close(){this.opened&&(this.#e.disconnect(),this.opened=!1,G(this.toggleButton,!1,this.bar),this.eventBus.dispatch("findbarclose",{source:this}))}toggle(){this.opened?this.close():this.open()}#i(){const{bar:t}=this;t.classList.remove("wrapContainers");const e=t.clientHeight,i=t.firstElementChild.clientHeight;e>i&&t.classList.add("wrapContainers")}}const ra=1e3,oa=50,la=1e3;function ue(){return document.location.hash}class da{#t=null;constructor({linkService:t,eventBus:e}){this.linkService=t,this.eventBus=e,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus.on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus.on("pagesloaded",i=>{this._isPagesLoaded=!!i.pagesCount},{once:!0,...x})},x)}initialize({fingerprint:t,resetHistory:e=!1,updateUrl:i=!1}){if(!t||typeof t!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const n=this._fingerprint!==""&&this._fingerprint!==t;this._fingerprint=t,this._updateUrl=i===!0,this._initialized=!0,this.#h();const s=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=ue(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this.#a(s,!0)||e){const{hash:o,page:l,rotation:d}=this.#o(!0);if(!o||n||e){this.#e(null,!0);return}this.#e({hash:o,page:l,rotation:d},!0);return}const a=s.destination;this.#n(a,s.uid,!0),a.rotation!==void 0&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this.#d(),this._initialized=!1,this.#c()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:e,pageNumber:i}){if(!this._initialized)return;if(t&&typeof t!="string"){console.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);return}else if(Array.isArray(e)){if(!this.#s(i)&&(i!==null||this._destination)){console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${e}" is not a valid explicitDest parameter.`);return}const n=t||JSON.stringify(e);if(!n)return;let s=!1;if(this._destination&&(ha(this._destination.hash,n)||ca(this._destination.dest,e))){if(this._destination.page)return;s=!0}this._popStateInProgress&&!s||(this.#e({dest:e,hash:n,page:i,rotation:this.linkService.rotation},s),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(t){if(this._initialized){if(!this.#s(t)){console.error(`PDFHistory.pushPage: "${t}" is not a valid page number.`);return}this._destination?.page!==t&&(this._popStateInProgress||(this.#e({dest:null,hash:`page=${t}`,page:t,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||this.#i()}back(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;this.#a(t)&&t.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;this.#a(t)&&t.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}#e(t,e=!1){const i=e||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:t};this.#n(t,n.uid);let s;if(this._updateUrl&&t?.hash){const{href:a,protocol:o}=document.location;o!=="file:"&&(s=te(a,t.hash))}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}#i(t=!1){if(!this._position)return;let e=this._position;if(t&&(e=Object.assign(Object.create(null),this._position),e.temporary=!0),!this._destination){this.#e(e);return}if(this._destination.temporary){this.#e(e,!0);return}if(this._destination.hash===e.hash||!this._destination.page&&this._numPositionUpdates<=oa)return;let i=!1;if(this._destination.page>=e.first&&this._destination.page<=e.page){if(this._destination.dest!==void 0||!this._destination.first)return;i=!0}this.#e(e,i)}#s(t){return Number.isInteger(t)&&t>0&&t<=this.linkService.pagesCount}#a(t,e=!1){if(!t)return!1;if(t.fingerprint!==this._fingerprint)if(e){if(typeof t.fingerprint!="string"||t.fingerprint.length!==this._fingerprint.length)return!1;const[i]=performance.getEntriesByType("navigation");if(i?.type!=="reload")return!1}else return!1;return!(!Number.isInteger(t.uid)||t.uid<0||t.destination===null||typeof t.destination!="object")}#n(t,e,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&t?.temporary&&delete t.temporary,this._destination=t,this._uid=e,this._maxUid=Math.max(this._maxUid,e),this._numPositionUpdates=0}#o(t=!1){const e=unescape(ue()).substring(1),i=Ct(e),n=i.get("nameddest")||"";let s=i.get("page")|0;return(!this.#s(s)||t&&n.length>0)&&(s=null),{hash:e,page:s,rotation:this.linkService.rotation}}#r({location:t}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||this.#i(!0),this._updateViewareaTimeout=null},la))}#l({state:t}){const e=ue(),i=this._currentHash!==e;if(this._currentHash=e,!t){this._uid++;const{hash:s,page:a,rotation:o}=this.#o();this.#e({hash:s,page:a,rotation:o},!0);return}if(!this.#a(t))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,Xe({target:window,name:"hashchange",delay:ra}).then(()=>{this._blockHashChange--}));const n=t.destination;this.#n(n,t.uid,!0),kt(n.rotation)&&(this.linkService.rotation=n.rotation),n.dest?this.linkService.goToDestination(n.dest):n.hash?this.linkService.setHash(n.hash):n.page&&(this.linkService.page=n.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})}#d(){(!this._destination||this._destination.temporary)&&this.#i()}#h(){if(this.#t)return;this.#t=new AbortController;const{signal:t}=this.#t;this.eventBus.on("updateviewarea",this.#r.bind(this),{signal:t,...x}),window.addEventListener("popstate",this.#l.bind(this),{signal:t}),window.addEventListener("pagehide",this.#d.bind(this),{signal:t})}#c(){this.#t?.abort(),this.#t=null}}function ha(r,t){return typeof r!="string"||typeof t!="string"?!1:r===t||Ct(r).get("nameddest")===t}function ca(r,t){function e(i,n){if(typeof i!=typeof n||Array.isArray(i)||Array.isArray(n))return!1;if(i!==null&&typeof i=="object"&&n!==null){if(Object.keys(i).length!==Object.keys(n).length)return!1;for(const s in i)if(!e(i[s],n[s]))return!1;return!0}return i===n||Number.isNaN(i)&&Number.isNaN(n)}if(!(Array.isArray(r)&&Array.isArray(t))||r.length!==t.length)return!1;for(let i=0,n=r.length;i<n;i++)if(!e(r[i],t[i]))return!1;return!0}class ua extends le{constructor(t){super(t);const{eventBus:e}=this;e.on("optionalcontentconfigchanged",i=>{this.#t(i.promise)},x),e.on("resetlayers",()=>{this.#t()},x),e.on("togglelayerstree",this._toggleAllTreeItems.bind(this),x)}reset(){super.reset(),this._optionalContentConfig=null,this._optionalContentVisibility?.clear(),this._optionalContentVisibility=null}_dispatchEvent(t){this.eventBus.dispatch("layersloaded",{source:this,layersCount:t})}_bindLink(t,{groupId:e,input:i}){const n=()=>{const s=i.checked;this._optionalContentConfig.setVisibility(e,s);const a=this._optionalContentVisibility.get(e);a&&(a.visible=s),this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};t.onclick=s=>s.target===i?(n(),!0):s.target!==t?!0:(i.checked=!i.checked,n(),!1)}_setNestedName(t,{name:e=null}){if(typeof e=="string"){t.textContent=this._normalizeTextContent(e);return}t.setAttribute("data-l10n-id","pdfjs-additional-layers"),t.style.fontStyle="italic",this._l10n.translateOnce(t)}_addToggleButton(t,{name:e=null}){super._addToggleButton(t,e===null)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render({optionalContentConfig:t,pdfDocument:e}){this._optionalContentConfig&&this.reset(),this._optionalContentConfig=t||null,this._pdfDocument=e||null;const i=t?.getOrder();if(!i){this._dispatchEvent(0);return}this._optionalContentVisibility=new Map;const n=document.createDocumentFragment(),s=[{parent:n,groups:i}];let a=0,o=!1;for(;s.length>0;){const l=s.shift();for(const d of l.groups){const h=document.createElement("div");h.className="treeItem";const c=document.createElement("a");if(h.append(c),typeof d=="object"){o=!0,this._addToggleButton(h,d),this._setNestedName(c,d);const u=document.createElement("div");u.className="treeItems",h.append(u),s.push({parent:u,groups:d.order})}else{const u=t.getGroup(d),f=document.createElement("label"),g=document.createElement("input");f.append(g,document.createTextNode(this._normalizeTextContent(u.name))),this._bindLink(c,{groupId:d,input:g}),g.type="checkbox",g.checked=u.visible,this._optionalContentVisibility.set(d,{input:g,visible:g.checked}),c.append(f),a++}l.parent.append(h)}}this._finishRendering(n,a,o)}async#t(t=null){if(!this._optionalContentConfig)return;const e=this._pdfDocument,i=await(t||e.getOptionalContentConfig({intent:"display"}));if(e===this._pdfDocument){if(t){for(const[n,s]of this._optionalContentVisibility){const a=i.getGroup(n);a&&s.visible!==a.visible&&(s.input.checked=s.visible=!s.visible)}return}this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(i)}),this.render({optionalContentConfig:i,pdfDocument:this._pdfDocument})}}}class ga extends le{constructor(t){super(t),this.linkService=t.linkService,this.downloadManager=t.downloadManager;const{eventBus:e}=this;e.on("toggleoutlinetree",this._toggleAllTreeItems.bind(this),x),e.on("currentoutlineitem",this._currentOutlineItem.bind(this),x),e.on("pagechanging",i=>{this._currentPageNumber=i.pageNumber},x),e.on("pagesloaded",i=>{this._isPagesLoaded=!!i.pagesCount,this._currentOutlineItemCapability?.resolve(this._isPagesLoaded)},x),e.on("sidebarviewchanged",i=>{this._sidebarView=i.view},x)}reset(){super.reset(),this._outline=null,this._pageNumberToDestHashCapability=null,this._currentPageNumber=1,this._isPagesLoaded=null,this._currentOutlineItemCapability?.resolve(!1),this._currentOutlineItemCapability=null}_dispatchEvent(t){this._currentOutlineItemCapability=Promise.withResolvers(),t===0||this._pdfDocument?.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):this._isPagesLoaded!==null&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded),this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:t,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(t,{url:e,newWindow:i,action:n,attachmentId:s,attachment:a,dest:o,setOCGState:l}){const{linkService:d}=this;if(e){d.addLinkAttributes(t,e,i);return}if(n){t.href=d.getAnchorUrl(""),t.onclick=()=>(d.executeNamedAction(n),!1);return}if(s&&a){t.href=d.getAnchorUrl("");const h=async()=>{const c=await d.getAttachmentContent(s);c&&this.downloadManager?.openOrDownloadData(c,a.filename)};t.onclick=()=>(h(),!1);return}if(l){t.href=d.getAnchorUrl(""),t.onclick=()=>(d.executeSetOCGState(l),!1);return}t.href=d.getDestinationHash(o),t.onclick=h=>(this._updateCurrentTreeItem(h.target.parentNode),o&&d.goToDestination(o),!1)}_setStyles(t,{bold:e,italic:i}){e&&(t.style.fontWeight="bold"),i&&(t.style.fontStyle="italic")}_addToggleButton(t,{count:e,items:i}){let n=!1;if(e<0){let s=i.length;if(s>0){const a=[...i];for(;a.length>0;){const{count:o,items:l}=a.shift();o>0&&l.length>0&&(s+=l.length,a.push(...l))}}Math.abs(e)===s&&(n=!0)}super._addToggleButton(t,n)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render({outline:t,pdfDocument:e}){if(this._outline&&this.reset(),this._outline=t||null,this._pdfDocument=e||null,!t){this._dispatchEvent(0);return}const i=document.createDocumentFragment(),n=[{parent:i,items:t}];let s=0,a=!1;for(;n.length>0;){const o=n.shift();for(const l of o.items){const d=document.createElement("div");d.className="treeItem";const h=document.createElement("a");if(this._bindLink(h,l),this._setStyles(h,l),h.textContent=this._normalizeTextContent(l.title),d.append(h),l.items.length>0){a=!0,this._addToggleButton(d,l);const c=document.createElement("div");c.className="treeItems",d.append(c),n.push({parent:c,items:l.items})}o.parent.append(d),s++}}this._finishRendering(i,s,a)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const t=await this._getPageNumberToDestHash(this._pdfDocument);if(t&&(this._updateCurrentTreeItem(null),this._sidebarView===N.OUTLINE))for(let e=this._currentPageNumber;e>0;e--){const i=t.get(e);if(!i)continue;const n=this.container.querySelector(`a[href="${i}"]`);if(n){this._scrollToCurrentTreeItem(n.parentNode);break}}}async _getPageNumberToDestHash(t){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=Promise.withResolvers();const e=new Map,i=new Map,n=[{nesting:0,items:this._outline}];for(;n.length>0;){const s=n.shift(),a=s.nesting;for(const{dest:o,items:l}of s.items){let d,h;if(typeof o=="string"){if(d=await t.getDestination(o),t!==this._pdfDocument)return null}else d=o;if(Array.isArray(d)){const[c]=d;if(c&&typeof c=="object"?h=t.cachedPageNumber(c):Number.isInteger(c)&&(h=c+1),Number.isInteger(h)&&(!e.has(h)||a>i.get(h))){const u=this.linkService.getDestinationHash(o);e.set(h,u),i.set(h,a)}}l.length>0&&n.push({nesting:a+1,items:l})}}return this._pageNumberToDestHashCapability.resolve(e.size>0?e:null),this._pageNumberToDestHashCapability.promise}}const fa=3e3,Si="pdfPresentationMode",ge="pdfPresentationModeControls",pa=50,ma=.1,Pi=50,fe=Math.PI/6;class ba{#t=H.UNKNOWN;#e=null;#i=null;#s=null;constructor({container:t,pdfViewer:e,eventBus:i}){this.container=t,this.pdfViewer=e,this.eventBus=i,this.contextMenuOpen=!1,this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0,this.touchSwipeState=null}async request(){const{container:t,pdfViewer:e}=this;if(this.active||!e.pagesCount||!t.requestFullscreen)return!1;this.#m(),this.#n(H.CHANGING);const i=t.requestFullscreen();this.#e={pageNumber:e.currentPageNumber,scaleValue:e.currentScaleValue,scrollMode:e.scrollMode,spreadMode:null,annotationEditorMode:null},e.spreadMode!==j.NONE&&!(e.pageViewsReady&&e.hasEqualPageSizes)&&(console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes."),this.#e.spreadMode=e.spreadMode),e.annotationEditorMode!==B.DISABLE&&(this.#e.annotationEditorMode=e.annotationEditorMode);try{return await i,e.focus(),!0}catch{this.#p(),this.#n(H.NORMAL)}return!1}get active(){return this.#t===H.CHANGING||this.#t===H.FULLSCREEN}#a(t){if(!this.active||t.target.closest?.(".mediaAnnotation"))return;t.preventDefault();const e=en(t),i=Date.now(),n=this.mouseScrollTimeStamp;if(!(i>n&&i-n<pa)&&((this.mouseScrollDelta>0&&e<0||this.mouseScrollDelta<0&&e>0)&&this.#f(),this.mouseScrollDelta+=e,Math.abs(this.mouseScrollDelta)>=ma)){const s=this.mouseScrollDelta;this.#f(),(s>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}#n(t){this.#t=t,this.eventBus.dispatch("presentationmodechanged",{source:this,state:t})}#o(){this.#n(H.FULLSCREEN),this.container.classList.add(Si),setTimeout(()=>{this.pdfViewer.scrollMode=M.PAGE,this.#e.spreadMode!==null&&(this.pdfViewer.spreadMode=j.NONE),this.pdfViewer.currentPageNumber=this.#e.pageNumber,this.pdfViewer.currentScaleValue="page-fit",this.#e.annotationEditorMode!==null&&(this.pdfViewer.annotationEditorMode={mode:B.NONE})},0),this.#b(),this.#h(),this.contextMenuOpen=!1,document.getSelection().empty()}#r(){const t=this.pdfViewer.currentPageNumber;this.container.classList.remove(Si),setTimeout(()=>{this.#p(),this.#n(H.NORMAL),this.pdfViewer.scrollMode=this.#e.scrollMode,this.#e.spreadMode!==null&&(this.pdfViewer.spreadMode=this.#e.spreadMode),this.pdfViewer.currentScaleValue=this.#e.scaleValue,this.pdfViewer.currentPageNumber=t,this.#e.annotationEditorMode!==null&&(this.pdfViewer.annotationEditorMode={mode:this.#e.annotationEditorMode}),this.#e=null},0),this.#g(),this.#c(),this.#f(),this.contextMenuOpen=!1}#l(t){if(this.contextMenuOpen){this.contextMenuOpen=!1,t.preventDefault();return}t.button===0&&(t.target.href&&t.target.parentNode?.hasAttribute("data-internal-link")||t.target.closest?.(".mediaAnnotation")||(t.preventDefault(),t.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()))}#d(){this.contextMenuOpen=!0}#h(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(ge),this.controlsTimeout=setTimeout(()=>{this.container.classList.remove(ge),delete this.controlsTimeout},fa)}#c(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove(ge),delete this.controlsTimeout)}#f(){this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0}#u(t){if(this.active){if(t.target.closest?.(".mediaAnnotation")){this.touchSwipeState=null;return}if(t.touches.length>1){this.touchSwipeState=null;return}switch(t.type){case"touchstart":this.touchSwipeState={startX:t.touches[0].pageX,startY:t.touches[0].pageY,endX:t.touches[0].pageX,endY:t.touches[0].pageY};break;case"touchmove":if(this.touchSwipeState===null)return;this.touchSwipeState.endX=t.touches[0].pageX,this.touchSwipeState.endY=t.touches[0].pageY,t.preventDefault();break;case"touchend":if(this.touchSwipeState===null)return;let e=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,n=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(n,i));Math.abs(i)>Pi&&(s<=fe||s>=Math.PI-fe)?e=i:Math.abs(n)>Pi&&Math.abs(s-Math.PI/2)<=fe&&(e=n),e>0?this.pdfViewer.previousPage():e<0&&this.pdfViewer.nextPage();break}}}#b(){if(this.#s)return;this.#s=new AbortController;const{signal:t}=this.#s,e=this.#u.bind(this);window.addEventListener("mousemove",this.#h.bind(this),{signal:t}),window.addEventListener("mousedown",this.#l.bind(this),{signal:t}),window.addEventListener("wheel",this.#a.bind(this),{passive:!1,signal:t}),window.addEventListener("keydown",this.#f.bind(this),{signal:t}),window.addEventListener("contextmenu",this.#d.bind(this),{signal:t}),window.addEventListener("touchstart",e,{signal:t}),window.addEventListener("touchmove",e,{signal:t}),window.addEventListener("touchend",e,{signal:t})}#g(){this.#s?.abort(),this.#s=null}#m(){this.#i||(this.#i=new AbortController,window.addEventListener("fullscreenchange",()=>{document.fullscreenElement?this.#o():this.#r()},{signal:this.#i.signal}))}#p(){this.#i?.abort(),this.#i=null}}class _i{#t=!1;div=null;constructor({pdfPage:t,annotationStorage:e=null,linkService:i,xfaHtml:n=null}){this.pdfPage=t,this.annotationStorage=e,this.linkService=i,this.xfaHtml=n}async render({viewport:t,intent:e="display"}){let i;if(e==="print")i=this.xfaHtml;else if(i=await this.pdfPage.getXfa(),this.#t||!i)return{textDivs:[]};const n=!!this.div,s={viewport:t.clone({dontFlip:!0}),div:this.div??=document.createElement("div"),xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return n?ee.update(s):ee.render(s)}cancel(){this.#t=!0}hide(){this.div&&(this.div.hidden=!0)}}class wa{static initGlobals(t){}static get supportsPrinting(){throw new Error("Not implemented: supportsPrinting")}static createPrintService(t){throw new Error("Not implemented: createPrintService")}}function va(r,t){const e=t.allXfaHtml,i=new $e,n=Math.round(J.PDF_TO_CSS_UNITS*100)/100;for(const s of e.children){const a=document.createElement("div");a.className="xfaPrintedPage",r.append(a);const o=new _i({pdfPage:null,annotationStorage:t.annotationStorage,linkService:i,xfaHtml:s}),l=ee.getPageViewport(s,{scale:n});o.render({viewport:l,intent:"print"}),a.append(o.div)}}let $=null,nt=null,wt=null,Ii={initialized:!1};function Ea(r,t,e,i,n,s,a){const o=$.scratchCanvas,l=n/J.PDF;o.width=Math.floor(i.width*l),o.height=Math.floor(i.height*l);const d=o.getContext("2d");return d.save(),d.fillStyle="rgb(255, 255, 255)",d.fillRect(0,0,o.width,o.height),d.restore(),Promise.all([t.getPage(e),a]).then(function([h,c]){const u={canvas:o,transform:[l,0,0,l,0,0],viewport:h.getViewport({scale:1,rotation:i.rotation}),intent:"print",annotationMode:Q.ENABLE_STORAGE,optionalContentConfigPromise:s,printAnnotationStorage:c};return h.render(u).promise.catch(g=>{throw g instanceof _t||console.error(g),g})})}class ya{constructor({pdfDocument:t,pagesOverview:e,printContainer:i,printResolution:n,printAnnotationStoragePromise:s=null}){this.pdfDocument=t,this.pagesOverview=e,this.printContainer=i,this._printResolution=n||150,this._optionalContentConfigPromise=t.getOptionalContentConfig({intent:"print"}),this._printAnnotationStoragePromise=s||Promise.resolve(),this.currentPage=-1,this.scratchCanvas=document.createElement("canvas")}layout(){this.throwIfInactive(),document.querySelector("body").setAttribute("data-pdfjsprinting",!0);const{width:e,height:i}=this.pagesOverview[0];this.pagesOverview.every(s=>s.width===e&&s.height===i)||console.warn("Not all pages have the same size. The printed result may be incorrect!"),this.pageStyleSheet=new CSSStyleSheet,this.pageStyleSheet.replaceSync(`@page { size: ${e}pt ${i}pt;}`),document.adoptedStyleSheets.push(this.pageStyleSheet)}destroy(){if($!==this)return;if(this.printContainer.textContent="",document.querySelector("body").removeAttribute("data-pdfjsprinting"),this.pageStyleSheet&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==this.pageStyleSheet),this.pageStyleSheet=null),this._blobURLs){for(const e of this._blobURLs)URL.revokeObjectURL(e);this._blobURLs=null}this.scratchCanvas.width=this.scratchCanvas.height=0,this.scratchCanvas=null,$=null,be().then(function(){wt.closeIfActive(nt)})}renderPages(){if(this.pdfDocument.isPureXfa)return va(this.printContainer,this.pdfDocument),Promise.resolve();const t=this.pagesOverview.length,e=(i,n)=>{if(this.throwIfInactive(),++this.currentPage>=t){Li(t,t),i();return}const s=this.currentPage;Li(s,t),Ea(this,this.pdfDocument,s+1,this.pagesOverview[s],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then(function(){e(i,n)},n)};return new Promise(e)}useRenderedPage(){this.throwIfInactive();const t=document.createElement("img");this.scratchCanvas.toBlob(a=>{const o=URL.createObjectURL(a);t.src=o,(this._blobURLs??=[]).push(o)});const e=document.createElement("div");e.className="printedPage",e.append(t),this.printContainer.append(e);const{promise:i,resolve:n,reject:s}=Promise.withResolvers();return t.onload=n,t.onerror=s,i.catch(()=>{}),i}performPrint(){return this.throwIfInactive(),new Promise(t=>{setTimeout(()=>{if(!this.active){t();return}Ca.call(window),setTimeout(t,20)},0)})}get active(){return this===$}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const Ca=window.print;window.print=function(){if($){console.warn("Ignored window.print() because of a pending print job.");return}be().then(function(){$&&wt.open(nt)});try{xi("beforeprint")}finally{if(!$)console.error("Expected print service to be initialized."),be().then(function(){wt.closeIfActive(nt)});else{const r=$;$.renderPages().then(()=>r.performPrint()).catch(()=>{}).then(()=>{r.active&&pe()})}}};function xi(r){const t=new CustomEvent(r,{bubbles:!1,cancelable:!1,detail:"custom"});window.dispatchEvent(t)}function pe(){$&&($.destroy(),xi("afterprint"))}function Li(r,t){nt||=document.getElementById("printServiceDialog");const e=Math.round(100*r/t),i=nt.querySelector("progress"),n=nt.querySelector(".relative-progress");i.value=e,n.setAttribute("data-l10n-args",JSON.stringify({progress:e}))}if(window.addEventListener("keydown",function(r){r.keyCode===80&&(r.ctrlKey||r.metaKey)&&!r.altKey&&(!r.shiftKey||window.chrome||window.opera)&&(window.print(),r.preventDefault(),r.stopImmediatePropagation())},!0),"onbeforeprint"in window){const r=function(t){t.detail!=="custom"&&t.stopImmediatePropagation()};window.addEventListener("beforeprint",r),window.addEventListener("afterprint",r)}let me;function be(){if(!me){if(wt=Ii.overlayManager,!wt)throw new Error("The overlay manager has not yet been initialized.");nt||=document.getElementById("printServiceDialog"),me=wt.register(nt,!0),document.getElementById("printCancel").onclick=pe,nt.addEventListener("close",pe)}return me}class we extends wa{static initGlobals(t){Ii=t}static get supportsPrinting(){return z(this,"supportsPrinting",!0)}static createPrintService(t){if($)throw new Error("The print service is created and active.");return $=new ya(t)}}const k={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};class Ti{renderingId="";renderTask=null;resume=null;get renderingState(){throw new Error("Abstract getter `renderingState` accessed")}set renderingState(t){throw new Error("Abstract setter `renderingState` accessed")}async draw(){throw new Error("Not implemented: draw")}}const Sa=3e4;class Ai{#t=null;#e=null;#i=null;#s=null;isThumbnailViewEnabled=!1;onIdle=null;printing=!1;constructor(){Object.defineProperty(this,"hasViewer",{value:()=>!!this.#s})}setViewer(t){this.#s=t}setThumbnailViewer(t){this.#i=t}isHighestPriority(t){return this.#t===t.renderingId}renderHighestPriority(t){this.#e&&(clearTimeout(this.#e),this.#e=null),!this.#s.forceRendering(t)&&(this.isThumbnailViewEnabled&&this.#i?.forceRendering()||this.printing||this.onIdle&&(this.#e=setTimeout(this.onIdle.bind(this),Sa)))}getHighestPriority(t,e,i,n=!1,s=!1){const a=t.views,o=a.length;if(o===0)return null;for(let u=0;u<o;u++){const f=a[u].view;if(!this.isViewFinished(f))return f}if(!s)for(let u=0;u<o;u++){const{detailView:f}=a[u].view;if(f&&!this.isViewFinished(f))return f}const l=t.first.id,d=t.last.id;if(d-l+1>o){const u=t.ids;for(let f=1,g=d-l;f<g;f++){const p=i?l+f:d-f;if(u.has(p))continue;const b=e[p-1];if(!this.isViewFinished(b))return b}}let h=i?d:l-2,c=e[h];return c&&!this.isViewFinished(c)||n&&(h+=i?1:-1,c=e[h],c&&!this.isViewFinished(c))?c:null}isViewFinished(t){return t.renderingState===k.FINISHED}renderView(t){switch(t.renderingState){case k.FINISHED:return!1;case k.PAUSED:this.#t=t.renderingId,t.resume();break;case k.RUNNING:this.#t=t.renderingId;break;case k.INITIAL:this.#t=t.renderingId,t.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof _t||console.error("renderView:",e)});break}return!0}}class Pa{#t=null;#e=null;#i=null;#s=null;#a=null;#n=null;#o=null;#r=null;#l=null;#d=!1;#h=null;#c=null;constructor({eventBus:t,externalServices:e=null,docProperties:i=null}){this.#a=t,this.#n=e,this.#i=i}setViewer(t){this.#l=t}async setDocument(t){if(this.#r&&await this.#m(),this.#r=t,!t)return;const[e,i,n]=await Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);if(!e&&!n){await this.#m();return}if(t!==this.#r)return;if(e){this.#o=new Set;for(const o of Object.values(e))for(const{id:l}of o)this.#o.add(l)}try{this.#h=this.#g()}catch(o){console.error("setDocument:",o),await this.#m();return}const s=this.#a;this.#s=new AbortController;const a={signal:this.#s.signal,...x};s.on("updatefromsandbox",o=>{o?.source===window&&this.#f(o.detail)},a),s.on("dispatcheventinsandbox",o=>{this.#h?.dispatchEventInSandbox(o.detail)},a),s.on("pagechanging",({pageNumber:o,previous:l})=>{o!==l&&(this.#b(l),this.#u(o))},a),s.on("pagerendered",({pageNumber:o})=>{this._pageOpenPending.has(o)&&o===this.#l.currentPageNumber&&this.#u(o)},a),s.on("pagesdestroy",async()=>{await this.#b(this.#l.currentPageNumber),await this.#h?.dispatchEventInSandbox({id:"doc",name:"WillClose"}),this.#t?.resolve()},a);try{const o=await this.#i(t);if(t!==this.#r)return;await this.#h.createSandbox({objects:e,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...o,actions:n}}),s.dispatch("sandboxcreated",{source:this})}catch(o){console.error("setDocument:",o),await this.#m();return}await this.#h?.dispatchEventInSandbox({id:"doc",name:"Open"}),await this.#u(this.#l.currentPageNumber,!0),Promise.resolve().then(()=>{t===this.#r&&(this.#d=!0)})}async dispatchWillSave(){return this.#h?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){return this.#h?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){if(this.#h){await this.#c?.promise,this.#c=Promise.withResolvers();try{await this.#h.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(t){throw this.#c.resolve(),this.#c=null,t}await this.#c.promise}}async dispatchDidPrint(){return this.#h?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return this.#e?.promise||null}get ready(){return this.#d}get _pageOpenPending(){return z(this,"_pageOpenPending",new Set)}get _visitedPages(){return z(this,"_visitedPages",new Map)}async#f(t){const e=this.#l,i=e.isInPresentationMode||e.isChangingPresentationMode,{id:n,siblings:s,command:a,value:o}=t;if(!n){switch(a){case"clear":console.clear();break;case"error":console.error(o);break;case"layout":if(!i){const d=Me(o);e.spreadMode=d.spreadMode}break;case"page-num":e.currentPageNumber=o+1;break;case"print":await e.pagesPromise,this.#a.dispatch("print",{source:this});break;case"println":console.log(o);break;case"zoom":i||(e.currentScaleValue=o);break;case"SaveAs":this.#a.dispatch("download",{source:this});break;case"FirstPage":e.currentPageNumber=1;break;case"LastPage":e.currentPageNumber=e.pagesCount;break;case"NextPage":e.nextPage();break;case"PrevPage":e.previousPage();break;case"ZoomViewIn":i||e.increaseScale();break;case"ZoomViewOut":i||e.decreaseScale();break;case"WillPrintFinished":this.#c?.resolve(),this.#c=null;break}return}if(i&&t.focus)return;delete t.id,delete t.siblings;const l=s?[n,...s]:[n];for(const d of l){if(!this.#o?.has(d))continue;const h=document.querySelector(`[data-element-id="${d}"]`);h?h.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):this.#r?.annotationStorage.setValue(d,t)}}async#u(t,e=!1){const i=this.#r,n=this._visitedPages;if(e&&(this.#t=Promise.withResolvers()),!this.#t)return;const s=this.#l.getPageView(t-1);if(s?.renderingState!==k.FINISHED){this._pageOpenPending.add(t);return}this._pageOpenPending.delete(t);const a=(async()=>{const o=await(n.has(t)?null:s.pdfPage?.getJSActions());i===this.#r&&await this.#h?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:t,actions:o})})();n.set(t,a)}async#b(t){const e=this.#r,i=this._visitedPages;if(!this.#t||this._pageOpenPending.has(t))return;const n=i.get(t);n&&(i.set(t,null),await n,e===this.#r&&await this.#h?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:t}))}#g(){if(this.#e=Promise.withResolvers(),this.#h)throw new Error("#initScripting: Scripting already exists.");return this.#n.createScripting()}async#m(){if(this.#o=null,!this.#h){this.#r=null,this.#e?.resolve();return}this.#t&&(await Promise.race([this.#t.promise,new Promise(t=>{setTimeout(t,1e3)})]).catch(()=>{}),this.#t=null),this.#r=null;try{await this.#h.destroySandbox()}catch{}this.#c?.reject(new Error("Scripting destroyed.")),this.#c=null,this.#s?.abort(),this.#s=null,this._pageOpenPending.clear(),this._visitedPages.clear(),this.#h=null,this.#d=!1,this.#e?.resolve()}}var Ni;class Jr{#t;#e;#i=Promise.withResolvers();constructor(t,e,i){this.#t=t,i.on("pagesinit",()=>{this.#i.resolve(e)},Ni),i.on("pagesdestroy",()=>{this.#i.reject(new Error("pagesdestroy")),this.#e=null,this.#i=Promise.withResolvers()},Ni),window.addEventListener("requestTextContent",({detail:n})=>{this.extractTextContent(n.requestId)})}async extractTextContent(t){if(!this.#e){const e=this.#e=this.#i.promise.then(i=>i.getAllText());e.then(()=>{setTimeout(()=>{this.#e===e&&(this.#e=null)},5e3)})}this.#t.reportText({text:await this.#e,requestId:t})}}class Mi{#t;#e;#i;#s=null;#a=new AbortController;#n=-1;#o=this.#d.bind(this);constructor(t,e,i){if(this.#e=t,this.#t=e,Array.isArray(i))this.#i=i;else{this.#i=[];for(const n of this.#e.querySelectorAll("button"))this.#i.push(n)}this.#h()}#r(){if(!this.#s)return;const t=this.#e;this.#t.ariaExpanded="false",this.#s.abort(),this.#s=null,t.contains(document.activeElement)&&setTimeout(()=>{t.contains(document.activeElement)||this.#t.focus()},0),this.#n=-1}#l(){if(this.#s)return;const t=this.#e;this.#t.ariaExpanded="true",this.#s=new AbortController;const e=AbortSignal.any([this.#a.signal,this.#s.signal]);window.addEventListener("pointerdown",({target:n})=>{!this.#t.contains(n)&&!t.contains(n)&&this.#r()},{signal:e});const i=this.#r.bind(this);window.addEventListener("blur",i,{signal:e}),t.addEventListener("focusout",this.#o,{signal:e})}#d({relatedTarget:t}){!this.#t.contains(t)&&!this.#e.contains(t)&&this.#r()}#h(){this.#t.addEventListener("click",e=>{if(this.#s){this.#r();return}this.#l()}),this.#t.addEventListener("focusout",this.#o);const{signal:t}=this.#a;this.#e.addEventListener("keydown",e=>{switch(e.key){case"Escape":this.#r(),L(e);break;case"ArrowDown":this.#c(e.target,!0),L(e);break;case"ArrowUp":this.#c(e.target,!1),L(e);break;case"Home":this.#i.find(s=>!s.disabled&&!s.classList.contains("hidden"))?.focus(),L(e);break;case"End":this.#i.findLast(s=>!s.disabled&&!s.classList.contains("hidden"))?.focus(),L(e);break;default:const{key:i}=e;if(!/^\p{L}$/u.test(i))break;const n=i.toLocaleLowerCase();this.#c(e.target,!0,s=>s.textContent.trim().toLowerCase().startsWith(n)),L(e);break}},{signal:t,capture:!0}),this.#e.addEventListener("contextmenu",q,{signal:t}),this.#e.addEventListener("click",this.#r.bind(this),{signal:t,capture:!0}),this.#t.addEventListener("keydown",e=>{switch(e.key){case" ":case"Enter":case"ArrowDown":case"Home":L(e),this.#s||this.#l(),this.#i.find(i=>!i.disabled&&!i.classList.contains("hidden"))?.focus();break;case"ArrowUp":case"End":L(e),this.#s||this.#l(),this.#i.findLast(i=>!i.disabled&&!i.classList.contains("hidden"))?.focus();break;case"Escape":this.#r(),L(e);break}},{signal:t})}#c(t,e,i=()=>!0){const n=this.#n===-1?this.#i.indexOf(t):this.#n,s=this.#i.length,a=e?1:s-1;for(let o=(n+a)%s;o!==n;o=(o+a)%s){const l=this.#i[o];if(!l.disabled&&!l.classList.contains("hidden")&&i(l)){l.focus(),this.#n=o;break}}}destroy(){this.#r(),this.#a?.abort(),this.#a=null}}const ki=2,Bi=3,_a=126;function Ia(r,t){const e=new OffscreenCanvas(r,t),i=e.getContext("2d",{alpha:!1});return i.save(),i.fillStyle="rgb(255, 255, 255)",i.fillRect(0,0,r,t),i.restore(),[e,i]}class ye extends Ti{#t=k.INITIAL;constructor({container:t,eventBus:e,id:i,defaultViewport:n,optionalContentConfigPromise:s,linkService:a,renderingQueue:o,maxCanvasPixels:l,maxCanvasDim:d,pageColors:h,enableSplitMerge:c=!1}){super(),this.id=i,this.renderingId=`thumbnail${i}`,this.pageLabel=null,this.pdfPage=null,this.rotation=0,this.viewport=n,this.pdfPageRotate=n.rotation,this._optionalContentConfigPromise=s||null,this.maxCanvasPixels=l??S.get("maxCanvasPixels"),this.maxCanvasDim=d||S.get("maxCanvasDim"),this.pageColors=h||null,this.eventBus=e,this.linkService=a,this.renderingQueue=o,this.placeholder=null;const u=this.div=document.createElement("div");u.className="thumbnail",u.setAttribute("page-number",i);const f=this.imageContainer=document.createElement("div");u.append(f),f.classList.add("thumbnailImageContainer","missingThumbnailImage"),f.role="button",f.tabIndex=-1,f.draggable=!1,f.setAttribute("page-number",i),f.setAttribute("data-l10n-id","pdfjs-thumb-page-title1"),f.setAttribute("data-l10n-args",this.#o(!0));const g=this.image=document.createElement("img");if(f.append(g),c){const p=this.checkbox=document.createElement("input");p.type="checkbox",p.tabIndex=-1,p.setAttribute("data-l10n-id","pdfjs-thumb-page-checkbox1"),p.setAttribute("data-l10n-args",this.#o()),u.append(p),this.pasteButton=null}this.#e(),t.append(u)}clone(t,e){const i=new ye({container:t,id:e,eventBus:this.eventBus,defaultViewport:this.viewport,optionalContentConfigPromise:this._optionalContentConfigPromise,linkService:this.linkService,renderingQueue:this.renderingQueue,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,pageColors:this.pageColors,enableSplitMerge:!!this.checkbox}),{imageContainer:n}=this;return n.classList.contains("missingThumbnailImage")||(i.image.replaceWith(this.image.cloneNode(!0)),i.imageContainer.classList.remove("missingThumbnailImage")),i}addPasteButton(t){if(this.pasteButton)return;const e=this.pasteButton=document.createElement("button");e.classList.add("thumbnailPasteButton","viewsManagerButton"),e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-views-manager-paste-button-after"),e.setAttribute("data-l10n-args",this.#o());const i=document.createElement("span");if(i.setAttribute("data-l10n-id","pdfjs-views-manager-paste-button-label"),e.append(i),e.addEventListener("click",()=>{t(this.id)}),this.id===1){const n=this.prevPasteButton=e.cloneNode(!0);n.setAttribute("data-l10n-id","pdfjs-views-manager-paste-button-before"),n.addEventListener("click",()=>{t(0)}),this.imageContainer.before(n)}this.imageContainer.after(e)}removePasteButton(){this.pasteButton?.remove(),this.pasteButton=null,this.prevPasteButton?.remove(),this.prevPasteButton=null}toggleSelected(t){this.checkbox&&(this.checkbox.checked=t)}updateId(t){this.id=t,this.renderingId=`thumbnail${t}`,this.div.setAttribute("page-number",t),this.imageContainer.setAttribute("page-number",t),this.setPageLabel(this.pageLabel)}#e(){const{width:t,height:e}=this.viewport,i=t/e,n=this.canvasWidth=_a,s=this.canvasHeight=n/i|0;this.scale=n/t,this.imageContainer.style.height=`${s}px`}get renderingState(){return this.#t}set renderingState(t){this.#t=t}setPdfPage(t){this.pdfPage=t,this.pdfPageRotate=t.rotate;const e=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:1,rotation:e}),this.reset()}reset(){this.cancelRendering(),this.renderingState=k.INITIAL,this.#e();const{image:t,imageContainer:e}=this,i=t.src;i&&(URL.revokeObjectURL(i),t.src="",e.removeAttribute("data-l10n-id"),e.removeAttribute("data-l10n-args"),e.classList.add("missingThumbnailImage"))}destroy(){this.reset(),this.toggleCurrent(!1),this.div.remove()}update({rotation:t=null}){typeof t=="number"&&(this.rotation=t);const e=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:e}),this.reset()}toggleCurrent(t){const{imageContainer:e}=this;t?(e.ariaCurrent="page",e.tabIndex=0,this.checkbox&&(this.checkbox.tabIndex=0)):(e.ariaCurrent=!1,e.tabIndex=-1,this.checkbox&&(this.checkbox.tabIndex=-1))}cancelRendering(){this.renderTask&&(this.renderTask.cancel(),this.renderTask=null),this.resume=null}#i(t=1){const e=new lt,i=t*this.canvasWidth,n=t*this.canvasHeight;e.limitCanvas(i,n,this.maxCanvasPixels,this.maxCanvasDim);const s=document.createElement("canvas");s.width=i*e.sx|0,s.height=n*e.sy|0;const a=e.scaled?[e.sx,0,0,e.sy,0,0]:null;return{canvas:s,transform:a}}async#s(t){if(this.renderingState!==k.FINISHED)throw new Error("#convertCanvasToImage: Rendering has not finished.");const e=this.#n(t),{imageContainer:i,image:n}=this,{promise:s,resolve:a}=Promise.withResolvers();e.toBlob(a);const o=await s;n.src=URL.createObjectURL(o),n.setAttribute("data-l10n-id","pdfjs-thumb-page-canvas"),n.setAttribute("data-l10n-args",this.#o()),i.classList.remove("missingThumbnailImage")}async draw(){if(this.renderingState!==k.INITIAL){console.error("Must be in new state before drawing");return}const{pageColors:t,pdfPage:e}=this;if(!e)throw this.renderingState=k.FINISHED,new Error("pdfPage is not loaded");this.renderingState=k.RUNNING;const{canvas:i,transform:n}=this.#i(ki),s=this.viewport.clone({scale:ki*this.scale}),a=h=>{if(!this.renderingQueue.isHighestPriority(this)){this.renderingState=k.PAUSED,this.resume=()=>{this.renderingState=k.RUNNING,h()};return}h()},o={canvas:i,transform:n,viewport:s,optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:t},l=this.renderTask=e.render(o);l.onContinue=a;let d=null;try{await l.promise}catch(h){if(h instanceof _t)return;d=h}finally{l===this.renderTask&&(this.renderTask=null)}if(this.renderingState=k.FINISHED,await this.#s(i),this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:e}),d)throw d}setImage(t){if(this.renderingState!==k.INITIAL)return;const{thumbnailCanvas:e,pdfPage:i,scale:n}=t;e&&(this.pdfPage||this.setPdfPage(i),!(n<this.scale)&&(this.renderingState=k.FINISHED,this.#s(e)))}#a(t){const e=t.width<<Bi,i=t.height<<Bi,n=new lt;return n.sx=n.sy=1,n.limitCanvas(e,i,this.maxCanvasPixels,this.maxCanvasDim),[e*n.sx|0,i*n.sy|0]}#n(t){const{canvas:e}=this.#i(1),i=e.getContext("2d",{alpha:!1,willReadFrequently:!1});if(t.width<=2*e.width)return i.drawImage(t,0,0,t.width,t.height,0,0,e.width,e.height),e;let[n,s]=this.#a(e);const[a,o]=Ia(n,s);for(;n>t.width||s>t.height;)n>>=1,s>>=1;for(o.drawImage(t,0,0,t.width,t.height,0,0,n,s);n>2*e.width;)o.drawImage(a,0,0,n,s,0,0,n>>1,s>>1),n>>=1,s>>=1;return i.drawImage(a,0,0,n,s,0,0,e.width,e.height),e}#o(t=!1){return JSON.stringify({page:this.pageLabel??this.id,total:t?this.linkService.pagesCount:void 0})}setPageLabel(t){this.pageLabel=typeof t=="string"?t:null,this.imageContainer.setAttribute("data-l10n-args",this.#o(!0)),this.image.setAttribute("data-l10n-args",this.#o()),this.checkbox?.setAttribute("data-l10n-args",this.#o())}}const xa={behavior:"instant",block:"nearest",inline:"nearest",container:"nearest"},Di=5,Ri=20,ve=15;class ut{static#t=0;#e=!1;#i=!1;#s=null;#a=void 0;#n=!1;#o=null;#r=null;#l=NaN;#d=null;#h=0;#c=0;#f=0;#u=0;#b=0;#g=0;#m=null;#p=NaN;#S=0;#E=0;#v=null;#y=null;#_=null;#w=null;#P=null;#I=null;#C=null;#L=null;#x=null;#k=this.#Tt.bind(this);#T=!1;#A=!1;#F=0;#M=0;#D=null;#V=null;#j=null;#B=null;#O=null;#R=null;#H=null;#z=null;#U=!1;#Y=!1;#N=null;constructor({container:t,eventBus:e,linkService:i,renderingQueue:n,maxCanvasPixels:s,maxCanvasDim:a,pageColors:o,abortSignal:l,enableMerge:d,enableSplitMerge:h,enableNewBadge:c,statusBar:u,undoBar:f,waitingBar:g,manageMenu:p,addFileComponent:b}){if(this.scrollableContainer=t.parentElement,this.container=t,this.eventBus=e,this.linkService=i,this.renderingQueue=n,this.maxCanvasPixels=s,this.maxCanvasDim=a,this.pageColors=o||null,this.#a=l,this.#e=d||!1,this.#i=h||!1,this.#D=u?.viewsManagerStatusActionLabel||null,this.#j=u?.viewsManagerStatusActionDeselectButton||null,this.#V=u?.viewsManagerStatusAction||null,this.#B=f?.viewsManagerStatusUndo||null,this.#O=f?.viewsManagerStatusUndoLabel||null,this.#R=f?.viewsManagerStatusUndoButton||null,this.#H=f?.viewsManagerStatusUndoCloseButton||null,this.#z=g||null,this.#i&&p){const{button:w,menu:C,copy:E,cut:P,delete:v,exportSelected:_}=p;if(c){const T=document.createElement("span");T.setAttribute("data-l10n-id","pdfjs-new-badge-content"),T.classList.add("newBadge"),w.parentElement.before(T),this.#N=T}if(e.on("pagesloaded",()=>{w.disabled=!1},{once:!0,...x}),this._manageMenu=new Mi(C,w,[E,P,v,_]),this.#y=_,_.addEventListener("click",this.#St.bind(this)),this.#_=v,v.addEventListener("click",this.#ct.bind(this,"delete")),this.#w=E,E.addEventListener("click",this.#ht.bind(this)),this.#P=P,P.addEventListener("click",this.#bt.bind(this)),this.#q(!1),w.disabled=!0,e.on("editingaction",({name:T})=>{switch(T){case"copyPage":this.#ht();break;case"cutPage":this.#bt();break;case"deletePage":this.#ct("delete");break;case"savePage":this.#St();break}},x),this.container.addEventListener("contextmenu",T=>{e.dispatch("editingstateschanged",{source:this,details:{thumbnailId:parseInt(T.target.closest(".thumbnailImageContainer")?.parentElement.getAttribute("page-number"),10)??-1,hasSelectedPages:!!this.#d?.size,canDeletePages:this.#lt()}})},{signal:l,passive:!0}),this.#R?.addEventListener("click",this.#Lt.bind(this)),this.#H?.addEventListener("click",this.#Ct.bind(this,!0)),this.#j?.addEventListener("click",()=>{this.#rt(),this.#q(!1),this.#W("select")}),this.#j.classList.toggle("hidden",!0),this.#e&&b){const{picker:T,button:D}=b;T.addEventListener("change",()=>{const y=Array.from(T.files??[]);y.length&&this.#et(y,this._currentPageNumber-1)}),D.addEventListener("click",()=>{T.click()}),this.#z.closeButton?.addEventListener("click",()=>{this.#st("status"),T.value=""})}}else p.button.hidden=!0;this.scroll=Pe(this.scrollableContainer,this.#tt.bind(this),l),this.#G(),this.#At()}#tt(){this.renderingQueue.renderHighestPriority()}async#et(t,e){this.#st("waiting","pdfjs-views-manager-waiting-for-file");const i=[];for(const a of t){const o=a.type?.startsWith("image/");if(!(!o&&a.type!=="application/pdf"&&await a.slice(0,5).text()!=="%PDF-"))if(o){let l;try{l=await ut.#ft(a)}catch{continue}i.push({image:l,insertAfter:e})}else i.push({document:await a.bytes(),insertAfter:e})}if(i.length===0){this.#st("status");return}const n=this.#v.pagesNumber,s=this.hasStructuralChanges()?this.getStructuralChanges():[{document:null}];s.push(...i),this.eventBus.on("pagesloaded",()=>{this.#d=null,this.#wt(),this.#st("status");const o=this.#v.pagesNumber-n;for(let l=e+1,d=e+1+o;l<d;l++)this._thumbnails[l].checkbox.checked=!0,this.#ut(l+1,!0);o&&this.#ot(e+2,!0)},{once:!0,...x}),this.#J({action:"merge"}),this.eventBus.dispatch("saveandload",{source:this,data:s})}getThumbnail(t){return this._thumbnails[t]}#$(){return xe({scrollEl:this.scrollableContainer,views:this._thumbnails})}#it(t){if(!this.pdfDocument)return;this._thumbnails[this._currentPageNumber-1]?.toggleCurrent(!1),this._currentPageNumber=t}scrollThumbnailIntoView(t){if(!this.pdfDocument)return;const e=this._thumbnails[t-1];if(!e){console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}t!==this._currentPageNumber&&(this.#it(t),e.toggleCurrent(!0));const{first:i,last:n,views:s}=this.#$();if(s.length>0){let a=!1;if(t<=i.id||t>=n.id)a=!0;else for(const{id:o,percent:l}of s)if(o===t){a=l<100;break}a&&e.div.scrollIntoView(xa)}this._currentPageNumber=t}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!kt(t))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument||this._pagesRotation===t)return;this._pagesRotation=t;const e={rotation:t};for(const i of this._thumbnails)i.update(e)}cleanup(){for(const t of this._thumbnails)t.renderingState!==k.FINISHED&&t.reset()}#G(){this._thumbnails=[],this._currentPageNumber=1,this._pageLabels=null,this._pagesRotation=0,this.container.textContent=""}setDocument(t){if(this.pdfDocument&&(this.#nt(),this.#G()),this.pdfDocument=t,!t)return;this.#v=t.pagesMapper;const e=t.getPage(1),i=t.getOptionalContentConfig({intent:"display"});e.then(n=>{const s=t.numPages,a=n.getViewport({scale:1}),o=document.createDocumentFragment();for(let d=1;d<=s;++d){const h=new ye({container:o,eventBus:this.eventBus,id:d,defaultViewport:a.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,pageColors:this.pageColors,enableSplitMerge:this.#i});this._thumbnails.push(h)}this._thumbnails[0]?.setPdfPage(n),this._thumbnails[this._currentPageNumber-1].toggleCurrent(!0),this.container.append(o),this.eventBus.dispatch("thumbnailsloaded",{source:this})}).catch(n=>{console.error("Unable to initialize thumbnail viewer",n)})}#nt(){for(const t of this._thumbnails)t.cancelRendering()}setPageLabels(t){if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,i=this._thumbnails.length;e<i;e++)this._thumbnails[e].setPageLabel(this._pageLabels?.[e]??null)}}async#at(t){if(t.pdfPage)return t.pdfPage;try{const e=await this.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(e),e}catch(e){return console.error("Unable to get page for thumb view",e),null}}#X(t){return t.first?.id===1?!0:t.last?.id===this._thumbnails.length?!1:this.scroll.down}forceRendering(){const t=this.#$(),e=this.#X(t),i=this.renderingQueue.getHighestPriority(t,this._thumbnails,e,!1,!0);return i?(this.#at(i).then(()=>{this.renderingQueue.renderView(i)}),!0):!1}hasStructuralChanges(){return this.#v?.hasBeenAltered()||!1}getStructuralChanges(){return this.#v?.getPageMappingForSaving()||null}static#K(t){return ut.#t||=parseFloat(getComputedStyle(t).getPropertyValue("--thumbnail-dragging-scale"))}static#Z(t,e,{minSide:i=0,maxSide:n}){const s=Math.max(t,e);let a=1;return i>0&&s<i?a=i/s:s>n&&(a=n/s),a===1?{width:t,height:e}:{width:Math.max(1,Math.round(t*a)),height:Math.max(1,Math.round(e*a))}}static async#ft(t){if(t.type!=="image/svg+xml"){const s=await createImageBitmap(t),{width:a,height:o}=ut.#Z(s.width,s.height,{maxSide:4096});if(a===s.width&&o===s.height)return s;const l=new OffscreenCanvas(a,o);return l.getContext("2d").drawImage(s,0,0,a,o),s.close(),l.transferToImageBitmap()}const n=URL.createObjectURL(t);try{const s=new Image;s.src=n,await s.decode();const{width:a,height:o}=ut.#Z(s.naturalWidth||1024,s.naturalHeight||1024,{minSide:1024,maxSide:4096}),l=new OffscreenCanvas(a,o);return l.getContext("2d").drawImage(s,0,0,a,o),l.transferToImageBitmap()}finally{URL.revokeObjectURL(n)}}#Q(t){this.#it(0);let e=0;const i=this.#v,n=this.#C=this._thumbnails,s=this._thumbnails=[],a=document.createDocumentFragment(),o=this.#T;for(let l=1,d=i.pagesNumber;l<=d;l++){const h=i.getPrevPageNumber(l);if(h<0){let u=this.#I.get(-h);u.checkbox.checked=!1,o?(u.updateId(l),a.append(u.div)):u=u.clone(a,l),s.push(u);continue}h===t&&(e=l);const c=n[h-1];s.push(c),c.updateId(l),c.checkbox.checked=!1,a.append(c.div)}return this.container.replaceChildren(a),e}#pt(t){this.#E=this.scrollableContainer.scrollTop,this.#S=this.#E+this.scrollableContainer.clientHeight,this.#s=new AbortController,this.container.classList.add("isDragging"),this.#N?.classList.add("hidden");const e=parseInt(t.getAttribute("page-number"),10);this.#l=e-1,this.#d?.has(e)||(this.#p=e,this.#ut(e,!0));for(const i of this.#d){const n=this._thumbnails[i-1],s=n.placeholder=document.createElement("div");s.classList.add("thumbnailImageContainer","placeholder");const{div:a,imageContainer:o}=n;if(a.classList.add("isDragging"),s.style.height=getComputedStyle(o).height,o.after(s),i!==e){o.classList.add("hidden");continue}if(this.#d.size===1){o.classList.add("draggingThumbnail"),this.#o=o;continue}const l=this.#o=document.createElement("div");l.classList.add("draggingThumbnail","thumbnailImageContainer","multiple"),l.style.height=getComputedStyle(o).height,o.replaceWith(l),o.classList.remove("thumbnailImageContainer"),l.append(o),l.setAttribute("data-multiple-count",this.#d.size)}}#mt(t=!1){const e=this.#o;this.#o=null;const i=this.#l;this.#l=NaN,this.#m?.remove(),this.#m=null,this.#s.abort(),this.#s=null,this.#N?.classList.remove("hidden"),this.container.classList.remove("isDragging");for(const s of this.#d){const a=this._thumbnails[s-1],{div:o,placeholder:l,imageContainer:d}=a;l.remove(),d.classList.remove("draggingThumbnail","hidden"),o.classList.remove("isDragging")}if(e.classList.contains("multiple")){const s=e.firstElementChild;e.replaceWith(s),s.classList.add("thumbnailImageContainer")}else e.style.translate="";const n=this.#d;if(!isNaN(i)&&t&&!(n.size===1&&(n.has(i+1)||n.has(i+2)))){this._thumbnails[this._currentPageNumber-1]?.toggleCurrent(!1),this._currentPageNumber=-1;const s=i+1,a=Array.from(n).sort((d,h)=>d-h),o=this.#v,l=isNaN(this.#p)?a[0]:this.#p;o.movePages(n,a,s),this.#ot(this.#Q(l)),this.#r=null,n.clear(),this.#p=NaN,this.#q(!1),this.#W("select"),this.#J({action:"move"}),this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:o,type:"move"})}isNaN(this.#p)||(this.#ut(this.#p,!1),this.#p=NaN)}#rt(){for(const t of this.#d)this._thumbnails[t-1].toggleSelected(!1);this.#d.clear()}#ot(t,e=!1){setTimeout(()=>{this.forceRendering();const i=t||1;this.linkService.goToPage(i);const n=this._thumbnails[i-1];(e||!this.container.contains(document.activeElement))&&n.imageContainer.focus()},0)}#Lt(){if(this.#rt(),this.#q(!1),this.#W("select"),this.#I&&(this.#I=null,this.#v.cancelCopy(),this.#dt(!1),this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:this.#v,type:"cancelCopy"})),this.#T=!1,this.#C){const t=this._thumbnails[this._currentPageNumber-1];t?.toggleCurrent(!1);const e=document.createDocumentFragment();for(let n=1,s=this.#C.length;n<=s;n++){const a=this.#C[n-1];a.updateId(n),a.checkbox.checked=!1,e.append(a.div)}this.container.replaceChildren(e),this._thumbnails=this.#C,this.#C=null;const i=t?this._thumbnails.indexOf(t):-1;this._currentPageNumber=i+1,t?.toggleCurrent(i!==-1),this.#v.cancelDelete(),this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:this.#v,type:"cancelDelete"})}}#Ct(t){if(this.#I=null,this.#L){if(this.#C){for(const e of this.#L)this.#C[e-1].destroy();this.#C=null}this.#L=null}this.#T=!1,t&&this.#W("select"),this.#dt(!1),this.#v.cleanSavedData(),this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:this.#v,type:"cleanSavedData"})}#lt(){const t=this.#d?.size||0;return t>0&&t<this._thumbnails.length}#st(t,e,i){switch(this.#V.classList.toggle("hidden",t!=="status"),this.#z.container.classList.toggle("hidden",t!=="waiting"),this.#B.classList.toggle("hidden",t!=="undo"),this.#Y=t==="undo",t){case"waiting":this.#z.label.setAttribute("data-l10n-id",e);break;case"undo":this.#O.setAttribute("data-l10n-id",e),i&&this.#O.setAttribute("data-l10n-args",JSON.stringify(i));break;case"status":i?this.#D.setAttribute("data-l10n-args",JSON.stringify(i)):this.#D.removeAttribute("data-l10n-args"),this.#N?.classList.toggle("hidden",!!i),this.#j.classList.toggle("hidden",!i);break}}#dt(t){if(this.#U=t,t){this.container.classList.add("pasteMode");for(const e of this._thumbnails)e.addPasteButton(this.#k)}else{this.container.classList.remove("pasteMode");for(const e of this._thumbnails)e.removePasteButton()}}#J(t){this.eventBus.dispatch("reporttelemetry",{source:this,details:{type:"pageOrganization",data:t}})}#St(){this.#J({action:"exportSelected"}),this.eventBus.dispatch("saveextractedpages",{source:this,data:this.#v.extractPages(this.#d)}),this.#rt(),this.#q(!1),this.#W("select")}#ht(t=!0){this.#T||(this.#C=null,this.#J({action:"copy"})),this.#W(this.#T?"cut":"copy");const e=this.#x=Uint32Array.from(this.#d).sort((n,s)=>n-s),i=this.#v;i.copyPages(e),this.#I=new Map;for(const n of e)this.#I.set(n,this._thumbnails[n-1]);this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:i,pageNumbers:e,type:"copy"}),t&&this.#rt(),this.#dt(!0),this.#q(!1)}#bt(){this.#lt()&&(this.#J({action:"cut"}),this.#T=!0,this.#ht(!1),this.#ct("cut"))}#Tt(t){this.#J({action:"paste"});const e=this.#v,i=this.#x.includes(this._currentPageNumber)?0:this._currentPageNumber;e.pastePages(t),this.#Q(i),this.#ot(t+1,!0),this.#r=null,this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:e,hasBeenCut:this.#T,type:"paste"}),this.#I=null,this.#T=!1,this.#dt(!1),this.#q(!1),this.#W("select")}#ct(t="delete"){if(!this.#lt())return;const e=this.#d;t==="delete"&&(this.#J({action:"delete"}),this.#W("delete"));const i=this.#v,n=e.has(this._currentPageNumber)?0:this._currentPageNumber,s=this.#L=Uint32Array.from(e).sort((a,o)=>a-o);i.deletePages(s),this.#ot(this.#Q(n)),this.#r=null,e.clear(),this.#wt(),this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:i,pageNumbers:s,type:t})}#wt(){const t=this.#d?.size||0;this.#y.disabled=this.#w.disabled=!t,this.#_.disabled=this.#P.disabled=!this.#lt()}#q(t){this.#y.disabled=this.#_.disabled=this.#w.disabled=this.#P.disabled=!t}#W(t){if(!this.#V||!this.#B)return;const e=this.#d?.size||0;if(t==="select"){this.#D.setAttribute("data-l10n-id",e?"pdfjs-views-manager-pages-status-action-label":"pdfjs-views-manager-pages-status-none-action-label"),this.#st("status","",e?{count:e}:null);return}let i;switch(t){case"copy":i="pdfjs-views-manager-pages-status-undo-copy-label";break;case"cut":i="pdfjs-views-manager-status-undo-cut-label";break;case"delete":i="pdfjs-views-manager-pages-status-undo-delete-label";break}this.#st("undo",i,{count:e});const n=t==="copy";this.#R.firstElementChild.setAttribute("data-l10n-id",n?"pdfjs-views-manager-status-done-button-label":"pdfjs-views-manager-status-undo-button-label"),this.#H.classList.toggle("hidden",n)}#Pt(t,e){this.#A&&(t=0),(this.#h+t<0||this.#h+this.#f+t>this.#F)&&(t=0),(this.#c+e<0||this.#c+this.#u+e>this.#M)&&(e=0),this.#h+=t,this.#c+=e,this.#b+=t,this.#g+=e,this.#o.style.translate=`${this.#b}px ${this.#g}px`,this.#c+this.#u>this.#S?this.scrollableContainer.scrollTop=Math.min(this.scrollableContainer.scrollTop+Ri,this.#M):this.#c<this.#E&&(this.scrollableContainer.scrollTop=Math.max(this.scrollableContainer.scrollTop-Ri,0));const i=this.#yt(this.#h+this.#f/2,this.#c+this.#u/2);this.#_t(i)}#_t(t){if(!t)return;let e=this.#m;e||(e=this.#m=document.createElement("div"),e.className="dragMarker",this.container.firstChild.before(e));const[i,n]=t,s=e.style,{bbox:a,x:o}=this.#r;let l,d,h,c;i<0?o.length===1?(d=a[1]-ve,l=a[0],h=a[2]):(d=a[1],l=a[0]-ve,c=a[3]):o.length===1?(d=a[i*4+1]+a[i*4+3]+n,l=a[i*4],h=a[i*4+2]):(d=a[i*4+1],l=a[i*4]+a[i*4+2]+n,c=a[i*4+3]),s.translate=`${l}px ${d}px`,s.width=h?`${h}px`:"",s.height=c?`${c}px`:""}#vt(){const t=[],e=[],i=[],n=new Float32Array(this._thumbnails.length*4);let s=-1/0,a=-1/0,o=-1,l,d,h;for(let u=0,f=this._thumbnails.length;u<f;u++){const{div:g}=this._thumbnails[u],{offsetTop:p,offsetLeft:b,offsetWidth:w,offsetHeight:C}=g;if(w===0)return;if(n[u*4]=b,n[u*4+1]=p,n[u*4+2]=w,n[u*4+3]=C,b>s&&(s=b+w/2,l??=s+w,t.push(s)),p>a&&(o===-1&&t.length>1&&(o=f%t.length),a=p+C/2,h??=a+C,e.push(a)),o>0&&u>=f-o){const E=b+w/2;i.push(E),d??=E+w}}let c;t.length>1?c=(t[1]-l)/2:e.length>1?c=(e[1]-h)/2:c=ve,this.#r={x:t,y:e,lastX:i,space:c,lastSpace:i.length?(i.at(-1)-d)/2:c,bbox:n},this.#A=t.length===1,{clientWidth:this.#F,scrollHeight:this.#M}=this.scrollableContainer}#At(){this.eventBus.on("resize",({source:t})=>{t.thumbnailsView===this.container&&this.#vt()},x),this.container.addEventListener("keydown",t=>{const{target:e}=t,i=e instanceof HTMLInputElement&&e.type==="checkbox";switch(t.key){case"ArrowLeft":this.#gt(e,!1,!0,i),L(t);break;case"ArrowRight":this.#gt(e,!0,!0,i),L(t);break;case"ArrowDown":this.#gt(e,!0,!1,i),L(t);break;case"ArrowUp":this.#gt(e,!1,!1,i),L(t);break;case"Home":this.#Et(this._thumbnails[0],i),L(t);break;case"End":this.#Et(this._thumbnails.at(-1),i),L(t);break;case"Enter":case" ":i||this.#xt(t);break;case"c":this.#i&&(t.ctrlKey||t.metaKey)&&this.#d?.size&&(this.#ht(),L(t));break;case"x":this.#i&&(t.ctrlKey||t.metaKey)&&this.#d?.size&&(this.#bt(),L(t));break;case"Delete":case"Backspace":this.#i&&!this.#U&&this.#d?.size&&(this.#ct(),L(t));break}}),this.container.addEventListener("click",t=>{const{target:e}=t;if(e instanceof HTMLInputElement){const i=parseInt(e.parentElement.getAttribute("page-number"),10);this.#ut(i,e.checked);return}this.#xt(t)}),this.#Nt(),this.#Mt()}#ut(t,e){this.#Y&&this.#Ct(!1);const i=this.#d??=new Set;e?i.add(t):i.delete(t),this.#wt(),this.#W("select")}#Nt(){this.#i&&this.container.addEventListener("pointerdown",t=>{const{target:e,clientX:i,clientY:n,pointerId:s}=t;if(t.button!==0||this.#U||this._thumbnails.length===1||!isNaN(this.#l)||!e.classList.contains("thumbnailImageContainer"))return;const a=e.parentElement,o=new AbortController,{signal:l}=o;let d=i,h=n,c=this.scrollableContainer.scrollTop;const u=ut.#K(e);this.#g=((u-1)*t.layerY+e.offsetTop)/u,this.#A?this.#b=e.offsetLeft+(u-1)*.5*e.offsetWidth/u:this.#b=((u-1)*t.layerX+e.offsetLeft)/u,this.#h=a.offsetLeft+this.#b,this.#c=a.offsetTop+this.#g,this.#f=e.offsetWidth/u,this.#u=e.offsetHeight/u,this.container.addEventListener("pointermove",f=>{const{clientX:g,clientY:p,pointerId:b}=f;if(isNaN(this.#l)){if(b!==s||Math.abs(g-i)<=Di&&Math.abs(p-n)<=Di)return;this.#pt(a);const E=(v,_=!1)=>{this.#mt(_),o.abort()},{signal:P}=this.#s;window.addEventListener("touchmove",L,{passive:!1,signal:P}),window.addEventListener("contextmenu",q,{signal:P}),this.scrollableContainer.addEventListener("scrollend",()=>{const{scrollableContainer:{clientHeight:v,scrollTop:_}}=this;this.#E=_,this.#S=_+v;const T=_-c;c=_,this.#Pt(0,T)},{passive:!0,signal:P}),window.addEventListener("pointerup",v=>{v.pointerId===s&&(window.addEventListener("click",L,{capture:!0,once:!0,signal:P}),L(v),E(v,!0))},{signal:P}),window.addEventListener("blur",E,{signal:P}),window.addEventListener("pointercancel",E,{signal:P}),window.addEventListener("wheel",L,{passive:!1,signal:P}),window.addEventListener("keydown",v=>{v.key==="Escape"&&!isNaN(this.#l)&&E(v)},{signal:P})}const w=g-d,C=p-h;d=g,h=p,this.#Pt(w,C)},{passive:!0,signal:l}),window.addEventListener("pointerup",({pointerId:f})=>{f===s&&o.abort()},{signal:l}),window.addEventListener("dragstart",L,{capture:!0,signal:l})})}#Mt(){if(!this.#e)return;const t=this.container,e=this.#a,i=s=>{if(!s)return!1;for(const a of s.items)if(a.kind==="file"&&(a.type==="application/pdf"||a.type.startsWith("image/")))return!0;return!1},n=({clientX:s,clientY:a})=>{const{left:o,right:l,top:d,bottom:h}=t.getBoundingClientRect();return s>=o&&s<l&&a>=d&&a<h};t.addEventListener("dragenter",s=>{this.#n||!isNaN(this.#l)||!this._thumbnails.length||!i(s.dataTransfer)||(s.preventDefault(),s.stopPropagation(),s.dataTransfer.dropEffect="copy",this.#n=!0,this.container.classList.add("isDraggingFile"),this.#r=null,this.#vt(),this.#l=NaN)},{signal:e}),t.addEventListener("dragover",s=>{if(!this.#n||(s.preventDefault(),s.stopPropagation(),s.dataTransfer.dropEffect="copy",!this.#r))return;const a=t.getBoundingClientRect(),o=s.clientX-a.left,l=s.clientY-a.top,d=this.#yt(o,l);this.#_t(d)},{signal:e}),t.addEventListener("dragleave",s=>{this.#n&&(s.relatedTarget&&t.contains(s.relatedTarget)||n(s)||this.#It())},{signal:e}),t.addEventListener("drop",s=>{if(!this.#n)return;s.preventDefault(),s.stopPropagation();const a=Array.from(s.dataTransfer.files??[]);if(isNaN(this.#l)&&this.#r){const l=t.getBoundingClientRect();this.#yt(s.clientX-l.left,s.clientY-l.top)}const o=isNaN(this.#l)?-1:this.#l;this.#It(),a.length&&this.#et(a,o)},{signal:e})}#It(){this.#n=!1,this.container.classList.remove("isDraggingFile"),this.#m?.remove(),this.#m=null,this.#l=NaN}#xt(t){const e=t.target.closest(".thumbnailImageContainer");if(e){const i=parseInt(e.getAttribute("page-number"),10);this.linkService.goToPage(i),L(t)}}#Et(t,e){e&&t.checkbox?t.checkbox.focus():t.imageContainer.focus()}#gt(t,e,i,n=!1){let s=parseInt(t.parentElement.getAttribute("page-number"),10);isNaN(s)&&(s=this._currentPageNumber);const a=e?1:-1;let o;if(i){const l=Pt(s+a,1,this._thumbnails.length+1);o=this._thumbnails[l-1]}else{const l=this._thumbnails[s-1],{x:d,y:h}=l.div.getBoundingClientRect();let c;for(let u=s-1+a;u>=0&&u<this._thumbnails.length;u+=a){const f=this._thumbnails[u],{x:g,y:p}=f.div.getBoundingClientRect();if(!c&&p!==h&&(c=f),g===d){o=f;break}}o??=c}o&&this.#Et(o,n)}#yt(t,e){this.#r||this.#vt();const{x:i,y:n,lastX:s,space:a,lastSpace:o}=this.#r,l=this.#l;let d=l%i.length,h=Math.floor(l/i.length),c=h===n.length-1?s:i;if(n[h]<=e&&e<(n[h+1]??1/0)&&c[d]<=t&&t<(c[d+1]??1/0))return null;let u;if(h=Y(n,g=>e<g),this.#A)u=h-1;else{if(h===n.length)h=n.length-1;else{const g=Math.abs(n[h-1]-e),p=Math.abs(n[h]-e);h=g<p?h-1:h}c=h===n.length-1&&s.length>0?s:i,d=Y(c,g=>t<g)-1,h<0&&(d<=0&&(d=-1),h=0),u=Pt(h*i.length+d,-1,this._thumbnails.length-1)}if(u===l)return null;this.#l=u;const f=h===n.length-1&&s.length>0&&d>=0?o:a;return[u,f]}}class La{#t=null;#e=null;#i=null;#s=null;#a=null;#n;constructor(t){this.pageIndex=t.pageIndex,this.accessibilityManager=t.accessibilityManager,this.l10n=t.l10n,this.l10n||=new st,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#n=t.uiManager,this.#t=t.annotationLayer||null,this.#a=t.textLayer||null,this.#e=t.drawLayer||null,this.#i=t.onAppend||null,this.#s=t.structTreeLayer||null}updatePageIndex(t){this.pageIndex=t,this.annotationEditorLayer?.updatePageIndex(t)}async render({viewport:t,intent:e="display"}){if(e!=="display"||this._cancelled)return;const i=t.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:i}),this.show();return}const n=this.div=document.createElement("div");n.className="annotationEditorLayer",n.hidden=!0,n.dir=this.#n.direction,this.#i?.(n),this.annotationEditorLayer=new on({uiManager:this.#n,div:n,structTreeLayer:this.#s,accessibilityManager:this.accessibilityManager,pageIndex:this.pageIndex,l10n:this.l10n,viewport:i,annotationLayer:this.#t,textLayer:this.#a,drawLayer:this.#e});const s={viewport:i,div:n,annotations:null,intent:e};await this.annotationEditorLayer.render(s),this.show()}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}}class Ta{#t=null;#e=null;#i=null;#s=null;#a=!1;constructor({pdfPage:t,linkService:e,downloadManager:i,annotationStorage:n=null,imageResourcesPath:s="",renderForms:a=!0,enableComment:o=!1,commentManager:l=null,enableScripting:d=!1,hasJSActionsPromise:h=null,fieldObjectsPromise:c=null,annotationCanvasMap:u=null,accessibilityManager:f=null,annotationEditorUIManager:g=null,onAppend:p=null}){this.pdfPage=t,this.linkService=e,this.downloadManager=i,this.imageResourcesPath=s,this.renderForms=a,this.annotationStorage=n,this.enableComment=o,this.#e=l,this.enableScripting=d,this._hasJSActionsPromise=h||Promise.resolve(!1),this._fieldObjectsPromise=c||Promise.resolve(null),this._annotationCanvasMap=u,this._accessibilityManager=f,this._annotationEditorUIManager=g,this.#i=p,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=e.eventBus}async render({viewport:t,intent:e="display",structTreeLayer:i=null,optionalContentConfigPromise:n=null}){if(this.div){const h=await n;if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:t.clone({dontFlip:!0}),optionalContentConfig:h});return}const[s,a,o,l]=await Promise.all([this.pdfPage.getAnnotations({intent:e}),this._hasJSActionsPromise,this._fieldObjectsPromise,n]);if(this._cancelled)return;const d=this.div=document.createElement("div");if(d.className="annotationLayer",this.#i?.(d),this.#n(t,i),s.length===0){this.#t=s,He(this.div,t);return}await this.annotationLayer.render({annotations:s,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:a,fieldObjects:o,optionalContentConfig:l}),this.#t=s,this.linkService.isInPresentationMode&&this.#o(H.FULLSCREEN),this.#s||(this.#s=new AbortController,this._eventBus?.on("presentationmodechanged",h=>{this.#o(h.state)},{signal:this.#s.signal,...x}))}#n(t,e){this.annotationLayer=new dn({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:t.clone({dontFlip:!0}),structTreeLayer:e,commentManager:this.#e,linkService:this.linkService})}cancel(){this._cancelled=!0,this.#s?.abort(),this.#s=null,this.annotationLayer?.destroy()}refreshCanvases(){this.annotationLayer?.refreshCanvases()}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}async injectLinkAnnotations(t){if(this.#t===null)throw new Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||this.#a)return;this.#a=!0;const e=this.#t.length?this.#r(t):t;e.length&&await this.annotationLayer.addLinkAnnotations(e)}#o(t){if(!this.div)return;let e=!1;switch(t){case H.FULLSCREEN:e=!0;break;case H.NORMAL:break;default:return}for(const i of this.div.childNodes)i.hasAttribute("data-internal-link")||i.classList.contains("mediaAnnotation")||(i.inert=e)}#r(t){function e(s){if(!s.quadPoints)return[s.rect];const a=[];for(let o=2,l=s.quadPoints.length;o<l;o+=8){const d=s.quadPoints[o],h=s.quadPoints[o+1],c=s.quadPoints[o+2],u=s.quadPoints[o+3];a.push([c,u,d,h])}return a}function i(s,a){const o=[],l=e(s),d=e(a);for(const h of l)for(const c of d){const u=dt.intersect(h,c);u&&o.push(u)}return o}function n(s){let a=0;for(const o of s)a+=Math.abs((o[2]-o[0])*(o[3]-o[1]));return a}return t.filter(s=>{let a;for(const o of this.#t){if(o.annotationType!==ke.LINK)continue;const l=i(o,s);if(l.length!==0&&(a??=n(e(s)),n(l)/a>.5))return!1}return!0})}}function Oi({width:r,height:t,left:e,top:i},n){if(r===0||t===0)return null;const s=n.textLayer.div.getBoundingClientRect(),a=n.getPagePoint(e-s.left,i-s.top),o=n.getPagePoint(e-s.left+r,i-s.top+t);return dt.normalizeRect([a[0],a[1],o[0],o[1]])}function Aa(r,t){const e=r.getClientRects();if(e.length===1)return{rect:Oi(e[0],t)};const i=[1/0,1/0,-1/0,-1/0],n=[];let s=0;for(const a of e){const o=Oi(a,t);o!==null&&(n[s]=n[s+4]=o[0],n[s+1]=n[s+3]=o[3],n[s+2]=n[s+6]=o[2],n[s+5]=n[s+7]=o[1],dt.rectBoundingBox(...o,i),s+=8)}return{quadPoints:n,rect:i}}function Fi(r,t){let e=r;do{if(e.nodeType===Node.TEXT_NODE){const i=e.textContent.length;if(t<=i)return[e,t];t-=i}else if(e.firstChild){e=e.firstChild;continue}for(;!e.nextSibling&&e!==r;)e=e.parentNode;e!==r&&(e=e.nextSibling)}while(e!==r);throw new Error("Offset is bigger than container's contents length.")}function Na({url:r,index:t,length:e},i,n){const s=i._textHighlighter,[{begin:a,end:o}]=s._convertMatches([t],[e]),l=new Range;return l.setStart(...Fi(s.textDivs[a.divIdx],a.offset)),l.setEnd(...Fi(s.textDivs[o.divIdx],o.offset)),{id:`inferred_link_${n}`,unsafeUrl:r,url:r,annotationType:ke.LINK,rotation:0,...Aa(l,i),borderStyle:null}}class Ma{static#t=0;static#e;static#i;static findLinks(t){this.#e??=new RegExp("\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|(?=\\p{L})[\\S--[@\\p{Ps}\\p{Pe}<>]]+@([\\S--[[\\p{P}--\\-]<>]]+(?:\\.[\\S--[[\\p{P}--\\-]<>]]+)+)","gv");const[e,i]=Ht(t,{ignoreDashEOL:!0}),n=e.matchAll(this.#e),s=[];for(const a of n){const[o,l]=a;let d;if(o.startsWith("www.")||o.startsWith("http://")||o.startsWith("https://"))d=o;else if(l){const c=URL.parse(`http://${l}`)?.hostname;if(!c||(this.#i??=/\.\d+$/,this.#i.test(c)))continue}d??=o.startsWith("mailto:")?o:`mailto:${o}`;const h=De(d,null,{addDefaultProtocol:!0});if(h){const[c,u]=Ci(i,a.index,o.length);s.push({url:h.href,index:c,length:u})}}return s}static processLinks(t){return this.findLinks(t._textHighlighter.textContentItemsStr.join(`
|
|
551
|
+
`)).map(e=>Na(e,t,this.#t++))}}class ji extends Ti{#t=null;#e=null;#i=k.INITIAL;#s=null;#a=0;#n=null;canvas=null;div=null;enableOptimizedPartialRendering=!1;enableSelectionRendering=!0;imagesRightClickMinSize=-1;eventBus=null;id=null;imageCoordinates=null;pageColors=null;recordedBBoxes=null;renderingQueue=null;constructor(t){super(),this.eventBus=t.eventBus,this.id=t.id,this.pageColors=t.pageColors||null,this.renderingQueue=t.renderingQueue,this.enableOptimizedPartialRendering=t.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=t.enableSelectionRendering!==!1&&Rt.isBackdropFilterSupported,this.imagesRightClickMinSize=t.imagesRightClickMinSize??-1,this.minDurationToUpdateCanvas=t.minDurationToUpdateCanvas??500}get renderingState(){return this.#i}set renderingState(t){if(t!==this.#i)switch(this.#i=t,this.#t&&(clearTimeout(this.#t),this.#t=null),t){case k.PAUSED:this.div.classList.remove("loading"),this.#a=0,this.#s?.(!1);break;case k.RUNNING:this.div.classList.add("loadingIcon"),this.#t=setTimeout(()=>{this.div.classList.add("loading"),this.#t=null},0),this.#a=Date.now();break;case k.INITIAL:case k.FINISHED:this.div.classList.remove("loadingIcon","loading"),this.#a=0;break}}_createCanvas(t,e=!1){const{pageColors:i}=this,n=!!(i?.background&&i?.foreground),s=this.canvas,a=!s&&!n&&!e;let o=this.canvas=document.createElement("canvas");return this.#s=l=>{if(a){let d=this.#n;if(!l&&this.minDurationToUpdateCanvas>0){if(Date.now()-this.#a<this.minDurationToUpdateCanvas)return;d||(d=this.#n=o,o=this.canvas=o.cloneNode(!1),t(o))}if(d){o.getContext("2d",{alpha:!1}).drawImage(d,0,0),l?this.#r():this.#a=Date.now();return}t(o),this.#s=null;return}l&&(s?(s.replaceWith(o),s.width=s.height=0):t(o))},{canvas:o,prevCanvas:s}}#o=t=>{if(this.#s?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=k.PAUSED,this.resume=()=>{this.renderingState=k.RUNNING,t()};return}t()};_resetCanvas(){const{canvas:t}=this;t&&(t.remove(),t.width=t.height=0,this.canvas=null,this.#r())}#r(){this.#n&&(this.#n.width=this.#n.height=0,this.#n=null)}async _drawCanvas(t,e,i){const n=this.renderTask=this.pdfPage.render(t);n.onContinue=this.#o,n.onError=a=>{a instanceof _t&&(e(),this.#e=null)};let s=null;try{await n.promise,this.#s?.(!0)}catch(a){if(a instanceof _t)return;s=a,this.#s?.(!0)}finally{this.#e=s,n===this.renderTask&&(this.renderTask=null,this.enableOptimizedPartialRendering&&(this.recordedBBoxes??=n.recordedBBoxes),this.imagesRightClickMinSize!==-1&&(this.imageCoordinates??=this.pdfPage.imageCoordinates))}if(this.renderingState=k.FINISHED,i(n),s)throw s}cancelRendering({cancelExtraDelay:t=0}={}){this.renderTask&&(this.renderTask.cancel(t),this.renderTask=null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(t,e){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:t,isDetailView:e,timestamp:performance.now(),error:this.#e})}}class ka{#t=null;constructor(t){this.pageIndex=t.pageIndex,this.textLayer=t.textLayer||null,this.filterFactory=t.filterFactory||null,this.pageColors=t.pageColors||null}async render({intent:t="display"}){t!=="display"||this.#t||this._cancelled||(this.#t=new gn({pageIndex:this.pageIndex,textLayer:this.textLayer,filterFactory:this.filterFactory,pageColors:this.pageColors}))}cancel(){this._cancelled=!0,this.#t?.destroy(),this.#t=null}setParent(t){this.#t?.setParent(t)}getDrawLayer(){return this.#t}}class Ba extends ji{#t=null;renderingCancelled=!1;constructor({pageView:t}){super(t),this.pageView=t,this.renderingId="detail"+this.id,this.div=t.div}setPdfPage(t){this.pageView.setPdfPage(t)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(t){this.renderingCancelled=!1,super.renderingState=t}reset({keepCanvas:t=!1}={}){const e=this.renderingCancelled||this.renderingState===k.RUNNING||this.renderingState===k.PAUSED;this.cancelRendering(),this.renderingState=k.INITIAL,this.renderingCancelled=e,t||this._resetCanvas()}#e(t){if(!this.#t)return!0;const e=this.#t.minX,i=this.#t.minY,n=this.#t.width+e,s=this.#t.height+i;if(t.minX<e||t.minY<i||t.maxX>n||t.maxY>s)return!0;const{width:a,height:o,scale:l}=this.pageView.viewport;if(this.#t.scale!==l)return!0;const d=t.minX-e,h=n-t.maxX,c=t.minY-i,u=s-t.maxY,f=.5,g=(1+f)/f;return e>0&&h/d>g||n<a&&d/h>g||i>0&&u/c>g||s<o&&c/u>g}update({visibleArea:t=null,underlyingViewUpdated:e=!1}={}){if(e){this.cancelRendering(),this.renderingState=k.INITIAL;return}if(!this.#e(t))return;const{viewport:i,maxCanvasPixels:n,capCanvasAreaFactor:s}=this.pageView,a=t.maxX-t.minX,o=t.maxY-t.minY,l=a*o*lt.pixelRatio**2,h=(Math.sqrt(lt.capPixels(n,s)/l)-1)/2;let c=Math.min(1,h);c<0&&(c=0);const u=a*c,f=o*c,g=Math.max(0,t.minX-u),p=Math.min(i.width,t.maxX+u),b=Math.max(0,t.minY-f),w=Math.min(i.height,t.maxY+f),C=p-g,E=w-b;this.#t={minX:g,minY:b,width:C,height:E,scale:i.scale},this.reset({keepCanvas:!0})}_getRenderingContext(t,e){const i=this.pageView._getRenderingContext(t,e,!1),n=this.pdfPage.recordedBBoxes;if(!n||!this.enableOptimizedPartialRendering)return i;const{viewport:{width:s,height:a}}=this.pageView,{width:o,height:l,minX:d,minY:h}=this.#t,c=d/s,u=h/a,f=(d+o)/s,g=(h+l)/a;return{...i,operationsFilter(p){return n.isEmpty(p)?!1:n.minX(p)<=f&&n.maxX(p)>=c&&n.minY(p)<=g&&n.maxY(p)>=u}}}async draw(){if(this.pageView.detailView!==this)return;const t=this.pageView.renderingState===k.FINISHED||this.renderingState===k.FINISHED;this.renderingState!==k.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,pdfPage:i,viewport:n}=this.pageView;if(!i)throw this.renderingState=k.FINISHED,new Error("pdfPage is not loaded");this.renderingState=k.RUNNING;const s=this.pageView._ensureCanvasWrapper(),{canvas:a,prevCanvas:o}=this._createCanvas(p=>{s.firstElementChild?.tagName==="CANVAS"?s.firstElementChild.after(p):s.prepend(p)},t);a.ariaHidden=!0,this.enableOptimizedPartialRendering&&(a.className="detailView");const{width:l,height:d}=n,h=this.#t,{pixelRatio:c}=lt,u=[c,0,0,c,-h.minX*c,-h.minY*c];a.width=h.width*c,a.height=h.height*c;const{style:f}=a;f.width=`${h.width*100/l}%`,f.height=`${h.height*100/d}%`,f.top=`${h.minY*100/d}%`,f.left=`${h.minX*100/l}%`;const g=this._drawCanvas(this._getRenderingContext(a,u),()=>{this.canvas?.remove(),this.canvas=o},()=>{this.pageView._refreshAnnotationLayer(),this.dispatchPageRendered(!1,!0)});return e.setAttribute("data-loaded",!0),this.dispatchPageRender(),g}}const Vi={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"rowgroup",TBody:"rowgroup",TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Ui=new Set(["math","merror","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mprescripts","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msubsup","msup","mtable","mtd","mtext","mtr","munder","munderover","semantics"]),zt="http://www.w3.org/1998/Math/MathML";class Hi{static get sanitizer(){return z(this,"sanitizer",Rt.isSanitizerSupported?new Sanitizer({elements:Array.from(Ui.keys(),t=>({name:t,namespace:zt})),replaceWithChildrenElements:[{name:"maction",namespace:zt}],attributes:["dir","displaystyle","mathbackground","mathcolor","mathsize","scriptlevel","encoding","display","linethickness","intent","arg","form","fence","separator","lspace","rspace","stretchy","symmetric","maxsize","minsize","largeop","movablelimits","width","height","depth","voffset","accent","accentunder","columnspan","rowspan"],comments:!1}):null)}}const Da=/^H(\d+)$/;class Ra{#t;#e=null;#i;#s=new Map;#a;#n=null;#o=null;#r=null;constructor(t,e){this.#t=t.getStructTree(),this.#a=e}async render(){if(this.#i)return this.#i;const{promise:t,resolve:e,reject:i}=Promise.withResolvers();this.#i=t;try{this.#e=this.#c(await this.#t)}catch(n){i(n)}return this.#t=null,this.#e?.classList.add("structTree"),e(this.#e),t}async getAriaAttributes(t){try{return await this.render(),this.#s.get(t)}catch{}return null}hide(){this.#e&&!this.#e.hidden&&(this.#e.hidden=!0)}show(){this.#e?.hidden&&(this.#e.hidden=!1)}#l(t,e){const{alt:i,id:n,lang:s}=t;if(i!==void 0){let a=!1;const o=gt(i);for(const l of t.children)l.type==="annotation"&&(this.#s.getOrInsertComputed(l.id,Cn).set("aria-label",o),a=!0);a||e.setAttribute("aria-label",o)}n!==void 0&&e.setAttribute("aria-owns",n),s!==void 0&&e.setAttribute("lang",gt(s,!0))}#d(t,e){const{alt:i,bbox:n,children:s}=t,a=s?.[0];if(!this.#a||!i||!n||a?.type!=="content")return!1;const{id:o}=a;if(!o)return!1;e.setAttribute("aria-owns",o);const l=document.createElement("span");(this.#n||=new Map).set(o,l),l.setAttribute("role","img"),l.setAttribute("aria-label",gt(i));const{pageHeight:d,pageX:h,pageY:c}=this.#a,u="calc(var(--total-scale-factor) *",{style:f}=l;return f.width=`${u}${n[2]-n[0]}px)`,f.height=`${u}${n[3]-n[1]}px)`,f.left=`${u}${n[0]-h}px)`,f.top=`${u}${d-n[3]+c}px)`,!0}updateTextLayer(){if(this.#n){for(const[t,e]of this.#n)document.getElementById(t)?.append(e);this.#n.clear(),this.#n=null}if(this.#o){for(const t of this.#o){const e=document.getElementById(t);e&&(e.ariaHidden=!0)}this.#o.length=0,this.#o=null}if(this.#r){for(let t=0,e=this.#r.length;t<e;t+=2){const i=this.#r[t],n=this.#r[t+1];let s="";for(const a of n){const o=document.getElementById(a);o&&(s+=o.textContent.trim()||"",o.ariaHidden="true")}s&&(i.textContent=s)}this.#r.length=0,this.#r=null}}#h(t,e){if(t){"id"in t&&e.push(t.id);for(const i of t.children||[])this.#h(i,e)}}#c(t,e=[]){if(!t)return null;let i,n=!0;if("role"in t){const{role:s}=t;if(Ui.has(s)){i=document.createElementNS(zt,s);const o=[];(this.#r||=[]).push(i,o);for(const{type:l,id:d}of t.children||[])l==="content"&&d&&o.push(d)}else i=document.createElement("span");const a=s.match(Da);if(a?(i.setAttribute("role","heading"),i.setAttribute("aria-level",a[1])):Vi[s]&&i.setAttribute("role",s==="TH"&&e.at(-1)?.role==="TR"&&e.at(-2)?.role==="TBody"?"rowheader":Vi[s]),s==="Figure"&&this.#d(t,i))return i;s==="Formula"&&(t.mathML&&Hi.sanitizer&&(n=!1,i.setHTML(t.mathML,{sanitizer:Hi.sanitizer}),this.#h(t,this.#o||=[]),delete t.alt),!t.mathML&&t.children.length===1&&t.children[0].role!=="math"&&(i=document.createElementNS(zt,"math"),delete t.alt))}if(i||=document.createElement("span"),this.#l(t,i),t.children){if(t.children.length===1&&"id"in t.children[0])this.#l(t.children[0],i);else if(n){e.push(t);for(const s of t.children)i.append(this.#c(s,e));e.pop()}}return i}}class At{#t=!1;#e=null;#i=new Map;#s=new Map;setTextMapping(t){this.#e=t}static#a(t,e){const i=t.getBoundingClientRect(),n=e.getBoundingClientRect();if(i.width===0&&i.height===0)return 1;if(n.width===0&&n.height===0)return-1;const s=i.y,a=i.y+i.height,o=i.y+i.height/2,l=n.y,d=n.y+n.height,h=n.y+n.height/2;if(o<=l&&h>=a)return-1;if(h<=s&&o>=d)return 1;const c=i.x+i.width/2,u=n.x+n.width/2;return c-u}enable(){if(this.#t)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#e)throw new Error("Text divs and strings have not been set.");if(this.#t=!0,this.#e=this.#e.slice(),this.#e.sort(At.#a),this.#i.size>0){const t=this.#e;for(const[e,i]of this.#i){if(!document.getElementById(e)){this.#i.delete(e);continue}this.#n(e,t[i])}}for(const[t,e]of this.#s)this.addPointerInTextLayer(t,e);this.#s.clear()}disable(){this.#t&&(this.#s.clear(),this.#e=null,this.#t=!1)}removePointerInTextLayer(t){if(!this.#t){this.#s.delete(t);return}const e=this.#e;if(!e?.length)return;const{id:i}=t,n=this.#i.get(i);if(n===void 0)return;const s=e[n];this.#i.delete(i);let a=s.getAttribute("aria-owns");a?.includes(i)&&(a=a.split(" ").filter(o=>o!==i).join(" "),a?s.setAttribute("aria-owns",a):(s.removeAttribute("aria-owns"),s.setAttribute("role","presentation")))}#n(t,e){const i=e.getAttribute("aria-owns");i?.includes(t)||e.setAttribute("aria-owns",i?`${i} ${t}`:t),e.removeAttribute("role")}addPointerInTextLayer(t,e){const{id:i}=t;if(!i)return null;if(!this.#t)return this.#s.set(t,e),null;e&&this.removePointerInTextLayer(t);const n=this.#e;if(!n?.length)return null;const s=Y(n,d=>At.#a(t,d)<0),a=Math.max(0,s-1),o=n[a];this.#n(i,o),this.#i.set(i,a);const l=o.parentNode;return l?.classList.contains("markedContent")?l.id:null}moveElementInDOM(t,e,i,n){const s=this.addPointerInTextLayer(i,n);if(!t.hasChildNodes())return t.append(e),s;const a=Array.from(t.childNodes).filter(l=>l!==e);if(a.length===0)return s;const o=Y(a,l=>At.#a(e,l)<0);return o===0?a[0].before(e):a[o-1].after(e),s}}class Oa{#t=null;constructor({findController:t,eventBus:e,pageIndex:i}){this.findController=t,this.matches=[],this.eventBus=e,this.pageIdx=i,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(t,e){this.textDivs=t,this.textContentItemsStr=e}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this.#t||(this.#t=new AbortController,this.eventBus.on("updatetextlayermatches",t=>{(t.pageIndex===this.pageIdx||t.pageIndex===-1)&&this._updateMatches()},{signal:this.#t.signal,...x})),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this.#t?.abort(),this.#t=null,this._updateMatches(!0))}_convertMatches(t,e){if(!t)return[];const{textContentItemsStr:i}=this;let n=0,s=0;const a=i.length-1,o=[];for(let l=0,d=t.length;l<d;l++){let h=t[l];for(;n!==a&&h>=s+i[n].length;)s+=i[n].length,n++;n===i.length&&console.error("Could not find a matching mapping");const c={begin:{divIdx:n,offset:h-s}};for(h+=e[l];n!==a&&h>s+i[n].length;)s+=i[n].length,n++;c.end={divIdx:n,offset:h-s},o.push(c)}return o}_renderMatches(t){if(t.length===0)return;const{findController:e,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,a=i===e.selected.pageIdx,o=e.selected.matchIdx,l=e.state.highlightAll;let d=null;const h={divIdx:-1,offset:void 0};function c(w,C){const E=w.divIdx;return s[E].textContent="",u(E,0,w.offset,C)}function u(w,C,E,P){let v=s[w];if(v.nodeType===Node.TEXT_NODE){const D=document.createElement("span");v.before(D),D.append(v),s[w]=D,v=D}const _=n[w].substring(C,E),T=document.createTextNode(_);if(P){const D=document.createElement("span");return D.className=`${P} appended`,D.append(T),v.append(D),P.includes("selected")?D:null}return v.append(T),0}let f=o,g=f+1;if(l)f=0,g=t.length;else if(!a)return;let p=-1,b=-1;for(let w=f;w<g;w++){const C=t[w],E=C.begin;if(E.divIdx===p&&E.offset===b)continue;p=E.divIdx,b=E.offset;const P=C.end,v=a&&w===o,_=v?" selected":"";let T=null;if(!d||E.divIdx!==d.divIdx?(d!==null&&u(d.divIdx,d.offset,h.offset),c(E)):u(d.divIdx,d.offset,E.offset),E.divIdx===P.divIdx)T=u(E.divIdx,E.offset,P.offset,"highlight"+_);else{T=u(E.divIdx,E.offset,h.offset,"highlight begin"+_);for(let D=E.divIdx+1,y=P.divIdx;D<y;D++)s[D].className="highlight middle"+_;c(P,"highlight end"+_)}d=P,v&&e.scrollMatchIntoView({element:T,pageIndex:i,matchIndex:o})}d&&u(d.divIdx,d.offset,h.offset)}_updateMatches(t=!1){if(!this.enabled&&!t)return;const{findController:e,matches:i,pageIdx:n}=this,{textContentItemsStr:s,textDivs:a}=this;let o=-1;for(const h of i){const c=Math.max(o,h.begin.divIdx);for(let u=c,f=h.end.divIdx;u<=f;u++){const g=a[u];g.textContent=s[u],g.className=""}o=h.end.divIdx+1}if(!e?.highlightMatches||t)return;const l=e.pageMatches[n]||null,d=e.pageMatchesLength[n]||null;this.matches=this._convertMatches(l,d),this._renderMatches(this.matches)}}class Nt{#t=null;#e=!1;#i=null;#s=!1;#a=null;static#n=new Map;static#o=null;constructor({pdfPage:t,highlighter:e=null,accessibilityManager:i=null,enablePermissions:n=!1,onAppend:s=null,abortSignal:a=null}){this.pdfPage=t,this.highlighter=e,this.accessibilityManager=i,this.#e=n===!0,this.#i=s,this.#t=a,this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}async render({viewport:t,images:e,textContentParams:i=null}){if(this.#s&&this.#a){this.#a.update({viewport:t,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),this.#a=new Ln({textContentSource:this.pdfPage.streamTextContent(i||{includeMarkedContent:!0,disableNormalization:!0}),images:e,container:this.div,viewport:t});const{textDivs:n,textContentItemsStr:s}=this.#a;this.highlighter?.setTextMapping(n,s),this.accessibilityManager?.setTextMapping(n),await this.#a.render(),this.#s=!0;const a=document.createElement("div");a.className="endOfContent",this.div.append(a),this.#r(a),this.#i?.(this.div),this.highlighter?.enable(),this.accessibilityManager?.enable()}hide(){!this.div.hidden&&this.#s&&(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.#s&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.#a?.cancel(),this.#a=null,this.#s=!1,this.div.replaceChildren(),this.highlighter?.disable(),this.accessibilityManager?.disable(),Nt.#l(this.div)}#r(t){const{div:e}=this,i=this.#t,n=i?{signal:i}:null;e.addEventListener("mousedown",()=>{e.classList.add("selecting")},n),e.addEventListener("copy",s=>{if(!this.#e){const a=document.getSelection();s.clipboardData.setData("text/plain",gt(Sn(a.toString())))}L(s)},n),Nt.#n.set(e,t),Nt.#d(i)}static#l(t){this.#n.delete(t),this.#n.size===0&&(this.#o?.abort(),this.#o=null)}static#d(t){if(this.#o)return;this.#o=new AbortController;const e=t?AbortSignal.any([this.#o.signal,t]):this.#o.signal,i=(o,l)=>{l.append(o),o.style.width="",o.style.height="",l.classList.remove("selecting")};let n=!1;document.addEventListener("pointerdown",()=>{n=!0},{signal:e}),document.addEventListener("pointerup",()=>{n=!1,this.#n.forEach(i)},{signal:e}),window.addEventListener("blur",()=>{n=!1,this.#n.forEach(i)},{signal:e}),document.addEventListener("keyup",()=>{n||this.#n.forEach(i)},{signal:e});var s,a;document.addEventListener("selectionchange",()=>{const o=document.getSelection();if(o.rangeCount===0){this.#n.forEach(i);return}const l=new Set;for(let g=0;g<o.rangeCount;g++){const p=o.getRangeAt(g);for(const b of this.#n.keys())!l.has(b)&&p.intersectsNode(b)&&l.add(b)}for(const[g,p]of this.#n)l.has(g)?g.classList.add("selecting"):i(p,g);if(s===void 0&&(s=getComputedStyle(this.#n.values().next().value).getPropertyValue("-moz-user-select")==="none",!s)){const g=navigator.userAgentData?navigator.userAgentData.brands.find(({brand:p})=>p==="Chromium")?.version:/\bChrome\/(\d+)\b/.exec(navigator.userAgent)?.[1];s=!!g&&parseInt(g,10)>=148}if(s)return;const d=o.getRangeAt(0),h=a&&(d.compareBoundaryPoints(Range.END_TO_END,a)===0||d.compareBoundaryPoints(Range.START_TO_END,a)===0);let c=h?d.startContainer:d.endContainer;if(c.nodeType===Node.TEXT_NODE&&(c=c.parentNode),c.classList?.contains("highlight")&&(c=c.parentNode),!h&&d.endOffset===0)do{for(;!c.previousSibling;)c=c.parentNode;c=c.previousSibling}while(!c.childNodes.length);const u=c.parentElement?.closest(".textLayer"),f=this.#n.get(u);f&&(f.style.width=u.style.width,f.style.height=u.style.height,f.style.userSelect="text",c.parentElement.insertBefore(f,h?c:c.nextSibling)),a=d.cloneRange()},{signal:e})}}const Fa=null,ja=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);class Ce extends ji{#t=null;#e=Q.ENABLE_FORMS;#i=null;#s=null;#a=!0;#n=!1;#o=!1;#r=null;#l=!1;#d=null;#h=null;#c=1;#f=1;#u=K.ENABLE;#b=1;#g={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#m=[null,null,null,null];constructor(t){super(t);const{container:e,defaultViewport:i}=t;this.renderingId="page"+this.id,this.#r=t.layerProperties||Fa,this.#t=t.abortSignal||null,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=t.scale||1,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=t.optionalContentConfigPromise||null,this.#u=t.textLayerMode??K.ENABLE,this.#e=t.annotationMode??Q.ENABLE_FORMS,this.imageResourcesPath=t.imageResourcesPath||"",this.enableDetailCanvas=t.enableDetailCanvas??!0,this.maxCanvasPixels=t.maxCanvasPixels??S.get("maxCanvasPixels"),this.maxCanvasDim=t.maxCanvasDim||S.get("maxCanvasDim"),this.capCanvasAreaFactor=t.capCanvasAreaFactor??S.get("capCanvasAreaFactor"),this.#a=t.enableAutoLinking!==!1,this.#s=t.commentManager||null,this.l10n=t.l10n,this.l10n||=new st,this._isStandalone=!this.renderingQueue?.hasViewer(),this._container=e,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null,this.detailView=null;const n=document.createElement("div");if(n.className="page",n.setAttribute("data-page-number",this.id),n.setAttribute("role","region"),n.setAttribute("data-l10n-id","pdfjs-page-landmark"),n.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=n,this.#S(),e?.append(n),this._isStandalone){e?.style.setProperty("--scale-factor",this.scale*J.PDF_TO_CSS_UNITS),this.pageColors?.background&&e?.style.setProperty("--page-bg-color",this.pageColors.background);const{optionalContentConfigPromise:s}=t;s&&s.then(a=>{s===this._optionalContentConfigPromise&&(this.#g.initialOptionalContent=a.hasInitialVisibility)}),t.l10n||this.l10n.translate(this.div)}}clone(t){const e=new Ce({container:null,eventBus:this.eventBus,pagesColors:this.pageColors,renderingQueue:this.renderingQueue,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,minDurationToUpdateCanvas:this.minDurationToUpdateCanvas,defaultViewport:this.viewport,id:t,layerProperties:this.#r,abortSignal:this.#t,scale:this.scale,optionalContentConfigPromise:this._optionalContentConfigPromise,textLayerMode:this.#u,annotationMode:this.#e,imageResourcesPath:this.imageResourcesPath,enableDetailCanvas:this.enableDetailCanvas,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableAutoLinking:this.#a,commentManager:this.#s,l10n:this.l10n});return e.setPdfPage(this.pdfPage.clone(t-1)),e}#p(t,e){const i=ja.get(e),n=this.#m[i];if(this.#m[i]=t,n){n.replaceWith(t);return}for(let s=i-1;s>=0;s--){const a=this.#m[s];if(a){a.after(t);return}}this.div.prepend(t)}#S(){const{div:t,viewport:e}=this;if(e.userUnit!==this.#b&&(e.userUnit!==1?t.style.setProperty("--user-unit",e.userUnit):t.style.removeProperty("--user-unit"),this.#b=e.userUnit),this.pdfPage){if(this.#h===e.rotation)return;this.#h=e.rotation}He(t,e,!0,!1)}updatePageNumber(t){const e=this.id;if(e!==t){this.id=t,this.renderingId=`page${t}`,this.pdfPage&&(this.pdfPage.pageNumber=t),this.setPageLabel(this.pageLabel);const{div:i}=this;i.setAttribute("data-page-number",t),i.setAttribute("data-l10n-args",JSON.stringify({page:t})),this._textHighlighter.pageIdx=t-1}this.#r.annotationEditorUIManager?.updatePageIndex(e-1,t-1)}setPdfPage(t){this._isStandalone&&(this.pageColors?.foreground==="CanvasText"||this.pageColors?.background==="Canvas")&&(this._container?.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),this._container?.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=t,this.pdfPageRotate=t.rotate;const e=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:this.scale*J.PDF_TO_CSS_UNITS,rotation:e}),this.#S(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}deleteMe(t){if(t){this.div.remove();return}this.destroy(),this.#r.annotationEditorUIManager?.deletePage(this.id)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return z(this,"_textHighlighter",new Oa({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#r.findController}))}#E(t,e){this.eventBus.dispatch(t,{source:this,pageNumber:this.id,error:e})}async#v(t=null){const{annotationLayer:e,textLayer:i}=this;let n=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer,optionalContentConfigPromise:this._optionalContentConfigPromise})}catch(s){console.error("#renderAnnotationLayer:",s),n=s}finally{this.#E("annotationlayerrendered",n)}this.#a&&t&&this.#L(t,e,i)}_refreshAnnotationLayer(){this._annotationCanvasMap?.size&&this.annotationLayer?.refreshCanvases()}async#y(){let t=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(e){console.error("#renderAnnotationEditorLayer:",e),t=e}finally{this.#E("annotationeditorlayerrendered",t)}}async#_(){try{await this.drawLayer.render({intent:"display"})}catch(t){console.error("#renderDrawLayer:",t)}}async#w(){let t=null;try{const e=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});e?.textDivs&&this._textHighlighter&&this.#C(e.textDivs)}catch(e){console.error("#renderXfaLayer:",e),t=e}finally{this.xfaLayer?.div&&(this.l10n.pause(),this.#p(this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),this.#E("xfalayerrendered",t)}}async#P(){let t=null;try{await this.textLayer.render({viewport:this.viewport,images:this.imageCoordinates?new Tn(this.imagesRightClickMinSize,this.imageCoordinates,this.viewport,()=>this.canvas):null})}catch(e){if(e instanceof rn)return;console.error("#renderTextLayer:",e),t=e}this.#E("textlayerrendered",t),this.#I()}async#I(){const t=await this.structTreeLayer?.render();t&&(this.l10n.pause(),this.structTreeLayer?.updateTextLayer(),this.canvas&&t.parentNode!==this.canvas&&this.canvas.append(t),this.l10n.resume()),this.structTreeLayer?.show()}async#C(t){const e=await this.pdfPage.getTextContent(),i=[];for(const n of e.items)i.push(n.str);this._textHighlighter.setTextMapping(t,i),this._textHighlighter.enable()}async#L(t,e,i){let n=null;try{if(await t,e!==this.annotationLayer||i!==this.textLayer)return;await e.injectLinkAnnotations(Ma.processLinks(this))}catch(s){console.error("#injectLinkAnnotations:",s),n=s}this.#E("linkannotationsadded",n)}_resetCanvas(){super._resetCanvas(),this.#d=null}reset({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,keepCanvasWrapper:s=!1,preserveDetailViewState:a=!1}={}){const o=this.pdfPage?._pdfBug??!1;this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:e,keepXfaLayer:i,keepTextLayer:n}),this.renderingState=k.INITIAL;const l=this.div,d=l.childNodes,h=t&&this.annotationLayer?.div||null,c=e&&this.annotationEditorLayer?.div||null,u=i&&this.xfaLayer?.div||null,f=n&&this.textLayer?.div||null,g=s&&this.#i||null;for(let p=d.length-1;p>=0;p--){const b=d[p];switch(b){case h:case c:case u:case f:case g:continue}if(o&&b.classList.contains("pdfBugGroupsLayer"))continue;b.remove();const w=this.#m.indexOf(b);w>=0&&(this.#m[w]=null)}l.removeAttribute("data-loaded"),h&&this.annotationLayer.hide(),c&&this.annotationEditorLayer.hide(),u&&this.xfaLayer.hide(),f&&this.textLayer.hide(),this.structTreeLayer?.hide(),!s&&this.#i&&(this.#i=null,this._resetCanvas()),a||(this.detailView?.reset({keepCanvas:s}),s||(this.detailView=null))}toggleEditingMode(t){this.#o=t,this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(t){this.enableDetailCanvas&&(this.#l&&this.maxCanvasPixels>0&&t?(this.detailView??=new Ba({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:-1}),this.detailView.update({visibleArea:t})):this.detailView&&(this.detailView.reset(),this.detailView=null))}update({scale:t=0,rotation:e=null,optionalContentConfigPromise:i=null,drawingDelay:n=-1}){this.scale=t||this.scale,typeof e=="number"&&(this.rotation=e),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then(a=>{i===this._optionalContentConfigPromise&&(this.#g.initialOptionalContent=a.hasInitialVisibility)})),this.#g.directDrawing=!0;const s=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*J.PDF_TO_CSS_UNITS,rotation:s}),this.#S(),this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale),this.#x(),this.canvas){const a=this.#n&&this.#l,o=n>=0&&n<1e3;if(o||a){o&&!a&&this.renderingState!==k.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=k.FINISHED,this.#g.directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!o,hideTextLayer:o}),o||(this.detailView?.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1));return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),this.detailView?.update({underlyingViewUpdated:!0})}#x(){const{width:t,height:e}=this.viewport,i=this.outputScale=new lt;if(this.maxCanvasPixels===0){const n=1/this.scale;i.sx*=n,i.sy*=n,this.#l=!0}else if(this.#l=i.limitCanvas(t,e,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor),this.#l&&this.enableDetailCanvas){const n=this.enableOptimizedPartialRendering?4:2;i.sx/=n,i.sy/=n}}cancelRendering({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){super.cancelRendering({cancelExtraDelay:s}),this.textLayer&&(!n||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!t||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!e||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!i||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:e=!1,redrawXfaLayer:i=!1,redrawTextLayer:n=!1,hideTextLayer:s=!1}){const{canvas:a}=this;if(!a)return;const o=this.#d;if(this.viewport!==o){const l=(360+this.viewport.rotation-o.rotation)%360;if(l===90||l===270){const{width:d,height:h}=this.viewport,c=h/d,u=d/h;a.style.transform=`rotate(${l}deg) scale(${c},${u})`}else a.style.transform=l===0?"":`rotate(${l}deg)`}t&&this.annotationLayer&&this.#v(),e&&this.annotationEditorLayer&&(this.drawLayer&&this.#_(),this.#y()),i&&this.xfaLayer&&this.#w(),this.textLayer&&(s?(this.textLayer.hide(),this.structTreeLayer?.hide()):n&&this.#P())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(t,e){return this.viewport.convertToPdfPoint(t,e)}_ensureCanvasWrapper(){let t=this.#i;return t||(t=this.#i=document.createElement("div"),t.classList.add("canvasWrapper"),this.#p(t,"canvasWrapper")),t}_getRenderingContext(t,e,i,n){return{canvas:t,transform:e,viewport:this.viewport,annotationMode:this.#e,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:this.#o,recordOperations:i,recordImages:n}}async draw(){this.renderingState!==k.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:t,l10n:e,pdfPage:i,viewport:n}=this;if(!i)throw this.renderingState=k.FINISHED,new Error("pdfPage is not loaded");this.renderingState=k.RUNNING;const s=this._ensureCanvasWrapper();if(!this.textLayer&&this.#u!==K.DISABLE&&!i.isPureXfa&&(this._accessibilityManager||=new At,this.textLayer=new Nt({pdfPage:i,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:this.#u===K.ENABLE_PERMISSIONS,onAppend:v=>{this.l10n.pause(),this.#p(v,"textLayer"),this.l10n.resume()},abortSignal:this.#t}),this.enableSelectionRendering&&this.textLayer.div.classList.add("selectionRendering")),!this.annotationLayer&&this.#e!==Q.DISABLE){const{annotationStorage:v,annotationEditorUIManager:_,downloadManager:T,enableComment:D,enableScripting:y,fieldObjectsPromise:I,hasJSActionsPromise:A,linkService:R}=this.#r;this._annotationCanvasMap||=new Map,this.annotationLayer=new Ta({pdfPage:i,annotationStorage:v,imageResourcesPath:this.imageResourcesPath,renderForms:this.#e===Q.ENABLE_FORMS,linkService:R,downloadManager:T,enableComment:D,enableScripting:y,hasJSActionsPromise:A,fieldObjectsPromise:I,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:_,commentManager:this.#s,onAppend:F=>{this.#p(F,"annotationLayer")}})}const{width:a,height:o}=n;this.#d=n;const{canvas:l,prevCanvas:d}=this._createCanvas(v=>{s.prepend(v)});l.setAttribute("role","presentation"),this.outputScale||this.#x();const{outputScale:h}=this;this.#n=this.#l;const c=Ie(h.sx),u=Ie(h.sy),f=l.width=Mt(Dt(a*h.sx),c[0]),g=l.height=Mt(Dt(o*h.sy),u[0]),p=Mt(Dt(a),c[1]),b=Mt(Dt(o),u[1]);h.sx=f/p,h.sy=g/b,this.#c!==c[1]&&(t.style.setProperty("--scale-round-x",`${c[1]}px`),this.#c=c[1]),this.#f!==u[1]&&(t.style.setProperty("--scale-round-y",`${u[1]}px`),this.#f=u[1]);const w=this.enableOptimizedPartialRendering&&this.#n&&!this.recordedBBoxes,C=this.imagesRightClickMinSize!==-1&&!this.imageCoordinates,E=h.scaled?[h.sx,0,0,h.sy,0,0]:null,P=this._drawCanvas(this._getRenderingContext(l,E,w,C),()=>{d?.remove(),this._resetCanvas()},v=>{this.#g.regularAnnotations=!v.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{if(this.renderingState!==k.FINISHED)return;this.structTreeLayer||=new Ra(i,n.rawDims);const v=this.textLayer?this.#P():null;this.annotationLayer&&await this.#v(v),this.drawLayer||=new ka({pageIndex:this.id,textLayer:this.enableSelectionRendering?this.textLayer?.div:null,filterFactory:this.pdfPage?.filterFactory,pageColors:this.pageColors}),await this.#_(),this.drawLayer.setParent(s);const{annotationEditorUIManager:_}=this.#r;_&&(this.annotationLayer||this.#e===Q.DISABLE)&&(this.annotationEditorLayer||=new La({uiManager:_,pageIndex:this.id-1,l10n:e,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:T=>{this.#p(T,"annotationEditorLayer")}}),this.#y())});if(i.isPureXfa){if(!this.xfaLayer){const{annotationStorage:v,linkService:_}=this.#r;this.xfaLayer=new _i({pdfPage:i,annotationStorage:v,linkService:_})}this.#w()}return t.setAttribute("data-loaded",!0),this.dispatchPageRender(),P}setPageLabel(t){this.pageLabel=typeof t=="string"?t:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:t,initialOptionalContent:e,regularAnnotations:i}=this.#g;return t&&e&&i?this.canvas:null}}const zi=10,Lt={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function Wi(r){return Object.values(B).includes(r)&&r!==B.DISABLE}class Va{#t=new Set;#e=0;constructor(t){this.#e=t}push(t){const e=this.#t;e.has(t)&&e.delete(t),e.add(t),e.size>this.#e&&this.#i()}resize(t,e=null){this.#e=t;const i=this.#t;if(e){const n=i.size;let s=1;for(const a of i)if(e.has(a.id)&&(i.delete(a),i.add(a)),++s>n)break}for(;i.size>this.#e;)this.#i()}has(t){return this.#t.has(t)}[Symbol.iterator](){return this.#t.keys()}#i(){const t=this.#t.keys().next().value;t?.destroy(),this.#t.delete(t)}}class Ua{#t=null;#e=null;#i=null;#s=B.NONE;#a=null;#n=Q.ENABLE_FORMS;#o=null;#r=null;#l=null;#d=!1;#h=!1;#c=!1;#f=!1;#u=!0;#b=null;#g=null;#m=0;#p=null;#S=!0;#E=null;#v=null;#y=null;#_=!1;#w=null;#P=0;#I=new ResizeObserver(this.#at.bind(this));#C=null;#L=null;#x=null;#k=!0;#T=K.ENABLE;#A=null;#F=null;#M=null;#D=null;constructor(t){const e="6.2.108";if(Ft!==e)throw new Error(`The API version "${Ft}" does not match the Viewer version "${e}".`);if(this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,this.#A=t.viewerAlert||null,this.container?.tagName!=="DIV"||this.viewer?.tagName!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");this.#I.observe(this.container),this.eventBus=t.eventBus,this.linkService=t.linkService||new $e,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,this.#e=t.altTextManager||null,this.#o=t.commentManager||null,this.#x=t.signatureManager||null,this.#l=t.editorUndoBar||null,this.findController&&(this.findController.onIsPageVisible=n=>this._getVisiblePages().ids.has(n)),this._scriptingManager=t.scriptingManager||null,this.#T=t.textLayerMode??K.ENABLE,this.#n=t.annotationMode??Q.ENABLE_FORMS,this.#s=t.annotationEditorMode??B.NONE,this.#i=t.annotationEditorHighlightColors||null,this.#d=t.enableHighlightFloatingButton===!0,this.#c=t.enableUpdatedAddImage===!0,this.#f=t.enableNewAltTextWhenAddingImage===!0,this.imageResourcesPath=t.imageResourcesPath||"",this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1,this.removePageBorders=t.removePageBorders||!1,this.maxCanvasPixels=t.maxCanvasPixels,this.maxCanvasDim=t.maxCanvasDim,this.capCanvasAreaFactor=t.capCanvasAreaFactor,this.enableDetailCanvas=t.enableDetailCanvas??!0,this.enableOptimizedPartialRendering=t.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=t.enableSelectionRendering!==!1,this.imagesRightClickMinSize=t.imagesRightClickMinSize??-1,this.l10n=t.l10n,this.l10n||=new st,this.#h=t.enablePermissions||!1,this.pageColors=t.pageColors||null,this.#p=t.mlManager||null,this.#k=t.supportsPinchToZoom!==!1,this.#u=t.enableAutoLinking!==!1,this.#m=t.minDurationToUpdateCanvas??500,this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new Ai,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue;const{abortSignal:i}=t;this.#b=i||null,i?.addEventListener("abort",()=>{this.#I.disconnect(),this.#I=null},{once:!0}),this.scroll=Pe(this.container,this._scrollUpdate.bind(this),i),this.presentationModeState=H.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#nt(),this.eventBus.on("thumbnailrendered",({pageNumber:n,pdfPage:s})=>{const a=this._pages[n-1];this.#t.has(a)||s?.cleanup()},x),t.l10n||this.l10n.translate(this.container)}get printingAllowed(){return this.#S}get pagesCount(){return this._pages.length}getPageView(t){return this._pages[t]}getCachedPageViews(){return new Set(this.#t)}get pageViewsReady(){return this._pages.every(t=>t?.pdfPage)}clearSelection(){const t=document.getSelection();if(!(!t||t.isCollapsed)){for(let e=0,i=t.rangeCount;e<i;e++)if(t.getRangeAt(e).intersectsNode(this.viewer)){t.removeAllRanges?.(),t.empty?.();return}}}get renderForms(){return this.#n===Q.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(t){if(!Number.isInteger(t))throw new Error("Invalid page number.");this.pdfDocument&&(this._currentPageNumber!==t&&this.clearSelection(),this._setCurrentPageNumber(t,!0)||console.error(`currentPageNumber: "${t}" is not a valid page.`))}_setCurrentPageNumber(t,e=!1){if(this._currentPageNumber===t)return e&&this.#tt(),!0;if(!(0<t&&t<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=t,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:t,pageLabel:this._pageLabels?.[t-1]??null,previous:i}),e&&this.#tt(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(t){if(!this.pdfDocument)return;let e=t|0;if(this._pageLabels){const i=this._pageLabels.indexOf(t);i>=0&&(e=i+1)}this._currentPageNumber!==e&&this.clearSelection(),this._setCurrentPageNumber(e,!0)||console.error(`currentPageLabel: "${t}" is not a valid page.`)}get currentScale(){return this._currentScale!==0?this._currentScale:1}set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#N(t,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(t){this.pdfDocument&&this.#N(t,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!kt(t))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(t%=360,t<0&&(t+=360),this._pagesRotation===t))return;this.clearSelection(),this._pagesRotation=t;const e=this._currentPageNumber;this.refresh(!0,{rotation:t}),this._currentScaleValue&&this.#N(this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:t,pageNumber:e}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const t=this;return z(this,"_layerProperties",{get annotationEditorUIManager(){return t.#a},get annotationStorage(){return t.pdfDocument?.annotationStorage},get downloadManager(){return t.downloadManager},get enableComment(){return!!t.#o},get enableScripting(){return!!t._scriptingManager},get fieldObjectsPromise(){return t.pdfDocument?.getFieldObjects()},get findController(){return t.findController},get hasJSActionsPromise(){return t.pdfDocument?.hasJSActions()},get linkService(){return t.linkService}})}#V(t){this.#S=t,this.eventBus.dispatch("printingallowed",{source:this,isAllowed:t})}#j(t){const e={annotationEditorMode:this.#s,annotationMode:this.#n,textLayerMode:this.#T};return t?(this.#V(t.includes(pt.PRINT_HIGH_QUALITY)||t.includes(pt.PRINT)),!t.includes(pt.COPY)&&this.#T===K.ENABLE&&(e.textLayerMode=K.ENABLE_PERMISSIONS),t.includes(pt.MODIFY_CONTENTS)||(e.annotationEditorMode=B.DISABLE),!t.includes(pt.MODIFY_ANNOTATIONS)&&!t.includes(pt.FILL_INTERACTIVE_FORMS)&&this.#n===Q.ENABLE_FORMS&&(e.annotationMode=Q.ENABLE),e):(this.#V(!0),e)}async#B(t){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;const e=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e.resolve()},{signal:AbortSignal.any([t,i.signal])}),await Promise.race([this._onePageRenderedCapability.promise,e.promise]),i.abort()}async getAllText(t=null){const e=[],i=[];for(let n=1,s=this.pdfDocument.numPages;n<=s;++n){if(t?.aborted)return null;i.length=0;const a=await this.pdfDocument.getPage(n),{items:o}=await a.getTextContent();for(const l of o)l.str&&i.push(l.str),l.hasEOL&&i.push(`
|
|
552
|
+
`);e.push(gt(i.join("")))}return e.join(`
|
|
553
|
+
`)}#O(t,e){const i=document.getSelection(),{focusNode:n,anchorNode:s}=i;if(s&&n&&i.containsNode(this.#w)){if(this.#_||t===K.ENABLE_PERMISSIONS){L(e);return}this.#_=!0;const{classList:a}=this.viewer;a.add("copyAll");const o=new AbortController,l=new AbortController;window.addEventListener("keydown",d=>{d.key==="Escape"&&l.abort()},{signal:o.signal}),this.getAllText(l.signal).then(async d=>{d!==null&&await navigator.clipboard.writeText(d)}).catch(d=>{console.warn(`Something goes wrong when extracting the text: ${d.message}`)}).finally(()=>{this.#_=!1,o.abort(),a.remove("copyAll")}),L(e)}}setDocument(t){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#a?.destroy(),this.#a=null,this.#s=B.NONE,this.#S=!0),this.pdfDocument=t,!t)return;const e=t.numPages,i=t.getPage(1),n=t.getOptionalContentConfig({intent:"display"}),s=this.#h?t.getPermissions():Promise.resolve(),{eventBus:a,pageColors:o,viewer:l}=this;this.#g=new AbortController;const{signal:d}=this.#g,h={signal:d,...x};if(e>Lt.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const f=this._scrollMode=M.PAGE;a.dispatch("scrollmodechanged",{source:this,mode:f})}this._pagesCapability.promise.then(()=>{a.dispatch("pagesloaded",{source:this,pagesCount:e})},()=>{});const c=f=>{const g=this._pages[f.pageNumber-1];g&&this.#t.push(g)};a.on("pagerender",c,h);const u=f=>{f.cssTransform||f.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:f.timestamp}),a.off("pagerendered",u))};a.on("pagerendered",u,h),Promise.all([i,s]).then(([f,g])=>{if(t!==this.pdfDocument)return;this._firstPageCapability.resolve(f),this._optionalContentConfigPromise=n;const{annotationEditorMode:p,annotationMode:b,textLayerMode:w}=this.#j(g);if(w!==K.DISABLE){const v=this.#w=document.createElement("div");v.id="hiddenCopyElement",v.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none",l.before(v)}if(p!==B.DISABLE){const v=p;t.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):Wi(v)?(this.#a=new ln(this.container,l,this.#A,this.#e,this.#o,this.#x,a,t,o,this.#i,this.#d,this.#c,this.#f,this.#p,this.#l,this.#k),a.dispatch("annotationeditoruimanager",{source:this,uiManager:this.#a}),v!==B.NONE&&(this.#Z(v),this.#a.updateMode(v))):console.error(`Invalid AnnotationEditor mode: ${v}`)}const C=this._scrollMode===M.PAGE?null:l,E=this.currentScale,P=f.getViewport({scale:E*J.PDF_TO_CSS_UNITS});l.style.setProperty("--scale-factor",P.scale),o?.background&&l.style.setProperty("--page-bg-color",o.background),(o?.foreground==="CanvasText"||o?.background==="Canvas")&&(l.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),l.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let v=1;v<=e;++v){const _=new Ce({container:C,eventBus:a,id:v,scale:E,defaultViewport:P.clone(),optionalContentConfigPromise:n,renderingQueue:this.renderingQueue,textLayerMode:w,annotationMode:b,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,enableSelectionRendering:this.enableSelectionRendering,imagesRightClickMinSize:this.imagesRightClickMinSize,pageColors:o,l10n:this.l10n,layerProperties:this._layerProperties,enableAutoLinking:this.#u,minDurationToUpdateCanvas:this.#m,commentManager:this.#o,abortSignal:this.#b});this._pages.push(_)}this._pages[0]?.setPdfPage(f),this._scrollMode===M.PAGE?this.#R():this._spreadMode!==j.NONE&&this._updateSpreadMode(),a.on("annotationeditorlayerrendered",v=>{this.#a&&a.dispatch("annotationeditormodechanged",{source:this,mode:this.#s})},{once:!0,signal:d,...x}),this.#B(d).then(async()=>{if(t!==this.pdfDocument)return;if(this.findController?.setDocument(t),this._scriptingManager?.setDocument(t),this.#w&&document.addEventListener("copy",this.#O.bind(this,w),{signal:d}),t.loadingParams.disableAutoFetch||e>Lt.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let v=e-1;if(v<=0){this._pagesCapability.resolve();return}for(let _=2;_<=e;++_){const T=t.getPage(_).then(D=>{const y=this._pages[_-1];y.pdfPage||y.setPdfPage(D),--v===0&&this._pagesCapability.resolve()},D=>{console.error(`Unable to get page ${_} to initialize viewer`,D),--v===0&&this._pagesCapability.resolve()});_%Lt.PAUSE_EAGER_PAGE_INIT===0&&await T}}),a.dispatch("pagesinit",{source:this}),t.getMetadata().then(({info:v})=>{t===this.pdfDocument&&v.Language&&(l.lang=v.Language)}),this.defaultRenderingQueue&&this.update()}).catch(f=>{console.error("Unable to initialize viewer",f),this._pagesCapability.reject(f)})}onPagesEdited({pagesMapper:t,type:e,hasBeenCut:i,pageNumbers:n}){if(e==="copy"){this.#F=new Map;for(const d of n)this.#F.set(d,this._pages[d-1]);return}if(e==="cancelCopy"){this.#F=null;return}if((e==="cut"||e==="delete")&&(this.#M=this._pages,this.#D=n),e==="cancelDelete"){if(this.#D=null,!this.#M)return;const d=this._scrollMode===M.PAGE?null:this.viewer;if(d){this.#a?.startUpdatePages();const h=document.createDocumentFragment();for(let c=0,u=this.#M.length;c<u;c++){const f=this.#M[c];f.updatePageNumber(c+1),h.append(f.div)}d.replaceChildren(h),this.#a?.endUpdatePages()}this._pages=this.#M,this.#M=null;return}if(e==="cleanSavedData"){if(this.#D){if(this.#M){for(const d of this.#D)this.#M[d-1].deleteMe();this.#M=null}this.#D=null}return}this._currentPageNumber=0;const a=this._pages,o=this._pages=[];this.#a?.startUpdatePages();for(let d=1,h=t.pagesNumber;d<=h;d++){const c=t.getPrevPageNumber(d);if(c<0){let f=this.#F.get(-c);i?f.updatePageNumber(d):(this.#a?.clonePage(-c-1,d-1),f=f.clone(d)),o.push(f);continue}const u=a[c-1];o.push(u),u.updatePageNumber(d)}this.#a?.endUpdatePages(),e==="paste"&&(this.#F=null);const l=this._scrollMode===M.PAGE?null:this.viewer;if(l){const d=document.createDocumentFragment();for(const{div:h}of o)d.append(h);l.replaceChildren(d)}setTimeout(()=>{this.forceRendering()})}setPageLabels(t){if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,i=this._pages.length;e<i;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=0,this._currentScaleValue=null,this._pageLabels=null,this.#t=new Va(zi),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=M.VERTICAL,this._previousScrollMode=M.UNKNOWN,this._spreadMode=j.NONE,this.#C={previousPageNumber:1,scrollDown:!0,pages:[]},this.#g?.abort(),this.#g=null,this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.#w?.remove(),this.#w=null,this.#X(),this.#K()}#R(){if(this._scrollMode!==M.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const t=this._currentPageNumber,e=this.#C,i=this.viewer;if(i.textContent="",e.pages.length=0,this._spreadMode===j.NONE&&!this.isInPresentationMode){const n=this._pages[t-1];i.append(n.div),e.pages.push(n)}else{const n=new Set,s=this._spreadMode-1;s===-1?n.add(t-1):t%2!==s?(n.add(t-1),n.add(t)):(n.add(t-2),n.add(t-1));const a=document.createElement("div");if(a.className="spread",this.isInPresentationMode){const o=document.createElement("div");o.className="dummyPage",a.append(o)}for(const o of n){const l=this._pages[o];l&&(a.append(l.div),e.pages.push(l))}i.append(a)}e.scrollDown=t>=e.previousPageNumber,e.previousPageNumber=t}_scrollUpdate(){this.pagesCount!==0&&(this.#E&&clearTimeout(this.#E),this.#E=setTimeout(()=>{this.#E=null,this.update()},100),this.update())}#H(t,e=null){const{div:i,id:n}=t;if(this._currentPageNumber!==n&&this._setCurrentPageNumber(n),this._scrollMode===M.PAGE&&(this.#R(),this.update()),!e&&!this.isInPresentationMode){const s=i.offsetLeft+i.clientLeft,a=s+i.clientWidth,{scrollLeft:o,clientWidth:l}=this.container;(this._scrollMode===M.HORIZONTAL||s<o||a>o+l)&&(e={left:0,top:0})}Ji(i,e),!this._currentScaleValue&&this._location&&(this._location=null)}#z(t){return t===this._currentScale||Math.abs(t-this._currentScale)<1e-15}#U(t,e,{noScroll:i=!1,preset:n=!1,drawingDelay:s=-1,origin:a=null}){if(this.clearSelection(),this._currentScaleValue=e.toString(),this.#z(t)){n&&this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:e});return}this.viewer.style.setProperty("--scale-factor",t*J.PDF_TO_CSS_UNITS);const o=s>=0&&s<1e3;this.refresh(!0,{scale:t,drawingDelay:o?s:-1}),o&&(this.#L=setTimeout(()=>{this.#L=null,this.refresh()},s));const l=this._currentScale;if(this._currentScale=t,!i){let d=this._currentPageNumber,h;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(d=this._location.pageNumber,h=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:d,destArray:h,allowNegativeOffset:!0}),Array.isArray(a)){const c=t/l-1,[u,f]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-f)*c,this.container.scrollTop+=(a[1]-u)*c}}this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:n?e:void 0}),this.defaultRenderingQueue&&this.update()}get#Y(){return this._spreadMode!==j.NONE&&this._scrollMode!==M.HORIZONTAL?2:1}#N(t,e){let i=parseFloat(t);if(i>0)e.preset=!1,this.#U(i,t,e);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let s=40,a=5;this.isInPresentationMode?(s=a=4,this._spreadMode!==j.NONE&&(s*=2)):this.removePageBorders?s=a=0:this._scrollMode===M.HORIZONTAL&&([s,a]=[a,s]);const o=(this.container.clientWidth-s)/n.width*n.scale/this.#Y,l=(this.container.clientHeight-a)/n.height*n.scale;switch(t){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const d=Kt(n)?o:Math.min(l,o);i=Math.min(1.25,d);break;default:console.error(`#setScale: "${t}" is an unknown zoom value.`);return}e.preset=!0,this.#U(i,t,e)}}#tt(){const t=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#N(this._currentScaleValue,{noScroll:!0}),this.#H(t)}pageLabelToPageNumber(t){if(!this._pageLabels)return null;const e=this._pageLabels.indexOf(t);return e<0?null:e+1}scrollPageIntoView({pageNumber:t,destArray:e=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:n=!1,center:s=null}){if(!this.pdfDocument)return;const a=Number.isInteger(t)&&this._pages[t-1];if(!a){console.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!e){this._setCurrentPageNumber(t,!0);return}let o=0,l=0,d=0,h=0,c,u;const f=a.rotation%180!==0,g=(f?a.height:a.width)/a.scale/J.PDF_TO_CSS_UNITS,p=(f?a.width:a.height)/a.scale/J.PDF_TO_CSS_UNITS;let b=0;switch(e[1].name){case"XYZ":o=e[2],l=e[3],b=e[4],o=o!==null?o:0,l=l!==null?l:p;break;case"Fit":case"FitB":b="page-fit";break;case"FitH":case"FitBH":l=e[2],b="page-width",l===null&&this._location?(o=this._location.left,l=this._location.top):(typeof l!="number"||l<0)&&(l=p);break;case"FitV":case"FitBV":o=e[2],d=g,h=p,b="page-height";break;case"FitR":o=e[2],l=e[3],d=e[4]-o,h=e[5]-l;let P=40,v=5;this.removePageBorders&&(P=v=0),c=(this.container.clientWidth-P)/d/J.PDF_TO_CSS_UNITS,u=(this.container.clientHeight-v)/h/J.PDF_TO_CSS_UNITS,b=Math.min(Math.abs(c),Math.abs(u));break;default:console.error(`scrollPageIntoView: "${e[1].name}" is not a valid destination type.`);return}if(n||(b&&b!==this._currentScale?this.currentScaleValue=b:this._currentScale===0&&(this.currentScaleValue="auto")),b==="page-fit"&&!e[4]){this.#H(a);return}const w=[a.viewport.convertToViewportPoint(o,l),a.viewport.convertToViewportPoint(o+d,l+h)];let C=Math.min(w[0][0],w[1][0]),E=Math.min(w[0][1],w[1][1]);s?((s==="both"||s==="vertical")&&(E-=(this.container.clientHeight-Math.abs(w[1][1]-w[0][1]))/2),(s==="both"||s==="horizontal")&&(C-=(this.container.clientWidth-Math.abs(w[1][0]-w[0][0]))/2)):i||(C=Math.max(C,0),E=Math.max(E,0)),this.#H(a,{left:C,top:E})}_updateLocation(t){const e=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===e?Math.round(e*1e4)/100:i,s=t.id,a=this._pages[s-1],o=this.container,l=a.getPagePoint(o.scrollLeft-t.x,o.scrollTop-t.y),d=Math.round(l[0]),h=Math.round(l[1]);let c=`#page=${s}`;this.isInPresentationMode||(c+=`&zoom=${n},${d},${h}`),this._location={pageNumber:s,scale:n,top:h,left:d,rotation:this._pagesRotation,pdfOpenParams:c}}update(){const t=this._getVisiblePages(),e=t.views,i=e.length;if(i===0)return;const n=Math.max(zi,2*i+1);this.#t.resize(n,t.ids);for(const{view:l,visibleArea:d}of e)l.updateVisibleArea(d);for(const l of this.#t)t.ids.has(l.id)||l.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(t);const s=this._spreadMode===j.NONE&&(this._scrollMode===M.PAGE||this._scrollMode===M.VERTICAL),a=this._currentPageNumber;let o=!1;for(const l of e){if(l.percent<100)break;if(l.id===a&&s){o=!0;break}}this._setCurrentPageNumber(o?this._currentPageNumber:e[0].id),this._updateLocation(t.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}#et(){const t=this._getVisiblePages(),e=[],{ids:i,views:n}=t;for(const s of n){const{view:a}=s;if(!a.hasEditableAnnotations()){i.delete(a.id);continue}e.push(s)}return e.length===0?null:(this.renderingQueue.renderHighestPriority({first:e[0],last:e.at(-1),views:e,ids:i}),i)}containsElement(t){return this.container.contains(t)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===H.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===H.CHANGING}get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const t=this._scrollMode===M.PAGE?this.#C.pages:this._pages,e=this._scrollMode===M.HORIZONTAL,i=e&&this._isContainerRtl;return xe({scrollEl:this.container,views:t,sortByVisibility:!0,horizontal:e,rtl:i})}cleanup(){for(const t of this._pages)t.renderingState!==k.FINISHED&&t.reset()}_cancelRendering(){for(const t of this._pages)t.cancelRendering()}async#$(t){if(t.pdfPage)return t.pdfPage;try{const e=await this.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(e),e}catch(e){return console.error("Unable to get page for page view",e),null}}#it(t){if(t.first?.id===1)return!0;if(t.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case M.PAGE:return this.#C.scrollDown;case M.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(t){const e=t||this._getVisiblePages(),i=this.#it(e),n=this._spreadMode!==j.NONE&&this._scrollMode!==M.HORIZONTAL,s=this.#L!==null||this.#E!==null&&e.views.some(o=>o.detailView?.renderingCancelled),a=this.renderingQueue.getHighestPriority(e,this._pages,i,n,s);return a?(this.#$(a).then(()=>{this.renderingQueue.renderView(a)}),!0):!1}get hasEqualPageSizes(){const t=this._pages[0];for(let e=1,i=this._pages.length;e<i;++e){const n=this._pages[e];if(n.width!==t.width||n.height!==t.height)return!1}return!0}getPagesOverview(){let t;return this._pages.map(e=>{const i=e.pdfPage.getViewport({scale:1}),n=Kt(i);if(t===void 0)t=n;else if(this.enablePrintAutoRotate&&n!==t)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(t){if(!(t instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${t}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=t,this.refresh(!1,{optionalContentConfigPromise:t}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:t}))}get scrollMode(){return this._scrollMode}set scrollMode(t){if(this._scrollMode!==t){if(!Te(t))throw new Error(`Invalid scroll mode: ${t}`);this.pagesCount>Lt.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this.clearSelection(),this._scrollMode=t,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(t=null){const e=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",e===M.HORIZONTAL),i.classList.toggle("scrollWrapped",e===M.WRAPPED),!(!this.pdfDocument||!t)&&(e===M.PAGE?this.#R():this._previousScrollMode===M.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#N(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(t){if(this._spreadMode!==t){if(!Ae(t))throw new Error(`Invalid spread mode: ${t}`);this.clearSelection(),this._spreadMode=t,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:t}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(t=null){if(!this.pdfDocument)return;const e=this.viewer,i=this._pages;if(this._scrollMode===M.PAGE)this.#R();else if(e.textContent="",this._spreadMode===j.NONE)for(const n of this._pages)e.append(n.div);else{const n=this._spreadMode-1;let s=null;for(let a=0,o=i.length;a<o;++a)s===null?(s=document.createElement("div"),s.className="spread",e.append(s)):a%2===n&&(s=s.cloneNode(!1),e.append(s)),s.append(i[a].div)}t&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#N(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}#G(t,e=!1){switch(this._scrollMode){case M.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:s,y:a,percent:o,widthPercent:l}of i)o===0||l<100||n.getOrInsertComputed(a,Ve).push(s);for(const s of n.values()){const a=s.indexOf(t);if(a===-1)continue;const o=s.length;if(o===1)break;if(e)for(let l=a-1,d=0;l>=d;l--){const h=s[l],c=s[l+1]-1;if(h<c)return t-c}else for(let l=a+1,d=o;l<d;l++){const h=s[l],c=s[l-1]+1;if(h>c)return c-t}if(e){const l=s[0];if(l<t)return t-l+1}else{const l=s[o-1];if(l>t)return l-t+1}break}break}case M.HORIZONTAL:break;case M.PAGE:case M.VERTICAL:{if(this._spreadMode===j.NONE)break;const i=this._spreadMode-1;if(e&&t%2!==i)break;if(!e&&t%2===i)break;const{views:n}=this._getVisiblePages(),s=e?t-1:t+1;for(const{id:a,percent:o,widthPercent:l}of n)if(a===s){if(o>0&&l===100)return 2;break}break}}return 1}nextPage(){const t=this._currentPageNumber,e=this.pagesCount;if(t>=e)return!1;const i=this.#G(t,!1)||1;return this.currentPageNumber=Math.min(t+i,e),!0}previousPage(){const t=this._currentPageNumber;if(t<=1)return!1;const e=this.#G(t,!0)||1;return this.currentPageNumber=Math.max(t-e,1),!0}updateScale({drawingDelay:t,scaleFactor:e=null,steps:i=null,origin:n}){if(i===null&&e===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let s=this._currentScale;if(e>0&&e!==1)s=Math.round(s*e*100)/100;else if(i){const a=i>0?1.1:.9090909090909091,o=i>0?Math.ceil:Math.floor;i=Math.abs(i);do s=o((s*a).toFixed(2)*10)/10;while(--i>0)}s=Pt(s,.1,25),this.#N(s,{noScroll:!1,drawingDelay:t,origin:n})}increaseScale(t={}){this.updateScale({...t,steps:t.steps??1})}decreaseScale(t={}){this.updateScale({...t,steps:-(t.steps??1)})}#nt(t=this.container.clientHeight){t!==this.#P&&(this.#P=t,Yt.setProperty("--viewer-container-height",`${t}px`))}#at(t){for(const e of t)if(e.target===this.container){this.#nt(Math.floor(e.borderBoxSize[0].blockSize)),this.#r=null;break}}get containerTopLeft(){return this.#r||=[this.container.offsetTop,this.container.offsetLeft]}#X(){this.#L!==null&&(clearTimeout(this.#L),this.#L=null),this.#E!==null&&(clearTimeout(this.#E),this.#E=null)}#K(){this.#v?.abort(),this.#v=null,this.#y!==null&&(clearTimeout(this.#y),this.#y=null)}#Z(t){switch(t){case B.STAMP:this.#p?.loadModel("altText");break;case B.SIGNATURE:this.#x?.loadSignatures();break}}get annotationEditorMode(){return this.#a?this.#s:B.DISABLE}set annotationEditorMode({mode:t,editId:e=null,isFromKeyboard:i=!1,mustEnterInEditMode:n=!1,editComment:s=!1}){if(!this.#a)throw new Error("The AnnotationEditor is not enabled.");if(this.#s===t)return;if(!Wi(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;this.#Z(t);const{eventBus:a,pdfDocument:o}=this,l=async()=>{this.#K(),this.#s=t,await this.#a.updateMode(t,e,!0,i,n,s),!(t!==this.#s||o!==this.pdfDocument)&&a.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===B.NONE||this.#s===B.NONE){const d=t!==B.NONE;d||this.pdfDocument.annotationStorage.resetModifiedIds(),this.cleanup();for(const c of this._pages)c.toggleEditingMode(d);const h=this.#et();if(d&&h){this.#K(),this.#v=new AbortController;const c=AbortSignal.any([this.#g.signal,this.#v.signal]);a.on("pagerendered",({pageNumber:u})=>{h.delete(u),h.size===0&&(this.#y=setTimeout(l,0))},{signal:c,...x});return}}l()}refresh(t=!1,e=Object.create(null)){if(this.pdfDocument){for(const i of this._pages)i.update(e);this.#X(),t||this.update()}}}class Ha{#t;constructor(t,e){this.#t=t;const i=[{element:t.presentationModeButton,eventName:"presentationmode",close:!0},{element:t.printButton,eventName:"print",close:!0},{element:t.downloadButton,eventName:"download",close:!0},{element:t.viewBookmarkButton,eventName:null,close:!0},{element:t.firstPageButton,eventName:"firstpage",close:!0},{element:t.lastPageButton,eventName:"lastpage",close:!0},{element:t.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:t.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:t.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:W.SELECT},close:!0},{element:t.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:W.HAND},close:!0},{element:t.scrollPageButton,eventName:"switchscrollmode",eventDetails:{mode:M.PAGE},close:!0},{element:t.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:M.VERTICAL},close:!0},{element:t.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:M.HORIZONTAL},close:!0},{element:t.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:M.WRAPPED},close:!0},{element:t.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:j.NONE},close:!0},{element:t.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:j.ODD},close:!0},{element:t.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:j.EVEN},close:!0},{element:t.imageAltTextSettingsButton,eventName:"imagealttextsettings",close:!0},{element:t.documentPropertiesButton,eventName:"documentproperties",close:!0}];i.push({element:t.openFileButton,eventName:"openfile",close:!0}),this.eventBus=e,this.opened=!1,this.#i(i),this.reset()}get isOpen(){return this.opened}setPageNumber(t){this.pageNumber=t,this.#e()}setPagesCount(t){this.pagesCount=t,this.#e()}reset(){this.pageNumber=0,this.pagesCount=0,this.#e(),this.eventBus.dispatch("switchcursortool",{source:this,reset:!0}),this.#a({mode:M.VERTICAL}),this.#n({mode:j.NONE})}#e(){const{firstPageButton:t,lastPageButton:e,pageRotateCwButton:i,pageRotateCcwButton:n}=this.#t;t.disabled=this.pageNumber<=1,e.disabled=this.pageNumber>=this.pagesCount,i.disabled=this.pagesCount===0,n.disabled=this.pagesCount===0}#i(t){const{eventBus:e}=this,{toggleButton:i}=this.#t;i.addEventListener("click",this.toggle.bind(this));for(const{element:n,eventName:s,close:a,eventDetails:o}of t)n.addEventListener("click",l=>{s!==null&&e.dispatch(s,{source:this,...o}),a&&this.close(),e.dispatch("reporttelemetry",{source:this,details:{type:"buttons",data:{id:n.id}}})});e.on("cursortoolchanged",this.#s.bind(this),x),e.on("scrollmodechanged",this.#a.bind(this),x),e.on("spreadmodechanged",this.#n.bind(this),x)}#s({tool:t,disabled:e}){const{cursorSelectToolButton:i,cursorHandToolButton:n}=this.#t;tt(i,t===W.SELECT),tt(n,t===W.HAND),i.disabled=e,n.disabled=e}#a({mode:t}){const{scrollPageButton:e,scrollVerticalButton:i,scrollHorizontalButton:n,scrollWrappedButton:s,spreadNoneButton:a,spreadOddButton:o,spreadEvenButton:l}=this.#t;tt(e,t===M.PAGE),tt(i,t===M.VERTICAL),tt(n,t===M.HORIZONTAL),tt(s,t===M.WRAPPED);const d=this.pagesCount>Lt.FORCE_SCROLL_MODE_PAGE;e.disabled=d,i.disabled=d,n.disabled=d,s.disabled=d;const h=t===M.HORIZONTAL;a.disabled=h,o.disabled=h,l.disabled=h}#n({mode:t}){const{spreadNoneButton:e,spreadOddButton:i,spreadEvenButton:n}=this.#t;tt(e,t===j.NONE),tt(i,t===j.ODD),tt(n,t===j.EVEN)}open(){if(this.opened)return;this.opened=!0;const{toggleButton:t,toolbar:e}=this.#t;G(t,!0,e)}close(){if(!this.opened)return;this.opened=!1;const{toggleButton:t,toolbar:e}=this.#t;G(t,!1,e)}toggle(){this.opened?this.close():this.open()}}const $i=40;class Et{#t;#e=null;#i;#s;#a;#n;#o;#r=null;#l;#d=null;#h="";#c=null;#f;#u;#b;#g;#m;#p=null;#S=null;#E;#v;#y;#_;#w;#P;#I;#C;#L=null;#x;#k=null;#T=null;#A=!1;#F;#M=!1;#D;#V;#j;#B;#O=null;static#R=null;constructor({dialog:t,panels:e,typeButton:i,typeInput:n,drawButton:s,drawPlaceholder:a,drawSVG:o,drawThickness:l,imageButton:d,imageSVG:h,imagePlaceholder:c,imagePicker:u,imagePickerLink:f,description:g,clearButton:p,cancelButton:b,addButton:w,errorCloseButton:C,errorBar:E,errorTitle:P,errorDescription:v,saveCheckbox:_,saveContainer:T},D,y,I,A,R,F){this.#t=w,this.#i=p,this.#s=g.lastElementChild,this.#n=g.firstElementChild,this.#o=t,this.#f=o,this.#l=a,this.#u=l,this.#b=E,this.#m=P,this.#g=v,this.#_=h,this.#y=c,this.#E=u,this.#v=f,this.#V=I,this.#w=_,this.#P=T,this.#C=y,this.#x=n,this.#D=A,this.#B=R,this.#F=F,this.#j=new za(D,I),Et.#R||=Object.freeze({signature:"pdfjs-editor-add-signature-description-default-when-drawing",errorUploadTitle:"pdfjs-editor-add-signature-image-upload-error-title",errorUploadDescription:"pdfjs-editor-add-signature-image-upload-error-description",errorNoDataTitle:"pdfjs-editor-add-signature-image-no-data-error-title",errorNoDataDescription:"pdfjs-editor-add-signature-image-no-data-error-description"}),t.addEventListener("close",this.#pt.bind(this)),t.addEventListener("contextmenu",O=>{const{target:U}=O;U!==this.#x&&U!==this.#n&&O.preventDefault()}),t.addEventListener("drop",O=>{L(O)}),b.addEventListener("click",this.#ft.bind(this)),w.addEventListener("click",this.#mt.bind(this)),p.addEventListener("click",()=>{this.#X({type:"signature",action:"pdfjs.signature.clear",data:{type:this.#k}}),this.#Y(null)},{passive:!0}),this.#n.addEventListener("input",()=>{this.#s.disabled=this.#n.value===""},{passive:!0}),this.#s.addEventListener("click",()=>{this.#n.value="",this.#s.disabled=!0},{passive:!0}),C.addEventListener("click",()=>{E.hidden=!0},{passive:!0}),this.#H(i,s,d,e),u.accept=Ot.join(","),F.on("storedsignatureschanged",this.#Z.bind(this),x),I.register(t)}#H(t,e,i,n){const s=this.#I=new Map([["type",t],["draw",e],["image",i]]),a=l=>{for(const[d,h]of s)h===l.target?(h.setAttribute("aria-selected",!0),h.setAttribute("tabindex",0),n.setAttribute("data-selected",d),this.#Y(d)):(h.setAttribute("aria-selected",!1),h.setAttribute("tabindex",-1))},o=Array.from(s.values());for(let l=0,d=o.length;l<d;l++){const h=o[l];h.addEventListener("click",a,{passive:!0}),h.addEventListener("keydown",({key:c})=>{c!=="ArrowLeft"&&c!=="ArrowRight"||o[l+(c==="ArrowLeft"?-1:1)]?.focus()},{passive:!0})}}#z(){this.#A=!1,this.#n.value="",this.#k&&(this.#e.get(this.#k).value="")}#U(t){switch(t){case"type":this.#x.value="";break;case"draw":this.#r=null,this.#c=null,this.#h="",this.#d?.remove(),this.#d=null,this.#l.hidden=!1,this.#u.value=1;break;case"image":this.#y.hidden=!1,this.#S?.remove(),this.#S=null;break}}#Y(t){if(t&&this.#k===t)return;this.#k&&(this.#e.get(this.#k).value=this.#n.value),t&&(this.#k=t),this.#b.hidden=!0;const e=!t;switch(e?this.#z():this.#n.value=this.#e.get(this.#k).value,this.#s.disabled=this.#n.value==="",this.#T?.abort(),this.#T=new AbortController,this.#k){case"type":this.#tt(e);break;case"draw":this.#et(e);break;case"image":this.#it(e);break}}#N(t){(!t||!this.#M)&&(this.#w.disabled=!t),this.#i.disabled=this.#t.disabled=this.#n.disabled=!t}#tt(t){t&&this.#U("type"),this.#N(this.#x.value);const{signal:e}=this.#T,i={passive:!0,signal:e};this.#x.addEventListener("input",()=>{const{value:n}=this.#x;this.#A||(this.#e.get("type").default=this.#n.value=n,this.#s.disabled=n===""),this.#N(n)},i),this.#n.addEventListener("input",()=>{this.#A=this.#x.value!==this.#n.value},i)}#et(t){t&&this.#U("draw"),this.#N(this.#d);const{signal:e}=this.#T,i={signal:e};let n=NaN;const s=a=>{const{pointerId:o}=a;if(!isNaN(n)&&n!==o)return;n=o,a.preventDefault(),this.#f.setPointerCapture(o);const{width:l,height:d}=this.#f.getBoundingClientRect();let{offsetX:h,offsetY:c}=a;if(h=Math.round(h),c=Math.round(c),a.target===this.#l&&(this.#l.hidden=!0),!this.#r){this.#r={width:l,height:d,thickness:parseInt(this.#u.value,10),curves:[]},this.#N(!0);const g=new St,p=this.#d=g.createElement("path");p.setAttribute("stroke-width",this.#u.value),this.#f.append(p),this.#f.addEventListener("pointerdown",s,i),this.#l.removeEventListener("pointerdown",s),this.#n.value===""&&this.#D.get(Et.#R.signature).then(b=>{this.#e.get("draw").default=b,this.#n.value||=b,this.#s.disabled=this.#n.value===""})}this.#c=[h,c],this.#r.curves.push({points:this.#c}),this.#h+=`M ${h} ${c}`,this.#d.setAttribute("d",this.#h);const u=new AbortController,f={signal:AbortSignal.any([e,u.signal])};this.#f.addEventListener("contextmenu",q,f),this.#f.addEventListener("pointermove",g=>{g.preventDefault();let{offsetX:p,offsetY:b}=g;p=Math.round(p),b=Math.round(b);const w=this.#c;if(!(p<0||b<0||p>l||b>d||p===w.at(-2)&&b===w.at(-1))){if(w.length>=4){const[C,E,P,v]=w.slice(-4);this.#h+=`C${(C+5*P)/6} ${(E+5*v)/6} ${(5*P+p)/6} ${(5*v+b)/6} ${(P+p)/2} ${(v+b)/2}`}else this.#h+=`L${p} ${b}`;w.push(p,b),this.#d.setAttribute("d",this.#h)}},f),this.#f.addEventListener("pointerup",g=>{const{pointerId:p}=g;!isNaN(n)&&n!==p||(n=NaN,g.preventDefault(),this.#f.releasePointerCapture(p),u.abort(),this.#c.length===2&&(this.#h+=`L${this.#c[0]} ${this.#c[1]}`,this.#d.setAttribute("d",this.#h)))},f)};this.#r?this.#f.addEventListener("pointerdown",s,i):this.#l.addEventListener("pointerdown",s,i),this.#u.addEventListener("input",()=>{const{value:a}=this.#u;this.#u.setAttribute("data-l10n-args",JSON.stringify({thickness:a})),this.#r&&(this.#d.setAttribute("stroke-width",a),this.#r.thickness=a)},i)}#$(t){this.#m.setAttribute("data-l10n-id",Et.#R[`error${t}Title`]),this.#g.setAttribute("data-l10n-id",Et.#R[`error${t}Description`]),this.#b.hidden=!1}#it(t){t&&this.#U("image"),this.#N(this.#S);const{signal:e}=this.#T,i={signal:e},n={passive:!0,signal:e};this.#v.addEventListener("keydown",s=>{const{key:a}=s;(a==="Enter"||a===" ")&&(L(s),this.#E.click())},i),this.#E.addEventListener("click",()=>{this.#o.classList.toggle("waiting",!0)},n),this.#E.addEventListener("change",async()=>{const s=this.#E.files?.[0];if(!s||!Ot.includes(s.type)){this.#$("Upload"),this.#o.classList.toggle("waiting",!1);return}await this.#G(s)},n),this.#E.addEventListener("cancel",()=>{this.#o.classList.toggle("waiting",!1)},n),this.#y.addEventListener("dragover",s=>{const{dataTransfer:a}=s;for(const{type:o}of a.items)if(Ot.includes(o)){a.dropEffect=a.effectAllowed==="copy"?"copy":"move",L(s);return}a.dropEffect="none"},i),this.#y.addEventListener("drop",s=>{const{dataTransfer:{files:a}}=s;if(a?.length){for(const o of a)if(Ot.includes(o.type)){this.#G(o);break}L(s),this.#o.classList.toggle("waiting",!0)}},i)}async#G(t){let e;try{e=await this.#O.imageManager.getFromFile(t)}catch(o){console.error("SignatureManager.#extractSignature.",o)}if(!e){this.#$("Upload"),this.#o.classList.toggle("waiting",!1);return}const i=this.#p=this.#a.getFromImage(e.bitmap);if(!i){this.#$("NoData"),this.#o.classList.toggle("waiting",!1);return}const{outline:n}=i;this.#y.hidden=!0,this.#N(!0);const s=new St,a=this.#S=s.createElement("path");this.#_.setAttribute("viewBox",n.viewBox),this.#_.setAttribute("preserveAspectRatio","xMidYMid meet"),this.#_.append(a),a.setAttribute("d",n.toSVGPath()),this.#e.get("image").default=t.name,this.#n.value===""&&(this.#n.value=t.name||"",this.#s.disabled=this.#n.value===""),this.#o.classList.toggle("waiting",!1)}#nt(){return this.#a.getFromText(this.#x.value,window.getComputedStyle(this.#x))}#at(){const{width:t,height:e}=this.#f.getBoundingClientRect();return this.#a.getDrawnSignature(this.#r,t,e)}#X(t){this.#F.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}#K(t,e,i){const{curves:n,areContours:s,thickness:a,width:o,height:l}=t,d=Math.max(o,l),h=qt.processDrawnLines({lines:{curves:n,thickness:a,width:o,height:l},pageWidth:d,pageHeight:d,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});if(!h)return;const{outline:c}=h,u=new St,f=document.createElement("div"),g=document.createElement("button");g.addEventListener("click",()=>{this.#F.dispatch("switchannotationeditorparams",{source:this,type:Z.CREATE,value:{signatureData:{lines:{curves:n,thickness:a,width:o,height:l},mustSmooth:!1,areContours:s,description:i,uuid:e,heightInPage:$i}}})}),f.append(g),f.classList.add("toolbarAddSignatureButtonContainer");const p=u.create(1,1,!0);g.append(p);const b=document.createElement("span");b.ariaHidden=!0,g.append(b),g.classList.add("toolbarAddSignatureButton"),g.type="button",b.textContent=i,g.setAttribute("data-l10n-id","pdfjs-editor-add-saved-signature-button"),g.setAttribute("data-l10n-args",JSON.stringify({description:i})),g.tabIndex=0;const w=u.createElement("path");p.append(w),p.setAttribute("viewBox",c.viewBox),p.setAttribute("preserveAspectRatio","xMidYMid meet"),s&&w.classList.add("contours"),w.setAttribute("d",c.toSVGPath());const C=document.createElement("button");f.append(C),C.classList.add("toolbarButton","deleteButton"),C.setAttribute("data-l10n-id","pdfjs-editor-delete-signature-button1"),C.type="button",C.tabIndex=0,C.addEventListener("click",async()=>{await this.#B.delete(e)&&(f.remove(),this.#X({type:"signature",action:"pdfjs.signature.delete_saved",data:{savedCount:await this.#B.size()}}))});const E=document.createElement("span");C.append(E),E.setAttribute("data-l10n-id","pdfjs-editor-delete-signature-button-label1"),this.#C.before(f)}async#Z(){const t=this.#C.parentElement;for(;t.firstElementChild!==this.#C;)t.firstElementChild.remove();this.#L=null,await this.loadSignatures(!0)}getSignature(t){return this.open(t)}async loadSignatures(t=!1){if(!this.#C||!t&&this.#C.previousElementSibling||!this.#B||!this.#L&&(this.#L=this.#B.getAll().then(async s=>[s,await Promise.all(Array.from(s.values(),({signatureData:a})=>qt.decompressSignature(a)))]),!t))return;const[e,i]=await this.#L;this.#L=null;let n=0;for(const[s,{description:a}]of e){const o=i[n++];o&&(o.curves=o.outlines.map(l=>({points:l})),delete o.outlines,this.#K(o,s,a))}}async renderEditButton(t){const e=document.createElement("button");e.classList.add("altText","editDescription"),e.tabIndex=0,t.description&&(e.title=t.description);const i=document.createElement("span");return e.append(i),i.setAttribute("data-l10n-id","pdfjs-editor-add-signature-edit-button-label"),e.addEventListener("click",()=>{this.#j.open(t)},{passive:!0}),e}async open({uiManager:t,editor:e}){this.#e||=new Map(this.#I.keys().map(s=>[s,{value:"",default:""}])),this.#O=t,this.#a=e,this.#O.removeEditListeners();const i=this.#M=await this.#B.isFull();this.#P.classList.toggle("fullStorage",i),this.#w.checked=!i,await this.#V.open(this.#o);const n=this.#I.get("type");n.focus(),n.click()}#ft(){this.#Q()}#Q(){this.#V.closeIfActive(this.#o)}#pt(){this.#a._drawId===null&&this.#a.remove(),this.#O?.addEditListeners(),this.#T?.abort(),this.#T=null,this.#O=null,this.#a=null,this.#z();for(const[t]of this.#I)this.#U(t);this.#N(!1),this.#k=null,this.#e=null}async#mt(){let t;const e=this.#k;switch(e){case"type":t=this.#nt();break;case"draw":t=this.#at();break;case"image":t=this.#p;break}let i=null;const n=this.#n.value;if(this.#w.checked){const{newCurves:a,areContours:o,thickness:l,width:d,height:h}=t,c=await qt.compressSignature({outlines:a,areContours:o,thickness:l,width:d,height:h});i=await this.#B.create({description:n,signatureData:c}),i?this.#K({curves:a.map(u=>({points:u})),areContours:o,thickness:l,width:d,height:h},i,n):console.warn("SignatureManager.add: cannot save the signature.")}const s=this.#e.get(e);this.#X({type:"signature",action:"pdfjs.signature.created",data:{type:e,saved:!!i,savedCount:await this.#B.size(),descriptionChanged:n!==s.default}}),this.#a.addSignature(t,$i,this.#n.value,i),this.#Q()}destroy(){this.#O=null,this.#Q()}}class za{#t;#e;#i;#s;#a;#n;#o;constructor({dialog:t,description:e,cancelButton:i,updateButton:n,editSignatureView:s},a){const o=this.#i=e.firstElementChild;this.#n=s,this.#s=t,this.#a=a,t.addEventListener("close",this.#h.bind(this)),t.addEventListener("contextmenu",d=>{d.target!==this.#i&&d.preventDefault()}),i.addEventListener("click",this.#l.bind(this)),n.addEventListener("click",this.#r.bind(this));const l=e.lastElementChild;l.addEventListener("click",()=>{o.value="",l.disabled=!0,n.disabled=this.#e===""}),o.addEventListener("input",()=>{const{value:d}=o;l.disabled=d==="",n.disabled=d===this.#e,s.setAttribute("aria-label",d)},{passive:!0}),a.register(t)}async open(t){this.#o=t._uiManager,this.#t=t,this.#e=this.#i.value=t.description,this.#i.dispatchEvent(new Event("input")),this.#o.removeEditListeners();const{areContours:e,outline:i}=t.getSignaturePreview(),s=new St().createElement("path");this.#n.append(s),this.#n.setAttribute("viewBox",i.viewBox),s.setAttribute("d",i.toSVGPath()),e&&s.classList.add("contours"),await this.#a.open(this.#s)}async#r(){this.#t._reportTelemetry({action:"pdfjs.signature.edit_description",data:{hasBeenChanged:!0}}),this.#t.description=this.#i.value,this.#d()}#l(){this.#t._reportTelemetry({action:"pdfjs.signature.edit_description",data:{hasBeenChanged:!1}}),this.#d()}#d(){this.#a.closeIfActive(this.#s)}#h(){this.#o?.addEditListeners(),this.#o=null,this.#t=null,this.#n.firstElementChild.remove()}}const Wt="pdfjs-digital-signature-properties-status-verified",Wa="pdfjs-digital-signature-properties-status-invalid",$a="pdfjs-digital-signature-properties-status-unknown",Tt={verified:{priority:0,severity:"verified",bannerId:"pdfjs-digital-signature-properties-banner-verified",statusId:Wt},unknown:{priority:1,severity:"error",bannerId:"pdfjs-digital-signature-properties-banner-unknown",statusId:$a},untrusted:{priority:2,severity:"warn",bannerId:"pdfjs-digital-signature-properties-banner-untrusted",statusId:Wt},expired:{priority:3,severity:"warn",bannerId:"pdfjs-digital-signature-properties-banner-expired",statusId:Wt},revoked:{priority:4,severity:"error",bannerId:"pdfjs-digital-signature-properties-banner-revoked",statusId:Wt},invalid:{priority:5,severity:"error",bannerId:"pdfjs-digital-signature-properties-banner-invalid",statusId:Wa}},Ga={trusted:"pdfjs-digital-signature-properties-certificate-trusted",unknown:"pdfjs-digital-signature-properties-certificate-unknown",untrusted:"pdfjs-digital-signature-properties-certificate-untrusted",expired:"pdfjs-digital-signature-properties-certificate-expired",revoked:"pdfjs-digital-signature-properties-certificate-revoked"},Xa="pdfjs-digital-signature-properties-certificate-expired-with-date";function Ka(r,t){const e=(r||"").toUpperCase(),i=t?{issuer:t}:null;return e.includes("UNKNOWN_ISSUER")&&i?{id:"pdfjs-digital-signature-properties-certificate-untrusted-unknown-issuer",args:i}:e.includes("SELF_SIGNED")&&i?{id:"pdfjs-digital-signature-properties-certificate-untrusted-self-signed",args:i}:e.includes("UNTRUSTED_ISSUER")&&i?{id:"pdfjs-digital-signature-properties-certificate-untrusted-untrusted-issuer",args:i}:{id:"pdfjs-digital-signature-properties-certificate-untrusted",args:null}}function Ya(r){if(!r)return null;const t=Date.now(),e=Array.isArray(r.chain)&&r.chain.length?r.chain:[r];for(const i of e){if(typeof i?.notAfter!="string"||!i.notAfter)continue;const n=new Date(i.notAfter),s=n.getTime();if(Number.isFinite(s)&&s<t)return n}return null}class Za{#t;#e;#i;#s=[];#a=new Map;#n=new Set;#o=!1;#r=!1;#l=!1;#d=null;constructor({appConfig:t,verifier:e,eventBus:i}){this.#t=t,this.#e=e,this.#i=i;const n=t.signaturePropertiesButton;for(let s=0;s<3;s++){const a=document.createElement("span");a.className="loadingDot",n.append(a)}n.addEventListener("click",()=>{this.#f()})}get isOpen(){return this.#o}close(){this.#o&&this.#b()}shouldCloseOnClick(t){return this.#o?!(this.#t.signaturePropertiesButton.contains(t)||this.#t.signaturePropertiesPanel.contains(t)):!1}async setDocument(t){if(this.#d&&(this.#s=[],this.#a.clear(),this.#n.clear(),this.#l=!1,this.#c(),this.#b(),this.#y()),this.#d=t,!t)return;this.#r=!0,this.#p();let e;try{e=await t.getSignatures()}catch(i){console.warn("getSignatures failed:",i)}if(t===this.#d){if(this.#s=e||[],this.#r=!1,this.#s.length===0){this.#c();return}this.#h();for(const i of this.#s)this.#a.set(i.id,{status:"unknown",errorCode:null,message:null,certificate:null,documentModifiedAfterSigning:!i.coversWholeDocument,modificationsAfterSignature:i.modificationsAfterSignature});this.#p(),this.#y();for(const i of this.#s)this.#v(i,t)}}#h(){const t=this.#t.signaturePropertiesButton.parentElement;t&&(t.hidden=!1);const e=this.#t.signaturePropertiesSeparator;e&&(e.hidden=!1)}#c(){const t=this.#t.signaturePropertiesButton.parentElement;t&&(t.hidden=!0);const e=this.#t.signaturePropertiesSeparator;e&&(e.hidden=!0)}#f(){this.#o?this.#b():this.#u()}#u(){this.#o=!0,this.#i?.dispatch("switchannotationeditormode",{source:this,mode:B.NONE}),this.#i?.dispatch("findbarclose",{source:this}),this.#t.signaturePropertiesPanel.classList.remove("hidden"),this.#t.signaturePropertiesButton.setAttribute("aria-expanded","true"),this.#l&&this.#p()}#b(){this.#o=!1,this.#t.signaturePropertiesPanel.classList.add("hidden"),this.#t.signaturePropertiesButton.setAttribute("aria-expanded","false")}get#g(){let t="verified";for(const e of this.#a.values())e?.status&&Tt[e.status].priority>Tt[t].priority&&(t=e.status);return t}get#m(){if(this.#a.size===0)return{worst:"unknown",severity:"error",count:0};const t=this.#g;let e=0;for(const i of this.#a.values())i?.status===t&&e++;return{worst:t,severity:Tt[t].severity,count:e}}#p(){if(!this.#o){this.#l=!0;return}this.#l=!1;const t=this.#t.signaturePropertiesList,e=this.#t.signaturePropertiesBanner,i=document.createDocumentFragment();if(this.#r){e.hidden=!0,t.replaceChildren();return}const{worst:n,severity:s,count:a}=this.#m;e.replaceChildren(),e.hidden=!1,e.className=`sigBanner ${s}`,e.setAttribute("data-l10n-id",Tt[n].bannerId),e.setAttribute("data-l10n-args",JSON.stringify({count:a}));const o=new Map,l=[];for(const h of this.#s)h.parentId?o.getOrInsertComputed(h.parentId,Ve).push(h):l.push(h);const d=s==="verified";for(const h of l)i.append(this.#S(h,o,0,d));t.replaceChildren(i)}#S(t,e,i,n){const s=e.get(t.id)||[],a=document.createElement("li");a.classList.add("sigCard"),i===0&&n&&a.classList.add("sigCard--top-allfine");const o=this.#a.get(t.id),l=o?.certificate?.subjectCN;if(l){const g=document.createElement("div");g.className="signer",g.textContent=l,a.append(g)}const d=document.createElement("div");d.classList.add("row",`status--${o.status}`);const h=document.createElement("span");if(h.setAttribute("data-l10n-id",Tt[o.status].statusId),d.append(h),a.append(d),o.status==="invalid"&&o.message){const g=document.createElement("div");g.className="detail",g.setAttribute("data-l10n-id","pdfjs-digital-signature-properties-reason"),g.setAttribute("data-l10n-args",JSON.stringify({reason:o.message})),a.append(g)}const c=o.certificate;let u="unknown";if(c)switch(o.status){case"verified":u="trusted";break;case"expired":u="expired";break;case"revoked":u="revoked";break;case"untrusted":u="untrusted";break;default:u="unknown"}if(o.status!=="invalid"){const g=document.createElement("div");g.classList.add("row",`cert--${u}`);const p=document.createElement("span");let b=Ga[u],w=null;if(c?.issuerCN&&u==="trusted")w={issuer:c.issuerCN};else if(u==="expired"){const C=Ya(c);C&&(b=Xa,w={dateObj:C.valueOf()})}else if(u==="untrusted"){const C=Ka(o.errorCode,c?.issuerCN);b=C.id,w=C.args}p.setAttribute("data-l10n-id",b),w&&p.setAttribute("data-l10n-args",JSON.stringify(w)),g.append(p),a.append(g)}if(o.status==="untrusted"&&o.message){const g=document.createElement("div");g.className="detail",g.textContent=o.message,a.append(g)}if(o.status==="expired"&&o.message){const g=document.createElement("div");g.className="detail",g.textContent=o.message,a.append(g)}const f=ft.toDateObject(t.signingTime);if(f){const g=document.createElement("div");g.className="detail",g.setAttribute("data-l10n-id","pdfjs-digital-signature-properties-timestamp"),g.setAttribute("data-l10n-args",JSON.stringify({dateObj:f.valueOf()})),a.append(g)}if(c&&typeof this.#e?.viewCertificate=="function"){const g=document.createElement("button");g.className="viewCert",g.type="button",g.setAttribute("data-l10n-id","pdfjs-digital-signature-properties-view-certificate"),g.addEventListener("click",p=>{p.stopPropagation(),this.#e.viewCertificate(c)}),a.append(g)}if(s.length>0){const g=document.createElement("ul");g.classList.add("signaturePropertiesList","nested");for(const p of s)g.append(this.#S(p,e,i+1,n));if(i===0){const p=document.createElement("details");p.className="subSignatures",p.open=!0;const b=document.createElement("summary");b.setAttribute("data-l10n-id","pdfjs-digital-signature-properties-sub-signatures"),b.setAttribute("data-l10n-args",JSON.stringify({count:this.#E(t.id,e)})),p.append(b),p.append(g),a.append(p)}else a.append(g)}return a}#E(t,e){const i=e.get(t);if(!i)return 0;let n=i.length;for(const s of i)n+=this.#E(s.id,e);return n}async#v(t,e){if(!this.#e||this.#n.has(t.id))return;this.#n.add(t.id),this.#p();let i;try{const n=await e.getSignatureData(t.id);if(e!==this.#d)return;if(!n)throw new Error("missing signature data");i=await this.#e.verify({...t,...n})}catch(n){console.warn("signature verify failed:",n),i={status:"unknown",errorCode:"BRIDGE_ERROR",message:n?.message??null,certificate:null,documentModifiedAfterSigning:!t.coversWholeDocument,modificationsAfterSignature:t.modificationsAfterSignature}}this.#n.delete(t.id),e===this.#d&&(this.#a.set(t.id,i),this.#p(),this.#y())}#y(){const t=this.#t.signaturePropertiesButton;if(t.classList.remove("state-loading","state-verified","state-warn","state-error"),this.#s.length!==0){if(this.#n.size>0){t.classList.add("state-loading");return}switch(this.#g){case"invalid":case"revoked":case"unknown":t.classList.add("state-error");break;case"expired":case"untrusted":t.classList.add("state-warn");break;default:t.classList.add("state-verified")}}}}class Qa{#t=null;#e;constructor(t,e,i=0){this.#e=t,this.eventBus=e;const n=[{element:t.previous,eventName:"previouspage"},{element:t.next,eventName:"nextpage"},{element:t.zoomIn,eventName:"zoomin"},{element:t.zoomOut,eventName:"zoomout"},{element:t.print,eventName:"print"},{element:t.download,eventName:"download"},{element:t.editorCommentButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:s}=t.editorCommentButton;return s.contains("toggled")?B.NONE:B.POPUP}}},{element:t.editorFreeTextButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:s}=t.editorFreeTextButton;return s.contains("toggled")?B.NONE:B.FREETEXT}}},{element:t.editorHighlightButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:s}=t.editorHighlightButton;return s.contains("toggled")?B.NONE:B.HIGHLIGHT}}},{element:t.editorInkButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:s}=t.editorInkButton;return s.contains("toggled")?B.NONE:B.INK}}},{element:t.editorStampButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:s}=t.editorStampButton;return s.contains("toggled")?B.NONE:B.STAMP}},telemetry:{type:"editing",data:{action:"pdfjs.image.icon_click"}}},{element:t.editorSignatureButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:s}=t.editorSignatureButton;return s.contains("toggled")?B.NONE:B.SIGNATURE}}}];this.#s(n),this.#i({value:i}),this.reset()}#i({value:t}){let e="normal";switch(t){case 1:e="compact";break;case 2:e="touch";break}document.documentElement.setAttribute("data-toolbar-density",e)}setPageNumber(t,e){this.pageNumber=t,this.pageLabel=e,this.#n(!1)}setPagesCount(t,e){this.pagesCount=t,this.hasPageLabels=e,this.#n(!0)}setPageScale(t,e){this.pageScaleValue=(t||e).toString(),this.pageScale=e,this.#n(!1)}reset(){this.#t=null,this.pageNumber=0,this.pageLabel=null,this.hasPageLabels=!1,this.pagesCount=0,this.pageScaleValue="auto",this.pageScale=1,this.#n(!0),this.updateLoadingIndicatorState(),this.#a({mode:B.DISABLE})}#s(t){const{eventBus:e}=this,{editorHighlightColorPicker:i,editorHighlightButton:n,pageNumber:s,scaleSelect:a}=this.#e,o=this;for(const{element:l,eventName:d,eventDetails:h,telemetry:c}of t)l.addEventListener("click",u=>{d!==null&&e.dispatch(d,{source:this,...h,isFromKeyboard:u.detail===0}),c&&e.dispatch("reporttelemetry",{source:this,details:c})});s.addEventListener("click",function(){this.select()}),s.addEventListener("change",function(){e.dispatch("pagenumberchanged",{source:o,value:this.value})}),e.on("pagesedited",({pagesMapper:l})=>{const d=l.pagesNumber;d!==this.pagesCount&&this.setPagesCount(d,this.hasPageLabels)},x),a.addEventListener("change",function(){this.value!=="custom"&&e.dispatch("scalechanged",{source:o,value:this.value})}),a.addEventListener("click",function({target:l}){this.value===o.pageScaleValue&&l.tagName.toUpperCase()==="OPTION"&&this.blur()}),a.oncontextmenu=q,e.on("annotationeditormodechanged",this.#a.bind(this),x),e.on("showannotationeditorui",({mode:l})=>{l===B.HIGHLIGHT&&n.click()},x),e.on("toolbardensity",this.#i.bind(this),x),i&&(e.on("annotationeditoruimanager",({uiManager:l})=>{const d=this.#t=new cn({uiManager:l});l.setMainHighlightColorPicker(d),i.append(d.renderMainDropdown())},x),e.on("mainhighlightcolorpickerupdatecolor",({value:l})=>{this.#t?.updateColor(l)},x))}#a({mode:t}){const{editorCommentButton:e,editorCommentParamsToolbar:i,editorFreeTextButton:n,editorFreeTextParamsToolbar:s,editorHighlightButton:a,editorHighlightParamsToolbar:o,editorInkButton:l,editorInkParamsToolbar:d,editorStampButton:h,editorStampParamsToolbar:c,editorSignatureButton:u,editorSignatureParamsToolbar:f}=this.#e;G(e,t===B.POPUP,i),G(n,t===B.FREETEXT,s),G(a,t===B.HIGHLIGHT,o),G(l,t===B.INK,d),G(h,t===B.STAMP,c),G(u,t===B.SIGNATURE,f),e.disabled=n.disabled=a.disabled=l.disabled=h.disabled=u.disabled=t===B.DISABLE}#n(t=!1){const{pageNumber:e,pagesCount:i,pageScaleValue:n,pageScale:s}=this,a=this.#e;t&&(this.hasPageLabels?(a.pageNumber.type="text",a.numPages.setAttribute("data-l10n-id","pdfjs-page-of-pages")):(a.pageNumber.type="number",a.numPages.setAttribute("data-l10n-id","pdfjs-of-pages"),a.numPages.setAttribute("data-l10n-args",JSON.stringify({pagesCount:i}))),a.pageNumber.max=i),this.hasPageLabels?(a.pageNumber.value=this.pageLabel,a.numPages.setAttribute("data-l10n-args",JSON.stringify({pageNumber:e,pagesCount:i}))):a.pageNumber.value=e,a.previous.disabled=e<=1,a.next.disabled=e>=i,a.zoomOut.disabled=s<=.1,a.zoomIn.disabled=s>=25;let o=!1;for(const l of a.scaleSelect.options){if(l.value!==n){l.selected=!1;continue}l.selected=!0,o=!0}o||(a.customScaleOption.selected=!0,a.customScaleOption.setAttribute("data-l10n-args",JSON.stringify({scale:Math.round(s*1e4)/100})))}updateLoadingIndicatorState(t=!1){const{pageNumber:e}=this.#e;e.classList.toggle("loading",t)}}const Ja=20;class qa{constructor(t,e=Ja){this.fingerprint=t,this.cacheSize=e,this._initializedPromise=this._readFromStorage().then(i=>{const n=JSON.parse(i||"{}");let s=-1;if(!Array.isArray(n.files))n.files=[];else{for(;n.files.length>=this.cacheSize;)n.files.shift();for(let a=0,o=n.files.length;a<o;a++)if(n.files[a].fingerprint===this.fingerprint){s=a;break}}s===-1&&(s=n.files.push({fingerprint:this.fingerprint})-1),this.file=n.files[s],this.database=n})}async _writeToStorage(){const t=JSON.stringify(this.database);localStorage.setItem("pdfjs.history",t)}async _readFromStorage(){return localStorage.getItem("pdfjs.history")}async set(t,e){return await this._initializedPromise,this.file[t]=e,this._writeToStorage()}async setMultiple(t){await this._initializedPromise;for(const e in t)this.file[e]=t[e];return this._writeToStorage()}async get(t,e){await this._initializedPromise;const i=this.file[t];return i!==void 0?i:e}async getMultiple(t){await this._initializedPromise;const e=Object.create(null);for(const i in t){const n=this.file[i];e[i]=n!==void 0?n:t[i]}return e}}const tr="--viewsManager-width",Gi="viewsManagerResizing",Xi="pdfSidebarNotification";class yt extends ci{static#t=null;#e=!window.matchMedia("(prefers-reduced-motion: reduce)").matches;constructor({elements:{outerContainer:t,sidebarContainer:e,toggleButton:i,resizer:n,thumbnailButton:s,outlineButton:a,attachmentsButton:o,layersButton:l,thumbnailsView:d,outlinesView:h,attachmentsView:c,layersView:u,viewsManagerAddFile:{button:f},viewsManagerCurrentOutlineButton:g,viewsManagerSelectorButton:p,viewsManagerSelectorOptions:b,viewsManagerHeaderLabel:w,viewsManagerStatus:C},eventBus:E,l10n:P,enableMerge:v=!1,enableSplitMerge:_=!1,globalAbortSignal:T}){super({sidebar:e,resizer:n,toggleButton:i},P.getDirection()==="ltr",!1,T),this.isOpen=!1,this.active=N.THUMBS,this.isInitialViewSet=!1,this.isInitialEventDispatched=!1,this.onToggled=null,this.onUpdateThumbnails=null,this.outerContainer=t,this.sidebarContainer=e,this.toggleButton=i,this.resizer=n,this.thumbnailButton=s,this.outlineButton=a,this.attachmentsButton=o,this.layersButton=l,this.thumbnailsView=d,this.outlinesView=h,this.attachmentsView=c,this.layersView=u,this.viewsManagerAddFileButton=f,this.viewsManagerCurrentOutlineButton=g,this.viewsManagerHeaderLabel=w,this.viewsManagerStatus=C,this.eventBus=E,_||(C.hidden=!0),this._enableSplitMerge=_,this._enableMerge=v,v||(f.hidden=!0),this.menu=new Mi(b,p,[s,a,o,l]),yt.#t||=Object.freeze({pagesTitle:"pdfjs-views-manager-pages-title",outlinesTitle:"pdfjs-views-manager-outlines-title1",attachmentsTitle:"pdfjs-views-manager-attachments-title",layersTitle:"pdfjs-views-manager-layers-title1",notificationButton:"pdfjs-toggle-views-manager-notification-button",toggleButton:"pdfjs-toggle-views-manager-button1"}),this.#n()}reset(){this.isInitialViewSet=!1,this.isInitialEventDispatched=!1,this.#a(!0),this.switchView(N.THUMBS),this.outlineButton.disabled=this.attachmentsButton.disabled=this.layersButton.disabled=!1,this.viewsManagerCurrentOutlineButton.disabled=!0}get visibleView(){return this.isOpen?this.active:N.NONE}setInitialView(t=N.NONE){if(!this.isInitialViewSet){if(this.isInitialViewSet=!0,t===N.NONE||t===N.UNKNOWN){this.#i();return}this.switchView(t,!0),this.isInitialEventDispatched||this.#i()}}switchView(t,e=!1){const i=t!==this.active;let n=!1,s=null;switch(t){case N.NONE:this.isOpen&&this.close();return;case N.THUMBS:s="pagesTitle",this.isOpen&&i&&(n=!0);break;case N.OUTLINE:if(s="outlinesTitle",this.outlineButton.disabled)return;break;case N.ATTACHMENTS:if(s="attachmentsTitle",this.attachmentsButton.disabled)return;break;case N.LAYERS:if(s="layersTitle",this.layersButton.disabled)return;break;default:console.error(`PDFSidebar.switchView: "${t}" is not a valid view.`);return}if(this.viewsManagerStatus.hidden=!this._enableSplitMerge||t!==N.THUMBS,this.viewsManagerAddFileButton.hidden=!this._enableMerge||t!==N.THUMBS,this.viewsManagerCurrentOutlineButton.hidden=t!==N.OUTLINE,this.viewsManagerHeaderLabel.setAttribute("data-l10n-id",yt.#t[s]||""),this.active=t,Bt(this.thumbnailButton,t===N.THUMBS,this.thumbnailsView),Bt(this.outlineButton,t===N.OUTLINE,this.outlinesView),Bt(this.attachmentsButton,t===N.ATTACHMENTS,this.attachmentsView),Bt(this.layersButton,t===N.LAYERS,this.layersView),e&&!this.isOpen){this.open();return}n&&(this.onUpdateThumbnails(),this.onToggled()),i&&this.#i()}open(){this.isOpen||(this.isOpen=!0,this.onResizing(this.width),this._sidebar.hidden=!1,G(this.toggleButton,!0),this.switchView(this.active),this.#e?queueMicrotask(()=>{this.outerContainer.classList.add("viewsManagerMoving","viewsManagerOpen")}):(this.outerContainer.classList.add("viewsManagerOpen"),this.eventBus.dispatch("resize",{source:this})),this.active===N.THUMBS&&this.onUpdateThumbnails(),this.onToggled(),this.#i(),this.#a())}close(t=null){this.isOpen&&(this.isOpen=!1,this._sidebar.hidden=!0,G(this.toggleButton,!1),this.outerContainer.classList.add("viewsManagerMoving"),this.outerContainer.classList.remove("viewsManagerOpen"),this.onToggled(),this.#i(),t?.detail>0&&this.toggleButton.blur())}toggle(t=null){super.toggle(),this.isOpen?this.close(t):this.open()}#i(){this.isInitialViewSet&&(this.isInitialEventDispatched||=!0),this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}#s(){this.toggleButton.setAttribute("data-l10n-id",yt.#t.notificationButton),this.isOpen||this.toggleButton.classList.add(Xi)}#a(t=!1){(this.isOpen||t)&&this.toggleButton.classList.remove(Xi),t&&this.toggleButton.setAttribute("data-l10n-id",yt.#t.toggleButton)}#n(){const{eventBus:t,outerContainer:e}=this;this.#e&&this.sidebarContainer.addEventListener("transitionend",n=>{n.target===this.sidebarContainer&&(e.classList.remove("viewsManagerMoving"),t.dispatch("resize",{source:this}))}),this.viewsManagerHeaderLabel.addEventListener("dblclick",n=>{if(this.active===N.OUTLINE){t.dispatch("toggleoutlinetree",{source:this});return}this.active===N.LAYERS&&t.dispatch("resetlayers",{source:this})}),this.thumbnailButton.addEventListener("click",()=>{this.switchView(N.THUMBS)}),this.outlineButton.addEventListener("click",()=>{this.switchView(N.OUTLINE)}),this.attachmentsButton.addEventListener("click",()=>{this.switchView(N.ATTACHMENTS)}),this.layersButton.addEventListener("click",()=>{this.switchView(N.LAYERS)}),this.viewsManagerCurrentOutlineButton.addEventListener("click",()=>{t.dispatch("currentoutlineitem",{source:this})});const i=(n,s,a)=>{s.disabled=!n,n?this.#s():this.active===a&&this.switchView(N.THUMBS)};t.on("outlineloaded",n=>{i(n.outlineCount,this.outlineButton,N.OUTLINE),n.currentOutlineItemPromise.then(s=>{this.isInitialViewSet&&(this.viewsManagerCurrentOutlineButton.disabled=!s)})},x),t.on("attachmentsloaded",n=>{i(n.attachmentsCount,this.attachmentsButton,N.ATTACHMENTS)},x),t.on("layersloaded",n=>{i(n.layersCount,this.layersButton,N.LAYERS)},x),t.on("presentationmodechanged",n=>{n.state===H.NORMAL&&this.visibleView===N.THUMBS&&this.onUpdateThumbnails()},x)}onStartResizing(){this.outerContainer.classList.add(Gi)}onStopResizing(){this.eventBus.dispatch("resize",{source:this}),this.outerContainer.classList.remove(Gi)}onResizing(t){Yt.setProperty(tr,`${t}px`)}}const er=1e4,Ee={UNKNOWN:-1,PREVIOUS:0,INITIAL:1},vt={initialBookmark:document.location.hash.substring(1),_initializedCapability:{...Promise.withResolvers(),settled:!1},appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfTextExtractor:null,pdfHistory:null,viewsManager:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,store:null,downloadManager:null,overlayManager:null,preferences:new As,toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,annotationEditorParams:null,signaturePropertiesManager:null,imageAltTextSettings:null,isInitialViewSet:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",mlManager:null,_downloadUrl:"",_eventBusAC:null,_windowAC:null,_globalAbortController:new AbortController,documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_wheelUnusedTicks:0,_wheelUnusedFactor:1,_touchManager:null,_touchUnusedTicks:0,_touchUnusedFactor:1,_PDFBug:null,_hasAnnotationEditors:!1,_title:document.title,_printAnnotationStoragePromise:null,_isCtrlKeyDown:!1,_caretBrowsing:null,_isScrolling:!1,editorUndoBar:null,_printPermissionPromise:null,async initialize(r){this.appConfig=r;try{await this.preferences.initializedPromise}catch(e){console.error("initialize:",e)}S.get("pdfBugEnabled")&&await this._parseHashParams();let t;switch(S.get("viewerCssTheme")){case 1:t="light";break;case 2:t="dark";break}t&&Yt.setProperty("color-scheme",t),this.l10n=await this.externalServices.createL10n(),document.getElementsByTagName("html")[0].dir=this.l10n.getDirection(),this.l10n.translate(r.appContainer||document.documentElement),this.isViewerEmbedded&&S.get("externalLinkTarget")===et.NONE&&S.set("externalLinkTarget",et.TOP),await this._initializeViewerComponents(),this.bindEvents(),this.bindWindowEvents(),this._initializedCapability.settled=!0,this._initializedCapability.resolve()},async _parseHashParams(){const r=document.location.hash.substring(1);if(!r)return;const{mainContainer:t,viewerContainer:e}=this.appConfig,i=Ct(r),n=async()=>{if(this._PDFBug)return;const{PDFBug:a}=await import(S.get("debuggerSrc"));this._PDFBug=a};if(i.get("disableworker")==="true")try{Fe.workerSrc||=S.get("workerSrc"),await import(In.workerSrc),S.set("workerPort",null)}catch(a){console.error("_parseHashParams:",a)}if(i.has("textlayer"))switch(i.get("textlayer")){case"off":S.set("textLayerMode",K.DISABLE);break;case"visible":case"shadow":case"hover":e.classList.add(`textLayer-${i.get("textlayer")}`);try{await n(),this._PDFBug.loadCSS()}catch(a){console.error("_parseHashParams:",a)}break}if(i.has("pdfbug")){const a=i.get("pdfbug").split(",");try{await n(),this._PDFBug.init(t,a)}catch(l){console.error("_parseHashParams:",l)}const o={pdfBug:!0,fontExtraProperties:!0};globalThis.StepperManager?.enabled&&(o.minDurationToUpdateCanvas=0),S.setAll(o)}i.has("locale")&&S.set("localeProperties",{lang:i.get("locale")});const s={disableAutoFetch:a=>a==="true",disableFontFace:a=>a==="true",disableHistory:a=>a==="true",disableRange:a=>a==="true",disableStream:a=>a==="true",verbosity:a=>a|0};for(const a in s){const o=s[a],l=a.toLowerCase();i.has(l)&&S.set(a,o(i.get(l)))}},async _initializeViewerComponents(){const{appConfig:r,externalServices:t,l10n:e,mlManager:i}=this,n=this._globalAbortController.signal,s=new jt;this.eventBus=S.eventBus=s,i?.setEventBus(s,n);const a=this.overlayManager=new Hs,o=this.pdfRenderingQueue=new Ai;o.onIdle=this._cleanup.bind(this);const l=this.pdfLinkService=new We({eventBus:s,externalLinkTarget:S.get("externalLinkTarget"),externalLinkRel:S.get("externalLinkRel"),ignoreDestinationZoom:S.get("ignoreDestinationZoom")}),d=S.get("supportsDownloading"),h=this.downloadManager=d?new Us:null;r.secondaryToolbar?.downloadButton&&(r.secondaryToolbar.downloadButton.hidden=!d),r.toolbar?.download&&(r.toolbar.download.hidden=!d);const c=this.findController=new na({linkService:l,eventBus:s,updateMatchesCountOnProgress:!0}),u=this.pdfScriptingManager=new Pa({eventBus:s,externalServices:t,docProperties:this._scriptingDocProperties.bind(this)}),f=r.mainContainer,g=r.viewerContainer,p=S.get("annotationEditorMode"),b=S.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches,w=b?{background:S.get("pageColorsBackground"),foreground:S.get("pageColorsForeground")}:null,C=S.get("enableMerge"),E=S.get("enableSplitMerge");let P;S.get("enableUpdatedAddImage")?P=r.newAltTextDialog?new Ms(r.newAltTextDialog,a,s):null:P=r.altTextDialog?new Bs(r.altTextDialog,f,a,s):null,r.editorUndoBar&&(this.editorUndoBar=new Xt(r.editorUndoBar,s));const v=S.get("enableSignatureEditor")&&r.addSignatureDialog?new Et(r.addSignatureDialog,r.editSignatureDialog,r.annotationEditorParams?.editorSignatureAddSignature||null,a,e,t.createSignatureStorage(s,n),s):null,_=S.get("enableComment")&&r.editCommentDialog?new rt(r.editCommentDialog,{learnMoreUrl:S.get("commentLearnMoreUrl"),sidebar:r.annotationEditorParams?.editorCommentsSidebar||null,sidebarResizer:r.annotationEditorParams?.editorCommentsSidebarResizer||null,commentsList:r.annotationEditorParams?.editorCommentsSidebarList||null,commentCount:r.annotationEditorParams?.editorCommentsSidebarCount||null,sidebarTitle:r.annotationEditorParams?.editorCommentsSidebarTitle||null,closeButton:r.annotationEditorParams?.editorCommentsSidebarCloseButton||null,commentToolbarButton:r.toolbar?.editorCommentButton||null},s,l,a,e.getDirection()==="ltr",b,n):null,T=S.get("maxCanvasPixels"),D=S.get("maxCanvasDim"),y=S.get("capCanvasAreaFactor"),I=this.pdfViewer=new Ua({container:f,viewer:g,viewerAlert:r.viewerAlert,eventBus:s,renderingQueue:o,linkService:l,downloadManager:h,altTextManager:P,commentManager:_,signatureManager:v,editorUndoBar:this.editorUndoBar,findController:c,scriptingManager:S.get("enableScripting")&&u,l10n:e,textLayerMode:S.get("textLayerMode"),annotationMode:S.get("annotationMode"),annotationEditorMode:p,annotationEditorHighlightColors:S.get("highlightEditorColors"),enableHighlightFloatingButton:S.get("enableHighlightFloatingButton"),enableUpdatedAddImage:S.get("enableUpdatedAddImage"),enableNewAltTextWhenAddingImage:S.get("enableNewAltTextWhenAddingImage"),imageResourcesPath:S.get("imageResourcesPath"),enablePrintAutoRotate:S.get("enablePrintAutoRotate"),maxCanvasPixels:T,maxCanvasDim:D,capCanvasAreaFactor:y,enableDetailCanvas:S.get("enableDetailCanvas"),enablePermissions:S.get("enablePermissions"),enableOptimizedPartialRendering:S.get("enableOptimizedPartialRendering"),enableSelectionRendering:S.get("enableSelectionRendering"),imagesRightClickMinSize:S.get("imagesRightClickMinSize"),pageColors:w,mlManager:i,abortSignal:n,supportsPinchToZoom:this.supportsPinchToZoom,enableAutoLinking:S.get("enableAutoLinking"),minDurationToUpdateCanvas:S.get("minDurationToUpdateCanvas")});if(o.setViewer(I),l.setViewer(I),u.setViewer(I),r.viewsManager?.thumbnailsView){const{viewsManager:A}=r;this.pdfThumbnailViewer=new ut({container:A.thumbnailsView,eventBus:s,renderingQueue:o,linkService:l,maxCanvasPixels:T,maxCanvasDim:D,pageColors:w,abortSignal:n,enableSplitMerge:E,enableMerge:C,enableNewBadge:S.get("enableNewBadge"),statusBar:A.viewsManagerStatusBar,undoBar:A.viewsManagerUndoBar,manageMenu:A.manageMenu,waitingBar:A.viewsManagerWaitingBar,addFileComponent:A.viewsManagerAddFile}),o.setThumbnailViewer(this.pdfThumbnailViewer)}if(!this.isViewerEmbedded&&!S.get("disableHistory")&&(this.pdfHistory=new da({linkService:l,eventBus:s}),l.setHistory(this.pdfHistory)),!this.supportsIntegratedFind&&r.findBar&&(this.findBar=new aa(r.findBar,r.principalContainer,s)),r.annotationEditorParams)if(p!==B.DISABLE){const A=r.toolbar?.editorSignatureButton;A&&S.get("enableSignatureEditor")&&(A.parentElement.hidden=!1);const R=r.toolbar?.editorCommentButton;R&&S.get("enableComment")&&(R.parentElement.hidden=!1),this.annotationEditorParams=new Ds(r.annotationEditorParams,s)}else for(const A of["editorModeButtons","editorModeSeparator"])document.getElementById(A)?.classList.add("hidden");i&&r.secondaryToolbar?.imageAltTextSettingsButton&&(this.imageAltTextSettings=new ks(r.altTextSettingsDialog,a,s,i)),r.documentProperties&&(this.pdfDocumentProperties=new Ys(r.documentProperties,a,s,e,()=>this._docFilename,()=>this._docTitle)),r.secondaryToolbar?.cursorHandToolButton&&(this.pdfCursorTools=new Gs({container:f,eventBus:s,cursorToolOnLoad:S.get("cursorToolOnLoad")})),r.toolbar&&(this.toolbar=new Qa(r.toolbar,s,S.get("toolbarDensity"))),r.secondaryToolbar&&(S.get("enableAltText")&&(r.secondaryToolbar.imageAltTextSettingsButton?.classList.remove("hidden"),r.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove("hidden")),this.secondaryToolbar=new Ha(r.secondaryToolbar,s)),this.supportsFullscreen&&r.secondaryToolbar?.presentationModeButton&&(this.pdfPresentationMode=new ba({container:f,pdfViewer:I,eventBus:s})),r.passwordOverlay&&(this.passwordPrompt=new zs(r.passwordOverlay,a,this.isViewerEmbedded)),r.viewsManager?.outlinesView&&(this.pdfOutlineViewer=new ga({container:r.viewsManager.outlinesView,eventBus:s,l10n:e,linkService:l,downloadManager:h})),r.viewsManager?.attachmentsView&&(this.pdfAttachmentViewer=new Ws({container:r.viewsManager.attachmentsView,eventBus:s,l10n:e,downloadManager:h,linkService:l})),r.viewsManager?.layersView&&(this.pdfLayerViewer=new ua({container:r.viewsManager.layersView,eventBus:s,l10n:e})),r.viewsManager&&(this.viewsManager=new yt({elements:r.viewsManager,eventBus:s,l10n:e,enableMerge:C,enableSplitMerge:E,globalAbortSignal:n}),this.viewsManager.onToggled=this.forceRendering.bind(this),this.viewsManager.onUpdateThumbnails=()=>{for(const A of I.getCachedPageViews())A.renderingState===k.FINISHED&&this.pdfThumbnailViewer.getThumbnail(A.id-1)?.setImage(A);this.pdfThumbnailViewer.scrollThumbnailIntoView(I.currentPageNumber)})},async run(r){await this.initialize(r);const{appConfig:t,eventBus:e}=this;let i;const n=document.location.search.substring(1);i=Ct(n).get("file")??S.get("defaultUrl");try{i=new URL(i).href}catch{i=encodeURIComponent(i).replaceAll("%2F","/")}ir(i);const a=this._openFileInput=document.createElement("input");a.id="fileInput",a.hidden=!0,a.type="file",a.value=null,document.body.append(a),a.addEventListener("change",function(l){const{files:d}=l.target;d?.length&&e.dispatch("fileinputchange",{source:this,fileInput:l.target})}),t.mainContainer.addEventListener("dragover",function(l){for(const d of l.dataTransfer.items)if(d.type==="application/pdf"){l.dataTransfer.dropEffect=l.dataTransfer.effectAllowed==="copy"?"copy":"move",L(l);return}}),t.mainContainer.addEventListener("drop",function(l){l.dataTransfer.files?.[0].type==="application/pdf"&&(L(l),e.dispatch("fileinputchange",{source:this,fileInput:l.dataTransfer}))}),S.get("supportsDocumentFonts")||(S.set("disableFontFace",!0),this.l10n.get("pdfjs-web-fonts-disabled").then(l=>{console.warn(l)}));const o=l=>{t.toolbar?.print?.classList.toggle("hidden",!l),t.secondaryToolbar?.printButton.classList.toggle("hidden",!l)};this.supportsPrinting?e.on("printingallowed",({isAllowed:l})=>o(l),x):o(!1),this.supportsFullscreen||t.secondaryToolbar?.presentationModeButton.classList.add("hidden"),this.supportsIntegratedFind&&t.findBar?.toggleButton?.classList.add("hidden"),i?this.open({url:i}):this._hideViewBookmark()},get externalServices(){return z(this,"externalServices",new Ns)},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},updateZoom(r,t,e){this.pdfViewer.isInPresentationMode||this.pdfViewer.updateScale({drawingDelay:S.get("defaultZoomDelay"),steps:r,scaleFactor:t,origin:e})},zoomIn(){this.updateZoom(1)},zoomOut(){this.updateZoom(-1)},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue="auto")},touchPinchCallback(r,t,e){if(this.supportsPinchToZoom){const i=this._accumulateFactor(this.pdfViewer.currentScale,e/t,"_touchUnusedFactor");this.updateZoom(null,i,r)}else{const n=this._accumulateTicks((e-t)/30,"_touchUnusedTicks");this.updateZoom(n,null,r)}},touchPinchEndCallback(){this._touchUnusedTicks=0,this._touchUnusedFactor=1},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(r){this.pdfViewer.currentPageNumber=r},get supportsPrinting(){return z(this,"supportsPrinting",S.get("supportsPrinting")&&we.supportsPrinting)},get supportsFullscreen(){return z(this,"supportsFullscreen",document.fullscreenEnabled)},get supportsPinchToZoom(){return z(this,"supportsPinchToZoom",S.get("supportsPinchToZoom"))},get supportsIntegratedFind(){return z(this,"supportsIntegratedFind",S.get("supportsIntegratedFind"))},get loadingBar(){const r=document.getElementById("loadingBar"),t=r?new sn(r):null;return z(this,"loadingBar",t)},get supportsMouseWheelZoomCtrlKey(){return z(this,"supportsMouseWheelZoomCtrlKey",S.get("supportsMouseWheelZoomCtrlKey"))},get supportsMouseWheelZoomMetaKey(){return z(this,"supportsMouseWheelZoomMetaKey",S.get("supportsMouseWheelZoomMetaKey"))},get supportsCaretBrowsingMode(){return S.get("supportsCaretBrowsingMode")},moveCaret(r,t){this._caretBrowsing||=new Gt(this._globalAbortController.signal,this.appConfig.mainContainer,this.appConfig.viewerContainer,this.appConfig.toolbar?.container),this._caretBrowsing.moveCaret(r,t)},setTitleUsingUrl(r="",t=null){this.url=r,this.baseUrl=te(r,"",!0),t&&(this._downloadUrl=t===r?this.baseUrl:te(t,"",!0)),En(r)&&this._hideViewBookmark();let e=Oe(r,"");if(!e)try{e=decodeURIComponent(mn(r))}catch{}this.setTitle(e||r)},setTitle(r=this._title){if(this._title=r,this.isViewerEmbedded)return;const t=this._hasChanges()&&!this.pdfRenderingQueue.printing;document.title=`${t?"* ":""}${r}`},get _docFilename(){return this._contentDispositionFilename||Oe(this.url)},get _docTitle(){const{documentInfo:r,metadata:t}=this,e=t?.get("dc:title");return e&&e!=="Untitled"&&!/[\uFFF0-\uFFFF]/.test(e)?e:r.Title},_hideViewBookmark(){const{secondaryToolbar:r}=this.appConfig;r?.viewBookmarkButton.classList.add("hidden"),r?.presentationModeButton.classList.contains("hidden")&&document.getElementById("viewBookmarkSeparator")?.classList.add("hidden")},async close(){if(this._unblockDocumentLoadEvent(),this._hideViewBookmark(),!this.pdfLoadingTask)return;if(this._hasChanges()&&this._annotationStorageModified)try{await this.downloadOrSave()}catch{}const r=[];r.push(this.pdfLoadingTask.destroy()),this.pdfLoadingTask=null,this.pdfDocument&&(this.pdfDocument=null,this.pdfThumbnailViewer?.setDocument(null),this.pdfViewer.setDocument(null),this.pdfLinkService.setDocument(null),this.pdfDocumentProperties?.setDocument(null),this.signaturePropertiesManager?.setDocument(null)),this.pdfLinkService.externalLinkEnabled=!0,this.store=null,this.isInitialViewSet=!1,this.url="",this.baseUrl="",this._downloadUrl="",this.documentInfo=null,this.metadata=null,this._contentDispositionFilename=null,this._contentLength=null,this._saveInProgress=!1,this._hasAnnotationEditors=!1,r.push(this.pdfScriptingManager.destroyPromise,this.passwordPrompt.close()),this.setTitle(),this.viewsManager?.reset(),this.pdfOutlineViewer?.reset(),this.pdfAttachmentViewer?.reset(),this.pdfLayerViewer?.reset(),this.pdfHistory?.reset(),this.findBar?.reset(),this.toolbar?.reset(),this.secondaryToolbar?.reset(),this._PDFBug?.cleanup(),await Promise.all(r)},async open(r){this.pdfLoadingTask&&await this.close();const t=S.getAll(m.WORKER);Object.assign(Fe,t),r.data&&je(r.filename)?this._contentDispositionFilename=r.filename:r.url&&this.setTitleUsingUrl(r.originalUrl||r.url,r.url);const e=S.getAll(m.API),i=pn({...e,...r});return this.pdfLoadingTask=i,i.onPassword=(n,s)=>{this.isViewerEmbedded&&this._unblockDocumentLoadEvent(),this.pdfLinkService.externalLinkEnabled=!1,this.passwordPrompt.setUpdateCallback(n,s),this.passwordPrompt.open()},i.onProgress=n=>this.progress(n.percent),i.promise.then(n=>{this.load(n)},n=>{if(i!==this.pdfLoadingTask)return;this.loadingBar&&(this.loadingBar.percent||=0);let s="pdfjs-loading-error";return n instanceof vn?s="pdfjs-invalid-file-error":n instanceof xn&&(s=n.missing?"pdfjs-missing-file-error":"pdfjs-unexpected-response-error"),this._documentError(s,{message:n.message}).then(()=>{throw n})})},async download(){if(!this.downloadManager)return;let r;try{r=await(this.pdfDocument?this.pdfDocument.getData():this.pdfLoadingTask.getData())}catch{}this.downloadManager.download(r,this._downloadUrl,this._docFilename)},async save(){if(!this.downloadManager||this._saveInProgress)return;this._saveInProgress=!0,await this.pdfScriptingManager.dispatchWillSave();try{const t=await this.pdfDocument.saveDocument();this.downloadManager.download(t,this._downloadUrl,this._docFilename)}catch(t){console.error("Error when saving the document:",t),await this.download()}finally{await this.pdfScriptingManager.dispatchDidSave(),this._saveInProgress=!1}const r=this.pdfDocument?.annotationStorage.editorStats;r&&this.externalServices.reportTelemetry({type:"editing",data:{type:"save",stats:r}})},async downloadOrSave(){if(!this.downloadManager)return;this.pdfViewer._layerProperties.annotationEditorUIManager?.endCurrentEditing();const{classList:r}=this.appConfig.appContainer;r.add("wait"),this.pdfThumbnailViewer?.hasStructuralChanges()?(this.externalServices.reportTelemetry({type:"pageOrganization",data:{action:"save"}}),await this.onSavePages({data:this.pdfThumbnailViewer.getStructuralChanges()})):await(this.pdfDocument?.annotationStorage.size>0?this.save():this.download()),delete this._mergedDocumentNeedsSaving,this.setTitle(),r.remove("wait")},async _documentError(r,t=null){this._unblockDocumentLoadEvent();const e=await this._otherError(r||"pdfjs-loading-error",t);this.eventBus.dispatch("documenterror",{source:this,message:e,reason:t?.message??null})},async _otherError(r,t=null){const e=await this.l10n.get(r),i=[`PDF.js v${Ft||"?"} (build: ${Be||"?"})`];return t&&(i.push(`Message: ${t.message}`),t.stack?i.push(`Stack: ${t.stack}`):(t.filename&&i.push(`File: ${t.filename}`),t.lineNumber&&i.push(`Line: ${t.lineNumber}`))),console.error(`${e}
|
|
554
|
+
|
|
555
|
+
${i.join(`
|
|
556
|
+
`)}`),e},progress(r){!this.loadingBar||r<=this.loadingBar.percent||(this.loadingBar.percent=r,(this.pdfDocument?.loadingParams.disableAutoFetch??S.get("disableAutoFetch"))&&this.loadingBar.setDisableAutoFetch())},load(r){this.pdfDocument=r,this._printPermissionPromise=new Promise(d=>{this.eventBus.on("printingallowed",({isAllowed:h})=>{d(h)},{once:!0,...x})}),r.getDownloadInfo().then(({length:d})=>{this._contentLength=d,this.loadingBar?.hide(),s.then(()=>{this.eventBus.dispatch("documentloaded",{source:this})})});const t=r.getPageLayout().catch(()=>{}),e=r.getPageMode().catch(()=>{}),i=r.getOpenAction().catch(()=>{});this.toolbar?.setPagesCount(r.numPages,!1),this.secondaryToolbar?.setPagesCount(r.numPages),this.pdfLinkService.setDocument(r),this.pdfDocumentProperties?.setDocument(r);const n=this.pdfViewer;n.setDocument(r);const{firstPagePromise:s,onePageRendered:a,pagesPromise:o}=n;this.pdfThumbnailViewer?.setDocument(r);const l=(this.store=new qa(r.fingerprints[0])).getMultiple({page:null,zoom:"auto",scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:N.UNKNOWN,scrollMode:M.UNKNOWN,spreadMode:j.UNKNOWN}).catch(()=>{});s.then(d=>{this.loadingBar?.setWidth(this.appConfig.viewerContainer),this._initializeAnnotationStorageCallbacks(r),Promise.all([nn,l,t,e,i]).then(async([h,c,u,f,g])=>{const p=S.get("viewOnLoad");this._initializePdfHistory({fingerprint:r.fingerprints[0],viewOnLoad:p,initialDest:g?.get("dest")});const b=this.initialBookmark,w=S.get("defaultZoomValue");let C=w?`zoom=${w}`:null,E=null,P=S.get("sidebarViewOnLoad"),v=S.get("scrollModeOnLoad"),_=S.get("spreadModeOnLoad");c?.page&&p!==Ee.INITIAL&&(C=`page=${c.page}&zoom=${w||c.zoom},${c.scrollLeft},${c.scrollTop}`,E=parseInt(c.rotation,10),P===N.UNKNOWN&&(P=c.sidebarView|0),v===M.UNKNOWN&&(v=c.scrollMode|0),_===j.UNKNOWN&&(_=c.spreadMode|0)),f&&P===N.UNKNOWN&&(P=an(f)),u&&v===M.UNKNOWN&&_===j.UNKNOWN&&(_=Me(u).spreadMode),this.setInitialView(C,{rotation:E,sidebarView:P,scrollMode:v,spreadMode:_}),this.eventBus.dispatch("documentinit",{source:this}),await Promise.race([o,new Promise(T=>{setTimeout(T,er)})]),!(!b&&!C)&&(n.hasEqualPageSizes||(this.initialBookmark=b,n.currentScaleValue=n.currentScaleValue,this.setInitialView(C)))}).catch(()=>{this.setInitialView()}).then(function(){n.update()})}),o.then(()=>{this._unblockDocumentLoadEvent(),this._initializeAutoPrint(r,i)},d=>{this._documentError("pdfjs-loading-error",{message:d.message})}),a.then(d=>{this.externalServices.reportTelemetry({type:"pageInfo",timestamp:d.timestamp}),this.pdfOutlineViewer&&r.getOutline().then(h=>{r===this.pdfDocument&&this.pdfOutlineViewer.render({outline:h,pdfDocument:r})}),this.pdfAttachmentViewer&&r.getAttachments().then(h=>{r===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:h})}),this.pdfLayerViewer&&n.optionalContentConfigPromise.then(h=>{r===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:h,pdfDocument:r})})}),this._initializePageLabels(r),this._initializeMetadata(r)},async _scriptingDocProperties(r){return!this.documentInfo&&(await new Promise(t=>{this.eventBus.on("metadataloaded",t,{once:!0,...x})}),r!==this.pdfDocument)||!this._contentLength&&(await new Promise(t=>{this.eventBus.on("documentloaded",t,{once:!0,...x})}),r!==this.pdfDocument)?null:{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:this._docFilename,metadata:this.metadata?.getRaw(),authors:this.metadata?.get("dc:creator"),numPages:this.pagesCount,URL:this.url}},async _initializeAutoPrint(r,t){const[e,i]=await Promise.all([t,this.pdfViewer.enableScripting?null:r.getJSActions()]);if(r!==this.pdfDocument)return;let n=e?.get("action")==="Print";if(i){console.warn("Warning: JavaScript support is not enabled");for(const s in i){if(n)break;switch(s){case"WillClose":case"WillSave":case"DidSave":case"WillPrint":case"DidPrint":continue}n=i[s].some(a=>Qi.test(a))}}n&&this.triggerPrinting()},async _initializeMetadata(r){const{info:t,metadata:e,contentDispositionFilename:i,contentLength:n,hasStructTree:s}=await r.getMetadata();if(r!==this.pdfDocument)return;this.externalServices.reportTelemetry({type:"taggedPDF",data:s}),this.documentInfo=t,this.metadata=e,this._contentDispositionFilename??=i,this._contentLength??=n,console.log(`PDF ${r.fingerprints[0]} [${t.PDFFormatVersion} ${(e?.get("pdf:producer")||t.Producer||"-").trim()} / ${(e?.get("xmp:creatortool")||t.Creator||"-").trim()}] (PDF.js: ${Ft||"?"} [${Be||"?"}])`);const a=this._docTitle;a?this.setTitle(`${a} - ${this._contentDispositionFilename||this._title}`):this._contentDispositionFilename&&this.setTitle(this._contentDispositionFilename),t.IsXFAPresent&&!t.IsAcroFormPresent&&!r.isPureXfa?r.loadingParams.enableXfa?console.warn("Warning: XFA Foreground documents are not supported"):console.warn("Warning: XFA support is not enabled"):(t.IsAcroFormPresent||t.IsXFAPresent)&&!this.pdfViewer.renderForms&&console.warn("Warning: Interactive form support is not enabled"),t.IsSignaturesPresent&&(this._maybeInitSignatureProperties(r)||console.warn("Warning: Digital signatures validation is not supported")),this.eventBus.dispatch("metadataloaded",{source:this})},_maybeInitSignatureProperties(r){if(!S.get("enableSignatureVerification"))return!1;const t=this.externalServices.createSignatureVerifier();return t?(r!==this.pdfDocument||(this.signaturePropertiesManager??=new Za({appConfig:this.appConfig.toolbar,verifier:t,eventBus:this.eventBus}),this.signaturePropertiesManager.setDocument(r)),!0):!1},async _initializePageLabels(r){const t=await r.getPageLabels();if(r!==this.pdfDocument||!t||S.get("disablePageLabels"))return;const e=t.length;let i=0,n=0;for(let l=0;l<e;l++){const d=t[l];if(d===(l+1).toString())i++;else if(d==="")n++;else break}if(i>=e||n>=e)return;const{pdfViewer:s,pdfThumbnailViewer:a,toolbar:o}=this;s.setPageLabels(t),a?.setPageLabels(t),o?.setPagesCount(e,!0),o?.setPageNumber(s.currentPageNumber,s.currentPageLabel)},_initializePdfHistory({fingerprint:r,viewOnLoad:t,initialDest:e=null}){this.pdfHistory&&(this.pdfHistory.initialize({fingerprint:r,resetHistory:t===Ee.INITIAL||!!this._mergedDocumentNeedsSaving,updateUrl:S.get("historyUpdateUrl")}),this.pdfHistory.initialBookmark&&(this.initialBookmark=this.pdfHistory.initialBookmark,this.initialRotation=this.pdfHistory.initialRotation),e&&!this.initialBookmark&&t===Ee.UNKNOWN&&(this.initialBookmark=JSON.stringify(e),this.pdfHistory.push({explicitDest:e,pageNumber:null})))},_hasChanges(){return this.pdfDocument?.annotationStorage.size>0||this.pdfThumbnailViewer?.hasStructuralChanges()||this._mergedDocumentNeedsSaving===!0},_initializeAnnotationStorageCallbacks(r){if(r!==this.pdfDocument)return;const{annotationStorage:t}=r;t.onSetModified=()=>{this._annotationStorageModified=!0},t.onResetModified=()=>{delete this._annotationStorageModified},t.onAnnotationEditor=e=>{this._hasAnnotationEditors=!!e,this.setTitle()}},setInitialView(r,{rotation:t,sidebarView:e,scrollMode:i,spreadMode:n}={}){const s=o=>{kt(o)&&(this.pdfViewer.pagesRotation=o)},a=(o,l)=>{Te(o)&&(this.pdfViewer.scrollMode=o),Ae(l)&&(this.pdfViewer.spreadMode=l)};this.isInitialViewSet=!0,this.viewsManager?.setInitialView(e),a(i,n),this.initialBookmark?(s(this.initialRotation),delete this.initialRotation,this.pdfLinkService.setHash(this.initialBookmark),this.initialBookmark=null):r&&(s(t),this.pdfLinkService.setHash(r)),this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel),this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber),this.pdfViewer.currentScaleValue||="auto"},_cleanup(){this.pdfDocument&&(this.pdfViewer.cleanup(),this.pdfThumbnailViewer?.cleanup(),this.pdfDocument.cleanup(S.get("fontExtraProperties")))},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService,this.pdfRenderingQueue.isThumbnailViewEnabled=this.viewsManager?.visibleView===N.THUMBS,this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){if(this._printAnnotationStoragePromise=this.pdfScriptingManager.dispatchWillPrint().catch(()=>{}).then(()=>this.pdfDocument?.annotationStorage.print),!this.printService){if(!this.supportsPrinting||!this.pdfViewer.printingAllowed){this._otherError("pdfjs-printing-not-supported");return}if(!this.pdfViewer.pageViewsReady){this.l10n.get("pdfjs-printing-not-ready").then(r=>{window.alert(r)});return}this.printService=we.createPrintService({pdfDocument:this.pdfDocument,pagesOverview:this.pdfViewer.getPagesOverview(),printContainer:this.appConfig.printContainer,printResolution:S.get("printResolution"),printAnnotationStoragePromise:this._printAnnotationStoragePromise}),this.forceRendering(),this.setTitle(),this.printService.layout(),this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"print",stats:this.pdfDocument?.annotationStorage.editorStats}})}},afterPrint(){this._printAnnotationStoragePromise&&(this._printAnnotationStoragePromise.then(()=>{this.pdfScriptingManager.dispatchDidPrint()}),this._printAnnotationStoragePromise=null),this.printService&&(this.printService.destroy(),this.printService=null,this.pdfDocument?.annotationStorage.resetModified()),this.forceRendering(),this.setTitle()},rotatePages(r){this.pdfViewer.pagesRotation+=r},requestPresentationMode(){this.pdfPresentationMode?.request()},async triggerPrinting(){this.supportsPrinting&&await this._printPermissionPromise&&window.print()},bindEvents(){if(this._eventBusAC)return;const t={signal:(this._eventBusAC=new AbortController).signal,...x},{eventBus:e,externalServices:i,pdfDocumentProperties:n,pdfViewer:s,preferences:a}=this;e.on("resize",cr.bind(this),t),e.on("hashchange",ur.bind(this),t),e.on("beforeprint",this.beforePrint.bind(this),t),e.on("afterprint",this.afterPrint.bind(this),t),e.on("pagerender",ar.bind(this),t),e.on("pagerendered",rr.bind(this),t),e.on("updateviewarea",hr.bind(this),t),e.on("pagechanging",Er.bind(this),t),e.on("scalechanging",wr.bind(this),t),e.on("rotationchanging",vr.bind(this),t),e.on("sidebarviewchanged",dr.bind(this),t),e.on("pagemode",or.bind(this),t),e.on("namedaction",lr.bind(this),t),e.on("presentationmodechanged",o=>s.presentationModeState=o.state,t),e.on("presentationmode",this.requestPresentationMode.bind(this),t),e.on("switchannotationeditormode",o=>s.annotationEditorMode=o,t),e.on("print",this.triggerPrinting.bind(this),t),e.on("download",this.downloadOrSave.bind(this),t),e.on("firstpage",()=>this.page=1,t),e.on("lastpage",()=>this.page=this.pagesCount,t),e.on("nextpage",()=>s.nextPage(),t),e.on("previouspage",()=>s.previousPage(),t),e.on("zoomin",this.zoomIn.bind(this),t),e.on("zoomout",this.zoomOut.bind(this),t),e.on("zoomreset",this.zoomReset.bind(this),t),e.on("pagenumberchanged",gr.bind(this),t),e.on("scalechanged",o=>s.currentScaleValue=o.value,t),e.on("rotatecw",this.rotatePages.bind(this,90),t),e.on("rotateccw",this.rotatePages.bind(this,-90),t),e.on("optionalcontentconfig",o=>s.optionalContentConfigPromise=o.promise,t),e.on("switchscrollmode",o=>s.scrollMode=o.mode,t),e.on("scrollmodechanged",Ki.bind(this,"scrollMode"),t),e.on("switchspreadmode",o=>s.spreadMode=o.mode,t),e.on("spreadmodechanged",Ki.bind(this,"spreadMode"),t),e.on("imagealttextsettings",fr.bind(this),t),e.on("documentproperties",()=>n?.open(),t),e.on("findfromurlhash",pr.bind(this),t),e.on("updatefindmatchescount",mr.bind(this),t),e.on("updatefindcontrolstate",br.bind(this),t),e.on("fileinputchange",nr.bind(this),t),e.on("openfile",sr.bind(this),t),e.on("pagesedited",this.onPagesEdited.bind(this),t),e.on("saveextractedpages",this.onSavePages.bind(this),t),e.on("saveandload",this.onSaveAndLoad.bind(this),t)},bindWindowEvents(){if(this._windowAC)return;this._windowAC=new AbortController;const{eventBus:r,appConfig:{mainContainer:t},pdfViewer:e,_windowAC:{signal:i}}=this;this._touchManager=new An({container:window,isPinchingDisabled:()=>e.isInPresentationMode,isPinchingStopped:()=>this.overlayManager?.active,onPinching:this.touchPinchCallback.bind(this),onPinchEnd:this.touchPinchEndCallback.bind(this),signal:i});function n(d=null){d&&e.refresh(),window.matchMedia(`(resolution: ${lt.pixelRatio}dppx)`).addEventListener("change",n,{once:!0,signal:i})}if(n(),window.addEventListener("wheel",yr.bind(this),{passive:!1,signal:i}),window.addEventListener("click",Ir.bind(this),{signal:i}),window.addEventListener("keydown",Lr.bind(this),{signal:i}),window.addEventListener("keyup",xr.bind(this),{signal:i}),window.addEventListener("resize",()=>r.dispatch("resize",{source:window}),{signal:i}),window.addEventListener("hashchange",()=>{r.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})},{signal:i}),window.addEventListener("beforeprint",()=>r.dispatch("beforeprint",{source:window}),{signal:i}),window.addEventListener("afterprint",()=>r.dispatch("afterprint",{source:window}),{signal:i}),window.addEventListener("updatefromsandbox",d=>{r.dispatch("updatefromsandbox",{source:window,detail:d.detail})},{signal:i}),window.addEventListener("beforeunload",_r.bind(this),{signal:i}),!("onscrollend"in document.documentElement))return;({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t);let s,a;const o=()=>{({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t),clearTimeout(s),this._isScrolling&&(a.abort(),a=null,this._isScrolling=!1)},l=()=>{if(!this._isCtrlKeyDown&&!(this._lastScrollTop===t.scrollTop&&this._lastScrollLeft===t.scrollLeft)){if(!this._isScrolling){a=new AbortController;const d=AbortSignal.any([a.signal,i]);t.addEventListener("scrollend",o,{signal:d}),t.addEventListener("blur",o,{signal:d}),this._isScrolling=!0}clearTimeout(s),s=setTimeout(o,100)}};t.addEventListener("scroll",l,{passive:!0,signal:i})},unbindEvents(){this._eventBusAC?.abort(),this._eventBusAC=null},unbindWindowEvents(){this._windowAC?.abort(),this._windowAC=null,this._touchManager=null},async testingClose(){this.unbindEvents(),this.unbindWindowEvents(),this._globalAbortController?.abort(),this._globalAbortController=null,this.findBar?.close(),await Promise.all([this.l10n?.destroy(),this.close()])},onPagesEdited(r){this.pdfViewer.onPagesEdited(r)},async onSavePages({data:r}){if(!this.downloadManager||!this.pdfDocument)return;const t=await this.pdfDocument.extractPages(r);if(!t){console.error(`Something wrong happened when saving the edited PDF.
|
|
557
|
+
Please file a bug.`);return}this.downloadManager.download(t,this._downloadUrl,this._docFilename)},async onSaveAndLoad({data:r}){if(!this.pdfDocument)return;const t=await this.pdfDocument.extractPages(r);if(!t){console.error(`Something wrong happened when saving the edited PDF.
|
|
558
|
+
Please file a bug.`);return}this._mergedDocumentNeedsSaving=!0,this.open({data:t,filename:this._docFilename})},_accumulateTicks(r,t){(this[t]>0&&r<0||this[t]<0&&r>0)&&(this[t]=0),this[t]+=r;const e=Math.trunc(this[t]);return this[t]-=e,e},_accumulateFactor(r,t,e){if(t===1)return 1;(this[e]>1&&t<1||this[e]<1&&t>1)&&(this[e]=1);const i=Math.floor(r*t*this[e]*100)/(100*r);return this[e]=t/i,i},_unblockDocumentLoadEvent(){document.blockUnblockOnload?.(!1),this._unblockDocumentLoadEvent=()=>{}},get scriptingReady(){return this.pdfScriptingManager.ready}};we.initGlobals(vt);{const r=new Set(["null","http://mozilla.github.io","https://mozilla.github.io"]);var ir=function(t){if(!t)return;const e=URL.parse(window.location)?.origin||"null";if(r.has(e)||URL.parse(t,window.location)?.origin===e)return;const n=new Error("file origin does not match viewer's");throw vt._documentError("pdfjs-loading-error",{message:n.message}),n},nr=function(t){if(this.pdfViewer?.isInPresentationMode)return;const e=t.fileInput.files[0];this.open({url:URL.createObjectURL(e),originalUrl:encodeURIComponent(e.name)})},sr=function(t){this._openFileInput?.click()}}function ar({pageNumber:r}){r===this.page&&this.toolbar?.updateLoadingIndicatorState(!0)}function rr({pageNumber:r,isDetailView:t,error:e}){if(r===this.page&&this.toolbar?.updateLoadingIndicatorState(!1),!t&&this.viewsManager?.visibleView===N.THUMBS){const i=this.pdfViewer.getPageView(r-1),n=this.pdfThumbnailViewer?.getThumbnail(r-1);i&&n?.setImage(i)}e&&this._otherError("pdfjs-rendering-error",e)}function or({mode:r}){let t;switch(r){case"thumbs":t=N.THUMBS;break;case"bookmarks":case"outline":t=N.OUTLINE;break;case"attachments":t=N.ATTACHMENTS;break;case"layers":t=N.LAYERS;break;case"none":t=N.NONE;break;default:console.error('Invalid "pagemode" hash parameter: '+r);return}this.viewsManager?.switchView(t,!0)}function lr(r){switch(r.action){case"GoToPage":this.appConfig.toolbar?.pageNumber.select();break;case"Find":this.supportsIntegratedFind||this.findBar?.toggle();break;case"Print":this.triggerPrinting();break;case"SaveAs":this.downloadOrSave();break}}function dr({view:r}){this.pdfRenderingQueue.isThumbnailViewEnabled=r===N.THUMBS,this.isInitialViewSet&&this.store?.set("sidebarView",r).catch(()=>{})}function hr({location:r}){this.isInitialViewSet&&this.store?.setMultiple({page:r.pageNumber,zoom:r.scale,scrollLeft:r.left,scrollTop:r.top,rotation:r.rotation}).catch(()=>{}),this.appConfig.secondaryToolbar&&(this.appConfig.secondaryToolbar.viewBookmarkButton.href=this.pdfLinkService.getAnchorUrl(r.pdfOpenParams))}function Ki(r,t){this.isInitialViewSet&&!this.pdfViewer.isInPresentationMode&&this.store?.set(r,t.mode).catch(()=>{})}function cr(){const{pdfDocument:r,pdfViewer:t,pdfRenderingQueue:e}=this;if(e.printing&&window.matchMedia("print").matches||!r)return;const i=t.currentScaleValue;(i==="auto"||i==="page-fit"||i==="page-width")&&(t.currentScaleValue=i),t.update()}function ur(r){const t=r.hash;t&&(this.isInitialViewSet?this.pdfHistory?.popStateInProgress||this.pdfLinkService.setHash(t):this.initialBookmark=t)}function gr(r){const{pdfViewer:t}=this;r.value!==""&&this.pdfLinkService.goToPage(r.value),r.value!==t.currentPageNumber.toString()&&r.value!==t.currentPageLabel&&this.toolbar?.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function fr(){this.imageAltTextSettings?.open({enableGuessAltText:S.get("enableGuessAltText"),enableNewAltTextWhenAddingImage:S.get("enableNewAltTextWhenAddingImage")})}function pr(r){this.eventBus.dispatch("find",{source:r.source,type:"",query:r.query,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function mr({matchesCount:r}){this.supportsIntegratedFind?this.externalServices.updateFindMatchesCount(r):this.findBar?.updateResultsCount(r)}function br({state:r,previous:t,entireWord:e,matchesCount:i,rawQuery:n}){this.supportsIntegratedFind?this.externalServices.updateFindControlState({result:r,findPrevious:t,entireWord:e,matchesCount:i,rawQuery:n}):this.findBar?.updateUIState(r,t,i)}function wr(r){this.toolbar?.setPageScale(r.presetValue,r.scale),this.pdfViewer.update()}function vr(r){this.pdfThumbnailViewer&&(this.pdfThumbnailViewer.pagesRotation=r.pagesRotation),this.forceRendering(),this.pdfViewer.currentPageNumber=r.pageNumber}function Er({pageNumber:r,pageLabel:t}){this.toolbar?.setPageNumber(r,t),this.secondaryToolbar?.setPageNumber(r),this.viewsManager?.visibleView===N.THUMBS&&this.pdfThumbnailViewer?.scrollThumbnailIntoView(r);const e=this.pdfViewer.getPageView(r-1);this.toolbar?.updateLoadingIndicatorState(e?.renderingState===k.RUNNING)}function yr(r){const{pdfViewer:t,supportsMouseWheelZoomCtrlKey:e,supportsMouseWheelZoomMetaKey:i,supportsPinchToZoom:n}=this;if(t.isInPresentationMode)return;const s=r.deltaMode;let a=Math.exp(-r.deltaY/100);const l=r.ctrlKey&&!this._isCtrlKeyDown&&s===WheelEvent.DOM_DELTA_PIXEL&&r.deltaX===0&&(Math.abs(a-1)<.05||!1)&&r.deltaZ===0,d=[r.clientX,r.clientY];if(l||r.ctrlKey&&e||r.metaKey&&i){if(r.preventDefault(),this._isScrolling||document.visibilityState==="hidden"||this.overlayManager.active)return;if(l&&n)a=this._accumulateFactor(t.currentScale,a,"_wheelUnusedFactor"),this.updateZoom(null,a,d);else{const h=Le(r);let c=0;s===WheelEvent.DOM_DELTA_LINE||s===WheelEvent.DOM_DELTA_PAGE?c=Math.abs(h)>=1?Math.sign(h):this._accumulateTicks(h,"_wheelUnusedTicks"):c=this._accumulateTicks(h/30,"_wheelUnusedTicks"),this.updateZoom(c,null,d)}}}function Cr({target:r}){if(!this.secondaryToolbar?.isOpen)return;const{toolbar:t,secondaryToolbar:e}=this.appConfig;(this.pdfViewer.containsElement(r)||t?.container.contains(r)&&!e?.toolbar.contains(r)&&!e?.toggleButton.contains(r))&&this.secondaryToolbar.close()}function Sr(r){this.editorUndoBar?.isOpen&&this.appConfig.secondaryToolbar?.toolbar.contains(r.target)&&this.editorUndoBar.hide()}function Pr({target:r}){this.signaturePropertiesManager?.shouldCloseOnClick(r)&&this.signaturePropertiesManager.close()}function _r(r){return this._hasChanges()?(r.preventDefault(),r.returnValue="",!1):!0}function Ir(r){Cr.call(this,r),Sr.call(this,r),Pr.call(this,r)}function xr(r){r.key==="Control"&&(this._isCtrlKeyDown=!1)}function Lr(r){if(this._isCtrlKeyDown=r.key==="Control",this.editorUndoBar?.isOpen&&r.keyCode!==9&&r.keyCode!==16&&!((r.keyCode===13||r.keyCode===32)&&Ne()===this.appConfig.editorUndoBar.undoButton)&&this.editorUndoBar.hide(),this.overlayManager.active)return;const{eventBus:t,pdfViewer:e}=this,i=e.isInPresentationMode;let n=!1,s=!1;const a=(r.ctrlKey?1:0)|(r.altKey?2:0)|(r.shiftKey?4:0)|(r.metaKey?8:0);if(a===1||a===8||a===5||a===12)switch(r.keyCode){case 70:!this.supportsIntegratedFind&&!r.shiftKey&&(this.findBar?.open(),n=!0);break;case 71:if(!this.supportsIntegratedFind){const{state:d}=this.findController;if(d){const h={source:window,type:"again",findPrevious:a===5||a===12};t.dispatch("find",{...d,...h})}n=!0}break;case 61:case 107:case 187:case 171:this.zoomIn(),n=!0;break;case 173:case 109:case 189:this.zoomOut(),n=!0;break;case 48:case 96:i||(setTimeout(()=>{this.zoomReset()}),n=!1);break;case 38:(i||this.page>1)&&(this.page=1,n=!0,s=!0);break;case 40:(i||this.page<this.pagesCount)&&(this.page=this.pagesCount,n=!0,s=!0);break}if(a===1||a===8)switch(r.keyCode){case 83:t.dispatch("download",{source:window}),n=!0;break;case 79:t.dispatch("openfile",{source:window}),n=!0;break}if(a===3||a===10)switch(r.keyCode){case 80:this.requestPresentationMode(),n=!0,this.externalServices.reportTelemetry({type:"buttons",data:{id:"presentationModeKeyboard"}});break;case 71:this.appConfig.toolbar&&(this.appConfig.toolbar.pageNumber.select(),n=!0);break}if(n){s&&!i&&e.focus(),r.preventDefault();return}const o=Ne(),l=o?.tagName.toUpperCase();if(!((l==="INPUT"||l==="TEXTAREA"||l==="SELECT"||l==="BUTTON"&&r.keyCode===32||o?.isContentEditable)&&r.keyCode!==27)){if(a===0){let d=0,h=!1;switch(r.keyCode){case 38:if(this.supportsCaretBrowsingMode){this.moveCaret(!0,!1),n=!0;break}case 33:e.isVerticalScrollbarEnabled&&(h=!0),d=-1;break;case 8:i||(h=!0),d=-1;break;case 37:if(this.supportsCaretBrowsingMode)return;e.isHorizontalScrollbarEnabled&&(h=!0);case 75:case 80:d=-1;break;case 27:this.secondaryToolbar?.isOpen&&(this.secondaryToolbar.close(),n=!0),this.signaturePropertiesManager?.isOpen&&(this.signaturePropertiesManager.close(),n=!0),!this.supportsIntegratedFind&&this.findBar?.opened&&(this.findBar.close(),n=!0);break;case 40:if(this.supportsCaretBrowsingMode){this.moveCaret(!1,!1),n=!0;break}case 34:e.isVerticalScrollbarEnabled&&(h=!0),d=1;break;case 32:i||(h=!0),d=1;break;case 39:if(this.supportsCaretBrowsingMode)return;e.isHorizontalScrollbarEnabled&&(h=!0);case 74:case 78:d=1;break;case 36:(i||this.page>1)&&(this.page=1,n=!0,s=!0);break;case 35:(i||this.page<this.pagesCount)&&(this.page=this.pagesCount,n=!0,s=!0);break;case 83:this.pdfCursorTools?.switchTool(W.SELECT);break;case 72:this.pdfCursorTools?.switchTool(W.HAND);break;case 82:this.rotatePages(90);break;case 115:this.viewsManager?.toggle();break}d!==0&&(!h||e.currentScaleValue==="page-fit")&&(d>0?e.nextPage():e.previousPage(),n=!0)}if(a===4)switch(r.keyCode){case 32:if(!i&&e.currentScaleValue!=="page-fit")break;e.previousPage(),n=!0;break;case 38:this.moveCaret(!0,!0),n=!0;break;case 40:this.moveCaret(!1,!0),n=!0;break;case 82:this.rotatePages(-90);break}!n&&!i&&(r.keyCode>=33&&r.keyCode<=40||r.keyCode===32&&l!=="BUTTON")&&(s=!0),s&&!e.containsElement(o)&&e.focus(),n&&r.preventDefault()}}const Yi={LinkTarget:et,RenderingStates:k,ScrollMode:M,SpreadMode:j};window.PDFViewerApplication=vt,window.PDFViewerApplicationConstants=Yi,window.PDFViewerApplicationOptions=S;function Tr(){return{appContainer:document.body,principalContainer:document.getElementById("mainContainer"),mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),viewerAlert:document.getElementById("viewer-alert"),toolbar:{container:document.getElementById("toolbarContainer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomInButton"),zoomOut:document.getElementById("zoomOutButton"),print:document.getElementById("printButton"),editorCommentButton:document.getElementById("editorCommentButton"),editorCommentParamsToolbar:document.getElementById("editorCommentParamsToolbar"),editorFreeTextButton:document.getElementById("editorFreeTextButton"),editorFreeTextParamsToolbar:document.getElementById("editorFreeTextParamsToolbar"),editorHighlightButton:document.getElementById("editorHighlightButton"),editorHighlightParamsToolbar:document.getElementById("editorHighlightParamsToolbar"),editorHighlightColorPicker:document.getElementById("editorHighlightColorPicker"),editorInkButton:document.getElementById("editorInkButton"),editorInkParamsToolbar:document.getElementById("editorInkParamsToolbar"),editorStampButton:document.getElementById("editorStampButton"),editorStampParamsToolbar:document.getElementById("editorStampParamsToolbar"),editorSignatureButton:document.getElementById("editorSignatureButton"),editorSignatureParamsToolbar:document.getElementById("editorSignatureParamsToolbar"),signaturePropertiesButton:document.getElementById("signaturePropertiesButton"),signaturePropertiesPanel:document.getElementById("signaturePropertiesPanel"),signaturePropertiesContainer:document.getElementById("signaturePropertiesContainer"),signaturePropertiesBanner:document.getElementById("signaturePropertiesBanner"),signaturePropertiesList:document.getElementById("signaturePropertiesList"),signaturePropertiesSeparator:document.getElementById("signaturePropertiesSeparator"),download:document.getElementById("downloadButton")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggleButton"),presentationModeButton:document.getElementById("presentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("viewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollPageButton:document.getElementById("scrollPage"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),imageAltTextSettingsButton:document.getElementById("imageAltTextSettings"),imageAltTextSettingsSeparator:document.getElementById("imageAltTextSettingsSeparator"),documentPropertiesButton:document.getElementById("documentProperties")},viewsManager:{outerContainer:document.getElementById("outerContainer"),toggleButton:document.getElementById("viewsManagerToggleButton"),sidebarContainer:document.getElementById("viewsManager"),resizer:document.getElementById("viewsManagerResizer"),thumbnailButton:document.getElementById("thumbnailsViewMenu"),outlineButton:document.getElementById("outlinesViewMenu"),attachmentsButton:document.getElementById("attachmentsViewMenu"),layersButton:document.getElementById("layersViewMenu"),viewsManagerSelectorButton:document.getElementById("viewsManagerSelectorButton"),viewsManagerSelectorOptions:document.getElementById("viewsManagerSelectorOptions"),thumbnailsView:document.getElementById("thumbnailsView"),outlinesView:document.getElementById("outlinesView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),viewsManagerAddFile:{button:document.getElementById("viewsManagerAddFileButton"),picker:document.getElementById("viewsManagerAddFilePicker")},viewsManagerCurrentOutlineButton:document.getElementById("viewsManagerCurrentOutlineButton"),viewsManagerHeaderLabel:document.getElementById("viewsManagerHeaderLabel"),viewsManagerStatus:document.getElementById("viewsManagerStatus"),viewsManagerStatusBar:{viewsManagerStatusAction:document.getElementById("viewsManagerStatusAction"),viewsManagerStatusActionDeselectButton:document.getElementById("viewsManagerStatusActionDeselectButton"),viewsManagerStatusActionLabel:document.getElementById("viewsManagerStatusActionLabel")},viewsManagerUndoBar:{viewsManagerStatusUndo:document.getElementById("viewsManagerStatusUndo"),viewsManagerStatusUndoLabel:document.getElementById("viewsManagerStatusUndoLabel"),viewsManagerStatusUndoButton:document.getElementById("viewsManagerStatusUndoButton"),viewsManagerStatusUndoCloseButton:document.getElementById("viewsManagerStatusUndoCloseButton")},viewsManagerWaitingBar:{container:document.getElementById("viewsManagerStatusWaiting"),closeButton:document.getElementById("viewsManagerStatusWaitingCloseButton"),label:document.getElementById("viewsManagerStatusWaitingLabel")},manageMenu:{button:document.getElementById("viewsManagerStatusActionButton"),menu:document.getElementById("viewsManagerStatusActionOptions"),copy:document.getElementById("viewsManagerStatusActionCopy"),cut:document.getElementById("viewsManagerStatusActionCut"),delete:document.getElementById("viewsManagerStatusActionDelete"),exportSelected:document.getElementById("viewsManagerStatusActionExport")}},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFindButton"),findField:document.getElementById("findInput"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),matchDiacriticsCheckbox:document.getElementById("findMatchDiacritics"),entireWordCheckbox:document.getElementById("findEntireWord"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPreviousButton"),findNextButton:document.getElementById("findNextButton")},passwordOverlay:{dialog:document.getElementById("passwordDialog"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{dialog:document.getElementById("documentPropertiesDialog"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},altTextDialog:{dialog:document.getElementById("altTextDialog"),optionDescription:document.getElementById("descriptionButton"),optionDecorative:document.getElementById("decorativeButton"),textarea:document.getElementById("descriptionTextarea"),cancelButton:document.getElementById("altTextCancel"),saveButton:document.getElementById("altTextSave")},newAltTextDialog:{dialog:document.getElementById("newAltTextDialog"),title:document.getElementById("newAltTextTitle"),descriptionContainer:document.getElementById("newAltTextDescriptionContainer"),textarea:document.getElementById("newAltTextDescriptionTextarea"),disclaimer:document.getElementById("newAltTextDisclaimer"),learnMore:document.getElementById("newAltTextLearnMore"),imagePreview:document.getElementById("newAltTextImagePreview"),createAutomatically:document.getElementById("newAltTextCreateAutomatically"),createAutomaticallyButton:document.getElementById("newAltTextCreateAutomaticallyButton"),downloadModel:document.getElementById("newAltTextDownloadModel"),downloadModelDescription:document.getElementById("newAltTextDownloadModelDescription"),error:document.getElementById("newAltTextError"),errorCloseButton:document.getElementById("newAltTextCloseButton"),cancelButton:document.getElementById("newAltTextCancel"),notNowButton:document.getElementById("newAltTextNotNow"),saveButton:document.getElementById("newAltTextSave")},altTextSettingsDialog:{dialog:document.getElementById("altTextSettingsDialog"),createModelButton:document.getElementById("createModelButton"),learnMore:document.getElementById("altTextSettingsLearnMore"),showAltTextDialogButton:document.getElementById("showAltTextDialogButton"),altTextSettingsCloseButton:document.getElementById("altTextSettingsCloseButton"),closeButton:document.getElementById("altTextSettingsCloseButton")},addSignatureDialog:{dialog:document.getElementById("addSignatureDialog"),panels:document.getElementById("addSignatureActionContainer"),typeButton:document.getElementById("addSignatureTypeButton"),typeInput:document.getElementById("addSignatureTypeInput"),drawButton:document.getElementById("addSignatureDrawButton"),drawSVG:document.getElementById("addSignatureDraw"),drawPlaceholder:document.getElementById("addSignatureDrawPlaceholder"),drawThickness:document.getElementById("addSignatureDrawThickness"),imageButton:document.getElementById("addSignatureImageButton"),imageSVG:document.getElementById("addSignatureImage"),imagePlaceholder:document.getElementById("addSignatureImagePlaceholder"),imagePicker:document.getElementById("addSignatureFilePicker"),imagePickerLink:document.getElementById("addSignatureImageBrowse"),description:document.getElementById("addSignatureDescription"),clearButton:document.getElementById("clearSignatureButton"),saveContainer:document.getElementById("addSignatureSaveContainer"),saveCheckbox:document.getElementById("addSignatureSaveCheckbox"),errorBar:document.getElementById("addSignatureError"),errorTitle:document.getElementById("addSignatureErrorTitle"),errorDescription:document.getElementById("addSignatureErrorDescription"),errorCloseButton:document.getElementById("addSignatureErrorCloseButton"),cancelButton:document.getElementById("addSignatureCancelButton"),addButton:document.getElementById("addSignatureAddButton")},editSignatureDialog:{dialog:document.getElementById("editSignatureDescriptionDialog"),description:document.getElementById("editSignatureDescription"),editSignatureView:document.getElementById("editSignatureView"),cancelButton:document.getElementById("editSignatureCancelButton"),updateButton:document.getElementById("editSignatureUpdateButton")},annotationEditorParams:{editorCommentsSidebar:document.getElementById("editorCommentsSidebar"),editorCommentsSidebarCount:document.getElementById("editorCommentsSidebarCount"),editorCommentsSidebarTitle:document.getElementById("editorCommentsSidebarTitle"),editorCommentsSidebarCloseButton:document.getElementById("editorCommentsSidebarCloseButton"),editorCommentsSidebarList:document.getElementById("editorCommentsSidebarList"),editorCommentsSidebarResizer:document.getElementById("editorCommentsSidebarResizer"),editorFreeTextFontSize:document.getElementById("editorFreeTextFontSize"),editorFreeTextColor:document.getElementById("editorFreeTextColor"),editorInkColor:document.getElementById("editorInkColor"),editorInkThickness:document.getElementById("editorInkThickness"),editorInkOpacity:document.getElementById("editorInkOpacity"),editorStampAddImage:document.getElementById("editorStampAddImage"),editorSignatureAddSignature:document.getElementById("editorSignatureAddSignature"),editorFreeHighlightThickness:document.getElementById("editorFreeHighlightThickness"),editorHighlightShowAll:document.getElementById("editorHighlightShowAll")},printContainer:document.getElementById("printContainer"),editorUndoBar:{container:document.getElementById("editorUndoBar"),message:document.getElementById("editorUndoBarMessage"),undoButton:document.getElementById("editorUndoBarUndoButton"),closeButton:document.getElementById("editorUndoBarCloseButton")},editCommentDialog:{dialog:document.getElementById("commentManagerDialog"),toolbar:document.getElementById("commentManagerToolbar"),title:document.getElementById("commentManagerTitle"),textInput:document.getElementById("commentManagerTextInput"),cancelButton:document.getElementById("commentManagerCancelButton"),saveButton:document.getElementById("commentManagerSaveButton")}}}function Zi(){const r=Tr(),t=new CustomEvent("webviewerloaded",{bubbles:!0,cancelable:!0,detail:{source:window}});try{parent.document.dispatchEvent(t)}catch(e){console.error("webviewerloaded:",e),document.dispatchEvent(t)}vt.run(r)}document.blockUnblockOnload?.(!0),document.readyState==="interactive"||document.readyState==="complete"?Zi():document.addEventListener("DOMContentLoaded",Zi,!0);export{vt as PDFViewerApplication,Yi as PDFViewerApplicationConstants,S as PDFViewerApplicationOptions};
|