1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,746174,418611,717017,251697,t=>{"use strict";var e=t.i(793890),i=t.i(511345),s=t.i(806057),r=t.i(547174),n=t.i(621664),a=t.i(454028),o=t.i(422022),l=t.i(444632),h=t.i(25735);t.i(934085);var d=t.i(361761),c=t.i(63844);t.i(456712);var u=t.i(864598),u=u;t.i(928505);var p=t.i(19586),g=t.i(167356);t.i(256555),t.i(336168),t.i(934559);var f=function(t,e,i){if(i||2==arguments.length)for(var s,r=0,n=e.length;r<n;r++)!s&&r in e||(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))},m=f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate"],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),["onKeyDown","onKeyPress","onKeyUp"],!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],!0),["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],!0),["onSelect"],!0),["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration"],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function b(t,e){var i={};return m.forEach(function(s){var r=t[s];r&&(e?i[s]=function(t){return r(t,e(s))}:i[s]=r)}),i}function v(t){var e=!1;return{promise:new Promise(function(i,s){t.then(function(t){return!e&&i(t)}).catch(function(t){return!e&&s(t)})}),cancel:function(){e=!0}}}var y=t.i(7284),x=t.i(728412);function A(t,e){if(!t)throw Error("Invariant failed")}var w=t.i(499763),_=Object.prototype.hasOwnProperty;function E(t,e,i){for(i of t.keys())if(S(i,e))return i}function S(t,e){var i,s,r;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((s=t.length)===e.length)for(;s--&&S(t[s],e[s]););return -1===s}if(i===Set){if(t.size!==e.size)return!1;for(s of t)if((r=s)&&"object"==typeof r&&!(r=E(e,r))||!e.has(r))return!1;return!0}if(i===Map){if(t.size!==e.size)return!1;for(s of t)if((r=s[0])&&"object"==typeof r&&!(r=E(e,r))||!S(s[1],e.get(r)))return!1;return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((s=t.byteLength)===e.byteLength)for(;s--&&t.getInt8(s)===e.getInt8(s););return -1===s}if(ArrayBuffer.isView(t)){if((s=t.byteLength)===e.byteLength)for(;s--&&t[s]===e[s];);return -1===s}if(!i||"object"==typeof t){for(i in s=0,t)if(_.call(t,i)&&++s&&!_.call(e,i)||!(i in e)||!S(t[i],e[i]))return!1;return Object.keys(e).length===s}}return t!=t&&e!=e}var C=t.i(9651),T={};T.d=(t,e)=>{for(var i in e)T.o(e,i)&&!T.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},T.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var M=globalThis.pdfjsLib={};T.d(M,{AbortException:()=>tt,AnnotationEditorLayer:()=>i6,AnnotationEditorParamsType:()=>L,AnnotationEditorType:()=>I,AnnotationEditorUIManager:()=>tB,AnnotationLayer:()=>iV,AnnotationMode:()=>D,ColorPicker:()=>i1,DOMSVGFactory:()=>ip,DrawLayer:()=>i4,FeatureTest:()=>tr,GlobalWorkerOptions:()=>ev,ImageKind:()=>N,InvalidPDFException:()=>Y,MissingPDFException:()=>Q,OPS:()=>j,OutputScale:()=>tP,PDFDataRangeTransport:()=>e4,PDFDateString:()=>tE,PDFWorker:()=>it,PasswordResponses:()=>B,PermissionFlag:()=>F,PixelsPerInch:()=>tu,RenderingCancelledException:()=>tf,TextLayer:()=>eQ,UnexpectedResponseException:()=>J,Util:()=>ta,VerbosityLevel:()=>O,XfaLayer:()=>ig,build:()=>il,createValidAbsoluteUrl:()=>V,fetchData:()=>tp,getDocument:()=>e5,getFilenameFromUrl:()=>tv,getPdfFilenameFromUrl:()=>ty,getXfaPageViewport:()=>tS,isDataScheme:()=>tm,isPdfFile:()=>tb,noContextMenu:()=>tw,normalizeUnicode:()=>th,setLayerDimensions:()=>tk,shadow:()=>
1W,version:()=>io});let k="object"==typeof x.default&&x.default+""=="[object process]"&&!x.default.versions.nw&&!(x.default.versions.electron&&x.default.type&&"browser"!==x.default.type),P=[1,0,0,1,0,0],R=[.001,0,0,.001,0,0],D={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},I={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},L={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},F={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},N={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},O={ERRORS:0,WARNINGS:1,INFOS:5},j={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},B={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},z=O.WARNINGS;function H(t){z>=O.INFOS&&console.log(`Info: ${t}`)}function U(t){z>=O.WARNINGS&&console.log(`Warning: ${t}`)}function $(t){throw Error(t)}function G(t,e){t||$(e)}function V(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){let e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{var s;s=t,t=decodeURIComponent(escape(s))}catch{}}let r=e?new URL(t,e):new URL(t);if(function(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch{}return null}function W(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}let q=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=Error(),t.constructor=t,t}();class K extends q{constructor(t,e){super(t,"PasswordException"),this.code=e}}class X extends q{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Y extends q{constructor(t){super(t,"InvalidPDFException")}}class Q extends q{constructor(t){super(t,"MissingPDFException")}}class J extends q{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Z extends q{constructor(t){super(t,"FormatError")}}class tt extends q{constructor(t){super(t,"AbortException")}}function te(t){("object"!=typeof t||t?.length===void 0)&&$("Invalid argument for bytesToString");let e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);let i=[];for(let s=0;s<e;s+=8192){let r=Math.min(s+8192,e),n=t.subarray(s,r);i.push(String.fromCharCode.apply(null,n))}return i.join("")}function ti(t){"string"!=typeof t&&$("Invalid argument for stringToBytes");let e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function ts(t){let e=Object.create(null);for(let[i,s]of t)e[i]=s;return e}class tr{static get isLittleEndian(){let t;return W(this,"isLittleEndian",((t=new Uint8Array(4))[0]=1,1===new Uint32Array(t.buffer,0,1)[0]))}static get isEvalSupported(){return W(this,"isEvalSupported",function(){try{return Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return W(this,"isOffscreenCanvasSupported","u">typeof OffscreenCanvas)}static get platform(){return"u">typeof navigator&&"string"==typeof navigator?.platform?W(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):W(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return W(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}let tn=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class ta{static makeHexColor(t,e,i){return`#${tn[t]}${tn[e]}${tn[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){let i=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){let i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),r=this.applyTransform([t[0],t[3]],e),n=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],r[0],n[0]),Math.min(i[1],s[1],r[1],n[1]),Math.max(i[0],s[0],r[0],n[0]),Math.max(i[1],s[1],r[1],n[1])]}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){let e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],r=t[2]*e[0]+t[3]*e[2],n=t[2]*e[1]+t[3]*e[3],a=(i+n)/2,o=Math.sqrt((i+n)**2-4*(i*n-r*s))/2;return[Math.sqrt(a+o||1),Math.sqrt(a-o||1)]}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;let r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),n=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>n?null:[i,r,s,n]}static #t(t,e,i,s,r,n,a,o,l,h){if(l<=0||l>=1)return;let d=1-l,c=l*l,u=c*l,p=d*(d*(d*t+3*l*e)+3*c*i)+u*s,g=d*(d*(d*r+3*l*n)+3*c*a)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],g)}static #e(t,e,i,s,r,n,a,o,l,h,d,c){if(1e-12>Math.abs(l)){Math.abs(h)>=1e-12&&this.#t(t,e,i,s,r,n,a,o,-d/h,c);return}let u=h**2-4*d*l;if(u<0)return;let p=Math.sqrt(u),g=2*l;this.#t(t,e,i,s,r,n,a,o,(-h+p)/g,c),this.#t(t,e,i,s,r,n,a,o,(-h-p)/g,c)}static bezierBoundingBox(t,e,i,s,r,n,a,o,l){return l?(l[0]=Math.min(l[0],t,a),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,a),l[3]=Math.max(l[3],e,o)):l=[Math.min(t,a),Math.min(e,o),Math.max(t,a),Math.max(e,o)],this.#e(t,i,r,a,e,
1s,n,o,3*(-t+3*(i-r)+a),6*(t-2*i+r),3*(i-t),l),this.#e(t,i,r,a,e,s,n,o,3*(-e+3*(s-n)+o),6*(e-2*s+n),3*(s-e),l),l}}let to=null,tl=null;function th(t){return to||(to=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,tl=new Map([["ï¬ ","Å¿t"]])),t.replaceAll(to,(t,e,i)=>e?e.normalize("NFKC"):tl.get(i))}let td="pdfjs_internal_id_",tc="http://www.w3.org/2000/svg";class tu{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function tp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(tA(t,document.baseURI)){let i=await fetch(t);if(!i.ok)throw Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{let r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType=e,r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){switch(e){case"arraybuffer":case"blob":case"json":i(r.response);return}i(r.responseText);return}s(Error(r.statusText))}},r.send(null)})}class tg{constructor({viewBox:t,scale:e,rotation:i,offsetX:s=0,offsetY:r=0,dontFlip:n=!1}){let a,o,l,h,d,c,u,p;this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=s,this.offsetY=r;const g=(t[2]+t[0])/2,f=(t[3]+t[1])/2;switch((i%=360)<0&&(i+=360),i){case 180:a=-1,o=0,l=0,h=1;break;case 90:a=0,o=1,l=1,h=0;break;case 270:a=0,o=-1,l=-1,h=0;break;case 0:a=1,o=0,l=0,h=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}n&&(l=-l,h=-h),0===a?(d=Math.abs(f-t[1])*e+s,c=Math.abs(g-t[0])*e+r,u=(t[3]-t[1])*e,p=(t[2]-t[0])*e):(d=Math.abs(g-t[0])*e+s,c=Math.abs(f-t[1])*e+r,u=(t[2]-t[0])*e,p=(t[3]-t[1])*e),this.transform=[a*e,o*e,l*e,h*e,d-a*e*g-l*e*f,c-o*e*g-h*e*f],this.width=u,this.height=p}get rawDims(){let{viewBox:t}=this;return W(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new tg({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:r})}convertToViewportPoint(t,e){return ta.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=ta.applyTransform([t[0],t[1]],this.transform),i=ta.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return ta.applyInverseTransform([t,e],this.transform)}}class tf extends q{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function tm(t){let e=t.length,i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function tb(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function tv(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function ty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return e;if(tm(t))return U('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t),r=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(r&&(r=r[0]).includes("%"))try{r=i.exec(decodeURIComponent(r))[0]}catch{}return r||e}class tx{started=Object.create(null);times=[];time(t){t in this.started&&U(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||U(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){let t=[],e=0;for(let{name:t}of this.times)e=Math.max(t.length,e);for(let{name:i,start:s,end:r}of this.times)t.push(`${i.padEnd(e)} ${r-s}ms 2`);return t.join("")}}function tA(t,e){try{let{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch{return!1}}function tw(t){t.preventDefault()}function t_(t){console.log("Deprecated API usage: "+t)}class tE{static #i;static toDateObject(t){if(!t||"string"!=typeof t)return null;this.#i||=RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let e=this.#i.exec(t);if(!e)return null;let i=parseInt(e[1],10),s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let n=parseInt(e[4],10);n=n>=0&&n<=23?n:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;let l=e[7]||"Z",h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===l?(n+=h,a+=d):"+"===l&&(n-=h,a-=d),new Date(Date.UTC(i,s,r,n,a,o))}}function tS(t,e){let{scale:i=1,rotation:s=0}=e,{width:r,height:n}=t.attributes.style;return new tg({viewBox:[0,0,parseInt(r),parseInt(n)],scale:i,rotation:s})}function tC(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(0xff0000&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(U(`Not a valid color format: "${t}"`),[0,0,0])}function tT(t){let{a:e,b:i,c:s,d:r,e:n,f:a}=t.getTransform();return[e,i,s,r,n,a]}function tM(t){let{a:e,b:i,c:s,d:r,e:n,f:a}=t.getTransform().invertSelf();return[e,i,s,r,n,a]}function tk(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(e instanceof tg){let{pageWidth:s,pageHeight:r}=e.rawDims,{style:n}=t,a=tr.isCSSRoundSupported,o=`var(--scale-factor) * ${s}px`,l=`var(--scale-factor) * ${r}px`,h=a?`round(down, ${o}, var(--scale-round-x, 1px))`:`calc(${o})`,d=a?`round(down, ${l}, var(--scale-round-y, 1px))`:`calc(${l})`;i&&e.rotation%180!=0?(n.width=d,n.height=h):(n.width=h,n.height=d)}s&&t.setAttribute("data-main-rotation",e.rotation)}class tP{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}class tR{#s=null;#r=null;#n;#a=null;#o=null;static #l=null;constructor(t){this.#n=t,tR.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"})}render(){let t=this.#s=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=this.#n._uiManager._signal;t.addEventListener("contextmenu",tw,{signal:e}),t.addEventListener("pointerdown",tR.#h,{signal:e});let i=this.#a=document.createElement("div");i.className="buttons",t.append(i);let s=this.#n.toolbarPosition;if(s){let{style:e}=t,i="ltr"===this.#n._uiManager.direction?1-s[0]:s[0];e.insetInlineEnd=`${100*i}%`,e.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return this.#d(),t}get div(){return this.#s}static #h(t){t.stopPropagation()}#c(t){this.#n._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#u(t){this.#n._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#p(t){let e=this.#n._uiManager._signal;t.addEventListener("focusin",this.#c.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#u.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",tw,{signal:e})}hide(){this.#s.classList.add("hidden"),this.#r?.hideDropdown()}show(){this.#s.classList.remove("hidden"),this.#o?.shown()}#d(){let{editorType:t,_uiManager:e}=this.#n,i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",tR.#l[t]),this.#p(i),i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),this.#a.append(i)}get #g(){let t=document.createElement("div");return t.className="divider",t}async addAltText(t){let e=await t.render();this.#p(e),this.#a.prepend(e,this.#g),this.#o=t}addColorPicker(t){this.#r=t;let e=t.renderButton();this.#p(e),this.#a.prepend(e,this.#g)}remove(){this.#s.remove(),this.#r?.destroy(),this.#r=null}}class tD{#a=null;#s=null;#f;constructor(t){this.#f=t}#m(){let t=this.#s=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",tw,{signal:this.#f._signal});let e=this.#a=document.createElement("div");return e.className="buttons",t.append(e),this.#b(),t}#v(t,e){let i=0,s=0;for(let r of t){let t=r.y+r.height;if(t<i)continue;let n=r.x+(e?r.width:0);if(t>i){s=n,i=t;continue}e?n>s&&(s=n):n<s&&(s=n)}return[e?1-s:s,i]}
2show(t,e,i){let[s,r]=this.#v(e,i),{style:n}=this.#s||=this.#m();t.append(this.#s),n.insetInlineEnd=`${100*s}%`,n.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){this.#s.remove()}#b(){let t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");let e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");let i=this.#f._signal;t.addEventListener("contextmenu",tw,{signal:i}),t.addEventListener("click",()=>{this.#f.highlightSelection("floating_button")},{signal:i}),this.#a.append(t)}}function tI(t,e,i){for(let s of i)e.addEventListener(s,t[s].bind(t))}class tL{#y=0;get id(){return`pdfjs_internal_editor_${this.#y++}`}}class tF{#x=(function(){if("u">typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();let t=new Uint8Array(32);if("u">typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(255*Math.random());return te(t)})();#y=0;#A=null;static get _isSVGFittingCanvas(){let t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',W(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async #w(t,e){this.#A||=new Map;let i=this.#A.get(t);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let t;if(i||={bitmap:null,id:`image_${this.#x}_${this.#y++}`,refCounter:0,isSvg:!1},"string"==typeof e?(i.url=e,t=await tp(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){let e=tF._isSVGFittingCanvas,s=new FileReader,r=new Image,n=new Promise((t,n)=>{r.onload=()=>{i.bitmap=r,i.isSvg=!0,t()},s.onload=async()=>{let t=i.svgUrl=s.result;r.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},r.onerror=s.onerror=n});s.readAsDataURL(t),await n}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){console.error(t),i=null}return this.#A.set(t,i),i&&this.#A.set(i.id,i),i}async getFromFile(t){let{lastModified:e,name:i,size:s,type:r}=t;return this.#w(`${e}_${i}_${s}_${r}`,t)}async getFromUrl(t){return this.#w(t,t)}async getFromBlob(t,e){let i=await e;return this.#w(t,i)}async getFromId(t){this.#A||=new Map;let e=this.#A.get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#A||=new Map;let i=this.#A.get(t);if(i?.bitmap)return i.refCounter+=1,i;let s=new OffscreenCanvas(e.width,e.height);return s.getContext("2d").drawImage(e,0,0),i={bitmap:s.transferToImageBitmap(),id:`image_${this.#x}_${this.#y++}`,refCounter:1,isSvg:!1},this.#A.set(t,i),this.#A.set(i.id,i),i}getSvgUrl(t){let e=this.#A.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#A||=new Map;let e=this.#A.get(t);if(!e||(e.refCounter-=1,0!==e.refCounter))return;let{bitmap:i}=e;if(!e.url&&!e.file){let t=new OffscreenCanvas(i.width,i.height);t.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=t.convertToBlob()}i.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#x}_`)}}class tN{#_=[];#E=!1;#S;#C=-1;constructor(t=128){this.#S=t}add(t){let{cmd:e,undo:i,post:s,mustExec:r,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}=t;if(r&&e(),this.#E)return;let l={cmd:e,undo:i,post:s,type:n};if(-1===this.#C){this.#_.length>0&&(this.#_.length=0),this.#C=0,this.#_.push(l);return}if(a&&this.#_[this.#C].type===n){o&&(l.undo=this.#_[this.#C].undo),this.#_[this.#C]=l;return}let h=this.#C+1;h===this.#S?this.#_.splice(0,1):(this.#C=h,h<this.#_.length&&this.#_.splice(h)),this.#_.push(l)}undo(){if(-1===this.#C)return;this.#E=!0;let{undo:t,post:e}=this.#_[this.#C];t(),e?.(),this.#E=!1,this.#C-=1}redo(){if(this.#C<this.#_.length-1){this.#C+=1,this.#E=!0;let{cmd:t,post:e}=this.#_[this.#C];t(),e?.(),this.#E=!1}}hasSomethingToUndo(){return -1!==this.#C}hasSomethingToRedo(){return this.#C<this.#_.length-1}destroy(){this.#_=null}}class tO{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=tr.platform;for(const[i,s,r={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:r}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:r}),this.allKeys.add(t.split("+").at(-1)))}}#T(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get(this.#T(e));if(!i)return;let{callback:s,options:{bubbles:r=!1,args:n=[],checker:a=null}}=i;(!a||a(t,e))&&(s.bind(t,...n,e)(),r||(e.stopPropagation(),e.preventDefault()))}}class tj{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]),e=document.createElement("span");for(let i of(e.style.visibility="hidden",document.body.append(e),t.keys())){e.style.color=i;let s=window.getComputedStyle(e).color;t.set(i,tC(s))}return e.remove(),W(this,"_colors",t)}convert(t){let e=tC(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[t,i]of this._colors)if(i.every((t,i)=>t===e[i]))return tj._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?ta.makeHexColor(...e):t}}class tB{#M=new AbortController;#k=null;#P=new Map;#R=new Map;#D=null;#I=null;#L=null;#F=new tN;#N=null;#O=0;#j=new Set;#B=null;#z=null;#H=new Set;#U=!1;#$=!1;#G=!1;#V=null;#W=null;#q=null;#K=null;#X=!1;#Y=null;#Q=new tL;#J=!1;#Z=!1;#tt=null;#te=null;#ti=null;#ts=null;#tr=I.NONE;#tn=new Set;#ta=null;#to=null;#tl=null;#th={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#td=[0,0];#tc=null;#tu=null;#tp=null;#tg=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=tB.prototype,e=t=>t.#tu.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){let{type:t}=i;return"text"!==t&&"number"!==t}return!0},s=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return W(this,"_keyboardManager",new tO([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&t.#tu.contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&t.#tu.contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}constructor(t,e,i,s,r,n,a,o,l,h,d){const c=this._signal=this.#M.signal;this.#tu=t,this.#tp=e,this.#D=i,this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:c}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:c}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:c}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:c}),s._on("setpreference",this.onSetPreference.bind(this),{signal:c}),s._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:c}),this.#tf(),this.#tm(),this.#tb(),this.#I=r.annotationStorage,this.#V=r.filterFactory,this.#to=n,this.#K=a||null,this.#U=o,this.#$=l,this.#G=h,this.#ts=d||null,this.viewParameters={realScale:tu.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){for(let t of(this.#tg?.resolve(),this.#tg=null,this.#M?.abort(),this.#M=null,this._signal=null,this.#R.values())
2)t.destroy();this.#R.clear(),this.#P.clear(),this.#H.clear(),this.#k=null,this.#tn.clear(),this.#F.destroy(),this.#D?.destroy(),this.#Y?.hide(),this.#Y=null,this.#W&&(clearTimeout(this.#W),this.#W=null),this.#tc&&(clearTimeout(this.#tc),this.#tc=null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#ts}get useNewAltTextFlow(){return this.#$}get useNewAltTextWhenAddingImage(){return this.#G}get hcmFilter(){return W(this,"hcmFilter",this.#to?this.#V.addHCMFilter(this.#to.foreground,this.#to.background):"none")}get direction(){return W(this,"direction",getComputedStyle(this.#tu).direction)}get highlightColors(){return W(this,"highlightColors",this.#K?new Map(this.#K.split(",").map(t=>t.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return W(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#ti=t}editAltText(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.#D?.editAltText(this,t,e)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let{name:e,value:i}=t;"enableNewAltTextWhenAddingImage"===e&&(this.#G=i)}onPageChanging(t){let{pageNumber:e}=t;this.#O=e-1}focusMainContainer(){this.#tu.focus()}findParent(t,e){for(let i of this.#R.values()){let{x:s,y:r,width:n,height:a}=i.div.getBoundingClientRect();if(t>=s&&t<=s+n&&e>=r&&e<=r+a)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#tp.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#H.add(t)}removeShouldRescale(t){this.#H.delete(t)}onScaleChanging(t){let{scale:e}=t;for(let t of(this.commitOrRemove(),this.viewParameters.realScale=e*tu.PDF_TO_CSS_UNITS,this.#H))t.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}#tv(t){let{anchorNode:e}=t;return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#ty(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let e of this.#R.values())if(e.hasTextLayer(t))return e;return null}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=document.getSelection();if(!e||e.isCollapsed)return;let{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:n}=e,a=e.toString(),o=this.#tv(e).closest(".textLayer"),l=this.getSelectionBoxes(o);if(!l)return;e.empty();let h=this.#ty(o),d=this.#tr===I.NONE,c=()=>{h?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:l,anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:n,text:a}),d&&this.showAllEditors("highlight",!0,!0)};d?this.switchToMode(I.HIGHLIGHT,c):c()}#tx(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=this.#tv(t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(this.#Y||=new tD(this),this.#Y.show(e,i,"ltr"===this.direction))}addToAnnotationStorage(t){t.isEmpty()||!this.#I||this.#I.has(t.id)||this.#I.setValue(t.id,t)}#tA(){let t=document.getSelection();if(!t||t.isCollapsed){this.#ta&&(this.#Y?.hide(),this.#ta=null,this.#tw({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===this.#ta)return;let i=this.#tv(t).closest(".textLayer");if(!i){this.#ta&&(this.#Y?.hide(),this.#ta=null,this.#tw({hasSelectedText:!1}));return}if(this.#Y?.hide(),this.#ta=e,this.#tw({hasSelectedText:!0}),(this.#tr===I.HIGHLIGHT||this.#tr===I.NONE)&&(this.#tr===I.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#X=this.isShiftKeyDown,!this.isShiftKeyDown)){let t=this.#tr===I.HIGHLIGHT?this.#ty(i):null;t?.toggleDrawing();let e=new AbortController,s=this.combinedSignal(e),r=i=>{("pointerup"!==i.type||0===i.button)&&(e.abort(),t?.toggleDrawing(!0),"pointerup"===i.type&&this.#t_("main_toolbar"))};window.addEventListener("pointerup",r,{signal:s}),window.addEventListener("blur",r,{signal:s})}}#t_(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.#tr===I.HIGHLIGHT?this.highlightSelection(t):this.#U&&this.#tx()}#tf(){document.addEventListener("selectionchange",this.#tA.bind(this),{signal:this._signal})}#tE(){if(this.#q)return;this.#q=new AbortController;let t=this.combinedSignal(this.#q);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#tS(){this.#q?.abort(),this.#q=null}blur(){if(this.isShiftKeyDown=!1,this.#X&&(this.#X=!1,this.#t_("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#tn)if(e.div.contains(t)){this.#te=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#te)return;let[t,e]=this.#te;this.#te=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#tb(){if(this.#tt)return;this.#tt=new AbortController;let t=this.combinedSignal(this.#tt);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#tC(){this.#tt?.abort(),this.#tt=null}#tT(){if(this.#N)return;this.#N=new AbortController;let t=this.combinedSignal(this.#N);document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}#tM(){this.#N?.abort(),this.#N=null}#tm(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#tb(),this.#tT()}removeEditListeners(){this.#tC(),this.#tM()}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of this.#z)if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let i of this.#z)if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#k?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let t of this.#tn){let i=t.serialize(!0);i&&e.push(i)}0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let t of e.items)for(let e of this.#z)if(e.isHandlingMimeForPasting(t.type))return void e.paste(t,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(t){U(`paste: "${t.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let s=this.currentLayer;try{let t=[];for(let e of i){let i=await s.deserialize(e);if(!i)return;t.push(i)}let e=()=>{for(let e of t)this.#tk(e);this.#tP(t)};this.addCommands({cmd:e,undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){U(`paste: "${t.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#tr===I.NONE||this.isEditorHandlingKeyboard||tB._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#X&&(this.#X=!1,this.#t_("main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#tw(t){Object.entries(t).some(t=>{let[e,i]=t;return this.#th[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#th,t)}),this.#tr===I.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#tR([[L.HIGHLIGHT_FREE,!0]]))}#tR(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#tE(),this.#tT(),this.#tw({isEditing:this.#tr!==I.NONE,isEmpty:this.#tD(),hasSomethingToUndo:this.#F.hasSomethingToUndo(),hasSomethingToRedo:this.#F.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#tS(),this.#tM(),this.#tw({isEditing:!1}),this.disableUserSelect(!1))}
2registerEditorTypes(t){if(!this.#z)for(let e of(this.#z=t,this.#z))this.#tR(e.defaultPropertiesToUpdate)}getId(){return this.#Q.id}get currentLayer(){return this.#R.get(this.#O)}getLayer(t){return this.#R.get(t)}get currentPageIndex(){return this.#O}addLayer(t){this.#R.set(t.pageIndex,t),this.#J?t.enable():t.disable()}removeLayer(t){this.#R.delete(t.pageIndex)}async updateMode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.#tr!==t){if(this.#tg&&(await this.#tg.promise,!this.#tg))return;if(this.#tg=Promise.withResolvers(),this.#tr=t,t===I.NONE){this.setEditingState(!1),this.#tI(),this.#tg.resolve();return}for(let e of(this.setEditingState(!0),await this.#tL(),this.unselectAll(),this.#R.values()))e.updateMode(t);if(!e){i&&this.addNewEditorFromKeyboard(),this.#tg.resolve();return}for(let t of this.#P.values())t.annotationElementId===e?(this.setSelected(t),t.enterInEditMode()):t.unselect();this.#tg.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#tr&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if(this.#z){switch(t){case L.CREATE:this.currentLayer.addNewEditor();return;case L.HIGHLIGHT_DEFAULT_COLOR:this.#ti?.updateColor(e);break;case L.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#tl||=new Map).set(t,e),this.showAllEditors("highlight",e)}for(let i of this.#tn)i.updateParams(t,e);for(let i of this.#z)i.updateDefaultParams(t,e)}}showAllEditors(t,e){for(let i of(arguments.length>2&&void 0!==arguments[2]&&arguments[2],this.#P.values()))i.editorType===t&&i.show(e);(this.#tl?.get(L.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#tR([[L.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.#Z!==t)for(let e of(this.#Z=t,this.#R.values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}async #tL(){if(!this.#J){this.#J=!0;let t=[];for(let e of this.#R.values())t.push(e.enable());for(let e of(await Promise.all(t),this.#P.values()))e.enable()}}#tI(){if(this.unselectAll(),this.#J){for(let t of(this.#J=!1,this.#R.values()))t.disable();for(let t of this.#P.values())t.disable()}}getEditors(t){let e=[];for(let i of this.#P.values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return this.#P.get(t)}addEditor(t){this.#P.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#W&&clearTimeout(this.#W),this.#W=setTimeout(()=>{this.focusMainContainer(),this.#W=null},0)),this.#P.delete(t.id),this.unselect(t),t.annotationElementId&&this.#j.has(t.annotationElementId)||this.#I?.remove(t.id)}addDeletedAnnotationElement(t){this.#j.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#j.has(t)}removeDeletedAnnotationElement(t){this.#j.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#tk(t){let e=this.#R.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#k!==t&&(this.#k=t,t&&this.#tR(t.propertiesToUpdate))}get #tF(){let t=null;for(t of this.#tn);return t}updateUI(t){this.#tF===t&&this.#tR(t.propertiesToUpdate)}toggleSelected(t){if(this.#tn.has(t)){this.#tn.delete(t),t.unselect(),this.#tw({hasSelectedEditor:this.hasSelection});return}this.#tn.add(t),t.select(),this.#tR(t.propertiesToUpdate),this.#tw({hasSelectedEditor:!0})}setSelected(t){for(let e of this.#tn)e!==t&&e.unselect();this.#tn.clear(),this.#tn.add(t),t.select(),this.#tR(t.propertiesToUpdate),this.#tw({hasSelectedEditor:!0})}isSelected(t){return this.#tn.has(t)}get firstSelectedEditor(){return this.#tn.values().next().value}unselect(t){t.unselect(),this.#tn.delete(t),this.#tw({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#tn.size}get isEnterHandled(){return 1===this.#tn.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#F.undo(),this.#tw({hasSomethingToUndo:this.#F.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#tD()})}redo(){this.#F.redo(),this.#tw({hasSomethingToUndo:!0,hasSomethingToRedo:this.#F.hasSomethingToRedo(),isEmpty:this.#tD()})}addCommands(t){this.#F.add(t),this.#tw({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#tD()})}#tD(){if(0===this.#P.size)return!0;
2if(1===this.#P.size)for(let t of this.#P.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let t=[...this.#tn],e=()=>{for(let e of t)this.#tk(e)};this.addCommands({cmd:()=>{for(let e of t)e.remove()},undo:e,mustExec:!0})}commitOrRemove(){this.#k?.commitOrRemove()}hasSomethingToControl(){return this.#k||this.hasSelection}#tP(t){for(let t of this.#tn)t.unselect();for(let e of(this.#tn.clear(),t))e.isEmpty()||(this.#tn.add(e),e.select());this.#tw({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#tn)t.commit();this.#tP(this.#P.values())}unselectAll(){if((!this.#k||(this.#k.commitOrRemove(),this.#tr===I.NONE))&&this.hasSelection){for(let t of this.#tn)t.unselect();this.#tn.clear(),this.#tw({hasSelectedEditor:!1})}}translateSelectedEditors(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(i||this.commitOrRemove(),!this.hasSelection)return;this.#td[0]+=t,this.#td[1]+=e;let[s,r]=this.#td,n=[...this.#tn];for(let i of(this.#tc&&clearTimeout(this.#tc),this.#tc=setTimeout(()=>{this.#tc=null,this.#td[0]=this.#td[1]=0,this.addCommands({cmd:()=>{for(let t of n)this.#P.has(t.id)&&t.translateInPage(s,r)},undo:()=>{for(let t of n)this.#P.has(t.id)&&t.translateInPage(-s,-r)},mustExec:!1})},1e3),n))i.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection)for(let t of(this.disableUserSelect(!0),this.#B=new Map,this.#tn))this.#B.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#B)return!1;this.disableUserSelect(!1);let t=this.#B;this.#B=null;let e=!1;for(let[{x:i,y:s,pageIndex:r},n]of t)n.newX=i,n.newY=s,n.newPageIndex=r,e||=i!==n.savedX||s!==n.savedY||r!==n.savedPageIndex;if(!e)return!1;let i=(t,e,i,s)=>{if(this.#P.has(t.id)){let r=this.#R.get(s);r?t._setParentAndPosition(r,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:s,newY:r,newPageIndex:n}]of t)i(e,s,r,n)},undo:()=>{for(let[e,{savedX:s,savedY:r,savedPageIndex:n}]of t)i(e,s,r,n)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#B)for(let i of this.#B.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#tn.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#k===t}getActive(){return this.#k}getMode(){return this.#tr}get imageManager(){return W(this,"imageManager",new tF)}getSelectionBoxes(t){let e;if(!t)return null;let i=document.getSelection();for(let e=0,s=i.rangeCount;e<s;e++)if(!t.contains(i.getRangeAt(e).commonAncestorContainer))return null;let{x:s,y:r,width:n,height:a}=t.getBoundingClientRect();switch(t.getAttribute("data-main-rotation")){case"90":e=(t,e,i,o)=>({x:(e-r)/a,y:1-(t+i-s)/n,width:o/a,height:i/n});break;case"180":e=(t,e,i,o)=>({x:1-(t+i-s)/n,y:1-(e+o-r)/a,width:i/n,height:o/a});break;case"270":e=(t,e,i,o)=>({x:1-(e+o-r)/a,y:(t-s)/n,width:o/a,height:i/n});break;default:e=(t,e,i,o)=>({x:(t-s)/n,y:(e-r)/a,width:i/n,height:o/a})}let o=[];for(let t=0,s=i.rangeCount;t<s;t++){let s=i.getRangeAt(t);if(!s.collapsed)for(let{x:t,y:i,width:r,height:n}of s.getClientRects())0!==r&&0!==n&&o.push(e(t,i,r,n))}return 0===o.length?null:o}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;(this.#L||=new Map).set(e,i)}removeChangedExistingAnnotation(t){let{annotationElementId:e}=t;this.#L?.delete(e)}renderAnnotationElement(t){let e=this.#L?.get(t.data.id);if(!e)return;let i=this.#I.getRawValue(e);!i||(this.#tr!==I.NONE||i.hasBeenModified)&&i.renderAnnotationElement(t)}}class tz{#o=null;#tN=!1;#tO=null;#tj=null;#tB=null;#tz=null;#tH=!1;#tU=null;#n=null;#t$=null;#tG=null;#tV=!1;static #tW=null;static _l10n=null;constructor(t){this.#n=t,this.#tV=t._uiManager.useNewAltTextFlow,tz.#tW||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(t){tz._l10n??=t}async render(){let t=this.#tO=document.createElement("button");t.className="altText",t.tabIndex="0";let e=this.#tj=document.createElement("span");t.append(e),this.#tV?(t.classList.add("new"),t.setAttribute("data-l10n-id",tz.#tW.missing),e.setAttribute("data-l10n-id",tz.#tW["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let i=this.#n._uiManager._signal;t.addEventListener("contextmenu",tw,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});let s=t=>{t.preventDefault(),this.#n._uiManager.editAltText(this.#n),this.#tV&&this.#n._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#tq}})};
2return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#tH=!0,s(e))},{signal:i}),await this.#tK(),t}get #tq(){return this.#o&&"added"||null===this.#o&&this.guessedText&&"review"||"missing"}finish(){this.#tO&&(this.#tO.focus({focusVisible:this.#tH}),this.#tH=!1)}isEmpty(){return this.#tV?null===this.#o:!this.#o&&!this.#tN}hasData(){return this.#tV?null!==this.#o||!!this.#t$:this.isEmpty()}get guessedText(){return this.#t$}async setGuessedText(t){null===this.#o&&(this.#t$=t,this.#tG=await tz._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#tK())}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.#tV||this.#o){this.#tU?.remove(),this.#tU=null;return}if(!this.#tU){let t=this.#tU=document.createElement("div");t.className="noAltTextBadge",this.#n.div.append(t)}this.#tU.classList.toggle("hidden",!t)}serialize(t){let e=this.#o;return t||this.#t$!==e||(e=this.#tG),{altText:e,decorative:this.#tN,guessedText:this.#t$,textWithDisclaimer:this.#tG}}get data(){return{altText:this.#o,decorative:this.#tN}}set data(t){let{altText:e,decorative:i,guessedText:s,textWithDisclaimer:r,cancel:n=!1}=t;s&&(this.#t$=s,this.#tG=r),(this.#o!==e||this.#tN!==i)&&(n||(this.#o=e,this.#tN=i),this.#tK())}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#tO&&(!t&&this.#tz&&(clearTimeout(this.#tz),this.#tz=null),this.#tO.disabled=!t)}shown(){this.#n._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#tq}})}destroy(){this.#tO?.remove(),this.#tO=null,this.#tj=null,this.#tB=null,this.#tU?.remove(),this.#tU=null}async #tK(){let t=this.#tO;if(!t)return;if(this.#tV){if(t.classList.toggle("done",!!this.#o),t.setAttribute("data-l10n-id",tz.#tW[this.#tq]),this.#tj?.setAttribute("data-l10n-id",tz.#tW[`${this.#tq}-label`]),!this.#o)return void this.#tB?.remove()}else{if(!this.#o&&!this.#tN){t.classList.remove("done"),this.#tB?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#tB;if(!e){this.#tB=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#n.id}`;let i=this.#n._uiManager._signal;i.addEventListener("abort",()=>{clearTimeout(this.#tz),this.#tz=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#tz=setTimeout(()=>{this.#tz=null,this.#tB.classList.add("show"),this.#n._reportTelemetry({action:"alt_text_tooltip"})},100)},{signal:i}),t.addEventListener("mouseleave",()=>{this.#tz&&(clearTimeout(this.#tz),this.#tz=null),this.#tB?.classList.remove("show")},{signal:i})}this.#tN?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=this.#o),e.parentNode||t.append(e);let i=this.#n.getImageForAltText();i?.setAttribute("aria-describedby",e.id)}}class tH{#tX=null;#tY=null;#o=null;#tQ=!1;#tJ=!1;#tZ=null;#t0=null;#t1=null;#t2="";#t5=!1;#t3=null;#t6=!1;#t4=!1;#t8=!1;#t7=null;#t9=0;#et=0;#ee=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#ei=!1;#es=tH._zIndex++;static _borderLineWidth=-1;static _colorManager=new tj;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=tH.prototype._resizeWithKeyboard,e=tB.TRANSLATE_SMALL,i=tB.TRANSLATE_BIG;return W(this,"_resizerKeyboardManager",new tO([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],tH.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:r,pageY:n}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[r,n];const[a,o]=this.parentDimensions;this.x=t.x/a,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return W(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new tU({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(tH._l10n??=t,tH._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),-1!==tH._borderLineWidth)return;let i=getComputedStyle(document.documentElement);tH._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){$("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#ei}set _isDraggable(t){this.#ei=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
2setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#es}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#er(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#t5?this.#t5=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let e=t.relatedTarget;!e?.closest(`#${this.id}`)&&(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){let[r,n]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/r,this.y=(e+s)/n,this.fixAndSetPosition()}#en(t,e,i){let[s,r]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/s,this.y+=i/r,this.fixAndSetPosition()}translate(t,e){this.#en(this.parentDimensions,t,e)}translateInPage(t,e){this.#t3||=[this.x,this.y],this.#en(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#t3||=[this.x,this.y];let[i,s]=this.parentDimensions;if(this.x+=t/i,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:n}=this,[a,o]=this.getBaseTranslation();r+=a,n+=o,this.div.style.left=`${(100*r).toFixed(2)}%`,this.div.style.top=`${(100*n).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#t3&&(this.#t3[0]!==this.x||this.#t3[1]!==this.y)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=tH,s=i/t,r=i/e;switch(this.rotation){case 90:return[-s,r];case 180:return[s,r];case 270:return[s,-r];default:return[-s,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation,[e,i]=this.pageDimensions,{x:s,y:r,width:n,height:a}=this;if(n*=e,a*=i,s*=e,r*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-n,s)),r=Math.max(0,Math.min(i-a,r));break;case 90:s=Math.max(0,Math.min(e-a,s)),r=Math.min(i,Math.max(n,r));break;case 180:s=Math.min(e,Math.max(n,s)),r=Math.min(i,Math.max(a,r));break;case 270:s=Math.min(e,Math.max(a,s)),r=Math.max(0,Math.min(i-n,r))}this.x=s/=e,this.y=r/=i;let[o,l]=this.getBaseTranslation();s+=o,r+=l;let{style:h}=this.div;h.left=`${(100*s).toFixed(2)}%`,h.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static #ea(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return tH.#ea(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return tH.#ea(t,e,360-this.parentRotation)}#eo(t){switch(t){case 90:{let[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(t,e){let[i,s]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#tJ||(this.div.style.height=`${(100*e/s).toFixed(2)}%`)}fixDims(){let{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),r=!this.#tJ&&e.endsWith("%");if(s&&r)return;let[n,a]=this.parentDimensions;s||(t.width=`${(100*parseFloat(i)/n).toFixed(2)}%`),this.#tJ||r||(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#el(){if(this.#tZ)return;this.#tZ=document.createElement("div"),this.#tZ.classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let i of t){let t=document.createElement("div");this.#tZ.append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",this.#eh.bind(this,i),{signal:e}),t.addEventListener("contextmenu",tw,{signal:e}),t.tabIndex=-1}this.div.prepend(this.#tZ)}#eh(t,e){e.preventDefault();let{isMac:i}=tr.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#o?.toggle(!1);let s=this._isDraggable;this._isDraggable=!1;let r=new AbortController,n=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#ed.bind(this,t),{passive:!0,capture:!0,signal:n}),window.addEventListener("contextmenu",tw,{signal:n});let a=this.x,o=this.y,l=this.width,h=this.height,d=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let u=()=>{r.abort(),this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=d,this.div.style.cursor=c,this.#ec(a,o,l,h)};window.addEventListener("pointerup",u,{signal:n}),window.addEventListener("blur",u,{signal:n})}#ec(t,e,i,s){let r=this.x,n=this.y,a=this.width,o=this.height;(r!==t||n!==e||a!==i||o!==s)&&this.addCommands({cmd:()=>{this.width=a,this.height=o,this.x=r,this.y=n;let[t,e]=this.parentDimensions;this.setDims(t*a,e*o),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;let[r,n]=this.parentDimensions;this.setDims(r*i,n*s),this.fixAndSetPosition()},mustExec:!0})}#ed(t,e){let i,s,r,n,[a,o]=this.parentDimensions,l=this.x,h=this.y,d=this.width,c=this.height,u=tH.MIN_SIZE/a,p=tH.MIN_SIZE/o,g=t=>Math.round(1e4*t)/1e4,f=this.#eo(this.rotation),m=(t,e)=>[f[0]*t+f[2]*e,f[1]*t+f[3]*e],b=this.#eo(360-this.rotation),v=!1,y=!1;switch(t){case"topLeft":v=!0,i=(t,e)=>
2[0,0],s=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],s=(t,e)=>[t/2,e];break;case"topRight":v=!0,i=(t,e)=>[t,0],s=(t,e)=>[0,e];break;case"middleRight":y=!0,i=(t,e)=>[t,e/2],s=(t,e)=>[0,e/2];break;case"bottomRight":v=!0,i=(t,e)=>[t,e],s=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],s=(t,e)=>[t/2,0];break;case"bottomLeft":v=!0,i=(t,e)=>[0,e],s=(t,e)=>[t,0];break;case"middleLeft":y=!0,i=(t,e)=>[0,e/2],s=(t,e)=>[t,e/2]}let x=i(d,c),A=s(d,c),w=m(...A),_=g(l+w[0]),E=g(h+w[1]),S=1,C=1,[T,M]=this.screenToPageTranslation(e.movementX,e.movementY);if([T,M]=(r=T/a,n=M/o,[b[0]*r+b[2]*n,b[1]*r+b[3]*n]),v){let t=Math.hypot(d,c);S=C=Math.max(Math.min(Math.hypot(A[0]-x[0]-T,A[1]-x[1]-M)/t,1/d,1/c),u/d,p/c)}else y?S=Math.max(u,Math.min(1,Math.abs(A[0]-x[0]-T)))/d:C=Math.max(p,Math.min(1,Math.abs(A[1]-x[1]-M)))/c;let k=g(d*S),P=g(c*C),R=_-(w=m(...s(k,P)))[0],D=E-w[1];this.width=k,this.height=P,this.x=R,this.y=D,this.setDims(a*k,o*P),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this._editToolbar||this.#t4||(this._editToolbar=new tR(this),this.div.append(this._editToolbar.render()),this.#o&&await this._editToolbar.addAltText(this.#o)),this._editToolbar}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#o?.destroy())}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(tz.initialize(tH._l10n),this.#o=new tz(this),this.#tX&&(this.#o.data=this.#tX,this.#tX=null),await this.addEditToolbar())}get altTextData(){return this.#o?.data}set altTextData(t){this.#o&&(this.#o.data=t)}get guessedAltText(){return this.#o?.guessedText}async setGuessedAltText(t){await this.#o?.setGuessedText(t)}serializeAltText(t){return this.#o?.serialize(t)}hasAltText(){return!!this.#o&&!this.#o.isEmpty()}hasAltTextData(){return this.#o?.hasData()??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#tQ?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#eu();let[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);let[i,s]=this.getInitialTranslation();return this.translate(i,s),tI(this,this.div,["pointerdown"]),this.div}pointerdown(t){let{isMac:e}=tr.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#t5=!0,this._isDraggable)?this.#ep(t):this.#eg(t)}get isSelected(){return this._uiManager.isSelected(this)}#eg(t){let{isMac:e}=tr.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#ep(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=new AbortController,s=this._uiManager.combinedSignal(i);if(e){this.div.classList.add("moving"),this.#t9=t.clientX,this.#et=t.clientY;let e=t=>{let{clientX:e,clientY:i}=t,[s,r]=this.screenToPageTranslation(e-this.#t9,i-this.#et);this.#t9=e,this.#et=i,this._uiManager.dragSelectedEditors(s,r)};window.addEventListener("pointermove",e,{passive:!0,capture:!0,signal:s})}let r=()=>{i.abort(),e&&this.div.classList.remove("moving"),this.#t5=!1,this._uiManager.endDragSession()||this.#eg(t)};window.addEventListener("pointerup",r,{signal:s}),window.addEventListener("blur",r,{signal:s})}moveInDOM(){this.#t7&&clearTimeout(this.#t7),this.#t7=setTimeout(()=>{this.#t7=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation,s=this.parentScale,[r,n]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/s,h=e/s,d=this.x*r,c=this.y*n,u=this.width*r,p=this.height*n;switch(i){case 0:return[d+l+a,n-c-h-p+o,d+l+u+a,n-c-h+o];case 90:return[d+h+a,n-c+l+o,d+h+p+a,n-c+l+u+o];case 180:return[d-l-u+a,n-c+h+o,d-l+a,n-c+h+p+o];case 270:return[d-h-p+a,n-c-l-u+o,d-h+a,n-c-l+o];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,s,r,n]=t,a=r-i,o=n-s;
2switch(this.rotation){case 0:return[i,e-n,a,o];case 90:return[i,e-s,o,a];case 180:return[r,e-s,a,o];case 270:return[r,e-n,o,a];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#t4=!0}disableEditMode(){this.#t4=!1}isInEditMode(){return this.#t4}shouldGetKeyboardEvents(){return this.#t8}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}#eu(){if(this.#t1||!this.div)return;this.#t1=new AbortController;let t=this._uiManager.combinedSignal(this.#t1);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#eu()}rotate(t){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(){arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]&&arguments[1],$("An editor must be serializable")}static async deserialize(t,e,i){let s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,s.#tX=t.accessibilityData;let[r,n]=s.pageDimensions,[a,o,l,h]=s.getRectInCurrentCoords(t.rect,n);return s.x=a/r,s.y=o/n,s.width=l/r,s.height=h/n,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#t1?.abort(),this.#t1=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#t7&&(clearTimeout(this.#t7),this.#t7=null),this.#er(),this.removeEditToolbar(),this.#ee){for(let t of this.#ee.values())clearTimeout(t);this.#ee=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#el(),this.#tZ.classList.remove("hidden"),tI(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#t0={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#tZ.children;if(!this.#tY){this.#tY=Array.from(e);let t=this.#ef.bind(this),i=this.#em.bind(this),s=this._uiManager._signal;for(let e of this.#tY){let r=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:s}),e.addEventListener("blur",i,{signal:s}),e.addEventListener("focus",this.#eb.bind(this,r),{signal:s}),e.setAttribute("data-l10n-id",tH._l10nResizer[r])}}let i=this.#tY[0],s=0;for(let t of e){if(t===i)break;s++}let r=(360-this.rotation+this.parentRotation)%360/90*(this.#tY.length/4);if(r!==s){if(r<s)for(let t=0;t<s-r;t++)this.#tZ.append(this.#tZ.firstChild);else if(r>s)for(let t=0;t<r-s;t++)this.#tZ.firstChild.before(this.#tZ.lastChild);let t=0;for(let i of e){let e=this.#tY[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",tH._l10nResizer[e])}}this.#ev(0),this.#t8=!0,this.#tZ.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#ef(t){tH._resizerKeyboardManager.exec(this,t)}#em(t){this.#t8&&t.relatedTarget?.parentNode!==this.#tZ&&this.#er()}#eb(t){this.#t2=this.#t8?t:""}#ev(t){if(this.#tY)for(let e of this.#tY)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#t8&&this.#ed(this.#t2,{movementX:t,movementY:e})}#er(){if(this.#t8=!1,this.#ev(-1),this.#t0){let{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=this.#t0;this.#ec(t,e,i,s),this.#t0=null}}_stopResizingWithKeyboard(){this.#er(),this.div.focus()}select(){(this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar)?(this._editToolbar?.show(),this.#o?.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()})}unselect(){this.#tZ?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#o?.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#t6}set isEditing(t){this.#t6=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){this.#tJ=!0;let{style:i}=this.div;i.aspectRatio=t/e,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e){this.#ee||=new Map;let{action:e}=t,i=this.#ee.get(e);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),this.#ee.delete(e),0===this.#ee.size&&(this.#ee=null)},tH._telemetryTimeout),this.#ee.set(e,i);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
2show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#tQ=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#tQ=!0}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}}class tU extends tH{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}class t${constructor(t){this.h1=t?0|t:0xc3d2e1f0,this.h2=t?0|t:0xc3d2e1f0}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,r=t.length;s<r;s++){let r=t.charCodeAt(s);r<=255?e[i++]=r:(e[i++]=r>>>8,e[i++]=255&r)}}else if(ArrayBuffer.isView(t))i=(e=t.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,r=i-4*s,n=new Uint32Array(e.buffer,0,s),a=0,o=0,l=this.h1,h=this.h2;for(let t=0;t<s;t++)1&t?(l^=a=0x1b873593*(a=(a=0xcc9e2d51*(a=n[t])&0xffff0000|11601*a&65535)<<15|a>>>17)&0xffff0000|13715*a&65535,l=5*(l=l<<13|l>>>19)+0xe6546b64):(h^=o=0x1b873593*(o=(o=0xcc9e2d51*(o=n[t])&0xffff0000|11601*o&65535)<<15|o>>>17)&0xffff0000|13715*o&65535,h=5*(h=h<<13|h>>>19)+0xe6546b64);switch(a=0,r){case 3:a^=e[4*s+2]<<16;case 2:a^=e[4*s+1]<<8;case 1:a^=e[4*s],a=0x1b873593*(a=(a=0xcc9e2d51*a&0xffff0000|11601*a&65535)<<15|a>>>17)&0xffff0000|13715*a&65535,1&s?l^=a:h^=a}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,e=0xff51afd7*e&0xffff0000|((e<<16|(t=0xed558ccd*t&0xffff0000|36045*t&65535)>>>16)*0xafd7ed55&0xffff0000)>>>16,t^=e>>>1,e=0xc4ceb9fe*e&0xffff0000|((e<<16|(t=0x1a85ec53*t&0xffff0000|60499*t&65535)>>>16)*0xb9fe1a85&0xffff0000)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}let tG=Object.freeze({map:null,hash:"",transfer:void 0});class tV{#ey=!1;#ex=null;#eA=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){let i=this.#eA.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#eA.get(t)}remove(t){if(this.#eA.delete(t),0===this.#eA.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let t of this.#eA.values())if(t instanceof tH)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=this.#eA.get(t),s=!1;if(void 0!==i)for(let[t,r]of Object.entries(e))i[t]!==r&&(s=!0,i[t]=r);else s=!0,this.#eA.set(t,e);s&&this.#ew(),e instanceof tH&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#eA.has(t)}getAll(){return this.#eA.size>0?ts(this.#eA):null}setAll(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return this.#eA.size}#ew(){this.#ey||(this.#ey=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#ey&&(this.#ey=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new tW(this)}get serializable(){if(0===this.#eA.size)return tG;let t=new Map,e=new t$,i=[],s=Object.create(null),r=!1;for(let[i,n]of this.#eA){let a=n instanceof tH?n.serialize(!1,s):n;a&&(t.set(i,a),e.update(`${i}:${JSON.stringify(a)}`),r||=!!a.bitmap)}if(r)for(let e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:tG}get editorStats(){let t=null,e=new Map;for(let i of this.#eA.values()){if(!(i instanceof tH))continue;let s=i.telemetryFinalData;if(!s)continue;let{type:r}=s;e.has(r)||e.set(r,Object.getPrototypeOf(i).constructor),t||=Object.create(null);let n=t[r]||=new Map;for(let[t,e]of Object.entries(s)){if("type"===t)continue;let i=n.get(t);i||(i=new Map,n.set(t,i));let s=i.get(e)??0;i.set(e,s+1)}}for(let[i,s]of e)t[i]=s.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){this.#ex=null}get modifiedIds(){if(this.#ex)return this.#ex;let t=[];for(let e of this.#eA.values())e instanceof tH&&e.annotationElementId&&e.serialize()&&t.pu
2sh(e.annotationElementId);return this.#ex={ids:new Set(t),hash:t.join(",")}}}class tW extends tV{#e_;constructor(t){super();const{map:e,hash:i,transfer:s}=t.serializable,r=structuredClone(e,s?{transfer:s}:null);this.#e_={map:r,hash:i,transfer:s}}get print(){$("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e_}get modifiedIds(){return W(this,"modifiedIds",{ids:new Set,hash:""})}}class tq{#eE=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#eE.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(!(!e||this.#eE.has(e.loadedName))){if(G(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:s,style:r}=e,n=new FontFace(t,s,r);this.addNativeFontFace(n);try{await n.load(),this.#eE.add(t),i?.(e)}catch{U(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(n)}return}$("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){let e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw U(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{let i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){return W(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let t=!1;return k?t=!0:"u">typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(t=!0),W(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){let{loadingRequests:e}=this,i={done:!1,complete:function(){for(G(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;)setTimeout(e.shift().callback,0)},callback:t};return e.push(i),i}get _loadTestFont(){return W(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){var i;let s,r;function n(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function a(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)}let o=this._document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d"),h=0,d=`lt${Date.now()}${this.loadTestFontId++}`,c=this._loadTestFont,u=n(c=a(c,976,d.length,d),16);for(s=0,r=d.length-3;s<r;s+=4)u=u-0x58585858+n(d,s)|0;s<d.length&&(u=u-0x58585858+n(d+"XXX",s)|0),c=a(c,16,4,String.fromCharCode((i=u)>>24&255,i>>16&255,i>>8&255,255&i));let p=`url(data:font/opentype;base64,${btoa(c)});`,g=`@font-face {font-family:"${d}";src:${p}}`;this.insertRule(g);let f=this._document.createElement("div");
2for(let e of(f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,f.append(t)}this._document.body.append(f),function t(e,i){if(++h>30){U("Load test font never loaded."),i();return}(l.font="30px "+e,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0)?i():setTimeout(t.bind(null,e,i))}(d,()=>{f.remove(),e.complete()})}}class tK{constructor(t,{disableFontFace:e=!1,inspectFont:i=null}){for(const e in this.compiledGlyphs=Object.create(null),t)this[e]=t[e];this.disableFontFace=!0===e,this._inspectFont=i}createNativeFontFace(){let t;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){var t;let e;if(!this.data||this.disableFontFace)return null;let i=`url(data:${this.mimetype};base64,${(t=this.data,Uint8Array.prototype.toBase64?t.toBase64():btoa(te(t)))});`;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${i}}`}else e=`@font-face {font-family:"${this.loadedName}";src:${i}}`;return this._inspectFont?.(this,i),e}getPathGenerator(t,e){let i;if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];try{i=t.get(this.loadedName+"_path_"+e)}catch(t){U(`getPathGenerator - ignoring character: "${t}".`)}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};let s=[];for(let t=0,e=i.length;t<e;)switch(i[t++]){case 0:{let[e,r,n,a,o,l]=i.slice(t,t+6);s.push(t=>t.bezierCurveTo(e,r,n,a,o,l)),t+=6}break;case 1:{let[e,r]=i.slice(t,t+2);s.push(t=>t.moveTo(e,r)),t+=2}break;case 2:{let[e,r]=i.slice(t,t+2);s.push(t=>t.lineTo(e,r)),t+=2}break;case 3:{let[e,r,n,a]=i.slice(t,t+4);s.push(t=>t.quadraticCurveTo(e,r,n,a)),t+=4}break;case 4:s.push(t=>t.restore());break;case 5:s.push(t=>t.save());break;case 6:G(2===s.length,"Scale command is only valid at the third position.");break;case 7:{let[e,r,n,a,o,l]=i.slice(t,t+6);s.push(t=>t.transform(e,r,n,a,o,l)),t+=6}break;case 8:{let[e,r]=i.slice(t,t+2);s.push(t=>t.translate(e,r)),t+=2}}return this.compiledGlyphs[e]=function(t,e){s[0](t),s[1](t),t.scale(e,-e);for(let e=2,i=s.length;e<i;e++)s[e](t)}}}class tX{#eS=!1;constructor({enableHWA:t=!1}){this.#eS=t}create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#eS})}}reset(t,e,i){if(!t.canvas)throw Error("Canvas is not specified");if(e<=0||i<=0)throw Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){$("Abstract method `_createCanvas` called.")}}class tY{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw Error("CMap name must be specified.");let i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)})}async _fetch(t){$("Abstract method `_fetch` called.")}}class tQ extends tY{async _fetch(t){let e=await tp(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):ti(e)}}class tJ{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,r){return"none"}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]}}class tZ{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw Error("Font filename must be specified.");let i=`${this.baseUrl}${e}`;return this._fetch(i).catch(t=>{throw Error(`Unable to load font data at: ${i}`)})}async _fetch(t){$("Abstract method `_fetch` called.")}}class t0 extends tZ{async _fetch(t){return new Uint8Array(await tp(t,"arraybuffer"))}}if(k){var t1=Promise.withResolvers(),t2=null;(async()=>{let t,e,i=await import("fs"),s=await import("http");return new Map(Object.entries({fs:i,http:s,https:await import("https"),url:await import("url"),canvas:t,path2d:e}))})().then(t=>{t2=t,t1.resolve()},t=>{U(`loadPackages: ${t}`),t2=new Map,t1.resolve()})}class t5{static get promise(){return t1.promise}static get(t){return t2?.get(t)}}async function t3(t){let e=t5.get("fs");return new Uint8Array(await e.promises.readFile(t))}let t6="Fill",t4="Stroke",t8="Shading";function t7(t,e){if(!e)return;let i=e[2]-e[0],s=e[3]-e[1],r=new Path2D;r.rect(e[0],e[1],i,s),t.clip(r)}class t9{getPattern(){$("Abstract method `getPattern` called.")}}class et extends t9{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;for(let i of("axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1)),this._colorStops))e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let r;if(s===t4||s===t6){let n=e.current.getClippedPathBoundingBox(s,tT(t))||[0,0,0,0],a=Math.ceil(n[2]-n[0])||1,o=Math.ceil(n[3]-n[1])||1,l=e.cachedCanvases.getCanvas("pattern",a,o),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-n[0],-n[1]),i=ta.transform(i,[1,0,0,1,n[0],n[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix
2),t7(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),r=t.createPattern(l.canvas,"no-repeat");let d=new DOMMatrix(i);r.setTransform(d)}else t7(t,this._bbox),r=this._createGradient(t);return r}}function ee(t,e,i,s,r,n,a,o){let l,h,d,c,u,p,g,f,m,b=e.coords,v=e.colors,y=t.data,x=4*t.width;b[i+1]>b[s+1]&&(l=i,i=s,s=l,l=n,n=a,a=l),b[s+1]>b[r+1]&&(l=s,s=r,r=l,l=a,a=o,o=l),b[i+1]>b[s+1]&&(l=i,i=s,s=l,l=n,n=a,a=l);let A=(b[i]+e.offsetX)*e.scaleX,w=(b[i+1]+e.offsetY)*e.scaleY,_=(b[s]+e.offsetX)*e.scaleX,E=(b[s+1]+e.offsetY)*e.scaleY,S=(b[r]+e.offsetX)*e.scaleX,C=(b[r+1]+e.offsetY)*e.scaleY;if(w>=C)return;let T=v[n],M=v[n+1],k=v[n+2],P=v[a],R=v[a+1],D=v[a+2],I=v[o],L=v[o+1],F=v[o+2],N=Math.round(w),O=Math.round(C);for(let t=N;t<=O;t++){let e;if(t<E){let e=t<w?0:(w-t)/(w-E);h=A-(A-_)*e,d=T-(T-P)*e,c=M-(M-R)*e,u=k-(k-D)*e}else{let e;h=_-(_-S)*(e=t>C?1:E===C?0:(E-t)/(E-C)),d=P-(P-I)*e,c=R-(R-L)*e,u=D-(D-F)*e}p=A-(A-S)*(e=t<w?0:t>C?1:(w-t)/(w-C)),g=T-(T-I)*e,f=M-(M-L)*e,m=k-(k-F)*e;let i=Math.round(Math.min(h,p)),s=Math.round(Math.max(h,p)),r=x*t+4*i;for(let t=i;t<=s;t++)(e=(h-t)/(h-p))<0?e=0:e>1&&(e=1),y[r++]=d-(d-g)*e|0,y[r++]=c-(c-f)*e|0,y[r++]=u-(u-m)*e|0,y[r++]=255}}class ei extends t9{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){let s=Math.floor(this._bounds[0]),r=Math.floor(this._bounds[1]),n=Math.ceil(this._bounds[2])-s,a=Math.ceil(this._bounds[3])-r,o=Math.min(Math.ceil(Math.abs(n*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),h=n/o,d=a/l,c={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-r,scaleX:1/h,scaleY:1/d},u=o+4,p=l+4,g=i.getCanvas("mesh",u,p),f=g.context,m=f.createImageData(o,l);if(e){let t=m.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(let t of this._figures)!function(t,e,i){let s,r,n=e.coords,a=e.colors;switch(e.type){case"lattice":let o=e.verticesPerRow,l=Math.floor(n.length/o)-1,h=o-1;for(s=0;s<l;s++){let e=s*o;for(let s=0;s<h;s++,e++)ee(t,i,n[e],n[e+1],n[e+o],a[e],a[e+1],a[e+o]),ee(t,i,n[e+o+1],n[e+1],n[e+o],a[e+o+1],a[e+1],a[e+o])}break;case"triangles":for(s=0,r=n.length;s<r;s+=3)ee(t,i,n[s],n[s+1],n[s+2],a[s],a[s+1],a[s+2]);break;default:throw Error("illegal figure")}}(m,t,c);return f.putImageData(m,2,2),{canvas:g.canvas,offsetX:s-2*h,offsetY:r-2*d,scaleX:h,scaleY:d}}getPattern(t,e,i,s){let r;if(t7(t,this._bbox),s===t8)r=ta.singularValueDecompose2dScale(tT(t));else if(r=ta.singularValueDecompose2dScale(e.baseTransform),this.matrix){let t=ta.singularValueDecompose2dScale(this.matrix);r=[r[0]*t[0],r[1]*t[1]]}let n=this._createMeshCanvas(r,s===t8?null:this._background,e.cachedCanvases);return s!==t8&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(n.offsetX,n.offsetY),t.scale(n.scaleX,n.scaleY),t.createPattern(n.canvas,"no-repeat")}}class es extends t9{getPattern(){return"hotpink"}}class er{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,s,r){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=s,this.baseTransform=r}createPatternCanvas(t){let{bbox:e,operatorList:i,paintType:s,tilingType:r,color:n,canvasGraphicsFactory:a}=this,{xstep:o,ystep:l}=this;o=Math.abs(o),l=Math.abs(l),H("TilingType: "+r);let h=e[0],d=e[1],c=e[2],u=e[3],p=c-h,g=u-d,f=ta.singularValueDecompose2dScale(this.matrix),m=ta.singularValueDecompose2dScale(this.baseTransform),b=f[0]*m[0],v=f[1]*m[1],y=p,x=g,A=!1,w=!1,_=Math.ceil(l*v),E=Math.ceil(g*v);Math.ceil(o*b)>=Math.ceil(p*b)?y=o:A=!0,_>=E?x=l:w=!0;let S=this.getSizeAndScale(y,this.ctx.canvas.width,b),C=this.getSizeAndScale(x,this.ctx.canvas.height,v),T=t.cachedCanvases.getCanvas("pattern",S.size,C.size),M=T.context,k=a.createCanvasGraphics(M);if(k.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(k,s,n),M.translate(-S.scale*h,-C.scale*d),k.transform(S.scale,0,0,C.scale,0,0),M.save(),this.clipBbox(k,h,d,c,u),k.baseTransform=tT(k.ctx),k.executeOperatorList(i),k.endDrawing(),M.restore(
2),A||w){let e=T.canvas;A&&(y=o),w&&(x=l);let i=this.getSizeAndScale(y,this.ctx.canvas.width,b),s=this.getSizeAndScale(x,this.ctx.canvas.height,v),r=i.size,n=s.size,a=t.cachedCanvases.getCanvas("pattern-workaround",r,n),c=a.context,u=A?Math.floor(p/o):0,f=w?Math.floor(g/l):0;for(let t=0;t<=u;t++)for(let i=0;i<=f;i++)c.drawImage(e,r*t,n*i,r,n,0,0,r,n);return{canvas:a.canvas,scaleX:i.scale,scaleY:s.scale,offsetX:h,offsetY:d}}return{canvas:T.canvas,scaleX:S.scale,scaleY:C.scale,offsetX:h,offsetY:d}}getSizeAndScale(t,e,i){let s=Math.max(er.MAX_PATTERN_SIZE,e),r=Math.ceil(t*i);return r>=s?r=s:i=r/t,{scale:i,size:r}}clipBbox(t,e,i,s,r){let n=s-e,a=r-i;t.ctx.rect(e,i,n,a),t.current.updateRectMinMax(tT(t.ctx),[e,i,s,r]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let s=t.ctx,r=t.current;switch(e){case 1:let n=this.ctx;s.fillStyle=n.fillStyle,s.strokeStyle=n.strokeStyle,r.fillColor=n.fillStyle,r.strokeColor=n.strokeStyle;break;case 2:let a=ta.makeHexColor(i[0],i[1],i[2]);s.fillStyle=a,s.strokeStyle=a,r.fillColor=a,r.strokeColor=a;break;default:throw new Z(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,s){let r=i;s!==t8&&(r=ta.transform(r,e.baseTransform),this.matrix&&(r=ta.transform(r,this.matrix)));let n=this.createPatternCanvas(e),a=new DOMMatrix(r);a=(a=a.translate(n.offsetX,n.offsetY)).scale(1/n.scaleX,1/n.scaleY);let o=t.createPattern(n.canvas,"repeat");return o.setTransform(a),o}}class en{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function ea(t,e,i,s,r,n,a,o,l,h){let[d,c,u,p,g,f]=tT(t);if(0===c&&0===u){let m=Math.round(a*d+g),b=Math.round(o*p+f),v=Math.abs(Math.round((a+l)*d+g)-m)||1,y=Math.abs(Math.round((o+h)*p+f)-b)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),m,b),t.drawImage(e,i,s,r,n,0,0,v,y),t.setTransform(d,c,u,p,g,f),[v,y]}if(0===d&&0===p){let m=Math.round(o*u+g),b=Math.round(a*c+f),v=Math.abs(Math.round((o+h)*u+g)-m)||1,y=Math.abs(Math.round((a+l)*c+f)-b)||1;return t.setTransform(0,Math.sign(c),Math.sign(u),0,m,b),t.drawImage(e,i,s,r,n,0,0,y,v),t.setTransform(d,c,u,p,g,f),[y,v]}return t.drawImage(e,i,s,r,n,a,o,l,h),[Math.hypot(d,c)*l,Math.hypot(u,p)*h]}class eo{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=P,this.textMatrixScale=1,this.fontMatrix=R,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=0,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,i){[e,i]=ta.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){let i=ta.applyTransform(e,t),s=ta.applyTransform(e.slice(2),t),r=ta.applyTransform([e[0],e[3]],t),n=ta.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],s[0],r[0],n[0]),this.minY=Math.min(this.minY,i[1],s[1],r[1],n[1]),this.maxX=Math.max(this.maxX,i[0],s[0],r[0],n[0]),this.maxY=Math.max(this.maxY,i[1],s[1],r[1],n[1])}updateScalingPathMinMax(t,e){ta.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,s,r,n,a,o,l,h){let d=ta.bezierBoundingBox(e,i,s,r,n,a,o,l,h);h||this.updateRectMinMax(t,d)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t6,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[this.minX,this.minY,this.maxX,this.maxY];if(t===t4){e||$("Stroke bounding box must include transform.");let t=ta.singularValueDecompose2dScale(e),s=t[0]*this.lineWidth/2,r=t[1]*this.lineWidth/2;i[0]-=s,i[1]-=r,i[2]+=s,i[3]+=r}return i}updateClipFromPath(){let t=ta.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t6,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return ta.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function el(t,e){let i,s,r,n;if("u">typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);let a=e.height,o=e.width,l=a%16,h=(a-l)/16,d=0===l?h:h+1,c=t.createImageData(o,16),u=0,p,g=e.data,f=c.data;if(e.kind===N.GRAYSCALE_1BPP){let e=g.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),a=n.length,m=o+7>>3,b=tr.isLittleEndian?0xff000000:255;for(i=0;i<d;i++){for(r=i<h?16:l,p=0,s=0;s<r;s++){let t=e-u,i=0,s=t>m?o:8*t-7,r=-8&s,a=0,l=0;for(;i<r;i+=8)l=g[u++],n[p++]=128&l?0xffffffff:b,n[p++]=64&l?0xffffffff:b,n[p++]=32&l?0xffffffff:b,n[p++]=16&l?0xffffffff:b,n[p++]=8&l?0xffffffff:b,n[p++]=4&l?0xffffffff:b,n[p++]=2&l?0xffffffff:b,n[p++]=1&l?0xffffffff:b;for(;i<s;i++)0===a&&(l=g[u++],a=128),n[p++]=l&a?0xffffffff:b,a>
2>=1}for(;p<a;)n[p++]=0;t.putImageData(c,0,16*i)}}else if(e.kind===N.RGBA_32BPP){for(s=0,n=16*o*4,i=0;i<h;i++)f.set(g.subarray(u,u+n)),u+=n,t.putImageData(c,0,s),s+=16;i<d&&(n=o*l*4,f.set(g.subarray(u,u+n)),t.putImageData(c,0,s))}else if(e.kind===N.RGB_24BPP)for(n=o*(r=16),i=0;i<d;i++){for(i>=h&&(n=o*(r=l)),p=0,s=n;s--;)f[p++]=g[u++],f[p++]=g[u++],f[p++]=g[u++],f[p++]=255;t.putImageData(c,0,16*i)}else throw Error(`bad image kind: ${e.kind}`)}function eh(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);let i=e.height,s=e.width,r=i%16,n=(i-r)/16,a=0===r?n:n+1,o=t.createImageData(s,16),l=0,h=e.data,d=o.data;for(let e=0;e<a;e++){let i=e<n?16:r;({srcPos:l}=function(t){let{src:e,srcPos:i=0,dest:s,width:r,height:n,nonBlackColor:a=0xffffffff,inverseDecode:o=!1}=t,l=tr.isLittleEndian?0xff000000:255,[h,d]=o?[a,l]:[l,a],c=r>>3,u=7&r,p=e.length;s=new Uint32Array(s.buffer);let g=0;for(let t=0;t<n;t++){for(let t=i+c;i<t;i++){let t=i<p?e[i]:255;s[g++]=128&t?d:h,s[g++]=64&t?d:h,s[g++]=32&t?d:h,s[g++]=16&t?d:h,s[g++]=8&t?d:h,s[g++]=4&t?d:h,s[g++]=2&t?d:h,s[g++]=1&t?d:h}if(0===u)continue;let t=i<p?e[i++]:255;for(let e=0;e<u;e++)s[g++]=t&1<<7-e?d:h}return{srcPos:i,destPos:g}}({src:h,srcPos:l,dest:d,width:s,height:i,nonBlackColor:0})),t.putImageData(o,0,16*e)}}function ed(t,e){for(let i of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==t[i]&&(e[i]=t[i]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function ec(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!k){let{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function eu(t,e){if(e)return!0;let i=ta.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);let s=Math.fround((globalThis.devicePixelRatio||1)*tu.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}let ep=["butt","round","square"],eg=["miter","round","bevel"],ef={},em={};class eb{constructor(t,e,i,s,r,{optionalContentConfig:n,markedContentStack:a=null},o,l){this.ctx=t,this.current=new eo(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=r,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=n,this.cachedCanvases=new en(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:s=!1,background:r=null}=t,n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=r||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){let t=this.cachedCanvases.getCanvas("transparent",n,a);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...tT(this.compositeCtx))}this.ctx.save(),ec(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=tT(this.ctx)}executeOperatorList(t,e,i,s){let r,n=t.argsArray,a=t.fnArray,o=e||0,l=n.length;if(l===o)return o;let h=l-o>10&&"function"==typeof i,d=h?Date.now()+15:0,c=0,u=this.commonObjs,p=this.objs;for(;;){if(void 0!==s&&o===s.nextBreakPoint)return s.breakIt(o,i),o;if((r=a[o])!==j.dependency)this[r].apply(this,n[o]);else for(let t of n[o]){let e=t.startsWith("g_")?u:p;if(!e.has(t))return e.get(t,i),o}if(++o===l)return o;if(h&&++c>10){if(Date.now()>d)return i(),o;c=0}}}#eC(){for(;this.stateStack.length||this.inSMaskMode;
2)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){for(let t of(this.#eC(),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#eT()}#eT(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let i,s,r=t.width??t.displayWidth,n=t.height??t.displayHeight,a=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=r,h=n,d="prescale1";for(;a>2&&l>1||o>2&&h>1;){let e=l,r=h;a>2&&l>1&&(e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),a/=l/e),o>2&&h>1&&(r=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/r),(s=(i=this.cachedCanvases.getCanvas(d,e,r)).context).clearRect(0,0,e,r),s.drawImage(t,0,0,l,h,0,0,e,r),t=i.canvas,l=e,h=r,d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t){let e,i,s,r,n=this.ctx,{width:a,height:o}=t,l=this.current.fillColor,h=this.current.patternFill,d=tT(n);if((t.bitmap||t.data)&&t.count>1){let r=t.bitmap||t.data.buffer;i=JSON.stringify(h?d:[d.slice(0,4),l]),(e=this._cachedBitmapsMap.get(r))||(e=new Map,this._cachedBitmapsMap.set(r,e));let n=e.get(i);if(n&&!h)return{canvas:n,offsetX:Math.round(Math.min(d[0],d[2])+d[4]),offsetY:Math.round(Math.min(d[1],d[3])+d[5])};s=n}s||eh((r=this.cachedCanvases.getCanvas("maskCanvas",a,o)).context,t);let c=ta.transform(d,[1/a,0,0,-1/o,0,0]);c=ta.transform(c,[1,0,0,1,0,-o]);let[u,p,g,f]=ta.getAxialAlignedBoundingBox([0,0,a,o],c),m=Math.round(g-u)||1,b=Math.round(f-p)||1,v=this.cachedCanvases.getCanvas("fillCanvas",m,b),y=v.context;y.translate(-u,-p),y.transform(...c),!s&&(s=(s=this._scaleImage(r.canvas,tM(y))).img,e&&h&&e.set(i,s)),y.imageSmoothingEnabled=eu(tT(y),t.interpolate),ea(y,s,0,0,s.width,s.height,0,0,a,o),y.globalCompositeOperation="source-in";let x=ta.transform(tM(y),[1,0,0,1,-u,-p]);return y.fillStyle=h?l.getPattern(n,this,x,t6):l,y.fillRect(0,0,a,o),e&&!h&&(this.cachedCanvases.delete("fillCanvas"),e.set(i,v.canvas)),{canvas:v.canvas,offsetX:Math.round(u),offsetY:Math.round(p)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=ep[t]}setLineJoin(t){this.ctx.lineJoin=eg[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){let i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;let r=this.ctx;r.setTransform(...tT(this.suspendedCtx)),ed(this.suspendedCtx,r);var n=this.suspendedCtx;if(r._removeMirroring)throw Error("Context is already forwarding operations.");r.__originalSave=r.save,r.__originalRestore=r.restore,r.__originalRotate=r.rotate,r.__originalScale=r.scale,r.__originalTranslate=r.translate,r.__originalTransform=r.transform,r.__originalSetTransform=r.setTransform,r.__originalResetTransform=r.resetTransform,r.__originalClip=r.clip,r.__originalMoveTo=r.moveTo,r.__originalLineTo=r.lineTo,r.__originalBezierCurveTo=r.bezierCurveTo,r.__originalRect=r.rect,r.__originalClosePath=r.closePath,r.__originalBeginPath=r.beginPath,r._removeMirroring=()=>{r.save=r.__originalSave,r.restore=r.__originalRestore,r.rotate=r.__originalRotate,r.scale=r.__originalScale,r.translate=r.__originalTranslate,r.transform=r.__originalTransform,r.setTransform=r.__originalSetTransform,r.resetTransform=r.__originalResetTransform,r.clip=r.__originalClip,r.moveTo=r.__originalMoveTo,r.lineTo=r.__originalLineTo,r.bezierCurveTo=r.__originalBezierCurveTo,r.rect=r.__originalRect,r.closePath=r.__originalClosePath,r.beginPath=r.__originalBeginPath,delete r._removeMirroring},r.save=function(){n.save(),this.__originalSave()}
2,r.restore=function(){n.restore(),this.__originalRestore()},r.translate=function(t,e){n.translate(t,e),this.__originalTranslate(t,e)},r.scale=function(t,e){n.scale(t,e),this.__originalScale(t,e)},r.transform=function(t,e,i,s,r,a){n.transform(t,e,i,s,r,a),this.__originalTransform(t,e,i,s,r,a)},r.setTransform=function(t,e,i,s,r,a){n.setTransform(t,e,i,s,r,a),this.__originalSetTransform(t,e,i,s,r,a)},r.resetTransform=function(){n.resetTransform(),this.__originalResetTransform()},r.rotate=function(t){n.rotate(t),this.__originalRotate(t)},r.clip=function(t){n.clip(t),this.__originalClip(t)},r.moveTo=function(t,e){n.moveTo(t,e),this.__originalMoveTo(t,e)},r.lineTo=function(t,e){n.lineTo(t,e),this.__originalLineTo(t,e)},r.bezierCurveTo=function(t,e,i,s,r,a){n.bezierCurveTo(t,e,i,s,r,a),this.__originalBezierCurveTo(t,e,i,s,r,a)},r.rect=function(t,e,i,s){n.rect(t,e,i,s),this.__originalRect(t,e,i,s)},r.closePath=function(){n.closePath(),this.__originalClosePath()},r.beginPath=function(){n.beginPath(),this.__originalBeginPath()},this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ed(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,s){let r=s[0],n=s[1],a=s[2]-r,o=s[3]-n;0!==a&&0!==o&&(this.genericComposeSMask(e.context,i,a,o,e.subtype,e.backdrop,e.transferMap,r,n,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,r,n,a,o,l,h,d){let c=t.canvas,u=o-h,p=l-d;if(n){let e=ta.makeHexColor(...n);if(u<0||p<0||u+i>c.width||p+s>c.height){let t=this.cachedCanvases.getCanvas("maskExtension",i,s),r=t.context;r.drawImage(c,-u,-p),r.globalCompositeOperation="destination-atop",r.fillStyle=e,r.fillRect(0,0,i,s),r.globalCompositeOperation="source-over",c=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let r=new Path2D;r.rect(u,p,i,s),t.clip(r),t.globalCompositeOperation="destination-atop",t.fillStyle=e,t.fillRect(u,p,i,s),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===r&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===r&&(e.filter=this.filterFactory.addLuminosityFilter(a));let g=new Path2D;g.rect(o,l,i,s),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(c,u,p,i,s,o,l,i,s),e.restore()}save(){this.inSMaskMode?(ed(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ed(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,r,n){this.ctx.transform(t,e,i,s,r,n),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let s,r,n=this.ctx,a=this.current,o=a.x,l=a.y,h=tT(n),d=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],c=d?i.slice(0):null;for(let i=0,u=0,p=t.length;i<p;i++)switch(0|t[i]){case j.rectangle:o=e[u++],l=e[u++];let p=e[u++],g=e[u++],f=o+p,m=l+g;n.moveTo(o,l),0===p||0===g?n.lineTo(f,m):(n.lineTo(f,l),n.lineTo(f,m),n.lineTo(o,m)),d||a.updateRectMinMax(h,[o,l,f,m]),n.closePath();break;case j.moveTo:o=e[u++],l=e[u++],n.moveTo(o,l),d||a.updatePathMinMax(h,o,l);break;case j.lineTo:o=e[u++],l=e[u++],n.lineTo(o,l),d||a.updatePathMinMax(h,o,l);break;case j.curveTo:s=o,r=l,o=e[u+4],l=e[u+5],n.bezierCurveTo(e[u],e[u+1],e[u+2],e[u+3],o,l),a.updateCurvePathMinMax(h,s,r,e[u],e[u+1],e[u+2],e[u+3],o,l,c),u+=6;break;case j.curveTo2:s=o,r=l,n.bezierCurveTo(o,l,e[u],e[u+1],e[u+2],e[u+3]),a.updateCurvePathMinMax(h,s,r,o,l,e[u],e[u+1],e[u+2],e[u+3],c),o=e[u+2],l=e[u+3],u+=4;break;case j.curveTo3:s=o,r=l,o=e[u+2],l=e[u+3],n.bezierCurveTo(e[u],e[u+1],o,l,o,l),a.updateCurvePathMinMax(h,s,r,e[u],e[u+1],o,l,o,l,c),u+=4;break;case j.closePath:n.closePath()}d&&a.updateScalingPathMinMax(h,c),a.setCurrentPoint(o,l)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&i?.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,tM(e),t4),this.rescaleAndStroke(!1),e.restore(
2)):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],e=this.ctx,i=this.current.fillColor,s=this.current.patternFill,r=!1;s&&(e.save(),e.fillStyle=i.getPattern(e,this,tM(e),t6),r=!0);let n=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==n&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),r&&e.restore(),t&&this.consumePath(n)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=ef}eoClip(){this.pendingClip=em}beginText(){this.current.textMatrix=P,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let t=this.pendingTextPaths,e=this.ctx;if(void 0===t)return void e.beginPath();for(let i of(e.save(),e.beginPath(),t))e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){let i=this.commonObjs.get(t),s=this.current;if(!i)throw Error(`Can't find font for ${t}`);if(s.fontMatrix=i.fontMatrix||R,(0===s.fontMatrix[0]||0===s.fontMatrix[3])&&U("Invalid font matrix for font "+t),e<0?(e=-e,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;let r=i.loadedName||"sans-serif",n=i.systemFontInfo?.css||`"${r}", ${i.fallbackName}`,a="normal";i.black?a="900":i.bold&&(a="bold");let o=i.italic?"italic":"normal",l=e;e<16?l=16:e>100&&(l=100),this.current.fontSizeScale=e/l,this.ctx.font=`${o} ${a} ${l}px ${n}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,s,r,n){this.current.textMatrix=[t,e,i,s,r,n],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,s){let r,n=this.ctx,a=this.current,o=a.font,l=a.textRenderingMode,h=a.fontSize/a.fontSizeScale,d=3&l,c=!!(4&l),u=a.patternFill&&!o.missingFile;(o.disableFontFace||c||u)&&(r=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||u?(n.save(),n.translate(e,i),n.beginPath(),r(n,h),s&&n.setTransform(...s),(0===d||2===d)&&n.fill(),(1===d||2===d)&&n.stroke(),n.restore()):((0===d||2===d)&&n.fillText(t,e,i),(1===d||2===d)&&n.strokeText(t,e,i)),c&&(this.pendingTextPaths||=[]).push({transform:tT(n),x:e,y:i,fontSize:h,addToPath:r})}get isFontSubpixelAAEnabled(){let{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);let e=t.getImageData(0,0,10,10).data,i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return W(this,"isFontSubpixelAAEnabled",i)}showText(t){let e,i=this.current,s=i.font;if(s.isType3Font)return this.showType3Text(t);let r=i.fontSize;if(0===r)return;let n=this.ctx,a=i.fontSizeScale,o=i.charSpacing,l=i.wordSpacing,h=i.fontDirection,d=i.textHScale*h,c=t.length,u=s.vertical,p=u?1:-1,g=s.defaultVMetrics,f=r*i.fontMatrix[0],m=0===i.textRenderingMode&&!s.disableFontFace&&!i.patternFill;if(n.save(),n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),h>0?n.scale(d,-1):n.scale(d,1),i.patternFill){n.save();let t=i.fillColor.getPattern(n,this,tM(n),t6);e=tT(n),n.restore(),n.fillStyle=t}let b=i.lineWidth,v=i.textMatrixScale;if(0===v||0===b){let t=3&i.textRenderingMode;(1===t||2===t)&&(b=this.getSinglePixelWidth())}else b/=v;if(1!==a&&(n.scale(a,a),b/=a),n.lineWidth=b,s.isInvalidPDFjsFont){let e=[],s=0;for(let i of t)e.push(i.unicode),s+=i.width;
2n.fillText(e.join(""),0,0),i.x+=s*f*d,n.restore(),this.compose();return}let y=0,x;for(x=0;x<c;++x){let i,d,c=t[x];if("number"==typeof c){y+=p*c*r/1e3;continue}let b=!1,v=(c.isSpace?l:0)+o,A=c.fontChar,w=c.accent,_=c.width;if(u){let t=c.vmetric||g,e=-(c.vmetric?t[1]:.5*_)*f,s=t[2]*f;_=t?-t[0]:_,i=e/a,d=(y+s)/a}else i=y/a,d=0;if(s.remeasure&&_>0){let t=1e3*n.measureText(A).width/r*a;if(_<t&&this.isFontSubpixelAAEnabled){let e=_/t;b=!0,n.save(),n.scale(e,1),i/=e}else _!==t&&(i+=(_-t)/2e3*r/a)}if(this.contentVisible&&(c.isInFont||s.missingFile)){if(m&&!w)n.fillText(A,i,d);else if(this.paintChar(A,i,d,e),w){let t=i+r*w.offset.x/a,s=d-r*w.offset.y/a;this.paintChar(w.fontChar,t,s,e)}}y+=u?_*f-v*h:_*f+v*h,b&&n.restore()}u?i.y-=y:i.x+=y*d,n.restore(),this.compose()}showType3Text(t){let e,i,s,r,n=this.ctx,a=this.current,o=a.font,l=a.fontSize,h=a.fontDirection,d=o.vertical?1:-1,c=a.charSpacing,u=a.wordSpacing,p=a.textHScale*h,g=a.fontMatrix||R,f=t.length;if(3!==a.textRenderingMode&&0!==l){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),n.transform(...a.textMatrix),n.translate(a.x,a.y),n.scale(p,h),e=0;e<f;++e){if("number"==typeof(i=t[e])){r=d*i*l/1e3,this.ctx.translate(r,0),a.x+=r*p;continue}let h=(i.isSpace?u:0)+c,f=o.charProcOperatorList[i.operatorListId];if(!f){U(`Type3 character "${i.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=i,this.save(),n.scale(l,l),n.transform(...g),this.executeOperatorList(f),this.restore()),s=ta.applyTransform([i.width,0],g)[0]*l+h,n.translate(s,0),a.x+=s*p}n.restore(),this.processingType3=null}}setCharWidth(t,e){}
2setCharWidthAndBounds(t,e,i,s,r,n){this.ctx.rect(i,s,r-i,n-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){let i=t[1],s=this.baseTransform||tT(this.ctx);e=new er(t,i,this.ctx,{createCanvasGraphics:t=>new eb(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){this.ctx.strokeStyle=this.current.strokeColor=ta.makeHexColor(t,e,i)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=ta.makeHexColor(t,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=function(t){switch(t[0]){case"RadialAxial":return new et(t);case"Mesh":return new ei(t);case"Dummy":return new es}throw Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;let e=this.ctx;this.save(),e.fillStyle=this._getPattern(t).getPattern(e,this,tM(e),t8);let i=tM(e);{let{width:t,height:s}=e.canvas,[r,n,a,o]=ta.getAxialAlignedBoundingBox([0,0,t,s],i);this.ctx.fillRect(r,n,a-r,o-n)}this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){$("Should not call beginInlineImage")}beginImageData(){$("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=tT(this.ctx),e)){let t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(tT(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let e=this.ctx;t.isolated||H("TODO: Support non-isolated groups."),t.knockout&&U("Knockout groups not supported.");let i=tT(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw Error("Bounding box is required.");let s=ta.getAxialAlignedBoundingBox(t.bbox,tT(e)),r=[0,0,e.canvas.width,e.canvas.height],n=Math.floor((s=ta.intersect(s,r)||[0,0,0,0])[0]),a=Math.floor(s[1]),o=Math.max(Math.ceil(s[2])-n,1),l=Math.max(Math.ceil(s[3])-a,1);this.current.startNewPathAndClipBox([0,0,o,l]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);let d=this.cachedCanvases.getCanvas(h,o,l),c=d.context;c.translate(-n,-a),c.transform(...i),t.smask?this.smaskStack.push({canvas:d.canvas,context:c,offsetX:n,offsetY:a,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(n,a),e.save()),ed(e,c),this.ctx=c,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;let e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let t=tT(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);let i=ta.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,r){if(this.#eC(),ec(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){let s=e[2]-e[0],n=e[3]-e[1];if(r&&this.annotationCanvasMap){i=i.slice(),i[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=n;let[r,a]=ta.singularValueDecompose2dScale(tT(this.ctx)),{viewportScale:o}=this,l=Math.ceil(s*this.outputScaleX*o),h=Math.ceil(n*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(l,h);let{canvas:d,context:c}=this.annotationCanvas;this.annotationCanvasMap.set(t,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=c,this.ctx.save(),this.ctx.setTransform(r,0,0,-a,0,n*a),ec(this.ctx)}else ec(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],s,n),this.ctx.clip(),this.ctx.beginPath()}
2this.current=new eo(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#eT(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;let e=t.count;(t=this.getObject(t.data,t)).count=e;let i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=function(t){let e,i,s,{width:r,height:n}=t;if(r>1e3||n>1e3)return null;let a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),o=r+1,l=new Uint8Array(o*(n+1)),h=r+7&-8,d=new Uint8Array(h*n),c=0;for(let e of t.data){let t=128;for(;t>0;)d[c++]=e&t?0:255,t>>=1}let u=0;for(0!==d[c=0]&&(l[0]=1,++u),i=1;i<r;i++)d[c]!==d[c+1]&&(l[i]=d[c]?2:1,++u),c++;for(0!==d[c]&&(l[i]=2,++u),e=1;e<n;e++){c=e*h,s=e*o,d[c-h]!==d[c]&&(l[s]=d[c]?1:8,++u);let t=4*!!d[c]+8*!!d[c-h];for(i=1;i<r;i++)a[t=(t>>2)+4*!!d[c+1]+8*!!d[c-h+1]]&&(l[s+i]=a[t],++u),c++;if(d[c-h]!==d[c]&&(l[s+i]=d[c]?2:4,++u),u>1e3)return null}for(c=h*(n-1),s=e*o,0!==d[c]&&(l[s]=8,++u),i=1;i<r;i++)d[c]!==d[c+1]&&(l[s+i]=d[c]?4:8,++u),c++;if(0!==d[c]&&(l[s+i]=4,++u),u>1e3)return null;let p=new Int32Array([0,o,-1,0,-o,0,0,0,1]),g=new Path2D;for(e=0;u&&e<=n;e++){let t=e*o,i=t+r;for(;t<i&&!l[t];)t++;if(t===i)continue;g.moveTo(t%o,e);let s=t,n=l[t];do{let e=p[n];do t+=e;while(!l[t])let i=l[t];5!==i&&10!==i?(n=i,l[t]=0):(n=i&51*n>>4,l[t]&=n>>2|n<<2),g.lineTo(t%o,t/o|0),!l[t]&&--u}while(s!==t)--e}return d=null,l=null,function(t){t.save(),t.scale(1/r,-1/n),t.translate(0,-n),t.fill(g),t.beginPath(),t.restore()}}(t)),s.compiled))return void s.compiled(i);let r=this._createMaskCanvas(t),n=r.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(n,r.offsetX,r.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4?arguments[4]:void 0,n=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);let a=this.ctx;a.save();let o=tT(a);a.transform(e,i,s,r,0,0);let l=this._createMaskCanvas(t);a.setTransform(1,0,0,1,l.offsetX-o[4],l.offsetY-o[5]);for(let t=0,h=n.length;t<h;t+=2){let h=ta.transform(o,[e,i,s,r,n[t],n[t+1]]),[d,c]=ta.applyTransform([0,0],h);a.drawImage(l.canvas,d,c)}a.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;let e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(let r of t){let{data:t,width:n,height:a,transform:o}=r,l=this.cachedCanvases.getCanvas("maskCanvas",n,a),h=l.context;h.save(),eh(h,this.getObject(t,r)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,tM(e),t6):i,h.fillRect(0,0,n,a),h.restore(),e.save(),e.transform(...o),e.scale(1,-1),ea(e,l.canvas,0,0,n,a,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;let e=this.getObject(t);e?this.paintInlineImageXObject(e):U("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;let r=this.getObject(t);if(!r)return void U("Dependent image isn't ready yet");let n=r.width,a=r.height,o=[];for(let t=0,r=s.length;t<r;t+=2)o.push({transform:[e,0,0,i,s[t],s[t+1]],x:0,y:0,w:n,h:a});this.paintInlineImageXObjectGroup(r,o)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;let{bitmap:e,width:i,height:s}=t,r=this.cachedCanvases.getCanvas("inlineImage",i,s),n=r.context;return n.filter=this.current.transferMaps,n.drawImage(e,0,0),n.filter="none",r.canvas}paintInlineImageXObject(t){let e;if(!this.contentVisible)return;let i=t.width,s=t.height,r=this.ctx;if(this.save(),!k){let{filter:t}=r;"none"!==t&&""!==t&&(r.filter="none")}if(r.scale(1/i,-1/s),t.bitmap)e=this.applyTransferMapsToBitmap(t);else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)e=t;else{let r=this.cachedCanvases.getCanvas("inlineImage",i,s).context;el(r,t),e=this.applyTransferMapsToCanvas(r)}let n=this._scaleImage(e,tM(r));r.imageSmoothingEnabled=eu(tT(r),t.interpolate),ea(r,n.img,0,0,n.paintWidth,n.paintHeight,0,-s,i,s),this.compose(),this.restore(
2)}paintInlineImageXObjectGroup(t,e){let i;if(!this.contentVisible)return;let s=this.ctx;if(t.bitmap)i=t.bitmap;else{let e=t.width,s=t.height,r=this.cachedCanvases.getCanvas("inlineImage",e,s).context;el(r,t),i=this.applyTransferMapsToCanvas(r)}for(let t of e)s.save(),s.transform(...t.transform),s.scale(1,-1),ea(s,i,t.x,t.y,t.w,t.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){let e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);let i=this.ctx;this.pendingClip&&(e||(this.pendingClip===em?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=tT(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let t,e,{lineWidth:i}=this.current,{a:s,b:r,c:n,d:a}=this.ctx.getTransform();if(0===r&&0===n){let r=Math.abs(s),n=Math.abs(a);if(r===n)if(0===i)t=e=1/r;else{let s=r*i;t=e=s<1?1/s:1}else if(0===i)t=1/r,e=1/n;else{let s=r*i,a=n*i;t=s<1?1/s:1,e=a<1?1/a:1}}else{let o=Math.abs(s*a-r*n),l=Math.hypot(s,r),h=Math.hypot(n,a);if(0===i)t=h/o,e=l/o;else{let s=i*o;t=h>s?h/s:1,e=l>s?l/s:1}}this._cachedScaleForStroking[0]=t,this._cachedScaleForStroking[1]=e}return this._cachedScaleForStroking}rescaleAndStroke(t){let{ctx:e}=this,{lineWidth:i}=this.current,[s,r]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===r)return void e.stroke();let n=e.getLineDash();if(t&&e.save(),e.scale(s,r),n.length>0){let t=Math.max(s,r);e.setLineDash(n.map(e=>e/t)),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(let t in j)void 0!==eb.prototype[t]&&(eb.prototype[j[t]]=eb.prototype[t]);class ev{static #eM=null;static #ek="";static get workerPort(){return this.#eM}static set workerPort(t){if(!("u">typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");this.#eM=t}static get workerSrc(){return this.#ek}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");this.#ek=t}}function ey(t){switch(!(t instanceof Error||"object"==typeof t&&null!==t)&&$('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new tt(t.message);case"MissingPDFException":return new Q(t.message);case"PasswordException":return new K(t.message,t.code);case"UnexpectedResponseException":return new J(t.message,t.status);case"UnknownErrorException":return new X(t.message,t.details);default:return new X(t.message,t.toString())}}class ex{#eP=new AbortController;constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#eR.bind(this),{signal:this.#eP.signal})}#eR(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#eD(e);if(e.callback){let t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],1===e.callback)i.resolve(e.data);else if(2===e.callback)i.reject(ey(e.reason));else throw Error("Unexpected callback case");return}let i=this.actionHandler[e.action];if(!i)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let t=this.sourceName,s=e.sourceName,r=this.comObj;new Promise(function(t){t(i(e.data))}).then(function(i){r.postMessage({sourceName:t,targetName:s,callback:1,callbackId:e.callbackId,data:i})},function(i){r.postMessage({sourceName:t,targetName:s,callback:2,callbackId:e.callbackId,reason:ey(i)})});return}e.streamId?this.#eI(e):i(e.data)}on(t,e){let i=this.actionHandler;if(i[t])throw Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}
2sendWithPromise(t,e,i){let s=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[s]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(t){r.reject(t)}return r.promise}sendWithStream(t,e,i,s){let r=this.streamId++,n=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{let l=Promise.withResolvers();return this.streamControllers[r]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:n,targetName:a,action:t,streamId:r,data:e,desiredSize:i.desiredSize},s),l.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[r].pullCall=e,o.postMessage({sourceName:n,targetName:a,stream:6,streamId:r,desiredSize:t.desiredSize}),e.promise},cancel:t=>{G(t instanceof Error,"cancel must have a valid reason");let e=Promise.withResolvers();return this.streamControllers[r].cancelCall=e,this.streamControllers[r].isClosed=!0,o.postMessage({sourceName:n,targetName:a,stream:1,streamId:r,reason:ey(t)}),e.promise}},i)}#eI(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,r=this.comObj,n=this,a=this.actionHandler[t.action],o={enqueue(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;let o=this.desiredSize;this.desiredSize-=n,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:i,targetName:s,stream:4,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:3,streamId:e}),delete n.streamSinks[e])},error(t){G(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:5,streamId:e,reason:ey(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,new Promise(function(e){e(a(t.data,o))}).then(function(){r.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,success:!0})},function(t){r.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,reason:ey(t)})})}#eD(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,r=this.comObj,n=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case 8:t.success?n.startCall.resolve():n.startCall.reject(ey(t.reason));break;case 7:t.success?n.pullCall.resolve():n.pullCall.reject(ey(t.reason));break;case 6:if(!a){r.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,new Promise(function(t){t(a.onPull?.())}).then(function(){r.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0})},function(t){r.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,reason:ey(t)})});break;case 4:if(G(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case 3:if(G(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),this.#eL(n,e);break;case 5:G(n,"error should have stream controller"),n.controller.error(ey(t.reason)),this.#eL(n,e);break;case 2:t.success?n.cancelCall.resolve():n.cancelCall.reject(ey(t.reason)),this.#eL(n,e);break;case 1:if(!a)break;new Promise(function(e){e(a.onCancel?.(ey(t.reason)))}).then(function(){r.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,success:!0})},function(t){r.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,reason:ey(t)})}),a.sinkCapability.reject(ey(t.reason)),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async #eL(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#eP?.abort(),this.#eP=null}}class eA{#eF;#eN;constructor({parsedData:t,rawData:e}){this.#eF=t,this.#eN=e}getRaw(){return this.#eN}get(t){return this.#eF.get(t)??null}getAll(){return ts(this.#eF)}has(t){return this.#eF.has(t)}}let ew=Symbol("INTERNAL");class e_{#eO=!1;#ej=!1;#eB=!1;#ez=!0;constructor(t,{name:e,intent:i,usage:s,rbGroups:r}){this.#eO=!!(2&t),this.#ej=!!(4&t),this.name=e,this.intent=i,this.usage=s,this.rbGroups=r}get visible(){if(this.#eB)return this.#ez;if(!this.#ez)return!1;let{print:t,view:e}=this.usage;return this.#eO?e?.viewState!=="OFF":!this.#ej||t?.printState!=="OFF"}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==ew&&$("Internal method `_setVisible` called."),this.#eB=i,this.#ez=e}}class eE{#eH=null;#eU=new Map;#e$=null;#eG=null;constructor(t,e=2){if(this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(const i of(this.name=t.name,this.creator=t.creator,this.#eG=t.order,t.groups))this.#eU.set(i.id,new e_(e,i));if("OFF"===t.baseState)for(const t of this.#eU.values())t._setVisible(ew,!1);for(const e of t.on)this.#eU.get(e)._setVisible(ew,!0);for(const e of t.off)this.#eU.get(e)._setVisible(ew,!1);this.#e$=this.getHash()}#eV(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let s=1;s<e;s++){let e,r=t[s];if(Array.isArray(r))e=this.#eV(r);else{if(!this.#eU.has(r))return U(`Optional content group not found: ${r}`),!0;e=this.#eU.get(r).visible}switch(i){case"And":if(!e)return!1;break;case"Or":if(e)return!0;break;case"Not":return!e;default:return!0}}return"And"===i}isVisible(t){if(0===this.#eU.size)return!0;
2if(!t)return H("Optional content group not defined."),!0;if("OCG"===t.type)return this.#eU.has(t.id)?this.#eU.get(t.id).visible:(U(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#eV(t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!this.#eU.has(e)){U(`Optional content group not found: ${e}`);break}if(!this.#eU.get(e).visible)return!1}return!0}else if("AnyOff"===t.policy){for(let e of t.ids){if(!this.#eU.has(e))return U(`Optional content group not found: ${e}`),!0;if(!this.#eU.get(e).visible)return!0}return!1}else if("AllOff"===t.policy){for(let e of t.ids){if(!this.#eU.has(e)){U(`Optional content group not found: ${e}`);break}if(this.#eU.get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!this.#eU.has(e))return U(`Optional content group not found: ${e}`),!0;if(this.#eU.get(e).visible)return!0}return!1}return U(`Unknown optional content policy ${t.policy}.`),!0}return U(`Unknown group type ${t.type}.`),!0}setVisibility(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=this.#eU.get(t);if(!s)return void U(`Optional content group not found: ${t}`);if(i&&e&&s.rbGroups.length)for(let e of s.rbGroups)for(let i of e)i!==t&&this.#eU.get(i)?._setVisible(ew,!1,!0);s._setVisible(ew,!!e,!0),this.#eH=null}setOCGState(t){let e,{state:i,preserveRB:s}=t;for(let t of i){switch(t){case"ON":case"OFF":case"Toggle":e=t;continue}let i=this.#eU.get(t);if(i)switch(e){case"ON":this.setVisibility(t,!0,s);break;case"OFF":this.setVisibility(t,!1,s);break;case"Toggle":this.setVisibility(t,!i.visible,s)}}this.#eH=null}get hasInitialVisibility(){return null===this.#e$||this.getHash()===this.#e$}getOrder(){return this.#eU.size?this.#eG?this.#eG.slice():[...this.#eU.keys()]:null}getGroups(){return this.#eU.size>0?ts(this.#eU):null}getGroup(t){return this.#eU.get(t)||null}getHash(){if(null!==this.#eH)return this.#eH;let t=new t$;for(let[e,i]of this.#eU)t.update(`${e}:${i.visible}`);return this.#eH=t.hexdigest()}}class eS{constructor(t,{disableRange:e=!1,disableStream:i=!1}){G(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:r,progressiveDone:n,contentDispositionFilename:a}=t;if(this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=a,r?.length>0){const t=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData(t){let{begin:e,chunk:i}=t,s=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;void 0===e?this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s):G(this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(s),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){void 0===t.total?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){let e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){G(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let t=this._queuedChunks;return this._queuedChunks=null,new eC(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new eT(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeReaders.slice(0)))e.cancel(t);this._pdfDataRangeTransport.abort()}}class eC{constructor(t,e,i=!1,s=null){for(const r of(this._stream=t,this._done=i||!1,this._filename=tb(s)?s:null,this._queuedChunks=e||[],this._loaded=0,this._queuedChunks))this._loaded+=r.byteLength;
2this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class eT{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{for(let e of(this._requests.shift().resolve({value:t,done:!1}),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function eM(t,e){let i=new Headers;if(!t||!e||"object"!=typeof e)return i;for(let t in e){let s=e[t];void 0!==s&&i.append(t,s)}return i}function ek(t){let{responseHeaders:e,isHttp:i,rangeChunkSize:s,disableRange:r}=t,n={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e.get("Content-Length"),10);return Number.isInteger(a)&&(n.suggestedLength=a,a<=2*s||r||!i||"bytes"!==e.get("Accept-Ranges")||"identity"!==(e.get("Content-Encoding")||"identity")||(n.allowRangeRequests=!0)),n}function eP(t){let e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=s("filename\\*","i").exec(t);if(i){let t=a(i=i[1]);return n(t=l(t=o(t=unescape(t))))}if(i=function(t){let e,i=[],r=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=r.exec(t));){let[,t,s,r]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[s,r]}let n=[];for(let t=0;t<i.length&&t in i;++t){let[e,s]=i[t];s=a(s),e&&(s=unescape(s),0===t&&(s=o(s))),n.push(s)}return n.join("")}(t))return n(l(i));if(i=s("filename","i").exec(t)){let t=a(i=i[1]);return n(t=l(t))}function s(t,e){return RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function r(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{let s=new TextDecoder(t,{fatal:!0}),r=ti(i);i=s.decode(r),e=!1}catch{}}return i}function n(t){return e&&/[\x80-\xff]/.test(t)&&(t=r("utf-8",t),e&&(t=r("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){let e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){let i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){let e=t.indexOf("'");return -1===e?t:r(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,s){if("q"===i||"Q"===i)return r(e,s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{s=atob(s)}catch{}return r(e,s)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(tb(t))return t}return null}function eR(t,e){return 404===t||0===t&&e.startsWith("file:")?new Q('Missing PDF "'+e+'".'):new J(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)}function eD(t){return 200===t||206===t}function eI(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function eL(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(U(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class eF{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=eM(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return G(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new eN(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new eO(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class eN{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const i=new Headers(t.headers),s=e.url;fetch(s,eI(i,this._withCredentials,this._abortController)).then(e=>{if(!eD(e.status))throw eR(e.status,s);this._reader=e.body.getReader(),this._headersCapability.resolve();let i=e.headers,{allowRangeRequests:r,suggestedLength:n}=ek({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=n||this._contentLength,this._filename=eP(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new tt("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:eL(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class eO{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const r=new Headers(t.headers);r.append("Range",`bytes=${e}-${i-1}`);const n=s.url;fetch(n,eI(r,this._withCredentials,this._abortController)).then(t=>{if(!eD(t.status))throw eR(t.status,n);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:eL(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class ej{constructor({url:t,httpHeaders:e,withCredentials:i}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=eM(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){let s={begin:t,end:e};for(let t in i)s[t]=i[t];return this.request(s)}requestFull(t){return this.request(t)}request(t){let e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};for(let[t,i]of(e.open("GET",this.url),e.withCredentials=this.withCredentials,this.headers))e.setRequestHeader(t,i);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){let i=this.pendingRequests[t];i&&i.onProgress?.(e)}onStateChange(t,e){let i,s=this.pendingRequests[t];if(!s)return;let r=s.xhr;if(r.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),4!==r.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===r.status&&this.isHttp)return void s.onError?.(r.status);let n=r.status||200;if((200!==n||206!==s.expectedStatus)&&n!==s.expectedStatus)return void s.onError?.(r.status);let a="string"!=typeof(i=r.response)?i:ti(i).buffer;if(206===n){let t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);s.onDone({begin:parseInt(e[1],10),chunk:a})}else a?s.onDone({begin:0,chunk:a}):s.onError?.(r.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
2abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class eB{constructor(t){this._source=t,this._manager=new ej(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){let e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return G(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new ez(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let i=new eH(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class ez{constructor(t,e){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){let t=this._fullRequestId,e=new Headers(this._manager.getRequestXhr(t).getAllResponseHeaders().trim().split(/[\r\n]+/).map(t=>{let[e,...i]=t.split(": ");return[e,i.join(": ")]})),{allowRangeRequests:i,suggestedLength:s}=ek({responseHeaders:e,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=eP(e),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){for(let e of(this._storedError=eR(t,this._url),this._headersCapability.reject(this._storedError),this._requests))e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let e of(this._done=!0,this._headersCapability.reject(t),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class eH{constructor(t,e,i){this._manager=t;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){let e=t.chunk;for(let t of(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){for(let e of(this._storedError=eR(t,this._url),this._requests))e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest
2(this._requestId),this._close()}}let eU=/^[a-z][a-z0-9\-+.]+:/i;function e$(t,e,i){return"http:"===t.protocol?t5.get("http").request(t,{headers:e},i):t5.get("https").request(t,{headers:e},i)}class eG{constructor(t){this.source=t,this.url=function(t){return new URL(eU.test(t)?t:t5.get("url").pathToFileURL(t))}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=eM(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return G(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new eX(this):new eq(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=this.isFsUrl?new eY(this,t,e):new eK(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class eV{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new tt("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class eW{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class eq extends eV{constructor(t){super(t);const e=Object.fromEntries(t.headers),i=e=>{if(404===e.statusCode){let t=new Q(`Missing PDF "${this._url}".`);this._storedError=t,this._headersCapability.reject(t);return}this._headersCapability.resolve(),this._setReadableStream(e);let i=new Headers(this._readableStream.headers),{allowRangeRequests:s,suggestedLength:r}=ek({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=r||this._contentLength,this._filename=eP(i)};this._request=e$(this._url,e,i),this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class eK extends eW{constructor(t,e,i){super(t);const s=Object.fromEntries(t.headers);s.Range=`bytes=${e}-${i-1}`;const r=t=>{if(404===t.statusCode){let t=new Q(`Missing PDF "${this._url}".`);this._storedError=t;return}this._setReadableStream(t)};this._request=e$(this._url,s,r),this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class eX extends eV{constructor(t){super(t);const e=t5.get("fs");e.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=new Q(`Missing PDF "${this._url}".`)),this._storedError=t,this._headersCapability.reject(t)})}}class eY extends eW{constructor(t,e,i){super(t);const s=t5.get("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}}class eQ{#eW=Promise.withResolvers();#tu=null;#eq=!1;#eK=!!globalThis.FontInspector?.enabled;#eX=null;#eY=null;#eQ=0;#eJ=0;#eZ=null;#e0=null;#e1=0;#e2=0;#e5=Object.create(null);#e3=[];#e6=null;#e4=[];#e8=new WeakMap;#e7=null;static #e9=new Map;static #it=new Map;static #ie=new WeakMap;static #ii=null;static #is=new Set;constructor({textContentSource:t,container:e,viewport:i}){if(t instanceof ReadableStream)this.#e6=t;else if("object"==typeof t)this.#e6=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error('No "textContentSource" parameter specified.');this.#tu=this.#e0=e,this.#e2=i.scale*(globalThis.devicePixelRatio||1),this.#e1=i.rotation,this.#eY={div:null,properties:null,ctx:null};const{pageWidth:s,pageHeight:r,pageX:n,pageY:a}=i.rawDims;this.#e7=[1,0,0,-1,-n,a+r],this.#eJ=s,this.#eQ=r,eQ.#ir(),tk(e,i),this.#eW.promise.finally(()=>{eQ.#is.delete(this),this.#eY=null,this.#e5=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=tr.platform;return W(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){let t=()=>{this.#eZ.read().then(e=>{let{value:i,done:s}=e;s?this.#eW.resolve():(this.#eX??=i.lang,Object.assign(this.#e5,i.styles),this.#ia(i.items),t())},this.#eW.reject)};return this.#eZ=this.#e6.getReader(),eQ.#is.add(this),t(),this.#eW.promise}update(t){let{viewport:e,onBefore:i=null}=t,s=e.scale*(globalThis.devicePixelRatio||1),r=e.rotation;if(r!==this.#e1&&(i?.(),this.#e1=r,tk(this.#e0,{rotation:r})),s!==this.#e2){i?.(),this.#e2=s;let t={div:null,properties:null,ctx:eQ.#io(this.#eX)};for(let e of this.#e4)t.properties=this.#e8.get(e),t.div=e,this.#il(t)}}cancel(){let t=new tt("TextLayer task cancelled.");this.#eZ?.cancel(t).catch(()=>{}),this.#eZ=null,this.#eW.reject(t)}get textDivs(){return this.#e4}get textContentItemsStr(){return this.#e3}#ia(t){if(this.#eq)return;this.#eY.ctx??=eQ.#io(this.#eX);let e=this.#e4,i=this.#e3;for(let s of t){if(e.length>1e5){U("Ignoring additional textDivs for performance reasons."),this.#eq=!0;return}if(void 0===s.str){if("beginMarkedContentProps"===s.type||"beginMarkedContent"===s.type){let t=this.#tu;this.#tu=document.createElement("span"),this.#tu.classList.add("markedContent"),null!==s.id&&this.#tu.setAttribute("id",`${s.id}`),t.append(this.#tu)}else"endMarkedContent"===s.type&&(this.#tu=this.#tu.parentNode);continue}i.push(s.str),this.#ih(s)}}#ih(t){let e,i,s=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#e4.push(s);let n=ta.transform(this.#e7,t.transform),a=Math.atan2(n[1],n[0]),o=this.#e5[t.fontName];o.vertical&&(a+=Math.PI/2);let l=this.#eK&&o.fontSubstitution||o.fontFamily;l=eQ.fontFamilyMap.get(l)||l;let h=Math.hypot(n[2],n[3]),d=h*eQ.#id(l,this.#eX);0===a?(e=n[4],i=n[5]-d):(e=n[4]+d*Math.sin(a),i=n[5]-d*Math.cos(a));let c="calc(var(--scale-factor)*",u=s.style;this.#tu===this.#e0?(u.left=`${(100*e/this.#eJ).toFixed(2)}%`,u.top=`${(100*i/this.#eQ).toFixed(2)}%`):(u.left=`${c}${e.toFixed(2)}px)`,u.top=`${c}${i.toFixed(2)}px)`),u.fontSize=`${c}${(eQ.#ii*h).toFixed(2)}px)`,u.fontFamily=l,r.fontSize=h,s.setAttribute("role","presentation"),s.textContent=t.str,s.dir=t.dir,this.#eK&&(s.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),0!==a&&(r.angle=180/Math.PI*a);let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(p=!0)}if(p&&(r.canvasWidth=o.vertical?t.height:t.width),this.#e8.set(s,r),this.#eY.div=s,this.#eY.properties=r,this.#il(this.#eY),r.hasText&&this.#tu.append(s),r.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),this.#tu.append(t)}}#il(t){let{div:e,properties:i,ctx:s}=t,{style:r}=e,n="";if(eQ.#ii>1&&(n=`scale(${1/eQ.#ii})`),0!==i.canvasWidth&&i.hasText){let{fontFamily:t}=r,{canvasWidth:a,fontSize:o}=i;eQ.#ic(s,o*this.#e2,t);let{width:l}=s.measureText(e.textContent);l>0&&(n=`scaleX(${a*this.#e2/l}) ${n}`)}0!==i.angle&&(n=`rotate(${i.angle}deg) ${n}`),n.length>0&&(r.transform=n)}static cleanup(){if(!(this.#is.size>0)){for(let{canvas:t}
2of(this.#e9.clear(),this.#it.values()))t.remove();this.#it.clear()}}static #io(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.#it.get(t||="");if(!e){let i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#it.set(t,e),this.#ie.set(e,{size:0,family:""})}return e}static #ic(t,e,i){let s=this.#ie.get(t);(e!==s.size||i!==s.family)&&(t.font=`${e}px ${i}`,s.size=e,s.family=i)}static #ir(){if(null!==this.#ii)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),this.#ii=t.getBoundingClientRect().height,t.remove()}static #id(t,e){let i=this.#e9.get(t);if(i)return i;let s=this.#io(e);s.canvas.width=s.canvas.height=30,this.#ic(s,30,t);let r=s.measureText(""),n=r.fontBoundingBoxAscent,a=Math.abs(r.fontBoundingBoxDescent);if(n){let e=n/(n+a);return this.#e9.set(t,e),s.canvas.width=s.canvas.height=0,e}s.strokeStyle="red",s.clearRect(0,0,30,30),s.strokeText("g",0,0);let o=s.getImageData(0,0,30,30).data;a=0;for(let t=o.length-1-3;t>=0;t-=4)if(o[t]>0){a=Math.ceil(t/4/30);break}s.clearRect(0,0,30,30),s.strokeText("A",0,30),o=s.getImageData(0,0,30,30).data,n=0;for(let t=0,e=o.length;t<e;t+=4)if(o[t]>0){n=30-Math.floor(t/4/30);break}s.canvas.width=s.canvas.height=0;let l=n?n/(n+a):.8;return this.#e9.set(t,l),l}}class eJ{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};return!function t(i){if(!i)return;let s=null,r=i.name;if("#text"===r)s=i.value;else{if(!eJ.shouldBuildText(r))return;i?.attributes?.textContent?s=i.attributes.textContent:i.value&&(s=i.value)}if(null!==s&&e.push({str:s}),i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return"textarea"!==t&&"input"!==t&&"option"!==t&&"select"!==t}}let eZ=k?class extends tX{_createCanvas(t,e){return t5.get("canvas").createCanvas(t,e)}}:class extends tX{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},e0=k?class extends tY{async _fetch(t){return t3(t)}}:tQ,e1=k?class extends tJ{}:class extends tJ{#iu;#ip;#ig;#im;#ib;#iv;#y=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#im=t,this.#ib=e}get #A(){return this.#ip||=new Map}get #iy(){return this.#iv||=new Map}get #ix(){if(!this.#ig){let t=this.#ib.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let i=this.#ib.createElementNS(tc,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#ig=this.#ib.createElementNS(tc,"defs"),t.append(i),i.append(this.#ig),this.#ib.body.append(t)}return this.#ig}#iA(t){if(1===t.length){let e=t[0],i=Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;let s=i.join(",");return[s,s,s]}let[e,i,s]=t,r=Array(256),n=Array(256),a=Array(256);for(let t=0;t<256;t++)r[t]=e[t]/255,n[t]=i[t]/255,a[t]=s[t]/255;return[r.join(","),n.join(","),a.join(",")]}#iw(t){if(void 0===this.#iu){this.#iu="";let t=this.#ib.URL;t!==this.#ib.baseURI&&(tm(t)?U('#createUrl: ignore "data:"-URL for performance reasons.'):this.#iu=t.split("#",1)[0])}return`url(${this.#iu}#${t})`}addFilter(t){if(!t)return"none";let e=this.#A.get(t);if(e)return e;let[i,s,r]=this.#iA(t),n=1===t.length?i:`${i}${s}${r}`;if(e=this.#A.get(n))return this.#A.set(t,e),e;let a=`g_${this.#im}_transfer_map_${this.#y++}`,o=this.#iw(a);this.#A.set(t,o),this.#A.set(n,o);let l=this.#i_(a);return this.#iE(i,s,r,l),o}addHCMFilter(t,e){let i=`${t}-${e}`,s="base",r=this.#iy.get(s);if(r?.key===i||(r?(r.filter?.remove(),r.key=i,r.url="none",r.filter=null):(r={key:i,url:"none",filter:null},this.#iy.set(s,r)),!t||!e))return r.url;let n=this.#iS(t);t=ta.makeHexColor(...n);let a=this.#iS(e);if(e=ta.makeHexColor(...a),this.#ix.style.color="","#000000"===t&&"#ffffff"===e||t===e)return r.url;let o=Array(256);for(let t=0;t<=255;t++){let e=t/255;o[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}let l=o.join(","),h=`g_${this.#im}_hcm_filter`,d=r.filter=this.#i_(h);this.#iE(l,l,l,d),this.#iC(d);let c=(t,e)=>{let i=n[t]/255,s=a[t]/255,r=Array(e+1);for(let t=0;t<=e;t++)r[t]=i+t/e*(s-i);return r.join(",")};return this.#iE(c(0,5),c(1,5),c(2,5),d),r.url=this.#iw(h),r.url}addAlphaFilter(t){let e=this.#A.get(t);if(e)return e;let[i]=this.#iA([t]),s=`alpha_${i}`;if(e=this.#A.get(s))return this.#A.set(t,e),e;let r=`g_${this.#im}_alpha_map_${this.#y++}`,n=this.#iw(r);this.#A.set(t,n),this.#A.set(s,n);let a=this.#i_(r);return this.#iT(i,a),n}addLuminosityFilter(t){let e,i,s=this.#A.get(t||"luminosity");if(s)return s;if(t?([e]=this.#iA([t]),i=`luminosity_${e}`):i="luminosity",s=this.#A.get(i))return this.#A.set(t,s),s;let r=`g_${this.#im}_luminosity_map_${this.#y++}`,n=this.#iw(r);this.#A.set(t,n),this.#A.set(i,n);let a=this.#i_(r);return this.#iM(a),t&&this.#iT(e,a),n}addHighlightHCMFilter(t,e,i,s,r){let n=`${e}-${i}-${s}-${r}`,a=this.#iy.get(t);if(a?.key===n||(a?(a.filter?.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},this.#iy.set(t,a)),!e||!i))return a.url;let[o,l]=[e,i].map(this.#iS.bind(this)),h=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[c,u]=[s,r].map(this.#iS.bind(this));d<h&&([h,d,c,u]=[d,h,u,c]),this.#ix.style.color="";let p=(t,e,i)=>{let s=Array(256),r=(d-h)/i,n=t/255,a=(e-t)/(255*i),o=0;for(let t=0;t<=i;t++){let e=Math.round(h+t*r),i=n+t*a;for(let t=o;t<=e;t++)s[t]=i;o=e+1}for(let t=o;t<256;t++)s[t]=s[o-1];return s.join(",")},g=`g_${this.#im}_hcm_${t}_filter`,f=a.filter=this.#i_(g);return this.#iC(f),this.#iE(p(c[0],u[0],5),p(c[1],u[1],5),p(c[2],u[2],5),f),a.url=this.#iw(g),a.url}destroy(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&0!==this.#iy.size||(this.#ig&&(this.#ig.parentNode.parentNode.remove(),this.#ig=null),this.#ip&&(this.#ip.clear(),this.#ip=null),this.#y=0)}#iM(t){let e=this.#ib.createElementNS(tc,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#iC(t){let e=this.#ib.createElementNS(tc,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}#i_(t){let e=this.#ib.createElementNS(tc,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#ix.append(e),e}#ik(t,e,i){let s=this.#ib.createElementNS(tc,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}#iE(t,e,i,s){let r=this.#ib.createElementNS(tc,"feComponentTransfer");
2s.append(r),this.#ik(r,"feFuncR",t),this.#ik(r,"feFuncG",e),this.#ik(r,"feFuncB",i)}#iT(t,e){let i=this.#ib.createElementNS(tc,"feComponentTransfer");e.append(i),this.#ik(i,"feFuncA",t)}#iS(t){return this.#ix.style.color=t,tC(getComputedStyle(this.#ix).getPropertyValue("color"))}},e2=k?class extends tZ{async _fetch(t){return t3(t)}}:t0;function e5(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e=new e6,{docId:i}=e,s=t.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(k&&"string"==typeof t)return t}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,r=t.data?function(t){if(k&&void 0!==C.Buffer&&t instanceof C.Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return ti(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,n=t.httpHeaders||null,a=!0===t.withCredentials,o=t.password??null,l=t.range instanceof e4?t.range:null,h=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536,d=t.worker instanceof it?t.worker:null,c=t.verbosity,u="string"!=typeof t.docBaseUrl||tm(t.docBaseUrl)?null:t.docBaseUrl,p="string"==typeof t.cMapUrl?t.cMapUrl:null,g=!1!==t.cMapPacked,f=t.CMapReaderFactory||e0,m="string"==typeof t.standardFontDataUrl?t.standardFontDataUrl:null,b=t.StandardFontDataFactory||e2,v=!0!==t.stopAtErrors,y=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,x=!1!==t.isEvalSupported,A="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!k,w="boolean"==typeof t.isChrome?t.isChrome:!tr.platform.isFirefox&&!!window?.chrome,_=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,E="boolean"==typeof t.disableFontFace?t.disableFontFace:k,S=!0===t.fontExtraProperties,T=!0===t.enableXfa,M=t.ownerDocument||globalThis.document,P=!0===t.disableRange,R=!0===t.disableStream,D=!0===t.disableAutoFetch,I=!0===t.pdfBug,L=t.CanvasFactory||eZ,F=t.FilterFactory||e1,N=!0===t.enableHWA,O=l?l.length:t.length??NaN,j="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!k&&!E,B="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:f===tQ&&b===t0&&p&&m&&tA(p,document.baseURI)&&tA(m,document.baseURI);t.canvasFactory&&t_("`canvasFactory`-instance option, please use `CanvasFactory` instead."),t.filterFactory&&t_("`filterFactory`-instance option, please use `FilterFactory` instead."),Number.isInteger(c)&&(z=c);let H={canvasFactory:new L({ownerDocument:M,enableHWA:N}),filterFactory:new F({docId:i,ownerDocument:M}),cMapReaderFactory:B?null:new f({baseUrl:p,isCompressed:g}),standardFontDataFactory:B?null:new b({baseUrl:m})};if(!d){let t={verbosity:c,port:ev.workerPort};e._worker=d=t.port?it.fromPort(t):new it(t)}let U={docId:i,apiVersion:"4.8.69",data:r,password:o,disableAutoFetch:D,rangeChunkSize:h,length:O,docBaseUrl:u,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:E,ignoreErrors:v,isEvalSupported:x,isOffscreenCanvasSupported:A,isChrome:w,canvasMaxAreaInBytes:_,fontExtraProperties:S,useSystemFonts:j,cMapUrl:B?p:null,standardFontDataUrl:B?m:null}},$={disableFontFace:E,fontExtraProperties:S,ownerDocument:M,pdfBug:I,styleElement:null,loadingParams:{disableAutoFetch:D,enableXfa:T}};return d.promise.then(function(){let t;if(e.destroyed)throw Error("Loading aborted");if(d.destroyed)throw Error("Worker was destroyed");let o=d.messageHandler.sendWithPromise("GetDocRequest",U,r?[r.buffer]:null);if(l)t=new eS(l,{disableRange:P,disableStream:R});else if(!r){if(!s)throw Error("getDocument - no `url` parameter provided.");t=new(k?"u">typeof fetch&&"u">typeof Response&&"body"in Response.prototype&&tA(s)?eF:eG:tA(s)?eF:eB)({url:s,length:O,httpHeaders:n,withCredentials:a,rangeChunkSize:h,disableRange:P,disableStream:R})}return o.then(s=>{if(e.destroyed)throw Error("Loading aborted");if(d.destroyed)throw Error("Worker was destroyed");let r=new ex(i,s,d.port),n=new ie(r,e,t,$,H);e._transport=n,r.send("Ready",null)})}).catch(e._capability.reject),e}function e3(t){return"object"==typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0}class e6{static #im=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${e6.#im++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}class e4{constructor(t,e,i=!1,s=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(let i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(let i of this._progressListeners)i(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(let e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){$("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class e8{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return W(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:e}
2=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class e7{#iP=null;#iR=!1;constructor(t,e,i,s=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new tx:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new is,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new tg({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:r})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return W(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render(t){let{canvasContext:e,viewport:i,intent:s="display",annotationMode:r=D.ENABLE,transform:n=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:c=!1}=t;this._stats?.time("Overall");let u=this._transport.getRenderingIntent(s,r,d,c),{renderingIntent:p,cacheKey:g}=u;this.#iR=!1,this.#iD(),o||=this._transport.getOptionalContentConfig(p);let f=this._intentStates.get(g);f||(f=Object.create(null),this._intentStates.set(g,f)),f.streamReaderCancelTimeout&&(clearTimeout(f.streamReaderCancelTimeout),f.streamReaderCancelTimeout=null);let m=!!(4&p);f.displayReadyCapability||(f.displayReadyCapability=Promise.withResolvers(),f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(u));let b=t=>{f.renderTasks.delete(v),(this._maybeCleanupAfterRender||m)&&(this.#iR=!0),this.#iI(!m),t?(v.capability.reject(t),this._abortOperatorList({intentState:f,reason:t instanceof Error?t:Error(t)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new ia({callback:b,params:{canvasContext:e,viewport:i,transform:n,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:h});(f.renderTasks||=new Set).add(v);let y=v.task;return Promise.all([f.displayReadyCapability.promise,o]).then(t=>{let[e,i]=t;if(this.destroyed)return void b();if(this._stats?.time("Rendering"),!(i.renderingIntent&p))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:e,optionalContentConfig:i}),v.operatorListChanged()}).catch(b),y}getOperatorList(){let t,{intent:e="display",annotationMode:i=D.ENABLE,printAnnotationStorage:s=null,isEditing:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
2,n=this._transport.getRenderingIntent(e,i,s,r,!0),a=this._intentStates.get(n.cacheKey);return a||(a=Object.create(null),this._intentStates.set(n.cacheKey,a)),a.opListReadCapability||((t=Object.create(null)).operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(t))},a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(t),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),a.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(t=>eJ.textContent(t));let e=this.streamTextContent(t);return new Promise(function(t,i){let s=e.getReader(),r={items:[],styles:Object.create(null),lang:null};!function e(){s.read().then(function(i){let{value:s,done:n}=i;n?t(r):(r.lang??=s.lang,Object.assign(r.styles,s.styles),r.items.push(...s.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#iR=!1,this.#iD(),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#iR=!0;let e=this.#iI(!1);return t&&e&&(this._stats&&=new tx),e}#iI(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.#iD(),!this.#iR||this.destroyed)return!1;if(t)return this.#iP=setTimeout(()=>{this.#iP=null,this.#iI(!1)},5e3),!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#iR=!1,!0}#iD(){this.#iP&&(clearTimeout(this.#iP),this.#iP=null)}_startRenderPage(t,e){let i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);for(let i of(e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots,e.renderTasks))i.operatorListChanged();t.lastChunk&&this.#iI(!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:s,modifiedIds:r}=t,{map:n,transfer:a}=s,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n,modifiedIds:r},a).getReader(),l=this._intentStates.get(i);l.streamReader=o;let h=()=>{o.read().then(t=>{let{value:e,done:i}=t;if(i){l.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(e,l),h())},t=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){for(let t of(l.operatorList.lastChunk=!0,l.renderTasks))t.operatorListChanged();this.#iI(!0)}if(l.displayReadyCapability)l.displayReadyCapability.reject(t);else if(l.opListReadCapability)l.opListReadCapability.reject(t);else throw t}})};h()}_abortOperatorList(t){let{intentState:e,reason:i,force:s=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(i instanceof tf){let t=100;i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},t);return}}if(e.streamReader.cancel(new tt(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}class e9{#iL=new Map;#iF=Promise.resolve();postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};this.#iF.then(()=>{for(let[t]of this.#iL)t.call(this,i)})}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=null;if(i?.signal instanceof AbortSignal){let{signal:r}=i;if(r.aborted)return void U("LoopbackPort - cannot use an `aborted` signal.");let n=()=>this.removeEventListener(t,e);s=()=>r.removeEventListener("abort",n),r.addEventListener("abort",n)}this.#iL.set(e,s)}removeEventListener(t,e){let i=this.#iL.get(e);i?.(),this.#iL.delete(e)}terminate(){for(let[,t]of this.#iL)t?.();this.#iL.clear()}}class it{static #iN=0;static #iO=!1;static #ij;static #iB=void(k&&(this.#iO=!0,ev.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let i;try{if(!(i=new URL(t)).origin||"null"===i.origin)return!1}catch{return!1}let s=new URL(e,i);return i.origin===s.origin},this._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))});constructor({name:t=null,port:e=null,verbosity:i=z}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(it.#ij?.has(e))throw Error("Cannot use more than one PDFWorker per port.");(it.#ij||=new WeakMap).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return k?Promise.all([t5.promise,this._readyCapability.promise]):this._readyCapability.promise}#iz(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new ex("main","worker",t),this._messageHandler.on("ready",function(){}),this.#iz()}_initialize(){if(it.#iO||it.#iH)return void this._setupFakeWorker();let{workerSrc:t}=it;try{it._isSameOrigin(window.location.href,t)||(t=it._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new ex("main","worker",e),s=()=>{r.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},r=new AbortController;e.addEventListener("error",()=>{this._webWorker||s()},{signal:r.signal}),i.on("test",t=>{(r.abort(),this.destroyed||!t)?s():(this._messageHandler=i,this._port=e,this._webWorker=e,this.#iz())}),i.on("ready",t=>{if(r.abort(),this.destroyed)return void s();try{n()}catch{this._setupFakeWorker()}});let n=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};n();return}catch{H("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){it.#iO||(U("Setting up fake worker."),it.#iO=!0),it._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this._readyCapability.reject(Error("Worker was destroyed"));let e=new e9;this._port=e;let i=`fake${it.#iN++}`,s=new ex(i+"_worker",i,e);t.setup(s,e),this._messageHandler=new ex(i,i+"_worker",e),this.#iz()}).catch(t=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),it.#ij?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw Error("PDFWorker.fromPort - invalid method signature.");let e=this.#ij?.get(t.port);
2if(e){if(e._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new it(t)}static get workerSrc(){if(ev.workerSrc)return ev.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get #iH(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return W(this,"_setupFakeWorkerGlobal",(async()=>this.#iH?this.#iH:(await import(this.workerSrc)).WorkerMessageHandler)())}}class ie{#iU=new Map;#i$=new Map;#iG=new Map;#iV=new Map;#iW=null;constructor(t,e,i,s,r){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new is,this.fontLoader=new tq({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#iq(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.#iU.get(t);if(i)return i;let s=this.messageHandler.sendWithPromise(t,e);return this.#iU.set(t,s),s}get annotationStorage(){return W(this,"annotationStorage",new tV)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=2,a=tG;switch(t){case"any":n=1;break;case"display":break;case"print":n=4;break;default:U(`getRenderingIntent - invalid intent: ${t}`)}let o=4&n&&i instanceof tW?i:this.annotationStorage;switch(e){case D.DISABLE:n+=64;break;case D.ENABLE:break;case D.ENABLE_FORMS:n+=16;break;case D.ENABLE_STORAGE:n+=32,a=o.serializable;break;default:U(`getRenderingIntent - invalid annotationMode: ${e}`)}s&&(n+=128),r&&(n+=256);let{ids:l,hash:h}=o.modifiedIds,d=[n,a.hash,h];return{renderingIntent:n,cacheKey:d.join("_"),annotationStorageSerializable:a,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#iW?.reject(Error("Worker was destroyed during onPassword callback"));let t=[];for(let e of this.#i$.values())t.push(e._destroy());this.#i$.clear(),this.#iG.clear(),this.#iV.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#iU.clear(),this.filterFactory.destroy(),eQ.cleanup(),this._networkStream?.cancelAllRequests(new tt("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{G(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function(t){let{value:i,done:s}=t;s?e.close():(G(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this._fullReader.headersReady;let{isStreamingSupported:i,isRangeSupported:s,contentLength:r}=this._fullReader;return i&&s||(this._lastProgress&&e.onProgress?.(this._lastProgress),this._fullReader.onProgress=t=>{e.onProgress?.({loaded:t.loaded,total:t.total})}),{isStreamingSupported:i,isRangeSupported:s,contentLength:r}}),t.on("GetRangeReader",(t,e)=>{G(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function(t){let{value:i,done:s}=t;s?e.close():(G(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new e8(i,this))}),t.on("DocException",function(t){let i;switch(t.name){case"PasswordException":i=new K(t.message,t.code);break;case"InvalidPDFException":i=new Y(t.message);break;case"MissingPDFException":i=new Q(t.message);break;case"UnexpectedResponseException":i=new J(t.message,t.status);break;case"UnknownErrorException":i=new X(t.message,t.details);break;default:$("DocException - expected a valid Error.")}e._capability.reject(i)}
2),t.on("PasswordRequest",t=>{if(this.#iW=Promise.withResolvers(),e.onPassword){let i=t=>{t instanceof Error?this.#iW.reject(t):this.#iW.resolve({password:t})};try{e.onPassword(i,t.code)}catch(t){this.#iW.reject(t)}}else this.#iW.reject(new K(t.message,t.code));return this.#iW.promise}),t.on("DataLoaded",t=>{e.onProgress?.({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||this.#i$.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",e=>{let[i,s,r]=e;if(this.destroyed||this.commonObjs.has(i))return null;switch(s){case"Font":let{disableFontFace:n,fontExtraProperties:a,pdfBug:o}=this._params;if("error"in r){let t=r.error;U(`Error during font loading: ${t}`),this.commonObjs.resolve(i,t);break}let l=new tK(r,{disableFontFace:n,inspectFont:o&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null});this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{!a&&l.data&&(l.data=null),this.commonObjs.resolve(i,l)});break;case"CopyLocalImage":let{imageRef:h}=r;for(let t of(G(h,"The imageRef must be defined."),this.#i$.values()))for(let[,e]of t.objs)if(e?.ref===h){if(!e.dataLen)return null;return this.commonObjs.resolve(i,structuredClone(e)),e.dataLen}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,r);break;default:throw Error(`Got unknown common object type ${s}`)}return null}),t.on("obj",t=>{let[e,i,s,r]=t;if(this.destroyed)return;let n=this.#i$.get(i);if(!n.objs.has(e)){if(0===n._intentStates.size)return void r?.bitmap?.close();switch(s){case"Image":n.objs.resolve(e,r),r?.dataLen>1e7&&(n._maybeCleanupAfterRender=!0);break;case"Pattern":n.objs.resolve(e,r);break;default:throw Error(`Got unknown object type ${s}`)}}}),t.on("DocProgress",t=>{this.destroyed||e.onProgress?.({loaded:t.loaded,total:t.total})}),t.on("FetchBuiltInCMap",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(t)}),t.on("FetchStandardFontData",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&U("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(Error("Invalid page request."));let e=t-1,i=this.#iG.get(e);if(i)return i;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw Error("Transport destroyed");i.refStr&&this.#iV.set(i.refStr,t);let s=new e7(e,i,this,this._params.pdfBug);return this.#i$.set(e,s),s});return this.#iG.set(e,s),s}getPageIndex(t){return e3(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#iq("GetFieldObjects")}hasJSActions(){return this.#iq("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}
2getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#iq("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#iq("GetOptionalContentConfig").then(e=>new eE(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=this.#iU.get(t);if(e)return e;let i=this.messageHandler.sendWithPromise(t,null).then(t=>({info:t[0],metadata:t[1]?new eA(t[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#iU.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){for(let t of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#i$.values()))if(!t.cleanup())throw Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#iU.clear(),this.filterFactory.destroy(!0),eQ.cleanup()}}cachedPageNumber(t){if(!e3(t))return null;let e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;return this.#iV.get(e)??null}}let ii=Symbol("INITIAL_DATA");class is{#iK=Object.create(null);#iX(t){return this.#iK[t]||={...Promise.withResolvers(),data:ii}}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){let i=this.#iX(t);return i.promise.then(()=>e(i.data)),null}let i=this.#iK[t];if(!i||i.data===ii)throw Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=this.#iK[t];return!!e&&e.data!==ii}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.#iX(t);i.data=e,i.resolve()}clear(){for(let t in this.#iK){let{data:e}=this.#iK[t];e?.bitmap?.close()}this.#iK=Object.create(null)}*[Symbol.iterator](){for(let t in this.#iK){let{data:e}=this.#iK[t];e!==ii&&(yield[t,e])}}}class ir{#iY=null;constructor(t){this.#iY=t,this.onContinue=null}get promise(){return this.#iY.capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.#iY.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this.#iY.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this.#iY;return t.form||t.canvas&&e?.size>0}}class ia{#iQ=null;static #iJ=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:r,operatorList:n,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:c=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=n,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=d,this.pageColors=c,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new ir(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(t){let{transparency:e=!1,optionalContentConfig:i}=t;if(this.cancelled)return;if(this._canvas){if(ia.#iJ.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");ia.#iJ.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:s,viewport:r,transform:n,background:a}=this.params;this.gfx=new eb(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:r,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#iQ&&(window.cancelAnimationFrame(this.#iQ),this.#iQ=null),ia.#iJ.delete(this._canvas),this.callback(t||new tf(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#iQ=window.requestAnimationFrame(()=>{this.#iQ=null,this._nextBound().catch(this._cancelBound)}
2):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){!this.cancelled&&(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),ia.#iJ.delete(this._canvas),this.callback())))}}let io="4.8.69",il="3634dab10";function ih(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function id(t){return Math.max(0,Math.min(255,255*t))}class ic{static CMYK_G(t){let[e,i,s,r]=t;return["G",1-Math.min(1,.3*e+.59*s+.11*i+r)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return[e=id(e),e,e]}static G_HTML(t){let[e]=t,i=ih(e);return`#${i}${i}${i}`}static RGB_G(t){let[e,i,s]=t;return["G",.3*e+.59*i+.11*s]}static RGB_rgb(t){return t.map(id)}static RGB_HTML(t){return`#${t.map(ih).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,s,r]=t;return["RGB",1-Math.min(1,e+r),1-Math.min(1,s+r),1-Math.min(1,i+r)]}static CMYK_rgb(t){let[e,i,s,r]=t;return[id(1-Math.min(1,e+r)),id(1-Math.min(1,s+r)),id(1-Math.min(1,i+r))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,s]=t,r=1-e,n=1-i,a=1-s,o=Math.min(r,n,a);return["CMYK",r,n,a,o]}}class iu{create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if("string"!=typeof t)throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){$("Abstract method `_createSVG` called.")}}class ip extends iu{_createSVG(t){return document.createElementNS(tc,t)}}class ig{static setupStorage(t,e,i,s,r){let n=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==n.value&&(t.textContent=n.value),"print"===r)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(n.value===i.attributes.xfaOn?t.setAttribute("checked",!0):n.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===r)break;t.addEventListener("change",t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==n.value&&t.setAttribute("value",n.value),"print"===r)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})})}break;case"select":if(null!==n.value)for(let e of(t.setAttribute("value",n.value),i.children))e.attributes.value===n.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,r=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:r})})}}static setAttributes(t){let{html:e,element:i,storage:s=null,intent:r,linkService:n}=t,{attributes:a}=i,o=e instanceof HTMLAnchorElement;for(let[t,i]of("radio"===a.type&&(a.name=`${a.name}-${r}`),Object.entries(a)))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:o&&("href"===t||"newWindow"===t)||e.setAttribute(t,i)}o&&n.addLinkAttributes(e,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(e,a.dataId,i,s)}static render(t){let e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,r=t.intent||"display",n=document.createElement(s.name);s.attributes&&this.setAttributes({html:n,element:s,intent:r,linkService:i});let a="richText"!==r,o=t.div;if(o.append(n),t.viewport){let e=`matrix(${t.viewport.transform.join(",")})`;o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");let l=[];
2if(0===s.children.length){if(s.value){let t=document.createTextNode(s.value);n.append(t),a&&eJ.shouldBuildText(s.name)&&l.push(t)}return{textDivs:l}}let h=[[s,-1,n]];for(;h.length>0;){let[t,s,n]=h.at(-1);if(s+1===t.children.length){h.pop();continue}let o=t.children[++h.at(-1)[1]];if(null===o)continue;let{name:d}=o;if("#text"===d){let t=document.createTextNode(o.value);l.push(t),n.append(t);continue}let c=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,d):document.createElement(d);if(n.append(c),o.attributes&&this.setAttributes({html:c,element:o,storage:e,intent:r,linkService:i}),o.children?.length>0)h.push([o,-1,c]);else if(o.value){let t=document.createTextNode(o.value);a&&eJ.shouldBuildText(d)&&l.push(t),c.append(t)}}for(let t of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}let im=new WeakSet;function ib(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class iv{static create(t){switch(t.data.annotationType){case 2:return new ix(t);case 1:return new iA(t);case 20:switch(t.data.fieldType){case"Tx":return new i_(t);case"Btn":if(t.data.radioButton)return new iC(t);if(t.data.checkBox)return new iS(t);return new iT(t);case"Ch":return new iM(t);case"Sig":return new iE(t)}return new iw(t);case 16:return new ik(t);case 3:return new iR(t);case 4:return new iD(t);case 5:return new iI(t);case 6:return new iL(t);case 8:return new iF(t);case 14:return new iO(t);case 15:return new ij(t);case 7:return new iN(t);case 9:return new iB(t);case 10:return new iz(t);case 11:return new iH(t);case 12:return new iU(t);case 13:return new i$(t);case 17:return new iG(t);default:return new iy(t)}}}class iy{#iZ=null;#i0=!1;#i1=null;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),s&&this._createQuadrilaterals()}static _hasPopupData(t){let{titleObj:e,contentsObj:i,richText:s}=t;return!!(e?.str||i?.str||s?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return iy._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#iZ||={rect:this.data.rect.slice(0)};let{rect:e}=t;e&&this.#i2(e),this.#i1?.popup.updateEdited(t)}resetEdited(){this.#iZ&&(this.#i2(this.#iZ.rect),this.#i1?.popup.resetEdited(),this.#iZ=null)}#i2(t){let{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:n,pageX:a,pageY:o}}}}=this;i?.splice(0,4,...t);let{width:l,height:h}=ib(t);e.left=`${100*(t[0]-a)/r}%`,e.top=`${100*(n-t[3]+o)/n}%`,0===s?(e.width=`${100*l/r}%`,e.height=`${100*h/n}%`):this.setRotation(s)}_createContainer(t){let{data:e,parent:{page:i,viewport:s}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),this instanceof iw||(r.tabIndex=1e3);let{style:n}=r;if(n.zIndex=this.parent.zIndex++,e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof ik){let{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,r),r}let{width:a,height:o}=ib(e.rect);if(!t&&e.borderStyle.width>0){n.borderWidth=`${e.borderStyle.width}px`;let t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?n.borderRadius=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`:this instanceof iC&&(n.borderRadius=`calc(${a}px * var(--scale-factor)) / calc(${o}px * var(--scale-factor))`),e.borderStyle.style){case 1:n.borderStyle="solid";break;case 2:n.borderStyle="dashed";break;case 3:U("Unimplemented border style: beveled");break;case 4:U("Unimplemented border style: inset");break;case 5:n.borderBottomStyle="solid"}let s=e.borderColor||null;s?(this.#i0=!0,n.borderColor=ta.makeHexColor(0|s[0],0|s[1],0|s[2])):n.borderWidth=0}let l=ta.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:d,pageX:c,pageY:u}=s.rawDims;n.left=`${100*(l[0]-c)/h}%`,n.top=`${100*(l[1]-u)/d}%`;let{rotation:p}=e;return e.hasOwnCanvas||0===p?(n.width=`${100*a/h}%`,n.height=`${100*o/d}%`):this.setRotation(p,r),r}setRotation(t){let e,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;let{pageWidth:r,pageHeight:n}=this.parent.viewport.rawDims,{width:a,height:o}=ib(this.data.rect);t%180==0?(e=100*a/r,i=100*o/n):(e=100*o/r,i=100*a/n),s.style.width=`${e}%`,s.style.height=`${i}%`,s.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(t,e,i)=>{let s=i.detail[t],r=s[0],n=s.slice(1);i.target.style[e]=ic[`${r}_HTML`](n),this.annotationStorage.setValue(this.data.id,{[e]:ic[`${r}_rgb`](n)})};return W(this,"_commonActions",{display:t=>{let{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>
2t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{let e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let s of Object.keys(e.detail)){let r=t[s]||i[s];r?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[s,r]of Object.entries(e)){let n=i[s];n&&(n({detail:{[s]:r},target:t}),delete e[s])}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,s,r,n]=this.data.rect.map(t=>Math.fround(t));if(8===e.length){let[t,a,o,l]=e.subarray(2,6);if(r===t&&n===a&&i===o&&s===l)return}let{style:a}=this.container;if(this.#i0){let{borderColor:e,borderWidth:i}=a;a.borderWidth=0,t=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${i}">`],this.container.classList.add("hasBorder")}let o=r-i,l=n-s,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);let c=h.createElement("defs");d.append(c);let u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),c.append(u);for(let s=2,r=e.length;s<r;
2s+=8){let r=e[s],a=e[s+1],d=e[s+2],c=e[s+3],p=h.createElement("rect"),g=(d-i)/o,f=(n-a)/l,m=(r-d)/o,b=(a-c)/l;p.setAttribute("x",g),p.setAttribute("y",f),p.setAttribute("width",m),p.setAttribute("height",b),u.append(p),t?.push(`<rect vector-effect="non-scaling-stroke" x="${g}" y="${f}" width="${m}" height="${b}"/>`)}this.#i0&&(t.push("</g></svg>')"),a.backgroundImage=t.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(){let{data:t}=this,e=this.#i1=new ik({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]});this.parent.div.append(e.render())}render(){$("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[];if(this._fieldObjects){let s=this._fieldObjects[t];if(s)for(let{page:t,id:r,exportValues:n}of s){if(-1===t||r===e)continue;let s="string"==typeof n?n:null,a=document.querySelector(`[data-element-id="${r}"]`);if(a&&!im.has(a)){U(`_getElementsByName - element not allowed: ${r}`);continue}i.push({id:r,exportValue:s,domElement:a})}return i}for(let s of document.getElementsByName(t)){let{exportValue:t}=s,r=s.getAttribute("data-element-id");r!==e&&im.has(s)&&i.push({id:r,exportValue:t,domElement:s})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}}class ix extends iy{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){let{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action),s=!0):t.attachment?(this.#i5(i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(this.#i3(i,t.setOCGState),s=!0):t.dest?(this._bindLink(i,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&this.container.append(i),this.container}#i6(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#i6()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#i6()}#i5(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#i6()}#i3(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#i6()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(e.actions)){let r=i.get(s);r&&(t[r]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1))}t.onclick||(t.onclick=()=>!1),this.#i6()}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#i6(),!this._fieldObjects){U('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{i?.();let{fields:t,refs:s,include:r}=e,n=[];if(0!==t.length||0!==s.length){let e=new Set(s);for(let i of t)for(let{id:t}of this._fieldObjects[i]||[])e.add(t);for(let t of Object.values(this._fieldObjects))for(let i of t)e.has(i.id)===r&&n.push(i)}else for(let t of Object.values(this._fieldObjects))n.push(...t);let a=this.annotationStorage,o=[];for(let t of n){let{id:e}=t;switch(o.push(e),t.type){case"text":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{let i=t.defaultValue===t.exportValues;a.setValue(e,{value:i});break}case"combobox":case"listbox":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}default:continue}let i=document.querySelector(`[data-element-id="${e}"]`);if(i){if(!im.has(i)){U(`_bindResetFormAction - element not allowed: ${e}`);continue}i.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}}}class iA extends iy{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}
2class iw extends iy{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return tr.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,r){i.includes("mouse")?t.addEventListener(i,t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}r&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(t)}})})}_setEventListeners(t,e,i,s){for(let[r,n]of i)("Action"===n||this.data.actions?.[n])&&(("Focus"===n||"Blur"===n)&&(e||={focused:!1}),this._setEventListener(t,e,r,n,s),"Focus"!==n||this.data.actions?.Blur?"Blur"!==n||this.data.actions?.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":ta.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e,{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,r=t.style,n=t=>Math.round(10*t)/10;if(this.data.multiLine){let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),i=Math.round(t/(1.35*s))||1;e=Math.min(s,n(t/i/1.35))}else e=Math.min(s,n(Math.abs(this.data.rect[3]-this.data.rect[1]-2)/1.35));r.fontSize=`calc(${e}px * var(--scale-factor))`,r.color=ta.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(r.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class i_ extends iw{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,s){let r=this.annotationStorage;
2for(let n of this._getElementsByName(t.name,t.id))n.domElement&&(n.domElement[e]=i),r.setValue(n.id,{[s]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let s=t.getValue(e,{value:this.data.fieldValue}),r=s.value||"",n=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;n&&r.length>n&&(r=r.slice(0,n));let a=s.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));let o={userValue:r,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=a??r,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type="text",i.setAttribute("value",a??r),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),im.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=1e3,this._setRequired(i,this.data.required),n&&(i.maxLength=n),i.addEventListener("input",s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),o.formattedValue=null}),i.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null});let l=t=>{let{formattedValue:e}=o;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{if(o.focused)return;let{target:e}=t;o.userValue&&(e.value=o.userValue),o.lastCommittedValue=e.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target),this._dispatchEventFromSandbox({value(i){o.userValue=i.detail.value??"",t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){let{formattedValue:s}=i.detail;o.formattedValue=s,null!=s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{let{charLimit:s}=i.detail,{target:r}=i;if(0===s)return void r.removeAttribute("maxLength");r.setAttribute("maxLength",s);let n=o.userValue;n&&!(n.length<=s)&&(r.value=o.userValue=n=n.slice(0,s),t.setValue(e,{value:n}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:1,selStart:r.selectionStart,selEnd:r.selectionEnd}}))}},i)}),i.addEventListener("keydown",t=>{o.commitKey=1;let i=-1;if("Escape"===t.key?i=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(o.commitKey=3):i=2,-1===i)return;let{value:s}=t.target;o.lastCommittedValue!==s&&(o.lastCommittedValue=s,o.userValue=s,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});let s=l;l=null,i.addEventListener("blur",t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);let{value:i}=t.target;o.userValue=i,o.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),s(t)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",t=>{o.lastCommittedValue=null;let{data:i,target:s}=t,{value:r,selectionStart:n,selectionEnd:a}=s,l=n,h=a;switch(t.inputType){case"deleteWordBackward":{let t=r.substring(0,n).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}
2case"deleteWordForward":{let t=r.substring(n).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":n===a&&(l-=1);break;case"deleteContentForward":n===a&&(h+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,change:i||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(l&&i.addEventListener("blur",l),this.data.comb){let t=(this.data.rect[2]-this.data.rect[0])/n;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--scale-factor) - 1ch)`}}else(i=document.createElement("div")).textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class iE extends iw{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class iS extends iw{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let r=document.createElement("input");return im.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=1e3,r.addEventListener("change",s=>{let{name:r,checked:n}=s.target;for(let s of this._getElementsByName(r,i)){let i=n&&s.exportValue===e.exportValue;s.domElement&&(s.domElement.checked=i),t.setValue(s.id,{value:i})}t.setValue(i,{value:n})}),r.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class iC extends iw{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(let s of this._getElementsByName(e.fieldName,i))t.setValue(s.id,{value:!1});let r=document.createElement("input");if(im.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.tabIndex=1e3,r.addEventListener("change",e=>{let{name:s,checked:r}=e.target;for(let e of this._getElementsByName(s,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:r})}),r.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let s=e.buttonValue;r.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let r=s===e.detail.value;for(let s of this._getElementsByName(e.target.name)){let e=r&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}},e)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}
2return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class iT extends ix{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class iM extends iw{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");im.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=1e3;let r=this.data.combo&&this.data.options.length>0;for(let t of(!this.data.combo&&(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue;for(let t of s.options)t.selected=t.value===e}),this.data.options)){let e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),r=!1),s.append(e)}let n=null;if(r){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),n=()=>{t.remove(),s.removeEventListener("input",n),n=null},s.addEventListener("input",n)}let a=t=>{let e=t?"value":"textContent",{options:i,multiple:r}=s;return r?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]},o=a(!1),l=t=>{let e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({value(i){n?.();let r=i.detail.value,l=new Set(Array.isArray(r)?r:[r]);for(let t of s.options)t.selected=l.has(t.value);t.setValue(e,{value:a(!0)}),o=a(!1)},multipleSelection(t){s.multiple=!0},remove(i){let r=s.options,n=i.detail.remove;r[n].selected=!1,s.remove(n),r.length>0&&-1===Array.prototype.findIndex.call(r,t=>t.selected)&&(r[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),o=a(!1)},insert(i){let{index:r,displayValue:n,exportValue:h}=i.detail.insert,d=s.children[r],c=document.createElement("option");c.textContent=n,c.value=h,d?d.before(c):s.append(c),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},items(i){let{items:r}=i.detail;for(;0!==s.length;)s.remove(0);for(let t of r){let{displayValue:e,exportValue:i}=t,r=document.createElement("option");r.textContent=e,r.value=i,s.append(r)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){let s=new Set(i.detail.indices);for(let t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:a(!0)}),o=a(!1)},editable(t){t.target.disabled=!t.detail.editable}},i)}),s.addEventListener("input",i=>{let s=a(!0),r=a(!1);t.setValue(e,{value:s}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:r,changeEx:s,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):s.addEventListener("input",function(i){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class ik extends iy{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:iy._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");let t=this.popup=new iP({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(let i of this.elements)i.popup=t,i.container.ariaHasPopup="dialog",e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(t=>`${td}${t}`).join(",")),this.container}}
2class iP{#i4=this.#i8.bind(this);#i7=this.#i9.bind(this);#st=this.#se.bind(this);#si=this.#ss.bind(this);#sr=null;#tu=null;#sn=null;#sa=null;#so=null;#sl=null;#sh=null;#sd=!1;#sc=null;#C=null;#su=null;#sp=null;#sg=null;#iZ=null;#sf=!1;constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:r,contentsObj:n,richText:a,parent:o,rect:l,parentRect:h,open:d}){for(const d of(this.#tu=t,this.#sg=s,this.#sn=n,this.#sp=a,this.#sl=o,this.#sr=e,this.#su=l,this.#sh=h,this.#so=i,this.#sa=tE.toDateObject(r),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),this.trigger))d.addEventListener("click",this.#si),d.addEventListener("mouseenter",this.#st),d.addEventListener("mouseleave",this.#i7),d.classList.add("popupTriggerArea");for(const t of i)t.container?.addEventListener("keydown",this.#i4);this.#tu.hidden=!0,d&&this.#ss()}render(){if(this.#sc)return;let t=this.#sc=document.createElement("div");if(t.className="popup",this.#sr){let e=t.style.outlineColor=ta.makeHexColor(...this.#sr);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`:t.style.backgroundColor=ta.makeHexColor(...this.#sr.map(t=>Math.floor(.7*(255-t)+t)))}let e=document.createElement("span");e.className="header";let i=document.createElement("h1");if(e.append(i),{dir:i.dir,str:i.textContent}=this.#sg,t.append(e),this.#sa){let t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#sa.valueOf()})),e.append(t)}let s=this.#sm;if(s)ig.render({xfaHtml:s,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{let e=this._formatContents(this.#sn);t.append(e)}this.#tu.append(t)}get #sm(){let t=this.#sp,e=this.#sn;return t?.str&&(!e?.str||e.str===t.str)&&this.#sp.html||null}get #sb(){return this.#sm?.attributes?.style?.fontSize||0}get #sv(){return this.#sm?.attributes?.style?.color||null}#sy(t){let e=[],i={style:{color:this.#sv,fontSize:this.#sb?`calc(${this.#sb}px * var(--scale-factor))`:""}};for(let s of t.split("\n"))e.push({name:"span",value:s,attributes:i});return{str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}}}_formatContents(t){let{str:e,dir:i}=t,s=document.createElement("p");s.classList.add("popupContent"),s.dir=i;let r=e.split(/(?:\r\n?|\n)/);for(let t=0,e=r.length;t<e;++t){let i=r[t];s.append(document.createTextNode(i)),t<e-1&&s.append(document.createElement("br"))}return s}#i8(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#sd)&&this.#ss()}updateEdited(t){let{rect:e,popupContent:i}=t;this.#iZ||={contentsObj:this.#sn,richText:this.#sp},e&&(this.#C=null),i&&(this.#sp=this.#sy(i),this.#sn=null),this.#sc?.remove(),this.#sc=null}resetEdited(){this.#iZ&&({contentsObj:this.#sn,richText:this.#sp}=this.#iZ,this.#iZ=null,this.#sc?.remove(),this.#sc=null,this.#C=null)}#sx(){if(null!==this.#C)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:r}}}=this.#sl,n=!!this.#sh,a=n?this.#sh:this.#su;for(let t of this.#so)if(!a||null!==ta.intersect(t.data.rect,a)){a=t.data.rect,n=!0;break}let o=ta.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),l=n?a[2]-a[0]+5:0,h=o[0]+l,d=o[1];this.#C=[100*(h-s)/e,100*(d-r)/i];let{style:c}=this.#tu;c.left=`${this.#C[0]}%`,c.top=`${this.#C[1]}%`}#ss(){this.#sd=!this.#sd,this.#sd?(this.#se(),this.#tu.addEventListener("click",this.#si),this.#tu.addEventListener("keydown",this.#i4)):(this.#i9(),this.#tu.removeEventListener("click",this.#si),this.#tu.removeEventListener("keydown",this.#i4))}#se(){this.#sc||this.render(),this.isVisible?this.#sd&&this.#tu.classList.add("focused"):(this.#sx(),this.#tu.hidden=!1,this.#tu.style.zIndex=parseInt(this.#tu.style.zIndex)+1e3)}#i9(){this.#tu.classList.remove("focused"),!this.#sd&&this.isVisible&&(this.#tu.hidden=!0,this.#tu.style.zIndex=parseInt(this.#tu.style.zIndex)-1e3)}forceHide(){this.#sf=this.isVisible,this.#sf&&(this.#tu.hidden=!0)}maybeShow(){this.#sf&&(this.#sc||this.#se(),this.#sf=!1,this.#tu.hidden=!1)}get isVisible(){return!1===this.#tu.hidden}}class iR extends iy{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=I.FREETEXT}
2render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=document.createElement("div");for(let e of(t.classList.add("annotationTextContent"),t.setAttribute("role","comment"),this.textContent)){let i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class iD extends iy{#sA=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let t=this.data,{width:e,height:i}=ib(t.rect),s=this.svgFactory.create(e,i,!0),r=this.#sA=this.svgFactory.createElement("svg:line");return r.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),r.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),r.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),r.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#sA}addHighlightArea(){this.container.classList.add("highlightArea")}}class iI extends iy{#sw=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let t=this.data,{width:e,height:i}=ib(t.rect),s=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,n=this.#sw=this.svgFactory.createElement("svg:rect");return n.setAttribute("x",r/2),n.setAttribute("y",r/2),n.setAttribute("width",e-r),n.setAttribute("height",i-r),n.setAttribute("stroke-width",r||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#sw}addHighlightArea(){this.container.classList.add("highlightArea")}}class iL extends iy{#s_=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let t=this.data,{width:e,height:i}=ib(t.rect),s=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,n=this.#s_=this.svgFactory.createElement("svg:ellipse");return n.setAttribute("cx",e/2),n.setAttribute("cy",i/2),n.setAttribute("rx",e/2-r/2),n.setAttribute("ry",i/2-r/2),n.setAttribute("stroke-width",r||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#s_}addHighlightArea(){this.container.classList.add("highlightArea")}}class iF extends iy{#sE=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,vertices:e,borderStyle:i,popupRef:s}}=this;if(!e)return this.container;let{width:r,height:n}=ib(t),a=this.svgFactory.create(r,n,!0),o=[];for(let i=0,s=e.length;i<s;i+=2){let s=e[i]-t[0],r=t[3]-e[i+1];o.push(`${s},${r}`)}o=o.join(" ");let l=this.#sE=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),a.append(l),this.container.append(a),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#sE}addHighlightArea(){this.container.classList.add("highlightArea")}}class iN extends iF{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class iO extends iy{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class ij extends iy{#sS=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?I.HIGHLIGHT:I.INK}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,inkLists:e,borderStyle:i,popupRef:s}}=this,{width:r,height:n}=ib(t),a=this.svgFactory.create(r,n,!0);for(let s of e){let e=[];for(let i=0,r=s.length;i<r;i+=2){let r=s[i]-t[0],n=t[3]-s[i+1];e.push(`${r},${n}`)}e=e.join(" ");let r=this.svgFactory.createElement(this.svgElementName);this.#sS.push(r),r.setAttribute("points",e),r.setAttribute("stroke-width",i.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),a.append(r)}return!s&&this.hasPopupData&&this._createPopup(),this.container.append(a),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return this.#sS}
2addHighlightArea(){this.container.classList.add("highlightArea")}}class iB extends iy{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=I.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class iz extends iy{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class iH extends iy{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class iU extends iy{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class i$ extends iy{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=I.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class iG extends iy{#sC=null;constructor(t){super(t,{isRenderable:!0});const{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){let t;this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:i}=this;i.hasAppearance||0===i.fillAlpha?t=document.createElement("div"):((t=document.createElement("img")).src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(i.name)?"paperclip":"pushpin"}.svg`,i.fillAlpha&&i.fillAlpha<1&&(t.style=`filter: opacity(${Math.round(100*i.fillAlpha)}%);`)),t.addEventListener("dblclick",this.#sT.bind(this)),this.#sC=t;let{isMac:s}=tr.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&this.#sT()}),!i.popupRef&&this.hasPopupData?this._createPopup():t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return this.#sC}addHighlightArea(){this.container.classList.add("highlightArea")}#sT(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class iV{#sM=null;#sk=null;#sP=new Map;#sR=null;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:r,viewport:n,structTreeLayer:a}){this.div=t,this.#sM=e,this.#sk=i,this.#sR=a||null,this.page=r,this.viewport=n,this.zIndex=0,this._annotationEditorUIManager=s}hasEditableAnnotations(){return this.#sP.size>0}async #sD(t,e){let i=t.firstChild||t,s=i.id=`${td}${e}`,r=await this.#sR?.getAriaAttributes(s);if(r)for(let[t,e]of r)i.setAttribute(t,e);this.div.append(t),this.#sM?.moveElementInDOM(this.div,t,i,!1)}async render(t){let{annotations:e}=t,i=this.div;tk(i,this.viewport);let s=new Map,r={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new ip,annotationStorage:t.annotationStorage||new tV,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let t of e){if(t.noHTML)continue;let e=16===t.annotationType;if(e){let e=s.get(t.id);if(!e)continue;r.elements=e}else{let{width:e,height:i}=ib(t.rect);if(e<=0||i<=0)continue}r.data=t;let i=iv.create(r);if(!i.isRenderable)continue;if(!e&&t.popupRef){let e=s.get(t.popupRef);e?e.push(i):s.set(t.popupRef,[i])}let n=i.render();t.hidden&&(n.style.visibility="hidden"),await this.#sD(n,t.id),i._isEditable&&(this.#sP.set(i.data.id,i),this._annotationEditorUIManager?.renderAnnotationElement(i))}this.#sI()}update(t){let{viewport:e}=t,i=this.div;this.viewport=e,tk(i,{rotation:e.rotation}),this.#sI(),i.hidden=!1}
2#sI(){if(!this.#sk)return;let t=this.div;for(let[e,i]of this.#sk){let s=t.querySelector(`[data-annotation-id="${e}"]`);if(!s)continue;i.className="annotationContent";let{firstChild:r}=s;r?"CANVAS"===r.nodeName?r.replaceWith(i):r.classList.contains("annotationContent")?r.after(i):r.before(i):s.append(i)}this.#sk.clear()}getEditableAnnotations(){return Array.from(this.#sP.values())}getEditableAnnotation(t){return this.#sP.get(t)}}let iW=/\r\n?|\n/g;class iq extends tH{#sr;#sL="";#sF=`${this.id}-editor`;#sN=null;#sb;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=iq.prototype,e=t=>t.isEmpty(),i=tB.TRANSLATE_SMALL,s=tB.TRANSLATE_BIG;return W(this,"_keyboardManager",new tO([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}static _type="freetext";static _editorType=I.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#sr=t.color||iq._defaultColor||tH._defaultLineColor,this.#sb=t.fontSize||iq._defaultFontSize}static initialize(t,e){tH.initialize(t,e);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case L.FREETEXT_SIZE:iq._defaultFontSize=e;break;case L.FREETEXT_COLOR:iq._defaultColor=e}}updateParams(t,e){switch(t){case L.FREETEXT_SIZE:this.#sO(e);break;case L.FREETEXT_COLOR:this.#sj(e)}}static get defaultPropertiesToUpdate(){return[[L.FREETEXT_SIZE,iq._defaultFontSize],[L.FREETEXT_COLOR,iq._defaultColor||tH._defaultLineColor]]}get propertiesToUpdate(){return[[L.FREETEXT_SIZE,this.#sb],[L.FREETEXT_COLOR,this.#sr]]}#sO(t){let e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-this.#sb)*this.parentScale),this.#sb=t,this.#sB()},i=this.#sb;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:L.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#sj(t){let e=t=>{this.#sr=this.editorDiv.style.color=t},i=this.#sr;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:L.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-iq._internalPadding*t,-(iq._internalPadding+this.#sb)*t]}rebuild(){!this.parent||(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(I.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#sN=new AbortController;let t=this._uiManager.combinedSignal(this.#sN);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#sF),this._isDraggable=!0,this.#sN?.abort(),this.#sN=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#sz(){let t=[];
2this.editorDiv.normalize();let e=null;for(let i of this.editorDiv.childNodes)(e?.nodeType!==Node.TEXT_NODE||"BR"!==i.nodeName)&&(t.push(iq.#sH(i)),e=i);return t.join("\n")}#sB(){let t,[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,s=i.style.display,r=i.classList.contains("hidden");i.classList.remove("hidden"),i.style.display="hidden",e.div.append(this.div),t=i.getBoundingClientRect(),i.remove(),i.style.display=s,i.classList.toggle("hidden",r)}this.rotation%180==this.parentRotation%180?(this.width=t.width/e,this.height=t.height/i):(this.width=t.height/e,this.height=t.width/i),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#sL,e=this.#sL=this.#sz().trimEnd();if(t===e)return;let i=t=>{(this.#sL=t,t)?(this.#sU(),this._uiManager.rebuild(this),this.#sB()):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#sB()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){iq._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#sF),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#sb}px * var(--scale-factor))`,i.color=this.#sr,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),tI(this,this.div,["dblclick","keydown"]),this.width){let[i,s]=this.parentDimensions;if(this.annotationElementId){let r,n,{position:a}=this._initialData,[o,l]=this.getInitialTranslation();[o,l]=this.pageTranslationToScreen(o,l);let[h,d]=this.pageDimensions,[c,u]=this.pageTranslation;switch(this.rotation){case 0:r=t+(a[0]-c)/h,n=e+this.height-(a[1]-u)/d;break;case 90:r=t+(a[0]-c)/h,n=e-(a[1]-u)/d,[o,l]=[l,-o];break;case 180:r=t-this.width+(a[0]-c)/h,n=e-(a[1]-u)/d,[o,l]=[-o,-l];break;case 270:r=t+(a[0]-c-this.height*d)/h,n=e+(a[1]-u-this.width*h)/d,[o,l]=[-l,o]}this.setAt(r*i,n*s,o,l)}else this.setAt(t*i,e*s,this.width*i,this.height*s);this.#sU(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static #sH(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(iW,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();let s=iq.#s$(e.getData("text")||"").replaceAll(iW,"\n");if(!s)return;let r=window.getSelection();if(!r.rangeCount)return;this.editorDiv.normalize(),r.deleteFromDocument();let n=r.getRangeAt(0);if(!s.includes("\n")){n.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),r.collapseToStart();return}let{startContainer:a,startOffset:o}=n,l=[],h=[];if(a.nodeType===Node.TEXT_NODE){let t=a.parentElement;if(h.push(a.nodeValue.slice(o).replaceAll(iW,"")),t!==this.editorDiv){let e=l;for(let i of this.editorDiv.childNodes){if(i===t){e=h;continue}e.push(iq.#sH(i))}}l.push(a.nodeValue.slice(0,o).replaceAll(iW,""))}else if(a===this.editorDiv){let t=l,e=0;for(let i of this.editorDiv.childNodes)e++===o&&(t=h),t.push(iq.#sH(i))}this.#sL=`${l.join("\n")}${s}${h.join("\n")}`,this.#sU();let d=new Range,c=l.reduce((t,e)=>t+e.length,0);for(let{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.nodeValue.length;if(c<=e){d.setStart(t,c),d.setEnd(t,c);break}c-=e}r.removeAllRanges(),r.addRange(d)}#sU(){if(this.editorDiv.replaceChildren(),this.#sL)for(let t of this.#sL.split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#sG(){return this.#sL.replaceAll("Â "," ")}static #s$(t){return t.replaceAll(" ","Â ")}get contentDiv(){return this.editorDiv}static async deserialize(t,e,i){let s=null;if(t instanceof iR){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:r,rotation:n,id:a,popupRef:o},textContent:l,textPosition:h,parent:{page:{pageNumber:d}}}=t;if(!l||0===l.length)return null;s=t={annotationType:I.FREETEXT,color:Array.from(i),fontSize:e,value:l.join("\n"),position:h,pageIndex:d-1,rect:r.slice(0),rotation:n,id:a,deleted:!1,popupRef:o}}let r=await super.deserialize(t,e,i);return r.#sb=t.fontSize,r.#sr=ta.makeHexColor(...t.color),r.#sL=iq.#s$(t.value),r.annotationElementId=t.id||null,r._initialData=s,r}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=iq._internalPadding*this.parentScale,i=this.getRect(e,e),s=tH._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#sr),r={annotationType:I.FREETEXT,color:s,fontSize:this.#sb,value:this.#sG(),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?r:this.annotationElementId&&!this.#sV(r)?null:(r.id=this.annotationElementId,r)}#sV(t){let{value:e,fontSize:i,color:s,pageIndex:r}=this._initialData;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==s[e])||t.pageIndex!==r}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(this.deleted)return e;let{style:i}=e;for(let t of(i.fontSize=`calc(${this.#sb}px * var(--scale-factor))`,i.color=this.#sr,e.replaceChildren(),this.#sL.split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}let s=iq._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:this.#sL}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class iK{toSVGPath(){$("Abstract method `toSVGPath` must be implemented.")}get box(){$("Abstract getter `box` must be implemented.")}serialize(t,e){$("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){$("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){$("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}class iX{#sW;#sq=[];#sK;#sX;#sY=[];#sQ=new Float64Array(18);#sJ;#sZ;#s0;#s1;#s2;
2#s5;#s3=[];static #s6=8;static #s4=2;static #s8=iX.#s6+iX.#s4;constructor({x:t,y:e},i,s,r,n,a=0){this.#sW=i,this.#s5=r*s,this.#sX=n,this.#sQ.set([NaN,NaN,NaN,NaN,t,e],6),this.#sK=a,this.#s1=iX.#s6*s,this.#s0=iX.#s8*s,this.#s2=s,this.#s3.push(t,e)}isEmpty(){return isNaN(this.#sQ[8])}#s7(){let t=this.#sQ.subarray(4,6),e=this.#sQ.subarray(16,18),[i,s,r,n]=this.#sW;return[(this.#sJ+(t[0]-e[0])/2-i)/r,(this.#sZ+(t[1]-e[1])/2-s)/n,(this.#sJ+(e[0]-t[0])/2-i)/r,(this.#sZ+(e[1]-t[1])/2-s)/n]}add(t){let{x:e,y:i}=t;this.#sJ=e,this.#sZ=i;let[s,r,n,a]=this.#sW,[o,l,h,d]=this.#sQ.subarray(8,12),c=e-h,u=i-d,p=Math.hypot(c,u);if(p<this.#s0)return!1;let g=p-this.#s1,f=g/p,m=f*c,b=f*u,v=o,y=l;o=h,l=d,h+=m,d+=b,this.#s3?.push(e,i);let x=-b/g*this.#s5,A=m/g*this.#s5;return(this.#sQ.set(this.#sQ.subarray(2,8),0),this.#sQ.set([h+x,d+A],4),this.#sQ.set(this.#sQ.subarray(14,18),12),this.#sQ.set([h-x,d-A],16),isNaN(this.#sQ[6]))?(0===this.#sY.length&&(this.#sQ.set([o+x,l+A],2),this.#sY.push(NaN,NaN,NaN,NaN,(o+x-s)/n,(l+A-r)/a),this.#sQ.set([o-x,l-A],14),this.#sq.push(NaN,NaN,NaN,NaN,(o-x-s)/n,(l-A-r)/a)),this.#sQ.set([v,y,o,l,h,d],6),!this.isEmpty()):((this.#sQ.set([v,y,o,l,h,d],6),Math.abs(Math.atan2(y-l,v-o)-Math.atan2(b,m))<Math.PI/2)?([o,l,h,d]=this.#sQ.subarray(2,6),this.#sY.push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((l+d)/2-r)/a),[o,l,v,y]=this.#sQ.subarray(14,18),this.#sq.push(NaN,NaN,NaN,NaN,((v+o)/2-s)/n,((y+l)/2-r)/a)):([v,y,o,l,h,d]=this.#sQ.subarray(0,6),this.#sY.push(((v+5*o)/6-s)/n,((y+5*l)/6-r)/a,((5*o+h)/6-s)/n,((5*l+d)/6-r)/a,((o+h)/2-s)/n,((l+d)/2-r)/a),[h,d,o,l,v,y]=this.#sQ.subarray(12,18),this.#sq.push(((v+5*o)/6-s)/n,((y+5*l)/6-r)/a,((5*o+h)/6-s)/n,((5*l+d)/6-r)/a,((o+h)/2-s)/n,((l+d)/2-r)/a)),!0)}toSVGPath(){if(this.isEmpty())return"";let t=this.#sY,e=this.#sq;if(isNaN(this.#sQ[6])&&!this.isEmpty())return this.#s9();let i=[];i.push(`M${t[4]} ${t[5]}`);for(let e=6;e<t.length;e+=6)isNaN(t[e])?i.push(`L${t[e+4]} ${t[e+5]}`):i.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);this.#rt(i);for(let t=e.length-6;t>=6;t-=6)isNaN(e[t])?i.push(`L${e[t+4]} ${e[t+5]}`):i.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);return this.#re(i),i.join(" ")}#s9(){let[t,e,i,s]=this.#sW,[r,n,a,o]=this.#s7();return`M${(this.#sQ[2]-t)/i} ${(this.#sQ[3]-e)/s} L${(this.#sQ[4]-t)/i} ${(this.#sQ[5]-e)/s} L${r} ${n} L${a} ${o} L${(this.#sQ[16]-t)/i} ${(this.#sQ[17]-e)/s} L${(this.#sQ[14]-t)/i} ${(this.#sQ[15]-e)/s} Z`}#re(t){let e=this.#sq;t.push(`L${e[4]} ${e[5]} Z`)}#rt(t){let[e,i,s,r]=this.#sW,n=this.#sQ.subarray(4,6),a=this.#sQ.subarray(16,18),[o,l,h,d]=this.#s7();t.push(`L${(n[0]-e)/s} ${(n[1]-i)/r} L${o} ${l} L${h} ${d} L${(a[0]-e)/s} ${(a[1]-i)/r}`)}newFreeDrawOutline(t,e,i,s,r,n){return new iY(t,e,i,s,r,n)}getOutlines(){let t=this.#sY,e=this.#sq,i=this.#sQ,[s,r,n,a]=this.#sW,o=new Float64Array((this.#s3?.length??0)+2);for(let t=0,e=o.length-2;t<e;t+=2)o[t]=(this.#s3[t]-s)/n,o[t+1]=(this.#s3[t+1]-r)/a;if(o[o.length-2]=(this.#sJ-s)/n,o[o.length-1]=(this.#sZ-r)/a,isNaN(i[6])&&!this.isEmpty())return this.#ri(o);let l=new Float64Array(this.#sY.length+24+this.#sq.length),h=t.length;for(let e=0;e<h;e+=2){if(isNaN(t[e])){l[e]=l[e+1]=NaN;continue}l[e]=t[e],l[e+1]=t[e+1]}h=this.#rs(l,h);for(let t=e.length-6;t>=6;t-=6)for(let i=0;i<6;i+=2){if(isNaN(e[t+i])){l[h]=l[h+1]=NaN,h+=2;continue}l[h]=e[t+i],l[h+1]=e[t+i+1],h+=2}return this.#rr(l,h),this.newFreeDrawOutline(l,o,this.#sW,this.#s2,this.#sK,this.#sX)}#ri(t){let e=this.#sQ,[i,s,r,n]=this.#sW,[a,o,l,h]=this.#s7(),d=new Float64Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-i)/r,(e[3]-s)/n,NaN,NaN,NaN,NaN,(e[4]-i)/r,(e[5]-s)/n,NaN,NaN,NaN,NaN,a,o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,(e[16]-i)/r,(e[17]-s)/n,NaN,NaN,NaN,NaN,(e[14]-i)/r,(e[15]-s)/n],0),this.newFreeDrawOutline(d,t,this.#sW,this.#s2,this.#sK,this.#sX)}#rr(t,e){let i=this.#sq;return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6}#rs(t,e){let i=this.#sQ.subarray(4,6),s=this.#sQ.subarray(16,18),[r,n,a,o]=this.#sW,[l,h,d,c]=this.#s7();return t.set([NaN,NaN,NaN,NaN,(i[0]-r)/a,(i[1]-n)/o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,d,c,NaN,NaN,NaN,NaN,(s[0]-r)/a,(s[1]-n)/o],e),e+=24}}class iY extends iK{#sW;#rn=null;#sK;#sX;#s3;#s2;#ra;constructor(t,e,i,s,r,n){super(),this.#ra=t,this.#s3=e,this.#sW=i,this.#s2=s,this.#sK=r,this.#sX=n,this.#ro(n);const{x:a,y:o,width:l,height:h}=this.#rn;for(let e=0,i=t.length;e<i;e+=2)t[e]=(t[e]-a)/l,t[e+1]=(t[e+1]-o)/h;for(let t=0,i=e.length;t<i;t+=2)e[t]=(e[t]-a)/l,e[t+1]=(e[t+1]-o)/h}toSVGPath(){let t=[`M${this.#ra[4]} ${this.#ra[5]}`];for(let e=6,i=this.#ra.length;e<i;e+=6){if(isNaN(this.#ra[e])){t.push(`L${this.#ra[e+4]} ${this.#ra[e+5]}`);continue}t.push(`C${this.#ra[e]} ${this.#ra[e+1]} ${this.#ra[e+2]} ${this.#ra[e+3]} ${this.#ra[e+4]} ${this.#ra[e+5]}`)}return t.push("Z"),t.join(" ")}serialize(t,e){let i,s,[r,n,a,o]=t,l=a-r,h=o-n;switch(e){case 0:i=this.#rl(this.#ra,r,o,l,-h),s=this.#rl(this.#s3,r,o,l,-h);break;case 90:i=this.#rh(this.#ra,r,n,l,h),s=this.#rh(this.#s3,r,n,l,h);break;case 180:i=this.#rl(this.#ra,a,n,-l,h),s=this.#rl(this.#s3,a,n,-l,h);break;case 270:i=this.#rh(this.#ra,a,o,-l,-h),s=this.#rh(this.#s3,a,o,-l,-h)}return{outline:Array.from(i),points:[Array.from(s)]}}#rl(t,e,i,s,r){let n=new Float64Array(t.length);for(let a=0,o=t.length;a<o;a+=2)n[a]=e+t[a]*s,n[a+1]=i+t[a+1]*r;return n}
2#rh(t,e,i,s,r){let n=new Float64Array(t.length);for(let a=0,o=t.length;a<o;a+=2)n[a]=e+t[a+1]*s,n[a+1]=i+t[a]*r;return n}#ro(t){let e=this.#ra,i=e[4],s=e[5],r=i,n=s,a=i,o=s,l=i,h=s,d=t?Math.max:Math.min;for(let t=6,c=e.length;t<c;t+=6){if(isNaN(e[t]))r=Math.min(r,e[t+4]),n=Math.min(n,e[t+5]),a=Math.max(a,e[t+4]),o=Math.max(o,e[t+5]),h<e[t+5]?(l=e[t+4],h=e[t+5]):h===e[t+5]&&(l=d(l,e[t+4]));else{let c=ta.bezierBoundingBox(i,s,...e.slice(t,t+6));r=Math.min(r,c[0]),n=Math.min(n,c[1]),a=Math.max(a,c[2]),o=Math.max(o,c[3]),h<c[3]?(l=c[2],h=c[3]):h===c[3]&&(l=d(l,c[2]))}i=e[t+4],s=e[t+5]}let c=r-this.#sK,u=n-this.#sK,p=a-r+2*this.#sK,g=o-n+2*this.#sK;this.#rn={x:c,y:u,width:p,height:g,lastPoint:[l,h]}}get box(){return this.#rn}newOutliner(t,e,i,s,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return new iX(t,e,i,s,r,n)}getNewOutline(t,e){let{x:i,y:s,width:r,height:n}=this.#rn,[a,o,l,h]=this.#sW,d=r*l,c=n*h,u=i*l+a,p=s*h+o,g=this.newOutliner({x:this.#s3[0]*d+u,y:this.#s3[1]*c+p},this.#sW,this.#s2,t,this.#sX,e??this.#sK);for(let t=2;t<this.#s3.length;t+=2)g.add({x:this.#s3[t]*d+u,y:this.#s3[t+1]*c+p});return g.getOutlines()}get mustRemoveSelfIntersections(){return!0}}class iQ{#sW;#rd=[];#rc=[];constructor(t,e=0,i=0,s=!0){let r=1/0,n=-1/0,a=1/0,o=-1/0;for(const{x:i,y:s,width:l,height:h}of t){const t=1e-4*Math.floor((i-e)/1e-4),d=1e-4*Math.ceil((i+l+e)/1e-4),c=1e-4*Math.floor((s-e)/1e-4),u=1e-4*Math.ceil((s+h+e)/1e-4),p=[t,c,u,!0],g=[d,c,u,!1];this.#rd.push(p,g),r=Math.min(r,t),n=Math.max(n,d),a=Math.min(a,c),o=Math.max(o,u)}const l=n-r+2*i,h=o-a+2*i,d=r-i,c=a-i,u=this.#rd.at(s?-1:-2),p=[u[0],u[2]];for(const t of this.#rd){const[e,i,s]=t;t[0]=(e-d)/l,t[1]=(i-c)/h,t[2]=(s-c)/h}this.#sW={x:d,y:c,width:l,height:h,lastPoint:p}}getOutlines(){this.#rd.sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of this.#rd)e[3]?(t.push(...this.#ru(e)),this.#rp(e)):(this.#rg(e),t.pu
2sh(...this.#ru(e)));return this.#rf(t)}#rf(t){let e,i=[],s=new Set;for(let e of t){let[t,s,r]=e;i.push([t,s,e],[t,r,e])}i.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,e=i.length;t<e;t+=2){let e=i[t][2],r=i[t+1][2];e.push(r),r.push(e),s.add(e),s.add(r)}let r=[];for(;s.size>0;){let t=s.values().next().value,[i,n,a,o,l]=t;s.delete(t);let h=i,d=n;for(e=[i,a],r.push(e);;){let t;if(s.has(o))t=o;else if(s.has(l))t=l;else break;s.delete(t),[i,n,a,o,l]=t,h!==i&&(e.push(h,d,i,d===n?n:a),h=i),d=d===n?a:n}e.push(h,d)}return new iJ(r,this.#sW)}#rm(t){let e=this.#rc,i=0,s=e.length-1;for(;i<=s;){let r=i+s>>1,n=e[r][0];if(n===t)return r;n<t?i=r+1:s=r-1}return s+1}#rp(t){let[,e,i]=t,s=this.#rm(e);this.#rc.splice(s,0,[e,i])}#rg(t){let[,e,i]=t,s=this.#rm(e);for(let t=s;t<this.#rc.length;t++){let[s,r]=this.#rc[t];if(s!==e)break;if(s===e&&r===i)return void this.#rc.splice(t,1)}for(let t=s-1;t>=0;t--){let[s,r]=this.#rc[t];if(s!==e)break;if(s===e&&r===i)return void this.#rc.splice(t,1)}}#ru(t){let[e,i,s]=t,r=[[e,i,s]],n=this.#rm(s);for(let t=0;t<n;t++){let[i,s]=this.#rc[t];for(let t=0,n=r.length;t<n;t++){let[,a,o]=r[t];if(!(s<=a)&&!(o<=i)){if(a>=i){if(o>s)r[t][1]=s;else{if(1===n)return[];r.splice(t,1),t--,n--}continue}r[t][2]=i,o>s&&r.push([e,s,o])}}}return r}}class iJ extends iK{#sW;#rb;constructor(t,e){super(),this.#rb=t,this.#sW=e}toSVGPath(){let t=[];for(let e of this.#rb){let[i,s]=e;t.push(`M${i} ${s}`);for(let r=2;r<e.length;r+=2){let n=e[r],a=e[r+1];n===i?(t.push(`V${a}`),s=a):a===s&&(t.push(`H${n}`),i=n)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,s,r,n]=t,a=[],o=r-i,l=n-s;for(let t of this.#rb){let e=Array(t.length);for(let s=0;s<t.length;s+=2)e[s]=i+t[s]*o,e[s+1]=n-t[s+1]*l;a.push(e)}return a}get box(){return this.#sW}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}class iZ extends iX{newFreeDrawOutline(t,e,i,s,r,n){return new i0(t,e,i,s,r,n)}get classNamesForDrawing(){return["highlight","free"]}}class i0 extends iY{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,i,s,r){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return new iZ(t,e,i,s,r,n)}}class i1{#rv=null;#ry=null;#rx;#rA=null;#rw=!1;#r_=!1;#n=null;#rE;#rS=null;#f=null;#rC;static #rT=null;static get _keyboardManager(){return W(this,"_keyboardManager",new tO([[["Escape","mac+Escape"],i1.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],i1.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],i1.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],i1.prototype._moveToPrevious],[["Home","mac+Home"],i1.prototype._moveToBeginning],[["End","mac+End"],i1.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#r_=!1,this.#rC=L.HIGHLIGHT_COLOR,this.#n=t):(this.#r_=!0,this.#rC=L.HIGHLIGHT_DEFAULT_COLOR),this.#f=t?._uiManager||e,this.#rE=this.#f._eventBus,this.#rx=t?.color||this.#f?.highlightColors.values().next().value||"#FFFF98",i1.#rT||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let t=this.#rv=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);let e=this.#f._signal;t.addEventListener("click",this.#rM.bind(this),{signal:e}),t.addEventListener("keydown",this.#i8.bind(this),{signal:e});let i=this.#ry=document.createElement("span");return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=this.#rx,t.append(i),t}renderMainDropdown(){let t=this.#rA=this.#rk();return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#rk(){let t=document.createElement("div"),e=this.#f._signal;for(let[i,s]of(t.addEventListener("contextmenu",tw,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#f.highlightColors)){let r=document.createElement("button");r.tabIndex="0",r.role="option",r.setAttribute("data-color",s),r.title=i,r.setAttribute("data-l10n-id",i1.#rT[i]);let n=document.createElement("span");r.append(n),n.className="swatch",n.style.backgroundColor=s,r.setAttribute("aria-selected",s===this.#rx),r.addEventListener("click",this.#rP.bind(this,s),{signal:e}),t.append(r)}return t.addEventListener("keydown",this.#i8.bind(this),{signal:e}),t}#rP(t,e){e.stopPropagation(),this.#rE.dispatch("switchannotationeditorparams",{source:this,type:this.#rC,value:t})}_colorSelectFromKeyboard(t){if(t.target===this.#rv)return void this.#rM(t);let e=t.target.getAttribute("data-color");e&&this.#rP(e,t)}_moveToNext(t){this.#rR?t.target===this.#rv?this.#rA.firstChild?.focus():t.target.nextSibling?.focus():this.#rM(t)}_moveToPrevious(t){if(t.target===this.#rA?.firstChild||t.target===this.#rv){this.#rR&&this._hideDropdownFromKeyboard();return}this.#rR||this.#rM(t),t.target.previousSibling?.focus()}_moveToBeginning(t){this.#rR?this.#rA.firstChild?.focus():this.#rM(t)}_moveToEnd(t){this.#rR?this.#rA.lastChild?.focus():this.#rM(t)}#i8(t){i1._keyboardManager.exec(this,t)}#rM(t){if(this.#rR)return void this.hideDropdown();if(this.#rw=0===t.detail,this.#rS||(this.#rS=new AbortController,window.addEventListener("pointerdown",this.#h.bind(this),{signal:this.#f.combinedSignal(this.#rS)})),this.#rA)return void this.#rA.classList.remove("hidden");let e=this.#rA=this.#rk();this.#rv.append(e)}#h(t){this.#rA?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#rA?.classList.add("hidden"),this.#rS?.abort(),this.#rS=null}get #rR(){return this.#rA&&!this.#rA.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#r_){if(!this.#rR)return void this.#n?.unselect();this.hideDropdown(),this.#rv.focus({preventScroll:!0,focusVisible:this.#rw})}}updateColor(t){if(this.#ry&&(this.#ry.style.backgroundColor=t),!this.#rA)return;let e=this.#f.highlightColors.values();for(let i of this.#rA.children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#rv?.remove(),this.#rv=null,this.#ry=null,this.#rA?.remove(),this.#rA=null}}class i2 extends tH{#rD=null;#rI=0;#rL;#rF=null;#r=null;#rN=null;#rO=null;#rj=0;#rB=null;#rz=null;#y=null;#rH=!1;#rU=null;#r$;#rG=null;#rV="";#s5;#rW="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=I.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=i2.prototype;return W(this,"_keyboardManager",new tO([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||i2._defaultColor,this.#s5=t.thickness||i2._defaultThickness,this.#r$=t.opacity||i2._defaultOpacity,this.#rL=t.boxes||null,this.#rW=t.methodOfCreation||"",this.#rV=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#rH=!0,this.#rq(t),this.#rK()):this.#rL&&(this.#rD=t.anchorNode,this.#rI=t.anchorOffset,this.#rO=t.focusNode,this.#rj=t.focusOffset,this.#rX(),this.#rK(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#rH?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#s5,methodOfCreation:this.#rW}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#rX(){let t=new iQ(this.#rL,.001);this.#rz=t.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#rz.box;let e=new iQ(this.#rL,.0025,.001,"ltr"===this._uiManager.direction);this.#rN=e.getOutlines();let{lastPoint:i}=this.#rN.box;this.#rU=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#rq(t){let{highlightOutlines:e,highlightId:i,clipPathId:s}=t;if(this.#rz=e,this.#rN=e.getNewOutline(this.#s5/2+1.5,.0025),i>=0)this.#y=i,this.#rF=s,this.parent.drawLayer.finalizeLine(i,e),this.#rG=this.parent.drawLayer.drawOutline(this.#rN);else if(this.parent){let t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#y,e),this.parent.drawLayer.updateBox(this.#y,i2.#rY(this.#rz.box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#rG,this.#rN),this.parent.drawLayer.updateBox(this.#rG,i2.#rY(this.#rN.box,t))}let{x:r,y:n,width:a,height:o}=e.box;switch(this.rotation){case 0:this.x=r,this.y=n,this.width=a,this.height=o;break;case 90:{let[t,e]=this.parentDimensions;this.x=n,this.y=1-r,this.width=a*e/t,this.height=o*t/e;break}case 180:this.x=1-r,this.y=1-n,this.width=a,this.height=o;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-n,this.y=r,this.width=a*e/t,this.height=o*t/e}}let{lastPoint:l}=this.#rN.box;this.#rU=[(l[0]-r)/a,(l[1]-n)/o]}static initialize(t,e){tH.initialize(t,e),i2._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case L.HIGHLIGHT_DEFAULT_COLOR:i2._defaultColor=e;break;case L.HIGHLIGHT_THICKNESS:i2._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#rU}updateParams(t,e){switch(t){case L.HIGHLIGHT_COLOR:this.#sj(e);break;case L.HIGHLIGHT_THICKNESS:this.#rQ(e)}}static get defaultPropertiesToUpdate(){return[[L.HIGHLIGHT_DEFAULT_COLOR,i2._defaultColor],[L.HIGHLIGHT_THICKNESS,i2._defaultThickness]]}get propertiesToUpdate(){return[[L.HIGHLIGHT_COLOR,this.color||i2._defaultColor],[L.HIGHLIGHT_THICKNESS,this.#s5||i2._defaultThickness],[L.HIGHLIGHT_FREE,this.#rH]]}#sj(t){let e=(t,e)=>{this.color=t,this.parent?.drawLayer.changeColor(this.#y,t),this.#r?.updateColor(t),this.#r$=e,this.parent?.drawLayer.changeOpacity(this.#y,e)},i=this.color,s=this.#r$;this.addCommands({cmd:e.bind(this,t,i2._defaultOpacity),undo:e.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:L.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#rQ(t){let e=this.#s5,i=t=>{this.#s5=t,this.#rJ(t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:L.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){let t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#r=new i1({editor:this}),t.addColorPicker(this.#r)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#rZ())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#rZ())}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#r0(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){!this.parent||(super.rebuild(),null!==this.div&&(this.#rK(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#r0():t&&(this.#rK(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#rJ(t){if(!this.#rH)return;this.#rq({highlightOutlines:this.#rz.getNewOutline(t/2)}),this.fixAndSetPosition();let[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}#r0(){null!==this.#y&&this.parent&&(this.parent.drawLayer.remove(this.#y),this.#y=null,this.parent.drawLayer.remove(this.#rG),this.#rG=null)}#rK(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===this.#y&&({id:this.#y,clipPathId:this.#rF}=t.drawLayer.draw(this.#rz,this.color,this.#r$),this.#rG=t.drawLayer.drawOutline(this.#rN),this.#rB&&(this.#rB.style.clipPath=this.#rF))}static #rY(t,e){let{x:i,y:s,width:r,height:n}=t;switch(e){case 90:return{x:1-s-n,y:i,width:n,height:r};case 180:return{x:1-i-r,y:1-s-n,width:r,height:n};case 270:return{x:s,y:1-i-r,width:n,height:r}}return{x:i,y:s,width:r,height:n}}rotate(t){let e,{drawLayer:i}
2=this.parent;this.#rH?(t=(t-this.rotation+360)%360,e=i2.#rY(this.#rz.box,t)):e=i2.#rY(this,t),i.rotate(this.#y,t),i.rotate(this.#rG,t),i.updateBox(this.#y,e),i.updateBox(this.#rG,i2.#rY(this.#rN.box,t))}render(){if(this.div)return this.div;let t=super.render();this.#rV&&(t.setAttribute("aria-label",this.#rV),t.setAttribute("role","mark")),this.#rH?t.classList.add("free"):this.div.addEventListener("keydown",this.#r1.bind(this),{signal:this._uiManager._signal});let e=this.#rB=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#rF;let[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),tI(this,this.#rB,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass(this.#rG,"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(this.#rG,"hovered")}#r1(t){i2._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#r2(!0);break;case 1:case 3:this.#r2(!1)}}#r2(t){if(!this.#rD)return;let e=window.getSelection();t?e.setPosition(this.#rD,this.#rI):e.setPosition(this.#rO,this.#rj)}select(){super.select(),this.#rG&&(this.parent?.drawLayer.removeClass(this.#rG,"hovered"),this.parent?.drawLayer.addClass(this.#rG,"selected"))}unselect(){super.unselect(),this.#rG&&(this.parent?.drawLayer.removeClass(this.#rG,"selected"),this.#rH||this.#r2(!1))}get _mustFixPosition(){return!this.#rH}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.show(this.#y,t),this.parent.drawLayer.show(this.#rG,t))}#rZ(){return this.#rH?this.rotation:0}#r5(){if(this.#rH)return null;let[t,e]=this.pageDimensions,[i,s]=this.pageTranslation,r=this.#rL,n=new Float32Array(8*r.length),a=0;for(let{x:o,y:l,width:h,height:d}of r){let r=o*t+i,c=(1-l-d)*e+s;n[a]=n[a+4]=r,n[a+1]=n[a+3]=c,n[a+2]=n[a+6]=r+h*t,n[a+5]=n[a+7]=c+d*e,a+=8}return n}#r3(t){return this.#rz.serialize(t,this.#rZ())}static startHighlighting(t,e,i){let{target:s,x:r,y:n}=i,{x:a,y:o,width:l,height:h}=s.getBoundingClientRect(),d=new AbortController,c=t.combinedSignal(d),u=e=>{d.abort(),this.#r6(t,e)};window.addEventListener("blur",u,{signal:c}),window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation()},{capture:!0,passive:!1,signal:c}),window.addEventListener("contextmenu",tw,{signal:c}),s.addEventListener("pointermove",this.#r4.bind(this,t),{signal:c}),this._freeHighlight=new iZ({x:r,y:n},[a,o,l,h],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static #r4(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static #r6(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,e,i){let s=null;if(t instanceof iB){let{data:{quadPoints:e,rect:i,rotation:r,id:n,color:a,opacity:o,popupRef:l},parent:{page:{pageNumber:h}}}=t;s=t={annotationType:I.HIGHLIGHT,color:Array.from(a),opacity:o,quadPoints:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:r,id:n,deleted:!1,popupRef:l}}else if(t instanceof ij){let{data:{inkLists:e,rect:i,rotation:r,id:n,color:a,borderStyle:{rawWidth:o},popupRef:l},parent:{page:{pageNumber:h}}}=t;s=t={annotationType:I.HIGHLIGHT,color:Array.from(a),thickness:o,inkLists:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:r,id:n,deleted:!1,popupRef:l}}let{color:r,quadPoints:n,inkLists:a,opacity:o}=t,l=await super.deserialize(t,e,i);l.color=ta.makeHexColor(...r),l.#r$=o||1,a&&(l.#s5=t.thickness),l.annotationElementId=t.id||null,l._initialData=s;let[h,d]=l.pageDimensions,[c,u]=l.pageTranslation;if(n){let t=l.#rL=[];for(let e=0;e<n.length;e+=8)t.push({x:(n[e]-c)/h,y:1-(n[e+1]-u)/d,width:(n[e+2]-n[e])/h,height:(n[e+1]-n[e+5])/d});l.#rX(),l.#rK(),l.rotate(l.rotation)}else if(a){l.#rH=!0;let t=a[0],i={x:t[0]-c,y:d-(t[1]-u)},s=new iZ(i,[0,0,h,d],1,l.#s5/2,!0,.001);for(let e=0,r=t.length;e<r;e+=2)i.x=t[e]-c,i.y=d-(t[e+1]-u),s.add(i);let{id:r,clipPathId:n}=e.drawLayer.draw(s,l.color,l._defaultOpacity,!0);l.#rq({highlightOutlines:s.getOutlines(),highlightId:r,clipPathId:n}),l.#rK()}return l}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=this.getRect(0,0),i=tH._colorManager.convert(this.color),s={annotationType:I.HIGHLIGHT,color:i,opacity:this.#r$,thickness:this.#s5,quadPoints:this.#r5(),outlines:this.#r3(e),pageIndex:this.pageIndex,rect:e,rotation:this.#rZ(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#sV(s)?null:(s.id=this.annotationElementId,s)}#sV(t){let{color:e}=this._initialData;return t.color.some((t,i)=>t!==e[i])}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class i5 extends tH{#r8=0;#r7=0;#r9=null;#nt=new Path2D;#ne=!1;#ni=null;#ns=!1;#nr=!1;#nn=null;#na=null;#no=0;#nl=0;#nh=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=I.INK;constructor(t){super({...t,name:"inkEditor"}),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,e){tH.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case L.INK_THICKNESS:i5._defaultThickness=e;break;case L.INK_COLOR:i5._defaultColor=e;break;case L.INK_OPACITY:i5._defaultOpacity=e/100}}updateParams(t,e){switch(t){case L.INK_THICKNESS:this.#rQ(e);break;case L.INK_COLOR:this.#sj(e);break;
2case L.INK_OPACITY:this.#nd(e)}}static get defaultPropertiesToUpdate(){return[[L.INK_THICKNESS,i5._defaultThickness],[L.INK_COLOR,i5._defaultColor||tH._defaultLineColor],[L.INK_OPACITY,Math.round(100*i5._defaultOpacity)]]}get propertiesToUpdate(){return[[L.INK_THICKNESS,this.thickness||i5._defaultThickness],[L.INK_COLOR,this.color||i5._defaultColor||tH._defaultLineColor],[L.INK_OPACITY,Math.round(100*(this.opacity??i5._defaultOpacity))]]}#rQ(t){let e=t=>{this.thickness=t,this.#nc()},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:L.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#sj(t){let e=t=>{this.color=t,this.#nu()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:L.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#nd(t){let e=t=>{this.opacity=t,this.#nu()};t/=100;let i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:L.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#np(),this.#ng()),this.isAttachedToDOM||(this.parent.add(this),this.#nf()),this.#nc()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#r9&&(clearTimeout(this.#r9),this.#r9=null),this.#nn?.disconnect(),this.#nn=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){let[t,e]=this.parentDimensions,i=this.width*t,s=this.height*e;this.setDimensions(i,s)}enableEditMode(){this.#ne||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.#nm())}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.#nb())}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#nv(){let{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}#ny(){let{ctx:t,color:e,opacity:i,thickness:s,parentScale:r,scaleFactor:n}=this;t.lineWidth=s*r/n,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${Math.round(Math.min(255,Math.max(1,255*i))).toString(16).padStart(2,"0")}`}#nx(t,e){this.canvas.addEventListener("contextmenu",tw,{signal:this._uiManager._signal}),this.#nb(),this.#ni=new AbortController;let i=this._uiManager.combinedSignal(this.#ni);this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,this.#nr||(this.#nr=!0,this.#nf(),this.thickness||=i5._defaultThickness,this.color||=i5._defaultColor||tH._defaultLineColor,this.opacity??=i5._defaultOpacity),this.currentPath.push([t,e]),this.#ns=!1,this.#ny(),this.#nh=()=>{this.#nA(),this.#nh&&window.requestAnimationFrame(this.#nh)},window.requestAnimationFrame(this.#nh)}#nw(t,e){let[i,s]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===s)return;let r=this.currentPath,n=this.#nt;if(r.push([t,e]),this.#ns=!0,r.length<=2){n.moveTo(...r[0]),n.lineTo(t,e);return}3===r.length&&(this.#nt=n=new Path2D,n.moveTo(...r[0])),this.#n_(n,...r.at(-3),...r.at(-2),t,e)}#nE(){if(0===this.currentPath.length)return;let t=this.currentPath.at(-1);this.#nt.lineTo(...t)}#nS(t,e){let i;if(this.#nh=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#nw(t,e),this.#nE(),1!==this.currentPath.length)i=this.#nC();else{let s=[t,e];i=[[s,s.slice(),s.slice(),s]]}let s=this.#nt,r=this.currentPath;this.currentPath=[],this.#nt=new Path2D;let n=()=>{this.allRawPaths.push(r),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},a=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#np(),this.#ng()),this.#nc())};this.addCommands({cmd:n,undo:a,mustExec:!0})}#nA(){if(!this.#ns)return;this.#ns=!1,this.thickness,this.parentScale;let t=this.currentPath.slice(-3);t.map(t=>t[0]),t.map(t=>t[1]);let{ctx:e}=this;for(let t of(e.save(),e.clearRect(0,0,this.canvas.width,this.canvas.height),this.bezierPath2D))e.stroke(t);
2e.stroke(this.#nt),e.restore()}#n_(t,e,i,s,r,n,a){let o=(e+s)/2,l=(i+r)/2,h=(s+n)/2,d=(r+a)/2;t.bezierCurveTo(o+2*(s-o)/3,l+2*(r-l)/3,h+2*(s-h)/3,d+2*(r-d)/3,h,d)}#nC(){let t,e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let i=[],[s,r]=e[0];for(t=1;t<e.length-2;t++){let[n,a]=e[t],[o,l]=e[t+1],h=(n+o)/2,d=(a+l)/2,c=[s+2*(n-s)/3,r+2*(a-r)/3],u=[h+2*(n-h)/3,d+2*(a-d)/3];i.push([[s,r],c,u,[h,d]]),[s,r]=[h,d]}let[n,a]=e[t],[o,l]=e[t+1],h=[s+2*(n-s)/3,r+2*(a-r)/3];return i.push([[s,r],h,[o+2*(n-o)/3,l+2*(a-l)/3],[o,l]]),i}#nu(){if(this.isEmpty())return void this.#nT();this.#ny();let{canvas:t,ctx:e}=this;for(let i of(e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),this.#nT(),this.bezierPath2D))e.stroke(i)}commit(){this.#ne||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#ne=!0,this.div.classList.add("disabled"),this.#nc(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}#nm(){if(this.#na)return;this.#na=new AbortController;let t=this._uiManager.combinedSignal(this.#na);this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})}#nb(){this.pointerdownAC?.abort(),this.pointerdownAC=null}canvasPointerdown(t){0===t.button&&this.isInEditMode()&&!this.#ne&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#nx(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#nw(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#nM(t)}canvasPointerleave(t){this.#nM(t)}#nM(t){this.#ni?.abort(),this.#ni=null,this.#nm(),this.#r9&&clearTimeout(this.#r9),this.#r9=setTimeout(()=>{this.#r9=null,this.canvas.removeEventListener("contextmenu",tw)},10),this.#nS(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#np(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#ng(){this.#nn=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}),this.#nn.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#nn?.disconnect(),this.#nn=null},{once:!0})}get isResizable(){return!this.isEmpty()&&this.#ne}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");let[i,s,r,n]=this.#nv();if(this.setAt(i,s,0,0),this.setDims(r,n),this.#np(),this.width){let[i,s]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*s),this.setAt(t*i,e*s,this.width*i,this.height*s),this.#nr=!0,this.#nf(),this.setDims(this.width*i,this.height*s),this.#nu(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#ng(),this.div}#nf(){if(!this.#nr)return;let[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#nT()}setDimensions(t,e){let i=Math.round(t),s=Math.round(e);if(this.#no===i&&this.#nl===s)return;this.#no=i,this.#nl=s,this.canvas.style.visibility="hidden";let[r,n]=this.parentDimensions;this.width=t/r,this.height=e/n,this.fixAndSetPosition(),this.#ne&&this.#nk(t,e),this.#nf(),this.#nu(),this.canvas.style.visibility="visible",this.fixDims()}#nk(t,e){let i=this.#nP(),s=(t-i)/this.#r7,r=(e-i)/this.#r8;this.scaleFactor=Math.min(s,r)}#nT(){let t=this.#nP()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static #nR(t){let e=new Path2D;for(let i=0,s=t.length;i<s;i++){let[s,r,n,a]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(r[0],r[1],n[0],n[1],a[0],a[1])}return e}static #nD(t,e,i){let[s,r,n,a]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=s,t[e+1]=a-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]+s,t[e+1]=i+r}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=n-t[e],t[e+1]+=r;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=n-t[e+1],t[e+1]=a-i}break;default:throw Error("Invalid rotation")}return t}static #nI(t,e,i){let[s,r,n,a]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=s,t[e+1]=a-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]-r,t[e+1]=i-s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=n-t[e],t[e+1]-=r;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=a-t[e+1],t[e+1]=n-i}break;default:throw Error("Invalid rotation")}return t}#nL(t,e,i,s){let r=[],n=this.thickness/2,a=t*e+n,o=t*i+n;for(let e of this.paths){let i=[],n=[];for(let s=0,r=e.length;s<r;s++){let[l,h,d,c]=e[s];if(l[0]===c[0]&&l[1]===c[1]&&1===r){let e=t*l[0]+a,s=t*l[1]+o;i.push(e,s),n.push(e,s);break}let u=t*l[0]+a,p=t*l[1]+o,g=t*h[0]+a,f=t*h[1]+o,m=t*d[0]+a,b=t*d[1]+o,v=t*c[0]+a,y=t*c[1]+o;0===s&&(i.push(u,p),n.push(u,p)),i.push(g,f,m,b,v,y),n.push(g,f),s===r-1&&n.push(v,y)}r.push({bezier:i5.#nD(i,s,this.rotation),points:i5.#nD(n,s,this.rotation)})}return r}#nF(){let t=1/0,e=-1/0,i=1/0,s=-1/0;for(let r of this.paths)for(let[n,a,o,l]of r){let r=ta.bezierBoundingBox(...n,...a,...o,...l);t=Math.min(t,r[0]),i=Math.min(i,r[1]),e=Math.max(e,r[2]),s=Math.max(s,r[3])}return[t,i,e,s]}#nP(){return this.#ne?Math.ceil(this.thickness*this.parentScale):0}#nc(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!this.#ne)return void this.#nu();let e=this.#nF(),i=this.#nP();this.#r7=Math.max(tH.MIN_SIZE,e[2]-e[0]),this.#r8=Math.max(tH.MIN_SIZE,e[3]-e[1]);let s=Math.ceil(i+this.#r7*this.scaleFactor),r=Math.ceil(i+this.#r8*this.scaleFactor),[n,a]=this.parentDimensions;this.width=s/n,this.height=r/a,this.setAspectRatio(s,r);let o=this.translationX,l=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#nf(),this.#nu(),this.#no=s,this.#nl=r,this.setDims(s,r);let h=t?i/this.scaleFactor/2:0;this.translate(o-this.translationX-h,l-this.translationY-h)}static async deserialize(t,e,i){if(t instanceof ij)return null;let s=await super.deserialize(t,e,i);s.thickness=t.thickness,s.color=ta.makeHexColor(...t.color),s.opacity=t.opacity;let[r,n]=s.pageDimensions,a=s.width*r,o=s.height*n,l=s.parentScale,h=t.thickness/2;s.#ne=!0,s.#no=Math.round(a),s.#nl=Math.round(o);let{paths:d,rect:c,rotation:u}=t;for(let{bezier:t}of d){t=i5.#nI(t,c,u);let e=[];s.paths.push(e);
2let i=l*(t[0]-h),r=l*(t[1]-h);for(let s=2,n=t.length;s<n;s+=6){let n=l*(t[s]-h),a=l*(t[s+1]-h),o=l*(t[s+2]-h),d=l*(t[s+3]-h),c=l*(t[s+4]-h),u=l*(t[s+5]-h);e.push([[i,r],[n,a],[o,d],[c,u]]),i=c,r=u}let n=this.#nR(e);s.bezierPath2D.push(n)}let p=s.#nF();return s.#r7=Math.max(tH.MIN_SIZE,p[2]-p[0]),s.#r8=Math.max(tH.MIN_SIZE,p[3]-p[1]),s.#nk(a,o),s}serialize(){if(this.isEmpty())return null;let t=this.getRect(0,0),e=tH._colorManager.convert(this.ctx.strokeStyle);return{annotationType:I.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:this.#nL(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class i3 extends tH{#nN=null;#nO=null;#nj=null;#nB=null;#nz=null;#nH="";#nU=null;#nn=null;#n$=null;#nG=!1;#nV=!1;static _type="stamp";static _editorType=I.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#nB=t.bitmapUrl,this.#nz=t.bitmapFile}static initialize(t,e){tH.initialize(t,e)}static get supportedTypes(){return W(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>`image/${t}`))}static get supportedTypesStr(){return W(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(I.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#nW(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(this.#nN=t.bitmap,e||(this.#nO=t.id,this.#nG=t.isSvg),t.file&&(this.#nH=t.file.name),this.#np()):this.remove()}#nq(){if(this.#nj=null,this._uiManager.enableWaiting(!1),this.#nU){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#nN){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#nN){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw Error("No ML.");if(!await i.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:s,width:r,height:n}=t||this.copyCanvas(null,null,!0).imageData,a=await i.guess({name:"altText",request:{data:s,width:r,height:n,channels:s.length/(r*n)}});if(!a)throw Error("No response from the AI service.");if(a.error)throw Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw Error("No valid response from the AI service.");let o=a.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}#nK(){if(this.#nO){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#nO).then(t=>this.#nW(t,!0)).finally(()=>this.#nq());return}if(this.#nB){let t=this.#nB;this.#nB=null,this._uiManager.enableWaiting(!0),this.#nj=this._uiManager.imageManager.getFromUrl(t).then(t=>this.#nW(t)).finally(()=>this.#nq());return}if(this.#nz){let t=this.#nz;this.#nz=null,this._uiManager.enableWaiting(!0),this.#nj=this._uiManager.imageManager.getFromFile(t).then(t=>this.#nW(t)).finally(()=>this.#nq());return}let t=document.createElement("input");t.type="file",t.accept=i3.supportedTypesStr;let e=this._uiManager._signal;this.#nj=new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);let e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}
2),this.#nW(e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>this.#nq()),t.click()}remove(){this.#nO&&(this.#nN=null,this._uiManager.imageManager.deleteId(this.#nO),this.#nU?.remove(),this.#nU=null,this.#nn?.disconnect(),this.#nn=null,this.#n$&&(clearTimeout(this.#n$),this.#n$=null)),super.remove()}rebuild(){if(!this.parent){this.#nO&&this.#nK();return}super.rebuild(),null!==this.div&&(this.#nO&&null===this.#nU&&this.#nK(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#nj||this.#nN||this.#nB||this.#nz||this.#nO)}get isResizable(){return!0}render(){let t,e;if(this.div)return this.div;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#nN?this.#np():this.#nK(),this.width&&!this.annotationElementId){let[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}#np(){let{div:t}=this,{width:e,height:i}=this.#nN,[s,r]=this.pageDimensions;if(this.width)e=this.width*s,i=this.height*r;else if(e>.75*s||i>.75*r){let t=Math.min(.75*s/e,.75*r/i);e*=t,i*=t}let[n,a]=this.parentDimensions;this.setDims(e*n/s,i*a/r),this._uiManager.enableWaiting(!1);let o=this.#nU=document.createElement("canvas");o.setAttribute("role","img"),this.addContainer(o),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),this.#nX(e,i),this.#ng(),this.#nV||(this.parent.addUndoableEditor(this),this.#nV=!0),this._reportTelemetry({action:"inserted_image"}),this.#nH&&o.setAttribute("aria-label",this.#nH)}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);let{width:s,height:r}=this.#nN,n=new tP,a=this.#nN,o=s,l=r,h=null;if(e){if(s>e||r>e){let t=Math.min(e/s,e/r);o=Math.floor(s*t),l=Math.floor(r*t)}let t=(h=document.createElement("canvas")).width=Math.ceil(o*n.sx),i=h.height=Math.ceil(l*n.sy);this.#nG||(a=this.#nY(t,i));let d=h.getContext("2d");d.filter=this._uiManager.hcmFilter;let c="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(c="#8f8f9d",u="#42414d");let p=15*n.sx,g=15*n.sy,f=new OffscreenCanvas(2*p,2*g),m=f.getContext("2d");m.fillStyle=c,m.fillRect(0,0,2*p,2*g),m.fillStyle=u,m.fillRect(0,0,p,g),m.fillRect(p,g,p,g),d.fillStyle=d.createPattern(f,"repeat"),d.fillRect(0,0,t,i),d.drawImage(a,0,0,a.width,a.height,0,0,t,i)}let d=null;if(i){let e,i;if(n.symmetric&&a.width<t&&a.height<t)e=a.width,i=a.height;else if(a=this.#nN,s>t||r>t){let n=Math.min(t/s,t/r);e=Math.floor(s*n),i=Math.floor(r*n),this.#nG||(a=this.#nY(e,i))}let o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(a,0,0,a.width,a.height,0,0,e,i),d={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:h,width:o,height:l,imageData:d}}#nQ(t,e){let[i,s]=this.parentDimensions;this.width=t/i,this.height=e/s,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#n$&&clearTimeout(this.#n$),this.#n$=setTimeout(()=>{this.#n$=null,this.#nX(t,e)},200)}#nY(t,e){let{width:i,height:s}=this.#nN,r=i,n=s,a=this.#nN;for(;r>2*t||n>2*e;){let i=r,s=n;r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2)),n>2*e&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));let o=new OffscreenCanvas(r,n);o.getContext("2d").drawImage(a,0,0,i,s,0,0,r,n),a=o.transferToImageBitmap()}return a}#nX(t,e){let i=new tP,s=Math.ceil(t*i.sx),r=Math.ceil(e*i.sy),n=this.#nU;if(!n||n.width===s&&n.height===r)return;n.width=s,n.height=r;let a=this.#nG?this.#nN:this.#nY(s,r),o=n.getContext("2d");o.filter=this._uiManager.hcmFilter,o.drawImage(a,0,0,a.width,a.height,0,0,s,r)}getImageForAltText(){return this.#nU}#nJ(t){if(t){if(this.#nG){let t=this._uiManager.imageManager.getSvgUrl(this.#nO);if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#nN,t.getContext("2d").drawImage(this.#nN,0,0),t.toDataURL()}if(this.#nG){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*tu.PDF_TO_CSS_UNITS),s=Math.round(this.height*e*tu.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(i,s);return r.getContext("2d").drawImage(this.#nN,0,0,this.#nN.width,this.#nN.height,0,0,i,s),r.transferToImageBitmap()}return structuredClone(this.#nN)}#ng(){this._uiManager._signal&&(this.#nn=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.#nQ(e.width,e.height)}),this.#nn.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#nn?.disconnect(),this.#nn=null},{once:!0}))}static async deserialize(t,e,i){let s=null;if(t instanceof i$){let{data:{rect:r,rotation:n,id:a,structParent:o,popupRef:l},container:h,parent:{page:{pageNumber:d}}}=t,c=h.querySelector("canvas"),u=i.imageManager.getFromCanvas(h.id,c);c.remove();let p=(await e._structTree.getAriaAttributes(`${td}${a}`))?.get("aria-label")||"";s=t={annotationType:I.STAMP,bitmapId:u.id,bitmap:u.bitmap,pageIndex:d-1,rect:r.slice(0),rotation:n,id:a,deleted:!1,accessibilityData:{decorative:!1,altText:p},isSvg:!1,structParent:o,popupRef:l}}let r=await super.deserialize(t,e,i),{rect:n,bitmap:a,bitmapUrl:o,bitmapId:l,isSvg:h,accessibilityData:d}=t;l&&i.imageManager.isValidId(l)?(r.#nO=l,a&&(r.#nN=a)):r.#nB=o,r.#nG=h;let[c,u]=r.pageDimensions;
2return r.width=(n[2]-n[0])/c,r.height=(n[3]-n[1])/u,r.annotationElementId=t.id||null,d&&(r.altTextData=d),r._initialData=s,r.#nV=!!s,r}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i={annotationType:I.STAMP,bitmapId:this.#nO,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#nG,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#nJ(!0),i.accessibilityData=this.serializeAltText(!0),i;let{decorative:s,altText:r}=this.serializeAltText(!1);if(!s&&r&&(i.accessibilityData={type:"Figure",alt:r}),this.annotationElementId){let t=this.#sV(i);if(t.isSame)return null;t.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,null===e)return i;e.stamps||=new Map;let n=this.#nG?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#nO)){if(this.#nG){let t=e.stamps.get(this.#nO);n>t.area&&(t.area=n,t.serialized.bitmap.close(),t.serialized.bitmap=this.#nJ(!1))}}else e.stamps.set(this.#nO,{area:n,serialized:i}),i.bitmap=this.#nJ(!1);return i}#sV(t){let{rect:e,pageIndex:i,accessibilityData:{altText:s}}=this._initialData,r=t.rect.every((t,i)=>1>Math.abs(t-e[i])),n=t.pageIndex===i,a=(t.accessibilityData?.alt||"")===s;return{isSame:r&&n&&a,isSameAltText:a}}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}class i6{#sM;#nZ=!1;#n0=null;#n1=null;#n2=null;#n5=new Map;#n3=!1;#n6=!1;#n4=!1;#n8=null;#n7=null;#f;static _initialized=!1;static #z=new Map([iq,i5,i3,i2].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:s,accessibilityManager:r,annotationLayer:n,drawLayer:a,textLayer:o,viewport:l,l10n:h}){const d=[...i6.#z.values()];if(!i6._initialized)for(const e of(i6._initialized=!0,d))e.initialize(h,t);t.registerEditorTypes(d),this.#f=t,this.pageIndex=e,this.div=i,this.#sM=r,this.#n0=n,this.viewport=l,this.#n8=o,this.drawLayer=a,this._structTree=s,this.#f.addLayer(this)}get isEmpty(){return 0===this.#n5.size}get isInvisible(){return this.isEmpty&&this.#f.getMode()===I.NONE}updateToolbar(t){this.#f.updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#f.getMode();switch(this.#n9(),t){case I.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case I.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case I.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;for(let i of i6.#z.values())e.toggle(`${i._type}Editing`,t===i._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#n8?.div}addInkEditorIfNeeded(t){if(this.#f.getMode()===I.INK){if(!t){for(let t of this.#n5.values())if(t.isEmpty())return void t.setInBackground()}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#f.setEditingState(t)}addCommands(t){this.#f.addCommands(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#n0?.div.classList.toggle("disabled",!t)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);let t=new Set;for(let e of this.#n5.values())e.enableEditing(),e.show(!0),e.annotationElementId&&(this.#f.removeChangedExistingAnnotation(e),t.add(e.annotationElementId));if(this.#n0)for(let e of this.#n0.getEditableAnnotations()){if(e.hide(),this.#f.isDeletedAnnotationElement(e.data.id)||t.has(e.data.id))continue;let i=await this.deserialize(e);
2i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){this.#n4=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);let t=new Map,e=new Map;for(let i of this.#n5.values())if(i.disableEditing(),i.annotationElementId){if(null!==i.serialize()){t.set(i.annotationElementId,i);continue}e.set(i.annotationElementId,i),this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()}if(this.#n0)for(let i of this.#n0.getEditableAnnotations()){let{id:s}=i.data;if(this.#f.isDeletedAnnotationElement(s))continue;let r=e.get(s);if(r){r.resetAnnotationElement(i),r.show(!1),i.show();continue}(r=t.get(s))&&(this.#f.addChangedExistingAnnotation(r),r.renderAnnotationElement(i)&&r.show(!1)),i.show()}this.#n9(),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let t of i6.#z.values())i.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#n4=!1}getEditableAnnotation(t){return this.#n0?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#f.getActive()!==t&&this.#f.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#n8?.div&&!this.#n7){this.#n7=new AbortController;let t=this.#f.combinedSignal(this.#n7);this.#n8.div.addEventListener("pointerdown",this.#at.bind(this),{signal:t}),this.#n8.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#n8?.div&&this.#n7&&(this.#n7.abort(),this.#n7=null,this.#n8.div.classList.remove("highlighting"))}#at(t){this.#f.unselectAll();let{target:e}=t;if(e===this.#n8.div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&this.#n8.div.contains(e)){let{isMac:e}=tr.platform;if(0!==t.button||t.ctrlKey&&e)return;this.#f.showAllEditors("highlight",!0,!0),this.#n8.div.classList.add("free"),this.toggleDrawing(),i2.startHighlighting(this,"ltr"===this.#f.direction,{target:this.#n8.div,x:t.x,y:t.y}),this.#n8.div.addEventListener("pointerup",()=>{this.#n8.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#f._signal}),t.preventDefault()}}enableClick(){if(this.#n1)return;this.#n1=new AbortController;let t=this.#f.combinedSignal(this.#n1);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){this.#n1?.abort(),this.#n1=null}attach(t){this.#n5.set(t.id,t);let{annotationElementId:e}=t;e&&this.#f.isDeletedAnnotationElement(e)&&this.#f.removeDeletedAnnotationElement(t)}detach(t){this.#n5.delete(t.id),this.#sM?.removePointerInTextLayer(t.contentDiv),!this.#n4&&t.annotationElementId&&this.#f.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#f.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#n6||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#f.addDeletedAnnotationElement(t.annotationElementId),tH.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#f.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#f.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#n2&&(t._focusEventsAllowed=!1,this.#n2=setTimeout(()=>{this.#n2=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#f._signal}),e.focus())},0)),t._structTreeParentId=this.#sM?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#f.getId()}get #ae(){return i6.#z.get(this.#f.getMode())}combinedSignal(t){return this.#f.combinedSignal(t)}#ai(t){let e=this.#ae;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#ae?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#f.updateToolbar(t),this.#f.updateMode(t);let{offsetX:i,offsetY:s}=this.#as(),r=this.getNextId(),n=this.#ai({parent:this,id:r,x:i,y:s,uiManager:this.#f,isCentered:!0,...e});n&&this.add(n)}async deserialize(t){return await i6.#z.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#f)||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=this.getNextId(),r=this.#ai({parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:this.#f,isCentered:e,...i});return r&&this.add(r),r}#as(){let{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),r=Math.max(0,t),n=Math.max(0,e),a=Math.min(window.innerWidth,t+i),o=Math.min(window.innerHeight,e+s),l=(r+a)/2-t,h=(n+o)/2-e,[d,c]=this.viewport.rotation%180==0?[l,h]:[h,l];return{offsetX:d,offsetY:c}}addNewEditor(){this.createAndAddNewEditor(this.#as(),!0)}setSelected(t){this.#f.setSelected(t)}toggleSelected(t){this.#f.toggleSelected(t)}unselect(t){this.#f.unselect(t)}pointerup(t){let{isMac:e}=tr.platform;if(0===t.button&&(!t.ctrlKey||!e)&&t.target===this.div&&this.#n3){if(this.#n3=!1,!this.#nZ){this.#nZ=!0;return}if(this.#f.getMode()===I.STAMP)return void this.#f.unselectAll();this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(this.#f.getMode()===I.HIGHLIGHT&&this.enableTextSelection(),this.#n3){this.#n3=!1;return}let{isMac:e}=tr.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div)return;this.#n3=!0;let i=this.#f.getActive();this.#nZ=!i||i.isEmpty()}findNewParent(t,e,i){let s=this.#f.findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){for(let t of(this.#f.getActive()?.parent===this&&(this.#f.commitOrRemove(),this.#f.setActiveEditor(null)),this.#n2&&(clearTimeout(this.#n2),this.#n2=null),this.#n5.values())
2)this.#sM?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#n5.clear(),this.#f.removeLayer(this)}#n9(){for(let t of(this.#n6=!0,this.#n5.values()))t.isEmpty()&&t.remove();this.#n6=!1}render(t){let{viewport:e}=t;for(let t of(this.viewport=e,tk(this.div,e),this.#f.getEditors(this.pageIndex)))this.add(t),t.rebuild();this.updateMode()}update(t){let{viewport:e}=t;this.#f.commitOrRemove(),this.#n9();let i=this.viewport.rotation,s=e.rotation;if(this.viewport=e,tk(this.div,{rotation:s}),i!==s)for(let t of this.#n5.values())t.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#f.viewParameters.realScale}}class i4{#sl=null;#y=0;#ar=new Map;#an=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#sl){this.#sl=t;return}if(this.#sl!==t){if(this.#ar.size>0)for(let e of this.#ar.values())e.remove(),t.append(e);this.#sl=t}}static get _svgFactory(){return W(this,"_svgFactory",new ip)}static #aa(t){let{x:e=0,y:i=0,width:s=1,height:r=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{style:n}=t;n.top=`${100*i}%`,n.left=`${100*e}%`,n.width=`${100*s}%`,n.height=`${100*r}%`}#ao(t){let e=i4._svgFactory.create(1,1,!0);return this.#sl.append(e),e.setAttribute("aria-hidden",!0),i4.#aa(e,t),e}#al(t,e){let i=i4._svgFactory.createElement("clipPath");t.append(i);let s=`clip_${e}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let r=i4._svgFactory.createElement("use");return i.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),s}draw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=this.#y++,n=this.#ao(t.box);n.classList.add(...t.classNamesForDrawing);let a=i4._svgFactory.createElement("defs");n.append(a);let o=i4._svgFactory.createElement("path");a.append(o);let l=`path_p${this.pageIndex}_${r}`;o.setAttribute("id",l),o.setAttribute("d",t.toSVGPath()),s&&this.#an.set(r,o);let h=this.#al(a,l),d=i4._svgFactory.createElement("use");return n.append(d),n.setAttribute("fill",e),n.setAttribute("fill-opacity",i),d.setAttribute("href",`#${l}`),this.#ar.set(r,n),{id:r,clipPathId:`url(#${h})`}}drawOutline(t){let e,i=this.#y++,s=this.#ao(t.box);s.classList.add(...t.classNamesForOutlining);let r=i4._svgFactory.createElement("defs");s.append(r);let n=i4._svgFactory.createElement("path");r.append(n);let a=`path_p${this.pageIndex}_${i}`;if(n.setAttribute("id",a),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke"),t.mustRemoveSelfIntersections){let t=i4._svgFactory.createElement("mask");r.append(t),e=`mask_p${this.pageIndex}_${i}`,t.setAttribute("id",e),t.setAttribute("maskUnits","objectBoundingBox");let s=i4._svgFactory.createElement("rect");t.append(s),s.setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","white");let n=i4._svgFactory.createElement("use");t.append(n),n.setAttribute("href",`#${a}`),n.setAttribute("stroke","none"),n.setAttribute("fill","black"),n.setAttribute("fill-rule","nonzero"),n.classList.add("mask")}let o=i4._svgFactory.createElement("use");s.append(o),o.setAttribute("href",`#${a}`),e&&o.setAttribute("mask",`url(#${e})`);let l=o.cloneNode();return s.append(l),o.classList.add("mainOutline"),l.classList.add("secondaryOutline"),this.#ar.set(i,s),i}finalizeLine(t,e){let i=this.#an.get(t);this.#an.delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#ar.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){this.#an.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){i4.#aa(this.#ar.get(t),e)}show(t,e){this.#ar.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#ar.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#ar.get(t).setAttribute("fill",e)}changeOpacity(t,e){this.#ar.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#ar.get(t).classList.add(e)}removeClass(t,e){this.#ar.get(t).classList.remove(e)}getSVGRoot(t){return this.#ar.get(t)}remove(t){this.#an.delete(t),null!==this.#sl&&(this.#ar.get(t).remove(),this.#ar.delete(t))}
2destroy(){for(let t of(this.#sl=null,this.#ar.values()))t.remove();this.#ar.clear(),this.#an.clear()}}var i8=M.AbortException,i7=M.AnnotationEditorLayer,i9=M.AnnotationEditorParamsType,st=M.AnnotationEditorType,se=M.AnnotationEditorUIManager,si=M.AnnotationLayer,ss=M.AnnotationMode,sr=M.ColorPicker,sn=M.DOMSVGFactory,sa=M.DrawLayer,so=M.FeatureTest,sl=M.GlobalWorkerOptions,sh=M.ImageKind,sd=M.InvalidPDFException,sc=M.MissingPDFException,su=M.OPS,sp=M.OutputScale,sg=M.PDFDataRangeTransport,sf=M.PDFDateString,sm=M.PDFWorker,sb=M.PasswordResponses,sv=M.PermissionFlag,sy=M.PixelsPerInch,sx=M.RenderingCancelledException,sA=M.TextLayer,sw=M.UnexpectedResponseException,s_=M.Util,sE=M.VerbosityLevel,sS=M.XfaLayer,sC=M.build,sT=M.createValidAbsoluteUrl,sM=M.fetchData,sk=M.getDocument,sP=M.getFilenameFromUrl,sR=M.getPdfFilenameFromUrl,sD=M.getXfaPageViewport,sI=M.isDataScheme,sL=M.isPdfFile,sF=M.noContextMenu,sN=M.normalizeUnicode,sO=M.setLayerDimensions,sj=M.shadow,sB=M.version;t.s(["AbortException",0,i8,"AnnotationEditorLayer",0,i7,"AnnotationEditorParamsType",0,i9,"AnnotationEditorType",0,st,"AnnotationEditorUIManager",0,se,"AnnotationLayer",0,si,"AnnotationMode",0,ss,"ColorPicker",0,sr,"DOMSVGFactory",0,sn,"DrawLayer",0,sa,"FeatureTest",0,so,"GlobalWorkerOptions",0,sl,"ImageKind",0,sh,"InvalidPDFException",0,sd,"MissingPDFException",0,sc,"OPS",0,su,"OutputScale",0,sp,"PDFDataRangeTransport",0,sg,"PDFDateString",0,sf,"PDFWorker",0,sm,"PasswordResponses",0,sb,"PermissionFlag",0,sv,"PixelsPerInch",0,sy,"RenderingCancelledException",0,sx,"TextLayer",0,sA,"UnexpectedResponseException",0,sw,"Util",0,s_,"VerbosityLevel",0,sE,"XfaLayer",0,sS,"build",0,sC,"createValidAbsoluteUrl",0,sT,"fetchData",0,sM,"getDocument",0,sk,"getFilenameFromUrl",0,sP,"getPdfFilenameFromUrl",0,sR,"getXfaPageViewport",0,sD,"isDataScheme",0,sI,"isPdfFile",0,sL,"noContextMenu",0,sF,"normalizeUnicode",0,sN,"setLayerDimensions",0,sO,"shadow",0,sj,"version",0,sB],207627);var sz=t.i(207627);let sH=(0,i.createContext)(null);function sU(t){let{children:i,type:s}=t;return(0,e.jsx)("div",{className:`react-pdf__message react-pdf__message--${s}`,children:i})}class s${constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return A(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){A(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{A(this.pdfDocument,"PDF document not loaded."),A(t,"Destination is not specified."),"string"==typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(t=>{A(Array.isArray(t),`"${t}" is not a valid destination array.`);let e=t[0];new Promise(t=>{A(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then(e=>{t(e)}).catch(()=>{A(!1,`"${e}" is not a valid page reference.`)}):"number"==typeof e?t(e):A(!1,`"${e}" is not a valid destination reference.`)}).then(e=>{let i=e+1;A(this.pdfViewer,"PDF viewer is not initialized."),A(i>=1&&i<=this.pagesCount,`"${i}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){A(this.pdfViewer,"PDF viewer is not initialized."),A(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t-1,pageNumber:t})}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}let sG="u">typeof window,sV=sG&&"file:"===window.location.protocol;function sW(t){return null!=t}function sq(t){return"string"==typeof t&&/^data:/.test(t)}function sK(t){A(sq(t),"Invalid data URI.");let[e="",i=""]=t.split(",");return -1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function sX(){(0,w.default)(!sV,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.")}function sY(t){(null==t?void 0:t.cancel)&&t.cancel()}function sQ(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}function sJ(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function sZ(){return(0,i.useReducer)(sJ,{value:void 0,error:void 0})}var s0=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&0>e.indexOf(s)&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)0>e.indexOf(s[r])&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]]);return i};let{PDFDataRangeTransport:s1}=sz,s2=(t,e)=>{switch(e){case 1:t(prompt("Enter the password to open this PDF file."));break;case 2:t(prompt("Invalid password. Please try again."))}};function s5(t){return"object"==typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}let s3=(0,i.forwardRef)(function(t,s){var{children:r,className:n,error:a="Failed to load PDF file.",externalLinkRel:o,externalLinkTarget:l,file:h,inputRef:d,imageResourcesPath:c,loading:u="Loading PDFâ¦",noData:p="No PDF file specified.",onItemClick:g,onLoadError:f,onLoadProgress:m,onLoadSuccess:x,onPassword:_=s2,onSourceError:E,onSourceSuccess:C,options:T,renderMode:M,rotate:k}=t,P=s0(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);
2let[R,D]=sZ(),{value:I,error:L}=R,[F,N]=sZ(),{value:O,error:j}=F,B=(0,i.useRef)(new s$),z=(0,i.useRef)([]),H=(0,i.useRef)(void 0),U=(0,i.useRef)(void 0);h&&h!==H.current&&s5(h)&&((0,w.default)(!S(h,H.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),H.current=h),T&&T!==U.current&&((0,w.default)(!S(T,U.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),U.current=T);let $=(0,i.useRef)({scrollPageIntoView:t=>{let{dest:e,pageNumber:i,pageIndex:s=i-1}=t;if(g)return void g({dest:e,pageIndex:s,pageNumber:i});let r=z.current[s];r?r.scrollIntoView():(0,w.default)(!1,`An internal link leading to page ${i} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});(0,i.useImperativeHandle)(s,()=>({linkService:B,pages:z,viewer:$}),[]),(0,i.useEffect)(function(){D({type:"RESET"})},[h,D]);let G=(0,i.useCallback)(()=>{var t,e,i,s;return t=this,e=void 0,i=void 0,s=function*(){if(!h)return null;if("string"==typeof h)return sq(h)?{data:sK(h)}:(sX(),{url:h});if(h instanceof s1)return{range:h};if(h instanceof ArrayBuffer)return{data:h};if(sG&&(A(sG,"isBlob can only be used in a browser environment"),h instanceof Blob))return{data:yield new Promise((t,e)=>{let i=new FileReader;i.onload=()=>{if(!i.result)return e(Error("Error while reading a file."));t(i.result)},i.onerror=t=>{if(!t.target)return e(Error("Error while reading a file."));let{error:i}=t.target;if(!i)return e(Error("Error while reading a file."));switch(i.code){case i.NOT_FOUND_ERR:return e(Error("Error while reading a file: File not found."));case i.SECURITY_ERR:return e(Error("Error while reading a file: Security error."));case i.ABORT_ERR:return e(Error("Error while reading a file: Aborted."));default:return e(Error("Error while reading a file."))}},i.readAsArrayBuffer(h)})};if(A("object"==typeof h,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),A(s5(h),"Invalid parameter object: need either .data, .range or .url"),"url"in h&&"string"==typeof h.url){if(sq(h.url)){let{url:t}=h,e=s0(h,["url"]);return Object.assign({data:sK(t)},e)}sX()}return h},new(i||(i=Promise))(function(r,n){function a(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(a,o)}l((s=s.apply(t,e||[])).next())})},[h]);(0,i.useEffect)(()=>{let t=v(G());return t.promise.then(t=>{D({type:"RESOLVE",value:t})}).catch(t=>{D({type:"REJECT",error:t})}),()=>{sY(t)}},[G,D]),(0,i.useEffect)(()=>{if(void 0!==I){if(!1===I)return void(L&&((0,w.default)(!1,L.toString()),E&&E(L)));C&&C()}},[I]),(0,i.useEffect)(function(){N({type:"RESET"})},[N,I]),(0,i.useEffect)(function(){if(!I)return;let t=T?Object.assign(Object.assign({},I),T):I,e=sz.getDocument(t);m&&(e.onProgress=m),_&&(e.onPassword=_);let i=e.promise.then(t=>{N({type:"RESOLVE",value:t})}).catch(t=>{e.destroyed||N({type:"REJECT",error:t})});return()=>{i.finally(()=>e.destroy())}},[T,N,I]),(0,i.useEffect)(()=>{if(void 0!==O){if(!1===O)return void(j&&((0,w.default)(!1,j.toString()),f&&f(j)));O&&(x&&x(O),z.current=Array(O.numPages),B.current.setDocument(O))}},[O]),(0,i.useEffect)(function(){B.current.setViewer($.current),B.current.setExternalLinkRel(o),B.current.setExternalLinkTarget(l)},[o,l]);let V=(0,i.useCallback)((t,e)=>{z.current[t]=e},[]),W=(0,i.useCallback)(t=>{delete z.current[t]},[]),q=(0,i.useMemo)(()=>({imageResourcesPath:c,linkService:B.current,onItemClick:g,pdf:O,registerPage:V,renderMode:M,rotate:k,unregisterPage:W}),[c,g,O,V,M,k,W]),K=(0,i.useMemo)(()=>b(P,()=>O),[P,O]);return(0,e.jsx)("div",Object.assign({className:(0,y.default)("react-pdf__Document",n),ref:d,style:{"--scale-factor":"1"}},K,{children:h?null==O?(0,e.jsx)(sU,{type:"loading",children:"function"==typeof u?u():u}):!1===O?(0,e.jsx)(sU,{type:"error",children:"function"==typeof a?a():a}):(0,e.jsx)(sH.Provider,{value:q,children:r}):(0,e.jsx)(sU,{type:"no-data",children:"function"==typeof p?p():p})}))});function s6(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);
2return i.length<=1?i[0]||null:function(t){i.forEach(function(e){"function"==typeof e?e(t):e&&(e.current=t)})}}let s4=(0,i.createContext)(null),s8={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:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},s7=/^H(\d+)$/;function s9(t){return"children"in t}function rt(t){return!!s9(t)&&1===t.children.length&&0 in t.children&&"id"in t.children[0]}function re(t){let{className:s,node:r}=t,n=(0,i.useMemo)(()=>r?Object.assign(Object.assign({},function(t){let e={};if(s9(t)){let{role:i}=t,s=i.match(s7);if(s)e.role="heading",e["aria-level"]=Number(s[1]);else if(i in s8){let t=s8[i];t&&(e.role=t)}}return e}(r)),function t(e){let i={};if(s9(e)){if(void 0!==e.alt&&(i["aria-label"]=e.alt),void 0!==e.lang&&(i.lang=e.lang),rt(e)){let[s]=e.children;if(s){let e=t(s);return Object.assign(Object.assign({},i),e)}}}else"id"in e&&(i["aria-owns"]=e.id);return i}(r)):null,[r]),a=(0,i.useMemo)(()=>!s9(r)||rt(r)?null:r.children.map((t,i)=>(0,e.jsx)(re,{node:t},i)),[r]);return(0,e.jsx)("span",Object.assign({className:s},n,{children:a}))}function ri(){return(0,i.useContext)(s4)}function rs(){let t=ri();A(t,"Unable to find Page context.");let{onGetStructTreeError:s,onGetStructTreeSuccess:r}=t,[n,a]=sZ(),{value:o,error:l}=n,{customTextRenderer:h,page:d}=t;return((0,i.useEffect)(function(){a({type:"RESET"})},[a,d]),(0,i.useEffect)(function(){if(h||!d)return;let t=v(d.getStructTree());return t.promise.then(t=>{a({type:"RESOLVE",value:t})}).catch(t=>{a({type:"REJECT",error:t})}),()=>sY(t)},[h,d,a]),(0,i.useEffect)(()=>{if(void 0!==o){if(!1===o)return void(l&&((0,w.default)(!1,l.toString()),s&&s(l)));o&&r&&r(o)}},[o]),o)?(0,e.jsx)(re,{className:"react-pdf__Page__structTree structTree",node:o}):null}function rr(t){let s=ri();A(s,"Unable to find Page context.");let{_className:r,canvasBackground:n,devicePixelRatio:a=sG&&window.devicePixelRatio||1,onRenderError:o,onRenderSuccess:l,page:h,renderForms:d,renderTextLayer:c,rotate:u,scale:p}=Object.assign(Object.assign({},s),t),{canvasRef:g}=t;A(h,"Attempted to render page canvas, but no page was specified.");let f=(0,i.useRef)(null);function m(t){"RenderingCancelledException"!==t.name&&((0,w.default)(!1,t.toString()),o&&o(t))}let b=(0,i.useMemo)(()=>h.getViewport({scale:p*a,rotation:u}),[a,h,u,p]),v=(0,i.useMemo)(()=>h.getViewport({scale:p,rotation:u}),[h,u,p]);(0,i.useEffect)(function(){if(!h)return;h.cleanup();let{current:t}=f;if(!t)return;t.width=b.width,t.height=b.height,t.style.width=`${Math.floor(v.width)}px`,t.style.height=`${Math.floor(v.height)}px`,t.style.visibility="hidden";let e={annotationMode:d?ss.ENABLE_FORMS:ss.ENABLE,canvasContext:t.getContext("2d",{alpha:!1}),viewport:b};n&&(e.background=n);let i=h.render(e);return i.promise.then(()=>{t.style.visibility="",h&&l&&l(sQ(h,p))}).catch(m),()=>sY(i)},[n,h,d,b,v]);let y=(0,i.useCallback)(()=>{let{current:t}=f;t&&(t.width=0,t.height=0)},[]);return(0,i.useEffect)(()=>y,[y]),(0,e.jsx)("canvas",{className:`${r}__canvas`,dir:"ltr",ref:s6(g,f),style:{display:"block",userSelect:"none"},children:c?(0,e.jsx)(rs,{}):null})}function rn(){let t=ri();A(t,"Unable to find Page context.");let{customTextRenderer:s,onGetTextError:r,onGetTextSuccess:n,onRenderTextLayerError:a,onRenderTextLayerSuccess:o,page:l,pageIndex:h,pageNumber:d,rotate:c,scale:u}=t;A(l,"Attempted to load page text content, but no page was specified.");let[p,g]=sZ(),{value:f,error:m}=p,b=(0,i.useRef)(null);(0,w.default)(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,i.useEffect)(function(){g({type:"RESET"})},[l,g]),(0,i.useEffect)(function(){if(!l)return;let t=v(l.getTextContent());return t.promise.then(t=>{g({type:"RESOLVE",value:t})}).catch(t=>{g({type:"REJECT",error:t})}),()=>sY(t)},[l,g]),(0,i.useEffect)(()=>
2{if(void 0!==f){if(!1===f)return void(m&&((0,w.default)(!1,m.toString()),r&&r(m)));f&&n&&n(f)}},[f]);let x=(0,i.useCallback)(()=>{o&&o()},[o]),_=(0,i.useCallback)(t=>{(0,w.default)(!1,t.toString()),a&&a(t)},[a]),E=(0,i.useMemo)(()=>l.getViewport({scale:u,rotation:c}),[l,c,u]);return(0,i.useLayoutEffect)(function(){if(!l||!f)return;let{current:t}=b;if(!t)return;t.innerHTML="";let e=new sA({container:t,textContentSource:l.streamTextContent({includeMarkedContent:!0}),viewport:E});return e.render().then(()=>{let e=document.createElement("div");e.className="endOfContent",t.append(e);let i=t.querySelectorAll('[role="presentation"]');if(s){let t=0;f.items.forEach((e,r)=>{if(!("str"in e))return;let n=i[t];n&&(n.innerHTML=s(Object.assign({pageIndex:h,pageNumber:d,itemIndex:r},e)),t+=e.str&&e.hasEOL?2:1)})}x()}).catch(_),()=>sY(e)},[s,_,x,l,h,d,f,E]),(0,e.jsx)("div",{className:(0,y.default)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){let t=b.current;t&&t.classList.remove("selecting")},onMouseDown:function(){let t=b.current;t&&t.classList.add("selecting")},ref:b})}function ra(){return(0,i.useContext)(sH)}function ro(){let t=ra(),s=ri();A(s,"Unable to find Page context.");let{imageResourcesPath:r,linkService:n,onGetAnnotationsError:a,onGetAnnotationsSuccess:o,onRenderAnnotationLayerError:l,onRenderAnnotationLayerSuccess:h,page:d,pdf:c,renderForms:u,rotate:p,scale:g=1}=Object.assign(Object.assign({},t),s);A(c,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),A(d,"Attempted to load page annotations, but no page was specified."),A(n,"Attempted to load page annotations, but no linkService was specified.");let[f,m]=sZ(),{value:b,error:x}=f,_=(0,i.useRef)(null);(0,w.default)(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,i.useEffect)(function(){m({type:"RESET"})},[m,d]),(0,i.useEffect)(function(){if(!d)return;let t=v(d.getAnnotations());return t.promise.then(t=>{m({type:"RESOLVE",value:t})}).catch(t=>{m({type:"REJECT",error:t})}),()=>{sY(t)}},[m,d]),(0,i.useEffect)(()=>{if(void 0!==b){if(!1===b)return void(x&&((0,w.default)(!1,x.toString()),a&&a(x)));b&&o&&o(b)}},[b]);let E=(0,i.useMemo)(()=>d.getViewport({scale:g,rotation:p}),[d,p,g]);return(0,i.useEffect)(function(){if(!c||!d||!n||!b)return;let{current:t}=_;if(!t)return;let e=E.clone({dontFlip:!0}),i={annotations:b,annotationStorage:c.annotationStorage,div:t,imageResourcesPath:r,linkService:n,page:d,renderForms:u,viewport:e};t.innerHTML="";try{new si({accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:t,l10n:null,page:d,structTreeLayer:null,viewport:e}).render(i),h&&h()}catch(t){(0,w.default)(!1,`${t}`),l&&l(t)}return()=>{}},[b,r,n,d,c,u,E]),(0,e.jsx)("div",{className:(0,y.default)("react-pdf__Page__annotations","annotationLayer"),ref:_})}var rl=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&0>e.indexOf(s)&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)0>e.indexOf(s[r])&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]]);return i};function rh(t){let s=Object.assign(Object.assign({},ra()),t),{_className:r="react-pdf__Page",_enableRegisterUnregisterPage:n=!0,canvasBackground:a,canvasRef:o,children:l,className:h,customRenderer:d,customTextRenderer:c,devicePixelRatio:u,error:p="Failed to load the page.",height:g,inputRef:f,loading:m="Loading pageâ¦",noData:x="No page specified.",onGetAnnotationsError:_,onGetAnnotationsSuccess:E,onGetStructTreeError:S,onGetStructTreeSuccess:C,onGetTextError:T,onGetTextSuccess:M,onLoadError:k,onLoadSuccess:P,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:D,onRenderError:I,onRenderSuccess:L,onRenderTextLayerError:F,onRenderTextLayerSuccess:N,pageIndex:O,pageNumber:j,pdf:B,registerPage:z,renderAnnotationLayer:H=!0,renderForms:U=!1,renderMode:$="canvas",renderTextLayer:G=!0,rotate:V,scale:W=1,unregisterPage:q,width:K}=s,X=rl(s,["_className","_enableRegisterUnregisterPage","canvasBackgroun
2d","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[Y,Q]=sZ(),{value:J,error:Z}=Y,tt=(0,i.useRef)(null);A(B,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");let te=sW(j)?j-1:null!=O?O:null,ti=null!=j?j:sW(O)?O+1:null,ts=null!=V?V:J?J.rotate:null,tr=(0,i.useMemo)(()=>{if(!J)return null;let t=1,e=null!=W?W:1;if(K||g){let e=J.getViewport({scale:1,rotation:ts});K?t=K/e.width:g&&(t=g/e.height)}return e*t},[g,J,ts,W,K]);(0,i.useEffect)(function(){return()=>{sW(te)&&n&&q&&q(te)}},[n,B,te,q]),(0,i.useEffect)(function(){Q({type:"RESET"})},[Q,B,te]),(0,i.useEffect)(function(){if(!B||!ti)return;let t=v(B.getPage(ti));return t.promise.then(t=>{Q({type:"RESOLVE",value:t})}).catch(t=>{Q({type:"REJECT",error:t})}),()=>sY(t)},[Q,B,ti]),(0,i.useEffect)(()=>{if(void 0!==J){if(!1===J)return void(Z&&((0,w.default)(!1,Z.toString()),k&&k(Z)));!function(){if(P){if(!J||!tr)return;P(sQ(J,tr))}if(n&&z){if(!sW(te)||!tt.current)return;z(te,tt.current)}}()}},[J,tr]);let tn=(0,i.useMemo)(()=>J&&sW(te)&&ti&&sW(ts)&&sW(tr)?{_className:r,canvasBackground:a,customTextRenderer:c,devicePixelRatio:u,onGetAnnotationsError:_,onGetAnnotationsSuccess:E,onGetStructTreeError:S,onGetStructTreeSuccess:C,onGetTextError:T,onGetTextSuccess:M,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:D,onRenderError:I,onRenderSuccess:L,onRenderTextLayerError:F,onRenderTextLayerSuccess:N,page:J,pageIndex:te,pageNumber:ti,renderForms:U,renderTextLayer:G,rotate:ts,scale:tr}:null,[r,a,c,u,_,E,S,C,T,M,R,D,I,L,F,N,J,te,ti,U,G,ts,tr]),ta=(0,i.useMemo)(()=>b(X,()=>J?tr?sQ(J,tr):void 0:J),[X,J,tr]),to=`${te}@${tr}/${ts}`;return(0,e.jsx)("div",Object.assign({className:(0,y.default)(r,h),"data-page-number":ti,ref:s6(f,tt),style:{"--scale-factor":`${tr}`,backgroundColor:a||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},ta,{children:ti?null===B||null==J?(0,e.jsx)(sU,{type:"loading",children:"function"==typeof m?m():m}):!1===B||!1===J?(0,e.jsx)(sU,{type:"error",children:"function"==typeof p?p():p}):(0,e.jsxs)(s4.Provider,{value:tn,children:[function(){switch($){case"custom":return A(d,'renderMode was set to "custom", but no customRenderer was passed.'),(0,e.jsx)(d,{},`${to}_custom`);case"none":return null;default:return(0,e.jsx)(rr,{canvasRef:o},`${to}_canvas`)}}(),G?(0,e.jsx)(rn,{},`${to}_text`):null,H?(0,e.jsx)(ro,{},`${to}_annotations`):null,l]}):(0,e.jsx)(sU,{type:"no-data",children:"function"==typeof x?x():x})}))}function rd(){return(0,e.jsxs)("div",{className:"text-center text-sm text-danger-700",children:["Fail to render PDF, file might be moved or deleted",(0,e.jsx)("br",{}),"Please try again by refreshing your browser"]})}function rc(t){let{path:s}=t,[r,n]=(0,i.useState)(null),[a,o]=(0,i.useState)(800),l=(0,i.useRef)(null);return(0,i.useEffect)(()=>{function t(){window&&l.current&&o((l.current.clientWidth||800)-14)}return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[l]),(0,e.jsx)("div",{className:"px-1 pt-4",children:(0,e.jsx)("div",{className:"relative",ref:l,children:(0,e.jsx)(s3,{file:s,onLoadSuccess:function(t){let{numPages:e}=t;n(e)},error:(0,e.jsx)(rd,{}),children:Array.from(Array(r),(t,i)=>(0,e.jsx)(rh,{pageNumber:i+1,width:a,className:"mb-8 border border-background-outline shadow-md"},`page_${i+1}`))})})})}function ru(t){let i,{path:s,imgAlt:r}=t,n=(i=s.split(".").pop())?i.split(/[#?]/)[0]?.toLowerCase()??"":"";return"pdf"===n?(0,e.jsx)(rc,{path:s}):["png","jpg","jpeg"].includes(n)?(0,e.jsx)("img",{src:s,className:"h-auto w-full",alt:r}):null}sz.GlobalWorkerOptions.workerSrc="/script/pdf.worker.legacy.min.mjs";var rp=t.i(812878),rg=t.i(820056),rf=t.i(824700),rm=t.i(331668);function rb(t){let{children:i}=t;return(0,e.jsx)(rf.MemoizedReactMarkdown,{remarkPlugins:[rp.default,rg.default],components:{p(t){let{children:i}=t;return(0,e.jsx)("p",{className:"mb-4 text-sm last:mb-0",children:i})},ol(t){let{children:i}=t;return(0,e.jsx)("ol",{className:"mb-2 list-inside list-disc whitespace-normal",children:i})},ul(t){let{children:i}=t;return(0,e.jsx)("ul",{className:"mb-2 ml-4 list-outside list-disc pl-4 whitespace-normal",children:i})},li(t){let{children:i}=t;return(0,e.jsx)("li",{className:"mb-1 text-sm last:mb-0",children:i})},strong(t){let{children:i}=t;return(0,e.jsx)("span",{className:"font-bold",children:i})},a(t){let{children:i,...s}=t;return(0,e.jsx)(rm.MarkDownLinkAnalytic,{...s,className:"font-medium text-primary-700 hover:underline",target:"_blank",children:i})}},children:i})}t.i(331250);var rv=t.i(277840);let ry=i.forwardRef(function(t,e){let{title:s,titleId:r,...n}=t;return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:e,"aria-labelledby":r},n),s?i.createElement("title",{id:r},s):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))});t.s(["ArrowDownTrayIcon",0,ry],418611);var rx=t.i(235945),rA=t.i(671595),rw=t.i(282113);let r_=i.forwardRef(function(t,e){let{title:s,titleId:r,...n}=t;return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:e,"aria-labelledby":r},n),s?i.createElement("title",{id:r},s):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.7
25"}))});t.s(["DocumentDuplicateIcon",0,r_],717017);let rE=i.forwardRef(function(t,e){let{title:s,titleId:r,...n}=t;return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:e,"aria-labelledby":r},n),s?i.createElement("title",{id:r},s):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))});var rS=t.i(989239),rC=t.i(950016),rT=t.i(198767);let rM={en:{Nationality:"Indonesia","Country of residence":"Indonesia","Marital Status":"Single",Occupation:"Employee","Sponsorship Status":"Self-sponsored"},id:{Kewarganegaraan:"Indonesia","Negara tempat tinggal":"Indonesia","Status Perkawinan":"Single",Pekerjaan:"Pegawai","Status Pembiayaan":"Biaya Sendiri"}},rk=(t,e)=>{let i=[];return e&&e.filter(t=>t.id>
20).forEach(e=>{let s=e.options.find(i=>t[e.name]===i.option_label)||e.options[0];s?.persona_id&&i.push(s.persona_id.toString())}),i};t.s(["defaultPersona",0,rM,"getDefaultPersonaId",0,rk],251697);var rP=t.i(121270);let rR={service_documents:[],is_visa_free:!1},rD=(0,i.memo)(function(f){let{applicant:m,fallbackName:b,onEdit:v,onInView:y}=f,x=(0,a.useTranslations)(),A=(0,n.useLocale)(),w=(0,rC.useDocumentWorkspaceAgeGroupLabels)(),_=(0,i.useRef)(null),E=(0,i.useRef)(m.revision),S=(0,i.useRef)(null),[C,T]=(0,i.useState)(!1),[M,k]=(0,i.useState)(!0),[P,R]=(0,i.useState)(!1),[D,I]=(0,i.useState)(!1),[L,F]=(0,i.useState)(!1),[N,O]=(0,i.useState)(rR),[j,B]=(0,i.useState)("idle"),{ageGroupLabelsById:z,ageGroups:H,applicantCount:U,deleteApplicant:$,getDocumentList:G,isDeletingApplicant:V,isPublic:W,isWorkspaceReady:q,personaDetails:K,personaQuestions:X,serviceDestination:Y,serviceName:Q,serviceSlug:J}=(0,rT.useDocumentWorkspaceStore)((0,l.useShallow)(t=>({ageGroupLabelsById:t.ageGroupLabelsById,ageGroups:(0,h.getServicePersonaAgeGroups)(t.personaDetails)??rP.EMPTY_AGE_GROUPS,applicantCount:t.applicants.length,deleteApplicant:t.deleteApplicant,getDocumentList:t.getDocumentList,isDeletingApplicant:null!==t.deletingApplicantId,isPublic:t.isPublic,isWorkspaceReady:"ready"===t.workspaceInitializationStatus,personaDetails:t.personaDetails,personaQuestions:(0,h.getServicePersonaQuestions)(t.personaDetails)??rT.EMPTY_PERSONA_QUESTIONS,serviceDestination:t.serviceDetails?.destination,serviceName:t.serviceDetails?.name,serviceSlug:t.serviceDetails?.slug}))),[Z,tt]=(0,i.useState)(()=>rF(m.persona,X,A)),te=(0,i.useMemo)(()=>(0,h.getVisibleServicePersonaQuestions)(K,rO(Z,X,(0,rP.getApplicantAgeGroupId)(m.age_group,H))),[H,m.age_group,K,X,Z]),ti=(0,o.useInView)(_,{margin:"-12% 0px -79% 0px"}),ts=(0,o.useInView)(_,{margin:"400px 0px",once:!0});(0,i.useEffect)(()=>{ti&&y(m.id)},[m.id,ti,y]),(0,i.useEffect)(()=>()=>{S.current&&clearTimeout(S.current)},[]),(0,i.useEffect)(()=>{E.current!==m.revision&&(E.current=m.revision,tt(rF(m.persona,X,A)))},[m.persona,m.revision,A,X]),(0,i.useEffect)(()=>{if(!J||!ts)return;let t=!0,e=rN(Z,te),i=rk(rM[A]??rM.en,te);return O(rR),B("loading"),G({service_slug:J,persona_ids:(e.length>0?e:i).join(","),age_group_type:(0,rP.getApplicantAgeGroupType)(m.age_group,H)??(0,rP.getDefaultAdultAgeGroup)(H)?.type,is_public:W,nationality_country_id:rU(Z,X,"nationality"),country_of_residence_id:rU(Z,X,"country-of-residence")}).then(e=>{t&&(O(e),B("success"))}).catch(()=>{t&&(O(rR),B("error"))}),()=>{t=!1}},[m.age_group,H,G,W,A,X,Z,J,ts,te]);let tr=(0,i.useMemo)(()=>r$({ageGroup:m.age_group??(0,rP.getDefaultAdultAgeGroup)(H)?.type??null,ageGroups:H,ageGroupLabelsById:z,ageGroupTypeLabels:w,locale:A,persona:Z,personaQuestions:te}),[w,z,H,m.age_group,A,Z,te]),tn=(0,i.useMemo)(()=>r$({ageGroup:null,ageGroups:H,ageGroupTypeLabels:w,locale:A,persona:Z,personaQuestions:te}),[w,H,A,Z,te]),ta=N.service_documents,to=(0,i.useMemo)(()=>{let t=X.find(t=>rH(t,"nationality")),e=t?.options.find(t=>t.id===rU(Z,X,"nationality"));return e?.option_label_locales[A]??e?.option_label??""},[A,X,Z]),tl=ta.filter(t=>"REQUIRED_FOR_APPOINTMENT"===t.requirement_level),th=ta.filter(t=>"REQUIRED_FOR_APPOINTMENT"!==t.requirement_level),td=[...tl,...th],tc=td.slice(0,P?td.length:5),tu=tl.filter(t=>tc.includes(t)),tp=th.filter(t=>tc.includes(t)),tg="success"===j&&!N.is_visa_free&&0===td.length,tf=(0,rP.getApplicantDisplayName)({ageGroups:H,ageGroupLabelsById:z,ageGroupTypeLabels:w,applicantAgeGroup:m.age_group,fallbackName:b,locale:A,name:m.name}),tm=(0,i.useMemo)(()=>tn.length>0?(0,rS.getPersonaSentence)(tn.map(t=>({name:t})),A):"",[A,tn]),tb=tm?`${tf} (${tm})`:tf,tv=async()=>{let t=["SPAN"===r.BRAND?rW:"*ð SPUN Global - "+x("web.label.hero-subtitle")+"*","",`*${Q??J??""}*`,"",...rq({applicantName:tf,documents:td,labels:{appointment:x("service.label.requirement-share-section-appointment"),documentRequirePhysical:x("service.label.document-require-physical"),required:x("service.label.requirement-share-section-required"),requiredLater:x("service.label.requirement-share-section-required-later")},personaDescription:tm})];t.push("",x("service.label.requirement-share-footer"),window.location.href);try{return await navigator.clipboard.writeText(t.join("\n")),T(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{T(!1),S.current=null},2e3),!0}catch{return!1}},ty=async()=>
2{if(!D&&0!==td.length){I(!0),F(!1);try{let[{toDataURL:i},{generateAndDownloadPDF:s},{DocumentWorkspaceApplicantChecklistPDF:n}]=await Promise.all([t.A(814126),t.A(200200),t.A(591049)]),a=new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:r.DEFAULT_TIMEZONE}).format(new Date).replace(",",""),o=window.location.href,l=await i(o),h=Q??J??"",d=(0,e.jsx)(n,{documents:td,qrData:l,qrUrl:o,text:{applicantSummary:tb,appointmentDocuments:x("service.label.requirement-mode-appointment"),footerCopyright:"SPAN"===r.BRAND?x("layout.footer.label.copyright-span",{year:2026}):x("layout.footer.label.copyright",{year:2026}),footerQr:x("service.label.checklist-pdf-footer-qr"),generatedBy:x("service.label.checklist-pdf-generated-by-span",{time:a}),laterDocuments:x("service.label.requirement-mode-rest"),mandatory:x("service.label.checklist-pdf-mandatory"),mandatorySubtitle:x("service.label.checklist-pdf-mandatory-subtitle"),needPhysical:x("service.label.document-require-physical"),optional:x("service.label.checklist-pdf-optional"),optionalSubtitle:x("service.label.checklist-pdf-optional-subtitle"),serviceName:h}});await s(d,`${h} - ${tf}.pdf`)}catch{F(!0)}finally{I(!1)}}};return(0,e.jsxs)("div",{ref:_,id:rV(m.id),className:"scroll-mt-28 overflow-hidden rounded-2xl border border-background-outline bg-white shadow-xs",children:[(0,e.jsxs)("div",{className:(0,rS.cx)("flex flex-col gap-4 p-4 pb-4",M&&"border-b border-background-outline xl:pb-5"),children:[(0,e.jsxs)("div",{className:"flex w-full min-w-0 items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,e.jsx)("button",{type:"button",className:"shrink-0 px-px text-texticon-secondary xl:px-2","aria-expanded":M,"aria-label":M?x("common.button.view-less"):x("common.button.view-all"),onClick:()=>k(t=>!t),children:M?(0,e.jsx)(rw.ChevronUpIcon,{className:"size-4"}):(0,e.jsx)(rA.ChevronDownIcon,{className:"size-4"})}),(0,e.jsx)("p",{className:"truncate text-base font-medium text-texticon-primary xl:text-lg",children:tf})]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,e.jsxs)("button",{type:"button",className:"relative cursor-pointer",onClick:()=>v(m),children:[(0,e.jsx)("span",{className:"absolute bottom-0 h-0.5 w-full bg-smart-gradient"}),(0,e.jsx)("span",{className:"bg-smart-gradient bg-clip-text text-sm font-semibold text-transparent",children:x("common.label.edit")})]}),(0,e.jsxs)("div",{className:"flex divide-x divide-background-outline overflow-hidden rounded-lg border border-background-outline",children:[(0,e.jsx)(rI,{label:x("common.button.copy-all"),onClick:()=>void tv(),children:C?(0,e.jsx)(rx.CheckIcon,{className:"size-4 text-success-700"}):(0,e.jsx)(r_,{className:"size-4"})}),(0,e.jsx)(rI,{label:x("common.button.download-all"),disabled:D||"success"!==j||0===td.length,onClick:()=>void ty(),children:D?(0,e.jsx)(g.SpinnerIcon,{className:"size-4 animate-spin"}):(0,e.jsx)(ry,{className:"size-4"})}),(0,e.jsx)(rI,{label:x("common.button.delete"),disabled:!q||U<=1||V,onClick:()=>void $(m),children:(0,e.jsx)(rE,{className:"size-4"})})]})]})]}),tr.length>0&&(0,e.jsx)("div",{className:"flex w-full flex-wrap gap-1",children:tr.map((t,i)=>(0,e.jsx)(c.Chip,{variant:"secondary",children:t},`${t}-${i}`))})]}),M&&(0,e.jsxs)("div",{className:"flex flex-col p-4 pt-2 xl:p-6 xl:pt-4",children:[L&&(0,e.jsx)(p.BaseAlert,{variant:"danger",containerClassName:"mb-4",className:"text-sm",children:x("service.label.checklist-pdf-download-error")}),N.is_visa_free&&(0,e.jsxs)("div",{className:"mt-2 flex w-full flex-col items-center text-center",children:[(0,e.jsx)(s.default,{src:r.CDN_URL+"/img/service/visa-not-available.png",alt:"Visa Free",width:120,height:100}),(0,e.jsxs)("div",{className:"mt-6 w-full",children:[(0,e.jsx)("p",{className:"text-lg font-semibold",children:x("common.label.good-news")}),(0,e.jsx)("p",{className:"mt-2 mb-4 text-sm text-texticon-secondary",children:x.rich("service.label.visa-free-description",{to:Y??"",for:to,label:t=>(0,e.jsx)("b",{children:t})})})]})]}),tg&&(0,e.jsxs)("div",{className:"mt-2 flex w-full flex-col items-center text-center",children:[(0,e.jsx)(s.default,{src:r.CDN_URL+"/img/service/visa-not-supported.png",alt:"
2Visa Not Supported",width:120,height:100}),(0,e.jsxs)("div",{className:"mt-6 w-full",children:[(0,e.jsx)("p",{className:"text-lg font-semibold",children:x("service.label.visa-not-support")}),r.FEATURE_FLAGS.CONTACT_SUPPORT?(0,e.jsx)("p",{className:"mt-2 mb-4 text-sm text-texticon-secondary",children:x.rich("service.label.visa-not-support-description",{webchat:t=>(0,e.jsx)(u.default,{className:"font-semibold text-primary-700 underline",children:t})})}):(0,e.jsx)("p",{className:"my-2"}),(0,e.jsxs)(d.Button,{variant:"gradient-border",className:"w-full justify-center",slim:"ultra-slim",onClick:()=>v(m),children:[x("common.label.edit")," persona"]})]})]}),td.length>0&&(0,e.jsxs)("div",{className:"my-2 flex flex-col gap-y-6",children:[tu.length>0&&(0,e.jsxs)("div",{className:"mb-2",children:[(0,e.jsx)("p",{className:"text-xs font-medium text-texticon-secondary capitalize",children:x("service.label.requirement-mode-appointment").toUpperCase()}),tu.map(t=>(0,e.jsx)(rv.Disclosure,{as:"div",className:"flex w-full flex-col",children:i=>{let{open:s}=i;return(0,e.jsx)(rL,{document:t,open:s})}},`additional-${t.service_document_id}`))]}),tp.length>0&&(0,e.jsxs)("div",{children:[tu.length>0&&(0,e.jsx)("p",{className:"text-xs font-medium text-texticon-secondary capitalize",children:x("service.label.requirement-mode-rest").toUpperCase()}),tp.map((t,i)=>(0,e.jsx)(rv.Disclosure,{as:"div",className:"flex w-full flex-col",children:s=>{let{open:r}=s;return(0,e.jsx)(rL,{document:t,open:r,className:(0,rS.cx)(0===tu.length&&0===i?"pt-0":"")})}},`additional-${t.service_document_id}`))]})]}),td.length>5&&(0,e.jsxs)(d.Button,{type:"button",variant:"outline",className:"mt-2 flex w-full items-center justify-center gap-2",onClick:()=>{R(t=>{let e=document.getElementById(rV(m.id));return e&&t&&e.scrollIntoView({behavior:"smooth",block:"center"}),!t})},children:[(0,e.jsx)("div",{children:(0,e.jsx)(rA.ChevronDownIcon,{className:(0,rS.cx)("h-5 w-5 transform",P&&"rotate-180")})}),(0,e.jsx)("div",{children:P?x("common.button.view-less"):x("common.button.view-all")})]})]})]})});function rI(t){let{children:i,disabled:s,label:r,onClick:n}=t;return(0,e.jsx)("button",{type:"button",disabled:s,title:r,"aria-label":r,onClick:n,className:"flex size-9 items-center justify-center text-texticon-secondary disabled:cursor-not-allowed disabled:text-texticon-disabled",children:i})}function rL(t){let{className:i,document:s,open:r}=t,n=(0,a.useTranslations)();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(rv.DisclosureButton,{className:(0,rS.cx)("flex w-full items-center justify-between py-4 pr-2",i),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"required-el text-left font-medium",children:s.name}),s.is_handoff_required&&(0,e.jsx)("p",{className:"text-left text-xs text-texticon-secondary",children:n("service.label.document-require-physical")})]}),r?(0,e.jsx)(rw.ChevronUpIcon,{className:"size-4 text-texticon-secondary","aria-hidden":"true"}):(0,e.jsx)(rA.ChevronDownIcon,{className:"size-4 text-texticon-secondary","aria-hidden":"true"})]}),(0,e.jsx)(rv.DisclosurePanel,{className:"flex flex-col divide-y divide-background-outline",children:(0,e.jsxs)("div",{className:"flex flex-col gap-2 py-2",children:[(0,e.jsx)("div",{className:"text-sm text-texticon-secondary",children:(0,e.jsx)(rb,{children:s.description})}),s.guideline_file_url&&(0,e.jsx)(ru,{path:s.guideline_file_url,imgAlt:`Guideline for ${s.name}`})]})}),(0,e.jsx)("div",{className:"h-[0.5px] w-full bg-background-outline"})]})}function rF(t,e,i){let s=rG(t)?t:null,r=rM[i]??rM.en;return Object.fromEntries(e.flatMap(t=>{let e=function(t,e){if(!t)return;let i=t[e.id];if(void 0!==i)return i;let s=rj(e.name),r=t[s]??t[e.name];return void 0!==r?r:rz(s).map(e=>t[e]).find(t=>void 0!==t)}(s,t),i=t.options.find(t=>{var i,s,r;return i=e,s=t.id,r=t.option_label,"number"==typeof i?i===s:"string"==typeof i&&(Number(i)===s||i.replaceAll(" ","-").toLowerCase()===r.replaceAll(" ","-").toLowerCase())})??t.options.find(e=>r[t.name]===e.option_label)??t.options[0];return i?[[t.id,i.id]]:[]}))}function rN(t,e){return e.filter(t=>t.id>0).flatMap(e=>{let i=e.options.find(i=>i.id===t[e.id]);return i?.persona_id?[i.persona_id.toString()]:[]})}function rO(t,e,i){return Object.fromEntries([...void 0===i?[]:[[h.SERVICE_PERSONA_AGE_GROUP_DOCUMENT_ID,i]],...e.map(e=>
2[e.id,t[e.id]])])}function rj(t){return t.replaceAll(" ","-").toLowerCase()}let rB=[["nationality","kewarganegaraan"],["country-of-residence","negara-tempat-tinggal"],["marital-status","status-perkawinan"],["occupation","pekerjaan"],["sponsorship-status","status-pembiayaan"]];function rz(t){return rB.find(e=>e.includes(t))??[t]}function rH(t,e){return rz(e).includes(rj(t.name))}function rU(t,e,i){let s=e.find(t=>rH(t,i));return s?t[s.id]:void 0}function r$(t){let{ageGroup:e,ageGroups:i,ageGroupLabelsById:s,ageGroupTypeLabels:r,locale:n,persona:a,personaQuestions:o}=t,l=[],h=Number(e),d=i.find(t=>(0,rP.getStoredAgeGroupValue)(t)===e)??(Number.isFinite(h)?i.find(t=>"id"in t&&t.id===h):"ADULT"===e?(0,rP.getDefaultAdultAgeGroup)(i):i.find(t=>t.type===e));if(d&&l.push((0,rP.getLocalizedAgeGroupLabel)(d,n,r,s)),!rG(a))return l;for(let t of[...o].sort((t,e)=>t.sorting_index-e.sorting_index)){let e=a[t.id],i=t.options.find(t=>t.id===Number(e));if(!i)continue;let s=i.option_label_locales[n]??i.option_label;rH(t,"nationality")?s="id"===n?`Warga Negara ${s}`:`${s} Nationality`:rH(t,"country-of-residence")&&(s="id"===n?`Tinggal di ${s}`:`Resident of ${s}`),l.push(s)}return l}function rG(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function rV(t){return`section-detail-document-applicant-${t}`}let rW="*ð SPAN VISAð*";function rq(t){let{applicantName:e,documents:i,labels:s,personaDescription:r}=t,n=[r?`*${e} (${r})*`:e,""],a=t=>`- ${t.name}${t.is_handoff_required?` (${s.documentRequirePhysical})`:""}`,o=i.filter(t=>"REQUIRED_FOR_APPOINTMENT"===t.requirement_level),l=i.filter(t=>"REQUIRED"===t.requirement_level);return o.length>0&&(n.push(s.appointment),n.push(...o.map(a))),l.length>0&&(o.length>0&&n.push(""),n.push(o.length>0?s.requiredLater:s.required),n.push(...l.map(a))),n}t.s(["DOCUMENT_WORKSPACE_COPY_TITLE",0,rW,"default",0,rD,"getApplicantChecklistCopyLines",0,rq,"getApplicantPersonaLabels",0,r$,"getApplicantPersonaState",0,rF,"getDocumentApplicantAnchorId",0,rV,"getPersonaAnswersFromState",0,rO,"getPersonaIdsFromState",0,rN,"getPersonaValueForKey",0,rU,"splitApplicantName",0,function(t){let[e="",...i]=t?.trim().split(/\s+/)??[];return{firstName:e,lastName:i.join(" ")}}],746174)},131645,t=>{"use strict";var e=t.i(793890),i=t.i(511345),s=t.i(454028),r=t.i(422022),n=t.i(989239);let a={overview:{id:"section-detail-overview",label:"service.label.overview-title"},eligibility:{id:"section-detail-eligibility",label:"service.label.eligibility-title"},requirement:{id:"section-detail-requirement",label:"service.label.requirement-title"},timeline:{id:"section-detail-timeline",label:"service.label.timeline-title"},offer:{id:"section-detail-offer",label:"service.label.offer"},faq:{id:"section-detail-faq",label:"service.label.faq-title"},"add-on":{id:"section-detail-add-on",label:"service.label.add-on-title"},pricing:{id:"section-detail-pricing",label:"service.label.pricing-title"},document:{id:"section-detail-document",label:"service.label.document-title"}};t.s(["default",0,function(t){let{section:o,className:l,titleClassName:h,children:d,action:c,title:u,subtitle:p,headerClassName:g,onInView:f}=t,m=(0,i.useRef)(null),b=(0,r.useInView)(m,{margin:"-12% 0px -79% 0px"}),v=(0,s.useTranslations)();return(0,i.useEffect)(()=>{b&&f?.()},[b,f]),(0,e.jsxs)("div",{className:(0,n.cx)("relative flex flex-col gap-3 px-4 lg:px-1 xl:gap-4",l),children:["overview"!==o&&(0,e.jsx)("div",{id:a[o].id,className:"absolute -top-12 lg:top-0"}),(0,e.jsxs)("div",{className:(0,n.cx)(g),children:[(0,e.jsxs)("div",{ref:m,className:"@container flex flex-wrap items-center justify-between gap-2 text-xl font-semibold lg:text-2xl",children:[(0,e.jsx)("h2",{className:h,children:u??v(a[o].label)??""}),(0,e.jsx)("div",{children:c})]}),p&&(0,e.jsx)("h3",{className:"text-sm text-texticon-secondary",children:p})]}),d]})}
2,"serviceNavigationConfig",0,a])},240540,t=>{"use strict";var e=t.i(793890),i=t.i(511345),s=t.i(808723),r=t.i(547174),n=t.i(454028),a=t.i(444632),o=t.i(989239);function l(){let[t,e]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let t=window.matchMedia("(min-width: 1024px)");e(t.matches);let i=t=>e(t.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),t}var h=t.i(75406),d=t.i(741033),c=t.i(751403),u=t.i(131645),p=t.i(762333);function g(t){let{containerRef:i}=t,{activeSection:s}=(0,d.useCheckoutPersistStore)((0,a.useShallow)(t=>({activeSection:t.serviceSection})));return(0,e.jsx)(c.MobileDocumentApplicantMenu,{isActive:"document"===s,containerRef:i})}function f(t){let{section:r,containerRef:l}=t,h=(0,i.useRef)(null),{activeSection:c}=(0,d.useCheckoutPersistStore)((0,a.useShallow)(t=>({activeSection:t.serviceSection}))),p=(0,n.useTranslations)(),g=c===r;return(0,i.useEffect)(()=>{if(g&&h.current&&l.current){let t=l.current,e=h.current,i=e.offsetLeft,s=i+e.offsetWidth,r=t.scrollLeft,n=t.offsetWidth;i<r?t.scrollTo({left:i-16,behavior:"smooth"}):s>r+n&&t.scrollTo({left:s-n+16,behavior:"smooth"})}},[g,l]),(0,e.jsx)(s.default,{ref:h,href:`#${u.serviceNavigationConfig[r].id}`,className:(0,o.cx)("px-2.5 py-1.5 text-center font-semibold whitespace-nowrap",g&&"border-b-[3px] border-primary-700"),children:p(u.serviceNavigationConfig[r].label)??""})}function m(){let t="document"===(0,d.useCheckoutPersistStore)((0,a.useShallow)(t=>({activeSection:t.serviceSection}))).activeSection;return(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsx)(c.DesktopNavigationLink,{section:"document",isActive:t}),(0,e.jsx)(c.DocumentApplicantSubsectionLinks,{isActive:t})]})}function b(t){let{section:r}=t,l=(0,i.useRef)(null),{activeSection:h}=(0,d.useCheckoutPersistStore)((0,a.useShallow)(t=>({activeSection:t.serviceSection}))),c=(0,n.useTranslations)();return(0,e.jsx)(s.default,{ref:l,href:`#${u.serviceNavigationConfig[r].id}`,className:(0,o.cx)("border-l px-4 py-2",h===r?"border-black font-medium text-black":"border-background-outline text-texticon-secondary"),children:c(u.serviceNavigationConfig[r].label)??""})}t.s(["NavigationContainer",0,function(t){let{section:s,className:r,titleClassName:n,children:a,action:o,title:l,subtitle:h,headerClassName:c}=t,p=(0,d.useCheckoutPersistStore)(t=>t.setServiceSection),g=(0,i.useCallback)(()=>{p(s)},[s,p]);return(0,e.jsx)(u.default,{section:s,className:r,titleClassName:n,action:o,title:l,subtitle:h,headerClassName:c,onInView:g,children:a})},"ServiceNavigation",0,function(t){let{showFAQ:s,showTimeline:n,showPricing:c,showDocument:u=!0,showAddon:m,showOffer:b=!1,showEligibility:v=!0,documentNavigationMode:y="requirement"}=t,x=(0,i.useRef)(null),{data:A,bundleList:w}=(0,d.useCheckoutPersistStore)((0,a.useShallow)(t=>({data:t.serviceDetails,bundleList:t.bundleList}))),_=l();return((0,h.useScrollToLocationHash)("SPUN"===r.BRAND),_)?null:(0,e.jsx)("div",{className:(0,o.cx)("sticky z-sticky flex w-full max-w-full flex-col overflow-hidden bg-background-body pb-1.5","top-16"),children:(0,e.jsxs)("div",{ref:x,className:"flex w-full max-w-full gap-4 overflow-x-auto border-b border-background-outline",children:[(0,e.jsx)(f,{section:"overview",containerRef:x}),v&&A&&(0,p.hasServiceEligibility)(A)&&(0,e.jsx)(f,{section:"eligibility",containerRef:x}),u&&A&&"workspace"===y&&(0,e.jsx)(g,{containerRef:x}),n&&(0,e.jsx)(f,{section:"timeline",containerRef:x}),c&&(0,e.jsx)(f,{section:"pricing",containerRef:x}),(b||w.length>0)&&(0,e.jsx)(f,{section:"offer",containerRef:x}),m&&(0,e.jsx)(f,{section:"add-on",containerRef:x}),s&&(0,e.jsx)(f,{section:"faq",containerRef:x})]})})},"ServiceNavigationV4",0,function(t){let{showFAQ:i,showTimeline:s,showPricing:n,showDocument:c=!0,showAddon:u,showOffer:g=!1,showEligibility:f=!0,documentNavigationMode:v="requirement"}=t,{data:y,bundleList:x}=(0,d.useCheckoutPersistStore)((0,a.useShallow)(t=>({data:t.serviceDetails,bundleList:t.bundleList})));return((0,h.useScrollToLocationHash)("SPUN"===r.BRAND),l())?(0,e.jsx)("div",{className:"relative w-40 pt-6 pb-20 pl-4",children:(0,e.jsxs)("div",{className:(0,o.cx
2)("sticky flex flex-col","top-16"),children:[(0,e.jsx)(b,{section:"overview"}),f&&y&&(0,p.hasServiceEligibility)(y)&&(0,e.jsx)(b,{section:"eligibility"}),c&&y&&"workspace"===v&&(0,e.jsx)(m,{}),s&&(0,e.jsx)(b,{section:"timeline"}),n&&(0,e.jsx)(b,{section:"pricing"}),(g||x.length>0)&&(0,e.jsx)(b,{section:"offer"}),u&&(0,e.jsx)(b,{section:"add-on"}),i&&(0,e.jsx)(b,{section:"faq"})]})}):null}],240540)},762333,t=>{"use strict";function e(t){return!!t.eligibility_description}function i(t){return!!(t.eligibility_daily_allowance&&t.eligibility_daily_hotel_rate&&t.eligibility_round_trip_flight_price)}t.s(["hasServiceEligibility",0,function(t){return e(t)||i(t)},"hasServiceEligibilityDescription",0,e,"hasServiceEligibilityFunds",0,i,"serviceEligibilitySubsectionConfig",0,{"who-can-apply":{id:"section-detail-eligibility-who-can-apply",label:"service.label.eligibility-subtitle"},"proof-of-funds":{id:"section-detail-eligibility-proof-of-funds",label:"service.label.eligibility-fund-subtitle"}}])},950016,t=>{"use strict";var e=t.i(511345),i=t.i(454028);t.s(["useDocumentWorkspaceAgeGroupLabels",0,function(){let t=(0,i.useTranslations)();return(0,e.useMemo)(()=>({ADULT:t("application.trip.adult"),CHILDREN:t("application.trip.children")}),[t])}])},75406,751403,t=>{"use strict";var e=t.i(511345);function i(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];(0,e.useEffect)(()=>{if(!t)return;let e=window.setTimeout(()=>{let t=window.location.hash;if(t)try{document.getElementById(decodeURIComponent(t.slice(1)))?.scrollIntoView({behavior:"smooth"})}catch{document.getElementById(t.slice(1))?.scrollIntoView({behavior:"smooth"})}},100);return()=>window.clearTimeout(e)},[t])}t.s(["useScrollToLocationHash",0,i],75406);var s=t.i(793890),r=t.i(808723),n=t.i(547174),a=t.i(621664),o=t.i(454028),l=t.i(444632),h=t.i(25735);t.i(331250);var d=t.i(904518),c=t.i(588892),u=t.i(37062),p=t.i(235945),g=t.i(283297),f=t.i(895539),m=t.i(989239),b=t.i(950016),v=t.i(198767),y=t.i(121270),x=t.i(131645),A=t.i(762333),w=t.i(746174);function _(t,e){let i=["overview"];return t&&(0,A.hasServiceEligibility)(t)&&i.push("eligibility"),i.push("document"),e&&i.push("faq"),i}function E(t){let{serviceDetails:e,activeSubsection:i}=t,n=(0,o.useTranslations)();if(!e)return null;let a=[];(0,A.hasServiceEligibilityDescription)(e)&&a.push("who-can-apply"),(0,A.hasServiceEligibilityFunds)(e)&&a.push("proof-of-funds");let l=i?a.indexOf(i):-1,h=l>=0?`${(l+.5)/a.length*100}%`:null;return(0,s.jsxs)("div",{className:"relative flex flex-col border-l border-background-outline",children:[h&&(0,s.jsx)("div",{"aria-hidden":"true",className:"absolute top-0 -left-px w-px bg-black",style:{height:h}}),a.map(t=>{let e=A.serviceEligibilitySubsectionConfig[t],a=i===t;return(0,s.jsx)(r.default,{href:`#${e.id}`,"aria-current":a?"location":void 0,className:(0,m.cx)("relative min-w-0 truncate py-2 pl-6 text-sm text-texticon-secondary","before:absolute before:top-1/2 before:left-0 before:w-3 before:border-t before:border-background-outline",a&&"font-medium text-black before:border-black"),children:n(e.label)??""},t)})]})}function S(t){let{isActive:e}=t,i=(0,o.useTranslations)(),n=(0,a.useLocale)(),d=(0,b.useDocumentWorkspaceAgeGroupLabels)(),{activeApplicantId:c,ageGroupLabelsById:u,ageGroups:p,applicants:g,hasPersonaDetails:x,isWorkspaceReady:A,setAddApplicantDialogOpen:_,setDocumentApplicant:E}=(0,v.useDocumentWorkspaceStore)((0,l.useShallow)(t=>({activeApplicantId:t.documentApplicantId,ageGroupLabelsById:t.ageGroupLabelsById,ageGroups:(0,h.getServicePersonaAgeGroups)(t.personaDetails)??y.EMPTY_AGE_GROUPS,applicants:t.applicants,hasPersonaDetails:null!==t.personaDetails,isWorkspaceReady:"ready"===t.workspaceInitializationStatus,setAddApplicantDialogOpen:t.setAddApplicantDialogOpen,setDocumentApplicant:t.setDocumentApplicant}))),S=g.some(t=>t.id===c)?c:g[0]?.id,C=e?g.findIndex(t=>t.id===S):-1,T=C>=0?`${(C+.5)/g.length*100}%`:null;return(0,s.jsxs)("div",{className:"flex flex-col border-l border-background-outline",children:[(0,s.jsxs)("div",{className:"relative flex flex-col",children:[T&&(0,s.jsx)("div",{"aria-hidden":"true",className:"absolute top-0 -left-px w-px bg-black",style:{height:T}}),g.map(t=>{let a=e&&t.id===S,o=(0,y.getApplicantDisplayName)({ageGroups:p,ageGroupLabelsById:u,ageGroupTypeLabels:d,applicantAgeGroup:t.age_group,fallbackName:i("common.label.applicant"),locale:n,name:t.name});return(0,s.jsx)(r.default,{href:`#${(0,w.getDocumentApplicantAnchorId)(t.id)}`,title:o,"aria-current":a?"location":void 0,onClick:()=>
2E(t.id),className:(0,m.cx)("relative min-w-0 truncate py-2 pl-6 text-sm text-texticon-secondary","before:absolute before:top-1/2 before:left-0 before:w-3 before:border-t before:border-background-outline",a&&"font-medium text-black before:border-black"),children:o},t.id)})]}),x&&(0,s.jsxs)("button",{type:"button","aria-haspopup":"dialog",disabled:!A,onClick:()=>_(!0),className:"flex items-center gap-2 py-2 pl-6 text-sm font-medium text-primary-700 disabled:text-texticon-disabled",children:[(0,s.jsx)(f.PlusIcon,{className:"h-4 w-4"}),i("common.button.add")]})]})}function C(t){let{section:e,isActive:i}=t,n=(0,o.useTranslations)(),a=x.serviceNavigationConfig[e];return(0,s.jsx)(r.default,{href:`#${a.id}`,"aria-current":i?"location":void 0,className:(0,m.cx)("border-l px-4 py-2",i?"border-black font-medium text-black":"border-background-outline text-texticon-secondary"),children:n(a.label)??""})}function T(t){let{isActive:i,containerRef:n}=t,A=(0,e.useRef)(null),_=(0,o.useTranslations)(),E=(0,a.useLocale)(),S=(0,b.useDocumentWorkspaceAgeGroupLabels)(),{activeApplicantId:C,ageGroupLabelsById:T,ageGroups:M,applicants:k,setAddApplicantDialogOpen:P,setDocumentApplicant:R}=(0,v.useDocumentWorkspaceStore)((0,l.useShallow)(t=>({activeApplicantId:t.documentApplicantId,ageGroupLabelsById:t.ageGroupLabelsById,ageGroups:(0,h.getServicePersonaAgeGroups)(t.personaDetails)??y.EMPTY_AGE_GROUPS,applicants:t.applicants,setAddApplicantDialogOpen:t.setAddApplicantDialogOpen,setDocumentApplicant:t.setDocumentApplicant}))),D=x.serviceNavigationConfig.document,I=k.some(t=>t.id===C)?C:k[0]?.id;return(0,e.useEffect)(()=>{let t=n.current,e=A.current;if(!i||!t||!e)return;let s=e.offsetLeft,r=s+e.offsetWidth,a=t.scrollLeft,o=a+t.offsetWidth;s<a?t.scrollTo({left:s-16,behavior:"smooth"}):r>o&&t.scrollTo({left:r-t.offsetWidth+16,behavior:"smooth"})},[n,i]),(0,s.jsx)(d.Popover,{children:t=>{let{open:e,close:a}=t;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(d.PopoverButton,{ref:A,"aria-current":i?"location":void 0,className:(0,m.cx)("flex items-center gap-1 px-2.5 py-1.5 text-center font-semibold whitespace-nowrap",i&&"border-b-[3px] border-primary-700"),children:[_(D.label)??"",(0,s.jsx)(u.ChevronDownIcon,{className:(0,m.cx)("h-4 w-4 transition-transform",e&&"rotate-180")})]}
2),(0,s.jsx)(c.Portal,{children:(0,s.jsx)(d.PopoverBackdrop,{className:"fixed inset-x-0 bottom-0 z-modal bg-black/50",style:{top:n.current?.getBoundingClientRect().bottom??0}})}),(0,s.jsxs)(d.PopoverPanel,{modal:!0,anchor:{to:"bottom",gap:6,padding:16},className:"z-popover w-[calc(100vw-2rem)] max-w-md overflow-hidden rounded-lg border border-background-outline bg-white shadow-xs",children:[(0,s.jsx)("div",{className:"h-[35dvh] overflow-y-auto py-1",children:k.map(t=>{let e=(0,y.getApplicantDisplayName)({ageGroups:M,ageGroupLabelsById:T,ageGroupTypeLabels:S,applicantAgeGroup:t.age_group,fallbackName:_("common.label.applicant"),locale:E,name:t.name}),i=t.id===I;return(0,s.jsxs)(r.default,{href:`#${(0,w.getDocumentApplicantAnchorId)(t.id)}`,title:e,"aria-current":i?"location":void 0,onClick:()=>{R(t.id),a()},className:(0,m.cx)("flex h-11 w-full min-w-0 items-center gap-3 px-4 text-left text-sm hover:bg-primary-100",i&&"bg-primary-100 font-medium"),children:[(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),i&&(0,s.jsx)(p.CheckIcon,{className:"h-5 w-5 shrink-0 text-primary-700"})]},t.id)})}),(0,s.jsxs)("div",{className:"shrink-0 border-t border-background-outline",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 text-sm",children:[(0,s.jsx)(g.DocumentPlusIcon,{className:"mt-0.5 h-4 w-4 shrink-0 text-texticon-secondary"}),(0,s.jsx)("div",{children:_("service.label.document-checklist-banner")})]}),(0,s.jsxs)("button",{type:"button",className:"flex h-12 w-full items-center justify-center gap-2 border-t border-background-outline font-semibold text-primary-700",onClick:()=>{a(),P(!0)},children:[(0,s.jsx)(f.PlusIcon,{className:"h-5 w-5"}),_("web.label.workspace-add-applicants-title")]})]})]})]})}})}function M(t){let{section:i,isActive:n,containerRef:a}=t,l=(0,e.useRef)(null),h=(0,o.useTranslations)(),d=x.serviceNavigationConfig[i];return(0,e.useEffect)(()=>{let t=a.current,e=l.current;if(!n||!t||!e)return;let i=e.offsetLeft,s=i+e.offsetWidth,r=t.scrollLeft,o=r+t.offsetWidth;i<r?t.scrollTo({left:i-16,behavior:"smooth"}):s>o&&t.scrollTo({left:s-t.offsetWidth+16,behavior:"smooth"})},[a,n]),(0,s.jsx)(r.default,{ref:l,href:`#${d.id}`,"aria-current":n?"location":void 0,className:(0,m.cx)("px-2.5 py-1.5 text-center font-semibold whitespace-nowrap",n&&"border-b-[3px] border-primary-700"),children:h(d.label)??""})}t.s(["DesktopNavigationLink",0,C,"DocumentApplicantSubsectionLinks",0,S,"DocumentWorkspaceNavigationDesktop",0,function(t){let{showFAQ:r}=t,{activeSection:a,activeEligibilitySubsection:o,serviceDetails:h}=(0,v.useDocumentWorkspaceStore)((0,l.useShallow)(t=>({activeSection:t.section,activeEligibilitySubsection:t.eligibilitySubsection,serviceDetails:t.serviceDetails}))),d=(0,e.useMemo)(()=>_(h,r),[h,r]);return i("SPAN"===n.BRAND),(0,s.jsx)("nav",{"aria-label":"Service sections",className:"relative hidden w-40 pt-6 pb-20 pl-4 lg:block",children:(0,s.jsx)("div",{className:"sticky top-16 flex flex-col",children:d.map(t=>{let e=a===t;return(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(C,{section:t,isActive:e}),"eligibility"===t&&(0,s.jsx)(E,{serviceDetails:h,activeSubsection:e?o:null}),"document"===t&&(0,s.jsx)(S,{isActive:e})]},t)})})})},"DocumentWorkspaceNavigationMobile",0,function(t){let{showFAQ:i}=t,r=(0,e.useRef)(null),{activeSection:n,serviceDetails:a}=(0,v.useDocumentWorkspaceStore)((0,l.useShallow)(t=>({activeSection:t.section,serviceDetails:t.serviceDetails}))),o=(0,e.useMemo)(()=>_(a,i),[a,i]);return(0,s.jsx)("nav",{"aria-label":"Service sections",className:"sticky top-16 z-sticky flex w-full max-w-full flex-col overflow-hidden bg-background-body pb-1.5 lg:hidden",children:(0,s.jsx)("div",{ref:r,className:"flex w-full max-w-full gap-4 overflow-x-auto border-b border-background-outline",children:o.map(t=>"document"===t?(0,s.jsx)(T,{isActive:n===t,containerRef:r},t):(0,s.jsx)(M,{section:t,isActive:n===t,containerRef:r},t))})})},"MobileDocumentApplicantMenu",0,T],751403)},283297,t=>{"use strict";var e=t.i(511345);let i=e.forwardRef(function(t,i){let{title:s,titleId:r,...n}=t;return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":r},n),s?e.createElement("title",{id:r},s):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))});t.s(["DocumentPlusIcon",0,i],283297)},58316,(t,e,i)=>{"use strict";var s=function(t){return t&&t.Math===Math&&t};e.exports=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s(t.g)||s("object"==typeof t.e&&t.e)||function(){return this}()||Function("return this")()},920568,(t,e,i)=>{"use strict";e.exports=function(t){try{return!!t()}catch(t){return!0}}},205635,(t,e,i)=>{"use strict";e.exports=!t.r(920568)(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}}
2)[1]})},220761,(t,e,i)=>{"use strict";e.exports=!t.r(920568)(function(){var t=(function(){}).bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},910603,(t,e,i)=>{"use strict";var s=t.r(220761),r=Function.prototype.call;e.exports=s?r.bind(r):function(){return r.apply(r,arguments)}},73453,(t,e,i)=>{"use strict";var s={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;i.f=r&&!s.call({1:2},1)?function(t){var e=r(this,t);return!!e&&e.enumerable}:s},851031,(t,e,i)=>{"use strict";e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},742392,(t,e,i)=>{"use strict";var s=t.r(220761),r=Function.prototype,n=r.call,a=s&&r.bind.bind(n,n);e.exports=s?a:function(t){return function(){return n.apply(t,arguments)}}},458992,(t,e,i)=>{"use strict";var s=t.r(742392),r=s({}.toString),n=s("".slice);e.exports=function(t){return n(r(t),8,-1)}},902259,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(920568),n=t.r(458992),a=Object,o=s("".split);e.exports=r(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===n(t)?o(t,""):a(t)}:a},856586,(t,e,i)=>{"use strict";e.exports=function(t){return null==t}},951831,(t,e,i)=>{"use strict";var s=t.r(856586),r=TypeError;e.exports=function(t){if(s(t))throw new r("Can't call method on "+t);return t}},178033,(t,e,i)=>{"use strict";var s=t.r(902259),r=t.r(951831);e.exports=function(t){return s(r(t))}},182299,(t,e,i)=>{"use strict";var s="object"==typeof document&&document.all;e.exports=void 0===s&&void 0!==s?function(t){return"function"==typeof t||t===s}:function(t){return"function"==typeof t}},751551,(t,e,i)=>{"use strict";var s=t.r(182299);e.exports=function(t){return"object"==typeof t?null!==t:s(t)}},12746,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(182299);e.exports=function(t,e){var i;return arguments.length<2?r(i=s[t])?i:void 0:s[t]&&s[t][e]}},980202,(t,e,i)=>{"use strict";e.exports=t.r(742392)({}.isPrototypeOf)},204385,(t,e,i)=>{"use strict";var s=t.r(58316).navigator,r=s&&s.userAgent;e.exports=r?String(r):""},821387,(t,e,i)=>{"use strict";var s,r,n=t.r(58316),a=t.r(204385),o=n.process,l=n.Deno,h=o&&o.versions||l&&l.version,d=h&&h.v8;d&&(r=(s=d.split("."))[0]>0&&s[0]<4?1:+(s[0]+s[1])),!r&&a&&(!(s=a.match(/Edge\/(\d+)/))||s[1]>=74)&&(s=a.match(/Chrome\/(\d+)/))&&(r=+s[1]),e.exports=r},904701,(t,e,i)=>{"use strict";var s=t.r(821387),r=t.r(920568),n=t.r(58316).String;e.exports=!!Object.getOwnPropertySymbols&&!r(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&s&&s<41})},272580,(t,e,i)=>{"use strict";e.exports=t.r(904701)&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},152001,(t,e,i)=>{"use strict";var s=t.r(12746),r=t.r(182299),n=t.r(980202),a=t.r(272580),o=Object;e.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=s("Symbol");return r(e)&&n(e.prototype,o(t))}},653083,(t,e,i)=>{"use strict";var s=String;e.exports=function(t){try{return s(t)}catch(t){return"Object"}}},768689,(t,e,i)=>{"use strict";var s=t.r(182299),r=t.r(653083),n=TypeError;e.exports=function(t){if(s(t))return t;throw new n(r(t)+" is not a function")}},193750,(t,e,i)=>{"use strict";var s=t.r(768689),r=t.r(856586);e.exports=function(t,e){var i=t[e];return r(i)?void 0:s(i)}},86,(t,e,i)=>{"use strict";var s=t.r(910603),r=t.r(182299),n=t.r(751551),a=TypeError;e.exports=function(t,e){var i,o;if("string"===e&&r(i=t.toString)&&!n(o=s(i,t))||r(i=t.valueOf)&&!n(o=s(i,t))||"string"!==e&&r(i=t.toString)&&!n(o=s(i,t)))return o;throw new a("Can't convert object to primitive value")}},143225,(t,e,i)=>{"use strict";e.exports=!1},34536,(t,e,i)=>{"use strict";var s=t.r(58316),r=Object.defineProperty;e.exports=function(t,e){try{r(s,t,{value:e,configurable:!0,writable:!0})}catch(i){s[t]=e}return e}},799807,(t,e,i)=>{"use strict";var s=t.r(143225),r=t.r(58316),n=t.r(34536),a="__core-js_shared__",o=e.exports=r[a]||n(a,{});(o.versions||(o.versions=[])).push({version:"3.50.0",mode:s?"pure":"global",copyright:"© 2013â2025 Denis Pushkarev (zloirock.ru), 2025â2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"})},577860,(t,e,i)=>{"use strict";var s=t.r(799807),r=Object.create||Object;e.exports=function(t,e){return s[t]||(s[t]=e||r(null))}},434186,(t,e,i)=>{"use strict";var s=t.r(951831),r=Object;e.exports=function(t){return r(s(t))}},512044,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(434186),n=s({}.hasOwnProperty);e.exports=Object.hasOwn||function(t,e){return n(r(t),e)}},126026,(t,e,i)=>{"use strict";var s=t.r(742392),r=0,n=Math.random(),a=s(1.1.toString);e.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++r+n,36)}},276860,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(577860),n=t.r(512044),a=t.r(126026),o=t.r(904701),l=t.r(272580),h=s.Symbol,d=r("wks"),c=l?h.for||h:h&&h.withoutSetter||a;e.exports=function(t){return n(d,t)||(d[t]=o&&n(h,t)?h[t]:c("Symbol."+t)),d[t]}},346220,(t,e,i)=>{"use strict";var s=t.r(910603),r=t.r(751551),n=t.r(152001),a=t.r(193750),o=t.r(86),l=t.r(276860),h=TypeError,d=l("toPrimitive");e.exports=function(t,e){if(!r(t)||n(t))return t;var i,l=a(t,d);if(l){if(void 0===e&&(e="default"),!r(i=s(l,t,e))||n(i))return i;throw new h("Can't convert object to primitive value")}return void 0===e&&(e="number"),o(t,e)}},367029,(t,e,i)=>{"use strict";var s=t.r(346220),r=t.r(152001);e.exports=function(t){var e=s(t,"string");return r(e)?e:e+""}},952835,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(751551),n=s.document,a=r(n)&&r(n.createElement);e.exports=function(t){return a?n.createElement(t):{}}},544194,(t,e,i)=>{"use strict";var s=t.r(205635),r=t.r(920568),n=t.r(952835);e.exports=!s&&!r(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})},961733,(t,e,i)=>{"use strict";var s=t.r(205635),r=t.r(910603),n=t.r(73453),a=t.r(851031),o=t.r(178033),l=t.r(367029),h=t.r(512044),d=t.r(544194),c=Object.getOwnPropertyDescriptor;i.f=s?c:function(t,e){if(t=o(t),e=l(e),d)try{return c(t,e)}catch(t){}if(h(t,e))return a(!r(n.f,t,e),t[e])}},444559,(t,e,i)=>{"use strict";var s=t.r(205635),r=t.r(920568);e.exports=s&&r(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},566113,(t,e,i)=>{"use strict";var s=t.r(751551),r=String,n=TypeError;e.exports=function(t){if(s(t))return t;throw new n(r(t)+" is not an object")}},803759,(t,e,i)=>{"use strict";var s=t.r(205635),r=t.r(544194),n=t.r(444559),a=t.r(566113),o=t.r(367029),l=TypeError,h=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c="enumerable",u="configurable",p="writable";
2i.f=s?n?function(t,e,i){if(a(t),e=o(e),a(i),"function"==typeof t&&"prototype"===e&&"value"in i&&p in i&&!i[p]){var s=d(t,e);s&&s[p]&&(t[e]=i.value,i={configurable:u in i?i[u]:s[u],enumerable:c in i?i[c]:s[c],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(a(t),e=o(e),a(i),r)try{return h(t,e,i)}catch(t){}if("get"in i||"set"in i)throw new l("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},733579,(t,e,i)=>{"use strict";var s=t.r(205635),r=t.r(803759),n=t.r(851031);e.exports=s?function(t,e,i){return r.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},948373,(t,e,i)=>{"use strict";var s=t.r(205635),r=t.r(512044),n=Function.prototype,a=s&&Object.getOwnPropertyDescriptor,o=r(n,"name"),l=o&&(!s||s&&a(n,"name").configurable);e.exports={EXISTS:o,PROPER:o&&"something"===(function(){}).name,CONFIGURABLE:l}},218491,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(182299),n=t.r(799807),a=s(Function.toString);r(n.inspectSource)||(n.inspectSource=function(t){return a(t)}),e.exports=n.inspectSource},833257,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(182299),n=s.WeakMap;e.exports=r(n)&&/native code/.test(String(n))},639962,(t,e,i)=>{"use strict";var s=t.r(577860),r=t.r(126026),n=s("keys");e.exports=function(t){return n[t]||(n[t]=r(t))}},810894,(t,e,i)=>{"use strict";e.exports={}},26519,(t,e,i)=>{"use strict";var s,r,n,a=t.r(833257),o=t.r(58316),l=t.r(751551),h=t.r(733579),d=t.r(512044),c=t.r(799807),u=t.r(639962),p=t.r(810894),g="Object already initialized",f=o.TypeError,m=o.WeakMap;if(a||c.state){var b=c.state||(c.state=new m);b.get=b.get,b.has=b.has,b.set=b.set,s=function(t,e){if(b.has(t))throw new f(g);return e.facade=t,b.set(t,e),e},r=function(t){return b.get(t)||{}},n=function(t){return b.has(t)}}else{var v=u("state");p[v]=!0,s=function(t,e){if(d(t,v))throw new f(g);return e.facade=t,h(t,v,e),e},r=function(t){return d(t,v)?t[v]:{}},n=function(t){return d(t,v)}}e.exports={set:s,get:r,has:n,enforce:function(t){return n(t)?r(t):s(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=r(e)).type!==t)throw new f("Incompatible receiver, "+t+" required");return i}}}},885218,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(920568),n=t.r(182299),a=t.r(512044),o=t.r(205635),l=t.r(948373).CONFIGURABLE,h=t.r(218491),d=t.r(26519),c=d.enforce,u=d.get,p=String,g=Object.defineProperty,f=s("".slice),m=s("".replace),b=s([].join),v=o&&!r(function(){return 8!==g(function(){},"length",{value:8}).length}),y=String(String).split("String"),x=e.exports=function(t,e,i){"Symbol("===f(p(e),0,7)&&(e="["+m(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!a(t,"name")||l&&t.name!==e)&&(o?g(t,"name",{value:e,configurable:!0}):t.name=e),v&&i&&a(i,"arity")&&t.length!==i.arity&&g(t,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?o&&g(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var s=c(t);return a(s,"source")||(s.source=b(y,"string"==typeof e?e:"")),t};Function.prototype.toString=x(function(){return n(this)&&u(this).source||h(this)},"toString")},403227,(t,e,i)=>{"use strict";var s=t.r(182299),r=t.r(803759),n=t.r(885218),a=t.r(34536);e.exports=function(t,e,i,o){o||(o={});var l=o.enumerable,h=void 0!==o.name?o.name:e;if(s(i)&&n(i,h,o),o.global)l?t[e]=i:a(e,i);else{try{o.unsafe?t[e]&&(l=!0):delete t[e]}catch(t){}l?t[e]=i:r.f(t,e,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},310586,(t,e,i)=>{"use strict";var s=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(t){var e=+t;return(e>0?r:s)(e)}},858454,(t,e,i)=>{"use strict";var s=t.r(310586);e.exports=function(t){var e=+t;return e!=e||0===e?0:s(e)}},898036,(t,e,i)=>{"use strict";var s=t.r(858454),r=Math.max,n=Math.min;e.exports=function(t,e){var i=s(t);return i<0?r(i+e,0):n(i,e)}},434553,(t,e,i)=>{"use strict";var s=t.r(858454),r=Math.min;e.exports=function(t){var e=s(t);return e>0?r(e,0x1fffffffffffff):0}},547586,(t,e,i)=>{"use strict";var s=t.r(434553);e.exports=function(t){return s(t.length)}},62604,(t,e,i)=>{"use strict";var s=t.r(178033),r=t.r(898036),n=t.r(547586),a=function(t){return function(e,i,a){var o,l=s(e),h=n(l);if(0===h)return!t&&-1;var d=r(a,h);if(t&&i!=i){for(;h>d;)if((o=l[d++])!=o)return!0}else for(;h>d;d++)if((t||d in l)&&l[d]===i)return t||d||0;return!t&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},980912,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(512044),n=t.r(178033),a=t.r(62604).indexOf,o=t.r(810894),l=s([].push);e.exports=function(t,e){var i,s=n(t),h=0,d=[];for(i in s)!r(o,i)&&r(s,i)&&l(d,i);for(;e.length>h;
2)r(s,i=e[h++])&&(~a(d,i)||l(d,i));return d}},127157,(t,e,i)=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},317617,(t,e,i)=>{"use strict";var s=t.r(980912),r=t.r(127157).concat("length","prototype");i.f=Object.getOwnPropertyNames||function(t){return s(t,r)}},840340,(t,e,i)=>{"use strict";i.f=Object.getOwnPropertySymbols},319445,(t,e,i)=>{"use strict";var s=t.r(12746),r=t.r(742392),n=t.r(317617),a=t.r(840340),o=t.r(566113),l=r([].concat);e.exports=s("Reflect","ownKeys")||function(t){var e=n.f(o(t)),i=a.f;return i?l(e,i(t)):e}},614608,(t,e,i)=>{"use strict";var s=t.r(512044),r=t.r(319445),n=t.r(961733),a=t.r(803759);e.exports=function(t,e,i){for(var o=r(e),l=a.f,h=n.f,d=0;d<o.length;d++){var c=o[d];s(t,c)||i&&s(i,c)||l(t,c,h(e,c))}}},744162,(t,e,i)=>{"use strict";var s=t.r(920568),r=t.r(182299),n=/#|\.prototype\./,a=function(t,e){var i=l[o(t)];return i===d||i!==h&&(r(e)?s(e):!!e)},o=a.normalize=function(t){return String(t).replace(n,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",d=a.POLYFILL="P";e.exports=a},296621,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(961733).f,n=t.r(733579),a=t.r(403227),o=t.r(34536),l=t.r(614608),h=t.r(744162);e.exports=function(t,e){var i,d,c,u,p,g=t.target,f=t.global,m=t.stat;if(i=f?s:m?s[g]||o(g,{}):s[g]&&s[g].prototype)for(d in e){if(u=e[d],c=t.dontCallGetSet?(p=r(i,d))&&p.value:i[d],!h(f?d:g+(m?".":"#")+d,t.forced)&&void 0!==c){if(typeof u==typeof c)continue;l(u,c)}(t.sham||c&&c.sham)&&n(u,"sham",!0),a(i,d,u,t)}}},517878,(t,e,i)=>{"use strict";var s=t.r(980912),r=t.r(127157);e.exports=Object.keys||function(t){return s(t,r)}},302752,(t,e,i)=>{"use strict";var s=t.r(205635),r=t.r(444559),n=t.r(803759),a=t.r(566113),o=t.r(178033),l=t.r(517878);i.f=s&&!r?Object.defineProperties:function(t,e){a(t);for(var i,s=o(e),r=l(e),h=r.length,d=0;h>d;)n.f(t,i=r[d++],s[i]);return t}},879983,(t,e,i)=>{"use strict";e.exports=t.r(12746)("document","documentElement")},598688,(t,e,i)=>{"use strict";var s,r=t.r(566113),n=t.r(302752),a=t.r(127157),o=t.r(810894),l=t.r(879983),h=t.r(952835),d=t.r(639962),c="prototype",u="script",p=d("IE_PROTO"),g=function(){},f=function(t){return"<"+u+">"+t+"</"+u+">"},m=function(t){t.write(f("")),t.close();var e=t.parentWindow.Object;return t=null,e},b=function(){var t,e=h("iframe");return e.style.display="none",l.appendChild(e),e.src=String("java"+u+":"),(t=e.contentWindow.document).open(),t.write(f("document.F=Object")),t.close(),t.F},v=function(){try{s=new ActiveXObject("htmlfile")}catch(t){}v="u">typeof document?document.domain&&s?m(s):b():m(s);for(var t=a.length;t--;)delete v[c][a[t]];return v()};o[p]=!0,e.exports=Object.create||function(t,e){var i;return null!==t?(g[c]=r(t),i=new g,g[c]=null,i[p]=t):i=v(),void 0===e?i:n.f(i,e)}},618734,(t,e,i)=>{"use strict";var s=t.r(276860),r=t.r(598688),n=t.r(803759).f,a=s("unscopables"),o=Array.prototype;void 0===o[a]&&n(o,a,{configurable:!0,value:r(null)}),e.exports=function(t){o[a][t]=!0}},648205,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(434186),n=t.r(547586),a=t.r(858454),o=t.r(618734);s({target:"Array",proto:!0},{at:function(t){var e=r(this),i=n(e),s=a(t),o=s>=0?s:i+s;return o<0||o>=i?void 0:e[o]}}),o("at")},190097,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(742392);e.exports=function(t,e){return r(s[t].prototype[e])}},242677,(t,e,i)=>{"use strict";t.r(648205),e.exports=t.r(190097)("Array","at")},252698,(t,e,i)=>{"use strict";e.exports=t.r(242677)},256555,(t,e,i)=>{"use strict";e.exports=t.r(252698)},861599,(t,e,i)=>{"use strict";e.exports=Object.create?Object.create(null):{}},729964,(t,e,i)=>{"use strict";e.exports=!t.r(920568)(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},123494,(t,e,i)=>{"use strict";var s=t.r(512044),r=t.r(182299),n=t.r(434186),a=t.r(639962),o=t.r(729964),l=a("IE_PROTO"),h=Object,d=h.prototype;e.exports=o?h.getPrototypeOf:function(t){var e=n(t);if(s(e,l))return e[l];var i=e.constructor;return r(i)&&e instanceof i?i.prototype:e instanceof h?d:null}},975492,(t,e,i)=>{"use strict";var s,r,n,a=t.r(920568),o=t.r(182299),l=t.r(751551),h=t.r(598688),d=t.r(123494),c=t.r(403227),u=t.r(276860),p=t.r(143225),g=u("iterator"),f=!1;[].keys&&("next"in(n=[].keys())?(r=d(d(n)))!==Object.prototype&&(s=r):f=!0),!l(s)||a(function(){var t={};return s[g].call(t)!==t})?s={}:p&&(s=h(s)),o(s[g])||c(s,g,function(){return this}),e.exports={IteratorPrototype:s,BUGGY_SAFARI_ITERATORS:f}},215785,(t,e,i)=>{"use strict";var s=t.r(803759).f,r=t.r(512044),n=t.r(276860)("toStringTag");
2e.exports=function(t,e,i){t&&!i&&(t=t.prototype),t&&!r(t,n)&&s(t,n,{configurable:!0,value:e})}},34684,(t,e,i)=>{"use strict";var s=t.r(975492).IteratorPrototype,r=t.r(598688),n=t.r(851031),a=t.r(215785),o=t.r(861599),l=function(){return this};e.exports=function(t,e,i,h){var d=e+" Iterator";return t.prototype=r(s,{next:n(+!h,i)}),a(t,d,!1,!0),o[d]=l,t}},931794,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(768689);e.exports=function(t,e,i){try{return s(r(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}}},944893,(t,e,i)=>{"use strict";var s=t.r(751551);e.exports=function(t){return s(t)||null===t}},254658,(t,e,i)=>{"use strict";var s=t.r(944893),r=String,n=TypeError;e.exports=function(t){if(s(t))return t;throw new n("Can't set "+r(t)+" as a prototype")}},405827,(t,e,i)=>{"use strict";var s=t.r(931794),r=t.r(751551),n=t.r(951831),a=t.r(254658);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=s(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,s){return n(i),a(s),r(i)&&(e?t(i,s):i.__proto__=s),i}}():void 0)},534906,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(910603),n=t.r(143225),a=t.r(948373),o=t.r(182299),l=t.r(34684),h=t.r(123494),d=t.r(405827),c=t.r(215785),u=t.r(733579),p=t.r(403227),g=t.r(276860),f=t.r(861599),m=t.r(975492),b=a.PROPER,v=a.CONFIGURABLE,y=m.IteratorPrototype,x=m.BUGGY_SAFARI_ITERATORS,A=g("iterator"),w="keys",_="values",E="entries",S=function(){return this};e.exports=function(t,e,i,a,g,m,C){l(i,e,a);var T,M,k,P=function(t){if(t===g&&F)return F;if(!x&&t&&t in I)return I[t];switch(t){case w:case _:case E:return function(){return new i(this,t)}}return function(){return new i(this)}},R=e+" Iterator",D=!1,I=t.prototype,L=I[A]||I["@@iterator"]||g&&I[g],F=!x&&L||P(g),N="Array"===e&&I.entries||L;if(N&&(T=h(N.call(new t)))!==Object.prototype&&T.next&&(!n&&h(T)!==y&&(d?d(T,y):o(T[A])||p(T,A,S)),c(T,R,!0,!0),n&&(f[R]=S)),b&&g===_&&L&&L.name!==_&&(!n&&v?u(I,"name",_):(D=!0,F=function(){return r(L,this)})),g)if(M={values:P(_),keys:m?F:P(w),entries:P(E)},C)for(k in M)!x&&!D&&k in I||p(I,k,M[k]);else s({target:e,proto:!0,forced:x||D},M);return(!n||C)&&I[A]!==F&&p(I,A,F,{name:g}),f[e]=F,M}},195681,(t,e,i)=>{"use strict";e.exports=function(t,e){return{value:t,done:e}}},8372,(t,e,i)=>{"use strict";var s=t.r(178033),r=t.r(618734),n=t.r(861599),a=t.r(26519),o=t.r(803759).f,l=t.r(534906),h=t.r(195681),d=t.r(143225),c=t.r(205635),u="Array Iterator",p=a.set,g=a.getterFor(u);e.exports=l(Array,"Array",function(t,e){p(this,{type:u,target:s(t),index:0,kind:e})},function(){var t=g(this),e=t.target,i=t.index++;if(!e||i>=e.length)return t.target=null,h(void 0,!0);switch(t.kind){case"keys":return h(i,!1);case"values":return h(e[i],!1)}return h([i,e[i]],!1)},"values");var f=n.Arguments=n.Array;if(r("keys"),r("values"),r("entries"),!d&&c&&"values"!==f.name)try{o(f,"name",{value:"values"})}catch(t){}},618189,(t,e,i)=>{"use strict";var s=t.r(276860)("toStringTag"),r={};r[s]="z",e.exports="[object z]"===String(r)},438631,(t,e,i)=>{"use strict";var s=t.r(618189),r=t.r(182299),n=t.r(458992),a=t.r(276860)("toStringTag"),o=Object,l="Arguments"===n(function(){return arguments}()),h=function(t,e){try{return t[e]}catch(t){}};e.exports=s?n:function(t){var e,i,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=h(e=o(t),a))?i:l?n(e):"Object"===(s=n(e))&&r(e.callee)?"Arguments":s}},143536,(t,e,i)=>{"use strict";var s=t.r(618189),r=t.r(438631);e.exports=s?({}).toString:function(){return"[object "+r(this)+"]"}},308021,(t,e,i)=>{"use strict";var s=t.r(618189),r=t.r(403227),n=t.r(143536);s||r(Object.prototype,"toString",n,{unsafe:!0})},638450,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(204385),n=t.r(458992),a=function(t){return r.slice(0,t.length)===t};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":s.Bun&&"string"==typeof Bun.version?"BUN":s.Deno&&"object"==typeof Deno.version?"DENO":"process"===n(s.process)?"NODE":s.window&&s.document?"BROWSER":"REST"},853230,(t,e,i)=>{"use strict";e.exports="NODE"===t.r(638450)},43711,(t,e,i)=>{"use strict";e.exports=t.r(58316)},250860,(t,e,i)=>{"use strict";var s=t.r(885218),r=t.r(803759);
2e.exports=function(t,e,i){return i.get&&s(i.get,e,{getter:!0}),i.set&&s(i.set,e,{setter:!0}),r.f(t,e,i)}},532225,(t,e,i)=>{"use strict";var s=t.r(12746),r=t.r(250860),n=t.r(276860),a=t.r(205635),o=n("species");e.exports=function(t){var e=s(t);a&&e&&!e[o]&&r(e,o,{configurable:!0,get:function(){return this}})}},625716,(t,e,i)=>{"use strict";var s=t.r(980202),r=TypeError;e.exports=function(t,e){if(s(e,t))return t;throw new r("Incorrect invocation")}},429121,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(920568),n=t.r(182299),a=t.r(438631),o=t.r(12746),l=t.r(218491),h=function(){},d=o("Reflect","construct"),c=/^\s*(?:class|function)\b/,u=s(c.exec),p=!c.test(h),g=function(t){if(!n(t))return!1;try{return d(h,[],t),!0}catch(t){return!1}},f=function(t){if(!n(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!u(c,l(t))}catch(t){return!0}};f.sham=!0,e.exports=!d||r(function(){var t;return g(g.call)||!g(Object)||!g(function(){t=!0})||t})?f:g},127638,(t,e,i)=>{"use strict";var s=t.r(429121),r=t.r(653083),n=TypeError;e.exports=function(t){if(s(t))return t;throw new n(r(t)+" is not a constructor")}},606348,(t,e,i)=>{"use strict";var s=t.r(566113),r=t.r(127638),n=t.r(856586),a=t.r(276860)("species");e.exports=function(t,e){var i,o=s(t).constructor;return void 0===o||n(i=s(o)[a])?e:r(i)}},648003,(t,e,i)=>{"use strict";var s=t.r(220761),r=Function.prototype,n=r.apply,a=r.call;e.exports="object"==typeof Reflect&&Reflect.apply||(s?a.bind(n):function(){return a.apply(n,arguments)})},28682,(t,e,i)=>{"use strict";var s=t.r(458992),r=t.r(742392);e.exports=function(t){if("Function"===s(t))return r(t)}},702664,(t,e,i)=>{"use strict";var s=t.r(28682),r=t.r(768689),n=t.r(220761),a=s(s.bind);e.exports=function(t,e){return r(t),void 0===e?t:n?a(t,e):function(){return t.apply(e,arguments)}}},231608,(t,e,i)=>{"use strict";e.exports=t.r(742392)([].slice)},277168,(t,e,i)=>{"use strict";var s=TypeError;e.exports=function(t,e){if(t<e)throw new s("Not enough arguments");return t}},120774,(t,e,i)=>{"use strict";var s=t.r(204385);e.exports=/ipad|iphone|ipod/i.test(s)&&/applewebkit/i.test(s)},377468,(t,e,i)=>{"use strict";var s,r,n,a,o=t.r(58316),l=t.r(648003),h=t.r(702664),d=t.r(182299),c=t.r(512044),u=t.r(920568),p=t.r(879983),g=t.r(231608),f=t.r(952835),m=t.r(277168),b=t.r(120774),v=t.r(853230),y=o.setImmediate,x=o.clearImmediate,A=o.process,w=o.Dispatch,_=o.Function,E=o.MessageChannel,S=o.String,C=0,T={},M="onreadystatechange";u(function(){s=o.location});var k=function(t){if(c(T,t)){var e=T[t];delete T[t],e()}},P=function(t){return function(){k(t)}},R=function(t){k(t.data)},D=function(t){o.postMessage(S(t),s.protocol+"//"+s.host)};y&&x||(y=function(t){m(arguments.length,1);var e=d(t)?t:_(t),i=g(arguments,1);return T[++C]=function(){l(e,void 0,i)},r(C),C},x=function(t){delete T[t]},v?r=function(t){A.nextTick(P(t))}:w&&w.now?r=function(t){w.now(P(t))}:E&&!b?(a=(n=new E).port2,n.port1.onmessage=R,r=h(a.postMessage,a)):o.addEventListener&&d(o.postMessage)&&!o.importScripts&&s&&"file:"!==s.protocol&&!u(D)?(r=D,o.addEventListener("message",R,!1)):r=M in f("script")?function(t){p.appendChild(f("script"))[M]=function(){p.removeChild(this),k(t)}}:function(t){setTimeout(P(t),0)}),e.exports={set:y,clear:x}},961839,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(205635),n=Object.getOwnPropertyDescriptor;e.exports=function(t){if(!r)return s[t];var e=n(s,t);return e&&e.value}},584625,(t,e,i)=>{"use strict";var s=function(){this.head=null,this.tail=null};s.prototype={add:function(t){var e={item:t,next:null},i=this.tail;i?i.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},e.exports=s},483394,(t,e,i)=>{"use strict";var s=t.r(204385);e.exports=/ipad|iphone|ipod/i.test(s)&&"u">typeof Pebble},636801,(t,e,i)=>{"use strict";var s=t.r(204385);e.exports=/web0s(?!.*chrome)/i.test(s)},511652,(t,e,i)=>{"use strict";var s,r,n,a,o,l=t.r(58316),h=t.r(961839),d=t.r(702664),c=t.r(377468).set,u=t.r(584625),p=t.r(120774),g=t.r(483394),f=t.r(636801),m=t.r(853230),b=l.MutationObserver||l.WebKitMutationObserver,v=l.document,y=l.process,x=l.Promise,A=h("queueMicrotask");if(!A){var w=new u,_=function(){var t,e;for(m&&(t=y.domain)&&t.exit();e=w.get();)try{e()}catch(t){throw w.head&&s(),t}t&&t.enter()};p||m||f||!b||!v?!g&&x&&x.resolve?((a=x.resolve(void 0)).constructor=x,o=d(a.then,a),s=function(){o(_)}):m?s=function(){y.nextTick(_)}:(c=d(c,l),s=function(){c(_)}):(r=!0,n=v.createTextNode(""),new b(_).observe(n,{characterData:!0}
2),s=function(){n.data=r=!r}),A=function(t){w.head||s(),w.add(t)}}e.exports=A},797105,(t,e,i)=>{"use strict";e.exports=function(t,e){try{1==arguments.length?console.error(t):console.error(t,e)}catch(t){}}},171060,(t,e,i)=>{"use strict";e.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},158159,(t,e,i)=>{"use strict";e.exports=t.r(58316).Promise},189698,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(158159),n=t.r(182299),a=t.r(744162),o=t.r(218491),l=t.r(276860),h=t.r(638450),d=t.r(143225),c=t.r(821387),u=r&&r.prototype,p=l("species"),g=!1,f=n(s.PromiseRejectionEvent);e.exports={CONSTRUCTOR:a("Promise",function(){var t=o(r),e=t!==String(r);if(!e&&66===c||d&&!(u.catch&&u.finally))return!0;if(!c||c<51||!/native code/.test(t)){var i=new r(function(t){t(1)}),s=function(t){t(function(){},function(){})};if((i.constructor={})[p]=s,!(g=i.then(function(){})instanceof s))return!0}return!e&&("BROWSER"===h||"DENO"===h)&&!f}),REJECTION_EVENT:f,SUBCLASSING:g}},892302,(t,e,i)=>{"use strict";var s=t.r(768689),r=TypeError,n=function(t){var e,i;this.promise=new t(function(t,s){if(void 0!==e||void 0!==i)throw new r("Bad Promise constructor");e=t,i=s}),this.resolve=s(e),this.reject=s(i)};e.exports.f=function(t){return new n(t)}},774453,(t,e,i)=>{"use strict";var s,r,n,a,o=t.r(296621),l=t.r(143225),h=t.r(853230),d=t.r(58316),c=t.r(43711),u=t.r(910603),p=t.r(403227),g=t.r(405827),f=t.r(215785),m=t.r(532225),b=t.r(768689),v=t.r(182299),y=t.r(751551),x=t.r(625716),A=t.r(606348),w=t.r(377468).set,_=t.r(511652),E=t.r(797105),S=t.r(171060),C=t.r(584625),T=t.r(26519),M=t.r(158159),k=t.r(189698),P=t.r(892302),R="Promise",D=k.CONSTRUCTOR,I=k.REJECTION_EVENT,L=k.SUBCLASSING,F=T.getterFor(R),N=T.set,O=M&&M.prototype,j=M,B=O,z=d.TypeError,H=d.document,U=d.process,$=P.f,G=$,V=!!(H&&H.createEvent&&d.dispatchEvent),W="unhandledrejection",q=function(t){var e;return!!(y(t)&&v(e=t.then))&&e},K=function(t,e){var i,s,r,n=e.value,a=1===e.state,o=a?t.ok:t.fail,l=t.resolve,h=t.reject,d=t.domain;try{o?(a||(2===e.rejection&&Z(e),e.rejection=1),!0===o?i=n:(d&&d.enter(),i=o(n),d&&(d.exit(),r=!0)),i===t.promise?h(new z("Promise-chain cycle")):(s=q(i))?u(s,i,l,h):l(i)):h(n)}catch(t){d&&!r&&d.exit(),h(t)}},X=function(t,e){t.notified||(t.notified=!0,_(function(){for(var i,s=t.reactions;i=s.get();)K(i,t);t.notified=!1,e&&!t.rejection&&Q(t)}))},Y=function(t,e,i){var s,r;V?((s=H.createEvent("Event")).promise=e,s.reason=i,s.initEvent(t,!1,!0),d.dispatchEvent(s)):s={promise:e,reason:i},!I&&(r=d["on"+t])?r(s):t===W&&E("Unhandled promise rejection",i)},Q=function(t){u(w,d,function(){var e,i=t.facade,s=t.value;if(J(t)&&(e=S(function(){h?U.emit("unhandledRejection",s,i):Y(W,i,s)}),t.rejection=h||J(t)?2:1,e.error))throw e.value})},J=function(t){return 1!==t.rejection&&!t.parent},Z=function(t){u(w,d,function(){var e=t.facade;h?U.emit("rejectionHandled",e):Y("rejectionhandled",e,t.value)})},tt=function(t,e,i){return function(s){t(e,s,i)}},te=function(t,e,i){t.done||(t.done=!0,i&&(t=i),t.value=e,t.state=2,X(t,!0))},ti=function(t,e,i){if(!t.done){t.done=!0,i&&(t=i);try{if(t.facade===e)throw new z("Promise can't be resolved itself");var s=q(e);s?_(function(){var i={done:!1};try{u(s,e,tt(ti,i,t),tt(te,i,t))}catch(e){te(i,e,t)}}):(t.value=e,t.state=1,X(t,!1))}catch(e){te({done:!1},e,t)}}};if(D&&(B=(j=function(t){x(this,B),b(t),u(s,this);var e=F(this);try{t(tt(ti,e),tt(te,e))}catch(t){te(e,t)}}).prototype,(s=function(t){N(this,{type:R,done:!1,notified:!1,parent:!1,reactions:new C,rejection:!1,state:0,value:null})}).prototype=p(B,"then",function(t,e){var i=F(this),s=$(A(this,j));return i.parent=!0,s.ok=!v(t)||t,s.fail=v(e)&&e,s.domain=h?U.domain:void 0,0===i.state?i.reactions.add(s):_(function(){K(s,i)}),s.promise}),r=function(){var t=new s,e=F(t);this.promise=t,this.resolve=tt(ti,e),this.reject=tt(te,e)},P.f=$=function(t){return t===j||t===n?new r(t):G(t)},!l&&v(M)&&O!==Object.prototype)){a=O.then,L||p(O,"then",function(t,e){var i=this;return new j(function(t,e){u(a,i,t,e)}).then(t,e)},{unsafe:!0});try{delete O.constructor}catch(t){}g&&g(O,B)}o({global:!0,constructor:!0,wrap:!0,forced:D},{Promise:j}),n=c.Promise,f(j,R,!1,!0),m(R)},788120,(t,e,i)=>{"use strict";var s=t.r(276860),r=t.r(861599),n=s("iterator"),a=Array.prototype;e.exports=function(t){return void 0!==t&&(r.Array===t||a[n]===t)}},865157,(t,e,i)=>{"use strict";var s=t.r(458992),r=t.r(856586),n=t.r(193750),a=t.r(276860)("iterator"),o=Array.prototype;e.exports=function(t){if(!r(t))return n(t,a)||n(t,"@@iterator")||("Arguments"===s(t)?o[a]:void 0)}},655745,(t,e,i)=>{"use strict";var s=t.r(910603),r=t.r(182299),n=t.r(566113),a=t.r(653083),o=t.r(865157),l=TypeError;e.exports=function(t,e){var i=arguments.length<2?o(t):e;if(r(i))return n(s(i,t));throw new l(a(t)+" is not iterable")}},7496,(t,e,i)=>{"use strict";var s=t.r(910603),r=t.r(566113),n=t.r(193750);
2e.exports=function(t,e,i){var a,o;r(t);try{if(!(a=n(t,"return"))){if("throw"===e)throw i;return i}a=s(a,t)}catch(t){o=!0,a=t}if("throw"===e)throw i;if(o)throw a;return r(a),i}},907432,(t,e,i)=>{"use strict";var s=t.r(702664),r=t.r(910603),n=t.r(566113),a=t.r(653083),o=t.r(788120),l=t.r(547586),h=t.r(980202),d=t.r(655745),c=t.r(865157),u=t.r(7496),p=TypeError,g=function(t,e){this.stopped=t,this.result=e},f=g.prototype;e.exports=function(t,e,i){var m,b,v,y,x,A,w,_=i&&i.that,E=!!(i&&i.AS_ENTRIES),S=!!(i&&i.IS_RECORD),C=!!(i&&i.IS_ITERATOR),T=!!(i&&i.INTERRUPTED),M=s(e,_),k=function(t){var e=m;return m=void 0,e&&u(e,"normal"),new g(!0,t)},P=function(t){return E?(n(t),T?M(t[0],t[1],k):M(t[0],t[1])):T?M(t,k):M(t)};if(S)m=t.iterator;else if(C)m=t;else{if(!(b=c(t)))throw new p(a(t)+" is not iterable");if(o(b)){for(v=0,y=l(t);y>v;v++)if((x=P(t[v]))&&h(f,x))return x;return new g(!1)}m=d(t,b)}for(A=S?t.next:m.next;!(w=r(A,m)).done;){var R=w.value;try{x=P(R)}catch(t){if(m)u(m,"throw",t);else throw t}if("object"==typeof x&&x&&h(f,x))return x}return new g(!1)}},575621,(t,e,i)=>{"use strict";var s=t.r(276860)("iterator"),r=!1;try{var n=0,a={next:function(){return{done:!!n++}},return:function(){r=!0}};a[s]=function(){return this},Array.from(a,function(){throw 2})}catch(t){}e.exports=function(t,e){try{if(!e&&!r)return!1}catch(t){return!1}var i=!1;try{var n={};n[s]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i}},66829,(t,e,i)=>{"use strict";var s=t.r(158159),r=t.r(575621);e.exports=t.r(189698).CONSTRUCTOR||!r(function(t){s.all(t).then(void 0,function(){})})},780367,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(910603),n=t.r(768689),a=t.r(892302),o=t.r(171060),l=t.r(907432);s({target:"Promise",stat:!0,forced:t.r(66829)},{all:function(t){var e=this,i=a.f(e),s=i.resolve,h=i.reject,d=o(function(){var i=n(e.resolve),a=[],o=0,d=1;l(t,function(t){var n=o++,l=!1;d++,r(i,e,t).then(function(t){!l&&(l=!0,a[n]=t,--d||s(a))},h)}),--d||s(a)});return d.error&&h(d.value),i.promise}})},253673,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(143225),n=t.r(189698).CONSTRUCTOR,a=t.r(158159),o=t.r(12746),l=t.r(182299),h=t.r(403227),d=a&&a.prototype;if(s({target:"Promise",proto:!0,forced:n,real:!0},{catch:function(t){return this.then(void 0,t)}}),!r&&l(a)){var c=o("Promise").prototype.catch;d.catch!==c&&h(d,"catch",c,{unsafe:!0})}},436986,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(910603),n=t.r(768689),a=t.r(892302),o=t.r(171060),l=t.r(907432);s({target:"Promise",stat:!0,forced:t.r(66829)},{race:function(t){var e=this,i=a.f(e),s=i.reject,h=o(function(){var a=n(e.resolve);l(t,function(t){r(a,e,t).then(i.resolve,s)})});return h.error&&s(h.value),i.promise}})},257288,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(892302);s({target:"Promise",stat:!0,forced:t.r(189698).CONSTRUCTOR},{reject:function(t){var e=r.f(this);return(0,e.reject)(t),e.promise}})},849084,(t,e,i)=>{"use strict";var s=t.r(566113),r=t.r(751551),n=t.r(892302);e.exports=function(t,e){if(s(t),r(e)&&e.constructor===t)return e;var i=n.f(t);return(0,i.resolve)(e),i.promise}},19501,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(12746),n=t.r(143225),a=t.r(158159),o=t.r(189698).CONSTRUCTOR,l=t.r(849084),h=r("Promise"),d=n&&!o;s({target:"Promise",stat:!0,forced:n||o},{resolve:function(t){return l(d&&this===h?a:this,t)}})},343796,(t,e,i)=>{"use strict";t.r(774453),t.r(780367),t.r(253673),t.r(436986),t.r(257288),t.r(19501)},625792,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(910603),n=t.r(768689),a=t.r(892302),o=t.r(171060),l=t.r(907432);s({target:"Promise",stat:!0,forced:t.r(66829)},{allSettled:function(t){var e=this,i=a.f(e),s=i.resolve,h=i.reject,d=o(function(){var i=n(e.resolve),a=[],o=0,h=1;l(t,function(t){var n=o++,l=!1;h++,r(i,e,t).then(function(t){!l&&(l=!0,a[n]={status:"fulfilled",value:t},--h||s(a))},function(t){!l&&(l=!0,a[n]={status:"rejected",reason:t},--h||s(a))})}),--h||s(a)});return d.error&&h(d.value),i.promise}})},513559,(t,e,i)=>{"use strict";var s=t.r(438631),r=String;e.exports=function(t){if("Symbol"===s(t))throw TypeError("Cannot convert a Symbol value to a string");return r(t)}},151394,(t,e,i)=>{"use strict";var s=t.r(742392),r=t.r(858454),n=t.r(513559),a=t.r(951831),o=s("".charAt),l=s("".charCodeAt),h=s("".slice),d=function(t){return function(e,i){var s,d,c=n(a(e)),u=r(i),p=c.length;return u<0||u>=p?t?"":void 0:(s=l(c,u))<55296||s>56319||u+1===p||(d=l(c,u+1))<56320||d>57343?t?o(c,u):s:t?h(c,u,u+2):(s-55296<<10)+(d-56320)+65536}};e.exports={codeAt:d(!1),charAt:d(!0)}},747491,(t,e,i)=>{"use strict";var s=t.r(151394).charAt,r=t.r(513559),n=t.r(26519),a=t.r(534906),o=t.r(195681),l="Str
2ing Iterator",h=n.set,d=n.getterFor(l);a(String,"String",function(t){h(this,{type:l,string:r(t),index:0})},function(){var t,e=d(this),i=e.string,r=e.index;return r>=i.length?o(void 0,!0):(t=s(i,r),e.index+=t.length,o(t,!1))})},527682,(t,e,i)=>{"use strict";t.r(8372),t.r(308021),t.r(343796),t.r(625792),t.r(747491);var s=t.r(910603),r=t.r(182299),n=t.r(43711).Promise,a=n.allSettled;e.exports=function(t){return s(a,r(this)?this:n,t)}},8661,(t,e,i)=>{"use strict";e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},932183,(t,e,i)=>{"use strict";var s=t.r(952835)("span").classList,r=s&&s.constructor&&s.constructor.prototype;e.exports=r===Object.prototype?void 0:r},47464,(t,e,i)=>{"use strict";var s=t.r(58316),r=t.r(8661),n=t.r(932183),a=t.r(8372),o=t.r(733579),l=t.r(215785),h=t.r(276860)("iterator"),d=a.values,c=function(t,e){if(t){if(t[h]!==d)try{o(t,h,d)}catch(e){t[h]=d}if(l(t,e,!0),r[e]){for(var i in a)if(t[i]!==a[i])try{o(t,i,a[i])}catch(e){t[i]=a[i]}}}};for(var u in r)c(s[u]&&s[u].prototype,u);c(n,"DOMTokenList")},999080,(t,e,i)=>{"use strict";var s=t.r(527682);t.r(47464),e.exports=s},336168,(t,e,i)=>{"use strict";e.exports=t.r(999080)},948653,(t,e,i)=>{"use strict";var s=t.r(296621),r=t.r(892302);s({target:"Promise",stat:!0},{withResolvers:function(){var t=r.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},294072,(t,e,i)=>{"use strict";t.r(948653)},934559,(t,e,i)=>{"use strict";t.r(294072)},499763,(t,e,i)=>{"use strict";t.i(728412),e.exports=function(){}},63844,t=>{"use strict";var e=t.i(793890),i=t.i(989239);t.s(["Chip",0,function(t){let{variant:s,fullWidth:r,className:n,children:a,isGrayscale:o,size:l,...h}=t,d=function(t){let e="rounded-lg px-4 py-3 text-sm font-semibold focus:outline-hidden focus:ring-1 focus:ring-primary-800";switch(t){case"sketch":return(0,i.cx)(e,"border border-orange-400 bg-contain bg-repeat text-texticon-primary");case"fill":return(0,i.cx)(e,"bg-primary-700 text-white");case"pale":return(0,i.cx)(e,"border border-primary-timeline bg-primary-100 text-texticon-primary");case"secondary":return(0,i.cx)(e,"rounded-full border border-custom-pink bg-primary-100 px-2 py-1 text-xs font-medium text-texticon-secondary");case"warning":return(0,i.cx)(e,"border border-warning-300 bg-warning-100 text-warning-800");case"danger":return(0,i.cx)(e,"border border-danger-700 bg-danger-100 text-danger-800");case"gray":return(0,i.cx)(e,"border border-texticon-secondary bg-background-tertiary text-texticon-secondary");case"green":return(0,i.cx)(e,"border border-green-700 bg-green-50 text-green-700");case"orange":return(0,i.cx)(e,"border border-primary-700 bg-primary-100 text-primary-700");case"smart":return(0,i.cx)(e,"overflow-clip rounded-full bg-white");default:return e}}(s),c=function(t){if("small"===t)return"text-xs px-2 py-1 font-medium"}(l);return"smart"===s?(0,e.jsx)("div",{className:"rounded-full bg-smart-gradient p-px",children:(0,e.jsx)("div",{className:(0,i.cx)(d,c,"bg-white"),children:(0,e.jsx)("div",{className:"text-smart",children:a})})}):(0,e.jsx)("div",{className:(0,i.cx)("flex flex-row items-center gap-2.5 whitespace-nowrap disabled:opacity-20",d,c,r&&"w-full justify-center text-center",n,o?"grayscale":""),style:{backgroundImage:"sketch"===s?"url('/img/pattern-timeline.png')":void 0},...h,children:a})}])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.