amis-playground
Version:
amis-playground 是一个amis在线代码编辑器可实时预览运行效果
2 lines • 366 kB
JavaScript
var Im=Object.defineProperty;var Dm=(h,t,e)=>t in h?Im(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e;var $=(h,t,e)=>(Dm(h,typeof t!="symbol"?t+"":t,e),e),Zd=(h,t,e)=>{if(!t.has(h))throw TypeError("Cannot "+e)};var r=(h,t,e)=>(Zd(h,t,"read from private field"),e?e.call(h):t.get(h)),f=(h,t,e)=>{if(t.has(h))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(h):t.set(h,e)},m=(h,t,e,s)=>(Zd(h,t,"write to private field"),s?s.call(h,e):t.set(h,e),e);var ie=(h,t,e,s)=>({set _(i){m(h,t,i,e)},get _(){return r(h,t,s)}}),b=(h,t,e)=>(Zd(h,t,"access private method"),e);import{_ as Ea,ch as D,eh as dt,ei as it,ej as Ht,e5 as Fm,bu as Om,ai as va,R as at,S as Nm,I as Ah,b5 as Hm}from"./index-7c288cb3.js";var Ba={};Ba.d=(h,t)=>{for(var e in t)Ba.o(t,e)&&!Ba.o(h,e)&&Object.defineProperty(h,e,{enumerable:!0,get:t[e]})};Ba.o=(h,t)=>Object.prototype.hasOwnProperty.call(h,t);var j=globalThis.pdfjsLib={};Ba.d(j,{AbortException:()=>Hn,AnnotationEditorLayer:()=>Af,AnnotationEditorParamsType:()=>U,AnnotationEditorType:()=>W,AnnotationEditorUIManager:()=>Dn,AnnotationLayer:()=>OA,AnnotationMode:()=>zs,CMapCompressionType:()=>ou,ColorPicker:()=>tc,DOMSVGFactory:()=>Rf,DrawLayer:()=>wf,FeatureTest:()=>Zt,GlobalWorkerOptions:()=>Os,ImageKind:()=>Sh,InvalidPDFException:()=>bp,MissingPDFException:()=>Nn,OPS:()=>we,Outliner:()=>Ju,PDFDataRangeTransport:()=>hg,PDFDateString:()=>Sp,PDFWorker:()=>Qn,PasswordResponses:()=>$m,PermissionFlag:()=>Um,PixelsPerInch:()=>mi,RenderingCancelledException:()=>Lf,TextLayer:()=>Jh,UnexpectedResponseException:()=>jd,Util:()=>k,VerbosityLevel:()=>Nd,XfaLayer:()=>dg,build:()=>mA,createValidAbsoluteUrl:()=>Wm,fetchData:()=>Wd,getDocument:()=>oA,getFilenameFromUrl:()=>sb,getPdfFilenameFromUrl:()=>ib,getXfaPageViewport:()=>nb,isDataScheme:()=>kf,isPdfFile:()=>Mf,noContextMenu:()=>te,normalizeUnicode:()=>Jm,renderTextLayer:()=>Jb,setLayerDimensions:()=>In,shadow:()=>X,updateTextLayer:()=>Zb,version:()=>gA});const Bt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),mp=[1,0,0,1,0,0],au=[.001,0,0,.001,0,0],Bm=1e7,tu=1.35,Ae={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},zs={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},jm="pdfjs_internal_editor_",W={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},U={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},Um={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ft={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Sh={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},mt={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},ya={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Nd={ERRORS:0,WARNINGS:1,INFOS:5},ou={NONE:0,BINARY:1},we={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},$m={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Hd=Nd.WARNINGS;function zm(h){Number.isInteger(h)&&(Hd=h)}function Vm(){return Hd}function Bd(h){Hd>=Nd.INFOS&&console.log(`Info: ${h}`)}function V(h){Hd>=Nd.WARNINGS&&console.log(`Warning: ${h}`)}function tt(h){throw new Error(h)}function _t(h,t){h||tt(t)}function Gm(h){switch(h==null?void 0:h.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Wm(h,t=null,e=null){if(!h)return null;try{if(e&&typeof h=="string"){if(e.addDefaultProtocol&&h.startsWith("www.")){const i=h.match(/\./g);(i==null?void 0:i.length)>=2&&(h=`http://${h}`)}if(e.tryConvertEncoding)try{h=Qm(h)}catch{}}const s=t?new URL(h,t):new URL(h);if(Gm(s))return s}catch{}return null}function X(h,t,e,s=!1){return Object.defineProperty(h,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const bi=function(){function t(e,s){this.constructor===t&&tt("Cannot initialize BaseException."),this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class lu extends bi{constructor(t,e){super(t,"PasswordException"),this.code=e}}class hu extends bi{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class bp extends bi{constructor(t){super(t,"InvalidPDFException")}}class Nn extends bi{constructor(t){super(t,"MissingPDFException")}}class jd extends bi{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class qm extends bi{constructor(t){super(t,"FormatError")}}class Hn extends bi{constructor(t){super(t,"AbortException")}}function Ap(h){(typeof h!="object"||(h==null?void 0:h.length)===void 0)&&tt("Invalid argument for bytesToString");const t=h.length,e=8192;if(t<e)return String.fromCharCode.apply(null,h);const s=[];for(let i=0;i<t;i+=e){const n=Math.min(i+e,t),a=h.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function Ud(h){typeof h!="string"&&tt("Invalid argument for stringToBytes");const t=h.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=h.charCodeAt(s)&255;return e}function Xm(h){return String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,h&255)}function Tf(h){const t=Object.create(null);for(const[e,s]of h)t[e]=s;return t}function Ym(){const h=new Uint8Array(4);return h[0]=1,new Uint32Array(h.buffer,0,1)[0]===1}function Km(){try{return new Function(""),!0}catch{return!1}}class Zt{static get isLittleEndian(){return X(this,"isLittleEndian",Ym())}static get isEvalSupported(){return X(this,"isEvalSupported",Km())}static get isOffscreenCanvasSupported(){return X(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?X(this,"platform",{isMac:navigator.platform.includes("Mac")}):X(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var t,e;return X(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const eu=Array.from(Array(256).keys(),h=>h.toString(16).padStart(2,"0"));var tr,xh,za,cu;class k{static makeHexColor(t,e,s){return`#${eu[t]}${eu[e]}${eu[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){const s=t[0]*e[0]+t[1]*e[2]+e[4],i=t[0]*e[1]+t[1]*e[3]+e[5];return[s,i]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2],i=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,n=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s;return[i,n]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],n[0],a[0]),Math.min(s[1],i[1],n[1],a[1]),Math.max(s[0],i[0],n[0],a[0]),Math.max(s[1],i[1],n[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],o=(s+a)/2,l=Math.sqrt((s+a)**2-4*(s*a-n*i))/2,c=o+l||1,d=o-l||1;return[Math.sqrt(c),Math.sqrt(d)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[s,n,i,a]}static bezierBoundingBox(t,e,s,i,n,a,o,l,c){return c?(c[0]=Math.min(c[0],t,o),c[1]=Math.min(c[1],e,l),c[2]=Math.max(c[2],t,o),c[3]=Math.max(c[3],e,l)):c=[Math.min(t,o),Math.min(e,l),Math.max(t,o),Math.max(e,l)],b(this,za,cu).call(this,t,s,n,o,e,i,a,l,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),c),b(this,za,cu).call(this,t,s,n,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),c),c}}tr=new WeakSet,xh=function(t,e,s,i,n,a,o,l,c,d){if(c<=0||c>=1)return;const u=1-c,p=c*c,g=p*c,A=u*(u*(u*t+3*c*e)+3*p*s)+g*i,v=u*(u*(u*n+3*c*a)+3*p*o)+g*l;d[0]=Math.min(d[0],A),d[1]=Math.min(d[1],v),d[2]=Math.max(d[2],A),d[3]=Math.max(d[3],v)},za=new WeakSet,cu=function(t,e,s,i,n,a,o,l,c,d,u,p){if(Math.abs(c)<1e-12){Math.abs(d)>=1e-12&&b(this,tr,xh).call(this,t,e,s,i,n,a,o,l,-u/d,p);return}const g=d**2-4*u*c;if(g<0)return;const A=Math.sqrt(g),v=2*c;b(this,tr,xh).call(this,t,e,s,i,n,a,o,l,(-d+A)/v,p),b(this,tr,xh).call(this,t,e,s,i,n,a,o,l,(-d-A)/v,p)},f(k,tr),f(k,za);function Qm(h){return decodeURIComponent(escape(h))}let su=null,Uf=null;function Jm(h){return su||(su=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Uf=new Map([["ſt","ſt"]])),h.replaceAll(su,(t,e,s)=>e?e.normalize("NFKC"):Uf.get(s))}function Zm(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const h=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(h);else for(let t=0;t<32;t++)h[t]=Math.floor(Math.random()*255);return Ap(h)}const vp="pdfjs_internal_id_",ss={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class $d{constructor(){this.constructor===$d&&tt("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}class zd{constructor(){this.constructor===zd&&tt("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d")}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){tt("Abstract method `_createCanvas` called.")}}class Vd{constructor({baseUrl:t=null,isCompressed:e=!0}){this.constructor===Vd&&tt("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":""),s=this.isCompressed?ou.BINARY:ou.NONE;return this._fetchData(e,s).catch(i=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}_fetchData(t,e){tt("Abstract method `_fetchData` called.")}}class Gd{constructor({baseUrl:t=null}){this.constructor===Gd&&tt("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetchData(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}_fetchData(t){tt("Abstract method `_fetchData` called.")}}class Pf{constructor(){this.constructor===Pf&&tt("Cannot initialize BaseSVGFactory.")}create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){tt("Abstract method `_createSVG` called.")}}const ns="http://www.w3.org/2000/svg",Ei=class Ei{};$(Ei,"CSS",96),$(Ei,"PDF",72),$(Ei,"PDF_TO_CSS_UNITS",Ei.CSS/Ei.PDF);let mi=Ei;var xi,Oe,hs,Yt,sc,Ci,Et,Ot,Vs,zn,Gs,Vn,er,Ch,ic,yp,Va,du,Ws,Gn,Ti,Sa,Pi,xa,Ga,uu,Ri,Ca;class tb extends $d{constructor({docId:e,ownerDocument:s=globalThis.document}={}){super();f(this,Et);f(this,Vs);f(this,Gs);f(this,er);f(this,ic);f(this,Va);f(this,Ws);f(this,Ti);f(this,Pi);f(this,Ga);f(this,Ri);f(this,xi,void 0);f(this,Oe,void 0);f(this,hs,void 0);f(this,Yt,void 0);f(this,sc,void 0);f(this,Ci,0);m(this,hs,e),m(this,Yt,s)}addFilter(e){if(!e)return"none";let s=r(this,Et,Ot).get(e);if(s)return s;const[i,n,a]=b(this,er,Ch).call(this,e),o=e.length===1?i:`${i}${n}${a}`;if(s=r(this,Et,Ot).get(o),s)return r(this,Et,Ot).set(e,s),s;const l=`g_${r(this,hs)}_transfer_map_${ie(this,Ci)._++}`,c=`url(#${l})`;r(this,Et,Ot).set(e,c),r(this,Et,Ot).set(o,c);const d=b(this,Ws,Gn).call(this,l);return b(this,Pi,xa).call(this,i,n,a,d),c}addHCMFilter(e,s){var A;const i=`${e}-${s}`,n="base";let a=r(this,Vs,zn).get(n);if((a==null?void 0:a.key)===i||(a?((A=a.filter)==null||A.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,Vs,zn).set(n,a)),!e||!s))return a.url;const o=b(this,Ri,Ca).call(this,e);e=k.makeHexColor(...o);const l=b(this,Ri,Ca).call(this,s);if(s=k.makeHexColor(...l),r(this,Gs,Vn).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const c=new Array(256);for(let v=0;v<=255;v++){const _=v/255;c[v]=_<=.03928?_/12.92:((_+.055)/1.055)**2.4}const d=c.join(","),u=`g_${r(this,hs)}_hcm_filter`,p=a.filter=b(this,Ws,Gn).call(this,u);b(this,Pi,xa).call(this,d,d,d,p),b(this,Va,du).call(this,p);const g=(v,_)=>{const y=o[v]/255,w=l[v]/255,E=new Array(_+1);for(let x=0;x<=_;x++)E[x]=y+x/_*(w-y);return E.join(",")};return b(this,Pi,xa).call(this,g(0,5),g(1,5),g(2,5),p),a.url=`url(#${u})`,a.url}addAlphaFilter(e){let s=r(this,Et,Ot).get(e);if(s)return s;const[i]=b(this,er,Ch).call(this,[e]),n=`alpha_${i}`;if(s=r(this,Et,Ot).get(n),s)return r(this,Et,Ot).set(e,s),s;const a=`g_${r(this,hs)}_alpha_map_${ie(this,Ci)._++}`,o=`url(#${a})`;r(this,Et,Ot).set(e,o),r(this,Et,Ot).set(n,o);const l=b(this,Ws,Gn).call(this,a);return b(this,Ga,uu).call(this,i,l),o}addLuminosityFilter(e){let s=r(this,Et,Ot).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=b(this,er,Ch).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=r(this,Et,Ot).get(n),s)return r(this,Et,Ot).set(e,s),s;const a=`g_${r(this,hs)}_luminosity_map_${ie(this,Ci)._++}`,o=`url(#${a})`;r(this,Et,Ot).set(e,o),r(this,Et,Ot).set(n,o);const l=b(this,Ws,Gn).call(this,a);return b(this,ic,yp).call(this,l),e&&b(this,Ga,uu).call(this,i,l),o}addHighlightHCMFilter(e,s,i,n,a){var w;const o=`${s}-${i}-${n}-${a}`;let l=r(this,Vs,zn).get(e);if((l==null?void 0:l.key)===o||(l?((w=l.filter)==null||w.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,Vs,zn).set(e,l)),!s||!i))return l.url;const[c,d]=[s,i].map(b(this,Ri,Ca).bind(this));let u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),p=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[g,A]=[n,a].map(b(this,Ri,Ca).bind(this));p<u&&([u,p,g,A]=[p,u,A,g]),r(this,Gs,Vn).style.color="";const v=(E,x,S)=>{const C=new Array(256),P=(p-u)/S,R=E/255,M=(x-E)/(255*S);let F=0;for(let T=0;T<=S;T++){const H=Math.round(u+T*P),I=R+T*M;for(let B=F;B<=H;B++)C[B]=I;F=H+1}for(let T=F;T<256;T++)C[T]=C[F-1];return C.join(",")},_=`g_${r(this,hs)}_hcm_${e}_filter`,y=l.filter=b(this,Ws,Gn).call(this,_);return b(this,Va,du).call(this,y),b(this,Pi,xa).call(this,v(g[0],A[0],5),v(g[1],A[1],5),v(g[2],A[2],5),y),l.url=`url(#${_})`,l.url}destroy(e=!1){e&&r(this,Vs,zn).size!==0||(r(this,Oe)&&(r(this,Oe).parentNode.parentNode.remove(),m(this,Oe,null)),r(this,xi)&&(r(this,xi).clear(),m(this,xi,null)),m(this,Ci,0))}}xi=new WeakMap,Oe=new WeakMap,hs=new WeakMap,Yt=new WeakMap,sc=new WeakMap,Ci=new WeakMap,Et=new WeakSet,Ot=function(){return r(this,xi)||m(this,xi,new Map)},Vs=new WeakSet,zn=function(){return r(this,sc)||m(this,sc,new Map)},Gs=new WeakSet,Vn=function(){if(!r(this,Oe)){const e=r(this,Yt).createElement("div"),{style:s}=e;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,Yt).createElementNS(ns,"svg");i.setAttribute("width",0),i.setAttribute("height",0),m(this,Oe,r(this,Yt).createElementNS(ns,"defs")),e.append(i),i.append(r(this,Oe)),r(this,Yt).body.append(e)}return r(this,Oe)},er=new WeakSet,Ch=function(e){if(e.length===1){const c=e[0],d=new Array(256);for(let p=0;p<256;p++)d[p]=c[p]/255;const u=d.join(",");return[u,u,u]}const[s,i,n]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let c=0;c<256;c++)a[c]=s[c]/255,o[c]=i[c]/255,l[c]=n[c]/255;return[a.join(","),o.join(","),l.join(",")]},ic=new WeakSet,yp=function(e){const s=r(this,Yt).createElementNS(ns,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(s)},Va=new WeakSet,du=function(e){const s=r(this,Yt).createElementNS(ns,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(s)},Ws=new WeakSet,Gn=function(e){const s=r(this,Yt).createElementNS(ns,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),r(this,Gs,Vn).append(s),s},Ti=new WeakSet,Sa=function(e,s,i){const n=r(this,Yt).createElementNS(ns,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},Pi=new WeakSet,xa=function(e,s,i,n){const a=r(this,Yt).createElementNS(ns,"feComponentTransfer");n.append(a),b(this,Ti,Sa).call(this,a,"feFuncR",e),b(this,Ti,Sa).call(this,a,"feFuncG",s),b(this,Ti,Sa).call(this,a,"feFuncB",i)},Ga=new WeakSet,uu=function(e,s){const i=r(this,Yt).createElementNS(ns,"feComponentTransfer");s.append(i),b(this,Ti,Sa).call(this,i,"feFuncA",e)},Ri=new WeakSet,Ca=function(e){return r(this,Gs,Vn).style.color=e,If(getComputedStyle(r(this,Gs,Vn)).getPropertyValue("color"))};class eb extends zd{constructor({ownerDocument:t=globalThis.document}={}){super(),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}async function Wd(h,t="text"){if(Ta(h,document.baseURI)){const e=await fetch(h);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",h,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class _p extends Vd{_fetchData(t,e){return Wd(t,this.isCompressed?"arraybuffer":"text").then(s=>({cMapData:s instanceof ArrayBuffer?new Uint8Array(s):Ud(s),compressionType:e}))}}class wp extends Gd{_fetchData(t){return Wd(t,"arraybuffer").then(e=>new Uint8Array(e))}}class Rf extends Pf{_createSVG(t){return document.createElementNS(ns,t)}}class dh{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:a=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=n;const o=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let c,d,u,p;switch(s%=360,s<0&&(s+=360),s){case 180:c=-1,d=0,u=0,p=1;break;case 90:c=0,d=1,u=1,p=0;break;case 270:c=0,d=-1,u=-1,p=0;break;case 0:c=1,d=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(u=-u,p=-p);let g,A,v,_;c===0?(g=Math.abs(l-t[1])*e+i,A=Math.abs(o-t[0])*e+n,v=(t[3]-t[1])*e,_=(t[2]-t[0])*e):(g=Math.abs(o-t[0])*e+i,A=Math.abs(l-t[1])*e+n,v=(t[2]-t[0])*e,_=(t[3]-t[1])*e),this.transform=[c*e,d*e,u*e,p*e,g-c*e*o-u*e*l,A-d*e*o-p*e*l],this.width=v,this.height=_}get rawDims(){const{viewBox:t}=this;return X(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new dh({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){return k.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=k.applyTransform([t[0],t[1]],this.transform),s=k.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return k.applyInverseTransform([t,e],this.transform)}}class Lf extends bi{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function kf(h){const t=h.length;let e=0;for(;e<t&&h[e].trim()==="";)e++;return h.substring(e,e+5).toLowerCase()==="data:"}function Mf(h){return typeof h=="string"&&/\.pdf$/i.test(h)}function sb(h){return[h]=h.split(/[#?]/,1),h.substring(h.lastIndexOf("/")+1)}function ib(h,t="document.pdf"){if(typeof h!="string")return t;if(kf(h))return V('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=e.exec(h);let n=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(n&&(n=n[0],n.includes("%")))try{n=s.exec(decodeURIComponent(n))[0]}catch{}return n||t}class $f{constructor(){$(this,"started",Object.create(null));$(this,"times",[])}time(t){t in this.started&&V(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||V(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
`);return t.join("")}}function Ta(h,t){try{const{protocol:e}=t?new URL(h,t):new URL(h);return e==="http:"||e==="https:"}catch{return!1}}function te(h){h.preventDefault()}function Ep(h){console.log("Deprecated API usage: "+h)}let zf;class Sp{static toDateObject(t){if(!t||typeof t!="string")return null;zf||(zf=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=zf.exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const c=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,c==="-"?(a+=d,o+=u):c==="+"&&(a-=d,o-=u),new Date(Date.UTC(s,i,n,a,o,l))}}function nb(h,{scale:t=1,rotation:e=0}){const{width:s,height:i}=h.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new dh({viewBox:n,scale:t,rotation:e})}function If(h){if(h.startsWith("#")){const t=parseInt(h.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return h.startsWith("rgb(")?h.slice(4,-1).split(",").map(t=>parseInt(t)):h.startsWith("rgba(")?h.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(V(`Not a valid color format: "${h}"`),[0,0,0])}function rb(h){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of h.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;h.set(e,If(s))}t.remove()}function lt(h){const{a:t,b:e,c:s,d:i,e:n,f:a}=h.getTransform();return[t,e,s,i,n,a]}function is(h){const{a:t,b:e,c:s,d:i,e:n,f:a}=h.getTransform().invertSelf();return[t,e,s,i,n,a]}function In(h,t,e=!1,s=!0){if(t instanceof dh){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:a}=h,o=Zt.isCSSRoundSupported,l=`var(--scale-factor) * ${i}px`,c=`var(--scale-factor) * ${n}px`,d=o?`round(${l}, 1px)`:`calc(${l})`,u=o?`round(${c}, 1px)`:`calc(${c})`;!e||t.rotation%180===0?(a.width=d,a.height=u):(a.width=u,a.height=d)}s&&h.setAttribute("data-main-rotation",t.rotation)}var Li,ki,Ne,Mi,nc,xp,rc,Cp,ac,Tp,sr,Th,oc,Pp,Wa,pu;const lc=class lc{constructor(t){f(this,rc);f(this,ac);f(this,sr);f(this,oc);f(this,Wa);f(this,Li,null);f(this,ki,null);f(this,Ne,void 0);f(this,Mi,null);m(this,Ne,t)}render(){const t=m(this,Li,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",te),t.addEventListener("pointerdown",b(lc,nc,xp));const e=m(this,Mi,document.createElement("div"));e.className="buttons",t.append(e);const s=r(this,Ne).toolbarPosition;if(s){const{style:i}=t,n=r(this,Ne)._uiManager.direction==="ltr"?1-s[0]:s[0];i.insetInlineEnd=`${100*n}%`,i.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return b(this,oc,Pp).call(this),t}hide(){var t;r(this,Li).classList.add("hidden"),(t=r(this,ki))==null||t.hideDropdown()}show(){r(this,Li).classList.remove("hidden")}addAltTextButton(t){b(this,sr,Th).call(this,t),r(this,Mi).prepend(t,r(this,Wa,pu))}addColorPicker(t){m(this,ki,t);const e=t.renderButton();b(this,sr,Th).call(this,e),r(this,Mi).prepend(e,r(this,Wa,pu))}remove(){var t;r(this,Li).remove(),(t=r(this,ki))==null||t.destroy(),m(this,ki,null)}};Li=new WeakMap,ki=new WeakMap,Ne=new WeakMap,Mi=new WeakMap,nc=new WeakSet,xp=function(t){t.stopPropagation()},rc=new WeakSet,Cp=function(t){r(this,Ne)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},ac=new WeakSet,Tp=function(t){r(this,Ne)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},sr=new WeakSet,Th=function(t){t.addEventListener("focusin",b(this,rc,Cp).bind(this),{capture:!0}),t.addEventListener("focusout",b(this,ac,Tp).bind(this),{capture:!0}),t.addEventListener("contextmenu",te)},oc=new WeakSet,Pp=function(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${r(this,Ne).editorType}-button`),b(this,sr,Th).call(this,t),t.addEventListener("click",e=>{r(this,Ne)._uiManager.delete()}),r(this,Mi).append(t)},Wa=new WeakSet,pu=function(){const t=document.createElement("div");return t.className="divider",t},f(lc,nc);let fu=lc;var qa,Ii,Xa,hc,Rp,cc,Lp,dc,kp;class ab{constructor(t){f(this,hc);f(this,cc);f(this,dc);f(this,qa,null);f(this,Ii,null);f(this,Xa,void 0);m(this,Xa,t)}show(t,e,s){const[i,n]=b(this,cc,Lp).call(this,e,s),{style:a}=r(this,Ii)||m(this,Ii,b(this,hc,Rp).call(this));t.append(r(this,Ii)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,Ii).remove()}}qa=new WeakMap,Ii=new WeakMap,Xa=new WeakMap,hc=new WeakSet,Rp=function(){const t=m(this,Ii,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",te);const e=m(this,qa,document.createElement("div"));return e.className="buttons",t.append(e),b(this,dc,kp).call(this),t},cc=new WeakSet,Lp=function(t,e){let s=0,i=0;for(const n of t){const a=n.y+n.height;if(a<s)continue;const o=n.x+(e?n.width:0);if(a>s){i=o,s=a;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},dc=new WeakSet,kp=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label"),t.addEventListener("contextmenu",te),t.addEventListener("click",()=>{r(this,Xa).highlightSelection("floating_button")}),r(this,qa).append(t)};function Yh(h,t,e){for(const s of e)t.addEventListener(s,h[s].bind(h))}function ob(h){return Math.round(Math.min(255,Math.max(1,255*h))).toString(16).padStart(2,"0")}var uc;class lb{constructor(){f(this,uc,0)}get id(){return`${jm}${ie(this,uc)._++}`}}uc=new WeakMap;var Ya,fc,pe,Ka,mu;const Hf=class Hf{constructor(){f(this,Ka);f(this,Ya,Zm());f(this,fc,0);f(this,pe,null)}static get _isSVGFittingCanvas(){const t='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>',s=new OffscreenCanvas(1,3).getContext("2d"),i=new Image;i.src=t;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return X(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return b(this,Ka,mu).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return b(this,Ka,mu).call(this,t,t)}async getFromId(t){r(this,pe)||m(this,pe,new Map);const e=r(this,pe).get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=r(this,pe).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){r(this,pe)||m(this,pe,new Map);const e=r(this,pe).get(t);e&&(e.refCounter-=1,e.refCounter===0&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${r(this,Ya)}_`)}};Ya=new WeakMap,fc=new WeakMap,pe=new WeakMap,Ka=new WeakSet,mu=async function(t,e){r(this,pe)||m(this,pe,new Map);let s=r(this,pe).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,Ya)}_${ie(this,fc)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Wd(e,"blob")):i=s.file=e,i.type==="image/svg+xml"){const n=Hf._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((c,d)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,c()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=d});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){console.error(i),s=null}return r(this,pe).set(t,s),s&&r(this,pe).set(s.id,s),s};let gu=Hf;var St,qs,Qa,xt;class hb{constructor(t=128){f(this,St,[]);f(this,qs,!1);f(this,Qa,void 0);f(this,xt,-1);m(this,Qa,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),r(this,qs))return;const l={cmd:t,undo:e,post:s,type:n};if(r(this,xt)===-1){r(this,St).length>0&&(r(this,St).length=0),m(this,xt,0),r(this,St).push(l);return}if(a&&r(this,St)[r(this,xt)].type===n){o&&(l.undo=r(this,St)[r(this,xt)].undo),r(this,St)[r(this,xt)]=l;return}const c=r(this,xt)+1;c===r(this,Qa)?r(this,St).splice(0,1):(m(this,xt,c),c<r(this,St).length&&r(this,St).splice(c)),r(this,St).push(l)}undo(){if(r(this,xt)===-1)return;m(this,qs,!0);const{undo:t,post:e}=r(this,St)[r(this,xt)];t(),e==null||e(),m(this,qs,!1),m(this,xt,r(this,xt)-1)}redo(){if(r(this,xt)<r(this,St).length-1){m(this,xt,r(this,xt)+1),m(this,qs,!0);const{cmd:t,post:e}=r(this,St)[r(this,xt)];t(),e==null||e(),m(this,qs,!1)}}hasSomethingToUndo(){return r(this,xt)!==-1}hasSomethingToRedo(){return r(this,xt)<r(this,St).length-1}destroy(){m(this,St,null)}}St=new WeakMap,qs=new WeakMap,Qa=new WeakMap,xt=new WeakMap;var pc,Mp;class uh{constructor(t){f(this,pc);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Zt.platform;for(const[s,i,n={}]of t)for(const a of s){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(b(this,pc,Mp).call(this,e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:a=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...a,e)(),n||(e.stopPropagation(),e.preventDefault()))}}pc=new WeakSet,Mp=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const gc=class gc{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return rb(t),X(this,"_colors",t)}convert(t){const e=If(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,a)=>n===e[a]))return gc._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?k.makeHexColor(...e):t}};$(gc,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let bu=gc;var ae,bt,Tt,ir,cs,nr,Ee,rr,Di,He,ds,Fi,Ja,Za,Be,ar,Xs,je,mc,Ys,to,Oi,eo,or,Pt,Q,us,Ni,so,io,no,ro,ao,oo,lo,ho,co,uo,fo,po,go,mo,Ks,Ue,fs,bo,lr,Ph,bc,Ip,Ac,Dp,hr,Rh,vc,Fp,yc,Op,_c,Np,Ao,Au,vo,vu,yo,yu,_o,_u,wo,wu,Rt,$t,$e,js,wc,Hp,Ec,Bp,Eo,Eu,Sc,jp,Hi,Pa,So,Su;const Yn=class Yn{constructor(t,e,s,i,n,a,o,l,c){f(this,lr);f(this,bc);f(this,Ac);f(this,hr);f(this,vc);f(this,yc);f(this,_c);f(this,Ao);f(this,vo);f(this,yo);f(this,_o);f(this,wo);f(this,Rt);f(this,$e);f(this,wc);f(this,Ec);f(this,Eo);f(this,Sc);f(this,Hi);f(this,So);f(this,ae,null);f(this,bt,new Map);f(this,Tt,new Map);f(this,ir,null);f(this,cs,null);f(this,nr,null);f(this,Ee,new hb);f(this,rr,0);f(this,Di,new Set);f(this,He,null);f(this,ds,null);f(this,Fi,new Set);f(this,Ja,!1);f(this,Za,null);f(this,Be,null);f(this,ar,null);f(this,Xs,!1);f(this,je,null);f(this,mc,new lb);f(this,Ys,!1);f(this,to,!1);f(this,Oi,null);f(this,eo,null);f(this,or,null);f(this,Pt,W.NONE);f(this,Q,new Set);f(this,us,null);f(this,Ni,null);f(this,so,null);f(this,io,this.blur.bind(this));f(this,no,this.focus.bind(this));f(this,ro,this.copy.bind(this));f(this,ao,this.cut.bind(this));f(this,oo,this.paste.bind(this));f(this,lo,this.keydown.bind(this));f(this,ho,this.keyup.bind(this));f(this,co,this.onEditingAction.bind(this));f(this,uo,this.onPageChanging.bind(this));f(this,fo,this.onScaleChanging.bind(this));f(this,po,b(this,Ac,Dp).bind(this));f(this,go,this.onRotationChanging.bind(this));f(this,mo,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});f(this,Ks,[0,0]);f(this,Ue,null);f(this,fs,null);f(this,bo,null);m(this,fs,t),m(this,bo,e),m(this,ir,s),this._eventBus=i,this._eventBus._on("editingaction",r(this,co)),this._eventBus._on("pagechanging",r(this,uo)),this._eventBus._on("scalechanging",r(this,fo)),this._eventBus._on("rotationchanging",r(this,go)),b(this,vc,Fp).call(this),b(this,vo,vu).call(this),m(this,cs,n.annotationStorage),m(this,Za,n.filterFactory),m(this,Ni,a),m(this,ar,o||null),m(this,Ja,l),m(this,or,c||null),this.viewParameters={realScale:mi.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=Yn.prototype,e=a=>r(a,fs).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return X(this,"_keyboardManager",new uh([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,fs).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,fs).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e;b(this,yo,yu).call(this),b(this,Ao,Au).call(this),this._eventBus._off("editingaction",r(this,co)),this._eventBus._off("pagechanging",r(this,uo)),this._eventBus._off("scalechanging",r(this,fo)),this._eventBus._off("rotationchanging",r(this,go));for(const s of r(this,Tt).values())s.destroy();r(this,Tt).clear(),r(this,bt).clear(),r(this,Fi).clear(),m(this,ae,null),r(this,Q).clear(),r(this,Ee).destroy(),(t=r(this,ir))==null||t.destroy(),(e=r(this,je))==null||e.hide(),m(this,je,null),r(this,Be)&&(clearTimeout(r(this,Be)),m(this,Be,null)),r(this,Ue)&&(clearTimeout(r(this,Ue)),m(this,Ue,null)),b(this,yc,Op).call(this)}async mlGuess(t){var e;return((e=r(this,or))==null?void 0:e.guess(t))||null}get hasMLManager(){return!!r(this,or)}get hcmFilter(){return X(this,"hcmFilter",r(this,Ni)?r(this,Za).addHCMFilter(r(this,Ni).foreground,r(this,Ni).background):"none")}get direction(){return X(this,"direction",getComputedStyle(r(this,fs)).direction)}get highlightColors(){return X(this,"highlightColors",r(this,ar)?new Map(r(this,ar).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return X(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){m(this,eo,t)}editAltText(t){var e;(e=r(this,ir))==null||e.editAltText(this,t)}onPageChanging({pageNumber:t}){m(this,rr,t-1)}focusMainContainer(){r(this,fs).focus()}findParent(t,e){for(const s of r(this,Tt).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){r(this,bo).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,Fi).add(t)}removeShouldRescale(t){r(this,Fi).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*mi.PDF_TO_CSS_UNITS;for(const e of r(this,Fi))e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a}=e,o=e.toString(),c=b(this,lr,Ph).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(c);if(d){e.empty(),r(this,Pt)===W.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:W.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const u of r(this,Tt).values())if(u.hasTextLayer(c)){u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a,text:o});break}}}addToAnnotationStorage(t){!t.isEmpty()&&r(this,cs)&&!r(this,cs).has(t.id)&&r(this,cs).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,r(this,Xs)&&(m(this,Xs,!1),b(this,hr,Rh).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,Q))if(e.div.contains(t)){m(this,Oi,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,Oi))return;const[t,e]=r(this,Oi);m(this,Oi,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus()}addEditListeners(){b(this,vo,vu).call(this),b(this,_o,_u).call(this)}removeEditListeners(){b(this,yo,yu).call(this),b(this,wo,wu).call(this)}copy(t){var s;if(t.preventDefault(),(s=r(this,ae))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of r(this,Q)){const n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const a of r(this,ds))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){V(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const l of s){const c=i.deserialize(l);if(!c)return;n.push(c)}const a=()=>{for(const l of n)b(this,Eo,Eu).call(this,l);b(this,So,Su).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){V(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,Pt)!==W.NONE&&!this.isEditorHandlingKeyboard&&Yn._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,Xs)&&(m(this,Xs,!1),b(this,hr,Rh).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(t){t?(b(this,_c,Np).call(this),b(this,_o,_u).call(this),b(this,Rt,$t).call(this,{isEditing:r(this,Pt)!==W.NONE,isEmpty:b(this,Hi,Pa).call(this),hasSomethingToUndo:r(this,Ee).hasSomethingToUndo(),hasSomethingToRedo:r(this,Ee).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,Ao,Au).call(this),b(this,wo,wu).call(this),b(this,Rt,$t).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,ds)){m(this,ds,t);for(const e of r(this,ds))b(this,$e,js).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,mc).id}get currentLayer(){return r(this,Tt).get(r(this,rr))}getLayer(t){return r(this,Tt).get(t)}get currentPageIndex(){return r(this,rr)}addLayer(t){r(this,Tt).set(t.pageIndex,t),r(this,Ys)?t.enable():t.disable()}removeLayer(t){r(this,Tt).delete(t.pageIndex)}updateMode(t,e=null,s=!1){if(r(this,Pt)!==t){if(m(this,Pt,t),t===W.NONE){this.setEditingState(!1),b(this,Ec,Bp).call(this);return}this.setEditingState(!0),b(this,wc,Hp).call(this),this.unselectAll();for(const i of r(this,Tt).values())i.updateMode(t);if(!e&&s){this.addNewEditorFromKeyboard();return}if(e){for(const i of r(this,bt).values())if(i.annotationElementId===e){this.setSelected(i),i.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==r(this,Pt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var s;if(r(this,ds)){switch(t){case U.CREATE:this.currentLayer.addNewEditor();return;case U.HIGHLIGHT_DEFAULT_COLOR:(s=r(this,eo))==null||s.updateColor(e);break;case U.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,so)||m(this,so,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of r(this,Q))i.updateParams(t,e);for(const i of r(this,ds))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const a of r(this,bt).values())a.editorType===t&&a.show(e);(((n=r(this,so))==null?void 0:n.get(U.HIGHLIGHT_SHOW_ALL))??!0)!==e&&b(this,$e,js).call(this,[[U.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,to)!==t){m(this,to,t);for(const e of r(this,Tt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of r(this,bt).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return r(this,bt).get(t)}addEditor(t){r(this,bt).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(r(this,Be)&&clearTimeout(r(this,Be)),m(this,Be,setTimeout(()=>{this.focusMainContainer(),m(this,Be,null)},0))),r(this,bt).delete(t.id),this.unselect(t),(!t.annotationElementId||!r(this,Di).has(t.annotationElementId))&&((e=r(this,cs))==null||e.remove(t.id))}addDeletedAnnotationElement(t){r(this,Di).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,Di).has(t)}removeDeletedAnnotationElement(t){r(this,Di).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,ae)!==t&&(m(this,ae,t),t&&b(this,$e,js).call(this,t.propertiesToUpdate))}updateUI(t){r(this,Sc,jp)===t&&b(this,$e,js).call(this,t.propertiesToUpdate)}toggleSelected(t){if(r(this,Q).has(t)){r(this,Q).delete(t),t.unselect(),b(this,Rt,$t).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,Q).add(t),t.select(),b(this,$e,js).call(this,t.propertiesToUpdate),b(this,Rt,$t).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of r(this,Q))e!==t&&e.unselect();r(this,Q).clear(),r(this,Q).add(t),t.select(),b(this,$e,js).call(this,t.propertiesToUpdate),b(this,Rt,$t).call(this,{hasSelectedEditor:!0})}isSelected(t){return r(this,Q).has(t)}get firstSelectedEditor(){return r(this,Q).values().next().value}unselect(t){t.unselect(),r(this,Q).delete(t),b(this,Rt,$t).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,Q).size!==0}get isEnterHandled(){return r(this,Q).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){r(this,Ee).undo(),b(this,Rt,$t).call(this,{hasSomethingToUndo:r(this,Ee).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,Hi,Pa).call(this)})}redo(){r(this,Ee).redo(),b(this,Rt,$t).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,Ee).hasSomethingToRedo(),isEmpty:b(this,Hi,Pa).call(this)})}addCommands(t){r(this,Ee).add(t),b(this,Rt,$t).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,Hi,Pa).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...r(this,Q)],e=()=>{for(const i of t)i.remove()},s=()=>{for(const i of t)b(this,Eo,Eu).call(this,i)};this.addCommands({cmd:e,undo:s,mustExec:!0})}commitOrRemove(){var t;(t=r(this,ae))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,ae)||this.hasSelection}selectAll(){for(const t of r(this,Q))t.commit();b(this,So,Su).call(this,r(this,bt).values())}unselectAll(){if(!(r(this,ae)&&(r(this,ae).commitOrRemove(),r(this,Pt)!==W.NONE))&&this.hasSelection){for(const t of r(this,Q))t.unselect();r(this,Q).clear(),b(this,Rt,$t).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,Ks)[0]+=t,r(this,Ks)[1]+=e;const[i,n]=r(this,Ks),a=[...r(this,Q)],o=1e3;r(this,Ue)&&clearTimeout(r(this,Ue)),m(this,Ue,setTimeout(()=>{m(this,Ue,null),r(this,Ks)[0]=r(this,Ks)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,bt).has(l.id)&&l.translateInPage(i,n)},undo:()=>{for(const l of a)r(this,bt).has(l.id)&&l.translateInPage(-i,-n)},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),m(this,He,new Map);for(const t of r(this,Q))r(this,He).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,He))return!1;this.disableUserSelect(!1);const t=r(this,He);m(this,He,null);let e=!1;for(const[{x:i,y:n,pageIndex:a},o]of t)o.newX=i,o.newY=n,o.newPageIndex=a,e||(e=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,n,a,o)=>{if(r(this,bt).has(i.id)){const l=r(this,Tt).get(o);l?i._setParentAndPosition(l,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of t)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of t)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,He))for(const s of r(this,He).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.a