@file-viewer/vue3 2.2.5 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fit.js +498 -1
- package/dist/components/image.js +174 -1
- package/dist/components/messages.js +1430 -1
- package/dist/components/print-mask.js +213 -1
- package/dist/components/printMask.js +66 -1
- package/dist/index.mjs +5728 -1
- package/package.json +2 -2
package/dist/components/fit.js
CHANGED
|
@@ -1 +1,498 @@
|
|
|
1
|
-
const aF=a1;(function(a4,a5){const aB=a1,a6=a4();while(!![]){try{const a7=parseInt(aB(0x20a))/0x1*(parseInt(aB(0x231))/0x2)+-parseInt(aB(0x204))/0x3*(parseInt(aB(0x1f0))/0x4)+parseInt(aB(0x1f7))/0x5+-parseInt(aB(0x20d))/0x6+parseInt(aB(0x21c))/0x7*(-parseInt(aB(0x211))/0x8)+-parseInt(aB(0x1f3))/0x9+parseInt(aB(0x22b))/0xa*(parseInt(aB(0x1ef))/0xb);if(a7===a5)break;else a6['push'](a6['shift']());}catch(a8){a6['push'](a6['shift']());}}}(a0,0xf4053));function a0(){const b7=['none','22qHcVsB','500aavzar','smooth','left','8788536WbmADk','canZoomOut','minScale','top','3102465DBSEqC','overflowY','forEach','minScrollRange','clientWidth','join','line','find','__flyfishViewerViewStateProvider','max','reason','split','nodeType','18747LBmExb','extra','viewerViewStateProvider','call','getBoundingClientRect','number','9698lTaoXv','generic','getComputedStyle','5759442wiqsaf','slice','__flyfishViewerSearchProvider','.state-panel','1710256Imxcat','canReset','.pdf-nav-pane','scroll','unsupported','resize','length','height','auto','shadowRoot','actual','21CgKsJr','add','scale-down','push','padding','pending','viewer-anchor-','canZoomIn','.pdfViewer\x20.page,\x20[data-page-number],\x20[data-page]','isFinite','dataset','viewerAnchorId','width','escape','viewer','11949370JKAMqd','unmeasurable','source','.pdf-toolbar','initial','navigation','278VHgweQ','from','min','scale','maxTextLength','leftRatio'];a0=function(){return b7;};return a0();}function a1(a,b){a=a-0x1ef;const c=a0();let d=c[a];return d;}import{a as a2,i as a3}from'./messages.js';var n=(a4={})=>{const aC=a1;var a5,a6,a7;let a8=Number['isFinite'](a4['scale'])&&a4['scale']?Number(a4['scale']):0x1;return{'scale':a8,'label':a4['label']||Math['round'](a8*0x64)+'%','canZoomIn':(a5=a4[aC(0x223)])==null?!0x1:a5,'canZoomOut':(a6=a4['canZoomOut'])==null?!0x1:a6,'canReset':(a7=a4['canReset'])==null?!0x1:a7,'minScale':a4['minScale'],'maxScale':a4['maxScale']};},r=a4=>a4===!0x1?{'enabled':!0x1}:a4===!0x0||a4===void 0x0?{}:a4,i=(a4='')=>({'query':a4,'total':0x0,'currentIndex':-0x1,'current':null,'matches':[]}),a=a4=>a4===!0x1?{'enabled':!0x1,'collectText':!0x1}:a4===!0x0||a4===void 0x0?{}:a4,o=(a4,a5)=>{const aD=a1;var a6;let a7=a(a5);if(a7['enabled']===!0x1||a7['collectText']===!0x1)return[];let a8=Math[aD(0x200)](0xc8,a7['chunkSize']||0x4b0),a9=Math['max'](0x0,Math[aD(0x233)](a8-0x1,(a6=a7['chunkOverlap'])==null?0xa0:a6)),aa=Math['max'](0x0,a7[aD(0x235)]||0x0),ab=[];return a4['forEach'](ac=>{const aE=aD;let ad=aa?ac['text'][aE(0x20e)](0x0,aa):ac['text'];if(!ad)return;if(ad['length']<=a8){ab[aE(0x21f)]({'id':ac['id']+'-chunk-1','text':ad,'anchor':ac,'startLine':ac[aE(0x1fd)],'endLine':ac['line']});return;}let af=0x0,ag=0x1;for(;af<ad['length'];){let ah=ad['slice'](af,af+a8);if(ab['push']({'id':ac['id']+'-chunk-'+ag,'text':ah,'anchor':ac,'startLine':ac['line'],'endLine':ac['line']}),af+a8>=ad['length'])break;af+=a8-a9,ag+=0x1;}}),ab;},s='[data-viewer-anchor-id],.pdfViewer\x20.page,.docx-wrapper\x20section,.docx\x20p,.docx\x20li,.docx\x20table,.markdown-body\x20h1,.markdown-body\x20h2,.markdown-body\x20h3,.markdown-body\x20h4,.markdown-body\x20h5,.markdown-body\x20h6,.markdown-body\x20p,.markdown-body\x20li,.markdown-body\x20pre,.markdown-body\x20table,article\x20h1,article\x20h2,article\x20h3,article\x20h4,article\x20h5,article\x20h6,article\x20p,article\x20li,article\x20pre,article\x20table,pre\x20code,p,li,tr,h1,h2,h3,h4,h5,h6,pre,table'[aF(0x202)](',')['join'](','),c=['.viewer-actions','.viewer-watermark',aF(0x210),aF(0x22e),aF(0x213),'.flyfish-search-match'][aF(0x1fc)](','),l=a4=>typeof CSS<'u'&&typeof CSS[aF(0x229)]=='function'?CSS['escape'](a4):a4['replace'](/["\\]/g,'\x5c$&'),u=(a4,a5=0xa0)=>{let a6=a4['replace'](/\s+/g,'\x20')['trim']();return a6['length']>a5?a6['slice'](0x0,a5-0x1)+'…':a6;},d=a4=>{const aG=aF;let a5=a4[aG(0x208)]();return a5['width']>0x0||a5['height']>0x0;},f=a4=>!!a4['closest'](c),p=a4=>{const aH=aF;let a5=a4['closest']('[data-page-number],\x20[data-page]'),a6=(a5==null?void 0x0:a5[aH(0x226)]['pageNumber'])||(a5==null?void 0x0:a5[aH(0x226)]['page']),a7=a6?Number['parseInt'](a6,0xa):NaN;return Number['isFinite'](a7)?a7:void 0x0;},m=a4=>a4['matches'](aF(0x224))?'page':a4['matches']('p,\x20li,\x20tr,\x20pre,\x20code')?'line':'block',h=(a4,a5)=>{let a6=a4['parentElement'];for(;a6;){if(a5['has'](a6))return!0x0;a6=a6['parentElement'];}return!0x1;},g=a4=>{const aI=aF;if(!a4)return[];let a5=a4['getBoundingClientRect'](),a6=new Set(),a7=[];return Array[aI(0x232)](a4['querySelectorAll'](s))['forEach'](a8=>{const aJ=aI;if(f(a8)||!d(a8))return;let a9=u(a8['textContent']||'',0x3e8);if(!a9||h(a8,a6)&&!a8['matches']('p,\x20li,\x20tr,\x20pre,\x20code'))return;a6[aJ(0x21d)](a8);let aa=a8[aJ(0x226)]['viewerAnchorId']||aJ(0x222)+(a7['length']+0x1);a8[aJ(0x226)]['viewerAnchorId']=aa,a8['dataset']['viewerLine']=String(a7[aJ(0x217)]+0x1);let ab=a8['getBoundingClientRect']();a7['push']({'id':aa,'index':a7['length'],'line':a7['length']+0x1,'type':m(a8),'label':u(a9,0x60),'text':a9,'page':p(a8),'top':ab['top']-a5[aJ(0x1f6)]+a4['scrollTop'],'left':ab['left']-a5['left']+a4['scrollLeft'],'width':ab['width'],'height':ab['height']});}),a7;},_=(a4,a5,a6)=>{const aK=aF;if(!a4)return null;let a7=a4['closest']('[data-viewer-anchor-id]');if(a7!=null&&a7['dataset']['viewerAnchorId']){let ab=a5[aK(0x1fe)](ac=>ac['id']===a7['dataset'][aK(0x227)]);if(ab)return ab;}if(!a6)return null;let a8=a6[aK(0x208)](),a9=a4['getBoundingClientRect']()['top']-a8['top']+a6['scrollTop'],aa=null;for(let ac of a5){if(ac['top']<=a9+0x1){aa=ac;continue;}break;}return aa;},v=(a4,a5)=>{if(!a4||!a5['length'])return null;let a6=a4['scrollTop']+a4['clientHeight']*0.42,a7=a5[0x0];for(let a8 of a5){if(a8['top']<=a6){a7=a8;continue;}break;}return a7;},ee=(a4,a5)=>{const aL=aF;if(!a4||a5==null)return!0x1;let a6=typeof a5=='object'?'[data-viewer-anchor-id=\x22'+l(a5['id'])+'\x22]':typeof a5==aL(0x209)?'[data-viewer-line=\x22'+a5+'\x22]':'[data-viewer-anchor-id=\x22'+l(a5)+'\x22]',a7=a4['querySelector'](a6);return a7?(a7['scrollIntoView']({'block':'center','inline':'nearest'}),!0x0):typeof a5=='object'?(a4['scrollTo']({'top':Math[aL(0x200)](0x0,a5[aL(0x1f6)]-a4['clientHeight']*0.18),'left':Math['max'](0x0,Math[aL(0x233)](a5['left'],a4['scrollWidth']-a4['clientWidth'])),'behavior':aL(0x1f1)}),!0x0):!0x1;},y=new WeakMap(),b=new WeakMap(),x=new WeakMap(),S=a4=>!!a4&&a4[aF(0x203)]===0x1,C=(a4,a5)=>{const aM=aF;if(!(a4!=null&&a4['querySelectorAll']))return[];let a6=Array['from'](a4['querySelectorAll'](a5));S(a4)&&a4['shadowRoot']&&a6[aM(0x21f)](...C(a4['shadowRoot'],a5));let a7=Array['from'](a4['querySelectorAll']('*'));for(let a8 of a7)a8['shadowRoot']&&a6['push'](...C(a8[aM(0x21a)],a5));return a6;},w=a4=>{const aN=aF;if(!a4)return null;let a5=S(a4)?y['get'](a4)||a4['__flyfishViewerSearchProvider']:null;if(a5)return a5;let a6=C(a4,'[data-viewer-search-provider]')[0x0];return a6&&(y['get'](a6)||a6[aN(0x20f)])||null;},T=(a4,a5)=>{b['set'](a4,a5),a4['dataset']['viewerZoomProvider']=a4['dataset']['viewerZoomProvider']||'custom',a4['__flyfishViewerZoomProvider']=a5;},E=a4=>{a4&&(b['delete'](a4),delete a4['dataset']['viewerZoomProvider'],delete a4['__flyfishViewerZoomProvider']);},D=a4=>{if(!a4)return null;let a5=S(a4)?b['get'](a4)||a4['__flyfishViewerZoomProvider']:null;if(a5)return a5;let a6=C(a4,'[data-viewer-zoom-provider]')[0x0];return a6&&(b['get'](a6)||a6['__flyfishViewerZoomProvider'])||null;},O=(a4,a5)=>{const aO=aF;x['set'](a4,a5),a4['dataset'][aO(0x206)]=a4['dataset']['viewerViewStateProvider']||'custom',a4[aO(0x1ff)]=a5;},k=a4=>{a4&&(x['delete'](a4),delete a4['dataset']['viewerViewStateProvider'],delete a4['__flyfishViewerViewStateProvider']);},A=a4=>{const aP=aF;if(!a4)return null;let a5=S(a4)?x['get'](a4)||a4['__flyfishViewerViewStateProvider']:null;if(a5&&(!S(a4)||a4[aP(0x226)]['viewerViewStateProvider']!=='generic'))return a5;let a6=C(a4,'[data-viewer-view-state-provider]'),a7=a6['find'](aa=>aa['dataset']['viewerViewStateProvider']!=='generic'),a8=a6['find'](aa=>aa[aP(0x226)]['viewerViewStateProvider']===aP(0x20b)),a9=a7||a8;return a9?x['get'](a9)||a9['__flyfishViewerViewStateProvider']||null:a5||null;},j=['auto','scroll','overlay'],M=a4=>Math['max'](0x0,a4['scrollHeight']-a4['clientHeight']),N=(a4,a5={})=>{const aQ=aF;var a6,a7;let a8=(a6=a5[aQ(0x1fa)])==null?0x2:a6;if(M(a4)<=a8)return!0x1;let a9=(a7=a4['ownerDocument'])==null?void 0x0:a7['defaultView'],aa=a9!=null&&a9[aQ(0x20c)]?a9:typeof window<'u'?window:void 0x0;if(!(aa!=null&&aa['getComputedStyle']))return!0x1;let ab=aa[aQ(0x20c)](a4),ac=ab[aQ(0x1f8)]||ab['overflow'];return(a5['overflowValues']||j)['includes'](ac);},P=(a4,a5={})=>{if(!a4)return null;let a6=a5['preferredSelector']||'[data-viewer-scroll-container],\x20.pdf-wrapper',a7=a5['candidateSelector']||'div,\x20section,\x20article,\x20pre',a8=a4['querySelector'](a6);return a8&&N(a8,a5)?a8:N(a4,a5)?a4:Array['from'](a4['querySelectorAll'](a7))['filter'](a9=>N(a9,a5))['sort']((a9,aa)=>M(aa)-M(a9))[0x0]||a8||a4;},F=a4=>({'scale':a4[aF(0x234)],'label':a4['label'],'canZoomIn':a4['canZoomIn'],'canZoomOut':a4['canZoomOut'],'canReset':a4[aF(0x212)],'minScale':a4[aF(0x1f5)],'maxScale':a4['maxScale']}),I=(a4,a5)=>{const aR=aF;let a6=n(a5||{});return a4['scale']=a6['scale'],a4['label']=a6['label'],a4[aR(0x223)]=a6['canZoomIn'],a4[aR(0x1f4)]=a6['canZoomOut'],a4['canReset']=a6['canReset'],a4['minScale']=a6[aR(0x1f5)],a4['maxScale']=a6['maxScale'],a4;},te=a4=>F(a4);(function(){var a4=a3(function*(a5,a6){return I(a5,yield a6()),te(a5);});return function(a5,a6){return a4['apply'](this,arguments);};}());var L=()=>{let a4=new Set();return{'emit'(){const aS=a1;a4[aS(0x1f9)](a5=>a5());},'subscribe'(a5){return a4['add'](a5),()=>{a4['delete'](a5);};}};},R=a4=>{var a5,a6;return((a6=(a5=a4==null?void 0x0:a4['ownerDocument'])==null?void 0x0:a5['defaultView'])==null?void 0x0:a6['MutationObserver'])||(typeof MutationObserver<'u'?MutationObserver:void 0x0);},z=({root:a4,enabled:a5,beforeZoom:a6,onChange:a7})=>{let a8=null,a9=null,aa=null,ab=!0x1,ac=n(),ad=()=>{a7==null||a7(F(ac));},af=()=>{a9==null||a9(),a9=null,a8=null,I(ac,null);},ag=()=>{const aT=a1;var aj,ak;if((a5==null?void 0x0:a5())===!0x1)return af(),null;let al=D(a4());return al!==a8&&(a9==null||a9(),a8=al,a9=((aj=al==null?void 0x0:al['subscribe'])==null?void 0x0:aj[aT(0x207)](al,()=>{I(ac,al['getState']()),ab||ad();}))||null),I(ac,((ak=al==null?void 0x0:al['getState'])==null?void 0x0:ak['call'](al))||null),al;},ah=()=>{aa==null||aa['disconnect'](),aa=null;},ai=(function(){var aj=a3(function*(ak,al){let am=ag();if(!am||a6&&(yield a6(ak))===!0x1)return F(ac);ab=!0x0;try{return I(ac,(yield al(am))||am['getState']()),F(ac);}finally{ab=!0x1;}});return function(ak,al){return aj['apply'](this,arguments);};}());return{get 'provider'(){return a8;},'state':ac,'hasProvider'(){return!!ag();},'refreshProvider':ag,'observe'(){ah();let aj=a4(),ak=R(aj);if(!aj||!ak){ag();return;}aa=new ak(()=>{ag();}),aa['observe'](aj,{'childList':!0x0,'subtree':!0x0}),ag();},'clearProvider':af,'getState'(){return F(ac);},'zoomIn':()=>ai('zoom-in',aj=>aj['zoomIn']()),'zoomOut':()=>ai('zoom-out',aj=>aj['zoomOut']()),'resetZoom':()=>ai('zoom-reset',aj=>aj['resetZoom']()),'destroy'(){ah(),af();}};},B=[aF(0x219),'contain','cover','width','height','actual',aF(0x21e)],V=['until-interaction','always','initial'],H='until-interaction',U=0x0,W=0x8,G=a4=>!!a4&&typeof a4=='object'&&!Array['isArray'](a4),K=a4=>typeof a4=='string'&&B['includes'](a4),q=a4=>typeof a4=='string'&&V['includes'](a4),J=a4=>{const aU=aF;let a5=Number(a4);return Number[aU(0x225)](a5)&&a5>0x0?a5:void 0x0;},Y=a4=>{let a5=Number(a4);return Number['isFinite'](a5)&&a5>0x0?a5:U;},X=a4=>{const aV=aF;if(a4==null||a4===!0x1)return null;if(K(a4))return{'mode':a4,'resize':H,'padding':U};if(!G(a4))return null;let a5=J(a4['minScale']),a6=J(a4['maxScale']),a7=a5!==void 0x0&&a6!==void 0x0&&a6<a5?a5:a6;return{'mode':K(a4['mode'])?a4['mode']:'auto','resize':q(a4['resize'])?a4['resize']:H,'padding':Y(a4[aV(0x220)]),'minScale':a5,'maxScale':a7};},Z=(a4,a5,a6)=>{const aW=aF;let a7=a4;return Number[aW(0x225)](a5)&&(a7=Math['max'](Number(a5),a7)),Number['isFinite'](a6)&&(a7=Math['min'](Number(a6),a7)),a7;},ne=({mode:a4,viewportWidth:a5,viewportHeight:a6,contentWidth:a7,contentHeight:a8,minScale:a9,maxScale:aa})=>{const aX=aF;if(a5<=0x0||a6<=0x0||a7<=0x0||a8<=0x0)return;let ab=a5/a7,ac=a6/a8,ad=Math['min'](ab,ac),af=Math[aX(0x200)](ab,ac),ag=((()=>{const aY=aX;switch(a4){case'cover':return af;case'width':return ab;case aY(0x218):return ac;case aY(0x21b):return 0x1;case'scale-down':return Math['min'](0x1,ad);default:return ad;}})());if(!(!Number['isFinite'](ag)||ag<=0x0))return Z(ag,a9,aa);},re=a4=>{const aZ=aF;var a5,a6;if(!a4)return!0x1;let a7=Number((a5=a4['scale'])==null?(a6=a4['zoom'])==null?void 0x0:a6['scale']:a5);if(Number[aZ(0x225)](a7)&&a7>0x0||Number['isFinite'](a4['page'])||Number['isFinite'](a4['rotation'])||a4['navigation']&&Object['keys'](a4[aZ(0x230)])[aZ(0x217)]>0x0||a4['extra']&&Object['keys'](a4[aZ(0x205)])['length']>0x0)return!0x0;let a8=a4[aZ(0x214)]||{};return['top',aZ(0x1f2),'topRatio',aZ(0x236)]['some'](a9=>{let aa=a8[a9];return Number['isFinite'](aa);});},Q=(a4,a5,a6=aF(0x22a),a7='none')=>({'applied':!0x1,'mode':a4['mode'],'resize':a4['resize'],'source':a6,'reason':a5,'provider':a7}),$=(a4,a5,a6)=>({'applied':!!(a4!=null&&a4['applied']),'mode':(a4==null?void 0x0:a4['mode'])||a5['mode'],'resize':(a4==null?void 0x0:a4['resize'])||a5[aF(0x216)],'scale':a4==null?void 0x0:a4['scale'],'source':(a4==null?void 0x0:a4['source'])||a5[aF(0x22d)],'reason':a4==null?void 0x0:a4['reason'],'provider':(a4==null?void 0x0:a4['provider'])||a6,'state':a4==null?void 0x0:a4['state']}),ie=a4=>a4===aF(0x221)||a4==='retry'||a4==='image-not-ready'||a4===aF(0x22c),ae=a4=>{const b0=aF;var a5;let a6=(a5=a4['getBoundingClientRect'])==null?void 0x0:a5['call'](a4);return{'width':Math['max'](0x0,(a6==null?void 0x0:a6['width'])||a4[b0(0x1fb)]||0x0),'height':Math['max'](0x0,(a6==null?void 0x0:a6['height'])||a4['clientHeight']||0x0)};},oe=({root:a4,enabled:a5,getFit:a6=()=>void 0x0,onFit:a7})=>{const b3=aF;let a8=null,a9=null,aa=null,ab=!0x1,ac=0x0,ad=()=>{var am;let an=a4();return((am=an==null?void 0x0:an['ownerDocument'])==null?void 0x0:am['defaultView'])||(typeof window<'u'?window:void 0x0);},af=()=>{if(a9===null)return;let am=ad();am!=null&&am['cancelAnimationFrame']&&am['cancelAnimationFrame'](a9),a9=null;},ag=()=>{aa&&clearTimeout(aa),aa=null;},ah=(am,an)=>{const b1=a1;let ao=am===void 0x0?a6():am;return ao==null?an==='api'?X(b1(0x219)):null:X(ao);},ai=(am,an,ao)=>{ac>=W||(ag(),ac+=0x1,aa=setTimeout(()=>{aa=null,aj(am,{'source':an,'reason':ao==='api'?'api':'retry'});},0x20*ac));},aj=(function(){var am=a3(function*(an,ao={}){const b2=a1;let ap=ao['source']||'api',aq=ao['reason']||'api',ar=ah(an,aq);if(!ar)return{'applied':!0x1,'mode':'auto','resize':H,'source':ap,'reason':'not-configured','provider':b2(0x237)};if((a5==null?void 0x0:a5())===!0x1)return Q(ar,'disabled',ap);let as=a4();if(!as)return ai(an,ap,aq),Q(ar,'no-root',ap);let at=ae(as);if(at['width']<=0x0||at['height']<=0x0)return ai(an,ap,aq),Q(ar,'zero-size',ap);let au=a2(a2({},ar),{},{'source':ap,'reason':aq,'viewportWidth':Math['max'](0x0,at[b2(0x228)]-ar['padding']*0x2),'viewportHeight':Math['max'](0x0,at[b2(0x218)]-ar[b2(0x220)]*0x2),'container':as}),av=A(as),aw=null;if(av!=null&&av['fit']){let az=$(yield av['fit'](au),au,'view-state');if(az['applied'])return ac=0x0,a7==null||a7(az),az;aw=az;}let ax=D(as);if(ax!=null&&ax['fit']){let aA=$(yield ax['fit'](au),au,'zoom');if(aA['applied'])return ac=0x0,a7==null||a7(aA),aA;aw=aA;}let ay=Q(ar,av||ax?b2(0x215):'no-provider',ap);return(ay['reason']==='no-provider'||ie(aw==null?void 0x0:aw['reason']))&&ai(an,ap,aq),ay;});return function(an){return am['apply'](this,arguments);};}()),ak=(am=b3(0x216))=>{const b4=b3;let an=X(a6());if(!an||an[b4(0x216)]==='initial'||an[b4(0x216)]==='until-interaction'&&ab)return;af();let ao=ad(),ap=()=>{a9=null,aj(void 0x0,{'source':'viewer','reason':am});};if(ao!=null&&ao['requestAnimationFrame']){a9=ao['requestAnimationFrame'](ap);return;}a9=setTimeout(ap,0x10);},al=()=>{af(),a8==null||a8['disconnect'](),a8=null;};return{'normalize':X,'fit':(function(){var am=a3(function*(an,ao){const b5=a1;return ag(),ab=!0x1,aj(an,{'source':(ao==null?void 0x0:ao['source'])||'api','reason':(ao==null?void 0x0:ao[b5(0x201)])||'api'});});return function(an,ao){return am['apply'](this,arguments);};}()),'applyInitialFit':(function(){var am=a3(function*(an={}){const b6=a1;return ag(),ac=0x0,ab=!0x1,an['skip']?Q(X(a6())||X('auto'),'initial-view-state','initial'):aj(void 0x0,{'source':'initial','reason':b6(0x22f)});});return function(){return am['apply'](this,arguments);};}()),'scheduleFit':ak,'observe'(){var am,an;al();let ao=a4(),ap=((an=(am=ao==null?void 0x0:ao['ownerDocument'])==null?void 0x0:am['defaultView'])==null?void 0x0:an['ResizeObserver'])||(typeof ResizeObserver<'u'?ResizeObserver:void 0x0);!ao||!ap||(a8=new ap(()=>ak('resize')),a8['observe'](ao));},'markUserInteraction'(){ab=!0x0,ag();},'resetAutoFit'(){ab=!0x1,ac=0x0;},'destroy'(){al(),ag(),ac=0x0;}};};export{ee as _,z as a,r as b,A as c,T as d,k as f,v as g,_ as h,L as i,D as l,g as m,re as n,P as o,E as p,ne as r,w as s,oe as t,O as u,o as v,i as y};
|
|
1
|
+
import { a as e, i as t } from "./messages.js";
|
|
2
|
+
var n = (e = {}) => {
|
|
3
|
+
var t, n, r;
|
|
4
|
+
let i = Number.isFinite(e.scale) && e.scale ? Number(e.scale) : 1;
|
|
5
|
+
return {
|
|
6
|
+
scale: i,
|
|
7
|
+
label: e.label || `${Math.round(i * 100)}%`,
|
|
8
|
+
canZoomIn: (t = e.canZoomIn) == null ? !1 : t,
|
|
9
|
+
canZoomOut: (n = e.canZoomOut) == null ? !1 : n,
|
|
10
|
+
canReset: (r = e.canReset) == null ? !1 : r,
|
|
11
|
+
minScale: e.minScale,
|
|
12
|
+
maxScale: e.maxScale
|
|
13
|
+
};
|
|
14
|
+
}, r = (e) => e === !1 ? { enabled: !1 } : e === !0 || e === void 0 ? {} : e, i = (e = "") => ({
|
|
15
|
+
query: e,
|
|
16
|
+
total: 0,
|
|
17
|
+
currentIndex: -1,
|
|
18
|
+
current: null,
|
|
19
|
+
matches: []
|
|
20
|
+
}), a = (e) => e === !1 ? {
|
|
21
|
+
enabled: !1,
|
|
22
|
+
collectText: !1
|
|
23
|
+
} : e === !0 || e === void 0 ? {} : e, o = (e, t) => {
|
|
24
|
+
var n;
|
|
25
|
+
let r = a(t);
|
|
26
|
+
if (r.enabled === !1 || r.collectText === !1) return [];
|
|
27
|
+
let i = Math.max(200, r.chunkSize || 1200), o = Math.max(0, Math.min(i - 1, (n = r.chunkOverlap) == null ? 160 : n)), s = Math.max(0, r.maxTextLength || 0), c = [];
|
|
28
|
+
return e.forEach((e) => {
|
|
29
|
+
let t = s ? e.text.slice(0, s) : e.text;
|
|
30
|
+
if (!t) return;
|
|
31
|
+
if (t.length <= i) {
|
|
32
|
+
c.push({
|
|
33
|
+
id: `${e.id}-chunk-1`,
|
|
34
|
+
text: t,
|
|
35
|
+
anchor: e,
|
|
36
|
+
startLine: e.line,
|
|
37
|
+
endLine: e.line
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let n = 0, r = 1;
|
|
42
|
+
for (; n < t.length;) {
|
|
43
|
+
let a = t.slice(n, n + i);
|
|
44
|
+
if (c.push({
|
|
45
|
+
id: `${e.id}-chunk-${r}`,
|
|
46
|
+
text: a,
|
|
47
|
+
anchor: e,
|
|
48
|
+
startLine: e.line,
|
|
49
|
+
endLine: e.line
|
|
50
|
+
}), n + i >= t.length) break;
|
|
51
|
+
n += i - o, r += 1;
|
|
52
|
+
}
|
|
53
|
+
}), c;
|
|
54
|
+
}, s = (/* @__PURE__ */ "[data-viewer-anchor-id],.pdfViewer .page,.docx-wrapper section,.docx p,.docx li,.docx table,.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6,.markdown-body p,.markdown-body li,.markdown-body pre,.markdown-body table,article h1,article h2,article h3,article h4,article h5,article h6,article p,article li,article pre,article table,pre code,p,li,tr,h1,h2,h3,h4,h5,h6,pre,table".split(",")).join(","), c = [
|
|
55
|
+
".viewer-actions",
|
|
56
|
+
".viewer-watermark",
|
|
57
|
+
".state-panel",
|
|
58
|
+
".pdf-toolbar",
|
|
59
|
+
".pdf-nav-pane",
|
|
60
|
+
".flyfish-search-match"
|
|
61
|
+
].join(","), l = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), u = (e, t = 160) => {
|
|
62
|
+
let n = e.replace(/\s+/g, " ").trim();
|
|
63
|
+
return n.length > t ? `${n.slice(0, t - 1)}…` : n;
|
|
64
|
+
}, d = (e) => {
|
|
65
|
+
let t = e.getBoundingClientRect();
|
|
66
|
+
return t.width > 0 || t.height > 0;
|
|
67
|
+
}, f = (e) => !!e.closest(c), p = (e) => {
|
|
68
|
+
let t = e.closest("[data-page-number], [data-page]"), n = (t == null ? void 0 : t.dataset.pageNumber) || (t == null ? void 0 : t.dataset.page), r = n ? Number.parseInt(n, 10) : NaN;
|
|
69
|
+
return Number.isFinite(r) ? r : void 0;
|
|
70
|
+
}, m = (e) => e.matches(".pdfViewer .page, [data-page-number], [data-page]") ? "page" : e.matches("p, li, tr, pre, code") ? "line" : "block", h = (e, t) => {
|
|
71
|
+
let n = e.parentElement;
|
|
72
|
+
for (; n;) {
|
|
73
|
+
if (t.has(n)) return !0;
|
|
74
|
+
n = n.parentElement;
|
|
75
|
+
}
|
|
76
|
+
return !1;
|
|
77
|
+
}, g = (e) => {
|
|
78
|
+
if (!e) return [];
|
|
79
|
+
let t = e.getBoundingClientRect(), n = /* @__PURE__ */ new Set(), r = [];
|
|
80
|
+
return Array.from(e.querySelectorAll(s)).forEach((i) => {
|
|
81
|
+
if (f(i) || !d(i)) return;
|
|
82
|
+
let a = u(i.textContent || "", 1e3);
|
|
83
|
+
if (!a || h(i, n) && !i.matches("p, li, tr, pre, code")) return;
|
|
84
|
+
n.add(i);
|
|
85
|
+
let o = i.dataset.viewerAnchorId || `viewer-anchor-${r.length + 1}`;
|
|
86
|
+
i.dataset.viewerAnchorId = o, i.dataset.viewerLine = String(r.length + 1);
|
|
87
|
+
let s = i.getBoundingClientRect();
|
|
88
|
+
r.push({
|
|
89
|
+
id: o,
|
|
90
|
+
index: r.length,
|
|
91
|
+
line: r.length + 1,
|
|
92
|
+
type: m(i),
|
|
93
|
+
label: u(a, 96),
|
|
94
|
+
text: a,
|
|
95
|
+
page: p(i),
|
|
96
|
+
top: s.top - t.top + e.scrollTop,
|
|
97
|
+
left: s.left - t.left + e.scrollLeft,
|
|
98
|
+
width: s.width,
|
|
99
|
+
height: s.height
|
|
100
|
+
});
|
|
101
|
+
}), r;
|
|
102
|
+
}, _ = (e, t, n) => {
|
|
103
|
+
if (!e) return null;
|
|
104
|
+
let r = e.closest("[data-viewer-anchor-id]");
|
|
105
|
+
if (r != null && r.dataset.viewerAnchorId) {
|
|
106
|
+
let e = t.find((e) => e.id === r.dataset.viewerAnchorId);
|
|
107
|
+
if (e) return e;
|
|
108
|
+
}
|
|
109
|
+
if (!n) return null;
|
|
110
|
+
let i = n.getBoundingClientRect(), a = e.getBoundingClientRect().top - i.top + n.scrollTop, o = null;
|
|
111
|
+
for (let e of t) {
|
|
112
|
+
if (e.top <= a + 1) {
|
|
113
|
+
o = e;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
return o;
|
|
119
|
+
}, v = (e, t) => {
|
|
120
|
+
if (!e || !t.length) return null;
|
|
121
|
+
let n = e.scrollTop + e.clientHeight * .42, r = t[0];
|
|
122
|
+
for (let e of t) {
|
|
123
|
+
if (e.top <= n) {
|
|
124
|
+
r = e;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
return r;
|
|
130
|
+
}, ee = (e, t) => {
|
|
131
|
+
if (!e || t == null) return !1;
|
|
132
|
+
let n = typeof t == "object" ? `[data-viewer-anchor-id="${l(t.id)}"]` : typeof t == "number" ? `[data-viewer-line="${t}"]` : `[data-viewer-anchor-id="${l(t)}"]`, r = e.querySelector(n);
|
|
133
|
+
return r ? (r.scrollIntoView({
|
|
134
|
+
block: "center",
|
|
135
|
+
inline: "nearest"
|
|
136
|
+
}), !0) : typeof t == "object" ? (e.scrollTo({
|
|
137
|
+
top: Math.max(0, t.top - e.clientHeight * .18),
|
|
138
|
+
left: Math.max(0, Math.min(t.left, e.scrollWidth - e.clientWidth)),
|
|
139
|
+
behavior: "smooth"
|
|
140
|
+
}), !0) : !1;
|
|
141
|
+
}, y = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), S = (e) => !!e && e.nodeType === 1, C = (e, t) => {
|
|
142
|
+
if (!(e != null && e.querySelectorAll)) return [];
|
|
143
|
+
let n = Array.from(e.querySelectorAll(t));
|
|
144
|
+
S(e) && e.shadowRoot && n.push(...C(e.shadowRoot, t));
|
|
145
|
+
let r = Array.from(e.querySelectorAll("*"));
|
|
146
|
+
for (let e of r) e.shadowRoot && n.push(...C(e.shadowRoot, t));
|
|
147
|
+
return n;
|
|
148
|
+
}, w = (e) => {
|
|
149
|
+
if (!e) return null;
|
|
150
|
+
let t = S(e) ? y.get(e) || e.__flyfishViewerSearchProvider : null;
|
|
151
|
+
if (t) return t;
|
|
152
|
+
let n = C(e, "[data-viewer-search-provider]")[0];
|
|
153
|
+
return n && (y.get(n) || n.__flyfishViewerSearchProvider) || null;
|
|
154
|
+
}, T = (e, t) => {
|
|
155
|
+
b.set(e, t), e.dataset.viewerZoomProvider = e.dataset.viewerZoomProvider || "custom", e.__flyfishViewerZoomProvider = t;
|
|
156
|
+
}, E = (e) => {
|
|
157
|
+
e && (b.delete(e), delete e.dataset.viewerZoomProvider, delete e.__flyfishViewerZoomProvider);
|
|
158
|
+
}, D = (e) => {
|
|
159
|
+
if (!e) return null;
|
|
160
|
+
let t = S(e) ? b.get(e) || e.__flyfishViewerZoomProvider : null;
|
|
161
|
+
if (t) return t;
|
|
162
|
+
let n = C(e, "[data-viewer-zoom-provider]")[0];
|
|
163
|
+
return n && (b.get(n) || n.__flyfishViewerZoomProvider) || null;
|
|
164
|
+
}, O = (e, t) => {
|
|
165
|
+
x.set(e, t), e.dataset.viewerViewStateProvider = e.dataset.viewerViewStateProvider || "custom", e.__flyfishViewerViewStateProvider = t;
|
|
166
|
+
}, k = (e) => {
|
|
167
|
+
e && (x.delete(e), delete e.dataset.viewerViewStateProvider, delete e.__flyfishViewerViewStateProvider);
|
|
168
|
+
}, A = (e) => {
|
|
169
|
+
if (!e) return null;
|
|
170
|
+
let t = S(e) ? x.get(e) || e.__flyfishViewerViewStateProvider : null;
|
|
171
|
+
if (t && (!S(e) || e.dataset.viewerViewStateProvider !== "generic")) return t;
|
|
172
|
+
let n = C(e, "[data-viewer-view-state-provider]"), r = n.find((e) => e.dataset.viewerViewStateProvider !== "generic"), i = n.find((e) => e.dataset.viewerViewStateProvider === "generic"), a = r || i;
|
|
173
|
+
return a ? x.get(a) || a.__flyfishViewerViewStateProvider || null : t || null;
|
|
174
|
+
}, j = [
|
|
175
|
+
"auto",
|
|
176
|
+
"scroll",
|
|
177
|
+
"overlay"
|
|
178
|
+
], M = (e) => Math.max(0, e.scrollHeight - e.clientHeight), N = (e, t = {}) => {
|
|
179
|
+
var n, r;
|
|
180
|
+
let i = (n = t.minScrollRange) == null ? 2 : n;
|
|
181
|
+
if (M(e) <= i) return !1;
|
|
182
|
+
let a = (r = e.ownerDocument) == null ? void 0 : r.defaultView, o = a != null && a.getComputedStyle ? a : typeof window < "u" ? window : void 0;
|
|
183
|
+
if (!(o != null && o.getComputedStyle)) return !1;
|
|
184
|
+
let s = o.getComputedStyle(e), c = s.overflowY || s.overflow;
|
|
185
|
+
return (t.overflowValues || j).includes(c);
|
|
186
|
+
}, P = (e, t = {}) => {
|
|
187
|
+
if (!e) return null;
|
|
188
|
+
let n = t.preferredSelector || "[data-viewer-scroll-container], .pdf-wrapper", r = t.candidateSelector || "div, section, article, pre", i = e.querySelector(n);
|
|
189
|
+
return i && N(i, t) ? i : N(e, t) ? e : Array.from(e.querySelectorAll(r)).filter((e) => N(e, t)).sort((e, t) => M(t) - M(e))[0] || i || e;
|
|
190
|
+
}, F = (e) => ({
|
|
191
|
+
scale: e.scale,
|
|
192
|
+
label: e.label,
|
|
193
|
+
canZoomIn: e.canZoomIn,
|
|
194
|
+
canZoomOut: e.canZoomOut,
|
|
195
|
+
canReset: e.canReset,
|
|
196
|
+
minScale: e.minScale,
|
|
197
|
+
maxScale: e.maxScale
|
|
198
|
+
}), I = (e, t) => {
|
|
199
|
+
let r = n(t || {});
|
|
200
|
+
return e.scale = r.scale, e.label = r.label, e.canZoomIn = r.canZoomIn, e.canZoomOut = r.canZoomOut, e.canReset = r.canReset, e.minScale = r.minScale, e.maxScale = r.maxScale, e;
|
|
201
|
+
}, te = (e) => F(e);
|
|
202
|
+
(function() {
|
|
203
|
+
var e = t(function* (e, t) {
|
|
204
|
+
return I(e, yield t()), te(e);
|
|
205
|
+
});
|
|
206
|
+
return function(t, n) {
|
|
207
|
+
return e.apply(this, arguments);
|
|
208
|
+
};
|
|
209
|
+
})();
|
|
210
|
+
var L = () => {
|
|
211
|
+
let e = /* @__PURE__ */ new Set();
|
|
212
|
+
return {
|
|
213
|
+
emit() {
|
|
214
|
+
e.forEach((e) => e());
|
|
215
|
+
},
|
|
216
|
+
subscribe(t) {
|
|
217
|
+
return e.add(t), () => {
|
|
218
|
+
e.delete(t);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}, R = (e) => {
|
|
223
|
+
var t, n;
|
|
224
|
+
return ((n = (t = e == null ? void 0 : e.ownerDocument) == null ? void 0 : t.defaultView) == null ? void 0 : n.MutationObserver) || (typeof MutationObserver < "u" ? MutationObserver : void 0);
|
|
225
|
+
}, z = ({ root: e, enabled: r, beforeZoom: i, onChange: a }) => {
|
|
226
|
+
let o = null, s = null, c = null, l = !1, u = n(), d = () => {
|
|
227
|
+
a == null || a(F(u));
|
|
228
|
+
}, f = () => {
|
|
229
|
+
s == null || s(), s = null, o = null, I(u, null);
|
|
230
|
+
}, p = () => {
|
|
231
|
+
var t, n;
|
|
232
|
+
if ((r == null ? void 0 : r()) === !1) return f(), null;
|
|
233
|
+
let i = D(e());
|
|
234
|
+
return i !== o && (s == null || s(), o = i, s = ((t = i == null ? void 0 : i.subscribe) == null ? void 0 : t.call(i, () => {
|
|
235
|
+
I(u, i.getState()), l || d();
|
|
236
|
+
})) || null), I(u, ((n = i == null ? void 0 : i.getState) == null ? void 0 : n.call(i)) || null), i;
|
|
237
|
+
}, m = () => {
|
|
238
|
+
c == null || c.disconnect(), c = null;
|
|
239
|
+
}, h = function() {
|
|
240
|
+
var e = t(function* (e, t) {
|
|
241
|
+
let n = p();
|
|
242
|
+
if (!n || i && (yield i(e)) === !1) return F(u);
|
|
243
|
+
l = !0;
|
|
244
|
+
try {
|
|
245
|
+
return I(u, (yield t(n)) || n.getState()), F(u);
|
|
246
|
+
} finally {
|
|
247
|
+
l = !1;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
return function(t, n) {
|
|
251
|
+
return e.apply(this, arguments);
|
|
252
|
+
};
|
|
253
|
+
}();
|
|
254
|
+
return {
|
|
255
|
+
get provider() {
|
|
256
|
+
return o;
|
|
257
|
+
},
|
|
258
|
+
state: u,
|
|
259
|
+
hasProvider() {
|
|
260
|
+
return !!p();
|
|
261
|
+
},
|
|
262
|
+
refreshProvider: p,
|
|
263
|
+
observe() {
|
|
264
|
+
m();
|
|
265
|
+
let t = e(), n = R(t);
|
|
266
|
+
if (!t || !n) {
|
|
267
|
+
p();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
c = new n(() => {
|
|
271
|
+
p();
|
|
272
|
+
}), c.observe(t, {
|
|
273
|
+
childList: !0,
|
|
274
|
+
subtree: !0
|
|
275
|
+
}), p();
|
|
276
|
+
},
|
|
277
|
+
clearProvider: f,
|
|
278
|
+
getState() {
|
|
279
|
+
return F(u);
|
|
280
|
+
},
|
|
281
|
+
zoomIn: () => h("zoom-in", (e) => e.zoomIn()),
|
|
282
|
+
zoomOut: () => h("zoom-out", (e) => e.zoomOut()),
|
|
283
|
+
resetZoom: () => h("zoom-reset", (e) => e.resetZoom()),
|
|
284
|
+
destroy() {
|
|
285
|
+
m(), f();
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}, B = [
|
|
289
|
+
"auto",
|
|
290
|
+
"contain",
|
|
291
|
+
"cover",
|
|
292
|
+
"width",
|
|
293
|
+
"height",
|
|
294
|
+
"actual",
|
|
295
|
+
"scale-down"
|
|
296
|
+
], V = [
|
|
297
|
+
"until-interaction",
|
|
298
|
+
"always",
|
|
299
|
+
"initial"
|
|
300
|
+
], H = "until-interaction", U = 0, W = 8, G = (e) => !!e && typeof e == "object" && !Array.isArray(e), K = (e) => typeof e == "string" && B.includes(e), q = (e) => typeof e == "string" && V.includes(e), J = (e) => {
|
|
301
|
+
let t = Number(e);
|
|
302
|
+
return Number.isFinite(t) && t > 0 ? t : void 0;
|
|
303
|
+
}, Y = (e) => {
|
|
304
|
+
let t = Number(e);
|
|
305
|
+
return Number.isFinite(t) && t > 0 ? t : U;
|
|
306
|
+
}, X = (e) => {
|
|
307
|
+
if (e == null || e === !1) return null;
|
|
308
|
+
if (K(e)) return {
|
|
309
|
+
mode: e,
|
|
310
|
+
resize: H,
|
|
311
|
+
padding: U
|
|
312
|
+
};
|
|
313
|
+
if (!G(e)) return null;
|
|
314
|
+
let t = J(e.minScale), n = J(e.maxScale), r = t !== void 0 && n !== void 0 && n < t ? t : n;
|
|
315
|
+
return {
|
|
316
|
+
mode: K(e.mode) ? e.mode : "auto",
|
|
317
|
+
resize: q(e.resize) ? e.resize : H,
|
|
318
|
+
padding: Y(e.padding),
|
|
319
|
+
minScale: t,
|
|
320
|
+
maxScale: r
|
|
321
|
+
};
|
|
322
|
+
}, Z = (e, t, n) => {
|
|
323
|
+
let r = e;
|
|
324
|
+
return Number.isFinite(t) && (r = Math.max(Number(t), r)), Number.isFinite(n) && (r = Math.min(Number(n), r)), r;
|
|
325
|
+
}, ne = ({ mode: e, viewportWidth: t, viewportHeight: n, contentWidth: r, contentHeight: i, minScale: a, maxScale: o }) => {
|
|
326
|
+
if (t <= 0 || n <= 0 || r <= 0 || i <= 0) return;
|
|
327
|
+
let s = t / r, c = n / i, l = Math.min(s, c), u = Math.max(s, c), d = (() => {
|
|
328
|
+
switch (e) {
|
|
329
|
+
case "cover": return u;
|
|
330
|
+
case "width": return s;
|
|
331
|
+
case "height": return c;
|
|
332
|
+
case "actual": return 1;
|
|
333
|
+
case "scale-down": return Math.min(1, l);
|
|
334
|
+
default: return l;
|
|
335
|
+
}
|
|
336
|
+
})();
|
|
337
|
+
if (!(!Number.isFinite(d) || d <= 0)) return Z(d, a, o);
|
|
338
|
+
}, re = (e) => {
|
|
339
|
+
var t, n;
|
|
340
|
+
if (!e) return !1;
|
|
341
|
+
let r = Number((t = e.scale) == null ? (n = e.zoom) == null ? void 0 : n.scale : t);
|
|
342
|
+
if (Number.isFinite(r) && r > 0 || Number.isFinite(e.page) || Number.isFinite(e.rotation) || e.navigation && Object.keys(e.navigation).length > 0 || e.extra && Object.keys(e.extra).length > 0) return !0;
|
|
343
|
+
let i = e.scroll || {};
|
|
344
|
+
return [
|
|
345
|
+
"top",
|
|
346
|
+
"left",
|
|
347
|
+
"topRatio",
|
|
348
|
+
"leftRatio"
|
|
349
|
+
].some((e) => {
|
|
350
|
+
let t = i[e];
|
|
351
|
+
return Number.isFinite(t);
|
|
352
|
+
});
|
|
353
|
+
}, Q = (e, t, n = "viewer", r = "none") => ({
|
|
354
|
+
applied: !1,
|
|
355
|
+
mode: e.mode,
|
|
356
|
+
resize: e.resize,
|
|
357
|
+
source: n,
|
|
358
|
+
reason: t,
|
|
359
|
+
provider: r
|
|
360
|
+
}), $ = (e, t, n) => ({
|
|
361
|
+
applied: !!(e != null && e.applied),
|
|
362
|
+
mode: (e == null ? void 0 : e.mode) || t.mode,
|
|
363
|
+
resize: (e == null ? void 0 : e.resize) || t.resize,
|
|
364
|
+
scale: e == null ? void 0 : e.scale,
|
|
365
|
+
source: (e == null ? void 0 : e.source) || t.source,
|
|
366
|
+
reason: e == null ? void 0 : e.reason,
|
|
367
|
+
provider: (e == null ? void 0 : e.provider) || n,
|
|
368
|
+
state: e == null ? void 0 : e.state
|
|
369
|
+
}), ie = (e) => e === "pending" || e === "retry" || e === "image-not-ready" || e === "unmeasurable", ae = (e) => {
|
|
370
|
+
var t;
|
|
371
|
+
let n = (t = e.getBoundingClientRect) == null ? void 0 : t.call(e);
|
|
372
|
+
return {
|
|
373
|
+
width: Math.max(0, (n == null ? void 0 : n.width) || e.clientWidth || 0),
|
|
374
|
+
height: Math.max(0, (n == null ? void 0 : n.height) || e.clientHeight || 0)
|
|
375
|
+
};
|
|
376
|
+
}, oe = ({ root: n, enabled: r, getFit: i = () => void 0, onFit: a }) => {
|
|
377
|
+
let o = null, s = null, c = null, l = !1, u = 0, d = () => {
|
|
378
|
+
var e;
|
|
379
|
+
let t = n();
|
|
380
|
+
return ((e = t == null ? void 0 : t.ownerDocument) == null ? void 0 : e.defaultView) || (typeof window < "u" ? window : void 0);
|
|
381
|
+
}, f = () => {
|
|
382
|
+
if (s === null) return;
|
|
383
|
+
let e = d();
|
|
384
|
+
e != null && e.cancelAnimationFrame && e.cancelAnimationFrame(s), s = null;
|
|
385
|
+
}, p = () => {
|
|
386
|
+
c && clearTimeout(c), c = null;
|
|
387
|
+
}, m = (e, t) => {
|
|
388
|
+
let n = e === void 0 ? i() : e;
|
|
389
|
+
return n == null ? t === "api" ? X("auto") : null : X(n);
|
|
390
|
+
}, h = (e, t, n) => {
|
|
391
|
+
u >= W || (p(), u += 1, c = setTimeout(() => {
|
|
392
|
+
c = null, g(e, {
|
|
393
|
+
source: t,
|
|
394
|
+
reason: n === "api" ? "api" : "retry"
|
|
395
|
+
});
|
|
396
|
+
}, 32 * u));
|
|
397
|
+
}, g = function() {
|
|
398
|
+
var i = t(function* (t, i = {}) {
|
|
399
|
+
let o = i.source || "api", s = i.reason || "api", c = m(t, s);
|
|
400
|
+
if (!c) return {
|
|
401
|
+
applied: !1,
|
|
402
|
+
mode: "auto",
|
|
403
|
+
resize: H,
|
|
404
|
+
source: o,
|
|
405
|
+
reason: "not-configured",
|
|
406
|
+
provider: "none"
|
|
407
|
+
};
|
|
408
|
+
if ((r == null ? void 0 : r()) === !1) return Q(c, "disabled", o);
|
|
409
|
+
let l = n();
|
|
410
|
+
if (!l) return h(t, o, s), Q(c, "no-root", o);
|
|
411
|
+
let d = ae(l);
|
|
412
|
+
if (d.width <= 0 || d.height <= 0) return h(t, o, s), Q(c, "zero-size", o);
|
|
413
|
+
let f = e(e({}, c), {}, {
|
|
414
|
+
source: o,
|
|
415
|
+
reason: s,
|
|
416
|
+
viewportWidth: Math.max(0, d.width - c.padding * 2),
|
|
417
|
+
viewportHeight: Math.max(0, d.height - c.padding * 2),
|
|
418
|
+
container: l
|
|
419
|
+
}), p = A(l), g = null;
|
|
420
|
+
if (p != null && p.fit) {
|
|
421
|
+
let e = $(yield p.fit(f), f, "view-state");
|
|
422
|
+
if (e.applied) return u = 0, a == null || a(e), e;
|
|
423
|
+
g = e;
|
|
424
|
+
}
|
|
425
|
+
let _ = D(l);
|
|
426
|
+
if (_ != null && _.fit) {
|
|
427
|
+
let e = $(yield _.fit(f), f, "zoom");
|
|
428
|
+
if (e.applied) return u = 0, a == null || a(e), e;
|
|
429
|
+
g = e;
|
|
430
|
+
}
|
|
431
|
+
let v = Q(c, p || _ ? "unsupported" : "no-provider", o);
|
|
432
|
+
return (v.reason === "no-provider" || ie(g == null ? void 0 : g.reason)) && h(t, o, s), v;
|
|
433
|
+
});
|
|
434
|
+
return function(e) {
|
|
435
|
+
return i.apply(this, arguments);
|
|
436
|
+
};
|
|
437
|
+
}(), _ = (e = "resize") => {
|
|
438
|
+
let t = X(i());
|
|
439
|
+
if (!t || t.resize === "initial" || t.resize === "until-interaction" && l) return;
|
|
440
|
+
f();
|
|
441
|
+
let n = d(), r = () => {
|
|
442
|
+
s = null, g(void 0, {
|
|
443
|
+
source: "viewer",
|
|
444
|
+
reason: e
|
|
445
|
+
});
|
|
446
|
+
};
|
|
447
|
+
if (n != null && n.requestAnimationFrame) {
|
|
448
|
+
s = n.requestAnimationFrame(r);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
s = setTimeout(r, 16);
|
|
452
|
+
}, v = () => {
|
|
453
|
+
f(), o == null || o.disconnect(), o = null;
|
|
454
|
+
};
|
|
455
|
+
return {
|
|
456
|
+
normalize: X,
|
|
457
|
+
fit: function() {
|
|
458
|
+
var e = t(function* (e, t) {
|
|
459
|
+
return p(), l = !1, g(e, {
|
|
460
|
+
source: (t == null ? void 0 : t.source) || "api",
|
|
461
|
+
reason: (t == null ? void 0 : t.reason) || "api"
|
|
462
|
+
});
|
|
463
|
+
});
|
|
464
|
+
return function(t, n) {
|
|
465
|
+
return e.apply(this, arguments);
|
|
466
|
+
};
|
|
467
|
+
}(),
|
|
468
|
+
applyInitialFit: function() {
|
|
469
|
+
var e = t(function* (e = {}) {
|
|
470
|
+
return p(), u = 0, l = !1, e.skip ? Q(X(i()) || X("auto"), "initial-view-state", "initial") : g(void 0, {
|
|
471
|
+
source: "initial",
|
|
472
|
+
reason: "initial"
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
return function() {
|
|
476
|
+
return e.apply(this, arguments);
|
|
477
|
+
};
|
|
478
|
+
}(),
|
|
479
|
+
scheduleFit: _,
|
|
480
|
+
observe() {
|
|
481
|
+
var e, t;
|
|
482
|
+
v();
|
|
483
|
+
let r = n(), i = ((t = (e = r == null ? void 0 : r.ownerDocument) == null ? void 0 : e.defaultView) == null ? void 0 : t.ResizeObserver) || (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
|
|
484
|
+
!r || !i || (o = new i(() => _("resize")), o.observe(r));
|
|
485
|
+
},
|
|
486
|
+
markUserInteraction() {
|
|
487
|
+
l = !0, p();
|
|
488
|
+
},
|
|
489
|
+
resetAutoFit() {
|
|
490
|
+
l = !1, u = 0;
|
|
491
|
+
},
|
|
492
|
+
destroy() {
|
|
493
|
+
v(), p(), u = 0;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
};
|
|
497
|
+
//#endregion
|
|
498
|
+
export { ee as _, z as a, r as b, A as c, T as d, k as f, v as g, _ as h, L as i, D as l, g as m, re as n, P as o, E as p, ne as r, w as s, oe as t, O as u, o as v, i as y };
|