222
This commit is contained in:
1 parent
b284193114
commit
1e3ebb99b8
49 files changed
+48
-48
No files matched your search
@@ -0,0 +1,35 @@
|
||||
var Ks=Object.defineProperty;var vs=(lt,r,h)=>r in lt?Ks(lt,r,{enumerable:!0,configurable:!0,writable:!0,value:h}):lt[r]=h;var gl=(lt,r,h)=>(vs(lt,typeof r!="symbol"?r+"":r,h),h),Xe=(lt,r,h)=>{if(!r.has(lt))throw TypeError("Cannot "+h)};var bt=(lt,r,h)=>(Xe(lt,r,"read from private field"),h?h.call(lt):r.get(lt)),ll=(lt,r,h)=>{if(r.has(lt))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(lt):r.set(lt,h)},ul=(lt,r,h,m)=>(Xe(lt,r,"write to private field"),m?m.call(lt,h):r.set(lt,h),h);var Al=(lt,r,h,m)=>({set _(T){ul(lt,r,T,h)},get _(){return bt(lt,r,m)}}),nl=(lt,r,h)=>(Xe(lt,r,"access private method"),h);import{a7 as propsFactory,ab as genericComponent,af as useRender,x as createVNode,z as mergeProps,c_ as omit,c$ as IconValue,d0 as getUid,f as computed,ak as useProxiedModel,d1 as filterInputAttrs,S as Fragment,r as ref,s as openBlock,R as createElementBlock,v as withCtx,E as VCol,K as VCard,T as renderList,F as VCardActions,t as createBlock,y as createTextVNode,A as VBtn,a0 as createCommentVNode,D as VRow,M as createBaseVNode,$ as toDisplayString,cP as getAugmentedNamespace$1,ah as shallowRef,ao as watchEffect,e as onBeforeUnmount,bk as defineComponent,ck as toValue,an as toRef,w as watch,c3 as renderSlot,bO as normalizeStyle,cQ as commonjsGlobal$1,Q as resolveComponent,u as unref,X as VImg,L as VDialog,U as axiosApiInstance,cT as VCardSubtitle,a5 as baseURL,_ as _export_sfc,d2 as get_name,B as VCardTitle,aP as normalizeClass,I as VProgressLinear,G as withDirectives,H as vShow,C as VCardText,Z as VDivider,d3 as spravURLBase,a3 as VListItem,V as VIcon,cV as pagecounter,cN as useRoute,bX as onUpdated}from"./index-ddd50af6.js";import{P as PatternTabs}from"./PatternTabs-802cc916.js";import{V as VWindow,a as VWindowItem}from"./VWindowItem-01501256.js";import{V as VSpacer}from"./VSpacer-8f8d4bec.js";import{V as VContainer}from"./VContainer-66e02ae7.js";import{m as makeVInputProps,V as VInput,a as VLabel}from"./VInput-45f929b7.js";import{m as makeVSelectionControlProps,V as VSelectionControl,a as makeSelectionControlGroupProps,b as VSelectionControlGroup}from"./VSelectionControl-1d5c3ce5.js";import{V as VCheckbox}from"./VCheckbox-875be128.js";import{V as VExpansionPanels,a as VExpansionPanel,b as VExpansionPanelTitle,c as VExpansionPanelText}from"./VExpansionPanels-41ff2ac5.js";import{V as VList}from"./VList-d328b13d.js";import"./ssrBoot-d6a6682b.js";import"./VCheckboxBtn-bc2ce272.js";const makeVRadioProps=propsFactory({...makeVSelectionControlProps({falseIcon:"$radioOff",trueIcon:"$radioOn"})},"VRadio"),VRadio=genericComponent()({name:"VRadio",props:makeVRadioProps(),setup(lt,r){let{slots:h}=r;return useRender(()=>createVNode(VSelectionControl,mergeProps(lt,{class:["v-radio",lt.class],style:lt.style,type:"radio"}),h)),{}}}),VRadioGroup$1="",makeVRadioGroupProps=propsFactory({height:{type:[Number,String],default:"auto"},...makeVInputProps(),...omit(makeSelectionControlGroupProps(),["multiple"]),trueIcon:{type:IconValue,default:"$radioOn"},falseIcon:{type:IconValue,default:"$radioOff"},type:{type:String,default:"radio"}},"VRadioGroup"),VRadioGroup=genericComponent()({name:"VRadioGroup",inheritAttrs:!1,props:makeVRadioGroupProps(),emits:{"update:modelValue":lt=>!0},setup(lt,r){let{attrs:h,slots:m}=r;const T=getUid(),B=computed(()=>lt.id||`radio-group-${T}`),v=useProxiedModel(lt,"modelValue");return useRender(()=>{const[F,J]=filterInputAttrs(h),p=VInput.filterProps(lt),S=VSelectionControl.filterProps(lt),_=m.label?m.label({label:lt.label,props:{for:B.value}}):lt.label;return createVNode(VInput,mergeProps({class:["v-radio-group",lt.class],style:lt.style},F,p,{modelValue:v.value,"onUpdate:modelValue":U=>v.value=U,id:B.value}),{...m,default:U=>{let{id:f,messagesId:L,isDisabled:g,isReadonly:I}=U;return createVNode(Fragment,null,[_&&createVNode(VLabel,{id:f.value},{default:()=>[_]}),createVNode(VSelectionControlGroup,mergeProps(S,{id:f.value,"aria-describedby":L.value,defaultsTarget:"VRadio",trueIcon:lt.trueIcon,falseIcon:lt.falseIcon,type:lt.type,disabled:g.value,readonly:I.value,"aria-labelledby":_?f.value:void 0,multiple:!1},J,{modelValue:v.value,"onUpdate:modelValue":C=>v.value=C}),m)])}})}),{}}}),_sfc_main$4={__name:"TestSafety",props:{data:Array},setup(lt){const r=ref([{question:"Вопрос 1",answers:["1","2","3","4"]},{question:"Вопрос 2",answers:["Rer","LoL","Fort","FullG"]},{checkQuestion:"Вопрос с чексбоксом",answers:["Кукумбер","Сикельд"]}]),h=ref(""),m=ref([]),T=ref([]),B=ref(0);return(v,F)=>(openBlock(),createElementBlock(Fragment,null,[createVNode(VRow,null,{default:withCtx(()=>[createVNode(VCol,{cols:"12"},{default:withCtx(()=>[createVNode(VCard,null,{default:withCtx(()=>[createVNode(VWindow,{modelValue:B.value,"onUpdate:modelValue":F[2]||(F[2]=J=>B.value=J)},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.value,(J,p)=>(openBlock(),createBlock(VWindowItem,{key:p},{default:withCtx(()=>[JLine truncated
|
||||
`);return wt.join("")}}r.StatTimer=K;function P(Ft,wt){try{const{protocol:Yt}=wt?new URL(Ft,wt):new URL(Ft);return Yt==="http:"||Yt==="https:"}catch{return!1}}function M(Ft){Ft.preventDefault()}function u(Ft,wt=!1){return new Promise((Yt,jt)=>{const $t=document.createElement("script");$t.src=Ft,$t.onload=function(al){wt&&$t.remove(),Yt(al)},$t.onerror=function(){jt(new Error(`Cannot load script at: ${$t.src}`))},(document.head||document.documentElement).append($t)})}function q(Ft){console.log("Deprecated API usage: "+Ft)}let $;class H{static toDateObject(wt){if(!wt||typeof wt!="string")return null;$||($=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const Yt=$.exec(wt);if(!Yt)return null;const jt=parseInt(Yt[1],10);let $t=parseInt(Yt[2],10);$t=$t>=1&&$t<=12?$t-1:0;let al=parseInt(Yt[3],10);al=al>=1&&al<=31?al:1;let Ml=parseInt(Yt[4],10);Ml=Ml>=0&&Ml<=23?Ml:0;let pl=parseInt(Yt[5],10);pl=pl>=0&&pl<=59?pl:0;let Xl=parseInt(Yt[6],10);Xl=Xl>=0&&Xl<=59?Xl:0;const Yl=Yt[7]||"Z";let Vl=parseInt(Yt[8],10);Vl=Vl>=0&&Vl<=23?Vl:0;let yl=parseInt(Yt[9],10)||0;return yl=yl>=0&&yl<=59?yl:0,Yl==="-"?(Ml+=Vl,pl+=yl):Yl==="+"&&(Ml-=Vl,pl-=yl),new Date(Date.UTC(jt,$t,al,Ml,pl,Xl))}}r.PDFDateString=H;function Zt(Ft,{scale:wt=1,rotation:Yt=0}){const{width:jt,height:$t}=Ft.attributes.style,al=[0,0,parseInt(jt),parseInt($t)];return new f({viewBox:al,scale:wt,rotation:Yt})}function at(Ft){if(Ft.startsWith("#")){const wt=parseInt(Ft.slice(1),16);return[(wt&16711680)>>16,(wt&65280)>>8,wt&255]}return Ft.startsWith("rgb(")?Ft.slice(4,-1).split(",").map(wt=>parseInt(wt)):Ft.startsWith("rgba(")?Ft.slice(5,-1).split(",").map(wt=>parseInt(wt)).slice(0,3):((0,T.warn)(`Not a valid color format: "${Ft}"`),[0,0,0])}function It(Ft){const wt=document.createElement("span");wt.style.visibility="hidden",document.body.append(wt);for(const Yt of Ft.keys()){wt.style.color=Yt;const jt=window.getComputedStyle(wt).color;Ft.set(Yt,at(jt))}wt.remove()}function xt(Ft){const{a:wt,b:Yt,c:jt,d:$t,e:al,f:Ml}=Ft.getTransform();return[wt,Yt,jt,$t,al,Ml]}function it(Ft){const{a:wt,b:Yt,c:jt,d:$t,e:al,f:Ml}=Ft.getTransform().invertSelf();return[wt,Yt,jt,$t,al,Ml]}function Xt(Ft,wt,Yt=!1,jt=!0){if(wt instanceof f){const{pageWidth:$t,pageHeight:al}=wt.rawDims,{style:Ml}=Ft,pl=T.FeatureTest.isCSSRoundSupported,Xl=`var(--scale-factor) * ${$t}px`,Yl=`var(--scale-factor) * ${al}px`,Vl=pl?`round(${Xl}, 1px)`:`calc(${Xl})`,yl=pl?`round(${Yl}, 1px)`:`calc(${Yl})`;!Yt||wt.rotation%180===0?(Ml.width=Vl,Ml.height=yl):(Ml.width=yl,Ml.height=Vl)}jt&&Ft.setAttribute("data-main-rotation",wt.rotation)}},(lt,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BaseStandardFontDataFactory=r.BaseSVGFactory=r.BaseFilterFactory=r.BaseCanvasFactory=r.BaseCMapReaderFactory=void 0;var m=h(1);class T{constructor(){this.constructor===T&&(0,m.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(S){return"none"}addHCMFilter(S,_){return"none"}addHighlightHCMFilter(S,_,U,f){return"none"}destroy(S=!1){}}r.BaseFilterFactory=T;class B{constructor(){this.constructor===B&&(0,m.unreachable)("Cannot initialize BaseCanvasFactory.")}create(S,_){if(S<=0||_<=0)throw new Error("Invalid canvas size");const U=this._createCanvas(S,_);return{canvas:U,context:U.getContext("2d")}}reset(S,_,U){if(!S.canvas)throw new Error("Canvas is not specified");if(_<=0||U<=0)throw new Error("Invalid canvas size");S.canvas.width=_,S.canvas.height=U}destroy(S){if(!S.canvas)throw new Error("Canvas is not specified");S.canvas.width=0,S.canvas.height=0,S.canvas=null,S.context=null}_createCanvas(S,_){(0,m.unreachable)("Abstract method `_createCanvas` called.")}}r.BaseCanvasFactory=B;class v{constructor({baseUrl:S=null,isCompressed:_=!0}){this.constructor===v&&(0,m.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=S,this.isCompressed=_}async fetch({name:S}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!S)throw new Error("CMap name must be specified.");const _=this.baseUrl+S+(this.isCompressed?".bcmap":""),U=this.isCompressed?m.CMapCompressionType.BINARY:m.CMapCompressionType.NONE;return this._fetchData(_,U).catch(f=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${_}`)})}_fetchData(S,_){(0,m.unreachable)("Abstract method `_fetchData` called.")}}r.BaseCMapReaderFactory=v;class F{constructor({baseUrl:S=null}){this.constructor===F&&(0,m.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=S}async fetch({filename:S}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!S)throw new Error("Font filename must be specified.");const _=`${this.baseUrl}${S}`;return this._fetchData(_).catch(U=>{throw new Error(`Unable to load font data at: ${_}`)})}_fetchData(S){(0,m.unreachable)("Ab
Line truncated
|
||||
`)}return this.compiledGlyphs[p]=new Function("c","size",_.join(""))}return this.compiledGlyphs[p]=function(_,U){for(const f of S)f.cmd==="scale"&&(f.args=[U,-U]),_[f.cmd].apply(_,f.args)}}}r.FontFaceObject=B},(lt,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.NodeStandardFontDataFactory=r.NodeFilterFactory=r.NodeCanvasFactory=r.NodeCMapReaderFactory=void 0;var m=h(7);h(1);const T=function(p){return new Promise((S,_)=>{require$$5.readFile(p,(f,L)=>{if(f||!L){_(new Error(f));return}S(new Uint8Array(L))})})};class B extends m.BaseFilterFactory{}r.NodeFilterFactory=B;class v extends m.BaseCanvasFactory{_createCanvas(S,_){return require$$5.createCanvas(S,_)}}r.NodeCanvasFactory=v;class F extends m.BaseCMapReaderFactory{_fetchData(S,_){return T(S).then(U=>({cMapData:U,compressionType:_}))}}r.NodeCMapReaderFactory=F;class J extends m.BaseStandardFontDataFactory{_fetchData(S){return T(S)}}r.NodeStandardFontDataFactory=J},(lt,r,h)=>{var Nt,De,Lt,Ce;Object.defineProperty(r,"__esModule",{value:!0}),r.CanvasGraphics=void 0;var m=h(1),T=h(6),B=h(12),v=h(13);const F=16,J=100,p=4096,S=15,_=10,U=1e3,f=16;function L(dt,w){if(dt._removeMirroring)throw new Error("Context is already forwarding operations.");dt.__originalSave=dt.save,dt.__originalRestore=dt.restore,dt.__originalRotate=dt.rotate,dt.__originalScale=dt.scale,dt.__originalTranslate=dt.translate,dt.__originalTransform=dt.transform,dt.__originalSetTransform=dt.setTransform,dt.__originalResetTransform=dt.resetTransform,dt.__originalClip=dt.clip,dt.__originalMoveTo=dt.moveTo,dt.__originalLineTo=dt.lineTo,dt.__originalBezierCurveTo=dt.bezierCurveTo,dt.__originalRect=dt.rect,dt.__originalClosePath=dt.closePath,dt.__originalBeginPath=dt.beginPath,dt._removeMirroring=()=>{dt.save=dt.__originalSave,dt.restore=dt.__originalRestore,dt.rotate=dt.__originalRotate,dt.scale=dt.__originalScale,dt.translate=dt.__originalTranslate,dt.transform=dt.__originalTransform,dt.setTransform=dt.__originalSetTransform,dt.resetTransform=dt.__originalResetTransform,dt.clip=dt.__originalClip,dt.moveTo=dt.__originalMoveTo,dt.lineTo=dt.__originalLineTo,dt.bezierCurveTo=dt.__originalBezierCurveTo,dt.rect=dt.__originalRect,dt.closePath=dt.__originalClosePath,dt.beginPath=dt.__originalBeginPath,delete dt._removeMirroring},dt.save=function(){w.save(),this.__originalSave()},dt.restore=function(){w.restore(),this.__originalRestore()},dt.translate=function(X,O){w.translate(X,O),this.__originalTranslate(X,O)},dt.scale=function(X,O){w.scale(X,O),this.__originalScale(X,O)},dt.transform=function(X,O,Q,st,et,Mt){w.transform(X,O,Q,st,et,Mt),this.__originalTransform(X,O,Q,st,et,Mt)},dt.setTransform=function(X,O,Q,st,et,Mt){w.setTransform(X,O,Q,st,et,Mt),this.__originalSetTransform(X,O,Q,st,et,Mt)},dt.resetTransform=function(){w.resetTransform(),this.__originalResetTransform()},dt.rotate=function(X){w.rotate(X),this.__originalRotate(X)},dt.clip=function(X){w.clip(X),this.__originalClip(X)},dt.moveTo=function(k,X){w.moveTo(k,X),this.__originalMoveTo(k,X)},dt.lineTo=function(k,X){w.lineTo(k,X),this.__originalLineTo(k,X)},dt.bezierCurveTo=function(k,X,O,Q,st,et){w.bezierCurveTo(k,X,O,Q,st,et),this.__originalBezierCurveTo(k,X,O,Q,st,et)},dt.rect=function(k,X,O,Q){w.rect(k,X,O,Q),this.__originalRect(k,X,O,Q)},dt.closePath=function(){w.closePath(),this.__originalClosePath()},dt.beginPath=function(){w.beginPath(),this.__originalBeginPath()}}class g{constructor(w){this.canvasFactory=w,this.cache=Object.create(null)}getCanvas(w,k,X){let O;return this.cache[w]!==void 0?(O=this.cache[w],this.canvasFactory.reset(O,k,X)):(O=this.canvasFactory.create(k,X),this.cache[w]=O),O}delete(w){delete this.cache[w]}clear(){for(const w in this.cache){const k=this.cache[w];this.canvasFactory.destroy(k),delete this.cache[w]}}}function I(dt,w,k,X,O,Q,st,et,Mt,Rt){const[gt,Jt,Dt,qt,vt,cl]=(0,T.getCurrentTransform)(dt);if(Jt===0&&Dt===0){const Bt=st*gt+vt,Ft=Math.round(Bt),wt=et*qt+cl,Yt=Math.round(wt),jt=(st+Mt)*gt+vt,$t=Math.abs(Math.round(jt)-Ft)||1,al=(et+Rt)*qt+cl,Ml=Math.abs(Math.round(al)-Yt)||1;return dt.setTransform(Math.sign(gt),0,0,Math.sign(qt),Ft,Yt),dt.drawImage(w,k,X,O,Q,0,0,$t,Ml),dt.setTransform(gt,Jt,Dt,qt,vt,cl),[$t,Ml]}if(gt===0&&qt===0){const Bt=et*Dt+vt,Ft=Math.round(Bt),wt=st*Jt+cl,Yt=Math.round(wt),jt=(et+Rt)*Dt+vt,$t=Math.abs(Math.round(jt)-Ft)||1,al=(st+Mt)*Jt+cl,Ml=Math.abs(Math.round(al)-Yt)||1;return dt.setTransform(0,Math.sign(Jt),Math.sign(Dt),0,Ft,Yt),dt.drawImage(w,k,X,O,Q,0,0,Ml,$t),dt.setTransform(gt,Jt,Dt,qt,vt,cl),[Ml,$t]}dt.drawImage(w,k,X,O,Q,st,et,Mt,Rt);const bl=Math.hypot(gt,Jt),il=Math.hypot(Dt,qt);return[bl*Mt,il*Rt]}function C(dt){const{width:w,height:k}=dt;if(w>U||k>U)return null;const X=1e3,O=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),Q=w+1;let st=new Uint8Array(Q*(k+1)),et,Mt,Rt;const gt=w+7&-8;let Jt=new Uint8Array(gt*k),Dt=0;for(const il of dt.data){let Bt=128;for(;Bt>0;)Jt[Dt++]=il&Bt?0:255,Bt>>=1}let qt=0;for(Dt=0,Jt[Dt]!==0&&(st[0]=1,++qt),Mt=1;Mt<w;Mt++)Jt[Dt]!==Jt[Dt+1
Line truncated
|
||||
`}setFont(M){const u=this.current,q=this.commonObjs.get(M[0]);let $=M[1];u.font=q,this.embedFonts&&!q.missingFile&&!this.embeddedFonts[q.loadedName]&&(this.addFontStyle(q),this.embeddedFonts[q.loadedName]=q),u.fontMatrix=q.fontMatrix||T.FONT_IDENTITY_MATRIX;let H="normal";q.black?H="900":q.bold&&(H="bold");const Zt=q.italic?"italic":"normal";$<0?($=-$,u.fontDirection=-1):u.fontDirection=1,u.fontSize=$,u.fontFamily=q.loadedName,u.fontWeight=H,u.fontStyle=Zt,u.tspan=this.svgFactory.createElement("svg:tspan"),u.tspan.setAttributeNS(null,"y",L(-u.y)),u.xcoords=[],u.ycoords=[]}endText(){var u;const M=this.current;M.textRenderingMode&T.TextRenderingMode.ADD_TO_PATH_FLAG&&((u=M.txtElement)!=null&&u.hasChildNodes())&&(M.element=M.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(M){M>0&&(this.current.lineWidth=M)}setLineCap(M){this.current.lineCap=J[M]}setLineJoin(M){this.current.lineJoin=p[M]}setMiterLimit(M){this.current.miterLimit=M}setStrokeAlpha(M){this.current.strokeAlpha=M}setStrokeRGBColor(M,u,q){this.current.strokeColor=T.Util.makeHexColor(M,u,q)}setFillAlpha(M){this.current.fillAlpha=M}setFillRGBColor(M,u,q){this.current.fillColor=T.Util.makeHexColor(M,u,q),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(M){this.current.strokeColor=this._makeColorN_Pattern(M)}setFillColorN(M){this.current.fillColor=this._makeColorN_Pattern(M)}shadingFill(M){const{width:u,height:q}=this.viewport,$=T.Util.inverseTransform(this.transformMatrix),[H,Zt,at,It]=T.Util.getAxialAlignedBoundingBox([0,0,u,q],$),xt=this.svgFactory.createElement("svg:rect");xt.setAttributeNS(null,"x",H),xt.setAttributeNS(null,"y",Zt),xt.setAttributeNS(null,"width",at-H),xt.setAttributeNS(null,"height",It-Zt),xt.setAttributeNS(null,"fill",this._makeShadingPattern(M)),this.current.fillAlpha<1&&xt.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(xt)}_makeColorN_Pattern(M){return M[0]==="TilingPattern"?this._makeTilingPattern(M):this._makeShadingPattern(M)}_makeTilingPattern(M){const u=M[1],q=M[2],$=M[3]||T.IDENTITY_MATRIX,[H,Zt,at,It]=M[4],xt=M[5],it=M[6],Xt=M[7],zt=`shading${j++}`,[Gt,Nt,Ut,Lt]=T.Util.normalizeRect([...T.Util.applyTransform([H,Zt],$),...T.Util.applyTransform([at,It],$)]),[Ht,Pt]=T.Util.singularValueDecompose2dScale($),dt=xt*Ht,w=it*Pt,k=this.svgFactory.createElement("svg:pattern");k.setAttributeNS(null,"id",zt),k.setAttributeNS(null,"patternUnits","userSpaceOnUse"),k.setAttributeNS(null,"width",dt),k.setAttributeNS(null,"height",w),k.setAttributeNS(null,"x",`${Gt}`),k.setAttributeNS(null,"y",`${Nt}`);const X=this.svg,O=this.transformMatrix,Q=this.current.fillColor,st=this.current.strokeColor,et=this.svgFactory.create(Ut-Gt,Lt-Nt);if(this.svg=et,this.transformMatrix=$,Xt===2){const Mt=T.Util.makeHexColor(...u);this.current.fillColor=Mt,this.current.strokeColor=Mt}return this.executeOpTree(this.convertOpList(q)),this.svg=X,this.transformMatrix=O,this.current.fillColor=Q,this.current.strokeColor=st,k.append(et.childNodes[0]),this.defs.append(k),`url(#${zt})`}_makeShadingPattern(M){switch(typeof M=="string"&&(M=this.objs.get(M)),M[0]){case"RadialAxial":const u=`shading${j++}`,q=M[3];let $;switch(M[1]){case"axial":const H=M[4],Zt=M[5];$=this.svgFactory.createElement("svg:linearGradient"),$.setAttributeNS(null,"id",u),$.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),$.setAttributeNS(null,"x1",H[0]),$.setAttributeNS(null,"y1",H[1]),$.setAttributeNS(null,"x2",Zt[0]),$.setAttributeNS(null,"y2",Zt[1]);break;case"radial":const at=M[4],It=M[5],xt=M[6],it=M[7];$=this.svgFactory.createElement("svg:radialGradient"),$.setAttributeNS(null,"id",u),$.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),$.setAttributeNS(null,"cx",It[0]),$.setAttributeNS(null,"cy",It[1]),$.setAttributeNS(null,"r",it),$.setAttributeNS(null,"fx",at[0]),$.setAttributeNS(null,"fy",at[1]),$.setAttributeNS(null,"fr",xt);break;default:throw new Error(`Unknown RadialAxial type: ${M[1]}`)}for(const H of q){const Zt=this.svgFactory.createElement("svg:stop");Zt.setAttributeNS(null,"offset",H[0]),Zt.setAttributeNS(null,"stop-color",H[1]),$.append(Zt)}return this.defs.append($),`url(#${u})`;case"Mesh":return(0,T.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${M[0]}`)}}setDash(M,u){this.current.dashArray=M,this.current.dashPhase=u}constructPath(M,u){const q=this.current;let $=q.x,H=q.y,Zt=[],at=0;for(const It of M)switch(It|0){case T.OPS.rectangle:$=u[at++],H=u[at++];const xt=u[at++],it=u[at++],Xt=$+xt,zt=H+it;Zt.push("M",L($),L(H),"L",L(Xt),L(H),"L",L(Xt),L(zt),"L",L($),L(zt),"Z");break;case T.OPS.moveTo:$=u[at++],H=u[at++],Zt.push("M",L($),L(H));break;case T.OPS.lineTo:$=u[at++],H=u[at++],Zt.push("L",L($),L(H));break;case T.OPS.curveTo:$=u[at+4],H=u[at+5],Zt.push("C",L(u[at]),L(u[at+1]),L(u[at+2]),L(u[at+3]),L($),L(H)),at+=6;break;case T.OPS.curveTo2:Zt.push("C",L($),L(H),L(u[at])
Line truncated
|
||||
`),position:st,pageIndex:et-1,rect:k,rotation:X,id:O,deleted:!1}}const Pt=super.deserialize(Nt,Ut,Lt);return ul(Pt,g,Nt.fontSize),ul(Pt,U,m.Util.makeHexColor(...Nt.color)),ul(Pt,f,Nt.value),Pt.annotationElementId=Nt.id||null,ul(Pt,I,Ht),Pt}serialize(Nt=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const Ut=Xt._internalPadding*this.parentScale,Lt=this.getRect(Ut,Ut),Ht=B.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:bt(this,U)),Pt={annotationType:m.AnnotationEditorType.FREETEXT,color:Ht,fontSize:bt(this,g),value:bt(this,f),pageIndex:this.pageIndex,rect:Lt,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return Nt?Pt:this.annotationElementId&&!nl(this,at,rs).call(this,Pt)?null:(Pt.id=this.annotationElementId,Pt)}};J=new WeakMap,p=new WeakMap,S=new WeakMap,_=new WeakMap,U=new WeakMap,f=new WeakMap,L=new WeakMap,g=new WeakMap,I=new WeakMap,C=new WeakSet,us=function(Nt){const Ut=Ht=>{this.editorDiv.style.fontSize=`calc(${Ht}px * var(--scale-factor))`,this.translate(0,-(Ht-bt(this,g))*this.parentScale),ul(this,g,Ht),nl(this,q,le).call(this)},Lt=bt(this,g);this.addCommands({cmd:()=>{Ut(Nt)},undo:()=>{Ut(Lt)},mustExec:!0,type:m.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},K=new WeakSet,Ws=function(Nt){const Ut=bt(this,U);this.addCommands({cmd:()=>{ul(this,U,this.editorDiv.style.color=Nt)},undo:()=>{ul(this,U,this.editorDiv.style.color=Ut)},mustExec:!0,type:m.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},M=new WeakSet,Gs=function(){const Nt=this.editorDiv.getElementsByTagName("div");if(Nt.length===0)return this.editorDiv.innerText;const Ut=[];for(const Lt of Nt)Ut.push(Lt.innerText.replace(/\r\n?|\n/,""));return Ut.join(`
|
||||
`)},q=new WeakSet,le=function(){const[Nt,Ut]=this.parentDimensions;let Lt;if(this.isAttachedToDOM)Lt=this.div.getBoundingClientRect();else{const{currentLayer:Ht,div:Pt}=this,dt=Pt.style.display;Pt.style.display="hidden",Ht.div.append(this.div),Lt=Pt.getBoundingClientRect(),Pt.remove(),Pt.style.display=dt}this.rotation%180===this.parentRotation%180?(this.width=Lt.width/Nt,this.height=Lt.height/Ut):(this.width=Lt.height/Nt,this.height=Lt.width/Ut),this.fixAndSetPosition()},H=new WeakSet,Ue=function(){if(this.editorDiv.replaceChildren(),!!bt(this,f))for(const Nt of bt(this,f).split(`
|
||||
`)){const Ut=document.createElement("div");Ut.append(Nt?document.createTextNode(Nt):document.createElement("br")),this.editorDiv.append(Ut)}},at=new WeakSet,rs=function(Nt){const{value:Ut,fontSize:Lt,color:Ht,rect:Pt,pageIndex:dt}=bt(this,I);return Nt.value!==Ut||Nt.fontSize!==Lt||Nt.rect.some((w,k)=>Math.abs(w-Pt[k])>=1)||Nt.color.some((w,k)=>w!==Ht[k])||Nt.pageIndex!==dt},xt=new WeakSet,Ee=function(Nt=!1){if(!this.annotationElementId)return;if(nl(this,q,le).call(this),!Nt&&(this.width===0||this.height===0)){setTimeout(()=>nl(this,xt,Ee).call(this,!0),0);return}const Ut=Xt._internalPadding*this.parentScale;bt(this,I).rect=this.getRect(Ut,Ut)},gl(Xt,"_freeTextDefaultContent",""),gl(Xt,"_internalPadding",0),gl(Xt,"_defaultColor",null),gl(Xt,"_defaultFontSize",10),gl(Xt,"_type","freetext");let F=Xt;r.FreeTextEditor=F},(lt,r,h)=>{var k,O,Kl,st,Ms,Mt,Rt,gt,Jt,Dt,qt,vt,cl,bl,il,Bt,Ft,wt,Yt,jt,$t,al,Ml,Ns,Xl,oe,Vl,Ke,Ll,ve,ot,ut,Tt,Ct,Ot,Vt,yt,Pe,tl,el,ol,Qt,Xs,hl,He;Object.defineProperty(r,"__esModule",{value:!0}),r.StampAnnotationElement=r.InkAnnotationElement=r.FreeTextAnnotationElement=r.AnnotationLayer=void 0;var m=h(1),T=h(6),B=h(3),v=h(30),F=h(31),J=h(32);const p=1e3,S=9,_=new WeakSet;function U(Wl){return{width:Wl[2]-Wl[0],height:Wl[3]-Wl[1]}}class f{static create(nt){switch(nt.data.annotationType){case m.AnnotationType.LINK:return new g(nt);case m.AnnotationType.TEXT:return new I(nt);case m.AnnotationType.WIDGET:switch(nt.data.fieldType){case"Tx":return new j(nt);case"Btn":return nt.data.radioButton?new M(nt):nt.data.checkBox?new P(nt):new u(nt);case"Ch":return new q(nt);case"Sig":return new K(nt)}return new C(nt);case m.AnnotationType.POPUP:return new $(nt);case m.AnnotationType.FREETEXT:return new Zt(nt);case m.AnnotationType.LINE:return new at(nt);case m.AnnotationType.SQUARE:return new It(nt);case m.AnnotationType.CIRCLE:return new xt(nt);case m.AnnotationType.POLYLINE:return new it(nt);case m.AnnotationType.CARET:return new zt(nt);case m.AnnotationType.INK:return new Gt(nt);case m.AnnotationType.POLYGON:return new Xt(nt);case m.AnnotationType.HIGHLIGHT:return new Nt(nt);case m.AnnotationType.UNDERLINE:return new Ut(nt);case m.AnnotationType.SQUIGGLY:return new Lt(nt);case m.AnnotationType.STRIKEOUT:return new Ht(nt);case m.AnnotationType.STAMP:return new Pt(nt);case m.AnnotationType.FILEATTACHMENT:return new dt(nt);default:return new L(nt)}}}const X=class X{constructor(nt,{isRenderable:R=!1,ignoreBorder:ct=!1,createQuadrilaterals:Wt=!1}={}){ll(this,k,!1);this.isRenderable=R,this.data=nt.data,this.layer=nt.layer,this.linkService=nt.linkService,this.downloadManager=nt.downloadManager,this.imageResourcesPath=nt.imageResourcesPath,this.renderForms=nt.renderForms,this.svgFactory=nt.svgFactory,this.annotationStorage=nt.annotationStorage,this.enableScripting=nt.enableScripting,this.hasJSActions=nt.hasJSActions,this._fieldObjects=nt.fieldObjects,this.parent=nt.parent,R&&(this.container=this._createContainer(ct)),Wt&&this._createQuadrilaterals()}static _hasPopupData({titleObj:nt,contentsObj:R,richText:ct}){return!!(nt!=null&&nt.str||R!=null&&R.str||ct!=null&&ct.str)}get hasPopupData(){return X._hasPopupData(this.data)}_createContainer(nt){const{data:R,parent:{page:ct,viewport:Wt}}=this,pt=document.createElement("section");pt.setAttribute("data-annotation-id",R.id),this instanceof C||(pt.tabIndex=p),pt.style.zIndex=this.parent.zIndex++,this.data.popupRef&&pt.setAttribute("aria-haspopup","dialog"),R.noRotate&&pt.classList.add("norotate");const{pageWidth:kt,pageHeight:Et,pageX:sl,pageY:ml}=Wt.rawDims;if(!R.rect||this instanceof $){const{rotation:Tl}=R;return!R.hasOwnCanvas&&Tl!==0&&this.setRotation(Tl,pt),pt}const{width:dl,height:zl}=U(R.rect),Gl=m.Util.normalizeRect([R.rect[0],ct.view[3]-R.rect[1]+ct.view[1],R.rect[2],ct.view[3]-R.rect[3]+ct.view[1]]);if(!nt&&R.borderStyle.width>0){pt.style.borderWidth=`${R.borderStyle.width}px`;const Tl=R.borderStyle.horizontalCornerRadius,Rl=R.borderStyle.verticalCornerRadius;if(Tl>0||Rl>0){const wl=`calc(${Tl}px * var(--scale-factor)) / calc(${Rl}px * var(--scale-factor))`;pt.style.borderRadius=wl}else if(this instanceof M){const wl=`calc(${dl}px * var(--scale-factor)) / calc(${zl}px * var(--scale-factor))`;pt.style.borderRadius=wl}switch(R.borderStyle.style){case m.AnnotationBorderStyleType.SOLID:pt.style.borderStyle="solid";break;case m.AnnotationBorderStyleType.DASHED:pt.style.borderStyle="dashed";break;case m.AnnotationBorderStyleType.BEVELED:(0,m.warn)("Unimplemented border style: beveled");break;case m.AnnotationBorderStyleType.INSET:(0,m.warn)("Unimplemented border style: inset");break;case m.AnnotationBorderStyleType.UNDERLINE:pt.style.borderBottomStyle="solid";break}const Sl=R.borderColor||null;Sl?(ul(this,k,!0),pt.style.borderColor=m.Util.makeHexColor(Sl[0]|0,Sl[1]|0,Sl[2]|0)):pt.style.borderWidth=0}pt.style.left=`${100*(Gl[0]-sl)/kt}%`,pt.style.top=`${100*(Gl[1]-ml)/Et}%`;const{rotation:Nl}=R;return R.hasOwnCanvas||Nl===0?(pt.style.width=`${100*dl/kt}%`,pt.style
Line truncated
|
||||
`))||null;ml&&this.data.comb&&(ml=ml.replaceAll(/\s+/g,""));const dl={userValue:Et,formattedValue:ml,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(ct=document.createElement("textarea"),ct.textContent=ml??Et,this.data.doNotScroll&&(ct.style.overflowY="hidden")):(ct=document.createElement("input"),ct.type="text",ct.setAttribute("value",ml??Et),this.data.doNotScroll&&(ct.style.overflowX="hidden")),this.data.hasOwnCanvas&&(ct.hidden=!0),_.add(ct),ct.setAttribute("data-element-id",R),ct.disabled=this.data.readOnly,ct.name=this.data.fieldName,ct.tabIndex=p,this._setRequired(ct,this.data.required),sl&&(ct.maxLength=sl),ct.addEventListener("input",Gl=>{nt.setValue(R,{value:Gl.target.value}),this.setPropertyOnSiblings(ct,"value",Gl.target.value,"value"),dl.formattedValue=null}),ct.addEventListener("resetform",Gl=>{const Nl=this.data.defaultFieldValue??"";ct.value=dl.userValue=Nl,dl.formattedValue=null});let zl=Gl=>{const{formattedValue:Nl}=dl;Nl!=null&&(Gl.target.value=Nl),Gl.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){ct.addEventListener("focus",Nl=>{if(dl.focused)return;const{target:Tl}=Nl;dl.userValue&&(Tl.value=dl.userValue),dl.lastCommittedValue=Tl.value,dl.commitKey=1,dl.focused=!0}),ct.addEventListener("updatefromsandbox",Nl=>{this.showElementAndHideCanvas(Nl.target);const Tl={value(Rl){dl.userValue=Rl.detail.value??"",nt.setValue(R,{value:dl.userValue.toString()}),Rl.target.value=dl.userValue},formattedValue(Rl){const{formattedValue:Sl}=Rl.detail;dl.formattedValue=Sl,Sl!=null&&Rl.target!==document.activeElement&&(Rl.target.value=Sl),nt.setValue(R,{formattedValue:Sl})},selRange(Rl){Rl.target.setSelectionRange(...Rl.detail.selRange)},charLimit:Rl=>{var xl;const{charLimit:Sl}=Rl.detail,{target:wl}=Rl;if(Sl===0){wl.removeAttribute("maxLength");return}wl.setAttribute("maxLength",Sl);let kl=dl.userValue;!kl||kl.length<=Sl||(kl=kl.slice(0,Sl),wl.value=dl.userValue=kl,nt.setValue(R,{value:kl}),(xl=this.linkService.eventBus)==null||xl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:R,name:"Keystroke",value:kl,willCommit:!0,commitKey:1,selStart:wl.selectionStart,selEnd:wl.selectionEnd}}))}};this._dispatchEventFromSandbox(Tl,Nl)}),ct.addEventListener("keydown",Nl=>{var Sl;dl.commitKey=1;let Tl=-1;if(Nl.key==="Escape"?Tl=0:Nl.key==="Enter"&&!this.data.multiLine?Tl=2:Nl.key==="Tab"&&(dl.commitKey=3),Tl===-1)return;const{value:Rl}=Nl.target;dl.lastCommittedValue!==Rl&&(dl.lastCommittedValue=Rl,dl.userValue=Rl,(Sl=this.linkService.eventBus)==null||Sl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:R,name:"Keystroke",value:Rl,willCommit:!0,commitKey:Tl,selStart:Nl.target.selectionStart,selEnd:Nl.target.selectionEnd}}))});const Gl=zl;zl=null,ct.addEventListener("blur",Nl=>{var Rl;if(!dl.focused||!Nl.relatedTarget)return;dl.focused=!1;const{value:Tl}=Nl.target;dl.userValue=Tl,dl.lastCommittedValue!==Tl&&((Rl=this.linkService.eventBus)==null||Rl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:R,name:"Keystroke",value:Tl,willCommit:!0,commitKey:dl.commitKey,selStart:Nl.target.selectionStart,selEnd:Nl.target.selectionEnd}})),Gl(Nl)}),(pt=this.data.actions)!=null&&pt.Keystroke&&ct.addEventListener("beforeinput",Nl=>{var jl;dl.lastCommittedValue=null;const{data:Tl,target:Rl}=Nl,{value:Sl,selectionStart:wl,selectionEnd:kl}=Rl;let xl=wl,Dl=kl;switch(Nl.inputType){case"deleteWordBackward":{const Cl=Sl.substring(0,wl).match(/\w*[^\w]*$/);Cl&&(xl-=Cl[0].length);break}case"deleteWordForward":{const Cl=Sl.substring(wl).match(/^[^\w]*\w*/);Cl&&(Dl+=Cl[0].length);break}case"deleteContentBackward":wl===kl&&(xl-=1);break;case"deleteContentForward":wl===kl&&(Dl+=1);break}Nl.preventDefault(),(jl=this.linkService.eventBus)==null||jl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:R,name:"Keystroke",value:Sl,change:Tl||"",willCommit:!1,selStart:xl,selEnd:Dl}})}),this._setEventListeners(ct,dl,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Nl=>Nl.target.value)}if(zl&&ct.addEventListener("blur",zl),this.data.comb){const Nl=(this.data.rect[2]-this.data.rect[0])/sl;ct.classList.add("comb"),ct.style.letterSpacing=`calc(${Nl}px * var(--scale-factor) - 1ch)`}}else ct=document.createElement("div"),ct.textContent=this.data.fieldValue,ct.style.verticalAlign="middle",ct.style.display="table-cell";return this._setTextStyle(ct),this._setBackgroundColor(ct),this._setDefaultPropertiesFromJS(ct),this.container.append(ct),this.container}}class K extends C{constructor(nt){super(nt,{isRenderable:!!nt.data.hasOwnCanvas})}}class P extends C{constructor(nt){super(nt,{isRenderable:nt.renderForms})}render(){const nt=this.annotationStorage,R=this.data,ct=R.id;let Wt=nt.getValue(ct,{value:R.exportValue===R.fieldValue}).value;typeof Wt=="string"&&(Wt=Wt!=="Off",nt.setValue(ct,{value:Wt})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const pt=document.createElement("input");r
Line truncated
|
||||
`,"\\r":"\r","\\t":" "},U=/^[\da-f]{4}$/i,f=/^[\u0000-\u001F]$/;lt.exports=function(L,g){for(var I=!0,C="";g<L.length;){var j=J(L,g);if(j==="\\"){var K=p(L,g,g+2);if(T(_,K))C+=_[K],g+=2;else if(K==="\\u"){g+=2;var P=p(L,g,g+4);if(!S(U,P))throw B("Bad Unicode escape at: "+g);C+=F(v(P,16)),g+=4}else throw B('Unknown escape sequence: "'+K+'"')}else if(j==='"'){I=!1,g++;break}else{if(S(f,j))throw B("Bad control character in string literal at: "+g);C+=j,g++}}if(I)throw B("Unterminated string at: "+g);return{value:C,end:g}}},(lt,r,h)=>{var m,T,B,v,F,J,p,S,_,U,f,L,g,I,C,j,K,P,M,u,q,$,H,Zt,at;Object.defineProperty(r,"__esModule",{value:!0}),r.StatTimer=r.RenderingCancelledException=r.PixelsPerInch=r.PageViewport=r.PDFDateString=r.DOMStandardFontDataFactory=r.DOMSVGFactory=r.DOMFilterFactory=r.DOMCanvasFactory=r.DOMCMapReaderFactory=void 0,r.deprecated=gt,r.getColorValues=cl,r.getCurrentTransform=bl,r.getCurrentTransformInverse=il,r.getFilenameFromUrl=O,r.getPdfFilenameFromUrl=Q,r.getRGB=vt,r.getXfaPageViewport=qt,r.isDataScheme=k,r.isPdfFile=X,r.isValidFetchUrl=et,r.loadScript=Rt,r.noContextMenu=Mt,r.setLayerDimensions=Bt,h(2),h(93),h(101),h(102),h(105),h(107),h(109),h(113),h(116),h(123),h(89),h(84),h(86),h(87);var It=h(169),xt=h(1);const it="http://www.w3.org/2000/svg",Xt=class{};tt(Xt,"CSS",96),tt(Xt,"PDF",72),tt(Xt,"PDF_TO_CSS_UNITS",Xt.CSS/Xt.PDF);let zt=Xt;r.PixelsPerInch=zt;class Gt extends It.BaseFilterFactory{constructor(){let{docId:wt,ownerDocument:Yt=globalThis.document}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),E(this,L),E(this,I),E(this,j),E(this,P),E(this,u),E(this,$),E(this,Zt),E(this,m,void 0),E(this,T,void 0),E(this,B,void 0),E(this,v,void 0),E(this,F,void 0),E(this,J,void 0),E(this,p,void 0),E(this,S,void 0),E(this,_,void 0),E(this,U,void 0),E(this,f,0),Zl(this,B,wt),Zl(this,v,Yt)}addFilter(wt){if(!wt)return"none";let Yt=t(this,L,g).get(wt);if(Yt)return Yt;let jt,$t,al,Ml;if(wt.length===1){const Vl=wt[0],yl=new Array(256);for(let Ll=0;Ll<256;Ll++)yl[Ll]=Vl[Ll]/255;Ml=jt=$t=al=yl.join(",")}else{const[Vl,yl,Ll]=wt,_t=new Array(256),ot=new Array(256),ut=new Array(256);for(let Tt=0;Tt<256;Tt++)_t[Tt]=Vl[Tt]/255,ot[Tt]=yl[Tt]/255,ut[Tt]=Ll[Tt]/255;jt=_t.join(","),$t=ot.join(","),al=ut.join(","),Ml=`${jt}${$t}${al}`}if(Yt=t(this,L,g).get(Ml),Yt)return t(this,L,g).set(wt,Yt),Yt;const pl=`g_${t(this,B)}_transfer_map_${mt(this,f)._++}`,Xl=`url(#${pl})`;t(this,L,g).set(wt,Xl),t(this,L,g).set(Ml,Xl);const Yl=A(this,P,M).call(this,pl);return A(this,$,H).call(this,jt,$t,al,Yl),Xl}addHCMFilter(wt,Yt){var jt;const $t=`${wt}-${Yt}`;if(t(this,J)===$t)return t(this,p);if(Zl(this,J,$t),Zl(this,p,"none"),(jt=t(this,F))==null||jt.remove(),!wt||!Yt)return t(this,p);const al=A(this,Zt,at).call(this,wt);wt=xt.Util.makeHexColor(...al);const Ml=A(this,Zt,at).call(this,Yt);if(Yt=xt.Util.makeHexColor(...Ml),t(this,I,C).style.color="",wt==="#000000"&&Yt==="#ffffff"||wt===Yt)return t(this,p);const pl=new Array(256);for(let Ll=0;Ll<=255;Ll++){const _t=Ll/255;pl[Ll]=_t<=.03928?_t/12.92:((_t+.055)/1.055)**2.4}const Xl=pl.join(","),Yl=`g_${t(this,B)}_hcm_filter`,Vl=Zl(this,S,A(this,P,M).call(this,Yl));A(this,$,H).call(this,Xl,Xl,Xl,Vl),A(this,j,K).call(this,Vl);const yl=(Ll,_t)=>{const ot=al[Ll]/255,ut=Ml[Ll]/255,Tt=new Array(_t+1);for(let Ct=0;Ct<=_t;Ct++)Tt[Ct]=ot+Ct/_t*(ut-ot);return Tt.join(",")};return A(this,$,H).call(this,yl(0,5),yl(1,5),yl(2,5),Vl),Zl(this,p,`url(#${Yl})`),t(this,p)}addHighlightHCMFilter(wt,Yt,jt,$t){var al;const Ml=`${wt}-${Yt}-${jt}-${$t}`;if(t(this,_)===Ml)return t(this,U);if(Zl(this,_,Ml),Zl(this,U,"none"),(al=t(this,S))==null||al.remove(),!wt||!Yt)return t(this,U);const[pl,Xl]=[wt,Yt].map(A(this,Zt,at).bind(this));let Yl=Math.round(.2126*pl[0]+.7152*pl[1]+.0722*pl[2]),Vl=Math.round(.2126*Xl[0]+.7152*Xl[1]+.0722*Xl[2]),[yl,Ll]=[jt,$t].map(A(this,Zt,at).bind(this));Vl<Yl&&([Yl,Vl,yl,Ll]=[Vl,Yl,Ll,yl]),t(this,I,C).style.color="";const _t=(Tt,Ct,Ot)=>{const Vt=new Array(256),yt=(Vl-Yl)/Ot,Kt=Tt/255,tl=(Ct-Tt)/(255*Ot);let el=0;for(let ol=0;ol<=Ot;ol++){const Qt=Math.round(Yl+ol*yt),rl=Kt+ol*tl;for(let hl=el;hl<=Qt;hl++)Vt[hl]=rl;el=Qt+1}for(let ol=el;ol<256;ol++)Vt[ol]=Vt[el-1];return Vt.join(",")},ot=`g_${t(this,B)}_hcm_highlight_filter`,ut=Zl(this,S,A(this,P,M).call(this,ot));return A(this,j,K).call(this,ut),A(this,$,H).call(this,_t(yl[0],Ll[0],5),_t(yl[1],Ll[1],5),_t(yl[2],Ll[2],5),ut),Zl(this,U,`url(#${ot})`),t(this,U)}destroy(){arguments.length>0&&arguments[0]!==void 0&&arguments[0]&&(t(this,p)||t(this,U))||(t(this,T)&&(t(this,T).parentNode.parentNode.remove(),Zl(this,T,null)),t(this,m)&&(t(this,m).clear(),Zl(this,m,null)),Zl(this,f,0))}}m=new WeakMap,T=new WeakMap,B=new WeakMap,v=new WeakMap,F=new WeakMap,J=new WeakMap,p=new WeakMap,S=new WeakMap,_=new WeakMap,U=new WeakMap,f=new WeakMap,L=new WeakSet,g=function(){return t(this,m)||Zl(this,m,new Map)},I=new WeakSet,C=function(){if(!t(this,T)){const Ft=t(this,v).createElement("div"),{style:wt}=Ft;wt.visibility="hidden",wt.cont
Line truncated
|
||||
`);return wt.join("")}}r.StatTimer=st;function et(Ft,wt){try{const{protocol:Yt}=wt?new URL(Ft,wt):new URL(Ft);return Yt==="http:"||Yt==="https:"}catch{return!1}}function Mt(Ft){Ft.preventDefault()}function Rt(Ft){let wt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return new Promise((Yt,jt)=>{const $t=document.createElement("script");$t.src=Ft,$t.onload=function(al){wt&&$t.remove(),Yt(al)},$t.onerror=function(){jt(new Error(`Cannot load script at: ${$t.src}`))},(document.head||document.documentElement).append($t)})}function gt(Ft){console.log("Deprecated API usage: "+Ft)}let Jt;class Dt{static toDateObject(wt){if(!wt||typeof wt!="string")return null;Jt||(Jt=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const Yt=Jt.exec(wt);if(!Yt)return null;const jt=parseInt(Yt[1],10);let $t=parseInt(Yt[2],10);$t=$t>=1&&$t<=12?$t-1:0;let al=parseInt(Yt[3],10);al=al>=1&&al<=31?al:1;let Ml=parseInt(Yt[4],10);Ml=Ml>=0&&Ml<=23?Ml:0;let pl=parseInt(Yt[5],10);pl=pl>=0&&pl<=59?pl:0;let Xl=parseInt(Yt[6],10);Xl=Xl>=0&&Xl<=59?Xl:0;const Yl=Yt[7]||"Z";let Vl=parseInt(Yt[8],10);Vl=Vl>=0&&Vl<=23?Vl:0;let yl=parseInt(Yt[9],10)||0;return yl=yl>=0&&yl<=59?yl:0,Yl==="-"?(Ml+=Vl,pl+=yl):Yl==="+"&&(Ml-=Vl,pl-=yl),new Date(Date.UTC(jt,$t,al,Ml,pl,Xl))}}r.PDFDateString=Dt;function qt(Ft,wt){let{scale:Yt=1,rotation:jt=0}=wt;const{width:$t,height:al}=Ft.attributes.style,Ml=[0,0,parseInt($t),parseInt(al)];return new dt({viewBox:Ml,scale:Yt,rotation:jt})}function vt(Ft){if(Ft.startsWith("#")){const wt=parseInt(Ft.slice(1),16);return[(wt&16711680)>>16,(wt&65280)>>8,wt&255]}return Ft.startsWith("rgb(")?Ft.slice(4,-1).split(",").map(wt=>parseInt(wt)):Ft.startsWith("rgba(")?Ft.slice(5,-1).split(",").map(wt=>parseInt(wt)).slice(0,3):((0,xt.warn)(`Not a valid color format: "${Ft}"`),[0,0,0])}function cl(Ft){const wt=document.createElement("span");wt.style.visibility="hidden",document.body.append(wt);for(const Yt of Ft.keys()){wt.style.color=Yt;const jt=window.getComputedStyle(wt).color;Ft.set(Yt,vt(jt))}wt.remove()}function bl(Ft){const{a:wt,b:Yt,c:jt,d:$t,e:al,f:Ml}=Ft.getTransform();return[wt,Yt,jt,$t,al,Ml]}function il(Ft){const{a:wt,b:Yt,c:jt,d:$t,e:al,f:Ml}=Ft.getTransform().invertSelf();return[wt,Yt,jt,$t,al,Ml]}function Bt(Ft,wt){let Yt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,jt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;if(wt instanceof dt){const{pageWidth:$t,pageHeight:al}=wt.rawDims,{style:Ml}=Ft,pl=xt.FeatureTest.isCSSRoundSupported,Xl=`var(--scale-factor) * ${$t}px`,Yl=`var(--scale-factor) * ${al}px`,Vl=pl?`round(${Xl}, 1px)`:`calc(${Xl})`,yl=pl?`round(${Yl}, 1px)`:`calc(${Yl})`;!Yt||wt.rotation%180===0?(Ml.width=Vl,Ml.height=yl):(Ml.width=yl,Ml.height=Vl)}jt&&Ft.setAttribute("data-main-rotation",wt.rotation)}},(lt,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BaseStandardFontDataFactory=r.BaseSVGFactory=r.BaseFilterFactory=r.BaseCanvasFactory=r.BaseCMapReaderFactory=void 0,h(2);var m=h(1);class T{constructor(){this.constructor===T&&(0,m.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(S){return"none"}addHCMFilter(S,_){return"none"}addHighlightHCMFilter(S,_,U,f){return"none"}destroy(){}}r.BaseFilterFactory=T;class B{constructor(){this.constructor===B&&(0,m.unreachable)("Cannot initialize BaseCanvasFactory.")}create(S,_){if(S<=0||_<=0)throw new Error("Invalid canvas size");const U=this._createCanvas(S,_);return{canvas:U,context:U.getContext("2d")}}reset(S,_,U){if(!S.canvas)throw new Error("Canvas is not specified");if(_<=0||U<=0)throw new Error("Invalid canvas size");S.canvas.width=_,S.canvas.height=U}destroy(S){if(!S.canvas)throw new Error("Canvas is not specified");S.canvas.width=0,S.canvas.height=0,S.canvas=null,S.context=null}_createCanvas(S,_){(0,m.unreachable)("Abstract method `_createCanvas` called.")}}r.BaseCanvasFactory=B;class v{constructor(S){let{baseUrl:_=null,isCompressed:U=!0}=S;this.constructor===v&&(0,m.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=_,this.isCompressed=U}async fetch(S){let{name:_}=S;if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!_)throw new Error("CMap name must be specified.");const U=this.baseUrl+_+(this.isCompressed?".bcmap":""),f=this.isCompressed?m.CMapCompressionType.BINARY:m.CMapCompressionType.NONE;return this._fetchData(U,f).catch(L=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${U}`)})}_fetchData(S,_){(0,m.unreachable)("Abstract method `_fetchData` called.")}}r.BaseCMapReaderFactory=v;class F{constructor(S){let{baseUrl:_=null}=S;this.constructor===F&&(0,m.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=_}async fetch(S){let{filename:_}=S;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is
Line truncated
|
||||
`)}return this.compiledGlyphs[p]=new Function("c","size",_.join(""))}return this.compiledGlyphs[p]=function(_,U){for(const f of S)f.cmd==="scale"&&(f.args=[U,-U]),_[f.cmd].apply(_,f.args)}}}r.FontFaceObject=v},(lt,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.NodeStandardFontDataFactory=r.NodeFilterFactory=r.NodeCanvasFactory=r.NodeCMapReaderFactory=void 0,h(2),h(93),h(101),h(102),h(105),h(107),h(109),h(113),h(116),h(123);var m=h(169),T=h(1);(function(){if(!(globalThis.DOMMatrix||!T.isNodeJS))try{globalThis.DOMMatrix=require$$6.DOMMatrix}catch(S){(0,T.warn)(`Cannot polyfill \`DOMMatrix\`, rendering may be broken: "${S}".`)}})(),function(){if(!(globalThis.Path2D||!T.isNodeJS))try{const{CanvasRenderingContext2D:S}=require$$6,{polyfillPath2D:_}=requirePath2dPolyfill_esm();globalThis.CanvasRenderingContext2D=S,_(globalThis)}catch(S){(0,T.warn)(`Cannot polyfill \`Path2D\`, rendering may be broken: "${S}".`)}}();const B=function(S){return new Promise((_,U)=>{require$$6.readFile(S,(f,L)=>{if(f||!L){U(new Error(f));return}_(new Uint8Array(L))})})};class v extends m.BaseFilterFactory{}r.NodeFilterFactory=v;class F extends m.BaseCanvasFactory{_createCanvas(_,U){return require$$6.createCanvas(_,U)}}r.NodeCanvasFactory=F;class J extends m.BaseCMapReaderFactory{_fetchData(_,U){return B(_).then(f=>({cMapData:f,compressionType:U}))}}r.NodeCMapReaderFactory=J;class p extends m.BaseStandardFontDataFactory{_fetchData(_){return B(_)}}r.NodeStandardFontDataFactory=p},(lt,r,h)=>{var m,T,B,v;Object.defineProperty(r,"__esModule",{value:!0}),r.CanvasGraphics=void 0,h(2),h(93),h(101),h(102),h(105),h(107),h(109),h(113),h(116),h(123),h(89);var F=h(1),J=h(168),p=h(174),S=h(175);const _=16,U=100,f=4096,L=15,g=10,I=1e3,C=16;function j(dt,w){if(dt._removeMirroring)throw new Error("Context is already forwarding operations.");dt.__originalSave=dt.save,dt.__originalRestore=dt.restore,dt.__originalRotate=dt.rotate,dt.__originalScale=dt.scale,dt.__originalTranslate=dt.translate,dt.__originalTransform=dt.transform,dt.__originalSetTransform=dt.setTransform,dt.__originalResetTransform=dt.resetTransform,dt.__originalClip=dt.clip,dt.__originalMoveTo=dt.moveTo,dt.__originalLineTo=dt.lineTo,dt.__originalBezierCurveTo=dt.bezierCurveTo,dt.__originalRect=dt.rect,dt.__originalClosePath=dt.closePath,dt.__originalBeginPath=dt.beginPath,dt._removeMirroring=()=>{dt.save=dt.__originalSave,dt.restore=dt.__originalRestore,dt.rotate=dt.__originalRotate,dt.scale=dt.__originalScale,dt.translate=dt.__originalTranslate,dt.transform=dt.__originalTransform,dt.setTransform=dt.__originalSetTransform,dt.resetTransform=dt.__originalResetTransform,dt.clip=dt.__originalClip,dt.moveTo=dt.__originalMoveTo,dt.lineTo=dt.__originalLineTo,dt.bezierCurveTo=dt.__originalBezierCurveTo,dt.rect=dt.__originalRect,dt.closePath=dt.__originalClosePath,dt.beginPath=dt.__originalBeginPath,delete dt._removeMirroring},dt.save=function(){w.save(),this.__originalSave()},dt.restore=function(){w.restore(),this.__originalRestore()},dt.translate=function(k,X){w.translate(k,X),this.__originalTranslate(k,X)},dt.scale=function(k,X){w.scale(k,X),this.__originalScale(k,X)},dt.transform=function(k,X,O,Q,st,et){w.transform(k,X,O,Q,st,et),this.__originalTransform(k,X,O,Q,st,et)},dt.setTransform=function(k,X,O,Q,st,et){w.setTransform(k,X,O,Q,st,et),this.__originalSetTransform(k,X,O,Q,st,et)},dt.resetTransform=function(){w.resetTransform(),this.__originalResetTransform()},dt.rotate=function(k){w.rotate(k),this.__originalRotate(k)},dt.clip=function(k){w.clip(k),this.__originalClip(k)},dt.moveTo=function(k,X){w.moveTo(k,X),this.__originalMoveTo(k,X)},dt.lineTo=function(k,X){w.lineTo(k,X),this.__originalLineTo(k,X)},dt.bezierCurveTo=function(k,X,O,Q,st,et){w.bezierCurveTo(k,X,O,Q,st,et),this.__originalBezierCurveTo(k,X,O,Q,st,et)},dt.rect=function(k,X,O,Q){w.rect(k,X,O,Q),this.__originalRect(k,X,O,Q)},dt.closePath=function(){w.closePath(),this.__originalClosePath()},dt.beginPath=function(){w.beginPath(),this.__originalBeginPath()}}class K{constructor(w){this.canvasFactory=w,this.cache=Object.create(null)}getCanvas(w,k,X){let O;return this.cache[w]!==void 0?(O=this.cache[w],this.canvasFactory.reset(O,k,X)):(O=this.canvasFactory.create(k,X),this.cache[w]=O),O}delete(w){delete this.cache[w]}clear(){for(const w in this.cache){const k=this.cache[w];this.canvasFactory.destroy(k),delete this.cache[w]}}}function P(dt,w,k,X,O,Q,st,et,Mt,Rt){const[gt,Jt,Dt,qt,vt,cl]=(0,J.getCurrentTransform)(dt);if(Jt===0&&Dt===0){const Bt=st*gt+vt,Ft=Math.round(Bt),wt=et*qt+cl,Yt=Math.round(wt),jt=(st+Mt)*gt+vt,$t=Math.abs(Math.round(jt)-Ft)||1,al=(et+Rt)*qt+cl,Ml=Math.abs(Math.round(al)-Yt)||1;return dt.setTransform(Math.sign(gt),0,0,Math.sign(qt),Ft,Yt),dt.drawImage(w,k,X,O,Q,0,0,$t,Ml),dt.setTransform(gt,Jt,Dt,qt,vt,cl),[$t,Ml]}if(gt===0&&qt===0){const Bt=et*Dt+vt,Ft=Math.round(Bt),wt=st*Jt+cl,Yt=Math.round(wt),jt=(et+Rt)*Dt+vt,$t=Math.abs(Math.round(jt)-Ft)||1,al=(st+Mt)*Jt+cl,Ml=Math.abs(Math.round(al)-Yt)||1;return dLine truncated
|
||||
`}setFont(M){const u=this.current,q=this.commonObjs.get(M[0]);let $=M[1];u.font=q,this.embedFonts&&!q.missingFile&&!this.embeddedFonts[q.loadedName]&&(this.addFontStyle(q),this.embeddedFonts[q.loadedName]=q),u.fontMatrix=q.fontMatrix||T.FONT_IDENTITY_MATRIX;let H="normal";q.black?H="900":q.bold&&(H="bold");const Zt=q.italic?"italic":"normal";$<0?($=-$,u.fontDirection=-1):u.fontDirection=1,u.fontSize=$,u.fontFamily=q.loadedName,u.fontWeight=H,u.fontStyle=Zt,u.tspan=this.svgFactory.createElement("svg:tspan"),u.tspan.setAttributeNS(null,"y",L(-u.y)),u.xcoords=[],u.ycoords=[]}endText(){var M;const u=this.current;u.textRenderingMode&T.TextRenderingMode.ADD_TO_PATH_FLAG&&(M=u.txtElement)!=null&&M.hasChildNodes()&&(u.element=u.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(M){M>0&&(this.current.lineWidth=M)}setLineCap(M){this.current.lineCap=J[M]}setLineJoin(M){this.current.lineJoin=p[M]}setMiterLimit(M){this.current.miterLimit=M}setStrokeAlpha(M){this.current.strokeAlpha=M}setStrokeRGBColor(M,u,q){this.current.strokeColor=T.Util.makeHexColor(M,u,q)}setFillAlpha(M){this.current.fillAlpha=M}setFillRGBColor(M,u,q){this.current.fillColor=T.Util.makeHexColor(M,u,q),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(M){this.current.strokeColor=this._makeColorN_Pattern(M)}setFillColorN(M){this.current.fillColor=this._makeColorN_Pattern(M)}shadingFill(M){const{width:u,height:q}=this.viewport,$=T.Util.inverseTransform(this.transformMatrix),[H,Zt,at,It]=T.Util.getAxialAlignedBoundingBox([0,0,u,q],$),xt=this.svgFactory.createElement("svg:rect");xt.setAttributeNS(null,"x",H),xt.setAttributeNS(null,"y",Zt),xt.setAttributeNS(null,"width",at-H),xt.setAttributeNS(null,"height",It-Zt),xt.setAttributeNS(null,"fill",this._makeShadingPattern(M)),this.current.fillAlpha<1&&xt.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(xt)}_makeColorN_Pattern(M){return M[0]==="TilingPattern"?this._makeTilingPattern(M):this._makeShadingPattern(M)}_makeTilingPattern(M){const u=M[1],q=M[2],$=M[3]||T.IDENTITY_MATRIX,[H,Zt,at,It]=M[4],xt=M[5],it=M[6],Xt=M[7],zt=`shading${j++}`,[Gt,Nt,Ut,Lt]=T.Util.normalizeRect([...T.Util.applyTransform([H,Zt],$),...T.Util.applyTransform([at,It],$)]),[Ht,Pt]=T.Util.singularValueDecompose2dScale($),dt=xt*Ht,w=it*Pt,k=this.svgFactory.createElement("svg:pattern");k.setAttributeNS(null,"id",zt),k.setAttributeNS(null,"patternUnits","userSpaceOnUse"),k.setAttributeNS(null,"width",dt),k.setAttributeNS(null,"height",w),k.setAttributeNS(null,"x",`${Gt}`),k.setAttributeNS(null,"y",`${Nt}`);const X=this.svg,O=this.transformMatrix,Q=this.current.fillColor,st=this.current.strokeColor,et=this.svgFactory.create(Ut-Gt,Lt-Nt);if(this.svg=et,this.transformMatrix=$,Xt===2){const Mt=T.Util.makeHexColor(...u);this.current.fillColor=Mt,this.current.strokeColor=Mt}return this.executeOpTree(this.convertOpList(q)),this.svg=X,this.transformMatrix=O,this.current.fillColor=Q,this.current.strokeColor=st,k.append(et.childNodes[0]),this.defs.append(k),`url(#${zt})`}_makeShadingPattern(M){switch(typeof M=="string"&&(M=this.objs.get(M)),M[0]){case"RadialAxial":const u=`shading${j++}`,q=M[3];let $;switch(M[1]){case"axial":const H=M[4],Zt=M[5];$=this.svgFactory.createElement("svg:linearGradient"),$.setAttributeNS(null,"id",u),$.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),$.setAttributeNS(null,"x1",H[0]),$.setAttributeNS(null,"y1",H[1]),$.setAttributeNS(null,"x2",Zt[0]),$.setAttributeNS(null,"y2",Zt[1]);break;case"radial":const at=M[4],It=M[5],xt=M[6],it=M[7];$=this.svgFactory.createElement("svg:radialGradient"),$.setAttributeNS(null,"id",u),$.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),$.setAttributeNS(null,"cx",It[0]),$.setAttributeNS(null,"cy",It[1]),$.setAttributeNS(null,"r",it),$.setAttributeNS(null,"fx",at[0]),$.setAttributeNS(null,"fy",at[1]),$.setAttributeNS(null,"fr",xt);break;default:throw new Error(`Unknown RadialAxial type: ${M[1]}`)}for(const H of q){const Zt=this.svgFactory.createElement("svg:stop");Zt.setAttributeNS(null,"offset",H[0]),Zt.setAttributeNS(null,"stop-color",H[1]),$.append(Zt)}return this.defs.append($),`url(#${u})`;case"Mesh":return(0,T.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${M[0]}`)}}setDash(M,u){this.current.dashArray=M,this.current.dashPhase=u}constructPath(M,u){const q=this.current;let $=q.x,H=q.y,Zt=[],at=0;for(const It of M)switch(It|0){case T.OPS.rectangle:$=u[at++],H=u[at++];const xt=u[at++],it=u[at++],Xt=$+xt,zt=H+it;Zt.push("M",L($),L(H),"L",L(Xt),L(H),"L",L(Xt),L(zt),"L",L($),L(zt),"Z");break;case T.OPS.moveTo:$=u[at++],H=u[at++],Zt.push("M",L($),L(H));break;case T.OPS.lineTo:$=u[at++],H=u[at++],Zt.push("L",L($),L(H));break;case T.OPS.curveTo:$=u[at+4],H=u[at+5],Zt.push("C",L(u[at]),L(u[at+1]),L(u[at+2]),L(u[at+3]),L($),L(H)),at+=6;break;case T.OPS.curveTo2:Zt.push("C",L($),L(H),L(u[at]),L
Line truncated
|
||||
`),position:Q,pageIndex:st-1,rect:w,rotation:k,id:X,deleted:!1}}const Ht=super.deserialize(Gt,Nt,Ut);return Zl(Ht,S,Gt.fontSize),Zl(Ht,F,Zt.Util.makeHexColor(...Gt.color)),Zl(Ht,J,Gt.value),Ht.annotationElementId=Gt.id||null,Zl(Ht,_,Lt),Ht}serialize(){let Gt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const Nt=Ol._internalPadding*this.parentScale,Ut=this.getRect(Nt,Nt),Lt=It.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:t(this,F)),Ht={annotationType:Zt.AnnotationEditorType.FREETEXT,color:Lt,fontSize:t(this,S),value:t(this,J),pageIndex:this.pageIndex,rect:Ut,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return Gt?Ht:this.annotationElementId&&!A(this,u,q).call(this,Ht)?null:(Ht.id=this.annotationElementId,Ht)}};m=new WeakMap,T=new WeakMap,B=new WeakMap,v=new WeakMap,F=new WeakMap,J=new WeakMap,p=new WeakMap,S=new WeakMap,_=new WeakMap,U=new WeakSet,f=function(zt){const Gt=Ut=>{this.editorDiv.style.fontSize=`calc(${Ut}px * var(--scale-factor))`,this.translate(0,-(Ut-t(this,S))*this.parentScale),Zl(this,S,Ut),A(this,j,K).call(this)},Nt=t(this,S);this.addCommands({cmd:()=>{Gt(zt)},undo:()=>{Gt(Nt)},mustExec:!0,type:Zt.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},L=new WeakSet,g=function(zt){const Gt=t(this,F);this.addCommands({cmd:()=>{Zl(this,F,this.editorDiv.style.color=zt)},undo:()=>{Zl(this,F,this.editorDiv.style.color=Gt)},mustExec:!0,type:Zt.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},I=new WeakSet,C=function(){const zt=this.editorDiv.getElementsByTagName("div");if(zt.length===0)return this.editorDiv.innerText;const Gt=[];for(const Nt of zt)Gt.push(Nt.innerText.replace(/\r\n?|\n/,""));return Gt.join(`
|
||||
`)},j=new WeakSet,K=function(){const[zt,Gt]=this.parentDimensions;let Nt;if(this.isAttachedToDOM)Nt=this.div.getBoundingClientRect();else{const{currentLayer:Ut,div:Lt}=this,Ht=Lt.style.display;Lt.style.display="hidden",Ut.div.append(this.div),Nt=Lt.getBoundingClientRect(),Lt.remove(),Lt.style.display=Ht}this.rotation%180===this.parentRotation%180?(this.width=Nt.width/zt,this.height=Nt.height/Gt):(this.width=Nt.height/zt,this.height=Nt.width/Gt),this.fixAndSetPosition()},P=new WeakSet,M=function(){if(this.editorDiv.replaceChildren(),!!t(this,J))for(const zt of t(this,J).split(`
|
||||
`)){const Gt=document.createElement("div");Gt.append(zt?document.createTextNode(zt):document.createElement("br")),this.editorDiv.append(Gt)}},u=new WeakSet,q=function(zt){const{value:Gt,fontSize:Nt,color:Ut,rect:Lt,pageIndex:Ht}=t(this,_);return zt.value!==Gt||zt.fontSize!==Nt||zt.rect.some((Pt,dt)=>Math.abs(Pt-Lt[dt])>=1)||zt.color.some((Pt,dt)=>Pt!==Ut[dt])||zt.pageIndex!==Ht},$=new WeakSet,H=function(){let zt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.annotationElementId)return;if(A(this,j,K).call(this),!zt&&(this.width===0||this.height===0)){setTimeout(()=>A(this,$,H).call(this,!0),0);return}const Gt=it._internalPadding*this.parentScale;t(this,_).rect=this.getRect(Gt,Gt)},tt(it,"_freeTextDefaultContent",""),tt(it,"_internalPadding",0),tt(it,"_defaultColor",null),tt(it,"_defaultFontSize",10),tt(it,"_type","freetext");let Xt=it;r.FreeTextEditor=Xt},(lt,r,h)=>{var m,T,B,v,F,J,p,S,_,U,f,L,g,I,C,j,K,P,M,u,q,$,H,Zt,at,It,xt,it,Xt,zt,Gt,Nt,Ut,Lt,Ht,Pt,dt,w,k,X,O,Q,st,et,Mt;Object.defineProperty(r,"__esModule",{value:!0}),r.StampAnnotationElement=r.InkAnnotationElement=r.FreeTextAnnotationElement=r.AnnotationLayer=void 0,h(89),h(125),h(136),h(138),h(141),h(143),h(145),h(147);var Rt=h(1),gt=h(168),Jt=h(163),Dt=h(199),qt=h(200),vt=h(201);const cl=1e3,bl=9,il=new WeakSet;function Bt(Wl){return{width:Wl[2]-Wl[0],height:Wl[3]-Wl[1]}}class Ft{static create(nt){switch(nt.data.annotationType){case Rt.AnnotationType.LINK:return new jt(nt);case Rt.AnnotationType.TEXT:return new $t(nt);case Rt.AnnotationType.WIDGET:switch(nt.data.fieldType){case"Tx":return new Ml(nt);case"Btn":return nt.data.radioButton?new Yl(nt):nt.data.checkBox?new Xl(nt):new Vl(nt);case"Ch":return new yl(nt);case"Sig":return new pl(nt)}return new al(nt);case Rt.AnnotationType.POPUP:return new Ll(nt);case Rt.AnnotationType.FREETEXT:return new ot(nt);case Rt.AnnotationType.LINE:return new ut(nt);case Rt.AnnotationType.SQUARE:return new Tt(nt);case Rt.AnnotationType.CIRCLE:return new Ct(nt);case Rt.AnnotationType.POLYLINE:return new Ot(nt);case Rt.AnnotationType.CARET:return new yt(nt);case Rt.AnnotationType.INK:return new Kt(nt);case Rt.AnnotationType.POLYGON:return new Vt(nt);case Rt.AnnotationType.HIGHLIGHT:return new tl(nt);case Rt.AnnotationType.UNDERLINE:return new el(nt);case Rt.AnnotationType.SQUIGGLY:return new ol(nt);case Rt.AnnotationType.STRIKEOUT:return new Qt(nt);case Rt.AnnotationType.STAMP:return new rl(nt);case Rt.AnnotationType.FILEATTACHMENT:return new hl(nt);default:return new Yt(nt)}}}const wt=class Us{constructor(nt){E(this,m,!1);let{isRenderable:R=!1,ignoreBorder:ct=!1,createQuadrilaterals:Wt=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.isRenderable=R,this.data=nt.data,this.layer=nt.layer,this.linkService=nt.linkService,this.downloadManager=nt.downloadManager,this.imageResourcesPath=nt.imageResourcesPath,this.renderForms=nt.renderForms,this.svgFactory=nt.svgFactory,this.annotationStorage=nt.annotationStorage,this.enableScripting=nt.enableScripting,this.hasJSActions=nt.hasJSActions,this._fieldObjects=nt.fieldObjects,this.parent=nt.parent,R&&(this.container=this._createContainer(ct)),Wt&&this._createQuadrilaterals()}static _hasPopupData(nt){let{titleObj:R,contentsObj:ct,richText:Wt}=nt;return!!(R!=null&&R.str||ct!=null&&ct.str||Wt!=null&&Wt.str)}get hasPopupData(){return Us._hasPopupData(this.data)}_createContainer(nt){const{data:R,parent:{page:ct,viewport:Wt}}=this,pt=document.createElement("section");pt.setAttribute("data-annotation-id",R.id),this instanceof al||(pt.tabIndex=cl),pt.style.zIndex=this.parent.zIndex++,this.data.popupRef&&pt.setAttribute("aria-haspopup","dialog"),R.noRotate&&pt.classList.add("norotate");const{pageWidth:kt,pageHeight:Et,pageX:sl,pageY:ml}=Wt.rawDims;if(!R.rect||this instanceof Ll){const{rotation:Tl}=R;return!R.hasOwnCanvas&&Tl!==0&&this.setRotation(Tl,pt),pt}const{width:dl,height:zl}=Bt(R.rect),Gl=Rt.Util.normalizeRect([R.rect[0],ct.view[3]-R.rect[1]+ct.view[1],R.rect[2],ct.view[3]-R.rect[3]+ct.view[1]]);if(!nt&&R.borderStyle.width>0){pt.style.borderWidth=`${R.borderStyle.width}px`;const Tl=R.borderStyle.horizontalCornerRadius,Rl=R.borderStyle.verticalCornerRadius;if(Tl>0||Rl>0){const wl=`calc(${Tl}px * var(--scale-factor)) / calc(${Rl}px * var(--scale-factor))`;pt.style.borderRadius=wl}else if(this instanceof Yl){const wl=`calc(${dl}px * var(--scale-factor)) / calc(${zl}px * var(--scale-factor))`;pt.style.borderRadius=wl}switch(R.borderStyle.style){case Rt.AnnotationBorderStyleType.SOLID:pt.style.borderStyle="solid";break;case Rt.AnnotationBorderStyleType.DASHED:pt.style.borderStyle="dashed";break;case Rt.AnnotationBorderStyleType.BEVELED:(0,Rt.warn)("Unimplemented border style: beveled");break;case Rt.AnnotationBorderStyleType.INSET:(0,Rt.warn)("Unimplemented border style: inset");break;case Rt.AnnotationBorderStyleType.UNDERLINE:pt.style.borderBottomStyle="solid";break}const Sl=R.borderColor||null;Sl?(Zl(this,m,!0),pt.style.borderColor=Rt.Util.makeHexCol
Line truncated
|
||||
`))||null;ml&&this.data.comb&&(ml=ml.replaceAll(/\s+/g,""));const dl={userValue:Et,formattedValue:ml,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(pt=document.createElement("textarea"),pt.textContent=ml??Et,this.data.doNotScroll&&(pt.style.overflowY="hidden")):(pt=document.createElement("input"),pt.type="text",pt.setAttribute("value",ml??Et),this.data.doNotScroll&&(pt.style.overflowX="hidden")),this.data.hasOwnCanvas&&(pt.hidden=!0),il.add(pt),pt.setAttribute("data-element-id",Wt),pt.disabled=this.data.readOnly,pt.name=this.data.fieldName,pt.tabIndex=cl,this._setRequired(pt,this.data.required),sl&&(pt.maxLength=sl),pt.addEventListener("input",Gl=>{ct.setValue(Wt,{value:Gl.target.value}),this.setPropertyOnSiblings(pt,"value",Gl.target.value,"value"),dl.formattedValue=null}),pt.addEventListener("resetform",Gl=>{const Nl=this.data.defaultFieldValue??"";pt.value=dl.userValue=Nl,dl.formattedValue=null});let zl=Gl=>{const{formattedValue:Nl}=dl;Nl!=null&&(Gl.target.value=Nl),Gl.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){pt.addEventListener("focus",Nl=>{if(dl.focused)return;const{target:Tl}=Nl;dl.userValue&&(Tl.value=dl.userValue),dl.lastCommittedValue=Tl.value,dl.commitKey=1,dl.focused=!0}),pt.addEventListener("updatefromsandbox",Nl=>{this.showElementAndHideCanvas(Nl.target);const Tl={value(Rl){dl.userValue=Rl.detail.value??"",ct.setValue(Wt,{value:dl.userValue.toString()}),Rl.target.value=dl.userValue},formattedValue(Rl){const{formattedValue:Sl}=Rl.detail;dl.formattedValue=Sl,Sl!=null&&Rl.target!==document.activeElement&&(Rl.target.value=Sl),ct.setValue(Wt,{formattedValue:Sl})},selRange(Rl){Rl.target.setSelectionRange(...Rl.detail.selRange)},charLimit:Rl=>{var Sl;const{charLimit:wl}=Rl.detail,{target:kl}=Rl;if(wl===0){kl.removeAttribute("maxLength");return}kl.setAttribute("maxLength",wl);let xl=dl.userValue;!xl||xl.length<=wl||(xl=xl.slice(0,wl),kl.value=dl.userValue=xl,ct.setValue(Wt,{value:xl}),(Sl=this.linkService.eventBus)==null||Sl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:Wt,name:"Keystroke",value:xl,willCommit:!0,commitKey:1,selStart:kl.selectionStart,selEnd:kl.selectionEnd}}))}};this._dispatchEventFromSandbox(Tl,Nl)}),pt.addEventListener("keydown",Nl=>{var Tl;dl.commitKey=1;let Rl=-1;if(Nl.key==="Escape"?Rl=0:Nl.key==="Enter"&&!this.data.multiLine?Rl=2:Nl.key==="Tab"&&(dl.commitKey=3),Rl===-1)return;const{value:Sl}=Nl.target;dl.lastCommittedValue!==Sl&&(dl.lastCommittedValue=Sl,dl.userValue=Sl,(Tl=this.linkService.eventBus)==null||Tl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:Wt,name:"Keystroke",value:Sl,willCommit:!0,commitKey:Rl,selStart:Nl.target.selectionStart,selEnd:Nl.target.selectionEnd}}))});const Gl=zl;zl=null,pt.addEventListener("blur",Nl=>{var Tl;if(!dl.focused||!Nl.relatedTarget)return;dl.focused=!1;const{value:Rl}=Nl.target;dl.userValue=Rl,dl.lastCommittedValue!==Rl&&((Tl=this.linkService.eventBus)==null||Tl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:Wt,name:"Keystroke",value:Rl,willCommit:!0,commitKey:dl.commitKey,selStart:Nl.target.selectionStart,selEnd:Nl.target.selectionEnd}})),Gl(Nl)}),(R=this.data.actions)!=null&&R.Keystroke&&pt.addEventListener("beforeinput",Nl=>{var Tl;dl.lastCommittedValue=null;const{data:Rl,target:Sl}=Nl,{value:wl,selectionStart:kl,selectionEnd:xl}=Sl;let Dl=kl,jl=xl;switch(Nl.inputType){case"deleteWordBackward":{const Cl=wl.substring(0,kl).match(/\w*[^\w]*$/);Cl&&(Dl-=Cl[0].length);break}case"deleteWordForward":{const Cl=wl.substring(kl).match(/^[^\w]*\w*/);Cl&&(jl+=Cl[0].length);break}case"deleteContentBackward":kl===xl&&(Dl-=1);break;case"deleteContentForward":kl===xl&&(jl+=1);break}Nl.preventDefault(),(Tl=this.linkService.eventBus)==null||Tl.dispatch("dispatcheventinsandbox",{source:this,detail:{id:Wt,name:"Keystroke",value:wl,change:Rl||"",willCommit:!1,selStart:Dl,selEnd:jl}})}),this._setEventListeners(pt,dl,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Nl=>Nl.target.value)}if(zl&&pt.addEventListener("blur",zl),this.data.comb){const Gl=(this.data.rect[2]-this.data.rect[0])/sl;pt.classList.add("comb"),pt.style.letterSpacing=`calc(${Gl}px * var(--scale-factor) - 1ch)`}}else pt=document.createElement("div"),pt.textContent=this.data.fieldValue,pt.style.verticalAlign="middle",pt.style.display="table-cell";return this._setTextStyle(pt),this._setBackgroundColor(pt),this._setDefaultPropertiesFromJS(pt),this.container.append(pt),this.container}}class pl extends al{constructor(nt){super(nt,{isRenderable:!!nt.data.hasOwnCanvas})}}class Xl extends al{constructor(nt){super(nt,{isRenderable:nt.renderForms})}render(){const nt=this.annotationStorage,R=this.data,ct=R.id;let Wt=nt.getValue(ct,{value:R.exportValue===R.fieldValue}).value;typeof Wt=="string"&&(Wt=Wt!=="Off",nt.setValue(ct,{value:Wt})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const pt=document.createEleme
Line truncated
|
||||
`),Rl=Tl?pt.length-2:pt.length;Wl=!0;let Sl=Rl;dl+Il===((Gl=Kt[ol])==null?void 0:Gl[1])&&(Sl-=Kt[ol][0],++ol);for(let wl=1;wl<=Sl;wl++)el.push([dl-1-rl+wl,rl-wl]);return rl-=Sl,hl+=Sl,Tl?(dl+=Rl-1,el.push([dl-rl+1,1+rl]),rl+=1,hl+=1,Il+=1,pt.slice(0,Rl)):pt}if(kt){const Tl=kt.length-2;return el.push([dl-rl+Tl,1+rl]),rl+=1,hl+=1,Il+=1,kt.slice(0,-2)}if(Et){const Tl=Et.length-1;return el.push([dl-rl+Tl,rl]),hl+=1,Il+=1,Et.slice(0,-1)}if(sl)return el.push([dl-rl+1,rl-1]),rl-=1,hl+=1,Il+=1," ";if(dl+Il===((Nl=Ot[Qt])==null?void 0:Nl[1])){const Tl=Ot[Qt][0]-1;++Qt;for(let Rl=1;Rl<=Tl;Rl++)el.push([dl-(rl-Rl),rl-Rl]);rl-=Tl,hl+=Tl}return ml}),el.push([tl.length,rl]),[tl,el,Wl]}function ut(Ct,Ot,Vt){if(!Ct)return[Ot,Vt];const yt=Ot,Kt=Ot+Vt-1;let tl=(0,qt.binarySearchFirstItem)(Ct,rl=>rl[0]>=yt);Ct[tl][0]>yt&&--tl;let el=(0,qt.binarySearchFirstItem)(Ct,rl=>rl[0]>=Kt,tl);Ct[el][0]>Kt&&--el;const ol=yt+Ct[tl][1],Qt=Kt+Ct[el][1]+1-ol;return[ol,Qt]}class Tt{constructor({linkService:Ot,eventBus:Vt,updateMatchesCountOnProgress:yt=!0}){E(this,U),E(this,L),E(this,I),E(this,j),E(this,P),E(this,u),E(this,$),E(this,Zt),E(this,It),E(this,it),E(this,zt),E(this,Nt),E(this,Lt),E(this,Pt),E(this,w),E(this,X),E(this,Q),E(this,et),E(this,Rt),E(this,Jt),E(this,p,null),E(this,S,!0),E(this,_,0),this._linkService=Ot,this._eventBus=Vt,Zl(this,S,yt),this.onIsPageVisible=null,A(this,L,g).call(this),Vt._on("find",A(this,U,f).bind(this)),Vt._on("findbarclose",A(this,Q,st).bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return t(this,p)}setDocument(Ot){this._pdfDocument&&A(this,L,g).call(this),Ot&&(this._pdfDocument=Ot,this._firstPageCapability.resolve())}scrollMatchIntoView({element:Ot=null,selectedLeft:Vt=0,pageIndex:yt=-1,matchIndex:Kt=-1}){if(!this._scrollMatches||!Ot||Kt===-1||Kt!==this._selected.matchIdx||yt===-1||yt!==this._selected.pageIdx)return;this._scrollMatches=!1;const tl={top:Bt,left:Vt+Ft};(0,qt.scrollIntoView)(Ot,tl,!0)}}p=new WeakMap,S=new WeakMap,_=new WeakMap,U=new WeakSet,f=function(Ct){if(!Ct)return;Ct.phraseSearch===!1&&(console.error("The `phraseSearch`-parameter was removed, please provide an Array of strings in the `query`-parameter instead."),typeof Ct.query=="string"&&(Ct.query=Ct.query.match(/\S+/g)));const Ot=this._pdfDocument,{type:Vt}=Ct;(t(this,p)===null||A(this,j,K).call(this,Ct))&&(this._dirtyMatch=!0),Zl(this,p,Ct),Vt!=="highlightallchange"&&A(this,Jt,Dt).call(this,bl.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||Ot&&this._pdfDocument!==Ot)return;A(this,It,xt).call(this);const yt=!this._highlightMatches,Kt=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),Vt?this._dirtyMatch?A(this,Nt,Ut).call(this):Vt==="again"?(A(this,Nt,Ut).call(this),yt&&t(this,p).highlightAll&&A(this,zt,Gt).call(this)):Vt==="highlightallchange"?(Kt?A(this,Nt,Ut).call(this):this._highlightMatches=!0,A(this,zt,Gt).call(this)):A(this,Nt,Ut).call(this):this._findTimeout=setTimeout(()=>{A(this,Nt,Ut).call(this),this._findTimeout=null},il)})},L=new WeakSet,g=function(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],Zl(this,_,0),Zl(this,p,null),this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=new cl.PromiseCapability},I=new WeakSet,C=function(){const{query:Ct}=t(this,p);return typeof Ct=="string"?(Ct!==this._rawQuery&&(this._rawQuery=Ct,[this._normalizedQuery]=ot(Ct)),this._normalizedQuery):(Ct||[]).filter(Ot=>!!Ot).map(Ot=>ot(Ot)[0])},j=new WeakSet,K=function(Ct){var Ot;const Vt=Ct.query,yt=t(this,p).query,Kt=typeof Vt;if(Kt!==typeof yt)return!0;if(Kt==="string"){if(Vt!==yt)return!0}else if(JSON.stringify(Vt)!==JSON.stringify(yt))return!0;switch(Ct.type){case"again":const tl=this._selected.pageIdx+1,el=this._linkService;return tl>=1&&tl<=el.pagesCount&&tl!==el.page&&!(((Ot=this.onIsPageVisible)==null?void 0:Ot.call(this,tl))??!0);case"highlightallchange":return!1}return!0},P=new WeakSet,M=function(Ct,Ot,Vt){let yt=Ct.slice(0,Ot).match(Ml);if(yt){const Kt=Ct.charCodeAt(Ot),tl=yt[1].charCodeAt(0);if((0,vt.getCharacterType)(Kt)===(0,vt.getCharacterType)(tl))return!1}if(yt=Ct.slice(Ot+Vt).match(pl),yt){const Kt=Ct.charCodeAt(Ot+Vt-1),tl=yt[1].charCodeAt(0);if((0,vt.getCharacterType)(Kt)===(0,vt.getCharacterType)(tl))return!1}return!0},u=new WeakSet,q=function(Ct,Ot,Vt,yt){const Kt=this._pageMatches[Vt]=[],tl=this._pageMatchesLength[Vt]=[];if(!Ct)return;const el=this._pageDiffs[Vt];let ol;for(;(ol
Line truncated
|
||||
`);[this._pageContents[Vt],this._pageDiffs[Vt],this._hasDiacritics[Vt]]=ot(el.join("")),Kt.resolve()},tl=>{console.error(`Unable to get text content for page ${Vt+1}`,tl),this._pageContents[Vt]="",this._pageDiffs[Vt]=null,this._hasDiacritics[Vt]=!1,Kt.resolve()}))}},it=new WeakSet,Xt=function(Ct){this._scrollMatches&&this._selected.pageIdx===Ct&&(this._linkService.page=Ct+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:Ct})},zt=new WeakSet,Gt=function(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})},Nt=new WeakSet,Ut=function(){const Ct=t(this,p).findPrevious,Ot=this._linkService.page-1,Vt=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=Ot,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,Zl(this,_,0),this._matchesCountTotal=0,A(this,zt,Gt).call(this);for(let Kt=0;Kt<Vt;Kt++)this._pendingFindMatches.has(Kt)||(this._pendingFindMatches.add(Kt),this._extractTextPromises[Kt].then(()=>{this._pendingFindMatches.delete(Kt),A(this,Zt,at).call(this,Kt)}))}if(t(this,I,C).length===0){A(this,Jt,Dt).call(this,bl.FOUND);return}if(this._resumePageIdx)return;const yt=this._offset;if(this._pagesToSearch=Vt,yt.matchIdx!==null){const Kt=this._pageMatches[yt.pageIdx].length;if(!Ct&&yt.matchIdx+1<Kt||Ct&&yt.matchIdx>0){yt.matchIdx=Ct?yt.matchIdx-1:yt.matchIdx+1,A(this,X,O).call(this,!0);return}A(this,w,k).call(this,Ct)}A(this,Pt,dt).call(this)},Lt=new WeakSet,Ht=function(Ct){const Ot=this._offset,Vt=Ct.length,yt=t(this,p).findPrevious;return Vt?(Ot.matchIdx=yt?Vt-1:0,A(this,X,O).call(this,!0),!0):(A(this,w,k).call(this,yt),Ot.wrapped&&(Ot.matchIdx=null,this._pagesToSearch<0)?(A(this,X,O).call(this,!1),!0):!1)},Pt=new WeakSet,dt=function(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let Ct=null;do{const Ot=this._offset.pageIdx;if(Ct=this._pageMatches[Ot],!Ct){this._resumePageIdx=Ot;break}}while(!A(this,Lt,Ht).call(this,Ct))},w=new WeakSet,k=function(Ct){const Ot=this._offset,Vt=this._linkService.pagesCount;Ot.pageIdx=Ct?Ot.pageIdx-1:Ot.pageIdx+1,Ot.matchIdx=null,this._pagesToSearch--,(Ot.pageIdx>=Vt||Ot.pageIdx<0)&&(Ot.pageIdx=Ct?Vt-1:0,Ot.wrapped=!0)},X=new WeakSet,O=function(Ct=!1){let Ot=bl.NOT_FOUND;const Vt=this._offset.wrapped;if(this._offset.wrapped=!1,Ct){const yt=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,Ot=Vt?bl.WRAPPED:bl.FOUND,yt!==-1&&yt!==this._selected.pageIdx&&A(this,it,Xt).call(this,yt)}A(this,Jt,Dt).call(this,Ot,t(this,p).findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,A(this,it,Xt).call(this,this._selected.pageIdx))},Q=new WeakSet,st=function(Ct){const Ot=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||Ot&&this._pdfDocument!==Ot||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),A(this,Jt,Dt).call(this,bl.FOUND),this._highlightMatches=!1,A(this,zt,Gt).call(this))})},et=new WeakSet,Mt=function(){var Ct;const{pageIdx:Ot,matchIdx:Vt}=this._selected;let yt=0,Kt=this._matchesCountTotal;if(Vt!==-1){for(let tl=0;tl<Ot;tl++)yt+=((Ct=this._pageMatches[tl])==null?void 0:Ct.length)||0;yt+=Vt+1}return(yt<1||yt>Kt)&&(yt=Kt=0),{current:yt,total:Kt}},Rt=new WeakSet,gt=function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:A(this,et,Mt).call(this)})},Jt=new WeakSet,Dt=function(Ct,Ot=!1){var Vt;!t(this,S)&&(t(this,_)!==this._linkService.pagesCount||Ct===bl.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:Ct,previous:Ot,matchesCount:A(this,et,Mt).call(this),rawQuery:((Vt=t(this,p))==null?void 0:Vt.query)??null})},F.PDFFindController=Tt},(v,F)=>{var J,p,S,_,U;Object.defineProperty(F,"__esModule",{value:!0}),F.animationStarted=F.VERTICAL_PADDING=F.UNKNOWN_SCALE=F.TextLayerMode=F.SpreadMode=F.SidebarView=F.ScrollMode=F.SCROLLBAR_PADDING=F.RenderingStates=F.ProgressBar=F.PresentationModeState=F.OutputScale=F.MIN_SCALE=F.MAX_SCALE=F.MAX_AUTO_SCALE=F.DEFAULT_SCALE_VALUE=F.DEFAULT_SCALE_DELTA=F.DEFAULT_SCALE=F.CursorTool=F.AutoPrintRegExp=void 0,F.apiPageLayoutToViewerModes=vt,F.apiPageModeToSidebarView=cl,F.approximateFraction=Ht,F.backtrackBeforeAllVisibleElements=w,F.binarySearchFirstItem=Lt,F.docStyle=void 0,F.getActiveOrFocusedElement=qt,F.getPageSizeInches=dt,F.getVisibleElements=k,F.isPortraitOrientation=Mt,F.isValidRotation=Q,F.isValidScrollMode=st,F.isValidSpreadMode=et,F.normalizeWheelEventDelta=O,F.normalizeWheelEventDirection=X,F.parseQueryString=Gt,F.removeNullCharacters=Ut,F.roundToDivide=Pt,F.scrollIntoView=Xt,F.toggleCheckedBtn=bl,F.toggleExpandedBtn=il,F.watchScroll=zt;const f="auto";F.DEFAULT_SCALE_VALUE=f;const L=1;F.DEFAULT_SCALE=L;const g=1.1;F.
Line truncated
|
||||
`).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}function Lt(Ht,Pt){var dt={},w=/^\s*|\s*$/,k=/^\s*#|^\s*$/,X=/^\s*\[(.*)\]\s*$/,O=/^\s*@import\s+url\((.*)\)\s*$/i,Q=/^([^=\s]*)\s*=\s*(.+)$/;function st(Mt,Rt,gt){var Jt=Mt.replace(w,"").split(/[\r\n]+/),Dt="*",qt=Xt.split("-",1)[0],vt=!1,cl="";function bl(){for(;;){if(!Jt.length){gt();return}var il=Jt.shift();if(!k.test(il)){if(Rt){if(cl=X.exec(il),cl){Dt=cl[1].toLowerCase(),vt=Dt!=="*"&&Dt!==Xt&&Dt!==qt;continue}else if(vt)continue;if(cl=O.exec(il),cl){et(Nt+cl[1],bl);return}}var Bt=il.match(Q);Bt&&Bt.length==3&&(dt[Bt[1]]=Ut(Bt[2]))}}}bl()}function et(Mt,Rt){K(Mt,function(gt){st(gt,!1,Rt)},function(){console.warn(Mt+" not found."),Rt()})}st(Ht,!0,function(){Pt(dt)})}K(it,function(Ht){p+=Ht,Lt(Ht,function(Pt){for(var dt in Pt){var w,k,X=dt.lastIndexOf(".");X>0?(w=dt.substring(0,X),k=dt.substring(X+1)):(w=dt,k=S),J[w]||(J[w]={}),J[w][k]=Pt[dt]}zt&&zt()})},Gt)}function M(it,Xt){it&&(it=it.toLowerCase()),Xt=Xt||function(){},u(),_=it;var zt=g(),Gt=zt.length;if(Gt===0){var Nt=I();if(Nt&&Nt.locales&&Nt.default_locale){if(console.log("using the embedded JSON directory, early way out"),J=Nt.locales[it],!J){var Ut=Nt.default_locale.toLowerCase();for(var Lt in Nt.locales)if(Lt=Lt.toLowerCase(),Lt===it){J=Nt.locales[it];break}else Lt===Ut&&(J=Nt.locales[Ut])}Xt()}else console.log("no resource to load, early way out");f="complete";return}var Ht=null,Pt=0;Ht=function(){Pt++,Pt>=Gt&&(Xt(),f="complete")};function dt(X){var O=X.href;this.load=function(Q,st){P(O,Q,st,function(){console.warn(O+" not found."),console.warn('"'+Q+'" resource not found'),_="",st()})}}for(var w=0;w<Gt;w++){var k=new dt(zt[w]);k.load(it,Ht)}}function u(){J={},p="",_=""}function q(it){var Xt={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3};function zt(Lt,Ht){return Ht.indexOf(Lt)!==-1}function Gt(Lt,Ht,Pt){return Ht<=Lt&&Lt<=Pt}var Nt={0:function(Lt){return"other"},1:function(Lt){return Gt(Lt%100,3,10)?"few":Lt===0?"zero":Gt(Lt%100,11,99)?"many":Lt==2?"two":Lt==1?"one":"other"},2:function(Lt){return Lt!==0&&Lt%10===0?"many":Lt==2?"two":Lt==1?"one":"other"},3:function(Lt){return Lt==1?"one":"other"},4:function(Lt){return Gt(Lt,0,1)?"one":"other"},5:function(Lt){return Gt(Lt,0,2)&&Lt!=2?"one":"other"},6:function(Lt){return Lt===0?"zero":Lt%10==1&&Lt%100!=11?"one":"other"},7:function(Lt){return Lt==2?"two":Lt==1?"one":"other"},8:function(Lt){return Gt(Lt,3,6)?"few":Gt(Lt,7,10)?"many":Lt==2?"two":Lt==1?"one":"other"},9:function(Lt){return Lt===0||Lt!=1&&Gt(Lt%100,1,19)?"few":Lt==1?"one":"other"},10:function(Lt){return Gt(Lt%10,2,9)&&!Gt(Lt%100,11,19)?"few":Lt%10==1&&!Gt(Lt%100,11,19)?"one":"other"},11:function(Lt){return Gt(Lt%10,2,4)&&!Gt(Lt%100,12,14)?"few":Lt%10===0||Gt(Lt%10,5,9)||Gt(Lt%100,11,14)?"many":Lt%10==1&&Lt%100!=11?"one":"other"},12:function(Lt){return Gt(Lt,2,4)?"few":Lt==1?"one":"other"},13:function(Lt){return Gt(Lt%10,2,4)&&!Gt(Lt%100,12,14)?"few":Lt!=1&&Gt(Lt%10,0,1)||Gt(Lt%10,5,9)||Gt(Lt%100,12,14)?"many":Lt==1?"one":"other"},14:function(Lt){return Gt(Lt%100,3,4)?"few":Lt%100==2?"two":Lt%100==1?"one":"other"},15:function(Lt){return Lt===0||Gt(Lt%100,2,10)?"few":Gt(Lt%100,11,19)?"many":Lt==1?"one":"other"},16:function(Lt){return Lt%10==1&&Lt!=11?"one":"other"},17:function(Lt){return Lt==3?"few":Lt===0?"zero":Lt==6?"many":Lt==2?"two":Lt==1?"one":"other"},18:function(Lt){return Lt===0?"zero":Gt(Lt,0,2)&&Lt!==0&&Lt!=2?"one":"other"},19:function(Lt){return Gt(Lt,2,10)?"few":Gt(Lt,0,1)?"one":"other"},20:function(Lt){return(Gt(Lt%10,3,4)||Lt%10==9)&&!(Gt(Lt%100,10,19)||Gt(Lt%100,70,79)||Gt(Lt%100,90,99))?"few":Lt%1e6===0&&Lt!==0?"many":Lt%10==2&&!zt(Lt%100,[12,72,92])?"two":Lt%10==1&&!zt(Lt%100,[11,71,91])?"one":"other"},21:function(Lt){return Lt===0?"zero":Lt==1?"one":"other"},22:function(Lt){return Gt(Lt,0,1)||Gt(Lt,11,99)?"one":"other"},23:function(Lt){return Gt(Lt%10,1,2)||Lt%20===0?"one":"other"},24:function(Lt){return Gt(Lt,3,10)||Gt(Lt,13,19)?"few":zt(Lt,[2,12])?"two":zt(Lt,[1,11])?"one":"other"}},Ut=Xt[it.replac
Line truncated
|
||||
`);ot.push((0,jt.removeNullCharacters)(ut.join("")))}return ot.join(`
|
||||
`)}setDocument(ot){var ut,Tt;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),(ut=this.findController)==null||ut.setDocument(null),(Tt=this._scriptingManager)==null||Tt.setDocument(null),t(this,I)&&(t(this,I).destroy(),Zl(this,I,null))),this.pdfDocument=ot,!ot)return;const Ct=ot.numPages,Ot=ot.getPage(1),Vt=ot.getOptionalContentConfig(),yt=t(this,P)?ot.getPermissions():Promise.resolve();if(Ct>Yl.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const Kt=this._scrollMode=jt.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:Kt})}this._pagesCapability.promise.then(()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:Ct})},()=>{}),this._onBeforeDraw=Kt=>{const tl=this._pages[Kt.pageNumber-1];tl&&t(this,f).push(tl)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=Kt=>{Kt.cssTransform||this._onePageRenderedCapability.settled||(this._onePageRenderedCapability.resolve({timestamp:Kt.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,t(this,at)&&(document.removeEventListener("visibilitychange",t(this,at)),Zl(this,at,null)))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([Ot,yt]).then(([Kt,tl])=>{var el,ol;if(ot!==this.pdfDocument)return;this._firstPageCapability.resolve(Kt),this._optionalContentConfigPromise=Vt;const{annotationEditorMode:Qt,annotationMode:rl,textLayerMode:hl}=A(this,zt,Gt).call(this,tl);if(hl!==jt.TextLayerMode.DISABLE){const Wt=Zl(this,u,document.createElement("div"));Wt.id="hiddenCopyElement",this.viewer.before(Wt)}if(Qt!==Yt.AnnotationEditorType.DISABLE){const Wt=Qt;ot.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):Vl(Wt)?(Zl(this,I,new Yt.AnnotationEditorUIManager(this.container,this.viewer,t(this,L),this.eventBus,ot,this.pageColors)),Wt!==Yt.AnnotationEditorType.NONE&&t(this,I).updateMode(Wt)):console.error(`Invalid AnnotationEditor mode: ${Wt}`)}const Il=A(this,it,Xt).bind(this),Wl=this._scrollMode===jt.ScrollMode.PAGE?null:this.viewer,nt=this.currentScale,R=Kt.getViewport({scale:nt*Yt.PixelsPerInch.PDF_TO_CSS_UNITS});this.viewer.style.setProperty("--scale-factor",R.scale),(((el=this.pageColors)==null?void 0:el.foreground)==="CanvasText"||((ol=this.pageColors)==null?void 0:ol.background)==="Canvas")&&this.viewer.style.setProperty("--hcm-highligh-filter",ot.filterFactory.addHighlightHCMFilter("CanvasText","Canvas","HighlightText","Highlight"));for(let Wt=1;Wt<=Ct;++Wt){const pt=new al.PDFPageView({container:Wl,eventBus:this.eventBus,id:Wt,scale:nt,defaultViewport:R.clone(),optionalContentConfigPromise:Vt,renderingQueue:this.renderingQueue,textLayerMode:hl,annotationMode:rl,imageResourcesPath:this.imageResourcesPath,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:Il});this._pages.push(pt)}const ct=this._pages[0];ct&&(ct.setPdfPage(Kt),this.linkService.cachePageRef(1,Kt.ref)),this._scrollMode===jt.ScrollMode.PAGE?A(this,Pt,dt).call(this):this._spreadMode!==jt.SpreadMode.NONE&&this._updateSpreadMode(),A(this,Nt,Ut).call(this).then(async()=>{var Wt,pt;if((Wt=this.findController)==null||Wt.setDocument(ot),(pt=this._scriptingManager)==null||pt.setDocument(ot),t(this,u)&&(Zl(this,K,A(this,Lt,Ht).bind(this,hl)),document.addEventListener("copy",t(this,K))),t(this,I)&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:t(this,g)}),ot.loadingParams.disableAutoFetch||Ct>Yl.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let kt=Ct-1;if(kt<=0){this._pagesCapability.resolve();return}for(let Et=2;Et<=Ct;++Et){const sl=ot.getPage(Et).then(ml=>{const dl=this._pages[Et-1];dl.pdfPage||dl.setPdfPage(ml),this.linkService.cachePageRef(Et,ml.ref),--kt===0&&this._pagesCapability.resolve()},ml=>{console.error(`Unable to get page ${Et} to initialize viewer`,ml),--kt===0&&this._pagesCapability.resolve()});Et%Yl.PAUSE_EAGER_PAGE_INIT===0&&await sl}}),this.eventBus.dispatch("pagesinit",{source:this}),ot.getMetadata().then(({info:Wt})=>{ot===this.pdfDocument&&Wt.Language&&(this.viewer.lang=Wt.Language)}),this.defaultRenderingQueue&&this.update()}).catch(Kt=>{console.error("Unable to initialize viewer",Kt),this._pagesCapability.reject(Kt)})}setPageLabels(ot){var ut;if(this.pdfDocument){ot?Array.isArray(ot)&&this.pdfDocument.numPages===ot.length?this._pageLabels=ot:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let Tt=0,Ct=this._pages.length;Tt<Ct;Tt++)this._pages[Tt].setPageLabel(((ut=this._pageLabels)==null?void 0:ut[Tt])??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=jt.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,Zl(this,f,new yl(Xl)),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromis
Line truncated
|
||||
@page {
|
||||
margin: 3mm;
|
||||
size: ${r}pt ${h}pt;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
canvas {
|
||||
width: 100%;
|
||||
page-break-after: always;
|
||||
page-break-before: avoid;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
`,lt.contentWindow.document.head.appendChild(m),lt.contentWindow.document.body.style.width="100%"}function createPrintIframe(lt){return new Promise(r=>{const h=document.createElement("iframe");h.width="0",h.height="0",h.style.position="absolute",h.style.top="0",h.style.left="0",h.style.border="none",h.style.overflow="hidden",h.onload=()=>r(h),lt.appendChild(h)})}function downloadPdf(lt,r){const h=URL.createObjectURL(new Blob([lt],{type:"application/pdf"})),m=document.createElement("a");m.href=h,m.download=r,m.style.display="none",document.body.append(m),m.click(),setTimeout(()=>{URL.revokeObjectURL(h),document.body.removeChild(m)},1e3)}function emptyElement(lt){for(;lt!=null&<.firstChild;)lt.removeChild(lt.firstChild)}function releaseChildCanvases(lt){lt==null||lt.querySelectorAll("canvas").forEach(r=>{var h;r.width=1,r.height=1,(h=r.getContext("2d"))==null||h.clearRect(0,0,1,1)})}const _hoisted_1$2=["id"],_hoisted_2$2=["id"],_hoisted_3$2=createBaseVNode("canvas",null,null,-1),_hoisted_4$2={key:0,class:"textLayer"},_hoisted_5$2={key:1,class:"annotationLayer"},_sfc_main$3=defineComponent({__name:"VuePdfEmbed",props:{annotationLayer:{type:Boolean},height:{},id:{},imageResourcesPath:{},page:{},rotation:{default:0},scale:{default:1},source:{},textLayer:{type:Boolean},width:{}},emits:["internal-link-clicked","loaded","loading-failed","password-requested","progress","rendered","rendering-failed"],setup(lt,{expose:r,emit:h}){const m=lt,T=shallowRef([]),B=shallowRef([]),v=ref([]),F=shallowRef(null),{doc:J}=useVuePdfEmbed({onError:C=>{T.value=[],h("loading-failed",C)},onPasswordRequest({callback:C,isWrongPassword:j}){h("password-requested",{callback:C,isWrongPassword:j})},onProgress:C=>{h("progress",C)},source:toRef(m,"source")}),p=computed(()=>{if(!J.value||!m.annotationLayer)return null;const C=new pdf_viewerExports.PDFLinkService;return C.setDocument(J.value),C.setViewer({scrollPageIntoView:({pageNumber:j})=>{h("internal-link-clicked",j)}}),C}),S=async C=>{if(!J.value)return;const j=await J.value.getData(),K=await J.value.getMetadata(),P=C??K.contentDispositionFilename??"";downloadPdf(j,P)},_=C=>{let j,K;return m.height&&!m.width?(K=m.height,j=K/C):(j=m.width??F.value.clientWidth,K=j*C),[j,K]},U=async(C=300,j="",K=!1)=>{var P,M,u;if(!J.value)return;const q=C/72,$=96/72;let H,Zt,at;try{H=window.document.createElement("div"),H.style.display="none",window.document.body.appendChild(H),Zt=await createPrintIframe(H);const It=m.page&&!K?[m.page]:[...Array(J.value.numPages+1).keys()].slice(1);await Promise.all(It.map(async(xt,it)=>{const Xt=await J.value.getPage(xt),zt=Xt.getViewport({scale:1,rotation:0});if(it===0){const Ut=zt.width*q/$,Lt=zt.height*q/$;addPrintStyles(Zt,Ut,Lt)}const Gt=window.document.createElement("canvas");Gt.width=zt.width*q,Gt.height=zt.height*q,H.appendChild(Gt);const Nt=Gt.cloneNode();Zt.contentWindow.document.body.appendChild(Nt),await Xt.render({canvasContext:Gt.getContext("2d"),intent:"print",transform:[q,0,0,q,0,0],viewport:zt}).promise,Nt.getContext("2d").drawImage(Gt,0,0)})),j&&(at=window.document.title,window.document.title=j),(P=Zt.contentWindow)==null||P.focus(),(M=Zt.contentWindow)==null||M.print()}finally{at&&(window.document.title=at),releaseChildCanvases(H),(u=H.parentNode)==null||u.removeChild(H)}},f=async()=>{if(J.value)try{T.value=m.page?[m.page]:[...Array(J.value.numPages+1).keys()].slice(1),v.value=Array(T.value.length).fill(1),await Promise.all(T.value.map(async(C,j)=>{const K=await J.value.getPage(C),P=((m.rotation%90===0?m.rotation:0)+K.rotate)%360,[M,u,q]=Array.from(B.value[j].children),$=!!(P/90%2),[H,Zt]=_($?K.view[2]/K.view[3]:K.view[3]/K.view[2]),at=`${Math.floor(H)}px`,It=`${Math.floor(Zt)}px`,xt=$?K.view[3]:K.view[2],it=H/xt,Xt=K.getViewport({scale:it,rotation:P});v.value[j]=it,M.style.width=at,M.style.height=It,u&&(u.style.width=$?It:at,u.style.height=$?at:It),q&&(q.style.width=$?It:at,q.style.height=$?at:It),await L(K,Xt.clone({scale:Xt.scale*window.devicePixelRatio*m.scale}),M),m.textLayer&&await I(K,Xt.clone({dontFlip:!0}),u),m.annotationLayer&&await g(K,Xt.clone({dontFlip:!0}),q||u)})),h("rendered")}catch(C){T.value=[],v.value=[],h("rendering-failed",C)}},L=async(C,j,K)=>{K.width=j.width,K.height=j.height,await C.render({canvasContext:K.getContext("2d"),viewport:j}).promise},g=async(C,j,K)=>{emptyElement(K),new pdfExports.AnnotationLayer({accessibilityManager:null,annotationCanvasMap:null,div:K,l10n:null,page:C,viewport:j}).render({annotations:await C.getAnnotations(),div:K,downloadManager:null,imageResourcesPath:m.imageResourcesPath,linkService:p.value,page:C,renderForms:!1,viewport:j})},I=async(C,j,K)=>{emptyElement(K),await pdfExports.renderTextLayer({container:K,textContentSource:await C.getTextContent(),viewport:j}).promise};return watch(J,()=>{J.value&&h("loaded",J.value)},{immediate:!0}),watch(()=>m.source,()=>{releaseChildCanvases(F.value)}),watch(()=>[J.value,m.annotationLayer,m.height,m.imageResourcesPath,m.page,m.rotation,m.scale,m.textLayer,m.widt
Line truncated
|
||||
Reference in new issue
Block a user