KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12
System : Windows NT SERVER-PC 10.0 build 26200 (Windows 11) AMD64
User : ServerPC ( 0)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  C:/Users/ServerPC/AppData/Roaming/Emby-Server/system.old/dashboard-ui/thirdparty/pdfjs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : C:/Users/ServerPC/AppData/Roaming/Emby-Server/system.old/dashboard-ui/thirdparty/pdfjs/pdf.js
define(["exports"],function(_exports){var _AnnotationEditor,_PDFDocumentLoadingTa,_PDFDocumentLoadingTa2,_FreeTextEditor,_HighlightEditor,_DrawingEditor;function _toSetter(t,e,n){var r=(e=e||[]).length++;return Object.defineProperty({},"_",{set:function(o){e[r]=o,t.apply(n,e)}})}function _superPropGet(t,o,e,r){var p=babelHelpers.get(babelHelpers.getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p}function ownKeys(e,r){var o,t=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)),t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){babelHelpers.defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _classPrivateMethodInitSpec(e,a){_checkPrivateRedeclaration(e,a),a.add(e)}function _classPrivateFieldInitSpec(e,t,a){_checkPrivateRedeclaration(e,t),t.set(e,a)}function _checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateGetter(s,r,a){return a(_assertClassBrand(s,r))}function _classPrivateFieldGet(s,a){return s.get(_assertClassBrand(s,a))}function _classPrivateFieldSet(s,a,r){return s.set(_assertClassBrand(s,a),r),r}function _createForOfIteratorHelper(r,e){var o,a,u,n,t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return u=!(a=!0),{s:function(){t=t.call(r)},n:function(){var r=t.next();return a=r.done,r},e:function(r){u=!0,o=r},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}};if(Array.isArray(r)||(t=function(r,a){{var t;if(r)return"string"==typeof r?_arrayLikeToArray(r,a):"Map"===(t="Object"===(t={}.toString.call(r).slice(8,-1))&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}(r))||e&&r&&"number"==typeof r.length)return t&&(r=t),n=0,{s:e=function(){},n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _assertClassBrand(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function _callSuper(t,o,e){return o=babelHelpers.getPrototypeOf(o),babelHelpers.possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],babelHelpers.getPrototypeOf(t).constructor):o.apply(t,e))}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function(){return!!t})()}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.InvalidPDFException=_exports.ImageKind=_exports.GlobalWorkerOptions=_exports.FeatureTest=_exports.DrawLayer=_exports.DOMSVGFactory=_exports.ColorPicker=_exports.AnnotationType=_exports.AnnotationMode=_exports.AnnotationLayer=_exports.AnnotationEditorUIManager=_exports.AnnotationEditorType=_exports.AnnotationEditorParamsType=_exports.AnnotationEditorLayer=_exports.AbortException=void 0,_exports.MathClamp=MathClamp,_exports.build=_exports.XfaLayer=_exports.VerbosityLevel=_exports.Util=_exports.TouchManager=_exports.TextLayer=_exports.SupportedImageMimeTypes=_exports.SignatureExtractor=_exports.ResponseException=_exports.RenderingCancelledException=_exports.PixelsPerInch=_exports.PermissionFlag=_exports.PasswordResponses=_exports.PDFWorker=_exports.PDFDateString=_exports.PDFDataRangeTransport=_exports.OutputScale=_exports.OPS=void 0,_exports.createValidAbsoluteUrl=createValidAbsoluteUrl,_exports.fetchData=fetchData,_exports.getDocument=getDocument,_exports.getFilenameFromUrl=getFilenameFromUrl,_exports.getPdfFilenameFromUrl=getPdfFilenameFromUrl,_exports.getUuid=getUuid,_exports.getXfaPageViewport=getXfaPageViewport,_exports.isDataScheme=isDataScheme,_exports.isPdfFile=isPdfFile,_exports.isValidExplicitDest=void 0,_exports.noContextMenu=noContextMenu,_exports.normalizeUnicode=normalizeUnicode,_exports.setLayerDimensions=setLayerDimensions,_exports.shadow=shadow,_exports.stopEvent=stopEvent,_exports.updateUrlHash=updateUrlHash,_exports.version=void 0;var isNodeJS=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],RenderingIntentFlag_ANY=1,RenderingIntentFlag_DISPLAY=2,RenderingIntentFlag_PRINT=4,RenderingIntentFlag_ANNOTATIONS_FORMS=16,RenderingIntentFlag_ANNOTATIONS_STORAGE=32,RenderingIntentFlag_ANNOTATIONS_DISABLE=64,RenderingIntentFlag_IS_EDITING=128,RenderingIntentFlag_OPLIST=256,AnnotationMode=_exports.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},AnnotationEditorType=_exports.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},AnnotationEditorParamsType=_exports.AnnotationEditorParamsType={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,DRAW_STEP:41},PermissionFlag=_exports.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},TextRenderingMode_FILL=0,TextRenderingMode_STROKE=1,TextRenderingMode_FILL_STROKE=2,TextRenderingMode_INVISIBLE=3,TextRenderingMode_FILL_STROKE_MASK=3,TextRenderingMode_ADD_TO_PATH_FLAG=4,util_ImageKind=_exports.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},AnnotationType=_exports.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},AnnotationBorderStyleType_SOLID=1,AnnotationBorderStyleType_DASHED=2,AnnotationBorderStyleType_BEVELED=3,AnnotationBorderStyleType_INSET=4,AnnotationBorderStyleType_UNDERLINE=5,VerbosityLevel=_exports.VerbosityLevel={ERRORS:0,WARNINGS:1,INFOS:5},OPS=_exports.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},DrawOPS_moveTo=0,DrawOPS_lineTo=1,DrawOPS_curveTo=2,DrawOPS_closePath=3,PasswordResponses=_exports.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},verbosity=VerbosityLevel.WARNINGS;function setVerbosityLevel(level){Number.isInteger(level)&&(verbosity=level)}function getVerbosityLevel(){return verbosity}function info(msg){verbosity>=VerbosityLevel.INFOS&&console.log("Info: ".concat(msg))}function warn(msg){verbosity>=VerbosityLevel.WARNINGS&&console.log("Warning: ".concat(msg))}function unreachable(msg){throw new Error(msg)}function assert(cond,msg){cond||unreachable(msg)}function createValidAbsoluteUrl(url){var baseUrl=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,options=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!url)return null;if(options&&"string"==typeof url&&(options.addDefaultProtocol&&url.startsWith("www.")&&2<=(null==(dots=url.match(/\./g))?void 0:dots.length)&&(url="http://".concat(url)),options.tryConvertEncoding))try{url=decodeURIComponent(escape(url))}catch(_unused){}var dots=baseUrl?URL.parse(url,baseUrl):URL.parse(url);return function(url){switch(null==url?void 0:url.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return 1;default:return}}(dots)?dots:null}function updateUrlHash(url,hash){var allowRel=2<arguments.length&&void 0!==arguments[2]&&arguments[2],res=URL.parse(url);return res?(res.hash=hash,res.href):allowRel&&createValidAbsoluteUrl(url,"http://example.com")?url.split("#",1)[0]+"".concat(hash?"#".concat(hash):""):""}function shadow(obj,prop,value){return Object.defineProperty(obj,prop,{value:value,enumerable:!(3<arguments.length&&void 0!==arguments[3]&&arguments[3]),configurable:!0,writable:!1}),value}var BaseException=function(){function BaseException(message,name){this.message=message,this.name=name}return BaseException.prototype=new Error,BaseException.constructor=BaseException}(),PasswordException=function(){function PasswordException(msg,code){return babelHelpers.classCallCheck(this,PasswordException),(msg=_callSuper(this,PasswordException,[msg,"PasswordException"])).code=code,msg}return babelHelpers.inherits(PasswordException,BaseException),babelHelpers.createClass(PasswordException)}(),UnknownErrorException=function(){function UnknownErrorException(msg,details){return babelHelpers.classCallCheck(this,UnknownErrorException),(msg=_callSuper(this,UnknownErrorException,[msg,"UnknownErrorException"])).details=details,msg}return babelHelpers.inherits(UnknownErrorException,BaseException),babelHelpers.createClass(UnknownErrorException)}(),InvalidPDFException=_exports.InvalidPDFException=function(){function InvalidPDFException(msg){return babelHelpers.classCallCheck(this,InvalidPDFException),_callSuper(this,InvalidPDFException,[msg,"InvalidPDFException"])}return babelHelpers.inherits(InvalidPDFException,BaseException),babelHelpers.createClass(InvalidPDFException)}(),ResponseException=_exports.ResponseException=function(){function ResponseException(msg,status,missing){return babelHelpers.classCallCheck(this,ResponseException),(msg=_callSuper(this,ResponseException,[msg,"ResponseException"])).status=status,msg.missing=missing,msg}return babelHelpers.inherits(ResponseException,BaseException),babelHelpers.createClass(ResponseException)}(),FormatError=function(){function FormatError(msg){return babelHelpers.classCallCheck(this,FormatError),_callSuper(this,FormatError,[msg,"FormatError"])}return babelHelpers.inherits(FormatError,BaseException),babelHelpers.createClass(FormatError)}(),AbortException=_exports.AbortException=function(){function AbortException(msg){return babelHelpers.classCallCheck(this,AbortException),_callSuper(this,AbortException,[msg,"AbortException"])}return babelHelpers.inherits(AbortException,BaseException),babelHelpers.createClass(AbortException)}();function bytesToString(bytes){"object"==typeof bytes&&void 0!==(null==bytes?void 0:bytes.length)||unreachable("Invalid argument for bytesToString");var length=bytes.length;if(length<8192)return String.fromCharCode.apply(null,bytes);for(var strBuf=[],i=0;i<length;i+=8192){var chunkEnd=Math.min(i+8192,length),chunkEnd=bytes.subarray(i,chunkEnd);strBuf.push(String.fromCharCode.apply(null,chunkEnd))}return strBuf.join("")}function stringToBytes(str){"string"!=typeof str&&unreachable("Invalid argument for stringToBytes");for(var length=str.length,bytes=new Uint8Array(length),i=0;i<length;++i)bytes[i]=255&str.charCodeAt(i);return bytes}var util_FeatureTest=_exports.FeatureTest=function(){return babelHelpers.createClass(function util_FeatureTest(){babelHelpers.classCallCheck(this,util_FeatureTest)},null,[{key:"isLittleEndian",get:function(){return shadow(this,"isLittleEndian",((buffer8=new Uint8Array(4))[0]=1)===new Uint32Array(buffer8.buffer,0,1)[0]);var buffer8}},{key:"isEvalSupported",get:function(){return shadow(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(_unused2){return!1}}())}},{key:"isOffscreenCanvasSupported",get:function(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}},{key:"isImageDecoderSupported",get:function(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}},{key:"platform",get:function(){var _navigator=navigator,platform=_navigator.platform,_navigator=_navigator.userAgent;return shadow(this,"platform",{isAndroid:_navigator.includes("Android"),isLinux:platform.includes("Linux"),isMac:platform.includes("Mac"),isWindows:platform.includes("Win"),isFirefox:_navigator.includes("Firefox")})}},{key:"isCSSRoundSupported",get:function(){var _globalThis$CSS;return shadow(this,"isCSSRoundSupported",null==(_globalThis$CSS=globalThis.CSS)||null==_globalThis$CSS.supports?void 0:_globalThis$CSS.supports("width: round(1.5px, 1px)"))}}])}(),hexNumbers=Array.from(Array(256).keys(),function(n){return n.toString(16).padStart(2,"0")}),Util=_exports.Util=function(){function Util(){babelHelpers.classCallCheck(this,Util)}return babelHelpers.createClass(Util,null,[{key:"makeHexColor",value:function(r,g,b){return"#".concat(hexNumbers[r]).concat(hexNumbers[g]).concat(hexNumbers[b])}},{key:"scaleMinMax",value:function(transform,minMax){var temp;transform[0]?(transform[0]<0&&(temp=minMax[0],minMax[0]=minMax[2],minMax[2]=temp),minMax[0]*=transform[0],minMax[2]*=transform[0],transform[3]<0&&(temp=minMax[1],minMax[1]=minMax[3],minMax[3]=temp),minMax[1]*=transform[3],minMax[3]*=transform[3]):(temp=minMax[0],minMax[0]=minMax[1],minMax[1]=temp,temp=minMax[2],minMax[2]=minMax[3],minMax[3]=temp,transform[1]<0&&(temp=minMax[1],minMax[1]=minMax[3],minMax[3]=temp),minMax[1]*=transform[1],minMax[3]*=transform[1],transform[2]<0&&(temp=minMax[0],minMax[0]=minMax[2],minMax[2]=temp),minMax[0]*=transform[2],minMax[2]*=transform[2]),minMax[0]+=transform[4],minMax[1]+=transform[5],minMax[2]+=transform[4],minMax[3]+=transform[5]}},{key:"transform",value:function(m1,m2){return[m1[0]*m2[0]+m1[2]*m2[1],m1[1]*m2[0]+m1[3]*m2[1],m1[0]*m2[2]+m1[2]*m2[3],m1[1]*m2[2]+m1[3]*m2[3],m1[0]*m2[4]+m1[2]*m2[5]+m1[4],m1[1]*m2[4]+m1[3]*m2[5]+m1[5]]}},{key:"applyTransform",value:function(p,m){var pos=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,p0=p[pos],p1=p[pos+1];p[pos]=p0*m[0]+p1*m[2]+m[4],p[pos+1]=p0*m[1]+p1*m[3]+m[5]}},{key:"applyTransformToBezier",value:function(p,transform){for(var pos=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,m0=transform[0],m1=transform[1],m2=transform[2],m3=transform[3],m4=transform[4],m5=transform[5],i=0;i<6;i+=2){var pI=p[pos+i],pI1=p[pos+i+1];p[pos+i]=pI*m0+pI1*m2+m4,p[pos+i+1]=pI*m1+pI1*m3+m5}}},{key:"applyInverseTransform",value:function(p,m){var p0=p[0],p1=p[1],d=m[0]*m[3]-m[1]*m[2];p[0]=(p0*m[3]-p1*m[2]+m[2]*m[5]-m[4]*m[3])/d,p[1]=(-p0*m[1]+p1*m[0]+m[4]*m[1]-m[5]*m[0])/d}},{key:"axialAlignedBoundingBox",value:function(rect,transform,output){var m0=transform[0],m1=transform[1],m2=transform[2],m3=transform[3],m4=transform[4],transform=transform[5],r0=rect[0],r1=rect[1],r2=rect[2],rect=rect[3],a0=m0*r0+m4,a2=a0,m0=m0*r2+m4,m4=m0,b0=m3*r1+transform,b2=b0,m3=m3*rect+transform,transform=m3;0===m1&&0===m2||(a0+=r1=m2*r1,m4+=r1,m0+=r1=m2*rect,a2+=r1,b0+=m2=m1*r0,transform+=m2,m3+=rect=m1*r2,b2+=rect),output[0]=Math.min(output[0],a0,m0,a2,m4),output[1]=Math.min(output[1],b0,m3,b2,transform),output[2]=Math.max(output[2],a0,m0,a2,m4),output[3]=Math.max(output[3],b0,m3,b2,transform)}},{key:"inverseTransform",value:function(m){var d=m[0]*m[3]-m[1]*m[2];return[m[3]/d,-m[1]/d,-m[2]/d,m[0]/d,(m[2]*m[5]-m[4]*m[3])/d,(m[4]*m[1]-m[5]*m[0])/d]}},{key:"singularValueDecompose2dScale",value:function(matrix,output){var m0=matrix[0],m1=matrix[1],m2=matrix[2],matrix=matrix[3],a=Math.pow(m0,2)+Math.pow(m1,2),m0=m0*m2+m1*matrix,m1=Math.pow(m2,2)+Math.pow(matrix,2),m2=(a+m1)/2,matrix=Math.sqrt(Math.pow(m2,2)-(a*m1-Math.pow(m0,2)));output[0]=Math.sqrt(m2+matrix||1),output[1]=Math.sqrt(m2-matrix||1)}},{key:"normalizeRect",value:function(rect){var r=rect.slice(0);return rect[0]>rect[2]&&(r[0]=rect[2],r[2]=rect[0]),rect[1]>rect[3]&&(r[1]=rect[3],r[3]=rect[1]),r}},{key:"intersect",value:function(rect1,rect2){var yLow,xLow=Math.max(Math.min(rect1[0],rect1[2]),Math.min(rect2[0],rect2[2])),xHigh=Math.min(Math.max(rect1[0],rect1[2]),Math.max(rect2[0],rect2[2]));return xHigh<xLow||(yLow=Math.max(Math.min(rect1[1],rect1[3]),Math.min(rect2[1],rect2[3])),(rect1=Math.min(Math.max(rect1[1],rect1[3]),Math.max(rect2[1],rect2[3])))<yLow)?null:[xLow,yLow,xHigh,rect1]}},{key:"pointBoundingBox",value:function(x,y,minMax){minMax[0]=Math.min(minMax[0],x),minMax[1]=Math.min(minMax[1],y),minMax[2]=Math.max(minMax[2],x),minMax[3]=Math.max(minMax[3],y)}},{key:"rectBoundingBox",value:function(x0,y0,x1,y1,minMax){minMax[0]=Math.min(minMax[0],x0,x1),minMax[1]=Math.min(minMax[1],y0,y1),minMax[2]=Math.max(minMax[2],x0,x1),minMax[3]=Math.max(minMax[3],y0,y1)}},{key:"bezierBoundingBox",value:function(x0,y0,x1,y1,x2,y2,x3,y3,minMax){minMax[0]=Math.min(minMax[0],x0,x3),minMax[1]=Math.min(minMax[1],y0,y3),minMax[2]=Math.max(minMax[2],x0,x3),minMax[3]=Math.max(minMax[3],y0,y3),_assertClassBrand(Util,this,_getExtremum).call(this,x0,x1,x2,x3,y0,y1,y2,y3,3*(3*(x1-x2)-x0+x3),6*(x0-2*x1+x2),3*(x1-x0),minMax),_assertClassBrand(Util,this,_getExtremum).call(this,x0,x1,x2,x3,y0,y1,y2,y3,3*(3*(y1-y2)-y0+y3),6*(y0-2*y1+y2),3*(y1-y0),minMax)}}])}();function _getExtremumOnCurve(x0,x1,x2,x3,y0,y1,y2,y3,t,minMax){var mt;t<=0||1<=t||(x2=(mt=1-t)*(mt*(mt*x0+3*t*x1)+3*(x0=t*t)*x2)+(x1=x0*t)*x3,x3=mt*(mt*(mt*y0+3*t*y1)+3*x0*y2)+x1*y3,minMax[0]=Math.min(minMax[0],x2),minMax[1]=Math.min(minMax[1],x3),minMax[2]=Math.max(minMax[2],x2),minMax[3]=Math.max(minMax[3],x3))}function _getExtremum(x0,x1,x2,x3,y0,y1,y2,y3,a,b,c,minMax){Math.abs(a)<1e-12?1e-12<=Math.abs(b)&&_assertClassBrand(_Util,this,_getExtremumOnCurve).call(this,x0,x1,x2,x3,y0,y1,y2,y3,-c/b,minMax):(c=Math.pow(b,2)-4*c*a)<0||(c=Math.sqrt(c),a=2*a,_assertClassBrand(_Util,this,_getExtremumOnCurve).call(this,x0,x1,x2,x3,y0,y1,y2,y3,(-b+c)/a,minMax),_assertClassBrand(_Util,this,_getExtremumOnCurve).call(this,x0,x1,x2,x3,y0,y1,y2,y3,(-b-c)/a,minMax))}var _Util=Util;var NormalizeRegex=null,NormalizationMap=null;function normalizeUnicode(str){return NormalizeRegex||(NormalizeRegex=/([\xA0\xB5\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+)/g,NormalizationMap=new Map([["ſt","ſt"]])),str.replaceAll(NormalizeRegex,function(_,p1,p2){return p1?p1.normalize("NFKC"):NormalizationMap.get(p2)})}function getUuid(){var buf;return"function"==typeof crypto.randomUUID?crypto.randomUUID():(buf=new Uint8Array(32),crypto.getRandomValues(buf),bytesToString(buf))}function MathClamp(v,min,max){return Math.min(Math.max(v,min),max)}function toBase64Util(arr){return Uint8Array.prototype.toBase64?arr.toBase64():btoa(bytesToString(arr))}"function"!=typeof Promise.try&&(Promise.try=function(fn){for(var _len=arguments.length,args=new Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return new Promise(function(resolve){resolve(fn.apply(void 0,args))})}),"function"!=typeof Math.sumPrecise&&(Math.sumPrecise=function(numbers){return numbers.reduce(function(a,b){return a+b},0)});var SVG_NS="http://www.w3.org/2000/svg",PixelsPerInch=_exports.PixelsPerInch=babelHelpers.createClass(function PixelsPerInch(){babelHelpers.classCallCheck(this,PixelsPerInch)});async function fetchData(url){var type=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"text";if(isValidFetchUrl(url,document.baseURI)){var response=await fetch(url);if(!response.ok)throw new Error(response.statusText);switch(type){case"arraybuffer":return response.arrayBuffer();case"blob":return response.blob();case"json":return response.json()}return response.text()}return new Promise(function(resolve,reject){var request=new XMLHttpRequest;request.open("GET",url,!0),request.responseType=type,request.onreadystatechange=function(){if(request.readyState===XMLHttpRequest.DONE)if(200===request.status||0===request.status){switch(type){case"arraybuffer":case"blob":case"json":return void resolve(request.response)}resolve(request.responseText)}else reject(new Error(request.statusText))},request.send(null)})}_PixelsPerInch=PixelsPerInch,babelHelpers.defineProperty(PixelsPerInch,"CSS",96),babelHelpers.defineProperty(PixelsPerInch,"PDF",72),babelHelpers.defineProperty(PixelsPerInch,"PDF_TO_CSS_UNITS",_PixelsPerInch.CSS/_PixelsPerInch.PDF);var PageViewport=function(){function PageViewport(_ref){var rotateA,rotateB,rotateC,rotateD,offsetCanvasX,offsetCanvasY,width,viewBox=_ref.viewBox,userUnit=_ref.userUnit,scale=_ref.scale,rotation=_ref.rotation,_ref$offsetX=_ref.offsetX,_ref$offsetX=void 0===_ref$offsetX?0:_ref$offsetX,_ref$offsetY=_ref.offsetY,_ref$offsetY=void 0===_ref$offsetY?0:_ref$offsetY,_ref=_ref.dontFlip,_ref=void 0!==_ref&&_ref,userUnit=(babelHelpers.classCallCheck(this,PageViewport),this.viewBox=viewBox,this.userUnit=userUnit,this.scale=scale,this.rotation=rotation,this.offsetX=_ref$offsetX,this.offsetY=_ref$offsetY,scale*=userUnit,(viewBox[2]+viewBox[0])/2),centerY=(viewBox[3]+viewBox[1])/2;switch((rotation%=360)<0&&(rotation+=360),rotation){case 180:rotateA=-1,rotateC=rotateB=0,rotateD=1;break;case 90:rotateC=rotateB=1,rotateD=rotateA=0;break;case 270:rotateC=rotateB=-1,rotateD=rotateA=0;break;case 0:rotateC=rotateB=0,rotateD=-(rotateA=1);break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}_ref&&(rotateC=-rotateC,rotateD=-rotateD),rotation=0===rotateA?(offsetCanvasX=Math.abs(centerY-viewBox[1])*scale+_ref$offsetX,offsetCanvasY=Math.abs(userUnit-viewBox[0])*scale+_ref$offsetY,width=(viewBox[3]-viewBox[1])*scale,(viewBox[2]-viewBox[0])*scale):(offsetCanvasX=Math.abs(userUnit-viewBox[0])*scale+_ref$offsetX,offsetCanvasY=Math.abs(centerY-viewBox[1])*scale+_ref$offsetY,width=(viewBox[2]-viewBox[0])*scale,(viewBox[3]-viewBox[1])*scale),this.transform=[rotateA*scale,rotateB*scale,rotateC*scale,rotateD*scale,offsetCanvasX-rotateA*scale*userUnit-rotateC*scale*centerY,offsetCanvasY-rotateB*scale*userUnit-rotateD*scale*centerY],this.width=width,this.height=rotation}return babelHelpers.createClass(PageViewport,[{key:"rawDims",get:function(){var dims=this.viewBox;return shadow(this,"rawDims",{pageWidth:dims[2]-dims[0],pageHeight:dims[3]-dims[1],pageX:dims[0],pageY:dims[1]})}},{key:"clone",value:function(){var _ref2=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref2$scale=_ref2.scale,_ref2$scale=void 0===_ref2$scale?this.scale:_ref2$scale,_ref2$rotation=_ref2.rotation,_ref2$rotation=void 0===_ref2$rotation?this.rotation:_ref2$rotation,_ref2$offsetX=_ref2.offsetX,_ref2$offsetX=void 0===_ref2$offsetX?this.offsetX:_ref2$offsetX,_ref2$offsetY=_ref2.offsetY,_ref2$offsetY=void 0===_ref2$offsetY?this.offsetY:_ref2$offsetY,_ref2=_ref2.dontFlip,_ref2=void 0!==_ref2&&_ref2;return new PageViewport({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:_ref2$scale,rotation:_ref2$rotation,offsetX:_ref2$offsetX,offsetY:_ref2$offsetY,dontFlip:_ref2})}},{key:"convertToViewportPoint",value:function(x,y){x=[x,y];return Util.applyTransform(x,this.transform),x}},{key:"convertToViewportRectangle",value:function(rect){var topLeft=[rect[0],rect[1]],rect=(Util.applyTransform(topLeft,this.transform),[rect[2],rect[3]]);return Util.applyTransform(rect,this.transform),[topLeft[0],topLeft[1],rect[0],rect[1]]}},{key:"convertToPdfPoint",value:function(x,y){x=[x,y];return Util.applyInverseTransform(x,this.transform),x}}])}(),RenderingCancelledException=_exports.RenderingCancelledException=function(){function RenderingCancelledException(msg){var _this4,extraDelay=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return babelHelpers.classCallCheck(this,RenderingCancelledException),(_this4=_callSuper(this,RenderingCancelledException,[msg,"RenderingCancelledException"])).extraDelay=extraDelay,_this4}return babelHelpers.inherits(RenderingCancelledException,BaseException),babelHelpers.createClass(RenderingCancelledException)}();function isDataScheme(url){for(var ii=url.length,i=0;i<ii&&""===url[i].trim();)i++;return"data:"===url.substring(i,i+5).toLowerCase()}function isPdfFile(filename){return"string"==typeof filename&&/\.pdf$/i.test(filename)}function getFilenameFromUrl(url){var _url$split=url.split(/[#?]/,1);return(url=babelHelpers.slicedToArray(_url$split,1)[0]).substring(url.lastIndexOf("/")+1)}function getPdfFilenameFromUrl(url){var defaultFilename=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"==typeof url)if(isDataScheme(url))warn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');else{var newURL=function(urlString){try{return new URL(urlString)}catch(_unused3){try{return new URL(decodeURIComponent(urlString))}catch(_unused4){try{return new URL(urlString,"https://foo.bar")}catch(_unused5){try{return new URL(decodeURIComponent(urlString),"https://foo.bar")}catch(_unused6){return null}}}}}(url);if(newURL){function decode(name){try{var decoded=decodeURIComponent(name);return decoded.includes("/")?(decoded=decoded.split("/").at(-1)).test(/^\.pdf$/i)?decoded:name:decoded}catch(_unused7){return name}}var pdfRegex=/\.pdf$/i,filename=newURL.pathname.split("/").at(-1);if(pdfRegex.test(filename))return decode(filename);if(0<newURL.searchParams.size){var _step2,_iterator2=_createForOfIteratorHelper(Array.from(newURL.searchParams.values()).reverse());try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var value=_step2.value;if(pdfRegex.test(value))return decode(value)}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}var _step3,_iterator3=_createForOfIteratorHelper(Array.from(newURL.searchParams.keys()).reverse());try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var key=_step3.value;if(pdfRegex.test(key))return decode(key)}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}if(newURL.hash){filename=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(newURL.hash);if(filename)return decode(filename[0])}}}return defaultFilename}var StatTimer=function(){return babelHelpers.createClass(function StatTimer(){babelHelpers.classCallCheck(this,StatTimer),babelHelpers.defineProperty(this,"started",Object.create(null)),babelHelpers.defineProperty(this,"times",[])},[{key:"time",value:function(name){name in this.started&&warn("Timer is already running for ".concat(name)),this.started[name]=Date.now()}},{key:"timeEnd",value:function(name){name in this.started||warn("Timer has not been started for ".concat(name)),this.times.push({name:name,start:this.started[name],end:Date.now()}),delete this.started[name]}},{key:"toString",value:function(){var _step4,outBuf=[],longest=0,_iterator4=_createForOfIteratorHelper(this.times);try{for(_iterator4.s();!(_step4=_iterator4.n()).done;)var name=_step4.value.name,longest=Math.max(name.length,longest)}catch(err){_iterator4.e(err)}finally{_iterator4.f()}var _step5,_iterator5=_createForOfIteratorHelper(this.times);try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_step5.value,_name=_step5$value.name,start=_step5$value.start,end=_step5$value.end;outBuf.push("".concat(_name.padEnd(longest)," ").concat(end-start,"ms\n"))}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}return outBuf.join("")}}])}();function isValidFetchUrl(url,baseUrl){baseUrl=baseUrl?URL.parse(url,baseUrl):URL.parse(url);return"http:"===(null==baseUrl?void 0:baseUrl.protocol)||"https:"===(null==baseUrl?void 0:baseUrl.protocol)}function noContextMenu(e){e.preventDefault()}function stopEvent(e){e.preventDefault(),e.stopPropagation()}var PDFDateString=_exports.PDFDateString=function(){function PDFDateString(){babelHelpers.classCallCheck(this,PDFDateString)}return babelHelpers.createClass(PDFDateString,null,[{key:"toDateObject",value:function(input){if(!input||"string"!=typeof input)return null;_assertClassBrand(PDFDateString,this,_regex)._||(_regex._=_assertClassBrand(PDFDateString,this,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")));var year,month,day,hour,minute,second,universalTimeRelation,offsetHour,input=_assertClassBrand(PDFDateString,this,_regex)._.exec(input);return input?(year=parseInt(input[1],10),month=1<=(month=parseInt(input[2],10))&&month<=12?month-1:0,day=1<=(day=parseInt(input[3],10))&&day<=31?day:1,hour=0<=(hour=parseInt(input[4],10))&&hour<=23?hour:0,minute=0<=(minute=parseInt(input[5],10))&&minute<=59?minute:0,second=0<=(second=parseInt(input[6],10))&&second<=59?second:0,universalTimeRelation=input[7]||"Z",offsetHour=0<=(offsetHour=parseInt(input[8],10))&&offsetHour<=23?offsetHour:0,input=0<=(input=parseInt(input[9],10)||0)&&input<=59?input:0,"-"===universalTimeRelation?(hour+=offsetHour,minute+=input):"+"===universalTimeRelation&&(hour-=offsetHour,minute-=input),new Date(Date.UTC(year,month,day,hour,minute,second))):null}}])}(),_regex={_:void 0};function getXfaPageViewport(xfaPage,_ref3){var _ref3$scale=_ref3.scale,_ref3$scale=void 0===_ref3$scale?1:_ref3$scale,_ref3=_ref3.rotation,_ref3=void 0===_ref3?0:_ref3,xfaPage=xfaPage.attributes.style,width=xfaPage.width,xfaPage=xfaPage.height,width=[0,0,parseInt(width),parseInt(xfaPage)];return new PageViewport({viewBox:width,userUnit:1,scale:_ref3$scale,rotation:_ref3})}function getRGB(color){var colorRGB;return color.startsWith("#")?[(16711680&(colorRGB=parseInt(color.slice(1),16)))>>16,(65280&colorRGB)>>8,255&colorRGB]:color.startsWith("rgb(")?color.slice(4,-1).split(",").map(function(x){return parseInt(x)}):color.startsWith("rgba(")?color.slice(5,-1).split(",").map(function(x){return parseInt(x)}).slice(0,3):(warn('Not a valid color format: "'.concat(color,'"')),[0,0,0])}function getCurrentTransform(ctx){ctx=ctx.getTransform();return[ctx.a,ctx.b,ctx.c,ctx.d,ctx.e,ctx.f]}function getCurrentTransformInverse(ctx){ctx=ctx.getTransform().invertSelf();return[ctx.a,ctx.b,ctx.c,ctx.d,ctx.e,ctx.f]}function setLayerDimensions(div,viewport){var style,_viewport$rawDims,pageWidth,useRound,mustFlip=2<arguments.length&&void 0!==arguments[2]&&arguments[2],mustRotate=!(3<arguments.length&&void 0!==arguments[3])||arguments[3];viewport instanceof PageViewport&&(pageWidth=(_viewport$rawDims=viewport.rawDims).pageWidth,_viewport$rawDims=_viewport$rawDims.pageHeight,style=div.style,useRound=util_FeatureTest.isCSSRoundSupported,pageWidth="var(--total-scale-factor) * ".concat(pageWidth,"px"),_viewport$rawDims="var(--total-scale-factor) * ".concat(_viewport$rawDims,"px"),pageWidth=useRound?"round(down, ".concat(pageWidth,", var(--scale-round-x))"):"calc(".concat(pageWidth,")"),useRound=useRound?"round(down, ".concat(_viewport$rawDims,", var(--scale-round-y))"):"calc(".concat(_viewport$rawDims,")"),mustFlip&&viewport.rotation%180!=0?(style.width=useRound,style.height=pageWidth):(style.width=pageWidth,style.height=useRound)),mustRotate&&div.setAttribute("data-main-rotation",viewport.rotation)}var OutputScale=_exports.OutputScale=function(){function OutputScale(){babelHelpers.classCallCheck(this,OutputScale);var pixelRatio=OutputScale.pixelRatio;this.sx=pixelRatio,this.sy=pixelRatio}return babelHelpers.createClass(OutputScale,[{key:"scaled",get:function(){return 1!==this.sx||1!==this.sy}},{key:"symmetric",get:function(){return this.sx===this.sy}},{key:"limitCanvas",value:function(width,height,maxPixels,maxDim){var capAreaFactor=4<arguments.length&&void 0!==arguments[4]?arguments[4]:-1,maxAreaScale=1/0,maxWidthScale=1/0,maxHeightScale=1/0,capAreaFactor=(0<(maxPixels=OutputScale.capPixels(maxPixels,capAreaFactor))&&(maxAreaScale=Math.sqrt(maxPixels/(width*height))),-1!==maxDim&&(maxWidthScale=maxDim/width,maxHeightScale=maxDim/height),Math.min(maxAreaScale,maxWidthScale,maxHeightScale));return(this.sx>capAreaFactor||this.sy>capAreaFactor)&&(this.sx=capAreaFactor,this.sy=capAreaFactor,!0)}}],[{key:"pixelRatio",get:function(){return globalThis.devicePixelRatio||1}},{key:"capPixels",value:function(maxPixels,capAreaFactor){return 0<=capAreaFactor?(capAreaFactor=Math.ceil(window.screen.availWidth*window.screen.availHeight*Math.pow(this.pixelRatio,2)*(1+capAreaFactor/100)),0<maxPixels?Math.min(maxPixels,capAreaFactor):capAreaFactor):maxPixels}}])}(),SupportedImageMimeTypes=_exports.SupportedImageMimeTypes=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],_toolbar=new WeakMap,_colorPicker=new WeakMap,_editor=new WeakMap,_buttons=new WeakMap,_altText=new WeakMap,_signatureDescriptionButton=new WeakMap,_EditorToolbar_brand=new WeakSet,EditorToolbar=function(){return babelHelpers.createClass(function EditorToolbar(editor){babelHelpers.classCallCheck(this,EditorToolbar),_classPrivateMethodInitSpec(this,_EditorToolbar_brand),_classPrivateFieldInitSpec(this,_toolbar,null),_classPrivateFieldInitSpec(this,_colorPicker,null),_classPrivateFieldInitSpec(this,_editor,void 0),_classPrivateFieldInitSpec(this,_buttons,null),_classPrivateFieldInitSpec(this,_altText,null),_classPrivateFieldInitSpec(this,_signatureDescriptionButton,null),_classPrivateFieldSet(_editor,this,editor),_l10nRemove._||(_l10nRemove._=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))},[{key:"render",value:function(){var style,x,editToolbar=_classPrivateFieldSet(_toolbar,this,document.createElement("div")),signal=(editToolbar.classList.add("editToolbar","hidden"),editToolbar.setAttribute("role","toolbar"),_classPrivateFieldGet(_editor,this)._uiManager._signal),signal=(editToolbar.addEventListener("contextmenu",noContextMenu,{signal:signal}),editToolbar.addEventListener("pointerdown",_pointerDown,{signal:signal}),_classPrivateFieldSet(_buttons,this,document.createElement("div"))),signal=(signal.className="buttons",editToolbar.append(signal),_classPrivateFieldGet(_editor,this).toolbarPosition);return signal&&(style=editToolbar.style,x="ltr"===_classPrivateFieldGet(_editor,this)._uiManager.direction?1-signal[0]:signal[0],style.insetInlineEnd="".concat(100*x,"%"),style.top="calc(".concat(100*signal[1],"% + var(--editor-toolbar-vert-offset))")),editToolbar}},{key:"div",get:function(){return _classPrivateFieldGet(_toolbar,this)}},{key:"hide",value:function(){var _classPrivateFieldGet2;_classPrivateFieldGet(_toolbar,this).classList.add("hidden"),null!=(_classPrivateFieldGet2=_classPrivateFieldGet(_colorPicker,this))&&_classPrivateFieldGet2.hideDropdown()}},{key:"show",value:function(){var _classPrivateFieldGet3;_classPrivateFieldGet(_toolbar,this).classList.remove("hidden"),null!=(_classPrivateFieldGet3=_classPrivateFieldGet(_altText,this))&&_classPrivateFieldGet3.shown()}},{key:"addDeleteButton",value:function(){var _classPrivateFieldGet4=_classPrivateFieldGet(_editor,this),editorType=_classPrivateFieldGet4.editorType,_uiManager=_classPrivateFieldGet4._uiManager,_classPrivateFieldGet4=document.createElement("button");_classPrivateFieldGet4.className="delete",_classPrivateFieldGet4.tabIndex=0,_classPrivateFieldGet4.setAttribute("data-l10n-id",_l10nRemove._[editorType]),_assertClassBrand(_EditorToolbar_brand,this,_addListenersToElement).call(this,_classPrivateFieldGet4),_classPrivateFieldGet4.addEventListener("click",function(e){_uiManager.delete()},{signal:_uiManager._signal}),_classPrivateFieldGet(_buttons,this).append(_classPrivateFieldGet4)}},{key:"addAltText",value:async function(altText){var button=await altText.render();_assertClassBrand(_EditorToolbar_brand,this,_addListenersToElement).call(this,button),_classPrivateFieldGet(_buttons,this).append(button,_classPrivateGetter(_EditorToolbar_brand,this,_get_divider)),_classPrivateFieldSet(_altText,this,altText)}},{key:"addColorPicker",value:function(colorPicker){_classPrivateFieldSet(_colorPicker,this,colorPicker);colorPicker=colorPicker.renderButton();_assertClassBrand(_EditorToolbar_brand,this,_addListenersToElement).call(this,colorPicker),_classPrivateFieldGet(_buttons,this).append(colorPicker,_classPrivateGetter(_EditorToolbar_brand,this,_get_divider))}},{key:"addEditSignatureButton",value:async function(signatureManager){signatureManager=_classPrivateFieldSet(_signatureDescriptionButton,this,await signatureManager.renderEditButton(_classPrivateFieldGet(_editor,this)));_assertClassBrand(_EditorToolbar_brand,this,_addListenersToElement).call(this,signatureManager),_classPrivateFieldGet(_buttons,this).append(signatureManager,_classPrivateGetter(_EditorToolbar_brand,this,_get_divider))}},{key:"addButton",value:async function(name,tool){switch(name){case"colorPicker":this.addColorPicker(tool);break;case"altText":await this.addAltText(tool);break;case"editSignature":await this.addEditSignatureButton(tool);break;case"delete":this.addDeleteButton()}}},{key:"updateEditSignatureButton",value:function(description){_classPrivateFieldGet(_signatureDescriptionButton,this)&&(_classPrivateFieldGet(_signatureDescriptionButton,this).title=description)}},{key:"remove",value:function(){var _classPrivateFieldGet5;_classPrivateFieldGet(_toolbar,this).remove(),null!=(_classPrivateFieldGet5=_classPrivateFieldGet(_colorPicker,this))&&_classPrivateFieldGet5.destroy(),_classPrivateFieldSet(_colorPicker,this,null)}}])}();function _pointerDown(e){e.stopPropagation()}function _focusIn(e){_classPrivateFieldGet(_editor,this)._focusEventsAllowed=!1,stopEvent(e)}function _focusOut(e){_classPrivateFieldGet(_editor,this)._focusEventsAllowed=!0,stopEvent(e)}function _addListenersToElement(element){var signal=_classPrivateFieldGet(_editor,this)._uiManager._signal;element.addEventListener("focusin",_assertClassBrand(_EditorToolbar_brand,this,_focusIn).bind(this),{capture:!0,signal:signal}),element.addEventListener("focusout",_assertClassBrand(_EditorToolbar_brand,this,_focusOut).bind(this),{capture:!0,signal:signal}),element.addEventListener("contextmenu",noContextMenu,{signal:signal})}function _get_divider(_this5){var divider=document.createElement("div");return divider.className="divider",divider}var _l10nRemove={_:null},_buttons2=new WeakMap,_toolbar2=new WeakMap,_uiManager2=new WeakMap,_HighlightToolbar_brand=new WeakSet,HighlightToolbar=function(){return babelHelpers.createClass(function HighlightToolbar(uiManager){babelHelpers.classCallCheck(this,HighlightToolbar),_classPrivateMethodInitSpec(this,_HighlightToolbar_brand),_classPrivateFieldInitSpec(this,_buttons2,null),_classPrivateFieldInitSpec(this,_toolbar2,null),_classPrivateFieldInitSpec(this,_uiManager2,void 0),_classPrivateFieldSet(_uiManager2,this,uiManager)},[{key:"show",value:function(parent,boxes,isLTR){var boxes=_assertClassBrand(_HighlightToolbar_brand,this,_getLastPoint).call(this,boxes,isLTR),isLTR=babelHelpers.slicedToArray(boxes,2),boxes=isLTR[0],isLTR=isLTR[1],style=(_classPrivateFieldGet(_toolbar2,this)||_classPrivateFieldSet(_toolbar2,this,_assertClassBrand(_HighlightToolbar_brand,this,_render).call(this))).style;parent.append(_classPrivateFieldGet(_toolbar2,this)),style.insetInlineEnd="".concat(100*boxes,"%"),style.top="calc(".concat(100*isLTR,"% + var(--editor-toolbar-vert-offset))")}},{key:"hide",value:function(){_classPrivateFieldGet(_toolbar2,this).remove()}}])}();function _render(){var editToolbar=_classPrivateFieldSet(_toolbar2,this,document.createElement("div")),buttons=(editToolbar.className="editToolbar",editToolbar.setAttribute("role","toolbar"),editToolbar.addEventListener("contextmenu",noContextMenu,{signal:_classPrivateFieldGet(_uiManager2,this)._signal}),_classPrivateFieldSet(_buttons2,this,document.createElement("div")));return buttons.className="buttons",editToolbar.append(buttons),_assertClassBrand(_HighlightToolbar_brand,this,_addHighlightButton).call(this),editToolbar}function _getLastPoint(boxes,isLTR){var _step172,lastY=0,lastX=0,_iterator172=_createForOfIteratorHelper(boxes);try{for(_iterator172.s();!(_step172=_iterator172.n()).done;){var x,box=_step172.value,y=box.y+box.height;y<lastY||(x=box.x+(isLTR?box.width:0),lastY<y?(lastX=x,lastY=y):isLTR?lastX<x&&(lastX=x):x<lastX&&(lastX=x))}}catch(err){_iterator172.e(err)}finally{_iterator172.f()}return[isLTR?1-lastX:lastX,lastY]}function _addHighlightButton(){var _this106=this,button=document.createElement("button"),span=(button.className="highlightButton",button.tabIndex=0,button.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1"),document.createElement("span")),span=(button.append(span),span.className="visuallyHidden",span.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label"),_classPrivateFieldGet(_uiManager2,this)._signal);button.addEventListener("contextmenu",noContextMenu,{signal:span}),button.addEventListener("click",function(){_classPrivateFieldGet(_uiManager2,_this106).highlightSelection("floating_button")},{signal:span}),_classPrivateFieldGet(_buttons2,this).append(button)}function bindEvents(obj,element,names){var _step7,_iterator7=_createForOfIteratorHelper(names);try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var name=_step7.value;element.addEventListener(name,obj[name].bind(obj))}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}}var _id=new WeakMap,IdManager=function(){return babelHelpers.createClass(function IdManager(){babelHelpers.classCallCheck(this,IdManager),_classPrivateFieldInitSpec(this,_id,0)},[{key:"id",get:function(){var _this$id,_this$id2;return"".concat("pdfjs_internal_editor_").concat((_classPrivateFieldSet(_id,this,(_this$id=_classPrivateFieldGet(_id,this),_this$id2=_this$id++,_this$id)),_this$id2))}}])}(),_baseId=new WeakMap,_id2=new WeakMap,_cache=new WeakMap,_ImageManager_brand=new WeakSet,ImageManager=function(){return babelHelpers.createClass(function ImageManager(){babelHelpers.classCallCheck(this,ImageManager),_classPrivateMethodInitSpec(this,_ImageManager_brand),_classPrivateFieldInitSpec(this,_baseId,getUuid()),_classPrivateFieldInitSpec(this,_id2,0),_classPrivateFieldInitSpec(this,_cache,null)},[{key:"getFromFile",value:async function(file){var lastModified=file.lastModified,name=file.name,size=file.size,type=file.type;return _assertClassBrand(_ImageManager_brand,this,_get).call(this,"".concat(lastModified,"_").concat(name,"_").concat(size,"_").concat(type),file)}},{key:"getFromUrl",value:async function(url){return _assertClassBrand(_ImageManager_brand,this,_get).call(this,url,url)}},{key:"getFromBlob",value:async function(id,blobPromise){blobPromise=await blobPromise;return _assertClassBrand(_ImageManager_brand,this,_get).call(this,id,blobPromise)}},{key:"getFromId",value:async function(id){_classPrivateFieldGet(_cache,this)||_classPrivateFieldSet(_cache,this,new Map);var blobPromise,id=_classPrivateFieldGet(_cache,this).get(id);return id?id.bitmap?(id.refCounter+=1,id):id.file?this.getFromFile(id.file):id.blobPromise?(blobPromise=id.blobPromise,delete id.blobPromise,this.getFromBlob(id.id,blobPromise)):this.getFromUrl(id.url):null}},{key:"getFromCanvas",value:function(id,canvas){_classPrivateFieldGet(_cache,this)||_classPrivateFieldSet(_cache,this,new Map);var offscreen,data=_classPrivateFieldGet(_cache,this).get(id);return null!=data&&data.bitmap?data.refCounter+=1:((offscreen=new OffscreenCanvas(canvas.width,canvas.height)).getContext("2d").drawImage(canvas,0,0),data={bitmap:offscreen.transferToImageBitmap(),id:"image_".concat(_classPrivateFieldGet(_baseId,this),"_").concat((_classPrivateFieldSet(_id2,this,(canvas=_classPrivateFieldGet(_id2,this),offscreen=canvas++,canvas)),offscreen)),refCounter:1,isSvg:!1},_classPrivateFieldGet(_cache,this).set(id,data),_classPrivateFieldGet(_cache,this).set(data.id,data)),data}},{key:"getSvgUrl",value:function(id){id=_classPrivateFieldGet(_cache,this).get(id);return null!=id&&id.isSvg?id.svgUrl:null}},{key:"deleteId",value:function(id){_classPrivateFieldGet(_cache,this)||_classPrivateFieldSet(_cache,this,new Map);var bitmap,canvas,id=_classPrivateFieldGet(_cache,this).get(id);id&&(--id.refCounter,0===id.refCounter)&&(bitmap=id.bitmap,id.url||id.file||((canvas=new OffscreenCanvas(bitmap.width,bitmap.height)).getContext("bitmaprenderer").transferFromImageBitmap(bitmap),id.blobPromise=canvas.convertToBlob()),null!=bitmap.close&&bitmap.close(),id.bitmap=null)}},{key:"isValidId",value:function(id){return id.startsWith("image_".concat(_classPrivateFieldGet(_baseId,this),"_"))}}],[{key:"_isSVGFittingCanvas",get:function(){var ctx=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),image=new Image;return image.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>',shadow(this,"_isSVGFittingCanvas",image.decode().then(function(){return ctx.drawImage(image,0,0,1,1,0,0,1,3),0===new Uint32Array(ctx.getImageData(0,0,1,1).data.buffer)[0]}))}}])}();async function _get(key,rawData){if(_classPrivateFieldGet(_cache,this)||_classPrivateFieldSet(_cache,this,new Map),null===(data=_classPrivateFieldGet(_cache,this).get(key)))return null;if(null!=data&&data.bitmap)data.refCounter+=1;else{try{var _this$id3,_this$id4,image,mustRemoveAspectRatioPromise,fileReader,imageElement,imagePromise,data=data||{bitmap:null,id:"image_".concat(_classPrivateFieldGet(_baseId,this),"_").concat((_classPrivateFieldSet(_id2,this,(_this$id3=_classPrivateFieldGet(_id2,this),_this$id4=_this$id3++,_this$id3)),_this$id4)),refCounter:0,isSvg:!1};"string"==typeof rawData?image=await fetchData(data.url=rawData,"blob"):rawData instanceof File?image=data.file=rawData:rawData instanceof Blob&&(image=rawData),"image/svg+xml"===image.type?(mustRemoveAspectRatioPromise=_ImageManager._isSVGFittingCanvas,fileReader=new FileReader,imageElement=new Image,imagePromise=new Promise(function(resolve,reject){imageElement.onload=function(){data.bitmap=imageElement,data.isSvg=!0,resolve()},fileReader.onload=async function(){var url=data.svgUrl=fileReader.result;imageElement.src=await mustRemoveAspectRatioPromise?"".concat(url,"#svgView(preserveAspectRatio(none))"):url},imageElement.onerror=fileReader.onerror=reject}),fileReader.readAsDataURL(image),await imagePromise):data.bitmap=await createImageBitmap(image),data.refCounter=1}catch(e){warn(e),data=null}_classPrivateFieldGet(_cache,this).set(key,data),data&&_classPrivateFieldGet(_cache,this).set(data.id,data)}return data}var _ImageManager=ImageManager,_commands=new WeakMap,_locked=new WeakMap,_maxSize=new WeakMap,_position=new WeakMap,CommandManager=function(){return babelHelpers.createClass(function CommandManager(){var maxSize=0<arguments.length&&void 0!==arguments[0]?arguments[0]:128;babelHelpers.classCallCheck(this,CommandManager),_classPrivateFieldInitSpec(this,_commands,[]),_classPrivateFieldInitSpec(this,_locked,!1),_classPrivateFieldInitSpec(this,_maxSize,void 0),_classPrivateFieldInitSpec(this,_position,-1),_classPrivateFieldSet(_maxSize,this,maxSize)},[{key:"add",value:function(_ref5){var cmd=_ref5.cmd,undo=_ref5.undo,post=_ref5.post,mustExec=_ref5.mustExec,_ref5$type=_ref5.type,_ref5$type=void 0===_ref5$type?NaN:_ref5$type,_ref5$overwriteIfSame=_ref5.overwriteIfSameType,_ref5$overwriteIfSame=void 0!==_ref5$overwriteIfSame&&_ref5$overwriteIfSame,_ref5=_ref5.keepUndo,_ref5=void 0!==_ref5&&_ref5;mustExec&&cmd(),_classPrivateFieldGet(_locked,this)||(mustExec={cmd:cmd,undo:undo,post:post,type:_ref5$type},-1===_classPrivateFieldGet(_position,this)?(0<_classPrivateFieldGet(_commands,this).length&&(_classPrivateFieldGet(_commands,this).length=0),_classPrivateFieldSet(_position,this,0),_classPrivateFieldGet(_commands,this).push(mustExec)):_ref5$overwriteIfSame&&_classPrivateFieldGet(_commands,this)[_classPrivateFieldGet(_position,this)].type===_ref5$type?(_ref5&&(mustExec.undo=_classPrivateFieldGet(_commands,this)[_classPrivateFieldGet(_position,this)].undo),_classPrivateFieldGet(_commands,this)[_classPrivateFieldGet(_position,this)]=mustExec):((cmd=_classPrivateFieldGet(_position,this)+1)===_classPrivateFieldGet(_maxSize,this)?_classPrivateFieldGet(_commands,this).splice(0,1):(_classPrivateFieldSet(_position,this,cmd),cmd<_classPrivateFieldGet(_commands,this).length&&_classPrivateFieldGet(_commands,this).splice(cmd)),_classPrivateFieldGet(_commands,this).push(mustExec)))}},{key:"undo",value:function(){var undo,_classPrivateFieldGet6;-1!==_classPrivateFieldGet(_position,this)&&(_classPrivateFieldSet(_locked,this,!0),undo=(_classPrivateFieldGet6=_classPrivateFieldGet(_commands,this)[_classPrivateFieldGet(_position,this)]).undo,_classPrivateFieldGet6=_classPrivateFieldGet6.post,undo(),null!=_classPrivateFieldGet6&&_classPrivateFieldGet6(),_classPrivateFieldSet(_locked,this,!1),_classPrivateFieldSet(_position,this,_classPrivateFieldGet(_position,this)-1))}},{key:"redo",value:function(){var cmd,_classPrivateFieldGet7;_classPrivateFieldGet(_position,this)<_classPrivateFieldGet(_commands,this).length-1&&(_classPrivateFieldSet(_position,this,_classPrivateFieldGet(_position,this)+1),_classPrivateFieldSet(_locked,this,!0),cmd=(_classPrivateFieldGet7=_classPrivateFieldGet(_commands,this)[_classPrivateFieldGet(_position,this)]).cmd,_classPrivateFieldGet7=_classPrivateFieldGet7.post,cmd(),null!=_classPrivateFieldGet7&&_classPrivateFieldGet7(),_classPrivateFieldSet(_locked,this,!1))}},{key:"hasSomethingToUndo",value:function(){return-1!==_classPrivateFieldGet(_position,this)}},{key:"hasSomethingToRedo",value:function(){return _classPrivateFieldGet(_position,this)<_classPrivateFieldGet(_commands,this).length-1}},{key:"cleanType",value:function(type){if(-1!==_classPrivateFieldGet(_position,this)){for(var i=_classPrivateFieldGet(_position,this);0<=i;i--)if(_classPrivateFieldGet(_commands,this)[i].type!==type)return _classPrivateFieldGet(_commands,this).splice(i+1,_classPrivateFieldGet(_position,this)-i),void _classPrivateFieldSet(_position,this,i);_classPrivateFieldGet(_commands,this).length=0,_classPrivateFieldSet(_position,this,-1)}}},{key:"destroy",value:function(){_classPrivateFieldSet(_commands,this,null)}}])}(),_KeyboardManager_brand=new WeakSet,KeyboardManager=function(){return babelHelpers.createClass(function KeyboardManager(callbacks){babelHelpers.classCallCheck(this,KeyboardManager),_classPrivateMethodInitSpec(this,_KeyboardManager_brand),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;var _step8,isMac=util_FeatureTest.platform.isMac,_iterator8=_createForOfIteratorHelper(callbacks);try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _step9,_step8$value=babelHelpers.slicedToArray(_step8.value,3),keys=_step8$value[0],callback=_step8$value[1],_step8$value$=_step8$value[2],options=void 0===_step8$value$?{}:_step8$value$,_iterator9=_createForOfIteratorHelper(keys);try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var key=_step9.value,isMacKey=key.startsWith("mac+");isMac&&isMacKey?(this.callbacks.set(key.slice(4),{callback:callback,options:options}),this.allKeys.add(key.split("+").at(-1))):isMac||isMacKey||(this.callbacks.set(key,{callback:callback,options:options}),this.allKeys.add(key.split("+").at(-1)))}}catch(err){_iterator9.e(err)}finally{_iterator9.f()}}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}},[{key:"exec",value:function(self,event){var callback,_info$options$bubbles,_info$options$args,info;this.allKeys.has(event.key)&&(info=this.callbacks.get(_assertClassBrand(_KeyboardManager_brand,this,_serialize).call(this,event)))&&(callback=info.callback,_info$options$bubbles=void 0!==(_info$options$bubbles=(info=info.options).bubbles)&&_info$options$bubbles,_info$options$args=void 0===(_info$options$args=info.args)?[]:_info$options$args,(info=void 0===(info=info.checker)?null:info)&&!info(self,event)||(callback.bind.apply(callback,[self].concat(babelHelpers.toConsumableArray(_info$options$args),[event]))(),_info$options$bubbles)||stopEvent(event))}}])}();function _serialize(event){event.altKey&&this.buffer.push("alt"),event.ctrlKey&&this.buffer.push("ctrl"),event.metaKey&&this.buffer.push("meta"),event.shiftKey&&this.buffer.push("shift"),this.buffer.push(event.key);event=this.buffer.join("+");return this.buffer.length=0,event}var _PixelsPerInch=function(){function ColorManager(){babelHelpers.classCallCheck(this,ColorManager)}return babelHelpers.createClass(ColorManager,[{key:"_colors",get:function(){var colors=new Map([["CanvasText",null],["Canvas",null]]);return function(colors){var _step6,span=document.createElement("span"),_iterator6=(span.style.visibility="hidden",span.style.colorScheme="only light",document.body.append(span),_createForOfIteratorHelper(colors.keys()));try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var name=_step6.value,computedColor=(span.style.color=name,window.getComputedStyle(span).color);colors.set(name,getRGB(computedColor))}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}span.remove()}(colors),shadow(this,"_colors",colors)}},{key:"convert",value:function(color){var rgb=getRGB(color);if(window.matchMedia("(forced-colors: active)").matches){var _step0,_iterator0=_createForOfIteratorHelper(this._colors);try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){var _step0$value=babelHelpers.slicedToArray(_step0.value,2),name=_step0$value[0];if(_step0$value[1].every(function(x,i){return x===rgb[i]}))return ColorManager._colorsMapping.get(name)}}catch(err){_iterator0.e(err)}finally{_iterator0.f()}}return rgb}},{key:"getHexCode",value:function(name){var rgb=this._colors.get(name);return rgb?Util.makeHexColor.apply(Util,babelHelpers.toConsumableArray(rgb)):name}}])}(),_abortController=(babelHelpers.defineProperty(_PixelsPerInch,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]])),new WeakMap),_activeEditor=new WeakMap,_allEditors=new WeakMap,_allLayers=new WeakMap,_altTextManager=new WeakMap,_annotationStorage=new WeakMap,_changedExistingAnnotations=new WeakMap,_commandManager=new WeakMap,_copyPasteAC=new WeakMap,_currentDrawingSession=new WeakMap,_currentPageIndex=new WeakMap,_deletedAnnotationsElementIds=new WeakMap,_draggingEditors=new WeakMap,_editorTypes=new WeakMap,_editorsToRescale=new WeakMap,_enableHighlightFloatingButton=new WeakMap,_enableUpdatedAddImage=new WeakMap,_enableNewAltTextWhenAddingImage=new WeakMap,_filterFactory=new WeakMap,_focusMainContainerTimeoutId=new WeakMap,_focusManagerAC=new WeakMap,_highlightColors=new WeakMap,_highlightWhenShiftUp=new WeakMap,_highlightToolbar=new WeakMap,_idManager=new WeakMap,_isEnabled=new WeakMap,_isWaiting=new WeakMap,_keyboardManagerAC=new WeakMap,_lastActiveElement=new WeakMap,_mainHighlightColorPicker=new WeakMap,_missingCanvases=new WeakMap,_mlManager=new WeakMap,_mode=new WeakMap,_selectedEditors=new WeakMap,_selectedTextNode=new WeakMap,_signatureManager=new WeakMap,_pageColors=new WeakMap,_showAllStates=new WeakMap,_previousStates=new WeakMap,_translation=new WeakMap,_translationTimeoutId=new WeakMap,_container=new WeakMap,_viewer=new WeakMap,_viewerAlert=new WeakMap,_updateModeCapability=new WeakMap,_AnnotationEditorUIManager_brand=new WeakSet,AnnotationEditorUIManager=_exports.AnnotationEditorUIManager=function(){function AnnotationEditorUIManager(container,viewer,viewerAlert,altTextManager,signatureManager,eventBus,pdfDocument,pageColors,highlightColors,enableHighlightFloatingButton,enableUpdatedAddImage,enableNewAltTextWhenAddingImage,mlManager,editorUndoBar,supportsPinchToZoom){var _this7=this,_signal=(babelHelpers.classCallCheck(this,AnnotationEditorUIManager),_classPrivateMethodInitSpec(this,_AnnotationEditorUIManager_brand),_classPrivateFieldInitSpec(this,_abortController,new AbortController),_classPrivateFieldInitSpec(this,_activeEditor,null),_classPrivateFieldInitSpec(this,_allEditors,new Map),_classPrivateFieldInitSpec(this,_allLayers,new Map),_classPrivateFieldInitSpec(this,_altTextManager,null),_classPrivateFieldInitSpec(this,_annotationStorage,null),_classPrivateFieldInitSpec(this,_changedExistingAnnotations,null),_classPrivateFieldInitSpec(this,_commandManager,new CommandManager),_classPrivateFieldInitSpec(this,_copyPasteAC,null),_classPrivateFieldInitSpec(this,_currentDrawingSession,null),_classPrivateFieldInitSpec(this,_currentPageIndex,0),_classPrivateFieldInitSpec(this,_deletedAnnotationsElementIds,new Set),_classPrivateFieldInitSpec(this,_draggingEditors,null),_classPrivateFieldInitSpec(this,_editorTypes,null),_classPrivateFieldInitSpec(this,_editorsToRescale,new Set),babelHelpers.defineProperty(this,"_editorUndoBar",null),_classPrivateFieldInitSpec(this,_enableHighlightFloatingButton,!1),_classPrivateFieldInitSpec(this,_enableUpdatedAddImage,!1),_classPrivateFieldInitSpec(this,_enableNewAltTextWhenAddingImage,!1),_classPrivateFieldInitSpec(this,_filterFactory,null),_classPrivateFieldInitSpec(this,_focusMainContainerTimeoutId,null),_classPrivateFieldInitSpec(this,_focusManagerAC,null),_classPrivateFieldInitSpec(this,_highlightColors,null),_classPrivateFieldInitSpec(this,_highlightWhenShiftUp,!1),_classPrivateFieldInitSpec(this,_highlightToolbar,null),_classPrivateFieldInitSpec(this,_idManager,new IdManager),_classPrivateFieldInitSpec(this,_isEnabled,!1),_classPrivateFieldInitSpec(this,_isWaiting,!1),_classPrivateFieldInitSpec(this,_keyboardManagerAC,null),_classPrivateFieldInitSpec(this,_lastActiveElement,null),_classPrivateFieldInitSpec(this,_mainHighlightColorPicker,null),_classPrivateFieldInitSpec(this,_missingCanvases,null),_classPrivateFieldInitSpec(this,_mlManager,null),_classPrivateFieldInitSpec(this,_mode,AnnotationEditorType.NONE),_classPrivateFieldInitSpec(this,_selectedEditors,new Set),_classPrivateFieldInitSpec(this,_selectedTextNode,null),_classPrivateFieldInitSpec(this,_signatureManager,null),_classPrivateFieldInitSpec(this,_pageColors,null),_classPrivateFieldInitSpec(this,_showAllStates,null),_classPrivateFieldInitSpec(this,_previousStates,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),_classPrivateFieldInitSpec(this,_translation,[0,0]),_classPrivateFieldInitSpec(this,_translationTimeoutId,null),_classPrivateFieldInitSpec(this,_container,null),_classPrivateFieldInitSpec(this,_viewer,null),_classPrivateFieldInitSpec(this,_viewerAlert,null),_classPrivateFieldInitSpec(this,_updateModeCapability,null),this._signal=_classPrivateFieldGet(_abortController,this).signal);_classPrivateFieldSet(_container,this,container),_classPrivateFieldSet(_viewer,this,viewer),_classPrivateFieldSet(_viewerAlert,this,viewerAlert),_classPrivateFieldSet(_altTextManager,this,altTextManager),_classPrivateFieldSet(_signatureManager,this,signatureManager),(this._eventBus=eventBus)._on("editingaction",this.onEditingAction.bind(this),{signal:_signal}),eventBus._on("pagechanging",this.onPageChanging.bind(this),{signal:_signal}),eventBus._on("scalechanging",this.onScaleChanging.bind(this),{signal:_signal}),eventBus._on("rotationchanging",this.onRotationChanging.bind(this),{signal:_signal}),eventBus._on("setpreference",this.onSetPreference.bind(this),{signal:_signal}),eventBus._on("switchannotationeditorparams",function(evt){return _this7.updateParams(evt.type,evt.value)},{signal:_signal}),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_addSelectionListener).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_addDragAndDropListeners).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_addKeyboardManager).call(this),_classPrivateFieldSet(_annotationStorage,this,pdfDocument.annotationStorage),_classPrivateFieldSet(_filterFactory,this,pdfDocument.filterFactory),_classPrivateFieldSet(_pageColors,this,pageColors),_classPrivateFieldSet(_highlightColors,this,highlightColors||null),_classPrivateFieldSet(_enableHighlightFloatingButton,this,enableHighlightFloatingButton),_classPrivateFieldSet(_enableUpdatedAddImage,this,enableUpdatedAddImage),_classPrivateFieldSet(_enableNewAltTextWhenAddingImage,this,enableNewAltTextWhenAddingImage),_classPrivateFieldSet(_mlManager,this,mlManager||null),this.viewParameters={realScale:PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=editorUndoBar||null,this._supportsPinchToZoom=!1!==supportsPinchToZoom}return babelHelpers.createClass(AnnotationEditorUIManager,[{key:"destroy",value:function(){null!=(_classPrivateFieldGet8=_classPrivateFieldGet(_updateModeCapability,this))&&_classPrivateFieldGet8.resolve(),_classPrivateFieldSet(_updateModeCapability,this,null),null!=(_classPrivateFieldGet8=_classPrivateFieldGet(_abortController,this))&&_classPrivateFieldGet8.abort(),_classPrivateFieldSet(_abortController,this,null),this._signal=null;var _classPrivateFieldGet8,_step1,_iterator1=_createForOfIteratorHelper(_classPrivateFieldGet(_allLayers,this).values());try{for(_iterator1.s();!(_step1=_iterator1.n()).done;)_step1.value.destroy()}catch(err){_iterator1.e(err)}finally{_iterator1.f()}_classPrivateFieldGet(_allLayers,this).clear(),_classPrivateFieldGet(_allEditors,this).clear(),_classPrivateFieldGet(_editorsToRescale,this).clear(),null!=(_classPrivateFieldGet8=_classPrivateFieldGet(_missingCanvases,this))&&_classPrivateFieldGet8.clear(),_classPrivateFieldSet(_activeEditor,this,null),_classPrivateFieldGet(_selectedEditors,this).clear(),_classPrivateFieldGet(_commandManager,this).destroy(),null!=(_classPrivateFieldGet8=_classPrivateFieldGet(_altTextManager,this))&&_classPrivateFieldGet8.destroy(),null!=(_classPrivateFieldGet8=_classPrivateFieldGet(_signatureManager,this))&&_classPrivateFieldGet8.destroy(),null!=(_classPrivateFieldGet8=_classPrivateFieldGet(_highlightToolbar,this))&&_classPrivateFieldGet8.hide(),_classPrivateFieldSet(_highlightToolbar,this,null),null!=(_classPrivateFieldGet8=_classPrivateFieldGet(_mainHighlightColorPicker,this))&&_classPrivateFieldGet8.destroy(),_classPrivateFieldSet(_mainHighlightColorPicker,this,null),_classPrivateFieldGet(_focusMainContainerTimeoutId,this)&&(clearTimeout(_classPrivateFieldGet(_focusMainContainerTimeoutId,this)),_classPrivateFieldSet(_focusMainContainerTimeoutId,this,null)),_classPrivateFieldGet(_translationTimeoutId,this)&&(clearTimeout(_classPrivateFieldGet(_translationTimeoutId,this)),_classPrivateFieldSet(_translationTimeoutId,this,null)),null!=(_classPrivateFieldGet8=this._editorUndoBar)&&_classPrivateFieldGet8.destroy()}},{key:"combinedSignal",value:function(ac){return AbortSignal.any([this._signal,ac.signal])}},{key:"mlManager",get:function(){return _classPrivateFieldGet(_mlManager,this)}},{key:"useNewAltTextFlow",get:function(){return _classPrivateFieldGet(_enableUpdatedAddImage,this)}},{key:"useNewAltTextWhenAddingImage",get:function(){return _classPrivateFieldGet(_enableNewAltTextWhenAddingImage,this)}},{key:"hcmFilter",get:function(){return shadow(this,"hcmFilter",_classPrivateFieldGet(_pageColors,this)?_classPrivateFieldGet(_filterFactory,this).addHCMFilter(_classPrivateFieldGet(_pageColors,this).foreground,_classPrivateFieldGet(_pageColors,this).background):"none")}},{key:"direction",get:function(){return shadow(this,"direction",getComputedStyle(_classPrivateFieldGet(_container,this)).direction)}},{key:"highlightColors",get:function(){return shadow(this,"highlightColors",_classPrivateFieldGet(_highlightColors,this)?new Map(_classPrivateFieldGet(_highlightColors,this).split(",").map(function(pair){return(pair=pair.split("=").map(function(x){return x.trim()}))[1]=pair[1].toUpperCase(),pair})):null)}},{key:"highlightColorNames",get:function(){return shadow(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,function(e){return e.reverse()})):null)}},{key:"setCurrentDrawingSession",value:function(layer){layer?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),_classPrivateFieldSet(_currentDrawingSession,this,layer)}},{key:"setMainHighlightColorPicker",value:function(colorPicker){_classPrivateFieldSet(_mainHighlightColorPicker,this,colorPicker)}},{key:"editAltText",value:function(editor){var _classPrivateFieldGet13,firstTime=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!=(_classPrivateFieldGet13=_classPrivateFieldGet(_altTextManager,this))&&_classPrivateFieldGet13.editAltText(this,editor,firstTime)}},{key:"getSignature",value:function(editor){var _classPrivateFieldGet14;null!=(_classPrivateFieldGet14=_classPrivateFieldGet(_signatureManager,this))&&_classPrivateFieldGet14.getSignature({uiManager:this,editor:editor})}},{key:"signatureManager",get:function(){return _classPrivateFieldGet(_signatureManager,this)}},{key:"switchToMode",value:function(mode,callback){this._eventBus.on("annotationeditormodechanged",callback,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:mode})}},{key:"setPreference",value:function(name,value){this._eventBus.dispatch("setpreference",{source:this,name:name,value:value})}},{key:"onSetPreference",value:function(_ref6){var name=_ref6.name,_ref6=_ref6.value;"enableNewAltTextWhenAddingImage"===name&&_classPrivateFieldSet(_enableNewAltTextWhenAddingImage,this,_ref6)}},{key:"onPageChanging",value:function(_ref7){_ref7=_ref7.pageNumber;_classPrivateFieldSet(_currentPageIndex,this,_ref7-1)}},{key:"focusMainContainer",value:function(){_classPrivateFieldGet(_container,this).focus()}},{key:"findParent",value:function(x,y){var _step10,_iterator10=_createForOfIteratorHelper(_classPrivateFieldGet(_allLayers,this).values());try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var layer=_step10.value,_layer$div$getBoundin=layer.div.getBoundingClientRect(),layerX=_layer$div$getBoundin.x,layerY=_layer$div$getBoundin.y,width=_layer$div$getBoundin.width,height=_layer$div$getBoundin.height;if(layerX<=x&&x<=layerX+width&&layerY<=y&&y<=layerY+height)return layer}}catch(err){_iterator10.e(err)}finally{_iterator10.f()}return null}},{key:"disableUserSelect",value:function(){var value=0<arguments.length&&void 0!==arguments[0]&&arguments[0];_classPrivateFieldGet(_viewer,this).classList.toggle("noUserSelect",value)}},{key:"addShouldRescale",value:function(editor){_classPrivateFieldGet(_editorsToRescale,this).add(editor)}},{key:"removeShouldRescale",value:function(editor){_classPrivateFieldGet(_editorsToRescale,this).delete(editor)}},{key:"onScaleChanging",value:function(_ref8){var _step11,_ref8=_ref8.scale,_iterator11=(this.commitOrRemove(),this.viewParameters.realScale=_ref8*PixelsPerInch.PDF_TO_CSS_UNITS,_createForOfIteratorHelper(_classPrivateFieldGet(_editorsToRescale,this)));try{for(_iterator11.s();!(_step11=_iterator11.n()).done;)_step11.value.onScaleChanging()}catch(err){_iterator11.e(err)}finally{_iterator11.f()}null!=(_ref8=_classPrivateFieldGet(_currentDrawingSession,this))&&_ref8.onScaleChanging()}},{key:"onRotationChanging",value:function(_ref9){_ref9=_ref9.pagesRotation;this.commitOrRemove(),this.viewParameters.rotation=_ref9}},{key:"highlightSelection",value:function(){var anchorNode,anchorOffset,focusNode,focusOffset,text,textLayer,boxes,layer,isNoneMode,_this8=this,methodOfCreation=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",selection=document.getSelection();selection&&!selection.isCollapsed&&(anchorNode=selection.anchorNode,anchorOffset=selection.anchorOffset,focusNode=selection.focusNode,focusOffset=selection.focusOffset,text=selection.toString(),textLayer=_assertClassBrand(_AnnotationEditorUIManager_brand,this,_getAnchorElementForSelection).call(this,selection).closest(".textLayer"),boxes=this.getSelectionBoxes(textLayer))&&(selection.empty(),layer=_assertClassBrand(_AnnotationEditorUIManager_brand,this,_getLayerForTextLayer).call(this,textLayer),selection=function(){null!=layer&&layer.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:methodOfCreation,boxes:boxes,anchorNode:anchorNode,anchorOffset:anchorOffset,focusNode:focusNode,focusOffset:focusOffset,text:text}),isNoneMode&&_this8.showAllEditors("highlight",!0,!0)},(isNoneMode=_classPrivateFieldGet(_mode,this)===AnnotationEditorType.NONE)?this.switchToMode(AnnotationEditorType.HIGHLIGHT,selection):selection())}},{key:"addToAnnotationStorage",value:function(editor){editor.isEmpty()||!_classPrivateFieldGet(_annotationStorage,this)||_classPrivateFieldGet(_annotationStorage,this).has(editor.id)||_classPrivateFieldGet(_annotationStorage,this).setValue(editor.id,editor)}},{key:"a11yAlert",value:function(messageId){var args=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,viewerAlert=_classPrivateFieldGet(_viewerAlert,this);viewerAlert&&(viewerAlert.setAttribute("data-l10n-id",messageId),args?viewerAlert.setAttribute("data-l10n-args",JSON.stringify(args)):viewerAlert.removeAttribute("data-l10n-args"))}},{key:"blur",value:function(){if(this.isShiftKeyDown=!1,_classPrivateFieldGet(_highlightWhenShiftUp,this)&&(_classPrivateFieldSet(_highlightWhenShiftUp,this,!1),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_onSelectEnd).call(this,"main_toolbar")),this.hasSelection){var _step12,activeElement=document.activeElement,_iterator12=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var editor=_step12.value;if(editor.div.contains(activeElement)){_classPrivateFieldSet(_lastActiveElement,this,[editor,activeElement]),editor._focusEventsAllowed=!1;break}}}catch(err){_iterator12.e(err)}finally{_iterator12.f()}}}},{key:"focus",value:function(){var lastEditor,_classPrivateFieldGet16;_classPrivateFieldGet(_lastActiveElement,this)&&(_classPrivateFieldGet16=_classPrivateFieldGet(_lastActiveElement,this),_classPrivateFieldGet16=babelHelpers.slicedToArray(_classPrivateFieldGet16,2),lastEditor=_classPrivateFieldGet16[0],_classPrivateFieldGet16=_classPrivateFieldGet16[1],_classPrivateFieldSet(_lastActiveElement,this,null),_classPrivateFieldGet16.addEventListener("focusin",function(){lastEditor._focusEventsAllowed=!0},{once:!0,signal:this._signal}),_classPrivateFieldGet16.focus())}},{key:"addEditListeners",value:function(){_assertClassBrand(_AnnotationEditorUIManager_brand,this,_addKeyboardManager).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_addCopyPasteListeners).call(this)}},{key:"removeEditListeners",value:function(){_assertClassBrand(_AnnotationEditorUIManager_brand,this,_removeKeyboardManager).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_removeCopyPasteListeners).call(this)}},{key:"dragOver",value:function(event){var _step13,_iterator13=_createForOfIteratorHelper(event.dataTransfer.items);try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var _step14,type=_step13.value.type,_iterator14=_createForOfIteratorHelper(_classPrivateFieldGet(_editorTypes,this));try{for(_iterator14.s();!(_step14=_iterator14.n()).done;)if(_step14.value.isHandlingMimeForPasting(type))return event.dataTransfer.dropEffect="copy",void event.preventDefault()}catch(err){_iterator14.e(err)}finally{_iterator14.f()}}}catch(err){_iterator13.e(err)}finally{_iterator13.f()}}},{key:"drop",value:function(event){var _step15,_iterator15=_createForOfIteratorHelper(event.dataTransfer.items);try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var _step16,item=_step15.value,_iterator16=_createForOfIteratorHelper(_classPrivateFieldGet(_editorTypes,this));try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var editorType=_step16.value;if(editorType.isHandlingMimeForPasting(item.type))return editorType.paste(item,this.currentLayer),void event.preventDefault()}}catch(err){_iterator16.e(err)}finally{_iterator16.f()}}}catch(err){_iterator15.e(err)}finally{_iterator15.f()}}},{key:"copy",value:function(event){var _classPrivateFieldGet18;if(event.preventDefault(),null!=(_classPrivateFieldGet18=_classPrivateFieldGet(_activeEditor,this))&&_classPrivateFieldGet18.commitOrRemove(),this.hasSelection){var _step17,editors=[],_iterator17=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var serialized=_step17.value.serialize(!0);serialized&&editors.push(serialized)}}catch(err){_iterator17.e(err)}finally{_iterator17.f()}0!==editors.length&&event.clipboardData.setData("application/pdfjs",JSON.stringify(editors))}}},{key:"cut",value:function(event){this.copy(event),this.delete()}},{key:"paste",value:async function(event){var _step18,_this9=this,event=(event.preventDefault(),event.clipboardData),_iterator18=_createForOfIteratorHelper(event.items);try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var _step20,item=_step18.value,_iterator20=_createForOfIteratorHelper(_classPrivateFieldGet(_editorTypes,this));try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var editorType=_step20.value;if(editorType.isHandlingMimeForPasting(item.type))return void editorType.paste(item,this.currentLayer)}}catch(err){_iterator20.e(err)}finally{_iterator20.f()}}}catch(err){_iterator18.e(err)}finally{_iterator18.f()}event=event.getData("application/pdfjs");if(event){try{event=JSON.parse(event)}catch(ex){return void warn('paste: "'.concat(ex.message,'".'))}if(Array.isArray(event)){this.unselectAll();var layer=this.currentLayer;try{var _step19,newEditors=[],_iterator19=_createForOfIteratorHelper(event);try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var editor=_step19.value,deserializedEditor=await layer.deserialize(editor);if(!deserializedEditor)return;newEditors.push(deserializedEditor)}}catch(err){_iterator19.e(err)}finally{_iterator19.f()}this.addCommands({cmd:function(){for(var _i=0,_newEditors=newEditors;_i<_newEditors.length;_i++){var editor=_newEditors[_i];_assertClassBrand(_AnnotationEditorUIManager_brand,_this9,_addEditorToLayer).call(_this9,editor)}_assertClassBrand(_AnnotationEditorUIManager_brand,_this9,_selectEditors).call(_this9,newEditors)},undo:function(){for(var _i2=0,_newEditors2=newEditors;_i2<_newEditors2.length;_i2++)_newEditors2[_i2].remove()},mustExec:!0})}catch(ex){warn('paste: "'.concat(ex.message,'".'))}}}}},{key:"keydown",value:function(event){this.isShiftKeyDown||"Shift"!==event.key||(this.isShiftKeyDown=!0),_classPrivateFieldGet(_mode,this)===AnnotationEditorType.NONE||this.isEditorHandlingKeyboard||AnnotationEditorUIManager._keyboardManager.exec(this,event)}},{key:"keyup",value:function(event){this.isShiftKeyDown&&"Shift"===event.key&&(this.isShiftKeyDown=!1,_classPrivateFieldGet(_highlightWhenShiftUp,this))&&(_classPrivateFieldSet(_highlightWhenShiftUp,this,!1),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_onSelectEnd).call(this,"main_toolbar"))}},{key:"onEditingAction",value:function(_ref0){var name=_ref0.name;switch(name){case"undo":case"redo":case"delete":case"selectAll":this[name]();break;case"highlightSelection":this.highlightSelection("context_menu")}}},{key:"setEditingState",value:function(isEditing){isEditing?(_assertClassBrand(_AnnotationEditorUIManager_brand,this,_addFocusManager).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_addCopyPasteListeners).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{isEditing:_classPrivateFieldGet(_mode,this)!==AnnotationEditorType.NONE,isEmpty:_assertClassBrand(_AnnotationEditorUIManager_brand,this,_isEmpty).call(this),hasSomethingToUndo:_classPrivateFieldGet(_commandManager,this).hasSomethingToUndo(),hasSomethingToRedo:_classPrivateFieldGet(_commandManager,this).hasSomethingToRedo(),hasSelectedEditor:!1})):(_assertClassBrand(_AnnotationEditorUIManager_brand,this,_removeFocusManager).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_removeCopyPasteListeners).call(this),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{isEditing:!1}),this.disableUserSelect(!1))}},{key:"registerEditorTypes",value:function(types){if(!_classPrivateFieldGet(_editorTypes,this)){_classPrivateFieldSet(_editorTypes,this,types);var _step21,_iterator21=_createForOfIteratorHelper(_classPrivateFieldGet(_editorTypes,this));try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var editorType=_step21.value;_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,editorType.defaultPropertiesToUpdate)}}catch(err){_iterator21.e(err)}finally{_iterator21.f()}}}},{key:"getId",value:function(){return _classPrivateFieldGet(_idManager,this).id}},{key:"currentLayer",get:function(){return _classPrivateFieldGet(_allLayers,this).get(_classPrivateFieldGet(_currentPageIndex,this))}},{key:"getLayer",value:function(pageIndex){return _classPrivateFieldGet(_allLayers,this).get(pageIndex)}},{key:"currentPageIndex",get:function(){return _classPrivateFieldGet(_currentPageIndex,this)}},{key:"addLayer",value:function(layer){_classPrivateFieldGet(_allLayers,this).set(layer.pageIndex,layer),_classPrivateFieldGet(_isEnabled,this)?layer.enable():layer.disable()}},{key:"removeLayer",value:function(layer){_classPrivateFieldGet(_allLayers,this).delete(layer.pageIndex)}},{key:"updateMode",value:async function(mode){var editId=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,isFromKeyboard=2<arguments.length&&void 0!==arguments[2]&&arguments[2],mustEnterInEditMode=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(_classPrivateFieldGet(_mode,this)!==mode&&(!_classPrivateFieldGet(_updateModeCapability,this)||(await _classPrivateFieldGet(_updateModeCapability,this).promise,_classPrivateFieldGet(_updateModeCapability,this)))){if(_classPrivateFieldSet(_updateModeCapability,this,Promise.withResolvers()),null!=(_classPrivateFieldGet19=_classPrivateFieldGet(_currentDrawingSession,this))&&_classPrivateFieldGet19.commitOrRemove(),_classPrivateFieldSet(_mode,this,mode),mode===AnnotationEditorType.NONE)this.setEditingState(!1),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_disableAll).call(this),null!=(_classPrivateFieldGet19=this._editorUndoBar)&&_classPrivateFieldGet19.hide();else{mode===AnnotationEditorType.SIGNATURE&&await(null==(_classPrivateFieldGet19=_classPrivateFieldGet(_signatureManager,this))?void 0:_classPrivateFieldGet19.loadSignatures()),this.setEditingState(!0),await _assertClassBrand(_AnnotationEditorUIManager_brand,this,_enableAll).call(this),this.unselectAll();var _classPrivateFieldGet19,_step22,_iterator22=_createForOfIteratorHelper(_classPrivateFieldGet(_allLayers,this).values());try{for(_iterator22.s();!(_step22=_iterator22.n()).done;)_step22.value.updateMode(mode)}catch(err){_iterator22.e(err)}finally{_iterator22.f()}if(editId){var _step23,_iterator23=_createForOfIteratorHelper(_classPrivateFieldGet(_allEditors,this).values());try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var editor=_step23.value;editor.annotationElementId===editId||editor.id===editId?(this.setSelected(editor),mustEnterInEditMode&&editor.enterInEditMode()):editor.unselect()}}catch(err){_iterator23.e(err)}finally{_iterator23.f()}}else isFromKeyboard&&this.addNewEditorFromKeyboard()}_classPrivateFieldGet(_updateModeCapability,this).resolve()}}},{key:"addNewEditorFromKeyboard",value:function(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}},{key:"updateToolbar",value:function(options){options.mode!==_classPrivateFieldGet(_mode,this)&&this._eventBus.dispatch("switchannotationeditormode",_objectSpread({source:this},options))}},{key:"updateParams",value:function(type,value){var _classPrivateFieldGet21;if(_classPrivateFieldGet(_editorTypes,this)){switch(type){case AnnotationEditorParamsType.CREATE:return void this.currentLayer.addNewEditor(value);case AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:null!=(_classPrivateFieldGet21=_classPrivateFieldGet(_mainHighlightColorPicker,this))&&_classPrivateFieldGet21.updateColor(value);break;case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(_classPrivateFieldGet(_showAllStates,this)||_classPrivateFieldSet(_showAllStates,this,new Map)).set(type,value),this.showAllEditors("highlight",value)}var _step24,_iterator24=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator24.s();!(_step24=_iterator24.n()).done;)_step24.value.updateParams(type,value)}catch(err){_iterator24.e(err)}finally{_iterator24.f()}var _step25,_iterator25=_createForOfIteratorHelper(_classPrivateFieldGet(_editorTypes,this));try{for(_iterator25.s();!(_step25=_iterator25.n()).done;)_step25.value.updateDefaultParams(type,value)}catch(err){_iterator25.e(err)}finally{_iterator25.f()}}}},{key:"showAllEditors",value:function(type,visible){var _classPrivateFieldGet23,_step26,_iterator26=_createForOfIteratorHelper(_classPrivateFieldGet(_allEditors,this).values());try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var editor=_step26.value;editor.editorType===type&&editor.show(visible)}}catch(err){_iterator26.e(err)}finally{_iterator26.f()}(null==(_classPrivateFieldGet23=null==(_classPrivateFieldGet23=_classPrivateFieldGet(_showAllStates,this))?void 0:_classPrivateFieldGet23.get(AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL))||_classPrivateFieldGet23)!==visible&&_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,[[AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,visible]])}},{key:"enableWaiting",value:function(){var mustWait=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(_classPrivateFieldGet(_isWaiting,this)!==mustWait){_classPrivateFieldSet(_isWaiting,this,mustWait);var _step27,_iterator27=_createForOfIteratorHelper(_classPrivateFieldGet(_allLayers,this).values());try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var layer=_step27.value;mustWait?layer.disableClick():layer.enableClick(),layer.div.classList.toggle("waiting",mustWait)}}catch(err){_iterator27.e(err)}finally{_iterator27.f()}}}},{key:"getEditors",value:function(pageIndex){var _step28,editors=[],_iterator28=_createForOfIteratorHelper(_classPrivateFieldGet(_allEditors,this).values());try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var editor=_step28.value;editor.pageIndex===pageIndex&&editors.push(editor)}}catch(err){_iterator28.e(err)}finally{_iterator28.f()}return editors}},{key:"getEditor",value:function(id){return _classPrivateFieldGet(_allEditors,this).get(id)}},{key:"addEditor",value:function(editor){_classPrivateFieldGet(_allEditors,this).set(editor.id,editor)}},{key:"removeEditor",value:function(editor){var _classPrivateFieldGet24,_this0=this;editor.div.contains(document.activeElement)&&(_classPrivateFieldGet(_focusMainContainerTimeoutId,this)&&clearTimeout(_classPrivateFieldGet(_focusMainContainerTimeoutId,this)),_classPrivateFieldSet(_focusMainContainerTimeoutId,this,setTimeout(function(){_this0.focusMainContainer(),_classPrivateFieldSet(_focusMainContainerTimeoutId,_this0,null)},0))),_classPrivateFieldGet(_allEditors,this).delete(editor.id),editor.annotationElementId&&null!=(_classPrivateFieldGet24=_classPrivateFieldGet(_missingCanvases,this))&&_classPrivateFieldGet24.delete(editor.annotationElementId),this.unselect(editor),editor.annotationElementId&&_classPrivateFieldGet(_deletedAnnotationsElementIds,this).has(editor.annotationElementId)||null!=(_classPrivateFieldGet24=_classPrivateFieldGet(_annotationStorage,this))&&_classPrivateFieldGet24.remove(editor.id)}},{key:"addDeletedAnnotationElement",value:function(editor){_classPrivateFieldGet(_deletedAnnotationsElementIds,this).add(editor.annotationElementId),this.addChangedExistingAnnotation(editor),editor.deleted=!0}},{key:"isDeletedAnnotationElement",value:function(annotationElementId){return _classPrivateFieldGet(_deletedAnnotationsElementIds,this).has(annotationElementId)}},{key:"removeDeletedAnnotationElement",value:function(editor){_classPrivateFieldGet(_deletedAnnotationsElementIds,this).delete(editor.annotationElementId),this.removeChangedExistingAnnotation(editor),editor.deleted=!1}},{key:"setActiveEditor",value:function(editor){_classPrivateFieldGet(_activeEditor,this)!==editor&&(_classPrivateFieldSet(_activeEditor,this,editor),editor)&&_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,editor.propertiesToUpdate)}},{key:"updateUI",value:function(editor){_classPrivateGetter(_AnnotationEditorUIManager_brand,this,_get_lastSelectedEditor)===editor&&_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,editor.propertiesToUpdate)}},{key:"updateUIForDefaultProperties",value:function(editorType){_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,editorType.defaultPropertiesToUpdate)}},{key:"toggleSelected",value:function(editor){_classPrivateFieldGet(_selectedEditors,this).has(editor)?(_classPrivateFieldGet(_selectedEditors,this).delete(editor),editor.unselect(),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})):(_classPrivateFieldGet(_selectedEditors,this).add(editor),editor.select(),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,editor.propertiesToUpdate),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!0}))}},{key:"setSelected",value:function(editor){this.updateToolbar({mode:editor.mode,editId:editor.id}),null!=(_classPrivateFieldGet26=_classPrivateFieldGet(_currentDrawingSession,this))&&_classPrivateFieldGet26.commitOrRemove();var _classPrivateFieldGet26,_step29,_iterator29=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var ed=_step29.value;ed!==editor&&ed.unselect()}}catch(err){_iterator29.e(err)}finally{_iterator29.f()}_classPrivateFieldGet(_selectedEditors,this).clear(),_classPrivateFieldGet(_selectedEditors,this).add(editor),editor.select(),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,editor.propertiesToUpdate),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!0})}},{key:"isSelected",value:function(editor){return _classPrivateFieldGet(_selectedEditors,this).has(editor)}},{key:"firstSelectedEditor",get:function(){return _classPrivateFieldGet(_selectedEditors,this).values().next().value}},{key:"unselect",value:function(editor){editor.unselect(),_classPrivateFieldGet(_selectedEditors,this).delete(editor),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}},{key:"hasSelection",get:function(){return 0!==_classPrivateFieldGet(_selectedEditors,this).size}},{key:"isEnterHandled",get:function(){return 1===_classPrivateFieldGet(_selectedEditors,this).size&&this.firstSelectedEditor.isEnterHandled}},{key:"undo",value:function(){var _this$_editorUndoBar3;_classPrivateFieldGet(_commandManager,this).undo(),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:_classPrivateFieldGet(_commandManager,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:_assertClassBrand(_AnnotationEditorUIManager_brand,this,_isEmpty).call(this)}),null!=(_this$_editorUndoBar3=this._editorUndoBar)&&_this$_editorUndoBar3.hide()}},{key:"redo",value:function(){_classPrivateFieldGet(_commandManager,this).redo(),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:_classPrivateFieldGet(_commandManager,this).hasSomethingToRedo(),isEmpty:_assertClassBrand(_AnnotationEditorUIManager_brand,this,_isEmpty).call(this)})}},{key:"addCommands",value:function(params){_classPrivateFieldGet(_commandManager,this).add(params),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:_assertClassBrand(_AnnotationEditorUIManager_brand,this,_isEmpty).call(this)})}},{key:"cleanUndoStack",value:function(type){_classPrivateFieldGet(_commandManager,this).cleanType(type)}},{key:"delete",value:function(){var editors,undo,_this1=this,_this$currentLayer=(this.commitOrRemove(),null==(_this$currentLayer=this.currentLayer)?void 0:_this$currentLayer.endDrawingSession(!0));(this.hasSelection||_this$currentLayer)&&(editors=_this$currentLayer?[_this$currentLayer]:babelHelpers.toConsumableArray(_classPrivateFieldGet(_selectedEditors,this)),undo=function(){var _step31,_iterator31=_createForOfIteratorHelper(editors);try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var editor=_step31.value;_assertClassBrand(_AnnotationEditorUIManager_brand,_this1,_addEditorToLayer).call(_this1,editor)}}catch(err){_iterator31.e(err)}finally{_iterator31.f()}},this.addCommands({cmd:function(){null!=(_this1$_editorUndoBar=_this1._editorUndoBar)&&_this1$_editorUndoBar.show(undo,1===editors.length?editors[0].editorType:editors.length);var _this1$_editorUndoBar,_step30,_iterator30=_createForOfIteratorHelper(editors);try{for(_iterator30.s();!(_step30=_iterator30.n()).done;)_step30.value.remove()}catch(err){_iterator30.e(err)}finally{_iterator30.f()}},undo:undo,mustExec:!0}))}},{key:"commitOrRemove",value:function(){var _classPrivateFieldGet27;null!=(_classPrivateFieldGet27=_classPrivateFieldGet(_activeEditor,this))&&_classPrivateFieldGet27.commitOrRemove()}},{key:"hasSomethingToControl",value:function(){return _classPrivateFieldGet(_activeEditor,this)||this.hasSelection}},{key:"selectAll",value:function(){var _step32,_iterator32=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator32.s();!(_step32=_iterator32.n()).done;)_step32.value.commit()}catch(err){_iterator32.e(err)}finally{_iterator32.f()}_assertClassBrand(_AnnotationEditorUIManager_brand,this,_selectEditors).call(this,_classPrivateFieldGet(_allEditors,this).values())}},{key:"unselectAll",value:function(){var _classPrivateFieldGet28;if((!_classPrivateFieldGet(_activeEditor,this)||(_classPrivateFieldGet(_activeEditor,this).commitOrRemove(),_classPrivateFieldGet(_mode,this)===AnnotationEditorType.NONE))&&(null==(_classPrivateFieldGet28=_classPrivateFieldGet(_currentDrawingSession,this))||!_classPrivateFieldGet28.commitOrRemove())&&this.hasSelection){var _step33,_iterator33=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator33.s();!(_step33=_iterator33.n()).done;)_step33.value.unselect()}catch(err){_iterator33.e(err)}finally{_iterator33.f()}_classPrivateFieldGet(_selectedEditors,this).clear(),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!1})}}},{key:"translateSelectedEditors",value:function(x,y){var _this10=this;if(2<arguments.length&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),this.hasSelection){_classPrivateFieldGet(_translation,this)[0]+=x,_classPrivateFieldGet(_translation,this)[1]+=y;var _step36,_classPrivateFieldGet29=_classPrivateFieldGet(_translation,this),_classPrivateFieldGet29=babelHelpers.slicedToArray(_classPrivateFieldGet29,2),totalX=_classPrivateFieldGet29[0],totalY=_classPrivateFieldGet29[1],editors=babelHelpers.toConsumableArray(_classPrivateFieldGet(_selectedEditors,this)),_iterator36=(_classPrivateFieldGet(_translationTimeoutId,this)&&clearTimeout(_classPrivateFieldGet(_translationTimeoutId,this)),_classPrivateFieldSet(_translationTimeoutId,this,setTimeout(function(){_classPrivateFieldSet(_translationTimeoutId,_this10,null),_classPrivateFieldGet(_translation,_this10)[0]=_classPrivateFieldGet(_translation,_this10)[1]=0,_this10.addCommands({cmd:function(){var _step34,_iterator34=_createForOfIteratorHelper(editors);try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var editor=_step34.value;_classPrivateFieldGet(_allEditors,_this10).has(editor.id)&&(editor.translateInPage(totalX,totalY),editor.translationDone())}}catch(err){_iterator34.e(err)}finally{_iterator34.f()}},undo:function(){var _step35,_iterator35=_createForOfIteratorHelper(editors);try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var editor=_step35.value;_classPrivateFieldGet(_allEditors,_this10).has(editor.id)&&(editor.translateInPage(-totalX,-totalY),editor.translationDone())}}catch(err){_iterator35.e(err)}finally{_iterator35.f()}},mustExec:!1})},1e3)),_createForOfIteratorHelper(editors));try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var editor=_step36.value;editor.translateInPage(x,y),editor.translationDone()}}catch(err){_iterator36.e(err)}finally{_iterator36.f()}}}},{key:"setUpDragSession",value:function(){if(this.hasSelection){this.disableUserSelect(!0),_classPrivateFieldSet(_draggingEditors,this,new Map);var _step37,_iterator37=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var editor=_step37.value;_classPrivateFieldGet(_draggingEditors,this).set(editor,{savedX:editor.x,savedY:editor.y,savedPageIndex:editor.pageIndex,newX:0,newY:0,newPageIndex:-1})}}catch(err){_iterator37.e(err)}finally{_iterator37.f()}}}},{key:"endDragSession",value:function(){var _this11=this;if(!_classPrivateFieldGet(_draggingEditors,this))return!1;this.disableUserSelect(!1);var _step38,move,map=_classPrivateFieldGet(_draggingEditors,this),mustBeAddedInUndoStack=(_classPrivateFieldSet(_draggingEditors,this,null),!1),_iterator38=_createForOfIteratorHelper(map);try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _step38$value=babelHelpers.slicedToArray(_step38.value,2),_step38$value$=_step38$value[0],x=_step38$value$.x,y=_step38$value$.y,pageIndex=_step38$value$.pageIndex,value=_step38$value[1];value.newX=x,value.newY=y,value.newPageIndex=pageIndex,mustBeAddedInUndoStack=mustBeAddedInUndoStack||x!==value.savedX||y!==value.savedY||pageIndex!==value.savedPageIndex}}catch(err){_iterator38.e(err)}finally{_iterator38.f()}return!!mustBeAddedInUndoStack&&(move=function(editor,x,y,pageIndex){var parent;_classPrivateFieldGet(_allEditors,_this11).has(editor.id)&&((parent=_classPrivateFieldGet(_allLayers,_this11).get(pageIndex))?editor._setParentAndPosition(parent,x,y):(editor.pageIndex=pageIndex,editor.x=x,editor.y=y))},this.addCommands({cmd:function(){var _step39,_iterator39=_createForOfIteratorHelper(map);try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _step39$value=babelHelpers.slicedToArray(_step39.value,2),editor=_step39$value[0],_step39$value$=_step39$value[1],newX=_step39$value$.newX,newY=_step39$value$.newY,newPageIndex=_step39$value$.newPageIndex;move(editor,newX,newY,newPageIndex)}}catch(err){_iterator39.e(err)}finally{_iterator39.f()}},undo:function(){var _step40,_iterator40=_createForOfIteratorHelper(map);try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var _step40$value=babelHelpers.slicedToArray(_step40.value,2),editor=_step40$value[0],_step40$value$=_step40$value[1],savedX=_step40$value$.savedX,savedY=_step40$value$.savedY,savedPageIndex=_step40$value$.savedPageIndex;move(editor,savedX,savedY,savedPageIndex)}}catch(err){_iterator40.e(err)}finally{_iterator40.f()}},mustExec:!0}),!0)}},{key:"dragSelectedEditors",value:function(tx,ty){if(_classPrivateFieldGet(_draggingEditors,this)){var _step41,_iterator41=_createForOfIteratorHelper(_classPrivateFieldGet(_draggingEditors,this).keys());try{for(_iterator41.s();!(_step41=_iterator41.n()).done;)_step41.value.drag(tx,ty)}catch(err){_iterator41.e(err)}finally{_iterator41.f()}}}},{key:"rebuild",value:function(editor){var parent;null===editor.parent?(parent=this.getLayer(editor.pageIndex))?(parent.changeParent(editor),parent.addOrRebuild(editor)):(this.addEditor(editor),this.addToAnnotationStorage(editor),editor.rebuild()):editor.parent.addOrRebuild(editor)}},{key:"isEditorHandlingKeyboard",get:function(){var _this$getActive;return(null==(_this$getActive=this.getActive())?void 0:_this$getActive.shouldGetKeyboardEvents())||1===_classPrivateFieldGet(_selectedEditors,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}},{key:"isActive",value:function(editor){return _classPrivateFieldGet(_activeEditor,this)===editor}},{key:"getActive",value:function(){return _classPrivateFieldGet(_activeEditor,this)}},{key:"getMode",value:function(){return _classPrivateFieldGet(_mode,this)}},{key:"imageManager",get:function(){return shadow(this,"imageManager",new ImageManager)}},{key:"getSelectionBoxes",value:function(textLayer){if(!textLayer)return null;for(var selection=document.getSelection(),i=0,ii=selection.rangeCount;i<ii;i++)if(!textLayer.contains(selection.getRangeAt(i).commonAncestorContainer))return null;var rotator,_textLayer$getBoundin=textLayer.getBoundingClientRect(),layerX=_textLayer$getBoundin.x,layerY=_textLayer$getBoundin.y,parentWidth=_textLayer$getBoundin.width,parentHeight=_textLayer$getBoundin.height;switch(textLayer.getAttribute("data-main-rotation")){case"90":rotator=function(x,y,w,h){return{x:(y-layerY)/parentHeight,y:1-(x+w-layerX)/parentWidth,width:h/parentHeight,height:w/parentWidth}};break;case"180":rotator=function(x,y,w,h){return{x:1-(x+w-layerX)/parentWidth,y:1-(y+h-layerY)/parentHeight,width:w/parentWidth,height:h/parentHeight}};break;case"270":rotator=function(x,y,w,h){return{x:1-(y+h-layerY)/parentHeight,y:(x-layerX)/parentWidth,width:h/parentHeight,height:w/parentWidth}};break;default:rotator=function(x,y,w,h){return{x:(x-layerX)/parentWidth,y:(y-layerY)/parentHeight,width:w/parentWidth,height:h/parentHeight}}}for(var boxes=[],_i3=0,_ii=selection.rangeCount;_i3<_ii;_i3++){var range=selection.getRangeAt(_i3);if(!range.collapsed){var _step42,_iterator42=_createForOfIteratorHelper(range.getClientRects());try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _step42$value=_step42.value,x=_step42$value.x,y=_step42$value.y,width=_step42$value.width,height=_step42$value.height;0!==width&&0!==height&&boxes.push(rotator(x,y,width,height))}}catch(err){_iterator42.e(err)}finally{_iterator42.f()}}}return 0===boxes.length?null:boxes}},{key:"addChangedExistingAnnotation",value:function(_ref1){var annotationElementId=_ref1.annotationElementId,_ref1=_ref1.id;(_classPrivateFieldGet(_changedExistingAnnotations,this)||_classPrivateFieldSet(_changedExistingAnnotations,this,new Map)).set(annotationElementId,_ref1)}},{key:"removeChangedExistingAnnotation",value:function(_ref10){var _classPrivateFieldGet31,_ref10=_ref10.annotationElementId;null!=(_classPrivateFieldGet31=_classPrivateFieldGet(_changedExistingAnnotations,this))&&_classPrivateFieldGet31.delete(_ref10)}},{key:"renderAnnotationElement",value:function(annotation){var _classPrivateFieldGet32=null==(_classPrivateFieldGet32=_classPrivateFieldGet(_changedExistingAnnotations,this))?void 0:_classPrivateFieldGet32.get(annotation.data.id);(_classPrivateFieldGet32=_classPrivateFieldGet32&&_classPrivateFieldGet(_annotationStorage,this).getRawValue(_classPrivateFieldGet32))&&(_classPrivateFieldGet(_mode,this)!==AnnotationEditorType.NONE||_classPrivateFieldGet32.hasBeenModified)&&_classPrivateFieldGet32.renderAnnotationElement(annotation)}},{key:"setMissingCanvas",value:function(annotationId,annotationElementId,canvas){var _classPrivateFieldGet33=null==(_classPrivateFieldGet33=_classPrivateFieldGet(_missingCanvases,this))?void 0:_classPrivateFieldGet33.get(annotationId);_classPrivateFieldGet33&&(_classPrivateFieldGet33.setCanvas(annotationElementId,canvas),_classPrivateFieldGet(_missingCanvases,this).delete(annotationId))}},{key:"addMissingCanvas",value:function(annotationId,editor){(_classPrivateFieldGet(_missingCanvases,this)||_classPrivateFieldSet(_missingCanvases,this,new Map)).set(annotationId,editor)}}],[{key:"_keyboardManager",get:function(){function arrowChecker(self){return _classPrivateFieldGet(_container,self).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&self.hasSomethingToControl()}function textInputChecker(_self,_ref11){return!((_ref11=_ref11.target)instanceof HTMLInputElement)||"text"!==(_ref11=_ref11.type)&&"number"!==_ref11}var proto=AnnotationEditorUIManager.prototype,small=this.TRANSLATE_SMALL,big=this.TRANSLATE_BIG;return shadow(this,"_keyboardManager",new KeyboardManager([[["ctrl+a","mac+meta+a"],proto.selectAll,{checker:textInputChecker}],[["ctrl+z","mac+meta+z"],proto.undo,{checker:textInputChecker}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],proto.redo,{checker:textInputChecker}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],proto.delete,{checker:textInputChecker}],[["Enter","mac+Enter"],proto.addNewEditorFromKeyboard,{checker:function(self,_ref12){_ref12=_ref12.target;return!(_ref12 instanceof HTMLButtonElement)&&_classPrivateFieldGet(_container,self).contains(_ref12)&&!self.isEnterHandled}}],[[" ","mac+ "],proto.addNewEditorFromKeyboard,{checker:function(self,_ref13){return!(_ref13.target instanceof HTMLButtonElement)&&_classPrivateFieldGet(_container,self).contains(document.activeElement)}}],[["Escape","mac+Escape"],proto.unselectAll],[["ArrowLeft","mac+ArrowLeft"],proto.translateSelectedEditors,{args:[-small,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],proto.translateSelectedEditors,{args:[-big,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],proto.translateSelectedEditors,{args:[small,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],proto.translateSelectedEditors,{args:[big,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],proto.translateSelectedEditors,{args:[0,-small],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],proto.translateSelectedEditors,{args:[0,-big],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],proto.translateSelectedEditors,{args:[0,small],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],proto.translateSelectedEditors,{args:[0,big],checker:arrowChecker}]]))}}])}();function _getAnchorElementForSelection(_ref129){_ref129=_ref129.anchorNode;return _ref129.nodeType===Node.TEXT_NODE?_ref129.parentElement:_ref129}function _getLayerForTextLayer(textLayer){var currentLayer=this.currentLayer;if(currentLayer.hasTextLayer(textLayer))return currentLayer;var _step173,_iterator173=_createForOfIteratorHelper(_classPrivateFieldGet(_allLayers,this).values());try{for(_iterator173.s();!(_step173=_iterator173.n()).done;){var layer=_step173.value;if(layer.hasTextLayer(textLayer))return layer}}catch(err){_iterator173.e(err)}finally{_iterator173.f()}return null}function _displayHighlightToolbar(){var boxes,selection=document.getSelection();selection&&!selection.isCollapsed&&(selection=_assertClassBrand(_AnnotationEditorUIManager_brand,this,_getAnchorElementForSelection).call(this,selection).closest(".textLayer"),boxes=this.getSelectionBoxes(selection))&&(_classPrivateFieldGet(_highlightToolbar,this)||_classPrivateFieldSet(_highlightToolbar,this,new HighlightToolbar(this)),_classPrivateFieldGet(_highlightToolbar,this).show(selection,boxes,"ltr"===this.direction))}function _selectionChange(){var activeLayer,ac,_classPrivateFieldGet136,_classPrivateFieldGet134,_this107=this,selection=document.getSelection();!selection||selection.isCollapsed?_classPrivateFieldGet(_selectedTextNode,this)&&(null!=(_classPrivateFieldGet134=_classPrivateFieldGet(_highlightToolbar,this))&&_classPrivateFieldGet134.hide(),_classPrivateFieldSet(_selectedTextNode,this,null),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedText:!1})):(_classPrivateFieldGet134=selection.anchorNode)!==_classPrivateFieldGet(_selectedTextNode,this)&&((selection=_assertClassBrand(_AnnotationEditorUIManager_brand,this,_getAnchorElementForSelection).call(this,selection).closest(".textLayer"))?(null!=(_classPrivateFieldGet136=_classPrivateFieldGet(_highlightToolbar,this))&&_classPrivateFieldGet136.hide(),_classPrivateFieldSet(_selectedTextNode,this,_classPrivateFieldGet134),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedText:!0}),_classPrivateFieldGet(_mode,this)!==AnnotationEditorType.HIGHLIGHT&&_classPrivateFieldGet(_mode,this)!==AnnotationEditorType.NONE||(_classPrivateFieldGet(_mode,this)===AnnotationEditorType.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),_classPrivateFieldSet(_highlightWhenShiftUp,this,this.isShiftKeyDown),this.isShiftKeyDown)||(null!=(activeLayer=_classPrivateFieldGet(_mode,this)===AnnotationEditorType.HIGHLIGHT?_assertClassBrand(_AnnotationEditorUIManager_brand,this,_getLayerForTextLayer).call(this,selection):null)&&activeLayer.toggleDrawing(),ac=new AbortController,_classPrivateFieldGet136=this.combinedSignal(ac),_classPrivateFieldGet134=function(e){"pointerup"===e.type&&0!==e.button||(ac.abort(),null!=activeLayer&&activeLayer.toggleDrawing(!0),"pointerup"===e.type&&_assertClassBrand(_AnnotationEditorUIManager_brand,_this107,_onSelectEnd).call(_this107,"main_toolbar"))},window.addEventListener("pointerup",_classPrivateFieldGet134,{signal:_classPrivateFieldGet136}),window.addEventListener("blur",_classPrivateFieldGet134,{signal:_classPrivateFieldGet136}))):_classPrivateFieldGet(_selectedTextNode,this)&&(null!=(selection=_classPrivateFieldGet(_highlightToolbar,this))&&selection.hide(),_classPrivateFieldSet(_selectedTextNode,this,null),_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedText:!1})))}function _onSelectEnd(){var methodOfCreation=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";_classPrivateFieldGet(_mode,this)===AnnotationEditorType.HIGHLIGHT?this.highlightSelection(methodOfCreation):_classPrivateFieldGet(_enableHighlightFloatingButton,this)&&_assertClassBrand(_AnnotationEditorUIManager_brand,this,_displayHighlightToolbar).call(this)}function _addSelectionListener(){document.addEventListener("selectionchange",_assertClassBrand(_AnnotationEditorUIManager_brand,this,_selectionChange).bind(this),{signal:this._signal})}function _addFocusManager(){var signal;_classPrivateFieldGet(_focusManagerAC,this)||(_classPrivateFieldSet(_focusManagerAC,this,new AbortController),signal=this.combinedSignal(_classPrivateFieldGet(_focusManagerAC,this)),window.addEventListener("focus",this.focus.bind(this),{signal:signal}),window.addEventListener("blur",this.blur.bind(this),{signal:signal}))}function _removeFocusManager(){var _classPrivateFieldGet137;null!=(_classPrivateFieldGet137=_classPrivateFieldGet(_focusManagerAC,this))&&_classPrivateFieldGet137.abort(),_classPrivateFieldSet(_focusManagerAC,this,null)}function _addKeyboardManager(){var signal;_classPrivateFieldGet(_keyboardManagerAC,this)||(_classPrivateFieldSet(_keyboardManagerAC,this,new AbortController),signal=this.combinedSignal(_classPrivateFieldGet(_keyboardManagerAC,this)),window.addEventListener("keydown",this.keydown.bind(this),{signal:signal}),window.addEventListener("keyup",this.keyup.bind(this),{signal:signal}))}function _removeKeyboardManager(){var _classPrivateFieldGet138;null!=(_classPrivateFieldGet138=_classPrivateFieldGet(_keyboardManagerAC,this))&&_classPrivateFieldGet138.abort(),_classPrivateFieldSet(_keyboardManagerAC,this,null)}function _addCopyPasteListeners(){var signal;_classPrivateFieldGet(_copyPasteAC,this)||(_classPrivateFieldSet(_copyPasteAC,this,new AbortController),signal=this.combinedSignal(_classPrivateFieldGet(_copyPasteAC,this)),document.addEventListener("copy",this.copy.bind(this),{signal:signal}),document.addEventListener("cut",this.cut.bind(this),{signal:signal}),document.addEventListener("paste",this.paste.bind(this),{signal:signal}))}function _removeCopyPasteListeners(){var _classPrivateFieldGet139;null!=(_classPrivateFieldGet139=_classPrivateFieldGet(_copyPasteAC,this))&&_classPrivateFieldGet139.abort(),_classPrivateFieldSet(_copyPasteAC,this,null)}function _addDragAndDropListeners(){var signal=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:signal}),document.addEventListener("drop",this.drop.bind(this),{signal:signal})}function _dispatchUpdateStates(details){var _this108=this;Object.entries(details).some(function(_ref130){var _ref130=babelHelpers.slicedToArray(_ref130,2),key=_ref130[0],_ref130=_ref130[1];return _classPrivateFieldGet(_previousStates,_this108)[key]!==_ref130})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(_classPrivateFieldGet(_previousStates,this),details)}),_classPrivateFieldGet(_mode,this)===AnnotationEditorType.HIGHLIGHT)&&!1===details.hasSelectedEditor&&_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateUI).call(this,[[AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]])}function _dispatchUpdateUI(details){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:details})}async function _enableAll(){if(!_classPrivateFieldGet(_isEnabled,this)){_classPrivateFieldSet(_isEnabled,this,!0);var _step174,promises=[],_iterator174=_createForOfIteratorHelper(_classPrivateFieldGet(_allLayers,this).values());try{for(_iterator174.s();!(_step174=_iterator174.n()).done;){var layer=_step174.value;promises.push(layer.enable())}}catch(err){_iterator174.e(err)}finally{_iterator174.f()}await Promise.all(promises);var _step175,_iterator175=_createForOfIteratorHelper(_classPrivateFieldGet(_allEditors,this).values());try{for(_iterator175.s();!(_step175=_iterator175.n()).done;)_step175.value.enable()}catch(err){_iterator175.e(err)}finally{_iterator175.f()}}}function _disableAll(){if(this.unselectAll(),_classPrivateFieldGet(_isEnabled,this)){_classPrivateFieldSet(_isEnabled,this,!1);var _step176,_iterator176=_createForOfIteratorHelper(_classPrivateFieldGet(_allLayers,this).values());try{for(_iterator176.s();!(_step176=_iterator176.n()).done;)_step176.value.disable()}catch(err){_iterator176.e(err)}finally{_iterator176.f()}var _step177,_iterator177=_createForOfIteratorHelper(_classPrivateFieldGet(_allEditors,this).values());try{for(_iterator177.s();!(_step177=_iterator177.n()).done;)_step177.value.disable()}catch(err){_iterator177.e(err)}finally{_iterator177.f()}}}function _addEditorToLayer(editor){var layer=_classPrivateFieldGet(_allLayers,this).get(editor.pageIndex);layer?layer.addOrRebuild(editor):(this.addEditor(editor),this.addToAnnotationStorage(editor))}function _get_lastSelectedEditor(_this6){var _step178,ed=null,_iterator178=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,_this6));try{for(_iterator178.s();!(_step178=_iterator178.n()).done;)ed=_step178.value}catch(err){_iterator178.e(err)}finally{_iterator178.f()}return ed}function _isEmpty(){if(0===_classPrivateFieldGet(_allEditors,this).size)return!0;if(1===_classPrivateFieldGet(_allEditors,this).size){var _step179,_iterator179=_createForOfIteratorHelper(_classPrivateFieldGet(_allEditors,this).values());try{for(_iterator179.s();!(_step179=_iterator179.n()).done;)return _step179.value.isEmpty()}catch(err){_iterator179.e(err)}finally{_iterator179.f()}}return!1}function _selectEditors(editors){var _step180,_iterator180=_createForOfIteratorHelper(_classPrivateFieldGet(_selectedEditors,this));try{for(_iterator180.s();!(_step180=_iterator180.n()).done;)_step180.value.unselect()}catch(err){_iterator180.e(err)}finally{_iterator180.f()}_classPrivateFieldGet(_selectedEditors,this).clear();var _step181,_iterator181=_createForOfIteratorHelper(editors);try{for(_iterator181.s();!(_step181=_iterator181.n()).done;){var _editor6=_step181.value;_editor6.isEmpty()||(_classPrivateFieldGet(_selectedEditors,this).add(_editor6),_editor6.select())}}catch(err){_iterator181.e(err)}finally{_iterator181.f()}_assertClassBrand(_AnnotationEditorUIManager_brand,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}babelHelpers.defineProperty(AnnotationEditorUIManager,"TRANSLATE_SMALL",1),babelHelpers.defineProperty(AnnotationEditorUIManager,"TRANSLATE_BIG",10);var _altText2=new WeakMap,_altTextDecorative=new WeakMap,_altTextButton=new WeakMap,_altTextButtonLabel=new WeakMap,_altTextTooltip=new WeakMap,_altTextTooltipTimeout=new WeakMap,_altTextWasFromKeyBoard=new WeakMap,_badge=new WeakMap,_editor2=new WeakMap,_guessedText=new WeakMap,_textWithDisclaimer=new WeakMap,_useNewAltTextFlow=new WeakMap,_AltText_brand=new WeakSet,AltText=function(){function AltText(editor){babelHelpers.classCallCheck(this,AltText),_classPrivateMethodInitSpec(this,_AltText_brand),_classPrivateFieldInitSpec(this,_altText2,null),_classPrivateFieldInitSpec(this,_altTextDecorative,!1),_classPrivateFieldInitSpec(this,_altTextButton,null),_classPrivateFieldInitSpec(this,_altTextButtonLabel,null),_classPrivateFieldInitSpec(this,_altTextTooltip,null),_classPrivateFieldInitSpec(this,_altTextTooltipTimeout,null),_classPrivateFieldInitSpec(this,_altTextWasFromKeyBoard,!1),_classPrivateFieldInitSpec(this,_badge,null),_classPrivateFieldInitSpec(this,_editor2,null),_classPrivateFieldInitSpec(this,_guessedText,null),_classPrivateFieldInitSpec(this,_textWithDisclaimer,null),_classPrivateFieldInitSpec(this,_useNewAltTextFlow,!1),_classPrivateFieldSet(_editor2,this,editor),_classPrivateFieldSet(_useNewAltTextFlow,this,editor._uiManager.useNewAltTextFlow),_l10nNewButton._||(_l10nNewButton._=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"}))}return babelHelpers.createClass(AltText,[{key:"render",value:async function(){function onClick(event){event.preventDefault(),_classPrivateFieldGet(_editor2,_this13)._uiManager.editAltText(_classPrivateFieldGet(_editor2,_this13)),_classPrivateFieldGet(_useNewAltTextFlow,_this13)&&_classPrivateFieldGet(_editor2,_this13)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:_classPrivateGetter(_AltText_brand,_this13,_get_label)}})}var _this13=this,altText=_classPrivateFieldSet(_altTextButton,this,document.createElement("button")),label=(altText.className="altText",altText.tabIndex="0",_classPrivateFieldSet(_altTextButtonLabel,this,document.createElement("span"))),label=(altText.append(label),_classPrivateFieldGet(_useNewAltTextFlow,this)?(altText.classList.add("new"),altText.setAttribute("data-l10n-id",_l10nNewButton._.missing),label.setAttribute("data-l10n-id",_l10nNewButton._["missing-label"])):(altText.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),label.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label")),_classPrivateFieldGet(_editor2,this)._uiManager._signal);altText.addEventListener("contextmenu",noContextMenu,{signal:label}),altText.addEventListener("pointerdown",function(event){return event.stopPropagation()},{signal:label});return altText.addEventListener("click",onClick,{capture:!0,signal:label}),altText.addEventListener("keydown",function(event){event.target===altText&&"Enter"===event.key&&(_classPrivateFieldSet(_altTextWasFromKeyBoard,_this13,!0),onClick(event))},{signal:label}),await _assertClassBrand(_AltText_brand,this,_setState).call(this),altText}},{key:"finish",value:function(){_classPrivateFieldGet(_altTextButton,this)&&(_classPrivateFieldGet(_altTextButton,this).focus({focusVisible:_classPrivateFieldGet(_altTextWasFromKeyBoard,this)}),_classPrivateFieldSet(_altTextWasFromKeyBoard,this,!1))}},{key:"isEmpty",value:function(){return _classPrivateFieldGet(_useNewAltTextFlow,this)?null===_classPrivateFieldGet(_altText2,this):!_classPrivateFieldGet(_altText2,this)&&!_classPrivateFieldGet(_altTextDecorative,this)}},{key:"hasData",value:function(){return _classPrivateFieldGet(_useNewAltTextFlow,this)?null!==_classPrivateFieldGet(_altText2,this)||!!_classPrivateFieldGet(_guessedText,this):this.isEmpty()}},{key:"guessedText",get:function(){return _classPrivateFieldGet(_guessedText,this)}},{key:"setGuessedText",value:async function(guessedText){null===_classPrivateFieldGet(_altText2,this)&&(_classPrivateFieldSet(_guessedText,this,guessedText),_classPrivateFieldSet(_textWithDisclaimer,this,await AltText._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:guessedText})),_assertClassBrand(_AltText_brand,this,_setState).call(this))}},{key:"toggleAltTextBadge",value:function(){var _classPrivateFieldGet34,visibility=0<arguments.length&&void 0!==arguments[0]&&arguments[0];!_classPrivateFieldGet(_useNewAltTextFlow,this)||_classPrivateFieldGet(_altText2,this)?(null!=(_classPrivateFieldGet34=_classPrivateFieldGet(_badge,this))&&_classPrivateFieldGet34.remove(),_classPrivateFieldSet(_badge,this,null)):(_classPrivateFieldGet(_badge,this)||((_classPrivateFieldGet34=_classPrivateFieldSet(_badge,this,document.createElement("div"))).className="noAltTextBadge",_classPrivateFieldGet(_editor2,this).div.append(_classPrivateFieldGet34)),_classPrivateFieldGet(_badge,this).classList.toggle("hidden",!visibility))}},{key:"serialize",value:function(isForCopying){var altText=_classPrivateFieldGet(_altText2,this);return{altText:altText=isForCopying||_classPrivateFieldGet(_guessedText,this)!==altText?altText:_classPrivateFieldGet(_textWithDisclaimer,this),decorative:_classPrivateFieldGet(_altTextDecorative,this),guessedText:_classPrivateFieldGet(_guessedText,this),textWithDisclaimer:_classPrivateFieldGet(_textWithDisclaimer,this)}}},{key:"data",get:function(){return{altText:_classPrivateFieldGet(_altText2,this),decorative:_classPrivateFieldGet(_altTextDecorative,this)}},set:function(_ref14){var altText=_ref14.altText,decorative=_ref14.decorative,guessedText=_ref14.guessedText,textWithDisclaimer=_ref14.textWithDisclaimer,_ref14=_ref14.cancel,_ref14=void 0!==_ref14&&_ref14;guessedText&&(_classPrivateFieldSet(_guessedText,this,guessedText),_classPrivateFieldSet(_textWithDisclaimer,this,textWithDisclaimer)),_classPrivateFieldGet(_altText2,this)===altText&&_classPrivateFieldGet(_altTextDecorative,this)===decorative||(_ref14||(_classPrivateFieldSet(_altText2,this,altText),_classPrivateFieldSet(_altTextDecorative,this,decorative)),_assertClassBrand(_AltText_brand,this,_setState).call(this))}},{key:"toggle",value:function(){var enabled=0<arguments.length&&void 0!==arguments[0]&&arguments[0];_classPrivateFieldGet(_altTextButton,this)&&(!enabled&&_classPrivateFieldGet(_altTextTooltipTimeout,this)&&(clearTimeout(_classPrivateFieldGet(_altTextTooltipTimeout,this)),_classPrivateFieldSet(_altTextTooltipTimeout,this,null)),_classPrivateFieldGet(_altTextButton,this).disabled=!enabled)}},{key:"shown",value:function(){_classPrivateFieldGet(_editor2,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:_classPrivateGetter(_AltText_brand,this,_get_label)}})}},{key:"destroy",value:function(){var _classPrivateFieldGet35;null!=(_classPrivateFieldGet35=_classPrivateFieldGet(_altTextButton,this))&&_classPrivateFieldGet35.remove(),_classPrivateFieldSet(_altTextButton,this,null),_classPrivateFieldSet(_altTextButtonLabel,this,null),_classPrivateFieldSet(_altTextTooltip,this,null),null!=(_classPrivateFieldGet35=_classPrivateFieldGet(_badge,this))&&_classPrivateFieldGet35.remove(),_classPrivateFieldSet(_badge,this,null)}}],[{key:"initialize",value:function(l10n){null==AltText._l10n&&(AltText._l10n=l10n)}}])}();function _get_label(_this12){return(_classPrivateFieldGet(_altText2,_this12)?"added":null===_classPrivateFieldGet(_altText2,_this12)&&_this12.guessedText&&"review")||"missing"}async function _setState(){var _this109=this,button=_classPrivateFieldGet(_altTextButton,this);if(button){if(_classPrivateFieldGet(_useNewAltTextFlow,this)){if(button.classList.toggle("done",!!_classPrivateFieldGet(_altText2,this)),button.setAttribute("data-l10n-id",_l10nNewButton._[_classPrivateGetter(_AltText_brand,this,_get_label)]),null!=(_classPrivateFieldGet140=_classPrivateFieldGet(_altTextButtonLabel,this))&&_classPrivateFieldGet140.setAttribute("data-l10n-id",_l10nNewButton._["".concat(_classPrivateGetter(_AltText_brand,this,_get_label),"-label")]),!_classPrivateFieldGet(_altText2,this))return void(null!=(_classPrivateFieldGet140=_classPrivateFieldGet(_altTextTooltip,this))&&_classPrivateFieldGet140.remove())}else{if(!_classPrivateFieldGet(_altText2,this)&&!_classPrivateFieldGet(_altTextDecorative,this))return button.classList.remove("done"),void(null!=(_classPrivateFieldGet140=_classPrivateFieldGet(_altTextTooltip,this))&&_classPrivateFieldGet140.remove());button.classList.add("done"),button.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}var _classPrivateFieldGet140=_classPrivateFieldGet(_altTextTooltip,this),signal=(_classPrivateFieldGet140||(_classPrivateFieldSet(_altTextTooltip,this,_classPrivateFieldGet140=document.createElement("span")),_classPrivateFieldGet140.className="tooltip",_classPrivateFieldGet140.setAttribute("role","tooltip"),_classPrivateFieldGet140.id="alt-text-tooltip-".concat(_classPrivateFieldGet(_editor2,this).id),(signal=_classPrivateFieldGet(_editor2,this)._uiManager._signal).addEventListener("abort",function(){clearTimeout(_classPrivateFieldGet(_altTextTooltipTimeout,_this109)),_classPrivateFieldSet(_altTextTooltipTimeout,_this109,null)},{once:!0}),button.addEventListener("mouseenter",function(){_classPrivateFieldSet(_altTextTooltipTimeout,_this109,setTimeout(function(){_classPrivateFieldSet(_altTextTooltipTimeout,_this109,null),_classPrivateFieldGet(_altTextTooltip,_this109).classList.add("show"),_classPrivateFieldGet(_editor2,_this109)._reportTelemetry({action:"alt_text_tooltip"})},100))},{signal:signal}),button.addEventListener("mouseleave",function(){var _classPrivateFieldGet143;_classPrivateFieldGet(_altTextTooltipTimeout,_this109)&&(clearTimeout(_classPrivateFieldGet(_altTextTooltipTimeout,_this109)),_classPrivateFieldSet(_altTextTooltipTimeout,_this109,null)),null!=(_classPrivateFieldGet143=_classPrivateFieldGet(_altTextTooltip,_this109))&&_classPrivateFieldGet143.classList.remove("show")},{signal:signal})),_classPrivateFieldGet(_altTextDecorative,this)?_classPrivateFieldGet140.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(_classPrivateFieldGet140.removeAttribute("data-l10n-id"),_classPrivateFieldGet140.textContent=_classPrivateFieldGet(_altText2,this)),_classPrivateFieldGet140.parentNode||button.append(_classPrivateFieldGet140),_classPrivateFieldGet(_editor2,this).getElementForAltText());null!=signal&&signal.setAttribute("aria-describedby",_classPrivateFieldGet140.id)}}var _l10nNewButton={_:null},_container2=(babelHelpers.defineProperty(AltText,"_l10n",null),new WeakMap),_isPinching=new WeakMap,_isPinchingStopped=new WeakMap,_isPinchingDisabled=new WeakMap,_onPinchStart=new WeakMap,_onPinching=new WeakMap,_onPinchEnd=new WeakMap,_pointerDownAC=new WeakMap,_signal2=new WeakMap,_touchInfo=new WeakMap,_touchManagerAC=new WeakMap,_touchMoveAC=new WeakMap,_TouchManager_brand=new WeakSet,TouchManager=_exports.TouchManager=function(){return babelHelpers.createClass(function TouchManager(_ref15){var _container3=_ref15.container,_ref15$isPinchingDisa=_ref15.isPinchingDisabled,_ref15$isPinchingDisa=void 0===_ref15$isPinchingDisa?null:_ref15$isPinchingDisa,_ref15$isPinchingStop=_ref15.isPinchingStopped,_ref15$isPinchingStop=void 0===_ref15$isPinchingStop?null:_ref15$isPinchingStop,_ref15$onPinchStart=_ref15.onPinchStart,_ref15$onPinchStart=void 0===_ref15$onPinchStart?null:_ref15$onPinchStart,_ref15$onPinching=_ref15.onPinching,_ref15$onPinching=void 0===_ref15$onPinching?null:_ref15$onPinching,_ref15$onPinchEnd=_ref15.onPinchEnd,_ref15$onPinchEnd=void 0===_ref15$onPinchEnd?null:_ref15$onPinchEnd,_ref15=_ref15.signal;babelHelpers.classCallCheck(this,TouchManager),_classPrivateMethodInitSpec(this,_TouchManager_brand),_classPrivateFieldInitSpec(this,_container2,void 0),_classPrivateFieldInitSpec(this,_isPinching,!1),_classPrivateFieldInitSpec(this,_isPinchingStopped,null),_classPrivateFieldInitSpec(this,_isPinchingDisabled,void 0),_classPrivateFieldInitSpec(this,_onPinchStart,void 0),_classPrivateFieldInitSpec(this,_onPinching,void 0),_classPrivateFieldInitSpec(this,_onPinchEnd,void 0),_classPrivateFieldInitSpec(this,_pointerDownAC,null),_classPrivateFieldInitSpec(this,_signal2,void 0),_classPrivateFieldInitSpec(this,_touchInfo,null),_classPrivateFieldInitSpec(this,_touchManagerAC,void 0),_classPrivateFieldInitSpec(this,_touchMoveAC,null),_classPrivateFieldSet(_container2,this,_container3),_classPrivateFieldSet(_isPinchingStopped,this,_ref15$isPinchingStop),_classPrivateFieldSet(_isPinchingDisabled,this,_ref15$isPinchingDisa),_classPrivateFieldSet(_onPinchStart,this,_ref15$onPinchStart),_classPrivateFieldSet(_onPinching,this,_ref15$onPinching),_classPrivateFieldSet(_onPinchEnd,this,_ref15$onPinchEnd),_classPrivateFieldSet(_touchManagerAC,this,new AbortController),_classPrivateFieldSet(_signal2,this,AbortSignal.any([_ref15,_classPrivateFieldGet(_touchManagerAC,this).signal])),_container3.addEventListener("touchstart",_assertClassBrand(_TouchManager_brand,this,_onTouchStart).bind(this),{passive:!1,signal:_classPrivateFieldGet(_signal2,this)})},[{key:"MIN_TOUCH_DISTANCE_TO_PINCH",get:function(){return 35/OutputScale.pixelRatio}},{key:"destroy",value:function(){var _classPrivateFieldGet37;null!=(_classPrivateFieldGet37=_classPrivateFieldGet(_touchManagerAC,this))&&_classPrivateFieldGet37.abort(),_classPrivateFieldSet(_touchManagerAC,this,null),null!=(_classPrivateFieldGet37=_classPrivateFieldGet(_pointerDownAC,this))&&_classPrivateFieldGet37.abort(),_classPrivateFieldSet(_pointerDownAC,this,null)}}])}();function _onTouchStart(evt){var cancelPointerDown,container,onTouchEnd,_classPrivateFieldGet144,_this110=this;if(null==(_classPrivateFieldGet144=_classPrivateFieldGet(_isPinchingDisabled,this))||!_classPrivateFieldGet144.call(this)){if(1===evt.touches.length)return _classPrivateFieldGet(_pointerDownAC,this)?void 0:(_classPrivateFieldGet144=_classPrivateFieldSet(_pointerDownAC,this,new AbortController),_classPrivateFieldGet144=AbortSignal.any([_classPrivateFieldGet(_signal2,this),_classPrivateFieldGet144.signal]),(container=_classPrivateFieldGet(_container2,this)).addEventListener("pointerdown",function(e){"touch"===e.pointerType&&(stopEvent(e),cancelPointerDown(e))},_classPrivateFieldGet144={capture:!0,signal:_classPrivateFieldGet144,passive:!(cancelPointerDown=function(e){"touch"===e.pointerType&&(null!=(e=_classPrivateFieldGet(_pointerDownAC,_this110))&&e.abort(),_classPrivateFieldSet(_pointerDownAC,_this110,null))})}),container.addEventListener("pointerup",cancelPointerDown,_classPrivateFieldGet144),void container.addEventListener("pointercancel",cancelPointerDown,_classPrivateFieldGet144));_classPrivateFieldGet(_touchMoveAC,this)||(_classPrivateFieldSet(_touchMoveAC,this,new AbortController),container={signal:AbortSignal.any([_classPrivateFieldGet(_signal2,this),_classPrivateFieldGet(_touchMoveAC,this).signal]),capture:!1,passive:!1},(_classPrivateFieldGet144=_classPrivateFieldGet(_container2,this)).addEventListener("touchmove",_assertClassBrand(_TouchManager_brand,this,_onTouchMove).bind(this),container),onTouchEnd=_assertClassBrand(_TouchManager_brand,this,_onTouchEnd).bind(this),_classPrivateFieldGet144.addEventListener("touchend",onTouchEnd,container),_classPrivateFieldGet144.addEventListener("touchcancel",onTouchEnd,container),container.capture=!0,_classPrivateFieldGet144.addEventListener("pointerdown",stopEvent,container),_classPrivateFieldGet144.addEventListener("pointermove",stopEvent,container),_classPrivateFieldGet144.addEventListener("pointercancel",stopEvent,container),_classPrivateFieldGet144.addEventListener("pointerup",stopEvent,container),null!=(onTouchEnd=_classPrivateFieldGet(_onPinchStart,this))&&onTouchEnd.call(this)),stopEvent(evt),2!==evt.touches.length||null!=(_classPrivateFieldGet144=_classPrivateFieldGet(_isPinchingStopped,this))&&_classPrivateFieldGet144.call(this)?_classPrivateFieldSet(_touchInfo,this,null):(onTouchEnd=(container=babelHelpers.slicedToArray(evt.touches,2))[0],_classPrivateFieldGet144=container[1],onTouchEnd.identifier>_classPrivateFieldGet144.identifier&&(onTouchEnd=(evt=[_classPrivateFieldGet144,onTouchEnd])[0],_classPrivateFieldGet144=evt[1]),_classPrivateFieldSet(_touchInfo,this,{touch0X:onTouchEnd.screenX,touch0Y:onTouchEnd.screenY,touch1X:_classPrivateFieldGet144.screenX,touch1Y:_classPrivateFieldGet144.screenY}))}}function _onTouchMove(evt){var _ref133,touch0,screen1X,touchInfo,distance,pTouch0X,pTouch0Y;_classPrivateFieldGet(_touchInfo,this)&&2===evt.touches.length&&(stopEvent(evt),touch0=(evt=babelHelpers.slicedToArray(evt.touches,2))[0],evt=evt[1],touch0.identifier>evt.identifier&&(touch0=(_ref133=[evt,touch0])[0],evt=_ref133[1]),_ref133=touch0.screenX,touch0=touch0.screenY,screen1X=(evt=evt).screenX,evt=evt.screenY,pTouch0X=(touchInfo=_classPrivateFieldGet(_touchInfo,this)).touch0X,pTouch0Y=touchInfo.touch0Y,pTouch0X=touchInfo.touch1X-pTouch0X,pTouch0Y=touchInfo.touch1Y-pTouch0Y,distance=Math.hypot(screen1X-_ref133,evt-touch0)||1,pTouch0X=Math.hypot(pTouch0X,pTouch0Y)||1,!_classPrivateFieldGet(_isPinching,this)&&Math.abs(pTouch0X-distance)<=_TouchManager.MIN_TOUCH_DISTANCE_TO_PINCH||(touchInfo.touch0X=_ref133,touchInfo.touch0Y=touch0,touchInfo.touch1X=screen1X,touchInfo.touch1Y=evt,_classPrivateFieldGet(_isPinching,this)?(pTouch0Y=[(_ref133+screen1X)/2,(touch0+evt)/2],null!=(touchInfo=_classPrivateFieldGet(_onPinching,this))&&touchInfo.call(this,pTouch0Y,pTouch0X,distance)):_classPrivateFieldSet(_isPinching,this,!0)))}function _onTouchEnd(evt){var _classPrivateFieldGet149;2<=evt.touches.length||(_classPrivateFieldGet(_touchMoveAC,this)&&(_classPrivateFieldGet(_touchMoveAC,this).abort(),_classPrivateFieldSet(_touchMoveAC,this,null),null!=(_classPrivateFieldGet149=_classPrivateFieldGet(_onPinchEnd,this)))&&_classPrivateFieldGet149.call(this),_classPrivateFieldGet(_touchInfo,this)&&(stopEvent(evt),_classPrivateFieldSet(_touchInfo,this,null),_classPrivateFieldSet(_isPinching,this,!1)))}var _TouchManager=TouchManager,_accessibilityData=new WeakMap,_allResizerDivs=new WeakMap,_altText3=new WeakMap,_disabled=new WeakMap,_dragPointerId=new WeakMap,_dragPointerType=new WeakMap,_keepAspectRatio=new WeakMap,_resizersDiv=new WeakMap,_lastPointerCoords=new WeakMap,_savedDimensions=new WeakMap,_focusAC=new WeakMap,_focusedResizerName=new WeakMap,_hasBeenClicked=new WeakMap,_initialRect=new WeakMap,_isEditing=new WeakMap,_isInEditMode=new WeakMap,_isResizerEnabledForKeyboard=new WeakMap,_moveInDOMTimeout=new WeakMap,_prevDragX=new WeakMap,_prevDragY=new WeakMap,_telemetryTimeouts=new WeakMap,_touchManager=new WeakMap,_isDraggable=new WeakMap,_zIndex=new WeakMap,_AnnotationEditor_brand=new WeakSet,AnnotationEditor=function(){function AnnotationEditor(parameters){babelHelpers.classCallCheck(this,AnnotationEditor),_classPrivateMethodInitSpec(this,_AnnotationEditor_brand),_classPrivateFieldInitSpec(this,_accessibilityData,null),_classPrivateFieldInitSpec(this,_allResizerDivs,null),_classPrivateFieldInitSpec(this,_altText3,null),_classPrivateFieldInitSpec(this,_disabled,!1),_classPrivateFieldInitSpec(this,_dragPointerId,null),_classPrivateFieldInitSpec(this,_dragPointerType,""),_classPrivateFieldInitSpec(this,_keepAspectRatio,!1),_classPrivateFieldInitSpec(this,_resizersDiv,null),_classPrivateFieldInitSpec(this,_lastPointerCoords,null),_classPrivateFieldInitSpec(this,_savedDimensions,null),_classPrivateFieldInitSpec(this,_focusAC,null),_classPrivateFieldInitSpec(this,_focusedResizerName,""),_classPrivateFieldInitSpec(this,_hasBeenClicked,!1),_classPrivateFieldInitSpec(this,_initialRect,null),_classPrivateFieldInitSpec(this,_isEditing,!1),_classPrivateFieldInitSpec(this,_isInEditMode,!1),_classPrivateFieldInitSpec(this,_isResizerEnabledForKeyboard,!1),_classPrivateFieldInitSpec(this,_moveInDOMTimeout,null),_classPrivateFieldInitSpec(this,_prevDragX,0),_classPrivateFieldInitSpec(this,_prevDragY,0),_classPrivateFieldInitSpec(this,_telemetryTimeouts,null),_classPrivateFieldInitSpec(this,_touchManager,null),babelHelpers.defineProperty(this,"isSelected",!1),babelHelpers.defineProperty(this,"_isCopy",!1),babelHelpers.defineProperty(this,"_editToolbar",null),babelHelpers.defineProperty(this,"_initialOptions",Object.create(null)),babelHelpers.defineProperty(this,"_initialData",null),babelHelpers.defineProperty(this,"_isVisible",!0),babelHelpers.defineProperty(this,"_uiManager",null),babelHelpers.defineProperty(this,"_focusEventsAllowed",!0),_classPrivateFieldInitSpec(this,_isDraggable,!1),_classPrivateFieldInitSpec(this,_zIndex,AnnotationEditor._zIndex++),this.parent=parameters.parent,this.id=parameters.id,this.width=this.height=null,this.pageIndex=parameters.parent.pageIndex,this.name=parameters.name,this.div=null,this._uiManager=parameters.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=parameters.isCentered,this._structTreeParentId=null,this.annotationElementId=parameters.annotationElementId||null;var _this$parent$viewport=this.parent.viewport,_rotation2=_this$parent$viewport.rotation,_this$parent$viewport=_this$parent$viewport.rawDims,_pageWidth2=_this$parent$viewport.pageWidth,_pageHeight2=_this$parent$viewport.pageHeight,pageX=_this$parent$viewport.pageX,_this$parent$viewport=_this$parent$viewport.pageY,_rotation2=(this.rotation=_rotation2,this.pageRotation=(360+_rotation2-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[_pageWidth2,_pageHeight2],this.pageTranslation=[pageX,_this$parent$viewport],babelHelpers.slicedToArray(this.parentDimensions,2)),_pageWidth2=_rotation2[0],_pageHeight2=_rotation2[1];this.x=parameters.x/_pageWidth2,this.y=parameters.y/_pageHeight2,this.isAttachedToDOM=!1,this.deleted=!1}return babelHelpers.createClass(AnnotationEditor,[{key:"editorType",get:function(){return Object.getPrototypeOf(this).constructor._type}},{key:"mode",get:function(){return Object.getPrototypeOf(this).constructor._editorType}},{key:"propertiesToUpdate",get:function(){return[]}},{key:"_isDraggable",get:function(){return _classPrivateFieldGet(_isDraggable,this)},set:function(value){var _this$div;_classPrivateFieldSet(_isDraggable,this,value),null!=(_this$div=this.div)&&_this$div.classList.toggle("draggable",value)}},{key:"isEnterHandled",get:function(){return!0}},{key:"center",value:function(){var _this$pageDimensions=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions[0],pageHeight=_this$pageDimensions[1];switch(this.parentRotation){case 90:this.x-=this.height*pageHeight/(2*pageWidth),this.y+=this.width*pageWidth/(2*pageHeight);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*pageHeight/(2*pageWidth),this.y-=this.width*pageWidth/(2*pageHeight);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}},{key:"addCommands",value:function(params){this._uiManager.addCommands(params)}},{key:"currentLayer",get:function(){return this._uiManager.currentLayer}},{key:"setInBackground",value:function(){this.div.style.zIndex=0}},{key:"setInForeground",value:function(){this.div.style.zIndex=_classPrivateFieldGet(_zIndex,this)}},{key:"setParent",value:function(parent){null!==parent?(this.pageIndex=parent.pageIndex,this.pageDimensions=parent.pageDimensions):_assertClassBrand(_AnnotationEditor_brand,this,_stopResizing).call(this),this.parent=parent}},{key:"focusin",value:function(event){this._focusEventsAllowed&&(_classPrivateFieldGet(_hasBeenClicked,this)?_classPrivateFieldSet(_hasBeenClicked,this,!1):this.parent.setSelected(this))}},{key:"focusout",value:function(event){var target;!this._focusEventsAllowed||!this.isAttachedToDOM||null!=(target=event.relatedTarget)&&target.closest("#".concat(this.id))||(event.preventDefault(),null!=(target=this.parent)&&target.isMultipleSelection)||this.commitOrRemove()}},{key:"commitOrRemove",value:function(){this.isEmpty()?this.remove():this.commit()}},{key:"commit",value:function(){this.isInEditMode()&&this.addToAnnotationStorage()}},{key:"addToAnnotationStorage",value:function(){this._uiManager.addToAnnotationStorage(this)}},{key:"setAt",value:function(x,y,tx,ty){var _this$parentDimension2=babelHelpers.slicedToArray(this.parentDimensions,2),width=_this$parentDimension2[0],_this$parentDimension2=_this$parentDimension2[1],_this$screenToPageTra=this.screenToPageTranslation(tx,ty),_this$screenToPageTra=babelHelpers.slicedToArray(_this$screenToPageTra,2);tx=_this$screenToPageTra[0],ty=_this$screenToPageTra[1],this.x=(x+tx)/width,this.y=(y+ty)/_this$parentDimension2,this.fixAndSetPosition()}},{key:"_moveAfterPaste",value:function(baseX,baseY){var _this$parentDimension3=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=_this$parentDimension3[0],_this$parentDimension3=_this$parentDimension3[1];this.setAt(baseX*parentWidth,baseY*_this$parentDimension3,this.width*parentWidth,this.height*_this$parentDimension3),this._onTranslated()}},{key:"translate",value:function(x,y){_assertClassBrand(_AnnotationEditor_brand,this,_translate).call(this,this.parentDimensions,x,y)}},{key:"translateInPage",value:function(x,y){_classPrivateFieldGet(_initialRect,this)||_classPrivateFieldSet(_initialRect,this,[this.x,this.y,this.width,this.height]),_assertClassBrand(_AnnotationEditor_brand,this,_translate).call(this,this.pageDimensions,x,y),this.div.scrollIntoView({block:"nearest"})}},{key:"translationDone",value:function(){this._onTranslated(this.x,this.y)}},{key:"drag",value:function(tx,ty){_classPrivateFieldGet(_initialRect,this)||_classPrivateFieldSet(_initialRect,this,[this.x,this.y,this.width,this.height]);var div=this.div,_this$parentDimension4=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=_this$parentDimension4[0],_this$parentDimension4=_this$parentDimension4[1],_this$parentDimension4=(this.x+=tx/parentWidth,this.y+=ty/_this$parentDimension4,this.parent&&(this.x<0||1<this.x||this.y<0||1<this.y)&&(parentWidth=(tx=this.div.getBoundingClientRect()).x,ty=tx.y,this.parent.findNewParent(this,parentWidth,ty))&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y)),this.x),tx=this.y,parentWidth=this.getBaseTranslation(),ty=babelHelpers.slicedToArray(parentWidth,2),parentWidth=ty[0],ty=(tx+=ty[1],div.style);ty.left="".concat((100*(_this$parentDimension4+=parentWidth)).toFixed(2),"%"),ty.top="".concat((100*tx).toFixed(2),"%"),this._onTranslating(_this$parentDimension4,tx),div.scrollIntoView({block:"nearest"})}},{key:"_onTranslating",value:function(x,y){}},{key:"_onTranslated",value:function(x,y){}},{key:"_hasBeenMoved",get:function(){return!!_classPrivateFieldGet(_initialRect,this)&&(_classPrivateFieldGet(_initialRect,this)[0]!==this.x||_classPrivateFieldGet(_initialRect,this)[1]!==this.y)}},{key:"_hasBeenResized",get:function(){return!!_classPrivateFieldGet(_initialRect,this)&&(_classPrivateFieldGet(_initialRect,this)[2]!==this.width||_classPrivateFieldGet(_initialRect,this)[3]!==this.height)}},{key:"getBaseTranslation",value:function(){var _this$parentDimension5=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=_this$parentDimension5[0],_this$parentDimension5=_this$parentDimension5[1],_borderLineWidth=AnnotationEditor._borderLineWidth,x=_borderLineWidth/parentWidth,y=_borderLineWidth/_this$parentDimension5;switch(this.rotation){case 90:return[-x,y];case 180:return[x,y];case 270:return[x,-y];default:return[-x,-y]}}},{key:"_mustFixPosition",get:function(){return!0}},{key:"fixAndSetPosition",value:function(){var rotation=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.rotation,style=this.div.style,_this$pageDimensions2=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions2[0],pageHeight=_this$pageDimensions2[1],x=this.x,y=this.y,width=this.width,height=this.height;if(width*=pageWidth,height*=pageHeight,x*=pageWidth,y*=pageHeight,this._mustFixPosition)switch(rotation){case 0:x=MathClamp(x,0,pageWidth-width),y=MathClamp(y,0,pageHeight-height);break;case 90:x=MathClamp(x,0,pageWidth-height),y=MathClamp(y,width,pageHeight);break;case 180:x=MathClamp(x,width,pageWidth),y=MathClamp(y,height,pageHeight);break;case 270:x=MathClamp(x,height,pageWidth),y=MathClamp(y,0,pageHeight-width)}this.x=x/=pageWidth,this.y=y/=pageHeight;_this$pageDimensions2=this.getBaseTranslation(),rotation=babelHelpers.slicedToArray(_this$pageDimensions2,2),_this$pageDimensions2=rotation[0];y+=rotation[1],style.left="".concat((100*(x+=_this$pageDimensions2)).toFixed(2),"%"),style.top="".concat((100*y).toFixed(2),"%"),this.moveInDOM()}},{key:"screenToPageTranslation",value:function(x,y){return _rotatePoint.call(AnnotationEditor,x,y,this.parentRotation)}},{key:"pageTranslationToScreen",value:function(x,y){return _rotatePoint.call(AnnotationEditor,x,y,360-this.parentRotation)}},{key:"parentScale",get:function(){return this._uiManager.viewParameters.realScale}},{key:"parentRotation",get:function(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}},{key:"parentDimensions",get:function(){var parentScale=this.parentScale,_this$pageDimensions3=babelHelpers.slicedToArray(this.pageDimensions,2);return[_this$pageDimensions3[0]*parentScale,_this$pageDimensions3[1]*parentScale]}},{key:"setDims",value:function(width,height){var _this$parentDimension6=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=_this$parentDimension6[0],_this$parentDimension6=_this$parentDimension6[1],style=this.div.style;style.width="".concat((100*width/parentWidth).toFixed(2),"%"),_classPrivateFieldGet(_keepAspectRatio,this)||(style.height="".concat((100*height/_this$parentDimension6).toFixed(2),"%"))}},{key:"fixDims",value:function(){var parentWidth,_this$parentDimension7,style=this.div.style,height=style.height,width=style.width,widthPercent=width.endsWith("%"),heightPercent=!_classPrivateFieldGet(_keepAspectRatio,this)&&height.endsWith("%");widthPercent&&heightPercent||(parentWidth=(_this$parentDimension7=babelHelpers.slicedToArray(this.parentDimensions,2))[0],_this$parentDimension7=_this$parentDimension7[1],widthPercent||(style.width="".concat((100*parseFloat(width)/parentWidth).toFixed(2),"%")),_classPrivateFieldGet(_keepAspectRatio,this))||heightPercent||(style.height="".concat((100*parseFloat(height)/_this$parentDimension7).toFixed(2),"%"))}},{key:"getInitialTranslation",value:function(){return[0,0]}},{key:"_onResized",value:function(){}},{key:"_onResizing",value:function(){}},{key:"altTextFinish",value:function(){var _classPrivateFieldGet39;null!=(_classPrivateFieldGet39=_classPrivateFieldGet(_altText3,this))&&_classPrivateFieldGet39.finish()}},{key:"toolbarButtons",get:function(){return null}},{key:"addEditToolbar",value:async function(){if(!this._editToolbar&&!_classPrivateFieldGet(_isInEditMode,this)){this._editToolbar=new EditorToolbar(this),this.div.append(this._editToolbar.render());var toolbarButtons=this.toolbarButtons;if(toolbarButtons){var _step43,_iterator43=_createForOfIteratorHelper(toolbarButtons);try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _step43$value=babelHelpers.slicedToArray(_step43.value,2),name=_step43$value[0],tool=_step43$value[1];await this._editToolbar.addButton(name,tool)}}catch(err){_iterator43.e(err)}finally{_iterator43.f()}}this._editToolbar.addButton("delete")}return this._editToolbar}},{key:"removeEditToolbar",value:function(){var _classPrivateFieldGet40;this._editToolbar&&(this._editToolbar.remove(),(this._editToolbar=null)!=(_classPrivateFieldGet40=_classPrivateFieldGet(_altText3,this)))&&_classPrivateFieldGet40.destroy()}},{key:"addContainer",value:function(container){var _this$_editToolbar=null==(_this$_editToolbar=this._editToolbar)?void 0:_this$_editToolbar.div;_this$_editToolbar?_this$_editToolbar.before(container):this.div.append(container)}},{key:"getClientDimensions",value:function(){return this.div.getBoundingClientRect()}},{key:"createAltText",value:function(){return _classPrivateFieldGet(_altText3,this)||(AltText.initialize(AnnotationEditor._l10n),_classPrivateFieldSet(_altText3,this,new AltText(this)),_classPrivateFieldGet(_accessibilityData,this)&&(_classPrivateFieldGet(_altText3,this).data=_classPrivateFieldGet(_accessibilityData,this),_classPrivateFieldSet(_accessibilityData,this,null))),_classPrivateFieldGet(_altText3,this)}},{key:"altTextData",get:function(){var _classPrivateFieldGet41;return null==(_classPrivateFieldGet41=_classPrivateFieldGet(_altText3,this))?void 0:_classPrivateFieldGet41.data},set:function(data){_classPrivateFieldGet(_altText3,this)&&(_classPrivateFieldGet(_altText3,this).data=data)}},{key:"guessedAltText",get:function(){var _classPrivateFieldGet42;return null==(_classPrivateFieldGet42=_classPrivateFieldGet(_altText3,this))?void 0:_classPrivateFieldGet42.guessedText}},{key:"setGuessedAltText",value:async function(text){var _classPrivateFieldGet43;await(null==(_classPrivateFieldGet43=_classPrivateFieldGet(_altText3,this))?void 0:_classPrivateFieldGet43.setGuessedText(text))}},{key:"serializeAltText",value:function(isForCopying){var _classPrivateFieldGet44;return null==(_classPrivateFieldGet44=_classPrivateFieldGet(_altText3,this))?void 0:_classPrivateFieldGet44.serialize(isForCopying)}},{key:"hasAltText",value:function(){return!!_classPrivateFieldGet(_altText3,this)&&!_classPrivateFieldGet(_altText3,this).isEmpty()}},{key:"hasAltTextData",value:function(){var _classPrivateFieldGet46;return null!=(_classPrivateFieldGet46=null==(_classPrivateFieldGet46=_classPrivateFieldGet(_altText3,this))?void 0:_classPrivateFieldGet46.hasData())&&_classPrivateFieldGet46}},{key:"render",value:function(){var _this14=this,div=this.div=document.createElement("div"),_this$parentDimension8=(div.setAttribute("data-editor-rotation",(360-this.rotation)%360),div.className=this.name,div.setAttribute("id",this.id),div.tabIndex=_classPrivateFieldGet(_disabled,this)?-1:0,div.setAttribute("role","application"),this.defaultL10nId&&div.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||div.classList.add("hidden"),this.setInForeground(),_assertClassBrand(_AnnotationEditor_brand,this,_addFocusListeners).call(this),babelHelpers.slicedToArray(this.parentDimensions,2)),parentWidth=_this$parentDimension8[0],_this$parentDimension8=_this$parentDimension8[1],parentWidth=(this.parentRotation%180!=0&&(div.style.maxWidth="".concat((100*_this$parentDimension8/parentWidth).toFixed(2),"%"),div.style.maxHeight="".concat((100*parentWidth/_this$parentDimension8).toFixed(2),"%")),this.getInitialTranslation()),_this$parentDimension8=babelHelpers.slicedToArray(parentWidth,2),parentWidth=_this$parentDimension8[0],_this$parentDimension8=_this$parentDimension8[1];return this.translate(parentWidth,_this$parentDimension8),bindEvents(this,div,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(_classPrivateFieldGet(_touchManager,this)||_classPrivateFieldSet(_touchManager,this,new TouchManager({container:div,isPinchingDisabled:function(){return!_this14.isSelected},onPinchStart:_assertClassBrand(_AnnotationEditor_brand,this,_touchPinchStartCallback).bind(this),onPinching:_assertClassBrand(_AnnotationEditor_brand,this,_touchPinchCallback).bind(this),onPinchEnd:_assertClassBrand(_AnnotationEditor_brand,this,_touchPinchEndCallback).bind(this),signal:this._uiManager._signal}))),null!=(parentWidth=this._uiManager._editorUndoBar)&&parentWidth.hide(),div}},{key:"pointerdown",value:function(event){var isMac=util_FeatureTest.platform.isMac;0!==event.button||event.ctrlKey&&isMac?event.preventDefault():(_classPrivateFieldSet(_hasBeenClicked,this,!0),(this._isDraggable?_assertClassBrand(_AnnotationEditor_brand,this,_setUpDragSession):_assertClassBrand(_AnnotationEditor_brand,this,_selectOnPointerEvent)).call(this,event))}},{key:"_onStartDragging",value:function(){}},{key:"_onStopDragging",value:function(){}},{key:"moveInDOM",value:function(){var _this15=this;_classPrivateFieldGet(_moveInDOMTimeout,this)&&clearTimeout(_classPrivateFieldGet(_moveInDOMTimeout,this)),_classPrivateFieldSet(_moveInDOMTimeout,this,setTimeout(function(){var _this15$parent;_classPrivateFieldSet(_moveInDOMTimeout,_this15,null),null!=(_this15$parent=_this15.parent)&&_this15$parent.moveEditorInDOM(_this15)},0))}},{key:"_setParentAndPosition",value:function(parent,x,y){parent.changeParent(this),this.x=x,this.y=y,this.fixAndSetPosition(),this._onTranslated()}},{key:"getRect",value:function(tx,ty){var rotation=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.rotation,scale=this.parentScale,_this$pageDimensions4=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions4[0],pageHeight=_this$pageDimensions4[1],_this$pageDimensions4=babelHelpers.slicedToArray(this.pageTranslation,2),pageX=_this$pageDimensions4[0],pageY=_this$pageDimensions4[1],shiftX=tx/scale,shiftY=ty/scale,x=this.x*pageWidth,y=this.y*pageHeight,width=this.width*pageWidth,height=this.height*pageHeight;switch(rotation){case 0:return[x+shiftX+pageX,pageHeight-y-shiftY-height+pageY,x+shiftX+width+pageX,pageHeight-y-shiftY+pageY];case 90:return[x+shiftY+pageX,pageHeight-y+shiftX+pageY,x+shiftY+height+pageX,pageHeight-y+shiftX+width+pageY];case 180:return[x-shiftX-width+pageX,pageHeight-y+shiftY+pageY,x-shiftX+pageX,pageHeight-y+shiftY+height+pageY];case 270:return[x-shiftY-height+pageX,pageHeight-y-shiftX-width+pageY,x-shiftY+pageX,pageHeight-y-shiftX+pageY];default:throw new Error("Invalid rotation")}}},{key:"getRectInCurrentCoords",value:function(rect,pageHeight){var rect=babelHelpers.slicedToArray(rect,4),x1=rect[0],y1=rect[1],x2=rect[2],y2=rect[3],width=x2-x1,height=y2-y1;switch(this.rotation){case 0:return[x1,pageHeight-y2,width,height];case 90:return[x1,pageHeight-y1,height,width];case 180:return[x2,pageHeight-y1,width,height];case 270:return[x2,pageHeight-y2,height,width];default:throw new Error("Invalid rotation")}}},{key:"onceAdded",value:function(focus){}},{key:"isEmpty",value:function(){return!1}},{key:"enableEditMode",value:function(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),_classPrivateFieldSet(_isInEditMode,this,!0),!0)}},{key:"disableEditMode",value:function(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),_classPrivateFieldSet(_isInEditMode,this,!1),!0)}},{key:"isInEditMode",value:function(){return _classPrivateFieldGet(_isInEditMode,this)}},{key:"shouldGetKeyboardEvents",value:function(){return _classPrivateFieldGet(_isResizerEnabledForKeyboard,this)}},{key:"needsToBeRebuilt",value:function(){return this.div&&!this.isAttachedToDOM}},{key:"isOnScreen",get:function(){var _this$getClientDimens=this.getClientDimensions(),top=_this$getClientDimens.top,left=_this$getClientDimens.left,bottom=_this$getClientDimens.bottom,_this$getClientDimens=_this$getClientDimens.right,_window=window,innerHeight=_window.innerHeight;return left<_window.innerWidth&&0<_this$getClientDimens&&top<innerHeight&&0<bottom}},{key:"rebuild",value:function(){_assertClassBrand(_AnnotationEditor_brand,this,_addFocusListeners).call(this)}},{key:"rotate",value:function(_angle){}},{key:"resize",value:function(){}},{key:"serializeDeleted",value:function(){var _this$_initialData;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null==(_this$_initialData=this._initialData)?void 0:_this$_initialData.popupRef)||""}}},{key:"serialize",value:function(){unreachable("An editor must be serializable")}},{key:"hasBeenModified",get:function(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}},{key:"remove",value:function(){var _classPrivateFieldGet47;if(null!=(_classPrivateFieldGet47=_classPrivateFieldGet(_focusAC,this))&&_classPrivateFieldGet47.abort(),_classPrivateFieldSet(_focusAC,this,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),_classPrivateFieldGet(_moveInDOMTimeout,this)&&(clearTimeout(_classPrivateFieldGet(_moveInDOMTimeout,this)),_classPrivateFieldSet(_moveInDOMTimeout,this,null)),_assertClassBrand(_AnnotationEditor_brand,this,_stopResizing).call(this),this.removeEditToolbar(),_classPrivateFieldGet(_telemetryTimeouts,this)){var _step44,_iterator44=_createForOfIteratorHelper(_classPrivateFieldGet(_telemetryTimeouts,this).values());try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var timeout=_step44.value;clearTimeout(timeout)}}catch(err){_iterator44.e(err)}finally{_iterator44.f()}_classPrivateFieldSet(_telemetryTimeouts,this,null)}(this.parent=null)!=(_classPrivateFieldGet47=_classPrivateFieldGet(_touchManager,this))&&_classPrivateFieldGet47.destroy(),_classPrivateFieldSet(_touchManager,this,null)}},{key:"isResizable",get:function(){return!1}},{key:"makeResizable",value:function(){this.isResizable&&(_assertClassBrand(_AnnotationEditor_brand,this,_createResizers).call(this),_classPrivateFieldGet(_resizersDiv,this).classList.remove("hidden"))}},{key:"toolbarPosition",get:function(){return null}},{key:"keydown",value:function(event){if(this.isResizable&&event.target===this.div&&"Enter"===event.key){this._uiManager.setSelected(this),_classPrivateFieldSet(_savedDimensions,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});var children=_classPrivateFieldGet(_resizersDiv,this).children;if(!_classPrivateFieldGet(_allResizerDivs,this)){_classPrivateFieldSet(_allResizerDivs,this,Array.from(children));var _step45,boundResizerKeydown=_assertClassBrand(_AnnotationEditor_brand,this,_resizerKeydown).bind(this),boundResizerBlur=_assertClassBrand(_AnnotationEditor_brand,this,_resizerBlur).bind(this),signal=this._uiManager._signal,_iterator45=_createForOfIteratorHelper(_classPrivateFieldGet(_allResizerDivs,this));try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var div=_step45.value,name=div.getAttribute("data-resizer-name");div.setAttribute("role","spinbutton"),div.addEventListener("keydown",boundResizerKeydown,{signal:signal}),div.addEventListener("blur",boundResizerBlur,{signal:signal}),div.addEventListener("focus",_assertClassBrand(_AnnotationEditor_brand,this,_resizerFocus).bind(this,name),{signal:signal}),div.setAttribute("data-l10n-id",AnnotationEditor._l10nResizer[name])}}catch(err){_iterator45.e(err)}finally{_iterator45.f()}}var _step46,first=_classPrivateFieldGet(_allResizerDivs,this)[0],firstPosition=0,_iterator46=_createForOfIteratorHelper(children);try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){if(_step46.value===first)break;firstPosition++}}catch(err){_iterator46.e(err)}finally{_iterator46.f()}var nextFirstPosition=(360-this.rotation+this.parentRotation)%360/90*(_classPrivateFieldGet(_allResizerDivs,this).length/4);if(nextFirstPosition!==firstPosition){if(nextFirstPosition<firstPosition)for(var _i4=0;_i4<firstPosition-nextFirstPosition;_i4++)_classPrivateFieldGet(_resizersDiv,this).append(_classPrivateFieldGet(_resizersDiv,this).firstChild);else if(firstPosition<nextFirstPosition)for(var _i5=0;_i5<nextFirstPosition-firstPosition;_i5++)_classPrivateFieldGet(_resizersDiv,this).firstChild.before(_classPrivateFieldGet(_resizersDiv,this).lastChild);var _step47,i=0,_iterator47=_createForOfIteratorHelper(children);try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var child=_step47.value,_name2=_classPrivateFieldGet(_allResizerDivs,this)[i++].getAttribute("data-resizer-name");child.setAttribute("data-l10n-id",AnnotationEditor._l10nResizer[_name2])}}catch(err){_iterator47.e(err)}finally{_iterator47.f()}}_assertClassBrand(_AnnotationEditor_brand,this,_setResizerTabIndex).call(this,0),_classPrivateFieldSet(_isResizerEnabledForKeyboard,this,!0),_classPrivateFieldGet(_resizersDiv,this).firstChild.focus({focusVisible:!0}),event.preventDefault(),event.stopImmediatePropagation()}}},{key:"_resizeWithKeyboard",value:function(x,y){_classPrivateFieldGet(_isResizerEnabledForKeyboard,this)&&_assertClassBrand(_AnnotationEditor_brand,this,_resizerPointermove).call(this,_classPrivateFieldGet(_focusedResizerName,this),{deltaX:x,deltaY:y,fromKeyboard:!0})}},{key:"_stopResizingWithKeyboard",value:function(){_assertClassBrand(_AnnotationEditor_brand,this,_stopResizing).call(this),this.div.focus()}},{key:"select",value:function(){var _this$div2,_this16=this;this.isSelected&&this._editToolbar||(this.isSelected=!0,this.makeResizable(),null!=(_this$div2=this.div)&&_this$div2.classList.add("selectedEditor"),this._editToolbar?(null!=(_this$div2=this._editToolbar)&&_this$div2.show(),null!=(_this$div2=_classPrivateFieldGet(_altText3,this))&&_this$div2.toggleAltTextBadge(!1)):this.addEditToolbar().then(function(){var _this16$div;null!=(_this16$div=_this16.div)&&_this16$div.classList.contains("selectedEditor")&&null!=(_this16$div=_this16._editToolbar)&&_this16$div.show()}))}},{key:"unselect",value:function(){var _classPrivateFieldGet50;this.isSelected&&(this.isSelected=!1,null!=(_classPrivateFieldGet50=_classPrivateFieldGet(_resizersDiv,this))&&_classPrivateFieldGet50.classList.add("hidden"),null!=(_classPrivateFieldGet50=this.div)&&_classPrivateFieldGet50.classList.remove("selectedEditor"),null!=(_classPrivateFieldGet50=this.div)&&_classPrivateFieldGet50.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null!=(_classPrivateFieldGet50=this._editToolbar)&&_classPrivateFieldGet50.hide(),null!=(_classPrivateFieldGet50=_classPrivateFieldGet(_altText3,this)))&&_classPrivateFieldGet50.toggleAltTextBadge(!0)}},{key:"updateParams",value:function(type,value){}},{key:"disableEditing",value:function(){}},{key:"enableEditing",value:function(){}},{key:"canChangeContent",get:function(){return!1}},{key:"enterInEditMode",value:function(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}},{key:"dblclick",value:function(event){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}},{key:"getElementForAltText",value:function(){return this.div}},{key:"contentDiv",get:function(){return this.div}},{key:"isEditing",get:function(){return _classPrivateFieldGet(_isEditing,this)},set:function(value){_classPrivateFieldSet(_isEditing,this,value),this.parent&&(value?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}},{key:"setAspectRatio",value:function(width,height){_classPrivateFieldSet(_keepAspectRatio,this,!0);var style=this.div.style;style.aspectRatio=width/height,style.height="auto"}},{key:"telemetryInitialData",get:function(){return{action:"added"}}},{key:"telemetryFinalData",get:function(){return null}},{key:"_reportTelemetry",value:function(data){var action,timeout,_this17=this;1<arguments.length&&void 0!==arguments[1]&&arguments[1]?(_classPrivateFieldGet(_telemetryTimeouts,this)||_classPrivateFieldSet(_telemetryTimeouts,this,new Map),action=data.action,(timeout=_classPrivateFieldGet(_telemetryTimeouts,this).get(action))&&clearTimeout(timeout),timeout=setTimeout(function(){_this17._reportTelemetry(data),_classPrivateFieldGet(_telemetryTimeouts,_this17).delete(action),0===_classPrivateFieldGet(_telemetryTimeouts,_this17).size&&_classPrivateFieldSet(_telemetryTimeouts,_this17,null)},AnnotationEditor._telemetryTimeout),_classPrivateFieldGet(_telemetryTimeouts,this).set(action,timeout)):(data.type||(data.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:data}}))}},{key:"show",value:function(){var visible=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!visible),this._isVisible=visible}},{key:"enable",value:function(){this.div&&(this.div.tabIndex=0),_classPrivateFieldSet(_disabled,this,!1)}},{key:"disable",value:function(){this.div&&(this.div.tabIndex=-1),_classPrivateFieldSet(_disabled,this,!0)}},{key:"renderAnnotationElement",value:function(annotation){var canvas,content=annotation.container.querySelector(".annotationContent");return content?"CANVAS"===content.nodeName&&(canvas=content,(content=document.createElement("div")).classList.add("annotationContent",this.editorType),canvas.before(content)):((content=document.createElement("div")).classList.add("annotationContent",this.editorType),annotation.container.prepend(content)),content}},{key:"resetAnnotationElement",value:function(annotation){annotation=annotation.container.firstChild;"DIV"===(null==annotation?void 0:annotation.nodeName)&&annotation.classList.contains("annotationContent")&&annotation.remove()}}],[{key:"_resizerKeyboardManager",get:function(){var resize=AnnotationEditor.prototype._resizeWithKeyboard,small=AnnotationEditorUIManager.TRANSLATE_SMALL,big=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,"_resizerKeyboardManager",new KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],resize,{args:[-small,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],resize,{args:[-big,0]}],[["ArrowRight","mac+ArrowRight"],resize,{args:[small,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],resize,{args:[big,0]}],[["ArrowUp","mac+ArrowUp"],resize,{args:[0,-small]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],resize,{args:[0,-big]}],[["ArrowDown","mac+ArrowDown"],resize,{args:[0,small]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],resize,{args:[0,big]}],[["Escape","mac+Escape"],AnnotationEditor.prototype._stopResizingWithKeyboard]]))}},{key:"isDrawer",get:function(){return!1}},{key:"_defaultLineColor",get:function(){return shadow(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}},{key:"deleteAnnotationElement",value:function(editor){var fakeEditor=new FakeEditor({id:editor.parent.getNextId(),parent:editor.parent,uiManager:editor._uiManager});fakeEditor.annotationElementId=editor.annotationElementId,fakeEditor.deleted=!0,fakeEditor._uiManager.addToAnnotationStorage(fakeEditor)}},{key:"initialize",value:function(l10n,_uiManager){null==AnnotationEditor._l10n&&(AnnotationEditor._l10n=l10n),AnnotationEditor._l10nResizer||(AnnotationEditor._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===AnnotationEditor._borderLineWidth&&(l10n=getComputedStyle(document.documentElement),AnnotationEditor._borderLineWidth=parseFloat(l10n.getPropertyValue("--outline-width"))||0)}},{key:"updateDefaultParams",value:function(_type,_value){}},{key:"defaultPropertiesToUpdate",get:function(){return[]}},{key:"isHandlingMimeForPasting",value:function(mime){return!1}},{key:"paste",value:function(item,parent){unreachable("Not implemented")}},{key:"_round",value:function(x){return Math.round(1e4*x)/1e4}},{key:"deserialize",value:async function(data,parent,uiManager){var parent=new this.prototype.constructor({parent:parent,id:parent.getNextId(),uiManager:uiManager,annotationElementId:data.annotationElementId}),uiManager=(parent.rotation=data.rotation,_classPrivateFieldSet(_accessibilityData,parent,data.accessibilityData),parent._isCopy=data.isCopy||!1,babelHelpers.slicedToArray(parent.pageDimensions,2)),pageWidth=uiManager[0],uiManager=uiManager[1],data=parent.getRectInCurrentCoords(data.rect,uiManager),data=babelHelpers.slicedToArray(data,4),x=data[0],y=data[1],width=data[2],data=data[3];return parent.x=x/pageWidth,parent.y=y/uiManager,parent.width=width/pageWidth,parent.height=data/uiManager,parent}},{key:"MIN_SIZE",get:function(){return 16}},{key:"canCreateNewEmptyEditor",value:function(){return!0}}])}();function _translate(_ref134,x,y){var _ref134=babelHelpers.slicedToArray(_ref134,2),width=_ref134[0],_ref134=_ref134[1],_this$screenToPageTra3=this.screenToPageTranslation(x,y),_this$screenToPageTra3=babelHelpers.slicedToArray(_this$screenToPageTra3,2);x=_this$screenToPageTra3[0],y=_this$screenToPageTra3[1],this.x+=x/width,this.y+=y/_ref134,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function _rotatePoint(x,y,angle){switch(angle){case 90:return[y,-x];case 180:return[-x,-y];case 270:return[-y,x];default:return[x,y]}}function _getRotationMatrix(rotation){switch(rotation){case 90:var _this$pageDimensions8=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions8[0],_this$pageDimensions8=_this$pageDimensions8[1];return[0,-pageWidth/_this$pageDimensions8,_this$pageDimensions8/pageWidth,0];case 180:return[-1,0,0,-1];case 270:_this$pageDimensions8=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions8[0],_this$pageDimensions8=_this$pageDimensions8[1];return[0,pageWidth/_this$pageDimensions8,-_this$pageDimensions8/pageWidth,0];default:return[1,0,0,1]}}function _createResizers(){if(!_classPrivateFieldGet(_resizersDiv,this)){_classPrivateFieldSet(_resizersDiv,this,document.createElement("div")),_classPrivateFieldGet(_resizersDiv,this).classList.add("resizers");for(var classes=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],signal=this._uiManager._signal,_i30=0,_classes=classes;_i30<_classes.length;_i30++){var name=_classes[_i30],div=document.createElement("div");_classPrivateFieldGet(_resizersDiv,this).append(div),div.classList.add("resizer",name),div.setAttribute("data-resizer-name",name),div.addEventListener("pointerdown",_assertClassBrand(_AnnotationEditor_brand,this,_resizerPointerdown).bind(this,name),{signal:signal}),div.addEventListener("contextmenu",noContextMenu,{signal:signal}),div.tabIndex=-1}this.div.prepend(_classPrivateFieldGet(_resizersDiv,this))}}function _resizerPointerdown(name,event){var savedDraggable,ac,savedParentCursor,savedCursor,_this111=this,isMac=(event.preventDefault(),util_FeatureTest.platform.isMac);0!==event.button||event.ctrlKey&&isMac||(null!=(isMac=_classPrivateFieldGet(_altText3,this))&&isMac.toggle(!1),savedDraggable=this._isDraggable,this._isDraggable=!1,_classPrivateFieldSet(_lastPointerCoords,this,[event.screenX,event.screenY]),ac=new AbortController,isMac=this._uiManager.combinedSignal(ac),this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",_assertClassBrand(_AnnotationEditor_brand,this,_resizerPointermove).bind(this,name),{passive:!0,capture:!0,signal:isMac}),window.addEventListener("touchmove",stopEvent,{passive:!1,signal:isMac}),window.addEventListener("contextmenu",noContextMenu,{signal:isMac}),_classPrivateFieldSet(_savedDimensions,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),savedParentCursor=this.parent.div.style.cursor,savedCursor=this.div.style.cursor,this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(event.target).cursor,name=function(){var _classPrivateFieldGet151;ac.abort(),_this111.parent.togglePointerEvents(!0),null!=(_classPrivateFieldGet151=_classPrivateFieldGet(_altText3,_this111))&&_classPrivateFieldGet151.toggle(!0),_this111._isDraggable=savedDraggable,_this111.parent.div.style.cursor=savedParentCursor,_this111.div.style.cursor=savedCursor,_assertClassBrand(_AnnotationEditor_brand,_this111,_addResizeToUndoStack).call(_this111)},window.addEventListener("pointerup",name,{signal:isMac}),window.addEventListener("blur",name,{signal:isMac}))}function _resize(x,y,width,height){this.width=width,this.height=height,this.x=x,this.y=y;x=babelHelpers.slicedToArray(this.parentDimensions,2),y=x[0],x=x[1];this.setDims(y*width,x*height),this.fixAndSetPosition(),this._onResized()}function _addResizeToUndoStack(){var savedX,savedY,savedWidth,_classPrivateFieldGet152,newX,newY,newWidth,newHeight;_classPrivateFieldGet(_savedDimensions,this)&&(savedX=(_classPrivateFieldGet152=_classPrivateFieldGet(_savedDimensions,this)).savedX,savedY=_classPrivateFieldGet152.savedY,savedWidth=_classPrivateFieldGet152.savedWidth,_classPrivateFieldGet152=_classPrivateFieldGet152.savedHeight,_classPrivateFieldSet(_savedDimensions,this,null),newX=this.x,newY=this.y,newWidth=this.width,newHeight=this.height,newX===savedX&&newY===savedY&&newWidth===savedWidth&&newHeight===_classPrivateFieldGet152||this.addCommands({cmd:_assertClassBrand(_AnnotationEditor_brand,this,_resize).bind(this,newX,newY,newWidth,newHeight),undo:_assertClassBrand(_AnnotationEditor_brand,this,_resize).bind(this,savedX,savedY,savedWidth,_classPrivateFieldGet152),mustExec:!0}))}function _resizerPointermove(name,event){function transf(x,y){return[rotationMatrix[0]*x+rotationMatrix[2]*y,rotationMatrix[1]*x+rotationMatrix[3]*y]}var getPoint,getOpposite,_this$parentDimension12=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=_this$parentDimension12[0],_this$parentDimension12=_this$parentDimension12[1],savedX=this.x,savedY=this.y,savedWidth=this.width,savedHeight=this.height,minWidth=_AnnotationEditor.MIN_SIZE/parentWidth,minHeight=_AnnotationEditor.MIN_SIZE/_this$parentDimension12,rotationMatrix=_assertClassBrand(_AnnotationEditor_brand,this,_getRotationMatrix).call(this,this.rotation),invRotationMatrix=_assertClassBrand(_AnnotationEditor_brand,this,_getRotationMatrix).call(this,360-this.rotation),isDiagonal=!1,isHorizontal=!1;switch(name){case"topLeft":isDiagonal=!0,getPoint=function(w,h){return[0,0]},getOpposite=function(w,h){return[w,h]};break;case"topMiddle":getPoint=function(w,h){return[w/2,0]},getOpposite=function(w,h){return[w/2,h]};break;case"topRight":isDiagonal=!0,getPoint=function(w,h){return[w,0]},getOpposite=function(w,h){return[0,h]};break;case"middleRight":isHorizontal=!0,getPoint=function(w,h){return[w,h/2]},getOpposite=function(w,h){return[0,h/2]};break;case"bottomRight":isDiagonal=!0,getPoint=function(w,h){return[w,h]},getOpposite=function(w,h){return[0,0]};break;case"bottomMiddle":getPoint=function(w,h){return[w/2,h]},getOpposite=function(w,h){return[w/2,0]};break;case"bottomLeft":isDiagonal=!0,getPoint=function(w,h){return[0,h]},getOpposite=function(w,h){return[w,0]};break;case"middleLeft":isHorizontal=!0,getPoint=function(w,h){return[0,h/2]},getOpposite=function(w,h){return[w,h/2]}}var deltaY,lastScreenX,_classPrivateFieldGet153,name=getPoint(savedWidth,savedHeight),oppositePoint=getOpposite(savedWidth,savedHeight),transfOppositePoint=transf.apply(void 0,babelHelpers.toConsumableArray(oppositePoint)),savedX=_AnnotationEditor._round(savedX+transfOppositePoint[0]),savedY=_AnnotationEditor._round(savedY+transfOppositePoint[1]),ratioX=1,ratioY=1,screenX=(event.fromKeyboard?(deltaX=event.deltaX,deltaY=event.deltaY):(screenX=event.screenX,event=event.screenY,_classPrivateFieldGet153=_classPrivateFieldGet(_lastPointerCoords,this),lastScreenX=(_classPrivateFieldGet153=babelHelpers.slicedToArray(_classPrivateFieldGet153,2))[0],_classPrivateFieldGet153=_classPrivateFieldGet153[1],lastScreenX=this.screenToPageTranslation(screenX-lastScreenX,event-_classPrivateFieldGet153),deltaX=(_classPrivateFieldGet153=babelHelpers.slicedToArray(lastScreenX,2))[0],deltaY=_classPrivateFieldGet153[1],_classPrivateFieldGet(_lastPointerCoords,this)[0]=screenX,_classPrivateFieldGet(_lastPointerCoords,this)[1]=event),lastScreenX=deltaX/parentWidth,_classPrivateFieldGet153=deltaY/_this$parentDimension12,[invRotationMatrix[0]*lastScreenX+invRotationMatrix[2]*_classPrivateFieldGet153,invRotationMatrix[1]*lastScreenX+invRotationMatrix[3]*_classPrivateFieldGet153]),event=babelHelpers.slicedToArray(screenX,2),screenX=(deltaX=event[0],deltaY=event[1],isDiagonal?(invRotationMatrix=Math.hypot(savedWidth,savedHeight),ratioX=ratioY=Math.max(Math.min(Math.hypot(oppositePoint[0]-name[0]-deltaX,oppositePoint[1]-name[1]-deltaY)/invRotationMatrix,1/savedWidth,1/savedHeight),minWidth/savedWidth,minHeight/savedHeight)):isHorizontal?ratioX=MathClamp(Math.abs(oppositePoint[0]-name[0]-deltaX),minWidth,1)/savedWidth:ratioY=MathClamp(Math.abs(oppositePoint[1]-name[1]-deltaY),minHeight,1)/savedHeight,_AnnotationEditor._round(savedWidth*ratioX)),event=_AnnotationEditor._round(savedHeight*ratioY),invRotationMatrix=savedX-(transfOppositePoint=transf.apply(void 0,babelHelpers.toConsumableArray(getOpposite(screenX,event))))[0],deltaX=savedY-transfOppositePoint[1];_classPrivateFieldGet(_initialRect,this)||_classPrivateFieldSet(_initialRect,this,[this.x,this.y,this.width,this.height]),this.width=screenX,this.height=event,this.x=invRotationMatrix,this.y=deltaX,this.setDims(parentWidth*screenX,_this$parentDimension12*event),this.fixAndSetPosition(),this._onResizing()}function _touchPinchStartCallback(){var _classPrivateFieldGet155;_classPrivateFieldSet(_savedDimensions,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),null!=(_classPrivateFieldGet155=_classPrivateFieldGet(_altText3,this))&&_classPrivateFieldGet155.toggle(!1),this.parent.togglePointerEvents(!1)}function _touchPinchCallback(_origin,prevDistance,distance){var rotationMatrix,parentWidth,_this$parentDimension13,savedY,minWidth,minHeight,savedWidth,savedHeight,savedX,distance=distance/prevDistance*.7+1-.7;1!=distance&&(rotationMatrix=_assertClassBrand(_AnnotationEditor_brand,this,_getRotationMatrix).call(this,this.rotation),prevDistance=function(x,y){return[rotationMatrix[0]*x+rotationMatrix[2]*y,rotationMatrix[1]*x+rotationMatrix[3]*y]},parentWidth=(_this$parentDimension13=babelHelpers.slicedToArray(this.parentDimensions,2))[0],_this$parentDimension13=_this$parentDimension13[1],savedX=this.x,savedY=this.y,savedWidth=this.width,savedHeight=this.height,minWidth=_AnnotationEditor.MIN_SIZE/parentWidth,minHeight=_AnnotationEditor.MIN_SIZE/_this$parentDimension13,distance=Math.max(Math.min(distance,1/savedWidth,1/savedHeight),minWidth/savedWidth,minHeight/savedHeight),minWidth=_AnnotationEditor._round(savedWidth*distance),minHeight=_AnnotationEditor._round(savedHeight*distance),minWidth!==savedWidth||minHeight!==savedHeight)&&(_classPrivateFieldGet(_initialRect,this)||_classPrivateFieldSet(_initialRect,this,[savedX,savedY,savedWidth,savedHeight]),distance=prevDistance(savedWidth/2,savedHeight/2),savedWidth=_AnnotationEditor._round(savedX+distance[0]),savedHeight=_AnnotationEditor._round(savedY+distance[1]),savedX=prevDistance(minWidth/2,minHeight/2),this.x=savedWidth-savedX[0],this.y=savedHeight-savedX[1],this.width=minWidth,this.height=minHeight,this.setDims(parentWidth*minWidth,_this$parentDimension13*minHeight),this.fixAndSetPosition(),this._onResizing())}function _touchPinchEndCallback(){var _classPrivateFieldGet156;null!=(_classPrivateFieldGet156=_classPrivateFieldGet(_altText3,this))&&_classPrivateFieldGet156.toggle(!0),this.parent.togglePointerEvents(!0),_assertClassBrand(_AnnotationEditor_brand,this,_addResizeToUndoStack).call(this)}function _selectOnPointerEvent(event){var isMac=util_FeatureTest.platform.isMac;event.ctrlKey&&!isMac||event.shiftKey||event.metaKey&&isMac?this.parent.toggleSelected(this):this.parent.setSelected(this)}function _setUpDragSession(event){function pointerUpCallback(e){(_classPrivateFieldGet(_dragPointerId,_this112)&&_classPrivateFieldGet(_dragPointerId,_this112)!==e.pointerId?stopEvent:cancelDrag)(e)}var _this112=this,isSelected=this.isSelected,hasDraggingStarted=(this._uiManager.setUpDragSession(),!1),ac=new AbortController,signal=this._uiManager.combinedSignal(ac),opts={capture:!0,passive:!1,signal:signal},cancelDrag=function(e){ac.abort(),_classPrivateFieldSet(_dragPointerId,_this112,null),_classPrivateFieldSet(_hasBeenClicked,_this112,!1),_this112._uiManager.endDragSession()||_assertClassBrand(_AnnotationEditor_brand,_this112,_selectOnPointerEvent).call(_this112,e),hasDraggingStarted&&_this112._onStopDragging()};isSelected&&(_classPrivateFieldSet(_prevDragX,this,event.clientX),_classPrivateFieldSet(_prevDragY,this,event.clientY),_classPrivateFieldSet(_dragPointerId,this,event.pointerId),_classPrivateFieldSet(_dragPointerType,this,event.pointerType),window.addEventListener("pointermove",function(e){hasDraggingStarted||(hasDraggingStarted=!0,_this112._onStartDragging());var tx,x=e.clientX,y=e.clientY;e.pointerId!==_classPrivateFieldGet(_dragPointerId,_this112)?stopEvent(e):(e=_this112.screenToPageTranslation(x-_classPrivateFieldGet(_prevDragX,_this112),y-_classPrivateFieldGet(_prevDragY,_this112)),tx=(e=babelHelpers.slicedToArray(e,2))[0],e=e[1],_classPrivateFieldSet(_prevDragX,_this112,x),_classPrivateFieldSet(_prevDragY,_this112,y),_this112._uiManager.dragSelectedEditors(tx,e))},opts),window.addEventListener("touchmove",stopEvent,opts),window.addEventListener("pointerdown",function(e){e.pointerType===_classPrivateFieldGet(_dragPointerType,_this112)&&(_classPrivateFieldGet(_touchManager,_this112)||e.isPrimary)&&cancelDrag(e),stopEvent(e)},opts));window.addEventListener("pointerup",pointerUpCallback,{signal:signal}),window.addEventListener("blur",pointerUpCallback,{signal:signal})}function _addFocusListeners(){var signal;!_classPrivateFieldGet(_focusAC,this)&&this.div&&(_classPrivateFieldSet(_focusAC,this,new AbortController),signal=this._uiManager.combinedSignal(_classPrivateFieldGet(_focusAC,this)),this.div.addEventListener("focusin",this.focusin.bind(this),{signal:signal}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:signal}))}function _resizerKeydown(event){_AnnotationEditor._resizerKeyboardManager.exec(this,event)}function _resizerBlur(event){_classPrivateFieldGet(_isResizerEnabledForKeyboard,this)&&(null==(event=event.relatedTarget)?void 0:event.parentNode)!==_classPrivateFieldGet(_resizersDiv,this)&&_assertClassBrand(_AnnotationEditor_brand,this,_stopResizing).call(this)}function _resizerFocus(name){_classPrivateFieldSet(_focusedResizerName,this,_classPrivateFieldGet(_isResizerEnabledForKeyboard,this)?name:"")}function _setResizerTabIndex(value){if(_classPrivateFieldGet(_allResizerDivs,this)){var _step182,_iterator182=_createForOfIteratorHelper(_classPrivateFieldGet(_allResizerDivs,this));try{for(_iterator182.s();!(_step182=_iterator182.n()).done;)_step182.value.tabIndex=value}catch(err){_iterator182.e(err)}finally{_iterator182.f()}}}function _stopResizing(){_classPrivateFieldSet(_isResizerEnabledForKeyboard,this,!1),_assertClassBrand(_AnnotationEditor_brand,this,_setResizerTabIndex).call(this,-1),_assertClassBrand(_AnnotationEditor_brand,this,_addResizeToUndoStack).call(this)}_AnnotationEditor=AnnotationEditor,babelHelpers.defineProperty(AnnotationEditor,"_l10n",null),babelHelpers.defineProperty(AnnotationEditor,"_l10nResizer",null),babelHelpers.defineProperty(AnnotationEditor,"_borderLineWidth",-1),babelHelpers.defineProperty(AnnotationEditor,"_colorManager",new _PixelsPerInch),babelHelpers.defineProperty(AnnotationEditor,"_zIndex",1),babelHelpers.defineProperty(AnnotationEditor,"_telemetryTimeout",1e3);var FakeEditor=function(_AnnotationEditor2){function FakeEditor(params){var _this18;return babelHelpers.classCallCheck(this,FakeEditor),(_this18=_callSuper(this,FakeEditor,[params])).annotationElementId=params.annotationElementId,_this18.deleted=!0,_this18}return babelHelpers.inherits(FakeEditor,_AnnotationEditor2),babelHelpers.createClass(FakeEditor,[{key:"serialize",value:function(){return this.serializeDeleted()}}])}(AnnotationEditor),MurmurHash3_64=function(){return babelHelpers.createClass(function MurmurHash3_64(seed){babelHelpers.classCallCheck(this,MurmurHash3_64),this.h1=seed?4294967295&seed:3285377520,this.h2=seed?4294967295&seed:3285377520},[{key:"update",value:function(input){if("string"==typeof input)for(var data=new Uint8Array(2*input.length),length=0,i=0,ii=input.length;i<ii;i++){var code=input.charCodeAt(i);code<=255?data[length++]=code:(data[length++]=code>>>8,data[length++]=255&code)}else{if(!ArrayBuffer.isView(input))throw new Error("Invalid data format, must be a string or TypedArray.");length=(data=input.slice()).byteLength}for(var k2,blockCounts=length>>2,tailLength=length-4*blockCounts,dataUint32=new Uint32Array(data.buffer,0,blockCounts),k1=0,h1=this.h1,h2=this.h2,C1=3432918353,C2=461845907,_i6=0;_i6<blockCounts;_i6++)1&_i6?h1=5*(h1=(h1^=k1=(k1=(k1=(k1=dataUint32[_i6])*C1&4294901760|11601*k1&65535)<<15|k1>>>17)*C2&4294901760|13715*k1&65535)<<13|h1>>>19)+3864292196:h2=5*(h2=(h2^=(k2=(k2=(k2=dataUint32[_i6])*C1&4294901760|11601*k2&65535)<<15|k2>>>17)*C2&4294901760|13715*k2&65535)<<13|h2>>>19)+3864292196;switch(k1=0,tailLength){case 3:k1^=data[4*blockCounts+2]<<16;case 2:k1^=data[4*blockCounts+1]<<8;case 1:k1=(k1=(k1=(k1^=data[4*blockCounts])*C1&4294901760|11601*k1&65535)<<15|k1>>>17)*C2&4294901760|13715*k1&65535,1&blockCounts?h1^=k1:h2^=k1}this.h1=h1,this.h2=h2}},{key:"hexdigest",value:function(){var h1=this.h1,h2=this.h2,h1=3981806797*(h1^=h2>>>1)&4294901760|36045*h1&65535;return h1=444984403*(h1^=(h2=4283543511*h2&4294901760|(2950163797*(h2<<16|h1>>>16)&4294901760)>>>16)>>>1)&4294901760|60499*h1&65535,((h1^=(h2=3301882366*h2&4294901760|(3120437893*(h2<<16|h1>>>16)&4294901760)>>>16)>>>1)>>>0).toString(16).padStart(8,"0")+(h2>>>0).toString(16).padStart(8,"0")}}])}(),SerializableEmpty=Object.freeze({map:null,hash:"",transfer:void 0}),_modified=new WeakMap,_modifiedIds=new WeakMap,_storage=new WeakMap,_AnnotationStorage_brand=new WeakSet,AnnotationStorage=function(){return babelHelpers.createClass(function AnnotationStorage(){babelHelpers.classCallCheck(this,AnnotationStorage),_classPrivateMethodInitSpec(this,_AnnotationStorage_brand),_classPrivateFieldInitSpec(this,_modified,!1),_classPrivateFieldInitSpec(this,_modifiedIds,null),_classPrivateFieldInitSpec(this,_storage,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null},[{key:"getValue",value:function(key,defaultValue){key=_classPrivateFieldGet(_storage,this).get(key);return void 0===key?defaultValue:Object.assign(defaultValue,key)}},{key:"getRawValue",value:function(key){return _classPrivateFieldGet(_storage,this).get(key)}},{key:"remove",value:function(key){if(_classPrivateFieldGet(_storage,this).delete(key),0===_classPrivateFieldGet(_storage,this).size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){var _step48,_iterator48=_createForOfIteratorHelper(_classPrivateFieldGet(_storage,this).values());try{for(_iterator48.s();!(_step48=_iterator48.n()).done;)if(_step48.value instanceof AnnotationEditor)return}catch(err){_iterator48.e(err)}finally{_iterator48.f()}this.onAnnotationEditor(null)}}},{key:"setValue",value:function(key,value){var obj=_classPrivateFieldGet(_storage,this).get(key),modified=!1;if(void 0!==obj)for(var _i7=0,_Object$entries=Object.entries(value);_i7<_Object$entries.length;_i7++){var _Object$entries$_i=babelHelpers.slicedToArray(_Object$entries[_i7],2),entry=_Object$entries$_i[0],_Object$entries$_i=_Object$entries$_i[1];obj[entry]!==_Object$entries$_i&&(modified=!0,obj[entry]=_Object$entries$_i)}else modified=!0,_classPrivateFieldGet(_storage,this).set(key,value);modified&&_assertClassBrand(_AnnotationStorage_brand,this,_setModified).call(this),value instanceof AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(value.constructor._type)}},{key:"has",value:function(key){return _classPrivateFieldGet(_storage,this).has(key)}},{key:"size",get:function(){return _classPrivateFieldGet(_storage,this).size}},{key:"resetModified",value:function(){_classPrivateFieldGet(_modified,this)&&(_classPrivateFieldSet(_modified,this,!1),"function"==typeof this.onResetModified)&&this.onResetModified()}},{key:"print",get:function(){return new PrintAnnotationStorage(this)}},{key:"serializable",get:function(){if(0===_classPrivateFieldGet(_storage,this).size)return SerializableEmpty;var _step49,map=new Map,hash=new MurmurHash3_64,transfer=[],context=Object.create(null),hasBitmap=!1,_iterator49=_createForOfIteratorHelper(_classPrivateFieldGet(_storage,this));try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _step49$value=babelHelpers.slicedToArray(_step49.value,2),key=_step49$value[0],val=_step49$value[1],serialized=val instanceof AnnotationEditor?val.serialize(!1,context):val;serialized&&(map.set(key,serialized),hash.update("".concat(key,":").concat(JSON.stringify(serialized))),hasBitmap=hasBitmap||!!serialized.bitmap)}}catch(err){_iterator49.e(err)}finally{_iterator49.f()}if(hasBitmap){var _step50,_iterator50=_createForOfIteratorHelper(map.values());try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var value=_step50.value;value.bitmap&&transfer.push(value.bitmap)}}catch(err){_iterator50.e(err)}finally{_iterator50.f()}}return 0<map.size?{map:map,hash:hash.hexdigest(),transfer:transfer}:SerializableEmpty}},{key:"editorStats",get:function(){var _step51,stats=null,typeToEditor=new Map,_iterator51=_createForOfIteratorHelper(_classPrivateFieldGet(_storage,this).values());try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){var value=_step51.value;if(value instanceof AnnotationEditor){var editorStats=value.telemetryFinalData;if(editorStats)for(var type=editorStats.type,map=(typeToEditor.has(type)||typeToEditor.set(type,Object.getPrototypeOf(value).constructor),(stats=stats||Object.create(null))[type]||(stats[type]=new Map)),_i8=0,_Object$entries2=Object.entries(editorStats);_i8<_Object$entries2.length;_i8++){var _counters$get,counters,count,_Object$entries2$_i=babelHelpers.slicedToArray(_Object$entries2[_i8],2),key=_Object$entries2$_i[0],val=_Object$entries2$_i[1];"type"!==key&&((counters=map.get(key))||(counters=new Map,map.set(key,counters)),count=null!=(_counters$get=counters.get(val))?_counters$get:0,counters.set(val,count+1))}}}}catch(err){_iterator51.e(err)}finally{_iterator51.f()}var _step52,_iterator52=_createForOfIteratorHelper(typeToEditor);try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){var _step52$value=babelHelpers.slicedToArray(_step52.value,2),_type2=_step52$value[0],editor=_step52$value[1];stats[_type2]=editor.computeTelemetryFinalData(stats[_type2])}}catch(err){_iterator52.e(err)}finally{_iterator52.f()}return stats}},{key:"resetModifiedIds",value:function(){_classPrivateFieldSet(_modifiedIds,this,null)}},{key:"modifiedIds",get:function(){if(_classPrivateFieldGet(_modifiedIds,this))return _classPrivateFieldGet(_modifiedIds,this);var _step53,ids=[],_iterator53=_createForOfIteratorHelper(_classPrivateFieldGet(_storage,this).values());try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var value=_step53.value;value instanceof AnnotationEditor&&value.annotationElementId&&value.serialize()&&ids.push(value.annotationElementId)}}catch(err){_iterator53.e(err)}finally{_iterator53.f()}return _classPrivateFieldSet(_modifiedIds,this,{ids:new Set(ids),hash:ids.join(",")})}},{key:Symbol.iterator,value:function(){return _classPrivateFieldGet(_storage,this).entries()}}])}();function _setModified(){_classPrivateFieldGet(_modified,this)||(_classPrivateFieldSet(_modified,this,!0),"function"==typeof this.onSetModified&&this.onSetModified())}var _serializable=new WeakMap,PrintAnnotationStorage=function(_AnnotationStorage2){function PrintAnnotationStorage(parent){babelHelpers.classCallCheck(this,PrintAnnotationStorage),_classPrivateFieldInitSpec(_this19=_callSuper(this,PrintAnnotationStorage),_serializable,void 0);var _this19,parent=parent.serializable,map=parent.map,hash=parent.hash,parent=parent.transfer,map=structuredClone(map,parent?{transfer:parent}:null);return _classPrivateFieldSet(_serializable,_this19,{map:map,hash:hash,transfer:parent}),_this19}return babelHelpers.inherits(PrintAnnotationStorage,_AnnotationStorage2),babelHelpers.createClass(PrintAnnotationStorage,[{key:"print",get:function(){unreachable("Should not call PrintAnnotationStorage.print")}},{key:"serializable",get:function(){return _classPrivateFieldGet(_serializable,this)}},{key:"modifiedIds",get:function(){return shadow(this,"modifiedIds",{ids:new Set,hash:""})}}])}(AnnotationStorage),_systemFonts=new WeakMap,FontLoader=function(){return babelHelpers.createClass(function FontLoader(_ref16){var _ref16$ownerDocument=_ref16.ownerDocument,_ref16$ownerDocument=void 0===_ref16$ownerDocument?globalThis.document:_ref16$ownerDocument;_ref16.styleElement;babelHelpers.classCallCheck(this,FontLoader),_classPrivateFieldInitSpec(this,_systemFonts,new Set),this._document=_ref16$ownerDocument,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0},[{key:"addNativeFontFace",value:function(nativeFontFace){this.nativeFontFaces.add(nativeFontFace),this._document.fonts.add(nativeFontFace)}},{key:"removeNativeFontFace",value:function(nativeFontFace){this.nativeFontFaces.delete(nativeFontFace),this._document.fonts.delete(nativeFontFace)}},{key:"insertRule",value:function(rule){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));var styleSheet=this.styleElement.sheet;styleSheet.insertRule(rule,styleSheet.cssRules.length)}},{key:"clear",value:function(){var _step54,_iterator54=_createForOfIteratorHelper(this.nativeFontFaces);try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var nativeFontFace=_step54.value;this._document.fonts.delete(nativeFontFace)}}catch(err){_iterator54.e(err)}finally{_iterator54.f()}this.nativeFontFaces.clear(),_classPrivateFieldGet(_systemFonts,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}},{key:"loadSystemFont",value:async function(_ref17){var info=_ref17.systemFontInfo,disableFontFace=_ref17.disableFontFace,_ref17=_ref17._inspectFont;if(info&&!_classPrivateFieldGet(_systemFonts,this).has(info.loadedName))if(assert(!disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){var disableFontFace=info.loadedName,src=info.src,style=info.style,src=new FontFace(disableFontFace,src,style);this.addNativeFontFace(src);try{await src.load(),_classPrivateFieldGet(_systemFonts,this).add(disableFontFace),null!=_ref17&&_ref17(info)}catch(_unused8){warn("Cannot load system font: ".concat(info.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(src)}}else unreachable("Not implemented: loadSystemFont without the Font Loading API.")}},{key:"bind",value:async function(font){var _this20=this;if(!(font.attached||font.missingFile&&!font.systemFontInfo))if(font.attached=!0,font.systemFontInfo)await this.loadSystemFont(font);else if(this.isFontLoadingAPISupported){var nativeFontFace=font.createNativeFontFace();if(nativeFontFace){this.addNativeFontFace(nativeFontFace);try{await nativeFontFace.loaded}catch(ex){throw warn("Failed to load font '".concat(nativeFontFace.family,"': '").concat(ex,"'.")),font.disableFontFace=!0,ex}}}else{nativeFontFace=font.createFontFaceRule();nativeFontFace&&(this.insertRule(nativeFontFace),this.isSyncFontLoadingSupported||await new Promise(function(resolve){resolve=_this20._queueLoadingCallback(resolve);_this20._prepareFontLoadEvent(font,resolve)}))}}},{key:"isFontLoadingAPISupported",get:function(){var _this$_document;return shadow(this,"isFontLoadingAPISupported",!(null==(_this$_document=this._document)||!_this$_document.fonts))}},{key:"isSyncFontLoadingSupported",get:function(){return shadow(this,"isSyncFontLoadingSupported",isNodeJS||util_FeatureTest.platform.isFirefox)}},{key:"_queueLoadingCallback",value:function(callback){var loadingRequests=this.loadingRequests,request={done:!1,complete:function(){for(assert(!request.done,"completeRequest() cannot be called twice."),request.done=!0;0<loadingRequests.length&&loadingRequests[0].done;){var otherRequest=loadingRequests.shift();setTimeout(otherRequest.callback,0)}},callback:callback};return loadingRequests.push(request),request}},{key:"_loadTestFont",get:function(){return shadow(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}},{key:"_prepareFontLoadEvent",value:function(font,request){function int32(data,offset){return data.charCodeAt(offset)<<24|data.charCodeAt(offset+1)<<16|data.charCodeAt(offset+2)<<8|255&data.charCodeAt(offset+3)}function spliceString(s,offset,remove,insert){return s.substring(0,offset)+insert+s.substring(offset+remove)}var canvas=this._document.createElement("canvas"),ctx=(canvas.width=1,canvas.height=1,canvas.getContext("2d")),called=0;function isFontReady(name,callback){30<++called?(warn("Load test font never loaded."),callback()):(ctx.font="30px "+name,ctx.fillText(".",0,20),0<ctx.getImageData(0,0,1,1).data[3]?callback():setTimeout(isFontReady.bind(null,name,callback)))}for(var loadTestFontId="lt".concat(Date.now()).concat(this.loadTestFontId++),checksum=int32(canvas=spliceString(this._loadTestFont,976,loadTestFontId.length,loadTestFontId),16),i=0,ii=loadTestFontId.length-3;i<ii;i+=4)checksum=checksum-1482184792+int32(loadTestFontId,i)|0;i<loadTestFontId.length&&(checksum=checksum-1482184792+int32(loadTestFontId+"XXX",i)|0),canvas=spliceString(canvas,16,4,(value=checksum,String.fromCharCode(value>>24&255,value>>16&255,value>>8&255,255&value)));var value="url(data:font/opentype;base64,".concat(btoa(canvas),");"),canvas='@font-face {font-family:"'.concat(loadTestFontId,'";src:').concat(value,"}"),div=(this.insertRule(canvas),this._document.createElement("div"));div.style.visibility="hidden",div.style.width=div.style.height="10px",div.style.position="absolute",div.style.top=div.style.left="0px";for(var _i9=0,_arr=[font.loadedName,loadTestFontId];_i9<_arr.length;_i9++){var name=_arr[_i9],span=this._document.createElement("span");span.textContent="Hi",span.style.fontFamily=name,div.append(span)}this._document.body.append(div),isFontReady(loadTestFontId,function(){div.remove(),request.complete()})}}])}(),FontFaceObject=function(){return babelHelpers.createClass(function FontFaceObject(translatedData){var i,inspectFont=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;for(i in babelHelpers.classCallCheck(this,FontFaceObject),this.compiledGlyphs=Object.create(null),translatedData)this[i]=translatedData[i];this._inspectFont=inspectFont},[{key:"createNativeFontFace",value:function(){var _this$_inspectFont,css;return!this.data||this.disableFontFace?null:(css=this.cssFontInfo?(css={weight:this.cssFontInfo.fontWeight},this.cssFontInfo.italicAngle&&(css.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),new FontFace(this.cssFontInfo.fontFamily,this.data,css)):new FontFace(this.loadedName,this.data,{}),null!=(_this$_inspectFont=this._inspectFont)&&_this$_inspectFont.call(this,this),css)}},{key:"createFontFaceRule",value:function(){var _this$_inspectFont2,url,css;return!this.data||this.disableFontFace?null:(url="url(data:".concat(this.mimetype,";base64,").concat(toBase64Util(this.data),");"),css=(this.cssFontInfo?(css="font-weight: ".concat(this.cssFontInfo.fontWeight,";"),this.cssFontInfo.italicAngle&&(css+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),'@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(css,"src:")):'@font-face {font-family:"'.concat(this.loadedName,'";src:')).concat(url,"}"),null!=(_this$_inspectFont2=this._inspectFont)&&_this$_inspectFont2.call(this,this,url),css)}},{key:"getPathGenerator",value:function(objs,character){if(void 0!==this.compiledGlyphs[character])return this.compiledGlyphs[character];var objId=this.loadedName+"_path_"+character;try{cmds=objs.get(objId)}catch(ex){warn('getPathGenerator - ignoring character: "'.concat(ex,'".'))}var cmds=new Path2D(cmds||"");return this.fontExtraProperties||objs.delete(objId),this.compiledGlyphs[character]=cmds}}])}();function getFactoryUrlProp(val){if("string"!=typeof val)return null;if(val.endsWith("/"))return val;throw new Error('Invalid factory url: "'.concat(val,'" must include trailing slash.'))}function isRefProxy(v){return"object"==typeof v&&Number.isInteger(null==v?void 0:v.num)&&0<=v.num&&Number.isInteger(null==v?void 0:v.gen)&&0<=v.gen}var _PixelsPerInch=_exports.isValidExplicitDest=function(validRef,validName,dest){if(!Array.isArray(dest)||dest.length<2)return!1;var page=(dest=babelHelpers.toArray(dest))[0],zoom=dest[1],dest=dest.slice(2);if(!validRef(page)&&!Number.isInteger(page))return!1;if(!validName(zoom))return!1;var argsLen=dest.length,allowNull=!0;switch(zoom.name){case"XYZ":if(argsLen<2||3<argsLen)return!1;break;case"Fit":case"FitB":return 0===argsLen;case"FitH":case"FitBH":case"FitV":case"FitBV":if(1<argsLen)return!1;break;case"FitR":if(4!==argsLen)return!1;allowNull=!1;break;default:return!1}var _step,_iterator=_createForOfIteratorHelper(dest);try{for(_iterator.s();!(_step=_iterator.n()).done;){var arg=_step.value;if(!("number"==typeof arg||allowNull&&null===arg))return!1}}catch(err){_iterator.e(err)}finally{_iterator.f()}return!0}.bind(null,isRefProxy,function(v){return"object"==typeof v&&"string"==typeof(null==v?void 0:v.name)}),_listeners=new WeakMap,_deferred=new WeakMap,LoopbackPort=function(){return babelHelpers.createClass(function LoopbackPort(){babelHelpers.classCallCheck(this,LoopbackPort),_classPrivateFieldInitSpec(this,_listeners,new Map),_classPrivateFieldInitSpec(this,_deferred,Promise.resolve())},[{key:"postMessage",value:function(obj,transfer){var _this21=this,event={data:structuredClone(obj,transfer?{transfer:transfer}:null)};_classPrivateFieldGet(_deferred,this).then(function(){var _step55,_iterator55=_createForOfIteratorHelper(_classPrivateFieldGet(_listeners,_this21));try{for(_iterator55.s();!(_step55=_iterator55.n()).done;)babelHelpers.slicedToArray(_step55.value,1)[0].call(_this21,event)}catch(err){_iterator55.e(err)}finally{_iterator55.f()}})}},{key:"addEventListener",value:function(name,listener){var _this22=this,options=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,rmAbort=null;if((null==options?void 0:options.signal)instanceof AbortSignal){var signal=options.signal;if(signal.aborted)return void warn("LoopbackPort - cannot use an `aborted` signal.");function onAbort(){return _this22.removeEventListener(name,listener)}rmAbort=function(){return signal.removeEventListener("abort",onAbort)};signal.addEventListener("abort",onAbort)}_classPrivateFieldGet(_listeners,this).set(listener,rmAbort)}},{key:"removeEventListener",value:function(name,listener){var rmAbort=_classPrivateFieldGet(_listeners,this).get(listener);null!=rmAbort&&rmAbort(),_classPrivateFieldGet(_listeners,this).delete(listener)}},{key:"terminate",value:function(){var _step56,_iterator56=_createForOfIteratorHelper(_classPrivateFieldGet(_listeners,this));try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var rmAbort=babelHelpers.slicedToArray(_step56.value,2)[1];null!=rmAbort&&rmAbort()}}catch(err){_iterator56.e(err)}finally{_iterator56.f()}_classPrivateFieldGet(_listeners,this).clear()}}])}(),CallbackKind={DATA:1,ERROR:2},StreamKind={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function onFn(){}function wrapReason(ex){if(ex instanceof AbortException||ex instanceof InvalidPDFException||ex instanceof PasswordException||ex instanceof ResponseException||ex instanceof UnknownErrorException)return ex;switch(ex instanceof Error||"object"==typeof ex&&null!==ex||unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),ex.name){case"AbortException":return new AbortException(ex.message);case"InvalidPDFException":return new InvalidPDFException(ex.message);case"PasswordException":return new PasswordException(ex.message,ex.code);case"ResponseException":return new ResponseException(ex.message,ex.status,ex.missing);case"UnknownErrorException":return new UnknownErrorException(ex.message,ex.details)}return new UnknownErrorException(ex.message,ex.toString())}var _messageAC=new WeakMap,_MessageHandler_brand=new WeakSet,MessageHandler=function(){return babelHelpers.createClass(function MessageHandler(_sourceName,_targetName,_comObj){babelHelpers.classCallCheck(this,MessageHandler),_classPrivateMethodInitSpec(this,_MessageHandler_brand),_classPrivateFieldInitSpec(this,_messageAC,new AbortController),this.sourceName=_sourceName,this.targetName=_targetName,this.comObj=_comObj,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),_comObj.addEventListener("message",_assertClassBrand(_MessageHandler_brand,this,_onMessage).bind(this),{signal:_classPrivateFieldGet(_messageAC,this).signal})},[{key:"on",value:function(actionName,handler){var ah=this.actionHandler;if(ah[actionName])throw new Error('There is already an actionName called "'.concat(actionName,'"'));ah[actionName]=handler}},{key:"send",value:function(actionName,data,transfers){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:actionName,data:data},transfers)}},{key:"sendWithPromise",value:function(actionName,data,transfers){var callbackId=this.callbackId++,capability=Promise.withResolvers();this.callbackCapabilities[callbackId]=capability;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:actionName,callbackId:callbackId,data:data},transfers)}catch(ex){capability.reject(ex)}return capability.promise}},{key:"sendWithStream",value:function(actionName,data,queueingStrategy,transfers){var _this23=this,streamId=this.streamId++,sourceName=this.sourceName,targetName=this.targetName,comObj=this.comObj;return new ReadableStream({start:function(controller){var startCapability=Promise.withResolvers();return _this23.streamControllers[streamId]={controller:controller,startCall:startCapability,pullCall:null,cancelCall:null,isClosed:!1},comObj.postMessage({sourceName:sourceName,targetName:targetName,action:actionName,streamId:streamId,data:data,desiredSize:controller.desiredSize},transfers),startCapability.promise},pull:function(controller){var pullCapability=Promise.withResolvers();return _this23.streamControllers[streamId].pullCall=pullCapability,comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.PULL,streamId:streamId,desiredSize:controller.desiredSize}),pullCapability.promise},cancel:function(reason){assert(reason instanceof Error,"cancel must have a valid reason");var cancelCapability=Promise.withResolvers();return _this23.streamControllers[streamId].cancelCall=cancelCapability,_this23.streamControllers[streamId].isClosed=!0,comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.CANCEL,streamId:streamId,reason:wrapReason(reason)}),cancelCapability.promise}},queueingStrategy)}},{key:"destroy",value:function(){var _classPrivateFieldGet52;null!=(_classPrivateFieldGet52=_classPrivateFieldGet(_messageAC,this))&&_classPrivateFieldGet52.abort(),_classPrivateFieldSet(_messageAC,this,null)}}])}();function _onMessage(_ref136){var data=_ref136.data;if(data.targetName===this.sourceName)if(data.stream)_assertClassBrand(_MessageHandler_brand,this,_processStreamMessage).call(this,data);else if(data.callback){var _ref136=data.callbackId,capability=this.callbackCapabilities[_ref136];if(!capability)throw new Error("Cannot resolve callback ".concat(_ref136));if(delete this.callbackCapabilities[_ref136],data.callback===CallbackKind.DATA)capability.resolve(data.data);else{if(data.callback!==CallbackKind.ERROR)throw new Error("Unexpected callback case");capability.reject(wrapReason(data.reason))}}else{var sourceName,targetName,comObj,_ref136=this.actionHandler[data.action];if(!_ref136)throw new Error("Unknown action from worker: ".concat(data.action));data.callbackId?(sourceName=this.sourceName,targetName=data.sourceName,comObj=this.comObj,Promise.try(_ref136,data.data).then(function(result){comObj.postMessage({sourceName:sourceName,targetName:targetName,callback:CallbackKind.DATA,callbackId:data.callbackId,data:result})},function(reason){comObj.postMessage({sourceName:sourceName,targetName:targetName,callback:CallbackKind.ERROR,callbackId:data.callbackId,reason:wrapReason(reason)})})):data.streamId?_assertClassBrand(_MessageHandler_brand,this,_createStreamSink).call(this,data):_ref136(data.data)}}function _createStreamSink(data){var streamId=data.streamId,sourceName=this.sourceName,targetName=data.sourceName,comObj=this.comObj,self=this,action=this.actionHandler[data.action],streamSink={enqueue:function(chunk){var lastDesiredSize,size=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,transfers=2<arguments.length?arguments[2]:void 0;this.isCancelled||(lastDesiredSize=this.desiredSize,this.desiredSize-=size,0<lastDesiredSize&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.ENQUEUE,streamId:streamId,chunk:chunk},transfers))},close:function(){this.isCancelled||(this.isCancelled=!0,comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.CLOSE,streamId:streamId}),delete self.streamSinks[streamId])},error:function(reason){assert(reason instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.ERROR,streamId:streamId,reason:wrapReason(reason)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:data.desiredSize,ready:null};streamSink.sinkCapability.resolve(),streamSink.ready=streamSink.sinkCapability.promise,this.streamSinks[streamId]=streamSink,Promise.try(action,data.data,streamSink).then(function(){comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.START_COMPLETE,streamId:streamId,success:!0})},function(reason){comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.START_COMPLETE,streamId:streamId,reason:wrapReason(reason)})})}function _processStreamMessage(data){var dataReason,streamId=data.streamId,sourceName=this.sourceName,targetName=data.sourceName,comObj=this.comObj,streamController=this.streamControllers[streamId],streamSink=this.streamSinks[streamId];switch(data.stream){case StreamKind.START_COMPLETE:data.success?streamController.startCall.resolve():streamController.startCall.reject(wrapReason(data.reason));break;case StreamKind.PULL_COMPLETE:data.success?streamController.pullCall.resolve():streamController.pullCall.reject(wrapReason(data.reason));break;case StreamKind.PULL:streamSink?(streamSink.desiredSize<=0&&0<data.desiredSize&&streamSink.sinkCapability.resolve(),streamSink.desiredSize=data.desiredSize,Promise.try(streamSink.onPull||onFn).then(function(){comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.PULL_COMPLETE,streamId:streamId,success:!0})},function(reason){comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.PULL_COMPLETE,streamId:streamId,reason:wrapReason(reason)})})):comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.PULL_COMPLETE,streamId:streamId,success:!0});break;case StreamKind.ENQUEUE:assert(streamController,"enqueue should have stream controller"),streamController.isClosed||streamController.controller.enqueue(data.chunk);break;case StreamKind.CLOSE:assert(streamController,"close should have stream controller"),streamController.isClosed||(streamController.isClosed=!0,streamController.controller.close(),_assertClassBrand(_MessageHandler_brand,this,_deleteStreamController).call(this,streamController,streamId));break;case StreamKind.ERROR:assert(streamController,"error should have stream controller"),streamController.controller.error(wrapReason(data.reason)),_assertClassBrand(_MessageHandler_brand,this,_deleteStreamController).call(this,streamController,streamId);break;case StreamKind.CANCEL_COMPLETE:data.success?streamController.cancelCall.resolve():streamController.cancelCall.reject(wrapReason(data.reason)),_assertClassBrand(_MessageHandler_brand,this,_deleteStreamController).call(this,streamController,streamId);break;case StreamKind.CANCEL:streamSink&&(dataReason=wrapReason(data.reason),Promise.try(streamSink.onCancel||onFn,dataReason).then(function(){comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.CANCEL_COMPLETE,streamId:streamId,success:!0})},function(reason){comObj.postMessage({sourceName:sourceName,targetName:targetName,stream:StreamKind.CANCEL_COMPLETE,streamId:streamId,reason:wrapReason(reason)})}),streamSink.sinkCapability.reject(dataReason),streamSink.isCancelled=!0,delete this.streamSinks[streamId]);break;default:throw new Error("Unexpected stream case")}}async function _deleteStreamController(streamController,streamId){var _streamController$sta;await Promise.allSettled([null==(_streamController$sta=streamController.startCall)?void 0:_streamController$sta.promise,null==(_streamController$sta=streamController.pullCall)?void 0:_streamController$sta.promise,null==(_streamController$sta=streamController.cancelCall)?void 0:_streamController$sta.promise]),delete this.streamControllers[streamId]}var _enableHWA=new WeakMap,BaseCanvasFactory=function(){return babelHelpers.createClass(function BaseCanvasFactory(_ref18){_ref18=_ref18.enableHWA,_ref18=void 0!==_ref18&&_ref18;babelHelpers.classCallCheck(this,BaseCanvasFactory),_classPrivateFieldInitSpec(this,_enableHWA,!1),_classPrivateFieldSet(_enableHWA,this,_ref18)},[{key:"create",value:function(width,height){if(width<=0||height<=0)throw new Error("Invalid canvas size");width=this._createCanvas(width,height);return{canvas:width,context:width.getContext("2d",{willReadFrequently:!_classPrivateFieldGet(_enableHWA,this)})}}},{key:"reset",value:function(canvasAndContext,width,height){if(!canvasAndContext.canvas)throw new Error("Canvas is not specified");if(width<=0||height<=0)throw new Error("Invalid canvas size");canvasAndContext.canvas.width=width,canvasAndContext.canvas.height=height}},{key:"destroy",value:function(canvasAndContext){if(!canvasAndContext.canvas)throw new Error("Canvas is not specified");canvasAndContext.canvas.width=0,canvasAndContext.canvas.height=0,canvasAndContext.canvas=null,canvasAndContext.context=null}},{key:"_createCanvas",value:function(width,height){unreachable("Abstract method `_createCanvas` called.")}}])}(),DOMCanvasFactory=function(){function DOMCanvasFactory(_ref19){var _ref19$ownerDocument=_ref19.ownerDocument,_ref19$ownerDocument=void 0===_ref19$ownerDocument?globalThis.document:_ref19$ownerDocument,_ref19=_ref19.enableHWA,_ref19=void 0!==_ref19&&_ref19;return babelHelpers.classCallCheck(this,DOMCanvasFactory),(_ref19=_callSuper(this,DOMCanvasFactory,[{enableHWA:_ref19}]))._document=_ref19$ownerDocument,_ref19}return babelHelpers.inherits(DOMCanvasFactory,BaseCanvasFactory),babelHelpers.createClass(DOMCanvasFactory,[{key:"_createCanvas",value:function(width,height){var canvas=this._document.createElement("canvas");return canvas.width=width,canvas.height=height,canvas}}])}(),BaseCMapReaderFactory=function(){return babelHelpers.createClass(function BaseCMapReaderFactory(_ref20){var _ref20$baseUrl=_ref20.baseUrl,_ref20$baseUrl=void 0===_ref20$baseUrl?null:_ref20$baseUrl,_ref20=_ref20.isCompressed,_ref20=void 0===_ref20||_ref20;babelHelpers.classCallCheck(this,BaseCMapReaderFactory),this.baseUrl=_ref20$baseUrl,this.isCompressed=_ref20},[{key:"fetch",value:async function(_ref21){var url,_this25=this,_ref21=_ref21.name;if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(_ref21)return url=this.baseUrl+_ref21+(this.isCompressed?".bcmap":""),this._fetch(url).then(function(cMapData){return{cMapData:cMapData,isCompressed:_this25.isCompressed}}).catch(function(reason){throw new Error("Unable to load ".concat(_this25.isCompressed?"binary ":"","CMap at: ").concat(url))});throw new Error("CMap name must be specified.")}},{key:"_fetch",value:async function(url){unreachable("Abstract method `_fetch` called.")}}])}(),DOMCMapReaderFactory=function(){function DOMCMapReaderFactory(){return babelHelpers.classCallCheck(this,DOMCMapReaderFactory),_callSuper(this,DOMCMapReaderFactory,arguments)}return babelHelpers.inherits(DOMCMapReaderFactory,BaseCMapReaderFactory),babelHelpers.createClass(DOMCMapReaderFactory,[{key:"_fetch",value:async function(url){url=await fetchData(url,this.isCompressed?"arraybuffer":"text");return url instanceof ArrayBuffer?new Uint8Array(url):stringToBytes(url)}}])}(),BaseFilterFactory=function(){return babelHelpers.createClass(function BaseFilterFactory(){babelHelpers.classCallCheck(this,BaseFilterFactory)},[{key:"addFilter",value:function(maps){return"none"}},{key:"addHCMFilter",value:function(fgColor,bgColor){return"none"}},{key:"addAlphaFilter",value:function(map){return"none"}},{key:"addLuminosityFilter",value:function(map){return"none"}},{key:"addHighlightHCMFilter",value:function(filterName,fgColor,bgColor,newFgColor,newBgColor){return"none"}},{key:"destroy",value:function(){}}])}(),_baseUrl=new WeakMap,_cache2=new WeakMap,_defs=new WeakMap,_docId=new WeakMap,_document2=new WeakMap,_hcmCache=new WeakMap,_id3=new WeakMap,_DOMFilterFactory_brand=new WeakSet,DOMFilterFactory=function(){function DOMFilterFactory(_ref22){var _this29,docId=_ref22.docId,_ref22=_ref22.ownerDocument,_ref22=void 0===_ref22?globalThis.document:_ref22;return babelHelpers.classCallCheck(this,DOMFilterFactory),_classPrivateMethodInitSpec(_this29=_callSuper(this,DOMFilterFactory),_DOMFilterFactory_brand),_classPrivateFieldInitSpec(_this29,_baseUrl,void 0),_classPrivateFieldInitSpec(_this29,_cache2,void 0),_classPrivateFieldInitSpec(_this29,_defs,void 0),_classPrivateFieldInitSpec(_this29,_docId,void 0),_classPrivateFieldInitSpec(_this29,_document2,void 0),_classPrivateFieldInitSpec(_this29,_hcmCache,void 0),_classPrivateFieldInitSpec(_this29,_id3,0),_classPrivateFieldSet(_docId,_this29,docId),_classPrivateFieldSet(_document2,_this29,_ref22),_this29}return babelHelpers.inherits(DOMFilterFactory,BaseFilterFactory),babelHelpers.createClass(DOMFilterFactory,[{key:"addFilter",value:function(maps){var tableR,tableG,_assertClassBrand$cal3,key,value,_this$id8;return maps?(value=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).get(maps))||(_assertClassBrand$cal3=_assertClassBrand(_DOMFilterFactory_brand,this,_createTables).call(this,maps),tableR=(_assertClassBrand$cal3=babelHelpers.slicedToArray(_assertClassBrand$cal3,3))[0],tableG=_assertClassBrand$cal3[1],_assertClassBrand$cal3=_assertClassBrand$cal3[2],key=1===maps.length?tableR:"".concat(tableR).concat(tableG).concat(_assertClassBrand$cal3),(value=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).get(key))?(_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(maps,value),value):(value="g_".concat(_classPrivateFieldGet(_docId,this),"_transfer_map_").concat((_classPrivateFieldSet(_id3,this,(value=_classPrivateFieldGet(_id3,this),_this$id8=value++,value)),_this$id8)),_this$id8=_assertClassBrand(_DOMFilterFactory_brand,this,_createUrl).call(this,value),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(maps,_this$id8),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(key,_this$id8),maps=_assertClassBrand(_DOMFilterFactory_brand,this,_createFilter).call(this,value),_assertClassBrand(_DOMFilterFactory_brand,this,_addTransferMapConversion).call(this,tableR,tableG,_assertClassBrand$cal3,maps),_this$id8)):"none"}},{key:"addHCMFilter",value:function(fgColor,bgColor){var key="".concat(fgColor,"-").concat(bgColor),info=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_hcmCache).get("base");if((null==info?void 0:info.key)!==key&&(info?(null!=(_info$filter=info.filter)&&_info$filter.remove(),info.key=key,info.url="none",info.filter=null):(info={key:key,url:"none",filter:null},_classPrivateGetter(_DOMFilterFactory_brand,this,_get_hcmCache).set("base",info)),fgColor&&bgColor)){var fgRGB=_assertClassBrand(_DOMFilterFactory_brand,this,_getRGB).call(this,fgColor),bgRGB=(fgColor=Util.makeHexColor.apply(Util,babelHelpers.toConsumableArray(fgRGB)),_assertClassBrand(_DOMFilterFactory_brand,this,_getRGB).call(this,bgColor));if(bgColor=Util.makeHexColor.apply(Util,babelHelpers.toConsumableArray(bgRGB)),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_defs).style.color="",("#000000"!==fgColor||"#ffffff"!==bgColor)&&fgColor!==bgColor){for(var map=new Array(256),i=0;i<=255;i++){var x=i/255;map[i]=x<=.03928?x/12.92:Math.pow((.055+x)/1.055,2.4)}function getSteps(c,n){for(var start=fgRGB[c]/255,end=bgRGB[c]/255,arr=new Array(n+1),_i0=0;_i0<=n;_i0++)arr[_i0]=start+_i0/n*(end-start);return arr.join(",")}var _info$filter=map.join(","),key="g_".concat(_classPrivateFieldGet(_docId,this),"_hcm_filter"),fgColor=info.filter=_assertClassBrand(_DOMFilterFactory_brand,this,_createFilter).call(this,key);_assertClassBrand(_DOMFilterFactory_brand,this,_addTransferMapConversion).call(this,_info$filter,_info$filter,_info$filter,fgColor),_assertClassBrand(_DOMFilterFactory_brand,this,_addGrayConversion).call(this,fgColor);_assertClassBrand(_DOMFilterFactory_brand,this,_addTransferMapConversion).call(this,getSteps(0,5),getSteps(1,5),getSteps(2,5),fgColor),info.url=_assertClassBrand(_DOMFilterFactory_brand,this,_createUrl).call(this,key)}}return info.url}},{key:"addAlphaFilter",value:function(map){var _assertClassBrand$cal5,key,_this$id0,value=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).get(map);return value||(_assertClassBrand$cal5=_assertClassBrand(_DOMFilterFactory_brand,this,_createTables).call(this,[map]),_assertClassBrand$cal5=babelHelpers.slicedToArray(_assertClassBrand$cal5,1)[0],key="alpha_".concat(_assertClassBrand$cal5),(value=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).get(key))?(_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(map,value),value):(value="g_".concat(_classPrivateFieldGet(_docId,this),"_alpha_map_").concat((_classPrivateFieldSet(_id3,this,(value=_classPrivateFieldGet(_id3,this),_this$id0=value++,value)),_this$id0)),_this$id0=_assertClassBrand(_DOMFilterFactory_brand,this,_createUrl).call(this,value),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(map,_this$id0),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(key,_this$id0),map=_assertClassBrand(_DOMFilterFactory_brand,this,_createFilter).call(this,value),_assertClassBrand(_DOMFilterFactory_brand,this,_addTransferMapAlphaConversion).call(this,_assertClassBrand$cal5,map),_this$id0))}},{key:"addLuminosityFilter",value:function(map){var _assertClassBrand$cal7,_this$id10,key,value=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).get(map||"luminosity");return value||(key=map?(_assertClassBrand$cal7=_assertClassBrand(_DOMFilterFactory_brand,this,_createTables).call(this,[map]),_assertClassBrand$cal7=babelHelpers.slicedToArray(_assertClassBrand$cal7,1)[0],"luminosity_".concat(_assertClassBrand$cal7)):"luminosity",(value=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).get(key))?(_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(map,value),value):(value="g_".concat(_classPrivateFieldGet(_docId,this),"_luminosity_map_").concat((_classPrivateFieldSet(_id3,this,(value=_classPrivateFieldGet(_id3,this),_this$id10=value++,value)),_this$id10)),_this$id10=_assertClassBrand(_DOMFilterFactory_brand,this,_createUrl).call(this,value),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(map,_this$id10),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_cache).set(key,_this$id10),key=_assertClassBrand(_DOMFilterFactory_brand,this,_createFilter).call(this,value),_assertClassBrand(_DOMFilterFactory_brand,this,_addLuminosityConversion).call(this,key),map&&_assertClassBrand(_DOMFilterFactory_brand,this,_addTransferMapAlphaConversion).call(this,_assertClassBrand$cal7,key),_this$id10))}},{key:"addHighlightHCMFilter",value:function(filterName,fgColor,bgColor,newFgColor,newBgColor){var fgGray,bgGray,_info$filter2,key="".concat(fgColor,"-").concat(bgColor,"-").concat(newFgColor,"-").concat(newBgColor),info=_classPrivateGetter(_DOMFilterFactory_brand,this,_get_hcmCache).get(filterName);return(null==info?void 0:info.key)!==key&&(info?(null!=(_info$filter2=info.filter)&&_info$filter2.remove(),info.key=key,info.url="none",info.filter=null):(info={key:key,url:"none",filter:null},_classPrivateGetter(_DOMFilterFactory_brand,this,_get_hcmCache).set(filterName,info)),fgColor&&bgColor)&&(_info$filter2=[fgColor,bgColor].map(_assertClassBrand(_DOMFilterFactory_brand,this,_getRGB).bind(this)),fgColor=(key=babelHelpers.slicedToArray(_info$filter2,2))[0],bgColor=key[1],fgGray=Math.round(.2126*fgColor[0]+.7152*fgColor[1]+.0722*fgColor[2]),bgGray=Math.round(.2126*bgColor[0]+.7152*bgColor[1]+.0722*bgColor[2]),_info$filter2=[newFgColor,newBgColor].map(_assertClassBrand(_DOMFilterFactory_brand,this,_getRGB).bind(this)),fgColor=(key=babelHelpers.slicedToArray(_info$filter2,2))[0],bgColor=key[1],bgGray<fgGray&&(fgGray=(newFgColor=[bgGray,fgGray,bgColor,fgColor])[0],bgGray=newFgColor[1],fgColor=newFgColor[2],bgColor=newFgColor[3]),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_defs).style.color="",newBgColor=function(fg,bg,n){for(var arr=new Array(256),step=(bgGray-fgGray)/n,newStart=fg/255,newStep=(bg-fg)/(255*n),prev=0,i=0;i<=n;i++){for(var k=Math.round(fgGray+i*step),value=newStart+i*newStep,j=prev;j<=k;j++)arr[j]=value;prev=k+1}for(var _i1=prev;_i1<256;_i1++)arr[_i1]=arr[prev-1];return arr.join(",")},_info$filter2="g_".concat(_classPrivateFieldGet(_docId,this),"_hcm_").concat(filterName,"_filter"),key=info.filter=_assertClassBrand(_DOMFilterFactory_brand,this,_createFilter).call(this,_info$filter2),_assertClassBrand(_DOMFilterFactory_brand,this,_addGrayConversion).call(this,key),_assertClassBrand(_DOMFilterFactory_brand,this,_addTransferMapConversion).call(this,newBgColor(fgColor[0],bgColor[0],5),newBgColor(fgColor[1],bgColor[1],5),newBgColor(fgColor[2],bgColor[2],5),key),info.url=_assertClassBrand(_DOMFilterFactory_brand,this,_createUrl).call(this,_info$filter2)),info.url}},{key:"destroy",value:function(){var _classPrivateFieldGet53;0<arguments.length&&void 0!==arguments[0]&&arguments[0]&&null!=(_classPrivateFieldGet53=_classPrivateFieldGet(_hcmCache,this))&&_classPrivateFieldGet53.size||(null!=(_classPrivateFieldGet53=_classPrivateFieldGet(_defs,this))&&_classPrivateFieldGet53.parentNode.parentNode.remove(),_classPrivateFieldSet(_defs,this,null),null!=(_classPrivateFieldGet53=_classPrivateFieldGet(_cache2,this))&&_classPrivateFieldGet53.clear(),_classPrivateFieldSet(_cache2,this,null),null!=(_classPrivateFieldGet53=_classPrivateFieldGet(_hcmCache,this))&&_classPrivateFieldGet53.clear(),_classPrivateFieldSet(_hcmCache,this,null),_classPrivateFieldSet(_id3,this,0))}}])}();function _get_cache(_this26){return _classPrivateFieldGet(_cache2,_this26)||_classPrivateFieldSet(_cache2,_this26,new Map)}function _get_hcmCache(_this27){return _classPrivateFieldGet(_hcmCache,_this27)||_classPrivateFieldSet(_hcmCache,_this27,new Map)}function _get_defs(_this28){var div,style;return _classPrivateFieldGet(_defs,_this28)||((style=(div=_classPrivateFieldGet(_document2,_this28).createElement("div")).style).visibility="hidden",style.contain="strict",style.width=style.height=0,style.position="absolute",style.top=style.left=0,style.zIndex=-1,(style=_classPrivateFieldGet(_document2,_this28).createElementNS(SVG_NS,"svg")).setAttribute("width",0),style.setAttribute("height",0),_classPrivateFieldSet(_defs,_this28,_classPrivateFieldGet(_document2,_this28).createElementNS(SVG_NS,"defs")),div.append(style),style.append(_classPrivateFieldGet(_defs,_this28)),_classPrivateFieldGet(_document2,_this28).body.append(div)),_classPrivateFieldGet(_defs,_this28)}function _createTables(maps){if(1===maps.length){for(var _mapR=maps[0],buffer=new Array(256),i=0;i<256;i++)buffer[i]=_mapR[i]/255;var table=buffer.join(",");return[table,table,table]}for(var table=babelHelpers.slicedToArray(maps,3),mapR=table[0],mapG=table[1],mapB=table[2],bufferR=new Array(256),bufferG=new Array(256),bufferB=new Array(256),_i31=0;_i31<256;_i31++)bufferR[_i31]=mapR[_i31]/255,bufferG[_i31]=mapG[_i31]/255,bufferB[_i31]=mapB[_i31]/255;return[bufferR.join(","),bufferG.join(","),bufferB.join(",")]}function _createUrl(id){var url;return void 0===_classPrivateFieldGet(_baseUrl,this)&&(_classPrivateFieldSet(_baseUrl,this,""),(url=_classPrivateFieldGet(_document2,this).URL)!==_classPrivateFieldGet(_document2,this).baseURI)&&(isDataScheme(url)?warn('#createUrl: ignore "data:"-URL for performance reasons.'):_classPrivateFieldSet(_baseUrl,this,updateUrlHash(url,""))),"url(".concat(_classPrivateFieldGet(_baseUrl,this),"#").concat(id,")")}function _addLuminosityConversion(filter){var feColorMatrix=_classPrivateFieldGet(_document2,this).createElementNS(SVG_NS,"feColorMatrix");feColorMatrix.setAttribute("type","matrix"),feColorMatrix.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"),filter.append(feColorMatrix)}function _addGrayConversion(filter){var feColorMatrix=_classPrivateFieldGet(_document2,this).createElementNS(SVG_NS,"feColorMatrix");feColorMatrix.setAttribute("type","matrix"),feColorMatrix.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"),filter.append(feColorMatrix)}function _createFilter(id){var filter=_classPrivateFieldGet(_document2,this).createElementNS(SVG_NS,"filter");return filter.setAttribute("color-interpolation-filters","sRGB"),filter.setAttribute("id",id),_classPrivateGetter(_DOMFilterFactory_brand,this,_get_defs).append(filter),filter}function _appendFeFunc(feComponentTransfer,func,table){func=_classPrivateFieldGet(_document2,this).createElementNS(SVG_NS,func);func.setAttribute("type","discrete"),func.setAttribute("tableValues",table),feComponentTransfer.append(func)}function _addTransferMapConversion(rTable,gTable,bTable,filter){var feComponentTransfer=_classPrivateFieldGet(_document2,this).createElementNS(SVG_NS,"feComponentTransfer");filter.append(feComponentTransfer),_assertClassBrand(_DOMFilterFactory_brand,this,_appendFeFunc).call(this,feComponentTransfer,"feFuncR",rTable),_assertClassBrand(_DOMFilterFactory_brand,this,_appendFeFunc).call(this,feComponentTransfer,"feFuncG",gTable),_assertClassBrand(_DOMFilterFactory_brand,this,_appendFeFunc).call(this,feComponentTransfer,"feFuncB",bTable)}function _addTransferMapAlphaConversion(aTable,filter){var feComponentTransfer=_classPrivateFieldGet(_document2,this).createElementNS(SVG_NS,"feComponentTransfer");filter.append(feComponentTransfer),_assertClassBrand(_DOMFilterFactory_brand,this,_appendFeFunc).call(this,feComponentTransfer,"feFuncA",aTable)}function _getRGB(color){return _classPrivateGetter(_DOMFilterFactory_brand,this,_get_defs).style.color=color,getRGB(getComputedStyle(_classPrivateGetter(_DOMFilterFactory_brand,this,_get_defs)).getPropertyValue("color"))}var BaseStandardFontDataFactory=function(){return babelHelpers.createClass(function BaseStandardFontDataFactory(_ref24){_ref24=_ref24.baseUrl,_ref24=void 0===_ref24?null:_ref24;babelHelpers.classCallCheck(this,BaseStandardFontDataFactory),this.baseUrl=_ref24},[{key:"fetch",value:async function(_ref25){var url,_ref25=_ref25.filename;if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(_ref25)return url="".concat(this.baseUrl).concat(_ref25),this._fetch(url).catch(function(reason){throw new Error("Unable to load font data at: ".concat(url))});throw new Error("Font filename must be specified.")}},{key:"_fetch",value:async function(url){unreachable("Abstract method `_fetch` called.")}}])}(),DOMStandardFontDataFactory=function(){function DOMStandardFontDataFactory(){return babelHelpers.classCallCheck(this,DOMStandardFontDataFactory),_callSuper(this,DOMStandardFontDataFactory,arguments)}return babelHelpers.inherits(DOMStandardFontDataFactory,BaseStandardFontDataFactory),babelHelpers.createClass(DOMStandardFontDataFactory,[{key:"_fetch",value:async function(url){url=await fetchData(url,"arraybuffer");return new Uint8Array(url)}}])}(),BaseWasmFactory=function(){return babelHelpers.createClass(function BaseWasmFactory(_ref26){_ref26=_ref26.baseUrl,_ref26=void 0===_ref26?null:_ref26;babelHelpers.classCallCheck(this,BaseWasmFactory),this.baseUrl=_ref26},[{key:"fetch",value:async function(_ref27){var url,_ref27=_ref27.filename;if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(_ref27)return url="".concat(this.baseUrl).concat(_ref27),this._fetch(url).catch(function(reason){throw new Error("Unable to load wasm data at: ".concat(url))});throw new Error("Wasm filename must be specified.")}},{key:"_fetch",value:async function(url){unreachable("Abstract method `_fetch` called.")}}])}(),DOMWasmFactory=function(){function DOMWasmFactory(){return babelHelpers.classCallCheck(this,DOMWasmFactory),_callSuper(this,DOMWasmFactory,arguments)}return babelHelpers.inherits(DOMWasmFactory,BaseWasmFactory),babelHelpers.createClass(DOMWasmFactory,[{key:"_fetch",value:async function(url){url=await fetchData(url,"arraybuffer");return new Uint8Array(url)}}])}();async function node_utils_fetchData(url){url=await process.getBuiltinModule("fs").promises.readFile(url);return new Uint8Array(url)}isNodeJS&&warn("Please use the `legacy` build in Node.js environments.");var NodeFilterFactory=function(){function NodeFilterFactory(){return babelHelpers.classCallCheck(this,NodeFilterFactory),_callSuper(this,NodeFilterFactory,arguments)}return babelHelpers.inherits(NodeFilterFactory,BaseFilterFactory),babelHelpers.createClass(NodeFilterFactory)}(),NodeCanvasFactory=function(){function NodeCanvasFactory(){return babelHelpers.classCallCheck(this,NodeCanvasFactory),_callSuper(this,NodeCanvasFactory,arguments)}return babelHelpers.inherits(NodeCanvasFactory,BaseCanvasFactory),babelHelpers.createClass(NodeCanvasFactory,[{key:"_createCanvas",value:function(width,height){return process.getBuiltinModule("module").createRequire(import1.meta.url)("@napi-rs/canvas").createCanvas(width,height)}}])}(),NodeCMapReaderFactory=function(){function NodeCMapReaderFactory(){return babelHelpers.classCallCheck(this,NodeCMapReaderFactory),_callSuper(this,NodeCMapReaderFactory,arguments)}return babelHelpers.inherits(NodeCMapReaderFactory,BaseCMapReaderFactory),babelHelpers.createClass(NodeCMapReaderFactory,[{key:"_fetch",value:async function(url){return node_utils_fetchData(url)}}])}(),NodeStandardFontDataFactory=function(){function NodeStandardFontDataFactory(){return babelHelpers.classCallCheck(this,NodeStandardFontDataFactory),_callSuper(this,NodeStandardFontDataFactory,arguments)}return babelHelpers.inherits(NodeStandardFontDataFactory,BaseStandardFontDataFactory),babelHelpers.createClass(NodeStandardFontDataFactory,[{key:"_fetch",value:async function(url){return node_utils_fetchData(url)}}])}(),NodeWasmFactory=function(){function NodeWasmFactory(){return babelHelpers.classCallCheck(this,NodeWasmFactory),_callSuper(this,NodeWasmFactory,arguments)}return babelHelpers.inherits(NodeWasmFactory,BaseWasmFactory),babelHelpers.createClass(NodeWasmFactory,[{key:"_fetch",value:async function(url){return node_utils_fetchData(url)}}])}(),PathType_FILL="Fill",PathType_STROKE="Stroke",PathType_SHADING="Shading";function applyBoundingBox(ctx,bbox){var width,height,region;bbox&&(width=bbox[2]-bbox[0],height=bbox[3]-bbox[1],(region=new Path2D).rect(bbox[0],bbox[1],width,height),ctx.clip(region))}var BaseShadingPattern=function(){return babelHelpers.createClass(function BaseShadingPattern(){babelHelpers.classCallCheck(this,BaseShadingPattern)},[{key:"isModifyingCurrentTransform",value:function(){return!1}},{key:"getPattern",value:function(){unreachable("Abstract method `getPattern` called.")}}])}(),RadialAxialShadingPattern=function(){function RadialAxialShadingPattern(IR){var _this30;return babelHelpers.classCallCheck(this,RadialAxialShadingPattern),(_this30=_callSuper(this,RadialAxialShadingPattern))._type=IR[1],_this30._bbox=IR[2],_this30._colorStops=IR[3],_this30._p0=IR[4],_this30._p1=IR[5],_this30._r0=IR[6],_this30._r1=IR[7],_this30.matrix=null,_this30}return babelHelpers.inherits(RadialAxialShadingPattern,BaseShadingPattern),babelHelpers.createClass(RadialAxialShadingPattern,[{key:"_createGradient",value:function(ctx){"axial"===this._type?grad=ctx.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(grad=ctx.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));var grad,_step57,_iterator57=_createForOfIteratorHelper(this._colorStops);try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var colorStop=_step57.value;grad.addColorStop(colorStop[0],colorStop[1])}}catch(err){_iterator57.e(err)}finally{_iterator57.f()}return grad}},{key:"getPattern",value:function(ctx,owner,inverse,pathType){var width,height;return pathType===PathType_STROKE||pathType===PathType_FILL?(pathType=owner.current.getClippedPathBoundingBox(pathType,getCurrentTransform(ctx))||[0,0,0,0],width=Math.ceil(pathType[2]-pathType[0])||1,height=Math.ceil(pathType[3]-pathType[1])||1,(height=(width=owner.cachedCanvases.getCanvas("pattern",width,height)).context).clearRect(0,0,height.canvas.width,height.canvas.height),height.beginPath(),height.rect(0,0,height.canvas.width,height.canvas.height),height.translate(-pathType[0],-pathType[1]),inverse=Util.transform(inverse,[1,0,0,1,pathType[0],pathType[1]]),height.transform.apply(height,babelHelpers.toConsumableArray(owner.baseTransform)),this.matrix&&height.transform.apply(height,babelHelpers.toConsumableArray(this.matrix)),applyBoundingBox(height,this._bbox),height.fillStyle=this._createGradient(height),height.fill(),height=ctx.createPattern(width.canvas,"no-repeat"),pathType=new DOMMatrix(inverse),height.setTransform(pathType)):(applyBoundingBox(ctx,this._bbox),height=this._createGradient(ctx)),height}}])}();function drawTriangle(data,context,p1,p2,p3,c1,c2,c3){var tmp,coords=context.coords,colors=context.colors,bytes=data.data,rowSize=4*data.width,x1=(coords[p1+1]>coords[p2+1]&&(tmp=p1,p1=p2,p2=tmp,tmp=c1,c1=c2,c2=tmp),coords[p2+1]>coords[p3+1]&&(tmp=p2,p2=p3,p3=tmp,tmp=c2,c2=c3,c3=tmp),coords[p1+1]>coords[p2+1]&&(tmp=p1,p1=p2,p2=tmp,tmp=c1,c1=c2,c2=tmp),(coords[p1]+context.offsetX)*context.scaleX),y1=(coords[p1+1]+context.offsetY)*context.scaleY,x2=(coords[p2]+context.offsetX)*context.scaleX,y2=(coords[p2+1]+context.offsetY)*context.scaleY,x3=(coords[p3]+context.offsetX)*context.scaleX,y3=(coords[p3+1]+context.offsetY)*context.scaleY;if(!(y3<=y1))for(var c1r=colors[c1],c1g=colors[c1+1],c1b=colors[c1+2],c2r=colors[c2],c2g=colors[c2+1],c2b=colors[c2+2],c3r=colors[c3],c3g=colors[c3+1],c3b=colors[c3+2],data=Math.round(y1),maxY=Math.round(y3),y=data;y<=maxY;y++){cab=y<y2?(xa=x1-(x1-x2)*(_k=y<y1?0:(y1-y)/(y1-y2)),car=c1r-(c1r-c2r)*_k,cag=c1g-(c1g-c2g)*_k,c1b-(c1b-c2b)*_k):(_k=void 0,xa=x2-(x2-x3)*(_k=y3<y?1:y2==y3?0:(y2-y)/(y2-y3)),car=c2r-(c2r-c3r)*_k,cag=c2g-(c2g-c3g)*_k,c2b-(c2b-c3b)*_k);for(var xa,car,cag,cab,_k,k=void 0,xb=x1-(x1-x3)*(k=y<y1?0:y3<y?1:(y1-y)/(y1-y3)),cbr=c1r-(c1r-c3r)*k,cbg=c1g-(c1g-c3g)*k,cbb=c1b-(c1b-c3b)*k,x1_=Math.round(Math.min(xa,xb)),x2_=Math.round(Math.max(xa,xb)),j=rowSize*y+4*x1_,x=x1_;x<=x2_;x++)(k=(xa-x)/(xa-xb))<0?k=0:1<k&&(k=1),bytes[j++]=car-(car-cbr)*k|0,bytes[j++]=cag-(cag-cbg)*k|0,bytes[j++]=cab-(cab-cbb)*k|0,bytes[j++]=255}}var MeshShadingPattern=function(){function MeshShadingPattern(IR){var _this31;return babelHelpers.classCallCheck(this,MeshShadingPattern),(_this31=_callSuper(this,MeshShadingPattern))._coords=IR[2],_this31._colors=IR[3],_this31._figures=IR[4],_this31._bounds=IR[5],_this31._bbox=IR[6],_this31._background=IR[7],_this31.matrix=null,_this31}return babelHelpers.inherits(MeshShadingPattern,BaseShadingPattern),babelHelpers.createClass(MeshShadingPattern,[{key:"_createMeshCanvas",value:function(combinedScale,backgroundColor,cachedCanvases){var offsetX=Math.floor(this._bounds[0]),offsetY=Math.floor(this._bounds[1]),boundsWidth=Math.ceil(this._bounds[2])-offsetX,boundsHeight=Math.ceil(this._bounds[3])-offsetY,width=Math.min(Math.ceil(Math.abs(boundsWidth*combinedScale[0]*1.1)),3e3),combinedScale=Math.min(Math.ceil(Math.abs(boundsHeight*combinedScale[1]*1.1)),3e3),boundsWidth=boundsWidth/width,boundsHeight=boundsHeight/combinedScale,context={coords:this._coords,colors:this._colors,offsetX:-offsetX,offsetY:-offsetY,scaleX:1/boundsWidth,scaleY:1/boundsHeight},cachedCanvases=cachedCanvases.getCanvas("mesh",width+4,combinedScale+4),tmpCtx=cachedCanvases.context,data=tmpCtx.createImageData(width,combinedScale);if(backgroundColor)for(var bytes=data.data,i=0,ii=bytes.length;i<ii;i+=4)bytes[i]=backgroundColor[0],bytes[i+1]=backgroundColor[1],bytes[i+2]=backgroundColor[2],bytes[i+3]=255;var _step58,_iterator58=_createForOfIteratorHelper(this._figures);try{for(_iterator58.s();!(_step58=_iterator58.n()).done;)!function(data,figure,context){var ii,ps=figure.coords,cs=figure.colors;switch(figure.type){case"lattice":for(var verticesPerRow=figure.verticesPerRow,rows=Math.floor(ps.length/verticesPerRow)-1,cols=verticesPerRow-1,i=0;i<rows;i++)for(var q=i*verticesPerRow,j=0;j<cols;j++,q++)drawTriangle(data,context,ps[q],ps[q+1],ps[q+verticesPerRow],cs[q],cs[q+1],cs[q+verticesPerRow]),drawTriangle(data,context,ps[q+verticesPerRow+1],ps[q+1],ps[q+verticesPerRow],cs[q+verticesPerRow+1],cs[q+1],cs[q+verticesPerRow]);break;case"triangles":for(i=0,ii=ps.length;i<ii;i+=3)drawTriangle(data,context,ps[i],ps[i+1],ps[i+2],cs[i],cs[i+1],cs[i+2]);break;default:throw new Error("illegal figure")}}(data,_step58.value,context)}catch(err){_iterator58.e(err)}finally{_iterator58.f()}return tmpCtx.putImageData(data,2,2),{canvas:cachedCanvases.canvas,offsetX:offsetX-2*boundsWidth,offsetY:offsetY-2*boundsHeight,scaleX:boundsWidth,scaleY:boundsHeight}}},{key:"isModifyingCurrentTransform",value:function(){return!0}},{key:"getPattern",value:function(ctx,owner,inverse,pathType){applyBoundingBox(ctx,this._bbox);var _scale,scale=new Float32Array(2),matrixScaleX=(pathType===PathType_SHADING?Util.singularValueDecompose2dScale(getCurrentTransform(ctx),scale):this.matrix?(Util.singularValueDecompose2dScale(this.matrix,scale),matrixScaleX=(_scale=babelHelpers.slicedToArray(scale,2))[0],_scale=_scale[1],Util.singularValueDecompose2dScale(owner.baseTransform,scale),scale[0]*=matrixScaleX,scale[1]*=_scale):Util.singularValueDecompose2dScale(owner.baseTransform,scale),this._createMeshCanvas(scale,pathType===PathType_SHADING?null:this._background,owner.cachedCanvases));return pathType!==PathType_SHADING&&(ctx.setTransform.apply(ctx,babelHelpers.toConsumableArray(owner.baseTransform)),this.matrix)&&ctx.transform.apply(ctx,babelHelpers.toConsumableArray(this.matrix)),ctx.translate(matrixScaleX.offsetX,matrixScaleX.offsetY),ctx.scale(matrixScaleX.scaleX,matrixScaleX.scaleY),ctx.createPattern(matrixScaleX.canvas,"no-repeat")}}])}(),DummyShadingPattern=function(){function DummyShadingPattern(){return babelHelpers.classCallCheck(this,DummyShadingPattern),_callSuper(this,DummyShadingPattern,arguments)}return babelHelpers.inherits(DummyShadingPattern,BaseShadingPattern),babelHelpers.createClass(DummyShadingPattern,[{key:"getPattern",value:function(){return"hotpink"}}])}();var PaintType_COLORED=1,PaintType_UNCOLORED=2,TilingPattern=function(){function TilingPattern(IR,ctx,canvasGraphicsFactory,baseTransform){babelHelpers.classCallCheck(this,TilingPattern),this.color=IR[1],this.operatorList=IR[2],this.matrix=IR[3],this.bbox=IR[4],this.xstep=IR[5],this.ystep=IR[6],this.paintType=IR[7],this.tilingType=IR[8],this.ctx=ctx,this.canvasGraphicsFactory=canvasGraphicsFactory,this.baseTransform=baseTransform}return babelHelpers.createClass(TilingPattern,[{key:"createPatternCanvas",value:function(owner){var bbox=this.bbox,operatorList=this.operatorList,paintType=this.paintType,tilingType=this.tilingType,color=this.color,canvasGraphicsFactory=this.canvasGraphicsFactory,xstep=this.xstep,ystep=this.ystep,xstep=Math.abs(xstep),ystep=Math.abs(ystep),tilingType=(info("TilingType: "+tilingType),bbox[0]),y0=bbox[1],x1=bbox[2],bbox=bbox[3],width=x1-tilingType,height=bbox-y0,scale=new Float32Array(2),_scale2=(Util.singularValueDecompose2dScale(this.matrix,scale),babelHelpers.slicedToArray(scale,2)),matrixScaleX=_scale2[0],_scale2=_scale2[1],matrixScaleX=(Util.singularValueDecompose2dScale(this.baseTransform,scale),matrixScaleX*scale[0]),_scale2=_scale2*scale[1],scale=width,canvasHeight=height,redrawHorizontally=!1,redrawVertically=!1,xScaledStep=Math.ceil(xstep*matrixScaleX),yScaledStep=Math.ceil(ystep*_scale2),xScaledStep=(Math.ceil(width*matrixScaleX)<=xScaledStep?scale=xstep:redrawHorizontally=!0,Math.ceil(height*_scale2)<=yScaledStep?canvasHeight=ystep:redrawVertically=!0,this.getSizeAndScale(scale,this.ctx.canvas.width,matrixScaleX)),yScaledStep=this.getSizeAndScale(canvasHeight,this.ctx.canvas.height,_scale2),tmpCanvas=owner.cachedCanvases.getCanvas("pattern",xScaledStep.size,yScaledStep.size),tmpCtx=tmpCanvas.context,canvasGraphicsFactory=canvasGraphicsFactory.createCanvasGraphics(tmpCtx);if(canvasGraphicsFactory.groupLevel=owner.groupLevel,this.setFillAndStrokeStyleToContext(canvasGraphicsFactory,paintType,color),tmpCtx.translate(-xScaledStep.scale*tilingType,-yScaledStep.scale*y0),canvasGraphicsFactory.transform(xScaledStep.scale,0,0,yScaledStep.scale,0,0),tmpCtx.save(),this.clipBbox(canvasGraphicsFactory,tilingType,y0,x1,bbox),canvasGraphicsFactory.baseTransform=getCurrentTransform(canvasGraphicsFactory.ctx),canvasGraphicsFactory.executeOperatorList(operatorList),canvasGraphicsFactory.endDrawing(),tmpCtx.restore(),redrawHorizontally||redrawVertically){for(var image=tmpCanvas.canvas,paintType=(redrawVertically&&(canvasHeight=ystep),this.getSizeAndScale(scale=redrawHorizontally?xstep:scale,this.ctx.canvas.width,matrixScaleX)),color=this.getSizeAndScale(canvasHeight,this.ctx.canvas.height,_scale2),xSize=paintType.size,ySize=color.size,x1=owner.cachedCanvases.getCanvas("pattern-workaround",xSize,ySize),tmpCtx2=x1.context,ii=redrawHorizontally?Math.floor(width/xstep):0,jj=redrawVertically?Math.floor(height/ystep):0,i=0;i<=ii;i++)for(var j=0;j<=jj;j++)tmpCtx2.drawImage(image,xSize*i,ySize*j,xSize,ySize,0,0,xSize,ySize);return{canvas:x1.canvas,scaleX:paintType.scale,scaleY:color.scale,offsetX:tilingType,offsetY:y0}}return{canvas:tmpCanvas.canvas,scaleX:xScaledStep.scale,scaleY:yScaledStep.scale,offsetX:tilingType,offsetY:y0}}},{key:"getSizeAndScale",value:function(step,realOutputSize,scale){var realOutputSize=Math.max(TilingPattern.MAX_PATTERN_SIZE,realOutputSize),size=Math.ceil(step*scale);return realOutputSize<=size?size=realOutputSize:scale=size/step,{scale:scale,size:size}}},{key:"clipBbox",value:function(graphics,x0,y0,x1,y1){graphics.ctx.rect(x0,y0,x1-x0,y1-y0),Util.axialAlignedBoundingBox([x0,y0,x1,y1],getCurrentTransform(graphics.ctx),graphics.current.minMax),graphics.clip(),graphics.endPath()}},{key:"setFillAndStrokeStyleToContext",value:function(graphics,paintType,color){var context=graphics.ctx,current=graphics.current;switch(paintType){case PaintType_COLORED:var _this$ctx=this.ctx,fillStyle=_this$ctx.fillStyle,_this$ctx=_this$ctx.strokeStyle;context.fillStyle=current.fillColor=fillStyle,context.strokeStyle=current.strokeColor=_this$ctx;break;case PaintType_UNCOLORED:context.fillStyle=context.strokeStyle=color,current.fillColor=current.strokeColor=color;break;default:throw new FormatError("Unsupported paint type: ".concat(paintType))}}},{key:"isModifyingCurrentTransform",value:function(){return!1}},{key:"getPattern",value:function(ctx,owner,inverse,pathType){pathType!==PathType_SHADING&&(inverse=Util.transform(inverse,owner.baseTransform),this.matrix)&&(inverse=Util.transform(inverse,this.matrix)),pathType=this.createPatternCanvas(owner),owner=new DOMMatrix(inverse),owner=(owner=owner.translate(pathType.offsetX,pathType.offsetY)).scale(1/pathType.scaleX,1/pathType.scaleY),inverse=ctx.createPattern(pathType.canvas,"repeat");return inverse.setTransform(owner),inverse}}])}();function convertBlackAndWhiteToRGBA(_ref28){for(var src=_ref28.src,_ref28$srcPos=_ref28.srcPos,srcPos=void 0===_ref28$srcPos?0:_ref28$srcPos,dest=_ref28.dest,_ref28$srcPos=_ref28.width,height=_ref28.height,_ref28$nonBlackColor=_ref28.nonBlackColor,_ref28$nonBlackColor=void 0===_ref28$nonBlackColor?4294967295:_ref28$nonBlackColor,_ref28=_ref28.inverseDecode,black=util_FeatureTest.isLittleEndian?4278190080:255,_ref28=babelHelpers.slicedToArray(void 0!==_ref28&&_ref28?[_ref28$nonBlackColor,black]:[black,_ref28$nonBlackColor],2),zeroMapping=_ref28[0],oneMapping=_ref28[1],widthInSource=_ref28$srcPos>>3,widthRemainder=7&_ref28$srcPos,srcLength=src.length,dest=new Uint32Array(dest.buffer),destPos=0,i=0;i<height;i++){for(var max=srcPos+widthInSource;srcPos<max;srcPos++){var _elem=srcPos<srcLength?src[srcPos]:255;dest[destPos++]=128&_elem?oneMapping:zeroMapping,dest[destPos++]=64&_elem?oneMapping:zeroMapping,dest[destPos++]=32&_elem?oneMapping:zeroMapping,dest[destPos++]=16&_elem?oneMapping:zeroMapping,dest[destPos++]=8&_elem?oneMapping:zeroMapping,dest[destPos++]=4&_elem?oneMapping:zeroMapping,dest[destPos++]=2&_elem?oneMapping:zeroMapping,dest[destPos++]=1&_elem?oneMapping:zeroMapping}if(0!=widthRemainder)for(var elem=srcPos<srcLength?src[srcPos++]:255,j=0;j<widthRemainder;j++)dest[destPos++]=elem&1<<7-j?oneMapping:zeroMapping}return{srcPos:srcPos,destPos:destPos}}babelHelpers.defineProperty(TilingPattern,"MAX_PATTERN_SIZE",3e3);var SCALE_MATRIX=new DOMMatrix,XY=new Float32Array(2),MIN_MAX_INIT=new Float32Array([1/0,1/0,-1/0,-1/0]);var CachedCanvases=function(){return babelHelpers.createClass(function CachedCanvases(canvasFactory){babelHelpers.classCallCheck(this,CachedCanvases),this.canvasFactory=canvasFactory,this.cache=Object.create(null)},[{key:"getCanvas",value:function(id,width,height){var canvasEntry;return void 0!==this.cache[id]?(canvasEntry=this.cache[id],this.canvasFactory.reset(canvasEntry,width,height)):(canvasEntry=this.canvasFactory.create(width,height),this.cache[id]=canvasEntry),canvasEntry}},{key:"delete",value:function(id){delete this.cache[id]}},{key:"clear",value:function(){for(var id in this.cache){var canvasEntry=this.cache[id];this.canvasFactory.destroy(canvasEntry),delete this.cache[id]}}}])}();function drawImageAtIntegerCoords(ctx,srcImg,srcX,srcY,srcW,srcH,destX,destY,destW,destH){var rTlX,rTlY,rWidth,rHeight,_getCurrentTransform=getCurrentTransform(ctx),_getCurrentTransform=babelHelpers.slicedToArray(_getCurrentTransform,6),a=_getCurrentTransform[0],b=_getCurrentTransform[1],c=_getCurrentTransform[2],d=_getCurrentTransform[3],tx=_getCurrentTransform[4],_getCurrentTransform=_getCurrentTransform[5];0===b&&0===c?(rTlX=Math.round(destX*a+tx),rTlY=Math.round(destY*d+_getCurrentTransform),rWidth=Math.abs(Math.round((destX+destW)*a+tx)-rTlX)||1,rHeight=Math.abs(Math.round((destY+destH)*d+_getCurrentTransform)-rTlY)||1,ctx.setTransform(Math.sign(a),0,0,Math.sign(d),rTlX,rTlY),ctx.drawImage(srcImg,srcX,srcY,srcW,srcH,0,0,rWidth,rHeight),ctx.setTransform(a,b,c,d,tx,_getCurrentTransform)):0===a&&0===d?(rTlX=Math.round(destY*c+tx),rTlY=Math.round(destX*b+_getCurrentTransform),rWidth=Math.abs(Math.round((destY+destH)*c+tx)-rTlX)||1,rHeight=Math.abs(Math.round((destX+destW)*b+_getCurrentTransform)-rTlY)||1,ctx.setTransform(0,Math.sign(b),Math.sign(c),0,rTlX,rTlY),ctx.drawImage(srcImg,srcX,srcY,srcW,srcH,0,0,rHeight,rWidth),ctx.setTransform(a,b,c,d,tx,_getCurrentTransform)):(ctx.drawImage(srcImg,srcX,srcY,srcW,srcH,destX,destY,destW,destH),Math.hypot(a,b),Math.hypot(c,d))}var CanvasExtraState=function(){return babelHelpers.createClass(function CanvasExtraState(width,height){babelHelpers.classCallCheck(this,CanvasExtraState),babelHelpers.defineProperty(this,"alphaIsShape",!1),babelHelpers.defineProperty(this,"fontSize",0),babelHelpers.defineProperty(this,"fontSizeScale",1),babelHelpers.defineProperty(this,"textMatrix",null),babelHelpers.defineProperty(this,"textMatrixScale",1),babelHelpers.defineProperty(this,"fontMatrix",FONT_IDENTITY_MATRIX),babelHelpers.defineProperty(this,"leading",0),babelHelpers.defineProperty(this,"x",0),babelHelpers.defineProperty(this,"y",0),babelHelpers.defineProperty(this,"lineX",0),babelHelpers.defineProperty(this,"lineY",0),babelHelpers.defineProperty(this,"charSpacing",0),babelHelpers.defineProperty(this,"wordSpacing",0),babelHelpers.defineProperty(this,"textHScale",1),babelHelpers.defineProperty(this,"textRenderingMode",TextRenderingMode_FILL),babelHelpers.defineProperty(this,"textRise",0),babelHelpers.defineProperty(this,"fillColor","#000000"),babelHelpers.defineProperty(this,"strokeColor","#000000"),babelHelpers.defineProperty(this,"patternFill",!1),babelHelpers.defineProperty(this,"patternStroke",!1),babelHelpers.defineProperty(this,"fillAlpha",1),babelHelpers.defineProperty(this,"strokeAlpha",1),babelHelpers.defineProperty(this,"lineWidth",1),babelHelpers.defineProperty(this,"activeSMask",null),babelHelpers.defineProperty(this,"transferMaps","none"),this.clipBox=new Float32Array([0,0,width,height]),this.minMax=MIN_MAX_INIT.slice()},[{key:"clone",value:function(){var clone;return(clone=Object.create(this)).clipBox=this.clipBox.slice(),clone.minMax=this.minMax.slice(),clone}},{key:"getPathBoundingBox",value:function(){var pathType=0<arguments.length&&void 0!==arguments[0]?arguments[0]:PathType_FILL,transform=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,box=this.minMax.slice();return pathType===PathType_STROKE&&(transform||unreachable("Stroke bounding box must include transform."),Util.singularValueDecompose2dScale(transform,XY),pathType=XY[0]*this.lineWidth/2,transform=XY[1]*this.lineWidth/2,box[0]-=pathType,box[1]-=transform,box[2]+=pathType,box[3]+=transform),box}},{key:"updateClipFromPath",value:function(){var intersect=Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(intersect||[0,0,0,0])}},{key:"isEmptyClip",value:function(){return this.minMax[0]===1/0}},{key:"startNewPathAndClipBox",value:function(box){this.clipBox.set(box,0),this.minMax.set(MIN_MAX_INIT,0)}},{key:"getClippedPathBoundingBox",value:function(){var pathType=0<arguments.length&&void 0!==arguments[0]?arguments[0]:PathType_FILL;return Util.intersect(this.clipBox,this.getPathBoundingBox(pathType,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null))}}])}();function putBinaryImageData(ctx,imgData){if(imgData instanceof ImageData)ctx.putImageData(imgData,0,0);else{var destPos,j,thisChunkHeight,elemsInThisChunk,height=imgData.height,width=imgData.width,partialChunkHeight=height%16,fullChunks=(height-partialChunkHeight)/16,totalChunks=0==partialChunkHeight?fullChunks:1+fullChunks,chunkImgData=ctx.createImageData(width,16),srcPos=0,src=imgData.data,dest=chunkImgData.data;if(imgData.kind===util_ImageKind.GRAYSCALE_1BPP)for(var srcLength=src.byteLength,dest32=new Uint32Array(dest.buffer,0,dest.byteLength>>2),dest32DataLength=dest32.length,fullSrcDiff=width+7>>3,white=4294967295,black=util_FeatureTest.isLittleEndian?4278190080:255,i=0;i<totalChunks;i++){for(thisChunkHeight=i<fullChunks?16:partialChunkHeight,j=destPos=0;j<thisChunkHeight;j++){for(var srcDiff=srcLength-srcPos,k=0,kEnd=fullSrcDiff<srcDiff?width:8*srcDiff-7,kEndUnrolled=-8&kEnd,mask=0,srcByte=0;k<kEndUnrolled;k+=8)srcByte=src[srcPos++],dest32[destPos++]=128&srcByte?white:black,dest32[destPos++]=64&srcByte?white:black,dest32[destPos++]=32&srcByte?white:black,dest32[destPos++]=16&srcByte?white:black,dest32[destPos++]=8&srcByte?white:black,dest32[destPos++]=4&srcByte?white:black,dest32[destPos++]=2&srcByte?white:black,dest32[destPos++]=1&srcByte?white:black;for(;k<kEnd;k++)0===mask&&(srcByte=src[srcPos++],mask=128),dest32[destPos++]=srcByte&mask?white:black,mask>>=1}for(;destPos<dest32DataLength;)dest32[destPos++]=0;ctx.putImageData(chunkImgData,0,16*i)}else if(imgData.kind===util_ImageKind.RGBA_32BPP){for(elemsInThisChunk=16*width*4,i=j=0;i<fullChunks;i++)dest.set(src.subarray(srcPos,srcPos+elemsInThisChunk)),srcPos+=elemsInThisChunk,ctx.putImageData(chunkImgData,0,j),j+=16;i<totalChunks&&(dest.set(src.subarray(srcPos,srcPos+(elemsInThisChunk=width*partialChunkHeight*4))),ctx.putImageData(chunkImgData,0,j))}else{if(imgData.kind!==util_ImageKind.RGB_24BPP)throw new Error("bad image kind: ".concat(imgData.kind));for(elemsInThisChunk=width*(thisChunkHeight=16),i=0;i<totalChunks;i++){for(destPos=0,j=elemsInThisChunk=fullChunks<=i?width*(thisChunkHeight=partialChunkHeight):elemsInThisChunk;j--;)dest[destPos++]=src[srcPos++],dest[destPos++]=src[srcPos++],dest[destPos++]=src[srcPos++],dest[destPos++]=255;ctx.putImageData(chunkImgData,0,16*i)}}}}function putBinaryImageMask(ctx,imgData){if(imgData.bitmap)ctx.drawImage(imgData.bitmap,0,0);else for(var height=imgData.height,width=imgData.width,partialChunkHeight=height%16,fullChunks=(height-partialChunkHeight)/16,totalChunks=0==partialChunkHeight?fullChunks:1+fullChunks,chunkImgData=ctx.createImageData(width,16),srcPos=0,src=imgData.data,dest=chunkImgData.data,i=0;i<totalChunks;i++){srcPos=convertBlackAndWhiteToRGBA({src:src,srcPos:srcPos,dest:dest,width:width,height:i<fullChunks?16:partialChunkHeight,nonBlackColor:0}).srcPos;ctx.putImageData(chunkImgData,0,16*i)}}function copyCtxState(sourceCtx,destCtx){for(var _i11=0,_properties=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];_i11<_properties.length;_i11++){var property=_properties[_i11];void 0!==sourceCtx[property]&&(destCtx[property]=sourceCtx[property])}void 0!==sourceCtx.setLineDash&&(destCtx.setLineDash(sourceCtx.getLineDash()),destCtx.lineDashOffset=sourceCtx.lineDashOffset)}function resetCtxToDefault(ctx){ctx.strokeStyle=ctx.fillStyle="#000000",ctx.fillRule="nonzero",ctx.globalAlpha=1,ctx.lineWidth=1,ctx.lineCap="butt",ctx.lineJoin="miter",ctx.miterLimit=10,ctx.globalCompositeOperation="source-over",ctx.font="10px sans-serif",void 0!==ctx.setLineDash&&(ctx.setLineDash([]),ctx.lineDashOffset=0);var filter=ctx.filter;"none"!==filter&&""!==filter&&(ctx.filter="none")}function getImageSmoothingEnabled(transform,interpolate){if(interpolate)return!0;Util.singularValueDecompose2dScale(transform,XY);interpolate=Math.fround(OutputScale.pixelRatio*PixelsPerInch.PDF_TO_CSS_UNITS);return XY[0]<=interpolate&&XY[1]<=interpolate}var op,LINE_CAP_STYLES=["butt","round","square"],LINE_JOIN_STYLES=["miter","round","bevel"],NORMAL_CLIP={},EO_CLIP={},_CanvasGraphics_brand=new WeakSet,CanvasGraphics=function(){function CanvasGraphics(canvasCtx,commonObjs,objs,canvasFactory,filterFactory,_ref32,annotationCanvasMap,pageColors){var optionalContentConfig=_ref32.optionalContentConfig,_ref32=_ref32.markedContentStack,_ref32=void 0===_ref32?null:_ref32;babelHelpers.classCallCheck(this,CanvasGraphics),_classPrivateMethodInitSpec(this,_CanvasGraphics_brand),this.ctx=canvasCtx,this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=commonObjs,this.objs=objs,this.canvasFactory=canvasFactory,this.filterFactory=filterFactory,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=_ref32||[],this.optionalContentConfig=optionalContentConfig,this.cachedCanvases=new CachedCanvases(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=annotationCanvasMap,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=pageColors,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}return babelHelpers.createClass(CanvasGraphics,[{key:"getObject",value:function(data){var fallback=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof data?(data.startsWith("g_")?this.commonObjs:this.objs).get(data):fallback}},{key:"beginDrawing",value:function(_ref33){var transform=_ref33.transform,viewport=_ref33.viewport,_ref33$transparency=_ref33.transparency,_ref33$transparency=void 0!==_ref33$transparency&&_ref33$transparency,_ref33=_ref33.background,width=this.ctx.canvas.width,height=this.ctx.canvas.height,savedFillStyle=this.ctx.fillStyle;this.ctx.fillStyle=(void 0===_ref33?null:_ref33)||"#ffffff",this.ctx.fillRect(0,0,width,height),this.ctx.fillStyle=savedFillStyle,_ref33$transparency&&(_ref33=this.cachedCanvases.getCanvas("transparent",width,height),this.compositeCtx=this.ctx,this.transparentCanvas=_ref33.canvas,this.ctx=_ref33.context,this.ctx.save(),(savedFillStyle=this.ctx).transform.apply(savedFillStyle,babelHelpers.toConsumableArray(getCurrentTransform(this.compositeCtx)))),this.ctx.save(),resetCtxToDefault(this.ctx),transform&&((_ref33$transparency=this.ctx).transform.apply(_ref33$transparency,babelHelpers.toConsumableArray(transform)),this.outputScaleX=transform[0],this.outputScaleY=transform[0]),(width=this.ctx).transform.apply(width,babelHelpers.toConsumableArray(viewport.transform)),this.viewportScale=viewport.scale,this.baseTransform=getCurrentTransform(this.ctx)}},{key:"executeOperatorList",value:function(operatorList,executionStartIdx,continueCallback,stepper){var argsArray=operatorList.argsArray,fnArray=operatorList.fnArray,i=executionStartIdx||0,argsArrayLen=argsArray.length;if(argsArrayLen===i)return i;for(var fnId,chunkOperations=10<argsArrayLen-i&&"function"==typeof continueCallback,endTime=chunkOperations?Date.now()+15:0,steps=0,commonObjs=this.commonObjs,objs=this.objs;;){if(void 0!==stepper&&i===stepper.nextBreakPoint)return stepper.breakIt(i,continueCallback),i;if((fnId=fnArray[i])!==OPS.dependency)this[fnId].apply(this,argsArray[i]);else{var _step59,_iterator59=_createForOfIteratorHelper(argsArray[i]);try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var depObjId=_step59.value,objsPool=depObjId.startsWith("g_")?commonObjs:objs;if(!objsPool.has(depObjId))return objsPool.get(depObjId,continueCallback),i}}catch(err){_iterator59.e(err)}finally{_iterator59.f()}}if(++i===argsArrayLen)return i;if(chunkOperations&&10<++steps){if(Date.now()>endTime)return continueCallback(),i;steps=0}}}},{key:"endDrawing",value:function(){_assertClassBrand(_CanvasGraphics_brand,this,_restoreInitialState).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();var _step60,_iterator60=_createForOfIteratorHelper(this._cachedBitmapsMap.values());try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var _step61,cache=_step60.value,_iterator61=_createForOfIteratorHelper(cache.values());try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var canvas=_step61.value;"undefined"!=typeof HTMLCanvasElement&&canvas instanceof HTMLCanvasElement&&(canvas.width=canvas.height=0)}}catch(err){_iterator61.e(err)}finally{_iterator61.f()}cache.clear()}}catch(err){_iterator60.e(err)}finally{_iterator60.f()}this._cachedBitmapsMap.clear(),_assertClassBrand(_CanvasGraphics_brand,this,_drawFilter).call(this)}},{key:"_scaleImage",value:function(img,inverseTransform){for(var tmpCanvas,tmpCtx,_img$width=null!=(_img$width=img.width)?_img$width:img.displayWidth,_img$height=null!=(_img$height=img.height)?_img$height:img.displayHeight,widthScale=Math.max(Math.hypot(inverseTransform[0],inverseTransform[1]),1),heightScale=Math.max(Math.hypot(inverseTransform[2],inverseTransform[3]),1),paintWidth=_img$width,paintHeight=_img$height,tmpCanvasId="prescale1";2<widthScale&&1<paintWidth||2<heightScale&&1<paintHeight;){var newWidth=paintWidth,newHeight=paintHeight;2<widthScale&&1<paintWidth&&(widthScale/=paintWidth/(newWidth=16384<=paintWidth?Math.floor(paintWidth/2)-1||1:Math.ceil(paintWidth/2))),2<heightScale&&1<paintHeight&&(heightScale/=paintHeight/(newHeight=16384<=paintHeight?Math.floor(paintHeight/2)-1||1:Math.ceil(paintHeight)/2)),(tmpCtx=(tmpCanvas=this.cachedCanvases.getCanvas(tmpCanvasId,newWidth,newHeight)).context).clearRect(0,0,newWidth,newHeight),tmpCtx.drawImage(img,0,0,paintWidth,paintHeight,0,0,newWidth,newHeight),img=tmpCanvas.canvas,paintWidth=newWidth,paintHeight=newHeight,tmpCanvasId="prescale1"===tmpCanvasId?"prescale2":"prescale1"}return{img:img,paintWidth:paintWidth,paintHeight:paintHeight}}},{key:"_createMaskCanvas",value:function(img){var maskCanvas,ctx=this.ctx,width=img.width,height=img.height,fillColor=this.current.fillColor,isPatternFill=this.current.patternFill,currentTransform=getCurrentTransform(ctx);if((img.bitmap||img.data)&&1<img.count){var cache,mainKey=img.bitmap||img.data.buffer,cacheKey=JSON.stringify(isPatternFill?currentTransform:[currentTransform.slice(0,4),fillColor]),mainKey=((cache=this._cachedBitmapsMap.get(mainKey))||(cache=new Map,this._cachedBitmapsMap.set(mainKey,cache)),cache.get(cacheKey));if(mainKey&&!isPatternFill)return{canvas:mainKey,offsetX:Math.round(Math.min(currentTransform[0],currentTransform[2])+currentTransform[4]),offsetY:Math.round(Math.min(currentTransform[1],currentTransform[3])+currentTransform[5])};mainKey=mainKey}mainKey||putBinaryImageMask((maskCanvas=this.cachedCanvases.getCanvas("maskCanvas",width,height)).context,img);var currentTransform=Util.transform(currentTransform,[1/width,0,0,-1/height,0,0]),currentTransform=Util.transform(currentTransform,[1,0,0,1,0,-height]),minMax=MIN_MAX_INIT.slice(),minMax=(Util.axialAlignedBoundingBox([0,0,width,height],currentTransform,minMax),babelHelpers.slicedToArray(minMax,4)),minX=minMax[0],minY=minMax[1],maxX=minMax[2],minMax=minMax[3],maxX=Math.round(maxX-minX)||1,minMax=Math.round(minMax-minY)||1,maxX=this.cachedCanvases.getCanvas("fillCanvas",maxX,minMax),minMax=maxX.context,currentTransform=(minMax.translate(-minX,-minY),minMax.transform.apply(minMax,babelHelpers.toConsumableArray(currentTransform)),mainKey||(mainKey=(mainKey=this._scaleImage(maskCanvas.canvas,getCurrentTransformInverse(minMax))).img,cache&&isPatternFill&&cache.set(cacheKey,mainKey)),minMax.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(minMax),img.interpolate),drawImageAtIntegerCoords(minMax,mainKey,0,0,mainKey.width,mainKey.height,0,0,width,height),minMax.globalCompositeOperation="source-in",Util.transform(getCurrentTransformInverse(minMax),[1,0,0,1,-minX,-minY]));return minMax.fillStyle=isPatternFill?fillColor.getPattern(ctx,this,currentTransform,PathType_FILL):fillColor,minMax.fillRect(0,0,width,height),cache&&!isPatternFill&&(this.cachedCanvases.delete("fillCanvas"),cache.set(cacheKey,maxX.canvas)),{canvas:maxX.canvas,offsetX:Math.round(minX),offsetY:Math.round(minY)}}},{key:"setLineWidth",value:function(width){width!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=width,this.ctx.lineWidth=width}},{key:"setLineCap",value:function(style){this.ctx.lineCap=LINE_CAP_STYLES[style]}},{key:"setLineJoin",value:function(style){this.ctx.lineJoin=LINE_JOIN_STYLES[style]}},{key:"setMiterLimit",value:function(limit){this.ctx.miterLimit=limit}},{key:"setDash",value:function(dashArray,dashPhase){var ctx=this.ctx;void 0!==ctx.setLineDash&&(ctx.setLineDash(dashArray),ctx.lineDashOffset=dashPhase)}},{key:"setRenderingIntent",value:function(intent){}},{key:"setFlatness",value:function(flatness){}},{key:"setGState",value:function(states){var _step62,_iterator62=_createForOfIteratorHelper(states);try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var _step62$value=babelHelpers.slicedToArray(_step62.value,2),key=_step62$value[0],value=_step62$value[1];switch(key){case"LW":this.setLineWidth(value);break;case"LC":this.setLineCap(value);break;case"LJ":this.setLineJoin(value);break;case"ML":this.setMiterLimit(value);break;case"D":this.setDash(value[0],value[1]);break;case"RI":this.setRenderingIntent(value);break;case"FL":this.setFlatness(value);break;case"Font":this.setFont(value[0],value[1]);break;case"CA":this.current.strokeAlpha=value;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=value;break;case"BM":this.ctx.globalCompositeOperation=value;break;case"SMask":this.current.activeSMask=value?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(value)}}}catch(err){_iterator62.e(err)}finally{_iterator62.f()}}},{key:"inSMaskMode",get:function(){return!!this.suspendedCtx}},{key:"checkSMaskState",value:function(){var inSMaskMode=this.inSMaskMode;this.current.activeSMask&&!inSMaskMode?this.beginSMaskMode():!this.current.activeSMask&&inSMaskMode&&this.endSMaskMode()}},{key:"beginSMaskMode",value:function(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");var drawnWidth=this.ctx.canvas.width,drawnHeight=this.ctx.canvas.height,cacheId="smaskGroupAt"+this.groupLevel,cacheId=this.cachedCanvases.getCanvas(cacheId,drawnWidth,drawnHeight),drawnWidth=(this.suspendedCtx=this.ctx,this.ctx=cacheId.context);drawnWidth.setTransform(this.suspendedCtx.getTransform()),copyCtxState(this.suspendedCtx,drawnWidth),function(ctx,destCtx){if(ctx._removeMirroring)throw new Error("Context is already forwarding operations.");ctx.__originalSave=ctx.save,ctx.__originalRestore=ctx.restore,ctx.__originalRotate=ctx.rotate,ctx.__originalScale=ctx.scale,ctx.__originalTranslate=ctx.translate,ctx.__originalTransform=ctx.transform,ctx.__originalSetTransform=ctx.setTransform,ctx.__originalResetTransform=ctx.resetTransform,ctx.__originalClip=ctx.clip,ctx.__originalMoveTo=ctx.moveTo,ctx.__originalLineTo=ctx.lineTo,ctx.__originalBezierCurveTo=ctx.bezierCurveTo,ctx.__originalRect=ctx.rect,ctx.__originalClosePath=ctx.closePath,ctx.__originalBeginPath=ctx.beginPath,ctx._removeMirroring=function(){ctx.save=ctx.__originalSave,ctx.restore=ctx.__originalRestore,ctx.rotate=ctx.__originalRotate,ctx.scale=ctx.__originalScale,ctx.translate=ctx.__originalTranslate,ctx.transform=ctx.__originalTransform,ctx.setTransform=ctx.__originalSetTransform,ctx.resetTransform=ctx.__originalResetTransform,ctx.clip=ctx.__originalClip,ctx.moveTo=ctx.__originalMoveTo,ctx.lineTo=ctx.__originalLineTo,ctx.bezierCurveTo=ctx.__originalBezierCurveTo,ctx.rect=ctx.__originalRect,ctx.closePath=ctx.__originalClosePath,ctx.beginPath=ctx.__originalBeginPath,delete ctx._removeMirroring},ctx.save=function(){destCtx.save(),this.__originalSave()},ctx.restore=function(){destCtx.restore(),this.__originalRestore()},ctx.translate=function(x,y){destCtx.translate(x,y),this.__originalTranslate(x,y)},ctx.scale=function(x,y){destCtx.scale(x,y),this.__originalScale(x,y)},ctx.transform=function(a,b,c,d,e,f){destCtx.transform(a,b,c,d,e,f),this.__originalTransform(a,b,c,d,e,f)},ctx.setTransform=function(a,b,c,d,e,f){destCtx.setTransform(a,b,c,d,e,f),this.__originalSetTransform(a,b,c,d,e,f)},ctx.resetTransform=function(){destCtx.resetTransform(),this.__originalResetTransform()},ctx.rotate=function(angle){destCtx.rotate(angle),this.__originalRotate(angle)},ctx.clip=function(rule){destCtx.clip(rule),this.__originalClip(rule)},ctx.moveTo=function(x,y){destCtx.moveTo(x,y),this.__originalMoveTo(x,y)},ctx.lineTo=function(x,y){destCtx.lineTo(x,y),this.__originalLineTo(x,y)},ctx.bezierCurveTo=function(cp1x,cp1y,cp2x,cp2y,x,y){destCtx.bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y),this.__originalBezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y)},ctx.rect=function(x,y,width,height){destCtx.rect(x,y,width,height),this.__originalRect(x,y,width,height)},ctx.closePath=function(){destCtx.closePath(),this.__originalClosePath()},ctx.beginPath=function(){destCtx.beginPath(),this.__originalBeginPath()}}(drawnWidth,this.suspendedCtx),this.setGState([["BM","source-over"]])}},{key:"endSMaskMode",value:function(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),copyCtxState(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}},{key:"compose",value:function(dirtyBox){var smask,suspendedCtx;this.current.activeSMask&&(dirtyBox?(dirtyBox[0]=Math.floor(dirtyBox[0]),dirtyBox[1]=Math.floor(dirtyBox[1]),dirtyBox[2]=Math.ceil(dirtyBox[2]),dirtyBox[3]=Math.ceil(dirtyBox[3])):dirtyBox=[0,0,this.ctx.canvas.width,this.ctx.canvas.height],smask=this.current.activeSMask,suspendedCtx=this.suspendedCtx,this.composeSMask(suspendedCtx,smask,this.ctx,dirtyBox),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())}},{key:"composeSMask",value:function(ctx,smask,layerCtx,layerBox){var layerOffsetX=layerBox[0],layerOffsetY=layerBox[1],layerWidth=layerBox[2]-layerOffsetX,layerBox=layerBox[3]-layerOffsetY;0!=layerWidth&&0!=layerBox&&(this.genericComposeSMask(smask.context,layerCtx,layerWidth,layerBox,smask.subtype,smask.backdrop,smask.transferMap,layerOffsetX,layerOffsetY,smask.offsetX,smask.offsetY),ctx.save(),ctx.globalAlpha=1,ctx.globalCompositeOperation="source-over",ctx.setTransform(1,0,0,1,0,0),ctx.drawImage(layerCtx.canvas,0,0),ctx.restore())}},{key:"genericComposeSMask",value:function(maskCtx,layerCtx,width,height,subtype,backdrop,transferMap,layerOffsetX,layerOffsetY,maskOffsetX,maskOffsetY){var ctx,maskCanvas=maskCtx.canvas,maskOffsetX=layerOffsetX-maskOffsetX,maskOffsetY=layerOffsetY-maskOffsetY,canvas=(backdrop&&(maskOffsetX<0||maskOffsetY<0||maskOffsetX+width>maskCanvas.width||maskOffsetY+height>maskCanvas.height?((ctx=(canvas=this.cachedCanvases.getCanvas("maskExtension",width,height)).context).drawImage(maskCanvas,-maskOffsetX,-maskOffsetY),ctx.globalCompositeOperation="destination-atop",ctx.fillStyle=backdrop,ctx.fillRect(0,0,width,height),ctx.globalCompositeOperation="source-over",maskCanvas=canvas.canvas,maskOffsetX=maskOffsetY=0):(maskCtx.save(),maskCtx.globalAlpha=1,maskCtx.setTransform(1,0,0,1,0,0),(ctx=new Path2D).rect(maskOffsetX,maskOffsetY,width,height),maskCtx.clip(ctx),maskCtx.globalCompositeOperation="destination-atop",maskCtx.fillStyle=backdrop,maskCtx.fillRect(maskOffsetX,maskOffsetY,width,height),maskCtx.restore())),layerCtx.save(),layerCtx.globalAlpha=1,layerCtx.setTransform(1,0,0,1,0,0),"Alpha"===subtype&&transferMap?layerCtx.filter=this.filterFactory.addAlphaFilter(transferMap):"Luminosity"===subtype&&(layerCtx.filter=this.filterFactory.addLuminosityFilter(transferMap)),new Path2D);canvas.rect(layerOffsetX,layerOffsetY,width,height),layerCtx.clip(canvas),layerCtx.globalCompositeOperation="destination-in",layerCtx.drawImage(maskCanvas,maskOffsetX,maskOffsetY,width,height,layerOffsetX,layerOffsetY,width,height),layerCtx.restore()}},{key:"save",value:function(){this.inSMaskMode&&copyCtxState(this.ctx,this.suspendedCtx),this.ctx.save();var old=this.current;this.stateStack.push(old),this.current=old.clone()}},{key:"restore",value:function(){0===this.stateStack.length?this.inSMaskMode&&this.endSMaskMode():(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&copyCtxState(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}},{key:"transform",value:function(a,b,c,d,e,f){this.ctx.transform(a,b,c,d,e,f),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}},{key:"constructPath",value:function(op,data,minMax){var path=babelHelpers.slicedToArray(data,1)[0];if(minMax){if(!(path instanceof Path2D)){for(var path2d=data[0]=new Path2D,i=0,ii=path.length;i<ii;)switch(path[i++]){case DrawOPS_moveTo:path2d.moveTo(path[i++],path[i++]);break;case DrawOPS_lineTo:path2d.lineTo(path[i++],path[i++]);break;case DrawOPS_curveTo:path2d.bezierCurveTo(path[i++],path[i++],path[i++],path[i++],path[i++],path[i++]);break;case DrawOPS_closePath:path2d.closePath();break;default:warn("Unrecognized drawing path operator: ".concat(path[i-1]))}path=path2d}Util.axialAlignedBoundingBox(minMax,getCurrentTransform(this.ctx),this.current.minMax)}else path=path||(data[0]=new Path2D);this[op](path)}},{key:"closePath",value:function(){this.ctx.closePath()}},{key:"stroke",value:function(path){var baseTransform,consumePath=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],ctx=this.ctx,strokeColor=this.current.strokeColor;ctx.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof strokeColor&&null!=strokeColor&&strokeColor.getPattern?(baseTransform=strokeColor.isModifyingCurrentTransform()?ctx.getTransform():null,ctx.save(),ctx.strokeStyle=strokeColor.getPattern(ctx,this,getCurrentTransformInverse(ctx),PathType_STROKE),baseTransform&&((strokeColor=new Path2D).addPath(path,ctx.getTransform().invertSelf().multiplySelf(baseTransform)),path=strokeColor),this.rescaleAndStroke(path,!1),ctx.restore()):this.rescaleAndStroke(path,!0)),consumePath&&this.consumePath(path,this.current.getClippedPathBoundingBox(PathType_STROKE,getCurrentTransform(this.ctx))),ctx.globalAlpha=this.current.fillAlpha}},{key:"closeStroke",value:function(path){this.stroke(path)}},{key:"fill",value:function(path){var consumePath=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],ctx=this.ctx,fillColor=this.current.fillColor,needRestore=!1,baseTransform=(this.current.patternFill&&(baseTransform=fillColor.isModifyingCurrentTransform()?ctx.getTransform():null,ctx.save(),ctx.fillStyle=fillColor.getPattern(ctx,this,getCurrentTransformInverse(ctx),PathType_FILL),baseTransform&&((fillColor=new Path2D).addPath(path,ctx.getTransform().invertSelf().multiplySelf(baseTransform)),path=fillColor),needRestore=!0),this.current.getClippedPathBoundingBox());this.contentVisible&&null!==baseTransform&&(this.pendingEOFill?(ctx.fill(path,"evenodd"),this.pendingEOFill=!1):ctx.fill(path)),needRestore&&ctx.restore(),consumePath&&this.consumePath(path,baseTransform)}},{key:"eoFill",value:function(path){this.pendingEOFill=!0,this.fill(path)}},{key:"fillStroke",value:function(path){this.fill(path,!1),this.stroke(path,!1),this.consumePath(path)}},{key:"eoFillStroke",value:function(path){this.pendingEOFill=!0,this.fillStroke(path)}},{key:"closeFillStroke",value:function(path){this.fillStroke(path)}},{key:"closeEOFillStroke",value:function(path){this.pendingEOFill=!0,this.fillStroke(path)}},{key:"endPath",value:function(path){this.consumePath(path)}},{key:"rawFillPath",value:function(path){this.ctx.fill(path)}},{key:"clip",value:function(){this.pendingClip=NORMAL_CLIP}},{key:"eoClip",value:function(){this.pendingClip=EO_CLIP}},{key:"beginText",value:function(){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}},{key:"endText",value:function(){var paths=this.pendingTextPaths,ctx=this.ctx;if(void 0!==paths){var _step63,newPath=new Path2D,invTransf=ctx.getTransform().invertSelf(),_iterator63=_createForOfIteratorHelper(paths);try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var _step63$value=_step63.value,transform=_step63$value.transform,x=_step63$value.x,y=_step63$value.y,fontSize=_step63$value.fontSize,path=_step63$value.path;newPath.addPath(path,new DOMMatrix(transform).preMultiplySelf(invTransf).translate(x,y).scale(fontSize,-fontSize))}}catch(err){_iterator63.e(err)}finally{_iterator63.f()}ctx.clip(newPath),delete this.pendingTextPaths}}},{key:"setCharSpacing",value:function(spacing){this.current.charSpacing=spacing}},{key:"setWordSpacing",value:function(spacing){this.current.wordSpacing=spacing}},{key:"setHScale",value:function(scale){this.current.textHScale=scale/100}},{key:"setLeading",value:function(leading){this.current.leading=-leading}},{key:"setFont",value:function(fontRefName,size){var browserFontSize,fontObj=this.commonObjs.get(fontRefName),current=this.current;if(!fontObj)throw new Error("Can't find font for ".concat(fontRefName));current.fontMatrix=fontObj.fontMatrix||FONT_IDENTITY_MATRIX,0!==current.fontMatrix[0]&&0!==current.fontMatrix[3]||warn("Invalid font matrix for font "+fontRefName),size<0?(size=-size,current.fontDirection=-1):current.fontDirection=1,this.current.font=fontObj,this.current.fontSize=size,fontObj.isType3Font||(fontRefName=fontObj.loadedName||"sans-serif",current=(null==(current=fontObj.systemFontInfo)?void 0:current.css)||'"'.concat(fontRefName,'", ').concat(fontObj.fallbackName),fontRefName="normal",fontObj.black?fontRefName="900":fontObj.bold&&(fontRefName="bold"),fontObj=fontObj.italic?"italic":"normal",(browserFontSize=size)<16?browserFontSize=16:100<size&&(browserFontSize=100),this.current.fontSizeScale=size/browserFontSize,this.ctx.font="".concat(fontObj," ").concat(fontRefName," ").concat(browserFontSize,"px ").concat(current))}},{key:"setTextRenderingMode",value:function(mode){this.current.textRenderingMode=mode}},{key:"setTextRise",value:function(rise){this.current.textRise=rise}},{key:"moveText",value:function(x,y){this.current.x=this.current.lineX+=x,this.current.y=this.current.lineY+=y}},{key:"setLeadingMoveText",value:function(x,y){this.setLeading(-y),this.moveText(x,y)}},{key:"setTextMatrix",value:function(matrix){var current=this.current;current.textMatrix=matrix,current.textMatrixScale=Math.hypot(matrix[0],matrix[1]),current.x=current.lineX=0,current.y=current.lineY=0}},{key:"nextLine",value:function(){this.moveText(0,this.current.leading)}},{key:"paintChar",value:function(character,x,y,patternFillTransform,patternStrokeTransform){var path,currentTransform,invPatternTransform,ctx=this.ctx,current=this.current,font=current.font,textRenderingMode=current.textRenderingMode,fontSize=current.fontSize/current.fontSizeScale,fillStrokeMode=textRenderingMode&TextRenderingMode_FILL_STROKE_MASK,textRenderingMode=!!(textRenderingMode&TextRenderingMode_ADD_TO_PATH_FLAG),patternFill=current.patternFill&&!font.missingFile,current=current.patternStroke&&!font.missingFile;(font.disableFontFace||textRenderingMode||patternFill||current)&&(path=font.getPathGenerator(this.commonObjs,character)),font.disableFontFace||patternFill||current?(ctx.save(),ctx.translate(x,y),ctx.scale(fontSize,-fontSize),fillStrokeMode!==TextRenderingMode_FILL&&fillStrokeMode!==TextRenderingMode_FILL_STROKE||(patternFillTransform?(currentTransform=ctx.getTransform(),ctx.setTransform.apply(ctx,babelHelpers.toConsumableArray(patternFillTransform)),ctx.fill(_assertClassBrand(_CanvasGraphics_brand,this,_getScaledPath).call(this,path,currentTransform,patternFillTransform))):ctx.fill(path)),fillStrokeMode!==TextRenderingMode_STROKE&&fillStrokeMode!==TextRenderingMode_FILL_STROKE||(patternStrokeTransform?(currentTransform=currentTransform||ctx.getTransform(),ctx.setTransform.apply(ctx,babelHelpers.toConsumableArray(patternStrokeTransform)),patternFill=(font=currentTransform).a,current=font.b,patternFillTransform=font.c,font=font.d,invPatternTransform=Util.inverseTransform(patternStrokeTransform),patternFill=Util.transform([patternFill,current,patternFillTransform,font,0,0],invPatternTransform),Util.singularValueDecompose2dScale(patternFill,XY),ctx.lineWidth*=Math.max(XY[0],XY[1])/fontSize,ctx.stroke(_assertClassBrand(_CanvasGraphics_brand,this,_getScaledPath).call(this,path,currentTransform,patternStrokeTransform))):(ctx.lineWidth/=fontSize,ctx.stroke(path))),ctx.restore()):(fillStrokeMode!==TextRenderingMode_FILL&&fillStrokeMode!==TextRenderingMode_FILL_STROKE||ctx.fillText(character,x,y),fillStrokeMode!==TextRenderingMode_STROKE&&fillStrokeMode!==TextRenderingMode_FILL_STROKE||ctx.strokeText(character,x,y)),textRenderingMode&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:getCurrentTransform(ctx),x:x,y:y,fontSize:fontSize,path:path})}},{key:"isFontSubpixelAAEnabled",get:function(){for(var ctx=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10).context,data=(ctx.scale(1.5,1),ctx.fillText("I",0,10),ctx.getImageData(0,0,10,10).data),enabled=!1,i=3;i<data.length;i+=4)if(0<data[i]&&data[i]<255){enabled=!0;break}return shadow(this,"isFontSubpixelAAEnabled",enabled)}},{key:"showText",value:function(glyphs){var current=this.current,font=current.font;if(font.isType3Font)return this.showType3Text(glyphs);var fontSize=current.fontSize;if(0!==fontSize){var patternFillTransform,patternStrokeTransform,fillStrokeMode,ctx=this.ctx,fontSizeScale=current.fontSizeScale,charSpacing=current.charSpacing,wordSpacing=current.wordSpacing,fontDirection=current.fontDirection,textHScale=current.textHScale*fontDirection,glyphsLength=glyphs.length,vertical=font.vertical,spacingDir=vertical?1:-1,defaultVMetrics=font.defaultVMetrics,widthAdvanceScale=fontSize*current.fontMatrix[0],simpleFillText=current.textRenderingMode===TextRenderingMode_FILL&&!font.disableFontFace&&!current.patternFill,pattern=(ctx.save(),current.textMatrix&&ctx.transform.apply(ctx,babelHelpers.toConsumableArray(current.textMatrix)),ctx.translate(current.x,current.y+current.textRise),0<fontDirection?ctx.scale(textHScale,-1):ctx.scale(textHScale,1),current.patternFill&&(ctx.save(),pattern=current.fillColor.getPattern(ctx,this,getCurrentTransformInverse(ctx),PathType_FILL),patternFillTransform=getCurrentTransform(ctx),ctx.restore(),ctx.fillStyle=pattern),current.patternStroke&&(ctx.save(),pattern=current.strokeColor.getPattern(ctx,this,getCurrentTransformInverse(ctx),PathType_STROKE),patternStrokeTransform=getCurrentTransform(ctx),ctx.restore(),ctx.strokeStyle=pattern),current.lineWidth),scale=current.textMatrixScale;if(0===scale||0===pattern?(fillStrokeMode=current.textRenderingMode&TextRenderingMode_FILL_STROKE_MASK)!==TextRenderingMode_STROKE&&fillStrokeMode!==TextRenderingMode_FILL_STROKE||(pattern=this.getSinglePixelWidth()):pattern/=scale,1!==fontSizeScale&&(ctx.scale(fontSizeScale,fontSizeScale),pattern/=fontSizeScale),ctx.lineWidth=pattern,font.isInvalidPDFjsFont){var _step64,chars=[],width=0,_iterator64=_createForOfIteratorHelper(glyphs);try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var glyph=_step64.value;chars.push(glyph.unicode),width+=glyph.width}}catch(err){_iterator64.e(err)}finally{_iterator64.f()}ctx.fillText(chars.join(""),0,0),current.x+=width*widthAdvanceScale*textHScale}else{for(var x=0,i=0;i<glyphsLength;++i){var spacing,character,accent,_width2,scaledX,scaledY,vmetric,vx,restoreNeeded,vy,_glyph=glyphs[i];"number"==typeof _glyph?x+=spacingDir*_glyph*fontSize/1e3:(restoreNeeded=!1,spacing=(_glyph.isSpace?wordSpacing:0)+charSpacing,character=_glyph.fontChar,accent=_glyph.accent,scaledY=scaledX=void 0,_width2=_glyph.width,scaledY=vertical?(vmetric=_glyph.vmetric||defaultVMetrics,vx=-(_glyph.vmetric?vmetric[1]:.5*_width2)*widthAdvanceScale,vy=vmetric[2]*widthAdvanceScale,_width2=vmetric?-vmetric[0]:_width2,scaledX=vx/fontSizeScale,(x+vy)/fontSizeScale):(scaledX=x/fontSizeScale,0),font.remeasure&&0<_width2&&(_width2<(vmetric=1e3*ctx.measureText(character).width/fontSize*fontSizeScale)&&this.isFontSubpixelAAEnabled?(vx=_width2/vmetric,restoreNeeded=!0,ctx.save(),ctx.scale(vx,1),scaledX/=vx):_width2!==vmetric&&(scaledX+=(_width2-vmetric)/2e3*fontSize/fontSizeScale)),this.contentVisible&&(_glyph.isInFont||font.missingFile)&&(simpleFillText&&!accent?ctx.fillText(character,scaledX,scaledY):(this.paintChar(character,scaledX,scaledY,patternFillTransform,patternStrokeTransform),accent&&(vy=scaledX+fontSize*accent.offset.x/fontSizeScale,_glyph=scaledY-fontSize*accent.offset.y/fontSizeScale,this.paintChar(accent.fontChar,vy,_glyph,patternFillTransform,patternStrokeTransform)))),x+=vertical?_width2*widthAdvanceScale-spacing*fontDirection:_width2*widthAdvanceScale+spacing*fontDirection,restoreNeeded&&ctx.restore())}vertical?current.y-=x:current.x+=x*textHScale}ctx.restore(),this.compose()}}},{key:"showType3Text",value:function(glyphs){var i,spacingLength,operatorList,glyph,ctx=this.ctx,current=this.current,font=current.font,fontSize=current.fontSize,fontDirection=current.fontDirection,spacingDir=font.vertical?1:-1,charSpacing=current.charSpacing,wordSpacing=current.wordSpacing,textHScale=current.textHScale*fontDirection,fontMatrix=current.fontMatrix||FONT_IDENTITY_MATRIX,glyphsLength=glyphs.length,isTextInvisible=current.textRenderingMode===TextRenderingMode_INVISIBLE;if(!isTextInvisible&&0!==fontSize){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,ctx.save(),current.textMatrix&&ctx.transform.apply(ctx,babelHelpers.toConsumableArray(current.textMatrix)),ctx.translate(current.x,current.y+current.textRise),ctx.scale(textHScale,fontDirection),i=0;i<glyphsLength;++i)"number"==typeof(glyph=glyphs[i])?(this.ctx.translate(spacingLength=spacingDir*glyph*fontSize/1e3,0),current.x+=spacingLength*textHScale):(spacingLength=(glyph.isSpace?wordSpacing:0)+charSpacing,operatorList=((operatorList=font.charProcOperatorList[glyph.operatorListId])?this.contentVisible&&(this.save(),ctx.scale(fontSize,fontSize),ctx.transform.apply(ctx,babelHelpers.toConsumableArray(fontMatrix)),this.executeOperatorList(operatorList),this.restore()):warn('Type3 character "'.concat(glyph.operatorListId,'" is not available.')),[glyph.width,0]),Util.applyTransform(operatorList,fontMatrix),ctx.translate(glyph=operatorList[0]*fontSize+spacingLength,0),current.x+=glyph*textHScale);ctx.restore()}}},{key:"setCharWidth",value:function(xWidth,yWidth){}},{key:"setCharWidthAndBounds",value:function(xWidth,yWidth,llx,lly,urx,ury){var clip=new Path2D;clip.rect(llx,lly,urx-llx,ury-lly),this.ctx.clip(clip),this.endPath()}},{key:"getColorN_Pattern",value:function(IR){var baseTransform,_this32=this;return"TilingPattern"===IR[0]?(baseTransform=this.baseTransform||getCurrentTransform(this.ctx),new TilingPattern(IR,this.ctx,{createCanvasGraphics:function(ctx){return new CanvasGraphics(ctx,_this32.commonObjs,_this32.objs,_this32.canvasFactory,_this32.filterFactory,{optionalContentConfig:_this32.optionalContentConfig,markedContentStack:_this32.markedContentStack})}},baseTransform)):this._getPattern(IR[1],IR[2])}},{key:"setStrokeColorN",value:function(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}},{key:"setFillColorN",value:function(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}},{key:"setStrokeRGBColor",value:function(color){this.ctx.strokeStyle=this.current.strokeColor=color,this.current.patternStroke=!1}},{key:"setStrokeTransparent",value:function(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}},{key:"setFillRGBColor",value:function(color){this.ctx.fillStyle=this.current.fillColor=color,this.current.patternFill=!1}},{key:"setFillTransparent",value:function(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}},{key:"_getPattern",value:function(objId){var pattern,matrix=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(objId)?pattern=this.cachedPatterns.get(objId):(pattern=function(IR){switch(IR[0]){case"RadialAxial":return new RadialAxialShadingPattern(IR);case"Mesh":return new MeshShadingPattern(IR);case"Dummy":return new DummyShadingPattern}throw new Error("Unknown IR type: ".concat(IR[0]))}(this.getObject(objId)),this.cachedPatterns.set(objId,pattern)),matrix&&(pattern.matrix=matrix),pattern}},{key:"shadingFill",value:function(objId){var ctx,minMax,width;this.contentVisible&&(ctx=this.ctx,this.save(),objId=this._getPattern(objId),ctx.fillStyle=objId.getPattern(ctx,this,getCurrentTransformInverse(ctx),PathType_SHADING),(objId=getCurrentTransformInverse(ctx))?(width=(ctx=ctx.canvas).width,ctx=ctx.height,minMax=MIN_MAX_INIT.slice(),Util.axialAlignedBoundingBox([0,0,width,ctx],objId,minMax),ctx=(width=babelHelpers.slicedToArray(minMax,4))[0],objId=width[1],minMax=width[2],width=width[3],this.ctx.fillRect(ctx,objId,minMax-ctx,width-objId)):this.ctx.fillRect(-1e10,-1e10,2e10,2e10),this.compose(this.current.getClippedPathBoundingBox()),this.restore())}},{key:"beginInlineImage",value:function(){unreachable("Should not call beginInlineImage")}},{key:"beginImageData",value:function(){unreachable("Should not call beginImageData")}},{key:"paintFormXObjectBegin",value:function(matrix,bbox){var y0,x1,clip;this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),matrix&&this.transform.apply(this,babelHelpers.toConsumableArray(matrix)),this.baseTransform=getCurrentTransform(this.ctx),bbox)&&(Util.axialAlignedBoundingBox(bbox,this.baseTransform,this.current.minMax),bbox=(matrix=babelHelpers.slicedToArray(bbox,4))[0],y0=matrix[1],x1=matrix[2],matrix=matrix[3],(clip=new Path2D).rect(bbox,y0,x1-bbox,matrix-y0),this.ctx.clip(clip),this.endPath())}},{key:"paintFormXObjectEnd",value:function(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}},{key:"beginGroup",value:function(group){if(this.contentVisible){this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);var currentCtx=this.ctx,currentTransform=(group.isolated||info("TODO: Support non-isolated groups."),group.knockout&&warn("Knockout groups not supported."),getCurrentTransform(currentCtx));if(group.matrix&&currentCtx.transform.apply(currentCtx,babelHelpers.toConsumableArray(group.matrix)),!group.bbox)throw new Error("Bounding box is required.");var bounds=MIN_MAX_INIT.slice(),canvasBounds=(Util.axialAlignedBoundingBox(group.bbox,getCurrentTransform(currentCtx),bounds),[0,0,currentCtx.canvas.width,currentCtx.canvas.height]),bounds=Util.intersect(bounds,canvasBounds)||[0,0,0,0],canvasBounds=Math.floor(bounds[0]),offsetY=Math.floor(bounds[1]),drawnWidth=Math.max(Math.ceil(bounds[2])-canvasBounds,1),bounds=Math.max(Math.ceil(bounds[3])-offsetY,1),cacheId=(this.current.startNewPathAndClipBox([0,0,drawnWidth,bounds]),"groupAt"+this.groupLevel),cacheId=(group.smask&&(cacheId+="_smask_"+this.smaskCounter++%2),this.cachedCanvases.getCanvas(cacheId,drawnWidth,bounds)),drawnWidth=cacheId.context,bounds=(drawnWidth.translate(-canvasBounds,-offsetY),drawnWidth.transform.apply(drawnWidth,babelHelpers.toConsumableArray(currentTransform)),new Path2D),currentTransform=babelHelpers.slicedToArray(group.bbox,4),x0=currentTransform[0],y0=currentTransform[1],x1=currentTransform[2],currentTransform=currentTransform[3];bounds.rect(x0,y0,x1-x0,currentTransform-y0),group.matrix&&((x1=new Path2D).addPath(bounds,new DOMMatrix(group.matrix)),bounds=x1),drawnWidth.clip(bounds),group.smask?this.smaskStack.push({canvas:cacheId.canvas,context:drawnWidth,offsetX:canvasBounds,offsetY:offsetY,subtype:group.smask.subtype,backdrop:group.smask.backdrop,transferMap:group.smask.transferMap||null,startTransformInverse:null}):(currentCtx.setTransform(1,0,0,1,0,0),currentCtx.translate(canvasBounds,offsetY),currentCtx.save()),copyCtxState(currentCtx,drawnWidth),this.ctx=drawnWidth,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(currentCtx),this.groupLevel++}}},{key:"endGroup",value:function(group){var groupCtx,ctx;this.contentVisible&&(this.groupLevel--,groupCtx=this.ctx,ctx=this.groupStack.pop(),this.ctx=ctx,this.ctx.imageSmoothingEnabled=!1,group.smask?(this.tempSMask=this.smaskStack.pop(),this.restore()):(this.ctx.restore(),ctx=getCurrentTransform(this.ctx),this.restore(),this.ctx.save(),(group=this.ctx).setTransform.apply(group,babelHelpers.toConsumableArray(ctx)),group=MIN_MAX_INIT.slice(),Util.axialAlignedBoundingBox([0,0,groupCtx.canvas.width,groupCtx.canvas.height],ctx,group),this.ctx.drawImage(groupCtx.canvas,0,0),this.ctx.restore(),this.compose(group)))}},{key:"beginAnnotation",value:function(id,rect,transform,matrix,hasOwnCanvas){var _this$ctx6,height,canvasWidth;_assertClassBrand(_CanvasGraphics_brand,this,_restoreInitialState).call(this),resetCtxToDefault(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&(_this$ctx6=this.ctx).setTransform.apply(_this$ctx6,babelHelpers.toConsumableArray(this.baseTransform)),rect&&(_this$ctx6=rect[2]-rect[0],height=rect[3]-rect[1],hasOwnCanvas&&this.annotationCanvasMap?((transform=transform.slice())[4]-=rect[0],transform[5]-=rect[1],(rect=rect.slice())[0]=rect[1]=0,rect[2]=_this$ctx6,rect[3]=height,Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx),XY),hasOwnCanvas=this.viewportScale,canvasWidth=Math.ceil(_this$ctx6*this.outputScaleX*hasOwnCanvas),hasOwnCanvas=Math.ceil(height*this.outputScaleY*hasOwnCanvas),this.annotationCanvas=this.canvasFactory.create(canvasWidth,hasOwnCanvas),hasOwnCanvas=(canvasWidth=this.annotationCanvas).canvas,canvasWidth=canvasWidth.context,this.annotationCanvasMap.set(id,hasOwnCanvas),this.annotationCanvas.savedCtx=this.ctx,this.ctx=canvasWidth,this.ctx.save(),this.ctx.setTransform(XY[0],0,0,-XY[1],0,height*XY[1]),resetCtxToDefault(this.ctx)):(resetCtxToDefault(this.ctx),this.endPath(),(id=new Path2D).rect(rect[0],rect[1],_this$ctx6,height),this.ctx.clip(id))),this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height),this.transform.apply(this,babelHelpers.toConsumableArray(transform)),this.transform.apply(this,babelHelpers.toConsumableArray(matrix))}},{key:"endAnnotation",value:function(){this.annotationCanvas&&(this.ctx.restore(),_assertClassBrand(_CanvasGraphics_brand,this,_drawFilter).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}},{key:"paintImageMaskXObject",value:function(img){var count,maskCanvas;this.contentVisible&&(count=img.count,(img=this.getObject(img.data,img)).count=count,count=this.ctx,maskCanvas=(img=this._createMaskCanvas(img)).canvas,count.save(),count.setTransform(1,0,0,1,0,0),count.drawImage(maskCanvas,img.offsetX,img.offsetY),count.restore(),this.compose())}},{key:"paintImageMaskXObjectRepeat",value:function(img,scaleX){var skewX=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,skewY=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,scaleY=4<arguments.length?arguments[4]:void 0,positions=5<arguments.length?arguments[5]:void 0;if(this.contentVisible){img=this.getObject(img.data,img);var ctx=this.ctx,currentTransform=(ctx.save(),getCurrentTransform(ctx)),mask=(ctx.transform(scaleX,skewX,skewY,scaleY,0,0),this._createMaskCanvas(img));ctx.setTransform(1,0,0,1,mask.offsetX-currentTransform[4],mask.offsetY-currentTransform[5]);for(var i=0,ii=positions.length;i<ii;i+=2){var trans=Util.transform(currentTransform,[scaleX,skewX,skewY,scaleY,positions[i],positions[i+1]]);ctx.drawImage(mask.canvas,trans[4],trans[5])}ctx.restore(),this.compose()}}},{key:"paintImageMaskXObjectGroup",value:function(images){if(this.contentVisible){var _step65,ctx=this.ctx,fillColor=this.current.fillColor,isPatternFill=this.current.patternFill,_iterator65=_createForOfIteratorHelper(images);try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var image=_step65.value,data=image.data,width=image.width,height=image.height,transform=image.transform,maskCanvas=this.cachedCanvases.getCanvas("maskCanvas",width,height),maskCtx=maskCanvas.context,img=(maskCtx.save(),this.getObject(data,image));putBinaryImageMask(maskCtx,img),maskCtx.globalCompositeOperation="source-in",maskCtx.fillStyle=isPatternFill?fillColor.getPattern(maskCtx,this,getCurrentTransformInverse(ctx),PathType_FILL):fillColor,maskCtx.fillRect(0,0,width,height),maskCtx.restore(),ctx.save(),ctx.transform.apply(ctx,babelHelpers.toConsumableArray(transform)),ctx.scale(1,-1),drawImageAtIntegerCoords(ctx,maskCanvas.canvas,0,0,width,height,0,-1,1,1),ctx.restore()}}catch(err){_iterator65.e(err)}finally{_iterator65.f()}this.compose()}}},{key:"paintImageXObject",value:function(objId){this.contentVisible&&((objId=this.getObject(objId))?this.paintInlineImageXObject(objId):warn("Dependent image isn't ready yet"))}},{key:"paintImageXObjectRepeat",value:function(objId,scaleX,scaleY,positions){if(this.contentVisible){objId=this.getObject(objId);if(objId){for(var width=objId.width,height=objId.height,map=[],i=0,ii=positions.length;i<ii;i+=2)map.push({transform:[scaleX,0,0,scaleY,positions[i],positions[i+1]],x:0,y:0,w:width,h:height});this.paintInlineImageXObjectGroup(objId,map)}else warn("Dependent image isn't ready yet")}}},{key:"applyTransferMapsToCanvas",value:function(ctx){return"none"!==this.current.transferMaps&&(ctx.filter=this.current.transferMaps,ctx.drawImage(ctx.canvas,0,0),ctx.filter="none"),ctx.canvas}},{key:"applyTransferMapsToBitmap",value:function(imgData){var bitmap,width;return"none"===this.current.transferMaps?imgData.bitmap:(bitmap=imgData.bitmap,width=imgData.width,imgData=imgData.height,(imgData=(width=this.cachedCanvases.getCanvas("inlineImage",width,imgData)).context).filter=this.current.transferMaps,imgData.drawImage(bitmap,0,0),imgData.filter="none",width.canvas)}},{key:"paintInlineImageXObject",value:function(imgData){var width,height,ctx,filter;this.contentVisible&&(width=imgData.width,height=imgData.height,ctx=this.ctx,this.save(),"none"!==(filter=ctx.filter)&&""!==filter&&(ctx.filter="none"),ctx.scale(1/width,-1/height),filter=imgData.bitmap?this.applyTransferMapsToBitmap(imgData):"function"==typeof HTMLElement&&imgData instanceof HTMLElement||!imgData.data?imgData:(putBinaryImageData(filter=this.cachedCanvases.getCanvas("inlineImage",width,height).context,imgData),this.applyTransferMapsToCanvas(filter)),filter=this._scaleImage(filter,getCurrentTransformInverse(ctx)),ctx.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(ctx),imgData.interpolate),drawImageAtIntegerCoords(ctx,filter.img,0,0,filter.paintWidth,filter.paintHeight,0,-height,width,height),this.compose(),this.restore())}},{key:"paintInlineImageXObjectGroup",value:function(imgData,map){if(this.contentVisible){var h,w,_step66,ctx=this.ctx,imgToPaint=imgData.bitmap||(w=imgData.width,h=imgData.height,putBinaryImageData(w=this.cachedCanvases.getCanvas("inlineImage",w,h).context,imgData),this.applyTransferMapsToCanvas(w)),_iterator66=_createForOfIteratorHelper(map);try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var entry=_step66.value;ctx.save(),ctx.transform.apply(ctx,babelHelpers.toConsumableArray(entry.transform)),ctx.scale(1,-1),drawImageAtIntegerCoords(ctx,imgToPaint,entry.x,entry.y,entry.w,entry.h,0,-1,1,1),ctx.restore()}}catch(err){_iterator66.e(err)}finally{_iterator66.f()}this.compose()}}},{key:"paintSolidColorImageMask",value:function(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}},{key:"markPoint",value:function(tag){}},{key:"markPointProps",value:function(tag,properties){}},{key:"beginMarkedContent",value:function(tag){this.markedContentStack.push({visible:!0})}},{key:"beginMarkedContentProps",value:function(tag,properties){"OC"===tag?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(properties)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}},{key:"endMarkedContent",value:function(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}},{key:"beginCompat",value:function(){}},{key:"endCompat",value:function(){}},{key:"consumePath",value:function(path,clipBox){var isEmpty=this.current.isEmptyClip(),clipBox=(this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(clipBox),this.ctx);this.pendingClip&&(isEmpty||(this.pendingClip===EO_CLIP?clipBox.clip(path,"evenodd"):clipBox.clip(path)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}},{key:"getSinglePixelWidth",value:function(){var absDet,normX,m;return this._cachedGetSinglePixelWidth||(0===(m=getCurrentTransform(this.ctx))[1]&&0===m[2]?this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(m[0]),Math.abs(m[3])):(absDet=Math.abs(m[0]*m[3]-m[2]*m[1]),normX=Math.hypot(m[0],m[2]),m=Math.hypot(m[1],m[3]),this._cachedGetSinglePixelWidth=Math.max(normX,m)/absDet)),this._cachedGetSinglePixelWidth}},{key:"getScaleForStroking",value:function(){var lineWidth,c,_this$ctx$getTransfor,scaleX,normY,normX,a,b,scaledLineWidth;return-1===this._cachedScaleForStroking[0]&&(lineWidth=this.current.lineWidth,a=(_this$ctx$getTransfor=this.ctx.getTransform()).a,b=_this$ctx$getTransfor.b,c=_this$ctx$getTransfor.c,_this$ctx$getTransfor=_this$ctx$getTransfor.d,0===b&&0===c?(normX=Math.abs(a))===(normY=Math.abs(_this$ctx$getTransfor))?scaleX=scaledLineWidth=0===lineWidth?1/normX:(scaledLineWidth=normX*lineWidth)<1?1/scaledLineWidth:1:scaledLineWidth=0===lineWidth?(scaleX=1/normX,1/normY):(scaleX=(normX=normX*lineWidth)<1?1/normX:1,(normX=normY*lineWidth)<1?1/normX:1):(normY=Math.abs(a*_this$ctx$getTransfor-b*c),normX=Math.hypot(a,b),a=Math.hypot(c,_this$ctx$getTransfor),scaledLineWidth=0===lineWidth?(scaleX=a/normY,normX/normY):(scaleX=(b=lineWidth*normY)<a?a/b:1,b<normX?normX/b:1)),this._cachedScaleForStroking[0]=scaleX,this._cachedScaleForStroking[1]=scaledLineWidth),this._cachedScaleForStroking}},{key:"rescaleAndStroke",value:function(path,saveRestore){var dashes,newPath,scale,ctx=this.ctx,lineWidth=this.current.lineWidth,_this$getScaleForStro=this.getScaleForStroking(),_this$getScaleForStro=babelHelpers.slicedToArray(_this$getScaleForStro,2),scaleX=_this$getScaleForStro[0],_this$getScaleForStro=_this$getScaleForStro[1];scaleX===_this$getScaleForStro?(ctx.lineWidth=(lineWidth||1)*scaleX,ctx.stroke(path)):(dashes=ctx.getLineDash(),saveRestore&&ctx.save(),ctx.scale(scaleX,_this$getScaleForStro),SCALE_MATRIX.a=1/scaleX,SCALE_MATRIX.d=1/_this$getScaleForStro,(newPath=new Path2D).addPath(path,SCALE_MATRIX),0<dashes.length&&(scale=Math.max(scaleX,_this$getScaleForStro),ctx.setLineDash(dashes.map(function(x){return x/scale})),ctx.lineDashOffset/=scale),ctx.lineWidth=lineWidth||1,ctx.stroke(newPath),saveRestore&&ctx.restore())}},{key:"isContentVisible",value:function(){for(var i=this.markedContentStack.length-1;0<=i;i--)if(!this.markedContentStack[i].visible)return!1;return!0}}])}();function _restoreInitialState(){for(;this.stateStack.length||this.inSMaskMode;)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)}function _drawFilter(){var hcmFilterId,savedFilter;this.pageColors&&"none"!==(hcmFilterId=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background))&&(savedFilter=this.ctx.filter,this.ctx.filter=hcmFilterId,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=savedFilter)}function _getScaledPath(path,currentTransform,transform){var newPath=new Path2D;return newPath.addPath(path,new DOMMatrix(transform).invertSelf().multiplySelf(currentTransform)),newPath}for(op in OPS)void 0!==CanvasGraphics.prototype[op]&&(CanvasGraphics.prototype[OPS[op]]=CanvasGraphics.prototype[op]);var GlobalWorkerOptions=_exports.GlobalWorkerOptions=function(){function GlobalWorkerOptions(){babelHelpers.classCallCheck(this,GlobalWorkerOptions)}return babelHelpers.createClass(GlobalWorkerOptions,null,[{key:"workerPort",get:function(){return _assertClassBrand(GlobalWorkerOptions,this,_port)._},set:function(val){if(!("undefined"!=typeof Worker&&val instanceof Worker)&&null!==val)throw new Error("Invalid `workerPort` type.");_port._=_assertClassBrand(GlobalWorkerOptions,this,val)}},{key:"workerSrc",get:function(){return _assertClassBrand(GlobalWorkerOptions,this,_src)._},set:function(val){if("string"!=typeof val)throw new Error("Invalid `workerSrc` type.");_src._=_assertClassBrand(GlobalWorkerOptions,this,val)}}])}(),_port={_:null},_src={_:""},_map5=new WeakMap,_data4=new WeakMap,Metadata=function(){return babelHelpers.createClass(function Metadata(_ref34){var parsedData=_ref34.parsedData,_ref34=_ref34.rawData;babelHelpers.classCallCheck(this,Metadata),_classPrivateFieldInitSpec(this,_map5,void 0),_classPrivateFieldInitSpec(this,_data4,void 0),_classPrivateFieldSet(_map5,this,parsedData),_classPrivateFieldSet(_data4,this,_ref34)},[{key:"getRaw",value:function(){return _classPrivateFieldGet(_data4,this)}},{key:"get",value:function(name){return null!=(name=_classPrivateFieldGet(_map5,this).get(name))?name:null}},{key:Symbol.iterator,value:function(){return _classPrivateFieldGet(_map5,this).entries()}}])}(),INTERNAL=Symbol("INTERNAL"),_isDisplay=new WeakMap,_isPrint=new WeakMap,_userSet=new WeakMap,_visible=new WeakMap,OptionalContentGroup=function(){return babelHelpers.createClass(function OptionalContentGroup(renderingIntent,_ref35){var name=_ref35.name,intent=_ref35.intent,usage=_ref35.usage,_ref35=_ref35.rbGroups;babelHelpers.classCallCheck(this,OptionalContentGroup),_classPrivateFieldInitSpec(this,_isDisplay,!1),_classPrivateFieldInitSpec(this,_isPrint,!1),_classPrivateFieldInitSpec(this,_userSet,!1),_classPrivateFieldInitSpec(this,_visible,!0),_classPrivateFieldSet(_isDisplay,this,!!(renderingIntent&RenderingIntentFlag_DISPLAY)),_classPrivateFieldSet(_isPrint,this,!!(renderingIntent&RenderingIntentFlag_PRINT)),this.name=name,this.intent=intent,this.usage=usage,this.rbGroups=_ref35},[{key:"visible",get:function(){var print,_this$usage;return _classPrivateFieldGet(_userSet,this)?_classPrivateFieldGet(_visible,this):!!_classPrivateFieldGet(_visible,this)&&(print=(_this$usage=this.usage).print,_this$usage=_this$usage.view,_classPrivateFieldGet(_isDisplay,this)?"OFF"!==(null==_this$usage?void 0:_this$usage.viewState):!_classPrivateFieldGet(_isPrint,this)||"OFF"!==(null==print?void 0:print.printState))}},{key:"_setVisible",value:function(internal,visible){var userSet=2<arguments.length&&void 0!==arguments[2]&&arguments[2];internal!==INTERNAL&&unreachable("Internal method `_setVisible` called."),_classPrivateFieldSet(_userSet,this,userSet),_classPrivateFieldSet(_visible,this,visible)}}])}(),_cachedGetHash=new WeakMap,_groups=new WeakMap,_initialHash=new WeakMap,_order=new WeakMap,_OptionalContentConfig_brand=new WeakSet,OptionalContentConfig=function(){return babelHelpers.createClass(function OptionalContentConfig(data){var renderingIntent=1<arguments.length&&void 0!==arguments[1]?arguments[1]:RenderingIntentFlag_DISPLAY;if(babelHelpers.classCallCheck(this,OptionalContentConfig),_classPrivateMethodInitSpec(this,_OptionalContentConfig_brand),_classPrivateFieldInitSpec(this,_cachedGetHash,null),_classPrivateFieldInitSpec(this,_groups,new Map),_classPrivateFieldInitSpec(this,_initialHash,null),_classPrivateFieldInitSpec(this,_order,null),this.renderingIntent=renderingIntent,this.name=null,(this.creator=null)!==data){this.name=data.name,this.creator=data.creator,_classPrivateFieldSet(_order,this,data.order);var _step67,_iterator67=_createForOfIteratorHelper(data.groups);try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var _group=_step67.value;_classPrivateFieldGet(_groups,this).set(_group.id,new OptionalContentGroup(renderingIntent,_group))}}catch(err){_iterator67.e(err)}finally{_iterator67.f()}if("OFF"===data.baseState){var _step68,_iterator68=_createForOfIteratorHelper(_classPrivateFieldGet(_groups,this).values());try{for(_iterator68.s();!(_step68=_iterator68.n()).done;)_step68.value._setVisible(INTERNAL,!1)}catch(err){_iterator68.e(err)}finally{_iterator68.f()}}var _step69,_iterator69=_createForOfIteratorHelper(data.on);try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var on=_step69.value;_classPrivateFieldGet(_groups,this).get(on)._setVisible(INTERNAL,!0)}}catch(err){_iterator69.e(err)}finally{_iterator69.f()}var _step70,_iterator70=_createForOfIteratorHelper(data.off);try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var off=_step70.value;_classPrivateFieldGet(_groups,this).get(off)._setVisible(INTERNAL,!1)}}catch(err){_iterator70.e(err)}finally{_iterator70.f()}_classPrivateFieldSet(_initialHash,this,this.getHash())}},[{key:"isVisible",value:function(group){if(0!==_classPrivateFieldGet(_groups,this).size)if(group){if("OCG"===group.type)return _classPrivateFieldGet(_groups,this).has(group.id)?_classPrivateFieldGet(_groups,this).get(group.id).visible:(warn("Optional content group not found: ".concat(group.id)),!0);if("OCMD"===group.type){if(group.expression)return _assertClassBrand(_OptionalContentConfig_brand,this,_evaluateVisibilityExpression).call(this,group.expression);if(!group.policy||"AnyOn"===group.policy){var _step71,_iterator71=_createForOfIteratorHelper(group.ids);try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){var id=_step71.value;if(!_classPrivateFieldGet(_groups,this).has(id))return warn("Optional content group not found: ".concat(id)),!0;if(_classPrivateFieldGet(_groups,this).get(id).visible)return!0}}catch(err){_iterator71.e(err)}finally{_iterator71.f()}return!1}if("AllOn"===group.policy){var _step72,_iterator72=_createForOfIteratorHelper(group.ids);try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){var _id4=_step72.value;if(!_classPrivateFieldGet(_groups,this).has(_id4))return warn("Optional content group not found: ".concat(_id4)),!0;if(!_classPrivateFieldGet(_groups,this).get(_id4).visible)return!1}}catch(err){_iterator72.e(err)}finally{_iterator72.f()}}else{if("AnyOff"===group.policy){var _step73,_iterator73=_createForOfIteratorHelper(group.ids);try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var _id5=_step73.value;if(!_classPrivateFieldGet(_groups,this).has(_id5))return warn("Optional content group not found: ".concat(_id5)),!0;if(!_classPrivateFieldGet(_groups,this).get(_id5).visible)return!0}}catch(err){_iterator73.e(err)}finally{_iterator73.f()}return!1}if("AllOff"===group.policy){var _step74,_iterator74=_createForOfIteratorHelper(group.ids);try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){var _id6=_step74.value;if(!_classPrivateFieldGet(_groups,this).has(_id6))return warn("Optional content group not found: ".concat(_id6)),!0;if(_classPrivateFieldGet(_groups,this).get(_id6).visible)return!1}}catch(err){_iterator74.e(err)}finally{_iterator74.f()}}else warn("Unknown optional content policy ".concat(group.policy,"."))}}else warn("Unknown group type ".concat(group.type,"."))}else info("Optional content group not defined.");return!0}},{key:"setVisibility",value:function(id){var visible=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],preserveRB=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],group=_classPrivateFieldGet(_groups,this).get(id);if(group){if(preserveRB&&visible&&group.rbGroups.length){var _step75,_iterator75=_createForOfIteratorHelper(group.rbGroups);try{for(_iterator75.s();!(_step75=_iterator75.n()).done;){var _step76,_iterator76=_createForOfIteratorHelper(_step75.value);try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){var _classPrivateFieldGet58,otherId=_step76.value;otherId!==id&&null!=(_classPrivateFieldGet58=_classPrivateFieldGet(_groups,this).get(otherId))&&_classPrivateFieldGet58._setVisible(INTERNAL,!1,!0)}}catch(err){_iterator76.e(err)}finally{_iterator76.f()}}}catch(err){_iterator75.e(err)}finally{_iterator75.f()}}group._setVisible(INTERNAL,!!visible,!0),_classPrivateFieldSet(_cachedGetHash,this,null)}else warn("Optional content group not found: ".concat(id))}},{key:"setOCGState",value:function(_ref36){var operator,_step77,state=_ref36.state,preserveRB=_ref36.preserveRB,_iterator77=_createForOfIteratorHelper(state);try{for(_iterator77.s();!(_step77=_iterator77.n()).done;){var elem=_step77.value;switch(elem){case"ON":case"OFF":case"Toggle":operator=elem;continue}var group=_classPrivateFieldGet(_groups,this).get(elem);if(group)switch(operator){case"ON":this.setVisibility(elem,!0,preserveRB);break;case"OFF":this.setVisibility(elem,!1,preserveRB);break;case"Toggle":this.setVisibility(elem,!group.visible,preserveRB)}}}catch(err){_iterator77.e(err)}finally{_iterator77.f()}_classPrivateFieldSet(_cachedGetHash,this,null)}},{key:"hasInitialVisibility",get:function(){return null===_classPrivateFieldGet(_initialHash,this)||this.getHash()===_classPrivateFieldGet(_initialHash,this)}},{key:"getOrder",value:function(){return _classPrivateFieldGet(_groups,this).size?_classPrivateFieldGet(_order,this)?_classPrivateFieldGet(_order,this).slice():babelHelpers.toConsumableArray(_classPrivateFieldGet(_groups,this).keys()):null}},{key:"getGroup",value:function(id){return _classPrivateFieldGet(_groups,this).get(id)||null}},{key:"getHash",value:function(){if(null!==_classPrivateFieldGet(_cachedGetHash,this))return _classPrivateFieldGet(_cachedGetHash,this);var _step78,hash=new MurmurHash3_64,_iterator78=_createForOfIteratorHelper(_classPrivateFieldGet(_groups,this));try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){var _step78$value=babelHelpers.slicedToArray(_step78.value,2),id=_step78$value[0],group=_step78$value[1];hash.update("".concat(id,":").concat(group.visible))}}catch(err){_iterator78.e(err)}finally{_iterator78.f()}return _classPrivateFieldSet(_cachedGetHash,this,hash.hexdigest())}},{key:Symbol.iterator,value:function(){return _classPrivateFieldGet(_groups,this).entries()}}])}();function _evaluateVisibilityExpression(array){var length=array.length;if(length<2)return!0;for(var operator=array[0],i=1;i<length;i++){var element=array[i],state=void 0;if(Array.isArray(element))state=_assertClassBrand(_OptionalContentConfig_brand,this,_evaluateVisibilityExpression).call(this,element);else{if(!_classPrivateFieldGet(_groups,this).has(element))return warn("Optional content group not found: ".concat(element)),!0;state=_classPrivateFieldGet(_groups,this).get(element).visible}switch(operator){case"And":if(state)break;return!1;case"Or":if(state)return!0;break;case"Not":return!state;default:return!0}}return"And"===operator}var PDFDataTransportStream=function(){return babelHelpers.createClass(function PDFDataTransportStream(pdfDataRangeTransport,_ref37){var _this33=this,_ref37$disableRange=_ref37.disableRange,_ref37$disableRange=void 0!==_ref37$disableRange&&_ref37$disableRange,_ref37=_ref37.disableStream,_ref37=void 0!==_ref37&&_ref37,length=(babelHelpers.classCallCheck(this,PDFDataTransportStream),assert(pdfDataRangeTransport,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),pdfDataRangeTransport.length),initialData=pdfDataRangeTransport.initialData,progressiveDone=pdfDataRangeTransport.progressiveDone,contentDispositionFilename=pdfDataRangeTransport.contentDispositionFilename;this._queuedChunks=[],this._progressiveDone=progressiveDone,this._contentDispositionFilename=contentDispositionFilename,0<(null==initialData?void 0:initialData.length)&&(progressiveDone=(initialData instanceof Uint8Array&&initialData.byteLength===initialData.buffer.byteLength?initialData:new Uint8Array(initialData)).buffer,this._queuedChunks.push(progressiveDone)),this._pdfDataRangeTransport=pdfDataRangeTransport,this._isStreamingSupported=!_ref37,this._isRangeSupported=!_ref37$disableRange,this._contentLength=length,this._fullRequestReader=null,this._rangeReaders=[],pdfDataRangeTransport.addRangeListener(function(begin,chunk){_this33._onReceiveData({begin:begin,chunk:chunk})}),pdfDataRangeTransport.addProgressListener(function(loaded,total){_this33._onProgress({loaded:loaded,total:total})}),pdfDataRangeTransport.addProgressiveReadListener(function(chunk){_this33._onReceiveData({chunk:chunk})}),pdfDataRangeTransport.addProgressiveDoneListener(function(){_this33._onProgressiveDone()}),pdfDataRangeTransport.transportReady()},[{key:"_onReceiveData",value:function(_ref38){var begin=_ref38.begin,_ref38=_ref38.chunk,buffer=(_ref38 instanceof Uint8Array&&_ref38.byteLength===_ref38.buffer.byteLength?_ref38:new Uint8Array(_ref38)).buffer;void 0===begin?this._fullRequestReader?this._fullRequestReader._enqueue(buffer):this._queuedChunks.push(buffer):assert(this._rangeReaders.some(function(rangeReader){return rangeReader._begin===begin&&(rangeReader._enqueue(buffer),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}},{key:"_progressiveDataLength",get:function(){var _this$_fullRequestRea2;return null!=(_this$_fullRequestRea2=null==(_this$_fullRequestRea2=this._fullRequestReader)?void 0:_this$_fullRequestRea2._loaded)?_this$_fullRequestRea2:0}},{key:"_onProgress",value:function(evt){var _this$_rangeReaders$;void 0===evt.total?null!=(_this$_rangeReaders$=this._rangeReaders[0])&&null!=_this$_rangeReaders$.onProgress&&_this$_rangeReaders$.onProgress({loaded:evt.loaded}):null!=(_this$_rangeReaders$=this._fullRequestReader)&&null!=_this$_rangeReaders$.onProgress&&_this$_rangeReaders$.onProgress({loaded:evt.loaded,total:evt.total})}},{key:"_onProgressiveDone",value:function(){var _this$_fullRequestRea4;null!=(_this$_fullRequestRea4=this._fullRequestReader)&&_this$_fullRequestRea4.progressiveDone(),this._progressiveDone=!0}},{key:"_removeRangeReader",value:function(reader){reader=this._rangeReaders.indexOf(reader);0<=reader&&this._rangeReaders.splice(reader,1)}},{key:"getFullReader",value:function(){assert(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");var queuedChunks=this._queuedChunks;return this._queuedChunks=null,new PDFDataTransportStreamReader(this,queuedChunks,this._progressiveDone,this._contentDispositionFilename)}},{key:"getRangeReader",value:function(begin,end){var reader;return end<=this._progressiveDataLength?null:(reader=new PDFDataTransportStreamRangeReader(this,begin,end),this._pdfDataRangeTransport.requestDataRange(begin,end),this._rangeReaders.push(reader),reader)}},{key:"cancelAllRequests",value:function(reason){null!=(_this$_fullRequestRea5=this._fullRequestReader)&&_this$_fullRequestRea5.cancel(reason);var _this$_fullRequestRea5,_step79,_iterator79=_createForOfIteratorHelper(this._rangeReaders.slice(0));try{for(_iterator79.s();!(_step79=_iterator79.n()).done;)_step79.value.cancel(reason)}catch(err){_iterator79.e(err)}finally{_iterator79.f()}this._pdfDataRangeTransport.abort()}}])}(),PDFDataTransportStreamReader=function(){return babelHelpers.createClass(function PDFDataTransportStreamReader(stream,queuedChunks){var _step80,progressiveDone=2<arguments.length&&void 0!==arguments[2]&&arguments[2],contentDispositionFilename=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,_iterator80=(babelHelpers.classCallCheck(this,PDFDataTransportStreamReader),this._stream=stream,this._done=progressiveDone||!1,this._filename=isPdfFile(contentDispositionFilename)?contentDispositionFilename:null,this._queuedChunks=queuedChunks||[],this._loaded=0,_createForOfIteratorHelper(this._queuedChunks));try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){var chunk=_step80.value;this._loaded+=chunk.byteLength}}catch(err){_iterator80.e(err)}finally{_iterator80.f()}this._requests=[],this._headersReady=Promise.resolve(),(stream._fullRequestReader=this).onProgress=null},[{key:"_enqueue",value:function(chunk){this._done||(0<this._requests.length?this._requests.shift().resolve({value:chunk,done:!1}):this._queuedChunks.push(chunk),this._loaded+=chunk.byteLength)}},{key:"headersReady",get:function(){return this._headersReady}},{key:"filename",get:function(){return this._filename}},{key:"isRangeSupported",get:function(){return this._stream._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._stream._isStreamingSupported}},{key:"contentLength",get:function(){return this._stream._contentLength}},{key:"read",value:async function(){var requestCapability;return 0<this._queuedChunks.length?{value:this._queuedChunks.shift(),done:!1}:this._done?{value:void 0,done:!0}:(requestCapability=Promise.withResolvers(),this._requests.push(requestCapability),requestCapability.promise)}},{key:"cancel",value:function(reason){this._done=!0;var _step81,_iterator81=_createForOfIteratorHelper(this._requests);try{for(_iterator81.s();!(_step81=_iterator81.n()).done;)_step81.value.resolve({value:void 0,done:!0})}catch(err){_iterator81.e(err)}finally{_iterator81.f()}this._requests.length=0}},{key:"progressiveDone",value:function(){this._done||(this._done=!0)}}])}(),PDFDataTransportStreamRangeReader=function(){return babelHelpers.createClass(function PDFDataTransportStreamRangeReader(stream,begin,end){babelHelpers.classCallCheck(this,PDFDataTransportStreamRangeReader),this._stream=stream,this._begin=begin,this._end=end,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null},[{key:"_enqueue",value:function(chunk){if(!this._done){if(0===this._requests.length)this._queuedChunk=chunk;else{this._requests.shift().resolve({value:chunk,done:!1});var _step82,_iterator82=_createForOfIteratorHelper(this._requests);try{for(_iterator82.s();!(_step82=_iterator82.n()).done;)_step82.value.resolve({value:void 0,done:!0})}catch(err){_iterator82.e(err)}finally{_iterator82.f()}this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}},{key:"isStreamingSupported",get:function(){return!1}},{key:"read",value:async function(){var chunk;return this._queuedChunk?(chunk=this._queuedChunk,this._queuedChunk=null,{value:chunk,done:!1}):this._done?{value:void 0,done:!0}:(chunk=Promise.withResolvers(),this._requests.push(chunk),chunk.promise)}},{key:"cancel",value:function(reason){this._done=!0;var _step83,_iterator83=_createForOfIteratorHelper(this._requests);try{for(_iterator83.s();!(_step83=_iterator83.n()).done;)_step83.value.resolve({value:void 0,done:!0})}catch(err){_iterator83.e(err)}finally{_iterator83.f()}this._requests.length=0,this._stream._removeRangeReader(this)}}])}();function getFilenameFromContentDispositionHeader(contentDisposition){var filename,needsEncodingFixup=!0,tmp=toParamRegExp("filename\\*","i").exec(contentDisposition);return tmp?(filename=rfc2616unquote(tmp=tmp[1]),fixupEncoding(filename=rfc2047decode(filename=rfc5987decode(filename=unescape(filename))))):(tmp=function(contentDispositionStr){var matches=[],iter=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(match=iter.exec(contentDispositionStr));){var match=babelHelpers.slicedToArray(match,4),n=match[1],quot=match[2],match=match[3];if((n=parseInt(n,10))in matches){if(0===n)break}else matches[n]=[quot,match]}for(var parts=[],_n=0;_n<matches.length&&_n in matches;++_n){var _matches$_n=babelHelpers.slicedToArray(matches[_n],2),_quot=_matches$_n[0],_matches$_n=_matches$_n[1];_matches$_n=rfc2616unquote(_matches$_n),_quot&&(_matches$_n=unescape(_matches$_n),0===_n)&&(_matches$_n=rfc5987decode(_matches$_n)),parts.push(_matches$_n)}return parts.join("")}(contentDisposition))?fixupEncoding(rfc2047decode(tmp)):(tmp=toParamRegExp("filename","i").exec(contentDisposition))?fixupEncoding(rfc2047decode(rfc2616unquote(tmp=tmp[1]))):"";function toParamRegExp(attributePattern,flags){return new RegExp("(?:^|;)\\s*"+attributePattern+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',flags)}function textdecode(encoding,value){if(encoding){if(!/^[\x00-\xFF]+$/.test(value))return value;try{var decoder=new TextDecoder(encoding,{fatal:!0}),buffer=stringToBytes(value);value=decoder.decode(buffer),needsEncodingFixup=!1}catch(_unused9){}}return value}function fixupEncoding(value){return value=needsEncodingFixup&&/[\x80-\xff]/.test(value)&&(value=textdecode("utf-8",value),needsEncodingFixup)?textdecode("iso-8859-1",value):value}function rfc2616unquote(value){if(value.startsWith('"')){for(var parts=value.slice(1).split('\\"'),i=0;i<parts.length;++i){var quotindex=parts[i].indexOf('"');-1!==quotindex&&(parts[i]=parts[i].slice(0,quotindex),parts.length=i+1),parts[i]=parts[i].replaceAll(/\\(.)/g,"$1")}value=parts.join('"')}return value}function rfc5987decode(extvalue){var encodingend=extvalue.indexOf("'");return-1===encodingend?extvalue:textdecode(extvalue.slice(0,encodingend),extvalue.slice(encodingend+1).replace(/^[^']*'/,""))}function rfc2047decode(value){return!value.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(value)?value:value.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(matches,charset,encoding,text){if("q"===encoding||"Q"===encoding)return textdecode(charset,text=(text=text.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(match,hex){return String.fromCharCode(parseInt(hex,16))}));try{text=atob(text)}catch(_unused0){}return textdecode(charset,text)})}}function createHeaders(isHttp,httpHeaders){var headers=new Headers;if(isHttp&&httpHeaders&&"object"==typeof httpHeaders)for(var key in httpHeaders){var val=httpHeaders[key];void 0!==val&&headers.append(key,val)}return headers}function getResponseOrigin(url){return null!=(url=null==(url=URL.parse(url))?void 0:url.origin)?url:null}function validateRangeRequestCapabilities(_ref39){var responseHeaders=_ref39.responseHeaders,isHttp=_ref39.isHttp,rangeChunkSize=_ref39.rangeChunkSize,_ref39=_ref39.disableRange,returnValues={allowRangeRequests:!1,suggestedLength:void 0},length=parseInt(responseHeaders.get("Content-Length"),10);return!Number.isInteger(length)||(returnValues.suggestedLength=length)<=2*rangeChunkSize||!_ref39&&isHttp&&"bytes"===responseHeaders.get("Accept-Ranges")&&"identity"===(responseHeaders.get("Content-Encoding")||"identity")&&(returnValues.allowRangeRequests=!0),returnValues}function extractFilenameFromHeader(responseHeaders){responseHeaders=responseHeaders.get("Content-Disposition");if(responseHeaders){responseHeaders=getFilenameFromContentDispositionHeader(responseHeaders);if(responseHeaders.includes("%"))try{responseHeaders=decodeURIComponent(responseHeaders)}catch(_unused1){}if(isPdfFile(responseHeaders))return responseHeaders}return null}function createResponseError(status,url){return new ResponseException("Unexpected server response (".concat(status,') while retrieving PDF "').concat(url,'".'),status,404===status||0===status&&url.startsWith("file:"))}function validateResponseStatus(status){return 200===status||206===status}function createFetchOptions(headers,withCredentials,abortController){return{method:"GET",headers:headers,signal:abortController.signal,mode:"cors",credentials:withCredentials?"include":"same-origin",redirect:"follow"}}function getArrayBuffer(val){return val instanceof Uint8Array?val.buffer:val instanceof ArrayBuffer?val:(warn("getArrayBuffer - unexpected data format: ".concat(val)),new Uint8Array(val).buffer)}var PDFFetchStream=function(){return babelHelpers.createClass(function PDFFetchStream(source){babelHelpers.classCallCheck(this,PDFFetchStream),babelHelpers.defineProperty(this,"_responseOrigin",null),this.source=source,this.isHttp=/^https?:/i.test(source.url),this.headers=createHeaders(this.isHttp,source.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]},[{key:"_progressiveDataLength",get:function(){var _this$_fullRequestRea7;return null!=(_this$_fullRequestRea7=null==(_this$_fullRequestRea7=this._fullRequestReader)?void 0:_this$_fullRequestRea7._loaded)?_this$_fullRequestRea7:0}},{key:"getFullReader",value:function(){return assert(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new PDFFetchStreamReader(this),this._fullRequestReader}},{key:"getRangeReader",value:function(begin,end){return end<=this._progressiveDataLength?null:(begin=new PDFFetchStreamRangeReader(this,begin,end),this._rangeRequestReaders.push(begin),begin)}},{key:"cancelAllRequests",value:function(reason){null!=(_this$_fullRequestRea8=this._fullRequestReader)&&_this$_fullRequestRea8.cancel(reason);var _this$_fullRequestRea8,_step84,_iterator84=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(_iterator84.s();!(_step84=_iterator84.n()).done;)_step84.value.cancel(reason)}catch(err){_iterator84.e(err)}finally{_iterator84.f()}}}])}(),PDFFetchStreamReader=function(){return babelHelpers.createClass(function PDFFetchStreamReader(stream){var _this34=this,source=(babelHelpers.classCallCheck(this,PDFFetchStreamReader),this._stream=stream,this._reader=null,this._loaded=0,this._filename=null,stream.source),headers=(this._withCredentials=source.withCredentials||!1,this._contentLength=source.length,this._headersCapability=Promise.withResolvers(),this._disableRange=source.disableRange||!1,this._rangeChunkSize=source.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!source.disableStream,this._isRangeSupported=!source.disableRange,new Headers(stream.headers)),url=source.url;fetch(url,createFetchOptions(headers,this._withCredentials,this._abortController)).then(function(response){if(stream._responseOrigin=getResponseOrigin(response.url),!validateResponseStatus(response.status))throw createResponseError(response.status,url);_this34._reader=response.body.getReader(),_this34._headersCapability.resolve();var response=response.headers,allowRangeRequests=(_validateRangeRequest=validateRangeRequestCapabilities({responseHeaders:response,isHttp:stream.isHttp,rangeChunkSize:_this34._rangeChunkSize,disableRange:_this34._disableRange})).allowRangeRequests,_validateRangeRequest=_validateRangeRequest.suggestedLength;_this34._isRangeSupported=allowRangeRequests,_this34._contentLength=_validateRangeRequest||_this34._contentLength,_this34._filename=extractFilenameFromHeader(response),!_this34._isStreamingSupported&&_this34._isRangeSupported&&_this34.cancel(new AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null},[{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:async function(){await this._headersCapability.promise;var _await$this$_reader$r=await this._reader.read(),value=_await$this$_reader$r.value,_await$this$_reader$r=_await$this$_reader$r.done;return _await$this$_reader$r?{value:value,done:_await$this$_reader$r}:(this._loaded+=value.byteLength,null!=(_await$this$_reader$r=this.onProgress)&&_await$this$_reader$r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:getArrayBuffer(value),done:!1})}},{key:"cancel",value:function(reason){var _this$_reader;null!=(_this$_reader=this._reader)&&_this$_reader.cancel(reason),this._abortController.abort()}}])}(),PDFFetchStreamRangeReader=function(){return babelHelpers.createClass(function PDFFetchStreamRangeReader(stream,begin,end){var _this35=this,source=(babelHelpers.classCallCheck(this,PDFFetchStreamRangeReader),this._stream=stream,this._reader=null,this._loaded=0,stream.source),headers=(this._withCredentials=source.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!source.disableStream,this._abortController=new AbortController,new Headers(stream.headers)),url=(headers.append("Range","bytes=".concat(begin,"-").concat(end-1)),source.url);fetch(url,createFetchOptions(headers,this._withCredentials,this._abortController)).then(function(response){var responseOrigin=getResponseOrigin(response.url);if(responseOrigin!==stream._responseOrigin)throw new Error('Expected range response-origin "'.concat(responseOrigin,'" to match "').concat(stream._responseOrigin,'".'));if(!validateResponseStatus(response.status))throw createResponseError(response.status,url);_this35._readCapability.resolve(),_this35._reader=response.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null},[{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:async function(){await this._readCapability.promise;var _await$this$_reader$r2=await this._reader.read(),value=_await$this$_reader$r2.value,_await$this$_reader$r2=_await$this$_reader$r2.done;return _await$this$_reader$r2?{value:value,done:_await$this$_reader$r2}:(this._loaded+=value.byteLength,null!=(_await$this$_reader$r2=this.onProgress)&&_await$this$_reader$r2.call(this,{loaded:this._loaded}),{value:getArrayBuffer(value),done:!1})}},{key:"cancel",value:function(reason){var _this$_reader2;null!=(_this$_reader2=this._reader)&&_this$_reader2.cancel(reason),this._abortController.abort()}}])}();var NetworkManager=function(){return babelHelpers.createClass(function NetworkManager(_ref40){var url=_ref40.url,httpHeaders=_ref40.httpHeaders,_ref40=_ref40.withCredentials;babelHelpers.classCallCheck(this,NetworkManager),babelHelpers.defineProperty(this,"_responseOrigin",null),this.url=url,this.isHttp=/^https?:/i.test(url),this.headers=createHeaders(this.isHttp,httpHeaders),this.withCredentials=_ref40||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)},[{key:"request",value:function(args){var _step85,xhr=new XMLHttpRequest,xhrId=this.currXhrId++,pendingRequest=this.pendingRequests[xhrId]={xhr:xhr},_iterator85=(xhr.open("GET",this.url),xhr.withCredentials=this.withCredentials,_createForOfIteratorHelper(this.headers));try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){var _step85$value=babelHelpers.slicedToArray(_step85.value,2),key=_step85$value[0],val=_step85$value[1];xhr.setRequestHeader(key,val)}}catch(err){_iterator85.e(err)}finally{_iterator85.f()}return this.isHttp&&"begin"in args&&"end"in args?(xhr.setRequestHeader("Range","bytes=".concat(args.begin,"-").concat(args.end-1)),pendingRequest.expectedStatus=206):pendingRequest.expectedStatus=200,xhr.responseType="arraybuffer",assert(args.onError,"Expected `onError` callback to be provided."),xhr.onerror=function(){args.onError(xhr.status)},xhr.onreadystatechange=this.onStateChange.bind(this,xhrId),xhr.onprogress=this.onProgress.bind(this,xhrId),pendingRequest.onHeadersReceived=args.onHeadersReceived,pendingRequest.onDone=args.onDone,pendingRequest.onError=args.onError,pendingRequest.onProgress=args.onProgress,xhr.send(null),xhrId}},{key:"onProgress",value:function(xhrId,evt){xhrId=this.pendingRequests[xhrId];xhrId&&null!=xhrId.onProgress&&xhrId.onProgress(evt)}},{key:"onStateChange",value:function(xhrId,evt){var xhr,chunk,pendingRequest=this.pendingRequests[xhrId];pendingRequest&&(2<=(xhr=pendingRequest.xhr).readyState&&pendingRequest.onHeadersReceived&&(pendingRequest.onHeadersReceived(),delete pendingRequest.onHeadersReceived),4===xhr.readyState)&&xhrId in this.pendingRequests&&(delete this.pendingRequests[xhrId],(0!==xhr.status||!this.isHttp)&&(200===(xhrId=xhr.status||200)&&206===pendingRequest.expectedStatus||xhrId===pendingRequest.expectedStatus)?(chunk=function(xhr){return"string"!=typeof(xhr=xhr.response)?xhr:stringToBytes(xhr).buffer}(xhr),206===xhrId?(xhrId=xhr.getResponseHeader("Content-Range"),(xhrId=/bytes (\d+)-(\d+)\/(\d+)/.exec(xhrId))?pendingRequest.onDone({begin:parseInt(xhrId[1],10),chunk:chunk}):(warn('Missing or invalid "Content-Range" header.'),pendingRequest.onError(0))):chunk?pendingRequest.onDone({begin:0,chunk:chunk}):pendingRequest.onError(xhr.status)):pendingRequest.onError(xhr.status))}},{key:"getRequestXhr",value:function(xhrId){return this.pendingRequests[xhrId].xhr}},{key:"isPendingRequest",value:function(xhrId){return xhrId in this.pendingRequests}},{key:"abortRequest",value:function(xhrId){var xhr=this.pendingRequests[xhrId].xhr;delete this.pendingRequests[xhrId],xhr.abort()}}])}(),PDFNetworkStream=function(){return babelHelpers.createClass(function PDFNetworkStream(source){babelHelpers.classCallCheck(this,PDFNetworkStream),this._source=source,this._manager=new NetworkManager(source),this._rangeChunkSize=source.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]},[{key:"_onRangeRequestReaderClosed",value:function(reader){reader=this._rangeRequestReaders.indexOf(reader);0<=reader&&this._rangeRequestReaders.splice(reader,1)}},{key:"getFullReader",value:function(){return assert(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new PDFNetworkStreamFullRequestReader(this._manager,this._source),this._fullRequestReader}},{key:"getRangeReader",value:function(begin,end){begin=new PDFNetworkStreamRangeRequestReader(this._manager,begin,end);return begin.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(begin),begin}},{key:"cancelAllRequests",value:function(reason){null!=(_this$_fullRequestRea9=this._fullRequestReader)&&_this$_fullRequestRea9.cancel(reason);var _this$_fullRequestRea9,_step86,_iterator86=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(_iterator86.s();!(_step86=_iterator86.n()).done;)_step86.value.cancel(reason)}catch(err){_iterator86.e(err)}finally{_iterator86.f()}}}])}(),PDFNetworkStreamFullRequestReader=function(){return babelHelpers.createClass(function PDFNetworkStreamFullRequestReader(manager,source){babelHelpers.classCallCheck(this,PDFNetworkStreamFullRequestReader),this._manager=manager,this._url=source.url,this._fullRequestId=manager.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=source.disableRange||!1,this._contentLength=source.length,this._rangeChunkSize=source.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},[{key:"_onHeadersReceived",value:function(){var fullRequestXhrId=this._fullRequestId,fullRequestXhr=this._manager.getRequestXhr(fullRequestXhrId),fullRequestXhr=(this._manager._responseOrigin=getResponseOrigin(fullRequestXhr.responseURL),fullRequestXhr.getAllResponseHeaders()),fullRequestXhr=new Headers(fullRequestXhr?fullRequestXhr.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(function(x){x=x.split(": "),x=babelHelpers.toArray(x);return[x[0],x.slice(1).join(": ")]}):[]),_validateRangeRequest2=validateRangeRequestCapabilities({responseHeaders:fullRequestXhr,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),allowRangeRequests=_validateRangeRequest2.allowRangeRequests,_validateRangeRequest2=_validateRangeRequest2.suggestedLength;allowRangeRequests&&(this._isRangeSupported=!0),this._contentLength=_validateRangeRequest2||this._contentLength,this._filename=extractFilenameFromHeader(fullRequestXhr),this._isRangeSupported&&this._manager.abortRequest(fullRequestXhrId),this._headersCapability.resolve()}},{key:"_onDone",value:function(data){if(data&&(0<this._requests.length?this._requests.shift().resolve({value:data.chunk,done:!1}):this._cachedChunks.push(data.chunk)),this._done=!0,!(0<this._cachedChunks.length)){var _step87,_iterator87=_createForOfIteratorHelper(this._requests);try{for(_iterator87.s();!(_step87=_iterator87.n()).done;)_step87.value.resolve({value:void 0,done:!0})}catch(err){_iterator87.e(err)}finally{_iterator87.f()}this._requests.length=0}}},{key:"_onError",value:function(status){this._storedError=createResponseError(status,this._url),this._headersCapability.reject(this._storedError);var _step88,_iterator88=_createForOfIteratorHelper(this._requests);try{for(_iterator88.s();!(_step88=_iterator88.n()).done;)_step88.value.reject(this._storedError)}catch(err){_iterator88.e(err)}finally{_iterator88.f()}this._requests.length=0,this._cachedChunks.length=0}},{key:"_onProgress",value:function(evt){var _this$onProgress3;null!=(_this$onProgress3=this.onProgress)&&_this$onProgress3.call(this,{loaded:evt.loaded,total:evt.lengthComputable?evt.total:this._contentLength})}},{key:"filename",get:function(){return this._filename}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"contentLength",get:function(){return this._contentLength}},{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"read",value:async function(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;var requestCapability;return 0<this._cachedChunks.length?{value:this._cachedChunks.shift(),done:!1}:this._done?{value:void 0,done:!0}:(requestCapability=Promise.withResolvers(),this._requests.push(requestCapability),requestCapability.promise)}},{key:"cancel",value:function(reason){this._done=!0,this._headersCapability.reject(reason);var _step89,_iterator89=_createForOfIteratorHelper(this._requests);try{for(_iterator89.s();!(_step89=_iterator89.n()).done;)_step89.value.resolve({value:void 0,done:!0})}catch(err){_iterator89.e(err)}finally{_iterator89.f()}this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}])}(),PDFNetworkStreamRangeRequestReader=function(){return babelHelpers.createClass(function PDFNetworkStreamRangeRequestReader(manager,begin,end){babelHelpers.classCallCheck(this,PDFNetworkStreamRangeRequestReader),this._manager=manager,this._url=manager.url,this._requestId=manager.request({begin:begin,end:end,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null},[{key:"_onHeadersReceived",value:function(){var _this$_manager$getReq=getResponseOrigin(null==(_this$_manager$getReq=this._manager.getRequestXhr(this._requestId))?void 0:_this$_manager$getReq.responseURL);_this$_manager$getReq!==this._manager._responseOrigin&&(this._storedError=new Error('Expected range response-origin "'.concat(_this$_manager$getReq,'" to match "').concat(this._manager._responseOrigin,'".')),this._onError(0))}},{key:"_close",value:function(){var _this$onClosed;null!=(_this$onClosed=this.onClosed)&&_this$onClosed.call(this,this)}},{key:"_onDone",value:function(data){var _step90,data=data.chunk,_iterator90=(0<this._requests.length?this._requests.shift().resolve({value:data,done:!1}):this._queuedChunk=data,this._done=!0,_createForOfIteratorHelper(this._requests));try{for(_iterator90.s();!(_step90=_iterator90.n()).done;)_step90.value.resolve({value:void 0,done:!0})}catch(err){_iterator90.e(err)}finally{_iterator90.f()}this._requests.length=0,this._close()}},{key:"_onError",value:function(status){null==this._storedError&&(this._storedError=createResponseError(status,this._url));var _step91,_iterator91=_createForOfIteratorHelper(this._requests);try{for(_iterator91.s();!(_step91=_iterator91.n()).done;)_step91.value.reject(this._storedError)}catch(err){_iterator91.e(err)}finally{_iterator91.f()}this._requests.length=0,this._queuedChunk=null}},{key:"_onProgress",value:function(evt){var _this$onProgress4;this.isStreamingSupported||null!=(_this$onProgress4=this.onProgress)&&_this$onProgress4.call(this,{loaded:evt.loaded})}},{key:"isStreamingSupported",get:function(){return!1}},{key:"read",value:async function(){if(this._storedError)throw this._storedError;var chunk;return null!==this._queuedChunk?(chunk=this._queuedChunk,this._queuedChunk=null,{value:chunk,done:!1}):this._done?{value:void 0,done:!0}:(chunk=Promise.withResolvers(),this._requests.push(chunk),chunk.promise)}},{key:"cancel",value:function(reason){this._done=!0;var _step92,_iterator92=_createForOfIteratorHelper(this._requests);try{for(_iterator92.s();!(_step92=_iterator92.n()).done;)_step92.value.resolve({value:void 0,done:!0})}catch(err){_iterator92.e(err)}finally{_iterator92.f()}this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}])}(),urlRegex=/^[a-z][a-z0-9\-+.]+:/i;var PDFNodeStream=function(){return babelHelpers.createClass(function PDFNodeStream(source){var url;babelHelpers.classCallCheck(this,PDFNodeStream),this.source=source,this.url=(source=source.url,urlRegex.test(source)?new URL(source):(url=process.getBuiltinModule("url"),new URL(url.pathToFileURL(source)))),assert("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]},[{key:"_progressiveDataLength",get:function(){var _this$_fullRequestRea1;return null!=(_this$_fullRequestRea1=null==(_this$_fullRequestRea1=this._fullRequestReader)?void 0:_this$_fullRequestRea1._loaded)?_this$_fullRequestRea1:0}},{key:"getFullReader",value:function(){return assert(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new PDFNodeStreamFsFullReader(this),this._fullRequestReader}},{key:"getRangeReader",value:function(start,end){return end<=this._progressiveDataLength?null:(start=new PDFNodeStreamFsRangeReader(this,start,end),this._rangeRequestReaders.push(start),start)}},{key:"cancelAllRequests",value:function(reason){null!=(_this$_fullRequestRea10=this._fullRequestReader)&&_this$_fullRequestRea10.cancel(reason);var _this$_fullRequestRea10,_step93,_iterator93=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(_iterator93.s();!(_step93=_iterator93.n()).done;)_step93.value.cancel(reason)}catch(err){_iterator93.e(err)}finally{_iterator93.f()}}}])}(),PDFNodeStreamFsFullReader=function(){return babelHelpers.createClass(function PDFNodeStreamFsFullReader(stream){var _this36=this,stream=(babelHelpers.classCallCheck(this,PDFNodeStreamFsFullReader),this._url=stream.url,this._done=!1,this._storedError=null,this.onProgress=null,stream.source),fs=(this._contentLength=stream.length,this._loaded=0,this._filename=null,this._disableRange=stream.disableRange||!1,this._rangeChunkSize=stream.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!stream.disableStream,this._isRangeSupported=!stream.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers(),process.getBuiltinModule("fs"));fs.promises.lstat(this._url).then(function(stat){_this36._contentLength=stat.size,_this36._setReadableStream(fs.createReadStream(_this36._url)),_this36._headersCapability.resolve()},function(error){"ENOENT"===error.code&&(error=createResponseError(0,_this36._url.href)),_this36._storedError=error,_this36._headersCapability.reject(error)})},[{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:async function(){var _this$onProgress5;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;var chunk=this._readableStream.read();return null===chunk?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=chunk.length,null!=(_this$onProgress5=this.onProgress)&&_this$onProgress5.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(chunk).buffer,done:!1})}},{key:"cancel",value:function(reason){this._readableStream?this._readableStream.destroy(reason):this._error(reason)}},{key:"_error",value:function(reason){this._storedError=reason,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(readableStream){var _this37=this;(this._readableStream=readableStream).on("readable",function(){_this37._readCapability.resolve()}),readableStream.on("end",function(){readableStream.destroy(),_this37._done=!0,_this37._readCapability.resolve()}),readableStream.on("error",function(reason){_this37._error(reason)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}])}(),PDFNodeStreamFsRangeReader=function(){return babelHelpers.createClass(function PDFNodeStreamFsRangeReader(stream,start,end){babelHelpers.classCallCheck(this,PDFNodeStreamFsRangeReader),this._url=stream.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();stream=stream.source,this._isStreamingSupported=!stream.disableStream,stream=process.getBuiltinModule("fs");this._setReadableStream(stream.createReadStream(this._url,{start:start,end:end-1}))},[{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:async function(){var _this$onProgress6;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;var chunk=this._readableStream.read();return null===chunk?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=chunk.length,null!=(_this$onProgress6=this.onProgress)&&_this$onProgress6.call(this,{loaded:this._loaded}),{value:new Uint8Array(chunk).buffer,done:!1})}},{key:"cancel",value:function(reason){this._readableStream?this._readableStream.destroy(reason):this._error(reason)}},{key:"_error",value:function(reason){this._storedError=reason,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(readableStream){var _this38=this;(this._readableStream=readableStream).on("readable",function(){_this38._readCapability.resolve()}),readableStream.on("end",function(){readableStream.destroy(),_this38._done=!0,_this38._readCapability.resolve()}),readableStream.on("error",function(reason){_this38._error(reason)}),this._storedError&&this._readableStream.destroy(this._storedError)}}])}(),INITIAL_DATA=Symbol("INITIAL_DATA"),_objs=new WeakMap,_PDFObjects_brand=new WeakSet,PDFObjects=function(){return babelHelpers.createClass(function PDFObjects(){babelHelpers.classCallCheck(this,PDFObjects),_classPrivateMethodInitSpec(this,_PDFObjects_brand),_classPrivateFieldInitSpec(this,_objs,Object.create(null))},[{key:"get",value:function(objId){var _obj,callback=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(callback)return(_obj=_assertClassBrand(_PDFObjects_brand,this,_ensureObj).call(this,objId)).promise.then(function(){return callback(_obj.data)}),null;var obj=_classPrivateFieldGet(_objs,this)[objId];if(obj&&obj.data!==INITIAL_DATA)return obj.data;throw new Error("Requesting object that isn't resolved yet ".concat(objId,"."))}},{key:"has",value:function(objId){objId=_classPrivateFieldGet(_objs,this)[objId];return!!objId&&objId.data!==INITIAL_DATA}},{key:"delete",value:function(objId){var obj=_classPrivateFieldGet(_objs,this)[objId];return!(!obj||obj.data===INITIAL_DATA||(delete _classPrivateFieldGet(_objs,this)[objId],0))}},{key:"resolve",value:function(objId){var data=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,obj=_assertClassBrand(_PDFObjects_brand,this,_ensureObj).call(this,objId);obj.data=data,obj.resolve()}},{key:"clear",value:function(){for(var objId in _classPrivateFieldGet(_objs,this)){var objId=_classPrivateFieldGet(_objs,this)[objId].data;null!=objId&&null!=(objId=objId.bitmap)&&objId.close()}_classPrivateFieldSet(_objs,this,Object.create(null))}},{key:Symbol.iterator,value:function*(){for(var objId in _classPrivateFieldGet(_objs,this)){var data=_classPrivateFieldGet(_objs,this)[objId].data;data!==INITIAL_DATA&&(yield[objId,data])}}}])}();function _ensureObj(objId){var _classPrivateFieldGet157;return(_classPrivateFieldGet157=_classPrivateFieldGet(_objs,this))[objId]||(_classPrivateFieldGet157[objId]=_objectSpread({},Promise.withResolvers(),{data:INITIAL_DATA}))}var MAX_TEXT_DIVS_TO_RENDER=1e5,DEFAULT_FONT_SIZE=30,_capability=new WeakMap,_container4=new WeakMap,_disableProcessItems=new WeakMap,_fontInspectorEnabled=new WeakMap,_lang=new WeakMap,_layoutTextParams=new WeakMap,_pageHeight3=new WeakMap,_pageWidth3=new WeakMap,_reader=new WeakMap,_rootContainer=new WeakMap,_rotation3=new WeakMap,_scale3=new WeakMap,_styleCache=new WeakMap,_textContentItemsStr=new WeakMap,_textContentSource=new WeakMap,_textDivs=new WeakMap,_textDivProperties=new WeakMap,_transform=new WeakMap,_TextLayer_brand=new WeakSet,TextLayer=_exports.TextLayer=function(){function TextLayer(_ref41){var _this39=this,textContentSource=_ref41.textContentSource,container=_ref41.container,_ref41=_ref41.viewport;if(babelHelpers.classCallCheck(this,TextLayer),_classPrivateMethodInitSpec(this,_TextLayer_brand),_classPrivateFieldInitSpec(this,_capability,Promise.withResolvers()),_classPrivateFieldInitSpec(this,_container4,null),_classPrivateFieldInitSpec(this,_disableProcessItems,!1),_classPrivateFieldInitSpec(this,_fontInspectorEnabled,!(null==(_globalThis$FontInspe=globalThis.FontInspector)||!_globalThis$FontInspe.enabled)),_classPrivateFieldInitSpec(this,_lang,null),_classPrivateFieldInitSpec(this,_layoutTextParams,null),_classPrivateFieldInitSpec(this,_pageHeight3,0),_classPrivateFieldInitSpec(this,_pageWidth3,0),_classPrivateFieldInitSpec(this,_reader,null),_classPrivateFieldInitSpec(this,_rootContainer,null),_classPrivateFieldInitSpec(this,_rotation3,0),_classPrivateFieldInitSpec(this,_scale3,0),_classPrivateFieldInitSpec(this,_styleCache,Object.create(null)),_classPrivateFieldInitSpec(this,_textContentItemsStr,[]),_classPrivateFieldInitSpec(this,_textContentSource,null),_classPrivateFieldInitSpec(this,_textDivs,[]),_classPrivateFieldInitSpec(this,_textDivProperties,new WeakMap),_classPrivateFieldInitSpec(this,_transform,null),textContentSource instanceof ReadableStream)_classPrivateFieldSet(_textContentSource,this,textContentSource);else{if("object"!=typeof textContentSource)throw new Error('No "textContentSource" parameter specified.');_classPrivateFieldSet(_textContentSource,this,new ReadableStream({start:function(controller){controller.enqueue(textContentSource),controller.close()}}))}_classPrivateFieldSet(_container4,this,_classPrivateFieldSet(_rootContainer,this,container)),_classPrivateFieldSet(_scale3,this,_ref41.scale*OutputScale.pixelRatio),_classPrivateFieldSet(_rotation3,this,_ref41.rotation),_classPrivateFieldSet(_layoutTextParams,this,{div:null,properties:null,ctx:null});var _globalThis$FontInspe=_ref41.rawDims,pageWidth=_globalThis$FontInspe.pageWidth,pageHeight=_globalThis$FontInspe.pageHeight,pageX=_globalThis$FontInspe.pageX,_globalThis$FontInspe=_globalThis$FontInspe.pageY;_classPrivateFieldSet(_transform,this,[1,0,0,-1,-pageX,_globalThis$FontInspe+pageHeight]),_classPrivateFieldSet(_pageWidth3,this,pageWidth),_classPrivateFieldSet(_pageHeight3,this,pageHeight),function(){var div;null===_assertClassBrand(_TextLayer,this,_minFontSize)._&&((div=document.createElement("div")).style.opacity=0,div.style.lineHeight=1,div.style.fontSize="1px",div.style.position="absolute",div.textContent="X",document.body.append(div),_minFontSize._=_assertClassBrand(_TextLayer,this,div.getBoundingClientRect().height),div.remove())}.call(TextLayer),setLayerDimensions(container,_ref41),_classPrivateFieldGet(_capability,this).promise.finally(function(){_pendingTextLayers._.delete(_this39),_classPrivateFieldSet(_layoutTextParams,_this39,null),_classPrivateFieldSet(_styleCache,_this39,null)}).catch(function(){})}return babelHelpers.createClass(TextLayer,[{key:"render",value:function(){var _this40=this,pump=function(){_classPrivateFieldGet(_reader,_this40).read().then(function(_ref42){var value=_ref42.value;_ref42.done?_classPrivateFieldGet(_capability,_this40).resolve():(null==_classPrivateFieldGet(_lang,_this40)&&_classPrivateFieldSet(_lang,_this40,value.lang),Object.assign(_classPrivateFieldGet(_styleCache,_this40),value.styles),_assertClassBrand(_TextLayer_brand,_this40,_processItems).call(_this40,value.items),pump())},_classPrivateFieldGet(_capability,_this40).reject)};return _classPrivateFieldSet(_reader,this,_classPrivateFieldGet(_textContentSource,this).getReader()),_pendingTextLayers._.add(this),pump(),_classPrivateFieldGet(_capability,this).promise}},{key:"update",value:function(_ref43){var viewport=_ref43.viewport,_ref43=_ref43.onBefore,_ref43=void 0===_ref43?null:_ref43,scale=viewport.scale*OutputScale.pixelRatio,viewport=viewport.rotation;if(viewport!==_classPrivateFieldGet(_rotation3,this)&&(null!=_ref43&&_ref43(),_classPrivateFieldSet(_rotation3,this,viewport),setLayerDimensions(_classPrivateFieldGet(_rootContainer,this),{rotation:viewport})),scale!==_classPrivateFieldGet(_scale3,this)){null!=_ref43&&_ref43(),_classPrivateFieldSet(_scale3,this,scale);var _step94,params={div:null,properties:null,ctx:_getCtx.call(TextLayer,_classPrivateFieldGet(_lang,this))},_iterator94=_createForOfIteratorHelper(_classPrivateFieldGet(_textDivs,this));try{for(_iterator94.s();!(_step94=_iterator94.n()).done;){var div=_step94.value;params.properties=_classPrivateFieldGet(_textDivProperties,this).get(div),params.div=div,_assertClassBrand(_TextLayer_brand,this,_layout).call(this,params)}}catch(err){_iterator94.e(err)}finally{_iterator94.f()}}}},{key:"cancel",value:function(){var _classPrivateFieldGet60,abortEx=new AbortException("TextLayer task cancelled.");null!=(_classPrivateFieldGet60=_classPrivateFieldGet(_reader,this))&&_classPrivateFieldGet60.cancel(abortEx).catch(function(){}),_classPrivateFieldSet(_reader,this,null),_classPrivateFieldGet(_capability,this).reject(abortEx)}},{key:"textDivs",get:function(){return _classPrivateFieldGet(_textDivs,this)}},{key:"textContentItemsStr",get:function(){return _classPrivateFieldGet(_textContentItemsStr,this)}}],[{key:"fontFamilyMap",get:function(){var _util_FeatureTest$pla=util_FeatureTest.platform,isWindows=_util_FeatureTest$pla.isWindows,_util_FeatureTest$pla=_util_FeatureTest$pla.isFirefox;return shadow(this,"fontFamilyMap",new Map([["sans-serif","".concat(isWindows&&_util_FeatureTest$pla?"Calibri, ":"","sans-serif")],["monospace","".concat(isWindows&&_util_FeatureTest$pla?"Lucida Console, ":"","monospace")]]))}},{key:"cleanup",value:function(){if(!(0<_assertClassBrand(TextLayer,this,_pendingTextLayers)._.size)){_assertClassBrand(TextLayer,this,_ascentCache)._.clear();var _step95,_iterator95=_createForOfIteratorHelper(_assertClassBrand(TextLayer,this,_canvasContexts)._.values());try{for(_iterator95.s();!(_step95=_iterator95.n()).done;)_step95.value.canvas.remove()}catch(err){_iterator95.e(err)}finally{_iterator95.f()}_assertClassBrand(TextLayer,this,_canvasContexts)._.clear()}}}])}();function _processItems(items){var _classPrivateFieldGet158;if(!_classPrivateFieldGet(_disableProcessItems,this)){null!=(_classPrivateFieldGet158=_classPrivateFieldGet(_layoutTextParams,this)).ctx||(_classPrivateFieldGet158.ctx=_getCtx.call(_TextLayer,_classPrivateFieldGet(_lang,this)));var _step183,textDivs=_classPrivateFieldGet(_textDivs,this),textContentItemsStr=_classPrivateFieldGet(_textContentItemsStr,this),_iterator183=_createForOfIteratorHelper(items);try{for(_iterator183.s();!(_step183=_iterator183.n()).done;){var parent,item=_step183.value;if(textDivs.length>MAX_TEXT_DIVS_TO_RENDER)return warn("Ignoring additional textDivs for performance reasons."),void _classPrivateFieldSet(_disableProcessItems,this,!0);void 0===item.str?"beginMarkedContentProps"===item.type||"beginMarkedContent"===item.type?(parent=_classPrivateFieldGet(_container4,this),_classPrivateFieldSet(_container4,this,document.createElement("span")),_classPrivateFieldGet(_container4,this).classList.add("markedContent"),null!==item.id&&_classPrivateFieldGet(_container4,this).setAttribute("id","".concat(item.id)),parent.append(_classPrivateFieldGet(_container4,this))):"endMarkedContent"===item.type&&_classPrivateFieldSet(_container4,this,_classPrivateFieldGet(_container4,this).parentNode):(textContentItemsStr.push(item.str),_assertClassBrand(_TextLayer_brand,this,_appendText).call(this,item))}}catch(err){_iterator183.e(err)}finally{_iterator183.f()}}}function _appendText(geom){var textDiv=document.createElement("span"),textDivProperties={angle:0,canvasWidth:0,hasText:""!==geom.str,hasEOL:geom.hasEOL,fontSize:0},tx=(_classPrivateFieldGet(_textDivs,this).push(textDiv),Util.transform(_classPrivateFieldGet(_transform,this),geom.transform)),angle=Math.atan2(tx[1],tx[0]),style=_classPrivateFieldGet(_styleCache,this)[geom.fontName],fontFamily=(style.vertical&&(angle+=Math.PI/2),_classPrivateFieldGet(_fontInspectorEnabled,this)&&style.fontSubstitution||style.fontFamily),fontFamily=_TextLayer.fontFamilyMap.get(fontFamily)||fontFamily,fontHeight=Math.hypot(tx[2],tx[3]),fontAscent=fontHeight*function(fontFamily,style,lang){var cachedAscent=_assertClassBrand(_TextLayer,this,_ascentCache)._.get(fontFamily);if(cachedAscent)return cachedAscent;var cachedAscent=_assertClassBrand(_TextLayer,this,_getCtx).call(this,lang),lang=(cachedAscent.canvas.width=cachedAscent.canvas.height=DEFAULT_FONT_SIZE,_assertClassBrand(_TextLayer,this,_ensureCtxFont).call(this,cachedAscent,DEFAULT_FONT_SIZE,fontFamily),cachedAscent.measureText("")),ascent=lang.fontBoundingBoxAscent,lang=Math.abs(lang.fontBoundingBoxDescent),cachedAscent=(cachedAscent.canvas.width=cachedAscent.canvas.height=0,.8);ascent?cachedAscent=ascent/(ascent+lang):(util_FeatureTest.platform.isFirefox&&warn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),style.ascent?cachedAscent=style.ascent:style.descent&&(cachedAscent=1+style.descent));return _assertClassBrand(_TextLayer,this,_ascentCache)._.set(fontFamily,cachedAscent),cachedAscent}.call(_TextLayer,fontFamily,style,_classPrivateFieldGet(_lang,this)),tx=0===angle?(left=tx[4],tx[5]-fontAscent):(left=tx[4]+fontAscent*Math.sin(angle),tx[5]-fontAscent*Math.cos(angle)),fontAscent="calc(var(--total-scale-factor) *",divStyle=textDiv.style,left=(_classPrivateFieldGet(_container4,this)===_classPrivateFieldGet(_rootContainer,this)?(divStyle.left="".concat((100*left/_classPrivateFieldGet(_pageWidth3,this)).toFixed(2),"%"),divStyle.top="".concat((100*tx/_classPrivateFieldGet(_pageHeight3,this)).toFixed(2),"%")):(divStyle.left="".concat(fontAscent).concat(left.toFixed(2),"px)"),divStyle.top="".concat(fontAscent).concat(tx.toFixed(2),"px)")),divStyle.fontSize="".concat(fontAscent).concat((_minFontSize._*fontHeight).toFixed(2),"px)"),divStyle.fontFamily=fontFamily,textDivProperties.fontSize=fontHeight,textDiv.setAttribute("role","presentation"),textDiv.textContent=geom.str,textDiv.dir=geom.dir,_classPrivateFieldGet(_fontInspectorEnabled,this)&&(textDiv.dataset.fontName=style.fontSubstitutionLoadedName||geom.fontName),0!==angle&&(textDivProperties.angle=angle*(180/Math.PI)),!1);(left=1<geom.str.length||" "!==geom.str&&geom.transform[0]!==geom.transform[3]&&(tx=Math.abs(geom.transform[0]))!==(fontAscent=Math.abs(geom.transform[3]))&&1.5<Math.max(tx,fontAscent)/Math.min(tx,fontAscent)?!0:left)&&(textDivProperties.canvasWidth=style.vertical?geom.height:geom.width),_classPrivateFieldGet(_textDivProperties,this).set(textDiv,textDivProperties),_classPrivateFieldGet(_layoutTextParams,this).div=textDiv,_classPrivateFieldGet(_layoutTextParams,this).properties=textDivProperties,_assertClassBrand(_TextLayer_brand,this,_layout).call(this,_classPrivateFieldGet(_layoutTextParams,this)),textDivProperties.hasText&&_classPrivateFieldGet(_container4,this).append(textDiv),textDivProperties.hasEOL&&((divStyle=document.createElement("br")).setAttribute("role","presentation"),_classPrivateFieldGet(_container4,this).append(divStyle))}function _layout(params){var fontFamily,canvasWidth,fontSize,div=params.div,properties=params.properties,params=params.ctx,style=div.style,transform="";1<_minFontSize._&&(transform="scale(".concat(1/_minFontSize._,")")),0!==properties.canvasWidth&&properties.hasText&&(fontFamily=style.fontFamily,canvasWidth=properties.canvasWidth,fontSize=properties.fontSize,_ensureCtxFont.call(_TextLayer,params,fontSize*_classPrivateFieldGet(_scale3,this),fontFamily),0<(fontSize=params.measureText(div.textContent).width))&&(transform="scaleX(".concat(canvasWidth*_classPrivateFieldGet(_scale3,this)/fontSize,") ").concat(transform)),0<(transform=0!==properties.angle?"rotate(".concat(properties.angle,"deg) ").concat(transform):transform).length&&(style.transform=transform)}function _getCtx(){var canvas,lang=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,ctx=_assertClassBrand(_TextLayer,this,_canvasContexts)._.get(lang=lang||"");return ctx||((canvas=document.createElement("canvas")).className="hiddenCanvasElement",canvas.lang=lang,document.body.append(canvas),ctx=canvas.getContext("2d",{alpha:!1,willReadFrequently:!0}),_assertClassBrand(_TextLayer,this,_canvasContexts)._.set(lang,ctx),_assertClassBrand(_TextLayer,this,_canvasCtxFonts)._.set(ctx,{size:0,family:""})),ctx}function _ensureCtxFont(ctx,size,family){var cached=_assertClassBrand(_TextLayer,this,_canvasCtxFonts)._.get(ctx);size===cached.size&&family===cached.family||(ctx.font="".concat(size,"px ").concat(family),cached.size=size,cached.family=family)}var _TextLayer=TextLayer,_ascentCache={_:new Map},_canvasContexts={_:new Map},_canvasCtxFonts={_:new WeakMap},_minFontSize={_:null},_pendingTextLayers={_:new Set},XfaText=function(){function XfaText(){babelHelpers.classCallCheck(this,XfaText)}return babelHelpers.createClass(XfaText,null,[{key:"textContent",value:function(xfa){var items=[],output={items:items,styles:Object.create(null)};return function walk(node){if(node){var str=null,name=node.name;if("#text"===name)str=node.value;else{if(!XfaText.shouldBuildText(name))return;null!=node&&null!=(name=node.attributes)&&name.textContent?str=node.attributes.textContent:node.value&&(str=node.value)}if(null!==str&&items.push({str:str}),node.children){var _step96,_iterator96=_createForOfIteratorHelper(node.children);try{for(_iterator96.s();!(_step96=_iterator96.n()).done;)walk(_step96.value)}catch(err){_iterator96.e(err)}finally{_iterator96.f()}}}}(xfa),output}},{key:"shouldBuildText",value:function(name){return!("textarea"===name||"input"===name||"option"===name||"select"===name)}}])}();function getDocument(){var src=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},task=("string"==typeof src||src instanceof URL?src={url:src}:(src instanceof ArrayBuffer||ArrayBuffer.isView(src))&&(src={data:src}),new PDFDocumentLoadingTask),docId=task.docId,url=src.url?function(val){if(val instanceof URL)return val.href;if("string"==typeof val){if(isNodeJS)return val;val=URL.parse(val,window.location);if(val)return val.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(src.url):null,data=src.data?function(val){if(isNodeJS&&"undefined"!=typeof Buffer&&val instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(val instanceof Uint8Array&&val.byteLength===val.buffer.byteLength)return val;if("string"==typeof val)return stringToBytes(val);if(val instanceof ArrayBuffer||ArrayBuffer.isView(val)||"object"==typeof val&&!isNaN(null==val?void 0:val.length))return new Uint8Array(val);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(src.data):null,httpHeaders=src.httpHeaders||null,withCredentials=!0===src.withCredentials,_src$password=null!=(_src$password=src.password)?_src$password:null,rangeTransport=src.range instanceof PDFDataRangeTransport?src.range:null,rangeChunkSize=Number.isInteger(src.rangeChunkSize)&&0<src.rangeChunkSize?src.rangeChunkSize:Math.pow(2,16),worker=src.worker instanceof PDFWorker?src.worker:null,verbosity=src.verbosity,docBaseUrl="string"!=typeof src.docBaseUrl||isDataScheme(src.docBaseUrl)?null:src.docBaseUrl,cMapUrl=getFactoryUrlProp(src.cMapUrl),cMapPacked=!1!==src.cMapPacked,CMapReaderFactory=src.CMapReaderFactory||(isNodeJS?NodeCMapReaderFactory:DOMCMapReaderFactory),iccUrl=getFactoryUrlProp(src.iccUrl),standardFontDataUrl=getFactoryUrlProp(src.standardFontDataUrl),StandardFontDataFactory=src.StandardFontDataFactory||(isNodeJS?NodeStandardFontDataFactory:DOMStandardFontDataFactory),wasmUrl=getFactoryUrlProp(src.wasmUrl),WasmFactory=src.WasmFactory||(isNodeJS?NodeWasmFactory:DOMWasmFactory),ignoreErrors=!0!==src.stopAtErrors,maxImageSize=Number.isInteger(src.maxImageSize)&&-1<src.maxImageSize?src.maxImageSize:-1,isEvalSupported=!1!==src.isEvalSupported,isOffscreenCanvasSupported="boolean"==typeof src.isOffscreenCanvasSupported?src.isOffscreenCanvasSupported:!isNodeJS,isImageDecoderSupported="boolean"==typeof src.isImageDecoderSupported?src.isImageDecoderSupported:!isNodeJS&&(util_FeatureTest.platform.isFirefox||!globalThis.chrome),canvasMaxAreaInBytes=Number.isInteger(src.canvasMaxAreaInBytes)?src.canvasMaxAreaInBytes:-1,disableFontFace="boolean"==typeof src.disableFontFace?src.disableFontFace:isNodeJS,fontExtraProperties=!0===src.fontExtraProperties,enableXfa=!0===src.enableXfa,ownerDocument=src.ownerDocument||globalThis.document,disableRange=!0===src.disableRange,disableStream=!0===src.disableStream,disableAutoFetch=!0===src.disableAutoFetch,pdfBug=!0===src.pdfBug,CanvasFactory=src.CanvasFactory||(isNodeJS?NodeCanvasFactory:DOMCanvasFactory),FilterFactory=src.FilterFactory||(isNodeJS?NodeFilterFactory:DOMFilterFactory),enableHWA=!0===src.enableHWA,useWasm=!1!==src.useWasm,length=rangeTransport?rangeTransport.length:null!=(_src$length=src.length)?_src$length:NaN,_src$length="boolean"==typeof src.useSystemFonts?src.useSystemFonts:!isNodeJS&&!disableFontFace,src="boolean"==typeof src.useWorkerFetch?src.useWorkerFetch:!!(CMapReaderFactory===DOMCMapReaderFactory&&StandardFontDataFactory===DOMStandardFontDataFactory&&WasmFactory===DOMWasmFactory&&cMapUrl&&standardFontDataUrl&&wasmUrl&&isValidFetchUrl(cMapUrl,document.baseURI)&&isValidFetchUrl(standardFontDataUrl,document.baseURI)&&isValidFetchUrl(wasmUrl,document.baseURI)),transportFactory=(setVerbosityLevel(verbosity),{canvasFactory:new CanvasFactory({ownerDocument:ownerDocument,enableHWA:enableHWA}),filterFactory:new FilterFactory({docId:docId,ownerDocument:ownerDocument}),cMapReaderFactory:src?null:new CMapReaderFactory({baseUrl:cMapUrl,isCompressed:cMapPacked}),standardFontDataFactory:src?null:new StandardFontDataFactory({baseUrl:standardFontDataUrl}),wasmFactory:src?null:new WasmFactory({baseUrl:wasmUrl})}),docParams=(worker||(worker=PDFWorker.create({verbosity:verbosity,port:GlobalWorkerOptions.workerPort}),task._worker=worker),{docId:docId,apiVersion:"5.3.93",data:data,password:_src$password,disableAutoFetch:disableAutoFetch,rangeChunkSize:rangeChunkSize,length:length,docBaseUrl:docBaseUrl,enableXfa:enableXfa,evaluatorOptions:{maxImageSize:maxImageSize,disableFontFace:disableFontFace,ignoreErrors:ignoreErrors,isEvalSupported:isEvalSupported,isOffscreenCanvasSupported:isOffscreenCanvasSupported,isImageDecoderSupported:isImageDecoderSupported,canvasMaxAreaInBytes:canvasMaxAreaInBytes,fontExtraProperties:fontExtraProperties,useSystemFonts:_src$length,useWasm:useWasm,useWorkerFetch:src,cMapUrl:cMapUrl,iccUrl:iccUrl,standardFontDataUrl:standardFontDataUrl,wasmUrl:wasmUrl}}),transportParams={ownerDocument:ownerDocument,pdfBug:pdfBug,styleElement:null,loadingParams:{disableAutoFetch:disableAutoFetch,enableXfa:enableXfa}};return worker.promise.then(function(){if(task.destroyed)throw new Error("Loading aborted");if(worker.destroyed)throw new Error("Worker was destroyed");var workerIdPromise=worker.messageHandler.sendWithPromise("GetDocRequest",docParams,data?[data.buffer]:null);if(rangeTransport)networkStream=new PDFDataTransportStream(rangeTransport,{disableRange:disableRange,disableStream:disableStream});else if(!data){if(!url)throw new Error("getDocument - no `url` parameter provided.");var networkStream=new(isValidFetchUrl(url)?PDFFetchStream:isNodeJS?PDFNodeStream:PDFNetworkStream)({url:url,length:length,httpHeaders:httpHeaders,withCredentials:withCredentials,rangeChunkSize:rangeChunkSize,disableRange:disableRange,disableStream:disableStream})}return workerIdPromise.then(function(workerId){if(task.destroyed)throw new Error("Loading aborted");if(worker.destroyed)throw new Error("Worker was destroyed");var workerId=new MessageHandler(docId,workerId,worker.port),transport=new WorkerTransport(workerId,task,networkStream,transportParams,transportFactory);task._transport=transport,workerId.send("Ready",null)})}).catch(task._capability.reject),task}var PDFDocumentLoadingTask=function(){return babelHelpers.createClass(function PDFDocumentLoadingTask(){babelHelpers.classCallCheck(this,PDFDocumentLoadingTask),babelHelpers.defineProperty(this,"_capability",Promise.withResolvers()),babelHelpers.defineProperty(this,"_transport",null),babelHelpers.defineProperty(this,"_worker",null),babelHelpers.defineProperty(this,"docId","d".concat((_docId2._=(_PDFDocumentLoadingTa=_docId2._,_PDFDocumentLoadingTa2=_PDFDocumentLoadingTa++,_PDFDocumentLoadingTa),_PDFDocumentLoadingTa2))),babelHelpers.defineProperty(this,"destroyed",!1),babelHelpers.defineProperty(this,"onPassword",null),babelHelpers.defineProperty(this,"onProgress",null)},[{key:"promise",get:function(){return this._capability.promise}},{key:"destroy",value:async function(){var _this$_transport,_this$_worker;this.destroyed=!0;try{null!=(_this$_worker=this._worker)&&_this$_worker.port&&(this._worker._pendingDestroy=!0),await(null==(_this$_transport=this._transport)?void 0:_this$_transport.destroy())}catch(ex){throw null!=(_this$_worker=this._worker)&&_this$_worker.port&&delete this._worker._pendingDestroy,ex}(this._transport=null)!=(_this$_transport=this._worker)&&_this$_transport.destroy(),this._worker=null}},{key:"getData",value:async function(){return this._transport.getData()}}])}(),_docId2={_:0},_capability2=new WeakMap,_progressiveDoneListeners=new WeakMap,_progressiveReadListeners=new WeakMap,_progressListeners=new WeakMap,_rangeListeners=new WeakMap,PDFDataRangeTransport=_exports.PDFDataRangeTransport=function(){return babelHelpers.createClass(function PDFDataRangeTransport(length,initialData){var progressiveDone=2<arguments.length&&void 0!==arguments[2]&&arguments[2],contentDispositionFilename=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;babelHelpers.classCallCheck(this,PDFDataRangeTransport),_classPrivateFieldInitSpec(this,_capability2,Promise.withResolvers()),_classPrivateFieldInitSpec(this,_progressiveDoneListeners,[]),_classPrivateFieldInitSpec(this,_progressiveReadListeners,[]),_classPrivateFieldInitSpec(this,_progressListeners,[]),_classPrivateFieldInitSpec(this,_rangeListeners,[]),this.length=length,this.initialData=initialData,this.progressiveDone=progressiveDone,this.contentDispositionFilename=contentDispositionFilename},[{key:"addRangeListener",value:function(listener){_classPrivateFieldGet(_rangeListeners,this).push(listener)}},{key:"addProgressListener",value:function(listener){_classPrivateFieldGet(_progressListeners,this).push(listener)}},{key:"addProgressiveReadListener",value:function(listener){_classPrivateFieldGet(_progressiveReadListeners,this).push(listener)}},{key:"addProgressiveDoneListener",value:function(listener){_classPrivateFieldGet(_progressiveDoneListeners,this).push(listener)}},{key:"onDataRange",value:function(begin,chunk){var _step97,_iterator97=_createForOfIteratorHelper(_classPrivateFieldGet(_rangeListeners,this));try{for(_iterator97.s();!(_step97=_iterator97.n()).done;)(0,_step97.value)(begin,chunk)}catch(err){_iterator97.e(err)}finally{_iterator97.f()}}},{key:"onDataProgress",value:function(loaded,total){var _this41=this;_classPrivateFieldGet(_capability2,this).promise.then(function(){var _step98,_iterator98=_createForOfIteratorHelper(_classPrivateFieldGet(_progressListeners,_this41));try{for(_iterator98.s();!(_step98=_iterator98.n()).done;)(0,_step98.value)(loaded,total)}catch(err){_iterator98.e(err)}finally{_iterator98.f()}})}},{key:"onDataProgressiveRead",value:function(chunk){var _this42=this;_classPrivateFieldGet(_capability2,this).promise.then(function(){var _step99,_iterator99=_createForOfIteratorHelper(_classPrivateFieldGet(_progressiveReadListeners,_this42));try{for(_iterator99.s();!(_step99=_iterator99.n()).done;)(0,_step99.value)(chunk)}catch(err){_iterator99.e(err)}finally{_iterator99.f()}})}},{key:"onDataProgressiveDone",value:function(){var _this43=this;_classPrivateFieldGet(_capability2,this).promise.then(function(){var _step100,_iterator100=_createForOfIteratorHelper(_classPrivateFieldGet(_progressiveDoneListeners,_this43));try{for(_iterator100.s();!(_step100=_iterator100.n()).done;)(0,_step100.value)()}catch(err){_iterator100.e(err)}finally{_iterator100.f()}})}},{key:"transportReady",value:function(){_classPrivateFieldGet(_capability2,this).resolve()}},{key:"requestDataRange",value:function(begin,end){unreachable("Abstract method PDFDataRangeTransport.requestDataRange")}},{key:"abort",value:function(){}}])}(),PDFDocumentProxy=function(){return babelHelpers.createClass(function PDFDocumentProxy(pdfInfo,transport){babelHelpers.classCallCheck(this,PDFDocumentProxy),this._pdfInfo=pdfInfo,this._transport=transport},[{key:"annotationStorage",get:function(){return this._transport.annotationStorage}},{key:"canvasFactory",get:function(){return this._transport.canvasFactory}},{key:"filterFactory",get:function(){return this._transport.filterFactory}},{key:"numPages",get:function(){return this._pdfInfo.numPages}},{key:"fingerprints",get:function(){return this._pdfInfo.fingerprints}},{key:"isPureXfa",get:function(){return shadow(this,"isPureXfa",!!this._transport._htmlForXfa)}},{key:"allXfaHtml",get:function(){return this._transport._htmlForXfa}},{key:"getPage",value:function(pageNumber){return this._transport.getPage(pageNumber)}},{key:"getPageIndex",value:function(ref){return this._transport.getPageIndex(ref)}},{key:"getDestinations",value:function(){return this._transport.getDestinations()}},{key:"getDestination",value:function(id){return this._transport.getDestination(id)}},{key:"getPageLabels",value:function(){return this._transport.getPageLabels()}},{key:"getPageLayout",value:function(){return this._transport.getPageLayout()}},{key:"getPageMode",value:function(){return this._transport.getPageMode()}},{key:"getViewerPreferences",value:function(){return this._transport.getViewerPreferences()}},{key:"getOpenAction",value:function(){return this._transport.getOpenAction()}},{key:"getAttachments",value:function(){return this._transport.getAttachments()}},{key:"getJSActions",value:function(){return this._transport.getDocJSActions()}},{key:"getOutline",value:function(){return this._transport.getOutline()}},{key:"getOptionalContentConfig",value:function(){var _ref44$intent=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).intent,_ref44$intent=this._transport.getRenderingIntent(void 0===_ref44$intent?"display":_ref44$intent).renderingIntent;return this._transport.getOptionalContentConfig(_ref44$intent)}},{key:"getPermissions",value:function(){return this._transport.getPermissions()}},{key:"getMetadata",value:function(){return this._transport.getMetadata()}},{key:"getMarkInfo",value:function(){return this._transport.getMarkInfo()}},{key:"getData",value:function(){return this._transport.getData()}},{key:"saveDocument",value:function(){return this._transport.saveDocument()}},{key:"getDownloadInfo",value:function(){return this._transport.downloadInfoCapability.promise}},{key:"cleanup",value:function(){return this._transport.startCleanup(0<arguments.length&&void 0!==arguments[0]&&arguments[0]||this.isPureXfa)}},{key:"destroy",value:function(){return this.loadingTask.destroy()}},{key:"cachedPageNumber",value:function(ref){return this._transport.cachedPageNumber(ref)}},{key:"loadingParams",get:function(){return this._transport.loadingParams}},{key:"loadingTask",get:function(){return this._transport.loadingTask}},{key:"getFieldObjects",value:function(){return this._transport.getFieldObjects()}},{key:"hasJSActions",value:function(){return this._transport.hasJSActions()}},{key:"getCalculationOrderIds",value:function(){return this._transport.getCalculationOrderIds()}}])}(),_pendingCleanup=new WeakMap,_PDFPageProxy_brand=new WeakSet,PDFPageProxy=function(){return babelHelpers.createClass(function PDFPageProxy(pageIndex,pageInfo,transport){var pdfBug=3<arguments.length&&void 0!==arguments[3]&&arguments[3];babelHelpers.classCallCheck(this,PDFPageProxy),_classPrivateMethodInitSpec(this,_PDFPageProxy_brand),_classPrivateFieldInitSpec(this,_pendingCleanup,!1),this._pageIndex=pageIndex,this._pageInfo=pageInfo,this._transport=transport,this._stats=pdfBug?new StatTimer:null,this._pdfBug=pdfBug,this.commonObjs=transport.commonObjs,this.objs=new PDFObjects,this._intentStates=new Map,this.destroyed=!1},[{key:"pageNumber",get:function(){return this._pageIndex+1}},{key:"rotate",get:function(){return this._pageInfo.rotate}},{key:"ref",get:function(){return this._pageInfo.ref}},{key:"userUnit",get:function(){return this._pageInfo.userUnit}},{key:"view",get:function(){return this._pageInfo.view}},{key:"getViewport",value:function(){var _ref45=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},scale=_ref45.scale,_ref45$rotation=_ref45.rotation,_ref45$rotation=void 0===_ref45$rotation?this.rotate:_ref45$rotation,_ref45$offsetX=_ref45.offsetX,_ref45$offsetY=_ref45.offsetY,_ref45=_ref45.dontFlip;return new PageViewport({viewBox:this.view,userUnit:this.userUnit,scale:scale,rotation:_ref45$rotation,offsetX:void 0===_ref45$offsetX?0:_ref45$offsetX,offsetY:void 0===_ref45$offsetY?0:_ref45$offsetY,dontFlip:void 0!==_ref45&&_ref45})}},{key:"getAnnotations",value:function(){var _ref46$intent=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).intent,_ref46$intent=this._transport.getRenderingIntent(void 0===_ref46$intent?"display":_ref46$intent).renderingIntent;return this._transport.getAnnotations(this._pageIndex,_ref46$intent)}},{key:"getJSActions",value:function(){return this._transport.getPageJSActions(this._pageIndex)}},{key:"filterFactory",get:function(){return this._transport.filterFactory}},{key:"isPureXfa",get:function(){return shadow(this,"isPureXfa",!!this._transport._htmlForXfa)}},{key:"getXfa",value:async function(){var _this$_transport$_htm;return(null==(_this$_transport$_htm=this._transport._htmlForXfa)?void 0:_this$_transport$_htm.children[this._pageIndex])||null}},{key:"render",value:function(_ref47){function complete(error){intentState.renderTasks.delete(internalRenderTask),intentPrint&&_classPrivateFieldSet(_pendingCleanup,_this44,!0),_assertClassBrand(_PDFPageProxy_brand,_this44,_tryCleanup).call(_this44),error?(internalRenderTask.capability.reject(error),_this44._abortOperatorList({intentState:intentState,reason:error instanceof Error?error:new Error(error)})):internalRenderTask.capability.resolve(),_this44._stats&&(_this44._stats.timeEnd("Rendering"),_this44._stats.timeEnd("Overall"),null!=(error=globalThis.Stats))&&error.enabled&&globalThis.Stats.add(_this44.pageNumber,_this44._stats)}var _this44=this,canvasContext=_ref47.canvasContext,viewport=_ref47.viewport,_ref47$intent=_ref47.intent,_ref47$intent=void 0===_ref47$intent?"display":_ref47$intent,_ref47$annotationMode=_ref47.annotationMode,_ref47$annotationMode=void 0===_ref47$annotationMode?AnnotationMode.ENABLE:_ref47$annotationMode,_ref47$transform=_ref47.transform,_ref47$transform=void 0===_ref47$transform?null:_ref47$transform,_ref47$background=_ref47.background,_ref47$background=void 0===_ref47$background?null:_ref47$background,_ref47$optionalConten=_ref47.optionalContentConfigPromise,_ref47$optionalConten=void 0===_ref47$optionalConten?null:_ref47$optionalConten,_ref47$annotationCanv=_ref47.annotationCanvasMap,_ref47$annotationCanv=void 0===_ref47$annotationCanv?null:_ref47$annotationCanv,_ref47$pageColors=_ref47.pageColors,_ref47$pageColors=void 0===_ref47$pageColors?null:_ref47$pageColors,_ref47$printAnnotatio=_ref47.printAnnotationStorage,_ref47$printAnnotatio=void 0===_ref47$printAnnotatio?null:_ref47$printAnnotatio,_ref47=_ref47.isEditing,_ref47=void 0!==_ref47&&_ref47,_this$_stats=(null!=(_this$_stats=this._stats)&&_this$_stats.time("Overall"),this._transport.getRenderingIntent(_ref47$intent,_ref47$annotationMode,_ref47$printAnnotatio,_ref47)),renderingIntent=_this$_stats.renderingIntent,_ref47$intent=_this$_stats.cacheKey,intentState=(_classPrivateFieldSet(_pendingCleanup,this,!1),_ref47$optionalConten=_ref47$optionalConten||this._transport.getOptionalContentConfig(renderingIntent),this._intentStates.get(_ref47$intent)),intentPrint=(intentState||(intentState=Object.create(null),this._intentStates.set(_ref47$intent,intentState)),intentState.streamReaderCancelTimeout&&(clearTimeout(intentState.streamReaderCancelTimeout),intentState.streamReaderCancelTimeout=null),!!(renderingIntent&RenderingIntentFlag_PRINT)),internalRenderTask=(intentState.displayReadyCapability||(intentState.displayReadyCapability=Promise.withResolvers(),intentState.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null!=(_ref47$annotationMode=this._stats)&&_ref47$annotationMode.time("Page Request"),this._pumpOperatorList(_this$_stats)),new InternalRenderTask({callback:complete,params:{canvasContext:canvasContext,viewport:viewport,transform:_ref47$transform,background:_ref47$background},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:_ref47$annotationCanv,operatorList:intentState.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!intentPrint,pdfBug:this._pdfBug,pageColors:_ref47$pageColors})),_ref47$printAnnotatio=((intentState.renderTasks||(intentState.renderTasks=new Set)).add(internalRenderTask),internalRenderTask.task);return Promise.all([intentState.displayReadyCapability.promise,_ref47$optionalConten]).then(function(_ref48){var _this44$_stats,_ref48=babelHelpers.slicedToArray(_ref48,2),transparency=_ref48[0],_ref48=_ref48[1];if(_this44.destroyed)complete();else{if(null!=(_this44$_stats=_this44._stats)&&_this44$_stats.time("Rendering"),!(_ref48.renderingIntent&renderingIntent))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");internalRenderTask.initializeGraphics({transparency:transparency,optionalContentConfig:_ref48}),internalRenderTask.operatorListChanged()}}).catch(complete),_ref47$printAnnotatio}},{key:"getOperatorList",value:function(){var _ref50=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref50$intent=_ref50.intent,_ref50$annotationMode=_ref50.annotationMode,_ref50$printAnnotatio=_ref50.printAnnotationStorage,_ref50=_ref50.isEditing;var opListTask,_ref50$intent=this._transport.getRenderingIntent(void 0===_ref50$intent?"display":_ref50$intent,void 0===_ref50$annotationMode?AnnotationMode.ENABLE:_ref50$annotationMode,void 0===_ref50$printAnnotatio?null:_ref50$printAnnotatio,void 0!==_ref50&&_ref50,!0),intentState=this._intentStates.get(_ref50$intent.cacheKey);return intentState||(intentState=Object.create(null),this._intentStates.set(_ref50$intent.cacheKey,intentState)),intentState.opListReadCapability||((opListTask=Object.create(null)).operatorListChanged=function(){intentState.operatorList.lastChunk&&(intentState.opListReadCapability.resolve(intentState.operatorList),intentState.renderTasks.delete(opListTask))},intentState.opListReadCapability=Promise.withResolvers(),(intentState.renderTasks||(intentState.renderTasks=new Set)).add(opListTask),intentState.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null!=(_ref50$annotationMode=this._stats)&&_ref50$annotationMode.time("Page Request"),this._pumpOperatorList(_ref50$intent)),intentState.opListReadCapability.promise}},{key:"streamTextContent",value:function(){var _ref51=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref51$includeMarkedC=_ref51.includeMarkedContent,_ref51=_ref51.disableNormalization;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===(void 0!==_ref51$includeMarkedC&&_ref51$includeMarkedC),disableNormalization:!0===(void 0!==_ref51&&_ref51)},{highWaterMark:100,size:function(textContent){return textContent.items.length}})}},{key:"getTextContent",value:function(){var readableStream,params=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return this._transport._htmlForXfa?this.getXfa().then(function(xfa){return XfaText.textContent(xfa)}):(readableStream=this.streamTextContent(params),new Promise(function(resolve,reject){var reader=readableStream.getReader(),textContent={items:[],styles:Object.create(null),lang:null};!function pump(){reader.read().then(function(_ref52){var value=_ref52.value;_ref52.done?resolve(textContent):(null==textContent.lang&&(textContent.lang=value.lang),Object.assign(textContent.styles,value.styles),(_ref52=textContent.items).push.apply(_ref52,babelHelpers.toConsumableArray(value.items)),pump())},reject)}()}))}},{key:"getStructTree",value:function(){return this._transport.getStructTree(this._pageIndex)}},{key:"_destroy",value:function(){this.destroyed=!0;var _step101,waitOn=[],_iterator101=_createForOfIteratorHelper(this._intentStates.values());try{for(_iterator101.s();!(_step101=_iterator101.n()).done;){var intentState=_step101.value;if(this._abortOperatorList({intentState:intentState,reason:new Error("Page was destroyed."),force:!0}),!intentState.opListReadCapability){var _step102,_iterator102=_createForOfIteratorHelper(intentState.renderTasks);try{for(_iterator102.s();!(_step102=_iterator102.n()).done;){var internalRenderTask=_step102.value;waitOn.push(internalRenderTask.completed),internalRenderTask.cancel()}}catch(err){_iterator102.e(err)}finally{_iterator102.f()}}}}catch(err){_iterator101.e(err)}finally{_iterator101.f()}return this.objs.clear(),_classPrivateFieldSet(_pendingCleanup,this,!1),Promise.all(waitOn)}},{key:"cleanup",value:function(){var resetStats=0<arguments.length&&void 0!==arguments[0]&&arguments[0],success=(_classPrivateFieldSet(_pendingCleanup,this,!0),_assertClassBrand(_PDFPageProxy_brand,this,_tryCleanup).call(this));return resetStats&&success&&this._stats&&(this._stats=new StatTimer),success}},{key:"_startRenderPage",value:function(transparency,cacheKey){var _this$_stats4,cacheKey=this._intentStates.get(cacheKey);cacheKey&&(null!=(_this$_stats4=this._stats)&&_this$_stats4.timeEnd("Page Request"),null!=(_this$_stats4=cacheKey.displayReadyCapability))&&_this$_stats4.resolve(transparency)}},{key:"_renderPageChunk",value:function(operatorListChunk,intentState){for(var i=0,ii=operatorListChunk.length;i<ii;i++)intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]),intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);intentState.operatorList.lastChunk=operatorListChunk.lastChunk,intentState.operatorList.separateAnnots=operatorListChunk.separateAnnots;var _step103,_iterator103=_createForOfIteratorHelper(intentState.renderTasks);try{for(_iterator103.s();!(_step103=_iterator103.n()).done;)_step103.value.operatorListChanged()}catch(err){_iterator103.e(err)}finally{_iterator103.f()}operatorListChunk.lastChunk&&_assertClassBrand(_PDFPageProxy_brand,this,_tryCleanup).call(this)}},{key:"_pumpOperatorList",value:function(_ref53){var _this45=this,renderingIntent=_ref53.renderingIntent,cacheKey=_ref53.cacheKey,annotationStorageSerializable=_ref53.annotationStorageSerializable,_ref53=_ref53.modifiedIds,map=annotationStorageSerializable.map,annotationStorageSerializable=annotationStorageSerializable.transfer,reader=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:renderingIntent,cacheKey:cacheKey,annotationStorage:map,modifiedIds:_ref53},annotationStorageSerializable).getReader(),intentState=this._intentStates.get(cacheKey),pump=(intentState.streamReader=reader,function(){reader.read().then(function(_ref54){var value=_ref54.value;_ref54.done?intentState.streamReader=null:_this45._transport.destroyed||(_this45._renderPageChunk(value,intentState),pump())},function(reason){if(intentState.streamReader=null,!_this45._transport.destroyed){if(intentState.operatorList){intentState.operatorList.lastChunk=!0;var _step104,_iterator104=_createForOfIteratorHelper(intentState.renderTasks);try{for(_iterator104.s();!(_step104=_iterator104.n()).done;)_step104.value.operatorListChanged()}catch(err){_iterator104.e(err)}finally{_iterator104.f()}_assertClassBrand(_PDFPageProxy_brand,_this45,_tryCleanup).call(_this45)}if(intentState.displayReadyCapability)intentState.displayReadyCapability.reject(reason);else{if(!intentState.opListReadCapability)throw reason;intentState.opListReadCapability.reject(reason)}}})});pump()}},{key:"_abortOperatorList",value:function(_ref55){var _this46=this,intentState=_ref55.intentState,reason=_ref55.reason,_ref55=_ref55.force,_ref55=void 0!==_ref55&&_ref55;if(intentState.streamReader){if(intentState.streamReaderCancelTimeout&&(clearTimeout(intentState.streamReaderCancelTimeout),intentState.streamReaderCancelTimeout=null),!_ref55){if(0<intentState.renderTasks.size)return;if(reason instanceof RenderingCancelledException)return _ref55=100,0<reason.extraDelay&&reason.extraDelay<1e3&&(_ref55+=reason.extraDelay),void(intentState.streamReaderCancelTimeout=setTimeout(function(){intentState.streamReaderCancelTimeout=null,_this46._abortOperatorList({intentState:intentState,reason:reason,force:!0})},_ref55))}if(intentState.streamReader.cancel(new AbortException(reason.message)).catch(function(){}),intentState.streamReader=null,!this._transport.destroyed){var _step105,_iterator105=_createForOfIteratorHelper(this._intentStates);try{for(_iterator105.s();!(_step105=_iterator105.n()).done;){var _step105$value=babelHelpers.slicedToArray(_step105.value,2),curCacheKey=_step105$value[0];if(_step105$value[1]===intentState){this._intentStates.delete(curCacheKey);break}}}catch(err){_iterator105.e(err)}finally{_iterator105.f()}this.cleanup()}}}},{key:"stats",get:function(){return this._stats}}])}();function _tryCleanup(){if(!_classPrivateFieldGet(_pendingCleanup,this)||this.destroyed)return!1;var _step184,_iterator184=_createForOfIteratorHelper(this._intentStates.values());try{for(_iterator184.s();!(_step184=_iterator184.n()).done;){var _step184$value=_step184.value,renderTasks=_step184$value.renderTasks,operatorList=_step184$value.operatorList;if(0<renderTasks.size||!operatorList.lastChunk)return!1}}catch(err){_iterator184.e(err)}finally{_iterator184.f()}return this._intentStates.clear(),this.objs.clear(),_classPrivateFieldSet(_pendingCleanup,this,!1),!0}var _capability3=new WeakMap,_messageHandler=new WeakMap,_port2=new WeakMap,_webWorker=new WeakMap,_PDFWorker_brand=new WeakSet,PDFWorker=_exports.PDFWorker=function(){function PDFWorker(){var _ref56=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref56$name=_ref56.name,_ref56$name=void 0===_ref56$name?null:_ref56$name,_ref56$port=_ref56.port,_ref56$port=void 0===_ref56$port?null:_ref56$port,_ref56=_ref56.verbosity,_ref56=void 0===_ref56?getVerbosityLevel():_ref56;if(babelHelpers.classCallCheck(this,PDFWorker),_classPrivateMethodInitSpec(this,_PDFWorker_brand),_classPrivateFieldInitSpec(this,_capability3,Promise.withResolvers()),_classPrivateFieldInitSpec(this,_messageHandler,null),_classPrivateFieldInitSpec(this,_port2,null),_classPrivateFieldInitSpec(this,_webWorker,null),this.name=_ref56$name,this.destroyed=!1,this.verbosity=_ref56,_ref56$port){if(_workerPorts._.has(_ref56$port))throw new Error("Cannot use more than one PDFWorker per port.");_workerPorts._.set(_ref56$port,this),_assertClassBrand(_PDFWorker_brand,this,_initializeFromPort).call(this,_ref56$port)}else _assertClassBrand(_PDFWorker_brand,this,_initialize).call(this)}return babelHelpers.createClass(PDFWorker,[{key:"promise",get:function(){return _classPrivateFieldGet(_capability3,this).promise}},{key:"port",get:function(){return _classPrivateFieldGet(_port2,this)}},{key:"messageHandler",get:function(){return _classPrivateFieldGet(_messageHandler,this)}},{key:"destroy",value:function(){var _classPrivateFieldGet61;this.destroyed=!0,null!=(_classPrivateFieldGet61=_classPrivateFieldGet(_webWorker,this))&&_classPrivateFieldGet61.terminate(),_classPrivateFieldSet(_webWorker,this,null),_workerPorts._.delete(_classPrivateFieldGet(_port2,this)),_classPrivateFieldSet(_port2,this,null),null!=(_classPrivateFieldGet61=_classPrivateFieldGet(_messageHandler,this))&&_classPrivateFieldGet61.destroy(),_classPrivateFieldSet(_messageHandler,this,null)}}],[{key:"create",value:function(params){var cachedPort=_assertClassBrand(PDFWorker,this,_workerPorts)._.get(null==params?void 0:params.port);if(cachedPort){if(cachedPort._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return cachedPort}return new PDFWorker(params)}},{key:"workerSrc",get:function(){if(GlobalWorkerOptions.workerSrc)return GlobalWorkerOptions.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}},{key:"_setupFakeWorkerGlobal",get:function(){var _this48=this;return shadow(this,"_setupFakeWorkerGlobal",async function(){return _classPrivateGetter(PDFWorker,_this48,_get_mainThreadWorkerMessageHandler)?_classPrivateGetter(PDFWorker,_this48,_get_mainThreadWorkerMessageHandler):(await Emby.importModule(_this48.workerSrc)).WorkerMessageHandler}())}}])}();function _resolve(){_classPrivateFieldGet(_capability3,this).resolve(),_classPrivateFieldGet(_messageHandler,this).send("configure",{verbosity:this.verbosity})}function _initializeFromPort(port){_classPrivateFieldSet(_port2,this,port),_classPrivateFieldSet(_messageHandler,this,new MessageHandler("main","worker",port)),_classPrivateFieldGet(_messageHandler,this).on("ready",function(){}),_assertClassBrand(_PDFWorker_brand,this,_resolve).call(this)}function _initialize(){var _this113=this;if(!_isWorkerDisabled._&&!_get_mainThreadWorkerMessageHandler()){var workerSrc=_PDFWorker.workerSrc;try{_PDFWorker._isSameOrigin(window.location,workerSrc)||(workerSrc=_PDFWorker._createCDNWrapper(new URL(workerSrc,window.location).href));function terminateEarly(){ac.abort(),messageHandler.destroy(),worker.terminate(),_this113.destroyed?_classPrivateFieldGet(_capability3,_this113).reject(new Error("Worker was destroyed")):_assertClassBrand(_PDFWorker_brand,_this113,_setupFakeWorker).call(_this113)}var worker=new Worker(workerSrc,{type:"module"}),messageHandler=new MessageHandler("main","worker",worker),ac=new AbortController,sendTest=(worker.addEventListener("error",function(){_classPrivateFieldGet(_webWorker,_this113)||terminateEarly()},{signal:ac.signal}),messageHandler.on("test",function(data){ac.abort(),_this113.destroyed||!data?terminateEarly():(_classPrivateFieldSet(_messageHandler,_this113,messageHandler),_classPrivateFieldSet(_port2,_this113,worker),_classPrivateFieldSet(_webWorker,_this113,worker),_assertClassBrand(_PDFWorker_brand,_this113,_resolve).call(_this113))}),messageHandler.on("ready",function(data){if(ac.abort(),_this113.destroyed)terminateEarly();else try{sendTest()}catch(_unused10){_assertClassBrand(_PDFWorker_brand,_this113,_setupFakeWorker).call(_this113)}}),function(){var testObj=new Uint8Array;messageHandler.send("test",testObj,[testObj.buffer])});return void sendTest()}catch(_unused11){info("The worker has been disabled.")}}_assertClassBrand(_PDFWorker_brand,this,_setupFakeWorker).call(this)}function _setupFakeWorker(){var _this114=this;_isWorkerDisabled._||(warn("Setting up fake worker."),_isWorkerDisabled._=!0),_PDFWorker._setupFakeWorkerGlobal.then(function(WorkerMessageHandler){var port,_PDFWorker$fakeWorker,_PDFWorker$fakeWorker2;_this114.destroyed?_classPrivateFieldGet(_capability3,_this114).reject(new Error("Worker was destroyed")):(port=new LoopbackPort,_classPrivateFieldSet(_port2,_this114,port),_PDFWorker$fakeWorker="fake".concat((_fakeWorkerId._=(_PDFWorker$fakeWorker=_fakeWorkerId._,_PDFWorker$fakeWorker2=_PDFWorker$fakeWorker++,_PDFWorker$fakeWorker),_PDFWorker$fakeWorker2)),_PDFWorker$fakeWorker2=new MessageHandler(_PDFWorker$fakeWorker+"_worker",_PDFWorker$fakeWorker,port),WorkerMessageHandler.setup(_PDFWorker$fakeWorker2,port),_classPrivateFieldSet(_messageHandler,_this114,new MessageHandler(_PDFWorker$fakeWorker,_PDFWorker$fakeWorker+"_worker",port)),_assertClassBrand(_PDFWorker_brand,_this114,_resolve).call(_this114))}).catch(function(reason){_classPrivateFieldGet(_capability3,_this114).reject(new Error('Setting up fake worker failed: "'.concat(reason.message,'".')))})}function _get_mainThreadWorkerMessageHandler(_this47){try{var _globalThis$pdfjsWork;return(null==(_globalThis$pdfjsWork=globalThis.pdfjsWorker)?void 0:_globalThis$pdfjsWork.WorkerMessageHandler)||null}catch(_unused12){return null}}var _PDFWorker=PDFWorker,_fakeWorkerId={_:0},_isWorkerDisabled={_:!1},_workerPorts={_:new WeakMap},_methodPromises=(isNodeJS&&(_isWorkerDisabled._=_assertClassBrand(_PDFWorker,_PDFWorker,!0),GlobalWorkerOptions.workerSrc||(GlobalWorkerOptions.workerSrc="./pdf.worker.mjs")),_PDFWorker._isSameOrigin=function(baseUrl,otherUrl){baseUrl=URL.parse(baseUrl);return!(null==baseUrl||!baseUrl.origin||"null"===baseUrl.origin)&&(otherUrl=new URL(otherUrl,baseUrl),baseUrl.origin===otherUrl.origin)},_PDFWorker._createCDNWrapper=function(url){url='await Emby.importModule("'.concat(url,'");');return URL.createObjectURL(new Blob([url],{type:"text/javascript"}))},_PDFWorker.fromPort=function(params){if(console.log("Deprecated API usage: `PDFWorker.fromPort` - please use `PDFWorker.create` instead."),null!=params&&params.port)return _PDFWorker.create(params);throw new Error("PDFWorker.fromPort - invalid method signature.")},new WeakMap),_pageCache=new WeakMap,_pagePromises=new WeakMap,_pageRefCache=new WeakMap,_passwordCapability=new WeakMap,_WorkerTransport_brand=new WeakSet,WorkerTransport=function(){return babelHelpers.createClass(function WorkerTransport(messageHandler,loadingTask,networkStream,params,factory){babelHelpers.classCallCheck(this,WorkerTransport),_classPrivateMethodInitSpec(this,_WorkerTransport_brand),_classPrivateFieldInitSpec(this,_methodPromises,new Map),_classPrivateFieldInitSpec(this,_pageCache,new Map),_classPrivateFieldInitSpec(this,_pagePromises,new Map),_classPrivateFieldInitSpec(this,_pageRefCache,new Map),_classPrivateFieldInitSpec(this,_passwordCapability,null),this.messageHandler=messageHandler,this.loadingTask=loadingTask,this.commonObjs=new PDFObjects,this.fontLoader=new FontLoader({ownerDocument:params.ownerDocument,styleElement:params.styleElement}),this.loadingParams=params.loadingParams,this._params=params,this.canvasFactory=factory.canvasFactory,this.filterFactory=factory.filterFactory,this.cMapReaderFactory=factory.cMapReaderFactory,this.standardFontDataFactory=factory.standardFontDataFactory,this.wasmFactory=factory.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=networkStream,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()},[{key:"annotationStorage",get:function(){return shadow(this,"annotationStorage",new AnnotationStorage)}},{key:"getRenderingIntent",value:function(intent){var annotationMode=1<arguments.length&&void 0!==arguments[1]?arguments[1]:AnnotationMode.ENABLE,printAnnotationStorage=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,isEditing=3<arguments.length&&void 0!==arguments[3]&&arguments[3],isOpList=4<arguments.length&&void 0!==arguments[4]&&arguments[4],renderingIntent=RenderingIntentFlag_DISPLAY,annotationStorageSerializable=SerializableEmpty;switch(intent){case"any":renderingIntent=RenderingIntentFlag_ANY;break;case"display":break;case"print":renderingIntent=RenderingIntentFlag_PRINT;break;default:warn("getRenderingIntent - invalid intent: ".concat(intent))}var annotationStorage=renderingIntent&RenderingIntentFlag_PRINT&&printAnnotationStorage instanceof PrintAnnotationStorage?printAnnotationStorage:this.annotationStorage;switch(annotationMode){case AnnotationMode.DISABLE:renderingIntent+=RenderingIntentFlag_ANNOTATIONS_DISABLE;break;case AnnotationMode.ENABLE:break;case AnnotationMode.ENABLE_FORMS:renderingIntent+=RenderingIntentFlag_ANNOTATIONS_FORMS;break;case AnnotationMode.ENABLE_STORAGE:renderingIntent+=RenderingIntentFlag_ANNOTATIONS_STORAGE,annotationStorageSerializable=annotationStorage.serializable;break;default:warn("getRenderingIntent - invalid annotationMode: ".concat(annotationMode))}isEditing&&(renderingIntent+=RenderingIntentFlag_IS_EDITING),isOpList&&(renderingIntent+=RenderingIntentFlag_OPLIST);printAnnotationStorage=annotationStorage.modifiedIds,isEditing=printAnnotationStorage.ids,isOpList=printAnnotationStorage.hash;return{renderingIntent:renderingIntent,cacheKey:[renderingIntent,annotationStorageSerializable.hash,isOpList].join("_"),annotationStorageSerializable:annotationStorageSerializable,modifiedIds:isEditing}}},{key:"destroy",value:function(){var _this49=this;if(!this.destroyCapability){this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null!=(_classPrivateFieldGet63=_classPrivateFieldGet(_passwordCapability,this))&&_classPrivateFieldGet63.reject(new Error("Worker was destroyed during onPassword callback"));var _step106,waitOn=[],_iterator106=_createForOfIteratorHelper(_classPrivateFieldGet(_pageCache,this).values());try{for(_iterator106.s();!(_step106=_iterator106.n()).done;){var page=_step106.value;waitOn.push(page._destroy())}}catch(err){_iterator106.e(err)}finally{_iterator106.f()}_classPrivateFieldGet(_pageCache,this).clear(),_classPrivateFieldGet(_pagePromises,this).clear(),_classPrivateFieldGet(_pageRefCache,this).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();var _classPrivateFieldGet63=this.messageHandler.sendWithPromise("Terminate",null);waitOn.push(_classPrivateFieldGet63),Promise.all(waitOn).then(function(){var _this49$_networkStrea;_this49.commonObjs.clear(),_this49.fontLoader.clear(),_classPrivateFieldGet(_methodPromises,_this49).clear(),_this49.filterFactory.destroy(),TextLayer.cleanup(),null!=(_this49$_networkStrea=_this49._networkStream)&&_this49$_networkStrea.cancelAllRequests(new AbortException("Worker was terminated.")),null!=(_this49$_networkStrea=_this49.messageHandler)&&_this49$_networkStrea.destroy(),_this49.messageHandler=null,_this49.destroyCapability.resolve()},this.destroyCapability.reject)}return this.destroyCapability.promise}},{key:"setupMessageHandler",value:function(){var _this50=this,messageHandler=this.messageHandler,loadingTask=this.loadingTask;messageHandler.on("GetReader",function(data,sink){assert(_this50._networkStream,"GetReader - no `IPDFStream` instance available."),_this50._fullReader=_this50._networkStream.getFullReader(),_this50._fullReader.onProgress=function(evt){_this50._lastProgress={loaded:evt.loaded,total:evt.total}},sink.onPull=function(){_this50._fullReader.read().then(function(_ref57){var value=_ref57.value;_ref57.done?sink.close():(assert(value instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),sink.enqueue(new Uint8Array(value),1,[value]))}).catch(function(reason){sink.error(reason)})},sink.onCancel=function(reason){_this50._fullReader.cancel(reason),sink.ready.catch(function(readyReason){if(!_this50.destroyed)throw readyReason})}}),messageHandler.on("ReaderHeadersReady",async function(data){await _this50._fullReader.headersReady;var _this50$_fullReader=_this50._fullReader,isStreamingSupported=_this50$_fullReader.isStreamingSupported,isRangeSupported=_this50$_fullReader.isRangeSupported,_this50$_fullReader=_this50$_fullReader.contentLength;return isStreamingSupported&&isRangeSupported||(_this50._lastProgress&&null!=loadingTask.onProgress&&loadingTask.onProgress(_this50._lastProgress),_this50._fullReader.onProgress=function(evt){null!=loadingTask.onProgress&&loadingTask.onProgress({loaded:evt.loaded,total:evt.total})}),{isStreamingSupported:isStreamingSupported,isRangeSupported:isRangeSupported,contentLength:_this50$_fullReader}}),messageHandler.on("GetRangeReader",function(data,sink){assert(_this50._networkStream,"GetRangeReader - no `IPDFStream` instance available.");var rangeReader=_this50._networkStream.getRangeReader(data.begin,data.end);rangeReader?(sink.onPull=function(){rangeReader.read().then(function(_ref58){var value=_ref58.value;_ref58.done?sink.close():(assert(value instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),sink.enqueue(new Uint8Array(value),1,[value]))}).catch(function(reason){sink.error(reason)})},sink.onCancel=function(reason){rangeReader.cancel(reason),sink.ready.catch(function(readyReason){if(!_this50.destroyed)throw readyReason})}):sink.close()}),messageHandler.on("GetDoc",function(_ref59){_ref59=_ref59.pdfInfo;_this50._numPages=_ref59.numPages,_this50._htmlForXfa=_ref59.htmlForXfa,delete _ref59.htmlForXfa,loadingTask._capability.resolve(new PDFDocumentProxy(_ref59,_this50))}),messageHandler.on("DocException",function(ex){loadingTask._capability.reject(wrapReason(ex))}),messageHandler.on("PasswordRequest",function(ex){_classPrivateFieldSet(_passwordCapability,_this50,Promise.withResolvers());try{if(!loadingTask.onPassword)throw wrapReason(ex);loadingTask.onPassword(function(password){password instanceof Error?_classPrivateFieldGet(_passwordCapability,_this50).reject(password):_classPrivateFieldGet(_passwordCapability,_this50).resolve({password:password})},ex.code)}catch(err){_classPrivateFieldGet(_passwordCapability,_this50).reject(err)}return _classPrivateFieldGet(_passwordCapability,_this50).promise}),messageHandler.on("DataLoaded",function(data){null!=loadingTask.onProgress&&loadingTask.onProgress({loaded:data.length,total:data.length}),_this50.downloadInfoCapability.resolve(data)}),messageHandler.on("StartRenderPage",function(data){_this50.destroyed||_classPrivateFieldGet(_pageCache,_this50).get(data.pageIndex)._startRenderPage(data.transparency,data.cacheKey)}),messageHandler.on("commonobj",function(_ref60){var exportedError,font,_ref60=babelHelpers.slicedToArray(_ref60,3),id=_ref60[0],type=_ref60[1],exportedData=_ref60[2];if(!_this50.destroyed&&!_this50.commonObjs.has(id))switch(type){case"Font":"error"in exportedData?(exportedError=exportedData.error,warn("Error during font loading: ".concat(exportedError)),_this50.commonObjs.resolve(id,exportedError)):(exportedError=_this50._params.pdfBug&&null!=(exportedError=globalThis.FontInspector)&&exportedError.enabled?function(font,url){return globalThis.FontInspector.fontAdded(font,url)}:null,font=new FontFaceObject(exportedData,exportedError),_this50.fontLoader.bind(font).catch(function(){return messageHandler.sendWithPromise("FontFallback",{id:id})}).finally(function(){!font.fontExtraProperties&&font.data&&(font.data=null),_this50.commonObjs.resolve(id,font)}));break;case"CopyLocalImage":var _step107,imageRef=exportedData.imageRef,_iterator107=(assert(imageRef,"The imageRef must be defined."),_createForOfIteratorHelper(_classPrivateFieldGet(_pageCache,_this50).values()));try{for(_iterator107.s();!(_step107=_iterator107.n()).done;){var _step108,_iterator108=_createForOfIteratorHelper(_step107.value.objs);try{for(_iterator108.s();!(_step108=_iterator108.n()).done;){var data=babelHelpers.slicedToArray(_step108.value,2)[1];if((null==data?void 0:data.ref)===imageRef)return data.dataLen?(_this50.commonObjs.resolve(id,structuredClone(data)),data.dataLen):null}}catch(err){_iterator108.e(err)}finally{_iterator108.f()}}}catch(err){_iterator107.e(err)}finally{_iterator107.f()}break;case"FontPath":case"Image":case"Pattern":_this50.commonObjs.resolve(id,exportedData);break;default:throw new Error("Got unknown common object type ".concat(type))}return null}),messageHandler.on("obj",function(_ref62){var _ref62=babelHelpers.slicedToArray(_ref62,4),id=_ref62[0],pageIndex=_ref62[1],type=_ref62[2],imageData=_ref62[3];if(!_this50.destroyed){var pageProxy=_classPrivateFieldGet(_pageCache,_this50).get(pageIndex);if(!pageProxy.objs.has(id))if(0===pageProxy._intentStates.size)null!=imageData&&null!=(_ref62=imageData.bitmap)&&_ref62.close();else switch(type){case"Image":case"Pattern":pageProxy.objs.resolve(id,imageData);break;default:throw new Error("Got unknown object type ".concat(type))}}}),messageHandler.on("DocProgress",function(data){_this50.destroyed||null!=loadingTask.onProgress&&loadingTask.onProgress({loaded:data.loaded,total:data.total})}),messageHandler.on("FetchBinaryData",async function(data){if(_this50.destroyed)throw new Error("Worker was destroyed.");var factory=_this50[data.type];if(factory)return factory.fetch(data);throw new Error("".concat(data.type," not initialized, see the `useWorkerFetch` parameter."))})}},{key:"getData",value:function(){return this.messageHandler.sendWithPromise("GetData",null)}},{key:"saveDocument",value:function(){var _this51=this,_this$annotationStora=(this.annotationStorage.size<=0&&warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this.annotationStorage.serializable),map=_this$annotationStora.map,_this$annotationStora=_this$annotationStora.transfer;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:map,filename:null!=(map=null==(map=this._fullReader)?void 0:map.filename)?map:null},_this$annotationStora).finally(function(){_this51.annotationStorage.resetModified()})}},{key:"getPage",value:function(pageNumber){var pageIndex,promise,_this52=this;return!Number.isInteger(pageNumber)||pageNumber<=0||pageNumber>this._numPages?Promise.reject(new Error("Invalid page request.")):(pageIndex=pageNumber-1,_classPrivateFieldGet(_pagePromises,this).get(pageIndex)||(promise=this.messageHandler.sendWithPromise("GetPage",{pageIndex:pageIndex}).then(function(pageInfo){if(_this52.destroyed)throw new Error("Transport destroyed");pageInfo.refStr&&_classPrivateFieldGet(_pageRefCache,_this52).set(pageInfo.refStr,pageNumber);pageInfo=new PDFPageProxy(pageIndex,pageInfo,_this52,_this52._params.pdfBug);return _classPrivateFieldGet(_pageCache,_this52).set(pageIndex,pageInfo),pageInfo}),_classPrivateFieldGet(_pagePromises,this).set(pageIndex,promise),promise))}},{key:"getPageIndex",value:function(ref){return isRefProxy(ref)?this.messageHandler.sendWithPromise("GetPageIndex",{num:ref.num,gen:ref.gen}):Promise.reject(new Error("Invalid pageIndex request."))}},{key:"getAnnotations",value:function(pageIndex,intent){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:pageIndex,intent:intent})}},{key:"getFieldObjects",value:function(){return _assertClassBrand(_WorkerTransport_brand,this,_cacheSimpleMethod).call(this,"GetFieldObjects")}},{key:"hasJSActions",value:function(){return _assertClassBrand(_WorkerTransport_brand,this,_cacheSimpleMethod).call(this,"HasJSActions")}},{key:"getCalculationOrderIds",value:function(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}},{key:"getDestinations",value:function(){return this.messageHandler.sendWithPromise("GetDestinations",null)}},{key:"getDestination",value:function(id){return"string"!=typeof id?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:id})}},{key:"getPageLabels",value:function(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}},{key:"getPageLayout",value:function(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}},{key:"getPageMode",value:function(){return this.messageHandler.sendWithPromise("GetPageMode",null)}},{key:"getViewerPreferences",value:function(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}},{key:"getOpenAction",value:function(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}},{key:"getAttachments",value:function(){return this.messageHandler.sendWithPromise("GetAttachments",null)}},{key:"getDocJSActions",value:function(){return _assertClassBrand(_WorkerTransport_brand,this,_cacheSimpleMethod).call(this,"GetDocJSActions")}},{key:"getPageJSActions",value:function(pageIndex){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:pageIndex})}},{key:"getStructTree",value:function(pageIndex){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:pageIndex})}},{key:"getOutline",value:function(){return this.messageHandler.sendWithPromise("GetOutline",null)}},{key:"getOptionalContentConfig",value:function(renderingIntent){return _assertClassBrand(_WorkerTransport_brand,this,_cacheSimpleMethod).call(this,"GetOptionalContentConfig").then(function(data){return new OptionalContentConfig(data,renderingIntent)})}},{key:"getPermissions",value:function(){return this.messageHandler.sendWithPromise("GetPermissions",null)}},{key:"getMetadata",value:function(){var _this53=this,name="GetMetadata",cachedPromise=_classPrivateFieldGet(_methodPromises,this).get(name);return cachedPromise||(cachedPromise=this.messageHandler.sendWithPromise(name,null).then(function(results){return{info:results[0],metadata:results[1]?new Metadata(results[1]):null,contentDispositionFilename:null!=(results=null==(results=_this53._fullReader)?void 0:results.filename)?results:null,contentLength:null!=(results=null==(results=_this53._fullReader)?void 0:results.contentLength)?results:null}}),_classPrivateFieldGet(_methodPromises,this).set(name,cachedPromise),cachedPromise)}},{key:"getMarkInfo",value:function(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}},{key:"startCleanup",value:async function(){var keepLoadedFonts=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);var _step109,_iterator109=_createForOfIteratorHelper(_classPrivateFieldGet(_pageCache,this).values());try{for(_iterator109.s();!(_step109=_iterator109.n()).done;){var page=_step109.value;if(!page.cleanup())throw new Error("startCleanup: Page ".concat(page.pageNumber," is currently rendering."))}}catch(err){_iterator109.e(err)}finally{_iterator109.f()}this.commonObjs.clear(),keepLoadedFonts||this.fontLoader.clear(),_classPrivateFieldGet(_methodPromises,this).clear(),this.filterFactory.destroy(!0),TextLayer.cleanup()}}},{key:"cachedPageNumber",value:function(ref){return isRefProxy(ref)&&(ref=0===ref.gen?"".concat(ref.num,"R"):"".concat(ref.num,"R").concat(ref.gen),null!=(ref=_classPrivateFieldGet(_pageRefCache,this).get(ref)))?ref:null}}])}();function _cacheSimpleMethod(name){var data=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,cachedPromise=_classPrivateFieldGet(_methodPromises,this).get(name);return cachedPromise||(cachedPromise=this.messageHandler.sendWithPromise(name,data),_classPrivateFieldGet(_methodPromises,this).set(name,cachedPromise),cachedPromise)}var _internalRenderTask=new WeakMap,RenderTask=function(){return babelHelpers.createClass(function RenderTask(internalRenderTask){babelHelpers.classCallCheck(this,RenderTask),_classPrivateFieldInitSpec(this,_internalRenderTask,null),babelHelpers.defineProperty(this,"onContinue",null),babelHelpers.defineProperty(this,"onError",null),_classPrivateFieldSet(_internalRenderTask,this,internalRenderTask)},[{key:"promise",get:function(){return _classPrivateFieldGet(_internalRenderTask,this).capability.promise}},{key:"cancel",value:function(){var extraDelay=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;_classPrivateFieldGet(_internalRenderTask,this).cancel(null,extraDelay)}},{key:"separateAnnots",get:function(){var annotationCanvasMap,separateAnnots=_classPrivateFieldGet(_internalRenderTask,this).operatorList.separateAnnots;return!!separateAnnots&&(annotationCanvasMap=_classPrivateFieldGet(_internalRenderTask,this).annotationCanvasMap,separateAnnots.form||separateAnnots.canvas&&0<(null==annotationCanvasMap?void 0:annotationCanvasMap.size))}}])}(),_rAF=new WeakMap,InternalRenderTask=function(){return babelHelpers.createClass(function InternalRenderTask(_ref64){var callback=_ref64.callback,params=_ref64.params,objs=_ref64.objs,commonObjs=_ref64.commonObjs,annotationCanvasMap=_ref64.annotationCanvasMap,operatorList=_ref64.operatorList,pageIndex=_ref64.pageIndex,canvasFactory=_ref64.canvasFactory,filterFactory=_ref64.filterFactory,_ref64$useRequestAnim=_ref64.useRequestAnimationFrame,_ref64$useRequestAnim=void 0!==_ref64$useRequestAnim&&_ref64$useRequestAnim,_ref64$pdfBug=_ref64.pdfBug,_ref64$pdfBug=void 0!==_ref64$pdfBug&&_ref64$pdfBug,_ref64=_ref64.pageColors,_ref64=void 0===_ref64?null:_ref64;babelHelpers.classCallCheck(this,InternalRenderTask),_classPrivateFieldInitSpec(this,_rAF,null),this.callback=callback,this.params=params,this.objs=objs,this.commonObjs=commonObjs,this.annotationCanvasMap=annotationCanvasMap,this.operatorListIdx=null,this.operatorList=operatorList,this._pageIndex=pageIndex,this.canvasFactory=canvasFactory,this.filterFactory=filterFactory,this._pdfBug=_ref64$pdfBug,this.pageColors=_ref64,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===_ref64$useRequestAnim&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=params.canvasContext.canvas},[{key:"completed",get:function(){return this.capability.promise.catch(function(){})}},{key:"initializeGraphics",value:function(_ref65){var _ref65$transparency=_ref65.transparency,_ref65$transparency=void 0!==_ref65$transparency&&_ref65$transparency,_ref65=_ref65.optionalContentConfig;if(!this.cancelled){if(this._canvas){if(_canvasInUse._.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");_canvasInUse._.add(this._canvas)}this._pdfBug&&null!=(_globalThis$StepperMa=globalThis.StepperManager)&&_globalThis$StepperMa.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());var _globalThis$StepperMa=this.params,canvasContext=_globalThis$StepperMa.canvasContext,viewport=_globalThis$StepperMa.viewport,transform=_globalThis$StepperMa.transform,_globalThis$StepperMa=_globalThis$StepperMa.background;this.gfx=new CanvasGraphics(canvasContext,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:_ref65},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:transform,viewport:viewport,transparency:_ref65$transparency,background:_globalThis$StepperMa}),this.operatorListIdx=0,this.graphicsReady=!0,null!=(canvasContext=this.graphicsReadyCallback)&&canvasContext.call(this)}}},{key:"cancel",value:function(){var _this$gfx,error=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,extraDelay=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null!=(_this$gfx=this.gfx)&&_this$gfx.endDrawing(),_classPrivateFieldGet(_rAF,this)&&(window.cancelAnimationFrame(_classPrivateFieldGet(_rAF,this)),_classPrivateFieldSet(_rAF,this,null)),_canvasInUse._.delete(this._canvas),error=error||new RenderingCancelledException("Rendering cancelled, page ".concat(this._pageIndex+1),extraDelay),this.callback(error),null!=(extraDelay=(_this$gfx=this.task).onError)&&extraDelay.call(_this$gfx,error)}},{key:"operatorListChanged",value:function(){var _this$stepper;this.graphicsReady?(null!=(_this$stepper=this.stepper)&&_this$stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}},{key:"_continue",value:function(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}},{key:"_scheduleNext",value:function(){var _this54=this;this._useRequestAnimationFrame?_classPrivateFieldSet(_rAF,this,window.requestAnimationFrame(function(){_classPrivateFieldSet(_rAF,_this54,null),_this54._nextBound().catch(_this54._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}},{key:"_next",value:async function(){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(),_canvasInUse._.delete(this._canvas),this.callback()))}}])}(),_canvasInUse={_:new WeakSet};_exports.version="5.3.93",_exports.build="cbeef3233";function makeColorComp(n){return Math.floor(255*Math.max(0,Math.min(1,n))).toString(16).padStart(2,"0")}function scaleAndClamp(x){return Math.max(0,Math.min(255,255*x))}var ColorConverters=function(){return babelHelpers.createClass(function ColorConverters(){babelHelpers.classCallCheck(this,ColorConverters)},null,[{key:"CMYK_G",value:function(_ref66){var _ref66=babelHelpers.slicedToArray(_ref66,4),c=_ref66[0],y=_ref66[1],m=_ref66[2],_ref66=_ref66[3];return["G",1-Math.min(1,.3*c+.59*m+.11*y+_ref66)]}},{key:"G_CMYK",value:function(_ref68){return["CMYK",0,0,0,1-babelHelpers.slicedToArray(_ref68,1)[0]]}},{key:"G_RGB",value:function(_ref70){_ref70=babelHelpers.slicedToArray(_ref70,1)[0];return["RGB",_ref70,_ref70,_ref70]}},{key:"G_rgb",value:function(_ref72){return[_ref72=scaleAndClamp(babelHelpers.slicedToArray(_ref72,1)[0]),_ref72,_ref72]}},{key:"G_HTML",value:function(_ref74){_ref74=makeColorComp(babelHelpers.slicedToArray(_ref74,1)[0]);return"#".concat(_ref74).concat(_ref74).concat(_ref74)}},{key:"RGB_G",value:function(_ref76){_ref76=babelHelpers.slicedToArray(_ref76,3);return["G",.3*_ref76[0]+.59*_ref76[1]+.11*_ref76[2]]}},{key:"RGB_rgb",value:function(color){return color.map(scaleAndClamp)}},{key:"RGB_HTML",value:function(color){return"#".concat(color.map(makeColorComp).join(""))}},{key:"T_HTML",value:function(){return"#00000000"}},{key:"T_rgb",value:function(){return[null]}},{key:"CMYK_RGB",value:function(_ref78){var _ref78=babelHelpers.slicedToArray(_ref78,4),c=_ref78[0],y=_ref78[1],m=_ref78[2],_ref78=_ref78[3];return["RGB",1-Math.min(1,c+_ref78),1-Math.min(1,m+_ref78),1-Math.min(1,y+_ref78)]}},{key:"CMYK_rgb",value:function(_ref80){var _ref80=babelHelpers.slicedToArray(_ref80,4),c=_ref80[0],y=_ref80[1],m=_ref80[2],_ref80=_ref80[3];return[scaleAndClamp(1-Math.min(1,c+_ref80)),scaleAndClamp(1-Math.min(1,m+_ref80)),scaleAndClamp(1-Math.min(1,y+_ref80))]}},{key:"CMYK_HTML",value:function(components){components=this.CMYK_RGB(components).slice(1);return this.RGB_HTML(components)}},{key:"RGB_CMYK",value:function(_ref82){var _ref82=babelHelpers.slicedToArray(_ref82,3),c=1-_ref82[0],m=1-_ref82[1],_ref82=1-_ref82[2];return["CMYK",c,m,_ref82,Math.min(c,m,_ref82)]}}])}(),BaseSVGFactory=function(){return babelHelpers.createClass(function BaseSVGFactory(){babelHelpers.classCallCheck(this,BaseSVGFactory)},[{key:"create",value:function(width,height){var skipDimensions=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(width<=0||height<=0)throw new Error("Invalid SVG dimensions");var svg=this._createSVG("svg:svg");return svg.setAttribute("version","1.1"),skipDimensions||(svg.setAttribute("width","".concat(width,"px")),svg.setAttribute("height","".concat(height,"px"))),svg.setAttribute("preserveAspectRatio","none"),svg.setAttribute("viewBox","0 0 ".concat(width," ").concat(height)),svg}},{key:"createElement",value:function(type){if("string"!=typeof type)throw new Error("Invalid SVG element type");return this._createSVG(type)}},{key:"_createSVG",value:function(type){unreachable("Abstract method `_createSVG` called.")}}])}(),DOMSVGFactory=_exports.DOMSVGFactory=function(){function DOMSVGFactory(){return babelHelpers.classCallCheck(this,DOMSVGFactory),_callSuper(this,DOMSVGFactory,arguments)}return babelHelpers.inherits(DOMSVGFactory,BaseSVGFactory),babelHelpers.createClass(DOMSVGFactory,[{key:"_createSVG",value:function(type){return document.createElementNS(SVG_NS,type)}}])}(),XfaLayer=_exports.XfaLayer=function(){return babelHelpers.createClass(function XfaLayer(){babelHelpers.classCallCheck(this,XfaLayer)},null,[{key:"setupStorage",value:function(html,id,element,storage,intent){var storedData=storage.getValue(id,{value:null});switch(element.name){case"textarea":null!==storedData.value&&(html.textContent=storedData.value),"print"!==intent&&html.addEventListener("input",function(event){storage.setValue(id,{value:event.target.value})});break;case"input":if("radio"===element.attributes.type||"checkbox"===element.attributes.type){if(storedData.value===element.attributes.xfaOn?html.setAttribute("checked",!0):storedData.value===element.attributes.xfaOff&&html.removeAttribute("checked"),"print"===intent)break;html.addEventListener("change",function(event){storage.setValue(id,{value:event.target.checked?event.target.getAttribute("xfaOn"):event.target.getAttribute("xfaOff")})})}else{if(null!==storedData.value&&html.setAttribute("value",storedData.value),"print"===intent)break;html.addEventListener("input",function(event){storage.setValue(id,{value:event.target.value})})}break;case"select":if(null!==storedData.value){html.setAttribute("value",storedData.value);var _step110,_iterator110=_createForOfIteratorHelper(element.children);try{for(_iterator110.s();!(_step110=_iterator110.n()).done;){var option=_step110.value;option.attributes.value===storedData.value?option.attributes.selected=!0:option.attributes.hasOwnProperty("selected")&&delete option.attributes.selected}}catch(err){_iterator110.e(err)}finally{_iterator110.f()}}html.addEventListener("input",function(event){event=event.target.options,event=-1===event.selectedIndex?"":event[event.selectedIndex].value;storage.setValue(id,{value:event})})}}},{key:"setAttributes",value:function(_ref84){var html=_ref84.html,element=_ref84.element,_ref84$storage=_ref84.storage,_ref84$storage=void 0===_ref84$storage?null:_ref84$storage,intent=_ref84.intent,_ref84=_ref84.linkService,attributes=element.attributes,isHTMLAnchorElement=html instanceof HTMLAnchorElement;"radio"===attributes.type&&(attributes.name="".concat(attributes.name,"-").concat(intent));for(var _i12=0,_Object$entries3=Object.entries(attributes);_i12<_Object$entries3.length;_i12++){var _Object$entries3$_i=babelHelpers.slicedToArray(_Object$entries3[_i12],2),key=_Object$entries3$_i[0],value=_Object$entries3$_i[1];if(null!=value)switch(key){case"class":value.length&&html.setAttribute(key,value.join(" "));break;case"dataId":break;case"id":html.setAttribute("data-element-id",value);break;case"style":Object.assign(html.style,value);break;case"textContent":html.textContent=value;break;default:isHTMLAnchorElement&&("href"===key||"newWindow"===key)||html.setAttribute(key,value)}}isHTMLAnchorElement&&_ref84.addLinkAttributes(html,attributes.href,attributes.newWindow),_ref84$storage&&attributes.dataId&&this.setupStorage(html,attributes.dataId,element,_ref84$storage)}},{key:"render",value:function(parameters){var storage=parameters.annotationStorage,linkService=parameters.linkService,root=parameters.xfaHtml,intent=parameters.intent||"display",rootHtml=document.createElement(root.name),isNotForRichText=(root.attributes&&this.setAttributes({html:rootHtml,element:root,intent:intent,linkService:linkService}),"richText"!==intent),rootDiv=parameters.div,textDivs=(rootDiv.append(rootHtml),parameters.viewport&&(parameters="matrix(".concat(parameters.viewport.transform.join(","),")"),rootDiv.style.transform=parameters),isNotForRichText&&rootDiv.setAttribute("class","xfaLayer xfaFont"),[]);if(0===root.children.length)root.value&&(parameters=document.createTextNode(root.value),rootHtml.append(parameters),isNotForRichText)&&XfaText.shouldBuildText(root.name)&&textDivs.push(parameters);else{for(var stack=[[root,-1,rootHtml]];0<stack.length;){var _node,childHtml,_stack$at=stack.at(-1),_stack$at=babelHelpers.slicedToArray(_stack$at,3),parent=_stack$at[0],i=_stack$at[1],_stack$at=_stack$at[2];i+1===parent.children.length?stack.pop():null!==(i=parent.children[++stack.at(-1)[1]])&&("#text"===(parent=i.name)?(_node=document.createTextNode(i.value),textDivs.push(_node),_stack$at.append(_node)):(childHtml=null!=i&&null!=(_node=i.attributes)&&_node.xmlns?document.createElementNS(i.attributes.xmlns,parent):document.createElement(parent),_stack$at.append(childHtml),i.attributes&&this.setAttributes({html:childHtml,element:i,storage:storage,intent:intent,linkService:linkService}),0<(null==(_stack$at=i.children)?void 0:_stack$at.length)?stack.push([i,-1,childHtml]):i.value&&(_stack$at=document.createTextNode(i.value),isNotForRichText&&XfaText.shouldBuildText(parent)&&textDivs.push(_stack$at),childHtml.append(_stack$at))))}var _step111,_iterator111=_createForOfIteratorHelper(rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"));try{for(_iterator111.s();!(_step111=_iterator111.n()).done;)_step111.value.setAttribute("readOnly",!0)}catch(err){_iterator111.e(err)}finally{_iterator111.f()}}return{textDivs:textDivs}}},{key:"update",value:function(parameters){var transform="matrix(".concat(parameters.viewport.transform.join(","),")");parameters.div.style.transform=transform,parameters.div.hidden=!1}}])}(),GetElementsByNameSet=new WeakSet,AnnotationElementFactory=function(){return babelHelpers.createClass(function AnnotationElementFactory(){babelHelpers.classCallCheck(this,AnnotationElementFactory)},null,[{key:"create",value:function(parameters){switch(parameters.data.annotationType){case AnnotationType.LINK:return new LinkAnnotationElement(parameters);case AnnotationType.TEXT:return new TextAnnotationElement(parameters);case AnnotationType.WIDGET:switch(parameters.data.fieldType){case"Tx":return new TextWidgetAnnotationElement(parameters);case"Btn":return parameters.data.radioButton?new RadioButtonWidgetAnnotationElement(parameters):new(parameters.data.checkBox?CheckboxWidgetAnnotationElement:PushButtonWidgetAnnotationElement)(parameters);case"Ch":return new ChoiceWidgetAnnotationElement(parameters);case"Sig":return new SignatureWidgetAnnotationElement(parameters)}return new WidgetAnnotationElement(parameters);case AnnotationType.POPUP:return new PopupAnnotationElement(parameters);case AnnotationType.FREETEXT:return new FreeTextAnnotationElement(parameters);case AnnotationType.LINE:return new LineAnnotationElement(parameters);case AnnotationType.SQUARE:return new SquareAnnotationElement(parameters);case AnnotationType.CIRCLE:return new CircleAnnotationElement(parameters);case AnnotationType.POLYLINE:return new PolylineAnnotationElement(parameters);case AnnotationType.CARET:return new CaretAnnotationElement(parameters);case AnnotationType.INK:return new InkAnnotationElement(parameters);case AnnotationType.POLYGON:return new PolygonAnnotationElement(parameters);case AnnotationType.HIGHLIGHT:return new HighlightAnnotationElement(parameters);case AnnotationType.UNDERLINE:return new UnderlineAnnotationElement(parameters);case AnnotationType.SQUIGGLY:return new SquigglyAnnotationElement(parameters);case AnnotationType.STRIKEOUT:return new StrikeOutAnnotationElement(parameters);case AnnotationType.STAMP:return new StampAnnotationElement(parameters);case AnnotationType.FILEATTACHMENT:return new FileAttachmentAnnotationElement(parameters);default:return new AnnotationElement(parameters)}}}])}(),_updates=new WeakMap,_hasBorder=new WeakMap,_popupElement=new WeakMap,_AnnotationElement_brand=new WeakSet,AnnotationElement=function(){function AnnotationElement(parameters){var _ref85=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},_ref85$isRenderable=_ref85.isRenderable,_ref85$isRenderable=void 0!==_ref85$isRenderable&&_ref85$isRenderable,_ref85$ignoreBorder=_ref85.ignoreBorder,_ref85$ignoreBorder=void 0!==_ref85$ignoreBorder&&_ref85$ignoreBorder,_ref85=_ref85.createQuadrilaterals,_ref85=void 0!==_ref85&&_ref85;babelHelpers.classCallCheck(this,AnnotationElement),_classPrivateMethodInitSpec(this,_AnnotationElement_brand),_classPrivateFieldInitSpec(this,_updates,null),_classPrivateFieldInitSpec(this,_hasBorder,!1),_classPrivateFieldInitSpec(this,_popupElement,null),this.isRenderable=_ref85$isRenderable,this.data=parameters.data,this.layer=parameters.layer,this.linkService=parameters.linkService,this.downloadManager=parameters.downloadManager,this.imageResourcesPath=parameters.imageResourcesPath,this.renderForms=parameters.renderForms,this.svgFactory=parameters.svgFactory,this.annotationStorage=parameters.annotationStorage,this.enableScripting=parameters.enableScripting,this.hasJSActions=parameters.hasJSActions,this._fieldObjects=parameters.fieldObjects,this.parent=parameters.parent,_ref85$isRenderable&&(this.container=this._createContainer(_ref85$ignoreBorder)),_ref85&&this._createQuadrilaterals()}return babelHelpers.createClass(AnnotationElement,[{key:"_isEditable",get:function(){return this.data.isEditable}},{key:"hasPopupData",get:function(){return AnnotationElement._hasPopupData(this.data)}},{key:"updateEdited",value:function(params){var rect;this.container&&(_classPrivateFieldGet(_updates,this)||_classPrivateFieldSet(_updates,this,{rect:this.data.rect.slice(0)}),(rect=params.rect)&&_assertClassBrand(_AnnotationElement_brand,this,_setRectEdited).call(this,rect),null!=(rect=_classPrivateFieldGet(_popupElement,this)))&&rect.popup.updateEdited(params)}},{key:"resetEdited",value:function(){var _classPrivateFieldGet67;_classPrivateFieldGet(_updates,this)&&(_assertClassBrand(_AnnotationElement_brand,this,_setRectEdited).call(this,_classPrivateFieldGet(_updates,this).rect),null!=(_classPrivateFieldGet67=_classPrivateFieldGet(_popupElement,this))&&_classPrivateFieldGet67.popup.resetEdited(),_classPrivateFieldSet(_updates,this,null))}},{key:"_createContainer",value:function(ignoreBorder){var data=this.data,_this$parent2=this.parent,page=_this$parent2.page,_this$parent2=_this$parent2.viewport,container=document.createElement("section"),style=(container.setAttribute("data-annotation-id",data.id),this instanceof WidgetAnnotationElement||(container.tabIndex=0),container.style);if(style.zIndex=this.parent.zIndex++,data.alternativeText&&(container.title=data.alternativeText),data.noRotate&&container.classList.add("norotate"),!data.rect||this instanceof PopupAnnotationElement)_rotation4=data.rotation,data.hasOwnCanvas||0===_rotation4||this.setRotation(_rotation4,container);else{var _rotation4=this.width,height=this.height;if(!ignoreBorder&&0<data.borderStyle.width){style.borderWidth="".concat(data.borderStyle.width,"px");var ignoreBorder=data.borderStyle.horizontalCornerRadius,verticalRadius=data.borderStyle.verticalCornerRadius;switch(0<ignoreBorder||0<verticalRadius?(ignoreBorder="calc(".concat(ignoreBorder,"px * var(--total-scale-factor)) / calc(").concat(verticalRadius,"px * var(--total-scale-factor))"),style.borderRadius=ignoreBorder):this instanceof RadioButtonWidgetAnnotationElement&&(verticalRadius="calc(".concat(_rotation4,"px * var(--total-scale-factor)) / calc(").concat(height,"px * var(--total-scale-factor))"),style.borderRadius=verticalRadius),data.borderStyle.style){case AnnotationBorderStyleType_SOLID:style.borderStyle="solid";break;case AnnotationBorderStyleType_DASHED:style.borderStyle="dashed";break;case AnnotationBorderStyleType_BEVELED:warn("Unimplemented border style: beveled");break;case AnnotationBorderStyleType_INSET:warn("Unimplemented border style: inset");break;case AnnotationBorderStyleType_UNDERLINE:style.borderBottomStyle="solid"}ignoreBorder=data.borderColor||null;ignoreBorder?(_classPrivateFieldSet(_hasBorder,this,!0),style.borderColor=Util.makeHexColor(0|ignoreBorder[0],0|ignoreBorder[1],0|ignoreBorder[2])):style.borderWidth=0}var verticalRadius=Util.normalizeRect([data.rect[0],page.view[3]-data.rect[1]+page.view[1],data.rect[2],page.view[3]-data.rect[3]+page.view[1]]),ignoreBorder=_this$parent2.rawDims,page=ignoreBorder.pageWidth,_this$parent2=ignoreBorder.pageHeight,pageX=ignoreBorder.pageX,ignoreBorder=ignoreBorder.pageY,pageX=(style.left="".concat(100*(verticalRadius[0]-pageX)/page,"%"),style.top="".concat(100*(verticalRadius[1]-ignoreBorder)/_this$parent2,"%"),data.rotation);data.hasOwnCanvas||0===pageX?(style.width="".concat(100*_rotation4/page,"%"),style.height="".concat(100*height/_this$parent2,"%")):this.setRotation(pageX,container)}return container}},{key:"setRotation",value:function(angle){var pageWidth,_this$parent$viewport3,_ref86,width,height,container=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.container;this.data.rect&&(pageWidth=(_this$parent$viewport3=this.parent.viewport.rawDims).pageWidth,_this$parent$viewport3=_this$parent$viewport3.pageHeight,width=this.width,height=this.height,angle%180!=0&&(width=(_ref86=[height,width])[0],height=_ref86[1]),container.style.width="".concat(100*width/pageWidth,"%"),container.style.height="".concat(100*height/_this$parent$viewport3,"%"),container.setAttribute("data-main-rotation",(360-angle)%360))}},{key:"_commonActions",get:function(){function setColor(jsName,styleName,event){var colorType=(jsName=event.detail[jsName])[0],jsName=jsName.slice(1);event.target.style[styleName]=ColorConverters["".concat(colorType,"_HTML")](jsName),_this55.annotationStorage.setValue(_this55.data.id,babelHelpers.defineProperty({},styleName,ColorConverters["".concat(colorType,"_rgb")](jsName)))}var _this55=this;return shadow(this,"_commonActions",{display:function(event){var event=event.detail.display,hidden=event%2==1;_this55.container.style.visibility=hidden?"hidden":"visible",_this55.annotationStorage.setValue(_this55.data.id,{noView:hidden,noPrint:1===event||2===event})},print:function(event){_this55.annotationStorage.setValue(_this55.data.id,{noPrint:!event.detail.print})},hidden:function(event){event=event.detail.hidden;_this55.container.style.visibility=event?"hidden":"visible",_this55.annotationStorage.setValue(_this55.data.id,{noPrint:event,noView:event})},focus:function(event){setTimeout(function(){return event.target.focus({preventScroll:!1})},0)},userName:function(event){event.target.title=event.detail.userName},readonly:function(event){event.target.disabled=event.detail.readonly},required:function(event){_this55._setRequired(event.target,event.detail.required)},bgColor:function(event){setColor("bgColor","backgroundColor",event)},fillColor:function(event){setColor("fillColor","backgroundColor",event)},fgColor:function(event){setColor("fgColor","color",event)},textColor:function(event){setColor("textColor","color",event)},borderColor:function(event){setColor("borderColor","borderColor",event)},strokeColor:function(event){setColor("strokeColor","borderColor",event)},rotation:function(event){event=event.detail.rotation;_this55.setRotation(event),_this55.annotationStorage.setValue(_this55.data.id,{rotation:event})}})}},{key:"_dispatchEventFromSandbox",value:function(actions,jsEvent){for(var commonActions=this._commonActions,_i13=0,_Object$keys=Object.keys(jsEvent.detail);_i13<_Object$keys.length;_i13++){var name=_Object$keys[_i13],name=actions[name]||commonActions[name];null!=name&&name(jsEvent)}}},{key:"_setDefaultPropertiesFromJS",value:function(element){if(this.enableScripting){var storedData=this.annotationStorage.getRawValue(this.data.id);if(storedData)for(var commonActions=this._commonActions,_i14=0,_Object$entries4=Object.entries(storedData);_i14<_Object$entries4.length;_i14++){var _Object$entries4$_i=babelHelpers.slicedToArray(_Object$entries4[_i14],2),actionName=_Object$entries4$_i[0],_Object$entries4$_i=_Object$entries4$_i[1],action=commonActions[actionName];action&&(action({detail:babelHelpers.defineProperty({},actionName,_Object$entries4$_i),target:element}),delete storedData[actionName])}}}},{key:"_createQuadrilaterals",value:function(){if(this.container){var quadPoints=this.data.quadPoints;if(quadPoints){var _this$data$rect$map=this.data.rect.map(function(x){return Math.fround(x)}),_this$data$rect$map=babelHelpers.slicedToArray(_this$data$rect$map,4),rectBlX=_this$data$rect$map[0],rectBlY=_this$data$rect$map[1],rectTrX=_this$data$rect$map[2],rectTrY=_this$data$rect$map[3];if(8===quadPoints.length){var _this$data$rect$map=quadPoints.subarray(2,6),_this$data$rect$map=babelHelpers.slicedToArray(_this$data$rect$map,4),trX=_this$data$rect$map[0],trY=_this$data$rect$map[1],blX=_this$data$rect$map[2],_this$data$rect$map=_this$data$rect$map[3];if(rectTrX===trX&&rectTrY===trY&&rectBlX===blX&&rectBlY===_this$data$rect$map)return}var svgBuffer,trX=this.container.style,width=(_classPrivateFieldGet(_hasBorder,this)&&(trY=trX.borderColor,blX=trX.borderWidth,trX.borderWidth=0,svgBuffer=["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="'.concat(trY,'" stroke-width="').concat(blX,'">')],this.container.classList.add("hasBorder")),rectTrX-rectBlX),height=rectTrY-rectBlY,svgFactory=this.svgFactory,_this$data$rect$map=svgFactory.createElement("svg"),trY=(_this$data$rect$map.classList.add("quadrilateralsContainer"),_this$data$rect$map.setAttribute("width",0),_this$data$rect$map.setAttribute("height",0),_this$data$rect$map.role="none",svgFactory.createElement("defs")),clipPath=(_this$data$rect$map.append(trY),svgFactory.createElement("clipPath")),blX="clippath_".concat(this.data.id);clipPath.setAttribute("id",blX),clipPath.setAttribute("clipPathUnits","objectBoundingBox"),trY.append(clipPath);for(var i=2,ii=quadPoints.length;i<ii;i+=8){var _trX=quadPoints[i],_trY=quadPoints[i+1],_blX=quadPoints[i+2],_blY=quadPoints[i+3],rect=svgFactory.createElement("rect"),x=(_blX-rectBlX)/width,y=(rectTrY-_trY)/height,_trX=(_trX-_blX)/width,_blX=(_trY-_blY)/height;rect.setAttribute("x",x),rect.setAttribute("y",y),rect.setAttribute("width",_trX),rect.setAttribute("height",_blX),clipPath.append(rect),null!=svgBuffer&&svgBuffer.push('<rect vector-effect="non-scaling-stroke" x="'.concat(x,'" y="').concat(y,'" width="').concat(_trX,'" height="').concat(_blX,'"/>'))}_classPrivateFieldGet(_hasBorder,this)&&(svgBuffer.push("</g></svg>')"),trX.backgroundImage=svgBuffer.join("")),this.container.append(_this$data$rect$map),this.container.style.clipPath="url(#".concat(blX,")")}}}},{key:"_createPopup",value:function(){var data=this.data,data=_classPrivateFieldSet(_popupElement,this,new PopupAnnotationElement({data:{color:data.color,titleObj:data.titleObj,modificationDate:data.modificationDate,contentsObj:data.contentsObj,richText:data.richText,parentRect:data.rect,borderStyle:0,id:"popup_".concat(data.id),rotation:data.rotation,noRotate:!0},parent:this.parent,elements:[this]}));this.parent.div.append(data.render())}},{key:"render",value:function(){unreachable("Abstract method `AnnotationElement.render` called")}},{key:"_getElementsByName",value:function(name){var skipId=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,fields=[];if(this._fieldObjects){var fieldObj=this._fieldObjects[name];if(fieldObj){var _step112,_iterator112=_createForOfIteratorHelper(fieldObj);try{for(_iterator112.s();!(_step112=_iterator112.n()).done;){var exportValue,domElement,_step112$value=_step112.value,page=_step112$value.page,id=_step112$value.id,exportValues=_step112$value.exportValues;-1!==page&&id!==skipId&&(exportValue="string"==typeof exportValues?exportValues:null,(domElement=document.querySelector('[data-element-id="'.concat(id,'"]')))&&!GetElementsByNameSet.has(domElement)?warn("_getElementsByName - element not allowed: ".concat(id)):fields.push({id:id,exportValue:exportValue,domElement:domElement}))}}catch(err){_iterator112.e(err)}finally{_iterator112.f()}}}else{var _step113,_iterator113=_createForOfIteratorHelper(document.getElementsByName(name));try{for(_iterator113.s();!(_step113=_iterator113.n()).done;){var _domElement=_step113.value,_exportValue=_domElement.exportValue,_id7=_domElement.getAttribute("data-element-id");_id7!==skipId&&GetElementsByNameSet.has(_domElement)&&fields.push({id:_id7,exportValue:_exportValue,domElement:_domElement})}}catch(err){_iterator113.e(err)}finally{_iterator113.f()}}return fields}},{key:"show",value:function(){var _this$popup;this.container&&(this.container.hidden=!1),null!=(_this$popup=this.popup)&&_this$popup.maybeShow()}},{key:"hide",value:function(){var _this$popup2;this.container&&(this.container.hidden=!0),null!=(_this$popup2=this.popup)&&_this$popup2.forceHide()}},{key:"getElementsToTriggerPopup",value:function(){return this.container}},{key:"addHighlightArea",value:function(){var triggers=this.getElementsToTriggerPopup();if(Array.isArray(triggers)){var _step114,_iterator114=_createForOfIteratorHelper(triggers);try{for(_iterator114.s();!(_step114=_iterator114.n()).done;)_step114.value.classList.add("highlightArea")}catch(err){_iterator114.e(err)}finally{_iterator114.f()}}else triggers.classList.add("highlightArea")}},{key:"_editOnDoubleClick",value:function(){var mode,editId,_this56=this;this._isEditable&&(mode=this.annotationEditorType,editId=this.data.id,this.container.addEventListener("dblclick",function(){var _this56$linkService$e;null!=(_this56$linkService$e=_this56.linkService.eventBus)&&_this56$linkService$e.dispatch("switchannotationeditormode",{source:_this56,mode:mode,editId:editId,mustEnterInEditMode:!0})}))}},{key:"width",get:function(){return this.data.rect[2]-this.data.rect[0]}},{key:"height",get:function(){return this.data.rect[3]-this.data.rect[1]}}],[{key:"_hasPopupData",value:function(_ref87){var contentsObj=_ref87.contentsObj,_ref87=_ref87.richText;return!!(null!=contentsObj&&contentsObj.str||null!=_ref87&&_ref87.str)}}])}();function _setRectEdited(rect){var style=this.container.style,_this$data7=this.data,currentRect=_this$data7.rect,_this$data7=_this$data7.rotation,_this$parent$viewport10=this.parent.viewport.rawDims,pageWidth=_this$parent$viewport10.pageWidth,pageHeight=_this$parent$viewport10.pageHeight,pageX=_this$parent$viewport10.pageX,_this$parent$viewport10=_this$parent$viewport10.pageY;null!=currentRect&&currentRect.splice.apply(currentRect,[0,4].concat(babelHelpers.toConsumableArray(rect))),style.left="".concat(100*(rect[0]-pageX)/pageWidth,"%"),style.top="".concat(100*(pageHeight-rect[3]+_this$parent$viewport10)/pageHeight,"%"),0===_this$data7?(style.width="".concat(100*(rect[2]-rect[0])/pageWidth,"%"),style.height="".concat(100*(rect[3]-rect[1])/pageHeight,"%")):this.setRotation(_this$data7)}var _LinkAnnotationElement_brand=new WeakSet,LinkAnnotationElement=function(){function LinkAnnotationElement(parameters){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return babelHelpers.classCallCheck(this,LinkAnnotationElement),_classPrivateMethodInitSpec(options=_callSuper(this,LinkAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!(null==options||!options.ignoreBorder),createQuadrilaterals:!0}]),_LinkAnnotationElement_brand),options.isTooltipOnly=parameters.data.isTooltipOnly,options}return babelHelpers.inherits(LinkAnnotationElement,AnnotationElement),babelHelpers.createClass(LinkAnnotationElement,[{key:"render",value:function(){var data=this.data,linkService=this.linkService,link=document.createElement("a"),isBound=(link.setAttribute("data-element-id",data.id),!1);return data.url?(linkService.addLinkAttributes(link,data.url,data.newWindow),isBound=!0):data.action?(this._bindNamedAction(link,data.action),isBound=!0):data.attachment?(_assertClassBrand(_LinkAnnotationElement_brand,this,_bindAttachment).call(this,link,data.attachment,data.attachmentDest),isBound=!0):data.setOCGState?(_assertClassBrand(_LinkAnnotationElement_brand,this,_bindSetOCGState).call(this,link,data.setOCGState),isBound=!0):data.dest?(this._bindLink(link,data.dest),isBound=!0):(data.actions&&(data.actions.Action||data.actions["Mouse Up"]||data.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(link,data),isBound=!0),data.resetForm?(this._bindResetFormAction(link,data.resetForm),isBound=!0):this.isTooltipOnly&&!isBound&&(this._bindLink(link,""),isBound=!0)),this.container.classList.add("linkAnnotation"),isBound&&this.container.append(link),this.container}},{key:"_bindLink",value:function(link,destination){var _this58=this;link.href=this.linkService.getDestinationHash(destination),link.onclick=function(){return destination&&_this58.linkService.goToDestination(destination),!1},!destination&&""!==destination||_assertClassBrand(_LinkAnnotationElement_brand,this,_setInternalLink).call(this)}},{key:"_bindNamedAction",value:function(link,action){var _this59=this;link.href=this.linkService.getAnchorUrl(""),link.onclick=function(){return _this59.linkService.executeNamedAction(action),!1},_assertClassBrand(_LinkAnnotationElement_brand,this,_setInternalLink).call(this)}},{key:"_bindJSAction",value:function(link,data){for(var _this60=this,map=(link.href=this.linkService.getAnchorUrl(""),new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]])),_i15=0,_Object$keys2=Object.keys(data.actions);_i15<_Object$keys2.length;_i15++)!function(){var name=_Object$keys2[_i15],jsName=map.get(name);if(!jsName)return;link[jsName]=function(){var _this60$linkService$e;return null!=(_this60$linkService$e=_this60.linkService.eventBus)&&_this60$linkService$e.dispatch("dispatcheventinsandbox",{source:_this60,detail:{id:data.id,name:name}}),!1}}();link.onclick||(link.onclick=function(){return!1}),_assertClassBrand(_LinkAnnotationElement_brand,this,_setInternalLink).call(this)}},{key:"_bindResetFormAction",value:function(link,resetForm){var _this61=this,otherClickAction=link.onclick;otherClickAction||(link.href=this.linkService.getAnchorUrl("")),_assertClassBrand(_LinkAnnotationElement_brand,this,_setInternalLink).call(this),this._fieldObjects?link.onclick=function(){null!=otherClickAction&&otherClickAction();var resetFormFields=resetForm.fields,resetFormRefs=resetForm.refs,include=resetForm.include,allFields=[];if(0!==resetFormFields.length||0!==resetFormRefs.length){var _step115,fieldIds=new Set(resetFormRefs),_iterator115=_createForOfIteratorHelper(resetFormFields);try{for(_iterator115.s();!(_step115=_iterator115.n()).done;){var _step117,fieldName=_step115.value,_iterator117=_createForOfIteratorHelper(_this61._fieldObjects[fieldName]||[]);try{for(_iterator117.s();!(_step117=_iterator117.n()).done;){var id=_step117.value.id;fieldIds.add(id)}}catch(err){_iterator117.e(err)}finally{_iterator117.f()}}}catch(err){_iterator115.e(err)}finally{_iterator115.f()}for(var _i16=0,_Object$values=Object.values(_this61._fieldObjects);_i16<_Object$values.length;_i16++){var _step116,_iterator116=_createForOfIteratorHelper(_Object$values[_i16]);try{for(_iterator116.s();!(_step116=_iterator116.n()).done;){var field=_step116.value;fieldIds.has(field.id)===include&&allFields.push(field)}}catch(err){_iterator116.e(err)}finally{_iterator116.f()}}}else for(var _i17=0,_Object$values2=Object.values(_this61._fieldObjects);_i17<_Object$values2.length;_i17++){var _fields2=_Object$values2[_i17];allFields.push.apply(allFields,babelHelpers.toConsumableArray(_fields2))}for(var storage=_this61.annotationStorage,allIds=[],_i18=0,_allFields=allFields;_i18<_allFields.length;_i18++){var _field=_allFields[_i18],_id8=_field.id;switch(allIds.push(_id8),_field.type){case"text":var value=_field.defaultValue||"";storage.setValue(_id8,{value:value});break;case"checkbox":case"radiobutton":value=_field.defaultValue===_field.exportValues;storage.setValue(_id8,{value:value});break;case"combobox":case"listbox":var _value3=_field.defaultValue||"";storage.setValue(_id8,{value:_value3});break;default:continue}var domElement=document.querySelector('[data-element-id="'.concat(_id8,'"]'));domElement&&(GetElementsByNameSet.has(domElement)?domElement.dispatchEvent(new Event("resetform")):warn("_bindResetFormAction - element not allowed: ".concat(_id8)))}return _this61.enableScripting&&null!=(resetFormRefs=_this61.linkService.eventBus)&&resetFormRefs.dispatch("dispatcheventinsandbox",{source:_this61,detail:{id:"app",ids:allIds,name:"ResetForm"}}),!1}:(warn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),otherClickAction||(link.onclick=function(){return!1}))}}])}();function _setInternalLink(){this.container.setAttribute("data-internal-link","")}function _bindAttachment(link,attachment){var _this115=this,dest=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;link.href=this.linkService.getAnchorUrl(""),attachment.description&&(link.title=attachment.description),link.onclick=function(){var _this115$downloadMana;return null!=(_this115$downloadMana=_this115.downloadManager)&&_this115$downloadMana.openOrDownloadData(attachment.content,attachment.filename,dest),!1},_assertClassBrand(_LinkAnnotationElement_brand,this,_setInternalLink).call(this)}function _bindSetOCGState(link,action){var _this116=this;link.href=this.linkService.getAnchorUrl(""),link.onclick=function(){return _this116.linkService.executeSetOCGState(action),!1},_assertClassBrand(_LinkAnnotationElement_brand,this,_setInternalLink).call(this)}var TextAnnotationElement=function(){function TextAnnotationElement(parameters){return babelHelpers.classCallCheck(this,TextAnnotationElement),_callSuper(this,TextAnnotationElement,[parameters,{isRenderable:!0}])}return babelHelpers.inherits(TextAnnotationElement,AnnotationElement),babelHelpers.createClass(TextAnnotationElement,[{key:"render",value:function(){this.container.classList.add("textAnnotation");var image=document.createElement("img");return image.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",image.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),image.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(image),this.container}}])}(),WidgetAnnotationElement=function(){function WidgetAnnotationElement(){return babelHelpers.classCallCheck(this,WidgetAnnotationElement),_callSuper(this,WidgetAnnotationElement,arguments)}return babelHelpers.inherits(WidgetAnnotationElement,AnnotationElement),babelHelpers.createClass(WidgetAnnotationElement,[{key:"render",value:function(){return this.container}},{key:"showElementAndHideCanvas",value:function(element){var _element$previousSibl;this.data.hasOwnCanvas&&("CANVAS"===(null==(_element$previousSibl=element.previousSibling)?void 0:_element$previousSibl.nodeName)&&(element.previousSibling.hidden=!0),element.hidden=!1)}},{key:"_getKeyModifier",value:function(event){return util_FeatureTest.platform.isMac?event.metaKey:event.ctrlKey}},{key:"_setEventListener",value:function(element,elementData,baseName,eventName,valueGetter){var _this62=this;baseName.includes("mouse")?element.addEventListener(baseName,function(event){var _this62$linkService$e;null!=(_this62$linkService$e=_this62.linkService.eventBus)&&_this62$linkService$e.dispatch("dispatcheventinsandbox",{source:_this62,detail:{id:_this62.data.id,name:eventName,value:valueGetter(event),shift:event.shiftKey,modifier:_this62._getKeyModifier(event)}})}):element.addEventListener(baseName,function(event){var _this62$linkService$e2;if("blur"===baseName){if(!elementData.focused||!event.relatedTarget)return;elementData.focused=!1}else if("focus"===baseName){if(elementData.focused)return;elementData.focused=!0}valueGetter&&null!=(_this62$linkService$e2=_this62.linkService.eventBus)&&_this62$linkService$e2.dispatch("dispatcheventinsandbox",{source:_this62,detail:{id:_this62.data.id,name:eventName,value:valueGetter(event)}})})}},{key:"_setEventListeners",value:function(element,elementData,names,getter){var _step118,_iterator118=_createForOfIteratorHelper(names);try{for(_iterator118.s();!(_step118=_iterator118.n()).done;){var _this$data$actions,_this$data$actions2,_this$data$actions3,_step118$value=babelHelpers.slicedToArray(_step118.value,2),baseName=_step118$value[0],eventName=_step118$value[1];("Action"===eventName||null!=(_this$data$actions=this.data.actions)&&_this$data$actions[eventName])&&("Focus"!==eventName&&"Blur"!==eventName||(elementData=elementData||{focused:!1}),this._setEventListener(element,elementData,baseName,eventName,getter),"Focus"!==eventName||null!=(_this$data$actions2=this.data.actions)&&_this$data$actions2.Blur?"Blur"!==eventName||null!=(_this$data$actions3=this.data.actions)&&_this$data$actions3.Focus||this._setEventListener(element,elementData,"focus","Focus",null):this._setEventListener(element,elementData,"blur","Blur",null))}}catch(err){_iterator118.e(err)}finally{_iterator118.f()}}},{key:"_setBackgroundColor",value:function(element){var color=this.data.backgroundColor||null;element.style.backgroundColor=null===color?"transparent":Util.makeHexColor(color[0],color[1],color[2])}},{key:"_setTextStyle",value:function(element){function roundToOneDecimal(x){return Math.round(10*x)/10}var numberOfLines,height,fontColor=this.data.defaultAppearanceData.fontColor,fontSize=this.data.defaultAppearanceData.fontSize||9,element=element.style;numberOfLines=this.data.multiLine?(height=Math.abs(this.data.rect[3]-this.data.rect[1]-2),numberOfLines=Math.round(height/(1.35*fontSize))||1,Math.min(fontSize,roundToOneDecimal(height/numberOfLines/1.35))):(height=Math.abs(this.data.rect[3]-this.data.rect[1]-2),Math.min(fontSize,roundToOneDecimal(height/1.35))),element.fontSize="calc(".concat(numberOfLines,"px * var(--total-scale-factor))"),element.color=Util.makeHexColor(fontColor[0],fontColor[1],fontColor[2]),null!==this.data.textAlignment&&(element.textAlign=["left","center","right"][this.data.textAlignment])}},{key:"_setRequired",value:function(element,isRequired){isRequired?element.setAttribute("required",!0):element.removeAttribute("required"),element.setAttribute("aria-required",isRequired)}}])}(),TextWidgetAnnotationElement=function(){function TextWidgetAnnotationElement(parameters){return babelHelpers.classCallCheck(this,TextWidgetAnnotationElement),_callSuper(this,TextWidgetAnnotationElement,[parameters,{isRenderable:parameters.renderForms||parameters.data.hasOwnCanvas||!parameters.data.hasAppearance&&!!parameters.data.fieldValue}])}return babelHelpers.inherits(TextWidgetAnnotationElement,WidgetAnnotationElement),babelHelpers.createClass(TextWidgetAnnotationElement,[{key:"setPropertyOnSiblings",value:function(base,key,value,keyInStorage){var _step119,storage=this.annotationStorage,_iterator119=_createForOfIteratorHelper(this._getElementsByName(base.name,base.id));try{for(_iterator119.s();!(_step119=_iterator119.n()).done;){var element=_step119.value;element.domElement&&(element.domElement[key]=value),storage.setValue(element.id,babelHelpers.defineProperty({},keyInStorage,value))}}catch(err){_iterator119.e(err)}finally{_iterator119.f()}}},{key:"render",value:function(){var maxLen,elementData,_blurListener,textContent,storedData,_this63=this,storage=this.annotationStorage,id=this.data.id,element=(this.container.classList.add("textWidgetAnnotation"),null);return this.renderForms?(textContent=(storedData=storage.getValue(id,{value:this.data.fieldValue})).value||"",(maxLen=storage.getValue(id,{charLimit:this.data.maxLen}).charLimit)&&textContent.length>maxLen&&(textContent=textContent.slice(0,maxLen)),storedData=storedData.formattedValue||(null==(storedData=this.data.textContent)?void 0:storedData.join("\n"))||null,elementData={userValue:textContent,formattedValue:storedData=storedData&&this.data.comb?storedData.replaceAll(/\s+/g,""):storedData,lastCommittedValue:null,commitKey:1,focused:!1},this.data.multiLine?((element=document.createElement("textarea")).textContent=null!=storedData?storedData:textContent,this.data.doNotScroll&&(element.style.overflowY="hidden")):((element=document.createElement("input")).type=this.data.password?"password":"text",element.setAttribute("value",null!=storedData?storedData:textContent),this.data.doNotScroll&&(element.style.overflowX="hidden")),this.data.hasOwnCanvas&&(element.hidden=!0),GetElementsByNameSet.add(element),element.setAttribute("data-element-id",id),element.disabled=this.data.readOnly,element.name=this.data.fieldName,element.tabIndex=0,(storedData=this.data.dateFormat||this.data.timeFormat)&&(element.title=storedData),this._setRequired(element,this.data.required),maxLen&&(element.maxLength=maxLen),element.addEventListener("input",function(event){storage.setValue(id,{value:event.target.value}),_this63.setPropertyOnSiblings(element,"value",event.target.value,"value"),elementData.formattedValue=null}),element.addEventListener("resetform",function(event){var _this63$data$defaultF=null!=(_this63$data$defaultF=_this63.data.defaultFieldValue)?_this63$data$defaultF:"";element.value=elementData.userValue=_this63$data$defaultF,elementData.formattedValue=null}),textContent=function(event){var formattedValue=elementData.formattedValue;null!=formattedValue&&(event.target.value=formattedValue),event.target.scrollLeft=0},this.enableScripting&&this.hasJSActions&&(element.addEventListener("focus",function(event){elementData.focused||(event=event.target,elementData.userValue&&(event.value=elementData.userValue),elementData.lastCommittedValue=event.value,elementData.commitKey=1,null!=(event=_this63.data.actions)&&event.Focus)||(elementData.focused=!0)}),element.addEventListener("updatefromsandbox",function(jsEvent){_this63.showElementAndHideCanvas(jsEvent.target),_this63._dispatchEventFromSandbox({value:function(event){var _event$detail$value;elementData.userValue=null!=(_event$detail$value=event.detail.value)?_event$detail$value:"",storage.setValue(id,{value:elementData.userValue.toString()}),event.target.value=elementData.userValue},formattedValue:function(event){var formattedValue=event.detail.formattedValue;null!=(elementData.formattedValue=formattedValue)&&event.target!==document.activeElement&&(event.target.value=formattedValue),storage.setValue(id,{formattedValue:formattedValue})},selRange:function(event){var _event$target;(_event$target=event.target).setSelectionRange.apply(_event$target,babelHelpers.toConsumableArray(event.detail.selRange))},charLimit:function(event){var value,charLimit=event.detail.charLimit,event=event.target;0===charLimit?event.removeAttribute("maxLength"):(event.setAttribute("maxLength",charLimit),!(value=elementData.userValue)||value.length<=charLimit||(value=value.slice(0,charLimit),event.value=elementData.userValue=value,storage.setValue(id,{value:value}),null!=(charLimit=_this63.linkService.eventBus)&&charLimit.dispatch("dispatcheventinsandbox",{source:_this63,detail:{id:id,name:"Keystroke",value:value,willCommit:!0,commitKey:1,selStart:event.selectionStart,selEnd:event.selectionEnd}})))}},jsEvent)}),element.addEventListener("keydown",function(event){var _this63$linkService$e2,value,commitKey=-(elementData.commitKey=1);"Escape"===event.key?commitKey=0:"Enter"!==event.key||_this63.data.multiLine?"Tab"===event.key&&(elementData.commitKey=3):commitKey=2,-1!==commitKey&&(value=event.target.value,elementData.lastCommittedValue!==value)&&(elementData.lastCommittedValue=value,elementData.userValue=value,null!=(_this63$linkService$e2=_this63.linkService.eventBus))&&_this63$linkService$e2.dispatch("dispatcheventinsandbox",{source:_this63,detail:{id:id,name:"Keystroke",value:value,willCommit:!0,commitKey:commitKey,selStart:event.target.selectionStart,selEnd:event.target.selectionEnd}})}),_blurListener=textContent,textContent=null,element.addEventListener("blur",function(event){var _this63$data$actions2,_this63$linkService$e3;elementData.focused&&event.relatedTarget&&(null!=(_this63$data$actions2=_this63.data.actions)&&_this63$data$actions2.Blur||(elementData.focused=!1),_this63$data$actions2=event.target.value,elementData.userValue=_this63$data$actions2,elementData.lastCommittedValue!==_this63$data$actions2&&null!=(_this63$linkService$e3=_this63.linkService.eventBus)&&_this63$linkService$e3.dispatch("dispatcheventinsandbox",{source:_this63,detail:{id:id,name:"Keystroke",value:_this63$data$actions2,willCommit:!0,commitKey:elementData.commitKey,selStart:event.target.selectionStart,selEnd:event.target.selectionEnd}}),_blurListener(event))}),null!=(storedData=this.data.actions)&&storedData.Keystroke&&element.addEventListener("beforeinput",function(event){elementData.lastCommittedValue=null;var data=event.data,target=event.target,value=target.value,selectionStart=target.selectionStart,selectionEnd=target.selectionEnd,selStart=selectionStart,selEnd=selectionEnd;switch(event.inputType){case"deleteWordBackward":var match=value.substring(0,selectionStart).match(/\w*[^\w]*$/);match&&(selStart-=match[0].length);break;case"deleteWordForward":match=value.substring(selectionStart).match(/^[^\w]*\w*/);match&&(selEnd+=match[0].length);break;case"deleteContentBackward":selectionStart===selectionEnd&&--selStart;break;case"deleteContentForward":selectionStart===selectionEnd&&(selEnd+=1)}event.preventDefault(),null!=(target=_this63.linkService.eventBus)&&target.dispatch("dispatcheventinsandbox",{source:_this63,detail:{id:id,name:"Keystroke",value:value,change:data||"",willCommit:!1,selStart:selStart,selEnd:selEnd}})}),this._setEventListeners(element,elementData,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],function(event){return event.target.value})),textContent&&element.addEventListener("blur",textContent),this.data.comb&&(storedData=(this.data.rect[2]-this.data.rect[0])/maxLen,element.classList.add("comb"),element.style.letterSpacing="calc(".concat(storedData,"px * var(--total-scale-factor) - 1ch)"))):((element=document.createElement("div")).textContent=this.data.fieldValue,element.style.verticalAlign="middle",element.style.display="table-cell",this.data.hasOwnCanvas&&(element.hidden=!0)),this._setTextStyle(element),this._setBackgroundColor(element),this._setDefaultPropertiesFromJS(element),this.container.append(element),this.container}}])}(),SignatureWidgetAnnotationElement=function(){function SignatureWidgetAnnotationElement(parameters){return babelHelpers.classCallCheck(this,SignatureWidgetAnnotationElement),_callSuper(this,SignatureWidgetAnnotationElement,[parameters,{isRenderable:!!parameters.data.hasOwnCanvas}])}return babelHelpers.inherits(SignatureWidgetAnnotationElement,WidgetAnnotationElement),babelHelpers.createClass(SignatureWidgetAnnotationElement)}(),CheckboxWidgetAnnotationElement=function(){function CheckboxWidgetAnnotationElement(parameters){return babelHelpers.classCallCheck(this,CheckboxWidgetAnnotationElement),_callSuper(this,CheckboxWidgetAnnotationElement,[parameters,{isRenderable:parameters.renderForms}])}return babelHelpers.inherits(CheckboxWidgetAnnotationElement,WidgetAnnotationElement),babelHelpers.createClass(CheckboxWidgetAnnotationElement,[{key:"render",value:function(){var _this64=this,storage=this.annotationStorage,data=this.data,id=data.id,value=storage.getValue(id,{value:data.exportValue===data.fieldValue}).value,element=("string"==typeof value&&storage.setValue(id,{value:value="Off"!==value}),this.container.classList.add("buttonWidgetAnnotation","checkBox"),document.createElement("input"));return GetElementsByNameSet.add(element),element.setAttribute("data-element-id",id),element.disabled=data.readOnly,this._setRequired(element,this.data.required),element.type="checkbox",element.name=data.fieldName,value&&element.setAttribute("checked",!0),element.setAttribute("exportValue",data.exportValue),element.tabIndex=0,element.addEventListener("change",function(event){var _step120,event=event.target,name=event.name,checked=event.checked,_iterator120=_createForOfIteratorHelper(_this64._getElementsByName(name,id));try{for(_iterator120.s();!(_step120=_iterator120.n()).done;){var checkbox=_step120.value,curChecked=checked&&checkbox.exportValue===data.exportValue;checkbox.domElement&&(checkbox.domElement.checked=curChecked),storage.setValue(checkbox.id,{value:curChecked})}}catch(err){_iterator120.e(err)}finally{_iterator120.f()}storage.setValue(id,{value:checked})}),element.addEventListener("resetform",function(event){var defaultValue=data.defaultFieldValue||"Off";event.target.checked=defaultValue===data.exportValue}),this.enableScripting&&this.hasJSActions&&(element.addEventListener("updatefromsandbox",function(jsEvent){_this64._dispatchEventFromSandbox({value:function(event){event.target.checked="Off"!==event.detail.value,storage.setValue(id,{value:event.target.checked})}},jsEvent)}),this._setEventListeners(element,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],function(event){return event.target.checked})),this._setBackgroundColor(element),this._setDefaultPropertiesFromJS(element),this.container.append(element),this.container}}])}(),RadioButtonWidgetAnnotationElement=function(){function RadioButtonWidgetAnnotationElement(parameters){return babelHelpers.classCallCheck(this,RadioButtonWidgetAnnotationElement),_callSuper(this,RadioButtonWidgetAnnotationElement,[parameters,{isRenderable:parameters.renderForms}])}return babelHelpers.inherits(RadioButtonWidgetAnnotationElement,WidgetAnnotationElement),babelHelpers.createClass(RadioButtonWidgetAnnotationElement,[{key:"render",value:function(){var _this65=this,storage=(this.container.classList.add("buttonWidgetAnnotation","radioButton"),this.annotationStorage),data=this.data,id=data.id,value=storage.getValue(id,{value:data.fieldValue===data.buttonValue}).value;if("string"==typeof value&&(value=value!==data.buttonValue,storage.setValue(id,{value:value})),value){var _step121,_iterator121=_createForOfIteratorHelper(this._getElementsByName(data.fieldName,id));try{for(_iterator121.s();!(_step121=_iterator121.n()).done;){var radio=_step121.value;storage.setValue(radio.id,{value:!1})}}catch(err){_iterator121.e(err)}finally{_iterator121.f()}}var pdfButtonValue,element=document.createElement("input");return GetElementsByNameSet.add(element),element.setAttribute("data-element-id",id),element.disabled=data.readOnly,this._setRequired(element,this.data.required),element.type="radio",element.name=data.fieldName,value&&element.setAttribute("checked",!0),element.tabIndex=0,element.addEventListener("change",function(event){var _step122,event=event.target,name=event.name,event=event.checked,_iterator122=_createForOfIteratorHelper(_this65._getElementsByName(name,id));try{for(_iterator122.s();!(_step122=_iterator122.n()).done;){var _radio=_step122.value;storage.setValue(_radio.id,{value:!1})}}catch(err){_iterator122.e(err)}finally{_iterator122.f()}storage.setValue(id,{value:event})}),element.addEventListener("resetform",function(event){var defaultValue=data.defaultFieldValue;event.target.checked=null!=defaultValue&&defaultValue===data.buttonValue}),this.enableScripting&&this.hasJSActions&&(pdfButtonValue=data.buttonValue,element.addEventListener("updatefromsandbox",function(jsEvent){_this65._dispatchEventFromSandbox({value:function(event){var _step123,checked=pdfButtonValue===event.detail.value,_iterator123=_createForOfIteratorHelper(_this65._getElementsByName(event.target.name));try{for(_iterator123.s();!(_step123=_iterator123.n()).done;){var _radio2=_step123.value,curChecked=checked&&_radio2.id===id;_radio2.domElement&&(_radio2.domElement.checked=curChecked),storage.setValue(_radio2.id,{value:curChecked})}}catch(err){_iterator123.e(err)}finally{_iterator123.f()}}},jsEvent)}),this._setEventListeners(element,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],function(event){return event.target.checked})),this._setBackgroundColor(element),this._setDefaultPropertiesFromJS(element),this.container.append(element),this.container}}])}(),PushButtonWidgetAnnotationElement=function(){function PushButtonWidgetAnnotationElement(parameters){return babelHelpers.classCallCheck(this,PushButtonWidgetAnnotationElement),_callSuper(this,PushButtonWidgetAnnotationElement,[parameters,{ignoreBorder:parameters.data.hasAppearance}])}return babelHelpers.inherits(PushButtonWidgetAnnotationElement,LinkAnnotationElement),babelHelpers.createClass(PushButtonWidgetAnnotationElement,[{key:"render",value:function(){var _this66=this,container=_superPropGet(PushButtonWidgetAnnotationElement,"render",this,3)([]),linkElement=(container.classList.add("buttonWidgetAnnotation","pushButton"),container.lastChild);return this.enableScripting&&this.hasJSActions&&linkElement&&(this._setDefaultPropertiesFromJS(linkElement),linkElement.addEventListener("updatefromsandbox",function(jsEvent){_this66._dispatchEventFromSandbox({},jsEvent)})),container}}])}(),ChoiceWidgetAnnotationElement=function(){function ChoiceWidgetAnnotationElement(parameters){return babelHelpers.classCallCheck(this,ChoiceWidgetAnnotationElement),_callSuper(this,ChoiceWidgetAnnotationElement,[parameters,{isRenderable:parameters.renderForms}])}return babelHelpers.inherits(ChoiceWidgetAnnotationElement,WidgetAnnotationElement),babelHelpers.createClass(ChoiceWidgetAnnotationElement,[{key:"render",value:function(){var _step125,_this67=this,storage=(this.container.classList.add("choiceWidgetAnnotation"),this.annotationStorage),id=this.data.id,storedData=storage.getValue(id,{value:this.data.fieldValue}),selectElement=document.createElement("select"),addAnEmptyEntry=(GetElementsByNameSet.add(selectElement),selectElement.setAttribute("data-element-id",id),selectElement.disabled=this.data.readOnly,this._setRequired(selectElement,this.data.required),selectElement.name=this.data.fieldName,selectElement.tabIndex=0,this.data.combo&&0<this.data.options.length),_iterator125=(this.data.combo||(selectElement.size=this.data.options.length,this.data.multiSelect&&(selectElement.multiple=!0)),selectElement.addEventListener("resetform",function(event){var _step124,defaultValue=_this67.data.defaultFieldValue,_iterator124=_createForOfIteratorHelper(selectElement.options);try{for(_iterator124.s();!(_step124=_iterator124.n()).done;){var option=_step124.value;option.selected=option.value===defaultValue}}catch(err){_iterator124.e(err)}finally{_iterator124.f()}}),_createForOfIteratorHelper(this.data.options));try{for(_iterator125.s();!(_step125=_iterator125.n()).done;){var option=_step125.value,optionElement=document.createElement("option");optionElement.textContent=option.displayValue,optionElement.value=option.exportValue,storedData.value.includes(option.exportValue)&&(optionElement.setAttribute("selected",!0),addAnEmptyEntry=!1),selectElement.append(optionElement)}}catch(err){_iterator125.e(err)}finally{_iterator125.f()}function getValue(isExport){var name=isExport?"value":"textContent",isExport=selectElement.options;return selectElement.multiple?Array.prototype.filter.call(isExport,function(option){return option.selected}).map(function(option){return option[name]}):-1===isExport.selectedIndex?null:isExport[isExport.selectedIndex][name]}function getItems(event){return event=event.target.options,Array.prototype.map.call(event,function(option){return{displayValue:option.textContent,exportValue:option.value}})}var noneOptionElement,removeEmptyEntry=null,selectedValues=(addAnEmptyEntry&&((noneOptionElement=document.createElement("option")).value=" ",noneOptionElement.setAttribute("hidden",!0),noneOptionElement.setAttribute("selected",!0),selectElement.prepend(noneOptionElement),removeEmptyEntry=function(){noneOptionElement.remove(),selectElement.removeEventListener("input",removeEmptyEntry),removeEmptyEntry=null},selectElement.addEventListener("input",removeEmptyEntry)),getValue(!1));return this.enableScripting&&this.hasJSActions?(selectElement.addEventListener("updatefromsandbox",function(jsEvent){_this67._dispatchEventFromSandbox({value:function(event){null!=removeEmptyEntry&&removeEmptyEntry();var _step126,event=event.detail.value,values=new Set(Array.isArray(event)?event:[event]),_iterator126=_createForOfIteratorHelper(selectElement.options);try{for(_iterator126.s();!(_step126=_iterator126.n()).done;){var option=_step126.value;option.selected=values.has(option.value)}}catch(err){_iterator126.e(err)}finally{_iterator126.f()}storage.setValue(id,{value:getValue(!0)}),selectedValues=getValue(!1)},multipleSelection:function(event){selectElement.multiple=!0},remove:function(event){var options=selectElement.options,index=event.detail.remove;options[index].selected=!1,selectElement.remove(index),0<options.length&&-1===Array.prototype.findIndex.call(options,function(option){return option.selected})&&(options[0].selected=!0),storage.setValue(id,{value:getValue(!0),items:getItems(event)}),selectedValues=getValue(!1)},clear:function(event){for(;0!==selectElement.length;)selectElement.remove(0);storage.setValue(id,{value:null,items:[]}),selectedValues=getValue(!1)},insert:function(event){var _event$detail$insert=event.detail.insert,index=_event$detail$insert.index,displayValue=_event$detail$insert.displayValue,_event$detail$insert=_event$detail$insert.exportValue,index=selectElement.children[index],optionElement=document.createElement("option");optionElement.textContent=displayValue,optionElement.value=_event$detail$insert,index?index.before(optionElement):selectElement.append(optionElement),storage.setValue(id,{value:getValue(!0),items:getItems(event)}),selectedValues=getValue(!1)},items:function(event){for(var items=event.detail.items;0!==selectElement.length;)selectElement.remove(0);var _step127,_iterator127=_createForOfIteratorHelper(items);try{for(_iterator127.s();!(_step127=_iterator127.n()).done;){var item=_step127.value,displayValue=item.displayValue,exportValue=item.exportValue,optionElement=document.createElement("option");optionElement.textContent=displayValue,optionElement.value=exportValue,selectElement.append(optionElement)}}catch(err){_iterator127.e(err)}finally{_iterator127.f()}0<selectElement.options.length&&(selectElement.options[0].selected=!0),storage.setValue(id,{value:getValue(!0),items:getItems(event)}),selectedValues=getValue(!1)},indices:function(event){var _step128,indices=new Set(event.detail.indices),_iterator128=_createForOfIteratorHelper(event.target.options);try{for(_iterator128.s();!(_step128=_iterator128.n()).done;){var option=_step128.value;option.selected=indices.has(option.index)}}catch(err){_iterator128.e(err)}finally{_iterator128.f()}storage.setValue(id,{value:getValue(!0)}),selectedValues=getValue(!1)},editable:function(event){event.target.disabled=!event.detail.editable}},jsEvent)}),selectElement.addEventListener("input",function(event){var exportValue=getValue(!0),change=getValue(!1);storage.setValue(id,{value:exportValue}),event.preventDefault(),null!=(event=_this67.linkService.eventBus)&&event.dispatch("dispatcheventinsandbox",{source:_this67,detail:{id:id,name:"Keystroke",value:selectedValues,change:change,changeEx:exportValue,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(selectElement,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],function(event){return event.target.value})):selectElement.addEventListener("input",function(event){storage.setValue(id,{value:getValue(!0)})}),this.data.combo&&this._setTextStyle(selectElement),this._setBackgroundColor(selectElement),this._setDefaultPropertiesFromJS(selectElement),this.container.append(selectElement),this.container}}])}(),PopupAnnotationElement=function(){function PopupAnnotationElement(parameters){babelHelpers.classCallCheck(this,PopupAnnotationElement);var data=parameters.data,elements=parameters.elements,parameters=_callSuper(this,PopupAnnotationElement,[parameters,{isRenderable:AnnotationElement._hasPopupData(data)}]);return parameters.elements=elements,parameters.popup=null,parameters}return babelHelpers.inherits(PopupAnnotationElement,AnnotationElement),babelHelpers.createClass(PopupAnnotationElement,[{key:"render",value:function(){var _step129,container=this.container,popup=(container.classList.add("popupAnnotation"),container.role="comment",this.popup=new PopupElement({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})),elementIds=[],_iterator129=_createForOfIteratorHelper(this.elements);try{for(_iterator129.s();!(_step129=_iterator129.n()).done;){var element=_step129.value;element.popup=popup,element.container.ariaHasPopup="dialog",elementIds.push(element.data.id),element.addHighlightArea()}}catch(err){_iterator129.e(err)}finally{_iterator129.f()}return this.container.setAttribute("aria-controls",elementIds.map(function(id){return"".concat("pdfjs_internal_id_").concat(id)}).join(",")),this.container}}])}(),_boundKeyDown=new WeakMap,_boundHide=new WeakMap,_boundShow=new WeakMap,_boundToggle=new WeakMap,_color=new WeakMap,_container5=new WeakMap,_contentsObj=new WeakMap,_dateObj=new WeakMap,_elements=new WeakMap,_parent=new WeakMap,_parentRect=new WeakMap,_pinned=new WeakMap,_popup=new WeakMap,_position2=new WeakMap,_rect2=new WeakMap,_richText=new WeakMap,_titleObj=new WeakMap,_updates2=new WeakMap,_wasVisible=new WeakMap,_PopupElement_brand=new WeakSet,PopupElement=function(){return babelHelpers.createClass(function PopupElement(_ref88){var _step130,container=_ref88.container,color=_ref88.color,elements=_ref88.elements,titleObj=_ref88.titleObj,modificationDate=_ref88.modificationDate,_contentsObj2=_ref88.contentsObj,_richText2=_ref88.richText,parent=_ref88.parent,_rect3=_ref88.rect,parentRect=_ref88.parentRect,_ref88=_ref88.open,_iterator130=(babelHelpers.classCallCheck(this,PopupElement),_classPrivateMethodInitSpec(this,_PopupElement_brand),_classPrivateFieldInitSpec(this,_boundKeyDown,_assertClassBrand(_PopupElement_brand,this,_keyDown).bind(this)),_classPrivateFieldInitSpec(this,_boundHide,_assertClassBrand(_PopupElement_brand,this,_hide).bind(this)),_classPrivateFieldInitSpec(this,_boundShow,_assertClassBrand(_PopupElement_brand,this,_show).bind(this)),_classPrivateFieldInitSpec(this,_boundToggle,_assertClassBrand(_PopupElement_brand,this,_toggle).bind(this)),_classPrivateFieldInitSpec(this,_color,null),_classPrivateFieldInitSpec(this,_container5,null),_classPrivateFieldInitSpec(this,_contentsObj,null),_classPrivateFieldInitSpec(this,_dateObj,null),_classPrivateFieldInitSpec(this,_elements,null),_classPrivateFieldInitSpec(this,_parent,null),_classPrivateFieldInitSpec(this,_parentRect,null),_classPrivateFieldInitSpec(this,_pinned,!1),_classPrivateFieldInitSpec(this,_popup,null),_classPrivateFieldInitSpec(this,_position2,null),_classPrivateFieldInitSpec(this,_rect2,null),_classPrivateFieldInitSpec(this,_richText,null),_classPrivateFieldInitSpec(this,_titleObj,null),_classPrivateFieldInitSpec(this,_updates2,null),_classPrivateFieldInitSpec(this,_wasVisible,!1),_classPrivateFieldSet(_container5,this,container),_classPrivateFieldSet(_titleObj,this,titleObj),_classPrivateFieldSet(_contentsObj,this,_contentsObj2),_classPrivateFieldSet(_richText,this,_richText2),_classPrivateFieldSet(_parent,this,parent),_classPrivateFieldSet(_color,this,color),_classPrivateFieldSet(_rect2,this,_rect3),_classPrivateFieldSet(_parentRect,this,parentRect),_classPrivateFieldSet(_elements,this,elements),_classPrivateFieldSet(_dateObj,this,PDFDateString.toDateObject(modificationDate)),this.trigger=elements.flatMap(function(e){return e.getElementsToTriggerPopup()}),_createForOfIteratorHelper(this.trigger));try{for(_iterator130.s();!(_step130=_iterator130.n()).done;){var element=_step130.value;element.addEventListener("click",_classPrivateFieldGet(_boundToggle,this)),element.addEventListener("mouseenter",_classPrivateFieldGet(_boundShow,this)),element.addEventListener("mouseleave",_classPrivateFieldGet(_boundHide,this)),element.classList.add("popupTriggerArea")}}catch(err){_iterator130.e(err)}finally{_iterator130.f()}var _step131,_element$container,_iterator131=_createForOfIteratorHelper(elements);try{for(_iterator131.s();!(_step131=_iterator131.n()).done;)null!=(_element$container=_step131.value.container)&&_element$container.addEventListener("keydown",_classPrivateFieldGet(_boundKeyDown,this))}catch(err){_iterator131.e(err)}finally{_iterator131.f()}_classPrivateFieldGet(_container5,this).hidden=!0,_ref88&&_assertClassBrand(_PopupElement_brand,this,_toggle).call(this)},[{key:"render",value:function(){var popup,title,_classPrivateFieldGet68,baseColor;_classPrivateFieldGet(_popup,this)||((popup=_classPrivateFieldSet(_popup,this,document.createElement("div"))).className="popup",_classPrivateFieldGet(_color,this)&&(baseColor=popup.style.outlineColor=Util.makeHexColor.apply(Util,babelHelpers.toConsumableArray(_classPrivateFieldGet(_color,this))),popup.style.backgroundColor="color-mix(in srgb, ".concat(baseColor," 30%, white)")),(baseColor=document.createElement("span")).className="header",title=document.createElement("h1"),baseColor.append(title),_classPrivateFieldGet68=_classPrivateFieldGet(_titleObj,this),title.dir=_classPrivateFieldGet68.dir,title.textContent=_classPrivateFieldGet68.str,popup.append(baseColor),_classPrivateFieldGet(_dateObj,this)&&((title=document.createElement("time")).classList.add("popupDate"),title.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),title.setAttribute("data-l10n-args",JSON.stringify({dateObj:_classPrivateFieldGet(_dateObj,this).valueOf()})),title.dateTime=_classPrivateFieldGet(_dateObj,this).toISOString(),baseColor.append(title)),(_classPrivateFieldGet68=_classPrivateGetter(_PopupElement_brand,this,_get_html))?(XfaLayer.render({xfaHtml:_classPrivateFieldGet68,intent:"richText",div:popup}),popup.lastChild.classList.add("richText","popupContent")):(baseColor=this._formatContents(_classPrivateFieldGet(_contentsObj,this)),popup.append(baseColor)),_classPrivateFieldGet(_container5,this).append(popup))}},{key:"_formatContents",value:function(_ref89){for(var str=_ref89.str,_ref89=_ref89.dir,p=document.createElement("p"),lines=(p.classList.add("popupContent"),p.dir=_ref89,str.split(/(?:\r\n?|\n)/)),i=0,ii=lines.length;i<ii;++i){var line=lines[i];p.append(document.createTextNode(line)),i<ii-1&&p.append(document.createElement("br"))}return p}},{key:"updateEdited",value:function(_ref90){var rect=_ref90.rect,_ref90=_ref90.popupContent;_classPrivateFieldGet(_updates2,this)||_classPrivateFieldSet(_updates2,this,{contentsObj:_classPrivateFieldGet(_contentsObj,this),richText:_classPrivateFieldGet(_richText,this)}),rect&&_classPrivateFieldSet(_position2,this,null),_ref90&&(_classPrivateFieldSet(_richText,this,_assertClassBrand(_PopupElement_brand,this,_makePopupContent).call(this,_ref90)),_classPrivateFieldSet(_contentsObj,this,null)),null!=(rect=_classPrivateFieldGet(_popup,this))&&rect.remove(),_classPrivateFieldSet(_popup,this,null)}},{key:"resetEdited",value:function(){var _classPrivateFieldGet70;_classPrivateFieldGet(_updates2,this)&&(_classPrivateFieldGet70=_classPrivateFieldGet(_updates2,this),_toSetter(_classPrivateFieldSet,[_contentsObj,this])._=_classPrivateFieldGet70.contentsObj,_toSetter(_classPrivateFieldSet,[_richText,this])._=_classPrivateFieldGet70.richText,_classPrivateFieldSet(_updates2,this,null),null!=(_classPrivateFieldGet70=_classPrivateFieldGet(_popup,this))&&_classPrivateFieldGet70.remove(),_classPrivateFieldSet(_popup,this,null),_classPrivateFieldSet(_position2,this,null))}},{key:"forceHide",value:function(){_classPrivateFieldSet(_wasVisible,this,this.isVisible),_classPrivateFieldGet(_wasVisible,this)&&(_classPrivateFieldGet(_container5,this).hidden=!0)}},{key:"maybeShow",value:function(){_classPrivateFieldGet(_wasVisible,this)&&(_classPrivateFieldGet(_popup,this)||_assertClassBrand(_PopupElement_brand,this,_show).call(this),_classPrivateFieldSet(_wasVisible,this,!1),_classPrivateFieldGet(_container5,this).hidden=!1)}},{key:"isVisible",get:function(){return!1===_classPrivateFieldGet(_container5,this).hidden}}])}();function _get_html(_this69){var richText=_classPrivateFieldGet(_richText,_this69),contentsObj=_classPrivateFieldGet(_contentsObj,_this69);return null!=richText&&richText.str&&(null==contentsObj||!contentsObj.str||contentsObj.str===richText.str)&&_classPrivateFieldGet(_richText,_this69).html||null}function _get_fontSize(_this70){return(null==(_this70=_classPrivateGetter(_PopupElement_brand,_this70,_get_html))||null==(_this70=_this70.attributes)||null==(_this70=_this70.style)?void 0:_this70.fontSize)||0}function _get_fontColor(_this71){return(null==(_this71=_classPrivateGetter(_PopupElement_brand,_this71,_get_html))||null==(_this71=_this71.attributes)||null==(_this71=_this71.style)?void 0:_this71.color)||null}function _makePopupContent(text){var _step185,popupLines=[],popupContent={str:text,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:popupLines}]}},lineAttributes={style:{color:_classPrivateGetter(_PopupElement_brand,this,_get_fontColor),fontSize:_classPrivateGetter(_PopupElement_brand,this,_get_fontSize)?"calc(".concat(_classPrivateGetter(_PopupElement_brand,this,_get_fontSize),"px * var(--total-scale-factor))"):""}},_iterator185=_createForOfIteratorHelper(text.split("\n"));try{for(_iterator185.s();!(_step185=_iterator185.n()).done;){var line=_step185.value;popupLines.push({name:"span",value:line,attributes:lineAttributes})}}catch(err){_iterator185.e(err)}finally{_iterator185.f()}return popupContent}function _keyDown(event){event.altKey||event.shiftKey||event.ctrlKey||event.metaKey||("Enter"===event.key||"Escape"===event.key&&_classPrivateFieldGet(_pinned,this))&&_assertClassBrand(_PopupElement_brand,this,_toggle).call(this)}function _setPosition(){if(null===_classPrivateFieldGet(_position2,this)){var _step186,_classPrivateFieldGet160=_classPrivateFieldGet(_parent,this),view=_classPrivateFieldGet160.page.view,_classPrivateFieldGet160=_classPrivateFieldGet160.viewport.rawDims,pageWidth=_classPrivateFieldGet160.pageWidth,pageHeight=_classPrivateFieldGet160.pageHeight,pageX=_classPrivateFieldGet160.pageX,_classPrivateFieldGet160=_classPrivateFieldGet160.pageY,useParentRect=!!_classPrivateFieldGet(_parentRect,this),rect=_classPrivateFieldGet(useParentRect?_parentRect:_rect2,this),_iterator186=_createForOfIteratorHelper(_classPrivateFieldGet(_elements,this));try{for(_iterator186.s();!(_step186=_iterator186.n()).done;){var element=_step186.value;if(!rect||null!==Util.intersect(element.data.rect,rect)){rect=element.data.rect,useParentRect=!0;break}}}catch(err){_iterator186.e(err)}finally{_iterator186.f()}var view=Util.normalizeRect([rect[0],view[3]-rect[1]+view[1],rect[2],view[3]-rect[3]+view[1]]),parentWidth=useParentRect?rect[2]-rect[0]+5:0,parentWidth=view[0]+parentWidth,view=view[1];_classPrivateFieldSet(_position2,this,[100*(parentWidth-pageX)/pageWidth,100*(view-_classPrivateFieldGet160)/pageHeight]);parentWidth=_classPrivateFieldGet(_container5,this).style;parentWidth.left="".concat(_classPrivateFieldGet(_position2,this)[0],"%"),parentWidth.top="".concat(_classPrivateFieldGet(_position2,this)[1],"%")}}function _toggle(){_classPrivateFieldSet(_pinned,this,!_classPrivateFieldGet(_pinned,this)),_classPrivateFieldGet(_pinned,this)?(_assertClassBrand(_PopupElement_brand,this,_show).call(this),_classPrivateFieldGet(_container5,this).addEventListener("click",_classPrivateFieldGet(_boundToggle,this)),_classPrivateFieldGet(_container5,this).addEventListener("keydown",_classPrivateFieldGet(_boundKeyDown,this))):(_assertClassBrand(_PopupElement_brand,this,_hide).call(this),_classPrivateFieldGet(_container5,this).removeEventListener("click",_classPrivateFieldGet(_boundToggle,this)),_classPrivateFieldGet(_container5,this).removeEventListener("keydown",_classPrivateFieldGet(_boundKeyDown,this)))}function _show(){_classPrivateFieldGet(_popup,this)||this.render(),this.isVisible?_classPrivateFieldGet(_pinned,this)&&_classPrivateFieldGet(_container5,this).classList.add("focused"):(_assertClassBrand(_PopupElement_brand,this,_setPosition).call(this),_classPrivateFieldGet(_container5,this).hidden=!1,_classPrivateFieldGet(_container5,this).style.zIndex=parseInt(_classPrivateFieldGet(_container5,this).style.zIndex)+1e3)}function _hide(){_classPrivateFieldGet(_container5,this).classList.remove("focused"),!_classPrivateFieldGet(_pinned,this)&&this.isVisible&&(_classPrivateFieldGet(_container5,this).hidden=!0,_classPrivateFieldGet(_container5,this).style.zIndex=parseInt(_classPrivateFieldGet(_container5,this).style.zIndex)-1e3)}var FreeTextAnnotationElement=function(){function FreeTextAnnotationElement(parameters){var _this72;return babelHelpers.classCallCheck(this,FreeTextAnnotationElement),(_this72=_callSuper(this,FreeTextAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}])).textContent=parameters.data.textContent,_this72.textPosition=parameters.data.textPosition,_this72.annotationEditorType=AnnotationEditorType.FREETEXT,_this72}return babelHelpers.inherits(FreeTextAnnotationElement,AnnotationElement),babelHelpers.createClass(FreeTextAnnotationElement,[{key:"render",value:function(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){var _step132,content=document.createElement("div"),_iterator132=(content.classList.add("annotationTextContent"),content.setAttribute("role","comment"),_createForOfIteratorHelper(this.textContent));try{for(_iterator132.s();!(_step132=_iterator132.n()).done;){var line=_step132.value,lineSpan=document.createElement("span");lineSpan.textContent=line,content.append(lineSpan)}}catch(err){_iterator132.e(err)}finally{_iterator132.f()}this.container.append(content)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}])}(),_line=new WeakMap,LineAnnotationElement=function(){function LineAnnotationElement(parameters){return babelHelpers.classCallCheck(this,LineAnnotationElement),_classPrivateFieldInitSpec(parameters=_callSuper(this,LineAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}]),_line,null),parameters}return babelHelpers.inherits(LineAnnotationElement,AnnotationElement),babelHelpers.createClass(LineAnnotationElement,[{key:"render",value:function(){this.container.classList.add("lineAnnotation");var data=this.data,width=this.width,height=this.height,width=this.svgFactory.create(width,height,!0),height=_classPrivateFieldSet(_line,this,this.svgFactory.createElement("svg:line"));return height.setAttribute("x1",data.rect[2]-data.lineCoordinates[0]),height.setAttribute("y1",data.rect[3]-data.lineCoordinates[1]),height.setAttribute("x2",data.rect[2]-data.lineCoordinates[2]),height.setAttribute("y2",data.rect[3]-data.lineCoordinates[3]),height.setAttribute("stroke-width",data.borderStyle.width||1),height.setAttribute("stroke","transparent"),height.setAttribute("fill","transparent"),width.append(height),this.container.append(width),!data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}},{key:"getElementsToTriggerPopup",value:function(){return _classPrivateFieldGet(_line,this)}},{key:"addHighlightArea",value:function(){this.container.classList.add("highlightArea")}}])}(),_square=new WeakMap,SquareAnnotationElement=function(){function SquareAnnotationElement(parameters){return babelHelpers.classCallCheck(this,SquareAnnotationElement),_classPrivateFieldInitSpec(parameters=_callSuper(this,SquareAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}]),_square,null),parameters}return babelHelpers.inherits(SquareAnnotationElement,AnnotationElement),babelHelpers.createClass(SquareAnnotationElement,[{key:"render",value:function(){this.container.classList.add("squareAnnotation");var data=this.data,width=this.width,height=this.height,svg=this.svgFactory.create(width,height,!0),borderWidth=data.borderStyle.width,square=_classPrivateFieldSet(_square,this,this.svgFactory.createElement("svg:rect"));return square.setAttribute("x",borderWidth/2),square.setAttribute("y",borderWidth/2),square.setAttribute("width",width-borderWidth),square.setAttribute("height",height-borderWidth),square.setAttribute("stroke-width",borderWidth||1),square.setAttribute("stroke","transparent"),square.setAttribute("fill","transparent"),svg.append(square),this.container.append(svg),!data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}},{key:"getElementsToTriggerPopup",value:function(){return _classPrivateFieldGet(_square,this)}},{key:"addHighlightArea",value:function(){this.container.classList.add("highlightArea")}}])}(),_circle=new WeakMap,CircleAnnotationElement=function(){function CircleAnnotationElement(parameters){return babelHelpers.classCallCheck(this,CircleAnnotationElement),_classPrivateFieldInitSpec(parameters=_callSuper(this,CircleAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}]),_circle,null),parameters}return babelHelpers.inherits(CircleAnnotationElement,AnnotationElement),babelHelpers.createClass(CircleAnnotationElement,[{key:"render",value:function(){this.container.classList.add("circleAnnotation");var data=this.data,width=this.width,height=this.height,svg=this.svgFactory.create(width,height,!0),borderWidth=data.borderStyle.width,circle=_classPrivateFieldSet(_circle,this,this.svgFactory.createElement("svg:ellipse"));return circle.setAttribute("cx",width/2),circle.setAttribute("cy",height/2),circle.setAttribute("rx",width/2-borderWidth/2),circle.setAttribute("ry",height/2-borderWidth/2),circle.setAttribute("stroke-width",borderWidth||1),circle.setAttribute("stroke","transparent"),circle.setAttribute("fill","transparent"),svg.append(circle),this.container.append(svg),!data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}},{key:"getElementsToTriggerPopup",value:function(){return _classPrivateFieldGet(_circle,this)}},{key:"addHighlightArea",value:function(){this.container.classList.add("highlightArea")}}])}(),_polyline=new WeakMap,PolylineAnnotationElement=function(){function PolylineAnnotationElement(parameters){return babelHelpers.classCallCheck(this,PolylineAnnotationElement),_classPrivateFieldInitSpec(parameters=_callSuper(this,PolylineAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}]),_polyline,null),parameters.containerClassName="polylineAnnotation",parameters.svgElementName="svg:polyline",parameters}return babelHelpers.inherits(PolylineAnnotationElement,AnnotationElement),babelHelpers.createClass(PolylineAnnotationElement,[{key:"render",value:function(){this.container.classList.add(this.containerClassName);var _this$data=this.data,rect=_this$data.rect,vertices=_this$data.vertices,borderStyle=_this$data.borderStyle,_this$data=_this$data.popupRef,width=this.width,height=this.height;if(vertices){for(var width=this.svgFactory.create(width,height,!0),points=[],i=0,ii=vertices.length;i<ii;i+=2){var x=vertices[i]-rect[0],y=rect[3]-vertices[i+1];points.push("".concat(x,",").concat(y))}points=points.join(" "),height=_classPrivateFieldSet(_polyline,this,this.svgFactory.createElement(this.svgElementName));height.setAttribute("points",points),height.setAttribute("stroke-width",borderStyle.width||1),height.setAttribute("stroke","transparent"),height.setAttribute("fill","transparent"),width.append(height),this.container.append(width),!_this$data&&this.hasPopupData&&this._createPopup()}return this.container}},{key:"getElementsToTriggerPopup",value:function(){return _classPrivateFieldGet(_polyline,this)}},{key:"addHighlightArea",value:function(){this.container.classList.add("highlightArea")}}])}(),PolygonAnnotationElement=function(){function PolygonAnnotationElement(parameters){return babelHelpers.classCallCheck(this,PolygonAnnotationElement),(parameters=_callSuper(this,PolygonAnnotationElement,[parameters])).containerClassName="polygonAnnotation",parameters.svgElementName="svg:polygon",parameters}return babelHelpers.inherits(PolygonAnnotationElement,PolylineAnnotationElement),babelHelpers.createClass(PolygonAnnotationElement)}(),CaretAnnotationElement=function(){function CaretAnnotationElement(parameters){return babelHelpers.classCallCheck(this,CaretAnnotationElement),_callSuper(this,CaretAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}])}return babelHelpers.inherits(CaretAnnotationElement,AnnotationElement),babelHelpers.createClass(CaretAnnotationElement,[{key:"render",value:function(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}])}(),_polylinesGroupElement=new WeakMap,_polylines=new WeakMap,_InkAnnotationElement_brand=new WeakSet,InkAnnotationElement=function(){function InkAnnotationElement(parameters){return babelHelpers.classCallCheck(this,InkAnnotationElement),_classPrivateMethodInitSpec(parameters=_callSuper(this,InkAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}]),_InkAnnotationElement_brand),_classPrivateFieldInitSpec(parameters,_polylinesGroupElement,null),_classPrivateFieldInitSpec(parameters,_polylines,[]),parameters.containerClassName="inkAnnotation",parameters.svgElementName="svg:polyline",parameters.annotationEditorType="InkHighlight"===parameters.data.it?AnnotationEditorType.HIGHLIGHT:AnnotationEditorType.INK,parameters}return babelHelpers.inherits(InkAnnotationElement,AnnotationElement),babelHelpers.createClass(InkAnnotationElement,[{key:"render",value:function(){this.container.classList.add(this.containerClassName);var _this$data2=this.data,rect=_this$data2.rect,rotation=_this$data2.rotation,inkLists=_this$data2.inkLists,borderStyle=_this$data2.borderStyle,_this$data2=_this$data2.popupRef,rotation=_assertClassBrand(_InkAnnotationElement_brand,this,_getTransform).call(this,rotation,rect),rect=rotation.transform,width=rotation.width,rotation=rotation.height,width=this.svgFactory.create(width,rotation,!0),g=_classPrivateFieldSet(_polylinesGroupElement,this,this.svgFactory.createElement("svg:g"));width.append(g),g.setAttribute("stroke-width",borderStyle.width||1),g.setAttribute("stroke-linecap","round"),g.setAttribute("stroke-linejoin","round"),g.setAttribute("stroke-miterlimit",10),g.setAttribute("stroke","transparent"),g.setAttribute("fill","transparent"),g.setAttribute("transform",rect);for(var i=0,ii=inkLists.length;i<ii;i++){var polyline=this.svgFactory.createElement(this.svgElementName);_classPrivateFieldGet(_polylines,this).push(polyline),polyline.setAttribute("points",inkLists[i].join(",")),g.append(polyline)}return!_this$data2&&this.hasPopupData&&this._createPopup(),this.container.append(width),this._editOnDoubleClick(),this.container}},{key:"updateEdited",value:function(params){_superPropGet(InkAnnotationElement,"updateEdited",this,3)([params]);var width,thickness=params.thickness,points=params.points,params=params.rect,g=_classPrivateFieldGet(_polylinesGroupElement,this);if(0<=thickness&&g.setAttribute("stroke-width",thickness||1),points)for(var i=0,ii=_classPrivateFieldGet(_polylines,this).length;i<ii;i++)_classPrivateFieldGet(_polylines,this)[i].setAttribute("points",points[i].join(","));params&&(params=(thickness=_assertClassBrand(_InkAnnotationElement_brand,this,_getTransform).call(this,this.data.rotation,params)).transform,width=thickness.width,thickness=thickness.height,g.parentElement.setAttribute("viewBox","0 0 ".concat(width," ").concat(thickness)),g.setAttribute("transform",params))}},{key:"getElementsToTriggerPopup",value:function(){return _classPrivateFieldGet(_polylines,this)}},{key:"addHighlightArea",value:function(){this.container.classList.add("highlightArea")}}])}();function _getTransform(rotation,rect){switch(rotation){case 90:return{transform:"rotate(90) translate(".concat(-rect[0],",").concat(rect[1],") scale(1,-1)"),width:rect[3]-rect[1],height:rect[2]-rect[0]};case 180:return{transform:"rotate(180) translate(".concat(-rect[2],",").concat(rect[1],") scale(1,-1)"),width:rect[2]-rect[0],height:rect[3]-rect[1]};case 270:return{transform:"rotate(270) translate(".concat(-rect[2],",").concat(rect[3],") scale(1,-1)"),width:rect[3]-rect[1],height:rect[2]-rect[0]};default:return{transform:"translate(".concat(-rect[0],",").concat(rect[3],") scale(1,-1)"),width:rect[2]-rect[0],height:rect[3]-rect[1]}}}var HighlightAnnotationElement=function(){function HighlightAnnotationElement(parameters){return babelHelpers.classCallCheck(this,HighlightAnnotationElement),(parameters=_callSuper(this,HighlightAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}])).annotationEditorType=AnnotationEditorType.HIGHLIGHT,parameters}return babelHelpers.inherits(HighlightAnnotationElement,AnnotationElement),babelHelpers.createClass(HighlightAnnotationElement,[{key:"render",value:function(){var _this$data3=this.data,overlaidText=_this$data3.overlaidText;return!_this$data3.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),overlaidText&&((_this$data3=document.createElement("mark")).classList.add("overlaidText"),_this$data3.textContent=overlaidText,this.container.append(_this$data3)),this.container}}])}(),UnderlineAnnotationElement=function(){function UnderlineAnnotationElement(parameters){return babelHelpers.classCallCheck(this,UnderlineAnnotationElement),_callSuper(this,UnderlineAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}])}return babelHelpers.inherits(UnderlineAnnotationElement,AnnotationElement),babelHelpers.createClass(UnderlineAnnotationElement,[{key:"render",value:function(){var _this$data4=this.data,overlaidText=_this$data4.overlaidText;return!_this$data4.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),overlaidText&&((_this$data4=document.createElement("u")).classList.add("overlaidText"),_this$data4.textContent=overlaidText,this.container.append(_this$data4)),this.container}}])}(),SquigglyAnnotationElement=function(){function SquigglyAnnotationElement(parameters){return babelHelpers.classCallCheck(this,SquigglyAnnotationElement),_callSuper(this,SquigglyAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}])}return babelHelpers.inherits(SquigglyAnnotationElement,AnnotationElement),babelHelpers.createClass(SquigglyAnnotationElement,[{key:"render",value:function(){var _this$data5=this.data,overlaidText=_this$data5.overlaidText;return!_this$data5.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),overlaidText&&((_this$data5=document.createElement("u")).classList.add("overlaidText"),_this$data5.textContent=overlaidText,this.container.append(_this$data5)),this.container}}])}(),StrikeOutAnnotationElement=function(){function StrikeOutAnnotationElement(parameters){return babelHelpers.classCallCheck(this,StrikeOutAnnotationElement),_callSuper(this,StrikeOutAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}])}return babelHelpers.inherits(StrikeOutAnnotationElement,AnnotationElement),babelHelpers.createClass(StrikeOutAnnotationElement,[{key:"render",value:function(){var _this$data6=this.data,overlaidText=_this$data6.overlaidText;return!_this$data6.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),overlaidText&&((_this$data6=document.createElement("s")).classList.add("overlaidText"),_this$data6.textContent=overlaidText,this.container.append(_this$data6)),this.container}}])}(),StampAnnotationElement=function(){function StampAnnotationElement(parameters){return babelHelpers.classCallCheck(this,StampAnnotationElement),(parameters=_callSuper(this,StampAnnotationElement,[parameters,{isRenderable:!0,ignoreBorder:!0}])).annotationEditorType=AnnotationEditorType.STAMP,parameters}return babelHelpers.inherits(StampAnnotationElement,AnnotationElement),babelHelpers.createClass(StampAnnotationElement,[{key:"render",value:function(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}])}(),_trigger=new WeakMap,_FileAttachmentAnnotationElement_brand=new WeakSet,FileAttachmentAnnotationElement=function(){function FileAttachmentAnnotationElement(parameters){babelHelpers.classCallCheck(this,FileAttachmentAnnotationElement),_classPrivateMethodInitSpec(parameters=_callSuper(this,FileAttachmentAnnotationElement,[parameters,{isRenderable:!0}]),_FileAttachmentAnnotationElement_brand),_classPrivateFieldInitSpec(parameters,_trigger,null);var _this81$linkService$e,file=parameters.data.file;return parameters.filename=file.filename,parameters.content=file.content,null!=(_this81$linkService$e=parameters.linkService.eventBus)&&_this81$linkService$e.dispatch("fileattachmentannotation",_objectSpread({source:parameters},file)),parameters}return babelHelpers.inherits(FileAttachmentAnnotationElement,AnnotationElement),babelHelpers.createClass(FileAttachmentAnnotationElement,[{key:"render",value:function(){var trigger,_this82=this,container=(this.container.classList.add("fileAttachmentAnnotation"),this.container),data=this.data,isMac=(data.hasAppearance||0===data.fillAlpha?trigger=document.createElement("div"):((trigger=document.createElement("img")).src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(data.name)?"paperclip":"pushpin",".svg"),data.fillAlpha&&data.fillAlpha<1&&(trigger.style="filter: opacity(".concat(Math.round(100*data.fillAlpha),"%);"))),trigger.addEventListener("dblclick",_assertClassBrand(_FileAttachmentAnnotationElement_brand,this,_download).bind(this)),_classPrivateFieldSet(_trigger,this,trigger),util_FeatureTest.platform.isMac);return container.addEventListener("keydown",function(evt){"Enter"===evt.key&&(isMac?evt.metaKey:evt.ctrlKey)&&_assertClassBrand(_FileAttachmentAnnotationElement_brand,_this82,_download).call(_this82)}),!data.popupRef&&this.hasPopupData?this._createPopup():trigger.classList.add("popupTriggerArea"),container.append(trigger),container}},{key:"getElementsToTriggerPopup",value:function(){return _classPrivateFieldGet(_trigger,this)}},{key:"addHighlightArea",value:function(){this.container.classList.add("highlightArea")}}])}();function _download(){var _this$downloadManager;null!=(_this$downloadManager=this.downloadManager)&&_this$downloadManager.openOrDownloadData(this.content,this.filename)}var _accessibilityManager=new WeakMap,_annotationCanvasMap=new WeakMap,_editableAnnotations=new WeakMap,_structTreeLayer=new WeakMap,_AnnotationLayer_brand=new WeakSet,AnnotationLayer=_exports.AnnotationLayer=function(){function AnnotationLayer(_ref91){var div=_ref91.div,accessibilityManager=_ref91.accessibilityManager,annotationCanvasMap=_ref91.annotationCanvasMap,annotationEditorUIManager=_ref91.annotationEditorUIManager,page=_ref91.page,viewport=_ref91.viewport,_ref91=_ref91.structTreeLayer;babelHelpers.classCallCheck(this,AnnotationLayer),_classPrivateMethodInitSpec(this,_AnnotationLayer_brand),_classPrivateFieldInitSpec(this,_accessibilityManager,null),_classPrivateFieldInitSpec(this,_annotationCanvasMap,null),_classPrivateFieldInitSpec(this,_editableAnnotations,new Map),_classPrivateFieldInitSpec(this,_structTreeLayer,null),this.div=div,_classPrivateFieldSet(_accessibilityManager,this,accessibilityManager),_classPrivateFieldSet(_annotationCanvasMap,this,annotationCanvasMap),_classPrivateFieldSet(_structTreeLayer,this,_ref91||null),this.page=page,this.viewport=viewport,this.zIndex=0,this._annotationEditorUIManager=annotationEditorUIManager}return babelHelpers.createClass(AnnotationLayer,[{key:"hasEditableAnnotations",value:function(){return 0<_classPrivateFieldGet(_editableAnnotations,this).size}},{key:"render",value:async function(params){var _step133,annotations=params.annotations,layer=this.div,popupToElements=(setLayerDimensions(layer,this.viewport),new Map),elementParams={data:null,layer:layer,linkService:params.linkService,downloadManager:params.downloadManager,imageResourcesPath:params.imageResourcesPath||"",renderForms:!1!==params.renderForms,svgFactory:new DOMSVGFactory,annotationStorage:params.annotationStorage||new AnnotationStorage,enableScripting:!0===params.enableScripting,hasJSActions:params.hasJSActions,fieldObjects:params.fieldObjects,parent:this,elements:null},_iterator133=_createForOfIteratorHelper(annotations);try{for(_iterator133.s();!(_step133=_iterator133.n()).done;){var data=_step133.value;if(!data.noHTML){var isPopupAnnotation=data.annotationType===AnnotationType.POPUP;if(isPopupAnnotation){var elements=popupToElements.get(data.id);if(!elements)continue;elementParams.elements=elements}else if(data.rect[2]===data.rect[0]||data.rect[3]===data.rect[1])continue;elementParams.data=data;var _elements2,rendered,_this$_annotationEdit,element=AnnotationElementFactory.create(elementParams);element.isRenderable&&(!isPopupAnnotation&&data.popupRef&&((_elements2=popupToElements.get(data.popupRef))?_elements2.push(element):popupToElements.set(data.popupRef,[element])),rendered=element.render(),data.hidden&&(rendered.style.visibility="hidden"),await _assertClassBrand(_AnnotationLayer_brand,this,_appendElement).call(this,rendered,data.id,elementParams.elements),element._isEditable)&&(_classPrivateFieldGet(_editableAnnotations,this).set(element.data.id,element),null!=(_this$_annotationEdit=this._annotationEditorUIManager))&&_this$_annotationEdit.renderAnnotationElement(element)}}}catch(err){_iterator133.e(err)}finally{_iterator133.f()}_assertClassBrand(_AnnotationLayer_brand,this,_setAnnotationCanvasMap).call(this)}},{key:"addLinkAnnotations",value:async function(annotations,linkService){var _step134,elementParams={data:null,layer:this.div,linkService:linkService,svgFactory:new DOMSVGFactory,parent:this},_iterator134=_createForOfIteratorHelper(annotations);try{for(_iterator134.s();!(_step134=_iterator134.n()).done;){var rendered,data=_step134.value,element=(data.borderStyle||(data.borderStyle=AnnotationLayer._defaultBorderStyle),elementParams.data=data,AnnotationElementFactory.create(elementParams));element.isRenderable&&(rendered=element.render(),await _assertClassBrand(_AnnotationLayer_brand,this,_appendElement).call(this,rendered,data.id,null))}}catch(err){_iterator134.e(err)}finally{_iterator134.f()}}},{key:"update",value:function(_ref92){var _ref92=_ref92.viewport,layer=this.div;setLayerDimensions(layer,{rotation:(this.viewport=_ref92).rotation}),_assertClassBrand(_AnnotationLayer_brand,this,_setAnnotationCanvasMap).call(this),layer.hidden=!1}},{key:"getEditableAnnotations",value:function(){return Array.from(_classPrivateFieldGet(_editableAnnotations,this).values())}},{key:"getEditableAnnotation",value:function(id){return _classPrivateFieldGet(_editableAnnotations,this).get(id)}}],[{key:"_defaultBorderStyle",get:function(){return shadow(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:AnnotationBorderStyleType_SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}])}();async function _appendElement(element,id,popupElements){var contentElement=element.firstChild||element,id=contentElement.id="".concat("pdfjs_internal_id_").concat(id),_classPrivateFieldGet163=await(null==(_classPrivateFieldGet163=_classPrivateFieldGet(_structTreeLayer,this))?void 0:_classPrivateFieldGet163.getAriaAttributes(id));if(_classPrivateFieldGet163){var _step187,_iterator187=_createForOfIteratorHelper(_classPrivateFieldGet163);try{for(_iterator187.s();!(_step187=_iterator187.n()).done;){var _step187$value=babelHelpers.slicedToArray(_step187.value,2),key=_step187$value[0],value=_step187$value[1];contentElement.setAttribute(key,value)}}catch(err){_iterator187.e(err)}finally{_iterator187.f()}}popupElements?popupElements.at(-1).container.after(element):(this.div.append(element),null!=(id=_classPrivateFieldGet(_accessibilityManager,this))&&id.moveElementInDOM(this.div,element,contentElement,!1))}function _setAnnotationCanvasMap(){if(_classPrivateFieldGet(_annotationCanvasMap,this)){var _step188,layer=this.div,_iterator188=_createForOfIteratorHelper(_classPrivateFieldGet(_annotationCanvasMap,this));try{for(_iterator188.s();!(_step188=_iterator188.n()).done;){var firstChild,editableAnnotation,_this$_annotationEdit2,_step188$value=babelHelpers.slicedToArray(_step188.value,2),id=_step188$value[0],canvas=_step188$value[1],element=layer.querySelector('[data-annotation-id="'.concat(id,'"]'));element&&(canvas.className="annotationContent",(firstChild=element.firstChild)?"CANVAS"===firstChild.nodeName?firstChild.replaceWith(canvas):firstChild.classList.contains("annotationContent")?firstChild.after(canvas):firstChild.before(canvas):element.append(canvas),editableAnnotation=_classPrivateFieldGet(_editableAnnotations,this).get(id))&&(editableAnnotation._hasNoCanvas?(null!=(_this$_annotationEdit2=this._annotationEditorUIManager)&&_this$_annotationEdit2.setMissingCanvas(id,element.id,canvas),editableAnnotation._hasNoCanvas=!1):editableAnnotation.canvas=canvas)}}catch(err){_iterator188.e(err)}finally{_iterator188.f()}_classPrivateFieldGet(_annotationCanvasMap,this).clear()}}var EOL_PATTERN=/\r\n?|\n/g,_color2=new WeakMap,_content=new WeakMap,_editorDivId=new WeakMap,_editModeAC=new WeakMap,_fontSize=new WeakMap,_FreeTextEditor_brand=new WeakSet,FreeTextEditor=function(_AnnotationEditor3){function FreeTextEditor(params){var _this83;return babelHelpers.classCallCheck(this,FreeTextEditor),_classPrivateMethodInitSpec(_this83=_callSuper(this,FreeTextEditor,[_objectSpread({},params,{name:"freeTextEditor"})]),_FreeTextEditor_brand),_classPrivateFieldInitSpec(_this83,_color2,void 0),_classPrivateFieldInitSpec(_this83,_content,""),_classPrivateFieldInitSpec(_this83,_editorDivId,"".concat(_this83.id,"-editor")),_classPrivateFieldInitSpec(_this83,_editModeAC,null),_classPrivateFieldInitSpec(_this83,_fontSize,void 0),_classPrivateFieldSet(_color2,_this83,params.color||FreeTextEditor._defaultColor||AnnotationEditor._defaultLineColor),_classPrivateFieldSet(_fontSize,_this83,params.fontSize||FreeTextEditor._defaultFontSize),_this83.annotationElementId||_this83._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),_this83}return babelHelpers.inherits(FreeTextEditor,_AnnotationEditor3),babelHelpers.createClass(FreeTextEditor,[{key:"updateParams",value:function(type,value){switch(type){case AnnotationEditorParamsType.FREETEXT_SIZE:_assertClassBrand(_FreeTextEditor_brand,this,_updateFontSize).call(this,value);break;case AnnotationEditorParamsType.FREETEXT_COLOR:_assertClassBrand(_FreeTextEditor_brand,this,_updateColor).call(this,value)}}},{key:"propertiesToUpdate",get:function(){return[[AnnotationEditorParamsType.FREETEXT_SIZE,_classPrivateFieldGet(_fontSize,this)],[AnnotationEditorParamsType.FREETEXT_COLOR,_classPrivateFieldGet(_color2,this)]]}},{key:"_translateEmpty",value:function(x,y){this._uiManager.translateSelectedEditors(x,y,!0)}},{key:"getInitialTranslation",value:function(){var scale=this.parentScale;return[-FreeTextEditor._internalPadding*scale,-(FreeTextEditor._internalPadding+_classPrivateFieldGet(_fontSize,this))*scale]}},{key:"rebuild",value:function(){this.parent&&(_superPropGet(FreeTextEditor,"rebuild",this,3)([]),null===this.div||this.isAttachedToDOM||this.parent.add(this))}},{key:"enableEditMode",value:function(){if(!_superPropGet(FreeTextEditor,"enableEditMode",this,3)([]))return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),_classPrivateFieldSet(_editModeAC,this,new AbortController);var signal=this._uiManager.combinedSignal(_classPrivateFieldGet(_editModeAC,this));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:signal}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:signal}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:signal}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:signal}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:signal}),!0}},{key:"disableEditMode",value:function(){var _classPrivateFieldGet72;return!!_superPropGet(FreeTextEditor,"disableEditMode",this,3)([])&&(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",_classPrivateFieldGet(_editorDivId,this)),this._isDraggable=!0,null!=(_classPrivateFieldGet72=_classPrivateFieldGet(_editModeAC,this))&&_classPrivateFieldGet72.abort(),_classPrivateFieldSet(_editModeAC,this,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0)}},{key:"focusin",value:function(event){this._focusEventsAllowed&&(_superPropGet(FreeTextEditor,"focusin",this,3)([event]),event.target!==this.editorDiv)&&this.editorDiv.focus()}},{key:"onceAdded",value:function(focus){this.width||(this.enableEditMode(),focus&&this.editorDiv.focus(),null!=(focus=this._initialOptions)&&focus.isCentered&&this.center(),this._initialOptions=null)}},{key:"isEmpty",value:function(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}},{key:"remove",value:function(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),_superPropGet(FreeTextEditor,"remove",this,3)([])}},{key:"commit",value:function(){var savedText,newText,setText,_this84=this;this.isInEditMode()&&(_superPropGet(FreeTextEditor,"commit",this,3)([]),this.disableEditMode(),savedText=_classPrivateFieldGet(_content,this),newText=_classPrivateFieldSet(_content,this,_assertClassBrand(_FreeTextEditor_brand,this,_extractText).call(this).trimEnd()),savedText!==newText)&&(this.addCommands({cmd:function(){setText(newText)},undo:function(){setText(savedText)},mustExec:!(setText=function(text){_classPrivateFieldSet(_content,_this84,text),text?(_assertClassBrand(_FreeTextEditor_brand,_this84,_setContent).call(_this84),_this84._uiManager.rebuild(_this84),_assertClassBrand(_FreeTextEditor_brand,_this84,_setEditorDimensions).call(_this84)):_this84.remove()})}),_assertClassBrand(_FreeTextEditor_brand,this,_setEditorDimensions).call(this))}},{key:"shouldGetKeyboardEvents",value:function(){return this.isInEditMode()}},{key:"enterInEditMode",value:function(){this.enableEditMode(),this.editorDiv.focus()}},{key:"keydown",value:function(event){event.target===this.div&&"Enter"===event.key&&(this.enterInEditMode(),event.preventDefault())}},{key:"editorDivKeydown",value:function(event){FreeTextEditor._keyboardManager.exec(this,event)}},{key:"editorDivFocus",value:function(event){this.isEditing=!0}},{key:"editorDivBlur",value:function(event){this.isEditing=!1}},{key:"editorDivInput",value:function(event){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}},{key:"disableEditing",value:function(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}},{key:"enableEditing",value:function(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}},{key:"canChangeContent",get:function(){return!0}},{key:"render",value:function(){if(!this.div){(this._isCopy||this.annotationElementId)&&(baseX=this.x,baseY=this.y),_superPropGet(FreeTextEditor,"render",this,3)([]),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",_classPrivateFieldGet(_editorDivId,this)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;var baseX,baseY,style=this.editorDiv.style;if(style.fontSize="calc(".concat(_classPrivateFieldGet(_fontSize,this),"px * var(--total-scale-factor))"),style.color=_classPrivateFieldGet(_color2,this),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){var style=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=style[0],style=style[1];if(this.annotationElementId){var position=this._initialData.position,_this$getInitialTrans3=this.getInitialTranslation(),_this$getInitialTrans3=babelHelpers.slicedToArray(_this$getInitialTrans3,2),tx=_this$getInitialTrans3[0],ty=_this$getInitialTrans3[1],_this$getInitialTrans3=this.pageTranslationToScreen(tx,ty),_this$getInitialTrans3=babelHelpers.slicedToArray(_this$getInitialTrans3,2),_this$getInitialTrans3=(tx=_this$getInitialTrans3[0],ty=_this$getInitialTrans3[1],babelHelpers.slicedToArray(this.pageDimensions,2)),pageWidth=_this$getInitialTrans3[0],pageHeight=_this$getInitialTrans3[1],_this$getInitialTrans3=babelHelpers.slicedToArray(this.pageTranslation,2),pageX=_this$getInitialTrans3[0],pageY=_this$getInitialTrans3[1];switch(this.rotation){case 0:posX=baseX+(position[0]-pageX)/pageWidth,posY=baseY+this.height-(position[1]-pageY)/pageHeight;break;case 90:var posX=baseX+(position[0]-pageX)/pageWidth,posY=baseY-(position[1]-pageY)/pageHeight,_ref93=[ty,-tx],tx=_ref93[0],ty=_ref93[1];break;case 180:posX=baseX-this.width+(position[0]-pageX)/pageWidth,posY=baseY-(position[1]-pageY)/pageHeight;_ref93=[-tx,-ty];tx=_ref93[0],ty=_ref93[1];break;case 270:posX=baseX+(position[0]-pageX-this.height*pageHeight)/pageWidth,posY=baseY+(position[1]-pageY-this.width*pageWidth)/pageHeight;_ref93=[-ty,tx];tx=_ref93[0],ty=_ref93[1]}this.setAt(posX*parentWidth,posY*style,tx,ty)}else this._moveAfterPaste(baseX,baseY);_assertClassBrand(_FreeTextEditor_brand,this,_setContent).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0}return this.div}},{key:"editorDivPaste",value:function(event){var clipboardData=event.clipboardData||window.clipboardData,types=clipboardData.types;if(1!==types.length||"text/plain"!==types[0]){event.preventDefault();types=_deserializeContent.call(FreeTextEditor,clipboardData.getData("text")||"").replaceAll(EOL_PATTERN,"\n");if(types){event=window.getSelection();if(event.rangeCount){this.editorDiv.normalize(),event.deleteFromDocument();clipboardData=event.getRangeAt(0);if(types.includes("\n")){var startContainer=clipboardData.startContainer,startOffset=clipboardData.startOffset,bufferBefore=[],bufferAfter=[];if(startContainer.nodeType===Node.TEXT_NODE){var parent=startContainer.parentElement;if(bufferAfter.push(startContainer.nodeValue.slice(startOffset).replaceAll(EOL_PATTERN,"")),parent!==this.editorDiv){var _step135,buffer=bufferBefore,_iterator135=_createForOfIteratorHelper(this.editorDiv.childNodes);try{for(_iterator135.s();!(_step135=_iterator135.n()).done;){var child=_step135.value;child===parent?buffer=bufferAfter:buffer.push(_getNodeContent.call(FreeTextEditor,child))}}catch(err){_iterator135.e(err)}finally{_iterator135.f()}}bufferBefore.push(startContainer.nodeValue.slice(0,startOffset).replaceAll(EOL_PATTERN,""))}else if(startContainer===this.editorDiv){var _step136,_buffer=bufferBefore,i=0,_iterator136=_createForOfIteratorHelper(this.editorDiv.childNodes);try{for(_iterator136.s();!(_step136=_iterator136.n()).done;){var _child=_step136.value;(_buffer=i++===startOffset?bufferAfter:_buffer).push(_getNodeContent.call(FreeTextEditor,_child))}}catch(err){_iterator136.e(err)}finally{_iterator136.f()}}_classPrivateFieldSet(_content,this,"".concat(bufferBefore.join("\n")).concat(types).concat(bufferAfter.join("\n"))),_assertClassBrand(_FreeTextEditor_brand,this,_setContent).call(this);var _step137,newRange=new Range,beforeLength=Math.sumPrecise(bufferBefore.map(function(line){return line.length})),_iterator137=_createForOfIteratorHelper(this.editorDiv.childNodes);try{for(_iterator137.s();!(_step137=_iterator137.n()).done;){var firstChild=_step137.value.firstChild;if(firstChild.nodeType===Node.TEXT_NODE){var length=firstChild.nodeValue.length;if(beforeLength<=length){newRange.setStart(firstChild,beforeLength),newRange.setEnd(firstChild,beforeLength);break}beforeLength-=length}}}catch(err){_iterator137.e(err)}finally{_iterator137.f()}event.removeAllRanges(),event.addRange(newRange)}else clipboardData.insertNode(document.createTextNode(types)),this.editorDiv.normalize(),event.collapseToStart()}}}}},{key:"contentDiv",get:function(){return this.editorDiv}},{key:"serialize",value:function(){var isForCopying=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();var padding=FreeTextEditor._internalPadding*this.parentScale,padding=this.getRect(padding,padding),color=AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:_classPrivateFieldGet(_color2,this)),color={annotationType:AnnotationEditorType.FREETEXT,color:color,fontSize:_classPrivateFieldGet(_fontSize,this),value:_assertClassBrand(_FreeTextEditor_brand,this,_serializeContent).call(this),pageIndex:this.pageIndex,rect:padding,rotation:this.rotation,structTreeParentId:this._structTreeParentId};if(isForCopying)color.isCopy=!0;else{if(this.annotationElementId&&!_assertClassBrand(_FreeTextEditor_brand,this,_hasElementChanged).call(this,color))return null;color.id=this.annotationElementId}return color}},{key:"renderAnnotationElement",value:function(annotation){var content=_superPropGet(FreeTextEditor,"renderAnnotationElement",this,3)([annotation]);if(!this.deleted){var _step138,style=content.style,_iterator138=(style.fontSize="calc(".concat(_classPrivateFieldGet(_fontSize,this),"px * var(--total-scale-factor))"),style.color=_classPrivateFieldGet(_color2,this),content.replaceChildren(),_createForOfIteratorHelper(_classPrivateFieldGet(_content,this).split("\n")));try{for(_iterator138.s();!(_step138=_iterator138.n()).done;){var line=_step138.value,div=document.createElement("div");div.append(line?document.createTextNode(line):document.createElement("br")),content.append(div)}}catch(err){_iterator138.e(err)}finally{_iterator138.f()}style=FreeTextEditor._internalPadding*this.parentScale;annotation.updateEdited({rect:this.getRect(style,style),popupContent:_classPrivateFieldGet(_content,this)})}return content}},{key:"resetAnnotationElement",value:function(annotation){_superPropGet(FreeTextEditor,"resetAnnotationElement",this,3)([annotation]),annotation.resetEdited()}}],[{key:"_keyboardManager",get:function(){function arrowChecker(self){return self.isEmpty()}var proto=FreeTextEditor.prototype,small=AnnotationEditorUIManager.TRANSLATE_SMALL,big=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,"_keyboardManager",new KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],proto.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],proto.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],proto._translateEmpty,{args:[-small,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],proto._translateEmpty,{args:[-big,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],proto._translateEmpty,{args:[small,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],proto._translateEmpty,{args:[big,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],proto._translateEmpty,{args:[0,-small],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],proto._translateEmpty,{args:[0,-big],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],proto._translateEmpty,{args:[0,small],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],proto._translateEmpty,{args:[0,big],checker:arrowChecker}]]))}},{key:"initialize",value:function(l10n,uiManager){AnnotationEditor.initialize(l10n,uiManager);l10n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(l10n.getPropertyValue("--freetext-padding"))}},{key:"updateDefaultParams",value:function(type,value){switch(type){case AnnotationEditorParamsType.FREETEXT_SIZE:FreeTextEditor._defaultFontSize=value;break;case AnnotationEditorParamsType.FREETEXT_COLOR:FreeTextEditor._defaultColor=value}}},{key:"defaultPropertiesToUpdate",get:function(){return[[AnnotationEditorParamsType.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[AnnotationEditorParamsType.FREETEXT_COLOR,FreeTextEditor._defaultColor||AnnotationEditor._defaultLineColor]]}},{key:"deserialize",value:async function(data,parent,uiManager){var initialData=null;if(data instanceof FreeTextAnnotationElement){var _data5=data,_data5$data=_data5.data,_data5$data$defaultAp=_data5$data.defaultAppearanceData,fontSize=_data5$data$defaultAp.fontSize,_data5$data$defaultAp=_data5$data$defaultAp.fontColor,rect=_data5$data.rect,rotation=_data5$data.rotation,id=_data5$data.id,_data5$data=_data5$data.popupRef,textContent=_data5.textContent,textPosition=_data5.textPosition,_data5=_data5.parent.page.pageNumber;if(!textContent||0===textContent.length)return null;initialData=data={annotationType:AnnotationEditorType.FREETEXT,color:Array.from(_data5$data$defaultAp),fontSize:fontSize,value:textContent.join("\n"),position:textPosition,pageIndex:_data5-1,rect:rect.slice(0),rotation:rotation,annotationElementId:id,id:id,deleted:!1,popupRef:_data5$data}}_data5$data$defaultAp=await _superPropGet(FreeTextEditor,"deserialize",this,2)([data,parent,uiManager]);return _classPrivateFieldSet(_fontSize,_data5$data$defaultAp,data.fontSize),_classPrivateFieldSet(_color2,_data5$data$defaultAp,Util.makeHexColor.apply(Util,babelHelpers.toConsumableArray(data.color))),_classPrivateFieldSet(_content,_data5$data$defaultAp,_deserializeContent.call(FreeTextEditor,data.value)),_data5$data$defaultAp._initialData=initialData,_data5$data$defaultAp}}])}(AnnotationEditor);function _updateFontSize(fontSize){function setFontsize(size){_this117.editorDiv.style.fontSize="calc(".concat(size,"px * var(--total-scale-factor))"),_this117.translate(0,-(size-_classPrivateFieldGet(_fontSize,_this117))*_this117.parentScale),_classPrivateFieldSet(_fontSize,_this117,size),_assertClassBrand(_FreeTextEditor_brand,_this117,_setEditorDimensions).call(_this117)}var _this117=this,savedFontsize=_classPrivateFieldGet(_fontSize,this);this.addCommands({cmd:setFontsize.bind(this,fontSize),undo:setFontsize.bind(this,savedFontsize),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function _updateColor(color){function setColor(col){_classPrivateFieldSet(_color2,_this118,_this118.editorDiv.style.color=col)}var _this118=this,savedColor=_classPrivateFieldGet(_color2,this);this.addCommands({cmd:setColor.bind(this,color),undo:setColor.bind(this,savedColor),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function _extractText(){var _step189,buffer=[],prevChild=(this.editorDiv.normalize(),null),_iterator189=_createForOfIteratorHelper(this.editorDiv.childNodes);try{for(_iterator189.s();!(_step189=_iterator189.n()).done;){var child=_step189.value;(null==prevChild?void 0:prevChild.nodeType)===Node.TEXT_NODE&&"BR"===child.nodeName||(buffer.push(_getNodeContent.call(_FreeTextEditor,child)),prevChild=child)}}catch(err){_iterator189.e(err)}finally{_iterator189.f()}return buffer.join("\n")}function _setEditorDimensions(){var rect,currentLayer,div,savedDisplay,savedVisibility,_this$parentDimension14=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=_this$parentDimension14[0],_this$parentDimension14=_this$parentDimension14[1];this.isAttachedToDOM?rect=this.div.getBoundingClientRect():(currentLayer=this.currentLayer,savedDisplay=(div=this.div).style.display,savedVisibility=div.classList.contains("hidden"),div.classList.remove("hidden"),div.style.display="hidden",currentLayer.div.append(this.div),rect=div.getBoundingClientRect(),div.remove(),div.style.display=savedDisplay,div.classList.toggle("hidden",savedVisibility)),this.rotation%180==this.parentRotation%180?(this.width=rect.width/parentWidth,this.height=rect.height/_this$parentDimension14):(this.width=rect.height/parentWidth,this.height=rect.width/_this$parentDimension14),this.fixAndSetPosition()}function _getNodeContent(node){return(node.nodeType===Node.TEXT_NODE?node.nodeValue:node.innerText).replaceAll(EOL_PATTERN,"")}function _setContent(){if(this.editorDiv.replaceChildren(),_classPrivateFieldGet(_content,this)){var _step190,_iterator190=_createForOfIteratorHelper(_classPrivateFieldGet(_content,this).split("\n"));try{for(_iterator190.s();!(_step190=_iterator190.n()).done;){var line=_step190.value,div=document.createElement("div");div.append(line?document.createTextNode(line):document.createElement("br")),this.editorDiv.append(div)}}catch(err){_iterator190.e(err)}finally{_iterator190.f()}}}function _serializeContent(){return _classPrivateFieldGet(_content,this).replaceAll(" "," ")}function _deserializeContent(content){return content.replaceAll(" "," ")}function _hasElementChanged(serialized){var _this$_initialData2=this._initialData,value=_this$_initialData2.value,fontSize=_this$_initialData2.fontSize,color=_this$_initialData2.color,_this$_initialData2=_this$_initialData2.pageIndex;return this._hasBeenMoved||serialized.value!==value||serialized.fontSize!==fontSize||serialized.color.some(function(c,i){return c!==color[i]})||serialized.pageIndex!==_this$_initialData2}_FreeTextEditor=FreeTextEditor,babelHelpers.defineProperty(FreeTextEditor,"_freeTextDefaultContent",""),babelHelpers.defineProperty(FreeTextEditor,"_internalPadding",0),babelHelpers.defineProperty(FreeTextEditor,"_defaultColor",null),babelHelpers.defineProperty(FreeTextEditor,"_defaultFontSize",10),babelHelpers.defineProperty(FreeTextEditor,"_type","freetext"),babelHelpers.defineProperty(FreeTextEditor,"_editorType",AnnotationEditorType.FREETEXT);var Outline=function(){return babelHelpers.createClass(function Outline(){babelHelpers.classCallCheck(this,Outline)},[{key:"toSVGPath",value:function(){unreachable("Abstract method `toSVGPath` must be implemented.")}},{key:"box",get:function(){unreachable("Abstract getter `box` must be implemented.")}},{key:"serialize",value:function(_bbox,_rotation){unreachable("Abstract method `serialize` must be implemented.")}}],[{key:"_rescale",value:function(src,tx,ty,sx,sy,dest){dest=dest||new Float32Array(src.length);for(var i=0,ii=src.length;i<ii;i+=2)dest[i]=tx+src[i]*sx,dest[i+1]=ty+src[i+1]*sy;return dest}},{key:"_rescaleAndSwap",value:function(src,tx,ty,sx,sy,dest){dest=dest||new Float32Array(src.length);for(var i=0,ii=src.length;i<ii;i+=2)dest[i]=tx+src[i+1]*sx,dest[i+1]=ty+src[i]*sy;return dest}},{key:"_translate",value:function(src,tx,ty,dest){dest=dest||new Float32Array(src.length);for(var i=0,ii=src.length;i<ii;i+=2)dest[i]=tx+src[i],dest[i+1]=ty+src[i+1];return dest}},{key:"svgRound",value:function(x){return Math.round(1e4*x)}},{key:"_normalizePoint",value:function(x,y,parentWidth,parentHeight,rotation){switch(rotation){case 90:return[1-y/parentWidth,x/parentHeight];case 180:return[1-x/parentWidth,1-y/parentHeight];case 270:return[y/parentWidth,1-x/parentHeight];default:return[x/parentWidth,y/parentHeight]}}},{key:"_normalizePagePoint",value:function(x,y,rotation){switch(rotation){case 90:return[1-y,x];case 180:return[1-x,1-y];case 270:return[y,1-x];default:return[x,y]}}},{key:"createBezierPoints",value:function(x1,y1,x2,y2,x3,y3){return[(x1+5*x2)/6,(y1+5*y2)/6,(5*x2+x3)/6,(5*y2+y3)/6,(x2+x3)/2,(y2+y3)/2]}}])}(),_box=(babelHelpers.defineProperty(Outline,"PRECISION",1e-4),new WeakMap),_bottom=new WeakMap,_innerMargin=new WeakMap,_isLTR2=new WeakMap,_top=new WeakMap,_last=new WeakMap,_lastX=new WeakMap,_lastY=new WeakMap,_min=new WeakMap,_min_dist=new WeakMap,_scaleFactor=new WeakMap,_thickness=new WeakMap,_points=new WeakMap,_FreeDrawOutliner_brand=new WeakSet,FreeDrawOutliner=function(){return babelHelpers.createClass(function FreeDrawOutliner(_ref96,box,scaleFactor,thickness,isLTR){var _x3=_ref96.x,_y3=_ref96.y,innerMargin=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;babelHelpers.classCallCheck(this,FreeDrawOutliner),_classPrivateMethodInitSpec(this,_FreeDrawOutliner_brand),_classPrivateFieldInitSpec(this,_box,void 0),_classPrivateFieldInitSpec(this,_bottom,[]),_classPrivateFieldInitSpec(this,_innerMargin,void 0),_classPrivateFieldInitSpec(this,_isLTR2,void 0),_classPrivateFieldInitSpec(this,_top,[]),_classPrivateFieldInitSpec(this,_last,new Float32Array(18)),_classPrivateFieldInitSpec(this,_lastX,void 0),_classPrivateFieldInitSpec(this,_lastY,void 0),_classPrivateFieldInitSpec(this,_min,void 0),_classPrivateFieldInitSpec(this,_min_dist,void 0),_classPrivateFieldInitSpec(this,_scaleFactor,void 0),_classPrivateFieldInitSpec(this,_thickness,void 0),_classPrivateFieldInitSpec(this,_points,[]),_classPrivateFieldSet(_box,this,box),_classPrivateFieldSet(_thickness,this,thickness*scaleFactor),_classPrivateFieldSet(_isLTR2,this,isLTR),_classPrivateFieldGet(_last,this).set([NaN,NaN,NaN,NaN,_x3,_y3],6),_classPrivateFieldSet(_innerMargin,this,innerMargin),_classPrivateFieldSet(_min_dist,this,_MIN_DIST._*scaleFactor),_classPrivateFieldSet(_min,this,_MIN._*scaleFactor),_classPrivateFieldSet(_scaleFactor,this,scaleFactor),_classPrivateFieldGet(_points,this).push(_x3,_y3)},[{key:"isEmpty",value:function(){return isNaN(_classPrivateFieldGet(_last,this)[8])}},{key:"add",value:function(_ref97){var x=_ref97.x,_ref97=_ref97.y,_classPrivateFieldGet73=(_classPrivateFieldSet(_lastX,this,x),_classPrivateFieldSet(_lastY,this,_ref97),_classPrivateFieldGet(_box,this)),_classPrivateFieldGet73=babelHelpers.slicedToArray(_classPrivateFieldGet73,4),layerX=_classPrivateFieldGet73[0],layerY=_classPrivateFieldGet73[1],layerWidth=_classPrivateFieldGet73[2],_classPrivateFieldGet73=_classPrivateFieldGet73[3],_classPrivateFieldGet75=_classPrivateFieldGet(_last,this).subarray(8,12),_classPrivateFieldGet75=babelHelpers.slicedToArray(_classPrivateFieldGet75,4),x1=_classPrivateFieldGet75[0],y1=_classPrivateFieldGet75[1],x2=_classPrivateFieldGet75[2],_classPrivateFieldGet75=_classPrivateFieldGet75[3],diffX=x-x2,diffY=_ref97-_classPrivateFieldGet75,d=Math.hypot(diffX,diffY);if(d<_classPrivateFieldGet(_min,this))return!1;var diffD=d-_classPrivateFieldGet(_min_dist,this),d=diffD/d,diffX=d*diffX,d=d*diffY,diffY=x1,y0=y1;x1=x2,y1=_classPrivateFieldGet75,x2+=diffX,_classPrivateFieldGet75+=d,null!=(_classPrivateFieldGet77=_classPrivateFieldGet(_points,this))&&_classPrivateFieldGet77.push(x,_ref97);var _classPrivateFieldGet77=diffX/diffD,x=-d/diffD*_classPrivateFieldGet(_thickness,this),_ref97=_classPrivateFieldGet77*_classPrivateFieldGet(_thickness,this);return _classPrivateFieldGet(_last,this).set(_classPrivateFieldGet(_last,this).subarray(2,8),0),_classPrivateFieldGet(_last,this).set([x2+x,_classPrivateFieldGet75+_ref97],4),_classPrivateFieldGet(_last,this).set(_classPrivateFieldGet(_last,this).subarray(14,18),12),_classPrivateFieldGet(_last,this).set([x2-x,_classPrivateFieldGet75-_ref97],16),isNaN(_classPrivateFieldGet(_last,this)[6])?(0===_classPrivateFieldGet(_top,this).length&&(_classPrivateFieldGet(_last,this).set([x1+x,y1+_ref97],2),_classPrivateFieldGet(_top,this).push(NaN,NaN,NaN,NaN,(x1+x-layerX)/layerWidth,(y1+_ref97-layerY)/_classPrivateFieldGet73),_classPrivateFieldGet(_last,this).set([x1-x,y1-_ref97],14),_classPrivateFieldGet(_bottom,this).push(NaN,NaN,NaN,NaN,(x1-x-layerX)/layerWidth,(y1-_ref97-layerY)/_classPrivateFieldGet73)),_classPrivateFieldGet(_last,this).set([diffY,y0,x1,y1,x2,_classPrivateFieldGet75],6),!this.isEmpty()):(_classPrivateFieldGet(_last,this).set([diffY,y0,x1,y1,x2,_classPrivateFieldGet75],6),Math.abs(Math.atan2(y0-y1,diffY-x1)-Math.atan2(d,diffX))<Math.PI/2?(diffD=_classPrivateFieldGet(_last,this).subarray(2,6),x1=(_classPrivateFieldGet77=babelHelpers.slicedToArray(diffD,4))[0],y1=_classPrivateFieldGet77[1],x2=_classPrivateFieldGet77[2],_classPrivateFieldGet75=_classPrivateFieldGet77[3],_classPrivateFieldGet(_top,this).push(NaN,NaN,NaN,NaN,((x1+x2)/2-layerX)/layerWidth,((y1+_classPrivateFieldGet75)/2-layerY)/_classPrivateFieldGet73),x=_classPrivateFieldGet(_last,this).subarray(14,18),x1=(_ref97=babelHelpers.slicedToArray(x,4))[0],y1=_ref97[1],diffY=_ref97[2],y0=_ref97[3],_classPrivateFieldGet(_bottom,this).push(NaN,NaN,NaN,NaN,((diffY+x1)/2-layerX)/layerWidth,((y0+y1)/2-layerY)/_classPrivateFieldGet73)):(d=_classPrivateFieldGet(_last,this).subarray(0,6),diffY=(diffX=babelHelpers.slicedToArray(d,6))[0],y0=diffX[1],x1=diffX[2],y1=diffX[3],x2=diffX[4],_classPrivateFieldGet75=diffX[5],_classPrivateFieldGet(_top,this).push(((diffY+5*x1)/6-layerX)/layerWidth,((y0+5*y1)/6-layerY)/_classPrivateFieldGet73,((5*x1+x2)/6-layerX)/layerWidth,((5*y1+_classPrivateFieldGet75)/6-layerY)/_classPrivateFieldGet73,((x1+x2)/2-layerX)/layerWidth,((y1+_classPrivateFieldGet75)/2-layerY)/_classPrivateFieldGet73),diffD=_classPrivateFieldGet(_last,this).subarray(12,18),x2=(_classPrivateFieldGet77=babelHelpers.slicedToArray(diffD,6))[0],_classPrivateFieldGet75=_classPrivateFieldGet77[1],x1=_classPrivateFieldGet77[2],y1=_classPrivateFieldGet77[3],diffY=_classPrivateFieldGet77[4],y0=_classPrivateFieldGet77[5],_classPrivateFieldGet(_bottom,this).push(((diffY+5*x1)/6-layerX)/layerWidth,((y0+5*y1)/6-layerY)/_classPrivateFieldGet73,((5*x1+x2)/6-layerX)/layerWidth,((5*y1+_classPrivateFieldGet75)/6-layerY)/_classPrivateFieldGet73,((x1+x2)/2-layerX)/layerWidth,((y1+_classPrivateFieldGet75)/2-layerY)/_classPrivateFieldGet73)),!0)}},{key:"toSVGPath",value:function(){if(this.isEmpty())return"";var top=_classPrivateFieldGet(_top,this),bottom=_classPrivateFieldGet(_bottom,this);if(isNaN(_classPrivateFieldGet(_last,this)[6])&&!this.isEmpty())return _assertClassBrand(_FreeDrawOutliner_brand,this,_toSVGPathTwoPoints).call(this);var buffer=[];buffer.push("M".concat(top[4]," ").concat(top[5]));for(var i=6;i<top.length;i+=6)isNaN(top[i])?buffer.push("L".concat(top[i+4]," ").concat(top[i+5])):buffer.push("C".concat(top[i]," ").concat(top[i+1]," ").concat(top[i+2]," ").concat(top[i+3]," ").concat(top[i+4]," ").concat(top[i+5]));_assertClassBrand(_FreeDrawOutliner_brand,this,_toSVGPathEnd).call(this,buffer);for(var _i19=bottom.length-6;6<=_i19;_i19-=6)isNaN(bottom[_i19])?buffer.push("L".concat(bottom[_i19+4]," ").concat(bottom[_i19+5])):buffer.push("C".concat(bottom[_i19]," ").concat(bottom[_i19+1]," ").concat(bottom[_i19+2]," ").concat(bottom[_i19+3]," ").concat(bottom[_i19+4]," ").concat(bottom[_i19+5]));return _assertClassBrand(_FreeDrawOutliner_brand,this,_toSVGPathStart).call(this,buffer),buffer.join(" ")}},{key:"newFreeDrawOutline",value:function(outline,points,box,scaleFactor,innerMargin,isLTR){return new FreeDrawOutline(outline,points,box,scaleFactor,innerMargin,isLTR)}},{key:"getOutlines",value:function(){for(var top=_classPrivateFieldGet(_top,this),bottom=_classPrivateFieldGet(_bottom,this),last=_classPrivateFieldGet(_last,this),_classPrivateFieldGet86=_classPrivateFieldGet(_box,this),_classPrivateFieldGet86=babelHelpers.slicedToArray(_classPrivateFieldGet86,4),layerX=_classPrivateFieldGet86[0],layerY=_classPrivateFieldGet86[1],layerWidth=_classPrivateFieldGet86[2],layerHeight=_classPrivateFieldGet86[3],points=new Float32Array((null!=(_classPrivateFieldGet86=null==(_classPrivateFieldGet86=_classPrivateFieldGet(_points,this))?void 0:_classPrivateFieldGet86.length)?_classPrivateFieldGet86:0)+2),i=0,ii=points.length-2;i<ii;i+=2)points[i]=(_classPrivateFieldGet(_points,this)[i]-layerX)/layerWidth,points[i+1]=(_classPrivateFieldGet(_points,this)[i+1]-layerY)/layerHeight;if(points[points.length-2]=(_classPrivateFieldGet(_lastX,this)-layerX)/layerWidth,points[points.length-1]=(_classPrivateFieldGet(_lastY,this)-layerY)/layerHeight,isNaN(last[6])&&!this.isEmpty())return _assertClassBrand(_FreeDrawOutliner_brand,this,_getOutlineTwoPoints).call(this,points);for(var outline=new Float32Array(_classPrivateFieldGet(_top,this).length+24+_classPrivateFieldGet(_bottom,this).length),N=top.length,_i20=0;_i20<N;_i20+=2)isNaN(top[_i20])?outline[_i20]=outline[_i20+1]=NaN:(outline[_i20]=top[_i20],outline[_i20+1]=top[_i20+1]);for(var N=_assertClassBrand(_FreeDrawOutliner_brand,this,_getOutlineEnd).call(this,outline,N),_i21=bottom.length-6;6<=_i21;_i21-=6)for(var j=0;j<6;j+=2)isNaN(bottom[_i21+j])?outline[N]=outline[N+1]=NaN:(outline[N]=bottom[_i21+j],outline[N+1]=bottom[_i21+j+1]),N+=2;return _assertClassBrand(_FreeDrawOutliner_brand,this,_getOutlineStart).call(this,outline,N),this.newFreeDrawOutline(outline,points,_classPrivateFieldGet(_box,this),_classPrivateFieldGet(_scaleFactor,this),_classPrivateFieldGet(_innerMargin,this),_classPrivateFieldGet(_isLTR2,this))}}])}();function _getLastCoords(){var lastTop=_classPrivateFieldGet(_last,this).subarray(4,6),lastBottom=_classPrivateFieldGet(_last,this).subarray(16,18),_classPrivateFieldGet165=_classPrivateFieldGet(_box,this),_classPrivateFieldGet165=babelHelpers.slicedToArray(_classPrivateFieldGet165,4),x=_classPrivateFieldGet165[0],y=_classPrivateFieldGet165[1],width=_classPrivateFieldGet165[2],_classPrivateFieldGet165=_classPrivateFieldGet165[3];return[(_classPrivateFieldGet(_lastX,this)+(lastTop[0]-lastBottom[0])/2-x)/width,(_classPrivateFieldGet(_lastY,this)+(lastTop[1]-lastBottom[1])/2-y)/_classPrivateFieldGet165,(_classPrivateFieldGet(_lastX,this)+(lastBottom[0]-lastTop[0])/2-x)/width,(_classPrivateFieldGet(_lastY,this)+(lastBottom[1]-lastTop[1])/2-y)/_classPrivateFieldGet165]}function _toSVGPathTwoPoints(){var _classPrivateFieldGet167=_classPrivateFieldGet(_box,this),_classPrivateFieldGet167=babelHelpers.slicedToArray(_classPrivateFieldGet167,4),x=_classPrivateFieldGet167[0],y=_classPrivateFieldGet167[1],width=_classPrivateFieldGet167[2],_classPrivateFieldGet167=_classPrivateFieldGet167[3],_assertClassBrand$cal30=_assertClassBrand(_FreeDrawOutliner_brand,this,_getLastCoords).call(this),_assertClassBrand$cal30=babelHelpers.slicedToArray(_assertClassBrand$cal30,4),lastTopX=_assertClassBrand$cal30[0],lastTopY=_assertClassBrand$cal30[1],lastBottomX=_assertClassBrand$cal30[2],_assertClassBrand$cal30=_assertClassBrand$cal30[3];return"M".concat((_classPrivateFieldGet(_last,this)[2]-x)/width," ").concat((_classPrivateFieldGet(_last,this)[3]-y)/_classPrivateFieldGet167," L").concat((_classPrivateFieldGet(_last,this)[4]-x)/width," ").concat((_classPrivateFieldGet(_last,this)[5]-y)/_classPrivateFieldGet167," L").concat(lastTopX," ").concat(lastTopY," L").concat(lastBottomX," ").concat(_assertClassBrand$cal30," L").concat((_classPrivateFieldGet(_last,this)[16]-x)/width," ").concat((_classPrivateFieldGet(_last,this)[17]-y)/_classPrivateFieldGet167," L").concat((_classPrivateFieldGet(_last,this)[14]-x)/width," ").concat((_classPrivateFieldGet(_last,this)[15]-y)/_classPrivateFieldGet167," Z")}function _toSVGPathStart(buffer){var bottom=_classPrivateFieldGet(_bottom,this);buffer.push("L".concat(bottom[4]," ").concat(bottom[5]," Z"))}function _toSVGPathEnd(buffer){var _classPrivateFieldGet169=_classPrivateFieldGet(_box,this),_classPrivateFieldGet169=babelHelpers.slicedToArray(_classPrivateFieldGet169,4),x=_classPrivateFieldGet169[0],y=_classPrivateFieldGet169[1],width=_classPrivateFieldGet169[2],_classPrivateFieldGet169=_classPrivateFieldGet169[3],lastTop=_classPrivateFieldGet(_last,this).subarray(4,6),lastBottom=_classPrivateFieldGet(_last,this).subarray(16,18),_assertClassBrand$cal32=_assertClassBrand(_FreeDrawOutliner_brand,this,_getLastCoords).call(this),_assertClassBrand$cal32=babelHelpers.slicedToArray(_assertClassBrand$cal32,4),lastTopX=_assertClassBrand$cal32[0],lastTopY=_assertClassBrand$cal32[1],lastBottomX=_assertClassBrand$cal32[2],_assertClassBrand$cal32=_assertClassBrand$cal32[3];buffer.push("L".concat((lastTop[0]-x)/width," ").concat((lastTop[1]-y)/_classPrivateFieldGet169," L").concat(lastTopX," ").concat(lastTopY," L").concat(lastBottomX," ").concat(_assertClassBrand$cal32," L").concat((lastBottom[0]-x)/width," ").concat((lastBottom[1]-y)/_classPrivateFieldGet169))}function _getOutlineTwoPoints(points){var last=_classPrivateFieldGet(_last,this),_classPrivateFieldGet171=_classPrivateFieldGet(_box,this),_classPrivateFieldGet171=babelHelpers.slicedToArray(_classPrivateFieldGet171,4),layerX=_classPrivateFieldGet171[0],layerY=_classPrivateFieldGet171[1],layerWidth=_classPrivateFieldGet171[2],_classPrivateFieldGet171=_classPrivateFieldGet171[3],_assertClassBrand$cal34=_assertClassBrand(_FreeDrawOutliner_brand,this,_getLastCoords).call(this),_assertClassBrand$cal34=babelHelpers.slicedToArray(_assertClassBrand$cal34,4),lastTopX=_assertClassBrand$cal34[0],lastTopY=_assertClassBrand$cal34[1],lastBottomX=_assertClassBrand$cal34[2],_assertClassBrand$cal34=_assertClassBrand$cal34[3],outline=new Float32Array(36);return outline.set([NaN,NaN,NaN,NaN,(last[2]-layerX)/layerWidth,(last[3]-layerY)/_classPrivateFieldGet171,NaN,NaN,NaN,NaN,(last[4]-layerX)/layerWidth,(last[5]-layerY)/_classPrivateFieldGet171,NaN,NaN,NaN,NaN,lastTopX,lastTopY,NaN,NaN,NaN,NaN,lastBottomX,_assertClassBrand$cal34,NaN,NaN,NaN,NaN,(last[16]-layerX)/layerWidth,(last[17]-layerY)/_classPrivateFieldGet171,NaN,NaN,NaN,NaN,(last[14]-layerX)/layerWidth,(last[15]-layerY)/_classPrivateFieldGet171],0),this.newFreeDrawOutline(outline,points,_classPrivateFieldGet(_box,this),_classPrivateFieldGet(_scaleFactor,this),_classPrivateFieldGet(_innerMargin,this),_classPrivateFieldGet(_isLTR2,this))}function _getOutlineStart(outline,pos){var bottom=_classPrivateFieldGet(_bottom,this);return outline.set([NaN,NaN,NaN,NaN,bottom[4],bottom[5]],pos),pos+6}function _getOutlineEnd(outline,pos){var lastTop=_classPrivateFieldGet(_last,this).subarray(4,6),lastBottom=_classPrivateFieldGet(_last,this).subarray(16,18),_classPrivateFieldGet173=_classPrivateFieldGet(_box,this),_classPrivateFieldGet173=babelHelpers.slicedToArray(_classPrivateFieldGet173,4),layerX=_classPrivateFieldGet173[0],layerY=_classPrivateFieldGet173[1],layerWidth=_classPrivateFieldGet173[2],_classPrivateFieldGet173=_classPrivateFieldGet173[3],_assertClassBrand$cal36=_assertClassBrand(_FreeDrawOutliner_brand,this,_getLastCoords).call(this),_assertClassBrand$cal36=babelHelpers.slicedToArray(_assertClassBrand$cal36,4),lastTopX=_assertClassBrand$cal36[0],lastTopY=_assertClassBrand$cal36[1],lastBottomX=_assertClassBrand$cal36[2],_assertClassBrand$cal36=_assertClassBrand$cal36[3];return outline.set([NaN,NaN,NaN,NaN,(lastTop[0]-layerX)/layerWidth,(lastTop[1]-layerY)/_classPrivateFieldGet173,NaN,NaN,NaN,NaN,lastTopX,lastTopY,NaN,NaN,NaN,NaN,lastBottomX,_assertClassBrand$cal36,NaN,NaN,NaN,NaN,(lastBottom[0]-layerX)/layerWidth,(lastBottom[1]-layerY)/_classPrivateFieldGet173],pos),pos+24}var _MIN_DIST={_:8},_MIN={_:_MIN_DIST._+2},_box2=new WeakMap,_bbox3=new WeakMap,_innerMargin2=new WeakMap,_isLTR3=new WeakMap,_points2=new WeakMap,_scaleFactor2=new WeakMap,_outline=new WeakMap,_FreeDrawOutline_brand=new WeakSet,FreeDrawOutline=function(){function FreeDrawOutline(_outline2,points,box,scaleFactor,innerMargin,_isLTR4){babelHelpers.classCallCheck(this,FreeDrawOutline),_classPrivateMethodInitSpec(_this85=_callSuper(this,FreeDrawOutline),_FreeDrawOutline_brand),_classPrivateFieldInitSpec(_this85,_box2,void 0),_classPrivateFieldInitSpec(_this85,_bbox3,new Float32Array(4)),_classPrivateFieldInitSpec(_this85,_innerMargin2,void 0),_classPrivateFieldInitSpec(_this85,_isLTR3,void 0),_classPrivateFieldInitSpec(_this85,_points2,void 0),_classPrivateFieldInitSpec(_this85,_scaleFactor2,void 0),_classPrivateFieldInitSpec(_this85,_outline,void 0),_classPrivateFieldSet(_outline,_this85,_outline2),_classPrivateFieldSet(_points2,_this85,points),_classPrivateFieldSet(_box2,_this85,box),_classPrivateFieldSet(_scaleFactor2,_this85,scaleFactor),_classPrivateFieldSet(_innerMargin2,_this85,innerMargin),_classPrivateFieldSet(_isLTR3,_this85,_isLTR4),_this85.lastPoint=[NaN,NaN],_assertClassBrand(_FreeDrawOutline_brand,_this85,_computeMinMax).call(_this85,_isLTR4);for(var _this85,box=_classPrivateFieldGet(_bbox3,_this85),scaleFactor=babelHelpers.slicedToArray(box,4),_x4=scaleFactor[0],_y4=scaleFactor[1],width=scaleFactor[2],height=scaleFactor[3],i=0,ii=_outline2.length;i<ii;i+=2)_outline2[i]=(_outline2[i]-_x4)/width,_outline2[i+1]=(_outline2[i+1]-_y4)/height;for(var _i22=0,_ii3=points.length;_i22<_ii3;_i22+=2)points[_i22]=(points[_i22]-_x4)/width,points[_i22+1]=(points[_i22+1]-_y4)/height;return _this85}return babelHelpers.inherits(FreeDrawOutline,Outline),babelHelpers.createClass(FreeDrawOutline,[{key:"toSVGPath",value:function(){for(var buffer=["M".concat(_classPrivateFieldGet(_outline,this)[4]," ").concat(_classPrivateFieldGet(_outline,this)[5])],i=6,ii=_classPrivateFieldGet(_outline,this).length;i<ii;i+=6)isNaN(_classPrivateFieldGet(_outline,this)[i])?buffer.push("L".concat(_classPrivateFieldGet(_outline,this)[i+4]," ").concat(_classPrivateFieldGet(_outline,this)[i+5])):buffer.push("C".concat(_classPrivateFieldGet(_outline,this)[i]," ").concat(_classPrivateFieldGet(_outline,this)[i+1]," ").concat(_classPrivateFieldGet(_outline,this)[i+2]," ").concat(_classPrivateFieldGet(_outline,this)[i+3]," ").concat(_classPrivateFieldGet(_outline,this)[i+4]," ").concat(_classPrivateFieldGet(_outline,this)[i+5]));return buffer.push("Z"),buffer.join(" ")}},{key:"serialize",value:function(_ref98,rotation){var outline,points,_ref98=babelHelpers.slicedToArray(_ref98,4),blX=_ref98[0],blY=_ref98[1],trX=_ref98[2],trY=_ref98[3],width=trX-blX,height=trY-blY;switch(rotation){case 0:outline=Outline._rescale(_classPrivateFieldGet(_outline,this),blX,trY,width,-height),points=Outline._rescale(_classPrivateFieldGet(_points2,this),blX,trY,width,-height);break;case 90:outline=Outline._rescaleAndSwap(_classPrivateFieldGet(_outline,this),blX,blY,width,height),points=Outline._rescaleAndSwap(_classPrivateFieldGet(_points2,this),blX,blY,width,height);break;case 180:outline=Outline._rescale(_classPrivateFieldGet(_outline,this),trX,blY,-width,height),points=Outline._rescale(_classPrivateFieldGet(_points2,this),trX,blY,-width,height);break;case 270:outline=Outline._rescaleAndSwap(_classPrivateFieldGet(_outline,this),trX,trY,-width,-height),points=Outline._rescaleAndSwap(_classPrivateFieldGet(_points2,this),trX,trY,-width,-height)}return{outline:Array.from(outline),points:[Array.from(points)]}}},{key:"box",get:function(){return _classPrivateFieldGet(_bbox3,this)}},{key:"newOutliner",value:function(point,box,scaleFactor,thickness,isLTR){return new FreeDrawOutliner(point,box,scaleFactor,thickness,isLTR,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0)}},{key:"getNewOutline",value:function(thickness,innerMargin){for(var _classPrivateFieldGet92=_classPrivateFieldGet(_bbox3,this),_classPrivateFieldGet92=babelHelpers.slicedToArray(_classPrivateFieldGet92,4),x=_classPrivateFieldGet92[0],y=_classPrivateFieldGet92[1],width=_classPrivateFieldGet92[2],_classPrivateFieldGet92=_classPrivateFieldGet92[3],_classPrivateFieldGet94=_classPrivateFieldGet(_box2,this),_classPrivateFieldGet94=babelHelpers.slicedToArray(_classPrivateFieldGet94,4),layerX=_classPrivateFieldGet94[0],layerY=_classPrivateFieldGet94[1],layerWidth=_classPrivateFieldGet94[2],_classPrivateFieldGet94=_classPrivateFieldGet94[3],sx=width*layerWidth,sy=_classPrivateFieldGet92*_classPrivateFieldGet94,tx=x*layerWidth+layerX,ty=y*_classPrivateFieldGet94+layerY,outliner=this.newOutliner({x:_classPrivateFieldGet(_points2,this)[0]*sx+tx,y:_classPrivateFieldGet(_points2,this)[1]*sy+ty},_classPrivateFieldGet(_box2,this),_classPrivateFieldGet(_scaleFactor2,this),thickness,_classPrivateFieldGet(_isLTR3,this),null!=innerMargin?innerMargin:_classPrivateFieldGet(_innerMargin2,this)),i=2;i<_classPrivateFieldGet(_points2,this).length;i+=2)outliner.add({x:_classPrivateFieldGet(_points2,this)[i]*sx+tx,y:_classPrivateFieldGet(_points2,this)[i+1]*sy+ty});return outliner.getOutlines()}}])}();function _computeMinMax(isLTR){for(var outline=_classPrivateFieldGet(_outline,this),lastX=outline[4],lastY=outline[5],minMax=[lastX,lastY,lastX,lastY],lastPointX=lastX,lastPointY=lastY,ltrCallback=isLTR?Math.max:Math.min,i=6,ii=outline.length;i<ii;i+=6){var _bbox6,x=outline[i+4],y=outline[i+5];isNaN(outline[i])?(Util.pointBoundingBox(x,y,minMax),lastPointY<y?(lastPointX=x,lastPointY=y):lastPointY===y&&(lastPointX=ltrCallback(lastPointX,x))):(_bbox6=[1/0,1/0,-1/0,-1/0],Util.bezierBoundingBox.apply(Util,[lastX,lastY].concat(babelHelpers.toConsumableArray(outline.slice(i,i+6)),[_bbox6])),Util.rectBoundingBox.apply(Util,_bbox6.concat([minMax])),lastPointY<_bbox6[3]?(lastPointX=_bbox6[2],lastPointY=_bbox6[3]):lastPointY===_bbox6[3]&&(lastPointX=ltrCallback(lastPointX,_bbox6[2]))),lastX=x,lastY=y}isLTR=_classPrivateFieldGet(_bbox3,this);isLTR[0]=minMax[0]-_classPrivateFieldGet(_innerMargin2,this),isLTR[1]=minMax[1]-_classPrivateFieldGet(_innerMargin2,this),isLTR[2]=minMax[2]-minMax[0]+2*_classPrivateFieldGet(_innerMargin2,this),isLTR[3]=minMax[3]-minMax[1]+2*_classPrivateFieldGet(_innerMargin2,this),this.lastPoint=[lastPointX,lastPointY]}var _box3=new WeakMap,_lastPoint=new WeakMap,_verticalEdges=new WeakMap,_intervals=new WeakMap,_HighlightOutliner_brand=new WeakSet,HighlightOutliner=function(){return babelHelpers.createClass(function HighlightOutliner(boxes){var _step139,borderWidth=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,innerMargin=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,isLTR=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],minMax=(babelHelpers.classCallCheck(this,HighlightOutliner),_classPrivateMethodInitSpec(this,_HighlightOutliner_brand),_classPrivateFieldInitSpec(this,_box3,void 0),_classPrivateFieldInitSpec(this,_lastPoint,void 0),_classPrivateFieldInitSpec(this,_verticalEdges,[]),_classPrivateFieldInitSpec(this,_intervals,[]),[1/0,1/0,-1/0,-1/0]),EPSILON=Math.pow(10,-4),_iterator139=_createForOfIteratorHelper(boxes);try{for(_iterator139.s();!(_step139=_iterator139.n()).done;){var _step139$value=_step139.value,x=_step139$value.x,y=_step139$value.y,width=_step139$value.width,height=_step139$value.height,x1=Math.floor((x-borderWidth)/EPSILON)*EPSILON,x2=Math.ceil((x+width+borderWidth)/EPSILON)*EPSILON,y1=Math.floor((y-borderWidth)/EPSILON)*EPSILON,y2=Math.ceil((y+height+borderWidth)/EPSILON)*EPSILON,left=[x1,y1,y2,!0],right=[x2,y1,y2,!1];_classPrivateFieldGet(_verticalEdges,this).push(left,right),Util.rectBoundingBox(x1,y1,x2,y2,minMax)}}catch(err){_iterator139.e(err)}finally{_iterator139.f()}var _step140,bboxWidth=minMax[2]-minMax[0]+2*innerMargin,bboxHeight=minMax[3]-minMax[1]+2*innerMargin,shiftedMinX=minMax[0]-innerMargin,shiftedMinY=minMax[1]-innerMargin,innerMargin=_classPrivateFieldGet(_verticalEdges,this).at(isLTR?-1:-2),isLTR=[innerMargin[0],innerMargin[2]],_iterator140=_createForOfIteratorHelper(_classPrivateFieldGet(_verticalEdges,this));try{for(_iterator140.s();!(_step140=_iterator140.n()).done;){var edge=_step140.value,_edge=babelHelpers.slicedToArray(edge,3),_x5=_edge[0],_y5=_edge[1],_y6=_edge[2];edge[0]=(_x5-shiftedMinX)/bboxWidth,edge[1]=(_y5-shiftedMinY)/bboxHeight,edge[2]=(_y6-shiftedMinY)/bboxHeight}}catch(err){_iterator140.e(err)}finally{_iterator140.f()}_classPrivateFieldSet(_box3,this,new Float32Array([shiftedMinX,shiftedMinY,bboxWidth,bboxHeight])),_classPrivateFieldSet(_lastPoint,this,isLTR)},[{key:"getOutlines",value:function(){_classPrivateFieldGet(_verticalEdges,this).sort(function(a,b){return a[0]-b[0]||a[1]-b[1]||a[2]-b[2]});var _step141,outlineVerticalEdges=[],_iterator141=_createForOfIteratorHelper(_classPrivateFieldGet(_verticalEdges,this));try{for(_iterator141.s();!(_step141=_iterator141.n()).done;){var edge=_step141.value;edge[3]?(outlineVerticalEdges.push.apply(outlineVerticalEdges,babelHelpers.toConsumableArray(_assertClassBrand(_HighlightOutliner_brand,this,_breakEdge).call(this,edge))),_assertClassBrand(_HighlightOutliner_brand,this,_insert).call(this,edge)):(_assertClassBrand(_HighlightOutliner_brand,this,_remove).call(this,edge),outlineVerticalEdges.push.apply(outlineVerticalEdges,babelHelpers.toConsumableArray(_assertClassBrand(_HighlightOutliner_brand,this,_breakEdge).call(this,edge))))}}catch(err){_iterator141.e(err)}finally{_iterator141.f()}return _assertClassBrand(_HighlightOutliner_brand,this,_getOutlines).call(this,outlineVerticalEdges)}}])}();function _getOutlines(outlineVerticalEdges){var _step191,edges=[],allEdges=new Set,_iterator191=_createForOfIteratorHelper(outlineVerticalEdges);try{for(_iterator191.s();!(_step191=_iterator191.n()).done;){var _edge5=_step191.value,_edge6=babelHelpers.slicedToArray(_edge5,3),_x7=_edge6[0],_y8=_edge6[1],_y9=_edge6[2];edges.push([_x7,_y8,_edge5],[_x7,_y9,_edge5])}}catch(err){_iterator191.e(err)}finally{_iterator191.f()}edges.sort(function(a,b){return a[1]-b[1]||a[0]-b[0]});for(var i=0,ii=edges.length;i<ii;i+=2){var edge1=edges[i][2],edge2=edges[i+1][2];edge1.push(edge2),edge2.push(edge1),allEdges.add(edge1),allEdges.add(edge2)}for(var outlines=[];0<allEdges.size;){var edge=allEdges.values().next().value,_edge2=babelHelpers.slicedToArray(edge,5),x=_edge2[0],y1=_edge2[1],y2=_edge2[2],_edge3=_edge2[3],_edge4=_edge2[4],lastPointX=(allEdges.delete(edge),x),lastPointY=y1,outline=[x,y2];for(outlines.push(outline);;){var e=void 0;if(allEdges.has(_edge3))e=_edge3;else{if(!allEdges.has(_edge4))break;e=_edge4}allEdges.delete(e);e=babelHelpers.slicedToArray(e,5),x=e[0],y1=e[1],y2=e[2],_edge3=e[3],_edge4=e[4];lastPointX!==x&&(outline.push(lastPointX,lastPointY,x,lastPointY===y1?y1:y2),lastPointX=x),lastPointY=lastPointY===y1?y2:y1}outline.push(lastPointX,lastPointY)}return new HighlightOutline(outlines,_classPrivateFieldGet(_box3,this),_classPrivateFieldGet(_lastPoint,this))}function _binarySearch(y){for(var array=_classPrivateFieldGet(_intervals,this),start=0,end=array.length-1;start<=end;){var middle=start+end>>1,y1=array[middle][0];if(y1===y)return middle;y1<y?start=1+middle:end=middle-1}return end+1}function _insert(_ref137){var _ref137=babelHelpers.slicedToArray(_ref137,3),y1=_ref137[1],_ref137=_ref137[2],index=_assertClassBrand(_HighlightOutliner_brand,this,_binarySearch).call(this,y1);_classPrivateFieldGet(_intervals,this).splice(index,0,[y1,_ref137])}function _remove(_ref139){for(var _ref139=babelHelpers.slicedToArray(_ref139,3),y1=_ref139[1],y2=_ref139[2],_ref139=_assertClassBrand(_HighlightOutliner_brand,this,_binarySearch).call(this,y1),i=_ref139;i<_classPrivateFieldGet(_intervals,this).length;i++){var _classPrivateFieldGet175=babelHelpers.slicedToArray(_classPrivateFieldGet(_intervals,this)[i],2),start=_classPrivateFieldGet175[0],_classPrivateFieldGet175=_classPrivateFieldGet175[1];if(start!==y1)break;if(start===y1&&_classPrivateFieldGet175===y2)return void _classPrivateFieldGet(_intervals,this).splice(i,1)}for(var _i32=_ref139-1;0<=_i32;_i32--){var _classPrivateFieldGet176=babelHelpers.slicedToArray(_classPrivateFieldGet(_intervals,this)[_i32],2),_start=_classPrivateFieldGet176[0],_classPrivateFieldGet176=_classPrivateFieldGet176[1];if(_start!==y1)break;if(_start===y1&&_classPrivateFieldGet176===y2)return void _classPrivateFieldGet(_intervals,this).splice(_i32,1)}}function _breakEdge(edge){for(var edge=babelHelpers.slicedToArray(edge,3),x=edge[0],y1=edge[1],edge=edge[2],results=[[x,y1,edge]],index=_assertClassBrand(_HighlightOutliner_brand,this,_binarySearch).call(this,edge),i=0;i<index;i++)for(var _classPrivateFieldGet177=babelHelpers.slicedToArray(_classPrivateFieldGet(_intervals,this)[i],2),start=_classPrivateFieldGet177[0],end=_classPrivateFieldGet177[1],j=0,jj=results.length;j<jj;j++){var _results$j=babelHelpers.slicedToArray(results[j],3),y3=_results$j[1],_results$j=_results$j[2];if(!(end<=y3||_results$j<=start))if(start<=y3)if(end<_results$j)results[j][1]=end;else{if(1===jj)return[];results.splice(j,1),j--,jj--}else results[j][2]=start,end<_results$j&&results.push([x,end,_results$j])}return results}var _box4=new WeakMap,_outlines=new WeakMap,HighlightOutline=function(){function HighlightOutline(outlines,box,lastPoint){var _this86;return babelHelpers.classCallCheck(this,HighlightOutline),_classPrivateFieldInitSpec(_this86=_callSuper(this,HighlightOutline),_box4,void 0),_classPrivateFieldInitSpec(_this86,_outlines,void 0),_classPrivateFieldSet(_outlines,_this86,outlines),_classPrivateFieldSet(_box4,_this86,box),_this86.lastPoint=lastPoint,_this86}return babelHelpers.inherits(HighlightOutline,Outline),babelHelpers.createClass(HighlightOutline,[{key:"toSVGPath",value:function(){var _step142,buffer=[],_iterator142=_createForOfIteratorHelper(_classPrivateFieldGet(_outlines,this));try{for(_iterator142.s();!(_step142=_iterator142.n()).done;){var polygon=_step142.value,_polygon=babelHelpers.slicedToArray(polygon,2),prevX=_polygon[0],prevY=_polygon[1];buffer.push("M".concat(prevX," ").concat(prevY));for(var i=2;i<polygon.length;i+=2){var x=polygon[i],y=polygon[i+1];x===prevX?(buffer.push("V".concat(y)),prevY=y):y===prevY&&(buffer.push("H".concat(x)),prevX=x)}buffer.push("Z")}}catch(err){_iterator142.e(err)}finally{_iterator142.f()}return buffer.join(" ")}},{key:"serialize",value:function(_ref100,_rotation){var _step143,_ref100=babelHelpers.slicedToArray(_ref100,4),blX=_ref100[0],blY=_ref100[1],trX=_ref100[2],trY=_ref100[3],outlines=[],width=trX-blX,height=trY-blY,_iterator143=_createForOfIteratorHelper(_classPrivateFieldGet(_outlines,this));try{for(_iterator143.s();!(_step143=_iterator143.n()).done;){for(var outline=_step143.value,points=new Array(outline.length),i=0;i<outline.length;i+=2)points[i]=blX+outline[i]*width,points[i+1]=trY-outline[i+1]*height;outlines.push(points)}}catch(err){_iterator143.e(err)}finally{_iterator143.f()}return outlines}},{key:"box",get:function(){return _classPrivateFieldGet(_box4,this)}},{key:"classNamesForOutlining",get:function(){return["highlightOutline"]}}])}(),FreeHighlightOutliner=function(_FreeDrawOutliner2){function FreeHighlightOutliner(){return babelHelpers.classCallCheck(this,FreeHighlightOutliner),_callSuper(this,FreeHighlightOutliner,arguments)}return babelHelpers.inherits(FreeHighlightOutliner,_FreeDrawOutliner2),babelHelpers.createClass(FreeHighlightOutliner,[{key:"newFreeDrawOutline",value:function(outline,points,box,scaleFactor,innerMargin,isLTR){return new FreeHighlightOutline(outline,points,box,scaleFactor,innerMargin,isLTR)}}])}(FreeDrawOutliner),FreeHighlightOutline=function(){function FreeHighlightOutline(){return babelHelpers.classCallCheck(this,FreeHighlightOutline),_callSuper(this,FreeHighlightOutline,arguments)}return babelHelpers.inherits(FreeHighlightOutline,FreeDrawOutline),babelHelpers.createClass(FreeHighlightOutline,[{key:"newOutliner",value:function(point,box,scaleFactor,thickness,isLTR){return new FreeHighlightOutliner(point,box,scaleFactor,thickness,isLTR,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0)}}])}(),_button=new WeakMap,_buttonSwatch=new WeakMap,_defaultColor=new WeakMap,_dropdown=new WeakMap,_dropdownWasFromKeyboard=new WeakMap,_isMainColorPicker=new WeakMap,_editor3=new WeakMap,_eventBus=new WeakMap,_openDropdownAC=new WeakMap,_uiManager3=new WeakMap,_type3=new WeakMap,_ColorPicker_brand=new WeakSet,ColorPicker=_exports.ColorPicker=function(){function ColorPicker(_ref102){var _ref102$editor=_ref102.editor,_ref102$editor=void 0===_ref102$editor?null:_ref102$editor,_ref102=_ref102.uiManager,_ref102=void 0===_ref102?null:_ref102;babelHelpers.classCallCheck(this,ColorPicker),_classPrivateMethodInitSpec(this,_ColorPicker_brand),_classPrivateFieldInitSpec(this,_button,null),_classPrivateFieldInitSpec(this,_buttonSwatch,null),_classPrivateFieldInitSpec(this,_defaultColor,void 0),_classPrivateFieldInitSpec(this,_dropdown,null),_classPrivateFieldInitSpec(this,_dropdownWasFromKeyboard,!1),_classPrivateFieldInitSpec(this,_isMainColorPicker,!1),_classPrivateFieldInitSpec(this,_editor3,null),_classPrivateFieldInitSpec(this,_eventBus,void 0),_classPrivateFieldInitSpec(this,_openDropdownAC,null),_classPrivateFieldInitSpec(this,_uiManager3,null),_classPrivateFieldInitSpec(this,_type3,void 0),_ref102$editor?(_classPrivateFieldSet(_isMainColorPicker,this,!1),_classPrivateFieldSet(_type3,this,AnnotationEditorParamsType.HIGHLIGHT_COLOR),_classPrivateFieldSet(_editor3,this,_ref102$editor)):(_classPrivateFieldSet(_isMainColorPicker,this,!0),_classPrivateFieldSet(_type3,this,AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR)),_classPrivateFieldSet(_uiManager3,this,(null==_ref102$editor?void 0:_ref102$editor._uiManager)||_ref102),_classPrivateFieldSet(_eventBus,this,_classPrivateFieldGet(_uiManager3,this)._eventBus),_classPrivateFieldSet(_defaultColor,this,(null==_ref102$editor||null==(_ref102=_ref102$editor.color)?void 0:_ref102.toUpperCase())||(null==(_ref102$editor=_classPrivateFieldGet(_uiManager3,this))?void 0:_ref102$editor.highlightColors.values().next().value)||"#FFFF98"),_l10nColor._||(_l10nColor._=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"}))}return babelHelpers.createClass(ColorPicker,[{key:"renderButton",value:function(){var button=_classPrivateFieldSet(_button,this,document.createElement("button")),signal=(button.className="colorPicker",button.tabIndex="0",button.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),button.ariaHasPopup="true",_classPrivateFieldGet(_editor3,this)&&(button.ariaControls="".concat(_classPrivateFieldGet(_editor3,this).id,"_colorpicker_dropdown")),_classPrivateFieldGet(_uiManager3,this)._signal),signal=(button.addEventListener("click",_assertClassBrand(_ColorPicker_brand,this,_openDropdown).bind(this),{signal:signal}),button.addEventListener("keydown",_assertClassBrand(_ColorPicker_brand,this,_keyDown2).bind(this),{signal:signal}),_classPrivateFieldSet(_buttonSwatch,this,document.createElement("span")));return signal.className="swatch",signal.ariaHidden="true",signal.style.backgroundColor=_classPrivateFieldGet(_defaultColor,this),button.append(signal),button}},{key:"renderMainDropdown",value:function(){var dropdown=_classPrivateFieldSet(_dropdown,this,_assertClassBrand(_ColorPicker_brand,this,_getDropdownRoot).call(this));return dropdown.ariaOrientation="horizontal",dropdown.ariaLabelledBy="highlightColorPickerLabel",dropdown}},{key:"_colorSelectFromKeyboard",value:function(event){var color;event.target===_classPrivateFieldGet(_button,this)?_assertClassBrand(_ColorPicker_brand,this,_openDropdown).call(this,event):(color=event.target.getAttribute("data-color"))&&_assertClassBrand(_ColorPicker_brand,this,_colorSelect).call(this,color,event)}},{key:"_moveToNext",value:function(event){var _classPrivateFieldGet97;_classPrivateGetter(_ColorPicker_brand,this,_get_isDropdownVisible)?event.target===_classPrivateFieldGet(_button,this)?null!=(_classPrivateFieldGet97=_classPrivateFieldGet(_dropdown,this).firstChild)&&_classPrivateFieldGet97.focus():null!=(_classPrivateFieldGet97=event.target.nextSibling)&&_classPrivateFieldGet97.focus():_assertClassBrand(_ColorPicker_brand,this,_openDropdown).call(this,event)}},{key:"_moveToPrevious",value:function(event){var _classPrivateFieldGet98;event.target===(null==(_classPrivateFieldGet98=_classPrivateFieldGet(_dropdown,this))?void 0:_classPrivateFieldGet98.firstChild)||event.target===_classPrivateFieldGet(_button,this)?_classPrivateGetter(_ColorPicker_brand,this,_get_isDropdownVisible)&&this._hideDropdownFromKeyboard():(_classPrivateGetter(_ColorPicker_brand,this,_get_isDropdownVisible)||_assertClassBrand(_ColorPicker_brand,this,_openDropdown).call(this,event),null!=(_classPrivateFieldGet98=event.target.previousSibling)&&_classPrivateFieldGet98.focus())}},{key:"_moveToBeginning",value:function(event){var _classPrivateFieldGet99;_classPrivateGetter(_ColorPicker_brand,this,_get_isDropdownVisible)?null!=(_classPrivateFieldGet99=_classPrivateFieldGet(_dropdown,this).firstChild)&&_classPrivateFieldGet99.focus():_assertClassBrand(_ColorPicker_brand,this,_openDropdown).call(this,event)}},{key:"_moveToEnd",value:function(event){var _classPrivateFieldGet100;_classPrivateGetter(_ColorPicker_brand,this,_get_isDropdownVisible)?null!=(_classPrivateFieldGet100=_classPrivateFieldGet(_dropdown,this).lastChild)&&_classPrivateFieldGet100.focus():_assertClassBrand(_ColorPicker_brand,this,_openDropdown).call(this,event)}},{key:"hideDropdown",value:function(){var _classPrivateFieldGet101;null!=(_classPrivateFieldGet101=_classPrivateFieldGet(_dropdown,this))&&_classPrivateFieldGet101.classList.add("hidden"),_classPrivateFieldGet(_button,this).ariaExpanded="false",null!=(_classPrivateFieldGet101=_classPrivateFieldGet(_openDropdownAC,this))&&_classPrivateFieldGet101.abort(),_classPrivateFieldSet(_openDropdownAC,this,null)}},{key:"_hideDropdownFromKeyboard",value:function(){var _classPrivateFieldGet103;_classPrivateFieldGet(_isMainColorPicker,this)||(_classPrivateGetter(_ColorPicker_brand,this,_get_isDropdownVisible)?(this.hideDropdown(),_classPrivateFieldGet(_button,this).focus({preventScroll:!0,focusVisible:_classPrivateFieldGet(_dropdownWasFromKeyboard,this)})):null!=(_classPrivateFieldGet103=_classPrivateFieldGet(_editor3,this))&&_classPrivateFieldGet103.unselect())}},{key:"updateColor",value:function(color){if(_classPrivateFieldGet(_buttonSwatch,this)&&(_classPrivateFieldGet(_buttonSwatch,this).style.backgroundColor=color),_classPrivateFieldGet(_dropdown,this)){var _step144,i=_classPrivateFieldGet(_uiManager3,this).highlightColors.values(),_iterator144=_createForOfIteratorHelper(_classPrivateFieldGet(_dropdown,this).children);try{for(_iterator144.s();!(_step144=_iterator144.n()).done;)_step144.value.ariaSelected=i.next().value===color.toUpperCase()}catch(err){_iterator144.e(err)}finally{_iterator144.f()}}}},{key:"destroy",value:function(){var _classPrivateFieldGet104;null!=(_classPrivateFieldGet104=_classPrivateFieldGet(_button,this))&&_classPrivateFieldGet104.remove(),_classPrivateFieldSet(_button,this,null),_classPrivateFieldSet(_buttonSwatch,this,null),null!=(_classPrivateFieldGet104=_classPrivateFieldGet(_dropdown,this))&&_classPrivateFieldGet104.remove(),_classPrivateFieldSet(_dropdown,this,null)}}],[{key:"_keyboardManager",get:function(){return shadow(this,"_keyboardManager",new KeyboardManager([[["Escape","mac+Escape"],ColorPicker.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ColorPicker.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ColorPicker.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ColorPicker.prototype._moveToPrevious],[["Home","mac+Home"],ColorPicker.prototype._moveToBeginning],[["End","mac+End"],ColorPicker.prototype._moveToEnd]]))}}])}();function _getDropdownRoot(){var _step192,div=document.createElement("div"),signal=_classPrivateFieldGet(_uiManager3,this)._signal,_iterator192=(div.addEventListener("contextmenu",noContextMenu,{signal:signal}),div.className="dropdown",div.role="listbox",div.ariaMultiSelectable="false",div.ariaOrientation="vertical",div.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),_classPrivateFieldGet(_editor3,this)&&(div.id="".concat(_classPrivateFieldGet(_editor3,this).id,"_colorpicker_dropdown")),_createForOfIteratorHelper(_classPrivateFieldGet(_uiManager3,this).highlightColors));try{for(_iterator192.s();!(_step192=_iterator192.n()).done;){var _step192$value=babelHelpers.slicedToArray(_step192.value,2),name=_step192$value[0],color=_step192$value[1],button=document.createElement("button"),swatch=(button.tabIndex="0",button.role="option",button.setAttribute("data-color",color),button.title=name,button.setAttribute("data-l10n-id",_l10nColor._[name]),document.createElement("span"));button.append(swatch),swatch.className="swatch",swatch.style.backgroundColor=color,button.ariaSelected=color===_classPrivateFieldGet(_defaultColor,this),button.addEventListener("click",_assertClassBrand(_ColorPicker_brand,this,_colorSelect).bind(this,color),{signal:signal}),div.append(button)}}catch(err){_iterator192.e(err)}finally{_iterator192.f()}return div.addEventListener("keydown",_assertClassBrand(_ColorPicker_brand,this,_keyDown2).bind(this),{signal:signal}),div}function _colorSelect(color,event){event.stopPropagation(),_classPrivateFieldGet(_eventBus,this).dispatch("switchannotationeditorparams",{source:this,type:_classPrivateFieldGet(_type3,this),value:color})}function _keyDown2(event){_ColorPicker._keyboardManager.exec(this,event)}function _openDropdown(event){_classPrivateGetter(_ColorPicker_brand,this,_get_isDropdownVisible)?this.hideDropdown():(_classPrivateFieldSet(_dropdownWasFromKeyboard,this,0===event.detail),_classPrivateFieldGet(_openDropdownAC,this)||(_classPrivateFieldSet(_openDropdownAC,this,new AbortController),window.addEventListener("pointerdown",_assertClassBrand(_ColorPicker_brand,this,_pointerDown3).bind(this),{signal:_classPrivateFieldGet(_uiManager3,this).combinedSignal(_classPrivateFieldGet(_openDropdownAC,this))})),_classPrivateFieldGet(_button,this).ariaExpanded="true",_classPrivateFieldGet(_dropdown,this)?_classPrivateFieldGet(_dropdown,this).classList.remove("hidden"):(event=_classPrivateFieldSet(_dropdown,this,_assertClassBrand(_ColorPicker_brand,this,_getDropdownRoot).call(this)),_classPrivateFieldGet(_button,this).append(event)))}function _pointerDown3(event){var _classPrivateFieldGet178;null!=(_classPrivateFieldGet178=_classPrivateFieldGet(_dropdown,this))&&_classPrivateFieldGet178.contains(event.target)||this.hideDropdown()}function _get_isDropdownVisible(_this87){return _classPrivateFieldGet(_dropdown,_this87)&&!_classPrivateFieldGet(_dropdown,_this87).classList.contains("hidden")}var _ColorPicker=ColorPicker,_l10nColor={_:null},_anchorNode=new WeakMap,_anchorOffset=new WeakMap,_boxes=new WeakMap,_clipPathId=new WeakMap,_colorPicker2=new WeakMap,_focusOutlines=new WeakMap,_focusNode=new WeakMap,_focusOffset=new WeakMap,_highlightDiv=new WeakMap,_highlightOutlines=new WeakMap,_id9=new WeakMap,_isFreeHighlight=new WeakMap,_lastPoint2=new WeakMap,_opacity=new WeakMap,_outlineId=new WeakMap,_text=new WeakMap,_thickness2=new WeakMap,_methodOfCreation=new WeakMap,_HighlightEditor_brand=new WeakSet,HighlightEditor=function(_AnnotationEditor4){function HighlightEditor(params){var _this88;return babelHelpers.classCallCheck(this,HighlightEditor),_classPrivateMethodInitSpec(_this88=_callSuper(this,HighlightEditor,[_objectSpread({},params,{name:"highlightEditor"})]),_HighlightEditor_brand),_classPrivateFieldInitSpec(_this88,_anchorNode,null),_classPrivateFieldInitSpec(_this88,_anchorOffset,0),_classPrivateFieldInitSpec(_this88,_boxes,void 0),_classPrivateFieldInitSpec(_this88,_clipPathId,null),_classPrivateFieldInitSpec(_this88,_colorPicker2,null),_classPrivateFieldInitSpec(_this88,_focusOutlines,null),_classPrivateFieldInitSpec(_this88,_focusNode,null),_classPrivateFieldInitSpec(_this88,_focusOffset,0),_classPrivateFieldInitSpec(_this88,_highlightDiv,null),_classPrivateFieldInitSpec(_this88,_highlightOutlines,null),_classPrivateFieldInitSpec(_this88,_id9,null),_classPrivateFieldInitSpec(_this88,_isFreeHighlight,!1),_classPrivateFieldInitSpec(_this88,_lastPoint2,null),_classPrivateFieldInitSpec(_this88,_opacity,void 0),_classPrivateFieldInitSpec(_this88,_outlineId,null),_classPrivateFieldInitSpec(_this88,_text,""),_classPrivateFieldInitSpec(_this88,_thickness2,void 0),_classPrivateFieldInitSpec(_this88,_methodOfCreation,""),_this88.color=params.color||HighlightEditor._defaultColor,_classPrivateFieldSet(_thickness2,_this88,params.thickness||HighlightEditor._defaultThickness),_classPrivateFieldSet(_opacity,_this88,params.opacity||HighlightEditor._defaultOpacity),_classPrivateFieldSet(_boxes,_this88,params.boxes||null),_classPrivateFieldSet(_methodOfCreation,_this88,params.methodOfCreation||""),_classPrivateFieldSet(_text,_this88,params.text||""),_this88._isDraggable=!1,_this88.defaultL10nId="pdfjs-editor-highlight-editor",-1<params.highlightId?(_classPrivateFieldSet(_isFreeHighlight,_this88,!0),_assertClassBrand(_HighlightEditor_brand,_this88,_createFreeOutlines).call(_this88,params),_assertClassBrand(_HighlightEditor_brand,_this88,_addToDrawLayer).call(_this88)):_classPrivateFieldGet(_boxes,_this88)&&(_classPrivateFieldSet(_anchorNode,_this88,params.anchorNode),_classPrivateFieldSet(_anchorOffset,_this88,params.anchorOffset),_classPrivateFieldSet(_focusNode,_this88,params.focusNode),_classPrivateFieldSet(_focusOffset,_this88,params.focusOffset),_assertClassBrand(_HighlightEditor_brand,_this88,_createOutlines).call(_this88),_assertClassBrand(_HighlightEditor_brand,_this88,_addToDrawLayer).call(_this88),_this88.rotate(_this88.rotation)),_this88.annotationElementId||_this88._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert"),_this88}return babelHelpers.inherits(HighlightEditor,_AnnotationEditor4),babelHelpers.createClass(HighlightEditor,[{key:"telemetryInitialData",get:function(){return{action:"added",type:_classPrivateFieldGet(_isFreeHighlight,this)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:_classPrivateFieldGet(_thickness2,this),methodOfCreation:_classPrivateFieldGet(_methodOfCreation,this)}}},{key:"telemetryFinalData",get:function(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}},{key:"translateInPage",value:function(x,y){}},{key:"toolbarPosition",get:function(){return _classPrivateFieldGet(_lastPoint2,this)}},{key:"updateParams",value:function(type,value){switch(type){case AnnotationEditorParamsType.HIGHLIGHT_COLOR:_assertClassBrand(_HighlightEditor_brand,this,_updateColor2).call(this,value);break;case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:_assertClassBrand(_HighlightEditor_brand,this,_updateThickness).call(this,value)}}},{key:"propertiesToUpdate",get:function(){return[[AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.color||HighlightEditor._defaultColor],[AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,_classPrivateFieldGet(_thickness2,this)||HighlightEditor._defaultThickness],[AnnotationEditorParamsType.HIGHLIGHT_FREE,_classPrivateFieldGet(_isFreeHighlight,this)]]}},{key:"toolbarButtons",get:function(){return this._uiManager.highlightColors?[["colorPicker",_classPrivateFieldSet(_colorPicker2,this,new ColorPicker({editor:this}))]]:_superPropGet(HighlightEditor,"toolbarButtons",this,1)}},{key:"disableEditing",value:function(){_superPropGet(HighlightEditor,"disableEditing",this,3)([]),this.div.classList.toggle("disabled",!0)}},{key:"enableEditing",value:function(){_superPropGet(HighlightEditor,"enableEditing",this,3)([]),this.div.classList.toggle("disabled",!1)}},{key:"fixAndSetPosition",value:function(){return _superPropGet(HighlightEditor,"fixAndSetPosition",this,3)([_assertClassBrand(_HighlightEditor_brand,this,_getRotation).call(this)])}},{key:"getBaseTranslation",value:function(){return[0,0]}},{key:"getRect",value:function(tx,ty){return _superPropGet(HighlightEditor,"getRect",this,3)([tx,ty,_assertClassBrand(_HighlightEditor_brand,this,_getRotation).call(this)])}},{key:"onceAdded",value:function(focus){this.annotationElementId||this.parent.addUndoableEditor(this),focus&&this.div.focus()}},{key:"remove",value:function(){_assertClassBrand(_HighlightEditor_brand,this,_cleanDrawLayer).call(this),this._reportTelemetry({action:"deleted"}),_superPropGet(HighlightEditor,"remove",this,3)([])}},{key:"rebuild",value:function(){this.parent&&(_superPropGet(HighlightEditor,"rebuild",this,3)([]),null===this.div||(_assertClassBrand(_HighlightEditor_brand,this,_addToDrawLayer).call(this),this.isAttachedToDOM)||this.parent.add(this))}},{key:"setParent",value:function(parent){var _this$div5,mustBeSelected=!1;this.parent&&!parent?_assertClassBrand(_HighlightEditor_brand,this,_cleanDrawLayer).call(this):parent&&(_assertClassBrand(_HighlightEditor_brand,this,_addToDrawLayer).call(this,parent),mustBeSelected=!this.parent&&(null==(_this$div5=this.div)?void 0:_this$div5.classList.contains("selectedEditor"))),_superPropGet(HighlightEditor,"setParent",this,3)([parent]),this.show(this._isVisible),mustBeSelected&&this.select()}},{key:"rotate",value:function(angle){var drawLayer=this.parent.drawLayer,box=_classPrivateFieldGet(_isFreeHighlight,this)?(angle=(angle-this.rotation+360)%360,_rotateBbox.call(HighlightEditor,_classPrivateFieldGet(_highlightOutlines,this).box,angle)):_rotateBbox.call(HighlightEditor,[this.x,this.y,this.width,this.height],angle);drawLayer.updateProperties(_classPrivateFieldGet(_id9,this),{bbox:box,root:{"data-main-rotation":angle}}),drawLayer.updateProperties(_classPrivateFieldGet(_outlineId,this),{bbox:_rotateBbox.call(HighlightEditor,_classPrivateFieldGet(_focusOutlines,this).box,angle),root:{"data-main-rotation":angle}})}},{key:"render",value:function(){var div,parentWidth,highlightDiv;return this.div||(div=_superPropGet(HighlightEditor,"render",this,3)([]),_classPrivateFieldGet(_text,this)&&(div.setAttribute("aria-label",_classPrivateFieldGet(_text,this)),div.setAttribute("role","mark")),_classPrivateFieldGet(_isFreeHighlight,this)?div.classList.add("free"):this.div.addEventListener("keydown",_assertClassBrand(_HighlightEditor_brand,this,_keydown).bind(this),{signal:this._uiManager._signal}),highlightDiv=_classPrivateFieldSet(_highlightDiv,this,document.createElement("div")),div.append(highlightDiv),highlightDiv.setAttribute("aria-hidden","true"),highlightDiv.className="internal",highlightDiv.style.clipPath=_classPrivateFieldGet(_clipPathId,this),parentWidth=(highlightDiv=babelHelpers.slicedToArray(this.parentDimensions,2))[0],highlightDiv=highlightDiv[1],this.setDims(this.width*parentWidth,this.height*highlightDiv),bindEvents(this,_classPrivateFieldGet(_highlightDiv,this),["pointerover","pointerleave"]),this.enableEditing(),div)}},{key:"pointerover",value:function(){var _this$parent3;this.isSelected||null!=(_this$parent3=this.parent)&&_this$parent3.drawLayer.updateProperties(_classPrivateFieldGet(_outlineId,this),{rootClass:{hovered:!0}})}},{key:"pointerleave",value:function(){var _this$parent4;this.isSelected||null!=(_this$parent4=this.parent)&&_this$parent4.drawLayer.updateProperties(_classPrivateFieldGet(_outlineId,this),{rootClass:{hovered:!1}})}},{key:"_moveCaret",value:function(direction){switch(this.parent.unselect(this),direction){case 0:case 2:_assertClassBrand(_HighlightEditor_brand,this,_setCaret).call(this,!0);break;case 1:case 3:_assertClassBrand(_HighlightEditor_brand,this,_setCaret).call(this,!1)}}},{key:"select",value:function(){var _this$parent5;_superPropGet(HighlightEditor,"select",this,3)([]),_classPrivateFieldGet(_outlineId,this)&&null!=(_this$parent5=this.parent)&&_this$parent5.drawLayer.updateProperties(_classPrivateFieldGet(_outlineId,this),{rootClass:{hovered:!1,selected:!0}})}},{key:"unselect",value:function(){var _this$parent6;_superPropGet(HighlightEditor,"unselect",this,3)([]),_classPrivateFieldGet(_outlineId,this)&&(null!=(_this$parent6=this.parent)&&_this$parent6.drawLayer.updateProperties(_classPrivateFieldGet(_outlineId,this),{rootClass:{selected:!1}}),_classPrivateFieldGet(_isFreeHighlight,this)||_assertClassBrand(_HighlightEditor_brand,this,_setCaret).call(this,!1))}},{key:"_mustFixPosition",get:function(){return!_classPrivateFieldGet(_isFreeHighlight,this)}},{key:"show",value:function(){var visible=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._isVisible;_superPropGet(HighlightEditor,"show",this,3)([visible]),this.parent&&(this.parent.drawLayer.updateProperties(_classPrivateFieldGet(_id9,this),{rootClass:{hidden:!visible}}),this.parent.drawLayer.updateProperties(_classPrivateFieldGet(_outlineId,this),{rootClass:{hidden:!visible}}))}},{key:"serialize",value:function(){var color,isForCopying=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this.isEmpty()||isForCopying?null:this.deleted?this.serializeDeleted():(isForCopying=this.getRect(0,0),color=AnnotationEditor._colorManager.convert(this.color),color={annotationType:AnnotationEditorType.HIGHLIGHT,color:color,opacity:_classPrivateFieldGet(_opacity,this),thickness:_classPrivateFieldGet(_thickness2,this),quadPoints:_assertClassBrand(_HighlightEditor_brand,this,_serializeBoxes).call(this),outlines:_assertClassBrand(_HighlightEditor_brand,this,_serializeOutlines).call(this,isForCopying),pageIndex:this.pageIndex,rect:isForCopying,rotation:_assertClassBrand(_HighlightEditor_brand,this,_getRotation).call(this),structTreeParentId:this._structTreeParentId},this.annotationElementId&&!_assertClassBrand(_HighlightEditor_brand,this,_hasElementChanged2).call(this,color)?null:(color.id=this.annotationElementId,color))}},{key:"renderAnnotationElement",value:function(annotation){return annotation.updateEdited({rect:this.getRect(0,0)}),null}}],[{key:"_keyboardManager",get:function(){var proto=HighlightEditor.prototype;return shadow(this,"_keyboardManager",new KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],proto._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],proto._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],proto._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],proto._moveCaret,{args:[3]}]]))}},{key:"computeTelemetryFinalData",value:function(data){return{numberOfColors:data.get("color").size}}},{key:"initialize",value:function(l10n,uiManager){AnnotationEditor.initialize(l10n,uiManager),HighlightEditor._defaultColor||(HighlightEditor._defaultColor=(null==(l10n=uiManager.highlightColors)?void 0:l10n.values().next().value)||"#fff066")}},{key:"updateDefaultParams",value:function(type,value){switch(type){case AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:HighlightEditor._defaultColor=value;break;case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:HighlightEditor._defaultThickness=value}}},{key:"defaultPropertiesToUpdate",get:function(){return[[AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR,HighlightEditor._defaultColor],[AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,HighlightEditor._defaultThickness]]}},{key:"startHighlighting",value:function(parent,isLTR,_ref103){function pointerUpCallback(e){ac.abort(),_assertClassBrand(HighlightEditor,_this89,_endHighlight).call(_this89,parent,e)}var _this89=this,textLayer=_ref103.target,x=_ref103.x,_ref103=_ref103.y,_textLayer$getBoundin2=textLayer.getBoundingClientRect(),layerX=_textLayer$getBoundin2.x,layerY=_textLayer$getBoundin2.y,parentWidth=_textLayer$getBoundin2.width,_textLayer$getBoundin2=_textLayer$getBoundin2.height,ac=new AbortController,signal=parent.combinedSignal(ac),textLayer=(window.addEventListener("blur",pointerUpCallback,{signal:signal}),window.addEventListener("pointerup",pointerUpCallback,{signal:signal}),window.addEventListener("pointerdown",stopEvent,{capture:!0,passive:!1,signal:signal}),window.addEventListener("contextmenu",noContextMenu,{signal:signal}),textLayer.addEventListener("pointermove",_assertClassBrand(HighlightEditor,this,_highlightMove).bind(this,parent),{signal:signal}),this._freeHighlight=new FreeHighlightOutliner({x:x,y:_ref103},[layerX,layerY,parentWidth,_textLayer$getBoundin2],parent.scale,this._defaultThickness/2,isLTR,.001),parent.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0));this._freeHighlightId=textLayer.id,this._freeHighlightClipId=textLayer.clipPathId}},{key:"deserialize",value:async function(data,parent,uiManager){var initialData=null,id=(data instanceof HighlightAnnotationElement?(_quadPoints=(_data6$data=(_data6=data).data).quadPoints,rect=_data6$data.rect,rotation=_data6$data.rotation,id=_data6$data.id,_color3=_data6$data.color,_opacity2=_data6$data.opacity,_data6$data=_data6$data.popupRef,_data6=_data6.parent.page.pageNumber,initialData=data={annotationType:AnnotationEditorType.HIGHLIGHT,color:Array.from(_color3),opacity:_opacity2,quadPoints:_quadPoints,boxes:null,pageIndex:_data6-1,rect:rect.slice(0),rotation:rotation,annotationElementId:id,id:id,deleted:!1,popupRef:_data6$data}):data instanceof InkAnnotationElement&&(_quadPoints=(_opacity2=(_color3=data).data).inkLists,_data6=_opacity2.rect,rect=_opacity2.rotation,rotation=_opacity2.id,id=_opacity2.color,_data6$data=_opacity2.borderStyle.rawWidth,_opacity2=_opacity2.popupRef,_color3=_color3.parent.page.pageNumber,initialData=data={annotationType:AnnotationEditorType.HIGHLIGHT,color:Array.from(id),thickness:_data6$data,inkLists:_quadPoints,boxes:null,pageIndex:_color3-1,rect:_data6.slice(0),rotation:rect,annotationElementId:rotation,id:rotation,deleted:!1,popupRef:_opacity2}),data),_data6$data=id.color,quadPoints=id.quadPoints,_quadPoints=id.inkLists,_color3=id.opacity,_data6=await _superPropGet(HighlightEditor,"deserialize",this,2)([data,parent,uiManager]),rect=(_data6.color=Util.makeHexColor.apply(Util,babelHelpers.toConsumableArray(_data6$data)),_classPrivateFieldSet(_opacity,_data6,_color3||1),_quadPoints&&_classPrivateFieldSet(_thickness2,_data6,data.thickness),_data6._initialData=initialData,babelHelpers.slicedToArray(_data6.pageDimensions,2)),pageWidth=rect[0],pageHeight=rect[1],rotation=babelHelpers.slicedToArray(_data6.pageTranslation,2),pageX=rotation[0],pageY=rotation[1];if(quadPoints){for(var boxes=_classPrivateFieldSet(_boxes,_data6,[]),i=0;i<quadPoints.length;i+=8)boxes.push({x:(quadPoints[i]-pageX)/pageWidth,y:1-(quadPoints[i+1]-pageY)/pageHeight,width:(quadPoints[i+2]-quadPoints[i])/pageWidth,height:(quadPoints[i+1]-quadPoints[i+5])/pageHeight});_assertClassBrand(_HighlightEditor_brand,_data6,_createOutlines).call(_data6),_assertClassBrand(_HighlightEditor_brand,_data6,_addToDrawLayer).call(_data6),_data6.rotate(_data6.rotation)}else if(_quadPoints){_classPrivateFieldSet(_isFreeHighlight,_data6,!0);for(var points=_quadPoints[0],point={x:points[0]-pageX,y:pageHeight-(points[1]-pageY)},outliner=new FreeHighlightOutliner(point,[0,0,pageWidth,pageHeight],1,_classPrivateFieldGet(_thickness2,_data6)/2,!0,.001),_i23=0,ii=points.length;_i23<ii;_i23+=2)point.x=points[_i23]-pageX,point.y=pageHeight-(points[_i23+1]-pageY),outliner.add(point);var _opacity2=parent.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:_data6.color,"fill-opacity":_data6._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:outliner.toSVGPath()}},!0,!0),id=_opacity2.id,uiManager=_opacity2.clipPathId;_assertClassBrand(_HighlightEditor_brand,_data6,_createFreeOutlines).call(_data6,{highlightOutlines:outliner.getOutlines(),highlightId:id,clipPathId:uiManager}),_assertClassBrand(_HighlightEditor_brand,_data6,_addToDrawLayer).call(_data6),_data6.rotate(_data6.parentRotation)}return _data6}},{key:"canCreateNewEmptyEditor",value:function(){return!1}}])}(AnnotationEditor);function _createOutlines(){var outliner=new HighlightOutliner(_classPrivateFieldGet(_boxes,this),.001),outliner=(_classPrivateFieldSet(_highlightOutlines,this,outliner.getOutlines()),babelHelpers.slicedToArray(_classPrivateFieldGet(_highlightOutlines,this).box,4)),outliner=(this.x=outliner[0],this.y=outliner[1],this.width=outliner[2],this.height=outliner[3],new HighlightOutliner(_classPrivateFieldGet(_boxes,this),.0025,.001,"ltr"===this._uiManager.direction));_classPrivateFieldSet(_focusOutlines,this,outliner.getOutlines());outliner=_classPrivateFieldGet(_focusOutlines,this).lastPoint;_classPrivateFieldSet(_lastPoint2,this,[(outliner[0]-this.x)/this.width,(outliner[1]-this.y)/this.height])}function _createFreeOutlines(_ref141){var highlightOutlines=_ref141.highlightOutlines,highlightId=_ref141.highlightId,_ref141=_ref141.clipPathId,highlightId=(_classPrivateFieldSet(_highlightOutlines,this,highlightOutlines),_classPrivateFieldSet(_focusOutlines,this,highlightOutlines.getNewOutline(_classPrivateFieldGet(_thickness2,this)/2+1.5,.0025)),0<=highlightId?(_classPrivateFieldSet(_id9,this,highlightId),_classPrivateFieldSet(_clipPathId,this,_ref141),this.parent.drawLayer.finalizeDraw(highlightId,{bbox:highlightOutlines.box,path:{d:highlightOutlines.toSVGPath()}}),_classPrivateFieldSet(_outlineId,this,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:_classPrivateFieldGet(_focusOutlines,this).box,path:{d:_classPrivateFieldGet(_focusOutlines,this).toSVGPath()}},!0))):this.parent&&(_ref141=this.parent.viewport.rotation,this.parent.drawLayer.updateProperties(_classPrivateFieldGet(_id9,this),{bbox:_rotateBbox.call(_HighlightEditor,_classPrivateFieldGet(_highlightOutlines,this).box,(_ref141-this.rotation+360)%360),path:{d:highlightOutlines.toSVGPath()}}),this.parent.drawLayer.updateProperties(_classPrivateFieldGet(_outlineId,this),{bbox:_rotateBbox.call(_HighlightEditor,_classPrivateFieldGet(_focusOutlines,this).box,_ref141),path:{d:_classPrivateFieldGet(_focusOutlines,this).toSVGPath()}})),babelHelpers.slicedToArray(highlightOutlines.box,4)),x=highlightId[0],y=highlightId[1],width=highlightId[2],height=highlightId[3];switch(this.rotation){case 0:this.x=x,this.y=y,this.width=width,this.height=height;break;case 90:var _this$parentDimension15=babelHelpers.slicedToArray(this.parentDimensions,2),pageWidth=_this$parentDimension15[0],_this$parentDimension15=_this$parentDimension15[1];this.x=y,this.y=1-x,this.width=width*_this$parentDimension15/pageWidth,this.height=height*pageWidth/_this$parentDimension15;break;case 180:this.x=1-x,this.y=1-y,this.width=width,this.height=height;break;case 270:pageWidth=babelHelpers.slicedToArray(this.parentDimensions,2),_this$parentDimension15=pageWidth[0],pageWidth=pageWidth[1];this.x=1-y,this.y=x,this.width=width*pageWidth/_this$parentDimension15,this.height=height*_this$parentDimension15/pageWidth}_ref141=_classPrivateFieldGet(_focusOutlines,this).lastPoint;_classPrivateFieldSet(_lastPoint2,this,[(_ref141[0]-x)/width,(_ref141[1]-y)/height])}function _updateColor2(color){function setColorAndOpacity(col,opa){var _this119$parent;_this119.color=col,_classPrivateFieldSet(_opacity,_this119,opa),null!=(_this119$parent=_this119.parent)&&_this119$parent.drawLayer.updateProperties(_classPrivateFieldGet(_id9,_this119),{root:{fill:col,"fill-opacity":opa}}),null!=(_this119$parent=_classPrivateFieldGet(_colorPicker2,_this119))&&_this119$parent.updateColor(col)}var _this119=this,savedColor=this.color,savedOpacity=_classPrivateFieldGet(_opacity,this);this.addCommands({cmd:setColorAndOpacity.bind(this,color,_HighlightEditor._defaultOpacity),undo:setColorAndOpacity.bind(this,savedColor,savedOpacity),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AnnotationEditorParamsType.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(color)},!0)}function _updateThickness(thickness){function setThickness(th){_classPrivateFieldSet(_thickness2,_this120,th),_assertClassBrand(_HighlightEditor_brand,_this120,_changeThickness).call(_this120,th)}var _this120=this,savedThickness=_classPrivateFieldGet(_thickness2,this);this.addCommands({cmd:setThickness.bind(this,thickness),undo:setThickness.bind(this,savedThickness),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:thickness},!0)}function _changeThickness(thickness){var parentWidth;_classPrivateFieldGet(_isFreeHighlight,this)&&(_assertClassBrand(_HighlightEditor_brand,this,_createFreeOutlines).call(this,{highlightOutlines:_classPrivateFieldGet(_highlightOutlines,this).getNewOutline(thickness/2)}),this.fixAndSetPosition(),parentWidth=(thickness=babelHelpers.slicedToArray(this.parentDimensions,2))[0],thickness=thickness[1],this.setDims(this.width*parentWidth,this.height*thickness))}function _cleanDrawLayer(){null!==_classPrivateFieldGet(_id9,this)&&this.parent&&(this.parent.drawLayer.remove(_classPrivateFieldGet(_id9,this)),_classPrivateFieldSet(_id9,this,null),this.parent.drawLayer.remove(_classPrivateFieldGet(_outlineId,this)),_classPrivateFieldSet(_outlineId,this,null))}function _addToDrawLayer(){var _parent$drawLayer$dra4,parent=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.parent;null===_classPrivateFieldGet(_id9,this)&&(_parent$drawLayer$dra4=parent.drawLayer.draw({bbox:_classPrivateFieldGet(_highlightOutlines,this).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":_classPrivateFieldGet(_opacity,this)},rootClass:{highlight:!0,free:_classPrivateFieldGet(_isFreeHighlight,this)},path:{d:_classPrivateFieldGet(_highlightOutlines,this).toSVGPath()}},!1,!0),_toSetter(_classPrivateFieldSet,[_id9,this])._=_parent$drawLayer$dra4.id,_toSetter(_classPrivateFieldSet,[_clipPathId,this])._=_parent$drawLayer$dra4.clipPathId,_classPrivateFieldSet(_outlineId,this,parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:_classPrivateFieldGet(_isFreeHighlight,this)},bbox:_classPrivateFieldGet(_focusOutlines,this).box,path:{d:_classPrivateFieldGet(_focusOutlines,this).toSVGPath()}},_classPrivateFieldGet(_isFreeHighlight,this))),_classPrivateFieldGet(_highlightDiv,this))&&(_classPrivateFieldGet(_highlightDiv,this).style.clipPath=_classPrivateFieldGet(_clipPathId,this))}function _rotateBbox(_ref142,angle){var _ref142=babelHelpers.slicedToArray(_ref142,4),x=_ref142[0],y=_ref142[1],width=_ref142[2],height=_ref142[3];switch(angle){case 90:return[1-y-height,x,height,width];case 180:return[1-x-width,1-y-height,width,height];case 270:return[y,1-x-width,height,width]}return[x,y,width,height]}function _keydown(event){_HighlightEditor._keyboardManager.exec(this,event)}function _setCaret(start){var selection;_classPrivateFieldGet(_anchorNode,this)&&(selection=window.getSelection(),start?selection.setPosition(_classPrivateFieldGet(_anchorNode,this),_classPrivateFieldGet(_anchorOffset,this)):selection.setPosition(_classPrivateFieldGet(_focusNode,this),_classPrivateFieldGet(_focusOffset,this)))}function _getRotation(){return _classPrivateFieldGet(_isFreeHighlight,this)?this.rotation:0}function _serializeBoxes(){if(_classPrivateFieldGet(_isFreeHighlight,this))return null;var _step193,_this$pageDimensions0=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions0[0],pageHeight=_this$pageDimensions0[1],_this$pageDimensions0=babelHelpers.slicedToArray(this.pageTranslation,2),pageX=_this$pageDimensions0[0],pageY=_this$pageDimensions0[1],_this$pageDimensions0=_classPrivateFieldGet(_boxes,this),quadPoints=new Float32Array(8*_this$pageDimensions0.length),i=0,_iterator193=_createForOfIteratorHelper(_this$pageDimensions0);try{for(_iterator193.s();!(_step193=_iterator193.n()).done;){var _step193$value=_step193.value,x=_step193$value.x,y=_step193$value.y,width=_step193$value.width,height=_step193$value.height,sx=x*pageWidth+pageX,sy=(1-y)*pageHeight+pageY;quadPoints[i]=quadPoints[i+4]=sx,quadPoints[i+1]=quadPoints[i+3]=sy,quadPoints[i+2]=quadPoints[i+6]=sx+width*pageWidth,quadPoints[i+5]=quadPoints[i+7]=sy-height*pageHeight,i+=8}}catch(err){_iterator193.e(err)}finally{_iterator193.f()}return quadPoints}function _serializeOutlines(rect){return _classPrivateFieldGet(_highlightOutlines,this).serialize(rect,_assertClassBrand(_HighlightEditor_brand,this,_getRotation).call(this))}function _highlightMove(parent,event){this._freeHighlight.add(event)&&parent.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function _endHighlight(parent,event){this._freeHighlight.isEmpty()?parent.drawLayer.remove(this._freeHighlightId):parent.createAndAddNewEditor(event,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}function _hasElementChanged2(serialized){var color=this._initialData.color;return serialized.color.some(function(c,i){return c!==color[i]})}_HighlightEditor=HighlightEditor,babelHelpers.defineProperty(HighlightEditor,"_defaultColor",null),babelHelpers.defineProperty(HighlightEditor,"_defaultOpacity",1),babelHelpers.defineProperty(HighlightEditor,"_defaultThickness",12),babelHelpers.defineProperty(HighlightEditor,"_type","highlight"),babelHelpers.defineProperty(HighlightEditor,"_editorType",AnnotationEditorType.HIGHLIGHT),babelHelpers.defineProperty(HighlightEditor,"_freeHighlightId",-1),babelHelpers.defineProperty(HighlightEditor,"_freeHighlight",null),babelHelpers.defineProperty(HighlightEditor,"_freeHighlightClipId","");var _svgProperties=new WeakMap,DrawingOptions=function(){return babelHelpers.createClass(function DrawingOptions(){babelHelpers.classCallCheck(this,DrawingOptions),_classPrivateFieldInitSpec(this,_svgProperties,Object.create(null))},[{key:"updateProperty",value:function(name,value){this[name]=value,this.updateSVGProperty(name,value)}},{key:"updateProperties",value:function(properties){if(properties)for(var _i24=0,_Object$entries5=Object.entries(properties);_i24<_Object$entries5.length;_i24++){var _Object$entries5$_i=babelHelpers.slicedToArray(_Object$entries5[_i24],2),name=_Object$entries5$_i[0],_Object$entries5$_i=_Object$entries5$_i[1];name.startsWith("_")||this.updateProperty(name,_Object$entries5$_i)}}},{key:"updateSVGProperty",value:function(name,value){_classPrivateFieldGet(_svgProperties,this)[name]=value}},{key:"toSVGProperties",value:function(){var root=_classPrivateFieldGet(_svgProperties,this);return _classPrivateFieldSet(_svgProperties,this,Object.create(null)),{root:root}}},{key:"reset",value:function(){_classPrivateFieldSet(_svgProperties,this,Object.create(null))}},{key:"updateAll",value:function(){this.updateProperties(0<arguments.length&&void 0!==arguments[0]?arguments[0]:this)}},{key:"clone",value:function(){unreachable("Not implemented")}}])}(),_drawOutlines=new WeakMap,_mustBeCommitted=new WeakMap,_DrawingEditor_brand=new WeakSet,DrawingEditor=function(_AnnotationEditor5){function DrawingEditor(params){var _this90;return babelHelpers.classCallCheck(this,DrawingEditor),_classPrivateMethodInitSpec(_this90=_callSuper(this,DrawingEditor,[params]),_DrawingEditor_brand),_classPrivateFieldInitSpec(_this90,_drawOutlines,null),_classPrivateFieldInitSpec(_this90,_mustBeCommitted,void 0),babelHelpers.defineProperty(_this90,"_drawId",null),_classPrivateFieldSet(_mustBeCommitted,_this90,params.mustBeCommitted||!1),_this90._addOutlines(params),_this90}return babelHelpers.inherits(DrawingEditor,_AnnotationEditor5),babelHelpers.createClass(DrawingEditor,[{key:"_addOutlines",value:function(params){params.drawOutlines&&(_assertClassBrand(_DrawingEditor_brand,this,_createDrawOutlines).call(this,params),_assertClassBrand(_DrawingEditor_brand,this,_addToDrawLayer2).call(this))}},{key:"updateParams",value:function(type,value){var propertyName=this.constructor.typesMap.get(type);propertyName&&this._updateProperty(type,propertyName,value)}},{key:"propertiesToUpdate",get:function(){var _step145,properties=[],_drawingOptions=this._drawingOptions,_iterator145=_createForOfIteratorHelper(this.constructor.typesMap);try{for(_iterator145.s();!(_step145=_iterator145.n()).done;){var _step145$value=babelHelpers.slicedToArray(_step145.value,2),type=_step145$value[0],name=_step145$value[1];properties.push([type,_drawingOptions[name]])}}catch(err){_iterator145.e(err)}finally{_iterator145.f()}return properties}},{key:"_updateProperty",value:function(type,name,value){function setter(val){options.updateProperty(name,val),(val=_classPrivateFieldGet(_drawOutlines,_this91).updateProperty(name,val))&&_assertClassBrand(_DrawingEditor_brand,_this91,_updateBbox).call(_this91,val),null!=(val=_this91.parent)&&val.drawLayer.updateProperties(_this91._drawId,options.toSVGProperties())}var _this91=this,options=this._drawingOptions,savedValue=options[name];this.addCommands({cmd:setter.bind(this,value),undo:setter.bind(this,savedValue),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:type,overwriteIfSameType:!0,keepUndo:!0})}},{key:"_onResizing",value:function(){var _this$parent7;null!=(_this$parent7=this.parent)&&_this$parent7.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(_classPrivateFieldGet(_drawOutlines,this).getPathResizingSVGProperties(_assertClassBrand(_DrawingEditor_brand,this,_convertToDrawSpace).call(this)),{bbox:_assertClassBrand(_DrawingEditor_brand,this,_rotateBox).call(this)}))}},{key:"_onResized",value:function(){var _this$parent8;null!=(_this$parent8=this.parent)&&_this$parent8.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(_classPrivateFieldGet(_drawOutlines,this).getPathResizedSVGProperties(_assertClassBrand(_DrawingEditor_brand,this,_convertToDrawSpace).call(this)),{bbox:_assertClassBrand(_DrawingEditor_brand,this,_rotateBox).call(this)}))}},{key:"_onTranslating",value:function(_x,_y){var _this$parent9;null!=(_this$parent9=this.parent)&&_this$parent9.drawLayer.updateProperties(this._drawId,{bbox:_assertClassBrand(_DrawingEditor_brand,this,_rotateBox).call(this)})}},{key:"_onTranslated",value:function(){var _this$parent0;null!=(_this$parent0=this.parent)&&_this$parent0.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(_classPrivateFieldGet(_drawOutlines,this).getPathTranslatedSVGProperties(_assertClassBrand(_DrawingEditor_brand,this,_convertToDrawSpace).call(this),this.parentDimensions),{bbox:_assertClassBrand(_DrawingEditor_brand,this,_rotateBox).call(this)}))}},{key:"_onStartDragging",value:function(){var _this$parent1;null!=(_this$parent1=this.parent)&&_this$parent1.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}},{key:"_onStopDragging",value:function(){var _this$parent10;null!=(_this$parent10=this.parent)&&_this$parent10.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}},{key:"commit",value:function(){_superPropGet(DrawingEditor,"commit",this,3)([]),this.disableEditMode(),this.disableEditing()}},{key:"disableEditing",value:function(){_superPropGet(DrawingEditor,"disableEditing",this,3)([]),this.div.classList.toggle("disabled",!0)}},{key:"enableEditing",value:function(){_superPropGet(DrawingEditor,"enableEditing",this,3)([]),this.div.classList.toggle("disabled",!1)}},{key:"getBaseTranslation",value:function(){return[0,0]}},{key:"isResizable",get:function(){return!0}},{key:"onceAdded",value:function(focus){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,_classPrivateFieldGet(_mustBeCommitted,this)&&(_classPrivateFieldSet(_mustBeCommitted,this,!1),this.commit(),this.parent.setSelected(this),focus)&&this.isOnScreen&&this.div.focus()}},{key:"remove",value:function(){_assertClassBrand(_DrawingEditor_brand,this,_cleanDrawLayer2).call(this),_superPropGet(DrawingEditor,"remove",this,3)([])}},{key:"rebuild",value:function(){this.parent&&(_superPropGet(DrawingEditor,"rebuild",this,3)([]),null===this.div||(_assertClassBrand(_DrawingEditor_brand,this,_addToDrawLayer2).call(this),_assertClassBrand(_DrawingEditor_brand,this,_updateBbox).call(this,_classPrivateFieldGet(_drawOutlines,this).box),this.isAttachedToDOM)||this.parent.add(this))}},{key:"setParent",value:function(parent){var _this$div6,mustBeSelected=!1;this.parent&&!parent?(this._uiManager.removeShouldRescale(this),_assertClassBrand(_DrawingEditor_brand,this,_cleanDrawLayer2).call(this)):parent&&(this._uiManager.addShouldRescale(this),_assertClassBrand(_DrawingEditor_brand,this,_addToDrawLayer2).call(this,parent),mustBeSelected=!this.parent&&(null==(_this$div6=this.div)?void 0:_this$div6.classList.contains("selectedEditor"))),_superPropGet(DrawingEditor,"setParent",this,3)([parent]),mustBeSelected&&this.select()}},{key:"rotate",value:function(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties({bbox:_assertClassBrand(_DrawingEditor_brand,this,_rotateBox).call(this)},_classPrivateFieldGet(_drawOutlines,this).updateRotation((this.parentRotation-this.rotation+360)%360)))}},{key:"onScaleChanging",value:function(){this.parent&&_assertClassBrand(_DrawingEditor_brand,this,_updateBbox).call(this,_classPrivateFieldGet(_drawOutlines,this).updateParentDimensions(this.parentDimensions,this.parent.scale))}},{key:"render",value:function(){var baseX,baseY,div,parentWidth,drawDiv;return this.div||(this._isCopy&&(baseX=this.x,baseY=this.y),(div=_superPropGet(DrawingEditor,"render",this,3)([])).classList.add("draw"),drawDiv=document.createElement("div"),div.append(drawDiv),drawDiv.setAttribute("aria-hidden","true"),drawDiv.className="internal",parentWidth=(drawDiv=babelHelpers.slicedToArray(this.parentDimensions,2))[0],drawDiv=drawDiv[1],this.setDims(this.width*parentWidth,this.height*drawDiv),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(baseX,baseY),div)}},{key:"createDrawingOptions",value:function(_data){}},{key:"serializeDraw",value:function(isForCopying){var _this$pageTranslation5=babelHelpers.slicedToArray(this.pageTranslation,2),pageX=_this$pageTranslation5[0],_this$pageTranslation5=_this$pageTranslation5[1],_this$pageDimensions6=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions6[0],_this$pageDimensions6=_this$pageDimensions6[1];return _classPrivateFieldGet(_drawOutlines,this).serialize([pageX,_this$pageTranslation5,pageWidth,_this$pageDimensions6],isForCopying)}},{key:"renderAnnotationElement",value:function(annotation){return annotation.updateEdited({rect:this.getRect(0,0)}),null}}],[{key:"_mergeSVGProperties",value:function(p1,p2){for(var p1Keys=new Set(Object.keys(p1)),_i25=0,_Object$entries6=Object.entries(p2);_i25<_Object$entries6.length;_i25++){var _Object$entries6$_i=babelHelpers.slicedToArray(_Object$entries6[_i25],2),key=_Object$entries6$_i[0],_Object$entries6$_i=_Object$entries6$_i[1];p1Keys.has(key)?Object.assign(p1[key],_Object$entries6$_i):p1[key]=_Object$entries6$_i}return p1}},{key:"getDefaultDrawingOptions",value:function(_options){unreachable("Not implemented")}},{key:"typesMap",get:function(){unreachable("Not implemented")}},{key:"isDrawer",get:function(){return!0}},{key:"supportMultipleDrawings",get:function(){return!1}},{key:"updateDefaultParams",value:function(type,value){type=this.typesMap.get(type);type&&this._defaultDrawingOptions.updateProperty(type,value),this._currentParent&&(_currentDraw._.updateProperty(type,value),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}},{key:"defaultPropertiesToUpdate",get:function(){var _step146,properties=[],options=this._defaultDrawingOptions,_iterator146=_createForOfIteratorHelper(this.typesMap);try{for(_iterator146.s();!(_step146=_iterator146.n()).done;){var _step146$value=babelHelpers.slicedToArray(_step146.value,2),type=_step146$value[0],name=_step146$value[1];properties.push([type,options[name]])}}catch(err){_iterator146.e(err)}finally{_iterator146.f()}return properties}},{key:"onScaleChangingWhenDrawing",value:function(){}},{key:"createDrawerInstance",value:function(_x,_y,_parentWidth,_parentHeight,_rotation){unreachable("Not implemented")}},{key:"startDrawing",value:function(parent,uiManager,_isLTR,event){var rotation,parentWidth,_target$getBoundingCl,ac,_this92=this,target=event.target,x=event.offsetX,y=event.offsetY,pointerId=event.pointerId,event=event.pointerType;_currentPointerType._&&_currentPointerType._!==event||(rotation=parent.viewport.rotation,parentWidth=(_target$getBoundingCl=target.getBoundingClientRect()).width,_target$getBoundingCl=_target$getBoundingCl.height,ac=_currentDrawingAC._=new AbortController,ac=parent.combinedSignal(ac),_currentPointerId._||(_currentPointerId._=pointerId),null==_currentPointerType._&&(_currentPointerType._=event),window.addEventListener("pointerup",function(e){var _currentPointerIds$_;_currentPointerId._===e.pointerId?_this92._endDraw(e):null!=(_currentPointerIds$_=_currentPointerIds._)&&_currentPointerIds$_.delete(e.pointerId)},{signal:ac}),window.addEventListener("pointercancel",function(e){var _currentPointerIds$_2;_currentPointerId._===e.pointerId?_this92._currentParent.endDrawingSession():null!=(_currentPointerIds$_2=_currentPointerIds._)&&_currentPointerIds$_2.delete(e.pointerId)},{signal:ac}),window.addEventListener("pointerdown",function(e){_currentPointerType._===e.pointerType&&((_currentPointerIds._||(_currentPointerIds._=new Set)).add(e.pointerId),_currentDraw._.isCancellable())&&(_currentDraw._.removeLastElement(),_currentDraw._.isEmpty()?_this92._currentParent.endDrawingSession(!0):_this92._endDraw(null))},{capture:!0,passive:!1,signal:ac}),window.addEventListener("contextmenu",noContextMenu,{signal:ac}),target.addEventListener("pointermove",this._drawMove.bind(this),{signal:ac}),target.addEventListener("touchmove",function(e){e.timeStamp===_currentMoveTimestamp._&&stopEvent(e)},{signal:ac}),parent.toggleDrawing(),null!=(pointerId=uiManager._editorUndoBar)&&pointerId.hide(),_currentDraw._?parent.drawLayer.updateProperties(this._currentDrawId,_currentDraw._.startNew(x,y,parentWidth,_target$getBoundingCl,rotation)):(uiManager.updateUIForDefaultProperties(this),_currentDraw._=this.createDrawerInstance(x,y,parentWidth,_target$getBoundingCl,rotation),_currentDrawingOptions._=this.getDefaultDrawingOptions(),event=(this._currentParent=parent).drawLayer.draw(this._mergeSVGProperties(_currentDrawingOptions._.toSVGProperties(),_currentDraw._.defaultSVGProperties),!0,!1),this._currentDrawId=event.id))}},{key:"_drawMove",value:function(event){var offsetX,offsetY,pointerId;_currentMoveTimestamp._=-1,_currentDraw._&&(offsetX=event.offsetX,offsetY=event.offsetY,pointerId=event.pointerId,_currentPointerId._===pointerId)&&(1<=(null==(pointerId=_currentPointerIds._)?void 0:pointerId.size)?this._endDraw(event):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,_currentDraw._.add(offsetX,offsetY)),_currentMoveTimestamp._=event.timeStamp,stopEvent(event)))}},{key:"_cleanup",value:function(all){all&&(this._currentDrawId=-1,this._currentParent=null,_currentDraw._=null,_currentDrawingOptions._=null,_currentPointerType._=null,_currentMoveTimestamp._=NaN),_currentDrawingAC._&&(_currentDrawingAC._.abort(),_currentDrawingAC._=null,_currentPointerId._=NaN,_currentPointerIds._=null)}},{key:"_endDraw",value:function(event){var draw,drawId,lastElement,parent=this._currentParent;parent&&(parent.toggleDrawing(!0),this._cleanup(!1),(null==event?void 0:event.target)===parent.div&&parent.drawLayer.updateProperties(this._currentDrawId,_currentDraw._.end(event.offsetX,event.offsetY)),this.supportMultipleDrawings?(draw=_currentDraw._,drawId=this._currentDrawId,lastElement=draw.getLastElement(),parent.addCommands({cmd:function(){parent.drawLayer.updateProperties(drawId,draw.setLastElement(lastElement))},undo:function(){parent.drawLayer.updateProperties(drawId,draw.removeLastElement())},mustExec:!1,type:AnnotationEditorParamsType.DRAW_STEP})):this.endDrawing(!1))}},{key:"endDrawing",value:function(isAborted){var _parent$pageDimension,scale,pageWidth,parent=this._currentParent;if(parent){if(parent.toggleDrawing(!0),parent.cleanUndoStack(AnnotationEditorParamsType.DRAW_STEP),!_currentDraw._.isEmpty())return pageWidth=(_parent$pageDimension=babelHelpers.slicedToArray(parent.pageDimensions,2))[0],_parent$pageDimension=_parent$pageDimension[1],scale=parent.scale,pageWidth=parent.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:_currentDraw._.getOutlines(pageWidth*scale,_parent$pageDimension*scale,scale,this._INNER_MARGIN),drawingOptions:_currentDrawingOptions._,mustBeCommitted:!isAborted}),this._cleanup(!0),pageWidth;parent.drawLayer.remove(this._currentDrawId),this._cleanup(!0)}return null}},{key:"deserializeDraw",value:function(_pageX,_pageY,_pageWidth,_pageHeight,_innerWidth,_data){unreachable("Not implemented")}},{key:"deserialize",value:async function(data,parent,uiManager){var _parent$viewport$rawD=parent.viewport.rawDims,pageWidth=_parent$viewport$rawD.pageWidth,pageHeight=_parent$viewport$rawD.pageHeight,pageX=_parent$viewport$rawD.pageX,_parent$viewport$rawD=_parent$viewport$rawD.pageY,pageX=this.deserializeDraw(pageX,_parent$viewport$rawD,pageWidth,pageHeight,this._INNER_MARGIN,data),_parent$viewport$rawD=await _superPropGet(DrawingEditor,"deserialize",this,2)([data,parent,uiManager]);return _parent$viewport$rawD.createDrawingOptions(data),_assertClassBrand(_DrawingEditor_brand,_parent$viewport$rawD,_createDrawOutlines).call(_parent$viewport$rawD,{drawOutlines:pageX}),_assertClassBrand(_DrawingEditor_brand,_parent$viewport$rawD,_addToDrawLayer2).call(_parent$viewport$rawD),_parent$viewport$rawD.onScaleChanging(),_parent$viewport$rawD.rotate(),_parent$viewport$rawD}},{key:"canCreateNewEmptyEditor",value:function(){return!1}}])}(AnnotationEditor);function _createDrawOutlines(_ref144){var drawOutlines=_ref144.drawOutlines,drawId=_ref144.drawId,_ref144=_ref144.drawingOptions;_classPrivateFieldSet(_drawOutlines,this,drawOutlines),this._drawingOptions||(this._drawingOptions=_ref144),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-".concat(this.editorType,"-added-alert")),0<=drawId?(this._drawId=drawId,this.parent.drawLayer.finalizeDraw(drawId,drawOutlines.defaultProperties)):this._drawId=_assertClassBrand(_DrawingEditor_brand,this,_createDrawing).call(this,drawOutlines,this.parent),_assertClassBrand(_DrawingEditor_brand,this,_updateBbox).call(this,drawOutlines.box)}function _createDrawing(drawOutlines,parent){return parent.drawLayer.draw(_DrawingEditor._mergeSVGProperties(this._drawingOptions.toSVGProperties(),drawOutlines.defaultSVGProperties),!1,!1).id}function _cleanDrawLayer2(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}function _addToDrawLayer2(){var parent=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.parent;null!==this._drawId&&this.parent===parent||(null!==this._drawId?this.parent.drawLayer.updateParent(this._drawId,parent.drawLayer):(this._drawingOptions.updateAll(),this._drawId=_assertClassBrand(_DrawingEditor_brand,this,_createDrawing).call(this,_classPrivateFieldGet(_drawOutlines,this),parent)))}function _convertToParentSpace(_ref145){var _ref145=babelHelpers.slicedToArray(_ref145,4),x=_ref145[0],y=_ref145[1],width=_ref145[2],height=_ref145[3],_ref145=babelHelpers.slicedToArray(this.parentDimensions,2),pW=_ref145[0],pH=_ref145[1];switch(this.rotation){case 90:return[y,1-x,width*(pH/pW),height*(pW/pH)];case 180:return[1-x,1-y,width,height];case 270:return[1-y,x,width*(pH/pW),height*(pW/pH)];default:return[x,y,width,height]}}function _convertToDrawSpace(){var x=this.x,y=this.y,width=this.width,height=this.height,_this$parentDimension19=babelHelpers.slicedToArray(this.parentDimensions,2),pW=_this$parentDimension19[0],pH=_this$parentDimension19[1];switch(this.rotation){case 90:return[1-y,x,width*(pW/pH),height*(pH/pW)];case 180:return[1-x,1-y,width,height];case 270:return[y,1-x,width*(pW/pH),height*(pH/pW)];default:return[x,y,width,height]}}function _updateBbox(bbox){var parentWidth,bbox=_assertClassBrand(_DrawingEditor_brand,this,_convertToParentSpace).call(this,bbox),bbox=babelHelpers.slicedToArray(bbox,4);this.x=bbox[0],this.y=bbox[1],this.width=bbox[2],this.height=bbox[3],this.div&&(this.fixAndSetPosition(),parentWidth=(bbox=babelHelpers.slicedToArray(this.parentDimensions,2))[0],bbox=bbox[1],this.setDims(this.width*parentWidth,this.height*bbox)),this._onResized()}function _rotateBox(){var x=this.x,y=this.y,width=this.width,height=this.height,rotation=this.rotation,parentRotation=this.parentRotation,_this$parentDimension21=babelHelpers.slicedToArray(this.parentDimensions,2),pW=_this$parentDimension21[0],pH=_this$parentDimension21[1];switch((4*rotation+parentRotation)/90){case 1:return[1-y-height,x,height,width];case 2:return[1-x-width,1-y-height,width,height];case 3:return[y,1-x-width,height,width];case 4:return[x,y-width*(pW/pH),height*(pH/pW),width*(pW/pH)];case 5:return[1-y,x,width*(pW/pH),height*(pH/pW)];case 6:return[1-x-height*(pH/pW),1-y,height*(pH/pW),width*(pW/pH)];case 7:return[y-width*(pW/pH),1-x-height*(pH/pW),width*(pW/pH),height*(pH/pW)];case 8:return[x-width,y-height,width,height];case 9:return[1-y,x-width,height,width];case 10:return[1-x,1-y,width,height];case 11:return[y-height,1-x,height,width];case 12:return[x-height*(pH/pW),y,height*(pH/pW),width*(pW/pH)];case 13:return[1-y-width*(pW/pH),x-height*(pH/pW),width*(pW/pH),height*(pH/pW)];case 14:return[1-x,1-y-width*(pW/pH),height*(pH/pW),width*(pW/pH)];case 15:return[y,1-x,width*(pW/pH),height*(pH/pW)];default:return[x,y,width,height]}}_DrawingEditor=DrawingEditor,babelHelpers.defineProperty(DrawingEditor,"_currentDrawId",-1),babelHelpers.defineProperty(DrawingEditor,"_currentParent",null);var _currentDraw={_:null},_currentDrawingAC={_:null},_currentDrawingOptions={_:null},_currentPointerId={_:NaN},_currentPointerType={_:null},_currentPointerIds={_:null},_currentMoveTimestamp={_:NaN},_last2=(babelHelpers.defineProperty(DrawingEditor,"_INNER_MARGIN",3),new WeakMap),_line2=new WeakMap,_lines=new WeakMap,_rotation6=new WeakMap,_thickness3=new WeakMap,_points3=new WeakMap,_lastSVGPath=new WeakMap,_lastIndex=new WeakMap,_outlines2=new WeakMap,_parentWidth2=new WeakMap,_parentHeight2=new WeakMap,_InkDrawOutliner_brand=new WeakSet,InkDrawOutliner=function(){return babelHelpers.createClass(function InkDrawOutliner(_x6,_y7,parentWidth,parentHeight,rotation,thickness){babelHelpers.classCallCheck(this,InkDrawOutliner),_classPrivateMethodInitSpec(this,_InkDrawOutliner_brand),_classPrivateFieldInitSpec(this,_last2,new Float64Array(6)),_classPrivateFieldInitSpec(this,_line2,void 0),_classPrivateFieldInitSpec(this,_lines,void 0),_classPrivateFieldInitSpec(this,_rotation6,void 0),_classPrivateFieldInitSpec(this,_thickness3,void 0),_classPrivateFieldInitSpec(this,_points3,void 0),_classPrivateFieldInitSpec(this,_lastSVGPath,""),_classPrivateFieldInitSpec(this,_lastIndex,0),_classPrivateFieldInitSpec(this,_outlines2,new InkDrawOutline),_classPrivateFieldInitSpec(this,_parentWidth2,void 0),_classPrivateFieldInitSpec(this,_parentHeight2,void 0),_classPrivateFieldSet(_parentWidth2,this,parentWidth),_classPrivateFieldSet(_parentHeight2,this,parentHeight),_classPrivateFieldSet(_rotation6,this,rotation),_classPrivateFieldSet(_thickness3,this,thickness);parentWidth=_assertClassBrand(_InkDrawOutliner_brand,this,_normalizePoint2).call(this,_x6,_y7),parentHeight=babelHelpers.slicedToArray(parentWidth,2),_x6=parentHeight[0],_y7=parentHeight[1],rotation=_classPrivateFieldSet(_line2,this,[NaN,NaN,NaN,NaN,_x6,_y7]);_classPrivateFieldSet(_points3,this,[_x6,_y7]),_classPrivateFieldSet(_lines,this,[{line:rotation,points:_classPrivateFieldGet(_points3,this)}]),_classPrivateFieldGet(_last2,this).set(rotation,0)},[{key:"updateProperty",value:function(name,value){"stroke-width"===name&&_classPrivateFieldSet(_thickness3,this,value)}},{key:"isEmpty",value:function(){return!_classPrivateFieldGet(_lines,this)||0===_classPrivateFieldGet(_lines,this).length}},{key:"isCancellable",value:function(){return _classPrivateFieldGet(_points3,this).length<=10}},{key:"add",value:function(x,y){var _assertClassBrand$cal11=_assertClassBrand(_InkDrawOutliner_brand,this,_normalizePoint2).call(this,x,y),_assertClassBrand$cal11=babelHelpers.slicedToArray(_assertClassBrand$cal11,2),_assertClassBrand$cal11=(x=_assertClassBrand$cal11[0],y=_assertClassBrand$cal11[1],_classPrivateFieldGet(_last2,this).subarray(2,6)),_assertClassBrand$cal11=babelHelpers.slicedToArray(_assertClassBrand$cal11,4),x1=_assertClassBrand$cal11[0],y1=_assertClassBrand$cal11[1],x2=_assertClassBrand$cal11[2],_assertClassBrand$cal11=_assertClassBrand$cal11[3],diffX=x-x2,diffY=y-_assertClassBrand$cal11;return Math.hypot(_classPrivateFieldGet(_parentWidth2,this)*diffX,_classPrivateFieldGet(_parentHeight2,this)*diffY)<=2?null:(_classPrivateFieldGet(_points3,this).push(x,y),isNaN(x1)?(_classPrivateFieldGet(_last2,this).set([x2,_assertClassBrand$cal11,x,y],2),_classPrivateFieldGet(_line2,this).push(NaN,NaN,NaN,NaN,x,y)):(isNaN(_classPrivateFieldGet(_last2,this)[0])&&_classPrivateFieldGet(_line2,this).splice(6,6),_classPrivateFieldGet(_last2,this).set([x1,y1,x2,_assertClassBrand$cal11,x,y],0),(diffX=_classPrivateFieldGet(_line2,this)).push.apply(diffX,babelHelpers.toConsumableArray(Outline.createBezierPoints(x1,y1,x2,_assertClassBrand$cal11,x,y)))),{path:{d:this.toSVGPath()}})}},{key:"end",value:function(x,y){x=this.add(x,y);return x||(2===_classPrivateFieldGet(_points3,this).length?{path:{d:this.toSVGPath()}}:null)}},{key:"startNew",value:function(x,y,parentWidth,parentHeight,rotation){_classPrivateFieldSet(_parentWidth2,this,parentWidth),_classPrivateFieldSet(_parentHeight2,this,parentHeight),_classPrivateFieldSet(_rotation6,this,rotation);parentWidth=_assertClassBrand(_InkDrawOutliner_brand,this,_normalizePoint2).call(this,x,y),parentHeight=babelHelpers.slicedToArray(parentWidth,2),x=parentHeight[0],y=parentHeight[1],rotation=_classPrivateFieldSet(_line2,this,[NaN,NaN,NaN,NaN,x,y]),_classPrivateFieldSet(_points3,this,[x,y]),parentWidth=_classPrivateFieldGet(_lines,this).at(-1);return parentWidth&&(parentWidth.line=new Float32Array(parentWidth.line),parentWidth.points=new Float32Array(parentWidth.points)),_classPrivateFieldGet(_lines,this).push({line:rotation,points:_classPrivateFieldGet(_points3,this)}),_classPrivateFieldGet(_last2,this).set(rotation,0),_classPrivateFieldSet(_lastIndex,this,0),this.toSVGPath(),null}},{key:"getLastElement",value:function(){return _classPrivateFieldGet(_lines,this).at(-1)}},{key:"setLastElement",value:function(element){return _classPrivateFieldGet(_lines,this)?(_classPrivateFieldGet(_lines,this).push(element),_classPrivateFieldSet(_line2,this,element.line),_classPrivateFieldSet(_points3,this,element.points),_classPrivateFieldSet(_lastIndex,this,0),{path:{d:this.toSVGPath()}}):_classPrivateFieldGet(_outlines2,this).setLastElement(element)}},{key:"removeLastElement",value:function(){if(!_classPrivateFieldGet(_lines,this))return _classPrivateFieldGet(_outlines2,this).removeLastElement();_classPrivateFieldGet(_lines,this).pop(),_classPrivateFieldSet(_lastSVGPath,this,"");for(var i=0,ii=_classPrivateFieldGet(_lines,this).length;i<ii;i++){var _classPrivateFieldGet109=_classPrivateFieldGet(_lines,this)[i],line=_classPrivateFieldGet109.line,_classPrivateFieldGet109=_classPrivateFieldGet109.points;_classPrivateFieldSet(_line2,this,line),_classPrivateFieldSet(_points3,this,_classPrivateFieldGet109),_classPrivateFieldSet(_lastIndex,this,0),this.toSVGPath()}return{path:{d:_classPrivateFieldGet(_lastSVGPath,this)}}}},{key:"toSVGPath",value:function(){var i,secondY,firstX=Outline.svgRound(_classPrivateFieldGet(_line2,this)[4]),firstY=Outline.svgRound(_classPrivateFieldGet(_line2,this)[5]);if(2===_classPrivateFieldGet(_points3,this).length)_classPrivateFieldSet(_lastSVGPath,this,"".concat(_classPrivateFieldGet(_lastSVGPath,this)," M ").concat(firstX," ").concat(firstY," Z"));else if(_classPrivateFieldGet(_points3,this).length<=6&&(i=_classPrivateFieldGet(_lastSVGPath,this).lastIndexOf("M"),_classPrivateFieldSet(_lastSVGPath,this,"".concat(_classPrivateFieldGet(_lastSVGPath,this).slice(0,i)," M ").concat(firstX," ").concat(firstY)),_classPrivateFieldSet(_lastIndex,this,6)),4===_classPrivateFieldGet(_points3,this).length)i=Outline.svgRound(_classPrivateFieldGet(_line2,this)[10]),secondY=Outline.svgRound(_classPrivateFieldGet(_line2,this)[11]),_classPrivateFieldSet(_lastSVGPath,this,"".concat(_classPrivateFieldGet(_lastSVGPath,this)," L ").concat(i," ").concat(secondY)),_classPrivateFieldSet(_lastIndex,this,12);else{var buffer=[];0===_classPrivateFieldGet(_lastIndex,this)&&(buffer.push("M ".concat(firstX," ").concat(firstY)),_classPrivateFieldSet(_lastIndex,this,6));for(var _i26=_classPrivateFieldGet(_lastIndex,this),ii=_classPrivateFieldGet(_line2,this).length;_i26<ii;_i26+=6){var _classPrivateFieldGet110=_classPrivateFieldGet(_line2,this).slice(_i26,_i26+6).map(Outline.svgRound),_classPrivateFieldGet110=babelHelpers.slicedToArray(_classPrivateFieldGet110,6),c1x=_classPrivateFieldGet110[0],c1y=_classPrivateFieldGet110[1],c2x=_classPrivateFieldGet110[2],c2y=_classPrivateFieldGet110[3],x=_classPrivateFieldGet110[4],_classPrivateFieldGet110=_classPrivateFieldGet110[5];buffer.push("C".concat(c1x," ").concat(c1y," ").concat(c2x," ").concat(c2y," ").concat(x," ").concat(_classPrivateFieldGet110))}_classPrivateFieldSet(_lastSVGPath,this,_classPrivateFieldGet(_lastSVGPath,this)+buffer.join(" ")),_classPrivateFieldSet(_lastIndex,this,_classPrivateFieldGet(_line2,this).length)}return _classPrivateFieldGet(_lastSVGPath,this)}},{key:"getOutlines",value:function(parentWidth,parentHeight,scale,innerMargin){var last=_classPrivateFieldGet(_lines,this).at(-1);return last.line=new Float32Array(last.line),last.points=new Float32Array(last.points),_classPrivateFieldGet(_outlines2,this).build(_classPrivateFieldGet(_lines,this),parentWidth,parentHeight,scale,_classPrivateFieldGet(_rotation6,this),_classPrivateFieldGet(_thickness3,this),innerMargin),_classPrivateFieldSet(_last2,this,null),_classPrivateFieldSet(_line2,this,null),_classPrivateFieldSet(_lines,this,null),_classPrivateFieldSet(_lastSVGPath,this,null),_classPrivateFieldGet(_outlines2,this)}},{key:"defaultSVGProperties",get:function(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}])}();function _normalizePoint2(x,y){return Outline._normalizePoint(x,y,_classPrivateFieldGet(_parentWidth2,this),_classPrivateFieldGet(_parentHeight2,this),_classPrivateFieldGet(_rotation6,this))}var _bbox4=new WeakMap,_currentRotation=new WeakMap,_innerMargin3=new WeakMap,_lines2=new WeakMap,_parentWidth3=new WeakMap,_parentHeight3=new WeakMap,_parentScale=new WeakMap,_rotation7=new WeakMap,_thickness4=new WeakMap,_InkDrawOutline_brand=new WeakSet,InkDrawOutline=function(){function InkDrawOutline(){var _this93;babelHelpers.classCallCheck(this,InkDrawOutline);for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++)args[_key2]=arguments[_key2];return _classPrivateMethodInitSpec(_this93=_callSuper(this,InkDrawOutline,[].concat(args)),_InkDrawOutline_brand),_classPrivateFieldInitSpec(_this93,_bbox4,void 0),_classPrivateFieldInitSpec(_this93,_currentRotation,0),_classPrivateFieldInitSpec(_this93,_innerMargin3,void 0),_classPrivateFieldInitSpec(_this93,_lines2,void 0),_classPrivateFieldInitSpec(_this93,_parentWidth3,void 0),_classPrivateFieldInitSpec(_this93,_parentHeight3,void 0),_classPrivateFieldInitSpec(_this93,_parentScale,void 0),_classPrivateFieldInitSpec(_this93,_rotation7,void 0),_classPrivateFieldInitSpec(_this93,_thickness4,void 0),_this93}return babelHelpers.inherits(InkDrawOutline,Outline),babelHelpers.createClass(InkDrawOutline,[{key:"build",value:function(lines,parentWidth,parentHeight,parentScale,rotation,thickness,innerMargin){_classPrivateFieldSet(_parentWidth3,this,parentWidth),_classPrivateFieldSet(_parentHeight3,this,parentHeight),_classPrivateFieldSet(_parentScale,this,parentScale),_classPrivateFieldSet(_rotation7,this,rotation),_classPrivateFieldSet(_thickness4,this,thickness),_classPrivateFieldSet(_innerMargin3,this,null!=innerMargin?innerMargin:0),_classPrivateFieldSet(_lines2,this,lines),_assertClassBrand(_InkDrawOutline_brand,this,_computeBbox).call(this)}},{key:"thickness",get:function(){return _classPrivateFieldGet(_thickness4,this)}},{key:"setLastElement",value:function(element){return _classPrivateFieldGet(_lines2,this).push(element),{path:{d:this.toSVGPath()}}}},{key:"removeLastElement",value:function(){return _classPrivateFieldGet(_lines2,this).pop(),{path:{d:this.toSVGPath()}}}},{key:"toSVGPath",value:function(){var _step147,buffer=[],_iterator147=_createForOfIteratorHelper(_classPrivateFieldGet(_lines2,this));try{for(_iterator147.s();!(_step147=_iterator147.n()).done;){var line=_step147.value.line;if(buffer.push("M".concat(Outline.svgRound(line[4])," ").concat(Outline.svgRound(line[5]))),6===line.length)buffer.push("Z");else if(12===line.length&&isNaN(line[6]))buffer.push("L".concat(Outline.svgRound(line[10])," ").concat(Outline.svgRound(line[11])));else for(var i=6,ii=line.length;i<ii;i+=6){var _line$subarray$map=line.subarray(i,i+6).map(Outline.svgRound),_line$subarray$map2=babelHelpers.slicedToArray(_line$subarray$map,6),c1x=_line$subarray$map2[0],c1y=_line$subarray$map2[1],c2x=_line$subarray$map2[2],c2y=_line$subarray$map2[3],x=_line$subarray$map2[4],y=_line$subarray$map2[5];buffer.push("C".concat(c1x," ").concat(c1y," ").concat(c2x," ").concat(c2y," ").concat(x," ").concat(y))}}}catch(err){_iterator147.e(err)}finally{_iterator147.f()}return buffer.join("")}},{key:"serialize",value:function(_ref104,isForCopying){var tx,ty,sx,sy,x1,y1,x2,y2,rescaleFn,_ref104=babelHelpers.slicedToArray(_ref104,4),pageX=_ref104[0],pageY=_ref104[1],pageWidth=_ref104[2],pageHeight=_ref104[3],serializedLines=[],serializedPoints=[],_ref104=_assertClassBrand(_InkDrawOutline_brand,this,_getBBoxWithNoMargin).call(this),_ref104=babelHelpers.slicedToArray(_ref104,4),x=_ref104[0],y=_ref104[1],width=_ref104[2],height=_ref104[3];switch(_classPrivateFieldGet(_rotation7,this)){case 0:rescaleFn=Outline._rescale,ty=pageY+pageHeight,sy=-pageHeight,x1=(tx=pageX)+x*(sx=pageWidth),y1=pageY+(1-y-height)*pageHeight,x2=pageX+(x+width)*pageWidth,y2=pageY+(1-y)*pageHeight;break;case 90:rescaleFn=Outline._rescaleAndSwap,x1=(tx=pageX)+y*(sx=pageWidth),y1=(ty=pageY)+x*(sy=pageHeight),x2=pageX+(y+height)*pageWidth,y2=pageY+(x+width)*pageHeight;break;case 180:rescaleFn=Outline._rescale,tx=pageX+pageWidth,sx=-pageWidth,x1=pageX+(1-x-width)*pageWidth,y1=(ty=pageY)+y*(sy=pageHeight),x2=pageX+(1-x)*pageWidth,y2=pageY+(y+height)*pageHeight;break;case 270:rescaleFn=Outline._rescaleAndSwap,tx=pageX+pageWidth,ty=pageY+pageHeight,sx=-pageWidth,sy=-pageHeight,x1=pageX+(1-y-height)*pageWidth,y1=pageY+(1-x-width)*pageHeight,x2=pageX+(1-y)*pageWidth,y2=pageY+(1-x)*pageHeight}var _step148,_iterator148=_createForOfIteratorHelper(_classPrivateFieldGet(_lines2,this));try{for(_iterator148.s();!(_step148=_iterator148.n()).done;){var _step148$value=_step148.value,line=_step148$value.line,points=_step148$value.points;serializedLines.push(rescaleFn(line,tx,ty,sx,sy,isForCopying?new Array(line.length):null)),serializedPoints.push(rescaleFn(points,tx,ty,sx,sy,isForCopying?new Array(points.length):null))}}catch(err){_iterator148.e(err)}finally{_iterator148.f()}return{lines:serializedLines,points:serializedPoints,rect:[x1,y1,x2,y2]}}},{key:"box",get:function(){return _classPrivateFieldGet(_bbox4,this)}},{key:"updateProperty",value:function(name,value){return"stroke-width"===name?_assertClassBrand(_InkDrawOutline_brand,this,_updateThickness2).call(this,value):null}},{key:"updateParentDimensions",value:function(_ref106,scale){var _ref106=babelHelpers.slicedToArray(_ref106,2),width=_ref106[0],_ref106=_ref106[1],_assertClassBrand$cal17=_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this),_assertClassBrand$cal17=babelHelpers.slicedToArray(_assertClassBrand$cal17,2),oldMarginX=_assertClassBrand$cal17[0],_assertClassBrand$cal17=_assertClassBrand$cal17[1],width=(_classPrivateFieldSet(_parentWidth3,this,width),_classPrivateFieldSet(_parentHeight3,this,_ref106),_classPrivateFieldSet(_parentScale,this,scale),_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this)),_ref106=babelHelpers.slicedToArray(width,2),scale=_ref106[0]-oldMarginX,width=_ref106[1]-_assertClassBrand$cal17,oldMarginX=_classPrivateFieldGet(_bbox4,this);return oldMarginX[0]-=scale,oldMarginX[1]-=width,oldMarginX[2]+=2*scale,oldMarginX[3]+=2*width,oldMarginX}},{key:"updateRotation",value:function(rotation){return _classPrivateFieldSet(_currentRotation,this,rotation),{path:{transform:this.rotationTransform}}}},{key:"viewBox",get:function(){return _classPrivateFieldGet(_bbox4,this).map(Outline.svgRound).join(" ")}},{key:"defaultProperties",get:function(){var _classPrivateFieldGet112=_classPrivateFieldGet(_bbox4,this),_classPrivateFieldGet112=babelHelpers.slicedToArray(_classPrivateFieldGet112,2),x=_classPrivateFieldGet112[0],_classPrivateFieldGet112=_classPrivateFieldGet112[1];return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(Outline.svgRound(x)," ").concat(Outline.svgRound(_classPrivateFieldGet112))}}}},{key:"rotationTransform",get:function(){var _classPrivateFieldGet114=_classPrivateFieldGet(_bbox4,this),_classPrivateFieldGet114=babelHelpers.slicedToArray(_classPrivateFieldGet114,4),width=_classPrivateFieldGet114[2],height=_classPrivateFieldGet114[3],a=0,b=0,c=0,d=0,e=0,f=0;switch(_classPrivateFieldGet(_currentRotation,this)){case 90:b=height/width,c=-width/height,e=width;break;case 180:d=a=-1,e=width,f=height;break;case 270:b=-height/width,c=width/height,f=height;break;default:return""}return"matrix(".concat(a," ").concat(b," ").concat(c," ").concat(d," ").concat(Outline.svgRound(e)," ").concat(Outline.svgRound(f),")")}},{key:"getPathResizingSVGProperties",value:function(_ref108){var tx,ty,_ref108=babelHelpers.slicedToArray(_ref108,4),newX=_ref108[0],newY=_ref108[1],newWidth=_ref108[2],_ref108=_ref108[3],_assertClassBrand$cal21=_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this),_assertClassBrand$cal21=babelHelpers.slicedToArray(_assertClassBrand$cal21,2),marginX=_assertClassBrand$cal21[0],_assertClassBrand$cal21=_assertClassBrand$cal21[1],_classPrivateFieldGet116=_classPrivateFieldGet(_bbox4,this),_classPrivateFieldGet116=babelHelpers.slicedToArray(_classPrivateFieldGet116,4),x=_classPrivateFieldGet116[0],y=_classPrivateFieldGet116[1],width=_classPrivateFieldGet116[2],_classPrivateFieldGet116=_classPrivateFieldGet116[3];return Math.abs(width-marginX)<=Outline.PRECISION||Math.abs(_classPrivateFieldGet116-_assertClassBrand$cal21)<=Outline.PRECISION?(tx=newX+newWidth/2-(x+width/2),ty=newY+_ref108/2-(y+_classPrivateFieldGet116/2),{path:{"transform-origin":"".concat(Outline.svgRound(newX)," ").concat(Outline.svgRound(newY)),transform:"".concat(this.rotationTransform," translate(").concat(tx," ").concat(ty,")")}}):(newX=(newWidth-2*marginX)/(width-2*marginX),newY=(_ref108-2*_assertClassBrand$cal21)/(_classPrivateFieldGet116-2*_assertClassBrand$cal21),tx=width/newWidth,ty=_classPrivateFieldGet116/_ref108,{path:{"transform-origin":"".concat(Outline.svgRound(x)," ").concat(Outline.svgRound(y)),transform:"".concat(this.rotationTransform," scale(").concat(tx," ").concat(ty,") ")+"translate(".concat(Outline.svgRound(marginX)," ").concat(Outline.svgRound(_assertClassBrand$cal21),") scale(").concat(newX," ").concat(newY,") ")+"translate(".concat(Outline.svgRound(-marginX)," ").concat(Outline.svgRound(-_assertClassBrand$cal21),")")}})}},{key:"getPathResizedSVGProperties",value:function(_ref110){var _ref110=babelHelpers.slicedToArray(_ref110,4),newX=_ref110[0],newY=_ref110[1],newWidth=_ref110[2],_ref110=_ref110[3],_assertClassBrand$cal23=_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this),_assertClassBrand$cal23=babelHelpers.slicedToArray(_assertClassBrand$cal23,2),marginX=_assertClassBrand$cal23[0],_assertClassBrand$cal23=_assertClassBrand$cal23[1],bbox=_classPrivateFieldGet(_bbox4,this),_bbox5=babelHelpers.slicedToArray(bbox,4),x=_bbox5[0],y=_bbox5[1],width=_bbox5[2],_bbox5=_bbox5[3];if(bbox[0]=newX,bbox[1]=newY,bbox[2]=newWidth,bbox[3]=_ref110,Math.abs(width-marginX)<=Outline.PRECISION||Math.abs(_bbox5-_assertClassBrand$cal23)<=Outline.PRECISION){var _step149,_tx=newX+newWidth/2-(x+width/2),_ty=newY+_ref110/2-(y+_bbox5/2),_iterator149=_createForOfIteratorHelper(_classPrivateFieldGet(_lines2,this));try{for(_iterator149.s();!(_step149=_iterator149.n()).done;){var _step149$value=_step149.value,line=_step149$value.line,points=_step149$value.points;Outline._translate(line,_tx,_ty,line),Outline._translate(points,_tx,_ty,points)}}catch(err){_iterator149.e(err)}finally{_iterator149.f()}}else{var s1x=(newWidth-2*marginX)/(width-2*marginX),s1y=(_ref110-2*_assertClassBrand$cal23)/(_bbox5-2*_assertClassBrand$cal23),tx=-s1x*(x+marginX)+newX+marginX,ty=-s1y*(y+_assertClassBrand$cal23)+newY+_assertClassBrand$cal23;if(1!=s1x||1!=s1y||0!==tx||0!==ty){var _step150,_iterator150=_createForOfIteratorHelper(_classPrivateFieldGet(_lines2,this));try{for(_iterator150.s();!(_step150=_iterator150.n()).done;){var _step150$value=_step150.value,_line3=_step150$value.line,_points4=_step150$value.points;Outline._rescale(_line3,tx,ty,s1x,s1y,_line3),Outline._rescale(_points4,tx,ty,s1x,s1y,_points4)}}catch(err){_iterator150.e(err)}finally{_iterator150.f()}}}return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(Outline.svgRound(newX)," ").concat(Outline.svgRound(newY)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}},{key:"getPathTranslatedSVGProperties",value:function(_ref112,parentDimensions){var _ref112=babelHelpers.slicedToArray(_ref112,2),newX=_ref112[0],_ref112=_ref112[1],parentDimensions=babelHelpers.slicedToArray(parentDimensions,2),newParentWidth=parentDimensions[0],parentDimensions=parentDimensions[1],bbox=_classPrivateFieldGet(_bbox4,this),tx=newX-bbox[0],ty=_ref112-bbox[1];if(_classPrivateFieldGet(_parentWidth3,this)===newParentWidth&&_classPrivateFieldGet(_parentHeight3,this)===parentDimensions){var _step151,_iterator151=_createForOfIteratorHelper(_classPrivateFieldGet(_lines2,this));try{for(_iterator151.s();!(_step151=_iterator151.n()).done;){var _step151$value=_step151.value,line=_step151$value.line,points=_step151$value.points;Outline._translate(line,tx,ty,line),Outline._translate(points,tx,ty,points)}}catch(err){_iterator151.e(err)}finally{_iterator151.f()}}else{var _step152,sx=_classPrivateFieldGet(_parentWidth3,this)/newParentWidth,sy=_classPrivateFieldGet(_parentHeight3,this)/parentDimensions,_iterator152=(_classPrivateFieldSet(_parentWidth3,this,newParentWidth),_classPrivateFieldSet(_parentHeight3,this,parentDimensions),_createForOfIteratorHelper(_classPrivateFieldGet(_lines2,this)));try{for(_iterator152.s();!(_step152=_iterator152.n()).done;){var _step152$value=_step152.value,_line4=_step152$value.line,_points5=_step152$value.points;Outline._rescale(_line4,tx,ty,sx,sy,_line4),Outline._rescale(_points5,tx,ty,sx,sy,_points5)}}catch(err){_iterator152.e(err)}finally{_iterator152.f()}bbox[2]*=sx,bbox[3]*=sy}return bbox[0]=newX,bbox[1]=_ref112,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":"".concat(Outline.svgRound(newX)," ").concat(Outline.svgRound(_ref112))}}}},{key:"defaultSVGProperties",get:function(){var bbox=_classPrivateFieldGet(_bbox4,this);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":"".concat(Outline.svgRound(bbox[0])," ").concat(Outline.svgRound(bbox[1])),transform:this.rotationTransform||null},bbox:bbox}}}],[{key:"deserialize",value:function(pageX,pageY,pageWidth,pageHeight,innerMargin,_ref114){var tx,ty,sx,sy,rescaleFn,_ref114$paths=_ref114.paths,lines=_ref114$paths.lines,points=_ref114$paths.points,_ref114$paths=_ref114.rotation,_ref114=_ref114.thickness,newLines=[];switch(_ref114$paths){case 0:rescaleFn=Outline._rescale,tx=-pageX/pageWidth,ty=pageY/pageHeight+1,sx=1/pageWidth,sy=-1/pageHeight;break;case 90:rescaleFn=Outline._rescaleAndSwap,tx=-pageY/pageHeight,ty=-pageX/pageWidth,sx=1/pageHeight,sy=1/pageWidth;break;case 180:rescaleFn=Outline._rescale,tx=pageX/pageWidth+1,ty=-pageY/pageHeight,sx=-1/pageWidth,sy=1/pageHeight;break;case 270:rescaleFn=Outline._rescaleAndSwap,tx=pageY/pageHeight+1,ty=pageX/pageWidth+1,sx=-1/pageHeight,sy=-1/pageWidth}if(!lines){var _step153,lines=[],_iterator153=_createForOfIteratorHelper(points);try{for(_iterator153.s();!(_step153=_iterator153.n()).done;){var point=_step153.value,len=point.length;if(2===len)lines.push(new Float32Array([NaN,NaN,NaN,NaN,point[0],point[1]]));else if(4===len)lines.push(new Float32Array([NaN,NaN,NaN,NaN,point[0],point[1],NaN,NaN,NaN,NaN,point[2],point[3]]));else{var line=new Float32Array(3*(len-2)),_point$subarray=(lines.push(line),point.subarray(0,4)),_point$subarray2=babelHelpers.slicedToArray(_point$subarray,4),x1=_point$subarray2[0],y1=_point$subarray2[1],x2=_point$subarray2[2],y2=_point$subarray2[3];line.set([NaN,NaN,NaN,NaN,x1,y1],0);for(var i=4;i<len;i+=2)var x=point[i],y=point[i+1],_ref115=(line.set(Outline.createBezierPoints(x1,y1,x2,y2,x,y),3*(i-2)),[x2,y2,x,y]),x1=_ref115[0],y1=_ref115[1],x2=_ref115[2],y2=_ref115[3]}}}catch(err){_iterator153.e(err)}finally{_iterator153.f()}}for(var _i27=0,ii=lines.length;_i27<ii;_i27++)newLines.push({line:rescaleFn(lines[_i27].map(function(x){return null!=x?x:NaN}),tx,ty,sx,sy),points:rescaleFn(points[_i27].map(function(x){return null!=x?x:NaN}),tx,ty,sx,sy)});var outlines=new this.prototype.constructor;return outlines.build(newLines,pageWidth,pageHeight,1,_ref114$paths,_ref114,innerMargin),outlines}}])}();function _getMarginComponents(){var thickness=0<arguments.length&&void 0!==arguments[0]?arguments[0]:_classPrivateFieldGet(_thickness4,this),thickness=_classPrivateFieldGet(_innerMargin3,this)+thickness/2*_classPrivateFieldGet(_parentScale,this);return _classPrivateFieldGet(_rotation7,this)%180==0?[thickness/_classPrivateFieldGet(_parentWidth3,this),thickness/_classPrivateFieldGet(_parentHeight3,this)]:[thickness/_classPrivateFieldGet(_parentHeight3,this),thickness/_classPrivateFieldGet(_parentWidth3,this)]}function _getBBoxWithNoMargin(){var _classPrivateFieldGet183=_classPrivateFieldGet(_bbox4,this),_classPrivateFieldGet183=babelHelpers.slicedToArray(_classPrivateFieldGet183,4),x=_classPrivateFieldGet183[0],y=_classPrivateFieldGet183[1],width=_classPrivateFieldGet183[2],_classPrivateFieldGet183=_classPrivateFieldGet183[3],_assertClassBrand$cal40=_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this,0),_assertClassBrand$cal40=babelHelpers.slicedToArray(_assertClassBrand$cal40,2),marginX=_assertClassBrand$cal40[0],_assertClassBrand$cal40=_assertClassBrand$cal40[1];return[x+marginX,y+_assertClassBrand$cal40,width-2*marginX,_classPrivateFieldGet183-2*_assertClassBrand$cal40]}function _computeBbox(){var _step194,bbox=_classPrivateFieldSet(_bbox4,this,new Float32Array([1/0,1/0,-1/0,-1/0])),_iterator194=_createForOfIteratorHelper(_classPrivateFieldGet(_lines2,this));try{for(_iterator194.s();!(_step194=_iterator194.n()).done;){var line=_step194.value.line;if(line.length<=12)for(var i=4,ii=line.length;i<ii;i+=6)Util.pointBoundingBox(line[i],line[i+1],bbox);else for(var lastX=line[4],lastY=line[5],_i33=6,_ii5=line.length;_i33<_ii5;_i33+=6){var _line$subarray=line.subarray(_i33,_i33+6),_line$subarray2=babelHelpers.slicedToArray(_line$subarray,6),c1x=_line$subarray2[0],c1y=_line$subarray2[1],c2x=_line$subarray2[2],c2y=_line$subarray2[3],x=_line$subarray2[4],y=_line$subarray2[5];Util.bezierBoundingBox(lastX,lastY,c1x,c1y,c2x,c2y,x,y,bbox),lastX=x,lastY=y}}}catch(err){_iterator194.e(err)}finally{_iterator194.f()}var _assertClassBrand$cal42=_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this),_assertClassBrand$cal42=babelHelpers.slicedToArray(_assertClassBrand$cal42,2),marginX=_assertClassBrand$cal42[0],_assertClassBrand$cal42=_assertClassBrand$cal42[1];bbox[0]=MathClamp(bbox[0]-marginX,0,1),bbox[1]=MathClamp(bbox[1]-_assertClassBrand$cal42,0,1),bbox[2]=MathClamp(bbox[2]+marginX,0,1),bbox[3]=MathClamp(bbox[3]+_assertClassBrand$cal42,0,1),bbox[2]-=bbox[0],bbox[3]-=bbox[1]}function _updateThickness2(thickness){var _assertClassBrand$cal44=_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this),_assertClassBrand$cal44=babelHelpers.slicedToArray(_assertClassBrand$cal44,2),oldMarginX=_assertClassBrand$cal44[0],_assertClassBrand$cal44=_assertClassBrand$cal44[1],thickness=(_classPrivateFieldSet(_thickness4,this,thickness),_assertClassBrand(_InkDrawOutline_brand,this,_getMarginComponents).call(this)),thickness=babelHelpers.slicedToArray(thickness,2),oldMarginX=thickness[0]-oldMarginX,thickness=thickness[1]-_assertClassBrand$cal44,_assertClassBrand$cal44=_classPrivateFieldGet(_bbox4,this);return _assertClassBrand$cal44[0]-=oldMarginX,_assertClassBrand$cal44[1]-=thickness,_assertClassBrand$cal44[2]+=2*oldMarginX,_assertClassBrand$cal44[3]+=2*thickness,_assertClassBrand$cal44}var InkDrawingOptions=function(){function InkDrawingOptions(viewerParameters){var _this94;return babelHelpers.classCallCheck(this,InkDrawingOptions),(_this94=_callSuper(this,InkDrawingOptions))._viewParameters=viewerParameters,_superPropGet(InkDrawingOptions,"updateProperties",_this94,3)([{fill:"none",stroke:AnnotationEditor._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10}]),_this94}return babelHelpers.inherits(InkDrawingOptions,DrawingOptions),babelHelpers.createClass(InkDrawingOptions,[{key:"updateSVGProperty",value:function(name,value){"stroke-width"===name&&(null==value&&(value=this["stroke-width"]),value*=this._viewParameters.realScale),_superPropGet(InkDrawingOptions,"updateSVGProperty",this,3)([name,value])}},{key:"clone",value:function(){var clone;return(clone=new InkDrawingOptions(this._viewParameters)).updateAll(this),clone}}])}(),_InkEditor_brand=new WeakSet,InkEditor=function(){function InkEditor(params){return babelHelpers.classCallCheck(this,InkEditor),_classPrivateMethodInitSpec(params=_callSuper(this,InkEditor,[_objectSpread({},params,{name:"inkEditor"})]),_InkEditor_brand),params._willKeepAspectRatio=!0,params.defaultL10nId="pdfjs-editor-ink-editor",params}return babelHelpers.inherits(InkEditor,DrawingEditor),babelHelpers.createClass(InkEditor,[{key:"onScaleChanging",value:function(){var _drawId,_drawingOptions,parent;this.parent&&(_superPropGet(InkEditor,"onScaleChanging",this,3)([]),_drawId=this._drawId,_drawingOptions=this._drawingOptions,parent=this.parent,_drawingOptions.updateSVGProperty("stroke-width"),parent.drawLayer.updateProperties(_drawId,_drawingOptions.toSVGProperties()))}},{key:"createDrawingOptions",value:function(_ref116){var color=_ref116.color,thickness=_ref116.thickness,_ref116=_ref116.opacity;this._drawingOptions=InkEditor.getDefaultDrawingOptions({stroke:Util.makeHexColor.apply(Util,babelHelpers.toConsumableArray(color)),"stroke-width":thickness,"stroke-opacity":_ref116})}},{key:"serialize",value:function(){var isForCopying=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();var _this$serializeDraw=this.serializeDraw(isForCopying),lines=_this$serializeDraw.lines,points=_this$serializeDraw.points,_this$serializeDraw=_this$serializeDraw.rect,_this$_drawingOptions=this._drawingOptions,stroke=_this$_drawingOptions.stroke,opacity=_this$_drawingOptions["stroke-opacity"],_this$_drawingOptions=_this$_drawingOptions["stroke-width"],stroke={annotationType:AnnotationEditorType.INK,color:AnnotationEditor._colorManager.convert(stroke),opacity:opacity,thickness:_this$_drawingOptions,paths:{lines:lines,points:points},pageIndex:this.pageIndex,rect:_this$serializeDraw,rotation:this.rotation,structTreeParentId:this._structTreeParentId};if(isForCopying)stroke.isCopy=!0;else{if(this.annotationElementId&&!_assertClassBrand(_InkEditor_brand,this,_hasElementChanged3).call(this,stroke))return null;stroke.id=this.annotationElementId}return stroke}},{key:"renderAnnotationElement",value:function(annotation){var _this$serializeDraw2=this.serializeDraw(!1),points=_this$serializeDraw2.points,_this$serializeDraw2=_this$serializeDraw2.rect;return annotation.updateEdited({rect:_this$serializeDraw2,thickness:this._drawingOptions["stroke-width"],points:points}),null}}],[{key:"initialize",value:function(l10n,uiManager){AnnotationEditor.initialize(l10n,uiManager),this._defaultDrawingOptions=new InkDrawingOptions(uiManager.viewParameters)}},{key:"getDefaultDrawingOptions",value:function(options){var clone=this._defaultDrawingOptions.clone();return clone.updateProperties(options),clone}},{key:"supportMultipleDrawings",get:function(){return!0}},{key:"typesMap",get:function(){return shadow(this,"typesMap",new Map([[AnnotationEditorParamsType.INK_THICKNESS,"stroke-width"],[AnnotationEditorParamsType.INK_COLOR,"stroke"],[AnnotationEditorParamsType.INK_OPACITY,"stroke-opacity"]]))}},{key:"createDrawerInstance",value:function(x,y,parentWidth,parentHeight,rotation){return new InkDrawOutliner(x,y,parentWidth,parentHeight,rotation,this._defaultDrawingOptions["stroke-width"])}},{key:"deserializeDraw",value:function(pageX,pageY,pageWidth,pageHeight,innerMargin,data){return InkDrawOutline.deserialize(pageX,pageY,pageWidth,pageHeight,innerMargin,data)}},{key:"deserialize",value:async function(data,parent,uiManager){var inkLists,rect,rotation,id,opacity,thickness,_data9$data,_data9,initialData=null,color=(data instanceof InkAnnotationElement&&(inkLists=(_data9$data=(_data9=data).data).inkLists,rect=_data9$data.rect,rotation=_data9$data.rotation,id=_data9$data.id,color=_data9$data.color,opacity=_data9$data.opacity,thickness=_data9$data.borderStyle.rawWidth,_data9$data=_data9$data.popupRef,_data9=_data9.parent.page.pageNumber,initialData=data={annotationType:AnnotationEditorType.INK,color:Array.from(color),thickness:thickness,opacity:opacity,paths:{points:inkLists},boxes:null,pageIndex:_data9-1,rect:rect.slice(0),rotation:rotation,annotationElementId:id,id:id,deleted:!1,popupRef:_data9$data}),await _superPropGet(InkEditor,"deserialize",this,2)([data,parent,uiManager]));return color._initialData=initialData,color}},{key:"onScaleChangingWhenDrawing",value:function(){var parent=this._currentParent;parent&&(_superPropGet(InkEditor,"onScaleChangingWhenDrawing",this,2)([]),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),parent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}}])}();function _hasElementChanged3(serialized){var _this$_initialData3=this._initialData,color=_this$_initialData3.color,thickness=_this$_initialData3.thickness,opacity=_this$_initialData3.opacity,_this$_initialData3=_this$_initialData3.pageIndex;return this._hasBeenMoved||this._hasBeenResized||serialized.color.some(function(c,i){return c!==color[i]})||serialized.thickness!==thickness||serialized.opacity!==opacity||serialized.pageIndex!==_this$_initialData3}babelHelpers.defineProperty(InkEditor,"_type","ink"),babelHelpers.defineProperty(InkEditor,"_editorType",AnnotationEditorType.INK),babelHelpers.defineProperty(InkEditor,"_defaultDrawingOptions",null);var ContourDrawOutline=function(){function ContourDrawOutline(){return babelHelpers.classCallCheck(this,ContourDrawOutline),_callSuper(this,ContourDrawOutline,arguments)}return babelHelpers.inherits(ContourDrawOutline,InkDrawOutline),babelHelpers.createClass(ContourDrawOutline,[{key:"toSVGPath",value:function(){var path=_superPropGet(ContourDrawOutline,"toSVGPath",this,3)([]);return path.endsWith("Z")||(path+="Z"),path}}])}(),SignatureExtractor=_exports.SignatureExtractor=function(){function SignatureExtractor(){babelHelpers.classCallCheck(this,SignatureExtractor)}return babelHelpers.createClass(SignatureExtractor,null,[{key:"extractContoursFromText",value:function(text,_ref117,pageWidth,pageHeight,rotation,innerMargin){var fontFamily=_ref117.fontFamily,fontStyle=_ref117.fontStyle,_ref117=_ref117.fontWeight,ctx=new OffscreenCanvas(1,1).getContext("2d",{alpha:!1}),fontStyle=ctx.font="".concat(fontStyle," ").concat(_ref117," ").concat(200,"px ").concat(fontFamily),_ref117=ctx.measureText(text),fontFamily=_ref117.actualBoundingBoxLeft,actualBoundingBoxRight=_ref117.actualBoundingBoxRight,actualBoundingBoxAscent=_ref117.actualBoundingBoxAscent,actualBoundingBoxDescent=_ref117.actualBoundingBoxDescent,fontBoundingBoxAscent=_ref117.fontBoundingBoxAscent,fontBoundingBoxDescent=_ref117.fontBoundingBoxDescent,_ref117=_ref117.width,fontFamily=Math.ceil(1.5*Math.max(Math.abs(fontFamily)+Math.abs(actualBoundingBoxRight)||0,_ref117)),actualBoundingBoxRight=Math.ceil(1.5*Math.max(Math.abs(actualBoundingBoxAscent)+Math.abs(actualBoundingBoxDescent)||200,Math.abs(fontBoundingBoxAscent)+Math.abs(fontBoundingBoxDescent)||200)),_ref117=((ctx=new OffscreenCanvas(fontFamily,actualBoundingBoxRight).getContext("2d",{alpha:!0,willReadFrequently:!0})).font=fontStyle,ctx.filter="grayscale(1)",ctx.fillStyle="white",ctx.fillRect(0,0,fontFamily,actualBoundingBoxRight),ctx.fillStyle="black",ctx.fillText(text,.5*fontFamily/2,1.5*actualBoundingBoxRight/2),_assertClassBrand(SignatureExtractor,this,_toUint).call(this,ctx.getImageData(0,0,fontFamily,actualBoundingBoxRight).data)),actualBoundingBoxAscent=_assertClassBrand(SignatureExtractor,this,_getHistogram).call(this,_ref117),actualBoundingBoxDescent=_assertClassBrand(SignatureExtractor,this,_guessThreshold).call(this,actualBoundingBoxAscent),fontBoundingBoxAscent=_assertClassBrand(SignatureExtractor,this,_findContours).call(this,_ref117,fontFamily,actualBoundingBoxRight,actualBoundingBoxDescent);return this.processDrawnLines({lines:{curves:fontBoundingBoxAscent,width:fontFamily,height:actualBoundingBoxRight},pageWidth:pageWidth,pageHeight:pageHeight,rotation:rotation,innerMargin:innerMargin,mustSmooth:!0,areContours:!0})}},{key:"process",value:function(bitmap,pageWidth,pageHeight,rotation,innerMargin){var bitmap=_assertClassBrand(SignatureExtractor,this,_getGrayPixels).call(this,bitmap),bitmap=babelHelpers.slicedToArray(bitmap,3),uint8Buf=bitmap[0],width=bitmap[1],bitmap=bitmap[2],uint8Buf=_assertClassBrand(SignatureExtractor,this,_bilateralFilter).call(this,uint8Buf,width,bitmap,Math.hypot(width,bitmap)*_assertClassBrand(SignatureExtractor,this,_PARAMETERS)._.sigmaSFactor,_assertClassBrand(SignatureExtractor,this,_PARAMETERS)._.sigmaR,_assertClassBrand(SignatureExtractor,this,_PARAMETERS)._.kernelSize),uint8Buf=babelHelpers.slicedToArray(uint8Buf,2),buffer=uint8Buf[0],uint8Buf=uint8Buf[1],uint8Buf=_assertClassBrand(SignatureExtractor,this,_guessThreshold).call(this,uint8Buf),buffer=_assertClassBrand(SignatureExtractor,this,_findContours).call(this,buffer,width,bitmap,uint8Buf);return this.processDrawnLines({lines:{curves:buffer,width:width,height:bitmap},pageWidth:pageWidth,pageHeight:pageHeight,rotation:rotation,innerMargin:innerMargin,mustSmooth:!0,areContours:!0})}},{key:"processDrawnLines",value:function(_ref118){var _step154,lines=_ref118.lines,pageWidth=_ref118.pageWidth,pageHeight=_ref118.pageHeight,rotation=_ref118.rotation,innerMargin=_ref118.innerMargin,mustSmooth=_ref118.mustSmooth,_ref118=_ref118.areContours,_ref119=(rotation%180!=0&&(pageWidth=(_ref119=[pageHeight,pageWidth])[0],pageHeight=_ref119[1]),lines.curves),width=lines.width,height=lines.height,lines=null!=(lines=lines.thickness)?lines:0,linesAndPoints=[],ratio=Math.min(pageWidth/width,pageHeight/height),xScale=ratio/pageWidth,yScale=ratio/pageHeight,newCurves=[],_iterator154=_createForOfIteratorHelper(_ref119);try{for(_iterator154.s();!(_step154=_iterator154.n()).done;){var points=_step154.value.points,reducedPoints=mustSmooth?_assertClassBrand(SignatureExtractor,this,_douglasPeucker).call(this,points):points;if(reducedPoints){newCurves.push(reducedPoints);var len=reducedPoints.length,newPoints=new Float32Array(len),line=new Float32Array(3*(2===len?2:len-2));if(linesAndPoints.push({line:line,points:newPoints}),2===len)newPoints[0]=reducedPoints[0]*xScale,newPoints[1]=reducedPoints[1]*yScale,line.set([NaN,NaN,NaN,NaN,newPoints[0],newPoints[1]],0);else{var _reducedPoints=babelHelpers.slicedToArray(reducedPoints,4),x1=_reducedPoints[0],y1=_reducedPoints[1],x2=_reducedPoints[2],y2=_reducedPoints[3];x1*=xScale,y1*=yScale,x2*=xScale,y2*=yScale,newPoints.set([x1,y1,x2,y2],0),line.set([NaN,NaN,NaN,NaN,x1,y1],0);for(var i=4;i<len;i+=2)var x=newPoints[i]=reducedPoints[i]*xScale,y=newPoints[i+1]=reducedPoints[i+1]*yScale,_ref120=(line.set(Outline.createBezierPoints(x1,y1,x2,y2,x,y),3*(i-2)),[x2,y2,x,y]),x1=_ref120[0],y1=_ref120[1],x2=_ref120[2],y2=_ref120[3]}}}}catch(err){_iterator154.e(err)}finally{_iterator154.f()}return 0===linesAndPoints.length?null:((ratio=new(_ref118?ContourDrawOutline:InkDrawOutline)).build(linesAndPoints,pageWidth,pageHeight,1,rotation,_ref118?0:lines,innerMargin),{outline:ratio,newCurves:newCurves,areContours:_ref118,thickness:lines,width:width,height:height})}},{key:"compressSignature",value:async function(_ref121){var _step155,outlines=_ref121.outlines,areContours=_ref121.areContours,thickness=_ref121.thickness,width=_ref121.width,_ref121=_ref121.height,minDiff=1/0,maxDiff=-1/0,outlinesLength=0,_iterator155=_createForOfIteratorHelper(outlines);try{for(_iterator155.s();!(_step155=_iterator155.n()).done;){var points=_step155.value;outlinesLength+=points.length;for(var i=2,ii=points.length;i<ii;i++)var dx=points[i]-points[i-2],minDiff=Math.min(minDiff,dx),maxDiff=Math.max(maxDiff,dx)}}catch(err){_iterator155.e(err)}finally{_iterator155.f()}var _step156,bufferType=-128<=minDiff&&maxDiff<=127?Int8Array:-32768<=minDiff&&maxDiff<=32767?Int16Array:Int32Array,len=outlines.length,headerLength=8+3*len,header=new Uint32Array(headerLength),offset=0,_iterator156=(header[offset++]=headerLength*Uint32Array.BYTES_PER_ELEMENT+(outlinesLength-2*len)*bufferType.BYTES_PER_ELEMENT,header[offset++]=0,header[offset++]=width,header[offset++]=_ref121,header[offset++]=areContours?0:1,header[offset++]=Math.max(0,Math.floor(null!=thickness?thickness:0)),header[offset++]=len,header[offset++]=bufferType.BYTES_PER_ELEMENT,_createForOfIteratorHelper(outlines));try{for(_iterator156.s();!(_step156=_iterator156.n()).done;){var _points6=_step156.value;header[offset++]=_points6.length-2,header[offset++]=_points6[0],header[offset++]=_points6[1]}}catch(err){_iterator156.e(err)}finally{_iterator156.f()}var _step157,headerLength=new CompressionStream("deflate-raw"),writer=headerLength.writable.getWriter(),BufferCtor=(await writer.ready,writer.write(header),bufferType.prototype.constructor),_iterator157=_createForOfIteratorHelper(outlines);try{for(_iterator157.s();!(_step157=_iterator157.n()).done;){for(var _points7=_step157.value,diffs=new BufferCtor(_points7.length-2),_i28=2,_ii4=_points7.length;_i28<_ii4;_i28++)diffs[_i28-2]=_points7[_i28]-_points7[_i28-2];writer.write(diffs)}}catch(err){_iterator157.e(err)}finally{_iterator157.f()}writer.close();width=await new Response(headerLength.readable).arrayBuffer();return toBase64Util(new Uint8Array(width))}},{key:"decompressSignature",value:async function(signatureData){try{str=signatureData;var _step158,bytes=Uint8Array.fromBase64?Uint8Array.fromBase64(str):stringToBytes(atob(str)),_DecompressionStream=new DecompressionStream("deflate-raw"),readable=_DecompressionStream.readable,writer=_DecompressionStream.writable.getWriter(),data=(await writer.ready,writer.write(bytes).then(async function(){await writer.ready,await writer.close()}).catch(function(){}),null),offset=0,_iterator158=_createForOfIteratorHelper(readable);try{for(_iterator158.s();!(_step158=_iterator158.n()).done;){var chunk=_step158.value;(data=data||new Uint8Array(new Uint32Array(chunk.buffer,0,4)[0])).set(chunk,offset),offset+=chunk.length}}catch(err){_iterator158.e(err)}finally{_iterator158.f()}var header=new Uint32Array(data.buffer,0,data.length>>2),_version=header[1];if(0!==_version)throw new Error("Invalid version: ".concat(_version));var diffs,width=header[2],height=header[3],areContours=0===header[4],thickness=header[5],numberOfDrawings=header[6],bufferType=header[7],outlines=[],diffsOffset=(8+3*numberOfDrawings)*Uint32Array.BYTES_PER_ELEMENT;switch(bufferType){case Int8Array.BYTES_PER_ELEMENT:diffs=new Int8Array(data.buffer,diffsOffset);break;case Int16Array.BYTES_PER_ELEMENT:diffs=new Int16Array(data.buffer,diffsOffset);break;case Int32Array.BYTES_PER_ELEMENT:diffs=new Int32Array(data.buffer,diffsOffset)}for(var offset=0,i=0;i<numberOfDrawings;i++){var len=header[3*i+8],points=new Float32Array(len+2);outlines.push(points);for(var j=0;j<2;j++)points[j]=header[3*i+8+j+1];for(var _j2=0;_j2<len;_j2++)points[_j2+2]=points[_j2]+diffs[offset++]}return{areContours:areContours,thickness:thickness,outlines:outlines,width:width,height:height}}catch(e){return warn("decompressSignature: ".concat(e)),null}var str}}])}();function _neighborIndexToId(i0,j0,i,j){return j-=j0,0===(i-=i0)?0<j?0:4:1===i?j+6:2-j}function _clockwiseNonZero(buf,width,i0,j0,i,j,offset){for(var id=_assertClassBrand(_SignatureExtractor,this,_neighborIndexToId).call(this,i0,j0,i,j),k=0;k<8;k++){var kk=(-k+id-offset+16)%8;if(0!==buf[(i0+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*kk])*width+(j0+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*kk+1])])return kk}return-1}function _counterClockwiseNonZero(buf,width,i0,j0,i,j,offset){for(var id=_assertClassBrand(_SignatureExtractor,this,_neighborIndexToId).call(this,i0,j0,i,j),k=0;k<8;k++){var kk=(k+id+offset+16)%8;if(0!==buf[(i0+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*kk])*width+(j0+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*kk+1])])return kk}return-1}function _findContours(buf,width,height,threshold){for(var N=buf.length,types=new Int32Array(N),i=0;i<N;i++)types[i]=buf[i]<=threshold?1:0;for(var _i34=1;_i34<height-1;_i34++)types[_i34*width]=types[_i34*width+width-1]=0;for(var _i35=0;_i35<width;_i35++)types[_i35]=types[width*height-1-_i35]=0;for(var nbd=1,contours=[],_i36=1;_i36<height-1;_i36++)for(var lnbd=1,j=1;j<width-1;j++){var ij=_i36*width+j,pix=types[ij];if(0!==pix){var i2=_i36,j2=j;if(1===pix&&0===types[ij-1])nbd+=1,--j2;else{if(!(1<=pix&&0===types[ij+1])){1!==pix&&(lnbd=Math.abs(pix));continue}nbd+=1,j2+=1,1<pix&&(lnbd=pix)}var _step195,points=[j,_i36],pix=j2===j+1,contour={isHole:pix,points:points,id:nbd,parent:0},contour0=(contours.push(contour),void 0),_iterator195=_createForOfIteratorHelper(contours);try{for(_iterator195.s();!(_step195=_iterator195.n()).done;){var c=_step195.value;if(c.id===lnbd){contour0=c;break}}}catch(err){_iterator195.e(err)}finally{_iterator195.f()}contour0?contour0.isHole?contour.parent=pix?contour0.parent:lnbd:contour.parent=pix?lnbd:contour0.parent:contour.parent=pix?lnbd:0;contour=_assertClassBrand(_SignatureExtractor,this,_clockwiseNonZero).call(this,types,width,_i36,j,i2,j2,0);if(-1===contour)types[ij]=-nbd,1!==types[ij]&&(lnbd=Math.abs(types[ij]));else for(var i1=_i36+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*contour],j1=j+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*contour+1],i2=i1,j2=j1,i3=_i36,j3=j;;){var kk=_assertClassBrand(_SignatureExtractor,this,_counterClockwiseNonZero).call(this,types,width,i3,j3,i2,j2,1),i4=i3+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*kk],kk=j3+_assertClassBrand(_SignatureExtractor,this,_neighborIdToIndex)._[2*kk+1],ij3=(points.push(kk,i4),i3*width+j3);if(0===types[ij3+1]?types[ij3]=-nbd:1===types[ij3]&&(types[ij3]=nbd),i4===_i36&&kk===j&&i3===i1&&j3===j1){1!==types[ij]&&(lnbd=Math.abs(types[ij]));break}i2=i3,j2=j3,i3=i4,j3=kk}}}return contours}function _douglasPeuckerHelper(points,start,end,output){if(end-start<=4)for(var i=start;i<end-2;i+=2)output.push(points[i],points[i+1]);else{for(var ax=points[start],ay=points[start+1],abx=points[end-4]-ax,aby=points[end-3]-ay,dist=Math.hypot(abx,aby),nabx=abx/dist,naby=aby/dist,aa=nabx*ay-naby*ax,invS=1/dist,aby=Math.atan(aby/abx),abx=Math.cos(aby),aby=Math.sin(aby),tmax=invS*(Math.abs(abx)+Math.abs(aby)),invS=invS*(1-tmax+Math.pow(tmax,2)),tmax=Math.max(Math.atan(Math.abs(aby+abx)*invS),Math.atan(Math.abs(aby-abx)*invS)),dmax=0,index=start,_i37=start+2;_i37<end-2;_i37+=2){var d=Math.abs(aa-nabx*points[_i37+1]+naby*points[_i37]);dmax<d&&(index=_i37,dmax=d)}dmax>Math.pow(dist*tmax,2)?(_assertClassBrand(_SignatureExtractor,this,_douglasPeuckerHelper).call(this,points,start,index+2,output),_assertClassBrand(_SignatureExtractor,this,_douglasPeuckerHelper).call(this,points,index,end,output)):output.push(ax,ay)}}function _douglasPeucker(points){var output=[],len=points.length;return _assertClassBrand(_SignatureExtractor,this,_douglasPeuckerHelper).call(this,points,0,len,output),output.push(points[len-2],points[len-1]),output.length<=4?null:output}function _bilateralFilter(buf,width,height,sigmaS,sigmaR,kernelSize){for(var kernel=new Float32Array(Math.pow(kernelSize,2)),sigmaS2=-2*Math.pow(sigmaS,2),halfSize=kernelSize>>1,i=0;i<kernelSize;i++)for(var x=Math.pow(i-halfSize,2),j=0;j<kernelSize;j++)kernel[i*kernelSize+j]=Math.exp((x+Math.pow(j-halfSize,2))/sigmaS2);for(var rangeValues=new Float32Array(256),sigmaR2=-2*Math.pow(sigmaR,2),_i38=0;_i38<256;_i38++)rangeValues[_i38]=Math.exp(Math.pow(_i38,2)/sigmaR2);for(var sigmaS=buf.length,out=new Uint8Array(sigmaS),histogram=new Uint32Array(256),_i39=0;_i39<height;_i39++)for(var _j3=0;_j3<width;_j3++){for(var ij=_i39*width+_j3,center=buf[ij],sum=0,norm=0,k=0;k<kernelSize;k++){var y=_i39+k-halfSize;if(!(y<0||height<=y))for(var l=0;l<kernelSize;l++){var _x8=_j3+l-halfSize;_x8<0||width<=_x8||(sum+=(_x8=buf[y*width+_x8])*(_x8=kernel[k*kernelSize+l]*rangeValues[Math.abs(_x8-center)]),norm+=_x8)}}histogram[out[ij]=Math.round(sum/norm)]++}return[out,histogram]}function _getHistogram(buf){var _step196,histogram=new Uint32Array(256),_iterator196=_createForOfIteratorHelper(buf);try{for(_iterator196.s();!(_step196=_iterator196.n()).done;)histogram[_step196.value]++}catch(err){_iterator196.e(err)}finally{_iterator196.f()}return histogram}function _toUint(buf){for(var pix,N=buf.length,out=new Uint8ClampedArray(N>>2),max=-1/0,min=1/0,i=0,ii=out.length;i<ii;i++)0===buf[3+(i<<2)]?max=out[i]=255:(max<(pix=out[i]=buf[i<<2])&&(max=pix),pix<min&&(min=pix));for(var ratio=255/(max-min),_i40=0;_i40<N;_i40++)out[_i40]=(out[_i40]-min)*ratio;return out}function _guessThreshold(histogram){for(var M=-1/0,L=-1/0,min=histogram.findIndex(function(v){return 0!==v}),pos=min,spos=min,i=min;i<256;i++){var v=histogram[i];M<v&&(L<i-pos&&(L=i-pos,spos=i-1),M=v,pos=i)}for(i=spos-1;0<=i&&!(histogram[i]>histogram[i+1]);i--);return i}function _getGrayPixels(bitmap){var originalBitmap=bitmap,_bitmap3=bitmap,width=_bitmap3.width,_bitmap3=_bitmap3.height,maxDim=_assertClassBrand(_SignatureExtractor,this,_PARAMETERS)._.maxDim,newWidth=width,newHeight=_bitmap3;if(maxDim<width||maxDim<_bitmap3){for(var prevWidth=width,prevHeight=_bitmap3,steps=Math.log2(Math.max(width,_bitmap3)/maxDim),width=Math.floor(steps),steps=steps===width?width-1:width,i=0;i<steps;i++){var newWidth=Math.ceil(prevWidth/2),newHeight=Math.ceil(prevHeight/2),_offscreen=new OffscreenCanvas(newWidth,newHeight);_offscreen.getContext("2d").drawImage(bitmap,0,0,prevWidth,prevHeight,0,0,newWidth,newHeight),prevWidth=newWidth,prevHeight=newHeight,bitmap!==originalBitmap&&bitmap.close(),bitmap=_offscreen.transferToImageBitmap()}_bitmap3=Math.min(maxDim/newWidth,maxDim/newHeight);newWidth=Math.round(newWidth*_bitmap3),newHeight=Math.round(newHeight*_bitmap3)}width=new OffscreenCanvas(newWidth,newHeight).getContext("2d",{willReadFrequently:!0}),width.filter="grayscale(1)",width.drawImage(bitmap,0,0,bitmap.width,bitmap.height,0,0,newWidth,newHeight),maxDim=width.getImageData(0,0,newWidth,newHeight).data;return[_assertClassBrand(_SignatureExtractor,this,_toUint).call(this,maxDim),newWidth,newHeight]}var _SignatureExtractor=SignatureExtractor,_PARAMETERS={_:{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}},_neighborIdToIndex={_:new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])},SignatureOptions=function(){function SignatureOptions(){var _this96;return babelHelpers.classCallCheck(this,SignatureOptions),_superPropGet(SignatureOptions,"updateProperties",_this96=_callSuper(this,SignatureOptions),3)([{fill:AnnotationEditor._defaultLineColor,"stroke-width":0}]),_this96}return babelHelpers.inherits(SignatureOptions,DrawingOptions),babelHelpers.createClass(SignatureOptions,[{key:"clone",value:function(){var clone;return(clone=new SignatureOptions).updateAll(this),clone}}])}(),DrawnSignatureOptions=function(_InkDrawingOptions){function DrawnSignatureOptions(viewerParameters){return babelHelpers.classCallCheck(this,DrawnSignatureOptions),_superPropGet(DrawnSignatureOptions,"updateProperties",viewerParameters=_callSuper(this,DrawnSignatureOptions,[viewerParameters]),3)([{stroke:AnnotationEditor._defaultLineColor,"stroke-width":1}]),viewerParameters}return babelHelpers.inherits(DrawnSignatureOptions,_InkDrawingOptions),babelHelpers.createClass(DrawnSignatureOptions,[{key:"clone",value:function(){var clone;return(clone=new DrawnSignatureOptions(this._viewParameters)).updateAll(this),clone}}])}(InkDrawingOptions),_isExtracted=new WeakMap,_description=new WeakMap,_signatureData=new WeakMap,_signatureUUID=new WeakMap,SignatureEditor=function(){function SignatureEditor(params){var _this98;return babelHelpers.classCallCheck(this,SignatureEditor),_classPrivateFieldInitSpec(_this98=_callSuper(this,SignatureEditor,[_objectSpread({},params,{mustBeCommitted:!0,name:"signatureEditor"})]),_isExtracted,!1),_classPrivateFieldInitSpec(_this98,_description,null),_classPrivateFieldInitSpec(_this98,_signatureData,null),_classPrivateFieldInitSpec(_this98,_signatureUUID,null),_this98._willKeepAspectRatio=!0,_classPrivateFieldSet(_signatureData,_this98,params.signatureData||null),_classPrivateFieldSet(_description,_this98,null),_this98.defaultL10nId="pdfjs-editor-signature-editor1",_this98}return babelHelpers.inherits(SignatureEditor,DrawingEditor),babelHelpers.createClass(SignatureEditor,[{key:"telemetryFinalData",get:function(){return{type:"signature",hasDescription:!!_classPrivateFieldGet(_description,this)}}},{key:"isResizable",get:function(){return!0}},{key:"onScaleChanging",value:function(){null!==this._drawId&&_superPropGet(SignatureEditor,"onScaleChanging",this,3)([])}},{key:"render",value:function(){var baseX,baseY,_isCopy,mustSmooth,areContours,description,uuid,_classPrivateFieldGet118,pageWidth,_this$parent$viewport5,_this$parent$viewport4,lines;return this.div||((_isCopy=this._isCopy)&&(this._isCopy=!1,baseX=this.x,baseY=this.y),_superPropGet(SignatureEditor,"render",this,3)([]),null===this._drawId&&(_classPrivateFieldGet(_signatureData,this)?(lines=(_classPrivateFieldGet118=_classPrivateFieldGet(_signatureData,this)).lines,mustSmooth=_classPrivateFieldGet118.mustSmooth,areContours=_classPrivateFieldGet118.areContours,description=_classPrivateFieldGet118.description,uuid=_classPrivateFieldGet118.uuid,_classPrivateFieldGet118=_classPrivateFieldGet118.heightInPage,pageWidth=(_this$parent$viewport5=(_this$parent$viewport4=this.parent.viewport).rawDims).pageWidth,_this$parent$viewport5=_this$parent$viewport5.pageHeight,_this$parent$viewport4=_this$parent$viewport4.rotation,lines=SignatureExtractor.processDrawnLines({lines:lines,pageWidth:pageWidth,pageHeight:_this$parent$viewport5,rotation:_this$parent$viewport4,innerMargin:SignatureEditor._INNER_MARGIN,mustSmooth:mustSmooth,areContours:areContours}),this.addSignature(lines,_classPrivateFieldGet118,description,uuid)):(this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this))),_isCopy&&(this._isCopy=!0,this._moveAfterPaste(baseX,baseY))),this.div}},{key:"setUuid",value:function(uuid){_classPrivateFieldSet(_signatureUUID,this,uuid),this.addEditToolbar()}},{key:"getUuid",value:function(){return _classPrivateFieldGet(_signatureUUID,this)}},{key:"description",get:function(){return _classPrivateFieldGet(_description,this)},set:function(description){_classPrivateFieldSet(_description,this,description),_superPropGet(SignatureEditor,"addEditToolbar",this,3)([]).then(function(toolbar){null!=toolbar&&toolbar.updateEditSignatureButton(description)})}},{key:"getSignaturePreview",value:function(){var _classPrivateFieldGet119=_classPrivateFieldGet(_signatureData,this),newCurves=_classPrivateFieldGet119.newCurves,areContours=_classPrivateFieldGet119.areContours,thickness=_classPrivateFieldGet119.thickness,width=_classPrivateFieldGet119.width,_classPrivateFieldGet119=_classPrivateFieldGet119.height,maxDim=Math.max(width,_classPrivateFieldGet119);return{areContours:areContours,outline:SignatureExtractor.processDrawnLines({lines:{curves:newCurves.map(function(points){return{points:points}}),thickness:thickness,width:width,height:_classPrivateFieldGet119},pageWidth:maxDim,pageHeight:maxDim,rotation:0,innerMargin:0,mustSmooth:!1,areContours:areContours}).outline}}},{key:"toolbarButtons",get:function(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:_superPropGet(SignatureEditor,"toolbarButtons",this,1)}},{key:"addSignature",value:function(data,heightInPage,description,uuid){var savedX=this.x,savedY=this.y,data=_classPrivateFieldSet(_signatureData,this,data).outline,data=(_classPrivateFieldSet(_isExtracted,this,data instanceof ContourDrawOutline),this.description=description,this.div.setAttribute("data-l10n-args",JSON.stringify({description:description})),_classPrivateFieldGet(_isExtracted,this)?drawingOptions=SignatureEditor.getDefaultDrawingOptions():(drawingOptions=SignatureEditor._defaultDrawnSignatureOptions.clone()).updateProperties({"stroke-width":data.thickness}),this._addOutlines({drawOutlines:data,drawingOptions:drawingOptions}),babelHelpers.slicedToArray(this.parentDimensions,2)),drawingOptions=data[0],data=data[1],heightInPage=1<=(heightInPage=heightInPage/babelHelpers.slicedToArray(this.pageDimensions,2)[1])?.5:heightInPage;this.width*=heightInPage/this.height,1<=this.width&&(heightInPage*=.9/this.width,this.width=.9),this.height=heightInPage,this.setDims(drawingOptions*this.width,data*this.height),this.x=savedX,this.y=savedY,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(uuid),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!uuid,hasDescription:!!description}}),this.div.hidden=!1}},{key:"getFromImage",value:function(bitmap){var _this$parent$viewport6=this.parent.viewport,_this$parent$viewport7=_this$parent$viewport6.rawDims,pageWidth=_this$parent$viewport7.pageWidth,_this$parent$viewport7=_this$parent$viewport7.pageHeight,_this$parent$viewport6=_this$parent$viewport6.rotation;return SignatureExtractor.process(bitmap,pageWidth,_this$parent$viewport7,_this$parent$viewport6,SignatureEditor._INNER_MARGIN)}},{key:"getFromText",value:function(text,fontInfo){var _this$parent$viewport8=this.parent.viewport,_this$parent$viewport9=_this$parent$viewport8.rawDims,pageWidth=_this$parent$viewport9.pageWidth,_this$parent$viewport9=_this$parent$viewport9.pageHeight,_this$parent$viewport8=_this$parent$viewport8.rotation;return SignatureExtractor.extractContoursFromText(text,fontInfo,pageWidth,_this$parent$viewport9,_this$parent$viewport8,SignatureEditor._INNER_MARGIN)}},{key:"getDrawnSignature",value:function(curves){var _this$parent$viewport0=this.parent.viewport,_this$parent$viewport1=_this$parent$viewport0.rawDims,pageWidth=_this$parent$viewport1.pageWidth,_this$parent$viewport1=_this$parent$viewport1.pageHeight,_this$parent$viewport0=_this$parent$viewport0.rotation;return SignatureExtractor.processDrawnLines({lines:curves,pageWidth:pageWidth,pageHeight:_this$parent$viewport1,rotation:_this$parent$viewport0,innerMargin:SignatureEditor._INNER_MARGIN,mustSmooth:!1,areContours:!1})}},{key:"createDrawingOptions",value:function(_ref122){var areContours=_ref122.areContours,_ref122=_ref122.thickness;areContours?this._drawingOptions=SignatureEditor.getDefaultDrawingOptions():(this._drawingOptions=SignatureEditor._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":_ref122}))}},{key:"serialize",value:function(){var lines,points,_this$serializeDraw3,thickness,isForCopying=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this.isEmpty()?null:(lines=(_this$serializeDraw3=this.serializeDraw(isForCopying)).lines,points=_this$serializeDraw3.points,_this$serializeDraw3=_this$serializeDraw3.rect,thickness=this._drawingOptions["stroke-width"],thickness={annotationType:AnnotationEditorType.SIGNATURE,isSignature:!0,areContours:_classPrivateFieldGet(_isExtracted,this),color:[0,0,0],thickness:_classPrivateFieldGet(_isExtracted,this)?0:thickness,pageIndex:this.pageIndex,rect:_this$serializeDraw3,rotation:this.rotation,structTreeParentId:this._structTreeParentId},isForCopying?(thickness.paths={lines:lines,points:points},thickness.uuid=_classPrivateFieldGet(_signatureUUID,this),thickness.isCopy=!0):thickness.lines=lines,_classPrivateFieldGet(_description,this)&&(thickness.accessibilityData={type:"Figure",alt:_classPrivateFieldGet(_description,this)}),thickness)}}],[{key:"initialize",value:function(l10n,uiManager){AnnotationEditor.initialize(l10n,uiManager),this._defaultDrawingOptions=new SignatureOptions,this._defaultDrawnSignatureOptions=new DrawnSignatureOptions(uiManager.viewParameters)}},{key:"getDefaultDrawingOptions",value:function(options){var clone=this._defaultDrawingOptions.clone();return clone.updateProperties(options),clone}},{key:"supportMultipleDrawings",get:function(){return!1}},{key:"typesMap",get:function(){return shadow(this,"typesMap",new Map)}},{key:"isDrawer",get:function(){return!1}},{key:"computeTelemetryFinalData",value:function(data){var _hasDescriptionStats$,data=data.get("hasDescription");return{hasAltText:null!=(_hasDescriptionStats$=data.get(!0))?_hasDescriptionStats$:0,hasNoAltText:null!=(_hasDescriptionStats$=data.get(!1))?_hasDescriptionStats$:0}}},{key:"deserializeDraw",value:function(pageX,pageY,pageWidth,pageHeight,innerMargin,data){return(data.areContours?ContourDrawOutline:InkDrawOutline).deserialize(pageX,pageY,pageWidth,pageHeight,innerMargin,data)}},{key:"deserialize",value:async function(data,parent,uiManager){parent=await _superPropGet(SignatureEditor,"deserialize",this,2)([data,parent,uiManager]);return _classPrivateFieldSet(_isExtracted,parent,data.areContours),_classPrivateFieldSet(_description,parent,(null==(uiManager=data.accessibilityData)?void 0:uiManager.alt)||""),_classPrivateFieldSet(_signatureUUID,parent,data.uuid),parent}}])}(),_bitmap=(babelHelpers.defineProperty(SignatureEditor,"_type","signature"),babelHelpers.defineProperty(SignatureEditor,"_editorType",AnnotationEditorType.SIGNATURE),babelHelpers.defineProperty(SignatureEditor,"_defaultDrawingOptions",null),new WeakMap),_bitmapId=new WeakMap,_bitmapPromise=new WeakMap,_bitmapUrl=new WeakMap,_bitmapFile=new WeakMap,_bitmapFileName=new WeakMap,_canvas=new WeakMap,_missingCanvas=new WeakMap,_resizeTimeoutId=new WeakMap,_isSvg=new WeakMap,_hasBeenAddedInUndoStack=new WeakMap,_StampEditor_brand=new WeakSet,StampEditor=function(_AnnotationEditor6){function StampEditor(params){var _this99;return babelHelpers.classCallCheck(this,StampEditor),_classPrivateMethodInitSpec(_this99=_callSuper(this,StampEditor,[_objectSpread({},params,{name:"stampEditor"})]),_StampEditor_brand),_classPrivateFieldInitSpec(_this99,_bitmap,null),_classPrivateFieldInitSpec(_this99,_bitmapId,null),_classPrivateFieldInitSpec(_this99,_bitmapPromise,null),_classPrivateFieldInitSpec(_this99,_bitmapUrl,null),_classPrivateFieldInitSpec(_this99,_bitmapFile,null),_classPrivateFieldInitSpec(_this99,_bitmapFileName,""),_classPrivateFieldInitSpec(_this99,_canvas,null),_classPrivateFieldInitSpec(_this99,_missingCanvas,!1),_classPrivateFieldInitSpec(_this99,_resizeTimeoutId,null),_classPrivateFieldInitSpec(_this99,_isSvg,!1),_classPrivateFieldInitSpec(_this99,_hasBeenAddedInUndoStack,!1),_classPrivateFieldSet(_bitmapUrl,_this99,params.bitmapUrl),_classPrivateFieldSet(_bitmapFile,_this99,params.bitmapFile),_this99.defaultL10nId="pdfjs-editor-stamp-editor",_this99}return babelHelpers.inherits(StampEditor,_AnnotationEditor6),babelHelpers.createClass(StampEditor,[{key:"altTextFinish",value:function(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),_superPropGet(StampEditor,"altTextFinish",this,3)([])}},{key:"telemetryFinalData",get:function(){var _this$altTextData;return{type:"stamp",hasAltText:!(null==(_this$altTextData=this.altTextData)||!_this$altTextData.altText)}}},{key:"mlGuessAltText",value:async function(){var imageData=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,updateAltTextData=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;var mlManager=this._uiManager.mlManager;if(!mlManager)throw new Error("No ML.");if(!await mlManager.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");var imageData=imageData||this.copyCanvas(null,null,!0).imageData,data=imageData.data,width=imageData.width,imageData=imageData.height,mlManager=await mlManager.guess({name:"altText",request:{data:data,width:width,height:imageData,channels:data.length/(width*imageData)}});if(!mlManager)throw new Error("No response from the AI service.");if(mlManager.error)throw new Error("Error from the AI service.");if(mlManager.cancel)return null;if(mlManager.output)return data=mlManager.output,await this.setGuessedAltText(data),updateAltTextData&&!this.hasAltTextData()&&(this.altTextData={alt:data,decorative:!1}),data;throw new Error("No valid response from the AI service.")}},{key:"remove",value:function(){var _classPrivateFieldGet120;_classPrivateFieldGet(_bitmapId,this)&&(_classPrivateFieldSet(_bitmap,this,null),this._uiManager.imageManager.deleteId(_classPrivateFieldGet(_bitmapId,this)),null!=(_classPrivateFieldGet120=_classPrivateFieldGet(_canvas,this))&&_classPrivateFieldGet120.remove(),_classPrivateFieldSet(_canvas,this,null),_classPrivateFieldGet(_resizeTimeoutId,this))&&(clearTimeout(_classPrivateFieldGet(_resizeTimeoutId,this)),_classPrivateFieldSet(_resizeTimeoutId,this,null)),_superPropGet(StampEditor,"remove",this,3)([])}},{key:"rebuild",value:function(){this.parent?(_superPropGet(StampEditor,"rebuild",this,3)([]),null===this.div||(_classPrivateFieldGet(_bitmapId,this)&&null===_classPrivateFieldGet(_canvas,this)&&_assertClassBrand(_StampEditor_brand,this,_getBitmap).call(this),this.isAttachedToDOM)||this.parent.add(this)):_classPrivateFieldGet(_bitmapId,this)&&_assertClassBrand(_StampEditor_brand,this,_getBitmap).call(this)}},{key:"onceAdded",value:function(focus){this._isDraggable=!0,focus&&this.div.focus()}},{key:"isEmpty",value:function(){return!(_classPrivateFieldGet(_bitmapPromise,this)||_classPrivateFieldGet(_bitmap,this)||_classPrivateFieldGet(_bitmapUrl,this)||_classPrivateFieldGet(_bitmapFile,this)||_classPrivateFieldGet(_bitmapId,this)||_classPrivateFieldGet(_missingCanvas,this))}},{key:"toolbarButtons",get:function(){return[["altText",this.createAltText()]]}},{key:"isResizable",get:function(){return!0}},{key:"render",value:function(){var baseX,baseY;return this.div||(this._isCopy&&(baseX=this.x,baseY=this.y),_superPropGet(StampEditor,"render",this,3)([]),this.div.hidden=!0,this.createAltText(),_classPrivateFieldGet(_missingCanvas,this)||(_classPrivateFieldGet(_bitmap,this)?_assertClassBrand(_StampEditor_brand,this,_createCanvas2):_assertClassBrand(_StampEditor_brand,this,_getBitmap)).call(this),this._isCopy&&this._moveAfterPaste(baseX,baseY),this._uiManager.addShouldRescale(this)),this.div}},{key:"setCanvas",value:function(annotationElementId,canvas){var annotationElementId=this._uiManager.imageManager.getFromCanvas(annotationElementId,canvas),bitmapId=annotationElementId.id,annotationElementId=annotationElementId.bitmap;canvas.remove(),bitmapId&&this._uiManager.imageManager.isValidId(bitmapId)&&(_classPrivateFieldSet(_bitmapId,this,bitmapId),annotationElementId&&_classPrivateFieldSet(_bitmap,this,annotationElementId),_classPrivateFieldSet(_missingCanvas,this,!1),_assertClassBrand(_StampEditor_brand,this,_createCanvas2).call(this))}},{key:"_onResized",value:function(){this.onScaleChanging()}},{key:"onScaleChanging",value:function(){var _this100=this;this.parent&&(null!==_classPrivateFieldGet(_resizeTimeoutId,this)&&clearTimeout(_classPrivateFieldGet(_resizeTimeoutId,this)),_classPrivateFieldSet(_resizeTimeoutId,this,setTimeout(function(){_classPrivateFieldSet(_resizeTimeoutId,_this100,null),_assertClassBrand(_StampEditor_brand,_this100,_drawBitmap).call(_this100)},200)))}},{key:"copyCanvas",value:function(maxDataDimension,maxPreviewDimension){var ratio,scaledHeight,ctx,boxDimWidth,boxDimHeight,pattern,black,dataWidth,dataHeight,patternCtx,createImageData=2<arguments.length&&void 0!==arguments[2]&&arguments[2],_classPrivateFieldGet121=(maxDataDimension=maxDataDimension||224,_classPrivateFieldGet(_bitmap,this)),bitmapWidth=_classPrivateFieldGet121.width,_classPrivateFieldGet121=_classPrivateFieldGet121.height,outputScale=new OutputScale,bitmap=_classPrivateFieldGet(_bitmap,this),width=bitmapWidth,height=_classPrivateFieldGet121,canvas=null,white=(maxPreviewDimension&&((maxPreviewDimension<bitmapWidth||maxPreviewDimension<_classPrivateFieldGet121)&&(ratio=Math.min(maxPreviewDimension/bitmapWidth,maxPreviewDimension/_classPrivateFieldGet121),width=Math.floor(bitmapWidth*ratio),height=Math.floor(_classPrivateFieldGet121*ratio)),ratio=(canvas=document.createElement("canvas")).width=Math.ceil(width*outputScale.sx),scaledHeight=canvas.height=Math.ceil(height*outputScale.sy),_classPrivateFieldGet(_isSvg,this)||(bitmap=_assertClassBrand(_StampEditor_brand,this,_scaleBitmap).call(this,ratio,scaledHeight)),(ctx=canvas.getContext("2d")).filter=this._uiManager.hcmFilter,white="white",black="#cfcfd8","none"!==this._uiManager.hcmFilter?black="black":null!=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(white="#8f8f9d",black="#42414d"),boxDimWidth=15*outputScale.sx,boxDimHeight=15*outputScale.sy,(patternCtx=(pattern=new OffscreenCanvas(2*boxDimWidth,2*boxDimHeight)).getContext("2d")).fillStyle=white,patternCtx.fillRect(0,0,2*boxDimWidth,2*boxDimHeight),patternCtx.fillStyle=black,patternCtx.fillRect(0,0,boxDimWidth,boxDimHeight),patternCtx.fillRect(boxDimWidth,boxDimHeight,boxDimWidth,boxDimHeight),ctx.fillStyle=ctx.createPattern(pattern,"repeat"),ctx.fillRect(0,0,ratio,scaledHeight),ctx.drawImage(bitmap,0,0,bitmap.width,bitmap.height,0,0,ratio,scaledHeight)),null);return createImageData&&(outputScale.symmetric&&bitmap.width<maxDataDimension&&bitmap.height<maxDataDimension?(dataWidth=bitmap.width,dataHeight=bitmap.height):(bitmap=_classPrivateFieldGet(_bitmap,this),(maxDataDimension<bitmapWidth||maxDataDimension<_classPrivateFieldGet121)&&(black=Math.min(maxDataDimension/bitmapWidth,maxDataDimension/_classPrivateFieldGet121),dataWidth=Math.floor(bitmapWidth*black),dataHeight=Math.floor(_classPrivateFieldGet121*black),_classPrivateFieldGet(_isSvg,this)||(bitmap=_assertClassBrand(_StampEditor_brand,this,_scaleBitmap).call(this,dataWidth,dataHeight)))),(patternCtx=new OffscreenCanvas(dataWidth,dataHeight).getContext("2d",{willReadFrequently:!0})).drawImage(bitmap,0,0,bitmap.width,bitmap.height,0,0,dataWidth,dataHeight),white={width:dataWidth,height:dataHeight,data:patternCtx.getImageData(0,0,dataWidth,dataHeight).data}),{canvas:canvas,width:width,height:height,imageData:white}}},{key:"serialize",value:function(){var isForCopying=0<arguments.length&&void 0!==arguments[0]&&arguments[0],context=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();var serialized={annotationType:AnnotationEditorType.STAMP,bitmapId:_classPrivateFieldGet(_bitmapId,this),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:_classPrivateFieldGet(_isSvg,this),structTreeParentId:this._structTreeParentId};if(isForCopying)serialized.bitmapUrl=_assertClassBrand(_StampEditor_brand,this,_serializeBitmap).call(this,!0),serialized.accessibilityData=this.serializeAltText(!0),serialized.isCopy=!0;else{var isForCopying=this.serializeAltText(!1),decorative=isForCopying.decorative,isForCopying=isForCopying.altText;if(!decorative&&isForCopying&&(serialized.accessibilityData={type:"Figure",alt:isForCopying}),this.annotationElementId){var decorative=_assertClassBrand(_StampEditor_brand,this,_hasElementChanged4).call(this,serialized);if(decorative.isSame)return null;decorative.isSameAltText?delete serialized.accessibilityData:serialized.accessibilityData.structParent=null!=(isForCopying=this._initialData.structParent)?isForCopying:-1}serialized.id=this.annotationElementId,null!==context&&(context.stamps||(context.stamps=new Map),decorative=_classPrivateFieldGet(_isSvg,this)?(serialized.rect[2]-serialized.rect[0])*(serialized.rect[3]-serialized.rect[1]):null,context.stamps.has(_classPrivateFieldGet(_bitmapId,this))?_classPrivateFieldGet(_isSvg,this)&&decorative>(isForCopying=context.stamps.get(_classPrivateFieldGet(_bitmapId,this))).area&&(isForCopying.area=decorative,isForCopying.serialized.bitmap.close(),isForCopying.serialized.bitmap=_assertClassBrand(_StampEditor_brand,this,_serializeBitmap).call(this,!1)):(context.stamps.set(_classPrivateFieldGet(_bitmapId,this),{area:decorative,serialized:serialized}),serialized.bitmap=_assertClassBrand(_StampEditor_brand,this,_serializeBitmap).call(this,!1)))}return serialized}},{key:"renderAnnotationElement",value:function(annotation){return annotation.updateEdited({rect:this.getRect(0,0)}),null}}],[{key:"initialize",value:function(l10n,uiManager){AnnotationEditor.initialize(l10n,uiManager)}},{key:"isHandlingMimeForPasting",value:function(mime){return SupportedImageMimeTypes.includes(mime)}},{key:"paste",value:function(item,parent){parent.pasteEditor({mode:AnnotationEditorType.STAMP},{bitmapFile:item.getAsFile()})}},{key:"computeTelemetryFinalData",value:function(data){var _hasAltTextStats$get,data=data.get("hasAltText");return{hasAltText:null!=(_hasAltTextStats$get=data.get(!0))?_hasAltTextStats$get:0,hasNoAltText:null!=(_hasAltTextStats$get=data.get(!1))?_hasAltTextStats$get:0}}},{key:"deserialize",value:async function(data,parent,uiManager){var initialData=null,missingCanvas=!1,container=(data instanceof StampAnnotationElement&&(_rect5=(_data0$data=(_data0=data).data).rect,rotation=_data0$data.rotation,id=_data0$data.id,structParent=_data0$data.structParent,_data0$data=_data0$data.popupRef,container=_data0.container,pageNumber=_data0.parent.page.pageNumber,(_data0=_data0.canvas)?(delete data.canvas,_bitmapId2=(container=uiManager.imageManager.getFromCanvas(container.id,_data0)).id,_bitmap2=container.bitmap,_data0.remove()):data._hasNoCanvas=missingCanvas=!0,_data0=(null==(container=await parent._structTree.getAriaAttributes("".concat("pdfjs_internal_id_").concat(id)))?void 0:container.get("aria-label"))||"",initialData=data={annotationType:AnnotationEditorType.STAMP,bitmapId:_bitmapId2,bitmap:_bitmap2,pageIndex:pageNumber-1,rect:_rect5.slice(0),rotation:rotation,annotationElementId:id,id:id,deleted:!1,accessibilityData:{decorative:!1,altText:_data0},isSvg:!1,structParent:structParent,popupRef:_data0$data}),await _superPropGet(StampEditor,"deserialize",this,2)([data,parent,uiManager])),_bitmapId2=data,_bitmap2=_bitmapId2.rect,pageNumber=_bitmapId2.bitmap,_rect5=_bitmapId2.bitmapUrl,rotation=_bitmapId2.bitmapId,id=_bitmapId2.isSvg,_data0=_bitmapId2.accessibilityData,structParent=(missingCanvas?(uiManager.addMissingCanvas(data.id,container),_classPrivateFieldSet(_missingCanvas,container,!0)):rotation&&uiManager.imageManager.isValidId(rotation)?(_classPrivateFieldSet(_bitmapId,container,rotation),pageNumber&&_classPrivateFieldSet(_bitmap,container,pageNumber)):_classPrivateFieldSet(_bitmapUrl,container,_rect5),_classPrivateFieldSet(_isSvg,container,id),babelHelpers.slicedToArray(container.pageDimensions,2)),_data0$data=structParent[0],parent=structParent[1];return container.width=(_bitmap2[2]-_bitmap2[0])/_data0$data,container.height=(_bitmap2[3]-_bitmap2[1])/parent,_data0&&(container.altTextData=_data0),container._initialData=initialData,_classPrivateFieldSet(_hasBeenAddedInUndoStack,container,!!initialData),container}}])}(AnnotationEditor);function _getBitmapFetched(data){var fromId=1<arguments.length&&void 0!==arguments[1]&&arguments[1];data?(_classPrivateFieldSet(_bitmap,this,data.bitmap),fromId||(_classPrivateFieldSet(_bitmapId,this,data.id),_classPrivateFieldSet(_isSvg,this,data.isSvg)),data.file&&_classPrivateFieldSet(_bitmapFileName,this,data.file.name),_assertClassBrand(_StampEditor_brand,this,_createCanvas2).call(this)):this.remove()}function _getBitmapDone(){var _this121=this;if(_classPrivateFieldSet(_bitmapPromise,this,null),this._uiManager.enableWaiting(!1),_classPrivateFieldGet(_canvas,this))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&_classPrivateFieldGet(_bitmap,this))this.addEditToolbar().then(function(){_this121._editToolbar.hide(),_this121._uiManager.editAltText(_this121,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&_classPrivateFieldGet(_bitmap,this)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(_unused13){}}this.div.focus()}}function _getBitmap(){var url,input,signal,_this122=this;_classPrivateFieldGet(_bitmapId,this)?(this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(_classPrivateFieldGet(_bitmapId,this)).then(function(data){return _assertClassBrand(_StampEditor_brand,_this122,_getBitmapFetched).call(_this122,data,!0)}).finally(function(){return _assertClassBrand(_StampEditor_brand,_this122,_getBitmapDone).call(_this122)})):_classPrivateFieldGet(_bitmapUrl,this)?(url=_classPrivateFieldGet(_bitmapUrl,this),_classPrivateFieldSet(_bitmapUrl,this,null),this._uiManager.enableWaiting(!0),_classPrivateFieldSet(_bitmapPromise,this,this._uiManager.imageManager.getFromUrl(url).then(function(data){return _assertClassBrand(_StampEditor_brand,_this122,_getBitmapFetched).call(_this122,data)}).finally(function(){return _assertClassBrand(_StampEditor_brand,_this122,_getBitmapDone).call(_this122)}))):_classPrivateFieldGet(_bitmapFile,this)?(url=_classPrivateFieldGet(_bitmapFile,this),_classPrivateFieldSet(_bitmapFile,this,null),this._uiManager.enableWaiting(!0),_classPrivateFieldSet(_bitmapPromise,this,this._uiManager.imageManager.getFromFile(url).then(function(data){return _assertClassBrand(_StampEditor_brand,_this122,_getBitmapFetched).call(_this122,data)}).finally(function(){return _assertClassBrand(_StampEditor_brand,_this122,_getBitmapDone).call(_this122)}))):((input=document.createElement("input")).type="file",input.accept=SupportedImageMimeTypes.join(","),signal=this._uiManager._signal,_classPrivateFieldSet(_bitmapPromise,this,new Promise(function(resolve){input.addEventListener("change",async function(){var data;input.files&&0!==input.files.length?(_this122._uiManager.enableWaiting(!0),data=await _this122._uiManager.imageManager.getFromFile(input.files[0]),_this122._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:_this122._uiManager.useNewAltTextFlow}}),_assertClassBrand(_StampEditor_brand,_this122,_getBitmapFetched).call(_this122,data)):_this122.remove(),resolve()},{signal:signal}),input.addEventListener("cancel",function(){_this122.remove(),resolve()},{signal:signal})}).finally(function(){return _assertClassBrand(_StampEditor_brand,_this122,_getBitmapDone).call(_this122)})),input.click())}function _createCanvas2(){var div=this.div,_classPrivateFieldGet185=_classPrivateFieldGet(_bitmap,this),width=_classPrivateFieldGet185.width,_classPrivateFieldGet185=_classPrivateFieldGet185.height,_this$pageDimensions1=babelHelpers.slicedToArray(this.pageDimensions,2),pageWidth=_this$pageDimensions1[0],_this$pageDimensions1=_this$pageDimensions1[1],factor=(this.width?(width=this.width*pageWidth,_classPrivateFieldGet185=this.height*_this$pageDimensions1):(.75*pageWidth<width||.75*_this$pageDimensions1<_classPrivateFieldGet185)&&(width*=factor=Math.min(.75*pageWidth/width,.75*_this$pageDimensions1/_classPrivateFieldGet185),_classPrivateFieldGet185*=factor),babelHelpers.slicedToArray(this.parentDimensions,2)),parentWidth=factor[0],factor=factor[1],parentWidth=(this.setDims(width*parentWidth/pageWidth,_classPrivateFieldGet185*factor/_this$pageDimensions1),this._uiManager.enableWaiting(!1),_classPrivateFieldSet(_canvas,this,document.createElement("canvas")));parentWidth.setAttribute("role","img"),this.addContainer(parentWidth),this.width=width/pageWidth,this.height=_classPrivateFieldGet185/_this$pageDimensions1,null!=(factor=this._initialOptions)&&factor.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(div.hidden=!1),_assertClassBrand(_StampEditor_brand,this,_drawBitmap).call(this),_classPrivateFieldGet(_hasBeenAddedInUndoStack,this)||(this.parent.addUndoableEditor(this),_classPrivateFieldSet(_hasBeenAddedInUndoStack,this,!0)),this._reportTelemetry({action:"inserted_image"}),_classPrivateFieldGet(_bitmapFileName,this)&&this.div.setAttribute("aria-description",_classPrivateFieldGet(_bitmapFileName,this)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}function _scaleBitmap(width,height){for(var _classPrivateFieldGet186=_classPrivateFieldGet(_bitmap,this),newWidth=_classPrivateFieldGet186.width,newHeight=_classPrivateFieldGet186.height,bitmap=_classPrivateFieldGet(_bitmap,this);2*width<newWidth||2*height<newHeight;){var prevWidth=newWidth,prevHeight=newHeight,offscreen=(2*width<newWidth&&(newWidth=16384<=newWidth?Math.floor(newWidth/2)-1:Math.ceil(newWidth/2)),2*height<newHeight&&(newHeight=16384<=newHeight?Math.floor(newHeight/2)-1:Math.ceil(newHeight/2)),new OffscreenCanvas(newWidth,newHeight));offscreen.getContext("2d").drawImage(bitmap,0,0,prevWidth,prevHeight,0,0,newWidth,newHeight),bitmap=offscreen.transferToImageBitmap()}return bitmap}function _drawBitmap(){var _this$parentDimension23=babelHelpers.slicedToArray(this.parentDimensions,2),parentWidth=_this$parentDimension23[0],_this$parentDimension23=_this$parentDimension23[1],width=this.width,height=this.height,outputScale=new OutputScale,width=Math.ceil(width*parentWidth*outputScale.sx),parentWidth=Math.ceil(height*_this$parentDimension23*outputScale.sy),height=_classPrivateFieldGet(_canvas,this);!height||height.width===width&&height.height===parentWidth||(height.width=width,height.height=parentWidth,_this$parentDimension23=_classPrivateFieldGet(_isSvg,this)?_classPrivateFieldGet(_bitmap,this):_assertClassBrand(_StampEditor_brand,this,_scaleBitmap).call(this,width,parentWidth),(outputScale=height.getContext("2d")).filter=this._uiManager.hcmFilter,outputScale.drawImage(_this$parentDimension23,0,0,_this$parentDimension23.width,_this$parentDimension23.height,0,0,width,parentWidth))}function _serializeBitmap(toUrl){if(toUrl){if(_classPrivateFieldGet(_isSvg,this)){toUrl=this._uiManager.imageManager.getSvgUrl(_classPrivateFieldGet(_bitmapId,this));if(toUrl)return toUrl}var toUrl=document.createElement("canvas"),_classPrivateFieldGet187=_classPrivateFieldGet(_bitmap,this);return toUrl.width=_classPrivateFieldGet187.width,toUrl.height=_classPrivateFieldGet187.height,toUrl.getContext("2d").drawImage(_classPrivateFieldGet(_bitmap,this),0,0),toUrl.toDataURL()}var offscreen;return _classPrivateFieldGet(_isSvg,this)?(toUrl=(_classPrivateFieldGet187=babelHelpers.slicedToArray(this.pageDimensions,2))[0],_classPrivateFieldGet187=_classPrivateFieldGet187[1],toUrl=Math.round(this.width*toUrl*PixelsPerInch.PDF_TO_CSS_UNITS),_classPrivateFieldGet187=Math.round(this.height*_classPrivateFieldGet187*PixelsPerInch.PDF_TO_CSS_UNITS),(offscreen=new OffscreenCanvas(toUrl,_classPrivateFieldGet187)).getContext("2d").drawImage(_classPrivateFieldGet(_bitmap,this),0,0,_classPrivateFieldGet(_bitmap,this).width,_classPrivateFieldGet(_bitmap,this).height,0,0,toUrl,_classPrivateFieldGet187),offscreen.transferToImageBitmap()):structuredClone(_classPrivateFieldGet(_bitmap,this))}function _hasElementChanged4(serialized){var _this$_initialData4=this._initialData,pageIndex=_this$_initialData4.pageIndex,_this$_initialData4=_this$_initialData4.accessibilityData.altText,pageIndex=serialized.pageIndex===pageIndex,serialized=((null==(serialized=serialized.accessibilityData)?void 0:serialized.alt)||"")===_this$_initialData4;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&pageIndex&&serialized,isSameAltText:serialized}}babelHelpers.defineProperty(StampEditor,"_type","stamp"),babelHelpers.defineProperty(StampEditor,"_editorType",AnnotationEditorType.STAMP);var _accessibilityManager2=new WeakMap,_allowClick=new WeakMap,_annotationLayer=new WeakMap,_clickAC=new WeakMap,_editorFocusTimeoutId=new WeakMap,_editors=new WeakMap,_hadPointerDown=new WeakMap,_isDisabling=new WeakMap,_isEnabling=new WeakMap,_drawingAC=new WeakMap,_focusedElement=new WeakMap,_textLayer=new WeakMap,_textSelectionAC=new WeakMap,_textLayerDblClickAC=new WeakMap,_lastPointerDownTimestamp=new WeakMap,_uiManager4=new WeakMap,_AnnotationEditorLayer_brand=new WeakSet,AnnotationEditorLayer=_exports.AnnotationEditorLayer=function(){function AnnotationEditorLayer(_ref124){var uiManager=_ref124.uiManager,pageIndex=_ref124.pageIndex,div=_ref124.div,structTreeLayer=_ref124.structTreeLayer,accessibilityManager=_ref124.accessibilityManager,annotationLayer=_ref124.annotationLayer,drawLayer=_ref124.drawLayer,textLayer=_ref124.textLayer,viewport=_ref124.viewport,l10n=_ref124.l10n,_ref124=(babelHelpers.classCallCheck(this,AnnotationEditorLayer),_classPrivateMethodInitSpec(this,_AnnotationEditorLayer_brand),_classPrivateFieldInitSpec(this,_accessibilityManager2,void 0),_classPrivateFieldInitSpec(this,_allowClick,!1),_classPrivateFieldInitSpec(this,_annotationLayer,null),_classPrivateFieldInitSpec(this,_clickAC,null),_classPrivateFieldInitSpec(this,_editorFocusTimeoutId,null),_classPrivateFieldInitSpec(this,_editors,new Map),_classPrivateFieldInitSpec(this,_hadPointerDown,!1),_classPrivateFieldInitSpec(this,_isDisabling,!1),_classPrivateFieldInitSpec(this,_isEnabling,!1),_classPrivateFieldInitSpec(this,_drawingAC,null),_classPrivateFieldInitSpec(this,_focusedElement,null),_classPrivateFieldInitSpec(this,_textLayer,null),_classPrivateFieldInitSpec(this,_textSelectionAC,null),_classPrivateFieldInitSpec(this,_textLayerDblClickAC,null),_classPrivateFieldInitSpec(this,_lastPointerDownTimestamp,-1),_classPrivateFieldInitSpec(this,_uiManager4,void 0),babelHelpers.toConsumableArray(_editorTypes2._.values()));if(!AnnotationEditorLayer._initialized){AnnotationEditorLayer._initialized=!0;var _step159,_iterator159=_createForOfIteratorHelper(_ref124);try{for(_iterator159.s();!(_step159=_iterator159.n()).done;)_step159.value.initialize(l10n,uiManager)}catch(err){_iterator159.e(err)}finally{_iterator159.f()}}uiManager.registerEditorTypes(_ref124),_classPrivateFieldSet(_uiManager4,this,uiManager),this.pageIndex=pageIndex,this.div=div,_classPrivateFieldSet(_accessibilityManager2,this,accessibilityManager),_classPrivateFieldSet(_annotationLayer,this,annotationLayer),this.viewport=viewport,_classPrivateFieldSet(_textLayer,this,textLayer),this.drawLayer=drawLayer,this._structTree=structTreeLayer,_classPrivateFieldGet(_uiManager4,this).addLayer(this)}return babelHelpers.createClass(AnnotationEditorLayer,[{key:"isEmpty",get:function(){return 0===_classPrivateFieldGet(_editors,this).size}},{key:"isInvisible",get:function(){return this.isEmpty&&_classPrivateFieldGet(_uiManager4,this).getMode()===AnnotationEditorType.NONE}},{key:"updateToolbar",value:function(options){_classPrivateFieldGet(_uiManager4,this).updateToolbar(options)}},{key:"updateMode",value:function(){var mode=0<arguments.length&&void 0!==arguments[0]?arguments[0]:_classPrivateFieldGet(_uiManager4,this).getMode();switch(_assertClassBrand(_AnnotationEditorLayer_brand,this,_cleanup2).call(this),mode){case AnnotationEditorType.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case AnnotationEditorType.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);var _step160,classList=this.div.classList,_iterator160=_createForOfIteratorHelper(_editorTypes2._.values());try{for(_iterator160.s();!(_step160=_iterator160.n()).done;){var editorType=_step160.value;classList.toggle("".concat(editorType._type,"Editing"),mode===editorType._editorType)}}catch(err){_iterator160.e(err)}finally{_iterator160.f()}this.div.hidden=!1}},{key:"hasTextLayer",value:function(textLayer){return textLayer===(null==(textLayer=_classPrivateFieldGet(_textLayer,this))?void 0:textLayer.div)}},{key:"setEditingState",value:function(isEditing){_classPrivateFieldGet(_uiManager4,this).setEditingState(isEditing)}},{key:"addCommands",value:function(params){_classPrivateFieldGet(_uiManager4,this).addCommands(params)}},{key:"cleanUndoStack",value:function(type){_classPrivateFieldGet(_uiManager4,this).cleanUndoStack(type)}},{key:"toggleDrawing",value:function(){this.div.classList.toggle("drawing",!(0<arguments.length&&void 0!==arguments[0]&&arguments[0]))}},{key:"togglePointerEvents",value:function(){this.div.classList.toggle("disabled",!(0<arguments.length&&void 0!==arguments[0]&&arguments[0]))}},{key:"toggleAnnotationLayerPointerEvents",value:function(){var _classPrivateFieldGet123,enabled=0<arguments.length&&void 0!==arguments[0]&&arguments[0];null!=(_classPrivateFieldGet123=_classPrivateFieldGet(_annotationLayer,this))&&_classPrivateFieldGet123.div.classList.toggle("disabled",!enabled)}},{key:"enable",value:async function(){_classPrivateFieldSet(_isEnabling,this,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),null!=(_classPrivateFieldGet124=_classPrivateFieldGet(_textLayerDblClickAC,this))&&_classPrivateFieldGet124.abort(),_classPrivateFieldSet(_textLayerDblClickAC,this,null);var _classPrivateFieldGet124,_step161,annotationElementIds=new Set,_iterator161=_createForOfIteratorHelper(_classPrivateFieldGet(_editors,this).values());try{for(_iterator161.s();!(_step161=_iterator161.n()).done;){var editor=_step161.value;editor.enableEditing(),editor.show(!0),editor.annotationElementId&&(_classPrivateFieldGet(_uiManager4,this).removeChangedExistingAnnotation(editor),annotationElementIds.add(editor.annotationElementId))}}catch(err){_iterator161.e(err)}finally{_iterator161.f()}if(_classPrivateFieldGet(_annotationLayer,this)){var _step162,_iterator162=_createForOfIteratorHelper(_classPrivateFieldGet(_annotationLayer,this).getEditableAnnotations());try{for(_iterator162.s();!(_step162=_iterator162.n()).done;){var _editor4,editable=_step162.value;editable.hide(),_classPrivateFieldGet(_uiManager4,this).isDeletedAnnotationElement(editable.data.id)||annotationElementIds.has(editable.data.id)||(_editor4=await this.deserialize(editable))&&(this.addOrRebuild(_editor4),_editor4.enableEditing())}}catch(err){_iterator162.e(err)}finally{_iterator162.f()}}_classPrivateFieldSet(_isEnabling,this,!1)}},{key:"disable",value:function(){var signal,_step164,_this102=this,changedAnnotations=(_classPrivateFieldSet(_isDisabling,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),_classPrivateFieldGet(_textLayer,this)&&!_classPrivateFieldGet(_textLayerDblClickAC,this)&&(_classPrivateFieldSet(_textLayerDblClickAC,this,new AbortController),signal=_classPrivateFieldGet(_uiManager4,this).combinedSignal(_classPrivateFieldGet(_textLayerDblClickAC,this)),_classPrivateFieldGet(_textLayer,this).div.addEventListener("pointerdown",function(e){var clientX=e.clientX,clientY=e.clientY,timeStamp=e.timeStamp;if(500<timeStamp-_classPrivateFieldGet(_lastPointerDownTimestamp,_this102))_classPrivateFieldSet(_lastPointerDownTimestamp,_this102,timeStamp);else{_classPrivateFieldSet(_lastPointerDownTimestamp,_this102,-1);timeStamp=_this102.div.classList,clientX=(timeStamp.toggle("getElements",!0),document.elementsFromPoint(clientX,clientY));if(timeStamp.toggle("getElements",!1),_this102.div.contains(clientX[0])){var id,_step163,regex=new RegExp("^".concat("pdfjs_internal_editor_","[0-9]+$")),_iterator163=_createForOfIteratorHelper(clientX);try{for(_iterator163.s();!(_step163=_iterator163.n()).done;){var element=_step163.value;if(regex.test(element.id)){id=element.id;break}}}catch(err){_iterator163.e(err)}finally{_iterator163.f()}id&&null===(null==(clientY=_classPrivateFieldGet(_editors,_this102).get(id))?void 0:clientY.annotationElementId)&&(e.stopPropagation(),e.preventDefault(),clientY.dblclick())}}},{signal:signal,capture:!0})),new Map),resetAnnotations=new Map,_iterator164=_createForOfIteratorHelper(_classPrivateFieldGet(_editors,this).values());try{for(_iterator164.s();!(_step164=_iterator164.n()).done;){var _this$getEditableAnno,_editor5=_step164.value;_editor5.disableEditing(),_editor5.annotationElementId&&(null!==_editor5.serialize()?changedAnnotations.set(_editor5.annotationElementId,_editor5):(resetAnnotations.set(_editor5.annotationElementId,_editor5),null!=(_this$getEditableAnno=this.getEditableAnnotation(_editor5.annotationElementId))&&_this$getEditableAnno.show(),_editor5.remove()))}}catch(err){_iterator164.e(err)}finally{_iterator164.f()}if(_classPrivateFieldGet(_annotationLayer,this)){var _step165,_iterator165=_createForOfIteratorHelper(_classPrivateFieldGet(_annotationLayer,this).getEditableAnnotations());try{for(_iterator165.s();!(_step165=_iterator165.n()).done;){var editor,editable=_step165.value,id=editable.data.id;_classPrivateFieldGet(_uiManager4,this).isDeletedAnnotationElement(id)||((editor=resetAnnotations.get(id))?(editor.resetAnnotationElement(editable),editor.show(!1)):(editor=changedAnnotations.get(id))&&(_classPrivateFieldGet(_uiManager4,this).addChangedExistingAnnotation(editor),editor.renderAnnotationElement(editable))&&editor.show(!1),editable.show())}}catch(err){_iterator165.e(err)}finally{_iterator165.f()}}_assertClassBrand(_AnnotationEditorLayer_brand,this,_cleanup2).call(this),this.isEmpty&&(this.div.hidden=!0);var _step166,classList=this.div.classList,_iterator166=_createForOfIteratorHelper(_editorTypes2._.values());try{for(_iterator166.s();!(_step166=_iterator166.n()).done;){var editorType=_step166.value;classList.remove("".concat(editorType._type,"Editing"))}}catch(err){_iterator166.e(err)}finally{_iterator166.f()}this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),_classPrivateFieldSet(_isDisabling,this,!1)}},{key:"getEditableAnnotation",value:function(id){var _classPrivateFieldGet125;return(null==(_classPrivateFieldGet125=_classPrivateFieldGet(_annotationLayer,this))?void 0:_classPrivateFieldGet125.getEditableAnnotation(id))||null}},{key:"setActiveEditor",value:function(editor){_classPrivateFieldGet(_uiManager4,this).getActive()!==editor&&_classPrivateFieldGet(_uiManager4,this).setActiveEditor(editor)}},{key:"enableTextSelection",value:function(){var _classPrivateFieldGet126;this.div.tabIndex=-1,null!=(_classPrivateFieldGet126=_classPrivateFieldGet(_textLayer,this))&&_classPrivateFieldGet126.div&&!_classPrivateFieldGet(_textSelectionAC,this)&&(_classPrivateFieldSet(_textSelectionAC,this,new AbortController),_classPrivateFieldGet126=_classPrivateFieldGet(_uiManager4,this).combinedSignal(_classPrivateFieldGet(_textSelectionAC,this)),_classPrivateFieldGet(_textLayer,this).div.addEventListener("pointerdown",_assertClassBrand(_AnnotationEditorLayer_brand,this,_textLayerPointerDown).bind(this),{signal:_classPrivateFieldGet126}),_classPrivateFieldGet(_textLayer,this).div.classList.add("highlighting"))}},{key:"disableTextSelection",value:function(){var _classPrivateFieldGet127;this.div.tabIndex=0,null!=(_classPrivateFieldGet127=_classPrivateFieldGet(_textLayer,this))&&_classPrivateFieldGet127.div&&_classPrivateFieldGet(_textSelectionAC,this)&&(_classPrivateFieldGet(_textSelectionAC,this).abort(),_classPrivateFieldSet(_textSelectionAC,this,null),_classPrivateFieldGet(_textLayer,this).div.classList.remove("highlighting"))}},{key:"enableClick",value:function(){var signal,pointerup;_classPrivateFieldGet(_clickAC,this)||(_classPrivateFieldSet(_clickAC,this,new AbortController),signal=_classPrivateFieldGet(_uiManager4,this).combinedSignal(_classPrivateFieldGet(_clickAC,this)),this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:signal}),pointerup=this.pointerup.bind(this),this.div.addEventListener("pointerup",pointerup,{signal:signal}),this.div.addEventListener("pointercancel",pointerup,{signal:signal}))}},{key:"disableClick",value:function(){var _classPrivateFieldGet128;null!=(_classPrivateFieldGet128=_classPrivateFieldGet(_clickAC,this))&&_classPrivateFieldGet128.abort(),_classPrivateFieldSet(_clickAC,this,null)}},{key:"attach",value:function(editor){_classPrivateFieldGet(_editors,this).set(editor.id,editor);var annotationElementId=editor.annotationElementId;annotationElementId&&_classPrivateFieldGet(_uiManager4,this).isDeletedAnnotationElement(annotationElementId)&&_classPrivateFieldGet(_uiManager4,this).removeDeletedAnnotationElement(editor)}},{key:"detach",value:function(editor){var _classPrivateFieldGet129;_classPrivateFieldGet(_editors,this).delete(editor.id),null!=(_classPrivateFieldGet129=_classPrivateFieldGet(_accessibilityManager2,this))&&_classPrivateFieldGet129.removePointerInTextLayer(editor.contentDiv),!_classPrivateFieldGet(_isDisabling,this)&&editor.annotationElementId&&_classPrivateFieldGet(_uiManager4,this).addDeletedAnnotationElement(editor)}},{key:"remove",value:function(editor){this.detach(editor),_classPrivateFieldGet(_uiManager4,this).removeEditor(editor),editor.div.remove(),editor.isAttachedToDOM=!1}},{key:"changeParent",value:function(editor){var _editor$parent;editor.parent!==this&&(editor.parent&&editor.annotationElementId&&(_classPrivateFieldGet(_uiManager4,this).addDeletedAnnotationElement(editor.annotationElementId),AnnotationEditor.deleteAnnotationElement(editor),editor.annotationElementId=null),this.attach(editor),null!=(_editor$parent=editor.parent)&&_editor$parent.detach(editor),editor.setParent(this),editor.div)&&editor.isAttachedToDOM&&(editor.div.remove(),this.div.append(editor.div))}},{key:"add",value:function(editor){var div;editor.parent===this&&editor.isAttachedToDOM||(this.changeParent(editor),_classPrivateFieldGet(_uiManager4,this).addEditor(editor),this.attach(editor),editor.isAttachedToDOM||(div=editor.render(),this.div.append(div),editor.isAttachedToDOM=!0),editor.fixAndSetPosition(),editor.onceAdded(!_classPrivateFieldGet(_isEnabling,this)),_classPrivateFieldGet(_uiManager4,this).addToAnnotationStorage(editor),editor._reportTelemetry(editor.telemetryInitialData))}},{key:"moveEditorInDOM",value:function(editor){var _classPrivateFieldGet130,activeElement,_this103=this;editor.isAttachedToDOM&&(activeElement=document.activeElement,editor.div.contains(activeElement)&&!_classPrivateFieldGet(_editorFocusTimeoutId,this)&&(editor._focusEventsAllowed=!1,_classPrivateFieldSet(_editorFocusTimeoutId,this,setTimeout(function(){_classPrivateFieldSet(_editorFocusTimeoutId,_this103,null),editor.div.contains(document.activeElement)?editor._focusEventsAllowed=!0:(editor.div.addEventListener("focusin",function(){editor._focusEventsAllowed=!0},{once:!0,signal:_classPrivateFieldGet(_uiManager4,_this103)._signal}),activeElement.focus())},0))),editor._structTreeParentId=null==(_classPrivateFieldGet130=_classPrivateFieldGet(_accessibilityManager2,this))?void 0:_classPrivateFieldGet130.moveElementInDOM(this.div,editor.div,editor.contentDiv,!0))}},{key:"addOrRebuild",value:function(editor){editor.needsToBeRebuilt()?(editor.parent||(editor.parent=this),editor.rebuild(),editor.show()):this.add(editor)}},{key:"addUndoableEditor",value:function(editor){this.addCommands({cmd:function(){return editor._uiManager.rebuild(editor)},undo:function(){editor.remove()},mustExec:!1})}},{key:"getNextId",value:function(){return _classPrivateFieldGet(_uiManager4,this).getId()}},{key:"combinedSignal",value:function(ac){return _classPrivateFieldGet(_uiManager4,this).combinedSignal(ac)}},{key:"canCreateNewEmptyEditor",value:function(){var _classPrivateGetter2;return null==(_classPrivateGetter2=_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType))?void 0:_classPrivateGetter2.canCreateNewEmptyEditor()}},{key:"pasteEditor",value:async function(options,params){this.updateToolbar(options),await _classPrivateFieldGet(_uiManager4,this).updateMode(options.mode);var options=_assertClassBrand(_AnnotationEditorLayer_brand,this,_getCenterPoint).call(this),offsetX=options.offsetX,options=options.offsetY,id=this.getNextId(),id=_assertClassBrand(_AnnotationEditorLayer_brand,this,_createNewEditor).call(this,_objectSpread({parent:this,id:id,x:offsetX,y:options,uiManager:_classPrivateFieldGet(_uiManager4,this),isCentered:!0},params));id&&this.add(id)}},{key:"deserialize",value:async function(data){var _data$annotationType;return await(null==(_data$annotationType=_editorTypes2._.get(null!=(_data$annotationType=data.annotationType)?_data$annotationType:data.annotationEditorType))?void 0:_data$annotationType.deserialize(data,this,_classPrivateFieldGet(_uiManager4,this)))||null}},{key:"createAndAddNewEditor",value:function(event,isCentered){var data=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},id=this.getNextId(),id=_assertClassBrand(_AnnotationEditorLayer_brand,this,_createNewEditor).call(this,_objectSpread({parent:this,id:id,x:event.offsetX,y:event.offsetY,uiManager:_classPrivateFieldGet(_uiManager4,this),isCentered:isCentered},data));return id&&this.add(id),id}},{key:"addNewEditor",value:function(){var data=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.createAndAddNewEditor(_assertClassBrand(_AnnotationEditorLayer_brand,this,_getCenterPoint).call(this),!0,data)}},{key:"setSelected",value:function(editor){_classPrivateFieldGet(_uiManager4,this).setSelected(editor)}},{key:"toggleSelected",value:function(editor){_classPrivateFieldGet(_uiManager4,this).toggleSelected(editor)}},{key:"unselect",value:function(editor){_classPrivateFieldGet(_uiManager4,this).unselect(editor)}},{key:"pointerup",value:function(event){var isMac=util_FeatureTest.platform.isMac;0!==event.button||event.ctrlKey&&isMac||event.target===this.div&&_classPrivateFieldGet(_hadPointerDown,this)&&(_classPrivateFieldSet(_hadPointerDown,this,!1),null!=(isMac=_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType))&&isMac.isDrawer&&_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType).supportMultipleDrawings||(_classPrivateFieldGet(_allowClick,this)?(isMac=_classPrivateFieldGet(_uiManager4,this).getMode())===AnnotationEditorType.STAMP||isMac===AnnotationEditorType.SIGNATURE?_classPrivateFieldGet(_uiManager4,this).unselectAll():this.createAndAddNewEditor(event,!1):_classPrivateFieldSet(_allowClick,this,!0)))}},{key:"pointerdown",value:function(event){var isMac;_classPrivateFieldGet(_uiManager4,this).getMode()===AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),_classPrivateFieldGet(_hadPointerDown,this)?_classPrivateFieldSet(_hadPointerDown,this,!1):(isMac=util_FeatureTest.platform.isMac,0!==event.button||event.ctrlKey&&isMac||event.target===this.div&&(_classPrivateFieldSet(_hadPointerDown,this,!0),null!=(isMac=_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType))&&isMac.isDrawer?this.startDrawingSession(event):(isMac=_classPrivateFieldGet(_uiManager4,this).getActive(),_classPrivateFieldSet(_allowClick,this,!isMac||isMac.isEmpty()))))}},{key:"startDrawingSession",value:function(event){var signal,_this104=this;this.div.focus({preventScroll:!0}),_classPrivateFieldGet(_drawingAC,this)||(_classPrivateFieldGet(_uiManager4,this).setCurrentDrawingSession(this),_classPrivateFieldSet(_drawingAC,this,new AbortController),signal=_classPrivateFieldGet(_uiManager4,this).combinedSignal(_classPrivateFieldGet(_drawingAC,this)),this.div.addEventListener("blur",function(_ref125){_ref125=_ref125.relatedTarget;_ref125&&!_this104.div.contains(_ref125)&&(_classPrivateFieldSet(_focusedElement,_this104,null),_this104.commitOrRemove())},{signal:signal})),_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType).startDrawing(this,_classPrivateFieldGet(_uiManager4,this),!1,event)}},{key:"pause",value:function(on){var _this105=this;on?(on=document.activeElement,this.div.contains(on)&&_classPrivateFieldSet(_focusedElement,this,on)):_classPrivateFieldGet(_focusedElement,this)&&setTimeout(function(){var _classPrivateFieldGet131;null!=(_classPrivateFieldGet131=_classPrivateFieldGet(_focusedElement,_this105))&&_classPrivateFieldGet131.focus(),_classPrivateFieldSet(_focusedElement,_this105,null)},0)}},{key:"endDrawingSession",value:function(){var isAborted=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return _classPrivateFieldGet(_drawingAC,this)?(_classPrivateFieldGet(_uiManager4,this).setCurrentDrawingSession(null),_classPrivateFieldGet(_drawingAC,this).abort(),_classPrivateFieldSet(_drawingAC,this,null),_classPrivateFieldSet(_focusedElement,this,null),_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType).endDrawing(isAborted)):null}},{key:"findNewParent",value:function(editor,x,y){x=_classPrivateFieldGet(_uiManager4,this).findParent(x,y);return null!==x&&x!==this&&(x.changeParent(editor),!0)}},{key:"commitOrRemove",value:function(){return!!_classPrivateFieldGet(_drawingAC,this)&&(this.endDrawingSession(),!0)}},{key:"onScaleChanging",value:function(){_classPrivateFieldGet(_drawingAC,this)&&_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType).onScaleChangingWhenDrawing(this)}},{key:"destroy",value:function(){this.commitOrRemove(),(null==(_classPrivateFieldGet132=_classPrivateFieldGet(_uiManager4,this).getActive())?void 0:_classPrivateFieldGet132.parent)===this&&(_classPrivateFieldGet(_uiManager4,this).commitOrRemove(),_classPrivateFieldGet(_uiManager4,this).setActiveEditor(null)),_classPrivateFieldGet(_editorFocusTimeoutId,this)&&(clearTimeout(_classPrivateFieldGet(_editorFocusTimeoutId,this)),_classPrivateFieldSet(_editorFocusTimeoutId,this,null));var _classPrivateFieldGet132,_step167,_iterator167=_createForOfIteratorHelper(_classPrivateFieldGet(_editors,this).values());try{for(_iterator167.s();!(_step167=_iterator167.n()).done;){var _classPrivateFieldGet133,editor=_step167.value;null!=(_classPrivateFieldGet133=_classPrivateFieldGet(_accessibilityManager2,this))&&_classPrivateFieldGet133.removePointerInTextLayer(editor.contentDiv),editor.setParent(null),editor.isAttachedToDOM=!1,editor.div.remove()}}catch(err){_iterator167.e(err)}finally{_iterator167.f()}this.div=null,_classPrivateFieldGet(_editors,this).clear(),_classPrivateFieldGet(_uiManager4,this).removeLayer(this)}},{key:"render",value:function(_ref126){var _step168,_ref126=_ref126.viewport,_iterator168=(this.viewport=_ref126,setLayerDimensions(this.div,_ref126),_createForOfIteratorHelper(_classPrivateFieldGet(_uiManager4,this).getEditors(this.pageIndex)));try{for(_iterator168.s();!(_step168=_iterator168.n()).done;){var editor=_step168.value;this.add(editor),editor.rebuild()}}catch(err){_iterator168.e(err)}finally{_iterator168.f()}this.updateMode()}},{key:"update",value:function(_ref127){var _ref127=_ref127.viewport,oldRotation=(_classPrivateFieldGet(_uiManager4,this).commitOrRemove(),_assertClassBrand(_AnnotationEditorLayer_brand,this,_cleanup2).call(this),this.viewport.rotation),rotation=_ref127.rotation;if(this.viewport=_ref127,setLayerDimensions(this.div,{rotation:rotation}),oldRotation!==rotation){var _step169,_iterator169=_createForOfIteratorHelper(_classPrivateFieldGet(_editors,this).values());try{for(_iterator169.s();!(_step169=_iterator169.n()).done;)_step169.value.rotate(rotation)}catch(err){_iterator169.e(err)}finally{_iterator169.f()}}}},{key:"pageDimensions",get:function(){var _this$viewport$rawDim=this.viewport.rawDims;return[_this$viewport$rawDim.pageWidth,_this$viewport$rawDim.pageHeight]}},{key:"scale",get:function(){return _classPrivateFieldGet(_uiManager4,this).viewParameters.realScale}}])}();function _textLayerPointerDown(event){var _this123=this,target=(_classPrivateFieldGet(_uiManager4,this).unselectAll(),event.target);(target===_classPrivateFieldGet(_textLayer,this).div||("img"===target.getAttribute("role")||target.classList.contains("endOfContent"))&&_classPrivateFieldGet(_textLayer,this).div.contains(target))&&(target=util_FeatureTest.platform.isMac,0!==event.button||event.ctrlKey&&target||(_classPrivateFieldGet(_uiManager4,this).showAllEditors("highlight",!0,!0),_classPrivateFieldGet(_textLayer,this).div.classList.add("free"),this.toggleDrawing(),HighlightEditor.startHighlighting(this,"ltr"===_classPrivateFieldGet(_uiManager4,this).direction,{target:_classPrivateFieldGet(_textLayer,this).div,x:event.x,y:event.y}),_classPrivateFieldGet(_textLayer,this).div.addEventListener("pointerup",function(){_classPrivateFieldGet(_textLayer,_this123).div.classList.remove("free"),_this123.toggleDrawing(!0)},{once:!0,signal:_classPrivateFieldGet(_uiManager4,this)._signal}),event.preventDefault()))}function _get_currentEditorType(_this101){return _editorTypes2._.get(_classPrivateFieldGet(_uiManager4,_this101).getMode())}function _createNewEditor(params){var editorType=_classPrivateGetter(_AnnotationEditorLayer_brand,this,_get_currentEditorType);return editorType?new editorType.prototype.constructor(params):null}function _getCenterPoint(){var _this$div$getBounding2=this.div.getBoundingClientRect(),x=_this$div$getBounding2.x,y=_this$div$getBounding2.y,width=_this$div$getBounding2.width,_this$div$getBounding2=_this$div$getBounding2.height,tlX=Math.max(0,x),tlY=Math.max(0,y),tlX=(tlX+Math.min(window.innerWidth,x+width))/2-x,width=(tlY+Math.min(window.innerHeight,y+_this$div$getBounding2))/2-y,x=this.viewport.rotation%180==0?[tlX,width]:[width,tlX],tlY=babelHelpers.slicedToArray(x,2);return{offsetX:tlY[0],offsetY:tlY[1]}}function _cleanup2(){var _step197,_iterator197=_createForOfIteratorHelper(_classPrivateFieldGet(_editors,this).values());try{for(_iterator197.s();!(_step197=_iterator197.n()).done;){var editor=_step197.value;editor.isEmpty()&&editor.remove()}}catch(err){_iterator197.e(err)}finally{_iterator197.f()}}babelHelpers.defineProperty(AnnotationEditorLayer,"_initialized",!1);var _editorTypes2={_:new Map([FreeTextEditor,InkEditor,StampEditor,HighlightEditor,SignatureEditor].map(function(type){return[type._editorType,type]}))},_parent2=new WeakMap,_mapping=new WeakMap,_toUpdate=new WeakMap,_DrawLayer_brand=new WeakSet,FreeTextEditor=_exports.DrawLayer=function(){function DrawLayer(_ref128){_ref128=_ref128.pageIndex;babelHelpers.classCallCheck(this,DrawLayer),_classPrivateMethodInitSpec(this,_DrawLayer_brand),_classPrivateFieldInitSpec(this,_parent2,null),_classPrivateFieldInitSpec(this,_mapping,new Map),_classPrivateFieldInitSpec(this,_toUpdate,new Map),this.pageIndex=_ref128}return babelHelpers.createClass(DrawLayer,[{key:"setParent",value:function(parent){if(_classPrivateFieldGet(_parent2,this)){if(_classPrivateFieldGet(_parent2,this)!==parent){if(0<_classPrivateFieldGet(_mapping,this).size){var _step170,_iterator170=_createForOfIteratorHelper(_classPrivateFieldGet(_mapping,this).values());try{for(_iterator170.s();!(_step170=_iterator170.n()).done;){var root=_step170.value;root.remove(),parent.append(root)}}catch(err){_iterator170.e(err)}finally{_iterator170.f()}}_classPrivateFieldSet(_parent2,this,parent)}}else _classPrivateFieldSet(_parent2,this,parent)}},{key:"draw",value:function(properties){var isPathUpdatable=1<arguments.length&&void 0!==arguments[1]&&arguments[1],hasClip=2<arguments.length&&void 0!==arguments[2]&&arguments[2],_DrawLayer$id=(_id10._=(_DrawLayer$id=_id10._,_DrawLayer$id2=_DrawLayer$id++,_DrawLayer$id),_DrawLayer$id2),_DrawLayer$id2=_assertClassBrand(_DrawLayer_brand,this,_createSVG2).call(this),defs=DrawLayer._svgFactory.createElement("defs"),path=(_DrawLayer$id2.append(defs),DrawLayer._svgFactory.createElement("path")),pathId=(defs.append(path),"path_p".concat(this.pageIndex,"_").concat(_DrawLayer$id)),isPathUpdatable=(path.setAttribute("id",pathId),path.setAttribute("vector-effect","non-scaling-stroke"),isPathUpdatable&&_classPrivateFieldGet(_toUpdate,this).set(_DrawLayer$id,path),hasClip?_assertClassBrand(_DrawLayer_brand,this,_createClipPath).call(this,defs,pathId):null),path=DrawLayer._svgFactory.createElement("use");return _DrawLayer$id2.append(path),path.setAttribute("href","#".concat(pathId)),this.updateProperties(_DrawLayer$id2,properties),_classPrivateFieldGet(_mapping,this).set(_DrawLayer$id,_DrawLayer$id2),{id:_DrawLayer$id,clipPathId:"url(#".concat(isPathUpdatable,")")}}},{key:"drawOutline",value:function(properties,mustRemoveSelfIntersections){_id10._=(_DrawLayer$id3=_id10._,_DrawLayer$id4=_DrawLayer$id3++,_DrawLayer$id3);var maskId,_DrawLayer$id3=_DrawLayer$id4,_DrawLayer$id4=_assertClassBrand(_DrawLayer_brand,this,_createSVG2).call(this),defs=DrawLayer._svgFactory.createElement("defs"),path=(_DrawLayer$id4.append(defs),DrawLayer._svgFactory.createElement("path")),pathId=(defs.append(path),"path_p".concat(this.pageIndex,"_").concat(_DrawLayer$id3)),mustRemoveSelfIntersections=(path.setAttribute("id",pathId),path.setAttribute("vector-effect","non-scaling-stroke"),mustRemoveSelfIntersections&&(path=DrawLayer._svgFactory.createElement("mask"),defs.append(path),maskId="mask_p".concat(this.pageIndex,"_").concat(_DrawLayer$id3),path.setAttribute("id",maskId),path.setAttribute("maskUnits","objectBoundingBox"),mustRemoveSelfIntersections=DrawLayer._svgFactory.createElement("rect"),path.append(mustRemoveSelfIntersections),mustRemoveSelfIntersections.setAttribute("width","1"),mustRemoveSelfIntersections.setAttribute("height","1"),mustRemoveSelfIntersections.setAttribute("fill","white"),defs=DrawLayer._svgFactory.createElement("use"),path.append(defs),defs.setAttribute("href","#".concat(pathId)),defs.setAttribute("stroke","none"),defs.setAttribute("fill","black"),defs.setAttribute("fill-rule","nonzero"),defs.classList.add("mask")),DrawLayer._svgFactory.createElement("use")),path=(_DrawLayer$id4.append(mustRemoveSelfIntersections),mustRemoveSelfIntersections.setAttribute("href","#".concat(pathId)),maskId&&mustRemoveSelfIntersections.setAttribute("mask","url(#".concat(maskId,")")),mustRemoveSelfIntersections.cloneNode());return _DrawLayer$id4.append(path),mustRemoveSelfIntersections.classList.add("mainOutline"),path.classList.add("secondaryOutline"),this.updateProperties(_DrawLayer$id4,properties),_classPrivateFieldGet(_mapping,this).set(_DrawLayer$id3,_DrawLayer$id4),_DrawLayer$id3}},{key:"finalizeDraw",value:function(id,properties){_classPrivateFieldGet(_toUpdate,this).delete(id),this.updateProperties(id,properties)}},{key:"updateProperties",value:function(elementOrId,properties){if(properties){var root=properties.root,bbox=properties.bbox,rootClass=properties.rootClass,properties=properties.path,elementOrId="number"==typeof elementOrId?_classPrivateFieldGet(_mapping,this).get(elementOrId):elementOrId;if(elementOrId){if(root&&_assertClassBrand(_DrawLayer_brand,this,_updateProperties).call(this,elementOrId,root),bbox&&!function(element,_ref149){var _ref149=babelHelpers.slicedToArray(_ref149,4),x=_ref149[0],y=_ref149[1],width=_ref149[2],_ref149=_ref149[3],element=element.style;element.top="".concat(100*y,"%"),element.left="".concat(100*x,"%"),element.width="".concat(100*width,"%"),element.height="".concat(100*_ref149,"%")}.call(DrawLayer,elementOrId,bbox),rootClass)for(var classList=elementOrId.classList,_i29=0,_Object$entries7=Object.entries(rootClass);_i29<_Object$entries7.length;_i29++){var _Object$entries7$_i=babelHelpers.slicedToArray(_Object$entries7[_i29],2),className=_Object$entries7$_i[0],_Object$entries7$_i=_Object$entries7$_i[1];classList.toggle(className,_Object$entries7$_i)}properties&&(root=elementOrId.firstChild.firstChild,_assertClassBrand(_DrawLayer_brand,this,_updateProperties).call(this,root,properties))}}}},{key:"updateParent",value:function(id,layer){var root;layer!==this&&(root=_classPrivateFieldGet(_mapping,this).get(id))&&(_classPrivateFieldGet(_parent2,layer).append(root),_classPrivateFieldGet(_mapping,this).delete(id),_classPrivateFieldGet(_mapping,layer).set(id,root))}},{key:"remove",value:function(id){_classPrivateFieldGet(_toUpdate,this).delete(id),null!==_classPrivateFieldGet(_parent2,this)&&(_classPrivateFieldGet(_mapping,this).get(id).remove(),_classPrivateFieldGet(_mapping,this).delete(id))}},{key:"destroy",value:function(){_classPrivateFieldSet(_parent2,this,null);var _step171,_iterator171=_createForOfIteratorHelper(_classPrivateFieldGet(_mapping,this).values());try{for(_iterator171.s();!(_step171=_iterator171.n()).done;)_step171.value.remove()}catch(err){_iterator171.e(err)}finally{_iterator171.f()}_classPrivateFieldGet(_mapping,this).clear(),_classPrivateFieldGet(_toUpdate,this).clear()}}],[{key:"_svgFactory",get:function(){return shadow(this,"_svgFactory",new DOMSVGFactory)}}])}();function _createSVG2(){var svg=_DrawLayer._svgFactory.create(1,1,!0);return _classPrivateFieldGet(_parent2,this).append(svg),svg.setAttribute("aria-hidden",!0),svg}function _createClipPath(defs,pathId){var clipPath=_DrawLayer._svgFactory.createElement("clipPath"),defs=(defs.append(clipPath),"clip_".concat(pathId)),clipPathUse=(clipPath.setAttribute("id",defs),clipPath.setAttribute("clipPathUnits","objectBoundingBox"),_DrawLayer._svgFactory.createElement("use"));return clipPath.append(clipPathUse),clipPathUse.setAttribute("href","#".concat(pathId)),clipPathUse.classList.add("clip"),defs}function _updateProperties(element,properties){for(var _i41=0,_Object$entries8=Object.entries(properties);_i41<_Object$entries8.length;_i41++){var _Object$entries8$_i=babelHelpers.slicedToArray(_Object$entries8[_i41],2),key=_Object$entries8$_i[0],_Object$entries8$_i=_Object$entries8$_i[1];null===_Object$entries8$_i?element.removeAttribute(key):element.setAttribute(key,_Object$entries8$_i)}}var _DrawLayer=FreeTextEditor,_id10={_:0};globalThis._pdfjsTestingUtils={HighlightOutliner:HighlightOutliner},globalThis.pdfjsLib={AbortException:AbortException,AnnotationEditorLayer:AnnotationEditorLayer,AnnotationEditorParamsType:AnnotationEditorParamsType,AnnotationEditorType:AnnotationEditorType,AnnotationEditorUIManager:AnnotationEditorUIManager,AnnotationLayer:AnnotationLayer,AnnotationMode:AnnotationMode,AnnotationType:AnnotationType,build:"cbeef3233",ColorPicker:ColorPicker,createValidAbsoluteUrl:createValidAbsoluteUrl,DOMSVGFactory:DOMSVGFactory,DrawLayer:FreeTextEditor,FeatureTest:util_FeatureTest,fetchData:fetchData,getDocument:getDocument,getFilenameFromUrl:getFilenameFromUrl,getPdfFilenameFromUrl:getPdfFilenameFromUrl,getUuid:getUuid,getXfaPageViewport:getXfaPageViewport,GlobalWorkerOptions:GlobalWorkerOptions,ImageKind:util_ImageKind,InvalidPDFException:InvalidPDFException,isDataScheme:isDataScheme,isPdfFile:isPdfFile,isValidExplicitDest:_PixelsPerInch,MathClamp:MathClamp,noContextMenu:noContextMenu,normalizeUnicode:normalizeUnicode,OPS:OPS,OutputScale:OutputScale,PasswordResponses:PasswordResponses,PDFDataRangeTransport:PDFDataRangeTransport,PDFDateString:PDFDateString,PDFWorker:PDFWorker,PermissionFlag:PermissionFlag,PixelsPerInch:PixelsPerInch,RenderingCancelledException:RenderingCancelledException,ResponseException:ResponseException,setLayerDimensions:setLayerDimensions,shadow:shadow,SignatureExtractor:SignatureExtractor,stopEvent:stopEvent,SupportedImageMimeTypes:SupportedImageMimeTypes,TextLayer:TextLayer,TouchManager:TouchManager,updateUrlHash:updateUrlHash,Util:Util,VerbosityLevel:VerbosityLevel,version:"5.3.93",XfaLayer:XfaLayer}});

Anon7 - 2021