pdf_viewer.js 347 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2021 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * Javascript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/web/pdf_viewer", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/web/pdf_viewer"] = factory();
  29. else
  30. root["pdfjs-dist/web/pdf_viewer"] = root.pdfjsViewer = factory();
  31. })(this, function() {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */,
  36. /* 1 */
  37. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0;
  42. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  43. var _pdfjsLib = __w_pdfjs_require__(4);
  44. var _l10n_utils = __w_pdfjs_require__(5);
  45. var _pdf_link_service = __w_pdfjs_require__(6);
  46. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  47. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  48. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  49. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  50. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  51. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  52. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  53. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  54. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  55. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  56. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  57. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  58. var AnnotationLayerBuilder = /*#__PURE__*/function () {
  59. function AnnotationLayerBuilder(_ref) {
  60. var pageDiv = _ref.pageDiv,
  61. pdfPage = _ref.pdfPage,
  62. linkService = _ref.linkService,
  63. downloadManager = _ref.downloadManager,
  64. _ref$annotationStorag = _ref.annotationStorage,
  65. annotationStorage = _ref$annotationStorag === void 0 ? null : _ref$annotationStorag,
  66. _ref$imageResourcesPa = _ref.imageResourcesPath,
  67. imageResourcesPath = _ref$imageResourcesPa === void 0 ? "" : _ref$imageResourcesPa,
  68. _ref$renderForms = _ref.renderForms,
  69. renderForms = _ref$renderForms === void 0 ? true : _ref$renderForms,
  70. _ref$l10n = _ref.l10n,
  71. l10n = _ref$l10n === void 0 ? _l10n_utils.NullL10n : _ref$l10n,
  72. _ref$enableScripting = _ref.enableScripting,
  73. enableScripting = _ref$enableScripting === void 0 ? false : _ref$enableScripting,
  74. _ref$hasJSActionsProm = _ref.hasJSActionsPromise,
  75. hasJSActionsPromise = _ref$hasJSActionsProm === void 0 ? null : _ref$hasJSActionsProm,
  76. _ref$fieldObjectsProm = _ref.fieldObjectsPromise,
  77. fieldObjectsPromise = _ref$fieldObjectsProm === void 0 ? null : _ref$fieldObjectsProm,
  78. _ref$mouseState = _ref.mouseState,
  79. mouseState = _ref$mouseState === void 0 ? null : _ref$mouseState;
  80. _classCallCheck(this, AnnotationLayerBuilder);
  81. this.pageDiv = pageDiv;
  82. this.pdfPage = pdfPage;
  83. this.linkService = linkService;
  84. this.downloadManager = downloadManager;
  85. this.imageResourcesPath = imageResourcesPath;
  86. this.renderForms = renderForms;
  87. this.l10n = l10n;
  88. this.annotationStorage = annotationStorage;
  89. this.enableScripting = enableScripting;
  90. this._hasJSActionsPromise = hasJSActionsPromise;
  91. this._fieldObjectsPromise = fieldObjectsPromise;
  92. this._mouseState = mouseState;
  93. this.div = null;
  94. this._cancelled = false;
  95. }
  96. _createClass(AnnotationLayerBuilder, [{
  97. key: "render",
  98. value: function () {
  99. var _render = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(viewport) {
  100. var intent,
  101. _yield$Promise$all,
  102. _yield$Promise$all2,
  103. annotations,
  104. _yield$Promise$all2$,
  105. hasJSActions,
  106. _yield$Promise$all2$2,
  107. fieldObjects,
  108. parameters,
  109. _args = arguments;
  110. return _regenerator["default"].wrap(function _callee$(_context) {
  111. while (1) {
  112. switch (_context.prev = _context.next) {
  113. case 0:
  114. intent = _args.length > 1 && _args[1] !== undefined ? _args[1] : "display";
  115. _context.next = 3;
  116. return Promise.all([this.pdfPage.getAnnotations({
  117. intent: intent
  118. }), this._hasJSActionsPromise, this._fieldObjectsPromise]);
  119. case 3:
  120. _yield$Promise$all = _context.sent;
  121. _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
  122. annotations = _yield$Promise$all2[0];
  123. _yield$Promise$all2$ = _yield$Promise$all2[1];
  124. hasJSActions = _yield$Promise$all2$ === void 0 ? false : _yield$Promise$all2$;
  125. _yield$Promise$all2$2 = _yield$Promise$all2[2];
  126. fieldObjects = _yield$Promise$all2$2 === void 0 ? null : _yield$Promise$all2$2;
  127. if (!(this._cancelled || annotations.length === 0)) {
  128. _context.next = 12;
  129. break;
  130. }
  131. return _context.abrupt("return");
  132. case 12:
  133. parameters = {
  134. viewport: viewport.clone({
  135. dontFlip: true
  136. }),
  137. div: this.div,
  138. annotations: annotations,
  139. page: this.pdfPage,
  140. imageResourcesPath: this.imageResourcesPath,
  141. renderForms: this.renderForms,
  142. linkService: this.linkService,
  143. downloadManager: this.downloadManager,
  144. annotationStorage: this.annotationStorage,
  145. enableScripting: this.enableScripting,
  146. hasJSActions: hasJSActions,
  147. fieldObjects: fieldObjects,
  148. mouseState: this._mouseState
  149. };
  150. if (this.div) {
  151. _pdfjsLib.AnnotationLayer.update(parameters);
  152. } else {
  153. this.div = document.createElement("div");
  154. this.div.className = "annotationLayer";
  155. this.pageDiv.appendChild(this.div);
  156. parameters.div = this.div;
  157. _pdfjsLib.AnnotationLayer.render(parameters);
  158. this.l10n.translate(this.div);
  159. }
  160. case 14:
  161. case "end":
  162. return _context.stop();
  163. }
  164. }
  165. }, _callee, this);
  166. }));
  167. function render(_x) {
  168. return _render.apply(this, arguments);
  169. }
  170. return render;
  171. }()
  172. }, {
  173. key: "cancel",
  174. value: function cancel() {
  175. this._cancelled = true;
  176. }
  177. }, {
  178. key: "hide",
  179. value: function hide() {
  180. if (!this.div) {
  181. return;
  182. }
  183. this.div.hidden = true;
  184. }
  185. }]);
  186. return AnnotationLayerBuilder;
  187. }();
  188. exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
  189. var DefaultAnnotationLayerFactory = /*#__PURE__*/function () {
  190. function DefaultAnnotationLayerFactory() {
  191. _classCallCheck(this, DefaultAnnotationLayerFactory);
  192. }
  193. _createClass(DefaultAnnotationLayerFactory, [{
  194. key: "createAnnotationLayerBuilder",
  195. value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
  196. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  197. var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
  198. var renderForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  199. var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _l10n_utils.NullL10n;
  200. var enableScripting = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  201. var hasJSActionsPromise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  202. var mouseState = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
  203. var fieldObjectsPromise = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
  204. return new AnnotationLayerBuilder({
  205. pageDiv: pageDiv,
  206. pdfPage: pdfPage,
  207. imageResourcesPath: imageResourcesPath,
  208. renderForms: renderForms,
  209. linkService: new _pdf_link_service.SimpleLinkService(),
  210. l10n: l10n,
  211. annotationStorage: annotationStorage,
  212. enableScripting: enableScripting,
  213. hasJSActionsPromise: hasJSActionsPromise,
  214. fieldObjectsPromise: fieldObjectsPromise,
  215. mouseState: mouseState
  216. });
  217. }
  218. }]);
  219. return DefaultAnnotationLayerFactory;
  220. }();
  221. exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
  222. /***/ }),
  223. /* 2 */
  224. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  225. module.exports = __w_pdfjs_require__(3);
  226. /***/ }),
  227. /* 3 */
  228. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  229. /* module decorator */ module = __w_pdfjs_require__.nmd(module);
  230. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  231. var runtime = function (exports) {
  232. "use strict";
  233. var Op = Object.prototype;
  234. var hasOwn = Op.hasOwnProperty;
  235. var undefined;
  236. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  237. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  238. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  239. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  240. function define(obj, key, value) {
  241. Object.defineProperty(obj, key, {
  242. value: value,
  243. enumerable: true,
  244. configurable: true,
  245. writable: true
  246. });
  247. return obj[key];
  248. }
  249. try {
  250. define({}, "");
  251. } catch (err) {
  252. define = function define(obj, key, value) {
  253. return obj[key] = value;
  254. };
  255. }
  256. function wrap(innerFn, outerFn, self, tryLocsList) {
  257. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  258. var generator = Object.create(protoGenerator.prototype);
  259. var context = new Context(tryLocsList || []);
  260. generator._invoke = makeInvokeMethod(innerFn, self, context);
  261. return generator;
  262. }
  263. exports.wrap = wrap;
  264. function tryCatch(fn, obj, arg) {
  265. try {
  266. return {
  267. type: "normal",
  268. arg: fn.call(obj, arg)
  269. };
  270. } catch (err) {
  271. return {
  272. type: "throw",
  273. arg: err
  274. };
  275. }
  276. }
  277. var GenStateSuspendedStart = "suspendedStart";
  278. var GenStateSuspendedYield = "suspendedYield";
  279. var GenStateExecuting = "executing";
  280. var GenStateCompleted = "completed";
  281. var ContinueSentinel = {};
  282. function Generator() {}
  283. function GeneratorFunction() {}
  284. function GeneratorFunctionPrototype() {}
  285. var IteratorPrototype = {};
  286. define(IteratorPrototype, iteratorSymbol, function () {
  287. return this;
  288. });
  289. var getProto = Object.getPrototypeOf;
  290. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  291. if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  292. IteratorPrototype = NativeIteratorPrototype;
  293. }
  294. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  295. GeneratorFunction.prototype = GeneratorFunctionPrototype;
  296. define(Gp, "constructor", GeneratorFunctionPrototype);
  297. define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  298. GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
  299. function defineIteratorMethods(prototype) {
  300. ["next", "throw", "return"].forEach(function (method) {
  301. define(prototype, method, function (arg) {
  302. return this._invoke(method, arg);
  303. });
  304. });
  305. }
  306. exports.isGeneratorFunction = function (genFun) {
  307. var ctor = typeof genFun === "function" && genFun.constructor;
  308. return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  309. };
  310. exports.mark = function (genFun) {
  311. if (Object.setPrototypeOf) {
  312. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  313. } else {
  314. genFun.__proto__ = GeneratorFunctionPrototype;
  315. define(genFun, toStringTagSymbol, "GeneratorFunction");
  316. }
  317. genFun.prototype = Object.create(Gp);
  318. return genFun;
  319. };
  320. exports.awrap = function (arg) {
  321. return {
  322. __await: arg
  323. };
  324. };
  325. function AsyncIterator(generator, PromiseImpl) {
  326. function invoke(method, arg, resolve, reject) {
  327. var record = tryCatch(generator[method], generator, arg);
  328. if (record.type === "throw") {
  329. reject(record.arg);
  330. } else {
  331. var result = record.arg;
  332. var value = result.value;
  333. if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
  334. return PromiseImpl.resolve(value.__await).then(function (value) {
  335. invoke("next", value, resolve, reject);
  336. }, function (err) {
  337. invoke("throw", err, resolve, reject);
  338. });
  339. }
  340. return PromiseImpl.resolve(value).then(function (unwrapped) {
  341. result.value = unwrapped;
  342. resolve(result);
  343. }, function (error) {
  344. return invoke("throw", error, resolve, reject);
  345. });
  346. }
  347. }
  348. var previousPromise;
  349. function enqueue(method, arg) {
  350. function callInvokeWithMethodAndArg() {
  351. return new PromiseImpl(function (resolve, reject) {
  352. invoke(method, arg, resolve, reject);
  353. });
  354. }
  355. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  356. }
  357. this._invoke = enqueue;
  358. }
  359. defineIteratorMethods(AsyncIterator.prototype);
  360. define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  361. return this;
  362. });
  363. exports.AsyncIterator = AsyncIterator;
  364. exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  365. if (PromiseImpl === void 0) PromiseImpl = Promise;
  366. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  367. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  368. return result.done ? result.value : iter.next();
  369. });
  370. };
  371. function makeInvokeMethod(innerFn, self, context) {
  372. var state = GenStateSuspendedStart;
  373. return function invoke(method, arg) {
  374. if (state === GenStateExecuting) {
  375. throw new Error("Generator is already running");
  376. }
  377. if (state === GenStateCompleted) {
  378. if (method === "throw") {
  379. throw arg;
  380. }
  381. return doneResult();
  382. }
  383. context.method = method;
  384. context.arg = arg;
  385. while (true) {
  386. var delegate = context.delegate;
  387. if (delegate) {
  388. var delegateResult = maybeInvokeDelegate(delegate, context);
  389. if (delegateResult) {
  390. if (delegateResult === ContinueSentinel) continue;
  391. return delegateResult;
  392. }
  393. }
  394. if (context.method === "next") {
  395. context.sent = context._sent = context.arg;
  396. } else if (context.method === "throw") {
  397. if (state === GenStateSuspendedStart) {
  398. state = GenStateCompleted;
  399. throw context.arg;
  400. }
  401. context.dispatchException(context.arg);
  402. } else if (context.method === "return") {
  403. context.abrupt("return", context.arg);
  404. }
  405. state = GenStateExecuting;
  406. var record = tryCatch(innerFn, self, context);
  407. if (record.type === "normal") {
  408. state = context.done ? GenStateCompleted : GenStateSuspendedYield;
  409. if (record.arg === ContinueSentinel) {
  410. continue;
  411. }
  412. return {
  413. value: record.arg,
  414. done: context.done
  415. };
  416. } else if (record.type === "throw") {
  417. state = GenStateCompleted;
  418. context.method = "throw";
  419. context.arg = record.arg;
  420. }
  421. }
  422. };
  423. }
  424. function maybeInvokeDelegate(delegate, context) {
  425. var method = delegate.iterator[context.method];
  426. if (method === undefined) {
  427. context.delegate = null;
  428. if (context.method === "throw") {
  429. if (delegate.iterator["return"]) {
  430. context.method = "return";
  431. context.arg = undefined;
  432. maybeInvokeDelegate(delegate, context);
  433. if (context.method === "throw") {
  434. return ContinueSentinel;
  435. }
  436. }
  437. context.method = "throw";
  438. context.arg = new TypeError("The iterator does not provide a 'throw' method");
  439. }
  440. return ContinueSentinel;
  441. }
  442. var record = tryCatch(method, delegate.iterator, context.arg);
  443. if (record.type === "throw") {
  444. context.method = "throw";
  445. context.arg = record.arg;
  446. context.delegate = null;
  447. return ContinueSentinel;
  448. }
  449. var info = record.arg;
  450. if (!info) {
  451. context.method = "throw";
  452. context.arg = new TypeError("iterator result is not an object");
  453. context.delegate = null;
  454. return ContinueSentinel;
  455. }
  456. if (info.done) {
  457. context[delegate.resultName] = info.value;
  458. context.next = delegate.nextLoc;
  459. if (context.method !== "return") {
  460. context.method = "next";
  461. context.arg = undefined;
  462. }
  463. } else {
  464. return info;
  465. }
  466. context.delegate = null;
  467. return ContinueSentinel;
  468. }
  469. defineIteratorMethods(Gp);
  470. define(Gp, toStringTagSymbol, "Generator");
  471. define(Gp, iteratorSymbol, function () {
  472. return this;
  473. });
  474. define(Gp, "toString", function () {
  475. return "[object Generator]";
  476. });
  477. function pushTryEntry(locs) {
  478. var entry = {
  479. tryLoc: locs[0]
  480. };
  481. if (1 in locs) {
  482. entry.catchLoc = locs[1];
  483. }
  484. if (2 in locs) {
  485. entry.finallyLoc = locs[2];
  486. entry.afterLoc = locs[3];
  487. }
  488. this.tryEntries.push(entry);
  489. }
  490. function resetTryEntry(entry) {
  491. var record = entry.completion || {};
  492. record.type = "normal";
  493. delete record.arg;
  494. entry.completion = record;
  495. }
  496. function Context(tryLocsList) {
  497. this.tryEntries = [{
  498. tryLoc: "root"
  499. }];
  500. tryLocsList.forEach(pushTryEntry, this);
  501. this.reset(true);
  502. }
  503. exports.keys = function (object) {
  504. var keys = [];
  505. for (var key in object) {
  506. keys.push(key);
  507. }
  508. keys.reverse();
  509. return function next() {
  510. while (keys.length) {
  511. var key = keys.pop();
  512. if (key in object) {
  513. next.value = key;
  514. next.done = false;
  515. return next;
  516. }
  517. }
  518. next.done = true;
  519. return next;
  520. };
  521. };
  522. function values(iterable) {
  523. if (iterable) {
  524. var iteratorMethod = iterable[iteratorSymbol];
  525. if (iteratorMethod) {
  526. return iteratorMethod.call(iterable);
  527. }
  528. if (typeof iterable.next === "function") {
  529. return iterable;
  530. }
  531. if (!isNaN(iterable.length)) {
  532. var i = -1,
  533. next = function next() {
  534. while (++i < iterable.length) {
  535. if (hasOwn.call(iterable, i)) {
  536. next.value = iterable[i];
  537. next.done = false;
  538. return next;
  539. }
  540. }
  541. next.value = undefined;
  542. next.done = true;
  543. return next;
  544. };
  545. return next.next = next;
  546. }
  547. }
  548. return {
  549. next: doneResult
  550. };
  551. }
  552. exports.values = values;
  553. function doneResult() {
  554. return {
  555. value: undefined,
  556. done: true
  557. };
  558. }
  559. Context.prototype = {
  560. constructor: Context,
  561. reset: function reset(skipTempReset) {
  562. this.prev = 0;
  563. this.next = 0;
  564. this.sent = this._sent = undefined;
  565. this.done = false;
  566. this.delegate = null;
  567. this.method = "next";
  568. this.arg = undefined;
  569. this.tryEntries.forEach(resetTryEntry);
  570. if (!skipTempReset) {
  571. for (var name in this) {
  572. if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
  573. this[name] = undefined;
  574. }
  575. }
  576. }
  577. },
  578. stop: function stop() {
  579. this.done = true;
  580. var rootEntry = this.tryEntries[0];
  581. var rootRecord = rootEntry.completion;
  582. if (rootRecord.type === "throw") {
  583. throw rootRecord.arg;
  584. }
  585. return this.rval;
  586. },
  587. dispatchException: function dispatchException(exception) {
  588. if (this.done) {
  589. throw exception;
  590. }
  591. var context = this;
  592. function handle(loc, caught) {
  593. record.type = "throw";
  594. record.arg = exception;
  595. context.next = loc;
  596. if (caught) {
  597. context.method = "next";
  598. context.arg = undefined;
  599. }
  600. return !!caught;
  601. }
  602. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  603. var entry = this.tryEntries[i];
  604. var record = entry.completion;
  605. if (entry.tryLoc === "root") {
  606. return handle("end");
  607. }
  608. if (entry.tryLoc <= this.prev) {
  609. var hasCatch = hasOwn.call(entry, "catchLoc");
  610. var hasFinally = hasOwn.call(entry, "finallyLoc");
  611. if (hasCatch && hasFinally) {
  612. if (this.prev < entry.catchLoc) {
  613. return handle(entry.catchLoc, true);
  614. } else if (this.prev < entry.finallyLoc) {
  615. return handle(entry.finallyLoc);
  616. }
  617. } else if (hasCatch) {
  618. if (this.prev < entry.catchLoc) {
  619. return handle(entry.catchLoc, true);
  620. }
  621. } else if (hasFinally) {
  622. if (this.prev < entry.finallyLoc) {
  623. return handle(entry.finallyLoc);
  624. }
  625. } else {
  626. throw new Error("try statement without catch or finally");
  627. }
  628. }
  629. }
  630. },
  631. abrupt: function abrupt(type, arg) {
  632. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  633. var entry = this.tryEntries[i];
  634. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  635. var finallyEntry = entry;
  636. break;
  637. }
  638. }
  639. if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
  640. finallyEntry = null;
  641. }
  642. var record = finallyEntry ? finallyEntry.completion : {};
  643. record.type = type;
  644. record.arg = arg;
  645. if (finallyEntry) {
  646. this.method = "next";
  647. this.next = finallyEntry.finallyLoc;
  648. return ContinueSentinel;
  649. }
  650. return this.complete(record);
  651. },
  652. complete: function complete(record, afterLoc) {
  653. if (record.type === "throw") {
  654. throw record.arg;
  655. }
  656. if (record.type === "break" || record.type === "continue") {
  657. this.next = record.arg;
  658. } else if (record.type === "return") {
  659. this.rval = this.arg = record.arg;
  660. this.method = "return";
  661. this.next = "end";
  662. } else if (record.type === "normal" && afterLoc) {
  663. this.next = afterLoc;
  664. }
  665. return ContinueSentinel;
  666. },
  667. finish: function finish(finallyLoc) {
  668. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  669. var entry = this.tryEntries[i];
  670. if (entry.finallyLoc === finallyLoc) {
  671. this.complete(entry.completion, entry.afterLoc);
  672. resetTryEntry(entry);
  673. return ContinueSentinel;
  674. }
  675. }
  676. },
  677. "catch": function _catch(tryLoc) {
  678. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  679. var entry = this.tryEntries[i];
  680. if (entry.tryLoc === tryLoc) {
  681. var record = entry.completion;
  682. if (record.type === "throw") {
  683. var thrown = record.arg;
  684. resetTryEntry(entry);
  685. }
  686. return thrown;
  687. }
  688. }
  689. throw new Error("illegal catch attempt");
  690. },
  691. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  692. this.delegate = {
  693. iterator: values(iterable),
  694. resultName: resultName,
  695. nextLoc: nextLoc
  696. };
  697. if (this.method === "next") {
  698. this.arg = undefined;
  699. }
  700. return ContinueSentinel;
  701. }
  702. };
  703. return exports;
  704. }(( false ? 0 : _typeof(module)) === "object" ? module.exports : {});
  705. try {
  706. regeneratorRuntime = runtime;
  707. } catch (accidentalStrictMode) {
  708. if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
  709. globalThis.regeneratorRuntime = runtime;
  710. } else {
  711. Function("r", "regeneratorRuntime = r")(runtime);
  712. }
  713. }
  714. /***/ }),
  715. /* 4 */
  716. /***/ ((module) => {
  717. var pdfjsLib;
  718. if (typeof window !== "undefined" && window["pdfjs-dist/build/pdf"]) {
  719. pdfjsLib = window["pdfjs-dist/build/pdf"];
  720. } else {
  721. pdfjsLib = require("../build/pdf.js");
  722. }
  723. module.exports = pdfjsLib;
  724. /***/ }),
  725. /* 5 */
  726. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  727. Object.defineProperty(exports, "__esModule", ({
  728. value: true
  729. }));
  730. exports.fixupLangCode = fixupLangCode;
  731. exports.getL10nFallback = getL10nFallback;
  732. exports.NullL10n = void 0;
  733. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  734. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  735. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  736. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  737. var DEFAULT_L10N_STRINGS = {
  738. of_pages: "of {{pagesCount}}",
  739. page_of_pages: "({{pageNumber}} of {{pagesCount}})",
  740. document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
  741. document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
  742. document_properties_date_string: "{{date}}, {{time}}",
  743. document_properties_page_size_unit_inches: "in",
  744. document_properties_page_size_unit_millimeters: "mm",
  745. document_properties_page_size_orientation_portrait: "portrait",
  746. document_properties_page_size_orientation_landscape: "landscape",
  747. document_properties_page_size_name_a3: "A3",
  748. document_properties_page_size_name_a4: "A4",
  749. document_properties_page_size_name_letter: "Letter",
  750. document_properties_page_size_name_legal: "Legal",
  751. document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
  752. document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
  753. document_properties_linearized_yes: "Yes",
  754. document_properties_linearized_no: "No",
  755. print_progress_percent: "{{progress}}%",
  756. "toggle_sidebar.title": "Toggle Sidebar",
  757. "toggle_sidebar_notification2.title": "Toggle Sidebar (document contains outline/attachments/layers)",
  758. additional_layers: "Additional Layers",
  759. page_landmark: "Page {{page}}",
  760. thumb_page_title: "Page {{page}}",
  761. thumb_page_canvas: "Thumbnail of Page {{page}}",
  762. find_reached_top: "Reached top of document, continued from bottom",
  763. find_reached_bottom: "Reached end of document, continued from top",
  764. "find_match_count[one]": "{{current}} of {{total}} match",
  765. "find_match_count[other]": "{{current}} of {{total}} matches",
  766. "find_match_count_limit[one]": "More than {{limit}} match",
  767. "find_match_count_limit[other]": "More than {{limit}} matches",
  768. find_not_found: "Phrase not found",
  769. error_version_info: "PDF.js v{{version}} (build: {{build}})",
  770. error_message: "Message: {{message}}",
  771. error_stack: "Stack: {{stack}}",
  772. error_file: "File: {{file}}",
  773. error_line: "Line: {{line}}",
  774. rendering_error: "An error occurred while rendering the page.",
  775. page_scale_width: "Page Width",
  776. page_scale_fit: "Page Fit",
  777. page_scale_auto: "Automatic Zoom",
  778. page_scale_actual: "Actual Size",
  779. page_scale_percent: "{{scale}}%",
  780. loading: "Loading…",
  781. loading_error: "An error occurred while loading the PDF.",
  782. invalid_file_error: "Invalid or corrupted PDF file.",
  783. missing_file_error: "Missing PDF file.",
  784. unexpected_response_error: "Unexpected server response.",
  785. printing_not_supported: "Warning: Printing is not fully supported by this browser.",
  786. printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
  787. web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts."
  788. };
  789. function getL10nFallback(key, args) {
  790. switch (key) {
  791. case "find_match_count":
  792. key = "find_match_count[".concat(args.total === 1 ? "one" : "other", "]");
  793. break;
  794. case "find_match_count_limit":
  795. key = "find_match_count_limit[".concat(args.limit === 1 ? "one" : "other", "]");
  796. break;
  797. }
  798. return DEFAULT_L10N_STRINGS[key] || "";
  799. }
  800. var PARTIAL_LANG_CODES = {
  801. en: "en-US",
  802. es: "es-ES",
  803. fy: "fy-NL",
  804. ga: "ga-IE",
  805. gu: "gu-IN",
  806. hi: "hi-IN",
  807. hy: "hy-AM",
  808. nb: "nb-NO",
  809. ne: "ne-NP",
  810. nn: "nn-NO",
  811. pa: "pa-IN",
  812. pt: "pt-PT",
  813. sv: "sv-SE",
  814. zh: "zh-CN"
  815. };
  816. function fixupLangCode(langCode) {
  817. return PARTIAL_LANG_CODES[langCode === null || langCode === void 0 ? void 0 : langCode.toLowerCase()] || langCode;
  818. }
  819. function formatL10nValue(text, args) {
  820. if (!args) {
  821. return text;
  822. }
  823. return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function (all, name) {
  824. return name in args ? args[name] : "{{" + name + "}}";
  825. });
  826. }
  827. var NullL10n = {
  828. getLanguage: function getLanguage() {
  829. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  830. return _regenerator["default"].wrap(function _callee$(_context) {
  831. while (1) {
  832. switch (_context.prev = _context.next) {
  833. case 0:
  834. return _context.abrupt("return", "en-us");
  835. case 1:
  836. case "end":
  837. return _context.stop();
  838. }
  839. }
  840. }, _callee);
  841. }))();
  842. },
  843. getDirection: function getDirection() {
  844. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  845. return _regenerator["default"].wrap(function _callee2$(_context2) {
  846. while (1) {
  847. switch (_context2.prev = _context2.next) {
  848. case 0:
  849. return _context2.abrupt("return", "ltr");
  850. case 1:
  851. case "end":
  852. return _context2.stop();
  853. }
  854. }
  855. }, _callee2);
  856. }))();
  857. },
  858. get: function get(key) {
  859. var _arguments = arguments;
  860. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  861. var args, fallback;
  862. return _regenerator["default"].wrap(function _callee3$(_context3) {
  863. while (1) {
  864. switch (_context3.prev = _context3.next) {
  865. case 0:
  866. args = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : null;
  867. fallback = _arguments.length > 2 && _arguments[2] !== undefined ? _arguments[2] : getL10nFallback(key, args);
  868. return _context3.abrupt("return", formatL10nValue(fallback, args));
  869. case 3:
  870. case "end":
  871. return _context3.stop();
  872. }
  873. }
  874. }, _callee3);
  875. }))();
  876. },
  877. translate: function translate(element) {
  878. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  879. return _regenerator["default"].wrap(function _callee4$(_context4) {
  880. while (1) {
  881. switch (_context4.prev = _context4.next) {
  882. case 0:
  883. case "end":
  884. return _context4.stop();
  885. }
  886. }
  887. }, _callee4);
  888. }))();
  889. }
  890. };
  891. exports.NullL10n = NullL10n;
  892. /***/ }),
  893. /* 6 */
  894. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  895. Object.defineProperty(exports, "__esModule", ({
  896. value: true
  897. }));
  898. exports.SimpleLinkService = exports.PDFLinkService = void 0;
  899. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  900. var _pdfjsLib = __w_pdfjs_require__(4);
  901. var _ui_utils = __w_pdfjs_require__(7);
  902. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  903. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  904. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  905. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  906. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  907. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  908. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  909. var PDFLinkService = /*#__PURE__*/function () {
  910. function PDFLinkService() {
  911. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  912. eventBus = _ref.eventBus,
  913. _ref$externalLinkTarg = _ref.externalLinkTarget,
  914. externalLinkTarget = _ref$externalLinkTarg === void 0 ? null : _ref$externalLinkTarg,
  915. _ref$externalLinkRel = _ref.externalLinkRel,
  916. externalLinkRel = _ref$externalLinkRel === void 0 ? null : _ref$externalLinkRel,
  917. _ref$ignoreDestinatio = _ref.ignoreDestinationZoom,
  918. ignoreDestinationZoom = _ref$ignoreDestinatio === void 0 ? false : _ref$ignoreDestinatio;
  919. _classCallCheck(this, PDFLinkService);
  920. this.eventBus = eventBus;
  921. this.externalLinkTarget = externalLinkTarget;
  922. this.externalLinkRel = externalLinkRel;
  923. this.externalLinkEnabled = true;
  924. this._ignoreDestinationZoom = ignoreDestinationZoom;
  925. this.baseUrl = null;
  926. this.pdfDocument = null;
  927. this.pdfViewer = null;
  928. this.pdfHistory = null;
  929. this._pagesRefCache = null;
  930. }
  931. _createClass(PDFLinkService, [{
  932. key: "setDocument",
  933. value: function setDocument(pdfDocument) {
  934. var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  935. this.baseUrl = baseUrl;
  936. this.pdfDocument = pdfDocument;
  937. this._pagesRefCache = Object.create(null);
  938. }
  939. }, {
  940. key: "setViewer",
  941. value: function setViewer(pdfViewer) {
  942. this.pdfViewer = pdfViewer;
  943. }
  944. }, {
  945. key: "setHistory",
  946. value: function setHistory(pdfHistory) {
  947. this.pdfHistory = pdfHistory;
  948. }
  949. }, {
  950. key: "pagesCount",
  951. get: function get() {
  952. return this.pdfDocument ? this.pdfDocument.numPages : 0;
  953. }
  954. }, {
  955. key: "page",
  956. get: function get() {
  957. return this.pdfViewer.currentPageNumber;
  958. },
  959. set: function set(value) {
  960. this.pdfViewer.currentPageNumber = value;
  961. }
  962. }, {
  963. key: "rotation",
  964. get: function get() {
  965. return this.pdfViewer.pagesRotation;
  966. },
  967. set: function set(value) {
  968. this.pdfViewer.pagesRotation = value;
  969. }
  970. }, {
  971. key: "_goToDestinationHelper",
  972. value: function _goToDestinationHelper(rawDest) {
  973. var _this = this;
  974. var namedDest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  975. var explicitDest = arguments.length > 2 ? arguments[2] : undefined;
  976. var destRef = explicitDest[0];
  977. var pageNumber;
  978. if (_typeof(destRef) === "object" && destRef !== null) {
  979. pageNumber = this._cachedPageNumber(destRef);
  980. if (pageNumber === null) {
  981. this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {
  982. _this.cachePageRef(pageIndex + 1, destRef);
  983. _this._goToDestinationHelper(rawDest, namedDest, explicitDest);
  984. })["catch"](function () {
  985. console.error("PDFLinkService._goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(rawDest, "\"."));
  986. });
  987. return;
  988. }
  989. } else if (Number.isInteger(destRef)) {
  990. pageNumber = destRef + 1;
  991. } else {
  992. console.error("PDFLinkService._goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid destination reference, for dest=\"".concat(rawDest, "\"."));
  993. return;
  994. }
  995. if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
  996. console.error("PDFLinkService._goToDestinationHelper: \"".concat(pageNumber, "\" is not ") + "a valid page number, for dest=\"".concat(rawDest, "\"."));
  997. return;
  998. }
  999. if (this.pdfHistory) {
  1000. this.pdfHistory.pushCurrentPosition();
  1001. this.pdfHistory.push({
  1002. namedDest: namedDest,
  1003. explicitDest: explicitDest,
  1004. pageNumber: pageNumber
  1005. });
  1006. }
  1007. this.pdfViewer.scrollPageIntoView({
  1008. pageNumber: pageNumber,
  1009. destArray: explicitDest,
  1010. ignoreDestinationZoom: this._ignoreDestinationZoom
  1011. });
  1012. }
  1013. }, {
  1014. key: "goToDestination",
  1015. value: function () {
  1016. var _goToDestination = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(dest) {
  1017. var namedDest, explicitDest;
  1018. return _regenerator["default"].wrap(function _callee$(_context) {
  1019. while (1) {
  1020. switch (_context.prev = _context.next) {
  1021. case 0:
  1022. if (this.pdfDocument) {
  1023. _context.next = 2;
  1024. break;
  1025. }
  1026. return _context.abrupt("return");
  1027. case 2:
  1028. if (!(typeof dest === "string")) {
  1029. _context.next = 9;
  1030. break;
  1031. }
  1032. namedDest = dest;
  1033. _context.next = 6;
  1034. return this.pdfDocument.getDestination(dest);
  1035. case 6:
  1036. explicitDest = _context.sent;
  1037. _context.next = 13;
  1038. break;
  1039. case 9:
  1040. namedDest = null;
  1041. _context.next = 12;
  1042. return dest;
  1043. case 12:
  1044. explicitDest = _context.sent;
  1045. case 13:
  1046. if (Array.isArray(explicitDest)) {
  1047. _context.next = 16;
  1048. break;
  1049. }
  1050. console.error("PDFLinkService.goToDestination: \"".concat(explicitDest, "\" is not ") + "a valid destination array, for dest=\"".concat(dest, "\"."));
  1051. return _context.abrupt("return");
  1052. case 16:
  1053. this._goToDestinationHelper(dest, namedDest, explicitDest);
  1054. case 17:
  1055. case "end":
  1056. return _context.stop();
  1057. }
  1058. }
  1059. }, _callee, this);
  1060. }));
  1061. function goToDestination(_x) {
  1062. return _goToDestination.apply(this, arguments);
  1063. }
  1064. return goToDestination;
  1065. }()
  1066. }, {
  1067. key: "goToPage",
  1068. value: function goToPage(val) {
  1069. if (!this.pdfDocument) {
  1070. return;
  1071. }
  1072. var pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
  1073. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  1074. console.error("PDFLinkService.goToPage: \"".concat(val, "\" is not a valid page."));
  1075. return;
  1076. }
  1077. if (this.pdfHistory) {
  1078. this.pdfHistory.pushCurrentPosition();
  1079. this.pdfHistory.pushPage(pageNumber);
  1080. }
  1081. this.pdfViewer.scrollPageIntoView({
  1082. pageNumber: pageNumber
  1083. });
  1084. }
  1085. }, {
  1086. key: "addLinkAttributes",
  1087. value: function addLinkAttributes(link, url) {
  1088. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1089. (0, _pdfjsLib.addLinkAttributes)(link, {
  1090. url: url,
  1091. target: newWindow ? _pdfjsLib.LinkTarget.BLANK : this.externalLinkTarget,
  1092. rel: this.externalLinkRel,
  1093. enabled: this.externalLinkEnabled
  1094. });
  1095. }
  1096. }, {
  1097. key: "getDestinationHash",
  1098. value: function getDestinationHash(dest) {
  1099. if (typeof dest === "string") {
  1100. if (dest.length > 0) {
  1101. return this.getAnchorUrl("#" + escape(dest));
  1102. }
  1103. } else if (Array.isArray(dest)) {
  1104. var str = JSON.stringify(dest);
  1105. if (str.length > 0) {
  1106. return this.getAnchorUrl("#" + escape(str));
  1107. }
  1108. }
  1109. return this.getAnchorUrl("");
  1110. }
  1111. }, {
  1112. key: "getAnchorUrl",
  1113. value: function getAnchorUrl(anchor) {
  1114. return (this.baseUrl || "") + anchor;
  1115. }
  1116. }, {
  1117. key: "setHash",
  1118. value: function setHash(hash) {
  1119. if (!this.pdfDocument) {
  1120. return;
  1121. }
  1122. var pageNumber, dest;
  1123. if (hash.includes("=")) {
  1124. var params = (0, _ui_utils.parseQueryString)(hash);
  1125. if (params.has("search")) {
  1126. this.eventBus.dispatch("findfromurlhash", {
  1127. source: this,
  1128. query: params.get("search").replace(/"/g, ""),
  1129. phraseSearch: params.get("phrase") === "true"
  1130. });
  1131. }
  1132. if (params.has("page")) {
  1133. pageNumber = params.get("page") | 0 || 1;
  1134. }
  1135. if (params.has("zoom")) {
  1136. var zoomArgs = params.get("zoom").split(",");
  1137. var zoomArg = zoomArgs[0];
  1138. var zoomArgNumber = parseFloat(zoomArg);
  1139. if (!zoomArg.includes("Fit")) {
  1140. dest = [null, {
  1141. name: "XYZ"
  1142. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
  1143. } else {
  1144. if (zoomArg === "Fit" || zoomArg === "FitB") {
  1145. dest = [null, {
  1146. name: zoomArg
  1147. }];
  1148. } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {
  1149. dest = [null, {
  1150. name: zoomArg
  1151. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
  1152. } else if (zoomArg === "FitR") {
  1153. if (zoomArgs.length !== 5) {
  1154. console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
  1155. } else {
  1156. dest = [null, {
  1157. name: zoomArg
  1158. }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
  1159. }
  1160. } else {
  1161. console.error("PDFLinkService.setHash: \"".concat(zoomArg, "\" is not ") + "a valid zoom value.");
  1162. }
  1163. }
  1164. }
  1165. if (dest) {
  1166. this.pdfViewer.scrollPageIntoView({
  1167. pageNumber: pageNumber || this.page,
  1168. destArray: dest,
  1169. allowNegativeOffset: true
  1170. });
  1171. } else if (pageNumber) {
  1172. this.page = pageNumber;
  1173. }
  1174. if (params.has("pagemode")) {
  1175. this.eventBus.dispatch("pagemode", {
  1176. source: this,
  1177. mode: params.get("pagemode")
  1178. });
  1179. }
  1180. if (params.has("nameddest")) {
  1181. this.goToDestination(params.get("nameddest"));
  1182. }
  1183. } else {
  1184. dest = unescape(hash);
  1185. try {
  1186. dest = JSON.parse(dest);
  1187. if (!Array.isArray(dest)) {
  1188. dest = dest.toString();
  1189. }
  1190. } catch (ex) {}
  1191. if (typeof dest === "string" || isValidExplicitDestination(dest)) {
  1192. this.goToDestination(dest);
  1193. return;
  1194. }
  1195. console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not ") + "a valid destination.");
  1196. }
  1197. }
  1198. }, {
  1199. key: "executeNamedAction",
  1200. value: function executeNamedAction(action) {
  1201. var _this$pdfHistory, _this$pdfHistory2;
  1202. switch (action) {
  1203. case "GoBack":
  1204. (_this$pdfHistory = this.pdfHistory) === null || _this$pdfHistory === void 0 ? void 0 : _this$pdfHistory.back();
  1205. break;
  1206. case "GoForward":
  1207. (_this$pdfHistory2 = this.pdfHistory) === null || _this$pdfHistory2 === void 0 ? void 0 : _this$pdfHistory2.forward();
  1208. break;
  1209. case "NextPage":
  1210. this.pdfViewer.nextPage();
  1211. break;
  1212. case "PrevPage":
  1213. this.pdfViewer.previousPage();
  1214. break;
  1215. case "LastPage":
  1216. this.page = this.pagesCount;
  1217. break;
  1218. case "FirstPage":
  1219. this.page = 1;
  1220. break;
  1221. default:
  1222. break;
  1223. }
  1224. this.eventBus.dispatch("namedaction", {
  1225. source: this,
  1226. action: action
  1227. });
  1228. }
  1229. }, {
  1230. key: "cachePageRef",
  1231. value: function cachePageRef(pageNum, pageRef) {
  1232. if (!pageRef) {
  1233. return;
  1234. }
  1235. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1236. this._pagesRefCache[refStr] = pageNum;
  1237. }
  1238. }, {
  1239. key: "_cachedPageNumber",
  1240. value: function _cachedPageNumber(pageRef) {
  1241. var _this$_pagesRefCache;
  1242. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1243. return ((_this$_pagesRefCache = this._pagesRefCache) === null || _this$_pagesRefCache === void 0 ? void 0 : _this$_pagesRefCache[refStr]) || null;
  1244. }
  1245. }, {
  1246. key: "isPageVisible",
  1247. value: function isPageVisible(pageNumber) {
  1248. return this.pdfViewer.isPageVisible(pageNumber);
  1249. }
  1250. }, {
  1251. key: "isPageCached",
  1252. value: function isPageCached(pageNumber) {
  1253. return this.pdfViewer.isPageCached(pageNumber);
  1254. }
  1255. }]);
  1256. return PDFLinkService;
  1257. }();
  1258. exports.PDFLinkService = PDFLinkService;
  1259. function isValidExplicitDestination(dest) {
  1260. if (!Array.isArray(dest)) {
  1261. return false;
  1262. }
  1263. var destLength = dest.length;
  1264. if (destLength < 2) {
  1265. return false;
  1266. }
  1267. var page = dest[0];
  1268. if (!(_typeof(page) === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
  1269. return false;
  1270. }
  1271. var zoom = dest[1];
  1272. if (!(_typeof(zoom) === "object" && typeof zoom.name === "string")) {
  1273. return false;
  1274. }
  1275. var allowNull = true;
  1276. switch (zoom.name) {
  1277. case "XYZ":
  1278. if (destLength !== 5) {
  1279. return false;
  1280. }
  1281. break;
  1282. case "Fit":
  1283. case "FitB":
  1284. return destLength === 2;
  1285. case "FitH":
  1286. case "FitBH":
  1287. case "FitV":
  1288. case "FitBV":
  1289. if (destLength !== 3) {
  1290. return false;
  1291. }
  1292. break;
  1293. case "FitR":
  1294. if (destLength !== 6) {
  1295. return false;
  1296. }
  1297. allowNull = false;
  1298. break;
  1299. default:
  1300. return false;
  1301. }
  1302. for (var i = 2; i < destLength; i++) {
  1303. var param = dest[i];
  1304. if (!(typeof param === "number" || allowNull && param === null)) {
  1305. return false;
  1306. }
  1307. }
  1308. return true;
  1309. }
  1310. var SimpleLinkService = /*#__PURE__*/function () {
  1311. function SimpleLinkService() {
  1312. _classCallCheck(this, SimpleLinkService);
  1313. this.externalLinkEnabled = true;
  1314. }
  1315. _createClass(SimpleLinkService, [{
  1316. key: "pagesCount",
  1317. get: function get() {
  1318. return 0;
  1319. }
  1320. }, {
  1321. key: "page",
  1322. get: function get() {
  1323. return 0;
  1324. },
  1325. set: function set(value) {}
  1326. }, {
  1327. key: "rotation",
  1328. get: function get() {
  1329. return 0;
  1330. },
  1331. set: function set(value) {}
  1332. }, {
  1333. key: "goToDestination",
  1334. value: function () {
  1335. var _goToDestination2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(dest) {
  1336. return _regenerator["default"].wrap(function _callee2$(_context2) {
  1337. while (1) {
  1338. switch (_context2.prev = _context2.next) {
  1339. case 0:
  1340. case "end":
  1341. return _context2.stop();
  1342. }
  1343. }
  1344. }, _callee2);
  1345. }));
  1346. function goToDestination(_x2) {
  1347. return _goToDestination2.apply(this, arguments);
  1348. }
  1349. return goToDestination;
  1350. }()
  1351. }, {
  1352. key: "goToPage",
  1353. value: function goToPage(val) {}
  1354. }, {
  1355. key: "addLinkAttributes",
  1356. value: function addLinkAttributes(link, url) {
  1357. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1358. (0, _pdfjsLib.addLinkAttributes)(link, {
  1359. url: url,
  1360. enabled: this.externalLinkEnabled
  1361. });
  1362. }
  1363. }, {
  1364. key: "getDestinationHash",
  1365. value: function getDestinationHash(dest) {
  1366. return "#";
  1367. }
  1368. }, {
  1369. key: "getAnchorUrl",
  1370. value: function getAnchorUrl(hash) {
  1371. return "#";
  1372. }
  1373. }, {
  1374. key: "setHash",
  1375. value: function setHash(hash) {}
  1376. }, {
  1377. key: "executeNamedAction",
  1378. value: function executeNamedAction(action) {}
  1379. }, {
  1380. key: "cachePageRef",
  1381. value: function cachePageRef(pageNum, pageRef) {}
  1382. }, {
  1383. key: "isPageVisible",
  1384. value: function isPageVisible(pageNumber) {
  1385. return true;
  1386. }
  1387. }, {
  1388. key: "isPageCached",
  1389. value: function isPageCached(pageNumber) {
  1390. return true;
  1391. }
  1392. }]);
  1393. return SimpleLinkService;
  1394. }();
  1395. exports.SimpleLinkService = SimpleLinkService;
  1396. /***/ }),
  1397. /* 7 */
  1398. /***/ ((__unused_webpack_module, exports) => {
  1399. Object.defineProperty(exports, "__esModule", ({
  1400. value: true
  1401. }));
  1402. exports.apiPageLayoutToSpreadMode = apiPageLayoutToSpreadMode;
  1403. exports.apiPageModeToSidebarView = apiPageModeToSidebarView;
  1404. exports.approximateFraction = approximateFraction;
  1405. exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
  1406. exports.binarySearchFirstItem = binarySearchFirstItem;
  1407. exports.getActiveOrFocusedElement = getActiveOrFocusedElement;
  1408. exports.getOutputScale = getOutputScale;
  1409. exports.getPageSizeInches = getPageSizeInches;
  1410. exports.getVisibleElements = getVisibleElements;
  1411. exports.isPortraitOrientation = isPortraitOrientation;
  1412. exports.isValidRotation = isValidRotation;
  1413. exports.isValidScrollMode = isValidScrollMode;
  1414. exports.isValidSpreadMode = isValidSpreadMode;
  1415. exports.moveToEndOfArray = moveToEndOfArray;
  1416. exports.noContextMenuHandler = noContextMenuHandler;
  1417. exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
  1418. exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
  1419. exports.parseQueryString = parseQueryString;
  1420. exports.roundToDivide = roundToDivide;
  1421. exports.scrollIntoView = scrollIntoView;
  1422. exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
  1423. exports.watchScroll = watchScroll;
  1424. exports.WaitOnType = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.EventBus = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.AutoPrintRegExp = exports.AutomationEventBus = exports.animationStarted = void 0;
  1425. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  1426. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  1427. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  1428. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  1429. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  1430. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  1431. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  1432. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1433. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  1434. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  1435. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1436. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  1437. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  1438. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  1439. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  1440. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  1441. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  1442. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  1443. var DEFAULT_SCALE_VALUE = "auto";
  1444. exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
  1445. var DEFAULT_SCALE = 1.0;
  1446. exports.DEFAULT_SCALE = DEFAULT_SCALE;
  1447. var DEFAULT_SCALE_DELTA = 1.1;
  1448. exports.DEFAULT_SCALE_DELTA = DEFAULT_SCALE_DELTA;
  1449. var MIN_SCALE = 0.1;
  1450. exports.MIN_SCALE = MIN_SCALE;
  1451. var MAX_SCALE = 10.0;
  1452. exports.MAX_SCALE = MAX_SCALE;
  1453. var UNKNOWN_SCALE = 0;
  1454. exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
  1455. var MAX_AUTO_SCALE = 1.25;
  1456. exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
  1457. var SCROLLBAR_PADDING = 40;
  1458. exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
  1459. var VERTICAL_PADDING = 5;
  1460. exports.VERTICAL_PADDING = VERTICAL_PADDING;
  1461. var LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset";
  1462. var PresentationModeState = {
  1463. UNKNOWN: 0,
  1464. NORMAL: 1,
  1465. CHANGING: 2,
  1466. FULLSCREEN: 3
  1467. };
  1468. exports.PresentationModeState = PresentationModeState;
  1469. var SidebarView = {
  1470. UNKNOWN: -1,
  1471. NONE: 0,
  1472. THUMBS: 1,
  1473. OUTLINE: 2,
  1474. ATTACHMENTS: 3,
  1475. LAYERS: 4
  1476. };
  1477. exports.SidebarView = SidebarView;
  1478. var RendererType = {
  1479. CANVAS: "canvas",
  1480. SVG: "svg"
  1481. };
  1482. exports.RendererType = RendererType;
  1483. var TextLayerMode = {
  1484. DISABLE: 0,
  1485. ENABLE: 1,
  1486. ENABLE_ENHANCE: 2
  1487. };
  1488. exports.TextLayerMode = TextLayerMode;
  1489. var ScrollMode = {
  1490. UNKNOWN: -1,
  1491. VERTICAL: 0,
  1492. HORIZONTAL: 1,
  1493. WRAPPED: 2
  1494. };
  1495. exports.ScrollMode = ScrollMode;
  1496. var SpreadMode = {
  1497. UNKNOWN: -1,
  1498. NONE: 0,
  1499. ODD: 1,
  1500. EVEN: 2
  1501. };
  1502. exports.SpreadMode = SpreadMode;
  1503. var AutoPrintRegExp = /\bprint\s*\(/;
  1504. exports.AutoPrintRegExp = AutoPrintRegExp;
  1505. function getOutputScale(ctx) {
  1506. var devicePixelRatio = window.devicePixelRatio || 1;
  1507. var backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
  1508. var pixelRatio = devicePixelRatio / backingStoreRatio;
  1509. return {
  1510. sx: pixelRatio,
  1511. sy: pixelRatio,
  1512. scaled: pixelRatio !== 1
  1513. };
  1514. }
  1515. function scrollIntoView(element, spot) {
  1516. var scrollMatches = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1517. var parent = element.offsetParent;
  1518. if (!parent) {
  1519. console.error("offsetParent is not set -- cannot scroll");
  1520. return;
  1521. }
  1522. var offsetY = element.offsetTop + element.clientTop;
  1523. var offsetX = element.offsetLeft + element.clientLeft;
  1524. while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) {
  1525. offsetY += parent.offsetTop;
  1526. offsetX += parent.offsetLeft;
  1527. parent = parent.offsetParent;
  1528. if (!parent) {
  1529. return;
  1530. }
  1531. }
  1532. if (spot) {
  1533. if (spot.top !== undefined) {
  1534. offsetY += spot.top;
  1535. }
  1536. if (spot.left !== undefined) {
  1537. offsetX += spot.left;
  1538. parent.scrollLeft = offsetX;
  1539. }
  1540. }
  1541. parent.scrollTop = offsetY;
  1542. }
  1543. function watchScroll(viewAreaElement, callback) {
  1544. var debounceScroll = function debounceScroll(evt) {
  1545. if (rAF) {
  1546. return;
  1547. }
  1548. rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
  1549. rAF = null;
  1550. var currentX = viewAreaElement.scrollLeft;
  1551. var lastX = state.lastX;
  1552. if (currentX !== lastX) {
  1553. state.right = currentX > lastX;
  1554. }
  1555. state.lastX = currentX;
  1556. var currentY = viewAreaElement.scrollTop;
  1557. var lastY = state.lastY;
  1558. if (currentY !== lastY) {
  1559. state.down = currentY > lastY;
  1560. }
  1561. state.lastY = currentY;
  1562. callback(state);
  1563. });
  1564. };
  1565. var state = {
  1566. right: true,
  1567. down: true,
  1568. lastX: viewAreaElement.scrollLeft,
  1569. lastY: viewAreaElement.scrollTop,
  1570. _eventHandler: debounceScroll
  1571. };
  1572. var rAF = null;
  1573. viewAreaElement.addEventListener("scroll", debounceScroll, true);
  1574. return state;
  1575. }
  1576. function parseQueryString(query) {
  1577. var params = new Map();
  1578. var _iterator = _createForOfIteratorHelper(query.split("&")),
  1579. _step;
  1580. try {
  1581. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  1582. var part = _step.value;
  1583. var param = part.split("="),
  1584. key = param[0].toLowerCase(),
  1585. value = param.length > 1 ? param[1] : "";
  1586. params.set(decodeURIComponent(key), decodeURIComponent(value));
  1587. }
  1588. } catch (err) {
  1589. _iterator.e(err);
  1590. } finally {
  1591. _iterator.f();
  1592. }
  1593. return params;
  1594. }
  1595. function binarySearchFirstItem(items, condition) {
  1596. var minIndex = 0;
  1597. var maxIndex = items.length - 1;
  1598. if (maxIndex < 0 || !condition(items[maxIndex])) {
  1599. return items.length;
  1600. }
  1601. if (condition(items[minIndex])) {
  1602. return minIndex;
  1603. }
  1604. while (minIndex < maxIndex) {
  1605. var currentIndex = minIndex + maxIndex >> 1;
  1606. var currentItem = items[currentIndex];
  1607. if (condition(currentItem)) {
  1608. maxIndex = currentIndex;
  1609. } else {
  1610. minIndex = currentIndex + 1;
  1611. }
  1612. }
  1613. return minIndex;
  1614. }
  1615. function approximateFraction(x) {
  1616. if (Math.floor(x) === x) {
  1617. return [x, 1];
  1618. }
  1619. var xinv = 1 / x;
  1620. var limit = 8;
  1621. if (xinv > limit) {
  1622. return [1, limit];
  1623. } else if (Math.floor(xinv) === xinv) {
  1624. return [1, xinv];
  1625. }
  1626. var x_ = x > 1 ? xinv : x;
  1627. var a = 0,
  1628. b = 1,
  1629. c = 1,
  1630. d = 1;
  1631. while (true) {
  1632. var p = a + c,
  1633. q = b + d;
  1634. if (q > limit) {
  1635. break;
  1636. }
  1637. if (x_ <= p / q) {
  1638. c = p;
  1639. d = q;
  1640. } else {
  1641. a = p;
  1642. b = q;
  1643. }
  1644. }
  1645. var result;
  1646. if (x_ - a / b < c / d - x_) {
  1647. result = x_ === x ? [a, b] : [b, a];
  1648. } else {
  1649. result = x_ === x ? [c, d] : [d, c];
  1650. }
  1651. return result;
  1652. }
  1653. function roundToDivide(x, div) {
  1654. var r = x % div;
  1655. return r === 0 ? x : Math.round(x - r + div);
  1656. }
  1657. function getPageSizeInches(_ref) {
  1658. var view = _ref.view,
  1659. userUnit = _ref.userUnit,
  1660. rotate = _ref.rotate;
  1661. var _view = _slicedToArray(view, 4),
  1662. x1 = _view[0],
  1663. y1 = _view[1],
  1664. x2 = _view[2],
  1665. y2 = _view[3];
  1666. var changeOrientation = rotate % 180 !== 0;
  1667. var width = (x2 - x1) / 72 * userUnit;
  1668. var height = (y2 - y1) / 72 * userUnit;
  1669. return {
  1670. width: changeOrientation ? height : width,
  1671. height: changeOrientation ? width : height
  1672. };
  1673. }
  1674. function backtrackBeforeAllVisibleElements(index, views, top) {
  1675. if (index < 2) {
  1676. return index;
  1677. }
  1678. var elt = views[index].div;
  1679. var pageTop = elt.offsetTop + elt.clientTop;
  1680. if (pageTop >= top) {
  1681. elt = views[index - 1].div;
  1682. pageTop = elt.offsetTop + elt.clientTop;
  1683. }
  1684. for (var i = index - 2; i >= 0; --i) {
  1685. elt = views[i].div;
  1686. if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
  1687. break;
  1688. }
  1689. index = i;
  1690. }
  1691. return index;
  1692. }
  1693. function getVisibleElements(_ref2) {
  1694. var scrollEl = _ref2.scrollEl,
  1695. views = _ref2.views,
  1696. _ref2$sortByVisibilit = _ref2.sortByVisibility,
  1697. sortByVisibility = _ref2$sortByVisibilit === void 0 ? false : _ref2$sortByVisibilit,
  1698. _ref2$horizontal = _ref2.horizontal,
  1699. horizontal = _ref2$horizontal === void 0 ? false : _ref2$horizontal,
  1700. _ref2$rtl = _ref2.rtl,
  1701. rtl = _ref2$rtl === void 0 ? false : _ref2$rtl;
  1702. var top = scrollEl.scrollTop,
  1703. bottom = top + scrollEl.clientHeight;
  1704. var left = scrollEl.scrollLeft,
  1705. right = left + scrollEl.clientWidth;
  1706. function isElementBottomAfterViewTop(view) {
  1707. var element = view.div;
  1708. var elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
  1709. return elementBottom > top;
  1710. }
  1711. function isElementNextAfterViewHorizontally(view) {
  1712. var element = view.div;
  1713. var elementLeft = element.offsetLeft + element.clientLeft;
  1714. var elementRight = elementLeft + element.clientWidth;
  1715. return rtl ? elementLeft < right : elementRight > left;
  1716. }
  1717. var visible = [],
  1718. numViews = views.length;
  1719. var firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
  1720. if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
  1721. firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
  1722. }
  1723. var lastEdge = horizontal ? right : -1;
  1724. for (var i = firstVisibleElementInd; i < numViews; i++) {
  1725. var view = views[i],
  1726. element = view.div;
  1727. var currentWidth = element.offsetLeft + element.clientLeft;
  1728. var currentHeight = element.offsetTop + element.clientTop;
  1729. var viewWidth = element.clientWidth,
  1730. viewHeight = element.clientHeight;
  1731. var viewRight = currentWidth + viewWidth;
  1732. var viewBottom = currentHeight + viewHeight;
  1733. if (lastEdge === -1) {
  1734. if (viewBottom >= bottom) {
  1735. lastEdge = viewBottom;
  1736. }
  1737. } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
  1738. break;
  1739. }
  1740. if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {
  1741. continue;
  1742. }
  1743. var hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
  1744. var hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
  1745. var fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
  1746. fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
  1747. var percent = fractionHeight * fractionWidth * 100 | 0;
  1748. visible.push({
  1749. id: view.id,
  1750. x: currentWidth,
  1751. y: currentHeight,
  1752. view: view,
  1753. percent: percent,
  1754. widthPercent: fractionWidth * 100 | 0
  1755. });
  1756. }
  1757. var first = visible[0],
  1758. last = visible[visible.length - 1];
  1759. if (sortByVisibility) {
  1760. visible.sort(function (a, b) {
  1761. var pc = a.percent - b.percent;
  1762. if (Math.abs(pc) > 0.001) {
  1763. return -pc;
  1764. }
  1765. return a.id - b.id;
  1766. });
  1767. }
  1768. return {
  1769. first: first,
  1770. last: last,
  1771. views: visible
  1772. };
  1773. }
  1774. function noContextMenuHandler(evt) {
  1775. evt.preventDefault();
  1776. }
  1777. function normalizeWheelEventDirection(evt) {
  1778. var delta = Math.hypot(evt.deltaX, evt.deltaY);
  1779. var angle = Math.atan2(evt.deltaY, evt.deltaX);
  1780. if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
  1781. delta = -delta;
  1782. }
  1783. return delta;
  1784. }
  1785. function normalizeWheelEventDelta(evt) {
  1786. var delta = normalizeWheelEventDirection(evt);
  1787. var MOUSE_DOM_DELTA_PIXEL_MODE = 0;
  1788. var MOUSE_DOM_DELTA_LINE_MODE = 1;
  1789. var MOUSE_PIXELS_PER_LINE = 30;
  1790. var MOUSE_LINES_PER_PAGE = 30;
  1791. if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
  1792. delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
  1793. } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
  1794. delta /= MOUSE_LINES_PER_PAGE;
  1795. }
  1796. return delta;
  1797. }
  1798. function isValidRotation(angle) {
  1799. return Number.isInteger(angle) && angle % 90 === 0;
  1800. }
  1801. function isValidScrollMode(mode) {
  1802. return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;
  1803. }
  1804. function isValidSpreadMode(mode) {
  1805. return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;
  1806. }
  1807. function isPortraitOrientation(size) {
  1808. return size.width <= size.height;
  1809. }
  1810. var WaitOnType = {
  1811. EVENT: "event",
  1812. TIMEOUT: "timeout"
  1813. };
  1814. exports.WaitOnType = WaitOnType;
  1815. function waitOnEventOrTimeout(_ref3) {
  1816. var target = _ref3.target,
  1817. name = _ref3.name,
  1818. _ref3$delay = _ref3.delay,
  1819. delay = _ref3$delay === void 0 ? 0 : _ref3$delay;
  1820. return new Promise(function (resolve, reject) {
  1821. if (_typeof(target) !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {
  1822. throw new Error("waitOnEventOrTimeout - invalid parameters.");
  1823. }
  1824. function handler(type) {
  1825. if (target instanceof EventBus) {
  1826. target._off(name, eventHandler);
  1827. } else {
  1828. target.removeEventListener(name, eventHandler);
  1829. }
  1830. if (timeout) {
  1831. clearTimeout(timeout);
  1832. }
  1833. resolve(type);
  1834. }
  1835. var eventHandler = handler.bind(null, WaitOnType.EVENT);
  1836. if (target instanceof EventBus) {
  1837. target._on(name, eventHandler);
  1838. } else {
  1839. target.addEventListener(name, eventHandler);
  1840. }
  1841. var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
  1842. var timeout = setTimeout(timeoutHandler, delay);
  1843. });
  1844. }
  1845. var animationStarted = new Promise(function (resolve) {
  1846. window.requestAnimationFrame(resolve);
  1847. });
  1848. exports.animationStarted = animationStarted;
  1849. var EventBus = /*#__PURE__*/function () {
  1850. function EventBus() {
  1851. _classCallCheck(this, EventBus);
  1852. this._listeners = Object.create(null);
  1853. }
  1854. _createClass(EventBus, [{
  1855. key: "on",
  1856. value: function on(eventName, listener) {
  1857. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1858. this._on(eventName, listener, {
  1859. external: true,
  1860. once: options === null || options === void 0 ? void 0 : options.once
  1861. });
  1862. }
  1863. }, {
  1864. key: "off",
  1865. value: function off(eventName, listener) {
  1866. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1867. this._off(eventName, listener, {
  1868. external: true,
  1869. once: options === null || options === void 0 ? void 0 : options.once
  1870. });
  1871. }
  1872. }, {
  1873. key: "dispatch",
  1874. value: function dispatch(eventName, data) {
  1875. var eventListeners = this._listeners[eventName];
  1876. if (!eventListeners || eventListeners.length === 0) {
  1877. return;
  1878. }
  1879. var externalListeners;
  1880. var _iterator2 = _createForOfIteratorHelper(eventListeners.slice(0)),
  1881. _step2;
  1882. try {
  1883. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  1884. var _step2$value = _step2.value,
  1885. _listener = _step2$value.listener,
  1886. external = _step2$value.external,
  1887. once = _step2$value.once;
  1888. if (once) {
  1889. this._off(eventName, _listener);
  1890. }
  1891. if (external) {
  1892. (externalListeners || (externalListeners = [])).push(_listener);
  1893. continue;
  1894. }
  1895. _listener(data);
  1896. }
  1897. } catch (err) {
  1898. _iterator2.e(err);
  1899. } finally {
  1900. _iterator2.f();
  1901. }
  1902. if (externalListeners) {
  1903. var _iterator3 = _createForOfIteratorHelper(externalListeners),
  1904. _step3;
  1905. try {
  1906. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  1907. var listener = _step3.value;
  1908. listener(data);
  1909. }
  1910. } catch (err) {
  1911. _iterator3.e(err);
  1912. } finally {
  1913. _iterator3.f();
  1914. }
  1915. externalListeners = null;
  1916. }
  1917. }
  1918. }, {
  1919. key: "_on",
  1920. value: function _on(eventName, listener) {
  1921. var _this$_listeners;
  1922. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1923. var eventListeners = (_this$_listeners = this._listeners)[eventName] || (_this$_listeners[eventName] = []);
  1924. eventListeners.push({
  1925. listener: listener,
  1926. external: (options === null || options === void 0 ? void 0 : options.external) === true,
  1927. once: (options === null || options === void 0 ? void 0 : options.once) === true
  1928. });
  1929. }
  1930. }, {
  1931. key: "_off",
  1932. value: function _off(eventName, listener) {
  1933. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1934. var eventListeners = this._listeners[eventName];
  1935. if (!eventListeners) {
  1936. return;
  1937. }
  1938. for (var i = 0, ii = eventListeners.length; i < ii; i++) {
  1939. if (eventListeners[i].listener === listener) {
  1940. eventListeners.splice(i, 1);
  1941. return;
  1942. }
  1943. }
  1944. }
  1945. }]);
  1946. return EventBus;
  1947. }();
  1948. exports.EventBus = EventBus;
  1949. var AutomationEventBus = /*#__PURE__*/function (_EventBus) {
  1950. _inherits(AutomationEventBus, _EventBus);
  1951. var _super = _createSuper(AutomationEventBus);
  1952. function AutomationEventBus() {
  1953. _classCallCheck(this, AutomationEventBus);
  1954. return _super.apply(this, arguments);
  1955. }
  1956. _createClass(AutomationEventBus, [{
  1957. key: "dispatch",
  1958. value: function dispatch(eventName, data) {
  1959. throw new Error("Not implemented: AutomationEventBus.dispatch");
  1960. }
  1961. }]);
  1962. return AutomationEventBus;
  1963. }(EventBus);
  1964. exports.AutomationEventBus = AutomationEventBus;
  1965. function clamp(v, min, max) {
  1966. return Math.min(Math.max(v, min), max);
  1967. }
  1968. var ProgressBar = /*#__PURE__*/function () {
  1969. function ProgressBar(id) {
  1970. var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  1971. height = _ref4.height,
  1972. width = _ref4.width,
  1973. units = _ref4.units;
  1974. _classCallCheck(this, ProgressBar);
  1975. this.visible = true;
  1976. this.div = document.querySelector(id + " .progress");
  1977. this.bar = this.div.parentNode;
  1978. this.height = height || 100;
  1979. this.width = width || 100;
  1980. this.units = units || "%";
  1981. this.div.style.height = this.height + this.units;
  1982. this.percent = 0;
  1983. }
  1984. _createClass(ProgressBar, [{
  1985. key: "_updateBar",
  1986. value: function _updateBar() {
  1987. if (this._indeterminate) {
  1988. this.div.classList.add("indeterminate");
  1989. this.div.style.width = this.width + this.units;
  1990. return;
  1991. }
  1992. this.div.classList.remove("indeterminate");
  1993. var progressSize = this.width * this._percent / 100;
  1994. this.div.style.width = progressSize + this.units;
  1995. }
  1996. }, {
  1997. key: "percent",
  1998. get: function get() {
  1999. return this._percent;
  2000. },
  2001. set: function set(val) {
  2002. this._indeterminate = isNaN(val);
  2003. this._percent = clamp(val, 0, 100);
  2004. this._updateBar();
  2005. }
  2006. }, {
  2007. key: "setWidth",
  2008. value: function setWidth(viewer) {
  2009. if (!viewer) {
  2010. return;
  2011. }
  2012. var container = viewer.parentNode;
  2013. var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
  2014. if (scrollbarWidth > 0) {
  2015. var doc = document.documentElement;
  2016. doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, "".concat(scrollbarWidth, "px"));
  2017. }
  2018. }
  2019. }, {
  2020. key: "hide",
  2021. value: function hide() {
  2022. if (!this.visible) {
  2023. return;
  2024. }
  2025. this.visible = false;
  2026. this.bar.classList.add("hidden");
  2027. }
  2028. }, {
  2029. key: "show",
  2030. value: function show() {
  2031. if (this.visible) {
  2032. return;
  2033. }
  2034. this.visible = true;
  2035. this.bar.classList.remove("hidden");
  2036. }
  2037. }]);
  2038. return ProgressBar;
  2039. }();
  2040. exports.ProgressBar = ProgressBar;
  2041. function moveToEndOfArray(arr, condition) {
  2042. var moved = [],
  2043. len = arr.length;
  2044. var write = 0;
  2045. for (var read = 0; read < len; ++read) {
  2046. if (condition(arr[read])) {
  2047. moved.push(arr[read]);
  2048. } else {
  2049. arr[write] = arr[read];
  2050. ++write;
  2051. }
  2052. }
  2053. for (var _read = 0; write < len; ++_read, ++write) {
  2054. arr[write] = moved[_read];
  2055. }
  2056. }
  2057. function getActiveOrFocusedElement() {
  2058. var curRoot = document;
  2059. var curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  2060. while ((_curActiveOrFocused = curActiveOrFocused) !== null && _curActiveOrFocused !== void 0 && _curActiveOrFocused.shadowRoot) {
  2061. var _curActiveOrFocused;
  2062. curRoot = curActiveOrFocused.shadowRoot;
  2063. curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  2064. }
  2065. return curActiveOrFocused;
  2066. }
  2067. function apiPageLayoutToSpreadMode(layout) {
  2068. switch (layout) {
  2069. case "SinglePage":
  2070. case "OneColumn":
  2071. return SpreadMode.NONE;
  2072. case "TwoColumnLeft":
  2073. case "TwoPageLeft":
  2074. return SpreadMode.ODD;
  2075. case "TwoColumnRight":
  2076. case "TwoPageRight":
  2077. return SpreadMode.EVEN;
  2078. }
  2079. return SpreadMode.NONE;
  2080. }
  2081. function apiPageModeToSidebarView(mode) {
  2082. switch (mode) {
  2083. case "UseNone":
  2084. return SidebarView.NONE;
  2085. case "UseThumbs":
  2086. return SidebarView.THUMBS;
  2087. case "UseOutlines":
  2088. return SidebarView.OUTLINE;
  2089. case "UseAttachments":
  2090. return SidebarView.ATTACHMENTS;
  2091. case "UseOC":
  2092. return SidebarView.LAYERS;
  2093. }
  2094. return SidebarView.NONE;
  2095. }
  2096. /***/ }),
  2097. /* 8 */
  2098. /***/ ((__unused_webpack_module, exports) => {
  2099. Object.defineProperty(exports, "__esModule", ({
  2100. value: true
  2101. }));
  2102. exports.StructTreeLayerBuilder = exports.DefaultStructTreeLayerFactory = void 0;
  2103. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  2104. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  2105. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  2106. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2107. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2108. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2109. var PDF_ROLE_TO_HTML_ROLE = {
  2110. Document: null,
  2111. DocumentFragment: null,
  2112. Part: "group",
  2113. Sect: "group",
  2114. Div: "group",
  2115. Aside: "note",
  2116. NonStruct: "none",
  2117. P: null,
  2118. H: "heading",
  2119. Title: null,
  2120. FENote: "note",
  2121. Sub: "group",
  2122. Lbl: null,
  2123. Span: null,
  2124. Em: null,
  2125. Strong: null,
  2126. Link: "link",
  2127. Annot: "note",
  2128. Form: "form",
  2129. Ruby: null,
  2130. RB: null,
  2131. RT: null,
  2132. RP: null,
  2133. Warichu: null,
  2134. WT: null,
  2135. WP: null,
  2136. L: "list",
  2137. LI: "listitem",
  2138. LBody: null,
  2139. Table: "table",
  2140. TR: "row",
  2141. TH: "columnheader",
  2142. TD: "cell",
  2143. THead: "columnheader",
  2144. TBody: null,
  2145. TFoot: null,
  2146. Caption: null,
  2147. Figure: "figure",
  2148. Formula: null,
  2149. Artifact: null
  2150. };
  2151. var HEADING_PATTERN = /^H(\d+)$/;
  2152. var StructTreeLayerBuilder = /*#__PURE__*/function () {
  2153. function StructTreeLayerBuilder(_ref) {
  2154. var pdfPage = _ref.pdfPage;
  2155. _classCallCheck(this, StructTreeLayerBuilder);
  2156. this.pdfPage = pdfPage;
  2157. }
  2158. _createClass(StructTreeLayerBuilder, [{
  2159. key: "render",
  2160. value: function render(structTree) {
  2161. return this._walk(structTree);
  2162. }
  2163. }, {
  2164. key: "_setAttributes",
  2165. value: function _setAttributes(structElement, htmlElement) {
  2166. if (structElement.alt !== undefined) {
  2167. htmlElement.setAttribute("aria-label", structElement.alt);
  2168. }
  2169. if (structElement.id !== undefined) {
  2170. htmlElement.setAttribute("aria-owns", structElement.id);
  2171. }
  2172. }
  2173. }, {
  2174. key: "_walk",
  2175. value: function _walk(node) {
  2176. if (!node) {
  2177. return null;
  2178. }
  2179. var element = document.createElement("span");
  2180. if ("role" in node) {
  2181. var role = node.role;
  2182. var match = role.match(HEADING_PATTERN);
  2183. if (match) {
  2184. element.setAttribute("role", "heading");
  2185. element.setAttribute("aria-level", match[1]);
  2186. } else if (PDF_ROLE_TO_HTML_ROLE[role]) {
  2187. element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]);
  2188. }
  2189. }
  2190. this._setAttributes(node, element);
  2191. if (node.children) {
  2192. if (node.children.length === 1 && "id" in node.children[0]) {
  2193. this._setAttributes(node.children[0], element);
  2194. } else {
  2195. var _iterator = _createForOfIteratorHelper(node.children),
  2196. _step;
  2197. try {
  2198. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2199. var kid = _step.value;
  2200. element.appendChild(this._walk(kid));
  2201. }
  2202. } catch (err) {
  2203. _iterator.e(err);
  2204. } finally {
  2205. _iterator.f();
  2206. }
  2207. }
  2208. }
  2209. return element;
  2210. }
  2211. }]);
  2212. return StructTreeLayerBuilder;
  2213. }();
  2214. exports.StructTreeLayerBuilder = StructTreeLayerBuilder;
  2215. var DefaultStructTreeLayerFactory = /*#__PURE__*/function () {
  2216. function DefaultStructTreeLayerFactory() {
  2217. _classCallCheck(this, DefaultStructTreeLayerFactory);
  2218. }
  2219. _createClass(DefaultStructTreeLayerFactory, [{
  2220. key: "createStructTreeLayerBuilder",
  2221. value: function createStructTreeLayerBuilder(pdfPage) {
  2222. return new StructTreeLayerBuilder({
  2223. pdfPage: pdfPage
  2224. });
  2225. }
  2226. }]);
  2227. return DefaultStructTreeLayerFactory;
  2228. }();
  2229. exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory;
  2230. /***/ }),
  2231. /* 9 */
  2232. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2233. Object.defineProperty(exports, "__esModule", ({
  2234. value: true
  2235. }));
  2236. exports.TextLayerBuilder = exports.DefaultTextLayerFactory = void 0;
  2237. var _pdfjsLib = __w_pdfjs_require__(4);
  2238. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2239. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2240. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2241. var EXPAND_DIVS_TIMEOUT = 300;
  2242. var TextLayerBuilder = /*#__PURE__*/function () {
  2243. function TextLayerBuilder(_ref) {
  2244. var textLayerDiv = _ref.textLayerDiv,
  2245. eventBus = _ref.eventBus,
  2246. pageIndex = _ref.pageIndex,
  2247. viewport = _ref.viewport,
  2248. _ref$highlighter = _ref.highlighter,
  2249. highlighter = _ref$highlighter === void 0 ? null : _ref$highlighter,
  2250. _ref$enhanceTextSelec = _ref.enhanceTextSelection,
  2251. enhanceTextSelection = _ref$enhanceTextSelec === void 0 ? false : _ref$enhanceTextSelec;
  2252. _classCallCheck(this, TextLayerBuilder);
  2253. this.textLayerDiv = textLayerDiv;
  2254. this.eventBus = eventBus;
  2255. this.textContent = null;
  2256. this.textContentItemsStr = [];
  2257. this.textContentStream = null;
  2258. this.renderingDone = false;
  2259. this.pageNumber = pageIndex + 1;
  2260. this.viewport = viewport;
  2261. this.textDivs = [];
  2262. this.textLayerRenderTask = null;
  2263. this.highlighter = highlighter;
  2264. this.enhanceTextSelection = enhanceTextSelection;
  2265. this._bindMouse();
  2266. }
  2267. _createClass(TextLayerBuilder, [{
  2268. key: "_finishRendering",
  2269. value: function _finishRendering() {
  2270. this.renderingDone = true;
  2271. if (!this.enhanceTextSelection) {
  2272. var endOfContent = document.createElement("div");
  2273. endOfContent.className = "endOfContent";
  2274. this.textLayerDiv.appendChild(endOfContent);
  2275. }
  2276. this.eventBus.dispatch("textlayerrendered", {
  2277. source: this,
  2278. pageNumber: this.pageNumber,
  2279. numTextDivs: this.textDivs.length
  2280. });
  2281. }
  2282. }, {
  2283. key: "render",
  2284. value: function render() {
  2285. var _this$highlighter,
  2286. _this = this;
  2287. var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  2288. if (!(this.textContent || this.textContentStream) || this.renderingDone) {
  2289. return;
  2290. }
  2291. this.cancel();
  2292. this.textDivs.length = 0;
  2293. (_this$highlighter = this.highlighter) === null || _this$highlighter === void 0 ? void 0 : _this$highlighter.setTextMapping(this.textDivs, this.textContentItemsStr);
  2294. var textLayerFrag = document.createDocumentFragment();
  2295. this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
  2296. textContent: this.textContent,
  2297. textContentStream: this.textContentStream,
  2298. container: textLayerFrag,
  2299. viewport: this.viewport,
  2300. textDivs: this.textDivs,
  2301. textContentItemsStr: this.textContentItemsStr,
  2302. timeout: timeout,
  2303. enhanceTextSelection: this.enhanceTextSelection
  2304. });
  2305. this.textLayerRenderTask.promise.then(function () {
  2306. var _this$highlighter2;
  2307. _this.textLayerDiv.appendChild(textLayerFrag);
  2308. _this._finishRendering();
  2309. (_this$highlighter2 = _this.highlighter) === null || _this$highlighter2 === void 0 ? void 0 : _this$highlighter2.enable();
  2310. }, function (reason) {});
  2311. }
  2312. }, {
  2313. key: "cancel",
  2314. value: function cancel() {
  2315. var _this$highlighter3;
  2316. if (this.textLayerRenderTask) {
  2317. this.textLayerRenderTask.cancel();
  2318. this.textLayerRenderTask = null;
  2319. }
  2320. (_this$highlighter3 = this.highlighter) === null || _this$highlighter3 === void 0 ? void 0 : _this$highlighter3.disable();
  2321. }
  2322. }, {
  2323. key: "setTextContentStream",
  2324. value: function setTextContentStream(readableStream) {
  2325. this.cancel();
  2326. this.textContentStream = readableStream;
  2327. }
  2328. }, {
  2329. key: "setTextContent",
  2330. value: function setTextContent(textContent) {
  2331. this.cancel();
  2332. this.textContent = textContent;
  2333. }
  2334. }, {
  2335. key: "_bindMouse",
  2336. value: function _bindMouse() {
  2337. var _this2 = this;
  2338. var div = this.textLayerDiv;
  2339. var expandDivsTimer = null;
  2340. div.addEventListener("mousedown", function (evt) {
  2341. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2342. _this2.textLayerRenderTask.expandTextDivs(true);
  2343. if (expandDivsTimer) {
  2344. clearTimeout(expandDivsTimer);
  2345. expandDivsTimer = null;
  2346. }
  2347. return;
  2348. }
  2349. var end = div.querySelector(".endOfContent");
  2350. if (!end) {
  2351. return;
  2352. }
  2353. var adjustTop = evt.target !== div;
  2354. adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none";
  2355. if (adjustTop) {
  2356. var divBounds = div.getBoundingClientRect();
  2357. var r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);
  2358. end.style.top = (r * 100).toFixed(2) + "%";
  2359. }
  2360. end.classList.add("active");
  2361. });
  2362. div.addEventListener("mouseup", function () {
  2363. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2364. expandDivsTimer = setTimeout(function () {
  2365. if (_this2.textLayerRenderTask) {
  2366. _this2.textLayerRenderTask.expandTextDivs(false);
  2367. }
  2368. expandDivsTimer = null;
  2369. }, EXPAND_DIVS_TIMEOUT);
  2370. return;
  2371. }
  2372. var end = div.querySelector(".endOfContent");
  2373. if (!end) {
  2374. return;
  2375. }
  2376. end.style.top = "";
  2377. end.classList.remove("active");
  2378. });
  2379. }
  2380. }]);
  2381. return TextLayerBuilder;
  2382. }();
  2383. exports.TextLayerBuilder = TextLayerBuilder;
  2384. var DefaultTextLayerFactory = /*#__PURE__*/function () {
  2385. function DefaultTextLayerFactory() {
  2386. _classCallCheck(this, DefaultTextLayerFactory);
  2387. }
  2388. _createClass(DefaultTextLayerFactory, [{
  2389. key: "createTextLayerBuilder",
  2390. value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
  2391. var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  2392. var eventBus = arguments.length > 4 ? arguments[4] : undefined;
  2393. var highlighter = arguments.length > 5 ? arguments[5] : undefined;
  2394. return new TextLayerBuilder({
  2395. textLayerDiv: textLayerDiv,
  2396. pageIndex: pageIndex,
  2397. viewport: viewport,
  2398. enhanceTextSelection: enhanceTextSelection,
  2399. eventBus: eventBus,
  2400. highlighter: highlighter
  2401. });
  2402. }
  2403. }]);
  2404. return DefaultTextLayerFactory;
  2405. }();
  2406. exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
  2407. /***/ }),
  2408. /* 10 */
  2409. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2410. Object.defineProperty(exports, "__esModule", ({
  2411. value: true
  2412. }));
  2413. exports.XfaLayerBuilder = exports.DefaultXfaLayerFactory = void 0;
  2414. var _pdf_link_service = __w_pdfjs_require__(6);
  2415. var _pdfjsLib = __w_pdfjs_require__(4);
  2416. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2417. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2418. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2419. var XfaLayerBuilder = /*#__PURE__*/function () {
  2420. function XfaLayerBuilder(_ref) {
  2421. var pageDiv = _ref.pageDiv,
  2422. pdfPage = _ref.pdfPage,
  2423. annotationStorage = _ref.annotationStorage,
  2424. linkService = _ref.linkService,
  2425. xfaHtml = _ref.xfaHtml;
  2426. _classCallCheck(this, XfaLayerBuilder);
  2427. this.pageDiv = pageDiv;
  2428. this.pdfPage = pdfPage;
  2429. this.annotationStorage = annotationStorage;
  2430. this.linkService = linkService;
  2431. this.xfaHtml = xfaHtml;
  2432. this.div = null;
  2433. this._cancelled = false;
  2434. }
  2435. _createClass(XfaLayerBuilder, [{
  2436. key: "render",
  2437. value: function render(viewport) {
  2438. var _this = this;
  2439. var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "display";
  2440. if (intent === "print") {
  2441. var parameters = {
  2442. viewport: viewport.clone({
  2443. dontFlip: true
  2444. }),
  2445. div: this.div,
  2446. xfa: this.xfaHtml,
  2447. page: null,
  2448. annotationStorage: this.annotationStorage,
  2449. linkService: this.linkService,
  2450. intent: intent
  2451. };
  2452. var div = document.createElement("div");
  2453. this.pageDiv.appendChild(div);
  2454. parameters.div = div;
  2455. var result = _pdfjsLib.XfaLayer.render(parameters);
  2456. return Promise.resolve(result);
  2457. }
  2458. return this.pdfPage.getXfa().then(function (xfa) {
  2459. if (_this._cancelled || !xfa) {
  2460. return {
  2461. textDivs: []
  2462. };
  2463. }
  2464. var parameters = {
  2465. viewport: viewport.clone({
  2466. dontFlip: true
  2467. }),
  2468. div: _this.div,
  2469. xfa: xfa,
  2470. page: _this.pdfPage,
  2471. annotationStorage: _this.annotationStorage,
  2472. linkService: _this.linkService,
  2473. intent: intent
  2474. };
  2475. if (_this.div) {
  2476. return _pdfjsLib.XfaLayer.update(parameters);
  2477. }
  2478. _this.div = document.createElement("div");
  2479. _this.pageDiv.appendChild(_this.div);
  2480. parameters.div = _this.div;
  2481. return _pdfjsLib.XfaLayer.render(parameters);
  2482. })["catch"](function (error) {
  2483. console.error(error);
  2484. });
  2485. }
  2486. }, {
  2487. key: "cancel",
  2488. value: function cancel() {
  2489. this._cancelled = true;
  2490. }
  2491. }, {
  2492. key: "hide",
  2493. value: function hide() {
  2494. if (!this.div) {
  2495. return;
  2496. }
  2497. this.div.hidden = true;
  2498. }
  2499. }]);
  2500. return XfaLayerBuilder;
  2501. }();
  2502. exports.XfaLayerBuilder = XfaLayerBuilder;
  2503. var DefaultXfaLayerFactory = /*#__PURE__*/function () {
  2504. function DefaultXfaLayerFactory() {
  2505. _classCallCheck(this, DefaultXfaLayerFactory);
  2506. }
  2507. _createClass(DefaultXfaLayerFactory, [{
  2508. key: "createXfaLayerBuilder",
  2509. value: function createXfaLayerBuilder(pageDiv, pdfPage) {
  2510. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  2511. var xfaHtml = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  2512. return new XfaLayerBuilder({
  2513. pageDiv: pageDiv,
  2514. pdfPage: pdfPage,
  2515. annotationStorage: annotationStorage,
  2516. linkService: new _pdf_link_service.SimpleLinkService(),
  2517. xfaHtml: xfaHtml
  2518. });
  2519. }
  2520. }]);
  2521. return DefaultXfaLayerFactory;
  2522. }();
  2523. exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory;
  2524. /***/ }),
  2525. /* 11 */
  2526. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2527. Object.defineProperty(exports, "__esModule", ({
  2528. value: true
  2529. }));
  2530. exports.DownloadManager = void 0;
  2531. var _pdfjsLib = __w_pdfjs_require__(4);
  2532. var _app_options = __w_pdfjs_require__(12);
  2533. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2534. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2535. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2536. ;
  2537. function _download(blobUrl, filename) {
  2538. var a = document.createElement("a");
  2539. if (!a.click) {
  2540. throw new Error('DownloadManager: "a.click()" is not supported.');
  2541. }
  2542. a.href = blobUrl;
  2543. a.target = "_parent";
  2544. if ("download" in a) {
  2545. a.download = filename;
  2546. }
  2547. (document.body || document.documentElement).appendChild(a);
  2548. a.click();
  2549. a.remove();
  2550. }
  2551. var DownloadManager = /*#__PURE__*/function () {
  2552. function DownloadManager() {
  2553. _classCallCheck(this, DownloadManager);
  2554. this._openBlobUrls = new WeakMap();
  2555. }
  2556. _createClass(DownloadManager, [{
  2557. key: "downloadUrl",
  2558. value: function downloadUrl(url, filename) {
  2559. if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) {
  2560. console.error("downloadUrl - not a valid URL: ".concat(url));
  2561. return;
  2562. }
  2563. _download(url + "#pdfjs.action=download", filename);
  2564. }
  2565. }, {
  2566. key: "downloadData",
  2567. value: function downloadData(data, filename, contentType) {
  2568. var blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, _app_options.compatibilityParams.disableCreateObjectURL);
  2569. _download(blobUrl, filename);
  2570. }
  2571. }, {
  2572. key: "openOrDownloadData",
  2573. value: function openOrDownloadData(element, data, filename) {
  2574. var isPdfData = (0, _pdfjsLib.isPdfFile)(filename);
  2575. var contentType = isPdfData ? "application/pdf" : "";
  2576. if (isPdfData && !_app_options.compatibilityParams.disableCreateObjectURL) {
  2577. var blobUrl = this._openBlobUrls.get(element);
  2578. if (!blobUrl) {
  2579. blobUrl = URL.createObjectURL(new Blob([data], {
  2580. type: contentType
  2581. }));
  2582. this._openBlobUrls.set(element, blobUrl);
  2583. }
  2584. var viewerUrl;
  2585. viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
  2586. try {
  2587. window.open(viewerUrl);
  2588. return true;
  2589. } catch (ex) {
  2590. console.error("openOrDownloadData: ".concat(ex));
  2591. URL.revokeObjectURL(blobUrl);
  2592. this._openBlobUrls["delete"](element);
  2593. }
  2594. }
  2595. this.downloadData(data, filename, contentType);
  2596. return false;
  2597. }
  2598. }, {
  2599. key: "download",
  2600. value: function download(blob, url, filename) {
  2601. var sourceEventType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "download";
  2602. if (_app_options.compatibilityParams.disableCreateObjectURL) {
  2603. this.downloadUrl(url, filename);
  2604. return;
  2605. }
  2606. var blobUrl = URL.createObjectURL(blob);
  2607. _download(blobUrl, filename);
  2608. }
  2609. }]);
  2610. return DownloadManager;
  2611. }();
  2612. exports.DownloadManager = DownloadManager;
  2613. /***/ }),
  2614. /* 12 */
  2615. /***/ ((__unused_webpack_module, exports) => {
  2616. Object.defineProperty(exports, "__esModule", ({
  2617. value: true
  2618. }));
  2619. exports.OptionKind = exports.compatibilityParams = exports.AppOptions = void 0;
  2620. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2621. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2622. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2623. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2624. var compatibilityParams = Object.create(null);
  2625. exports.compatibilityParams = compatibilityParams;
  2626. {
  2627. var userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
  2628. var platform = typeof navigator !== "undefined" && navigator.platform || "";
  2629. var maxTouchPoints = typeof navigator !== "undefined" && navigator.maxTouchPoints || 1;
  2630. var isAndroid = /Android/.test(userAgent);
  2631. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
  2632. var isIOSChrome = /CriOS/.test(userAgent);
  2633. (function checkOnBlobSupport() {
  2634. if (isIOSChrome) {
  2635. compatibilityParams.disableCreateObjectURL = true;
  2636. }
  2637. })();
  2638. (function checkCanvasSizeLimitation() {
  2639. if (isIOS || isAndroid) {
  2640. compatibilityParams.maxCanvasPixels = 5242880;
  2641. }
  2642. })();
  2643. }
  2644. var OptionKind = {
  2645. VIEWER: 0x02,
  2646. API: 0x04,
  2647. WORKER: 0x08,
  2648. PREFERENCE: 0x80
  2649. };
  2650. exports.OptionKind = OptionKind;
  2651. var defaultOptions = {
  2652. annotationMode: {
  2653. value: 2,
  2654. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2655. },
  2656. cursorToolOnLoad: {
  2657. value: 0,
  2658. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2659. },
  2660. defaultUrl: {
  2661. value: "compressed.tracemonkey-pldi-09.pdf",
  2662. kind: OptionKind.VIEWER
  2663. },
  2664. defaultZoomValue: {
  2665. value: "",
  2666. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2667. },
  2668. disableHistory: {
  2669. value: false,
  2670. kind: OptionKind.VIEWER
  2671. },
  2672. disablePageLabels: {
  2673. value: false,
  2674. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2675. },
  2676. enablePermissions: {
  2677. value: false,
  2678. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2679. },
  2680. enablePrintAutoRotate: {
  2681. value: true,
  2682. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2683. },
  2684. enableScripting: {
  2685. value: true,
  2686. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2687. },
  2688. externalLinkRel: {
  2689. value: "noopener noreferrer nofollow",
  2690. kind: OptionKind.VIEWER
  2691. },
  2692. externalLinkTarget: {
  2693. value: 0,
  2694. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2695. },
  2696. historyUpdateUrl: {
  2697. value: false,
  2698. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2699. },
  2700. ignoreDestinationZoom: {
  2701. value: false,
  2702. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2703. },
  2704. imageResourcesPath: {
  2705. value: "./images/",
  2706. kind: OptionKind.VIEWER
  2707. },
  2708. maxCanvasPixels: {
  2709. value: 16777216,
  2710. compatibility: compatibilityParams.maxCanvasPixels,
  2711. kind: OptionKind.VIEWER
  2712. },
  2713. pdfBugEnabled: {
  2714. value: false,
  2715. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2716. },
  2717. printResolution: {
  2718. value: 150,
  2719. kind: OptionKind.VIEWER
  2720. },
  2721. renderer: {
  2722. value: "canvas",
  2723. kind: OptionKind.VIEWER
  2724. },
  2725. sidebarViewOnLoad: {
  2726. value: -1,
  2727. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2728. },
  2729. scrollModeOnLoad: {
  2730. value: -1,
  2731. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2732. },
  2733. spreadModeOnLoad: {
  2734. value: -1,
  2735. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2736. },
  2737. textLayerMode: {
  2738. value: 1,
  2739. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2740. },
  2741. useOnlyCssZoom: {
  2742. value: false,
  2743. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2744. },
  2745. viewerCssTheme: {
  2746. value: 0,
  2747. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2748. },
  2749. viewOnLoad: {
  2750. value: 0,
  2751. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  2752. },
  2753. cMapPacked: {
  2754. value: true,
  2755. kind: OptionKind.API
  2756. },
  2757. cMapUrl: {
  2758. value: "../web/cmaps/",
  2759. kind: OptionKind.API
  2760. },
  2761. disableAutoFetch: {
  2762. value: false,
  2763. kind: OptionKind.API + OptionKind.PREFERENCE
  2764. },
  2765. disableFontFace: {
  2766. value: false,
  2767. kind: OptionKind.API + OptionKind.PREFERENCE
  2768. },
  2769. disableRange: {
  2770. value: false,
  2771. kind: OptionKind.API + OptionKind.PREFERENCE
  2772. },
  2773. disableStream: {
  2774. value: false,
  2775. kind: OptionKind.API + OptionKind.PREFERENCE
  2776. },
  2777. docBaseUrl: {
  2778. value: "",
  2779. kind: OptionKind.API
  2780. },
  2781. enableXfa: {
  2782. value: true,
  2783. kind: OptionKind.API + OptionKind.PREFERENCE
  2784. },
  2785. fontExtraProperties: {
  2786. value: false,
  2787. kind: OptionKind.API
  2788. },
  2789. isEvalSupported: {
  2790. value: true,
  2791. kind: OptionKind.API
  2792. },
  2793. maxImageSize: {
  2794. value: -1,
  2795. kind: OptionKind.API
  2796. },
  2797. pdfBug: {
  2798. value: false,
  2799. kind: OptionKind.API
  2800. },
  2801. standardFontDataUrl: {
  2802. value: "../web/standard_fonts/",
  2803. kind: OptionKind.API
  2804. },
  2805. verbosity: {
  2806. value: 1,
  2807. kind: OptionKind.API
  2808. },
  2809. workerPort: {
  2810. value: null,
  2811. kind: OptionKind.WORKER
  2812. },
  2813. workerSrc: {
  2814. value: "../build/pdf.worker.js",
  2815. kind: OptionKind.WORKER
  2816. }
  2817. };
  2818. {
  2819. defaultOptions.disablePreferences = {
  2820. value: false,
  2821. kind: OptionKind.VIEWER
  2822. };
  2823. defaultOptions.locale = {
  2824. value: typeof navigator !== "undefined" ? navigator.language : "en-US",
  2825. kind: OptionKind.VIEWER
  2826. };
  2827. defaultOptions.sandboxBundleSrc = {
  2828. value: "../build/pdf.sandbox.js",
  2829. kind: OptionKind.VIEWER
  2830. };
  2831. defaultOptions.renderer.kind += OptionKind.PREFERENCE;
  2832. }
  2833. var userOptions = Object.create(null);
  2834. var AppOptions = /*#__PURE__*/function () {
  2835. function AppOptions() {
  2836. _classCallCheck(this, AppOptions);
  2837. throw new Error("Cannot initialize AppOptions.");
  2838. }
  2839. _createClass(AppOptions, null, [{
  2840. key: "get",
  2841. value: function get(name) {
  2842. var userOption = userOptions[name];
  2843. if (userOption !== undefined) {
  2844. return userOption;
  2845. }
  2846. var defaultOption = defaultOptions[name];
  2847. if (defaultOption !== undefined) {
  2848. var _defaultOption$compat;
  2849. return (_defaultOption$compat = defaultOption.compatibility) !== null && _defaultOption$compat !== void 0 ? _defaultOption$compat : defaultOption.value;
  2850. }
  2851. return undefined;
  2852. }
  2853. }, {
  2854. key: "getAll",
  2855. value: function getAll() {
  2856. var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  2857. var options = Object.create(null);
  2858. for (var name in defaultOptions) {
  2859. var _defaultOption$compat2;
  2860. var defaultOption = defaultOptions[name];
  2861. if (kind) {
  2862. if ((kind & defaultOption.kind) === 0) {
  2863. continue;
  2864. }
  2865. if (kind === OptionKind.PREFERENCE) {
  2866. var value = defaultOption.value,
  2867. valueType = _typeof(value);
  2868. if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) {
  2869. options[name] = value;
  2870. continue;
  2871. }
  2872. throw new Error("Invalid type for preference: ".concat(name));
  2873. }
  2874. }
  2875. var userOption = userOptions[name];
  2876. options[name] = userOption !== undefined ? userOption : (_defaultOption$compat2 = defaultOption.compatibility) !== null && _defaultOption$compat2 !== void 0 ? _defaultOption$compat2 : defaultOption.value;
  2877. }
  2878. return options;
  2879. }
  2880. }, {
  2881. key: "set",
  2882. value: function set(name, value) {
  2883. userOptions[name] = value;
  2884. }
  2885. }, {
  2886. key: "setAll",
  2887. value: function setAll(options) {
  2888. for (var name in options) {
  2889. userOptions[name] = options[name];
  2890. }
  2891. }
  2892. }, {
  2893. key: "remove",
  2894. value: function remove(name) {
  2895. delete userOptions[name];
  2896. }
  2897. }, {
  2898. key: "_hasUserOptions",
  2899. value: function _hasUserOptions() {
  2900. return Object.keys(userOptions).length > 0;
  2901. }
  2902. }]);
  2903. return AppOptions;
  2904. }();
  2905. exports.AppOptions = AppOptions;
  2906. /***/ }),
  2907. /* 13 */
  2908. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2909. Object.defineProperty(exports, "__esModule", ({
  2910. value: true
  2911. }));
  2912. exports.GenericL10n = void 0;
  2913. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  2914. __w_pdfjs_require__(14);
  2915. var _l10n_utils = __w_pdfjs_require__(5);
  2916. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2917. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  2918. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  2919. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2920. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2921. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2922. var webL10n = document.webL10n;
  2923. var GenericL10n = /*#__PURE__*/function () {
  2924. function GenericL10n(lang) {
  2925. _classCallCheck(this, GenericL10n);
  2926. this._lang = lang;
  2927. this._ready = new Promise(function (resolve, reject) {
  2928. webL10n.setLanguage((0, _l10n_utils.fixupLangCode)(lang), function () {
  2929. resolve(webL10n);
  2930. });
  2931. });
  2932. }
  2933. _createClass(GenericL10n, [{
  2934. key: "getLanguage",
  2935. value: function () {
  2936. var _getLanguage = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  2937. var l10n;
  2938. return _regenerator["default"].wrap(function _callee$(_context) {
  2939. while (1) {
  2940. switch (_context.prev = _context.next) {
  2941. case 0:
  2942. _context.next = 2;
  2943. return this._ready;
  2944. case 2:
  2945. l10n = _context.sent;
  2946. return _context.abrupt("return", l10n.getLanguage());
  2947. case 4:
  2948. case "end":
  2949. return _context.stop();
  2950. }
  2951. }
  2952. }, _callee, this);
  2953. }));
  2954. function getLanguage() {
  2955. return _getLanguage.apply(this, arguments);
  2956. }
  2957. return getLanguage;
  2958. }()
  2959. }, {
  2960. key: "getDirection",
  2961. value: function () {
  2962. var _getDirection = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  2963. var l10n;
  2964. return _regenerator["default"].wrap(function _callee2$(_context2) {
  2965. while (1) {
  2966. switch (_context2.prev = _context2.next) {
  2967. case 0:
  2968. _context2.next = 2;
  2969. return this._ready;
  2970. case 2:
  2971. l10n = _context2.sent;
  2972. return _context2.abrupt("return", l10n.getDirection());
  2973. case 4:
  2974. case "end":
  2975. return _context2.stop();
  2976. }
  2977. }
  2978. }, _callee2, this);
  2979. }));
  2980. function getDirection() {
  2981. return _getDirection.apply(this, arguments);
  2982. }
  2983. return getDirection;
  2984. }()
  2985. }, {
  2986. key: "get",
  2987. value: function () {
  2988. var _get = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(key) {
  2989. var args,
  2990. fallback,
  2991. l10n,
  2992. _args3 = arguments;
  2993. return _regenerator["default"].wrap(function _callee3$(_context3) {
  2994. while (1) {
  2995. switch (_context3.prev = _context3.next) {
  2996. case 0:
  2997. args = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : null;
  2998. fallback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : (0, _l10n_utils.getL10nFallback)(key, args);
  2999. _context3.next = 4;
  3000. return this._ready;
  3001. case 4:
  3002. l10n = _context3.sent;
  3003. return _context3.abrupt("return", l10n.get(key, args, fallback));
  3004. case 6:
  3005. case "end":
  3006. return _context3.stop();
  3007. }
  3008. }
  3009. }, _callee3, this);
  3010. }));
  3011. function get(_x) {
  3012. return _get.apply(this, arguments);
  3013. }
  3014. return get;
  3015. }()
  3016. }, {
  3017. key: "translate",
  3018. value: function () {
  3019. var _translate = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(element) {
  3020. var l10n;
  3021. return _regenerator["default"].wrap(function _callee4$(_context4) {
  3022. while (1) {
  3023. switch (_context4.prev = _context4.next) {
  3024. case 0:
  3025. _context4.next = 2;
  3026. return this._ready;
  3027. case 2:
  3028. l10n = _context4.sent;
  3029. return _context4.abrupt("return", l10n.translate(element));
  3030. case 4:
  3031. case "end":
  3032. return _context4.stop();
  3033. }
  3034. }
  3035. }, _callee4, this);
  3036. }));
  3037. function translate(_x2) {
  3038. return _translate.apply(this, arguments);
  3039. }
  3040. return translate;
  3041. }()
  3042. }]);
  3043. return GenericL10n;
  3044. }();
  3045. exports.GenericL10n = GenericL10n;
  3046. /***/ }),
  3047. /* 14 */
  3048. /***/ (() => {
  3049. document.webL10n = function (window, document, undefined) {
  3050. var gL10nData = {};
  3051. var gTextData = '';
  3052. var gTextProp = 'textContent';
  3053. var gLanguage = '';
  3054. var gMacros = {};
  3055. var gReadyState = 'loading';
  3056. var gAsyncResourceLoading = true;
  3057. function getL10nResourceLinks() {
  3058. return document.querySelectorAll('link[type="application/l10n"]');
  3059. }
  3060. function getL10nDictionary() {
  3061. var script = document.querySelector('script[type="application/l10n"]');
  3062. return script ? JSON.parse(script.innerHTML) : null;
  3063. }
  3064. function getTranslatableChildren(element) {
  3065. return element ? element.querySelectorAll('*[data-l10n-id]') : [];
  3066. }
  3067. function getL10nAttributes(element) {
  3068. if (!element) return {};
  3069. var l10nId = element.getAttribute('data-l10n-id');
  3070. var l10nArgs = element.getAttribute('data-l10n-args');
  3071. var args = {};
  3072. if (l10nArgs) {
  3073. try {
  3074. args = JSON.parse(l10nArgs);
  3075. } catch (e) {
  3076. console.warn('could not parse arguments for #' + l10nId);
  3077. }
  3078. }
  3079. return {
  3080. id: l10nId,
  3081. args: args
  3082. };
  3083. }
  3084. function xhrLoadText(url, onSuccess, onFailure) {
  3085. onSuccess = onSuccess || function _onSuccess(data) {};
  3086. onFailure = onFailure || function _onFailure() {};
  3087. var xhr = new XMLHttpRequest();
  3088. xhr.open('GET', url, gAsyncResourceLoading);
  3089. if (xhr.overrideMimeType) {
  3090. xhr.overrideMimeType('text/plain; charset=utf-8');
  3091. }
  3092. xhr.onreadystatechange = function () {
  3093. if (xhr.readyState == 4) {
  3094. if (xhr.status == 200 || xhr.status === 0) {
  3095. onSuccess(xhr.responseText);
  3096. } else {
  3097. onFailure();
  3098. }
  3099. }
  3100. };
  3101. xhr.onerror = onFailure;
  3102. xhr.ontimeout = onFailure;
  3103. try {
  3104. xhr.send(null);
  3105. } catch (e) {
  3106. onFailure();
  3107. }
  3108. }
  3109. function parseResource(href, lang, successCallback, failureCallback) {
  3110. var baseURL = href.replace(/[^\/]*$/, '') || './';
  3111. function evalString(text) {
  3112. if (text.lastIndexOf('\\') < 0) return text;
  3113. return text.replace(/\\\\/g, '\\').replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\t/g, '\t').replace(/\\b/g, '\b').replace(/\\f/g, '\f').replace(/\\{/g, '{').replace(/\\}/g, '}').replace(/\\"/g, '"').replace(/\\'/g, "'");
  3114. }
  3115. function parseProperties(text, parsedPropertiesCallback) {
  3116. var dictionary = {};
  3117. var reBlank = /^\s*|\s*$/;
  3118. var reComment = /^\s*#|^\s*$/;
  3119. var reSection = /^\s*\[(.*)\]\s*$/;
  3120. var reImport = /^\s*@import\s+url\((.*)\)\s*$/i;
  3121. var reSplit = /^([^=\s]*)\s*=\s*(.+)$/;
  3122. function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {
  3123. var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
  3124. var currentLang = '*';
  3125. var genericLang = lang.split('-', 1)[0];
  3126. var skipLang = false;
  3127. var match = '';
  3128. function nextEntry() {
  3129. while (true) {
  3130. if (!entries.length) {
  3131. parsedRawLinesCallback();
  3132. return;
  3133. }
  3134. var line = entries.shift();
  3135. if (reComment.test(line)) continue;
  3136. if (extendedSyntax) {
  3137. match = reSection.exec(line);
  3138. if (match) {
  3139. currentLang = match[1].toLowerCase();
  3140. skipLang = currentLang !== '*' && currentLang !== lang && currentLang !== genericLang;
  3141. continue;
  3142. } else if (skipLang) {
  3143. continue;
  3144. }
  3145. match = reImport.exec(line);
  3146. if (match) {
  3147. loadImport(baseURL + match[1], nextEntry);
  3148. return;
  3149. }
  3150. }
  3151. var tmp = line.match(reSplit);
  3152. if (tmp && tmp.length == 3) {
  3153. dictionary[tmp[1]] = evalString(tmp[2]);
  3154. }
  3155. }
  3156. }
  3157. nextEntry();
  3158. }
  3159. function loadImport(url, callback) {
  3160. xhrLoadText(url, function (content) {
  3161. parseRawLines(content, false, callback);
  3162. }, function () {
  3163. console.warn(url + ' not found.');
  3164. callback();
  3165. });
  3166. }
  3167. parseRawLines(text, true, function () {
  3168. parsedPropertiesCallback(dictionary);
  3169. });
  3170. }
  3171. xhrLoadText(href, function (response) {
  3172. gTextData += response;
  3173. parseProperties(response, function (data) {
  3174. for (var key in data) {
  3175. var id,
  3176. prop,
  3177. index = key.lastIndexOf('.');
  3178. if (index > 0) {
  3179. id = key.substring(0, index);
  3180. prop = key.substring(index + 1);
  3181. } else {
  3182. id = key;
  3183. prop = gTextProp;
  3184. }
  3185. if (!gL10nData[id]) {
  3186. gL10nData[id] = {};
  3187. }
  3188. gL10nData[id][prop] = data[key];
  3189. }
  3190. if (successCallback) {
  3191. successCallback();
  3192. }
  3193. });
  3194. }, failureCallback);
  3195. }
  3196. function loadLocale(lang, callback) {
  3197. if (lang) {
  3198. lang = lang.toLowerCase();
  3199. }
  3200. callback = callback || function _callback() {};
  3201. clear();
  3202. gLanguage = lang;
  3203. var langLinks = getL10nResourceLinks();
  3204. var langCount = langLinks.length;
  3205. if (langCount === 0) {
  3206. var dict = getL10nDictionary();
  3207. if (dict && dict.locales && dict.default_locale) {
  3208. console.log('using the embedded JSON directory, early way out');
  3209. gL10nData = dict.locales[lang];
  3210. if (!gL10nData) {
  3211. var defaultLocale = dict.default_locale.toLowerCase();
  3212. for (var anyCaseLang in dict.locales) {
  3213. anyCaseLang = anyCaseLang.toLowerCase();
  3214. if (anyCaseLang === lang) {
  3215. gL10nData = dict.locales[lang];
  3216. break;
  3217. } else if (anyCaseLang === defaultLocale) {
  3218. gL10nData = dict.locales[defaultLocale];
  3219. }
  3220. }
  3221. }
  3222. callback();
  3223. } else {
  3224. console.log('no resource to load, early way out');
  3225. }
  3226. gReadyState = 'complete';
  3227. return;
  3228. }
  3229. var onResourceLoaded = null;
  3230. var gResourceCount = 0;
  3231. onResourceLoaded = function onResourceLoaded() {
  3232. gResourceCount++;
  3233. if (gResourceCount >= langCount) {
  3234. callback();
  3235. gReadyState = 'complete';
  3236. }
  3237. };
  3238. function L10nResourceLink(link) {
  3239. var href = link.href;
  3240. this.load = function (lang, callback) {
  3241. parseResource(href, lang, callback, function () {
  3242. console.warn(href + ' not found.');
  3243. console.warn('"' + lang + '" resource not found');
  3244. gLanguage = '';
  3245. callback();
  3246. });
  3247. };
  3248. }
  3249. for (var i = 0; i < langCount; i++) {
  3250. var resource = new L10nResourceLink(langLinks[i]);
  3251. resource.load(lang, onResourceLoaded);
  3252. }
  3253. }
  3254. function clear() {
  3255. gL10nData = {};
  3256. gTextData = '';
  3257. gLanguage = '';
  3258. }
  3259. function getPluralRules(lang) {
  3260. var locales2rules = {
  3261. 'af': 3,
  3262. 'ak': 4,
  3263. 'am': 4,
  3264. 'ar': 1,
  3265. 'asa': 3,
  3266. 'az': 0,
  3267. 'be': 11,
  3268. 'bem': 3,
  3269. 'bez': 3,
  3270. 'bg': 3,
  3271. 'bh': 4,
  3272. 'bm': 0,
  3273. 'bn': 3,
  3274. 'bo': 0,
  3275. 'br': 20,
  3276. 'brx': 3,
  3277. 'bs': 11,
  3278. 'ca': 3,
  3279. 'cgg': 3,
  3280. 'chr': 3,
  3281. 'cs': 12,
  3282. 'cy': 17,
  3283. 'da': 3,
  3284. 'de': 3,
  3285. 'dv': 3,
  3286. 'dz': 0,
  3287. 'ee': 3,
  3288. 'el': 3,
  3289. 'en': 3,
  3290. 'eo': 3,
  3291. 'es': 3,
  3292. 'et': 3,
  3293. 'eu': 3,
  3294. 'fa': 0,
  3295. 'ff': 5,
  3296. 'fi': 3,
  3297. 'fil': 4,
  3298. 'fo': 3,
  3299. 'fr': 5,
  3300. 'fur': 3,
  3301. 'fy': 3,
  3302. 'ga': 8,
  3303. 'gd': 24,
  3304. 'gl': 3,
  3305. 'gsw': 3,
  3306. 'gu': 3,
  3307. 'guw': 4,
  3308. 'gv': 23,
  3309. 'ha': 3,
  3310. 'haw': 3,
  3311. 'he': 2,
  3312. 'hi': 4,
  3313. 'hr': 11,
  3314. 'hu': 0,
  3315. 'id': 0,
  3316. 'ig': 0,
  3317. 'ii': 0,
  3318. 'is': 3,
  3319. 'it': 3,
  3320. 'iu': 7,
  3321. 'ja': 0,
  3322. 'jmc': 3,
  3323. 'jv': 0,
  3324. 'ka': 0,
  3325. 'kab': 5,
  3326. 'kaj': 3,
  3327. 'kcg': 3,
  3328. 'kde': 0,
  3329. 'kea': 0,
  3330. 'kk': 3,
  3331. 'kl': 3,
  3332. 'km': 0,
  3333. 'kn': 0,
  3334. 'ko': 0,
  3335. 'ksb': 3,
  3336. 'ksh': 21,
  3337. 'ku': 3,
  3338. 'kw': 7,
  3339. 'lag': 18,
  3340. 'lb': 3,
  3341. 'lg': 3,
  3342. 'ln': 4,
  3343. 'lo': 0,
  3344. 'lt': 10,
  3345. 'lv': 6,
  3346. 'mas': 3,
  3347. 'mg': 4,
  3348. 'mk': 16,
  3349. 'ml': 3,
  3350. 'mn': 3,
  3351. 'mo': 9,
  3352. 'mr': 3,
  3353. 'ms': 0,
  3354. 'mt': 15,
  3355. 'my': 0,
  3356. 'nah': 3,
  3357. 'naq': 7,
  3358. 'nb': 3,
  3359. 'nd': 3,
  3360. 'ne': 3,
  3361. 'nl': 3,
  3362. 'nn': 3,
  3363. 'no': 3,
  3364. 'nr': 3,
  3365. 'nso': 4,
  3366. 'ny': 3,
  3367. 'nyn': 3,
  3368. 'om': 3,
  3369. 'or': 3,
  3370. 'pa': 3,
  3371. 'pap': 3,
  3372. 'pl': 13,
  3373. 'ps': 3,
  3374. 'pt': 3,
  3375. 'rm': 3,
  3376. 'ro': 9,
  3377. 'rof': 3,
  3378. 'ru': 11,
  3379. 'rwk': 3,
  3380. 'sah': 0,
  3381. 'saq': 3,
  3382. 'se': 7,
  3383. 'seh': 3,
  3384. 'ses': 0,
  3385. 'sg': 0,
  3386. 'sh': 11,
  3387. 'shi': 19,
  3388. 'sk': 12,
  3389. 'sl': 14,
  3390. 'sma': 7,
  3391. 'smi': 7,
  3392. 'smj': 7,
  3393. 'smn': 7,
  3394. 'sms': 7,
  3395. 'sn': 3,
  3396. 'so': 3,
  3397. 'sq': 3,
  3398. 'sr': 11,
  3399. 'ss': 3,
  3400. 'ssy': 3,
  3401. 'st': 3,
  3402. 'sv': 3,
  3403. 'sw': 3,
  3404. 'syr': 3,
  3405. 'ta': 3,
  3406. 'te': 3,
  3407. 'teo': 3,
  3408. 'th': 0,
  3409. 'ti': 4,
  3410. 'tig': 3,
  3411. 'tk': 3,
  3412. 'tl': 4,
  3413. 'tn': 3,
  3414. 'to': 0,
  3415. 'tr': 0,
  3416. 'ts': 3,
  3417. 'tzm': 22,
  3418. 'uk': 11,
  3419. 'ur': 3,
  3420. 've': 3,
  3421. 'vi': 0,
  3422. 'vun': 3,
  3423. 'wa': 4,
  3424. 'wae': 3,
  3425. 'wo': 0,
  3426. 'xh': 3,
  3427. 'xog': 3,
  3428. 'yo': 0,
  3429. 'zh': 0,
  3430. 'zu': 3
  3431. };
  3432. function isIn(n, list) {
  3433. return list.indexOf(n) !== -1;
  3434. }
  3435. function isBetween(n, start, end) {
  3436. return start <= n && n <= end;
  3437. }
  3438. var pluralRules = {
  3439. '0': function _(n) {
  3440. return 'other';
  3441. },
  3442. '1': function _(n) {
  3443. if (isBetween(n % 100, 3, 10)) return 'few';
  3444. if (n === 0) return 'zero';
  3445. if (isBetween(n % 100, 11, 99)) return 'many';
  3446. if (n == 2) return 'two';
  3447. if (n == 1) return 'one';
  3448. return 'other';
  3449. },
  3450. '2': function _(n) {
  3451. if (n !== 0 && n % 10 === 0) return 'many';
  3452. if (n == 2) return 'two';
  3453. if (n == 1) return 'one';
  3454. return 'other';
  3455. },
  3456. '3': function _(n) {
  3457. if (n == 1) return 'one';
  3458. return 'other';
  3459. },
  3460. '4': function _(n) {
  3461. if (isBetween(n, 0, 1)) return 'one';
  3462. return 'other';
  3463. },
  3464. '5': function _(n) {
  3465. if (isBetween(n, 0, 2) && n != 2) return 'one';
  3466. return 'other';
  3467. },
  3468. '6': function _(n) {
  3469. if (n === 0) return 'zero';
  3470. if (n % 10 == 1 && n % 100 != 11) return 'one';
  3471. return 'other';
  3472. },
  3473. '7': function _(n) {
  3474. if (n == 2) return 'two';
  3475. if (n == 1) return 'one';
  3476. return 'other';
  3477. },
  3478. '8': function _(n) {
  3479. if (isBetween(n, 3, 6)) return 'few';
  3480. if (isBetween(n, 7, 10)) return 'many';
  3481. if (n == 2) return 'two';
  3482. if (n == 1) return 'one';
  3483. return 'other';
  3484. },
  3485. '9': function _(n) {
  3486. if (n === 0 || n != 1 && isBetween(n % 100, 1, 19)) return 'few';
  3487. if (n == 1) return 'one';
  3488. return 'other';
  3489. },
  3490. '10': function _(n) {
  3491. if (isBetween(n % 10, 2, 9) && !isBetween(n % 100, 11, 19)) return 'few';
  3492. if (n % 10 == 1 && !isBetween(n % 100, 11, 19)) return 'one';
  3493. return 'other';
  3494. },
  3495. '11': function _(n) {
  3496. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  3497. if (n % 10 === 0 || isBetween(n % 10, 5, 9) || isBetween(n % 100, 11, 14)) return 'many';
  3498. if (n % 10 == 1 && n % 100 != 11) return 'one';
  3499. return 'other';
  3500. },
  3501. '12': function _(n) {
  3502. if (isBetween(n, 2, 4)) return 'few';
  3503. if (n == 1) return 'one';
  3504. return 'other';
  3505. },
  3506. '13': function _(n) {
  3507. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  3508. if (n != 1 && isBetween(n % 10, 0, 1) || isBetween(n % 10, 5, 9) || isBetween(n % 100, 12, 14)) return 'many';
  3509. if (n == 1) return 'one';
  3510. return 'other';
  3511. },
  3512. '14': function _(n) {
  3513. if (isBetween(n % 100, 3, 4)) return 'few';
  3514. if (n % 100 == 2) return 'two';
  3515. if (n % 100 == 1) return 'one';
  3516. return 'other';
  3517. },
  3518. '15': function _(n) {
  3519. if (n === 0 || isBetween(n % 100, 2, 10)) return 'few';
  3520. if (isBetween(n % 100, 11, 19)) return 'many';
  3521. if (n == 1) return 'one';
  3522. return 'other';
  3523. },
  3524. '16': function _(n) {
  3525. if (n % 10 == 1 && n != 11) return 'one';
  3526. return 'other';
  3527. },
  3528. '17': function _(n) {
  3529. if (n == 3) return 'few';
  3530. if (n === 0) return 'zero';
  3531. if (n == 6) return 'many';
  3532. if (n == 2) return 'two';
  3533. if (n == 1) return 'one';
  3534. return 'other';
  3535. },
  3536. '18': function _(n) {
  3537. if (n === 0) return 'zero';
  3538. if (isBetween(n, 0, 2) && n !== 0 && n != 2) return 'one';
  3539. return 'other';
  3540. },
  3541. '19': function _(n) {
  3542. if (isBetween(n, 2, 10)) return 'few';
  3543. if (isBetween(n, 0, 1)) return 'one';
  3544. return 'other';
  3545. },
  3546. '20': function _(n) {
  3547. if ((isBetween(n % 10, 3, 4) || n % 10 == 9) && !(isBetween(n % 100, 10, 19) || isBetween(n % 100, 70, 79) || isBetween(n % 100, 90, 99))) return 'few';
  3548. if (n % 1000000 === 0 && n !== 0) return 'many';
  3549. if (n % 10 == 2 && !isIn(n % 100, [12, 72, 92])) return 'two';
  3550. if (n % 10 == 1 && !isIn(n % 100, [11, 71, 91])) return 'one';
  3551. return 'other';
  3552. },
  3553. '21': function _(n) {
  3554. if (n === 0) return 'zero';
  3555. if (n == 1) return 'one';
  3556. return 'other';
  3557. },
  3558. '22': function _(n) {
  3559. if (isBetween(n, 0, 1) || isBetween(n, 11, 99)) return 'one';
  3560. return 'other';
  3561. },
  3562. '23': function _(n) {
  3563. if (isBetween(n % 10, 1, 2) || n % 20 === 0) return 'one';
  3564. return 'other';
  3565. },
  3566. '24': function _(n) {
  3567. if (isBetween(n, 3, 10) || isBetween(n, 13, 19)) return 'few';
  3568. if (isIn(n, [2, 12])) return 'two';
  3569. if (isIn(n, [1, 11])) return 'one';
  3570. return 'other';
  3571. }
  3572. };
  3573. var index = locales2rules[lang.replace(/-.*$/, '')];
  3574. if (!(index in pluralRules)) {
  3575. console.warn('plural form unknown for [' + lang + ']');
  3576. return function () {
  3577. return 'other';
  3578. };
  3579. }
  3580. return pluralRules[index];
  3581. }
  3582. gMacros.plural = function (str, param, key, prop) {
  3583. var n = parseFloat(param);
  3584. if (isNaN(n)) return str;
  3585. if (prop != gTextProp) return str;
  3586. if (!gMacros._pluralRules) {
  3587. gMacros._pluralRules = getPluralRules(gLanguage);
  3588. }
  3589. var index = '[' + gMacros._pluralRules(n) + ']';
  3590. if (n === 0 && key + '[zero]' in gL10nData) {
  3591. str = gL10nData[key + '[zero]'][prop];
  3592. } else if (n == 1 && key + '[one]' in gL10nData) {
  3593. str = gL10nData[key + '[one]'][prop];
  3594. } else if (n == 2 && key + '[two]' in gL10nData) {
  3595. str = gL10nData[key + '[two]'][prop];
  3596. } else if (key + index in gL10nData) {
  3597. str = gL10nData[key + index][prop];
  3598. } else if (key + '[other]' in gL10nData) {
  3599. str = gL10nData[key + '[other]'][prop];
  3600. }
  3601. return str;
  3602. };
  3603. function getL10nData(key, args, fallback) {
  3604. var data = gL10nData[key];
  3605. if (!data) {
  3606. console.warn('#' + key + ' is undefined.');
  3607. if (!fallback) {
  3608. return null;
  3609. }
  3610. data = fallback;
  3611. }
  3612. var rv = {};
  3613. for (var prop in data) {
  3614. var str = data[prop];
  3615. str = substIndexes(str, args, key, prop);
  3616. str = substArguments(str, args, key);
  3617. rv[prop] = str;
  3618. }
  3619. return rv;
  3620. }
  3621. function substIndexes(str, args, key, prop) {
  3622. var reIndex = /\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/;
  3623. var reMatch = reIndex.exec(str);
  3624. if (!reMatch || !reMatch.length) return str;
  3625. var macroName = reMatch[1];
  3626. var paramName = reMatch[2];
  3627. var param;
  3628. if (args && paramName in args) {
  3629. param = args[paramName];
  3630. } else if (paramName in gL10nData) {
  3631. param = gL10nData[paramName];
  3632. }
  3633. if (macroName in gMacros) {
  3634. var macro = gMacros[macroName];
  3635. str = macro(str, param, key, prop);
  3636. }
  3637. return str;
  3638. }
  3639. function substArguments(str, args, key) {
  3640. var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
  3641. return str.replace(reArgs, function (matched_text, arg) {
  3642. if (args && arg in args) {
  3643. return args[arg];
  3644. }
  3645. if (arg in gL10nData) {
  3646. return gL10nData[arg];
  3647. }
  3648. console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');
  3649. return matched_text;
  3650. });
  3651. }
  3652. function translateElement(element) {
  3653. var l10n = getL10nAttributes(element);
  3654. if (!l10n.id) return;
  3655. var data = getL10nData(l10n.id, l10n.args);
  3656. if (!data) {
  3657. console.warn('#' + l10n.id + ' is undefined.');
  3658. return;
  3659. }
  3660. if (data[gTextProp]) {
  3661. if (getChildElementCount(element) === 0) {
  3662. element[gTextProp] = data[gTextProp];
  3663. } else {
  3664. var children = element.childNodes;
  3665. var found = false;
  3666. for (var i = 0, l = children.length; i < l; i++) {
  3667. if (children[i].nodeType === 3 && /\S/.test(children[i].nodeValue)) {
  3668. if (found) {
  3669. children[i].nodeValue = '';
  3670. } else {
  3671. children[i].nodeValue = data[gTextProp];
  3672. found = true;
  3673. }
  3674. }
  3675. }
  3676. if (!found) {
  3677. var textNode = document.createTextNode(data[gTextProp]);
  3678. element.insertBefore(textNode, element.firstChild);
  3679. }
  3680. }
  3681. delete data[gTextProp];
  3682. }
  3683. for (var k in data) {
  3684. element[k] = data[k];
  3685. }
  3686. }
  3687. function getChildElementCount(element) {
  3688. if (element.children) {
  3689. return element.children.length;
  3690. }
  3691. if (typeof element.childElementCount !== 'undefined') {
  3692. return element.childElementCount;
  3693. }
  3694. var count = 0;
  3695. for (var i = 0; i < element.childNodes.length; i++) {
  3696. count += element.nodeType === 1 ? 1 : 0;
  3697. }
  3698. return count;
  3699. }
  3700. function translateFragment(element) {
  3701. element = element || document.documentElement;
  3702. var children = getTranslatableChildren(element);
  3703. var elementCount = children.length;
  3704. for (var i = 0; i < elementCount; i++) {
  3705. translateElement(children[i]);
  3706. }
  3707. translateElement(element);
  3708. }
  3709. return {
  3710. get: function get(key, args, fallbackString) {
  3711. var index = key.lastIndexOf('.');
  3712. var prop = gTextProp;
  3713. if (index > 0) {
  3714. prop = key.substring(index + 1);
  3715. key = key.substring(0, index);
  3716. }
  3717. var fallback;
  3718. if (fallbackString) {
  3719. fallback = {};
  3720. fallback[prop] = fallbackString;
  3721. }
  3722. var data = getL10nData(key, args, fallback);
  3723. if (data && prop in data) {
  3724. return data[prop];
  3725. }
  3726. return '{{' + key + '}}';
  3727. },
  3728. getData: function getData() {
  3729. return gL10nData;
  3730. },
  3731. getText: function getText() {
  3732. return gTextData;
  3733. },
  3734. getLanguage: function getLanguage() {
  3735. return gLanguage;
  3736. },
  3737. setLanguage: function setLanguage(lang, callback) {
  3738. loadLocale(lang, function () {
  3739. if (callback) callback();
  3740. });
  3741. },
  3742. getDirection: function getDirection() {
  3743. var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
  3744. var shortCode = gLanguage.split('-', 1)[0];
  3745. return rtlList.indexOf(shortCode) >= 0 ? 'rtl' : 'ltr';
  3746. },
  3747. translate: translateFragment,
  3748. getReadyState: function getReadyState() {
  3749. return gReadyState;
  3750. },
  3751. ready: function ready(callback) {
  3752. if (!callback) {
  3753. return;
  3754. } else if (gReadyState == 'complete' || gReadyState == 'interactive') {
  3755. window.setTimeout(function () {
  3756. callback();
  3757. });
  3758. } else if (document.addEventListener) {
  3759. document.addEventListener('localized', function once() {
  3760. document.removeEventListener('localized', once);
  3761. callback();
  3762. });
  3763. }
  3764. }
  3765. };
  3766. }(window, document);
  3767. /***/ }),
  3768. /* 15 */
  3769. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3770. Object.defineProperty(exports, "__esModule", ({
  3771. value: true
  3772. }));
  3773. exports.PDFFindController = exports.FindState = void 0;
  3774. var _pdfjsLib = __w_pdfjs_require__(4);
  3775. var _pdf_find_utils = __w_pdfjs_require__(16);
  3776. var _ui_utils = __w_pdfjs_require__(7);
  3777. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3778. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3779. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3780. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  3781. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  3782. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  3783. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  3784. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  3785. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  3786. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  3787. var FindState = {
  3788. FOUND: 0,
  3789. NOT_FOUND: 1,
  3790. WRAPPED: 2,
  3791. PENDING: 3
  3792. };
  3793. exports.FindState = FindState;
  3794. var FIND_TIMEOUT = 250;
  3795. var MATCH_SCROLL_OFFSET_TOP = -50;
  3796. var MATCH_SCROLL_OFFSET_LEFT = -400;
  3797. var CHARACTERS_TO_NORMALIZE = {
  3798. "\u2010": "-",
  3799. "\u2018": "'",
  3800. "\u2019": "'",
  3801. "\u201A": "'",
  3802. "\u201B": "'",
  3803. "\u201C": '"',
  3804. "\u201D": '"',
  3805. "\u201E": '"',
  3806. "\u201F": '"',
  3807. "\xBC": "1/4",
  3808. "\xBD": "1/2",
  3809. "\xBE": "3/4"
  3810. };
  3811. var normalizationRegex = null;
  3812. function normalize(text) {
  3813. if (!normalizationRegex) {
  3814. var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");
  3815. normalizationRegex = new RegExp("[".concat(replace, "]"), "g");
  3816. }
  3817. var diffs = null;
  3818. var normalizedText = text.replace(normalizationRegex, function (ch, index) {
  3819. var normalizedCh = CHARACTERS_TO_NORMALIZE[ch],
  3820. diff = normalizedCh.length - ch.length;
  3821. if (diff !== 0) {
  3822. (diffs || (diffs = [])).push([index, diff]);
  3823. }
  3824. return normalizedCh;
  3825. });
  3826. return [normalizedText, diffs];
  3827. }
  3828. function getOriginalIndex(matchIndex) {
  3829. var diffs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  3830. if (!diffs) {
  3831. return matchIndex;
  3832. }
  3833. var totalDiff = 0;
  3834. var _iterator = _createForOfIteratorHelper(diffs),
  3835. _step;
  3836. try {
  3837. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  3838. var _step$value = _slicedToArray(_step.value, 2),
  3839. index = _step$value[0],
  3840. diff = _step$value[1];
  3841. var currentIndex = index + totalDiff;
  3842. if (currentIndex >= matchIndex) {
  3843. break;
  3844. }
  3845. if (currentIndex + diff > matchIndex) {
  3846. totalDiff += matchIndex - currentIndex;
  3847. break;
  3848. }
  3849. totalDiff += diff;
  3850. }
  3851. } catch (err) {
  3852. _iterator.e(err);
  3853. } finally {
  3854. _iterator.f();
  3855. }
  3856. return matchIndex - totalDiff;
  3857. }
  3858. var PDFFindController = /*#__PURE__*/function () {
  3859. function PDFFindController(_ref) {
  3860. var linkService = _ref.linkService,
  3861. eventBus = _ref.eventBus;
  3862. _classCallCheck(this, PDFFindController);
  3863. this._linkService = linkService;
  3864. this._eventBus = eventBus;
  3865. this._reset();
  3866. eventBus._on("findbarclose", this._onFindBarClose.bind(this));
  3867. }
  3868. _createClass(PDFFindController, [{
  3869. key: "highlightMatches",
  3870. get: function get() {
  3871. return this._highlightMatches;
  3872. }
  3873. }, {
  3874. key: "pageMatches",
  3875. get: function get() {
  3876. return this._pageMatches;
  3877. }
  3878. }, {
  3879. key: "pageMatchesLength",
  3880. get: function get() {
  3881. return this._pageMatchesLength;
  3882. }
  3883. }, {
  3884. key: "selected",
  3885. get: function get() {
  3886. return this._selected;
  3887. }
  3888. }, {
  3889. key: "state",
  3890. get: function get() {
  3891. return this._state;
  3892. }
  3893. }, {
  3894. key: "setDocument",
  3895. value: function setDocument(pdfDocument) {
  3896. if (this._pdfDocument) {
  3897. this._reset();
  3898. }
  3899. if (!pdfDocument) {
  3900. return;
  3901. }
  3902. this._pdfDocument = pdfDocument;
  3903. this._firstPageCapability.resolve();
  3904. }
  3905. }, {
  3906. key: "executeCommand",
  3907. value: function executeCommand(cmd, state) {
  3908. var _this = this;
  3909. if (!state) {
  3910. return;
  3911. }
  3912. var pdfDocument = this._pdfDocument;
  3913. if (this._state === null || this._shouldDirtyMatch(cmd, state)) {
  3914. this._dirtyMatch = true;
  3915. }
  3916. this._state = state;
  3917. if (cmd !== "findhighlightallchange") {
  3918. this._updateUIState(FindState.PENDING);
  3919. }
  3920. this._firstPageCapability.promise.then(function () {
  3921. if (!_this._pdfDocument || pdfDocument && _this._pdfDocument !== pdfDocument) {
  3922. return;
  3923. }
  3924. _this._extractText();
  3925. var findbarClosed = !_this._highlightMatches;
  3926. var pendingTimeout = !!_this._findTimeout;
  3927. if (_this._findTimeout) {
  3928. clearTimeout(_this._findTimeout);
  3929. _this._findTimeout = null;
  3930. }
  3931. if (cmd === "find") {
  3932. _this._findTimeout = setTimeout(function () {
  3933. _this._nextMatch();
  3934. _this._findTimeout = null;
  3935. }, FIND_TIMEOUT);
  3936. } else if (_this._dirtyMatch) {
  3937. _this._nextMatch();
  3938. } else if (cmd === "findagain") {
  3939. _this._nextMatch();
  3940. if (findbarClosed && _this._state.highlightAll) {
  3941. _this._updateAllPages();
  3942. }
  3943. } else if (cmd === "findhighlightallchange") {
  3944. if (pendingTimeout) {
  3945. _this._nextMatch();
  3946. } else {
  3947. _this._highlightMatches = true;
  3948. }
  3949. _this._updateAllPages();
  3950. } else {
  3951. _this._nextMatch();
  3952. }
  3953. });
  3954. }
  3955. }, {
  3956. key: "scrollMatchIntoView",
  3957. value: function scrollMatchIntoView(_ref2) {
  3958. var _ref2$element = _ref2.element,
  3959. element = _ref2$element === void 0 ? null : _ref2$element,
  3960. _ref2$selectedLeft = _ref2.selectedLeft,
  3961. selectedLeft = _ref2$selectedLeft === void 0 ? 0 : _ref2$selectedLeft,
  3962. _ref2$pageIndex = _ref2.pageIndex,
  3963. pageIndex = _ref2$pageIndex === void 0 ? -1 : _ref2$pageIndex,
  3964. _ref2$matchIndex = _ref2.matchIndex,
  3965. matchIndex = _ref2$matchIndex === void 0 ? -1 : _ref2$matchIndex;
  3966. if (!this._scrollMatches || !element) {
  3967. return;
  3968. } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {
  3969. return;
  3970. } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {
  3971. return;
  3972. }
  3973. this._scrollMatches = false;
  3974. var spot = {
  3975. top: MATCH_SCROLL_OFFSET_TOP,
  3976. left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT
  3977. };
  3978. (0, _ui_utils.scrollIntoView)(element, spot, true);
  3979. }
  3980. }, {
  3981. key: "_reset",
  3982. value: function _reset() {
  3983. this._highlightMatches = false;
  3984. this._scrollMatches = false;
  3985. this._pdfDocument = null;
  3986. this._pageMatches = [];
  3987. this._pageMatchesLength = [];
  3988. this._state = null;
  3989. this._selected = {
  3990. pageIdx: -1,
  3991. matchIdx: -1
  3992. };
  3993. this._offset = {
  3994. pageIdx: null,
  3995. matchIdx: null,
  3996. wrapped: false
  3997. };
  3998. this._extractTextPromises = [];
  3999. this._pageContents = [];
  4000. this._pageDiffs = [];
  4001. this._matchesCountTotal = 0;
  4002. this._pagesToSearch = null;
  4003. this._pendingFindMatches = new Set();
  4004. this._resumePageIdx = null;
  4005. this._dirtyMatch = false;
  4006. clearTimeout(this._findTimeout);
  4007. this._findTimeout = null;
  4008. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  4009. }
  4010. }, {
  4011. key: "_query",
  4012. get: function get() {
  4013. if (this._state.query !== this._rawQuery) {
  4014. this._rawQuery = this._state.query;
  4015. var _normalize = normalize(this._state.query);
  4016. var _normalize2 = _slicedToArray(_normalize, 1);
  4017. this._normalizedQuery = _normalize2[0];
  4018. }
  4019. return this._normalizedQuery;
  4020. }
  4021. }, {
  4022. key: "_shouldDirtyMatch",
  4023. value: function _shouldDirtyMatch(cmd, state) {
  4024. if (state.query !== this._state.query) {
  4025. return true;
  4026. }
  4027. switch (cmd) {
  4028. case "findagain":
  4029. var pageNumber = this._selected.pageIdx + 1;
  4030. var linkService = this._linkService;
  4031. if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) {
  4032. return true;
  4033. }
  4034. return false;
  4035. case "findhighlightallchange":
  4036. return false;
  4037. }
  4038. return true;
  4039. }
  4040. }, {
  4041. key: "_prepareMatches",
  4042. value: function _prepareMatches(matchesWithLength, matches, matchesLength) {
  4043. function isSubTerm(currentIndex) {
  4044. var currentElem = matchesWithLength[currentIndex];
  4045. var nextElem = matchesWithLength[currentIndex + 1];
  4046. if (currentIndex < matchesWithLength.length - 1 && currentElem.match === nextElem.match) {
  4047. currentElem.skipped = true;
  4048. return true;
  4049. }
  4050. for (var i = currentIndex - 1; i >= 0; i--) {
  4051. var prevElem = matchesWithLength[i];
  4052. if (prevElem.skipped) {
  4053. continue;
  4054. }
  4055. if (prevElem.match + prevElem.matchLength < currentElem.match) {
  4056. break;
  4057. }
  4058. if (prevElem.match + prevElem.matchLength >= currentElem.match + currentElem.matchLength) {
  4059. currentElem.skipped = true;
  4060. return true;
  4061. }
  4062. }
  4063. return false;
  4064. }
  4065. matchesWithLength.sort(function (a, b) {
  4066. return a.match === b.match ? a.matchLength - b.matchLength : a.match - b.match;
  4067. });
  4068. for (var i = 0, len = matchesWithLength.length; i < len; i++) {
  4069. if (isSubTerm(i)) {
  4070. continue;
  4071. }
  4072. matches.push(matchesWithLength[i].match);
  4073. matchesLength.push(matchesWithLength[i].matchLength);
  4074. }
  4075. }
  4076. }, {
  4077. key: "_isEntireWord",
  4078. value: function _isEntireWord(content, startIdx, length) {
  4079. if (startIdx > 0) {
  4080. var first = content.charCodeAt(startIdx);
  4081. var limit = content.charCodeAt(startIdx - 1);
  4082. if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) {
  4083. return false;
  4084. }
  4085. }
  4086. var endIdx = startIdx + length - 1;
  4087. if (endIdx < content.length - 1) {
  4088. var last = content.charCodeAt(endIdx);
  4089. var _limit = content.charCodeAt(endIdx + 1);
  4090. if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(_limit)) {
  4091. return false;
  4092. }
  4093. }
  4094. return true;
  4095. }
  4096. }, {
  4097. key: "_calculatePhraseMatch",
  4098. value: function _calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
  4099. var matches = [],
  4100. matchesLength = [];
  4101. var queryLen = query.length;
  4102. var matchIdx = -queryLen;
  4103. while (true) {
  4104. matchIdx = pageContent.indexOf(query, matchIdx + queryLen);
  4105. if (matchIdx === -1) {
  4106. break;
  4107. }
  4108. if (entireWord && !this._isEntireWord(pageContent, matchIdx, queryLen)) {
  4109. continue;
  4110. }
  4111. var originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
  4112. matchEnd = matchIdx + queryLen - 1,
  4113. originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
  4114. matches.push(originalMatchIdx);
  4115. matchesLength.push(originalQueryLen);
  4116. }
  4117. this._pageMatches[pageIndex] = matches;
  4118. this._pageMatchesLength[pageIndex] = matchesLength;
  4119. }
  4120. }, {
  4121. key: "_calculateWordMatch",
  4122. value: function _calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
  4123. var matchesWithLength = [];
  4124. var queryArray = query.match(/\S+/g);
  4125. for (var i = 0, len = queryArray.length; i < len; i++) {
  4126. var subquery = queryArray[i];
  4127. var subqueryLen = subquery.length;
  4128. var matchIdx = -subqueryLen;
  4129. while (true) {
  4130. matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);
  4131. if (matchIdx === -1) {
  4132. break;
  4133. }
  4134. if (entireWord && !this._isEntireWord(pageContent, matchIdx, subqueryLen)) {
  4135. continue;
  4136. }
  4137. var originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
  4138. matchEnd = matchIdx + subqueryLen - 1,
  4139. originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
  4140. matchesWithLength.push({
  4141. match: originalMatchIdx,
  4142. matchLength: originalQueryLen,
  4143. skipped: false
  4144. });
  4145. }
  4146. }
  4147. this._pageMatchesLength[pageIndex] = [];
  4148. this._pageMatches[pageIndex] = [];
  4149. this._prepareMatches(matchesWithLength, this._pageMatches[pageIndex], this._pageMatchesLength[pageIndex]);
  4150. }
  4151. }, {
  4152. key: "_calculateMatch",
  4153. value: function _calculateMatch(pageIndex) {
  4154. var pageContent = this._pageContents[pageIndex];
  4155. var pageDiffs = this._pageDiffs[pageIndex];
  4156. var query = this._query;
  4157. var _this$_state = this._state,
  4158. caseSensitive = _this$_state.caseSensitive,
  4159. entireWord = _this$_state.entireWord,
  4160. phraseSearch = _this$_state.phraseSearch;
  4161. if (query.length === 0) {
  4162. return;
  4163. }
  4164. if (!caseSensitive) {
  4165. pageContent = pageContent.toLowerCase();
  4166. query = query.toLowerCase();
  4167. }
  4168. if (phraseSearch) {
  4169. this._calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
  4170. } else {
  4171. this._calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
  4172. }
  4173. if (this._state.highlightAll) {
  4174. this._updatePage(pageIndex);
  4175. }
  4176. if (this._resumePageIdx === pageIndex) {
  4177. this._resumePageIdx = null;
  4178. this._nextPageMatch();
  4179. }
  4180. var pageMatchesCount = this._pageMatches[pageIndex].length;
  4181. if (pageMatchesCount > 0) {
  4182. this._matchesCountTotal += pageMatchesCount;
  4183. this._updateUIResultsCount();
  4184. }
  4185. }
  4186. }, {
  4187. key: "_extractText",
  4188. value: function _extractText() {
  4189. var _this2 = this;
  4190. if (this._extractTextPromises.length > 0) {
  4191. return;
  4192. }
  4193. var promise = Promise.resolve();
  4194. var _loop = function _loop(i, ii) {
  4195. var extractTextCapability = (0, _pdfjsLib.createPromiseCapability)();
  4196. _this2._extractTextPromises[i] = extractTextCapability.promise;
  4197. promise = promise.then(function () {
  4198. return _this2._pdfDocument.getPage(i + 1).then(function (pdfPage) {
  4199. return pdfPage.getTextContent({
  4200. normalizeWhitespace: true
  4201. });
  4202. }).then(function (textContent) {
  4203. var textItems = textContent.items;
  4204. var strBuf = [];
  4205. for (var j = 0, jj = textItems.length; j < jj; j++) {
  4206. strBuf.push(textItems[j].str);
  4207. }
  4208. var _normalize3 = normalize(strBuf.join(""));
  4209. var _normalize4 = _slicedToArray(_normalize3, 2);
  4210. _this2._pageContents[i] = _normalize4[0];
  4211. _this2._pageDiffs[i] = _normalize4[1];
  4212. extractTextCapability.resolve(i);
  4213. }, function (reason) {
  4214. console.error("Unable to get text content for page ".concat(i + 1), reason);
  4215. _this2._pageContents[i] = "";
  4216. _this2._pageDiffs[i] = null;
  4217. extractTextCapability.resolve(i);
  4218. });
  4219. });
  4220. };
  4221. for (var i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
  4222. _loop(i, ii);
  4223. }
  4224. }
  4225. }, {
  4226. key: "_updatePage",
  4227. value: function _updatePage(index) {
  4228. if (this._scrollMatches && this._selected.pageIdx === index) {
  4229. this._linkService.page = index + 1;
  4230. }
  4231. this._eventBus.dispatch("updatetextlayermatches", {
  4232. source: this,
  4233. pageIndex: index
  4234. });
  4235. }
  4236. }, {
  4237. key: "_updateAllPages",
  4238. value: function _updateAllPages() {
  4239. this._eventBus.dispatch("updatetextlayermatches", {
  4240. source: this,
  4241. pageIndex: -1
  4242. });
  4243. }
  4244. }, {
  4245. key: "_nextMatch",
  4246. value: function _nextMatch() {
  4247. var _this3 = this;
  4248. var previous = this._state.findPrevious;
  4249. var currentPageIndex = this._linkService.page - 1;
  4250. var numPages = this._linkService.pagesCount;
  4251. this._highlightMatches = true;
  4252. if (this._dirtyMatch) {
  4253. this._dirtyMatch = false;
  4254. this._selected.pageIdx = this._selected.matchIdx = -1;
  4255. this._offset.pageIdx = currentPageIndex;
  4256. this._offset.matchIdx = null;
  4257. this._offset.wrapped = false;
  4258. this._resumePageIdx = null;
  4259. this._pageMatches.length = 0;
  4260. this._pageMatchesLength.length = 0;
  4261. this._matchesCountTotal = 0;
  4262. this._updateAllPages();
  4263. for (var i = 0; i < numPages; i++) {
  4264. if (this._pendingFindMatches.has(i)) {
  4265. continue;
  4266. }
  4267. this._pendingFindMatches.add(i);
  4268. this._extractTextPromises[i].then(function (pageIdx) {
  4269. _this3._pendingFindMatches["delete"](pageIdx);
  4270. _this3._calculateMatch(pageIdx);
  4271. });
  4272. }
  4273. }
  4274. if (this._query === "") {
  4275. this._updateUIState(FindState.FOUND);
  4276. return;
  4277. }
  4278. if (this._resumePageIdx) {
  4279. return;
  4280. }
  4281. var offset = this._offset;
  4282. this._pagesToSearch = numPages;
  4283. if (offset.matchIdx !== null) {
  4284. var numPageMatches = this._pageMatches[offset.pageIdx].length;
  4285. if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
  4286. offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
  4287. this._updateMatch(true);
  4288. return;
  4289. }
  4290. this._advanceOffsetPage(previous);
  4291. }
  4292. this._nextPageMatch();
  4293. }
  4294. }, {
  4295. key: "_matchesReady",
  4296. value: function _matchesReady(matches) {
  4297. var offset = this._offset;
  4298. var numMatches = matches.length;
  4299. var previous = this._state.findPrevious;
  4300. if (numMatches) {
  4301. offset.matchIdx = previous ? numMatches - 1 : 0;
  4302. this._updateMatch(true);
  4303. return true;
  4304. }
  4305. this._advanceOffsetPage(previous);
  4306. if (offset.wrapped) {
  4307. offset.matchIdx = null;
  4308. if (this._pagesToSearch < 0) {
  4309. this._updateMatch(false);
  4310. return true;
  4311. }
  4312. }
  4313. return false;
  4314. }
  4315. }, {
  4316. key: "_nextPageMatch",
  4317. value: function _nextPageMatch() {
  4318. if (this._resumePageIdx !== null) {
  4319. console.error("There can only be one pending page.");
  4320. }
  4321. var matches = null;
  4322. do {
  4323. var pageIdx = this._offset.pageIdx;
  4324. matches = this._pageMatches[pageIdx];
  4325. if (!matches) {
  4326. this._resumePageIdx = pageIdx;
  4327. break;
  4328. }
  4329. } while (!this._matchesReady(matches));
  4330. }
  4331. }, {
  4332. key: "_advanceOffsetPage",
  4333. value: function _advanceOffsetPage(previous) {
  4334. var offset = this._offset;
  4335. var numPages = this._linkService.pagesCount;
  4336. offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
  4337. offset.matchIdx = null;
  4338. this._pagesToSearch--;
  4339. if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
  4340. offset.pageIdx = previous ? numPages - 1 : 0;
  4341. offset.wrapped = true;
  4342. }
  4343. }
  4344. }, {
  4345. key: "_updateMatch",
  4346. value: function _updateMatch() {
  4347. var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4348. var state = FindState.NOT_FOUND;
  4349. var wrapped = this._offset.wrapped;
  4350. this._offset.wrapped = false;
  4351. if (found) {
  4352. var previousPage = this._selected.pageIdx;
  4353. this._selected.pageIdx = this._offset.pageIdx;
  4354. this._selected.matchIdx = this._offset.matchIdx;
  4355. state = wrapped ? FindState.WRAPPED : FindState.FOUND;
  4356. if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
  4357. this._updatePage(previousPage);
  4358. }
  4359. }
  4360. this._updateUIState(state, this._state.findPrevious);
  4361. if (this._selected.pageIdx !== -1) {
  4362. this._scrollMatches = true;
  4363. this._updatePage(this._selected.pageIdx);
  4364. }
  4365. }
  4366. }, {
  4367. key: "_onFindBarClose",
  4368. value: function _onFindBarClose(evt) {
  4369. var _this4 = this;
  4370. var pdfDocument = this._pdfDocument;
  4371. this._firstPageCapability.promise.then(function () {
  4372. if (!_this4._pdfDocument || pdfDocument && _this4._pdfDocument !== pdfDocument) {
  4373. return;
  4374. }
  4375. if (_this4._findTimeout) {
  4376. clearTimeout(_this4._findTimeout);
  4377. _this4._findTimeout = null;
  4378. }
  4379. if (_this4._resumePageIdx) {
  4380. _this4._resumePageIdx = null;
  4381. _this4._dirtyMatch = true;
  4382. }
  4383. _this4._updateUIState(FindState.FOUND);
  4384. _this4._highlightMatches = false;
  4385. _this4._updateAllPages();
  4386. });
  4387. }
  4388. }, {
  4389. key: "_requestMatchesCount",
  4390. value: function _requestMatchesCount() {
  4391. var _this$_selected = this._selected,
  4392. pageIdx = _this$_selected.pageIdx,
  4393. matchIdx = _this$_selected.matchIdx;
  4394. var current = 0,
  4395. total = this._matchesCountTotal;
  4396. if (matchIdx !== -1) {
  4397. for (var i = 0; i < pageIdx; i++) {
  4398. var _this$_pageMatches$i;
  4399. current += ((_this$_pageMatches$i = this._pageMatches[i]) === null || _this$_pageMatches$i === void 0 ? void 0 : _this$_pageMatches$i.length) || 0;
  4400. }
  4401. current += matchIdx + 1;
  4402. }
  4403. if (current < 1 || current > total) {
  4404. current = total = 0;
  4405. }
  4406. return {
  4407. current: current,
  4408. total: total
  4409. };
  4410. }
  4411. }, {
  4412. key: "_updateUIResultsCount",
  4413. value: function _updateUIResultsCount() {
  4414. this._eventBus.dispatch("updatefindmatchescount", {
  4415. source: this,
  4416. matchesCount: this._requestMatchesCount()
  4417. });
  4418. }
  4419. }, {
  4420. key: "_updateUIState",
  4421. value: function _updateUIState(state, previous) {
  4422. var _this$_state$query, _this$_state2;
  4423. this._eventBus.dispatch("updatefindcontrolstate", {
  4424. source: this,
  4425. state: state,
  4426. previous: previous,
  4427. matchesCount: this._requestMatchesCount(),
  4428. rawQuery: (_this$_state$query = (_this$_state2 = this._state) === null || _this$_state2 === void 0 ? void 0 : _this$_state2.query) !== null && _this$_state$query !== void 0 ? _this$_state$query : null
  4429. });
  4430. }
  4431. }]);
  4432. return PDFFindController;
  4433. }();
  4434. exports.PDFFindController = PDFFindController;
  4435. /***/ }),
  4436. /* 16 */
  4437. /***/ ((__unused_webpack_module, exports) => {
  4438. Object.defineProperty(exports, "__esModule", ({
  4439. value: true
  4440. }));
  4441. exports.getCharacterType = getCharacterType;
  4442. exports.CharacterType = void 0;
  4443. var CharacterType = {
  4444. SPACE: 0,
  4445. ALPHA_LETTER: 1,
  4446. PUNCT: 2,
  4447. HAN_LETTER: 3,
  4448. KATAKANA_LETTER: 4,
  4449. HIRAGANA_LETTER: 5,
  4450. HALFWIDTH_KATAKANA_LETTER: 6,
  4451. THAI_LETTER: 7
  4452. };
  4453. exports.CharacterType = CharacterType;
  4454. function isAlphabeticalScript(charCode) {
  4455. return charCode < 0x2e80;
  4456. }
  4457. function isAscii(charCode) {
  4458. return (charCode & 0xff80) === 0;
  4459. }
  4460. function isAsciiAlpha(charCode) {
  4461. return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a;
  4462. }
  4463. function isAsciiDigit(charCode) {
  4464. return charCode >= 0x30 && charCode <= 0x39;
  4465. }
  4466. function isAsciiSpace(charCode) {
  4467. return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a;
  4468. }
  4469. function isHan(charCode) {
  4470. return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff;
  4471. }
  4472. function isKatakana(charCode) {
  4473. return charCode >= 0x30a0 && charCode <= 0x30ff;
  4474. }
  4475. function isHiragana(charCode) {
  4476. return charCode >= 0x3040 && charCode <= 0x309f;
  4477. }
  4478. function isHalfwidthKatakana(charCode) {
  4479. return charCode >= 0xff60 && charCode <= 0xff9f;
  4480. }
  4481. function isThai(charCode) {
  4482. return (charCode & 0xff80) === 0x0e00;
  4483. }
  4484. function getCharacterType(charCode) {
  4485. if (isAlphabeticalScript(charCode)) {
  4486. if (isAscii(charCode)) {
  4487. if (isAsciiSpace(charCode)) {
  4488. return CharacterType.SPACE;
  4489. } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) {
  4490. return CharacterType.ALPHA_LETTER;
  4491. }
  4492. return CharacterType.PUNCT;
  4493. } else if (isThai(charCode)) {
  4494. return CharacterType.THAI_LETTER;
  4495. } else if (charCode === 0xa0) {
  4496. return CharacterType.SPACE;
  4497. }
  4498. return CharacterType.ALPHA_LETTER;
  4499. }
  4500. if (isHan(charCode)) {
  4501. return CharacterType.HAN_LETTER;
  4502. } else if (isKatakana(charCode)) {
  4503. return CharacterType.KATAKANA_LETTER;
  4504. } else if (isHiragana(charCode)) {
  4505. return CharacterType.HIRAGANA_LETTER;
  4506. } else if (isHalfwidthKatakana(charCode)) {
  4507. return CharacterType.HALFWIDTH_KATAKANA_LETTER;
  4508. }
  4509. return CharacterType.ALPHA_LETTER;
  4510. }
  4511. /***/ }),
  4512. /* 17 */
  4513. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4514. Object.defineProperty(exports, "__esModule", ({
  4515. value: true
  4516. }));
  4517. exports.isDestArraysEqual = isDestArraysEqual;
  4518. exports.isDestHashesEqual = isDestHashesEqual;
  4519. exports.PDFHistory = void 0;
  4520. var _ui_utils = __w_pdfjs_require__(7);
  4521. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4522. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  4523. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  4524. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  4525. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  4526. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  4527. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  4528. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4529. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4530. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4531. var HASH_CHANGE_TIMEOUT = 1000;
  4532. var POSITION_UPDATED_THRESHOLD = 50;
  4533. var UPDATE_VIEWAREA_TIMEOUT = 1000;
  4534. function getCurrentHash() {
  4535. return document.location.hash;
  4536. }
  4537. var PDFHistory = /*#__PURE__*/function () {
  4538. function PDFHistory(_ref) {
  4539. var _this = this;
  4540. var linkService = _ref.linkService,
  4541. eventBus = _ref.eventBus;
  4542. _classCallCheck(this, PDFHistory);
  4543. this.linkService = linkService;
  4544. this.eventBus = eventBus;
  4545. this._initialized = false;
  4546. this._fingerprint = "";
  4547. this.reset();
  4548. this._boundEvents = null;
  4549. this._isViewerInPresentationMode = false;
  4550. this.eventBus._on("presentationmodechanged", function (evt) {
  4551. _this._isViewerInPresentationMode = evt.state !== _ui_utils.PresentationModeState.NORMAL;
  4552. });
  4553. this.eventBus._on("pagesinit", function () {
  4554. _this._isPagesLoaded = false;
  4555. _this.eventBus._on("pagesloaded", function (evt) {
  4556. _this._isPagesLoaded = !!evt.pagesCount;
  4557. }, {
  4558. once: true
  4559. });
  4560. });
  4561. }
  4562. _createClass(PDFHistory, [{
  4563. key: "initialize",
  4564. value: function initialize(_ref2) {
  4565. var fingerprint = _ref2.fingerprint,
  4566. _ref2$resetHistory = _ref2.resetHistory,
  4567. resetHistory = _ref2$resetHistory === void 0 ? false : _ref2$resetHistory,
  4568. _ref2$updateUrl = _ref2.updateUrl,
  4569. updateUrl = _ref2$updateUrl === void 0 ? false : _ref2$updateUrl;
  4570. if (!fingerprint || typeof fingerprint !== "string") {
  4571. console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');
  4572. return;
  4573. }
  4574. if (this._initialized) {
  4575. this.reset();
  4576. }
  4577. var reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;
  4578. this._fingerprint = fingerprint;
  4579. this._updateUrl = updateUrl === true;
  4580. this._initialized = true;
  4581. this._bindEvents();
  4582. var state = window.history.state;
  4583. this._popStateInProgress = false;
  4584. this._blockHashChange = 0;
  4585. this._currentHash = getCurrentHash();
  4586. this._numPositionUpdates = 0;
  4587. this._uid = this._maxUid = 0;
  4588. this._destination = null;
  4589. this._position = null;
  4590. if (!this._isValidState(state, true) || resetHistory) {
  4591. var _this$_parseCurrentHa = this._parseCurrentHash(true),
  4592. hash = _this$_parseCurrentHa.hash,
  4593. page = _this$_parseCurrentHa.page,
  4594. rotation = _this$_parseCurrentHa.rotation;
  4595. if (!hash || reInitialized || resetHistory) {
  4596. this._pushOrReplaceState(null, true);
  4597. return;
  4598. }
  4599. this._pushOrReplaceState({
  4600. hash: hash,
  4601. page: page,
  4602. rotation: rotation
  4603. }, true);
  4604. return;
  4605. }
  4606. var destination = state.destination;
  4607. this._updateInternalState(destination, state.uid, true);
  4608. if (destination.rotation !== undefined) {
  4609. this._initialRotation = destination.rotation;
  4610. }
  4611. if (destination.dest) {
  4612. this._initialBookmark = JSON.stringify(destination.dest);
  4613. this._destination.page = null;
  4614. } else if (destination.hash) {
  4615. this._initialBookmark = destination.hash;
  4616. } else if (destination.page) {
  4617. this._initialBookmark = "page=".concat(destination.page);
  4618. }
  4619. }
  4620. }, {
  4621. key: "reset",
  4622. value: function reset() {
  4623. if (this._initialized) {
  4624. this._pageHide();
  4625. this._initialized = false;
  4626. this._unbindEvents();
  4627. }
  4628. if (this._updateViewareaTimeout) {
  4629. clearTimeout(this._updateViewareaTimeout);
  4630. this._updateViewareaTimeout = null;
  4631. }
  4632. this._initialBookmark = null;
  4633. this._initialRotation = null;
  4634. }
  4635. }, {
  4636. key: "push",
  4637. value: function push(_ref3) {
  4638. var _this2 = this;
  4639. var _ref3$namedDest = _ref3.namedDest,
  4640. namedDest = _ref3$namedDest === void 0 ? null : _ref3$namedDest,
  4641. explicitDest = _ref3.explicitDest,
  4642. pageNumber = _ref3.pageNumber;
  4643. if (!this._initialized) {
  4644. return;
  4645. }
  4646. if (namedDest && typeof namedDest !== "string") {
  4647. console.error("PDFHistory.push: " + "\"".concat(namedDest, "\" is not a valid namedDest parameter."));
  4648. return;
  4649. } else if (!Array.isArray(explicitDest)) {
  4650. console.error("PDFHistory.push: " + "\"".concat(explicitDest, "\" is not a valid explicitDest parameter."));
  4651. return;
  4652. } else if (!this._isValidPage(pageNumber)) {
  4653. if (pageNumber !== null || this._destination) {
  4654. console.error("PDFHistory.push: " + "\"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  4655. return;
  4656. }
  4657. }
  4658. var hash = namedDest || JSON.stringify(explicitDest);
  4659. if (!hash) {
  4660. return;
  4661. }
  4662. var forceReplace = false;
  4663. if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
  4664. if (this._destination.page) {
  4665. return;
  4666. }
  4667. forceReplace = true;
  4668. }
  4669. if (this._popStateInProgress && !forceReplace) {
  4670. return;
  4671. }
  4672. this._pushOrReplaceState({
  4673. dest: explicitDest,
  4674. hash: hash,
  4675. page: pageNumber,
  4676. rotation: this.linkService.rotation
  4677. }, forceReplace);
  4678. if (!this._popStateInProgress) {
  4679. this._popStateInProgress = true;
  4680. Promise.resolve().then(function () {
  4681. _this2._popStateInProgress = false;
  4682. });
  4683. }
  4684. }
  4685. }, {
  4686. key: "pushPage",
  4687. value: function pushPage(pageNumber) {
  4688. var _this$_destination,
  4689. _this3 = this;
  4690. if (!this._initialized) {
  4691. return;
  4692. }
  4693. if (!this._isValidPage(pageNumber)) {
  4694. console.error("PDFHistory.pushPage: \"".concat(pageNumber, "\" is not a valid page number."));
  4695. return;
  4696. }
  4697. if (((_this$_destination = this._destination) === null || _this$_destination === void 0 ? void 0 : _this$_destination.page) === pageNumber) {
  4698. return;
  4699. }
  4700. if (this._popStateInProgress) {
  4701. return;
  4702. }
  4703. this._pushOrReplaceState({
  4704. dest: null,
  4705. hash: "page=".concat(pageNumber),
  4706. page: pageNumber,
  4707. rotation: this.linkService.rotation
  4708. });
  4709. if (!this._popStateInProgress) {
  4710. this._popStateInProgress = true;
  4711. Promise.resolve().then(function () {
  4712. _this3._popStateInProgress = false;
  4713. });
  4714. }
  4715. }
  4716. }, {
  4717. key: "pushCurrentPosition",
  4718. value: function pushCurrentPosition() {
  4719. if (!this._initialized || this._popStateInProgress) {
  4720. return;
  4721. }
  4722. this._tryPushCurrentPosition();
  4723. }
  4724. }, {
  4725. key: "back",
  4726. value: function back() {
  4727. if (!this._initialized || this._popStateInProgress) {
  4728. return;
  4729. }
  4730. var state = window.history.state;
  4731. if (this._isValidState(state) && state.uid > 0) {
  4732. window.history.back();
  4733. }
  4734. }
  4735. }, {
  4736. key: "forward",
  4737. value: function forward() {
  4738. if (!this._initialized || this._popStateInProgress) {
  4739. return;
  4740. }
  4741. var state = window.history.state;
  4742. if (this._isValidState(state) && state.uid < this._maxUid) {
  4743. window.history.forward();
  4744. }
  4745. }
  4746. }, {
  4747. key: "popStateInProgress",
  4748. get: function get() {
  4749. return this._initialized && (this._popStateInProgress || this._blockHashChange > 0);
  4750. }
  4751. }, {
  4752. key: "initialBookmark",
  4753. get: function get() {
  4754. return this._initialized ? this._initialBookmark : null;
  4755. }
  4756. }, {
  4757. key: "initialRotation",
  4758. get: function get() {
  4759. return this._initialized ? this._initialRotation : null;
  4760. }
  4761. }, {
  4762. key: "_pushOrReplaceState",
  4763. value: function _pushOrReplaceState(destination) {
  4764. var forceReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4765. var shouldReplace = forceReplace || !this._destination;
  4766. var newState = {
  4767. fingerprint: this._fingerprint,
  4768. uid: shouldReplace ? this._uid : this._uid + 1,
  4769. destination: destination
  4770. };
  4771. this._updateInternalState(destination, newState.uid);
  4772. var newUrl;
  4773. if (this._updateUrl && destination !== null && destination !== void 0 && destination.hash) {
  4774. var baseUrl = document.location.href.split("#")[0];
  4775. if (!baseUrl.startsWith("file://")) {
  4776. newUrl = "".concat(baseUrl, "#").concat(destination.hash);
  4777. }
  4778. }
  4779. if (shouldReplace) {
  4780. window.history.replaceState(newState, "", newUrl);
  4781. } else {
  4782. window.history.pushState(newState, "", newUrl);
  4783. }
  4784. }
  4785. }, {
  4786. key: "_tryPushCurrentPosition",
  4787. value: function _tryPushCurrentPosition() {
  4788. var temporary = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4789. if (!this._position) {
  4790. return;
  4791. }
  4792. var position = this._position;
  4793. if (temporary) {
  4794. position = Object.assign(Object.create(null), this._position);
  4795. position.temporary = true;
  4796. }
  4797. if (!this._destination) {
  4798. this._pushOrReplaceState(position);
  4799. return;
  4800. }
  4801. if (this._destination.temporary) {
  4802. this._pushOrReplaceState(position, true);
  4803. return;
  4804. }
  4805. if (this._destination.hash === position.hash) {
  4806. return;
  4807. }
  4808. if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {
  4809. return;
  4810. }
  4811. var forceReplace = false;
  4812. if (this._destination.page >= position.first && this._destination.page <= position.page) {
  4813. if (this._destination.dest !== undefined || !this._destination.first) {
  4814. return;
  4815. }
  4816. forceReplace = true;
  4817. }
  4818. this._pushOrReplaceState(position, forceReplace);
  4819. }
  4820. }, {
  4821. key: "_isValidPage",
  4822. value: function _isValidPage(val) {
  4823. return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount;
  4824. }
  4825. }, {
  4826. key: "_isValidState",
  4827. value: function _isValidState(state) {
  4828. var checkReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4829. if (!state) {
  4830. return false;
  4831. }
  4832. if (state.fingerprint !== this._fingerprint) {
  4833. if (checkReload) {
  4834. if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) {
  4835. return false;
  4836. }
  4837. var _performance$getEntri = performance.getEntriesByType("navigation"),
  4838. _performance$getEntri2 = _slicedToArray(_performance$getEntri, 1),
  4839. perfEntry = _performance$getEntri2[0];
  4840. if ((perfEntry === null || perfEntry === void 0 ? void 0 : perfEntry.type) !== "reload") {
  4841. return false;
  4842. }
  4843. } else {
  4844. return false;
  4845. }
  4846. }
  4847. if (!Number.isInteger(state.uid) || state.uid < 0) {
  4848. return false;
  4849. }
  4850. if (state.destination === null || _typeof(state.destination) !== "object") {
  4851. return false;
  4852. }
  4853. return true;
  4854. }
  4855. }, {
  4856. key: "_updateInternalState",
  4857. value: function _updateInternalState(destination, uid) {
  4858. var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  4859. if (this._updateViewareaTimeout) {
  4860. clearTimeout(this._updateViewareaTimeout);
  4861. this._updateViewareaTimeout = null;
  4862. }
  4863. if (removeTemporary && destination !== null && destination !== void 0 && destination.temporary) {
  4864. delete destination.temporary;
  4865. }
  4866. this._destination = destination;
  4867. this._uid = uid;
  4868. this._maxUid = Math.max(this._maxUid, uid);
  4869. this._numPositionUpdates = 0;
  4870. }
  4871. }, {
  4872. key: "_parseCurrentHash",
  4873. value: function _parseCurrentHash() {
  4874. var checkNameddest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4875. var hash = unescape(getCurrentHash()).substring(1);
  4876. var params = (0, _ui_utils.parseQueryString)(hash);
  4877. var nameddest = params.get("nameddest") || "";
  4878. var page = params.get("page") | 0;
  4879. if (!this._isValidPage(page) || checkNameddest && nameddest.length > 0) {
  4880. page = null;
  4881. }
  4882. return {
  4883. hash: hash,
  4884. page: page,
  4885. rotation: this.linkService.rotation
  4886. };
  4887. }
  4888. }, {
  4889. key: "_updateViewarea",
  4890. value: function _updateViewarea(_ref4) {
  4891. var _this4 = this;
  4892. var location = _ref4.location;
  4893. if (this._updateViewareaTimeout) {
  4894. clearTimeout(this._updateViewareaTimeout);
  4895. this._updateViewareaTimeout = null;
  4896. }
  4897. this._position = {
  4898. hash: this._isViewerInPresentationMode ? "page=".concat(location.pageNumber) : location.pdfOpenParams.substring(1),
  4899. page: this.linkService.page,
  4900. first: location.pageNumber,
  4901. rotation: location.rotation
  4902. };
  4903. if (this._popStateInProgress) {
  4904. return;
  4905. }
  4906. if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) {
  4907. this._numPositionUpdates++;
  4908. }
  4909. if (UPDATE_VIEWAREA_TIMEOUT > 0) {
  4910. this._updateViewareaTimeout = setTimeout(function () {
  4911. if (!_this4._popStateInProgress) {
  4912. _this4._tryPushCurrentPosition(true);
  4913. }
  4914. _this4._updateViewareaTimeout = null;
  4915. }, UPDATE_VIEWAREA_TIMEOUT);
  4916. }
  4917. }
  4918. }, {
  4919. key: "_popState",
  4920. value: function _popState(_ref5) {
  4921. var _this5 = this;
  4922. var state = _ref5.state;
  4923. var newHash = getCurrentHash(),
  4924. hashChanged = this._currentHash !== newHash;
  4925. this._currentHash = newHash;
  4926. if (!state) {
  4927. this._uid++;
  4928. var _this$_parseCurrentHa2 = this._parseCurrentHash(),
  4929. hash = _this$_parseCurrentHa2.hash,
  4930. page = _this$_parseCurrentHa2.page,
  4931. rotation = _this$_parseCurrentHa2.rotation;
  4932. this._pushOrReplaceState({
  4933. hash: hash,
  4934. page: page,
  4935. rotation: rotation
  4936. }, true);
  4937. return;
  4938. }
  4939. if (!this._isValidState(state)) {
  4940. return;
  4941. }
  4942. this._popStateInProgress = true;
  4943. if (hashChanged) {
  4944. this._blockHashChange++;
  4945. (0, _ui_utils.waitOnEventOrTimeout)({
  4946. target: window,
  4947. name: "hashchange",
  4948. delay: HASH_CHANGE_TIMEOUT
  4949. }).then(function () {
  4950. _this5._blockHashChange--;
  4951. });
  4952. }
  4953. var destination = state.destination;
  4954. this._updateInternalState(destination, state.uid, true);
  4955. if ((0, _ui_utils.isValidRotation)(destination.rotation)) {
  4956. this.linkService.rotation = destination.rotation;
  4957. }
  4958. if (destination.dest) {
  4959. this.linkService.goToDestination(destination.dest);
  4960. } else if (destination.hash) {
  4961. this.linkService.setHash(destination.hash);
  4962. } else if (destination.page) {
  4963. this.linkService.page = destination.page;
  4964. }
  4965. Promise.resolve().then(function () {
  4966. _this5._popStateInProgress = false;
  4967. });
  4968. }
  4969. }, {
  4970. key: "_pageHide",
  4971. value: function _pageHide() {
  4972. if (!this._destination || this._destination.temporary) {
  4973. this._tryPushCurrentPosition();
  4974. }
  4975. }
  4976. }, {
  4977. key: "_bindEvents",
  4978. value: function _bindEvents() {
  4979. if (this._boundEvents) {
  4980. return;
  4981. }
  4982. this._boundEvents = {
  4983. updateViewarea: this._updateViewarea.bind(this),
  4984. popState: this._popState.bind(this),
  4985. pageHide: this._pageHide.bind(this)
  4986. };
  4987. this.eventBus._on("updateviewarea", this._boundEvents.updateViewarea);
  4988. window.addEventListener("popstate", this._boundEvents.popState);
  4989. window.addEventListener("pagehide", this._boundEvents.pageHide);
  4990. }
  4991. }, {
  4992. key: "_unbindEvents",
  4993. value: function _unbindEvents() {
  4994. if (!this._boundEvents) {
  4995. return;
  4996. }
  4997. this.eventBus._off("updateviewarea", this._boundEvents.updateViewarea);
  4998. window.removeEventListener("popstate", this._boundEvents.popState);
  4999. window.removeEventListener("pagehide", this._boundEvents.pageHide);
  5000. this._boundEvents = null;
  5001. }
  5002. }]);
  5003. return PDFHistory;
  5004. }();
  5005. exports.PDFHistory = PDFHistory;
  5006. function isDestHashesEqual(destHash, pushHash) {
  5007. if (typeof destHash !== "string" || typeof pushHash !== "string") {
  5008. return false;
  5009. }
  5010. if (destHash === pushHash) {
  5011. return true;
  5012. }
  5013. var nameddest = (0, _ui_utils.parseQueryString)(destHash).get("nameddest");
  5014. if (nameddest === pushHash) {
  5015. return true;
  5016. }
  5017. return false;
  5018. }
  5019. function isDestArraysEqual(firstDest, secondDest) {
  5020. function isEntryEqual(first, second) {
  5021. if (_typeof(first) !== _typeof(second)) {
  5022. return false;
  5023. }
  5024. if (Array.isArray(first) || Array.isArray(second)) {
  5025. return false;
  5026. }
  5027. if (first !== null && _typeof(first) === "object" && second !== null) {
  5028. if (Object.keys(first).length !== Object.keys(second).length) {
  5029. return false;
  5030. }
  5031. for (var key in first) {
  5032. if (!isEntryEqual(first[key], second[key])) {
  5033. return false;
  5034. }
  5035. }
  5036. return true;
  5037. }
  5038. return first === second || Number.isNaN(first) && Number.isNaN(second);
  5039. }
  5040. if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {
  5041. return false;
  5042. }
  5043. if (firstDest.length !== secondDest.length) {
  5044. return false;
  5045. }
  5046. for (var i = 0, ii = firstDest.length; i < ii; i++) {
  5047. if (!isEntryEqual(firstDest[i], secondDest[i])) {
  5048. return false;
  5049. }
  5050. }
  5051. return true;
  5052. }
  5053. /***/ }),
  5054. /* 18 */
  5055. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5056. Object.defineProperty(exports, "__esModule", ({
  5057. value: true
  5058. }));
  5059. exports.PDFPageView = void 0;
  5060. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  5061. var _pdfjsLib = __w_pdfjs_require__(4);
  5062. var _ui_utils = __w_pdfjs_require__(7);
  5063. var _app_options = __w_pdfjs_require__(12);
  5064. var _l10n_utils = __w_pdfjs_require__(5);
  5065. var _pdf_rendering_queue = __w_pdfjs_require__(19);
  5066. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5067. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  5068. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  5069. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  5070. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  5071. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  5072. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  5073. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5074. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5075. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5076. var MAX_CANVAS_PIXELS = _app_options.compatibilityParams.maxCanvasPixels || 16777216;
  5077. var PDFPageView = /*#__PURE__*/function () {
  5078. function PDFPageView(options) {
  5079. var _options$textLayerMod, _options$annotationMo, _options$textHighligh, _this$renderingQueue;
  5080. _classCallCheck(this, PDFPageView);
  5081. var container = options.container;
  5082. var defaultViewport = options.defaultViewport;
  5083. this.id = options.id;
  5084. this.renderingId = "page" + this.id;
  5085. this.pdfPage = null;
  5086. this.pageLabel = null;
  5087. this.rotation = 0;
  5088. this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
  5089. this.viewport = defaultViewport;
  5090. this.pdfPageRotate = defaultViewport.rotation;
  5091. this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
  5092. this.hasRestrictedScaling = false;
  5093. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  5094. this._annotationMode = (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS;
  5095. this.imageResourcesPath = options.imageResourcesPath || "";
  5096. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  5097. this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
  5098. this.eventBus = options.eventBus;
  5099. this.renderingQueue = options.renderingQueue;
  5100. this.textLayerFactory = options.textLayerFactory;
  5101. this.annotationLayerFactory = options.annotationLayerFactory;
  5102. this.xfaLayerFactory = options.xfaLayerFactory;
  5103. this.textHighlighter = (_options$textHighligh = options.textHighlighterFactory) === null || _options$textHighligh === void 0 ? void 0 : _options$textHighligh.createTextHighlighter(this.id - 1, this.eventBus);
  5104. this.structTreeLayerFactory = options.structTreeLayerFactory;
  5105. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  5106. this.l10n = options.l10n || _l10n_utils.NullL10n;
  5107. this.paintTask = null;
  5108. this.paintedViewportMap = new WeakMap();
  5109. this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
  5110. this.resume = null;
  5111. this._renderError = null;
  5112. this._isStandalone = !((_this$renderingQueue = this.renderingQueue) !== null && _this$renderingQueue !== void 0 && _this$renderingQueue.hasViewer());
  5113. this.annotationLayer = null;
  5114. this.textLayer = null;
  5115. this.zoomLayer = null;
  5116. this.xfaLayer = null;
  5117. this.structTreeLayer = null;
  5118. var div = document.createElement("div");
  5119. div.className = "page";
  5120. div.style.width = Math.floor(this.viewport.width) + "px";
  5121. div.style.height = Math.floor(this.viewport.height) + "px";
  5122. div.setAttribute("data-page-number", this.id);
  5123. div.setAttribute("role", "region");
  5124. this.l10n.get("page_landmark", {
  5125. page: this.id
  5126. }).then(function (msg) {
  5127. div.setAttribute("aria-label", msg);
  5128. });
  5129. this.div = div;
  5130. container.appendChild(div);
  5131. }
  5132. _createClass(PDFPageView, [{
  5133. key: "setPdfPage",
  5134. value: function setPdfPage(pdfPage) {
  5135. this.pdfPage = pdfPage;
  5136. this.pdfPageRotate = pdfPage.rotate;
  5137. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  5138. this.viewport = pdfPage.getViewport({
  5139. scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
  5140. rotation: totalRotation
  5141. });
  5142. this.reset();
  5143. }
  5144. }, {
  5145. key: "destroy",
  5146. value: function destroy() {
  5147. this.reset();
  5148. if (this.pdfPage) {
  5149. this.pdfPage.cleanup();
  5150. }
  5151. }
  5152. }, {
  5153. key: "_renderAnnotationLayer",
  5154. value: function () {
  5155. var _renderAnnotationLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  5156. var error;
  5157. return _regenerator["default"].wrap(function _callee$(_context) {
  5158. while (1) {
  5159. switch (_context.prev = _context.next) {
  5160. case 0:
  5161. error = null;
  5162. _context.prev = 1;
  5163. _context.next = 4;
  5164. return this.annotationLayer.render(this.viewport, "display");
  5165. case 4:
  5166. _context.next = 9;
  5167. break;
  5168. case 6:
  5169. _context.prev = 6;
  5170. _context.t0 = _context["catch"](1);
  5171. error = _context.t0;
  5172. case 9:
  5173. _context.prev = 9;
  5174. this.eventBus.dispatch("annotationlayerrendered", {
  5175. source: this,
  5176. pageNumber: this.id,
  5177. error: error
  5178. });
  5179. return _context.finish(9);
  5180. case 12:
  5181. case "end":
  5182. return _context.stop();
  5183. }
  5184. }
  5185. }, _callee, this, [[1, 6, 9, 12]]);
  5186. }));
  5187. function _renderAnnotationLayer() {
  5188. return _renderAnnotationLayer2.apply(this, arguments);
  5189. }
  5190. return _renderAnnotationLayer;
  5191. }()
  5192. }, {
  5193. key: "_renderXfaLayer",
  5194. value: function () {
  5195. var _renderXfaLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  5196. var error, result;
  5197. return _regenerator["default"].wrap(function _callee2$(_context2) {
  5198. while (1) {
  5199. switch (_context2.prev = _context2.next) {
  5200. case 0:
  5201. error = null;
  5202. _context2.prev = 1;
  5203. _context2.next = 4;
  5204. return this.xfaLayer.render(this.viewport, "display");
  5205. case 4:
  5206. result = _context2.sent;
  5207. if (this.textHighlighter) {
  5208. this._buildXfaTextContentItems(result.textDivs);
  5209. }
  5210. _context2.next = 11;
  5211. break;
  5212. case 8:
  5213. _context2.prev = 8;
  5214. _context2.t0 = _context2["catch"](1);
  5215. error = _context2.t0;
  5216. case 11:
  5217. _context2.prev = 11;
  5218. this.eventBus.dispatch("xfalayerrendered", {
  5219. source: this,
  5220. pageNumber: this.id,
  5221. error: error
  5222. });
  5223. return _context2.finish(11);
  5224. case 14:
  5225. case "end":
  5226. return _context2.stop();
  5227. }
  5228. }
  5229. }, _callee2, this, [[1, 8, 11, 14]]);
  5230. }));
  5231. function _renderXfaLayer() {
  5232. return _renderXfaLayer2.apply(this, arguments);
  5233. }
  5234. return _renderXfaLayer;
  5235. }()
  5236. }, {
  5237. key: "_buildXfaTextContentItems",
  5238. value: function () {
  5239. var _buildXfaTextContentItems2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(textDivs) {
  5240. var text, items, _iterator, _step, item;
  5241. return _regenerator["default"].wrap(function _callee3$(_context3) {
  5242. while (1) {
  5243. switch (_context3.prev = _context3.next) {
  5244. case 0:
  5245. _context3.next = 2;
  5246. return this.pdfPage.getTextContent();
  5247. case 2:
  5248. text = _context3.sent;
  5249. items = [];
  5250. _iterator = _createForOfIteratorHelper(text.items);
  5251. try {
  5252. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5253. item = _step.value;
  5254. items.push(item.str);
  5255. }
  5256. } catch (err) {
  5257. _iterator.e(err);
  5258. } finally {
  5259. _iterator.f();
  5260. }
  5261. this.textHighlighter.setTextMapping(textDivs, items);
  5262. this.textHighlighter.enable();
  5263. case 8:
  5264. case "end":
  5265. return _context3.stop();
  5266. }
  5267. }
  5268. }, _callee3, this);
  5269. }));
  5270. function _buildXfaTextContentItems(_x) {
  5271. return _buildXfaTextContentItems2.apply(this, arguments);
  5272. }
  5273. return _buildXfaTextContentItems;
  5274. }()
  5275. }, {
  5276. key: "_resetZoomLayer",
  5277. value: function _resetZoomLayer() {
  5278. var removeFromDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5279. if (!this.zoomLayer) {
  5280. return;
  5281. }
  5282. var zoomLayerCanvas = this.zoomLayer.firstChild;
  5283. this.paintedViewportMap["delete"](zoomLayerCanvas);
  5284. zoomLayerCanvas.width = 0;
  5285. zoomLayerCanvas.height = 0;
  5286. if (removeFromDOM) {
  5287. this.zoomLayer.remove();
  5288. }
  5289. this.zoomLayer = null;
  5290. }
  5291. }, {
  5292. key: "reset",
  5293. value: function reset() {
  5294. var _this$annotationLayer,
  5295. _this$xfaLayer,
  5296. _this = this;
  5297. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  5298. _ref$keepZoomLayer = _ref.keepZoomLayer,
  5299. keepZoomLayer = _ref$keepZoomLayer === void 0 ? false : _ref$keepZoomLayer,
  5300. _ref$keepAnnotationLa = _ref.keepAnnotationLayer,
  5301. keepAnnotationLayer = _ref$keepAnnotationLa === void 0 ? false : _ref$keepAnnotationLa,
  5302. _ref$keepXfaLayer = _ref.keepXfaLayer,
  5303. keepXfaLayer = _ref$keepXfaLayer === void 0 ? false : _ref$keepXfaLayer;
  5304. this.cancelRendering({
  5305. keepAnnotationLayer: keepAnnotationLayer,
  5306. keepXfaLayer: keepXfaLayer
  5307. });
  5308. this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
  5309. var div = this.div;
  5310. div.style.width = Math.floor(this.viewport.width) + "px";
  5311. div.style.height = Math.floor(this.viewport.height) + "px";
  5312. var childNodes = div.childNodes,
  5313. zoomLayerNode = keepZoomLayer && this.zoomLayer || null,
  5314. annotationLayerNode = keepAnnotationLayer && ((_this$annotationLayer = this.annotationLayer) === null || _this$annotationLayer === void 0 ? void 0 : _this$annotationLayer.div) || null,
  5315. xfaLayerNode = keepXfaLayer && ((_this$xfaLayer = this.xfaLayer) === null || _this$xfaLayer === void 0 ? void 0 : _this$xfaLayer.div) || null;
  5316. for (var i = childNodes.length - 1; i >= 0; i--) {
  5317. var node = childNodes[i];
  5318. switch (node) {
  5319. case zoomLayerNode:
  5320. case annotationLayerNode:
  5321. case xfaLayerNode:
  5322. continue;
  5323. }
  5324. div.removeChild(node);
  5325. }
  5326. div.removeAttribute("data-loaded");
  5327. if (annotationLayerNode) {
  5328. this.annotationLayer.hide();
  5329. }
  5330. if (xfaLayerNode) {
  5331. this.xfaLayer.hide();
  5332. }
  5333. if (!zoomLayerNode) {
  5334. if (this.canvas) {
  5335. this.paintedViewportMap["delete"](this.canvas);
  5336. this.canvas.width = 0;
  5337. this.canvas.height = 0;
  5338. delete this.canvas;
  5339. }
  5340. this._resetZoomLayer();
  5341. }
  5342. if (this.svg) {
  5343. this.paintedViewportMap["delete"](this.svg);
  5344. delete this.svg;
  5345. }
  5346. this.loadingIconDiv = document.createElement("div");
  5347. this.loadingIconDiv.className = "loadingIcon";
  5348. this.loadingIconDiv.setAttribute("role", "img");
  5349. this.l10n.get("loading").then(function (msg) {
  5350. var _this$loadingIconDiv;
  5351. (_this$loadingIconDiv = _this.loadingIconDiv) === null || _this$loadingIconDiv === void 0 ? void 0 : _this$loadingIconDiv.setAttribute("aria-label", msg);
  5352. });
  5353. div.appendChild(this.loadingIconDiv);
  5354. }
  5355. }, {
  5356. key: "update",
  5357. value: function update(_ref2) {
  5358. var _ref2$scale = _ref2.scale,
  5359. scale = _ref2$scale === void 0 ? 0 : _ref2$scale,
  5360. _ref2$rotation = _ref2.rotation,
  5361. rotation = _ref2$rotation === void 0 ? null : _ref2$rotation,
  5362. _ref2$optionalContent = _ref2.optionalContentConfigPromise,
  5363. optionalContentConfigPromise = _ref2$optionalContent === void 0 ? null : _ref2$optionalContent;
  5364. if (_typeof(arguments[0]) !== "object") {
  5365. console.error("PDFPageView.update called with separate parameters, please use an object instead.");
  5366. this.update({
  5367. scale: arguments[0],
  5368. rotation: arguments[1],
  5369. optionalContentConfigPromise: arguments[2]
  5370. });
  5371. return;
  5372. }
  5373. this.scale = scale || this.scale;
  5374. if (typeof rotation === "number") {
  5375. this.rotation = rotation;
  5376. }
  5377. if (optionalContentConfigPromise instanceof Promise) {
  5378. this._optionalContentConfigPromise = optionalContentConfigPromise;
  5379. }
  5380. if (this._isStandalone) {
  5381. var doc = document.documentElement;
  5382. doc.style.setProperty("--zoom-factor", this.scale);
  5383. }
  5384. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  5385. this.viewport = this.viewport.clone({
  5386. scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
  5387. rotation: totalRotation
  5388. });
  5389. if (this.svg) {
  5390. this.cssTransform({
  5391. target: this.svg,
  5392. redrawAnnotationLayer: true,
  5393. redrawXfaLayer: true
  5394. });
  5395. this.eventBus.dispatch("pagerendered", {
  5396. source: this,
  5397. pageNumber: this.id,
  5398. cssTransform: true,
  5399. timestamp: performance.now(),
  5400. error: this._renderError
  5401. });
  5402. return;
  5403. }
  5404. var isScalingRestricted = false;
  5405. if (this.canvas && this.maxCanvasPixels > 0) {
  5406. var outputScale = this.outputScale;
  5407. if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > this.maxCanvasPixels) {
  5408. isScalingRestricted = true;
  5409. }
  5410. }
  5411. if (this.canvas) {
  5412. if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
  5413. this.cssTransform({
  5414. target: this.canvas,
  5415. redrawAnnotationLayer: true,
  5416. redrawXfaLayer: true
  5417. });
  5418. this.eventBus.dispatch("pagerendered", {
  5419. source: this,
  5420. pageNumber: this.id,
  5421. cssTransform: true,
  5422. timestamp: performance.now(),
  5423. error: this._renderError
  5424. });
  5425. return;
  5426. }
  5427. if (!this.zoomLayer && !this.canvas.hidden) {
  5428. this.zoomLayer = this.canvas.parentNode;
  5429. this.zoomLayer.style.position = "absolute";
  5430. }
  5431. }
  5432. if (this.zoomLayer) {
  5433. this.cssTransform({
  5434. target: this.zoomLayer.firstChild
  5435. });
  5436. }
  5437. this.reset({
  5438. keepZoomLayer: true,
  5439. keepAnnotationLayer: true,
  5440. keepXfaLayer: true
  5441. });
  5442. }
  5443. }, {
  5444. key: "cancelRendering",
  5445. value: function cancelRendering() {
  5446. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  5447. _ref3$keepAnnotationL = _ref3.keepAnnotationLayer,
  5448. keepAnnotationLayer = _ref3$keepAnnotationL === void 0 ? false : _ref3$keepAnnotationL,
  5449. _ref3$keepXfaLayer = _ref3.keepXfaLayer,
  5450. keepXfaLayer = _ref3$keepXfaLayer === void 0 ? false : _ref3$keepXfaLayer;
  5451. if (this.paintTask) {
  5452. this.paintTask.cancel();
  5453. this.paintTask = null;
  5454. }
  5455. this.resume = null;
  5456. if (this.textLayer) {
  5457. this.textLayer.cancel();
  5458. this.textLayer = null;
  5459. }
  5460. if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
  5461. this.annotationLayer.cancel();
  5462. this.annotationLayer = null;
  5463. }
  5464. if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
  5465. var _this$textHighlighter;
  5466. this.xfaLayer.cancel();
  5467. this.xfaLayer = null;
  5468. (_this$textHighlighter = this.textHighlighter) === null || _this$textHighlighter === void 0 ? void 0 : _this$textHighlighter.disable();
  5469. }
  5470. if (this._onTextLayerRendered) {
  5471. this.eventBus._off("textlayerrendered", this._onTextLayerRendered);
  5472. this._onTextLayerRendered = null;
  5473. }
  5474. }
  5475. }, {
  5476. key: "cssTransform",
  5477. value: function cssTransform(_ref4) {
  5478. var target = _ref4.target,
  5479. _ref4$redrawAnnotatio = _ref4.redrawAnnotationLayer,
  5480. redrawAnnotationLayer = _ref4$redrawAnnotatio === void 0 ? false : _ref4$redrawAnnotatio,
  5481. _ref4$redrawXfaLayer = _ref4.redrawXfaLayer,
  5482. redrawXfaLayer = _ref4$redrawXfaLayer === void 0 ? false : _ref4$redrawXfaLayer;
  5483. var width = this.viewport.width;
  5484. var height = this.viewport.height;
  5485. var div = this.div;
  5486. target.style.width = target.parentNode.style.width = div.style.width = Math.floor(width) + "px";
  5487. target.style.height = target.parentNode.style.height = div.style.height = Math.floor(height) + "px";
  5488. var relativeRotation = this.viewport.rotation - this.paintedViewportMap.get(target).rotation;
  5489. var absRotation = Math.abs(relativeRotation);
  5490. var scaleX = 1,
  5491. scaleY = 1;
  5492. if (absRotation === 90 || absRotation === 270) {
  5493. scaleX = height / width;
  5494. scaleY = width / height;
  5495. }
  5496. target.style.transform = "rotate(".concat(relativeRotation, "deg) scale(").concat(scaleX, ", ").concat(scaleY, ")");
  5497. if (this.textLayer) {
  5498. var textLayerViewport = this.textLayer.viewport;
  5499. var textRelativeRotation = this.viewport.rotation - textLayerViewport.rotation;
  5500. var textAbsRotation = Math.abs(textRelativeRotation);
  5501. var scale = width / textLayerViewport.width;
  5502. if (textAbsRotation === 90 || textAbsRotation === 270) {
  5503. scale = width / textLayerViewport.height;
  5504. }
  5505. var textLayerDiv = this.textLayer.textLayerDiv;
  5506. var transX, transY;
  5507. switch (textAbsRotation) {
  5508. case 0:
  5509. transX = transY = 0;
  5510. break;
  5511. case 90:
  5512. transX = 0;
  5513. transY = "-" + textLayerDiv.style.height;
  5514. break;
  5515. case 180:
  5516. transX = "-" + textLayerDiv.style.width;
  5517. transY = "-" + textLayerDiv.style.height;
  5518. break;
  5519. case 270:
  5520. transX = "-" + textLayerDiv.style.width;
  5521. transY = 0;
  5522. break;
  5523. default:
  5524. console.error("Bad rotation value.");
  5525. break;
  5526. }
  5527. textLayerDiv.style.transform = "rotate(".concat(textAbsRotation, "deg) ") + "scale(".concat(scale, ") ") + "translate(".concat(transX, ", ").concat(transY, ")");
  5528. textLayerDiv.style.transformOrigin = "0% 0%";
  5529. }
  5530. if (redrawAnnotationLayer && this.annotationLayer) {
  5531. this._renderAnnotationLayer();
  5532. }
  5533. if (redrawXfaLayer && this.xfaLayer) {
  5534. this._renderXfaLayer();
  5535. }
  5536. }
  5537. }, {
  5538. key: "width",
  5539. get: function get() {
  5540. return this.viewport.width;
  5541. }
  5542. }, {
  5543. key: "height",
  5544. get: function get() {
  5545. return this.viewport.height;
  5546. }
  5547. }, {
  5548. key: "getPagePoint",
  5549. value: function getPagePoint(x, y) {
  5550. return this.viewport.convertToPdfPoint(x, y);
  5551. }
  5552. }, {
  5553. key: "draw",
  5554. value: function draw() {
  5555. var _this$annotationLayer2,
  5556. _this$xfaLayer2,
  5557. _this2 = this;
  5558. if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) {
  5559. console.error("Must be in new state before drawing");
  5560. this.reset();
  5561. }
  5562. var div = this.div,
  5563. pdfPage = this.pdfPage;
  5564. if (!pdfPage) {
  5565. this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
  5566. if (this.loadingIconDiv) {
  5567. div.removeChild(this.loadingIconDiv);
  5568. delete this.loadingIconDiv;
  5569. }
  5570. return Promise.reject(new Error("pdfPage is not loaded"));
  5571. }
  5572. this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING;
  5573. var canvasWrapper = document.createElement("div");
  5574. canvasWrapper.style.width = div.style.width;
  5575. canvasWrapper.style.height = div.style.height;
  5576. canvasWrapper.classList.add("canvasWrapper");
  5577. if ((_this$annotationLayer2 = this.annotationLayer) !== null && _this$annotationLayer2 !== void 0 && _this$annotationLayer2.div) {
  5578. div.insertBefore(canvasWrapper, this.annotationLayer.div);
  5579. } else {
  5580. div.appendChild(canvasWrapper);
  5581. }
  5582. var textLayer = null;
  5583. if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) {
  5584. var _this$annotationLayer3;
  5585. var textLayerDiv = document.createElement("div");
  5586. textLayerDiv.className = "textLayer";
  5587. textLayerDiv.style.width = canvasWrapper.style.width;
  5588. textLayerDiv.style.height = canvasWrapper.style.height;
  5589. if ((_this$annotationLayer3 = this.annotationLayer) !== null && _this$annotationLayer3 !== void 0 && _this$annotationLayer3.div) {
  5590. div.insertBefore(textLayerDiv, this.annotationLayer.div);
  5591. } else {
  5592. div.appendChild(textLayerDiv);
  5593. }
  5594. textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, this.eventBus, this.textHighlighter);
  5595. }
  5596. this.textLayer = textLayer;
  5597. if ((_this$xfaLayer2 = this.xfaLayer) !== null && _this$xfaLayer2 !== void 0 && _this$xfaLayer2.div) {
  5598. div.appendChild(this.xfaLayer.div);
  5599. }
  5600. var renderContinueCallback = null;
  5601. if (this.renderingQueue) {
  5602. renderContinueCallback = function renderContinueCallback(cont) {
  5603. if (!_this2.renderingQueue.isHighestPriority(_this2)) {
  5604. _this2.renderingState = _pdf_rendering_queue.RenderingStates.PAUSED;
  5605. _this2.resume = function () {
  5606. _this2.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING;
  5607. cont();
  5608. };
  5609. return;
  5610. }
  5611. cont();
  5612. };
  5613. }
  5614. var finishPaintTask = /*#__PURE__*/function () {
  5615. var _ref5 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  5616. var error,
  5617. _args4 = arguments;
  5618. return _regenerator["default"].wrap(function _callee4$(_context4) {
  5619. while (1) {
  5620. switch (_context4.prev = _context4.next) {
  5621. case 0:
  5622. error = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
  5623. if (paintTask === _this2.paintTask) {
  5624. _this2.paintTask = null;
  5625. }
  5626. if (!(error instanceof _pdfjsLib.RenderingCancelledException)) {
  5627. _context4.next = 5;
  5628. break;
  5629. }
  5630. _this2._renderError = null;
  5631. return _context4.abrupt("return");
  5632. case 5:
  5633. _this2._renderError = error;
  5634. _this2.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
  5635. if (_this2.loadingIconDiv) {
  5636. div.removeChild(_this2.loadingIconDiv);
  5637. delete _this2.loadingIconDiv;
  5638. }
  5639. _this2._resetZoomLayer(true);
  5640. _this2.eventBus.dispatch("pagerendered", {
  5641. source: _this2,
  5642. pageNumber: _this2.id,
  5643. cssTransform: false,
  5644. timestamp: performance.now(),
  5645. error: _this2._renderError
  5646. });
  5647. if (!error) {
  5648. _context4.next = 12;
  5649. break;
  5650. }
  5651. throw error;
  5652. case 12:
  5653. case "end":
  5654. return _context4.stop();
  5655. }
  5656. }
  5657. }, _callee4);
  5658. }));
  5659. return function finishPaintTask() {
  5660. return _ref5.apply(this, arguments);
  5661. };
  5662. }();
  5663. var paintTask = this.renderer === _ui_utils.RendererType.SVG ? this.paintOnSvg(canvasWrapper) : this.paintOnCanvas(canvasWrapper);
  5664. paintTask.onRenderContinue = renderContinueCallback;
  5665. this.paintTask = paintTask;
  5666. var resultPromise = paintTask.promise.then(function () {
  5667. return finishPaintTask(null).then(function () {
  5668. if (textLayer) {
  5669. var readableStream = pdfPage.streamTextContent({
  5670. normalizeWhitespace: true,
  5671. includeMarkedContent: true
  5672. });
  5673. textLayer.setTextContentStream(readableStream);
  5674. textLayer.render();
  5675. }
  5676. });
  5677. }, function (reason) {
  5678. return finishPaintTask(reason);
  5679. });
  5680. if (this._annotationMode !== _pdfjsLib.AnnotationMode.DISABLE && this.annotationLayerFactory) {
  5681. if (!this.annotationLayer) {
  5682. this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, this._annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS, this.l10n, null, null, null, null);
  5683. }
  5684. this._renderAnnotationLayer();
  5685. }
  5686. if (this.xfaLayerFactory) {
  5687. if (!this.xfaLayer) {
  5688. this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder(div, pdfPage, null);
  5689. }
  5690. this._renderXfaLayer();
  5691. }
  5692. if (this.structTreeLayerFactory && this.textLayer && this.canvas) {
  5693. this._onTextLayerRendered = function (event) {
  5694. if (event.pageNumber !== _this2.id) {
  5695. return;
  5696. }
  5697. _this2.eventBus._off("textlayerrendered", _this2._onTextLayerRendered);
  5698. _this2._onTextLayerRendered = null;
  5699. if (!_this2.canvas) {
  5700. return;
  5701. }
  5702. _this2.pdfPage.getStructTree().then(function (tree) {
  5703. if (!tree) {
  5704. return;
  5705. }
  5706. if (!_this2.canvas) {
  5707. return;
  5708. }
  5709. var treeDom = _this2.structTreeLayer.render(tree);
  5710. treeDom.classList.add("structTree");
  5711. _this2.canvas.appendChild(treeDom);
  5712. });
  5713. };
  5714. this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
  5715. this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);
  5716. }
  5717. div.setAttribute("data-loaded", true);
  5718. this.eventBus.dispatch("pagerender", {
  5719. source: this,
  5720. pageNumber: this.id
  5721. });
  5722. return resultPromise;
  5723. }
  5724. }, {
  5725. key: "paintOnCanvas",
  5726. value: function paintOnCanvas(canvasWrapper) {
  5727. var renderCapability = (0, _pdfjsLib.createPromiseCapability)();
  5728. var result = {
  5729. promise: renderCapability.promise,
  5730. onRenderContinue: function onRenderContinue(cont) {
  5731. cont();
  5732. },
  5733. cancel: function cancel() {
  5734. renderTask.cancel();
  5735. }
  5736. };
  5737. var viewport = this.viewport;
  5738. var canvas = document.createElement("canvas");
  5739. canvas.hidden = true;
  5740. var isCanvasHidden = true;
  5741. var showCanvas = function showCanvas() {
  5742. if (isCanvasHidden) {
  5743. canvas.hidden = false;
  5744. isCanvasHidden = false;
  5745. }
  5746. };
  5747. canvasWrapper.appendChild(canvas);
  5748. this.canvas = canvas;
  5749. canvas.mozOpaque = true;
  5750. var ctx = canvas.getContext("2d", {
  5751. alpha: false
  5752. });
  5753. var outputScale = (0, _ui_utils.getOutputScale)(ctx);
  5754. this.outputScale = outputScale;
  5755. if (this.useOnlyCssZoom) {
  5756. var actualSizeViewport = viewport.clone({
  5757. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  5758. });
  5759. outputScale.sx *= actualSizeViewport.width / viewport.width;
  5760. outputScale.sy *= actualSizeViewport.height / viewport.height;
  5761. outputScale.scaled = true;
  5762. }
  5763. if (this.maxCanvasPixels > 0) {
  5764. var pixelsInViewport = viewport.width * viewport.height;
  5765. var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
  5766. if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
  5767. outputScale.sx = maxScale;
  5768. outputScale.sy = maxScale;
  5769. outputScale.scaled = true;
  5770. this.hasRestrictedScaling = true;
  5771. } else {
  5772. this.hasRestrictedScaling = false;
  5773. }
  5774. }
  5775. var sfx = (0, _ui_utils.approximateFraction)(outputScale.sx);
  5776. var sfy = (0, _ui_utils.approximateFraction)(outputScale.sy);
  5777. canvas.width = (0, _ui_utils.roundToDivide)(viewport.width * outputScale.sx, sfx[0]);
  5778. canvas.height = (0, _ui_utils.roundToDivide)(viewport.height * outputScale.sy, sfy[0]);
  5779. canvas.style.width = (0, _ui_utils.roundToDivide)(viewport.width, sfx[1]) + "px";
  5780. canvas.style.height = (0, _ui_utils.roundToDivide)(viewport.height, sfy[1]) + "px";
  5781. this.paintedViewportMap.set(canvas, viewport);
  5782. var transform = !outputScale.scaled ? null : [outputScale.sx, 0, 0, outputScale.sy, 0, 0];
  5783. var renderContext = {
  5784. canvasContext: ctx,
  5785. transform: transform,
  5786. viewport: this.viewport,
  5787. annotationMode: this._annotationMode,
  5788. optionalContentConfigPromise: this._optionalContentConfigPromise
  5789. };
  5790. var renderTask = this.pdfPage.render(renderContext);
  5791. renderTask.onContinue = function (cont) {
  5792. showCanvas();
  5793. if (result.onRenderContinue) {
  5794. result.onRenderContinue(cont);
  5795. } else {
  5796. cont();
  5797. }
  5798. };
  5799. renderTask.promise.then(function () {
  5800. showCanvas();
  5801. renderCapability.resolve(undefined);
  5802. }, function (error) {
  5803. showCanvas();
  5804. renderCapability.reject(error);
  5805. });
  5806. return result;
  5807. }
  5808. }, {
  5809. key: "paintOnSvg",
  5810. value: function paintOnSvg(wrapper) {
  5811. var _this3 = this;
  5812. var cancelled = false;
  5813. var ensureNotCancelled = function ensureNotCancelled() {
  5814. if (cancelled) {
  5815. throw new _pdfjsLib.RenderingCancelledException("Rendering cancelled, page ".concat(_this3.id), "svg");
  5816. }
  5817. };
  5818. var pdfPage = this.pdfPage;
  5819. var actualSizeViewport = this.viewport.clone({
  5820. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  5821. });
  5822. var promise = pdfPage.getOperatorList({
  5823. annotationMode: this._annotationMode
  5824. }).then(function (opList) {
  5825. ensureNotCancelled();
  5826. var svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs, _app_options.compatibilityParams.disableCreateObjectURL);
  5827. return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) {
  5828. ensureNotCancelled();
  5829. _this3.svg = svg;
  5830. _this3.paintedViewportMap.set(svg, actualSizeViewport);
  5831. svg.style.width = wrapper.style.width;
  5832. svg.style.height = wrapper.style.height;
  5833. _this3.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
  5834. wrapper.appendChild(svg);
  5835. });
  5836. });
  5837. return {
  5838. promise: promise,
  5839. onRenderContinue: function onRenderContinue(cont) {
  5840. cont();
  5841. },
  5842. cancel: function cancel() {
  5843. cancelled = true;
  5844. }
  5845. };
  5846. }
  5847. }, {
  5848. key: "setPageLabel",
  5849. value: function setPageLabel(label) {
  5850. this.pageLabel = typeof label === "string" ? label : null;
  5851. if (this.pageLabel !== null) {
  5852. this.div.setAttribute("data-page-label", this.pageLabel);
  5853. } else {
  5854. this.div.removeAttribute("data-page-label");
  5855. }
  5856. }
  5857. }]);
  5858. return PDFPageView;
  5859. }();
  5860. exports.PDFPageView = PDFPageView;
  5861. /***/ }),
  5862. /* 19 */
  5863. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5864. Object.defineProperty(exports, "__esModule", ({
  5865. value: true
  5866. }));
  5867. exports.RenderingStates = exports.PDFRenderingQueue = void 0;
  5868. var _pdfjsLib = __w_pdfjs_require__(4);
  5869. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5870. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5871. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5872. var CLEANUP_TIMEOUT = 30000;
  5873. var RenderingStates = {
  5874. INITIAL: 0,
  5875. RUNNING: 1,
  5876. PAUSED: 2,
  5877. FINISHED: 3
  5878. };
  5879. exports.RenderingStates = RenderingStates;
  5880. var PDFRenderingQueue = /*#__PURE__*/function () {
  5881. function PDFRenderingQueue() {
  5882. _classCallCheck(this, PDFRenderingQueue);
  5883. this.pdfViewer = null;
  5884. this.pdfThumbnailViewer = null;
  5885. this.onIdle = null;
  5886. this.highestPriorityPage = null;
  5887. this.idleTimeout = null;
  5888. this.printing = false;
  5889. this.isThumbnailViewEnabled = false;
  5890. }
  5891. _createClass(PDFRenderingQueue, [{
  5892. key: "setViewer",
  5893. value: function setViewer(pdfViewer) {
  5894. this.pdfViewer = pdfViewer;
  5895. }
  5896. }, {
  5897. key: "setThumbnailViewer",
  5898. value: function setThumbnailViewer(pdfThumbnailViewer) {
  5899. this.pdfThumbnailViewer = pdfThumbnailViewer;
  5900. }
  5901. }, {
  5902. key: "isHighestPriority",
  5903. value: function isHighestPriority(view) {
  5904. return this.highestPriorityPage === view.renderingId;
  5905. }
  5906. }, {
  5907. key: "hasViewer",
  5908. value: function hasViewer() {
  5909. return !!this.pdfViewer;
  5910. }
  5911. }, {
  5912. key: "renderHighestPriority",
  5913. value: function renderHighestPriority(currentlyVisiblePages) {
  5914. if (this.idleTimeout) {
  5915. clearTimeout(this.idleTimeout);
  5916. this.idleTimeout = null;
  5917. }
  5918. if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
  5919. return;
  5920. }
  5921. if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) {
  5922. if (this.pdfThumbnailViewer.forceRendering()) {
  5923. return;
  5924. }
  5925. }
  5926. if (this.printing) {
  5927. return;
  5928. }
  5929. if (this.onIdle) {
  5930. this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
  5931. }
  5932. }
  5933. }, {
  5934. key: "getHighestPriority",
  5935. value: function getHighestPriority(visible, views, scrolledDown) {
  5936. var preRenderExtra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  5937. var visibleViews = visible.views;
  5938. var numVisible = visibleViews.length;
  5939. if (numVisible === 0) {
  5940. return null;
  5941. }
  5942. for (var i = 0; i < numVisible; ++i) {
  5943. var view = visibleViews[i].view;
  5944. if (!this.isViewFinished(view)) {
  5945. return view;
  5946. }
  5947. }
  5948. var preRenderIndex = scrolledDown ? visible.last.id : visible.first.id - 2;
  5949. var preRenderView = views[preRenderIndex];
  5950. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5951. return preRenderView;
  5952. }
  5953. if (preRenderExtra) {
  5954. preRenderIndex += scrolledDown ? 1 : -1;
  5955. preRenderView = views[preRenderIndex];
  5956. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5957. return preRenderView;
  5958. }
  5959. }
  5960. return null;
  5961. }
  5962. }, {
  5963. key: "isViewFinished",
  5964. value: function isViewFinished(view) {
  5965. return view.renderingState === RenderingStates.FINISHED;
  5966. }
  5967. }, {
  5968. key: "renderView",
  5969. value: function renderView(view) {
  5970. var _this = this;
  5971. switch (view.renderingState) {
  5972. case RenderingStates.FINISHED:
  5973. return false;
  5974. case RenderingStates.PAUSED:
  5975. this.highestPriorityPage = view.renderingId;
  5976. view.resume();
  5977. break;
  5978. case RenderingStates.RUNNING:
  5979. this.highestPriorityPage = view.renderingId;
  5980. break;
  5981. case RenderingStates.INITIAL:
  5982. this.highestPriorityPage = view.renderingId;
  5983. view.draw()["finally"](function () {
  5984. _this.renderHighestPriority();
  5985. })["catch"](function (reason) {
  5986. if (reason instanceof _pdfjsLib.RenderingCancelledException) {
  5987. return;
  5988. }
  5989. console.error("renderView: \"".concat(reason, "\""));
  5990. });
  5991. break;
  5992. }
  5993. return true;
  5994. }
  5995. }]);
  5996. return PDFRenderingQueue;
  5997. }();
  5998. exports.PDFRenderingQueue = PDFRenderingQueue;
  5999. /***/ }),
  6000. /* 20 */
  6001. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6002. Object.defineProperty(exports, "__esModule", ({
  6003. value: true
  6004. }));
  6005. exports.PDFScriptingManager = void 0;
  6006. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  6007. var _pdfjsLib = __w_pdfjs_require__(4);
  6008. var _ui_utils = __w_pdfjs_require__(7);
  6009. var _pdf_rendering_queue = __w_pdfjs_require__(19);
  6010. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6011. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  6012. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  6013. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  6014. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  6015. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  6016. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  6017. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  6018. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  6019. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  6020. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  6021. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  6022. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  6023. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  6024. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  6025. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  6026. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  6027. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6028. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6029. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6030. var PDFScriptingManager = /*#__PURE__*/function () {
  6031. function PDFScriptingManager(_ref) {
  6032. var _this = this;
  6033. var eventBus = _ref.eventBus,
  6034. _ref$sandboxBundleSrc = _ref.sandboxBundleSrc,
  6035. sandboxBundleSrc = _ref$sandboxBundleSrc === void 0 ? null : _ref$sandboxBundleSrc,
  6036. _ref$scriptingFactory = _ref.scriptingFactory,
  6037. scriptingFactory = _ref$scriptingFactory === void 0 ? null : _ref$scriptingFactory,
  6038. _ref$docPropertiesLoo = _ref.docPropertiesLookup,
  6039. docPropertiesLookup = _ref$docPropertiesLoo === void 0 ? null : _ref$docPropertiesLoo;
  6040. _classCallCheck(this, PDFScriptingManager);
  6041. this._pdfDocument = null;
  6042. this._pdfViewer = null;
  6043. this._closeCapability = null;
  6044. this._destroyCapability = null;
  6045. this._scripting = null;
  6046. this._mouseState = Object.create(null);
  6047. this._ready = false;
  6048. this._eventBus = eventBus;
  6049. this._sandboxBundleSrc = sandboxBundleSrc;
  6050. this._scriptingFactory = scriptingFactory;
  6051. this._docPropertiesLookup = docPropertiesLookup;
  6052. if (!this._scriptingFactory) {
  6053. window.addEventListener("updatefromsandbox", function (event) {
  6054. _this._eventBus.dispatch("updatefromsandbox", {
  6055. source: window,
  6056. detail: event.detail
  6057. });
  6058. });
  6059. }
  6060. }
  6061. _createClass(PDFScriptingManager, [{
  6062. key: "setViewer",
  6063. value: function setViewer(pdfViewer) {
  6064. this._pdfViewer = pdfViewer;
  6065. }
  6066. }, {
  6067. key: "setDocument",
  6068. value: function () {
  6069. var _setDocument = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pdfDocument) {
  6070. var _this2 = this,
  6071. _this$_scripting;
  6072. var _yield$Promise$all, _yield$Promise$all2, objects, calculationOrder, docActions, _iterator, _step, _step$value, name, listener, _iterator2, _step2, _step2$value, _name, _listener, docProperties;
  6073. return _regenerator["default"].wrap(function _callee2$(_context2) {
  6074. while (1) {
  6075. switch (_context2.prev = _context2.next) {
  6076. case 0:
  6077. if (!this._pdfDocument) {
  6078. _context2.next = 3;
  6079. break;
  6080. }
  6081. _context2.next = 3;
  6082. return this._destroyScripting();
  6083. case 3:
  6084. this._pdfDocument = pdfDocument;
  6085. if (pdfDocument) {
  6086. _context2.next = 6;
  6087. break;
  6088. }
  6089. return _context2.abrupt("return");
  6090. case 6:
  6091. _context2.next = 8;
  6092. return Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]);
  6093. case 8:
  6094. _yield$Promise$all = _context2.sent;
  6095. _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
  6096. objects = _yield$Promise$all2[0];
  6097. calculationOrder = _yield$Promise$all2[1];
  6098. docActions = _yield$Promise$all2[2];
  6099. if (!(!objects && !docActions)) {
  6100. _context2.next = 17;
  6101. break;
  6102. }
  6103. _context2.next = 16;
  6104. return this._destroyScripting();
  6105. case 16:
  6106. return _context2.abrupt("return");
  6107. case 17:
  6108. if (!(pdfDocument !== this._pdfDocument)) {
  6109. _context2.next = 19;
  6110. break;
  6111. }
  6112. return _context2.abrupt("return");
  6113. case 19:
  6114. _context2.prev = 19;
  6115. this._scripting = this._createScripting();
  6116. _context2.next = 29;
  6117. break;
  6118. case 23:
  6119. _context2.prev = 23;
  6120. _context2.t0 = _context2["catch"](19);
  6121. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message, "\"."));
  6122. _context2.next = 28;
  6123. return this._destroyScripting();
  6124. case 28:
  6125. return _context2.abrupt("return");
  6126. case 29:
  6127. this._internalEvents.set("updatefromsandbox", function (event) {
  6128. if ((event === null || event === void 0 ? void 0 : event.source) !== window) {
  6129. return;
  6130. }
  6131. _this2._updateFromSandbox(event.detail);
  6132. });
  6133. this._internalEvents.set("dispatcheventinsandbox", function (event) {
  6134. var _this2$_scripting;
  6135. (_this2$_scripting = _this2._scripting) === null || _this2$_scripting === void 0 ? void 0 : _this2$_scripting.dispatchEventInSandbox(event.detail);
  6136. });
  6137. this._internalEvents.set("pagechanging", function (_ref2) {
  6138. var pageNumber = _ref2.pageNumber,
  6139. previous = _ref2.previous;
  6140. if (pageNumber === previous) {
  6141. return;
  6142. }
  6143. _this2._dispatchPageClose(previous);
  6144. _this2._dispatchPageOpen(pageNumber);
  6145. });
  6146. this._internalEvents.set("pagerendered", function (_ref3) {
  6147. var pageNumber = _ref3.pageNumber;
  6148. if (!_this2._pageOpenPending.has(pageNumber)) {
  6149. return;
  6150. }
  6151. if (pageNumber !== _this2._pdfViewer.currentPageNumber) {
  6152. return;
  6153. }
  6154. _this2._dispatchPageOpen(pageNumber);
  6155. });
  6156. this._internalEvents.set("pagesdestroy", /*#__PURE__*/function () {
  6157. var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(event) {
  6158. var _this2$_scripting2, _this2$_closeCapabili;
  6159. return _regenerator["default"].wrap(function _callee$(_context) {
  6160. while (1) {
  6161. switch (_context.prev = _context.next) {
  6162. case 0:
  6163. _context.next = 2;
  6164. return _this2._dispatchPageClose(_this2._pdfViewer.currentPageNumber);
  6165. case 2:
  6166. _context.next = 4;
  6167. return (_this2$_scripting2 = _this2._scripting) === null || _this2$_scripting2 === void 0 ? void 0 : _this2$_scripting2.dispatchEventInSandbox({
  6168. id: "doc",
  6169. name: "WillClose"
  6170. });
  6171. case 4:
  6172. (_this2$_closeCapabili = _this2._closeCapability) === null || _this2$_closeCapabili === void 0 ? void 0 : _this2$_closeCapabili.resolve();
  6173. case 5:
  6174. case "end":
  6175. return _context.stop();
  6176. }
  6177. }
  6178. }, _callee);
  6179. }));
  6180. return function (_x2) {
  6181. return _ref4.apply(this, arguments);
  6182. };
  6183. }());
  6184. this._domEvents.set("mousedown", function (event) {
  6185. _this2._mouseState.isDown = true;
  6186. });
  6187. this._domEvents.set("mouseup", function (event) {
  6188. _this2._mouseState.isDown = false;
  6189. });
  6190. _iterator = _createForOfIteratorHelper(this._internalEvents);
  6191. try {
  6192. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  6193. _step$value = _slicedToArray(_step.value, 2), name = _step$value[0], listener = _step$value[1];
  6194. this._eventBus._on(name, listener);
  6195. }
  6196. } catch (err) {
  6197. _iterator.e(err);
  6198. } finally {
  6199. _iterator.f();
  6200. }
  6201. _iterator2 = _createForOfIteratorHelper(this._domEvents);
  6202. try {
  6203. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  6204. _step2$value = _slicedToArray(_step2.value, 2), _name = _step2$value[0], _listener = _step2$value[1];
  6205. window.addEventListener(_name, _listener);
  6206. }
  6207. } catch (err) {
  6208. _iterator2.e(err);
  6209. } finally {
  6210. _iterator2.f();
  6211. }
  6212. _context2.prev = 40;
  6213. _context2.next = 43;
  6214. return this._getDocProperties();
  6215. case 43:
  6216. docProperties = _context2.sent;
  6217. if (!(pdfDocument !== this._pdfDocument)) {
  6218. _context2.next = 46;
  6219. break;
  6220. }
  6221. return _context2.abrupt("return");
  6222. case 46:
  6223. _context2.next = 48;
  6224. return this._scripting.createSandbox({
  6225. objects: objects,
  6226. calculationOrder: calculationOrder,
  6227. appInfo: {
  6228. platform: navigator.platform,
  6229. language: navigator.language
  6230. },
  6231. docInfo: _objectSpread(_objectSpread({}, docProperties), {}, {
  6232. actions: docActions
  6233. })
  6234. });
  6235. case 48:
  6236. this._eventBus.dispatch("sandboxcreated", {
  6237. source: this
  6238. });
  6239. _context2.next = 57;
  6240. break;
  6241. case 51:
  6242. _context2.prev = 51;
  6243. _context2.t1 = _context2["catch"](40);
  6244. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t1 === null || _context2.t1 === void 0 ? void 0 : _context2.t1.message, "\"."));
  6245. _context2.next = 56;
  6246. return this._destroyScripting();
  6247. case 56:
  6248. return _context2.abrupt("return");
  6249. case 57:
  6250. _context2.next = 59;
  6251. return (_this$_scripting = this._scripting) === null || _this$_scripting === void 0 ? void 0 : _this$_scripting.dispatchEventInSandbox({
  6252. id: "doc",
  6253. name: "Open"
  6254. });
  6255. case 59:
  6256. _context2.next = 61;
  6257. return this._dispatchPageOpen(this._pdfViewer.currentPageNumber, true);
  6258. case 61:
  6259. Promise.resolve().then(function () {
  6260. if (pdfDocument === _this2._pdfDocument) {
  6261. _this2._ready = true;
  6262. }
  6263. });
  6264. case 62:
  6265. case "end":
  6266. return _context2.stop();
  6267. }
  6268. }
  6269. }, _callee2, this, [[19, 23], [40, 51]]);
  6270. }));
  6271. function setDocument(_x) {
  6272. return _setDocument.apply(this, arguments);
  6273. }
  6274. return setDocument;
  6275. }()
  6276. }, {
  6277. key: "dispatchWillSave",
  6278. value: function () {
  6279. var _dispatchWillSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(detail) {
  6280. var _this$_scripting2;
  6281. return _regenerator["default"].wrap(function _callee3$(_context3) {
  6282. while (1) {
  6283. switch (_context3.prev = _context3.next) {
  6284. case 0:
  6285. return _context3.abrupt("return", (_this$_scripting2 = this._scripting) === null || _this$_scripting2 === void 0 ? void 0 : _this$_scripting2.dispatchEventInSandbox({
  6286. id: "doc",
  6287. name: "WillSave"
  6288. }));
  6289. case 1:
  6290. case "end":
  6291. return _context3.stop();
  6292. }
  6293. }
  6294. }, _callee3, this);
  6295. }));
  6296. function dispatchWillSave(_x3) {
  6297. return _dispatchWillSave.apply(this, arguments);
  6298. }
  6299. return dispatchWillSave;
  6300. }()
  6301. }, {
  6302. key: "dispatchDidSave",
  6303. value: function () {
  6304. var _dispatchDidSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(detail) {
  6305. var _this$_scripting3;
  6306. return _regenerator["default"].wrap(function _callee4$(_context4) {
  6307. while (1) {
  6308. switch (_context4.prev = _context4.next) {
  6309. case 0:
  6310. return _context4.abrupt("return", (_this$_scripting3 = this._scripting) === null || _this$_scripting3 === void 0 ? void 0 : _this$_scripting3.dispatchEventInSandbox({
  6311. id: "doc",
  6312. name: "DidSave"
  6313. }));
  6314. case 1:
  6315. case "end":
  6316. return _context4.stop();
  6317. }
  6318. }
  6319. }, _callee4, this);
  6320. }));
  6321. function dispatchDidSave(_x4) {
  6322. return _dispatchDidSave.apply(this, arguments);
  6323. }
  6324. return dispatchDidSave;
  6325. }()
  6326. }, {
  6327. key: "dispatchWillPrint",
  6328. value: function () {
  6329. var _dispatchWillPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5(detail) {
  6330. var _this$_scripting4;
  6331. return _regenerator["default"].wrap(function _callee5$(_context5) {
  6332. while (1) {
  6333. switch (_context5.prev = _context5.next) {
  6334. case 0:
  6335. return _context5.abrupt("return", (_this$_scripting4 = this._scripting) === null || _this$_scripting4 === void 0 ? void 0 : _this$_scripting4.dispatchEventInSandbox({
  6336. id: "doc",
  6337. name: "WillPrint"
  6338. }));
  6339. case 1:
  6340. case "end":
  6341. return _context5.stop();
  6342. }
  6343. }
  6344. }, _callee5, this);
  6345. }));
  6346. function dispatchWillPrint(_x5) {
  6347. return _dispatchWillPrint.apply(this, arguments);
  6348. }
  6349. return dispatchWillPrint;
  6350. }()
  6351. }, {
  6352. key: "dispatchDidPrint",
  6353. value: function () {
  6354. var _dispatchDidPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6(detail) {
  6355. var _this$_scripting5;
  6356. return _regenerator["default"].wrap(function _callee6$(_context6) {
  6357. while (1) {
  6358. switch (_context6.prev = _context6.next) {
  6359. case 0:
  6360. return _context6.abrupt("return", (_this$_scripting5 = this._scripting) === null || _this$_scripting5 === void 0 ? void 0 : _this$_scripting5.dispatchEventInSandbox({
  6361. id: "doc",
  6362. name: "DidPrint"
  6363. }));
  6364. case 1:
  6365. case "end":
  6366. return _context6.stop();
  6367. }
  6368. }
  6369. }, _callee6, this);
  6370. }));
  6371. function dispatchDidPrint(_x6) {
  6372. return _dispatchDidPrint.apply(this, arguments);
  6373. }
  6374. return dispatchDidPrint;
  6375. }()
  6376. }, {
  6377. key: "mouseState",
  6378. get: function get() {
  6379. return this._mouseState;
  6380. }
  6381. }, {
  6382. key: "destroyPromise",
  6383. get: function get() {
  6384. var _this$_destroyCapabil;
  6385. return ((_this$_destroyCapabil = this._destroyCapability) === null || _this$_destroyCapabil === void 0 ? void 0 : _this$_destroyCapabil.promise) || null;
  6386. }
  6387. }, {
  6388. key: "ready",
  6389. get: function get() {
  6390. return this._ready;
  6391. }
  6392. }, {
  6393. key: "_internalEvents",
  6394. get: function get() {
  6395. return (0, _pdfjsLib.shadow)(this, "_internalEvents", new Map());
  6396. }
  6397. }, {
  6398. key: "_domEvents",
  6399. get: function get() {
  6400. return (0, _pdfjsLib.shadow)(this, "_domEvents", new Map());
  6401. }
  6402. }, {
  6403. key: "_pageOpenPending",
  6404. get: function get() {
  6405. return (0, _pdfjsLib.shadow)(this, "_pageOpenPending", new Set());
  6406. }
  6407. }, {
  6408. key: "_visitedPages",
  6409. get: function get() {
  6410. return (0, _pdfjsLib.shadow)(this, "_visitedPages", new Map());
  6411. }
  6412. }, {
  6413. key: "_updateFromSandbox",
  6414. value: function () {
  6415. var _updateFromSandbox2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee7(detail) {
  6416. var isInPresentationMode, id, siblings, command, value, ids, _iterator3, _step3, elementId, element, _this$_pdfDocument;
  6417. return _regenerator["default"].wrap(function _callee7$(_context7) {
  6418. while (1) {
  6419. switch (_context7.prev = _context7.next) {
  6420. case 0:
  6421. isInPresentationMode = this._pdfViewer.isInPresentationMode || this._pdfViewer.isChangingPresentationMode;
  6422. id = detail.id, siblings = detail.siblings, command = detail.command, value = detail.value;
  6423. if (id) {
  6424. _context7.next = 43;
  6425. break;
  6426. }
  6427. _context7.t0 = command;
  6428. _context7.next = _context7.t0 === "clear" ? 6 : _context7.t0 === "error" ? 8 : _context7.t0 === "layout" ? 10 : _context7.t0 === "page-num" ? 12 : _context7.t0 === "print" ? 14 : _context7.t0 === "println" ? 18 : _context7.t0 === "zoom" ? 20 : _context7.t0 === "SaveAs" ? 24 : _context7.t0 === "FirstPage" ? 26 : _context7.t0 === "LastPage" ? 28 : _context7.t0 === "NextPage" ? 30 : _context7.t0 === "PrevPage" ? 32 : _context7.t0 === "ZoomViewIn" ? 34 : _context7.t0 === "ZoomViewOut" ? 38 : 42;
  6429. break;
  6430. case 6:
  6431. console.clear();
  6432. return _context7.abrupt("break", 42);
  6433. case 8:
  6434. console.error(value);
  6435. return _context7.abrupt("break", 42);
  6436. case 10:
  6437. this._pdfViewer.spreadMode = (0, _ui_utils.apiPageLayoutToSpreadMode)(value);
  6438. return _context7.abrupt("break", 42);
  6439. case 12:
  6440. this._pdfViewer.currentPageNumber = value + 1;
  6441. return _context7.abrupt("break", 42);
  6442. case 14:
  6443. _context7.next = 16;
  6444. return this._pdfViewer.pagesPromise;
  6445. case 16:
  6446. this._eventBus.dispatch("print", {
  6447. source: this
  6448. });
  6449. return _context7.abrupt("break", 42);
  6450. case 18:
  6451. console.log(value);
  6452. return _context7.abrupt("break", 42);
  6453. case 20:
  6454. if (!isInPresentationMode) {
  6455. _context7.next = 22;
  6456. break;
  6457. }
  6458. return _context7.abrupt("return");
  6459. case 22:
  6460. this._pdfViewer.currentScaleValue = value;
  6461. return _context7.abrupt("break", 42);
  6462. case 24:
  6463. this._eventBus.dispatch("save", {
  6464. source: this
  6465. });
  6466. return _context7.abrupt("break", 42);
  6467. case 26:
  6468. this._pdfViewer.currentPageNumber = 1;
  6469. return _context7.abrupt("break", 42);
  6470. case 28:
  6471. this._pdfViewer.currentPageNumber = this._pdfViewer.pagesCount;
  6472. return _context7.abrupt("break", 42);
  6473. case 30:
  6474. this._pdfViewer.nextPage();
  6475. return _context7.abrupt("break", 42);
  6476. case 32:
  6477. this._pdfViewer.previousPage();
  6478. return _context7.abrupt("break", 42);
  6479. case 34:
  6480. if (!isInPresentationMode) {
  6481. _context7.next = 36;
  6482. break;
  6483. }
  6484. return _context7.abrupt("return");
  6485. case 36:
  6486. this._pdfViewer.increaseScale();
  6487. return _context7.abrupt("break", 42);
  6488. case 38:
  6489. if (!isInPresentationMode) {
  6490. _context7.next = 40;
  6491. break;
  6492. }
  6493. return _context7.abrupt("return");
  6494. case 40:
  6495. this._pdfViewer.decreaseScale();
  6496. return _context7.abrupt("break", 42);
  6497. case 42:
  6498. return _context7.abrupt("return");
  6499. case 43:
  6500. if (!isInPresentationMode) {
  6501. _context7.next = 46;
  6502. break;
  6503. }
  6504. if (!detail.focus) {
  6505. _context7.next = 46;
  6506. break;
  6507. }
  6508. return _context7.abrupt("return");
  6509. case 46:
  6510. delete detail.id;
  6511. delete detail.siblings;
  6512. ids = siblings ? [id].concat(_toConsumableArray(siblings)) : [id];
  6513. _iterator3 = _createForOfIteratorHelper(ids);
  6514. try {
  6515. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  6516. elementId = _step3.value;
  6517. element = document.getElementById(elementId);
  6518. if (element) {
  6519. element.dispatchEvent(new CustomEvent("updatefromsandbox", {
  6520. detail: detail
  6521. }));
  6522. } else {
  6523. (_this$_pdfDocument = this._pdfDocument) === null || _this$_pdfDocument === void 0 ? void 0 : _this$_pdfDocument.annotationStorage.setValue(elementId, detail);
  6524. }
  6525. }
  6526. } catch (err) {
  6527. _iterator3.e(err);
  6528. } finally {
  6529. _iterator3.f();
  6530. }
  6531. case 51:
  6532. case "end":
  6533. return _context7.stop();
  6534. }
  6535. }
  6536. }, _callee7, this);
  6537. }));
  6538. function _updateFromSandbox(_x7) {
  6539. return _updateFromSandbox2.apply(this, arguments);
  6540. }
  6541. return _updateFromSandbox;
  6542. }()
  6543. }, {
  6544. key: "_dispatchPageOpen",
  6545. value: function () {
  6546. var _dispatchPageOpen2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee9(pageNumber) {
  6547. var _this3 = this;
  6548. var initialize,
  6549. pdfDocument,
  6550. visitedPages,
  6551. pageView,
  6552. actionsPromise,
  6553. _args9 = arguments;
  6554. return _regenerator["default"].wrap(function _callee9$(_context9) {
  6555. while (1) {
  6556. switch (_context9.prev = _context9.next) {
  6557. case 0:
  6558. initialize = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : false;
  6559. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  6560. if (initialize) {
  6561. this._closeCapability = (0, _pdfjsLib.createPromiseCapability)();
  6562. }
  6563. if (this._closeCapability) {
  6564. _context9.next = 5;
  6565. break;
  6566. }
  6567. return _context9.abrupt("return");
  6568. case 5:
  6569. pageView = this._pdfViewer.getPageView(pageNumber - 1);
  6570. if (!((pageView === null || pageView === void 0 ? void 0 : pageView.renderingState) !== _pdf_rendering_queue.RenderingStates.FINISHED)) {
  6571. _context9.next = 9;
  6572. break;
  6573. }
  6574. this._pageOpenPending.add(pageNumber);
  6575. return _context9.abrupt("return");
  6576. case 9:
  6577. this._pageOpenPending["delete"](pageNumber);
  6578. actionsPromise = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
  6579. var _pageView$pdfPage, _this3$_scripting;
  6580. var actions;
  6581. return _regenerator["default"].wrap(function _callee8$(_context8) {
  6582. while (1) {
  6583. switch (_context8.prev = _context8.next) {
  6584. case 0:
  6585. _context8.next = 2;
  6586. return !visitedPages.has(pageNumber) ? (_pageView$pdfPage = pageView.pdfPage) === null || _pageView$pdfPage === void 0 ? void 0 : _pageView$pdfPage.getJSActions() : null;
  6587. case 2:
  6588. actions = _context8.sent;
  6589. if (!(pdfDocument !== _this3._pdfDocument)) {
  6590. _context8.next = 5;
  6591. break;
  6592. }
  6593. return _context8.abrupt("return");
  6594. case 5:
  6595. _context8.next = 7;
  6596. return (_this3$_scripting = _this3._scripting) === null || _this3$_scripting === void 0 ? void 0 : _this3$_scripting.dispatchEventInSandbox({
  6597. id: "page",
  6598. name: "PageOpen",
  6599. pageNumber: pageNumber,
  6600. actions: actions
  6601. });
  6602. case 7:
  6603. case "end":
  6604. return _context8.stop();
  6605. }
  6606. }
  6607. }, _callee8);
  6608. }))();
  6609. visitedPages.set(pageNumber, actionsPromise);
  6610. case 12:
  6611. case "end":
  6612. return _context9.stop();
  6613. }
  6614. }
  6615. }, _callee9, this);
  6616. }));
  6617. function _dispatchPageOpen(_x8) {
  6618. return _dispatchPageOpen2.apply(this, arguments);
  6619. }
  6620. return _dispatchPageOpen;
  6621. }()
  6622. }, {
  6623. key: "_dispatchPageClose",
  6624. value: function () {
  6625. var _dispatchPageClose2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee10(pageNumber) {
  6626. var _this$_scripting6;
  6627. var pdfDocument, visitedPages, actionsPromise;
  6628. return _regenerator["default"].wrap(function _callee10$(_context10) {
  6629. while (1) {
  6630. switch (_context10.prev = _context10.next) {
  6631. case 0:
  6632. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  6633. if (this._closeCapability) {
  6634. _context10.next = 3;
  6635. break;
  6636. }
  6637. return _context10.abrupt("return");
  6638. case 3:
  6639. if (!this._pageOpenPending.has(pageNumber)) {
  6640. _context10.next = 5;
  6641. break;
  6642. }
  6643. return _context10.abrupt("return");
  6644. case 5:
  6645. actionsPromise = visitedPages.get(pageNumber);
  6646. if (actionsPromise) {
  6647. _context10.next = 8;
  6648. break;
  6649. }
  6650. return _context10.abrupt("return");
  6651. case 8:
  6652. visitedPages.set(pageNumber, null);
  6653. _context10.next = 11;
  6654. return actionsPromise;
  6655. case 11:
  6656. if (!(pdfDocument !== this._pdfDocument)) {
  6657. _context10.next = 13;
  6658. break;
  6659. }
  6660. return _context10.abrupt("return");
  6661. case 13:
  6662. _context10.next = 15;
  6663. return (_this$_scripting6 = this._scripting) === null || _this$_scripting6 === void 0 ? void 0 : _this$_scripting6.dispatchEventInSandbox({
  6664. id: "page",
  6665. name: "PageClose",
  6666. pageNumber: pageNumber
  6667. });
  6668. case 15:
  6669. case "end":
  6670. return _context10.stop();
  6671. }
  6672. }
  6673. }, _callee10, this);
  6674. }));
  6675. function _dispatchPageClose(_x9) {
  6676. return _dispatchPageClose2.apply(this, arguments);
  6677. }
  6678. return _dispatchPageClose;
  6679. }()
  6680. }, {
  6681. key: "_getDocProperties",
  6682. value: function () {
  6683. var _getDocProperties2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
  6684. var _require, docPropertiesLookup;
  6685. return _regenerator["default"].wrap(function _callee11$(_context11) {
  6686. while (1) {
  6687. switch (_context11.prev = _context11.next) {
  6688. case 0:
  6689. if (!this._docPropertiesLookup) {
  6690. _context11.next = 2;
  6691. break;
  6692. }
  6693. return _context11.abrupt("return", this._docPropertiesLookup(this._pdfDocument));
  6694. case 2:
  6695. _require = __w_pdfjs_require__(21), docPropertiesLookup = _require.docPropertiesLookup;
  6696. return _context11.abrupt("return", docPropertiesLookup(this._pdfDocument));
  6697. case 4:
  6698. case "end":
  6699. return _context11.stop();
  6700. }
  6701. }
  6702. }, _callee11, this);
  6703. }));
  6704. function _getDocProperties() {
  6705. return _getDocProperties2.apply(this, arguments);
  6706. }
  6707. return _getDocProperties;
  6708. }()
  6709. }, {
  6710. key: "_createScripting",
  6711. value: function _createScripting() {
  6712. this._destroyCapability = (0, _pdfjsLib.createPromiseCapability)();
  6713. if (this._scripting) {
  6714. throw new Error("_createScripting: Scripting already exists.");
  6715. }
  6716. if (this._scriptingFactory) {
  6717. return this._scriptingFactory.createScripting({
  6718. sandboxBundleSrc: this._sandboxBundleSrc
  6719. });
  6720. }
  6721. var _require2 = __w_pdfjs_require__(21),
  6722. GenericScripting = _require2.GenericScripting;
  6723. return new GenericScripting(this._sandboxBundleSrc);
  6724. }
  6725. }, {
  6726. key: "_destroyScripting",
  6727. value: function () {
  6728. var _destroyScripting2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
  6729. var _this$_destroyCapabil3;
  6730. var _this$_destroyCapabil2, _iterator4, _step4, _step4$value, name, listener, _iterator5, _step5, _step5$value, _name2, _listener2;
  6731. return _regenerator["default"].wrap(function _callee12$(_context12) {
  6732. while (1) {
  6733. switch (_context12.prev = _context12.next) {
  6734. case 0:
  6735. if (this._scripting) {
  6736. _context12.next = 4;
  6737. break;
  6738. }
  6739. this._pdfDocument = null;
  6740. (_this$_destroyCapabil2 = this._destroyCapability) === null || _this$_destroyCapabil2 === void 0 ? void 0 : _this$_destroyCapabil2.resolve();
  6741. return _context12.abrupt("return");
  6742. case 4:
  6743. if (!this._closeCapability) {
  6744. _context12.next = 8;
  6745. break;
  6746. }
  6747. _context12.next = 7;
  6748. return Promise.race([this._closeCapability.promise, new Promise(function (resolve) {
  6749. setTimeout(resolve, 1000);
  6750. })])["catch"](function (reason) {});
  6751. case 7:
  6752. this._closeCapability = null;
  6753. case 8:
  6754. this._pdfDocument = null;
  6755. _context12.prev = 9;
  6756. _context12.next = 12;
  6757. return this._scripting.destroySandbox();
  6758. case 12:
  6759. _context12.next = 16;
  6760. break;
  6761. case 14:
  6762. _context12.prev = 14;
  6763. _context12.t0 = _context12["catch"](9);
  6764. case 16:
  6765. _iterator4 = _createForOfIteratorHelper(this._internalEvents);
  6766. try {
  6767. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  6768. _step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], listener = _step4$value[1];
  6769. this._eventBus._off(name, listener);
  6770. }
  6771. } catch (err) {
  6772. _iterator4.e(err);
  6773. } finally {
  6774. _iterator4.f();
  6775. }
  6776. this._internalEvents.clear();
  6777. _iterator5 = _createForOfIteratorHelper(this._domEvents);
  6778. try {
  6779. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  6780. _step5$value = _slicedToArray(_step5.value, 2), _name2 = _step5$value[0], _listener2 = _step5$value[1];
  6781. window.removeEventListener(_name2, _listener2);
  6782. }
  6783. } catch (err) {
  6784. _iterator5.e(err);
  6785. } finally {
  6786. _iterator5.f();
  6787. }
  6788. this._domEvents.clear();
  6789. this._pageOpenPending.clear();
  6790. this._visitedPages.clear();
  6791. this._scripting = null;
  6792. delete this._mouseState.isDown;
  6793. this._ready = false;
  6794. (_this$_destroyCapabil3 = this._destroyCapability) === null || _this$_destroyCapabil3 === void 0 ? void 0 : _this$_destroyCapabil3.resolve();
  6795. case 28:
  6796. case "end":
  6797. return _context12.stop();
  6798. }
  6799. }
  6800. }, _callee12, this, [[9, 14]]);
  6801. }));
  6802. function _destroyScripting() {
  6803. return _destroyScripting2.apply(this, arguments);
  6804. }
  6805. return _destroyScripting;
  6806. }()
  6807. }]);
  6808. return PDFScriptingManager;
  6809. }();
  6810. exports.PDFScriptingManager = PDFScriptingManager;
  6811. /***/ }),
  6812. /* 21 */
  6813. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6814. Object.defineProperty(exports, "__esModule", ({
  6815. value: true
  6816. }));
  6817. exports.docPropertiesLookup = docPropertiesLookup;
  6818. exports.GenericScripting = void 0;
  6819. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  6820. var _pdfjsLib = __w_pdfjs_require__(4);
  6821. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6822. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  6823. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  6824. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  6825. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6826. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6827. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6828. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  6829. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  6830. function docPropertiesLookup(_x) {
  6831. return _docPropertiesLookup.apply(this, arguments);
  6832. }
  6833. function _docPropertiesLookup() {
  6834. _docPropertiesLookup = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(pdfDocument) {
  6835. var url, baseUrl, _yield$pdfDocument$ge, info, metadata, contentDispositionFilename, contentLength, _yield$pdfDocument$ge2, length;
  6836. return _regenerator["default"].wrap(function _callee4$(_context4) {
  6837. while (1) {
  6838. switch (_context4.prev = _context4.next) {
  6839. case 0:
  6840. url = "", baseUrl = url.split("#")[0];
  6841. _context4.next = 3;
  6842. return pdfDocument.getMetadata();
  6843. case 3:
  6844. _yield$pdfDocument$ge = _context4.sent;
  6845. info = _yield$pdfDocument$ge.info;
  6846. metadata = _yield$pdfDocument$ge.metadata;
  6847. contentDispositionFilename = _yield$pdfDocument$ge.contentDispositionFilename;
  6848. contentLength = _yield$pdfDocument$ge.contentLength;
  6849. if (contentLength) {
  6850. _context4.next = 14;
  6851. break;
  6852. }
  6853. _context4.next = 11;
  6854. return pdfDocument.getDownloadInfo();
  6855. case 11:
  6856. _yield$pdfDocument$ge2 = _context4.sent;
  6857. length = _yield$pdfDocument$ge2.length;
  6858. contentLength = length;
  6859. case 14:
  6860. return _context4.abrupt("return", _objectSpread(_objectSpread({}, info), {}, {
  6861. baseURL: baseUrl,
  6862. filesize: contentLength,
  6863. filename: contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(url),
  6864. metadata: metadata === null || metadata === void 0 ? void 0 : metadata.getRaw(),
  6865. authors: metadata === null || metadata === void 0 ? void 0 : metadata.get("dc:creator"),
  6866. numPages: pdfDocument.numPages,
  6867. URL: url
  6868. }));
  6869. case 15:
  6870. case "end":
  6871. return _context4.stop();
  6872. }
  6873. }
  6874. }, _callee4);
  6875. }));
  6876. return _docPropertiesLookup.apply(this, arguments);
  6877. }
  6878. var GenericScripting = /*#__PURE__*/function () {
  6879. function GenericScripting(sandboxBundleSrc) {
  6880. _classCallCheck(this, GenericScripting);
  6881. this._ready = (0, _pdfjsLib.loadScript)(sandboxBundleSrc, true).then(function () {
  6882. return window.pdfjsSandbox.QuickJSSandbox();
  6883. });
  6884. }
  6885. _createClass(GenericScripting, [{
  6886. key: "createSandbox",
  6887. value: function () {
  6888. var _createSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
  6889. var sandbox;
  6890. return _regenerator["default"].wrap(function _callee$(_context) {
  6891. while (1) {
  6892. switch (_context.prev = _context.next) {
  6893. case 0:
  6894. _context.next = 2;
  6895. return this._ready;
  6896. case 2:
  6897. sandbox = _context.sent;
  6898. sandbox.create(data);
  6899. case 4:
  6900. case "end":
  6901. return _context.stop();
  6902. }
  6903. }
  6904. }, _callee, this);
  6905. }));
  6906. function createSandbox(_x2) {
  6907. return _createSandbox.apply(this, arguments);
  6908. }
  6909. return createSandbox;
  6910. }()
  6911. }, {
  6912. key: "dispatchEventInSandbox",
  6913. value: function () {
  6914. var _dispatchEventInSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(event) {
  6915. var sandbox;
  6916. return _regenerator["default"].wrap(function _callee2$(_context2) {
  6917. while (1) {
  6918. switch (_context2.prev = _context2.next) {
  6919. case 0:
  6920. _context2.next = 2;
  6921. return this._ready;
  6922. case 2:
  6923. sandbox = _context2.sent;
  6924. sandbox.dispatchEvent(event);
  6925. case 4:
  6926. case "end":
  6927. return _context2.stop();
  6928. }
  6929. }
  6930. }, _callee2, this);
  6931. }));
  6932. function dispatchEventInSandbox(_x3) {
  6933. return _dispatchEventInSandbox.apply(this, arguments);
  6934. }
  6935. return dispatchEventInSandbox;
  6936. }()
  6937. }, {
  6938. key: "destroySandbox",
  6939. value: function () {
  6940. var _destroySandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  6941. var sandbox;
  6942. return _regenerator["default"].wrap(function _callee3$(_context3) {
  6943. while (1) {
  6944. switch (_context3.prev = _context3.next) {
  6945. case 0:
  6946. _context3.next = 2;
  6947. return this._ready;
  6948. case 2:
  6949. sandbox = _context3.sent;
  6950. sandbox.nukeSandbox();
  6951. case 4:
  6952. case "end":
  6953. return _context3.stop();
  6954. }
  6955. }
  6956. }, _callee3, this);
  6957. }));
  6958. function destroySandbox() {
  6959. return _destroySandbox.apply(this, arguments);
  6960. }
  6961. return destroySandbox;
  6962. }()
  6963. }]);
  6964. return GenericScripting;
  6965. }();
  6966. exports.GenericScripting = GenericScripting;
  6967. /***/ }),
  6968. /* 22 */
  6969. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6970. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  6971. Object.defineProperty(exports, "__esModule", ({
  6972. value: true
  6973. }));
  6974. exports.PDFSinglePageViewer = void 0;
  6975. var _base_viewer = __w_pdfjs_require__(23);
  6976. var _pdfjsLib = __w_pdfjs_require__(4);
  6977. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6978. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6979. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6980. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  6981. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  6982. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  6983. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6984. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  6985. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  6986. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  6987. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  6988. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  6989. var PDFSinglePageViewer = /*#__PURE__*/function (_BaseViewer) {
  6990. _inherits(PDFSinglePageViewer, _BaseViewer);
  6991. var _super = _createSuper(PDFSinglePageViewer);
  6992. function PDFSinglePageViewer(options) {
  6993. var _this;
  6994. _classCallCheck(this, PDFSinglePageViewer);
  6995. _this = _super.call(this, options);
  6996. _this.eventBus._on("pagesinit", function (evt) {
  6997. _this._ensurePageViewVisible();
  6998. });
  6999. return _this;
  7000. }
  7001. _createClass(PDFSinglePageViewer, [{
  7002. key: "_viewerElement",
  7003. get: function get() {
  7004. return (0, _pdfjsLib.shadow)(this, "_viewerElement", this._shadowViewer);
  7005. }
  7006. }, {
  7007. key: "_pageWidthScaleFactor",
  7008. get: function get() {
  7009. return 1;
  7010. }
  7011. }, {
  7012. key: "_resetView",
  7013. value: function _resetView() {
  7014. _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_resetView", this).call(this);
  7015. this._previousPageNumber = 1;
  7016. this._shadowViewer = document.createDocumentFragment();
  7017. this._updateScrollDown = null;
  7018. }
  7019. }, {
  7020. key: "_ensurePageViewVisible",
  7021. value: function _ensurePageViewVisible() {
  7022. var pageView = this._pages[this._currentPageNumber - 1];
  7023. var previousPageView = this._pages[this._previousPageNumber - 1];
  7024. var viewerNodes = this.viewer.childNodes;
  7025. switch (viewerNodes.length) {
  7026. case 0:
  7027. this.viewer.appendChild(pageView.div);
  7028. break;
  7029. case 1:
  7030. if (viewerNodes[0] !== previousPageView.div) {
  7031. throw new Error("_ensurePageViewVisible: Unexpected previously visible page.");
  7032. }
  7033. if (pageView === previousPageView) {
  7034. break;
  7035. }
  7036. this._shadowViewer.appendChild(previousPageView.div);
  7037. this.viewer.appendChild(pageView.div);
  7038. this.container.scrollTop = 0;
  7039. break;
  7040. default:
  7041. throw new Error("_ensurePageViewVisible: Only one page should be visible at a time.");
  7042. }
  7043. this._previousPageNumber = this._currentPageNumber;
  7044. }
  7045. }, {
  7046. key: "_scrollUpdate",
  7047. value: function _scrollUpdate() {
  7048. if (this._updateScrollDown) {
  7049. this._updateScrollDown();
  7050. }
  7051. _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_scrollUpdate", this).call(this);
  7052. }
  7053. }, {
  7054. key: "_scrollIntoView",
  7055. value: function _scrollIntoView(_ref) {
  7056. var _this2 = this;
  7057. var pageDiv = _ref.pageDiv,
  7058. _ref$pageSpot = _ref.pageSpot,
  7059. pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot,
  7060. _ref$pageNumber = _ref.pageNumber,
  7061. pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber;
  7062. if (pageNumber) {
  7063. this._setCurrentPageNumber(pageNumber);
  7064. }
  7065. var scrolledDown = this._currentPageNumber >= this._previousPageNumber;
  7066. this._ensurePageViewVisible();
  7067. this.update();
  7068. _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_scrollIntoView", this).call(this, {
  7069. pageDiv: pageDiv,
  7070. pageSpot: pageSpot,
  7071. pageNumber: pageNumber
  7072. });
  7073. this._updateScrollDown = function () {
  7074. _this2.scroll.down = scrolledDown;
  7075. _this2._updateScrollDown = null;
  7076. };
  7077. }
  7078. }, {
  7079. key: "_getVisiblePages",
  7080. value: function _getVisiblePages() {
  7081. return this._getCurrentVisiblePage();
  7082. }
  7083. }, {
  7084. key: "_updateHelper",
  7085. value: function _updateHelper(visiblePages) {}
  7086. }, {
  7087. key: "_isScrollModeHorizontal",
  7088. get: function get() {
  7089. return (0, _pdfjsLib.shadow)(this, "_isScrollModeHorizontal", false);
  7090. }
  7091. }, {
  7092. key: "_updateScrollMode",
  7093. value: function _updateScrollMode() {}
  7094. }, {
  7095. key: "_updateSpreadMode",
  7096. value: function _updateSpreadMode() {}
  7097. }, {
  7098. key: "_getPageAdvance",
  7099. value: function _getPageAdvance() {
  7100. return 1;
  7101. }
  7102. }]);
  7103. return PDFSinglePageViewer;
  7104. }(_base_viewer.BaseViewer);
  7105. exports.PDFSinglePageViewer = PDFSinglePageViewer;
  7106. /***/ }),
  7107. /* 23 */
  7108. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7109. Object.defineProperty(exports, "__esModule", ({
  7110. value: true
  7111. }));
  7112. exports.BaseViewer = void 0;
  7113. var _pdfjsLib = __w_pdfjs_require__(4);
  7114. var _ui_utils = __w_pdfjs_require__(7);
  7115. var _pdf_rendering_queue = __w_pdfjs_require__(19);
  7116. var _annotation_layer_builder = __w_pdfjs_require__(1);
  7117. var _l10n_utils = __w_pdfjs_require__(5);
  7118. var _pdf_page_view = __w_pdfjs_require__(18);
  7119. var _pdf_link_service = __w_pdfjs_require__(6);
  7120. var _struct_tree_layer_builder = __w_pdfjs_require__(8);
  7121. var _text_highlighter = __w_pdfjs_require__(24);
  7122. var _text_layer_builder = __w_pdfjs_require__(9);
  7123. var _xfa_layer_builder = __w_pdfjs_require__(10);
  7124. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  7125. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  7126. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  7127. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7128. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  7129. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  7130. var DEFAULT_CACHE_SIZE = 10;
  7131. function PDFPageViewBuffer(size) {
  7132. var data = [];
  7133. this.push = function (view) {
  7134. var i = data.indexOf(view);
  7135. if (i >= 0) {
  7136. data.splice(i, 1);
  7137. }
  7138. data.push(view);
  7139. if (data.length > size) {
  7140. data.shift().destroy();
  7141. }
  7142. };
  7143. this.resize = function (newSize, pagesToKeep) {
  7144. size = newSize;
  7145. if (pagesToKeep) {
  7146. var pageIdsToKeep = new Set();
  7147. for (var i = 0, iMax = pagesToKeep.length; i < iMax; ++i) {
  7148. pageIdsToKeep.add(pagesToKeep[i].id);
  7149. }
  7150. (0, _ui_utils.moveToEndOfArray)(data, function (page) {
  7151. return pageIdsToKeep.has(page.id);
  7152. });
  7153. }
  7154. while (data.length > size) {
  7155. data.shift().destroy();
  7156. }
  7157. };
  7158. this.has = function (view) {
  7159. return data.includes(view);
  7160. };
  7161. }
  7162. function isSameScale(oldScale, newScale) {
  7163. if (newScale === oldScale) {
  7164. return true;
  7165. }
  7166. if (Math.abs(newScale - oldScale) < 1e-15) {
  7167. return true;
  7168. }
  7169. return false;
  7170. }
  7171. var BaseViewer = /*#__PURE__*/function () {
  7172. function BaseViewer(options) {
  7173. var _this$container,
  7174. _this$viewer,
  7175. _options$textLayerMod,
  7176. _options$annotationMo,
  7177. _this = this;
  7178. _classCallCheck(this, BaseViewer);
  7179. if (this.constructor === BaseViewer) {
  7180. throw new Error("Cannot initialize BaseViewer.");
  7181. }
  7182. var viewerVersion = '2.11.338';
  7183. if (_pdfjsLib.version !== viewerVersion) {
  7184. throw new Error("The API version \"".concat(_pdfjsLib.version, "\" does not match the Viewer version \"").concat(viewerVersion, "\"."));
  7185. }
  7186. this.container = options.container;
  7187. this.viewer = options.viewer || options.container.firstElementChild;
  7188. if (!(((_this$container = this.container) === null || _this$container === void 0 ? void 0 : _this$container.tagName.toUpperCase()) === "DIV" && ((_this$viewer = this.viewer) === null || _this$viewer === void 0 ? void 0 : _this$viewer.tagName.toUpperCase()) === "DIV")) {
  7189. throw new Error("Invalid `container` and/or `viewer` option.");
  7190. }
  7191. if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") {
  7192. throw new Error("The `container` must be absolutely positioned.");
  7193. }
  7194. this.eventBus = options.eventBus;
  7195. this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
  7196. this.downloadManager = options.downloadManager || null;
  7197. this.findController = options.findController || null;
  7198. this._scriptingManager = options.scriptingManager || null;
  7199. this.removePageBorders = options.removePageBorders || false;
  7200. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  7201. this._annotationMode = (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS;
  7202. this.imageResourcesPath = options.imageResourcesPath || "";
  7203. this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
  7204. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  7205. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  7206. this.maxCanvasPixels = options.maxCanvasPixels;
  7207. this.l10n = options.l10n || _l10n_utils.NullL10n;
  7208. this.defaultRenderingQueue = !options.renderingQueue;
  7209. if (this.defaultRenderingQueue) {
  7210. this.renderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
  7211. this.renderingQueue.setViewer(this);
  7212. } else {
  7213. this.renderingQueue = options.renderingQueue;
  7214. }
  7215. this._doc = document.documentElement;
  7216. this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdate.bind(this));
  7217. this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
  7218. this._onBeforeDraw = this._onAfterDraw = null;
  7219. this._resetView();
  7220. if (this.removePageBorders) {
  7221. this.viewer.classList.add("removePageBorders");
  7222. }
  7223. Promise.resolve().then(function () {
  7224. _this.eventBus.dispatch("baseviewerinit", {
  7225. source: _this
  7226. });
  7227. });
  7228. }
  7229. _createClass(BaseViewer, [{
  7230. key: "pagesCount",
  7231. get: function get() {
  7232. return this._pages.length;
  7233. }
  7234. }, {
  7235. key: "getPageView",
  7236. value: function getPageView(index) {
  7237. return this._pages[index];
  7238. }
  7239. }, {
  7240. key: "pageViewsReady",
  7241. get: function get() {
  7242. if (!this._pagesCapability.settled) {
  7243. return false;
  7244. }
  7245. return this._pages.every(function (pageView) {
  7246. return pageView === null || pageView === void 0 ? void 0 : pageView.pdfPage;
  7247. });
  7248. }
  7249. }, {
  7250. key: "renderForms",
  7251. get: function get() {
  7252. return this._annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS;
  7253. }
  7254. }, {
  7255. key: "enableScripting",
  7256. get: function get() {
  7257. return !!this._scriptingManager;
  7258. }
  7259. }, {
  7260. key: "currentPageNumber",
  7261. get: function get() {
  7262. return this._currentPageNumber;
  7263. },
  7264. set: function set(val) {
  7265. if (!Number.isInteger(val)) {
  7266. throw new Error("Invalid page number.");
  7267. }
  7268. if (!this.pdfDocument) {
  7269. return;
  7270. }
  7271. if (!this._setCurrentPageNumber(val, true)) {
  7272. console.error("currentPageNumber: \"".concat(val, "\" is not a valid page."));
  7273. }
  7274. }
  7275. }, {
  7276. key: "_setCurrentPageNumber",
  7277. value: function _setCurrentPageNumber(val) {
  7278. var _this$_pageLabels, _this$_pageLabels2;
  7279. var resetCurrentPageView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7280. if (this._currentPageNumber === val) {
  7281. if (resetCurrentPageView) {
  7282. this._resetCurrentPageView();
  7283. }
  7284. return true;
  7285. }
  7286. if (!(0 < val && val <= this.pagesCount)) {
  7287. return false;
  7288. }
  7289. var previous = this._currentPageNumber;
  7290. this._currentPageNumber = val;
  7291. this.eventBus.dispatch("pagechanging", {
  7292. source: this,
  7293. pageNumber: val,
  7294. pageLabel: (_this$_pageLabels = (_this$_pageLabels2 = this._pageLabels) === null || _this$_pageLabels2 === void 0 ? void 0 : _this$_pageLabels2[val - 1]) !== null && _this$_pageLabels !== void 0 ? _this$_pageLabels : null,
  7295. previous: previous
  7296. });
  7297. if (resetCurrentPageView) {
  7298. this._resetCurrentPageView();
  7299. }
  7300. return true;
  7301. }
  7302. }, {
  7303. key: "currentPageLabel",
  7304. get: function get() {
  7305. var _this$_pageLabels3, _this$_pageLabels4;
  7306. return (_this$_pageLabels3 = (_this$_pageLabels4 = this._pageLabels) === null || _this$_pageLabels4 === void 0 ? void 0 : _this$_pageLabels4[this._currentPageNumber - 1]) !== null && _this$_pageLabels3 !== void 0 ? _this$_pageLabels3 : null;
  7307. },
  7308. set: function set(val) {
  7309. if (!this.pdfDocument) {
  7310. return;
  7311. }
  7312. var page = val | 0;
  7313. if (this._pageLabels) {
  7314. var i = this._pageLabels.indexOf(val);
  7315. if (i >= 0) {
  7316. page = i + 1;
  7317. }
  7318. }
  7319. if (!this._setCurrentPageNumber(page, true)) {
  7320. console.error("currentPageLabel: \"".concat(val, "\" is not a valid page."));
  7321. }
  7322. }
  7323. }, {
  7324. key: "currentScale",
  7325. get: function get() {
  7326. return this._currentScale !== _ui_utils.UNKNOWN_SCALE ? this._currentScale : _ui_utils.DEFAULT_SCALE;
  7327. },
  7328. set: function set(val) {
  7329. if (isNaN(val)) {
  7330. throw new Error("Invalid numeric scale.");
  7331. }
  7332. if (!this.pdfDocument) {
  7333. return;
  7334. }
  7335. this._setScale(val, false);
  7336. }
  7337. }, {
  7338. key: "currentScaleValue",
  7339. get: function get() {
  7340. return this._currentScaleValue;
  7341. },
  7342. set: function set(val) {
  7343. if (!this.pdfDocument) {
  7344. return;
  7345. }
  7346. this._setScale(val, false);
  7347. }
  7348. }, {
  7349. key: "pagesRotation",
  7350. get: function get() {
  7351. return this._pagesRotation;
  7352. },
  7353. set: function set(rotation) {
  7354. if (!(0, _ui_utils.isValidRotation)(rotation)) {
  7355. throw new Error("Invalid pages rotation angle.");
  7356. }
  7357. if (!this.pdfDocument) {
  7358. return;
  7359. }
  7360. rotation %= 360;
  7361. if (rotation < 0) {
  7362. rotation += 360;
  7363. }
  7364. if (this._pagesRotation === rotation) {
  7365. return;
  7366. }
  7367. this._pagesRotation = rotation;
  7368. var pageNumber = this._currentPageNumber;
  7369. var updateArgs = {
  7370. rotation: rotation
  7371. };
  7372. var _iterator = _createForOfIteratorHelper(this._pages),
  7373. _step;
  7374. try {
  7375. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  7376. var pageView = _step.value;
  7377. pageView.update(updateArgs);
  7378. }
  7379. } catch (err) {
  7380. _iterator.e(err);
  7381. } finally {
  7382. _iterator.f();
  7383. }
  7384. if (this._currentScaleValue) {
  7385. this._setScale(this._currentScaleValue, true);
  7386. }
  7387. this.eventBus.dispatch("rotationchanging", {
  7388. source: this,
  7389. pagesRotation: rotation,
  7390. pageNumber: pageNumber
  7391. });
  7392. if (this.defaultRenderingQueue) {
  7393. this.update();
  7394. }
  7395. }
  7396. }, {
  7397. key: "firstPagePromise",
  7398. get: function get() {
  7399. return this.pdfDocument ? this._firstPageCapability.promise : null;
  7400. }
  7401. }, {
  7402. key: "onePageRendered",
  7403. get: function get() {
  7404. return this.pdfDocument ? this._onePageRenderedCapability.promise : null;
  7405. }
  7406. }, {
  7407. key: "pagesPromise",
  7408. get: function get() {
  7409. return this.pdfDocument ? this._pagesCapability.promise : null;
  7410. }
  7411. }, {
  7412. key: "_viewerElement",
  7413. get: function get() {
  7414. throw new Error("Not implemented: _viewerElement");
  7415. }
  7416. }, {
  7417. key: "_onePageRenderedOrForceFetch",
  7418. value: function _onePageRenderedOrForceFetch() {
  7419. if (!this.container.offsetParent || this._getVisiblePages().views.length === 0) {
  7420. return Promise.resolve();
  7421. }
  7422. return this._onePageRenderedCapability.promise;
  7423. }
  7424. }, {
  7425. key: "setDocument",
  7426. value: function setDocument(pdfDocument) {
  7427. var _this2 = this;
  7428. if (this.pdfDocument) {
  7429. this.eventBus.dispatch("pagesdestroy", {
  7430. source: this
  7431. });
  7432. this._cancelRendering();
  7433. this._resetView();
  7434. if (this.findController) {
  7435. this.findController.setDocument(null);
  7436. }
  7437. if (this._scriptingManager) {
  7438. this._scriptingManager.setDocument(null);
  7439. }
  7440. }
  7441. this.pdfDocument = pdfDocument;
  7442. if (!pdfDocument) {
  7443. return;
  7444. }
  7445. var isPureXfa = pdfDocument.isPureXfa;
  7446. var pagesCount = pdfDocument.numPages;
  7447. var firstPagePromise = pdfDocument.getPage(1);
  7448. var optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
  7449. this._pagesCapability.promise.then(function () {
  7450. _this2.eventBus.dispatch("pagesloaded", {
  7451. source: _this2,
  7452. pagesCount: pagesCount
  7453. });
  7454. });
  7455. this._onBeforeDraw = function (evt) {
  7456. var pageView = _this2._pages[evt.pageNumber - 1];
  7457. if (!pageView) {
  7458. return;
  7459. }
  7460. _this2._buffer.push(pageView);
  7461. };
  7462. this.eventBus._on("pagerender", this._onBeforeDraw);
  7463. this._onAfterDraw = function (evt) {
  7464. if (evt.cssTransform || _this2._onePageRenderedCapability.settled) {
  7465. return;
  7466. }
  7467. _this2._onePageRenderedCapability.resolve();
  7468. _this2.eventBus._off("pagerendered", _this2._onAfterDraw);
  7469. _this2._onAfterDraw = null;
  7470. };
  7471. this.eventBus._on("pagerendered", this._onAfterDraw);
  7472. firstPagePromise.then(function (firstPdfPage) {
  7473. _this2._firstPageCapability.resolve(firstPdfPage);
  7474. _this2._optionalContentConfigPromise = optionalContentConfigPromise;
  7475. var scale = _this2.currentScale;
  7476. var viewport = firstPdfPage.getViewport({
  7477. scale: scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  7478. });
  7479. var textLayerFactory = _this2.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !isPureXfa ? _this2 : null;
  7480. var annotationLayerFactory = _this2._annotationMode !== _pdfjsLib.AnnotationMode.DISABLE ? _this2 : null;
  7481. var xfaLayerFactory = isPureXfa ? _this2 : null;
  7482. for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
  7483. var pageView = new _pdf_page_view.PDFPageView({
  7484. container: _this2._viewerElement,
  7485. eventBus: _this2.eventBus,
  7486. id: pageNum,
  7487. scale: scale,
  7488. defaultViewport: viewport.clone(),
  7489. optionalContentConfigPromise: optionalContentConfigPromise,
  7490. renderingQueue: _this2.renderingQueue,
  7491. textLayerFactory: textLayerFactory,
  7492. textLayerMode: _this2.textLayerMode,
  7493. annotationLayerFactory: annotationLayerFactory,
  7494. annotationMode: _this2._annotationMode,
  7495. xfaLayerFactory: xfaLayerFactory,
  7496. textHighlighterFactory: _this2,
  7497. structTreeLayerFactory: _this2,
  7498. imageResourcesPath: _this2.imageResourcesPath,
  7499. renderer: _this2.renderer,
  7500. useOnlyCssZoom: _this2.useOnlyCssZoom,
  7501. maxCanvasPixels: _this2.maxCanvasPixels,
  7502. l10n: _this2.l10n
  7503. });
  7504. _this2._pages.push(pageView);
  7505. }
  7506. var firstPageView = _this2._pages[0];
  7507. if (firstPageView) {
  7508. firstPageView.setPdfPage(firstPdfPage);
  7509. _this2.linkService.cachePageRef(1, firstPdfPage.ref);
  7510. }
  7511. if (_this2._spreadMode !== _ui_utils.SpreadMode.NONE) {
  7512. _this2._updateSpreadMode();
  7513. }
  7514. _this2._onePageRenderedOrForceFetch().then(function () {
  7515. if (_this2.findController) {
  7516. _this2.findController.setDocument(pdfDocument);
  7517. }
  7518. if (_this2._scriptingManager) {
  7519. _this2._scriptingManager.setDocument(pdfDocument);
  7520. }
  7521. if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) {
  7522. _this2._pagesCapability.resolve();
  7523. return;
  7524. }
  7525. var getPagesLeft = pagesCount - 1;
  7526. if (getPagesLeft <= 0) {
  7527. _this2._pagesCapability.resolve();
  7528. return;
  7529. }
  7530. var _loop = function _loop(_pageNum) {
  7531. pdfDocument.getPage(_pageNum).then(function (pdfPage) {
  7532. var pageView = _this2._pages[_pageNum - 1];
  7533. if (!pageView.pdfPage) {
  7534. pageView.setPdfPage(pdfPage);
  7535. }
  7536. _this2.linkService.cachePageRef(_pageNum, pdfPage.ref);
  7537. if (--getPagesLeft === 0) {
  7538. _this2._pagesCapability.resolve();
  7539. }
  7540. }, function (reason) {
  7541. console.error("Unable to get page ".concat(_pageNum, " to initialize viewer"), reason);
  7542. if (--getPagesLeft === 0) {
  7543. _this2._pagesCapability.resolve();
  7544. }
  7545. });
  7546. };
  7547. for (var _pageNum = 2; _pageNum <= pagesCount; ++_pageNum) {
  7548. _loop(_pageNum);
  7549. }
  7550. });
  7551. _this2.eventBus.dispatch("pagesinit", {
  7552. source: _this2
  7553. });
  7554. if (_this2.defaultRenderingQueue) {
  7555. _this2.update();
  7556. }
  7557. })["catch"](function (reason) {
  7558. console.error("Unable to initialize viewer", reason);
  7559. });
  7560. }
  7561. }, {
  7562. key: "setPageLabels",
  7563. value: function setPageLabels(labels) {
  7564. if (!this.pdfDocument) {
  7565. return;
  7566. }
  7567. if (!labels) {
  7568. this._pageLabels = null;
  7569. } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
  7570. this._pageLabels = null;
  7571. console.error("setPageLabels: Invalid page labels.");
  7572. } else {
  7573. this._pageLabels = labels;
  7574. }
  7575. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  7576. var _this$_pageLabels$i, _this$_pageLabels5;
  7577. this._pages[i].setPageLabel((_this$_pageLabels$i = (_this$_pageLabels5 = this._pageLabels) === null || _this$_pageLabels5 === void 0 ? void 0 : _this$_pageLabels5[i]) !== null && _this$_pageLabels$i !== void 0 ? _this$_pageLabels$i : null);
  7578. }
  7579. }
  7580. }, {
  7581. key: "_resetView",
  7582. value: function _resetView() {
  7583. this._pages = [];
  7584. this._currentPageNumber = 1;
  7585. this._currentScale = _ui_utils.UNKNOWN_SCALE;
  7586. this._currentScaleValue = null;
  7587. this._pageLabels = null;
  7588. this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
  7589. this._location = null;
  7590. this._pagesRotation = 0;
  7591. this._optionalContentConfigPromise = null;
  7592. this._pagesRequests = new WeakMap();
  7593. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  7594. this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)();
  7595. this._pagesCapability = (0, _pdfjsLib.createPromiseCapability)();
  7596. this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
  7597. this._spreadMode = _ui_utils.SpreadMode.NONE;
  7598. if (this._onBeforeDraw) {
  7599. this.eventBus._off("pagerender", this._onBeforeDraw);
  7600. this._onBeforeDraw = null;
  7601. }
  7602. if (this._onAfterDraw) {
  7603. this.eventBus._off("pagerendered", this._onAfterDraw);
  7604. this._onAfterDraw = null;
  7605. }
  7606. this.viewer.textContent = "";
  7607. this._updateScrollMode();
  7608. }
  7609. }, {
  7610. key: "_scrollUpdate",
  7611. value: function _scrollUpdate() {
  7612. if (this.pagesCount === 0) {
  7613. return;
  7614. }
  7615. this.update();
  7616. }
  7617. }, {
  7618. key: "_scrollIntoView",
  7619. value: function _scrollIntoView(_ref) {
  7620. var pageDiv = _ref.pageDiv,
  7621. _ref$pageSpot = _ref.pageSpot,
  7622. pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot,
  7623. _ref$pageNumber = _ref.pageNumber,
  7624. pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber;
  7625. (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot);
  7626. }
  7627. }, {
  7628. key: "_setScaleUpdatePages",
  7629. value: function _setScaleUpdatePages(newScale, newValue) {
  7630. var noScroll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  7631. var preset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  7632. this._currentScaleValue = newValue.toString();
  7633. if (isSameScale(this._currentScale, newScale)) {
  7634. if (preset) {
  7635. this.eventBus.dispatch("scalechanging", {
  7636. source: this,
  7637. scale: newScale,
  7638. presetValue: newValue
  7639. });
  7640. }
  7641. return;
  7642. }
  7643. this._doc.style.setProperty("--zoom-factor", newScale);
  7644. var updateArgs = {
  7645. scale: newScale
  7646. };
  7647. var _iterator2 = _createForOfIteratorHelper(this._pages),
  7648. _step2;
  7649. try {
  7650. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  7651. var pageView = _step2.value;
  7652. pageView.update(updateArgs);
  7653. }
  7654. } catch (err) {
  7655. _iterator2.e(err);
  7656. } finally {
  7657. _iterator2.f();
  7658. }
  7659. this._currentScale = newScale;
  7660. if (!noScroll) {
  7661. var page = this._currentPageNumber,
  7662. dest;
  7663. if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {
  7664. page = this._location.pageNumber;
  7665. dest = [null, {
  7666. name: "XYZ"
  7667. }, this._location.left, this._location.top, null];
  7668. }
  7669. this.scrollPageIntoView({
  7670. pageNumber: page,
  7671. destArray: dest,
  7672. allowNegativeOffset: true
  7673. });
  7674. }
  7675. this.eventBus.dispatch("scalechanging", {
  7676. source: this,
  7677. scale: newScale,
  7678. presetValue: preset ? newValue : undefined
  7679. });
  7680. if (this.defaultRenderingQueue) {
  7681. this.update();
  7682. }
  7683. }
  7684. }, {
  7685. key: "_pageWidthScaleFactor",
  7686. get: function get() {
  7687. if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL && !this.isInPresentationMode) {
  7688. return 2;
  7689. }
  7690. return 1;
  7691. }
  7692. }, {
  7693. key: "_setScale",
  7694. value: function _setScale(value) {
  7695. var noScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7696. var scale = parseFloat(value);
  7697. if (scale > 0) {
  7698. this._setScaleUpdatePages(scale, value, noScroll, false);
  7699. } else {
  7700. var currentPage = this._pages[this._currentPageNumber - 1];
  7701. if (!currentPage) {
  7702. return;
  7703. }
  7704. var noPadding = this.isInPresentationMode || this.removePageBorders;
  7705. var hPadding = noPadding ? 0 : _ui_utils.SCROLLBAR_PADDING;
  7706. var vPadding = noPadding ? 0 : _ui_utils.VERTICAL_PADDING;
  7707. if (!noPadding && this._isScrollModeHorizontal) {
  7708. var _ref2 = [vPadding, hPadding];
  7709. hPadding = _ref2[0];
  7710. vPadding = _ref2[1];
  7711. }
  7712. var pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this._pageWidthScaleFactor;
  7713. var pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
  7714. switch (value) {
  7715. case "page-actual":
  7716. scale = 1;
  7717. break;
  7718. case "page-width":
  7719. scale = pageWidthScale;
  7720. break;
  7721. case "page-height":
  7722. scale = pageHeightScale;
  7723. break;
  7724. case "page-fit":
  7725. scale = Math.min(pageWidthScale, pageHeightScale);
  7726. break;
  7727. case "auto":
  7728. var horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
  7729. scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale);
  7730. break;
  7731. default:
  7732. console.error("_setScale: \"".concat(value, "\" is an unknown zoom value."));
  7733. return;
  7734. }
  7735. this._setScaleUpdatePages(scale, value, noScroll, true);
  7736. }
  7737. }
  7738. }, {
  7739. key: "_resetCurrentPageView",
  7740. value: function _resetCurrentPageView() {
  7741. if (this.isInPresentationMode) {
  7742. this._setScale(this._currentScaleValue, true);
  7743. }
  7744. var pageView = this._pages[this._currentPageNumber - 1];
  7745. this._scrollIntoView({
  7746. pageDiv: pageView.div
  7747. });
  7748. }
  7749. }, {
  7750. key: "pageLabelToPageNumber",
  7751. value: function pageLabelToPageNumber(label) {
  7752. if (!this._pageLabels) {
  7753. return null;
  7754. }
  7755. var i = this._pageLabels.indexOf(label);
  7756. if (i < 0) {
  7757. return null;
  7758. }
  7759. return i + 1;
  7760. }
  7761. }, {
  7762. key: "scrollPageIntoView",
  7763. value: function scrollPageIntoView(_ref3) {
  7764. var pageNumber = _ref3.pageNumber,
  7765. _ref3$destArray = _ref3.destArray,
  7766. destArray = _ref3$destArray === void 0 ? null : _ref3$destArray,
  7767. _ref3$allowNegativeOf = _ref3.allowNegativeOffset,
  7768. allowNegativeOffset = _ref3$allowNegativeOf === void 0 ? false : _ref3$allowNegativeOf,
  7769. _ref3$ignoreDestinati = _ref3.ignoreDestinationZoom,
  7770. ignoreDestinationZoom = _ref3$ignoreDestinati === void 0 ? false : _ref3$ignoreDestinati;
  7771. if (!this.pdfDocument) {
  7772. return;
  7773. }
  7774. var pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
  7775. if (!pageView) {
  7776. console.error("scrollPageIntoView: \"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  7777. return;
  7778. }
  7779. if (this.isInPresentationMode || !destArray) {
  7780. this._setCurrentPageNumber(pageNumber, true);
  7781. return;
  7782. }
  7783. var x = 0,
  7784. y = 0;
  7785. var width = 0,
  7786. height = 0,
  7787. widthScale,
  7788. heightScale;
  7789. var changeOrientation = pageView.rotation % 180 !== 0;
  7790. var pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  7791. var pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  7792. var scale = 0;
  7793. switch (destArray[1].name) {
  7794. case "XYZ":
  7795. x = destArray[2];
  7796. y = destArray[3];
  7797. scale = destArray[4];
  7798. x = x !== null ? x : 0;
  7799. y = y !== null ? y : pageHeight;
  7800. break;
  7801. case "Fit":
  7802. case "FitB":
  7803. scale = "page-fit";
  7804. break;
  7805. case "FitH":
  7806. case "FitBH":
  7807. y = destArray[2];
  7808. scale = "page-width";
  7809. if (y === null && this._location) {
  7810. x = this._location.left;
  7811. y = this._location.top;
  7812. } else if (typeof y !== "number") {
  7813. y = pageHeight;
  7814. }
  7815. break;
  7816. case "FitV":
  7817. case "FitBV":
  7818. x = destArray[2];
  7819. width = pageWidth;
  7820. height = pageHeight;
  7821. scale = "page-height";
  7822. break;
  7823. case "FitR":
  7824. x = destArray[2];
  7825. y = destArray[3];
  7826. width = destArray[4] - x;
  7827. height = destArray[5] - y;
  7828. var hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING;
  7829. var vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING;
  7830. widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  7831. heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  7832. scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
  7833. break;
  7834. default:
  7835. console.error("scrollPageIntoView: \"".concat(destArray[1].name, "\" is not a valid destination type."));
  7836. return;
  7837. }
  7838. if (!ignoreDestinationZoom) {
  7839. if (scale && scale !== this._currentScale) {
  7840. this.currentScaleValue = scale;
  7841. } else if (this._currentScale === _ui_utils.UNKNOWN_SCALE) {
  7842. this.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
  7843. }
  7844. }
  7845. if (scale === "page-fit" && !destArray[4]) {
  7846. this._scrollIntoView({
  7847. pageDiv: pageView.div,
  7848. pageNumber: pageNumber
  7849. });
  7850. return;
  7851. }
  7852. var boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
  7853. var left = Math.min(boundingRect[0][0], boundingRect[1][0]);
  7854. var top = Math.min(boundingRect[0][1], boundingRect[1][1]);
  7855. if (!allowNegativeOffset) {
  7856. left = Math.max(left, 0);
  7857. top = Math.max(top, 0);
  7858. }
  7859. this._scrollIntoView({
  7860. pageDiv: pageView.div,
  7861. pageSpot: {
  7862. left: left,
  7863. top: top
  7864. },
  7865. pageNumber: pageNumber
  7866. });
  7867. }
  7868. }, {
  7869. key: "_updateLocation",
  7870. value: function _updateLocation(firstPage) {
  7871. var currentScale = this._currentScale;
  7872. var currentScaleValue = this._currentScaleValue;
  7873. var normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
  7874. var pageNumber = firstPage.id;
  7875. var pdfOpenParams = "#page=" + pageNumber;
  7876. pdfOpenParams += "&zoom=" + normalizedScaleValue;
  7877. var currentPageView = this._pages[pageNumber - 1];
  7878. var container = this.container;
  7879. var topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
  7880. var intLeft = Math.round(topLeft[0]);
  7881. var intTop = Math.round(topLeft[1]);
  7882. pdfOpenParams += "," + intLeft + "," + intTop;
  7883. this._location = {
  7884. pageNumber: pageNumber,
  7885. scale: normalizedScaleValue,
  7886. top: intTop,
  7887. left: intLeft,
  7888. rotation: this._pagesRotation,
  7889. pdfOpenParams: pdfOpenParams
  7890. };
  7891. }
  7892. }, {
  7893. key: "_updateHelper",
  7894. value: function _updateHelper(visiblePages) {
  7895. throw new Error("Not implemented: _updateHelper");
  7896. }
  7897. }, {
  7898. key: "update",
  7899. value: function update() {
  7900. var visible = this._getVisiblePages();
  7901. var visiblePages = visible.views,
  7902. numVisiblePages = visiblePages.length;
  7903. if (numVisiblePages === 0) {
  7904. return;
  7905. }
  7906. var newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
  7907. this._buffer.resize(newCacheSize, visiblePages);
  7908. this.renderingQueue.renderHighestPriority(visible);
  7909. this._updateHelper(visiblePages);
  7910. this._updateLocation(visible.first);
  7911. this.eventBus.dispatch("updateviewarea", {
  7912. source: this,
  7913. location: this._location
  7914. });
  7915. }
  7916. }, {
  7917. key: "containsElement",
  7918. value: function containsElement(element) {
  7919. return this.container.contains(element);
  7920. }
  7921. }, {
  7922. key: "focus",
  7923. value: function focus() {
  7924. this.container.focus();
  7925. }
  7926. }, {
  7927. key: "_isScrollModeHorizontal",
  7928. get: function get() {
  7929. return this.isInPresentationMode ? false : this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL;
  7930. }
  7931. }, {
  7932. key: "_isContainerRtl",
  7933. get: function get() {
  7934. return getComputedStyle(this.container).direction === "rtl";
  7935. }
  7936. }, {
  7937. key: "isInPresentationMode",
  7938. get: function get() {
  7939. return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN;
  7940. }
  7941. }, {
  7942. key: "isChangingPresentationMode",
  7943. get: function get() {
  7944. return this.presentationModeState === _ui_utils.PresentationModeState.CHANGING;
  7945. }
  7946. }, {
  7947. key: "isHorizontalScrollbarEnabled",
  7948. get: function get() {
  7949. return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;
  7950. }
  7951. }, {
  7952. key: "isVerticalScrollbarEnabled",
  7953. get: function get() {
  7954. return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
  7955. }
  7956. }, {
  7957. key: "_getCurrentVisiblePage",
  7958. value: function _getCurrentVisiblePage() {
  7959. if (!this.pagesCount) {
  7960. return {
  7961. views: []
  7962. };
  7963. }
  7964. var pageView = this._pages[this._currentPageNumber - 1];
  7965. var element = pageView.div;
  7966. var view = {
  7967. id: pageView.id,
  7968. x: element.offsetLeft + element.clientLeft,
  7969. y: element.offsetTop + element.clientTop,
  7970. view: pageView
  7971. };
  7972. return {
  7973. first: view,
  7974. last: view,
  7975. views: [view]
  7976. };
  7977. }
  7978. }, {
  7979. key: "_getVisiblePages",
  7980. value: function _getVisiblePages() {
  7981. return (0, _ui_utils.getVisibleElements)({
  7982. scrollEl: this.container,
  7983. views: this._pages,
  7984. sortByVisibility: true,
  7985. horizontal: this._isScrollModeHorizontal,
  7986. rtl: this._isScrollModeHorizontal && this._isContainerRtl
  7987. });
  7988. }
  7989. }, {
  7990. key: "isPageVisible",
  7991. value: function isPageVisible(pageNumber) {
  7992. if (!this.pdfDocument) {
  7993. return false;
  7994. }
  7995. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  7996. console.error("isPageVisible: \"".concat(pageNumber, "\" is not a valid page."));
  7997. return false;
  7998. }
  7999. return this._getVisiblePages().views.some(function (view) {
  8000. return view.id === pageNumber;
  8001. });
  8002. }
  8003. }, {
  8004. key: "isPageCached",
  8005. value: function isPageCached(pageNumber) {
  8006. if (!this.pdfDocument || !this._buffer) {
  8007. return false;
  8008. }
  8009. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  8010. console.error("isPageCached: \"".concat(pageNumber, "\" is not a valid page."));
  8011. return false;
  8012. }
  8013. var pageView = this._pages[pageNumber - 1];
  8014. if (!pageView) {
  8015. return false;
  8016. }
  8017. return this._buffer.has(pageView);
  8018. }
  8019. }, {
  8020. key: "cleanup",
  8021. value: function cleanup() {
  8022. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  8023. if (this._pages[i] && this._pages[i].renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) {
  8024. this._pages[i].reset();
  8025. }
  8026. }
  8027. }
  8028. }, {
  8029. key: "_cancelRendering",
  8030. value: function _cancelRendering() {
  8031. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  8032. if (this._pages[i]) {
  8033. this._pages[i].cancelRendering();
  8034. }
  8035. }
  8036. }
  8037. }, {
  8038. key: "_ensurePdfPageLoaded",
  8039. value: function _ensurePdfPageLoaded(pageView) {
  8040. var _this3 = this;
  8041. if (pageView.pdfPage) {
  8042. return Promise.resolve(pageView.pdfPage);
  8043. }
  8044. if (this._pagesRequests.has(pageView)) {
  8045. return this._pagesRequests.get(pageView);
  8046. }
  8047. var promise = this.pdfDocument.getPage(pageView.id).then(function (pdfPage) {
  8048. if (!pageView.pdfPage) {
  8049. pageView.setPdfPage(pdfPage);
  8050. }
  8051. _this3._pagesRequests["delete"](pageView);
  8052. return pdfPage;
  8053. })["catch"](function (reason) {
  8054. console.error("Unable to get page for page view", reason);
  8055. _this3._pagesRequests["delete"](pageView);
  8056. });
  8057. this._pagesRequests.set(pageView, promise);
  8058. return promise;
  8059. }
  8060. }, {
  8061. key: "forceRendering",
  8062. value: function forceRendering(currentlyVisiblePages) {
  8063. var _this4 = this;
  8064. var visiblePages = currentlyVisiblePages || this._getVisiblePages();
  8065. var scrollAhead = this._isScrollModeHorizontal ? this.scroll.right : this.scroll.down;
  8066. var preRenderExtra = this._scrollMode === _ui_utils.ScrollMode.VERTICAL && this._spreadMode !== _ui_utils.SpreadMode.NONE && !this.isInPresentationMode;
  8067. var pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra);
  8068. if (pageView) {
  8069. this._ensurePdfPageLoaded(pageView).then(function () {
  8070. _this4.renderingQueue.renderView(pageView);
  8071. });
  8072. return true;
  8073. }
  8074. return false;
  8075. }
  8076. }, {
  8077. key: "createTextLayerBuilder",
  8078. value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
  8079. var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  8080. var eventBus = arguments.length > 4 ? arguments[4] : undefined;
  8081. var highlighter = arguments.length > 5 ? arguments[5] : undefined;
  8082. return new _text_layer_builder.TextLayerBuilder({
  8083. textLayerDiv: textLayerDiv,
  8084. eventBus: eventBus,
  8085. pageIndex: pageIndex,
  8086. viewport: viewport,
  8087. enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection,
  8088. highlighter: highlighter
  8089. });
  8090. }
  8091. }, {
  8092. key: "createTextHighlighter",
  8093. value: function createTextHighlighter(pageIndex, eventBus) {
  8094. return new _text_highlighter.TextHighlighter({
  8095. eventBus: eventBus,
  8096. pageIndex: pageIndex,
  8097. findController: this.isInPresentationMode ? null : this.findController
  8098. });
  8099. }
  8100. }, {
  8101. key: "createAnnotationLayerBuilder",
  8102. value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
  8103. var _this$pdfDocument, _this$pdfDocument2, _this$pdfDocument3, _this$_scriptingManag;
  8104. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  8105. var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
  8106. var renderForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  8107. var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _l10n_utils.NullL10n;
  8108. var enableScripting = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  8109. var hasJSActionsPromise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  8110. var mouseState = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
  8111. var fieldObjectsPromise = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
  8112. return new _annotation_layer_builder.AnnotationLayerBuilder({
  8113. pageDiv: pageDiv,
  8114. pdfPage: pdfPage,
  8115. annotationStorage: annotationStorage || ((_this$pdfDocument = this.pdfDocument) === null || _this$pdfDocument === void 0 ? void 0 : _this$pdfDocument.annotationStorage),
  8116. imageResourcesPath: imageResourcesPath,
  8117. renderForms: renderForms,
  8118. linkService: this.linkService,
  8119. downloadManager: this.downloadManager,
  8120. l10n: l10n,
  8121. enableScripting: enableScripting !== null && enableScripting !== void 0 ? enableScripting : this.enableScripting,
  8122. hasJSActionsPromise: hasJSActionsPromise || ((_this$pdfDocument2 = this.pdfDocument) === null || _this$pdfDocument2 === void 0 ? void 0 : _this$pdfDocument2.hasJSActions()),
  8123. fieldObjectsPromise: fieldObjectsPromise || ((_this$pdfDocument3 = this.pdfDocument) === null || _this$pdfDocument3 === void 0 ? void 0 : _this$pdfDocument3.getFieldObjects()),
  8124. mouseState: mouseState || ((_this$_scriptingManag = this._scriptingManager) === null || _this$_scriptingManag === void 0 ? void 0 : _this$_scriptingManag.mouseState)
  8125. });
  8126. }
  8127. }, {
  8128. key: "createXfaLayerBuilder",
  8129. value: function createXfaLayerBuilder(pageDiv, pdfPage) {
  8130. var _this$pdfDocument4;
  8131. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  8132. return new _xfa_layer_builder.XfaLayerBuilder({
  8133. pageDiv: pageDiv,
  8134. pdfPage: pdfPage,
  8135. annotationStorage: annotationStorage || ((_this$pdfDocument4 = this.pdfDocument) === null || _this$pdfDocument4 === void 0 ? void 0 : _this$pdfDocument4.annotationStorage),
  8136. linkService: this.linkService
  8137. });
  8138. }
  8139. }, {
  8140. key: "createStructTreeLayerBuilder",
  8141. value: function createStructTreeLayerBuilder(pdfPage) {
  8142. return new _struct_tree_layer_builder.StructTreeLayerBuilder({
  8143. pdfPage: pdfPage
  8144. });
  8145. }
  8146. }, {
  8147. key: "hasEqualPageSizes",
  8148. get: function get() {
  8149. var firstPageView = this._pages[0];
  8150. for (var i = 1, ii = this._pages.length; i < ii; ++i) {
  8151. var pageView = this._pages[i];
  8152. if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) {
  8153. return false;
  8154. }
  8155. }
  8156. return true;
  8157. }
  8158. }, {
  8159. key: "getPagesOverview",
  8160. value: function getPagesOverview() {
  8161. var _this5 = this;
  8162. return this._pages.map(function (pageView) {
  8163. var viewport = pageView.pdfPage.getViewport({
  8164. scale: 1
  8165. });
  8166. if (!_this5.enablePrintAutoRotate || (0, _ui_utils.isPortraitOrientation)(viewport)) {
  8167. return {
  8168. width: viewport.width,
  8169. height: viewport.height,
  8170. rotation: viewport.rotation
  8171. };
  8172. }
  8173. return {
  8174. width: viewport.height,
  8175. height: viewport.width,
  8176. rotation: (viewport.rotation - 90) % 360
  8177. };
  8178. });
  8179. }
  8180. }, {
  8181. key: "optionalContentConfigPromise",
  8182. get: function get() {
  8183. if (!this.pdfDocument) {
  8184. return Promise.resolve(null);
  8185. }
  8186. if (!this._optionalContentConfigPromise) {
  8187. return this.pdfDocument.getOptionalContentConfig();
  8188. }
  8189. return this._optionalContentConfigPromise;
  8190. },
  8191. set: function set(promise) {
  8192. if (!(promise instanceof Promise)) {
  8193. throw new Error("Invalid optionalContentConfigPromise: ".concat(promise));
  8194. }
  8195. if (!this.pdfDocument) {
  8196. return;
  8197. }
  8198. if (!this._optionalContentConfigPromise) {
  8199. return;
  8200. }
  8201. this._optionalContentConfigPromise = promise;
  8202. var updateArgs = {
  8203. optionalContentConfigPromise: promise
  8204. };
  8205. var _iterator3 = _createForOfIteratorHelper(this._pages),
  8206. _step3;
  8207. try {
  8208. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  8209. var pageView = _step3.value;
  8210. pageView.update(updateArgs);
  8211. }
  8212. } catch (err) {
  8213. _iterator3.e(err);
  8214. } finally {
  8215. _iterator3.f();
  8216. }
  8217. this.update();
  8218. this.eventBus.dispatch("optionalcontentconfigchanged", {
  8219. source: this,
  8220. promise: promise
  8221. });
  8222. }
  8223. }, {
  8224. key: "scrollMode",
  8225. get: function get() {
  8226. return this._scrollMode;
  8227. },
  8228. set: function set(mode) {
  8229. if (this._scrollMode === mode) {
  8230. return;
  8231. }
  8232. if (!(0, _ui_utils.isValidScrollMode)(mode)) {
  8233. throw new Error("Invalid scroll mode: ".concat(mode));
  8234. }
  8235. this._scrollMode = mode;
  8236. this.eventBus.dispatch("scrollmodechanged", {
  8237. source: this,
  8238. mode: mode
  8239. });
  8240. this._updateScrollMode(this._currentPageNumber);
  8241. }
  8242. }, {
  8243. key: "_updateScrollMode",
  8244. value: function _updateScrollMode() {
  8245. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  8246. var scrollMode = this._scrollMode,
  8247. viewer = this.viewer;
  8248. viewer.classList.toggle("scrollHorizontal", scrollMode === _ui_utils.ScrollMode.HORIZONTAL);
  8249. viewer.classList.toggle("scrollWrapped", scrollMode === _ui_utils.ScrollMode.WRAPPED);
  8250. if (!this.pdfDocument || !pageNumber) {
  8251. return;
  8252. }
  8253. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  8254. this._setScale(this._currentScaleValue, true);
  8255. }
  8256. this._setCurrentPageNumber(pageNumber, true);
  8257. this.update();
  8258. }
  8259. }, {
  8260. key: "spreadMode",
  8261. get: function get() {
  8262. return this._spreadMode;
  8263. },
  8264. set: function set(mode) {
  8265. if (this._spreadMode === mode) {
  8266. return;
  8267. }
  8268. if (!(0, _ui_utils.isValidSpreadMode)(mode)) {
  8269. throw new Error("Invalid spread mode: ".concat(mode));
  8270. }
  8271. this._spreadMode = mode;
  8272. this.eventBus.dispatch("spreadmodechanged", {
  8273. source: this,
  8274. mode: mode
  8275. });
  8276. this._updateSpreadMode(this._currentPageNumber);
  8277. }
  8278. }, {
  8279. key: "_updateSpreadMode",
  8280. value: function _updateSpreadMode() {
  8281. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  8282. if (!this.pdfDocument) {
  8283. return;
  8284. }
  8285. var viewer = this.viewer,
  8286. pages = this._pages;
  8287. viewer.textContent = "";
  8288. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  8289. for (var i = 0, iMax = pages.length; i < iMax; ++i) {
  8290. viewer.appendChild(pages[i].div);
  8291. }
  8292. } else {
  8293. var parity = this._spreadMode - 1;
  8294. var spread = null;
  8295. for (var _i = 0, _iMax = pages.length; _i < _iMax; ++_i) {
  8296. if (spread === null) {
  8297. spread = document.createElement("div");
  8298. spread.className = "spread";
  8299. viewer.appendChild(spread);
  8300. } else if (_i % 2 === parity) {
  8301. spread = spread.cloneNode(false);
  8302. viewer.appendChild(spread);
  8303. }
  8304. spread.appendChild(pages[_i].div);
  8305. }
  8306. }
  8307. if (!pageNumber) {
  8308. return;
  8309. }
  8310. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  8311. this._setScale(this._currentScaleValue, true);
  8312. }
  8313. this._setCurrentPageNumber(pageNumber, true);
  8314. this.update();
  8315. }
  8316. }, {
  8317. key: "_getPageAdvance",
  8318. value: function _getPageAdvance(currentPageNumber) {
  8319. var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8320. if (this.isInPresentationMode) {
  8321. return 1;
  8322. }
  8323. switch (this._scrollMode) {
  8324. case _ui_utils.ScrollMode.WRAPPED:
  8325. {
  8326. var _this$_getVisiblePage = this._getVisiblePages(),
  8327. views = _this$_getVisiblePage.views,
  8328. pageLayout = new Map();
  8329. var _iterator4 = _createForOfIteratorHelper(views),
  8330. _step4;
  8331. try {
  8332. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  8333. var _step4$value = _step4.value,
  8334. id = _step4$value.id,
  8335. y = _step4$value.y,
  8336. percent = _step4$value.percent,
  8337. widthPercent = _step4$value.widthPercent;
  8338. if (percent === 0 || widthPercent < 100) {
  8339. continue;
  8340. }
  8341. var yArray = pageLayout.get(y);
  8342. if (!yArray) {
  8343. pageLayout.set(y, yArray || (yArray = []));
  8344. }
  8345. yArray.push(id);
  8346. }
  8347. } catch (err) {
  8348. _iterator4.e(err);
  8349. } finally {
  8350. _iterator4.f();
  8351. }
  8352. var _iterator5 = _createForOfIteratorHelper(pageLayout.values()),
  8353. _step5;
  8354. try {
  8355. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  8356. var _yArray = _step5.value;
  8357. var currentIndex = _yArray.indexOf(currentPageNumber);
  8358. if (currentIndex === -1) {
  8359. continue;
  8360. }
  8361. var numPages = _yArray.length;
  8362. if (numPages === 1) {
  8363. break;
  8364. }
  8365. if (previous) {
  8366. for (var i = currentIndex - 1, ii = 0; i >= ii; i--) {
  8367. var currentId = _yArray[i],
  8368. expectedId = _yArray[i + 1] - 1;
  8369. if (currentId < expectedId) {
  8370. return currentPageNumber - expectedId;
  8371. }
  8372. }
  8373. } else {
  8374. for (var _i2 = currentIndex + 1, _ii = numPages; _i2 < _ii; _i2++) {
  8375. var _currentId = _yArray[_i2],
  8376. _expectedId = _yArray[_i2 - 1] + 1;
  8377. if (_currentId > _expectedId) {
  8378. return _expectedId - currentPageNumber;
  8379. }
  8380. }
  8381. }
  8382. if (previous) {
  8383. var firstId = _yArray[0];
  8384. if (firstId < currentPageNumber) {
  8385. return currentPageNumber - firstId + 1;
  8386. }
  8387. } else {
  8388. var lastId = _yArray[numPages - 1];
  8389. if (lastId > currentPageNumber) {
  8390. return lastId - currentPageNumber + 1;
  8391. }
  8392. }
  8393. break;
  8394. }
  8395. } catch (err) {
  8396. _iterator5.e(err);
  8397. } finally {
  8398. _iterator5.f();
  8399. }
  8400. break;
  8401. }
  8402. case _ui_utils.ScrollMode.HORIZONTAL:
  8403. {
  8404. break;
  8405. }
  8406. case _ui_utils.ScrollMode.VERTICAL:
  8407. {
  8408. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  8409. break;
  8410. }
  8411. var parity = this._spreadMode - 1;
  8412. if (previous && currentPageNumber % 2 !== parity) {
  8413. break;
  8414. } else if (!previous && currentPageNumber % 2 === parity) {
  8415. break;
  8416. }
  8417. var _this$_getVisiblePage2 = this._getVisiblePages(),
  8418. _views = _this$_getVisiblePage2.views,
  8419. _expectedId2 = previous ? currentPageNumber - 1 : currentPageNumber + 1;
  8420. var _iterator6 = _createForOfIteratorHelper(_views),
  8421. _step6;
  8422. try {
  8423. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  8424. var _step6$value = _step6.value,
  8425. _id = _step6$value.id,
  8426. _percent = _step6$value.percent,
  8427. _widthPercent = _step6$value.widthPercent;
  8428. if (_id !== _expectedId2) {
  8429. continue;
  8430. }
  8431. if (_percent > 0 && _widthPercent === 100) {
  8432. return 2;
  8433. }
  8434. break;
  8435. }
  8436. } catch (err) {
  8437. _iterator6.e(err);
  8438. } finally {
  8439. _iterator6.f();
  8440. }
  8441. break;
  8442. }
  8443. }
  8444. return 1;
  8445. }
  8446. }, {
  8447. key: "nextPage",
  8448. value: function nextPage() {
  8449. var currentPageNumber = this._currentPageNumber,
  8450. pagesCount = this.pagesCount;
  8451. if (currentPageNumber >= pagesCount) {
  8452. return false;
  8453. }
  8454. var advance = this._getPageAdvance(currentPageNumber, false) || 1;
  8455. this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);
  8456. return true;
  8457. }
  8458. }, {
  8459. key: "previousPage",
  8460. value: function previousPage() {
  8461. var currentPageNumber = this._currentPageNumber;
  8462. if (currentPageNumber <= 1) {
  8463. return false;
  8464. }
  8465. var advance = this._getPageAdvance(currentPageNumber, true) || 1;
  8466. this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
  8467. return true;
  8468. }
  8469. }, {
  8470. key: "increaseScale",
  8471. value: function increaseScale() {
  8472. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  8473. var newScale = this._currentScale;
  8474. do {
  8475. newScale = (newScale * _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  8476. newScale = Math.ceil(newScale * 10) / 10;
  8477. newScale = Math.min(_ui_utils.MAX_SCALE, newScale);
  8478. } while (--steps > 0 && newScale < _ui_utils.MAX_SCALE);
  8479. this.currentScaleValue = newScale;
  8480. }
  8481. }, {
  8482. key: "decreaseScale",
  8483. value: function decreaseScale() {
  8484. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  8485. var newScale = this._currentScale;
  8486. do {
  8487. newScale = (newScale / _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  8488. newScale = Math.floor(newScale * 10) / 10;
  8489. newScale = Math.max(_ui_utils.MIN_SCALE, newScale);
  8490. } while (--steps > 0 && newScale > _ui_utils.MIN_SCALE);
  8491. this.currentScaleValue = newScale;
  8492. }
  8493. }]);
  8494. return BaseViewer;
  8495. }();
  8496. exports.BaseViewer = BaseViewer;
  8497. /***/ }),
  8498. /* 24 */
  8499. /***/ ((__unused_webpack_module, exports) => {
  8500. Object.defineProperty(exports, "__esModule", ({
  8501. value: true
  8502. }));
  8503. exports.TextHighlighter = void 0;
  8504. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8505. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8506. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8507. var TextHighlighter = /*#__PURE__*/function () {
  8508. function TextHighlighter(_ref) {
  8509. var findController = _ref.findController,
  8510. eventBus = _ref.eventBus,
  8511. pageIndex = _ref.pageIndex;
  8512. _classCallCheck(this, TextHighlighter);
  8513. this.findController = findController;
  8514. this.matches = [];
  8515. this.eventBus = eventBus;
  8516. this.pageIdx = pageIndex;
  8517. this._onUpdateTextLayerMatches = null;
  8518. this.textDivs = null;
  8519. this.textContentItemsStr = null;
  8520. this.enabled = false;
  8521. }
  8522. _createClass(TextHighlighter, [{
  8523. key: "setTextMapping",
  8524. value: function setTextMapping(divs, texts) {
  8525. this.textDivs = divs;
  8526. this.textContentItemsStr = texts;
  8527. }
  8528. }, {
  8529. key: "enable",
  8530. value: function enable() {
  8531. var _this = this;
  8532. if (!this.textDivs || !this.textContentItemsStr) {
  8533. throw new Error("Text divs and strings have not been set.");
  8534. }
  8535. if (this.enabled) {
  8536. throw new Error("TextHighlighter is already enabled.");
  8537. }
  8538. this.enabled = true;
  8539. if (!this._onUpdateTextLayerMatches) {
  8540. this._onUpdateTextLayerMatches = function (evt) {
  8541. if (evt.pageIndex === _this.pageIdx || evt.pageIndex === -1) {
  8542. _this._updateMatches();
  8543. }
  8544. };
  8545. this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
  8546. }
  8547. this._updateMatches();
  8548. }
  8549. }, {
  8550. key: "disable",
  8551. value: function disable() {
  8552. if (!this.enabled) {
  8553. return;
  8554. }
  8555. this.enabled = false;
  8556. if (this._onUpdateTextLayerMatches) {
  8557. this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
  8558. this._onUpdateTextLayerMatches = null;
  8559. }
  8560. }
  8561. }, {
  8562. key: "_convertMatches",
  8563. value: function _convertMatches(matches, matchesLength) {
  8564. if (!matches) {
  8565. return [];
  8566. }
  8567. var textContentItemsStr = this.textContentItemsStr;
  8568. var i = 0,
  8569. iIndex = 0;
  8570. var end = textContentItemsStr.length - 1;
  8571. var result = [];
  8572. for (var m = 0, mm = matches.length; m < mm; m++) {
  8573. var matchIdx = matches[m];
  8574. while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {
  8575. iIndex += textContentItemsStr[i].length;
  8576. i++;
  8577. }
  8578. if (i === textContentItemsStr.length) {
  8579. console.error("Could not find a matching mapping");
  8580. }
  8581. var match = {
  8582. begin: {
  8583. divIdx: i,
  8584. offset: matchIdx - iIndex
  8585. }
  8586. };
  8587. matchIdx += matchesLength[m];
  8588. while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
  8589. iIndex += textContentItemsStr[i].length;
  8590. i++;
  8591. }
  8592. match.end = {
  8593. divIdx: i,
  8594. offset: matchIdx - iIndex
  8595. };
  8596. result.push(match);
  8597. }
  8598. return result;
  8599. }
  8600. }, {
  8601. key: "_renderMatches",
  8602. value: function _renderMatches(matches) {
  8603. if (matches.length === 0) {
  8604. return;
  8605. }
  8606. var findController = this.findController,
  8607. pageIdx = this.pageIdx;
  8608. var textContentItemsStr = this.textContentItemsStr,
  8609. textDivs = this.textDivs;
  8610. var isSelectedPage = pageIdx === findController.selected.pageIdx;
  8611. var selectedMatchIdx = findController.selected.matchIdx;
  8612. var highlightAll = findController.state.highlightAll;
  8613. var prevEnd = null;
  8614. var infinity = {
  8615. divIdx: -1,
  8616. offset: undefined
  8617. };
  8618. function beginText(begin, className) {
  8619. var divIdx = begin.divIdx;
  8620. textDivs[divIdx].textContent = "";
  8621. return appendTextToDiv(divIdx, 0, begin.offset, className);
  8622. }
  8623. function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
  8624. var div = textDivs[divIdx];
  8625. if (div.nodeType === Node.TEXT_NODE) {
  8626. var span = document.createElement("span");
  8627. div.parentNode.insertBefore(span, div);
  8628. span.appendChild(div);
  8629. textDivs[divIdx] = span;
  8630. div = span;
  8631. }
  8632. var content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
  8633. var node = document.createTextNode(content);
  8634. if (className) {
  8635. var _span = document.createElement("span");
  8636. _span.className = "".concat(className, " appended");
  8637. _span.appendChild(node);
  8638. div.appendChild(_span);
  8639. return className.includes("selected") ? _span.offsetLeft : 0;
  8640. }
  8641. div.appendChild(node);
  8642. return 0;
  8643. }
  8644. var i0 = selectedMatchIdx,
  8645. i1 = i0 + 1;
  8646. if (highlightAll) {
  8647. i0 = 0;
  8648. i1 = matches.length;
  8649. } else if (!isSelectedPage) {
  8650. return;
  8651. }
  8652. for (var i = i0; i < i1; i++) {
  8653. var match = matches[i];
  8654. var begin = match.begin;
  8655. var end = match.end;
  8656. var isSelected = isSelectedPage && i === selectedMatchIdx;
  8657. var highlightSuffix = isSelected ? " selected" : "";
  8658. var selectedLeft = 0;
  8659. if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
  8660. if (prevEnd !== null) {
  8661. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  8662. }
  8663. beginText(begin);
  8664. } else {
  8665. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
  8666. }
  8667. if (begin.divIdx === end.divIdx) {
  8668. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);
  8669. } else {
  8670. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);
  8671. for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
  8672. textDivs[n0].className = "highlight middle" + highlightSuffix;
  8673. }
  8674. beginText(end, "highlight end" + highlightSuffix);
  8675. }
  8676. prevEnd = end;
  8677. if (isSelected) {
  8678. findController.scrollMatchIntoView({
  8679. element: textDivs[begin.divIdx],
  8680. selectedLeft: selectedLeft,
  8681. pageIndex: pageIdx,
  8682. matchIndex: selectedMatchIdx
  8683. });
  8684. }
  8685. }
  8686. if (prevEnd) {
  8687. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  8688. }
  8689. }
  8690. }, {
  8691. key: "_updateMatches",
  8692. value: function _updateMatches() {
  8693. if (!this.enabled) {
  8694. return;
  8695. }
  8696. var findController = this.findController,
  8697. matches = this.matches,
  8698. pageIdx = this.pageIdx;
  8699. var textContentItemsStr = this.textContentItemsStr,
  8700. textDivs = this.textDivs;
  8701. var clearedUntilDivIdx = -1;
  8702. for (var i = 0, ii = matches.length; i < ii; i++) {
  8703. var match = matches[i];
  8704. var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
  8705. for (var n = begin, end = match.end.divIdx; n <= end; n++) {
  8706. var div = textDivs[n];
  8707. div.textContent = textContentItemsStr[n];
  8708. div.className = "";
  8709. }
  8710. clearedUntilDivIdx = match.end.divIdx + 1;
  8711. }
  8712. if (!(findController !== null && findController !== void 0 && findController.highlightMatches)) {
  8713. return;
  8714. }
  8715. var pageMatches = findController.pageMatches[pageIdx] || null;
  8716. var pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;
  8717. this.matches = this._convertMatches(pageMatches, pageMatchesLength);
  8718. this._renderMatches(this.matches);
  8719. }
  8720. }]);
  8721. return TextHighlighter;
  8722. }();
  8723. exports.TextHighlighter = TextHighlighter;
  8724. /***/ }),
  8725. /* 25 */
  8726. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8727. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8728. Object.defineProperty(exports, "__esModule", ({
  8729. value: true
  8730. }));
  8731. exports.PDFViewer = void 0;
  8732. var _ui_utils = __w_pdfjs_require__(7);
  8733. var _base_viewer = __w_pdfjs_require__(23);
  8734. var _pdfjsLib = __w_pdfjs_require__(4);
  8735. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  8736. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  8737. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  8738. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8739. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8740. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8741. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  8742. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  8743. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8744. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8745. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  8746. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  8747. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8748. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  8749. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8750. var PDFViewer = /*#__PURE__*/function (_BaseViewer) {
  8751. _inherits(PDFViewer, _BaseViewer);
  8752. var _super = _createSuper(PDFViewer);
  8753. function PDFViewer() {
  8754. _classCallCheck(this, PDFViewer);
  8755. return _super.apply(this, arguments);
  8756. }
  8757. _createClass(PDFViewer, [{
  8758. key: "_viewerElement",
  8759. get: function get() {
  8760. return (0, _pdfjsLib.shadow)(this, "_viewerElement", this.viewer);
  8761. }
  8762. }, {
  8763. key: "_scrollIntoView",
  8764. value: function _scrollIntoView(_ref) {
  8765. var pageDiv = _ref.pageDiv,
  8766. _ref$pageSpot = _ref.pageSpot,
  8767. pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot,
  8768. _ref$pageNumber = _ref.pageNumber,
  8769. pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber;
  8770. if (!pageSpot && !this.isInPresentationMode) {
  8771. var left = pageDiv.offsetLeft + pageDiv.clientLeft;
  8772. var right = left + pageDiv.clientWidth;
  8773. var _this$container = this.container,
  8774. scrollLeft = _this$container.scrollLeft,
  8775. clientWidth = _this$container.clientWidth;
  8776. if (this._isScrollModeHorizontal || left < scrollLeft || right > scrollLeft + clientWidth) {
  8777. pageSpot = {
  8778. left: 0,
  8779. top: 0
  8780. };
  8781. }
  8782. }
  8783. _get(_getPrototypeOf(PDFViewer.prototype), "_scrollIntoView", this).call(this, {
  8784. pageDiv: pageDiv,
  8785. pageSpot: pageSpot,
  8786. pageNumber: pageNumber
  8787. });
  8788. }
  8789. }, {
  8790. key: "_getVisiblePages",
  8791. value: function _getVisiblePages() {
  8792. if (this.isInPresentationMode) {
  8793. return this._getCurrentVisiblePage();
  8794. }
  8795. return _get(_getPrototypeOf(PDFViewer.prototype), "_getVisiblePages", this).call(this);
  8796. }
  8797. }, {
  8798. key: "_updateHelper",
  8799. value: function _updateHelper(visiblePages) {
  8800. if (this.isInPresentationMode) {
  8801. return;
  8802. }
  8803. var currentId = this._currentPageNumber;
  8804. var stillFullyVisible = false;
  8805. var _iterator = _createForOfIteratorHelper(visiblePages),
  8806. _step;
  8807. try {
  8808. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  8809. var page = _step.value;
  8810. if (page.percent < 100) {
  8811. break;
  8812. }
  8813. if (page.id === currentId && this._scrollMode === _ui_utils.ScrollMode.VERTICAL && this._spreadMode === _ui_utils.SpreadMode.NONE) {
  8814. stillFullyVisible = true;
  8815. break;
  8816. }
  8817. }
  8818. } catch (err) {
  8819. _iterator.e(err);
  8820. } finally {
  8821. _iterator.f();
  8822. }
  8823. if (!stillFullyVisible) {
  8824. currentId = visiblePages[0].id;
  8825. }
  8826. this._setCurrentPageNumber(currentId);
  8827. }
  8828. }]);
  8829. return PDFViewer;
  8830. }(_base_viewer.BaseViewer);
  8831. exports.PDFViewer = PDFViewer;
  8832. /***/ })
  8833. /******/ ]);
  8834. /************************************************************************/
  8835. /******/ // The module cache
  8836. /******/ var __webpack_module_cache__ = {};
  8837. /******/
  8838. /******/ // The require function
  8839. /******/ function __w_pdfjs_require__(moduleId) {
  8840. /******/ // Check if module is in cache
  8841. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  8842. /******/ if (cachedModule !== undefined) {
  8843. /******/ return cachedModule.exports;
  8844. /******/ }
  8845. /******/ // Create a new module (and put it into the cache)
  8846. /******/ var module = __webpack_module_cache__[moduleId] = {
  8847. /******/ id: moduleId,
  8848. /******/ loaded: false,
  8849. /******/ exports: {}
  8850. /******/ };
  8851. /******/
  8852. /******/ // Execute the module function
  8853. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  8854. /******/
  8855. /******/ // Flag the module as loaded
  8856. /******/ module.loaded = true;
  8857. /******/
  8858. /******/ // Return the exports of the module
  8859. /******/ return module.exports;
  8860. /******/ }
  8861. /******/
  8862. /************************************************************************/
  8863. /******/ /* webpack/runtime/node module decorator */
  8864. /******/ (() => {
  8865. /******/ __w_pdfjs_require__.nmd = (module) => {
  8866. /******/ module.paths = [];
  8867. /******/ if (!module.children) module.children = [];
  8868. /******/ return module;
  8869. /******/ };
  8870. /******/ })();
  8871. /******/
  8872. /************************************************************************/
  8873. var __webpack_exports__ = {};
  8874. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  8875. (() => {
  8876. var exports = __webpack_exports__;
  8877. Object.defineProperty(exports, "__esModule", ({
  8878. value: true
  8879. }));
  8880. Object.defineProperty(exports, "AnnotationLayerBuilder", ({
  8881. enumerable: true,
  8882. get: function get() {
  8883. return _annotation_layer_builder.AnnotationLayerBuilder;
  8884. }
  8885. }));
  8886. Object.defineProperty(exports, "DefaultAnnotationLayerFactory", ({
  8887. enumerable: true,
  8888. get: function get() {
  8889. return _annotation_layer_builder.DefaultAnnotationLayerFactory;
  8890. }
  8891. }));
  8892. Object.defineProperty(exports, "DefaultStructTreeLayerFactory", ({
  8893. enumerable: true,
  8894. get: function get() {
  8895. return _struct_tree_layer_builder.DefaultStructTreeLayerFactory;
  8896. }
  8897. }));
  8898. Object.defineProperty(exports, "StructTreeLayerBuilder", ({
  8899. enumerable: true,
  8900. get: function get() {
  8901. return _struct_tree_layer_builder.StructTreeLayerBuilder;
  8902. }
  8903. }));
  8904. Object.defineProperty(exports, "DefaultTextLayerFactory", ({
  8905. enumerable: true,
  8906. get: function get() {
  8907. return _text_layer_builder.DefaultTextLayerFactory;
  8908. }
  8909. }));
  8910. Object.defineProperty(exports, "TextLayerBuilder", ({
  8911. enumerable: true,
  8912. get: function get() {
  8913. return _text_layer_builder.TextLayerBuilder;
  8914. }
  8915. }));
  8916. Object.defineProperty(exports, "DefaultXfaLayerFactory", ({
  8917. enumerable: true,
  8918. get: function get() {
  8919. return _xfa_layer_builder.DefaultXfaLayerFactory;
  8920. }
  8921. }));
  8922. Object.defineProperty(exports, "XfaLayerBuilder", ({
  8923. enumerable: true,
  8924. get: function get() {
  8925. return _xfa_layer_builder.XfaLayerBuilder;
  8926. }
  8927. }));
  8928. Object.defineProperty(exports, "EventBus", ({
  8929. enumerable: true,
  8930. get: function get() {
  8931. return _ui_utils.EventBus;
  8932. }
  8933. }));
  8934. Object.defineProperty(exports, "ProgressBar", ({
  8935. enumerable: true,
  8936. get: function get() {
  8937. return _ui_utils.ProgressBar;
  8938. }
  8939. }));
  8940. Object.defineProperty(exports, "PDFLinkService", ({
  8941. enumerable: true,
  8942. get: function get() {
  8943. return _pdf_link_service.PDFLinkService;
  8944. }
  8945. }));
  8946. Object.defineProperty(exports, "SimpleLinkService", ({
  8947. enumerable: true,
  8948. get: function get() {
  8949. return _pdf_link_service.SimpleLinkService;
  8950. }
  8951. }));
  8952. Object.defineProperty(exports, "DownloadManager", ({
  8953. enumerable: true,
  8954. get: function get() {
  8955. return _download_manager.DownloadManager;
  8956. }
  8957. }));
  8958. Object.defineProperty(exports, "GenericL10n", ({
  8959. enumerable: true,
  8960. get: function get() {
  8961. return _genericl10n.GenericL10n;
  8962. }
  8963. }));
  8964. Object.defineProperty(exports, "NullL10n", ({
  8965. enumerable: true,
  8966. get: function get() {
  8967. return _l10n_utils.NullL10n;
  8968. }
  8969. }));
  8970. Object.defineProperty(exports, "PDFFindController", ({
  8971. enumerable: true,
  8972. get: function get() {
  8973. return _pdf_find_controller.PDFFindController;
  8974. }
  8975. }));
  8976. Object.defineProperty(exports, "PDFHistory", ({
  8977. enumerable: true,
  8978. get: function get() {
  8979. return _pdf_history.PDFHistory;
  8980. }
  8981. }));
  8982. Object.defineProperty(exports, "PDFPageView", ({
  8983. enumerable: true,
  8984. get: function get() {
  8985. return _pdf_page_view.PDFPageView;
  8986. }
  8987. }));
  8988. Object.defineProperty(exports, "PDFScriptingManager", ({
  8989. enumerable: true,
  8990. get: function get() {
  8991. return _pdf_scripting_manager.PDFScriptingManager;
  8992. }
  8993. }));
  8994. Object.defineProperty(exports, "PDFSinglePageViewer", ({
  8995. enumerable: true,
  8996. get: function get() {
  8997. return _pdf_single_page_viewer.PDFSinglePageViewer;
  8998. }
  8999. }));
  9000. Object.defineProperty(exports, "PDFViewer", ({
  9001. enumerable: true,
  9002. get: function get() {
  9003. return _pdf_viewer.PDFViewer;
  9004. }
  9005. }));
  9006. var _annotation_layer_builder = __w_pdfjs_require__(1);
  9007. var _struct_tree_layer_builder = __w_pdfjs_require__(8);
  9008. var _text_layer_builder = __w_pdfjs_require__(9);
  9009. var _xfa_layer_builder = __w_pdfjs_require__(10);
  9010. var _ui_utils = __w_pdfjs_require__(7);
  9011. var _pdf_link_service = __w_pdfjs_require__(6);
  9012. var _download_manager = __w_pdfjs_require__(11);
  9013. var _genericl10n = __w_pdfjs_require__(13);
  9014. var _l10n_utils = __w_pdfjs_require__(5);
  9015. var _pdf_find_controller = __w_pdfjs_require__(15);
  9016. var _pdf_history = __w_pdfjs_require__(17);
  9017. var _pdf_page_view = __w_pdfjs_require__(18);
  9018. var _pdf_scripting_manager = __w_pdfjs_require__(20);
  9019. var _pdf_single_page_viewer = __w_pdfjs_require__(22);
  9020. var _pdf_viewer = __w_pdfjs_require__(25);
  9021. var pdfjsVersion = '2.11.338';
  9022. var pdfjsBuild = 'dedff3c98';
  9023. })();
  9024. /******/ return __webpack_exports__;
  9025. /******/ })()
  9026. ;
  9027. });
  9028. //# sourceMappingURL=pdf_viewer.js.map