2
0

pdf_viewer.js 401 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2022 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.DefaultXfaLayerFactory = exports.DefaultTextLayerFactory = exports.DefaultStructTreeLayerFactory = exports.DefaultAnnotationLayerFactory = void 0;
  42. var _annotation_layer_builder = __w_pdfjs_require__(2);
  43. var _l10n_utils = __w_pdfjs_require__(6);
  44. var _pdf_link_service = __w_pdfjs_require__(7);
  45. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  46. var _text_layer_builder = __w_pdfjs_require__(10);
  47. var _xfa_layer_builder = __w_pdfjs_require__(11);
  48. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  49. 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); } }
  50. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  51. var DefaultAnnotationLayerFactory = /*#__PURE__*/function () {
  52. function DefaultAnnotationLayerFactory() {
  53. _classCallCheck(this, DefaultAnnotationLayerFactory);
  54. }
  55. _createClass(DefaultAnnotationLayerFactory, [{
  56. key: "createAnnotationLayerBuilder",
  57. value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
  58. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  59. var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
  60. var renderForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  61. var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _l10n_utils.NullL10n;
  62. var enableScripting = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  63. var hasJSActionsPromise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  64. var mouseState = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
  65. var fieldObjectsPromise = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
  66. var annotationCanvasMap = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
  67. return new _annotation_layer_builder.AnnotationLayerBuilder({
  68. pageDiv: pageDiv,
  69. pdfPage: pdfPage,
  70. imageResourcesPath: imageResourcesPath,
  71. renderForms: renderForms,
  72. linkService: new _pdf_link_service.SimpleLinkService(),
  73. l10n: l10n,
  74. annotationStorage: annotationStorage,
  75. enableScripting: enableScripting,
  76. hasJSActionsPromise: hasJSActionsPromise,
  77. fieldObjectsPromise: fieldObjectsPromise,
  78. mouseState: mouseState,
  79. annotationCanvasMap: annotationCanvasMap
  80. });
  81. }
  82. }]);
  83. return DefaultAnnotationLayerFactory;
  84. }();
  85. exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
  86. var DefaultStructTreeLayerFactory = /*#__PURE__*/function () {
  87. function DefaultStructTreeLayerFactory() {
  88. _classCallCheck(this, DefaultStructTreeLayerFactory);
  89. }
  90. _createClass(DefaultStructTreeLayerFactory, [{
  91. key: "createStructTreeLayerBuilder",
  92. value: function createStructTreeLayerBuilder(pdfPage) {
  93. return new _struct_tree_layer_builder.StructTreeLayerBuilder({
  94. pdfPage: pdfPage
  95. });
  96. }
  97. }]);
  98. return DefaultStructTreeLayerFactory;
  99. }();
  100. exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory;
  101. var DefaultTextLayerFactory = /*#__PURE__*/function () {
  102. function DefaultTextLayerFactory() {
  103. _classCallCheck(this, DefaultTextLayerFactory);
  104. }
  105. _createClass(DefaultTextLayerFactory, [{
  106. key: "createTextLayerBuilder",
  107. value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
  108. var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  109. var eventBus = arguments.length > 4 ? arguments[4] : undefined;
  110. var highlighter = arguments.length > 5 ? arguments[5] : undefined;
  111. return new _text_layer_builder.TextLayerBuilder({
  112. textLayerDiv: textLayerDiv,
  113. pageIndex: pageIndex,
  114. viewport: viewport,
  115. enhanceTextSelection: enhanceTextSelection,
  116. eventBus: eventBus,
  117. highlighter: highlighter
  118. });
  119. }
  120. }]);
  121. return DefaultTextLayerFactory;
  122. }();
  123. exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
  124. var DefaultXfaLayerFactory = /*#__PURE__*/function () {
  125. function DefaultXfaLayerFactory() {
  126. _classCallCheck(this, DefaultXfaLayerFactory);
  127. }
  128. _createClass(DefaultXfaLayerFactory, [{
  129. key: "createXfaLayerBuilder",
  130. value: function createXfaLayerBuilder(pageDiv, pdfPage) {
  131. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  132. var xfaHtml = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  133. return new _xfa_layer_builder.XfaLayerBuilder({
  134. pageDiv: pageDiv,
  135. pdfPage: pdfPage,
  136. annotationStorage: annotationStorage,
  137. linkService: new _pdf_link_service.SimpleLinkService(),
  138. xfaHtml: xfaHtml
  139. });
  140. }
  141. }]);
  142. return DefaultXfaLayerFactory;
  143. }();
  144. exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory;
  145. /***/ }),
  146. /* 2 */
  147. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  148. Object.defineProperty(exports, "__esModule", ({
  149. value: true
  150. }));
  151. exports.AnnotationLayerBuilder = void 0;
  152. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  153. var _pdfjsLib = __w_pdfjs_require__(5);
  154. var _l10n_utils = __w_pdfjs_require__(6);
  155. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  156. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  157. 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."); }
  158. 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); }
  159. 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; }
  160. 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; }
  161. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  162. 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); } }
  163. 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); }); }; }
  164. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  165. 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); } }
  166. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  167. var AnnotationLayerBuilder = /*#__PURE__*/function () {
  168. function AnnotationLayerBuilder(_ref) {
  169. var pageDiv = _ref.pageDiv,
  170. pdfPage = _ref.pdfPage,
  171. linkService = _ref.linkService,
  172. downloadManager = _ref.downloadManager,
  173. _ref$annotationStorag = _ref.annotationStorage,
  174. annotationStorage = _ref$annotationStorag === void 0 ? null : _ref$annotationStorag,
  175. _ref$imageResourcesPa = _ref.imageResourcesPath,
  176. imageResourcesPath = _ref$imageResourcesPa === void 0 ? "" : _ref$imageResourcesPa,
  177. _ref$renderForms = _ref.renderForms,
  178. renderForms = _ref$renderForms === void 0 ? true : _ref$renderForms,
  179. _ref$l10n = _ref.l10n,
  180. l10n = _ref$l10n === void 0 ? _l10n_utils.NullL10n : _ref$l10n,
  181. _ref$enableScripting = _ref.enableScripting,
  182. enableScripting = _ref$enableScripting === void 0 ? false : _ref$enableScripting,
  183. _ref$hasJSActionsProm = _ref.hasJSActionsPromise,
  184. hasJSActionsPromise = _ref$hasJSActionsProm === void 0 ? null : _ref$hasJSActionsProm,
  185. _ref$fieldObjectsProm = _ref.fieldObjectsPromise,
  186. fieldObjectsPromise = _ref$fieldObjectsProm === void 0 ? null : _ref$fieldObjectsProm,
  187. _ref$mouseState = _ref.mouseState,
  188. mouseState = _ref$mouseState === void 0 ? null : _ref$mouseState,
  189. _ref$annotationCanvas = _ref.annotationCanvasMap,
  190. annotationCanvasMap = _ref$annotationCanvas === void 0 ? null : _ref$annotationCanvas;
  191. _classCallCheck(this, AnnotationLayerBuilder);
  192. this.pageDiv = pageDiv;
  193. this.pdfPage = pdfPage;
  194. this.linkService = linkService;
  195. this.downloadManager = downloadManager;
  196. this.imageResourcesPath = imageResourcesPath;
  197. this.renderForms = renderForms;
  198. this.l10n = l10n;
  199. this.annotationStorage = annotationStorage;
  200. this.enableScripting = enableScripting;
  201. this._hasJSActionsPromise = hasJSActionsPromise;
  202. this._fieldObjectsPromise = fieldObjectsPromise;
  203. this._mouseState = mouseState;
  204. this._annotationCanvasMap = annotationCanvasMap;
  205. this.div = null;
  206. this._cancelled = false;
  207. }
  208. _createClass(AnnotationLayerBuilder, [{
  209. key: "render",
  210. value: function () {
  211. var _render = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(viewport) {
  212. var intent,
  213. _yield$Promise$all,
  214. _yield$Promise$all2,
  215. annotations,
  216. _yield$Promise$all2$,
  217. hasJSActions,
  218. _yield$Promise$all2$2,
  219. fieldObjects,
  220. parameters,
  221. _args = arguments;
  222. return _regenerator["default"].wrap(function _callee$(_context) {
  223. while (1) {
  224. switch (_context.prev = _context.next) {
  225. case 0:
  226. intent = _args.length > 1 && _args[1] !== undefined ? _args[1] : "display";
  227. _context.next = 3;
  228. return Promise.all([this.pdfPage.getAnnotations({
  229. intent: intent
  230. }), this._hasJSActionsPromise, this._fieldObjectsPromise]);
  231. case 3:
  232. _yield$Promise$all = _context.sent;
  233. _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
  234. annotations = _yield$Promise$all2[0];
  235. _yield$Promise$all2$ = _yield$Promise$all2[1];
  236. hasJSActions = _yield$Promise$all2$ === void 0 ? false : _yield$Promise$all2$;
  237. _yield$Promise$all2$2 = _yield$Promise$all2[2];
  238. fieldObjects = _yield$Promise$all2$2 === void 0 ? null : _yield$Promise$all2$2;
  239. if (!(this._cancelled || annotations.length === 0)) {
  240. _context.next = 12;
  241. break;
  242. }
  243. return _context.abrupt("return");
  244. case 12:
  245. parameters = {
  246. viewport: viewport.clone({
  247. dontFlip: true
  248. }),
  249. div: this.div,
  250. annotations: annotations,
  251. page: this.pdfPage,
  252. imageResourcesPath: this.imageResourcesPath,
  253. renderForms: this.renderForms,
  254. linkService: this.linkService,
  255. downloadManager: this.downloadManager,
  256. annotationStorage: this.annotationStorage,
  257. enableScripting: this.enableScripting,
  258. hasJSActions: hasJSActions,
  259. fieldObjects: fieldObjects,
  260. mouseState: this._mouseState,
  261. annotationCanvasMap: this._annotationCanvasMap
  262. };
  263. if (this.div) {
  264. _pdfjsLib.AnnotationLayer.update(parameters);
  265. } else {
  266. this.div = document.createElement("div");
  267. this.div.className = "annotationLayer";
  268. this.pageDiv.appendChild(this.div);
  269. parameters.div = this.div;
  270. _pdfjsLib.AnnotationLayer.render(parameters);
  271. this.l10n.translate(this.div);
  272. }
  273. case 14:
  274. case "end":
  275. return _context.stop();
  276. }
  277. }
  278. }, _callee, this);
  279. }));
  280. function render(_x) {
  281. return _render.apply(this, arguments);
  282. }
  283. return render;
  284. }()
  285. }, {
  286. key: "cancel",
  287. value: function cancel() {
  288. this._cancelled = true;
  289. }
  290. }, {
  291. key: "hide",
  292. value: function hide() {
  293. if (!this.div) {
  294. return;
  295. }
  296. this.div.hidden = true;
  297. }
  298. }]);
  299. return AnnotationLayerBuilder;
  300. }();
  301. exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
  302. /***/ }),
  303. /* 3 */
  304. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  305. module.exports = __w_pdfjs_require__(4);
  306. /***/ }),
  307. /* 4 */
  308. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  309. /* module decorator */ module = __w_pdfjs_require__.nmd(module);
  310. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  311. var runtime = function (exports) {
  312. "use strict";
  313. var Op = Object.prototype;
  314. var hasOwn = Op.hasOwnProperty;
  315. var undefined;
  316. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  317. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  318. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  319. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  320. function define(obj, key, value) {
  321. Object.defineProperty(obj, key, {
  322. value: value,
  323. enumerable: true,
  324. configurable: true,
  325. writable: true
  326. });
  327. return obj[key];
  328. }
  329. try {
  330. define({}, "");
  331. } catch (err) {
  332. define = function define(obj, key, value) {
  333. return obj[key] = value;
  334. };
  335. }
  336. function wrap(innerFn, outerFn, self, tryLocsList) {
  337. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  338. var generator = Object.create(protoGenerator.prototype);
  339. var context = new Context(tryLocsList || []);
  340. generator._invoke = makeInvokeMethod(innerFn, self, context);
  341. return generator;
  342. }
  343. exports.wrap = wrap;
  344. function tryCatch(fn, obj, arg) {
  345. try {
  346. return {
  347. type: "normal",
  348. arg: fn.call(obj, arg)
  349. };
  350. } catch (err) {
  351. return {
  352. type: "throw",
  353. arg: err
  354. };
  355. }
  356. }
  357. var GenStateSuspendedStart = "suspendedStart";
  358. var GenStateSuspendedYield = "suspendedYield";
  359. var GenStateExecuting = "executing";
  360. var GenStateCompleted = "completed";
  361. var ContinueSentinel = {};
  362. function Generator() {}
  363. function GeneratorFunction() {}
  364. function GeneratorFunctionPrototype() {}
  365. var IteratorPrototype = {};
  366. define(IteratorPrototype, iteratorSymbol, function () {
  367. return this;
  368. });
  369. var getProto = Object.getPrototypeOf;
  370. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  371. if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  372. IteratorPrototype = NativeIteratorPrototype;
  373. }
  374. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  375. GeneratorFunction.prototype = GeneratorFunctionPrototype;
  376. define(Gp, "constructor", GeneratorFunctionPrototype);
  377. define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  378. GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
  379. function defineIteratorMethods(prototype) {
  380. ["next", "throw", "return"].forEach(function (method) {
  381. define(prototype, method, function (arg) {
  382. return this._invoke(method, arg);
  383. });
  384. });
  385. }
  386. exports.isGeneratorFunction = function (genFun) {
  387. var ctor = typeof genFun === "function" && genFun.constructor;
  388. return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  389. };
  390. exports.mark = function (genFun) {
  391. if (Object.setPrototypeOf) {
  392. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  393. } else {
  394. genFun.__proto__ = GeneratorFunctionPrototype;
  395. define(genFun, toStringTagSymbol, "GeneratorFunction");
  396. }
  397. genFun.prototype = Object.create(Gp);
  398. return genFun;
  399. };
  400. exports.awrap = function (arg) {
  401. return {
  402. __await: arg
  403. };
  404. };
  405. function AsyncIterator(generator, PromiseImpl) {
  406. function invoke(method, arg, resolve, reject) {
  407. var record = tryCatch(generator[method], generator, arg);
  408. if (record.type === "throw") {
  409. reject(record.arg);
  410. } else {
  411. var result = record.arg;
  412. var value = result.value;
  413. if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
  414. return PromiseImpl.resolve(value.__await).then(function (value) {
  415. invoke("next", value, resolve, reject);
  416. }, function (err) {
  417. invoke("throw", err, resolve, reject);
  418. });
  419. }
  420. return PromiseImpl.resolve(value).then(function (unwrapped) {
  421. result.value = unwrapped;
  422. resolve(result);
  423. }, function (error) {
  424. return invoke("throw", error, resolve, reject);
  425. });
  426. }
  427. }
  428. var previousPromise;
  429. function enqueue(method, arg) {
  430. function callInvokeWithMethodAndArg() {
  431. return new PromiseImpl(function (resolve, reject) {
  432. invoke(method, arg, resolve, reject);
  433. });
  434. }
  435. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  436. }
  437. this._invoke = enqueue;
  438. }
  439. defineIteratorMethods(AsyncIterator.prototype);
  440. define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  441. return this;
  442. });
  443. exports.AsyncIterator = AsyncIterator;
  444. exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  445. if (PromiseImpl === void 0) PromiseImpl = Promise;
  446. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  447. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  448. return result.done ? result.value : iter.next();
  449. });
  450. };
  451. function makeInvokeMethod(innerFn, self, context) {
  452. var state = GenStateSuspendedStart;
  453. return function invoke(method, arg) {
  454. if (state === GenStateExecuting) {
  455. throw new Error("Generator is already running");
  456. }
  457. if (state === GenStateCompleted) {
  458. if (method === "throw") {
  459. throw arg;
  460. }
  461. return doneResult();
  462. }
  463. context.method = method;
  464. context.arg = arg;
  465. while (true) {
  466. var delegate = context.delegate;
  467. if (delegate) {
  468. var delegateResult = maybeInvokeDelegate(delegate, context);
  469. if (delegateResult) {
  470. if (delegateResult === ContinueSentinel) continue;
  471. return delegateResult;
  472. }
  473. }
  474. if (context.method === "next") {
  475. context.sent = context._sent = context.arg;
  476. } else if (context.method === "throw") {
  477. if (state === GenStateSuspendedStart) {
  478. state = GenStateCompleted;
  479. throw context.arg;
  480. }
  481. context.dispatchException(context.arg);
  482. } else if (context.method === "return") {
  483. context.abrupt("return", context.arg);
  484. }
  485. state = GenStateExecuting;
  486. var record = tryCatch(innerFn, self, context);
  487. if (record.type === "normal") {
  488. state = context.done ? GenStateCompleted : GenStateSuspendedYield;
  489. if (record.arg === ContinueSentinel) {
  490. continue;
  491. }
  492. return {
  493. value: record.arg,
  494. done: context.done
  495. };
  496. } else if (record.type === "throw") {
  497. state = GenStateCompleted;
  498. context.method = "throw";
  499. context.arg = record.arg;
  500. }
  501. }
  502. };
  503. }
  504. function maybeInvokeDelegate(delegate, context) {
  505. var method = delegate.iterator[context.method];
  506. if (method === undefined) {
  507. context.delegate = null;
  508. if (context.method === "throw") {
  509. if (delegate.iterator["return"]) {
  510. context.method = "return";
  511. context.arg = undefined;
  512. maybeInvokeDelegate(delegate, context);
  513. if (context.method === "throw") {
  514. return ContinueSentinel;
  515. }
  516. }
  517. context.method = "throw";
  518. context.arg = new TypeError("The iterator does not provide a 'throw' method");
  519. }
  520. return ContinueSentinel;
  521. }
  522. var record = tryCatch(method, delegate.iterator, context.arg);
  523. if (record.type === "throw") {
  524. context.method = "throw";
  525. context.arg = record.arg;
  526. context.delegate = null;
  527. return ContinueSentinel;
  528. }
  529. var info = record.arg;
  530. if (!info) {
  531. context.method = "throw";
  532. context.arg = new TypeError("iterator result is not an object");
  533. context.delegate = null;
  534. return ContinueSentinel;
  535. }
  536. if (info.done) {
  537. context[delegate.resultName] = info.value;
  538. context.next = delegate.nextLoc;
  539. if (context.method !== "return") {
  540. context.method = "next";
  541. context.arg = undefined;
  542. }
  543. } else {
  544. return info;
  545. }
  546. context.delegate = null;
  547. return ContinueSentinel;
  548. }
  549. defineIteratorMethods(Gp);
  550. define(Gp, toStringTagSymbol, "Generator");
  551. define(Gp, iteratorSymbol, function () {
  552. return this;
  553. });
  554. define(Gp, "toString", function () {
  555. return "[object Generator]";
  556. });
  557. function pushTryEntry(locs) {
  558. var entry = {
  559. tryLoc: locs[0]
  560. };
  561. if (1 in locs) {
  562. entry.catchLoc = locs[1];
  563. }
  564. if (2 in locs) {
  565. entry.finallyLoc = locs[2];
  566. entry.afterLoc = locs[3];
  567. }
  568. this.tryEntries.push(entry);
  569. }
  570. function resetTryEntry(entry) {
  571. var record = entry.completion || {};
  572. record.type = "normal";
  573. delete record.arg;
  574. entry.completion = record;
  575. }
  576. function Context(tryLocsList) {
  577. this.tryEntries = [{
  578. tryLoc: "root"
  579. }];
  580. tryLocsList.forEach(pushTryEntry, this);
  581. this.reset(true);
  582. }
  583. exports.keys = function (object) {
  584. var keys = [];
  585. for (var key in object) {
  586. keys.push(key);
  587. }
  588. keys.reverse();
  589. return function next() {
  590. while (keys.length) {
  591. var key = keys.pop();
  592. if (key in object) {
  593. next.value = key;
  594. next.done = false;
  595. return next;
  596. }
  597. }
  598. next.done = true;
  599. return next;
  600. };
  601. };
  602. function values(iterable) {
  603. if (iterable) {
  604. var iteratorMethod = iterable[iteratorSymbol];
  605. if (iteratorMethod) {
  606. return iteratorMethod.call(iterable);
  607. }
  608. if (typeof iterable.next === "function") {
  609. return iterable;
  610. }
  611. if (!isNaN(iterable.length)) {
  612. var i = -1,
  613. next = function next() {
  614. while (++i < iterable.length) {
  615. if (hasOwn.call(iterable, i)) {
  616. next.value = iterable[i];
  617. next.done = false;
  618. return next;
  619. }
  620. }
  621. next.value = undefined;
  622. next.done = true;
  623. return next;
  624. };
  625. return next.next = next;
  626. }
  627. }
  628. return {
  629. next: doneResult
  630. };
  631. }
  632. exports.values = values;
  633. function doneResult() {
  634. return {
  635. value: undefined,
  636. done: true
  637. };
  638. }
  639. Context.prototype = {
  640. constructor: Context,
  641. reset: function reset(skipTempReset) {
  642. this.prev = 0;
  643. this.next = 0;
  644. this.sent = this._sent = undefined;
  645. this.done = false;
  646. this.delegate = null;
  647. this.method = "next";
  648. this.arg = undefined;
  649. this.tryEntries.forEach(resetTryEntry);
  650. if (!skipTempReset) {
  651. for (var name in this) {
  652. if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
  653. this[name] = undefined;
  654. }
  655. }
  656. }
  657. },
  658. stop: function stop() {
  659. this.done = true;
  660. var rootEntry = this.tryEntries[0];
  661. var rootRecord = rootEntry.completion;
  662. if (rootRecord.type === "throw") {
  663. throw rootRecord.arg;
  664. }
  665. return this.rval;
  666. },
  667. dispatchException: function dispatchException(exception) {
  668. if (this.done) {
  669. throw exception;
  670. }
  671. var context = this;
  672. function handle(loc, caught) {
  673. record.type = "throw";
  674. record.arg = exception;
  675. context.next = loc;
  676. if (caught) {
  677. context.method = "next";
  678. context.arg = undefined;
  679. }
  680. return !!caught;
  681. }
  682. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  683. var entry = this.tryEntries[i];
  684. var record = entry.completion;
  685. if (entry.tryLoc === "root") {
  686. return handle("end");
  687. }
  688. if (entry.tryLoc <= this.prev) {
  689. var hasCatch = hasOwn.call(entry, "catchLoc");
  690. var hasFinally = hasOwn.call(entry, "finallyLoc");
  691. if (hasCatch && hasFinally) {
  692. if (this.prev < entry.catchLoc) {
  693. return handle(entry.catchLoc, true);
  694. } else if (this.prev < entry.finallyLoc) {
  695. return handle(entry.finallyLoc);
  696. }
  697. } else if (hasCatch) {
  698. if (this.prev < entry.catchLoc) {
  699. return handle(entry.catchLoc, true);
  700. }
  701. } else if (hasFinally) {
  702. if (this.prev < entry.finallyLoc) {
  703. return handle(entry.finallyLoc);
  704. }
  705. } else {
  706. throw new Error("try statement without catch or finally");
  707. }
  708. }
  709. }
  710. },
  711. abrupt: function abrupt(type, arg) {
  712. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  713. var entry = this.tryEntries[i];
  714. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  715. var finallyEntry = entry;
  716. break;
  717. }
  718. }
  719. if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
  720. finallyEntry = null;
  721. }
  722. var record = finallyEntry ? finallyEntry.completion : {};
  723. record.type = type;
  724. record.arg = arg;
  725. if (finallyEntry) {
  726. this.method = "next";
  727. this.next = finallyEntry.finallyLoc;
  728. return ContinueSentinel;
  729. }
  730. return this.complete(record);
  731. },
  732. complete: function complete(record, afterLoc) {
  733. if (record.type === "throw") {
  734. throw record.arg;
  735. }
  736. if (record.type === "break" || record.type === "continue") {
  737. this.next = record.arg;
  738. } else if (record.type === "return") {
  739. this.rval = this.arg = record.arg;
  740. this.method = "return";
  741. this.next = "end";
  742. } else if (record.type === "normal" && afterLoc) {
  743. this.next = afterLoc;
  744. }
  745. return ContinueSentinel;
  746. },
  747. finish: function finish(finallyLoc) {
  748. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  749. var entry = this.tryEntries[i];
  750. if (entry.finallyLoc === finallyLoc) {
  751. this.complete(entry.completion, entry.afterLoc);
  752. resetTryEntry(entry);
  753. return ContinueSentinel;
  754. }
  755. }
  756. },
  757. "catch": function _catch(tryLoc) {
  758. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  759. var entry = this.tryEntries[i];
  760. if (entry.tryLoc === tryLoc) {
  761. var record = entry.completion;
  762. if (record.type === "throw") {
  763. var thrown = record.arg;
  764. resetTryEntry(entry);
  765. }
  766. return thrown;
  767. }
  768. }
  769. throw new Error("illegal catch attempt");
  770. },
  771. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  772. this.delegate = {
  773. iterator: values(iterable),
  774. resultName: resultName,
  775. nextLoc: nextLoc
  776. };
  777. if (this.method === "next") {
  778. this.arg = undefined;
  779. }
  780. return ContinueSentinel;
  781. }
  782. };
  783. return exports;
  784. }(( false ? 0 : _typeof(module)) === "object" ? module.exports : {});
  785. try {
  786. regeneratorRuntime = runtime;
  787. } catch (accidentalStrictMode) {
  788. if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
  789. globalThis.regeneratorRuntime = runtime;
  790. } else {
  791. Function("r", "regeneratorRuntime = r")(runtime);
  792. }
  793. }
  794. /***/ }),
  795. /* 5 */
  796. /***/ ((module) => {
  797. var pdfjsLib;
  798. if (typeof window !== "undefined" && window["pdfjs-dist/build/pdf"]) {
  799. pdfjsLib = window["pdfjs-dist/build/pdf"];
  800. } else {
  801. pdfjsLib = require("../build/pdf.js");
  802. }
  803. module.exports = pdfjsLib;
  804. /***/ }),
  805. /* 6 */
  806. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  807. Object.defineProperty(exports, "__esModule", ({
  808. value: true
  809. }));
  810. exports.NullL10n = void 0;
  811. exports.fixupLangCode = fixupLangCode;
  812. exports.getL10nFallback = getL10nFallback;
  813. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  814. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  815. 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); } }
  816. 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); }); }; }
  817. var DEFAULT_L10N_STRINGS = {
  818. of_pages: "of {{pagesCount}}",
  819. page_of_pages: "({{pageNumber}} of {{pagesCount}})",
  820. document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
  821. document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
  822. document_properties_date_string: "{{date}}, {{time}}",
  823. document_properties_page_size_unit_inches: "in",
  824. document_properties_page_size_unit_millimeters: "mm",
  825. document_properties_page_size_orientation_portrait: "portrait",
  826. document_properties_page_size_orientation_landscape: "landscape",
  827. document_properties_page_size_name_a3: "A3",
  828. document_properties_page_size_name_a4: "A4",
  829. document_properties_page_size_name_letter: "Letter",
  830. document_properties_page_size_name_legal: "Legal",
  831. document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
  832. document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
  833. document_properties_linearized_yes: "Yes",
  834. document_properties_linearized_no: "No",
  835. print_progress_percent: "{{progress}}%",
  836. "toggle_sidebar.title": "Toggle Sidebar",
  837. "toggle_sidebar_notification2.title": "Toggle Sidebar (document contains outline/attachments/layers)",
  838. additional_layers: "Additional Layers",
  839. page_landmark: "Page {{page}}",
  840. thumb_page_title: "Page {{page}}",
  841. thumb_page_canvas: "Thumbnail of Page {{page}}",
  842. find_reached_top: "Reached top of document, continued from bottom",
  843. find_reached_bottom: "Reached end of document, continued from top",
  844. "find_match_count[one]": "{{current}} of {{total}} match",
  845. "find_match_count[other]": "{{current}} of {{total}} matches",
  846. "find_match_count_limit[one]": "More than {{limit}} match",
  847. "find_match_count_limit[other]": "More than {{limit}} matches",
  848. find_not_found: "Phrase not found",
  849. error_version_info: "PDF.js v{{version}} (build: {{build}})",
  850. error_message: "Message: {{message}}",
  851. error_stack: "Stack: {{stack}}",
  852. error_file: "File: {{file}}",
  853. error_line: "Line: {{line}}",
  854. rendering_error: "An error occurred while rendering the page.",
  855. page_scale_width: "Page Width",
  856. page_scale_fit: "Page Fit",
  857. page_scale_auto: "Automatic Zoom",
  858. page_scale_actual: "Actual Size",
  859. page_scale_percent: "{{scale}}%",
  860. loading: "Loading…",
  861. loading_error: "An error occurred while loading the PDF.",
  862. invalid_file_error: "Invalid or corrupted PDF file.",
  863. missing_file_error: "Missing PDF file.",
  864. unexpected_response_error: "Unexpected server response.",
  865. printing_not_supported: "Warning: Printing is not fully supported by this browser.",
  866. printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
  867. web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts."
  868. };
  869. function getL10nFallback(key, args) {
  870. switch (key) {
  871. case "find_match_count":
  872. key = "find_match_count[".concat(args.total === 1 ? "one" : "other", "]");
  873. break;
  874. case "find_match_count_limit":
  875. key = "find_match_count_limit[".concat(args.limit === 1 ? "one" : "other", "]");
  876. break;
  877. }
  878. return DEFAULT_L10N_STRINGS[key] || "";
  879. }
  880. var PARTIAL_LANG_CODES = {
  881. en: "en-US",
  882. es: "es-ES",
  883. fy: "fy-NL",
  884. ga: "ga-IE",
  885. gu: "gu-IN",
  886. hi: "hi-IN",
  887. hy: "hy-AM",
  888. nb: "nb-NO",
  889. ne: "ne-NP",
  890. nn: "nn-NO",
  891. pa: "pa-IN",
  892. pt: "pt-PT",
  893. sv: "sv-SE",
  894. zh: "zh-CN"
  895. };
  896. function fixupLangCode(langCode) {
  897. return PARTIAL_LANG_CODES[langCode === null || langCode === void 0 ? void 0 : langCode.toLowerCase()] || langCode;
  898. }
  899. function formatL10nValue(text, args) {
  900. if (!args) {
  901. return text;
  902. }
  903. return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function (all, name) {
  904. return name in args ? args[name] : "{{" + name + "}}";
  905. });
  906. }
  907. var NullL10n = {
  908. getLanguage: function getLanguage() {
  909. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  910. return _regenerator["default"].wrap(function _callee$(_context) {
  911. while (1) {
  912. switch (_context.prev = _context.next) {
  913. case 0:
  914. return _context.abrupt("return", "en-us");
  915. case 1:
  916. case "end":
  917. return _context.stop();
  918. }
  919. }
  920. }, _callee);
  921. }))();
  922. },
  923. getDirection: function getDirection() {
  924. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  925. return _regenerator["default"].wrap(function _callee2$(_context2) {
  926. while (1) {
  927. switch (_context2.prev = _context2.next) {
  928. case 0:
  929. return _context2.abrupt("return", "ltr");
  930. case 1:
  931. case "end":
  932. return _context2.stop();
  933. }
  934. }
  935. }, _callee2);
  936. }))();
  937. },
  938. get: function get(key) {
  939. var _arguments = arguments;
  940. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  941. var args, fallback;
  942. return _regenerator["default"].wrap(function _callee3$(_context3) {
  943. while (1) {
  944. switch (_context3.prev = _context3.next) {
  945. case 0:
  946. args = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : null;
  947. fallback = _arguments.length > 2 && _arguments[2] !== undefined ? _arguments[2] : getL10nFallback(key, args);
  948. return _context3.abrupt("return", formatL10nValue(fallback, args));
  949. case 3:
  950. case "end":
  951. return _context3.stop();
  952. }
  953. }
  954. }, _callee3);
  955. }))();
  956. },
  957. translate: function translate(element) {
  958. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  959. return _regenerator["default"].wrap(function _callee4$(_context4) {
  960. while (1) {
  961. switch (_context4.prev = _context4.next) {
  962. case 0:
  963. case "end":
  964. return _context4.stop();
  965. }
  966. }
  967. }, _callee4);
  968. }))();
  969. }
  970. };
  971. exports.NullL10n = NullL10n;
  972. /***/ }),
  973. /* 7 */
  974. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  975. Object.defineProperty(exports, "__esModule", ({
  976. value: true
  977. }));
  978. exports.SimpleLinkService = exports.PDFLinkService = exports.LinkTarget = void 0;
  979. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  980. var _ui_utils = __w_pdfjs_require__(8);
  981. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  982. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  983. 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); } }
  984. 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); }); }; }
  985. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  986. 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); } }
  987. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  988. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  989. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  990. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  991. function _classStaticPrivateMethodGet(receiver, classConstructor, method) { _classCheckPrivateStaticAccess(receiver, classConstructor); return method; }
  992. function _classCheckPrivateStaticAccess(receiver, classConstructor) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } }
  993. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  994. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  995. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  996. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  997. var DEFAULT_LINK_REL = "noopener noreferrer nofollow";
  998. var LinkTarget = {
  999. NONE: 0,
  1000. SELF: 1,
  1001. BLANK: 2,
  1002. PARENT: 3,
  1003. TOP: 4
  1004. };
  1005. exports.LinkTarget = LinkTarget;
  1006. function _addLinkAttributes(link) {
  1007. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  1008. url = _ref.url,
  1009. target = _ref.target,
  1010. rel = _ref.rel,
  1011. _ref$enabled = _ref.enabled,
  1012. enabled = _ref$enabled === void 0 ? true : _ref$enabled;
  1013. if (!url || typeof url !== "string") {
  1014. throw new Error('A valid "url" parameter must provided.');
  1015. }
  1016. var urlNullRemoved = (0, _ui_utils.removeNullCharacters)(url);
  1017. if (enabled) {
  1018. link.href = link.title = urlNullRemoved;
  1019. } else {
  1020. link.href = "";
  1021. link.title = "Disabled: ".concat(urlNullRemoved);
  1022. link.onclick = function () {
  1023. return false;
  1024. };
  1025. }
  1026. var targetStr = "";
  1027. switch (target) {
  1028. case LinkTarget.NONE:
  1029. break;
  1030. case LinkTarget.SELF:
  1031. targetStr = "_self";
  1032. break;
  1033. case LinkTarget.BLANK:
  1034. targetStr = "_blank";
  1035. break;
  1036. case LinkTarget.PARENT:
  1037. targetStr = "_parent";
  1038. break;
  1039. case LinkTarget.TOP:
  1040. targetStr = "_top";
  1041. break;
  1042. }
  1043. link.target = targetStr;
  1044. link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;
  1045. }
  1046. var _pagesRefCache = /*#__PURE__*/new WeakMap();
  1047. var _goToDestinationHelper = /*#__PURE__*/new WeakSet();
  1048. var PDFLinkService = /*#__PURE__*/function () {
  1049. function PDFLinkService() {
  1050. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  1051. eventBus = _ref2.eventBus,
  1052. _ref2$externalLinkTar = _ref2.externalLinkTarget,
  1053. externalLinkTarget = _ref2$externalLinkTar === void 0 ? null : _ref2$externalLinkTar,
  1054. _ref2$externalLinkRel = _ref2.externalLinkRel,
  1055. externalLinkRel = _ref2$externalLinkRel === void 0 ? null : _ref2$externalLinkRel,
  1056. _ref2$ignoreDestinati = _ref2.ignoreDestinationZoom,
  1057. ignoreDestinationZoom = _ref2$ignoreDestinati === void 0 ? false : _ref2$ignoreDestinati;
  1058. _classCallCheck(this, PDFLinkService);
  1059. _classPrivateMethodInitSpec(this, _goToDestinationHelper);
  1060. _classPrivateFieldInitSpec(this, _pagesRefCache, {
  1061. writable: true,
  1062. value: new Map()
  1063. });
  1064. this.eventBus = eventBus;
  1065. this.externalLinkTarget = externalLinkTarget;
  1066. this.externalLinkRel = externalLinkRel;
  1067. this.externalLinkEnabled = true;
  1068. this._ignoreDestinationZoom = ignoreDestinationZoom;
  1069. this.baseUrl = null;
  1070. this.pdfDocument = null;
  1071. this.pdfViewer = null;
  1072. this.pdfHistory = null;
  1073. }
  1074. _createClass(PDFLinkService, [{
  1075. key: "setDocument",
  1076. value: function setDocument(pdfDocument) {
  1077. var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1078. this.baseUrl = baseUrl;
  1079. this.pdfDocument = pdfDocument;
  1080. _classPrivateFieldGet(this, _pagesRefCache).clear();
  1081. }
  1082. }, {
  1083. key: "setViewer",
  1084. value: function setViewer(pdfViewer) {
  1085. this.pdfViewer = pdfViewer;
  1086. }
  1087. }, {
  1088. key: "setHistory",
  1089. value: function setHistory(pdfHistory) {
  1090. this.pdfHistory = pdfHistory;
  1091. }
  1092. }, {
  1093. key: "pagesCount",
  1094. get: function get() {
  1095. return this.pdfDocument ? this.pdfDocument.numPages : 0;
  1096. }
  1097. }, {
  1098. key: "page",
  1099. get: function get() {
  1100. return this.pdfViewer.currentPageNumber;
  1101. },
  1102. set: function set(value) {
  1103. this.pdfViewer.currentPageNumber = value;
  1104. }
  1105. }, {
  1106. key: "rotation",
  1107. get: function get() {
  1108. return this.pdfViewer.pagesRotation;
  1109. },
  1110. set: function set(value) {
  1111. this.pdfViewer.pagesRotation = value;
  1112. }
  1113. }, {
  1114. key: "goToDestination",
  1115. value: function () {
  1116. var _goToDestination = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(dest) {
  1117. var namedDest, explicitDest;
  1118. return _regenerator["default"].wrap(function _callee$(_context) {
  1119. while (1) {
  1120. switch (_context.prev = _context.next) {
  1121. case 0:
  1122. if (this.pdfDocument) {
  1123. _context.next = 2;
  1124. break;
  1125. }
  1126. return _context.abrupt("return");
  1127. case 2:
  1128. if (!(typeof dest === "string")) {
  1129. _context.next = 9;
  1130. break;
  1131. }
  1132. namedDest = dest;
  1133. _context.next = 6;
  1134. return this.pdfDocument.getDestination(dest);
  1135. case 6:
  1136. explicitDest = _context.sent;
  1137. _context.next = 13;
  1138. break;
  1139. case 9:
  1140. namedDest = null;
  1141. _context.next = 12;
  1142. return dest;
  1143. case 12:
  1144. explicitDest = _context.sent;
  1145. case 13:
  1146. if (Array.isArray(explicitDest)) {
  1147. _context.next = 16;
  1148. break;
  1149. }
  1150. console.error("PDFLinkService.goToDestination: \"".concat(explicitDest, "\" is not ") + "a valid destination array, for dest=\"".concat(dest, "\"."));
  1151. return _context.abrupt("return");
  1152. case 16:
  1153. _classPrivateMethodGet(this, _goToDestinationHelper, _goToDestinationHelper2).call(this, dest, namedDest, explicitDest);
  1154. case 17:
  1155. case "end":
  1156. return _context.stop();
  1157. }
  1158. }
  1159. }, _callee, this);
  1160. }));
  1161. function goToDestination(_x) {
  1162. return _goToDestination.apply(this, arguments);
  1163. }
  1164. return goToDestination;
  1165. }()
  1166. }, {
  1167. key: "goToPage",
  1168. value: function goToPage(val) {
  1169. if (!this.pdfDocument) {
  1170. return;
  1171. }
  1172. var pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
  1173. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  1174. console.error("PDFLinkService.goToPage: \"".concat(val, "\" is not a valid page."));
  1175. return;
  1176. }
  1177. if (this.pdfHistory) {
  1178. this.pdfHistory.pushCurrentPosition();
  1179. this.pdfHistory.pushPage(pageNumber);
  1180. }
  1181. this.pdfViewer.scrollPageIntoView({
  1182. pageNumber: pageNumber
  1183. });
  1184. }
  1185. }, {
  1186. key: "addLinkAttributes",
  1187. value: function addLinkAttributes(link, url) {
  1188. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1189. _addLinkAttributes(link, {
  1190. url: url,
  1191. target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,
  1192. rel: this.externalLinkRel,
  1193. enabled: this.externalLinkEnabled
  1194. });
  1195. }
  1196. }, {
  1197. key: "getDestinationHash",
  1198. value: function getDestinationHash(dest) {
  1199. if (typeof dest === "string") {
  1200. if (dest.length > 0) {
  1201. return this.getAnchorUrl("#" + escape(dest));
  1202. }
  1203. } else if (Array.isArray(dest)) {
  1204. var str = JSON.stringify(dest);
  1205. if (str.length > 0) {
  1206. return this.getAnchorUrl("#" + escape(str));
  1207. }
  1208. }
  1209. return this.getAnchorUrl("");
  1210. }
  1211. }, {
  1212. key: "getAnchorUrl",
  1213. value: function getAnchorUrl(anchor) {
  1214. return (this.baseUrl || "") + anchor;
  1215. }
  1216. }, {
  1217. key: "setHash",
  1218. value: function setHash(hash) {
  1219. if (!this.pdfDocument) {
  1220. return;
  1221. }
  1222. var pageNumber, dest;
  1223. if (hash.includes("=")) {
  1224. var params = (0, _ui_utils.parseQueryString)(hash);
  1225. if (params.has("search")) {
  1226. this.eventBus.dispatch("findfromurlhash", {
  1227. source: this,
  1228. query: params.get("search").replace(/"/g, ""),
  1229. phraseSearch: params.get("phrase") === "true"
  1230. });
  1231. }
  1232. if (params.has("page")) {
  1233. pageNumber = params.get("page") | 0 || 1;
  1234. }
  1235. if (params.has("zoom")) {
  1236. var zoomArgs = params.get("zoom").split(",");
  1237. var zoomArg = zoomArgs[0];
  1238. var zoomArgNumber = parseFloat(zoomArg);
  1239. if (!zoomArg.includes("Fit")) {
  1240. dest = [null, {
  1241. name: "XYZ"
  1242. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
  1243. } else {
  1244. if (zoomArg === "Fit" || zoomArg === "FitB") {
  1245. dest = [null, {
  1246. name: zoomArg
  1247. }];
  1248. } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {
  1249. dest = [null, {
  1250. name: zoomArg
  1251. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
  1252. } else if (zoomArg === "FitR") {
  1253. if (zoomArgs.length !== 5) {
  1254. console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
  1255. } else {
  1256. dest = [null, {
  1257. name: zoomArg
  1258. }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
  1259. }
  1260. } else {
  1261. console.error("PDFLinkService.setHash: \"".concat(zoomArg, "\" is not a valid zoom value."));
  1262. }
  1263. }
  1264. }
  1265. if (dest) {
  1266. this.pdfViewer.scrollPageIntoView({
  1267. pageNumber: pageNumber || this.page,
  1268. destArray: dest,
  1269. allowNegativeOffset: true
  1270. });
  1271. } else if (pageNumber) {
  1272. this.page = pageNumber;
  1273. }
  1274. if (params.has("pagemode")) {
  1275. this.eventBus.dispatch("pagemode", {
  1276. source: this,
  1277. mode: params.get("pagemode")
  1278. });
  1279. }
  1280. if (params.has("nameddest")) {
  1281. this.goToDestination(params.get("nameddest"));
  1282. }
  1283. } else {
  1284. dest = unescape(hash);
  1285. try {
  1286. dest = JSON.parse(dest);
  1287. if (!Array.isArray(dest)) {
  1288. dest = dest.toString();
  1289. }
  1290. } catch (ex) {}
  1291. if (typeof dest === "string" || _classStaticPrivateMethodGet(PDFLinkService, PDFLinkService, _isValidExplicitDestination).call(PDFLinkService, dest)) {
  1292. this.goToDestination(dest);
  1293. return;
  1294. }
  1295. console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not a valid destination."));
  1296. }
  1297. }
  1298. }, {
  1299. key: "executeNamedAction",
  1300. value: function executeNamedAction(action) {
  1301. var _this$pdfHistory, _this$pdfHistory2;
  1302. switch (action) {
  1303. case "GoBack":
  1304. (_this$pdfHistory = this.pdfHistory) === null || _this$pdfHistory === void 0 ? void 0 : _this$pdfHistory.back();
  1305. break;
  1306. case "GoForward":
  1307. (_this$pdfHistory2 = this.pdfHistory) === null || _this$pdfHistory2 === void 0 ? void 0 : _this$pdfHistory2.forward();
  1308. break;
  1309. case "NextPage":
  1310. this.pdfViewer.nextPage();
  1311. break;
  1312. case "PrevPage":
  1313. this.pdfViewer.previousPage();
  1314. break;
  1315. case "LastPage":
  1316. this.page = this.pagesCount;
  1317. break;
  1318. case "FirstPage":
  1319. this.page = 1;
  1320. break;
  1321. default:
  1322. break;
  1323. }
  1324. this.eventBus.dispatch("namedaction", {
  1325. source: this,
  1326. action: action
  1327. });
  1328. }
  1329. }, {
  1330. key: "cachePageRef",
  1331. value: function cachePageRef(pageNum, pageRef) {
  1332. if (!pageRef) {
  1333. return;
  1334. }
  1335. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1336. _classPrivateFieldGet(this, _pagesRefCache).set(refStr, pageNum);
  1337. }
  1338. }, {
  1339. key: "_cachedPageNumber",
  1340. value: function _cachedPageNumber(pageRef) {
  1341. if (!pageRef) {
  1342. return null;
  1343. }
  1344. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1345. return _classPrivateFieldGet(this, _pagesRefCache).get(refStr) || null;
  1346. }
  1347. }, {
  1348. key: "isPageVisible",
  1349. value: function isPageVisible(pageNumber) {
  1350. return this.pdfViewer.isPageVisible(pageNumber);
  1351. }
  1352. }, {
  1353. key: "isPageCached",
  1354. value: function isPageCached(pageNumber) {
  1355. return this.pdfViewer.isPageCached(pageNumber);
  1356. }
  1357. }]);
  1358. return PDFLinkService;
  1359. }();
  1360. exports.PDFLinkService = PDFLinkService;
  1361. function _goToDestinationHelper2(rawDest) {
  1362. var _this = this;
  1363. var namedDest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1364. var explicitDest = arguments.length > 2 ? arguments[2] : undefined;
  1365. var destRef = explicitDest[0];
  1366. var pageNumber;
  1367. if (_typeof(destRef) === "object" && destRef !== null) {
  1368. pageNumber = this._cachedPageNumber(destRef);
  1369. if (!pageNumber) {
  1370. this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {
  1371. _this.cachePageRef(pageIndex + 1, destRef);
  1372. _classPrivateMethodGet(_this, _goToDestinationHelper, _goToDestinationHelper2).call(_this, rawDest, namedDest, explicitDest);
  1373. })["catch"](function () {
  1374. console.error("PDFLinkService.#goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(rawDest, "\"."));
  1375. });
  1376. return;
  1377. }
  1378. } else if (Number.isInteger(destRef)) {
  1379. pageNumber = destRef + 1;
  1380. } else {
  1381. console.error("PDFLinkService.#goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid destination reference, for dest=\"".concat(rawDest, "\"."));
  1382. return;
  1383. }
  1384. if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
  1385. console.error("PDFLinkService.#goToDestinationHelper: \"".concat(pageNumber, "\" is not ") + "a valid page number, for dest=\"".concat(rawDest, "\"."));
  1386. return;
  1387. }
  1388. if (this.pdfHistory) {
  1389. this.pdfHistory.pushCurrentPosition();
  1390. this.pdfHistory.push({
  1391. namedDest: namedDest,
  1392. explicitDest: explicitDest,
  1393. pageNumber: pageNumber
  1394. });
  1395. }
  1396. this.pdfViewer.scrollPageIntoView({
  1397. pageNumber: pageNumber,
  1398. destArray: explicitDest,
  1399. ignoreDestinationZoom: this._ignoreDestinationZoom
  1400. });
  1401. }
  1402. function _isValidExplicitDestination(dest) {
  1403. if (!Array.isArray(dest)) {
  1404. return false;
  1405. }
  1406. var destLength = dest.length;
  1407. if (destLength < 2) {
  1408. return false;
  1409. }
  1410. var page = dest[0];
  1411. if (!(_typeof(page) === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
  1412. return false;
  1413. }
  1414. var zoom = dest[1];
  1415. if (!(_typeof(zoom) === "object" && typeof zoom.name === "string")) {
  1416. return false;
  1417. }
  1418. var allowNull = true;
  1419. switch (zoom.name) {
  1420. case "XYZ":
  1421. if (destLength !== 5) {
  1422. return false;
  1423. }
  1424. break;
  1425. case "Fit":
  1426. case "FitB":
  1427. return destLength === 2;
  1428. case "FitH":
  1429. case "FitBH":
  1430. case "FitV":
  1431. case "FitBV":
  1432. if (destLength !== 3) {
  1433. return false;
  1434. }
  1435. break;
  1436. case "FitR":
  1437. if (destLength !== 6) {
  1438. return false;
  1439. }
  1440. allowNull = false;
  1441. break;
  1442. default:
  1443. return false;
  1444. }
  1445. for (var i = 2; i < destLength; i++) {
  1446. var param = dest[i];
  1447. if (!(typeof param === "number" || allowNull && param === null)) {
  1448. return false;
  1449. }
  1450. }
  1451. return true;
  1452. }
  1453. var SimpleLinkService = /*#__PURE__*/function () {
  1454. function SimpleLinkService() {
  1455. _classCallCheck(this, SimpleLinkService);
  1456. this.externalLinkEnabled = true;
  1457. }
  1458. _createClass(SimpleLinkService, [{
  1459. key: "pagesCount",
  1460. get: function get() {
  1461. return 0;
  1462. }
  1463. }, {
  1464. key: "page",
  1465. get: function get() {
  1466. return 0;
  1467. },
  1468. set: function set(value) {}
  1469. }, {
  1470. key: "rotation",
  1471. get: function get() {
  1472. return 0;
  1473. },
  1474. set: function set(value) {}
  1475. }, {
  1476. key: "goToDestination",
  1477. value: function () {
  1478. var _goToDestination2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(dest) {
  1479. return _regenerator["default"].wrap(function _callee2$(_context2) {
  1480. while (1) {
  1481. switch (_context2.prev = _context2.next) {
  1482. case 0:
  1483. case "end":
  1484. return _context2.stop();
  1485. }
  1486. }
  1487. }, _callee2);
  1488. }));
  1489. function goToDestination(_x2) {
  1490. return _goToDestination2.apply(this, arguments);
  1491. }
  1492. return goToDestination;
  1493. }()
  1494. }, {
  1495. key: "goToPage",
  1496. value: function goToPage(val) {}
  1497. }, {
  1498. key: "addLinkAttributes",
  1499. value: function addLinkAttributes(link, url) {
  1500. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1501. _addLinkAttributes(link, {
  1502. url: url,
  1503. enabled: this.externalLinkEnabled
  1504. });
  1505. }
  1506. }, {
  1507. key: "getDestinationHash",
  1508. value: function getDestinationHash(dest) {
  1509. return "#";
  1510. }
  1511. }, {
  1512. key: "getAnchorUrl",
  1513. value: function getAnchorUrl(hash) {
  1514. return "#";
  1515. }
  1516. }, {
  1517. key: "setHash",
  1518. value: function setHash(hash) {}
  1519. }, {
  1520. key: "executeNamedAction",
  1521. value: function executeNamedAction(action) {}
  1522. }, {
  1523. key: "cachePageRef",
  1524. value: function cachePageRef(pageNum, pageRef) {}
  1525. }, {
  1526. key: "isPageVisible",
  1527. value: function isPageVisible(pageNumber) {
  1528. return true;
  1529. }
  1530. }, {
  1531. key: "isPageCached",
  1532. value: function isPageCached(pageNumber) {
  1533. return true;
  1534. }
  1535. }]);
  1536. return SimpleLinkService;
  1537. }();
  1538. exports.SimpleLinkService = SimpleLinkService;
  1539. /***/ }),
  1540. /* 8 */
  1541. /***/ ((__unused_webpack_module, exports) => {
  1542. Object.defineProperty(exports, "__esModule", ({
  1543. value: true
  1544. }));
  1545. exports.animationStarted = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RenderingStates = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.OutputScale = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.AutoPrintRegExp = void 0;
  1546. exports.apiPageLayoutToViewerModes = apiPageLayoutToViewerModes;
  1547. exports.apiPageModeToSidebarView = apiPageModeToSidebarView;
  1548. exports.approximateFraction = approximateFraction;
  1549. exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
  1550. exports.binarySearchFirstItem = binarySearchFirstItem;
  1551. exports.getActiveOrFocusedElement = getActiveOrFocusedElement;
  1552. exports.getPageSizeInches = getPageSizeInches;
  1553. exports.getVisibleElements = getVisibleElements;
  1554. exports.isPortraitOrientation = isPortraitOrientation;
  1555. exports.isValidRotation = isValidRotation;
  1556. exports.isValidScrollMode = isValidScrollMode;
  1557. exports.isValidSpreadMode = isValidSpreadMode;
  1558. exports.noContextMenuHandler = noContextMenuHandler;
  1559. exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
  1560. exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
  1561. exports.parseQueryString = parseQueryString;
  1562. exports.removeNullCharacters = removeNullCharacters;
  1563. exports.roundToDivide = roundToDivide;
  1564. exports.scrollIntoView = scrollIntoView;
  1565. exports.watchScroll = watchScroll;
  1566. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  1567. 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."); }
  1568. 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; }
  1569. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  1570. 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; } } }; }
  1571. 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); }
  1572. 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; }
  1573. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1574. 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); } }
  1575. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  1576. var DEFAULT_SCALE_VALUE = "auto";
  1577. exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
  1578. var DEFAULT_SCALE = 1.0;
  1579. exports.DEFAULT_SCALE = DEFAULT_SCALE;
  1580. var DEFAULT_SCALE_DELTA = 1.1;
  1581. exports.DEFAULT_SCALE_DELTA = DEFAULT_SCALE_DELTA;
  1582. var MIN_SCALE = 0.1;
  1583. exports.MIN_SCALE = MIN_SCALE;
  1584. var MAX_SCALE = 10.0;
  1585. exports.MAX_SCALE = MAX_SCALE;
  1586. var UNKNOWN_SCALE = 0;
  1587. exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
  1588. var MAX_AUTO_SCALE = 1.25;
  1589. exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
  1590. var SCROLLBAR_PADDING = 40;
  1591. exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
  1592. var VERTICAL_PADDING = 5;
  1593. exports.VERTICAL_PADDING = VERTICAL_PADDING;
  1594. var LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset";
  1595. var RenderingStates = {
  1596. INITIAL: 0,
  1597. RUNNING: 1,
  1598. PAUSED: 2,
  1599. FINISHED: 3
  1600. };
  1601. exports.RenderingStates = RenderingStates;
  1602. var PresentationModeState = {
  1603. UNKNOWN: 0,
  1604. NORMAL: 1,
  1605. CHANGING: 2,
  1606. FULLSCREEN: 3
  1607. };
  1608. exports.PresentationModeState = PresentationModeState;
  1609. var SidebarView = {
  1610. UNKNOWN: -1,
  1611. NONE: 0,
  1612. THUMBS: 1,
  1613. OUTLINE: 2,
  1614. ATTACHMENTS: 3,
  1615. LAYERS: 4
  1616. };
  1617. exports.SidebarView = SidebarView;
  1618. var RendererType = {
  1619. CANVAS: "canvas",
  1620. SVG: "svg"
  1621. };
  1622. exports.RendererType = RendererType;
  1623. var TextLayerMode = {
  1624. DISABLE: 0,
  1625. ENABLE: 1,
  1626. ENABLE_ENHANCE: 2
  1627. };
  1628. exports.TextLayerMode = TextLayerMode;
  1629. var ScrollMode = {
  1630. UNKNOWN: -1,
  1631. VERTICAL: 0,
  1632. HORIZONTAL: 1,
  1633. WRAPPED: 2,
  1634. PAGE: 3
  1635. };
  1636. exports.ScrollMode = ScrollMode;
  1637. var SpreadMode = {
  1638. UNKNOWN: -1,
  1639. NONE: 0,
  1640. ODD: 1,
  1641. EVEN: 2
  1642. };
  1643. exports.SpreadMode = SpreadMode;
  1644. var AutoPrintRegExp = /\bprint\s*\(/;
  1645. exports.AutoPrintRegExp = AutoPrintRegExp;
  1646. var OutputScale = /*#__PURE__*/function () {
  1647. function OutputScale() {
  1648. _classCallCheck(this, OutputScale);
  1649. var pixelRatio = window.devicePixelRatio || 1;
  1650. this.sx = pixelRatio;
  1651. this.sy = pixelRatio;
  1652. }
  1653. _createClass(OutputScale, [{
  1654. key: "scaled",
  1655. get: function get() {
  1656. return this.sx !== 1 || this.sy !== 1;
  1657. }
  1658. }]);
  1659. return OutputScale;
  1660. }();
  1661. exports.OutputScale = OutputScale;
  1662. function scrollIntoView(element, spot) {
  1663. var scrollMatches = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1664. var parent = element.offsetParent;
  1665. if (!parent) {
  1666. console.error("offsetParent is not set -- cannot scroll");
  1667. return;
  1668. }
  1669. var offsetY = element.offsetTop + element.clientTop;
  1670. var offsetX = element.offsetLeft + element.clientLeft;
  1671. while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) {
  1672. offsetY += parent.offsetTop;
  1673. offsetX += parent.offsetLeft;
  1674. parent = parent.offsetParent;
  1675. if (!parent) {
  1676. return;
  1677. }
  1678. }
  1679. if (spot) {
  1680. if (spot.top !== undefined) {
  1681. offsetY += spot.top;
  1682. }
  1683. if (spot.left !== undefined) {
  1684. offsetX += spot.left;
  1685. parent.scrollLeft = offsetX;
  1686. }
  1687. }
  1688. parent.scrollTop = offsetY;
  1689. }
  1690. function watchScroll(viewAreaElement, callback) {
  1691. var debounceScroll = function debounceScroll(evt) {
  1692. if (rAF) {
  1693. return;
  1694. }
  1695. rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
  1696. rAF = null;
  1697. var currentX = viewAreaElement.scrollLeft;
  1698. var lastX = state.lastX;
  1699. if (currentX !== lastX) {
  1700. state.right = currentX > lastX;
  1701. }
  1702. state.lastX = currentX;
  1703. var currentY = viewAreaElement.scrollTop;
  1704. var lastY = state.lastY;
  1705. if (currentY !== lastY) {
  1706. state.down = currentY > lastY;
  1707. }
  1708. state.lastY = currentY;
  1709. callback(state);
  1710. });
  1711. };
  1712. var state = {
  1713. right: true,
  1714. down: true,
  1715. lastX: viewAreaElement.scrollLeft,
  1716. lastY: viewAreaElement.scrollTop,
  1717. _eventHandler: debounceScroll
  1718. };
  1719. var rAF = null;
  1720. viewAreaElement.addEventListener("scroll", debounceScroll, true);
  1721. return state;
  1722. }
  1723. function parseQueryString(query) {
  1724. var params = new Map();
  1725. var _iterator = _createForOfIteratorHelper(new URLSearchParams(query)),
  1726. _step;
  1727. try {
  1728. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  1729. var _step$value = _slicedToArray(_step.value, 2),
  1730. key = _step$value[0],
  1731. value = _step$value[1];
  1732. params.set(key.toLowerCase(), value);
  1733. }
  1734. } catch (err) {
  1735. _iterator.e(err);
  1736. } finally {
  1737. _iterator.f();
  1738. }
  1739. return params;
  1740. }
  1741. var NullCharactersRegExp = /\x00/g;
  1742. var InvisibleCharactersRegExp = /[\x01-\x1F]/g;
  1743. function removeNullCharacters(str) {
  1744. var replaceInvisible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1745. if (typeof str !== "string") {
  1746. console.error("The argument must be a string.");
  1747. return str;
  1748. }
  1749. if (replaceInvisible) {
  1750. str = str.replace(InvisibleCharactersRegExp, " ");
  1751. }
  1752. return str.replace(NullCharactersRegExp, "");
  1753. }
  1754. function binarySearchFirstItem(items, condition) {
  1755. var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  1756. var minIndex = start;
  1757. var maxIndex = items.length - 1;
  1758. if (maxIndex < 0 || !condition(items[maxIndex])) {
  1759. return items.length;
  1760. }
  1761. if (condition(items[minIndex])) {
  1762. return minIndex;
  1763. }
  1764. while (minIndex < maxIndex) {
  1765. var currentIndex = minIndex + maxIndex >> 1;
  1766. var currentItem = items[currentIndex];
  1767. if (condition(currentItem)) {
  1768. maxIndex = currentIndex;
  1769. } else {
  1770. minIndex = currentIndex + 1;
  1771. }
  1772. }
  1773. return minIndex;
  1774. }
  1775. function approximateFraction(x) {
  1776. if (Math.floor(x) === x) {
  1777. return [x, 1];
  1778. }
  1779. var xinv = 1 / x;
  1780. var limit = 8;
  1781. if (xinv > limit) {
  1782. return [1, limit];
  1783. } else if (Math.floor(xinv) === xinv) {
  1784. return [1, xinv];
  1785. }
  1786. var x_ = x > 1 ? xinv : x;
  1787. var a = 0,
  1788. b = 1,
  1789. c = 1,
  1790. d = 1;
  1791. while (true) {
  1792. var p = a + c,
  1793. q = b + d;
  1794. if (q > limit) {
  1795. break;
  1796. }
  1797. if (x_ <= p / q) {
  1798. c = p;
  1799. d = q;
  1800. } else {
  1801. a = p;
  1802. b = q;
  1803. }
  1804. }
  1805. var result;
  1806. if (x_ - a / b < c / d - x_) {
  1807. result = x_ === x ? [a, b] : [b, a];
  1808. } else {
  1809. result = x_ === x ? [c, d] : [d, c];
  1810. }
  1811. return result;
  1812. }
  1813. function roundToDivide(x, div) {
  1814. var r = x % div;
  1815. return r === 0 ? x : Math.round(x - r + div);
  1816. }
  1817. function getPageSizeInches(_ref) {
  1818. var view = _ref.view,
  1819. userUnit = _ref.userUnit,
  1820. rotate = _ref.rotate;
  1821. var _view = _slicedToArray(view, 4),
  1822. x1 = _view[0],
  1823. y1 = _view[1],
  1824. x2 = _view[2],
  1825. y2 = _view[3];
  1826. var changeOrientation = rotate % 180 !== 0;
  1827. var width = (x2 - x1) / 72 * userUnit;
  1828. var height = (y2 - y1) / 72 * userUnit;
  1829. return {
  1830. width: changeOrientation ? height : width,
  1831. height: changeOrientation ? width : height
  1832. };
  1833. }
  1834. function backtrackBeforeAllVisibleElements(index, views, top) {
  1835. if (index < 2) {
  1836. return index;
  1837. }
  1838. var elt = views[index].div;
  1839. var pageTop = elt.offsetTop + elt.clientTop;
  1840. if (pageTop >= top) {
  1841. elt = views[index - 1].div;
  1842. pageTop = elt.offsetTop + elt.clientTop;
  1843. }
  1844. for (var i = index - 2; i >= 0; --i) {
  1845. elt = views[i].div;
  1846. if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
  1847. break;
  1848. }
  1849. index = i;
  1850. }
  1851. return index;
  1852. }
  1853. function getVisibleElements(_ref2) {
  1854. var scrollEl = _ref2.scrollEl,
  1855. views = _ref2.views,
  1856. _ref2$sortByVisibilit = _ref2.sortByVisibility,
  1857. sortByVisibility = _ref2$sortByVisibilit === void 0 ? false : _ref2$sortByVisibilit,
  1858. _ref2$horizontal = _ref2.horizontal,
  1859. horizontal = _ref2$horizontal === void 0 ? false : _ref2$horizontal,
  1860. _ref2$rtl = _ref2.rtl,
  1861. rtl = _ref2$rtl === void 0 ? false : _ref2$rtl;
  1862. var top = scrollEl.scrollTop,
  1863. bottom = top + scrollEl.clientHeight;
  1864. var left = scrollEl.scrollLeft,
  1865. right = left + scrollEl.clientWidth;
  1866. function isElementBottomAfterViewTop(view) {
  1867. var element = view.div;
  1868. var elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
  1869. return elementBottom > top;
  1870. }
  1871. function isElementNextAfterViewHorizontally(view) {
  1872. var element = view.div;
  1873. var elementLeft = element.offsetLeft + element.clientLeft;
  1874. var elementRight = elementLeft + element.clientWidth;
  1875. return rtl ? elementLeft < right : elementRight > left;
  1876. }
  1877. var visible = [],
  1878. ids = new Set(),
  1879. numViews = views.length;
  1880. var firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
  1881. if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
  1882. firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
  1883. }
  1884. var lastEdge = horizontal ? right : -1;
  1885. for (var i = firstVisibleElementInd; i < numViews; i++) {
  1886. var view = views[i],
  1887. element = view.div;
  1888. var currentWidth = element.offsetLeft + element.clientLeft;
  1889. var currentHeight = element.offsetTop + element.clientTop;
  1890. var viewWidth = element.clientWidth,
  1891. viewHeight = element.clientHeight;
  1892. var viewRight = currentWidth + viewWidth;
  1893. var viewBottom = currentHeight + viewHeight;
  1894. if (lastEdge === -1) {
  1895. if (viewBottom >= bottom) {
  1896. lastEdge = viewBottom;
  1897. }
  1898. } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
  1899. break;
  1900. }
  1901. if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {
  1902. continue;
  1903. }
  1904. var hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
  1905. var hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
  1906. var fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
  1907. fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
  1908. var percent = fractionHeight * fractionWidth * 100 | 0;
  1909. visible.push({
  1910. id: view.id,
  1911. x: currentWidth,
  1912. y: currentHeight,
  1913. view: view,
  1914. percent: percent,
  1915. widthPercent: fractionWidth * 100 | 0
  1916. });
  1917. ids.add(view.id);
  1918. }
  1919. var first = visible[0],
  1920. last = visible[visible.length - 1];
  1921. if (sortByVisibility) {
  1922. visible.sort(function (a, b) {
  1923. var pc = a.percent - b.percent;
  1924. if (Math.abs(pc) > 0.001) {
  1925. return -pc;
  1926. }
  1927. return a.id - b.id;
  1928. });
  1929. }
  1930. return {
  1931. first: first,
  1932. last: last,
  1933. views: visible,
  1934. ids: ids
  1935. };
  1936. }
  1937. function noContextMenuHandler(evt) {
  1938. evt.preventDefault();
  1939. }
  1940. function normalizeWheelEventDirection(evt) {
  1941. var delta = Math.hypot(evt.deltaX, evt.deltaY);
  1942. var angle = Math.atan2(evt.deltaY, evt.deltaX);
  1943. if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
  1944. delta = -delta;
  1945. }
  1946. return delta;
  1947. }
  1948. function normalizeWheelEventDelta(evt) {
  1949. var delta = normalizeWheelEventDirection(evt);
  1950. var MOUSE_DOM_DELTA_PIXEL_MODE = 0;
  1951. var MOUSE_DOM_DELTA_LINE_MODE = 1;
  1952. var MOUSE_PIXELS_PER_LINE = 30;
  1953. var MOUSE_LINES_PER_PAGE = 30;
  1954. if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
  1955. delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
  1956. } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
  1957. delta /= MOUSE_LINES_PER_PAGE;
  1958. }
  1959. return delta;
  1960. }
  1961. function isValidRotation(angle) {
  1962. return Number.isInteger(angle) && angle % 90 === 0;
  1963. }
  1964. function isValidScrollMode(mode) {
  1965. return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;
  1966. }
  1967. function isValidSpreadMode(mode) {
  1968. return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;
  1969. }
  1970. function isPortraitOrientation(size) {
  1971. return size.width <= size.height;
  1972. }
  1973. var animationStarted = new Promise(function (resolve) {
  1974. window.requestAnimationFrame(resolve);
  1975. });
  1976. exports.animationStarted = animationStarted;
  1977. function clamp(v, min, max) {
  1978. return Math.min(Math.max(v, min), max);
  1979. }
  1980. var ProgressBar = /*#__PURE__*/function () {
  1981. function ProgressBar(id) {
  1982. var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  1983. height = _ref3.height,
  1984. width = _ref3.width,
  1985. units = _ref3.units;
  1986. _classCallCheck(this, ProgressBar);
  1987. this.visible = true;
  1988. this.div = document.querySelector(id + " .progress");
  1989. this.bar = this.div.parentNode;
  1990. this.height = height || 100;
  1991. this.width = width || 100;
  1992. this.units = units || "%";
  1993. this.div.style.height = this.height + this.units;
  1994. this.percent = 0;
  1995. }
  1996. _createClass(ProgressBar, [{
  1997. key: "_updateBar",
  1998. value: function _updateBar() {
  1999. if (this._indeterminate) {
  2000. this.div.classList.add("indeterminate");
  2001. this.div.style.width = this.width + this.units;
  2002. return;
  2003. }
  2004. this.div.classList.remove("indeterminate");
  2005. var progressSize = this.width * this._percent / 100;
  2006. this.div.style.width = progressSize + this.units;
  2007. }
  2008. }, {
  2009. key: "percent",
  2010. get: function get() {
  2011. return this._percent;
  2012. },
  2013. set: function set(val) {
  2014. this._indeterminate = isNaN(val);
  2015. this._percent = clamp(val, 0, 100);
  2016. this._updateBar();
  2017. }
  2018. }, {
  2019. key: "setWidth",
  2020. value: function setWidth(viewer) {
  2021. if (!viewer) {
  2022. return;
  2023. }
  2024. var container = viewer.parentNode;
  2025. var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
  2026. if (scrollbarWidth > 0) {
  2027. var doc = document.documentElement;
  2028. doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, "".concat(scrollbarWidth, "px"));
  2029. }
  2030. }
  2031. }, {
  2032. key: "hide",
  2033. value: function hide() {
  2034. if (!this.visible) {
  2035. return;
  2036. }
  2037. this.visible = false;
  2038. this.bar.classList.add("hidden");
  2039. }
  2040. }, {
  2041. key: "show",
  2042. value: function show() {
  2043. if (this.visible) {
  2044. return;
  2045. }
  2046. this.visible = true;
  2047. this.bar.classList.remove("hidden");
  2048. }
  2049. }]);
  2050. return ProgressBar;
  2051. }();
  2052. exports.ProgressBar = ProgressBar;
  2053. function getActiveOrFocusedElement() {
  2054. var curRoot = document;
  2055. var curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  2056. while ((_curActiveOrFocused = curActiveOrFocused) !== null && _curActiveOrFocused !== void 0 && _curActiveOrFocused.shadowRoot) {
  2057. var _curActiveOrFocused;
  2058. curRoot = curActiveOrFocused.shadowRoot;
  2059. curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  2060. }
  2061. return curActiveOrFocused;
  2062. }
  2063. function apiPageLayoutToViewerModes(layout) {
  2064. var scrollMode = ScrollMode.VERTICAL,
  2065. spreadMode = SpreadMode.NONE;
  2066. switch (layout) {
  2067. case "SinglePage":
  2068. scrollMode = ScrollMode.PAGE;
  2069. break;
  2070. case "OneColumn":
  2071. break;
  2072. case "TwoPageLeft":
  2073. scrollMode = ScrollMode.PAGE;
  2074. case "TwoColumnLeft":
  2075. spreadMode = SpreadMode.ODD;
  2076. break;
  2077. case "TwoPageRight":
  2078. scrollMode = ScrollMode.PAGE;
  2079. case "TwoColumnRight":
  2080. spreadMode = SpreadMode.EVEN;
  2081. break;
  2082. }
  2083. return {
  2084. scrollMode: scrollMode,
  2085. spreadMode: spreadMode
  2086. };
  2087. }
  2088. function apiPageModeToSidebarView(mode) {
  2089. switch (mode) {
  2090. case "UseNone":
  2091. return SidebarView.NONE;
  2092. case "UseThumbs":
  2093. return SidebarView.THUMBS;
  2094. case "UseOutlines":
  2095. return SidebarView.OUTLINE;
  2096. case "UseAttachments":
  2097. return SidebarView.ATTACHMENTS;
  2098. case "UseOC":
  2099. return SidebarView.LAYERS;
  2100. }
  2101. return SidebarView.NONE;
  2102. }
  2103. /***/ }),
  2104. /* 9 */
  2105. /***/ ((__unused_webpack_module, exports) => {
  2106. Object.defineProperty(exports, "__esModule", ({
  2107. value: true
  2108. }));
  2109. exports.StructTreeLayerBuilder = void 0;
  2110. 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; } } }; }
  2111. 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); }
  2112. 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; }
  2113. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2114. 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); } }
  2115. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2116. var PDF_ROLE_TO_HTML_ROLE = {
  2117. Document: null,
  2118. DocumentFragment: null,
  2119. Part: "group",
  2120. Sect: "group",
  2121. Div: "group",
  2122. Aside: "note",
  2123. NonStruct: "none",
  2124. P: null,
  2125. H: "heading",
  2126. Title: null,
  2127. FENote: "note",
  2128. Sub: "group",
  2129. Lbl: null,
  2130. Span: null,
  2131. Em: null,
  2132. Strong: null,
  2133. Link: "link",
  2134. Annot: "note",
  2135. Form: "form",
  2136. Ruby: null,
  2137. RB: null,
  2138. RT: null,
  2139. RP: null,
  2140. Warichu: null,
  2141. WT: null,
  2142. WP: null,
  2143. L: "list",
  2144. LI: "listitem",
  2145. LBody: null,
  2146. Table: "table",
  2147. TR: "row",
  2148. TH: "columnheader",
  2149. TD: "cell",
  2150. THead: "columnheader",
  2151. TBody: null,
  2152. TFoot: null,
  2153. Caption: null,
  2154. Figure: "figure",
  2155. Formula: null,
  2156. Artifact: null
  2157. };
  2158. var HEADING_PATTERN = /^H(\d+)$/;
  2159. var StructTreeLayerBuilder = /*#__PURE__*/function () {
  2160. function StructTreeLayerBuilder(_ref) {
  2161. var pdfPage = _ref.pdfPage;
  2162. _classCallCheck(this, StructTreeLayerBuilder);
  2163. this.pdfPage = pdfPage;
  2164. }
  2165. _createClass(StructTreeLayerBuilder, [{
  2166. key: "render",
  2167. value: function render(structTree) {
  2168. return this._walk(structTree);
  2169. }
  2170. }, {
  2171. key: "_setAttributes",
  2172. value: function _setAttributes(structElement, htmlElement) {
  2173. if (structElement.alt !== undefined) {
  2174. htmlElement.setAttribute("aria-label", structElement.alt);
  2175. }
  2176. if (structElement.id !== undefined) {
  2177. htmlElement.setAttribute("aria-owns", structElement.id);
  2178. }
  2179. if (structElement.lang !== undefined) {
  2180. htmlElement.setAttribute("lang", structElement.lang);
  2181. }
  2182. }
  2183. }, {
  2184. key: "_walk",
  2185. value: function _walk(node) {
  2186. if (!node) {
  2187. return null;
  2188. }
  2189. var element = document.createElement("span");
  2190. if ("role" in node) {
  2191. var role = node.role;
  2192. var match = role.match(HEADING_PATTERN);
  2193. if (match) {
  2194. element.setAttribute("role", "heading");
  2195. element.setAttribute("aria-level", match[1]);
  2196. } else if (PDF_ROLE_TO_HTML_ROLE[role]) {
  2197. element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]);
  2198. }
  2199. }
  2200. this._setAttributes(node, element);
  2201. if (node.children) {
  2202. if (node.children.length === 1 && "id" in node.children[0]) {
  2203. this._setAttributes(node.children[0], element);
  2204. } else {
  2205. var _iterator = _createForOfIteratorHelper(node.children),
  2206. _step;
  2207. try {
  2208. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2209. var kid = _step.value;
  2210. element.appendChild(this._walk(kid));
  2211. }
  2212. } catch (err) {
  2213. _iterator.e(err);
  2214. } finally {
  2215. _iterator.f();
  2216. }
  2217. }
  2218. }
  2219. return element;
  2220. }
  2221. }]);
  2222. return StructTreeLayerBuilder;
  2223. }();
  2224. exports.StructTreeLayerBuilder = StructTreeLayerBuilder;
  2225. /***/ }),
  2226. /* 10 */
  2227. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2228. Object.defineProperty(exports, "__esModule", ({
  2229. value: true
  2230. }));
  2231. exports.TextLayerBuilder = void 0;
  2232. var _pdfjsLib = __w_pdfjs_require__(5);
  2233. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2234. 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); } }
  2235. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2236. var EXPAND_DIVS_TIMEOUT = 300;
  2237. var TextLayerBuilder = /*#__PURE__*/function () {
  2238. function TextLayerBuilder(_ref) {
  2239. var textLayerDiv = _ref.textLayerDiv,
  2240. eventBus = _ref.eventBus,
  2241. pageIndex = _ref.pageIndex,
  2242. viewport = _ref.viewport,
  2243. _ref$highlighter = _ref.highlighter,
  2244. highlighter = _ref$highlighter === void 0 ? null : _ref$highlighter,
  2245. _ref$enhanceTextSelec = _ref.enhanceTextSelection,
  2246. enhanceTextSelection = _ref$enhanceTextSelec === void 0 ? false : _ref$enhanceTextSelec;
  2247. _classCallCheck(this, TextLayerBuilder);
  2248. this.textLayerDiv = textLayerDiv;
  2249. this.eventBus = eventBus;
  2250. this.textContent = null;
  2251. this.textContentItemsStr = [];
  2252. this.textContentStream = null;
  2253. this.renderingDone = false;
  2254. this.pageNumber = pageIndex + 1;
  2255. this.viewport = viewport;
  2256. this.textDivs = [];
  2257. this.textLayerRenderTask = null;
  2258. this.highlighter = highlighter;
  2259. this.enhanceTextSelection = enhanceTextSelection;
  2260. this._bindMouse();
  2261. }
  2262. _createClass(TextLayerBuilder, [{
  2263. key: "_finishRendering",
  2264. value: function _finishRendering() {
  2265. this.renderingDone = true;
  2266. if (!this.enhanceTextSelection) {
  2267. var endOfContent = document.createElement("div");
  2268. endOfContent.className = "endOfContent";
  2269. this.textLayerDiv.appendChild(endOfContent);
  2270. }
  2271. this.eventBus.dispatch("textlayerrendered", {
  2272. source: this,
  2273. pageNumber: this.pageNumber,
  2274. numTextDivs: this.textDivs.length
  2275. });
  2276. }
  2277. }, {
  2278. key: "render",
  2279. value: function render() {
  2280. var _this$highlighter,
  2281. _this = this;
  2282. var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  2283. if (!(this.textContent || this.textContentStream) || this.renderingDone) {
  2284. return;
  2285. }
  2286. this.cancel();
  2287. this.textDivs.length = 0;
  2288. (_this$highlighter = this.highlighter) === null || _this$highlighter === void 0 ? void 0 : _this$highlighter.setTextMapping(this.textDivs, this.textContentItemsStr);
  2289. var textLayerFrag = document.createDocumentFragment();
  2290. this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
  2291. textContent: this.textContent,
  2292. textContentStream: this.textContentStream,
  2293. container: textLayerFrag,
  2294. viewport: this.viewport,
  2295. textDivs: this.textDivs,
  2296. textContentItemsStr: this.textContentItemsStr,
  2297. timeout: timeout,
  2298. enhanceTextSelection: this.enhanceTextSelection
  2299. });
  2300. this.textLayerRenderTask.promise.then(function () {
  2301. var _this$highlighter2;
  2302. _this.textLayerDiv.appendChild(textLayerFrag);
  2303. _this._finishRendering();
  2304. (_this$highlighter2 = _this.highlighter) === null || _this$highlighter2 === void 0 ? void 0 : _this$highlighter2.enable();
  2305. }, function (reason) {});
  2306. }
  2307. }, {
  2308. key: "cancel",
  2309. value: function cancel() {
  2310. var _this$highlighter3;
  2311. if (this.textLayerRenderTask) {
  2312. this.textLayerRenderTask.cancel();
  2313. this.textLayerRenderTask = null;
  2314. }
  2315. (_this$highlighter3 = this.highlighter) === null || _this$highlighter3 === void 0 ? void 0 : _this$highlighter3.disable();
  2316. }
  2317. }, {
  2318. key: "setTextContentStream",
  2319. value: function setTextContentStream(readableStream) {
  2320. this.cancel();
  2321. this.textContentStream = readableStream;
  2322. }
  2323. }, {
  2324. key: "setTextContent",
  2325. value: function setTextContent(textContent) {
  2326. this.cancel();
  2327. this.textContent = textContent;
  2328. }
  2329. }, {
  2330. key: "_bindMouse",
  2331. value: function _bindMouse() {
  2332. var _this2 = this;
  2333. var div = this.textLayerDiv;
  2334. var expandDivsTimer = null;
  2335. div.addEventListener("mousedown", function (evt) {
  2336. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2337. _this2.textLayerRenderTask.expandTextDivs(true);
  2338. if (expandDivsTimer) {
  2339. clearTimeout(expandDivsTimer);
  2340. expandDivsTimer = null;
  2341. }
  2342. return;
  2343. }
  2344. var end = div.querySelector(".endOfContent");
  2345. if (!end) {
  2346. return;
  2347. }
  2348. var adjustTop = evt.target !== div;
  2349. adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none";
  2350. if (adjustTop) {
  2351. var divBounds = div.getBoundingClientRect();
  2352. var r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);
  2353. end.style.top = (r * 100).toFixed(2) + "%";
  2354. }
  2355. end.classList.add("active");
  2356. });
  2357. div.addEventListener("mouseup", function () {
  2358. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2359. expandDivsTimer = setTimeout(function () {
  2360. if (_this2.textLayerRenderTask) {
  2361. _this2.textLayerRenderTask.expandTextDivs(false);
  2362. }
  2363. expandDivsTimer = null;
  2364. }, EXPAND_DIVS_TIMEOUT);
  2365. return;
  2366. }
  2367. var end = div.querySelector(".endOfContent");
  2368. if (!end) {
  2369. return;
  2370. }
  2371. end.style.top = "";
  2372. end.classList.remove("active");
  2373. });
  2374. }
  2375. }]);
  2376. return TextLayerBuilder;
  2377. }();
  2378. exports.TextLayerBuilder = TextLayerBuilder;
  2379. /***/ }),
  2380. /* 11 */
  2381. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2382. Object.defineProperty(exports, "__esModule", ({
  2383. value: true
  2384. }));
  2385. exports.XfaLayerBuilder = void 0;
  2386. var _pdfjsLib = __w_pdfjs_require__(5);
  2387. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2388. 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); } }
  2389. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2390. var XfaLayerBuilder = /*#__PURE__*/function () {
  2391. function XfaLayerBuilder(_ref) {
  2392. var pageDiv = _ref.pageDiv,
  2393. pdfPage = _ref.pdfPage,
  2394. _ref$annotationStorag = _ref.annotationStorage,
  2395. annotationStorage = _ref$annotationStorag === void 0 ? null : _ref$annotationStorag,
  2396. linkService = _ref.linkService,
  2397. _ref$xfaHtml = _ref.xfaHtml,
  2398. xfaHtml = _ref$xfaHtml === void 0 ? null : _ref$xfaHtml;
  2399. _classCallCheck(this, XfaLayerBuilder);
  2400. this.pageDiv = pageDiv;
  2401. this.pdfPage = pdfPage;
  2402. this.annotationStorage = annotationStorage;
  2403. this.linkService = linkService;
  2404. this.xfaHtml = xfaHtml;
  2405. this.div = null;
  2406. this._cancelled = false;
  2407. }
  2408. _createClass(XfaLayerBuilder, [{
  2409. key: "render",
  2410. value: function render(viewport) {
  2411. var _this = this;
  2412. var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "display";
  2413. if (intent === "print") {
  2414. var parameters = {
  2415. viewport: viewport.clone({
  2416. dontFlip: true
  2417. }),
  2418. div: this.div,
  2419. xfaHtml: this.xfaHtml,
  2420. annotationStorage: this.annotationStorage,
  2421. linkService: this.linkService,
  2422. intent: intent
  2423. };
  2424. var div = document.createElement("div");
  2425. this.pageDiv.appendChild(div);
  2426. parameters.div = div;
  2427. var result = _pdfjsLib.XfaLayer.render(parameters);
  2428. return Promise.resolve(result);
  2429. }
  2430. return this.pdfPage.getXfa().then(function (xfaHtml) {
  2431. if (_this._cancelled || !xfaHtml) {
  2432. return {
  2433. textDivs: []
  2434. };
  2435. }
  2436. var parameters = {
  2437. viewport: viewport.clone({
  2438. dontFlip: true
  2439. }),
  2440. div: _this.div,
  2441. xfaHtml: xfaHtml,
  2442. annotationStorage: _this.annotationStorage,
  2443. linkService: _this.linkService,
  2444. intent: intent
  2445. };
  2446. if (_this.div) {
  2447. return _pdfjsLib.XfaLayer.update(parameters);
  2448. }
  2449. _this.div = document.createElement("div");
  2450. _this.pageDiv.appendChild(_this.div);
  2451. parameters.div = _this.div;
  2452. return _pdfjsLib.XfaLayer.render(parameters);
  2453. })["catch"](function (error) {
  2454. console.error(error);
  2455. });
  2456. }
  2457. }, {
  2458. key: "cancel",
  2459. value: function cancel() {
  2460. this._cancelled = true;
  2461. }
  2462. }, {
  2463. key: "hide",
  2464. value: function hide() {
  2465. if (!this.div) {
  2466. return;
  2467. }
  2468. this.div.hidden = true;
  2469. }
  2470. }]);
  2471. return XfaLayerBuilder;
  2472. }();
  2473. exports.XfaLayerBuilder = XfaLayerBuilder;
  2474. /***/ }),
  2475. /* 12 */
  2476. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2477. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  2478. Object.defineProperty(exports, "__esModule", ({
  2479. value: true
  2480. }));
  2481. exports.PDFViewer = exports.PDFSinglePageViewer = void 0;
  2482. var _ui_utils = __w_pdfjs_require__(8);
  2483. var _base_viewer = __w_pdfjs_require__(13);
  2484. function _get() { 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(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
  2485. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  2486. 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); } }
  2487. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2488. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2489. 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  2490. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  2491. 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); }; }
  2492. 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); }
  2493. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  2494. 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; } }
  2495. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  2496. var PDFViewer = /*#__PURE__*/function (_BaseViewer) {
  2497. _inherits(PDFViewer, _BaseViewer);
  2498. var _super = _createSuper(PDFViewer);
  2499. function PDFViewer() {
  2500. _classCallCheck(this, PDFViewer);
  2501. return _super.apply(this, arguments);
  2502. }
  2503. return _createClass(PDFViewer);
  2504. }(_base_viewer.BaseViewer);
  2505. exports.PDFViewer = PDFViewer;
  2506. var PDFSinglePageViewer = /*#__PURE__*/function (_BaseViewer2) {
  2507. _inherits(PDFSinglePageViewer, _BaseViewer2);
  2508. var _super2 = _createSuper(PDFSinglePageViewer);
  2509. function PDFSinglePageViewer() {
  2510. _classCallCheck(this, PDFSinglePageViewer);
  2511. return _super2.apply(this, arguments);
  2512. }
  2513. _createClass(PDFSinglePageViewer, [{
  2514. key: "_resetView",
  2515. value: function _resetView() {
  2516. _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_resetView", this).call(this);
  2517. this._scrollMode = _ui_utils.ScrollMode.PAGE;
  2518. this._spreadMode = _ui_utils.SpreadMode.NONE;
  2519. }
  2520. }, {
  2521. key: "scrollMode",
  2522. set: function set(mode) {}
  2523. }, {
  2524. key: "_updateScrollMode",
  2525. value: function _updateScrollMode() {}
  2526. }, {
  2527. key: "spreadMode",
  2528. set: function set(mode) {}
  2529. }, {
  2530. key: "_updateSpreadMode",
  2531. value: function _updateSpreadMode() {}
  2532. }]);
  2533. return PDFSinglePageViewer;
  2534. }(_base_viewer.BaseViewer);
  2535. exports.PDFSinglePageViewer = PDFSinglePageViewer;
  2536. /***/ }),
  2537. /* 13 */
  2538. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2539. Object.defineProperty(exports, "__esModule", ({
  2540. value: true
  2541. }));
  2542. exports.PagesCountLimit = exports.PDFPageViewBuffer = exports.BaseViewer = void 0;
  2543. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  2544. var _pdfjsLib = __w_pdfjs_require__(5);
  2545. var _ui_utils = __w_pdfjs_require__(8);
  2546. var _annotation_layer_builder = __w_pdfjs_require__(2);
  2547. var _l10n_utils = __w_pdfjs_require__(6);
  2548. var _pdf_page_view = __w_pdfjs_require__(14);
  2549. var _pdf_rendering_queue = __w_pdfjs_require__(16);
  2550. var _pdf_link_service = __w_pdfjs_require__(7);
  2551. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  2552. var _text_highlighter = __w_pdfjs_require__(17);
  2553. var _text_layer_builder = __w_pdfjs_require__(10);
  2554. var _xfa_layer_builder = __w_pdfjs_require__(11);
  2555. var _Symbol$iterator;
  2556. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2557. 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); } }
  2558. 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); }); }; }
  2559. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  2560. 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."); }
  2561. 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; }
  2562. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  2563. 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; } } }; }
  2564. 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); }
  2565. 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; }
  2566. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2567. 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); } }
  2568. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2569. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  2570. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  2571. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  2572. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  2573. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  2574. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  2575. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  2576. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  2577. function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
  2578. var DEFAULT_CACHE_SIZE = 10;
  2579. var ENABLE_PERMISSIONS_CLASS = "enablePermissions";
  2580. var PagesCountLimit = {
  2581. FORCE_SCROLL_MODE_PAGE: 15000,
  2582. FORCE_LAZY_PAGE_INIT: 7500,
  2583. PAUSE_EAGER_PAGE_INIT: 250
  2584. };
  2585. exports.PagesCountLimit = PagesCountLimit;
  2586. var _buf = /*#__PURE__*/new WeakMap();
  2587. var _size = /*#__PURE__*/new WeakMap();
  2588. var _destroyFirstView = /*#__PURE__*/new WeakSet();
  2589. _Symbol$iterator = Symbol.iterator;
  2590. var PDFPageViewBuffer = /*#__PURE__*/function () {
  2591. function PDFPageViewBuffer(size) {
  2592. _classCallCheck(this, PDFPageViewBuffer);
  2593. _classPrivateMethodInitSpec(this, _destroyFirstView);
  2594. _classPrivateFieldInitSpec(this, _buf, {
  2595. writable: true,
  2596. value: new Set()
  2597. });
  2598. _classPrivateFieldInitSpec(this, _size, {
  2599. writable: true,
  2600. value: 0
  2601. });
  2602. _classPrivateFieldSet(this, _size, size);
  2603. }
  2604. _createClass(PDFPageViewBuffer, [{
  2605. key: "push",
  2606. value: function push(view) {
  2607. var buf = _classPrivateFieldGet(this, _buf);
  2608. if (buf.has(view)) {
  2609. buf["delete"](view);
  2610. }
  2611. buf.add(view);
  2612. if (buf.size > _classPrivateFieldGet(this, _size)) {
  2613. _classPrivateMethodGet(this, _destroyFirstView, _destroyFirstView2).call(this);
  2614. }
  2615. }
  2616. }, {
  2617. key: "resize",
  2618. value: function resize(newSize) {
  2619. var idsToKeep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  2620. _classPrivateFieldSet(this, _size, newSize);
  2621. var buf = _classPrivateFieldGet(this, _buf);
  2622. if (idsToKeep) {
  2623. var ii = buf.size;
  2624. var i = 1;
  2625. var _iterator = _createForOfIteratorHelper(buf),
  2626. _step;
  2627. try {
  2628. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2629. var view = _step.value;
  2630. if (idsToKeep.has(view.id)) {
  2631. buf["delete"](view);
  2632. buf.add(view);
  2633. }
  2634. if (++i > ii) {
  2635. break;
  2636. }
  2637. }
  2638. } catch (err) {
  2639. _iterator.e(err);
  2640. } finally {
  2641. _iterator.f();
  2642. }
  2643. }
  2644. while (buf.size > _classPrivateFieldGet(this, _size)) {
  2645. _classPrivateMethodGet(this, _destroyFirstView, _destroyFirstView2).call(this);
  2646. }
  2647. }
  2648. }, {
  2649. key: "has",
  2650. value: function has(view) {
  2651. return _classPrivateFieldGet(this, _buf).has(view);
  2652. }
  2653. }, {
  2654. key: _Symbol$iterator,
  2655. value: function value() {
  2656. return _classPrivateFieldGet(this, _buf).keys();
  2657. }
  2658. }]);
  2659. return PDFPageViewBuffer;
  2660. }();
  2661. exports.PDFPageViewBuffer = PDFPageViewBuffer;
  2662. function _destroyFirstView2() {
  2663. var firstView = _classPrivateFieldGet(this, _buf).keys().next().value;
  2664. firstView === null || firstView === void 0 ? void 0 : firstView.destroy();
  2665. _classPrivateFieldGet(this, _buf)["delete"](firstView);
  2666. }
  2667. var _buffer = /*#__PURE__*/new WeakMap();
  2668. var _annotationMode = /*#__PURE__*/new WeakMap();
  2669. var _previousAnnotationMode = /*#__PURE__*/new WeakMap();
  2670. var _enablePermissions = /*#__PURE__*/new WeakMap();
  2671. var _previousContainerHeight = /*#__PURE__*/new WeakMap();
  2672. var _scrollModePageState = /*#__PURE__*/new WeakMap();
  2673. var _onVisibilityChange = /*#__PURE__*/new WeakMap();
  2674. var _initializePermissions = /*#__PURE__*/new WeakSet();
  2675. var _onePageRenderedOrForceFetch = /*#__PURE__*/new WeakSet();
  2676. var _ensurePageViewVisible = /*#__PURE__*/new WeakSet();
  2677. var _isSameScale = /*#__PURE__*/new WeakSet();
  2678. var _ensurePdfPageLoaded = /*#__PURE__*/new WeakSet();
  2679. var _getScrollAhead = /*#__PURE__*/new WeakSet();
  2680. var _toggleLoadingIconSpinner = /*#__PURE__*/new WeakSet();
  2681. var BaseViewer = /*#__PURE__*/function () {
  2682. function BaseViewer(options) {
  2683. var _this$container,
  2684. _this$viewer,
  2685. _options$textLayerMod,
  2686. _options$annotationMo,
  2687. _this = this;
  2688. _classCallCheck(this, BaseViewer);
  2689. _classPrivateMethodInitSpec(this, _toggleLoadingIconSpinner);
  2690. _classPrivateMethodInitSpec(this, _getScrollAhead);
  2691. _classPrivateMethodInitSpec(this, _ensurePdfPageLoaded);
  2692. _classPrivateMethodInitSpec(this, _isSameScale);
  2693. _classPrivateMethodInitSpec(this, _ensurePageViewVisible);
  2694. _classPrivateMethodInitSpec(this, _onePageRenderedOrForceFetch);
  2695. _classPrivateMethodInitSpec(this, _initializePermissions);
  2696. _classPrivateFieldInitSpec(this, _buffer, {
  2697. writable: true,
  2698. value: null
  2699. });
  2700. _classPrivateFieldInitSpec(this, _annotationMode, {
  2701. writable: true,
  2702. value: _pdfjsLib.AnnotationMode.ENABLE_FORMS
  2703. });
  2704. _classPrivateFieldInitSpec(this, _previousAnnotationMode, {
  2705. writable: true,
  2706. value: null
  2707. });
  2708. _classPrivateFieldInitSpec(this, _enablePermissions, {
  2709. writable: true,
  2710. value: false
  2711. });
  2712. _classPrivateFieldInitSpec(this, _previousContainerHeight, {
  2713. writable: true,
  2714. value: 0
  2715. });
  2716. _classPrivateFieldInitSpec(this, _scrollModePageState, {
  2717. writable: true,
  2718. value: null
  2719. });
  2720. _classPrivateFieldInitSpec(this, _onVisibilityChange, {
  2721. writable: true,
  2722. value: null
  2723. });
  2724. if (this.constructor === BaseViewer) {
  2725. throw new Error("Cannot initialize BaseViewer.");
  2726. }
  2727. var viewerVersion = '2.13.216';
  2728. if (_pdfjsLib.version !== viewerVersion) {
  2729. throw new Error("The API version \"".concat(_pdfjsLib.version, "\" does not match the Viewer version \"").concat(viewerVersion, "\"."));
  2730. }
  2731. this.container = options.container;
  2732. this.viewer = options.viewer || options.container.firstElementChild;
  2733. 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")) {
  2734. throw new Error("Invalid `container` and/or `viewer` option.");
  2735. }
  2736. if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") {
  2737. throw new Error("The `container` must be absolutely positioned.");
  2738. }
  2739. this.eventBus = options.eventBus;
  2740. this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
  2741. this.downloadManager = options.downloadManager || null;
  2742. this.findController = options.findController || null;
  2743. this._scriptingManager = options.scriptingManager || null;
  2744. this.removePageBorders = options.removePageBorders || false;
  2745. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  2746. _classPrivateFieldSet(this, _annotationMode, (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS);
  2747. this.imageResourcesPath = options.imageResourcesPath || "";
  2748. this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
  2749. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  2750. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  2751. this.maxCanvasPixels = options.maxCanvasPixels;
  2752. this.l10n = options.l10n || _l10n_utils.NullL10n;
  2753. _classPrivateFieldSet(this, _enablePermissions, options.enablePermissions || false);
  2754. this.defaultRenderingQueue = !options.renderingQueue;
  2755. if (this.defaultRenderingQueue) {
  2756. this.renderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
  2757. this.renderingQueue.setViewer(this);
  2758. } else {
  2759. this.renderingQueue = options.renderingQueue;
  2760. }
  2761. this._doc = document.documentElement;
  2762. this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdate.bind(this));
  2763. this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
  2764. this._onBeforeDraw = this._onAfterDraw = null;
  2765. this._resetView();
  2766. if (this.removePageBorders) {
  2767. this.viewer.classList.add("removePageBorders");
  2768. }
  2769. Promise.resolve().then(function () {
  2770. _this.eventBus.dispatch("baseviewerinit", {
  2771. source: _this
  2772. });
  2773. });
  2774. }
  2775. _createClass(BaseViewer, [{
  2776. key: "pagesCount",
  2777. get: function get() {
  2778. return this._pages.length;
  2779. }
  2780. }, {
  2781. key: "getPageView",
  2782. value: function getPageView(index) {
  2783. return this._pages[index];
  2784. }
  2785. }, {
  2786. key: "pageViewsReady",
  2787. get: function get() {
  2788. if (!this._pagesCapability.settled) {
  2789. return false;
  2790. }
  2791. return this._pages.every(function (pageView) {
  2792. return pageView === null || pageView === void 0 ? void 0 : pageView.pdfPage;
  2793. });
  2794. }
  2795. }, {
  2796. key: "renderForms",
  2797. get: function get() {
  2798. return _classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS;
  2799. }
  2800. }, {
  2801. key: "enableScripting",
  2802. get: function get() {
  2803. return !!this._scriptingManager;
  2804. }
  2805. }, {
  2806. key: "currentPageNumber",
  2807. get: function get() {
  2808. return this._currentPageNumber;
  2809. },
  2810. set: function set(val) {
  2811. if (!Number.isInteger(val)) {
  2812. throw new Error("Invalid page number.");
  2813. }
  2814. if (!this.pdfDocument) {
  2815. return;
  2816. }
  2817. if (!this._setCurrentPageNumber(val, true)) {
  2818. console.error("currentPageNumber: \"".concat(val, "\" is not a valid page."));
  2819. }
  2820. }
  2821. }, {
  2822. key: "_setCurrentPageNumber",
  2823. value: function _setCurrentPageNumber(val) {
  2824. var _this$_pageLabels, _this$_pageLabels2;
  2825. var resetCurrentPageView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2826. if (this._currentPageNumber === val) {
  2827. if (resetCurrentPageView) {
  2828. this._resetCurrentPageView();
  2829. }
  2830. return true;
  2831. }
  2832. if (!(0 < val && val <= this.pagesCount)) {
  2833. return false;
  2834. }
  2835. var previous = this._currentPageNumber;
  2836. this._currentPageNumber = val;
  2837. this.eventBus.dispatch("pagechanging", {
  2838. source: this,
  2839. pageNumber: val,
  2840. 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,
  2841. previous: previous
  2842. });
  2843. if (resetCurrentPageView) {
  2844. this._resetCurrentPageView();
  2845. }
  2846. return true;
  2847. }
  2848. }, {
  2849. key: "currentPageLabel",
  2850. get: function get() {
  2851. var _this$_pageLabels3, _this$_pageLabels4;
  2852. 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;
  2853. },
  2854. set: function set(val) {
  2855. if (!this.pdfDocument) {
  2856. return;
  2857. }
  2858. var page = val | 0;
  2859. if (this._pageLabels) {
  2860. var i = this._pageLabels.indexOf(val);
  2861. if (i >= 0) {
  2862. page = i + 1;
  2863. }
  2864. }
  2865. if (!this._setCurrentPageNumber(page, true)) {
  2866. console.error("currentPageLabel: \"".concat(val, "\" is not a valid page."));
  2867. }
  2868. }
  2869. }, {
  2870. key: "currentScale",
  2871. get: function get() {
  2872. return this._currentScale !== _ui_utils.UNKNOWN_SCALE ? this._currentScale : _ui_utils.DEFAULT_SCALE;
  2873. },
  2874. set: function set(val) {
  2875. if (isNaN(val)) {
  2876. throw new Error("Invalid numeric scale.");
  2877. }
  2878. if (!this.pdfDocument) {
  2879. return;
  2880. }
  2881. this._setScale(val, false);
  2882. }
  2883. }, {
  2884. key: "currentScaleValue",
  2885. get: function get() {
  2886. return this._currentScaleValue;
  2887. },
  2888. set: function set(val) {
  2889. if (!this.pdfDocument) {
  2890. return;
  2891. }
  2892. this._setScale(val, false);
  2893. }
  2894. }, {
  2895. key: "pagesRotation",
  2896. get: function get() {
  2897. return this._pagesRotation;
  2898. },
  2899. set: function set(rotation) {
  2900. if (!(0, _ui_utils.isValidRotation)(rotation)) {
  2901. throw new Error("Invalid pages rotation angle.");
  2902. }
  2903. if (!this.pdfDocument) {
  2904. return;
  2905. }
  2906. rotation %= 360;
  2907. if (rotation < 0) {
  2908. rotation += 360;
  2909. }
  2910. if (this._pagesRotation === rotation) {
  2911. return;
  2912. }
  2913. this._pagesRotation = rotation;
  2914. var pageNumber = this._currentPageNumber;
  2915. var updateArgs = {
  2916. rotation: rotation
  2917. };
  2918. var _iterator2 = _createForOfIteratorHelper(this._pages),
  2919. _step2;
  2920. try {
  2921. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  2922. var pageView = _step2.value;
  2923. pageView.update(updateArgs);
  2924. }
  2925. } catch (err) {
  2926. _iterator2.e(err);
  2927. } finally {
  2928. _iterator2.f();
  2929. }
  2930. if (this._currentScaleValue) {
  2931. this._setScale(this._currentScaleValue, true);
  2932. }
  2933. this.eventBus.dispatch("rotationchanging", {
  2934. source: this,
  2935. pagesRotation: rotation,
  2936. pageNumber: pageNumber
  2937. });
  2938. if (this.defaultRenderingQueue) {
  2939. this.update();
  2940. }
  2941. }
  2942. }, {
  2943. key: "firstPagePromise",
  2944. get: function get() {
  2945. return this.pdfDocument ? this._firstPageCapability.promise : null;
  2946. }
  2947. }, {
  2948. key: "onePageRendered",
  2949. get: function get() {
  2950. return this.pdfDocument ? this._onePageRenderedCapability.promise : null;
  2951. }
  2952. }, {
  2953. key: "pagesPromise",
  2954. get: function get() {
  2955. return this.pdfDocument ? this._pagesCapability.promise : null;
  2956. }
  2957. }, {
  2958. key: "setDocument",
  2959. value: function setDocument(pdfDocument) {
  2960. var _this2 = this;
  2961. if (this.pdfDocument) {
  2962. this.eventBus.dispatch("pagesdestroy", {
  2963. source: this
  2964. });
  2965. this._cancelRendering();
  2966. this._resetView();
  2967. if (this.findController) {
  2968. this.findController.setDocument(null);
  2969. }
  2970. if (this._scriptingManager) {
  2971. this._scriptingManager.setDocument(null);
  2972. }
  2973. }
  2974. this.pdfDocument = pdfDocument;
  2975. if (!pdfDocument) {
  2976. return;
  2977. }
  2978. var isPureXfa = pdfDocument.isPureXfa;
  2979. var pagesCount = pdfDocument.numPages;
  2980. var firstPagePromise = pdfDocument.getPage(1);
  2981. var optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
  2982. var permissionsPromise = _classPrivateFieldGet(this, _enablePermissions) ? pdfDocument.getPermissions() : Promise.resolve();
  2983. if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
  2984. console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");
  2985. var mode = this._scrollMode = _ui_utils.ScrollMode.PAGE;
  2986. this.eventBus.dispatch("scrollmodechanged", {
  2987. source: this,
  2988. mode: mode
  2989. });
  2990. }
  2991. this._pagesCapability.promise.then(function () {
  2992. _this2.eventBus.dispatch("pagesloaded", {
  2993. source: _this2,
  2994. pagesCount: pagesCount
  2995. });
  2996. }, function () {});
  2997. this._onBeforeDraw = function (evt) {
  2998. var pageView = _this2._pages[evt.pageNumber - 1];
  2999. if (!pageView) {
  3000. return;
  3001. }
  3002. _classPrivateFieldGet(_this2, _buffer).push(pageView);
  3003. };
  3004. this.eventBus._on("pagerender", this._onBeforeDraw);
  3005. this._onAfterDraw = function (evt) {
  3006. if (evt.cssTransform || _this2._onePageRenderedCapability.settled) {
  3007. return;
  3008. }
  3009. _this2._onePageRenderedCapability.resolve({
  3010. timestamp: evt.timestamp
  3011. });
  3012. _this2.eventBus._off("pagerendered", _this2._onAfterDraw);
  3013. _this2._onAfterDraw = null;
  3014. if (_classPrivateFieldGet(_this2, _onVisibilityChange)) {
  3015. document.removeEventListener("visibilitychange", _classPrivateFieldGet(_this2, _onVisibilityChange));
  3016. _classPrivateFieldSet(_this2, _onVisibilityChange, null);
  3017. }
  3018. };
  3019. this.eventBus._on("pagerendered", this._onAfterDraw);
  3020. Promise.all([firstPagePromise, permissionsPromise]).then(function (_ref) {
  3021. var _ref2 = _slicedToArray(_ref, 2),
  3022. firstPdfPage = _ref2[0],
  3023. permissions = _ref2[1];
  3024. if (pdfDocument !== _this2.pdfDocument) {
  3025. return;
  3026. }
  3027. _this2._firstPageCapability.resolve(firstPdfPage);
  3028. _this2._optionalContentConfigPromise = optionalContentConfigPromise;
  3029. _classPrivateMethodGet(_this2, _initializePermissions, _initializePermissions2).call(_this2, permissions);
  3030. var viewerElement = _this2._scrollMode === _ui_utils.ScrollMode.PAGE ? null : _this2.viewer;
  3031. var scale = _this2.currentScale;
  3032. var viewport = firstPdfPage.getViewport({
  3033. scale: scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  3034. });
  3035. var textLayerFactory = _this2.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !isPureXfa ? _this2 : null;
  3036. var annotationLayerFactory = _classPrivateFieldGet(_this2, _annotationMode) !== _pdfjsLib.AnnotationMode.DISABLE ? _this2 : null;
  3037. var xfaLayerFactory = isPureXfa ? _this2 : null;
  3038. for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
  3039. var pageView = new _pdf_page_view.PDFPageView({
  3040. container: viewerElement,
  3041. eventBus: _this2.eventBus,
  3042. id: pageNum,
  3043. scale: scale,
  3044. defaultViewport: viewport.clone(),
  3045. optionalContentConfigPromise: optionalContentConfigPromise,
  3046. renderingQueue: _this2.renderingQueue,
  3047. textLayerFactory: textLayerFactory,
  3048. textLayerMode: _this2.textLayerMode,
  3049. annotationLayerFactory: annotationLayerFactory,
  3050. annotationMode: _classPrivateFieldGet(_this2, _annotationMode),
  3051. xfaLayerFactory: xfaLayerFactory,
  3052. textHighlighterFactory: _this2,
  3053. structTreeLayerFactory: _this2,
  3054. imageResourcesPath: _this2.imageResourcesPath,
  3055. renderer: _this2.renderer,
  3056. useOnlyCssZoom: _this2.useOnlyCssZoom,
  3057. maxCanvasPixels: _this2.maxCanvasPixels,
  3058. l10n: _this2.l10n
  3059. });
  3060. _this2._pages.push(pageView);
  3061. }
  3062. var firstPageView = _this2._pages[0];
  3063. if (firstPageView) {
  3064. firstPageView.setPdfPage(firstPdfPage);
  3065. _this2.linkService.cachePageRef(1, firstPdfPage.ref);
  3066. }
  3067. if (_this2._scrollMode === _ui_utils.ScrollMode.PAGE) {
  3068. _classPrivateMethodGet(_this2, _ensurePageViewVisible, _ensurePageViewVisible2).call(_this2);
  3069. } else if (_this2._spreadMode !== _ui_utils.SpreadMode.NONE) {
  3070. _this2._updateSpreadMode();
  3071. }
  3072. _classPrivateMethodGet(_this2, _onePageRenderedOrForceFetch, _onePageRenderedOrForceFetch2).call(_this2).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  3073. var getPagesLeft, _loop, _pageNum;
  3074. return _regenerator["default"].wrap(function _callee$(_context2) {
  3075. while (1) {
  3076. switch (_context2.prev = _context2.next) {
  3077. case 0:
  3078. if (_this2.findController) {
  3079. _this2.findController.setDocument(pdfDocument);
  3080. }
  3081. if (_this2._scriptingManager) {
  3082. _this2._scriptingManager.setDocument(pdfDocument);
  3083. }
  3084. if (!(pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT)) {
  3085. _context2.next = 5;
  3086. break;
  3087. }
  3088. _this2._pagesCapability.resolve();
  3089. return _context2.abrupt("return");
  3090. case 5:
  3091. getPagesLeft = pagesCount - 1;
  3092. if (!(getPagesLeft <= 0)) {
  3093. _context2.next = 9;
  3094. break;
  3095. }
  3096. _this2._pagesCapability.resolve();
  3097. return _context2.abrupt("return");
  3098. case 9:
  3099. _loop = /*#__PURE__*/_regenerator["default"].mark(function _loop(_pageNum) {
  3100. var promise;
  3101. return _regenerator["default"].wrap(function _loop$(_context) {
  3102. while (1) {
  3103. switch (_context.prev = _context.next) {
  3104. case 0:
  3105. promise = pdfDocument.getPage(_pageNum).then(function (pdfPage) {
  3106. var pageView = _this2._pages[_pageNum - 1];
  3107. if (!pageView.pdfPage) {
  3108. pageView.setPdfPage(pdfPage);
  3109. }
  3110. _this2.linkService.cachePageRef(_pageNum, pdfPage.ref);
  3111. if (--getPagesLeft === 0) {
  3112. _this2._pagesCapability.resolve();
  3113. }
  3114. }, function (reason) {
  3115. console.error("Unable to get page ".concat(_pageNum, " to initialize viewer"), reason);
  3116. if (--getPagesLeft === 0) {
  3117. _this2._pagesCapability.resolve();
  3118. }
  3119. });
  3120. if (!(_pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0)) {
  3121. _context.next = 4;
  3122. break;
  3123. }
  3124. _context.next = 4;
  3125. return promise;
  3126. case 4:
  3127. case "end":
  3128. return _context.stop();
  3129. }
  3130. }
  3131. }, _loop);
  3132. });
  3133. _pageNum = 2;
  3134. case 11:
  3135. if (!(_pageNum <= pagesCount)) {
  3136. _context2.next = 16;
  3137. break;
  3138. }
  3139. return _context2.delegateYield(_loop(_pageNum), "t0", 13);
  3140. case 13:
  3141. ++_pageNum;
  3142. _context2.next = 11;
  3143. break;
  3144. case 16:
  3145. case "end":
  3146. return _context2.stop();
  3147. }
  3148. }
  3149. }, _callee);
  3150. })));
  3151. _this2.eventBus.dispatch("pagesinit", {
  3152. source: _this2
  3153. });
  3154. pdfDocument.getMetadata().then(function (_ref4) {
  3155. var info = _ref4.info;
  3156. if (pdfDocument !== _this2.pdfDocument) {
  3157. return;
  3158. }
  3159. if (info.Language) {
  3160. _this2.viewer.lang = info.Language;
  3161. }
  3162. });
  3163. if (_this2.defaultRenderingQueue) {
  3164. _this2.update();
  3165. }
  3166. })["catch"](function (reason) {
  3167. console.error("Unable to initialize viewer", reason);
  3168. _this2._pagesCapability.reject(reason);
  3169. });
  3170. }
  3171. }, {
  3172. key: "setPageLabels",
  3173. value: function setPageLabels(labels) {
  3174. if (!this.pdfDocument) {
  3175. return;
  3176. }
  3177. if (!labels) {
  3178. this._pageLabels = null;
  3179. } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
  3180. this._pageLabels = null;
  3181. console.error("setPageLabels: Invalid page labels.");
  3182. } else {
  3183. this._pageLabels = labels;
  3184. }
  3185. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  3186. var _this$_pageLabels$i, _this$_pageLabels5;
  3187. 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);
  3188. }
  3189. }
  3190. }, {
  3191. key: "_resetView",
  3192. value: function _resetView() {
  3193. this._pages = [];
  3194. this._currentPageNumber = 1;
  3195. this._currentScale = _ui_utils.UNKNOWN_SCALE;
  3196. this._currentScaleValue = null;
  3197. this._pageLabels = null;
  3198. _classPrivateFieldSet(this, _buffer, new PDFPageViewBuffer(DEFAULT_CACHE_SIZE));
  3199. this._location = null;
  3200. this._pagesRotation = 0;
  3201. this._optionalContentConfigPromise = null;
  3202. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  3203. this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)();
  3204. this._pagesCapability = (0, _pdfjsLib.createPromiseCapability)();
  3205. this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
  3206. this._previousScrollMode = _ui_utils.ScrollMode.UNKNOWN;
  3207. this._spreadMode = _ui_utils.SpreadMode.NONE;
  3208. _classPrivateFieldSet(this, _scrollModePageState, {
  3209. previousPageNumber: 1,
  3210. scrollDown: true,
  3211. pages: []
  3212. });
  3213. if (this._onBeforeDraw) {
  3214. this.eventBus._off("pagerender", this._onBeforeDraw);
  3215. this._onBeforeDraw = null;
  3216. }
  3217. if (this._onAfterDraw) {
  3218. this.eventBus._off("pagerendered", this._onAfterDraw);
  3219. this._onAfterDraw = null;
  3220. }
  3221. if (_classPrivateFieldGet(this, _onVisibilityChange)) {
  3222. document.removeEventListener("visibilitychange", _classPrivateFieldGet(this, _onVisibilityChange));
  3223. _classPrivateFieldSet(this, _onVisibilityChange, null);
  3224. }
  3225. this.viewer.textContent = "";
  3226. this._updateScrollMode();
  3227. this.viewer.removeAttribute("lang");
  3228. this.viewer.classList.remove(ENABLE_PERMISSIONS_CLASS);
  3229. if (_classPrivateFieldGet(this, _previousAnnotationMode) !== null) {
  3230. _classPrivateFieldSet(this, _annotationMode, _classPrivateFieldGet(this, _previousAnnotationMode));
  3231. _classPrivateFieldSet(this, _previousAnnotationMode, null);
  3232. }
  3233. }
  3234. }, {
  3235. key: "_scrollUpdate",
  3236. value: function _scrollUpdate() {
  3237. if (this.pagesCount === 0) {
  3238. return;
  3239. }
  3240. this.update();
  3241. }
  3242. }, {
  3243. key: "_scrollIntoView",
  3244. value: function _scrollIntoView(_ref5) {
  3245. var pageDiv = _ref5.pageDiv,
  3246. _ref5$pageSpot = _ref5.pageSpot,
  3247. pageSpot = _ref5$pageSpot === void 0 ? null : _ref5$pageSpot,
  3248. _ref5$pageNumber = _ref5.pageNumber,
  3249. pageNumber = _ref5$pageNumber === void 0 ? null : _ref5$pageNumber;
  3250. if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
  3251. if (pageNumber) {
  3252. this._setCurrentPageNumber(pageNumber);
  3253. }
  3254. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3255. this.update();
  3256. }
  3257. if (!pageSpot && !this.isInPresentationMode) {
  3258. var left = pageDiv.offsetLeft + pageDiv.clientLeft;
  3259. var right = left + pageDiv.clientWidth;
  3260. var _this$container2 = this.container,
  3261. scrollLeft = _this$container2.scrollLeft,
  3262. clientWidth = _this$container2.clientWidth;
  3263. if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) {
  3264. pageSpot = {
  3265. left: 0,
  3266. top: 0
  3267. };
  3268. }
  3269. }
  3270. (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot);
  3271. }
  3272. }, {
  3273. key: "_setScaleUpdatePages",
  3274. value: function _setScaleUpdatePages(newScale, newValue) {
  3275. var noScroll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3276. var preset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3277. this._currentScaleValue = newValue.toString();
  3278. if (_classPrivateMethodGet(this, _isSameScale, _isSameScale2).call(this, newScale)) {
  3279. if (preset) {
  3280. this.eventBus.dispatch("scalechanging", {
  3281. source: this,
  3282. scale: newScale,
  3283. presetValue: newValue
  3284. });
  3285. }
  3286. return;
  3287. }
  3288. this._doc.style.setProperty("--zoom-factor", newScale);
  3289. this._doc.style.setProperty("--viewport-scale-factor", newScale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS);
  3290. var updateArgs = {
  3291. scale: newScale
  3292. };
  3293. var _iterator3 = _createForOfIteratorHelper(this._pages),
  3294. _step3;
  3295. try {
  3296. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  3297. var pageView = _step3.value;
  3298. pageView.update(updateArgs);
  3299. }
  3300. } catch (err) {
  3301. _iterator3.e(err);
  3302. } finally {
  3303. _iterator3.f();
  3304. }
  3305. this._currentScale = newScale;
  3306. if (!noScroll) {
  3307. var page = this._currentPageNumber,
  3308. dest;
  3309. if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {
  3310. page = this._location.pageNumber;
  3311. dest = [null, {
  3312. name: "XYZ"
  3313. }, this._location.left, this._location.top, null];
  3314. }
  3315. this.scrollPageIntoView({
  3316. pageNumber: page,
  3317. destArray: dest,
  3318. allowNegativeOffset: true
  3319. });
  3320. }
  3321. this.eventBus.dispatch("scalechanging", {
  3322. source: this,
  3323. scale: newScale,
  3324. presetValue: preset ? newValue : undefined
  3325. });
  3326. if (this.defaultRenderingQueue) {
  3327. this.update();
  3328. }
  3329. _classPrivateFieldSet(this, _previousContainerHeight, this.container.clientHeight);
  3330. }
  3331. }, {
  3332. key: "_pageWidthScaleFactor",
  3333. get: function get() {
  3334. if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL) {
  3335. return 2;
  3336. }
  3337. return 1;
  3338. }
  3339. }, {
  3340. key: "_setScale",
  3341. value: function _setScale(value) {
  3342. var noScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3343. var scale = parseFloat(value);
  3344. if (scale > 0) {
  3345. this._setScaleUpdatePages(scale, value, noScroll, false);
  3346. } else {
  3347. var currentPage = this._pages[this._currentPageNumber - 1];
  3348. if (!currentPage) {
  3349. return;
  3350. }
  3351. var hPadding = _ui_utils.SCROLLBAR_PADDING,
  3352. vPadding = _ui_utils.VERTICAL_PADDING;
  3353. if (this.isInPresentationMode) {
  3354. hPadding = vPadding = 4;
  3355. } else if (this.removePageBorders) {
  3356. hPadding = vPadding = 0;
  3357. }
  3358. if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL) {
  3359. var _ref6 = [vPadding, hPadding];
  3360. hPadding = _ref6[0];
  3361. vPadding = _ref6[1];
  3362. }
  3363. var pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this._pageWidthScaleFactor;
  3364. var pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
  3365. switch (value) {
  3366. case "page-actual":
  3367. scale = 1;
  3368. break;
  3369. case "page-width":
  3370. scale = pageWidthScale;
  3371. break;
  3372. case "page-height":
  3373. scale = pageHeightScale;
  3374. break;
  3375. case "page-fit":
  3376. scale = Math.min(pageWidthScale, pageHeightScale);
  3377. break;
  3378. case "auto":
  3379. var horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
  3380. scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale);
  3381. break;
  3382. default:
  3383. console.error("_setScale: \"".concat(value, "\" is an unknown zoom value."));
  3384. return;
  3385. }
  3386. this._setScaleUpdatePages(scale, value, noScroll, true);
  3387. }
  3388. }
  3389. }, {
  3390. key: "_resetCurrentPageView",
  3391. value: function _resetCurrentPageView() {
  3392. if (this.isInPresentationMode) {
  3393. this._setScale(this._currentScaleValue, true);
  3394. }
  3395. var pageView = this._pages[this._currentPageNumber - 1];
  3396. this._scrollIntoView({
  3397. pageDiv: pageView.div
  3398. });
  3399. }
  3400. }, {
  3401. key: "pageLabelToPageNumber",
  3402. value: function pageLabelToPageNumber(label) {
  3403. if (!this._pageLabels) {
  3404. return null;
  3405. }
  3406. var i = this._pageLabels.indexOf(label);
  3407. if (i < 0) {
  3408. return null;
  3409. }
  3410. return i + 1;
  3411. }
  3412. }, {
  3413. key: "scrollPageIntoView",
  3414. value: function scrollPageIntoView(_ref7) {
  3415. var pageNumber = _ref7.pageNumber,
  3416. _ref7$destArray = _ref7.destArray,
  3417. destArray = _ref7$destArray === void 0 ? null : _ref7$destArray,
  3418. _ref7$allowNegativeOf = _ref7.allowNegativeOffset,
  3419. allowNegativeOffset = _ref7$allowNegativeOf === void 0 ? false : _ref7$allowNegativeOf,
  3420. _ref7$ignoreDestinati = _ref7.ignoreDestinationZoom,
  3421. ignoreDestinationZoom = _ref7$ignoreDestinati === void 0 ? false : _ref7$ignoreDestinati;
  3422. if (!this.pdfDocument) {
  3423. return;
  3424. }
  3425. var pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
  3426. if (!pageView) {
  3427. console.error("scrollPageIntoView: \"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  3428. return;
  3429. }
  3430. if (this.isInPresentationMode || !destArray) {
  3431. this._setCurrentPageNumber(pageNumber, true);
  3432. return;
  3433. }
  3434. var x = 0,
  3435. y = 0;
  3436. var width = 0,
  3437. height = 0,
  3438. widthScale,
  3439. heightScale;
  3440. var changeOrientation = pageView.rotation % 180 !== 0;
  3441. var pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3442. var pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3443. var scale = 0;
  3444. switch (destArray[1].name) {
  3445. case "XYZ":
  3446. x = destArray[2];
  3447. y = destArray[3];
  3448. scale = destArray[4];
  3449. x = x !== null ? x : 0;
  3450. y = y !== null ? y : pageHeight;
  3451. break;
  3452. case "Fit":
  3453. case "FitB":
  3454. scale = "page-fit";
  3455. break;
  3456. case "FitH":
  3457. case "FitBH":
  3458. y = destArray[2];
  3459. scale = "page-width";
  3460. if (y === null && this._location) {
  3461. x = this._location.left;
  3462. y = this._location.top;
  3463. } else if (typeof y !== "number" || y < 0) {
  3464. y = pageHeight;
  3465. }
  3466. break;
  3467. case "FitV":
  3468. case "FitBV":
  3469. x = destArray[2];
  3470. width = pageWidth;
  3471. height = pageHeight;
  3472. scale = "page-height";
  3473. break;
  3474. case "FitR":
  3475. x = destArray[2];
  3476. y = destArray[3];
  3477. width = destArray[4] - x;
  3478. height = destArray[5] - y;
  3479. var hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING;
  3480. var vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING;
  3481. widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3482. heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3483. scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
  3484. break;
  3485. default:
  3486. console.error("scrollPageIntoView: \"".concat(destArray[1].name, "\" is not a valid destination type."));
  3487. return;
  3488. }
  3489. if (!ignoreDestinationZoom) {
  3490. if (scale && scale !== this._currentScale) {
  3491. this.currentScaleValue = scale;
  3492. } else if (this._currentScale === _ui_utils.UNKNOWN_SCALE) {
  3493. this.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
  3494. }
  3495. }
  3496. if (scale === "page-fit" && !destArray[4]) {
  3497. this._scrollIntoView({
  3498. pageDiv: pageView.div,
  3499. pageNumber: pageNumber
  3500. });
  3501. return;
  3502. }
  3503. var boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
  3504. var left = Math.min(boundingRect[0][0], boundingRect[1][0]);
  3505. var top = Math.min(boundingRect[0][1], boundingRect[1][1]);
  3506. if (!allowNegativeOffset) {
  3507. left = Math.max(left, 0);
  3508. top = Math.max(top, 0);
  3509. }
  3510. this._scrollIntoView({
  3511. pageDiv: pageView.div,
  3512. pageSpot: {
  3513. left: left,
  3514. top: top
  3515. },
  3516. pageNumber: pageNumber
  3517. });
  3518. }
  3519. }, {
  3520. key: "_updateLocation",
  3521. value: function _updateLocation(firstPage) {
  3522. var currentScale = this._currentScale;
  3523. var currentScaleValue = this._currentScaleValue;
  3524. var normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
  3525. var pageNumber = firstPage.id;
  3526. var pdfOpenParams = "#page=" + pageNumber;
  3527. pdfOpenParams += "&zoom=" + normalizedScaleValue;
  3528. var currentPageView = this._pages[pageNumber - 1];
  3529. var container = this.container;
  3530. var topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
  3531. var intLeft = Math.round(topLeft[0]);
  3532. var intTop = Math.round(topLeft[1]);
  3533. pdfOpenParams += "," + intLeft + "," + intTop;
  3534. this._location = {
  3535. pageNumber: pageNumber,
  3536. scale: normalizedScaleValue,
  3537. top: intTop,
  3538. left: intLeft,
  3539. rotation: this._pagesRotation,
  3540. pdfOpenParams: pdfOpenParams
  3541. };
  3542. }
  3543. }, {
  3544. key: "update",
  3545. value: function update() {
  3546. var visible = this._getVisiblePages();
  3547. var visiblePages = visible.views,
  3548. numVisiblePages = visiblePages.length;
  3549. if (numVisiblePages === 0) {
  3550. return;
  3551. }
  3552. var newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
  3553. _classPrivateFieldGet(this, _buffer).resize(newCacheSize, visible.ids);
  3554. this.renderingQueue.renderHighestPriority(visible);
  3555. if (!this.isInPresentationMode) {
  3556. var isSimpleLayout = this._spreadMode === _ui_utils.SpreadMode.NONE && (this._scrollMode === _ui_utils.ScrollMode.PAGE || this._scrollMode === _ui_utils.ScrollMode.VERTICAL);
  3557. var currentId = this._currentPageNumber;
  3558. var stillFullyVisible = false;
  3559. var _iterator4 = _createForOfIteratorHelper(visiblePages),
  3560. _step4;
  3561. try {
  3562. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  3563. var page = _step4.value;
  3564. if (page.percent < 100) {
  3565. break;
  3566. }
  3567. if (page.id === currentId && isSimpleLayout) {
  3568. stillFullyVisible = true;
  3569. break;
  3570. }
  3571. }
  3572. } catch (err) {
  3573. _iterator4.e(err);
  3574. } finally {
  3575. _iterator4.f();
  3576. }
  3577. if (!stillFullyVisible) {
  3578. currentId = visiblePages[0].id;
  3579. }
  3580. this._setCurrentPageNumber(currentId);
  3581. }
  3582. this._updateLocation(visible.first);
  3583. this.eventBus.dispatch("updateviewarea", {
  3584. source: this,
  3585. location: this._location
  3586. });
  3587. }
  3588. }, {
  3589. key: "containsElement",
  3590. value: function containsElement(element) {
  3591. return this.container.contains(element);
  3592. }
  3593. }, {
  3594. key: "focus",
  3595. value: function focus() {
  3596. this.container.focus();
  3597. }
  3598. }, {
  3599. key: "_isContainerRtl",
  3600. get: function get() {
  3601. return getComputedStyle(this.container).direction === "rtl";
  3602. }
  3603. }, {
  3604. key: "isInPresentationMode",
  3605. get: function get() {
  3606. return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN;
  3607. }
  3608. }, {
  3609. key: "isChangingPresentationMode",
  3610. get: function get() {
  3611. return this.presentationModeState === _ui_utils.PresentationModeState.CHANGING;
  3612. }
  3613. }, {
  3614. key: "isHorizontalScrollbarEnabled",
  3615. get: function get() {
  3616. return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;
  3617. }
  3618. }, {
  3619. key: "isVerticalScrollbarEnabled",
  3620. get: function get() {
  3621. return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
  3622. }
  3623. }, {
  3624. key: "_getCurrentVisiblePage",
  3625. value: function _getCurrentVisiblePage() {
  3626. if (!this.pagesCount) {
  3627. return {
  3628. views: []
  3629. };
  3630. }
  3631. var pageView = this._pages[this._currentPageNumber - 1];
  3632. var element = pageView.div;
  3633. var view = {
  3634. id: pageView.id,
  3635. x: element.offsetLeft + element.clientLeft,
  3636. y: element.offsetTop + element.clientTop,
  3637. view: pageView
  3638. };
  3639. var ids = new Set([pageView.id]);
  3640. return {
  3641. first: view,
  3642. last: view,
  3643. views: [view],
  3644. ids: ids
  3645. };
  3646. }
  3647. }, {
  3648. key: "_getVisiblePages",
  3649. value: function _getVisiblePages() {
  3650. if (this.isInPresentationMode) {
  3651. return this._getCurrentVisiblePage();
  3652. }
  3653. var views = this._scrollMode === _ui_utils.ScrollMode.PAGE ? _classPrivateFieldGet(this, _scrollModePageState).pages : this._pages,
  3654. horizontal = this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL,
  3655. rtl = horizontal && this._isContainerRtl;
  3656. return (0, _ui_utils.getVisibleElements)({
  3657. scrollEl: this.container,
  3658. views: views,
  3659. sortByVisibility: true,
  3660. horizontal: horizontal,
  3661. rtl: rtl
  3662. });
  3663. }
  3664. }, {
  3665. key: "isPageVisible",
  3666. value: function isPageVisible(pageNumber) {
  3667. if (!this.pdfDocument) {
  3668. return false;
  3669. }
  3670. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  3671. console.error("isPageVisible: \"".concat(pageNumber, "\" is not a valid page."));
  3672. return false;
  3673. }
  3674. return this._getVisiblePages().ids.has(pageNumber);
  3675. }
  3676. }, {
  3677. key: "isPageCached",
  3678. value: function isPageCached(pageNumber) {
  3679. if (!this.pdfDocument) {
  3680. return false;
  3681. }
  3682. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  3683. console.error("isPageCached: \"".concat(pageNumber, "\" is not a valid page."));
  3684. return false;
  3685. }
  3686. var pageView = this._pages[pageNumber - 1];
  3687. return _classPrivateFieldGet(this, _buffer).has(pageView);
  3688. }
  3689. }, {
  3690. key: "cleanup",
  3691. value: function cleanup() {
  3692. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  3693. if (this._pages[i] && this._pages[i].renderingState !== _ui_utils.RenderingStates.FINISHED) {
  3694. this._pages[i].reset();
  3695. }
  3696. }
  3697. }
  3698. }, {
  3699. key: "_cancelRendering",
  3700. value: function _cancelRendering() {
  3701. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  3702. if (this._pages[i]) {
  3703. this._pages[i].cancelRendering();
  3704. }
  3705. }
  3706. }
  3707. }, {
  3708. key: "forceRendering",
  3709. value: function forceRendering(currentlyVisiblePages) {
  3710. var _this3 = this;
  3711. var visiblePages = currentlyVisiblePages || this._getVisiblePages();
  3712. var scrollAhead = _classPrivateMethodGet(this, _getScrollAhead, _getScrollAhead2).call(this, visiblePages);
  3713. var preRenderExtra = this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL;
  3714. var pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra);
  3715. _classPrivateMethodGet(this, _toggleLoadingIconSpinner, _toggleLoadingIconSpinner2).call(this, visiblePages.ids);
  3716. if (pageView) {
  3717. _classPrivateMethodGet(this, _ensurePdfPageLoaded, _ensurePdfPageLoaded2).call(this, pageView).then(function () {
  3718. _this3.renderingQueue.renderView(pageView);
  3719. });
  3720. return true;
  3721. }
  3722. return false;
  3723. }
  3724. }, {
  3725. key: "createTextLayerBuilder",
  3726. value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
  3727. var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3728. var eventBus = arguments.length > 4 ? arguments[4] : undefined;
  3729. var highlighter = arguments.length > 5 ? arguments[5] : undefined;
  3730. return new _text_layer_builder.TextLayerBuilder({
  3731. textLayerDiv: textLayerDiv,
  3732. eventBus: eventBus,
  3733. pageIndex: pageIndex,
  3734. viewport: viewport,
  3735. enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection,
  3736. highlighter: highlighter
  3737. });
  3738. }
  3739. }, {
  3740. key: "createTextHighlighter",
  3741. value: function createTextHighlighter(pageIndex, eventBus) {
  3742. return new _text_highlighter.TextHighlighter({
  3743. eventBus: eventBus,
  3744. pageIndex: pageIndex,
  3745. findController: this.isInPresentationMode ? null : this.findController
  3746. });
  3747. }
  3748. }, {
  3749. key: "createAnnotationLayerBuilder",
  3750. value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
  3751. var _this$pdfDocument, _this$pdfDocument2, _this$pdfDocument3, _this$_scriptingManag;
  3752. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  3753. var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
  3754. var renderForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  3755. var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _l10n_utils.NullL10n;
  3756. var enableScripting = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  3757. var hasJSActionsPromise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  3758. var mouseState = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
  3759. var fieldObjectsPromise = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
  3760. var annotationCanvasMap = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
  3761. return new _annotation_layer_builder.AnnotationLayerBuilder({
  3762. pageDiv: pageDiv,
  3763. pdfPage: pdfPage,
  3764. annotationStorage: annotationStorage || ((_this$pdfDocument = this.pdfDocument) === null || _this$pdfDocument === void 0 ? void 0 : _this$pdfDocument.annotationStorage),
  3765. imageResourcesPath: imageResourcesPath,
  3766. renderForms: renderForms,
  3767. linkService: this.linkService,
  3768. downloadManager: this.downloadManager,
  3769. l10n: l10n,
  3770. enableScripting: enableScripting !== null && enableScripting !== void 0 ? enableScripting : this.enableScripting,
  3771. hasJSActionsPromise: hasJSActionsPromise || ((_this$pdfDocument2 = this.pdfDocument) === null || _this$pdfDocument2 === void 0 ? void 0 : _this$pdfDocument2.hasJSActions()),
  3772. fieldObjectsPromise: fieldObjectsPromise || ((_this$pdfDocument3 = this.pdfDocument) === null || _this$pdfDocument3 === void 0 ? void 0 : _this$pdfDocument3.getFieldObjects()),
  3773. mouseState: mouseState || ((_this$_scriptingManag = this._scriptingManager) === null || _this$_scriptingManag === void 0 ? void 0 : _this$_scriptingManag.mouseState),
  3774. annotationCanvasMap: annotationCanvasMap
  3775. });
  3776. }
  3777. }, {
  3778. key: "createXfaLayerBuilder",
  3779. value: function createXfaLayerBuilder(pageDiv, pdfPage) {
  3780. var _this$pdfDocument4;
  3781. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  3782. return new _xfa_layer_builder.XfaLayerBuilder({
  3783. pageDiv: pageDiv,
  3784. pdfPage: pdfPage,
  3785. annotationStorage: annotationStorage || ((_this$pdfDocument4 = this.pdfDocument) === null || _this$pdfDocument4 === void 0 ? void 0 : _this$pdfDocument4.annotationStorage),
  3786. linkService: this.linkService
  3787. });
  3788. }
  3789. }, {
  3790. key: "createStructTreeLayerBuilder",
  3791. value: function createStructTreeLayerBuilder(pdfPage) {
  3792. return new _struct_tree_layer_builder.StructTreeLayerBuilder({
  3793. pdfPage: pdfPage
  3794. });
  3795. }
  3796. }, {
  3797. key: "hasEqualPageSizes",
  3798. get: function get() {
  3799. var firstPageView = this._pages[0];
  3800. for (var i = 1, ii = this._pages.length; i < ii; ++i) {
  3801. var pageView = this._pages[i];
  3802. if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) {
  3803. return false;
  3804. }
  3805. }
  3806. return true;
  3807. }
  3808. }, {
  3809. key: "getPagesOverview",
  3810. value: function getPagesOverview() {
  3811. var _this4 = this;
  3812. return this._pages.map(function (pageView) {
  3813. var viewport = pageView.pdfPage.getViewport({
  3814. scale: 1
  3815. });
  3816. if (!_this4.enablePrintAutoRotate || (0, _ui_utils.isPortraitOrientation)(viewport)) {
  3817. return {
  3818. width: viewport.width,
  3819. height: viewport.height,
  3820. rotation: viewport.rotation
  3821. };
  3822. }
  3823. return {
  3824. width: viewport.height,
  3825. height: viewport.width,
  3826. rotation: (viewport.rotation - 90) % 360
  3827. };
  3828. });
  3829. }
  3830. }, {
  3831. key: "optionalContentConfigPromise",
  3832. get: function get() {
  3833. if (!this.pdfDocument) {
  3834. return Promise.resolve(null);
  3835. }
  3836. if (!this._optionalContentConfigPromise) {
  3837. return this.pdfDocument.getOptionalContentConfig();
  3838. }
  3839. return this._optionalContentConfigPromise;
  3840. },
  3841. set: function set(promise) {
  3842. if (!(promise instanceof Promise)) {
  3843. throw new Error("Invalid optionalContentConfigPromise: ".concat(promise));
  3844. }
  3845. if (!this.pdfDocument) {
  3846. return;
  3847. }
  3848. if (!this._optionalContentConfigPromise) {
  3849. return;
  3850. }
  3851. this._optionalContentConfigPromise = promise;
  3852. var updateArgs = {
  3853. optionalContentConfigPromise: promise
  3854. };
  3855. var _iterator5 = _createForOfIteratorHelper(this._pages),
  3856. _step5;
  3857. try {
  3858. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  3859. var pageView = _step5.value;
  3860. pageView.update(updateArgs);
  3861. }
  3862. } catch (err) {
  3863. _iterator5.e(err);
  3864. } finally {
  3865. _iterator5.f();
  3866. }
  3867. this.update();
  3868. this.eventBus.dispatch("optionalcontentconfigchanged", {
  3869. source: this,
  3870. promise: promise
  3871. });
  3872. }
  3873. }, {
  3874. key: "scrollMode",
  3875. get: function get() {
  3876. return this._scrollMode;
  3877. },
  3878. set: function set(mode) {
  3879. if (this._scrollMode === mode) {
  3880. return;
  3881. }
  3882. if (!(0, _ui_utils.isValidScrollMode)(mode)) {
  3883. throw new Error("Invalid scroll mode: ".concat(mode));
  3884. }
  3885. if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
  3886. return;
  3887. }
  3888. this._previousScrollMode = this._scrollMode;
  3889. this._scrollMode = mode;
  3890. this.eventBus.dispatch("scrollmodechanged", {
  3891. source: this,
  3892. mode: mode
  3893. });
  3894. this._updateScrollMode(this._currentPageNumber);
  3895. }
  3896. }, {
  3897. key: "_updateScrollMode",
  3898. value: function _updateScrollMode() {
  3899. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  3900. var scrollMode = this._scrollMode,
  3901. viewer = this.viewer;
  3902. viewer.classList.toggle("scrollHorizontal", scrollMode === _ui_utils.ScrollMode.HORIZONTAL);
  3903. viewer.classList.toggle("scrollWrapped", scrollMode === _ui_utils.ScrollMode.WRAPPED);
  3904. if (!this.pdfDocument || !pageNumber) {
  3905. return;
  3906. }
  3907. if (scrollMode === _ui_utils.ScrollMode.PAGE) {
  3908. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3909. } else if (this._previousScrollMode === _ui_utils.ScrollMode.PAGE) {
  3910. this._updateSpreadMode();
  3911. }
  3912. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  3913. this._setScale(this._currentScaleValue, true);
  3914. }
  3915. this._setCurrentPageNumber(pageNumber, true);
  3916. this.update();
  3917. }
  3918. }, {
  3919. key: "spreadMode",
  3920. get: function get() {
  3921. return this._spreadMode;
  3922. },
  3923. set: function set(mode) {
  3924. if (this._spreadMode === mode) {
  3925. return;
  3926. }
  3927. if (!(0, _ui_utils.isValidSpreadMode)(mode)) {
  3928. throw new Error("Invalid spread mode: ".concat(mode));
  3929. }
  3930. this._spreadMode = mode;
  3931. this.eventBus.dispatch("spreadmodechanged", {
  3932. source: this,
  3933. mode: mode
  3934. });
  3935. this._updateSpreadMode(this._currentPageNumber);
  3936. }
  3937. }, {
  3938. key: "_updateSpreadMode",
  3939. value: function _updateSpreadMode() {
  3940. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  3941. if (!this.pdfDocument) {
  3942. return;
  3943. }
  3944. var viewer = this.viewer,
  3945. pages = this._pages;
  3946. if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
  3947. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3948. } else {
  3949. viewer.textContent = "";
  3950. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  3951. for (var i = 0, ii = pages.length; i < ii; ++i) {
  3952. viewer.appendChild(pages[i].div);
  3953. }
  3954. } else {
  3955. var parity = this._spreadMode - 1;
  3956. var spread = null;
  3957. for (var _i2 = 0, _ii = pages.length; _i2 < _ii; ++_i2) {
  3958. if (spread === null) {
  3959. spread = document.createElement("div");
  3960. spread.className = "spread";
  3961. viewer.appendChild(spread);
  3962. } else if (_i2 % 2 === parity) {
  3963. spread = spread.cloneNode(false);
  3964. viewer.appendChild(spread);
  3965. }
  3966. spread.appendChild(pages[_i2].div);
  3967. }
  3968. }
  3969. }
  3970. if (!pageNumber) {
  3971. return;
  3972. }
  3973. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  3974. this._setScale(this._currentScaleValue, true);
  3975. }
  3976. this._setCurrentPageNumber(pageNumber, true);
  3977. this.update();
  3978. }
  3979. }, {
  3980. key: "_getPageAdvance",
  3981. value: function _getPageAdvance(currentPageNumber) {
  3982. var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3983. switch (this._scrollMode) {
  3984. case _ui_utils.ScrollMode.WRAPPED:
  3985. {
  3986. var _this$_getVisiblePage = this._getVisiblePages(),
  3987. views = _this$_getVisiblePage.views,
  3988. pageLayout = new Map();
  3989. var _iterator6 = _createForOfIteratorHelper(views),
  3990. _step6;
  3991. try {
  3992. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  3993. var _step6$value = _step6.value,
  3994. id = _step6$value.id,
  3995. y = _step6$value.y,
  3996. percent = _step6$value.percent,
  3997. widthPercent = _step6$value.widthPercent;
  3998. if (percent === 0 || widthPercent < 100) {
  3999. continue;
  4000. }
  4001. var yArray = pageLayout.get(y);
  4002. if (!yArray) {
  4003. pageLayout.set(y, yArray || (yArray = []));
  4004. }
  4005. yArray.push(id);
  4006. }
  4007. } catch (err) {
  4008. _iterator6.e(err);
  4009. } finally {
  4010. _iterator6.f();
  4011. }
  4012. var _iterator7 = _createForOfIteratorHelper(pageLayout.values()),
  4013. _step7;
  4014. try {
  4015. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  4016. var _yArray = _step7.value;
  4017. var currentIndex = _yArray.indexOf(currentPageNumber);
  4018. if (currentIndex === -1) {
  4019. continue;
  4020. }
  4021. var numPages = _yArray.length;
  4022. if (numPages === 1) {
  4023. break;
  4024. }
  4025. if (previous) {
  4026. for (var i = currentIndex - 1, ii = 0; i >= ii; i--) {
  4027. var currentId = _yArray[i],
  4028. expectedId = _yArray[i + 1] - 1;
  4029. if (currentId < expectedId) {
  4030. return currentPageNumber - expectedId;
  4031. }
  4032. }
  4033. } else {
  4034. for (var _i3 = currentIndex + 1, _ii2 = numPages; _i3 < _ii2; _i3++) {
  4035. var _currentId = _yArray[_i3],
  4036. _expectedId = _yArray[_i3 - 1] + 1;
  4037. if (_currentId > _expectedId) {
  4038. return _expectedId - currentPageNumber;
  4039. }
  4040. }
  4041. }
  4042. if (previous) {
  4043. var firstId = _yArray[0];
  4044. if (firstId < currentPageNumber) {
  4045. return currentPageNumber - firstId + 1;
  4046. }
  4047. } else {
  4048. var lastId = _yArray[numPages - 1];
  4049. if (lastId > currentPageNumber) {
  4050. return lastId - currentPageNumber + 1;
  4051. }
  4052. }
  4053. break;
  4054. }
  4055. } catch (err) {
  4056. _iterator7.e(err);
  4057. } finally {
  4058. _iterator7.f();
  4059. }
  4060. break;
  4061. }
  4062. case _ui_utils.ScrollMode.HORIZONTAL:
  4063. {
  4064. break;
  4065. }
  4066. case _ui_utils.ScrollMode.PAGE:
  4067. case _ui_utils.ScrollMode.VERTICAL:
  4068. {
  4069. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  4070. break;
  4071. }
  4072. var parity = this._spreadMode - 1;
  4073. if (previous && currentPageNumber % 2 !== parity) {
  4074. break;
  4075. } else if (!previous && currentPageNumber % 2 === parity) {
  4076. break;
  4077. }
  4078. var _this$_getVisiblePage2 = this._getVisiblePages(),
  4079. _views = _this$_getVisiblePage2.views,
  4080. _expectedId2 = previous ? currentPageNumber - 1 : currentPageNumber + 1;
  4081. var _iterator8 = _createForOfIteratorHelper(_views),
  4082. _step8;
  4083. try {
  4084. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  4085. var _step8$value = _step8.value,
  4086. _id = _step8$value.id,
  4087. _percent = _step8$value.percent,
  4088. _widthPercent = _step8$value.widthPercent;
  4089. if (_id !== _expectedId2) {
  4090. continue;
  4091. }
  4092. if (_percent > 0 && _widthPercent === 100) {
  4093. return 2;
  4094. }
  4095. break;
  4096. }
  4097. } catch (err) {
  4098. _iterator8.e(err);
  4099. } finally {
  4100. _iterator8.f();
  4101. }
  4102. break;
  4103. }
  4104. }
  4105. return 1;
  4106. }
  4107. }, {
  4108. key: "nextPage",
  4109. value: function nextPage() {
  4110. var currentPageNumber = this._currentPageNumber,
  4111. pagesCount = this.pagesCount;
  4112. if (currentPageNumber >= pagesCount) {
  4113. return false;
  4114. }
  4115. var advance = this._getPageAdvance(currentPageNumber, false) || 1;
  4116. this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);
  4117. return true;
  4118. }
  4119. }, {
  4120. key: "previousPage",
  4121. value: function previousPage() {
  4122. var currentPageNumber = this._currentPageNumber;
  4123. if (currentPageNumber <= 1) {
  4124. return false;
  4125. }
  4126. var advance = this._getPageAdvance(currentPageNumber, true) || 1;
  4127. this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
  4128. return true;
  4129. }
  4130. }, {
  4131. key: "increaseScale",
  4132. value: function increaseScale() {
  4133. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  4134. var newScale = this._currentScale;
  4135. do {
  4136. newScale = (newScale * _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  4137. newScale = Math.ceil(newScale * 10) / 10;
  4138. newScale = Math.min(_ui_utils.MAX_SCALE, newScale);
  4139. } while (--steps > 0 && newScale < _ui_utils.MAX_SCALE);
  4140. this.currentScaleValue = newScale;
  4141. }
  4142. }, {
  4143. key: "decreaseScale",
  4144. value: function decreaseScale() {
  4145. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  4146. var newScale = this._currentScale;
  4147. do {
  4148. newScale = (newScale / _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  4149. newScale = Math.floor(newScale * 10) / 10;
  4150. newScale = Math.max(_ui_utils.MIN_SCALE, newScale);
  4151. } while (--steps > 0 && newScale > _ui_utils.MIN_SCALE);
  4152. this.currentScaleValue = newScale;
  4153. }
  4154. }]);
  4155. return BaseViewer;
  4156. }();
  4157. exports.BaseViewer = BaseViewer;
  4158. function _initializePermissions2(permissions) {
  4159. if (!permissions) {
  4160. return;
  4161. }
  4162. if (!permissions.includes(_pdfjsLib.PermissionFlag.COPY)) {
  4163. this.viewer.classList.add(ENABLE_PERMISSIONS_CLASS);
  4164. }
  4165. if (!permissions.includes(_pdfjsLib.PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(_pdfjsLib.PermissionFlag.FILL_INTERACTIVE_FORMS)) {
  4166. if (_classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS) {
  4167. _classPrivateFieldSet(this, _previousAnnotationMode, _classPrivateFieldGet(this, _annotationMode));
  4168. _classPrivateFieldSet(this, _annotationMode, _pdfjsLib.AnnotationMode.ENABLE);
  4169. }
  4170. }
  4171. }
  4172. function _onePageRenderedOrForceFetch2() {
  4173. var _this5 = this;
  4174. if (document.visibilityState === "hidden" || !this.container.offsetParent || this._getVisiblePages().views.length === 0) {
  4175. return Promise.resolve();
  4176. }
  4177. var visibilityChangePromise = new Promise(function (resolve) {
  4178. _classPrivateFieldSet(_this5, _onVisibilityChange, function () {
  4179. if (document.visibilityState !== "hidden") {
  4180. return;
  4181. }
  4182. resolve();
  4183. document.removeEventListener("visibilitychange", _classPrivateFieldGet(_this5, _onVisibilityChange));
  4184. _classPrivateFieldSet(_this5, _onVisibilityChange, null);
  4185. });
  4186. document.addEventListener("visibilitychange", _classPrivateFieldGet(_this5, _onVisibilityChange));
  4187. });
  4188. return Promise.race([this._onePageRenderedCapability.promise, visibilityChangePromise]);
  4189. }
  4190. function _ensurePageViewVisible2() {
  4191. if (this._scrollMode !== _ui_utils.ScrollMode.PAGE) {
  4192. throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");
  4193. }
  4194. var pageNumber = this._currentPageNumber,
  4195. state = _classPrivateFieldGet(this, _scrollModePageState),
  4196. viewer = this.viewer;
  4197. viewer.textContent = "";
  4198. state.pages.length = 0;
  4199. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  4200. var pageView = this._pages[pageNumber - 1];
  4201. if (this.isInPresentationMode) {
  4202. var spread = document.createElement("div");
  4203. spread.className = "spread";
  4204. var dummyPage = document.createElement("div");
  4205. dummyPage.className = "dummyPage";
  4206. dummyPage.style.height = "".concat(this.container.clientHeight, "px");
  4207. spread.appendChild(dummyPage);
  4208. spread.appendChild(pageView.div);
  4209. viewer.appendChild(spread);
  4210. } else {
  4211. viewer.appendChild(pageView.div);
  4212. }
  4213. state.pages.push(pageView);
  4214. } else {
  4215. var pageIndexSet = new Set(),
  4216. parity = this._spreadMode - 1;
  4217. if (pageNumber % 2 !== parity) {
  4218. pageIndexSet.add(pageNumber - 1);
  4219. pageIndexSet.add(pageNumber);
  4220. } else {
  4221. pageIndexSet.add(pageNumber - 2);
  4222. pageIndexSet.add(pageNumber - 1);
  4223. }
  4224. var _spread = null;
  4225. var _iterator9 = _createForOfIteratorHelper(pageIndexSet),
  4226. _step9;
  4227. try {
  4228. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  4229. var i = _step9.value;
  4230. var _pageView = this._pages[i];
  4231. if (!_pageView) {
  4232. continue;
  4233. }
  4234. if (_spread === null) {
  4235. _spread = document.createElement("div");
  4236. _spread.className = "spread";
  4237. viewer.appendChild(_spread);
  4238. } else if (i % 2 === parity) {
  4239. _spread = _spread.cloneNode(false);
  4240. viewer.appendChild(_spread);
  4241. }
  4242. _spread.appendChild(_pageView.div);
  4243. state.pages.push(_pageView);
  4244. }
  4245. } catch (err) {
  4246. _iterator9.e(err);
  4247. } finally {
  4248. _iterator9.f();
  4249. }
  4250. }
  4251. state.scrollDown = pageNumber >= state.previousPageNumber;
  4252. state.previousPageNumber = pageNumber;
  4253. }
  4254. function _isSameScale2(newScale) {
  4255. if (this.isInPresentationMode && this.container.clientHeight !== _classPrivateFieldGet(this, _previousContainerHeight)) {
  4256. return false;
  4257. }
  4258. return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;
  4259. }
  4260. function _ensurePdfPageLoaded2(_x) {
  4261. return _ensurePdfPageLoaded3.apply(this, arguments);
  4262. }
  4263. function _ensurePdfPageLoaded3() {
  4264. _ensurePdfPageLoaded3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pageView) {
  4265. var _this$linkService$_ca, _this$linkService, pdfPage;
  4266. return _regenerator["default"].wrap(function _callee2$(_context3) {
  4267. while (1) {
  4268. switch (_context3.prev = _context3.next) {
  4269. case 0:
  4270. if (!pageView.pdfPage) {
  4271. _context3.next = 2;
  4272. break;
  4273. }
  4274. return _context3.abrupt("return", pageView.pdfPage);
  4275. case 2:
  4276. _context3.prev = 2;
  4277. _context3.next = 5;
  4278. return this.pdfDocument.getPage(pageView.id);
  4279. case 5:
  4280. pdfPage = _context3.sent;
  4281. if (!pageView.pdfPage) {
  4282. pageView.setPdfPage(pdfPage);
  4283. }
  4284. if (!((_this$linkService$_ca = (_this$linkService = this.linkService)._cachedPageNumber) !== null && _this$linkService$_ca !== void 0 && _this$linkService$_ca.call(_this$linkService, pdfPage.ref))) {
  4285. this.linkService.cachePageRef(pageView.id, pdfPage.ref);
  4286. }
  4287. return _context3.abrupt("return", pdfPage);
  4288. case 11:
  4289. _context3.prev = 11;
  4290. _context3.t0 = _context3["catch"](2);
  4291. console.error("Unable to get page for page view", _context3.t0);
  4292. return _context3.abrupt("return", null);
  4293. case 15:
  4294. case "end":
  4295. return _context3.stop();
  4296. }
  4297. }
  4298. }, _callee2, this, [[2, 11]]);
  4299. }));
  4300. return _ensurePdfPageLoaded3.apply(this, arguments);
  4301. }
  4302. function _getScrollAhead2(visible) {
  4303. var _visible$first, _visible$last;
  4304. if (((_visible$first = visible.first) === null || _visible$first === void 0 ? void 0 : _visible$first.id) === 1) {
  4305. return true;
  4306. } else if (((_visible$last = visible.last) === null || _visible$last === void 0 ? void 0 : _visible$last.id) === this.pagesCount) {
  4307. return false;
  4308. }
  4309. switch (this._scrollMode) {
  4310. case _ui_utils.ScrollMode.PAGE:
  4311. return _classPrivateFieldGet(this, _scrollModePageState).scrollDown;
  4312. case _ui_utils.ScrollMode.HORIZONTAL:
  4313. return this.scroll.right;
  4314. }
  4315. return this.scroll.down;
  4316. }
  4317. function _toggleLoadingIconSpinner2(visibleIds) {
  4318. var _iterator10 = _createForOfIteratorHelper(visibleIds),
  4319. _step10;
  4320. try {
  4321. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  4322. var id = _step10.value;
  4323. var pageView = this._pages[id - 1];
  4324. pageView === null || pageView === void 0 ? void 0 : pageView.toggleLoadingIconSpinner(true);
  4325. }
  4326. } catch (err) {
  4327. _iterator10.e(err);
  4328. } finally {
  4329. _iterator10.f();
  4330. }
  4331. var _iterator11 = _createForOfIteratorHelper(_classPrivateFieldGet(this, _buffer)),
  4332. _step11;
  4333. try {
  4334. for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
  4335. var _pageView2 = _step11.value;
  4336. if (visibleIds.has(_pageView2.id)) {
  4337. continue;
  4338. }
  4339. _pageView2.toggleLoadingIconSpinner(false);
  4340. }
  4341. } catch (err) {
  4342. _iterator11.e(err);
  4343. } finally {
  4344. _iterator11.f();
  4345. }
  4346. }
  4347. /***/ }),
  4348. /* 14 */
  4349. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4350. Object.defineProperty(exports, "__esModule", ({
  4351. value: true
  4352. }));
  4353. exports.PDFPageView = void 0;
  4354. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  4355. var _pdfjsLib = __w_pdfjs_require__(5);
  4356. var _ui_utils = __w_pdfjs_require__(8);
  4357. var _app_options = __w_pdfjs_require__(15);
  4358. var _l10n_utils = __w_pdfjs_require__(6);
  4359. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4360. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  4361. 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; } } }; }
  4362. 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); }
  4363. 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; }
  4364. 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); } }
  4365. 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); }); }; }
  4366. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4367. 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); } }
  4368. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  4369. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  4370. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  4371. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  4372. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  4373. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  4374. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  4375. function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
  4376. var MAX_CANVAS_PIXELS = _app_options.compatibilityParams.maxCanvasPixels || 16777216;
  4377. var _annotationMode = /*#__PURE__*/new WeakMap();
  4378. var PDFPageView = /*#__PURE__*/function () {
  4379. function PDFPageView(options) {
  4380. var _options$textLayerMod, _options$annotationMo, _options$textHighligh, _this$renderingQueue;
  4381. _classCallCheck(this, PDFPageView);
  4382. _classPrivateFieldInitSpec(this, _annotationMode, {
  4383. writable: true,
  4384. value: _pdfjsLib.AnnotationMode.ENABLE_FORMS
  4385. });
  4386. var container = options.container;
  4387. var defaultViewport = options.defaultViewport;
  4388. this.id = options.id;
  4389. this.renderingId = "page" + this.id;
  4390. this.pdfPage = null;
  4391. this.pageLabel = null;
  4392. this.rotation = 0;
  4393. this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
  4394. this.viewport = defaultViewport;
  4395. this.pdfPageRotate = defaultViewport.rotation;
  4396. this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
  4397. this.hasRestrictedScaling = false;
  4398. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  4399. _classPrivateFieldSet(this, _annotationMode, (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS);
  4400. this.imageResourcesPath = options.imageResourcesPath || "";
  4401. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  4402. this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
  4403. this.eventBus = options.eventBus;
  4404. this.renderingQueue = options.renderingQueue;
  4405. this.textLayerFactory = options.textLayerFactory;
  4406. this.annotationLayerFactory = options.annotationLayerFactory;
  4407. this.xfaLayerFactory = options.xfaLayerFactory;
  4408. this.textHighlighter = (_options$textHighligh = options.textHighlighterFactory) === null || _options$textHighligh === void 0 ? void 0 : _options$textHighligh.createTextHighlighter(this.id - 1, this.eventBus);
  4409. this.structTreeLayerFactory = options.structTreeLayerFactory;
  4410. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  4411. this.l10n = options.l10n || _l10n_utils.NullL10n;
  4412. this.paintTask = null;
  4413. this.paintedViewportMap = new WeakMap();
  4414. this.renderingState = _ui_utils.RenderingStates.INITIAL;
  4415. this.resume = null;
  4416. this._renderError = null;
  4417. this._isStandalone = !((_this$renderingQueue = this.renderingQueue) !== null && _this$renderingQueue !== void 0 && _this$renderingQueue.hasViewer());
  4418. this._annotationCanvasMap = null;
  4419. this.annotationLayer = null;
  4420. this.textLayer = null;
  4421. this.zoomLayer = null;
  4422. this.xfaLayer = null;
  4423. this.structTreeLayer = null;
  4424. var div = document.createElement("div");
  4425. div.className = "page";
  4426. div.style.width = Math.floor(this.viewport.width) + "px";
  4427. div.style.height = Math.floor(this.viewport.height) + "px";
  4428. div.setAttribute("data-page-number", this.id);
  4429. div.setAttribute("role", "region");
  4430. this.l10n.get("page_landmark", {
  4431. page: this.id
  4432. }).then(function (msg) {
  4433. div.setAttribute("aria-label", msg);
  4434. });
  4435. this.div = div;
  4436. container === null || container === void 0 ? void 0 : container.appendChild(div);
  4437. }
  4438. _createClass(PDFPageView, [{
  4439. key: "setPdfPage",
  4440. value: function setPdfPage(pdfPage) {
  4441. this.pdfPage = pdfPage;
  4442. this.pdfPageRotate = pdfPage.rotate;
  4443. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  4444. this.viewport = pdfPage.getViewport({
  4445. scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
  4446. rotation: totalRotation
  4447. });
  4448. this.reset();
  4449. }
  4450. }, {
  4451. key: "destroy",
  4452. value: function destroy() {
  4453. this.reset();
  4454. if (this.pdfPage) {
  4455. this.pdfPage.cleanup();
  4456. }
  4457. }
  4458. }, {
  4459. key: "_renderAnnotationLayer",
  4460. value: function () {
  4461. var _renderAnnotationLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  4462. var error;
  4463. return _regenerator["default"].wrap(function _callee$(_context) {
  4464. while (1) {
  4465. switch (_context.prev = _context.next) {
  4466. case 0:
  4467. error = null;
  4468. _context.prev = 1;
  4469. _context.next = 4;
  4470. return this.annotationLayer.render(this.viewport, "display");
  4471. case 4:
  4472. _context.next = 9;
  4473. break;
  4474. case 6:
  4475. _context.prev = 6;
  4476. _context.t0 = _context["catch"](1);
  4477. error = _context.t0;
  4478. case 9:
  4479. _context.prev = 9;
  4480. this.eventBus.dispatch("annotationlayerrendered", {
  4481. source: this,
  4482. pageNumber: this.id,
  4483. error: error
  4484. });
  4485. return _context.finish(9);
  4486. case 12:
  4487. case "end":
  4488. return _context.stop();
  4489. }
  4490. }
  4491. }, _callee, this, [[1, 6, 9, 12]]);
  4492. }));
  4493. function _renderAnnotationLayer() {
  4494. return _renderAnnotationLayer2.apply(this, arguments);
  4495. }
  4496. return _renderAnnotationLayer;
  4497. }()
  4498. }, {
  4499. key: "_renderXfaLayer",
  4500. value: function () {
  4501. var _renderXfaLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  4502. var error, result;
  4503. return _regenerator["default"].wrap(function _callee2$(_context2) {
  4504. while (1) {
  4505. switch (_context2.prev = _context2.next) {
  4506. case 0:
  4507. error = null;
  4508. _context2.prev = 1;
  4509. _context2.next = 4;
  4510. return this.xfaLayer.render(this.viewport, "display");
  4511. case 4:
  4512. result = _context2.sent;
  4513. if (this.textHighlighter) {
  4514. this._buildXfaTextContentItems(result.textDivs);
  4515. }
  4516. _context2.next = 11;
  4517. break;
  4518. case 8:
  4519. _context2.prev = 8;
  4520. _context2.t0 = _context2["catch"](1);
  4521. error = _context2.t0;
  4522. case 11:
  4523. _context2.prev = 11;
  4524. this.eventBus.dispatch("xfalayerrendered", {
  4525. source: this,
  4526. pageNumber: this.id,
  4527. error: error
  4528. });
  4529. return _context2.finish(11);
  4530. case 14:
  4531. case "end":
  4532. return _context2.stop();
  4533. }
  4534. }
  4535. }, _callee2, this, [[1, 8, 11, 14]]);
  4536. }));
  4537. function _renderXfaLayer() {
  4538. return _renderXfaLayer2.apply(this, arguments);
  4539. }
  4540. return _renderXfaLayer;
  4541. }()
  4542. }, {
  4543. key: "_buildXfaTextContentItems",
  4544. value: function () {
  4545. var _buildXfaTextContentItems2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(textDivs) {
  4546. var text, items, _iterator, _step, item;
  4547. return _regenerator["default"].wrap(function _callee3$(_context3) {
  4548. while (1) {
  4549. switch (_context3.prev = _context3.next) {
  4550. case 0:
  4551. _context3.next = 2;
  4552. return this.pdfPage.getTextContent();
  4553. case 2:
  4554. text = _context3.sent;
  4555. items = [];
  4556. _iterator = _createForOfIteratorHelper(text.items);
  4557. try {
  4558. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4559. item = _step.value;
  4560. items.push(item.str);
  4561. }
  4562. } catch (err) {
  4563. _iterator.e(err);
  4564. } finally {
  4565. _iterator.f();
  4566. }
  4567. this.textHighlighter.setTextMapping(textDivs, items);
  4568. this.textHighlighter.enable();
  4569. case 8:
  4570. case "end":
  4571. return _context3.stop();
  4572. }
  4573. }
  4574. }, _callee3, this);
  4575. }));
  4576. function _buildXfaTextContentItems(_x) {
  4577. return _buildXfaTextContentItems2.apply(this, arguments);
  4578. }
  4579. return _buildXfaTextContentItems;
  4580. }()
  4581. }, {
  4582. key: "_resetZoomLayer",
  4583. value: function _resetZoomLayer() {
  4584. var removeFromDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4585. if (!this.zoomLayer) {
  4586. return;
  4587. }
  4588. var zoomLayerCanvas = this.zoomLayer.firstChild;
  4589. this.paintedViewportMap["delete"](zoomLayerCanvas);
  4590. zoomLayerCanvas.width = 0;
  4591. zoomLayerCanvas.height = 0;
  4592. if (removeFromDOM) {
  4593. this.zoomLayer.remove();
  4594. }
  4595. this.zoomLayer = null;
  4596. }
  4597. }, {
  4598. key: "reset",
  4599. value: function reset() {
  4600. var _this$annotationLayer,
  4601. _this$xfaLayer,
  4602. _this = this;
  4603. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4604. _ref$keepZoomLayer = _ref.keepZoomLayer,
  4605. keepZoomLayer = _ref$keepZoomLayer === void 0 ? false : _ref$keepZoomLayer,
  4606. _ref$keepAnnotationLa = _ref.keepAnnotationLayer,
  4607. keepAnnotationLayer = _ref$keepAnnotationLa === void 0 ? false : _ref$keepAnnotationLa,
  4608. _ref$keepXfaLayer = _ref.keepXfaLayer,
  4609. keepXfaLayer = _ref$keepXfaLayer === void 0 ? false : _ref$keepXfaLayer;
  4610. this.cancelRendering({
  4611. keepAnnotationLayer: keepAnnotationLayer,
  4612. keepXfaLayer: keepXfaLayer
  4613. });
  4614. this.renderingState = _ui_utils.RenderingStates.INITIAL;
  4615. var div = this.div;
  4616. div.style.width = Math.floor(this.viewport.width) + "px";
  4617. div.style.height = Math.floor(this.viewport.height) + "px";
  4618. var childNodes = div.childNodes,
  4619. zoomLayerNode = keepZoomLayer && this.zoomLayer || null,
  4620. annotationLayerNode = keepAnnotationLayer && ((_this$annotationLayer = this.annotationLayer) === null || _this$annotationLayer === void 0 ? void 0 : _this$annotationLayer.div) || null,
  4621. xfaLayerNode = keepXfaLayer && ((_this$xfaLayer = this.xfaLayer) === null || _this$xfaLayer === void 0 ? void 0 : _this$xfaLayer.div) || null;
  4622. for (var i = childNodes.length - 1; i >= 0; i--) {
  4623. var node = childNodes[i];
  4624. switch (node) {
  4625. case zoomLayerNode:
  4626. case annotationLayerNode:
  4627. case xfaLayerNode:
  4628. continue;
  4629. }
  4630. node.remove();
  4631. }
  4632. div.removeAttribute("data-loaded");
  4633. if (annotationLayerNode) {
  4634. this.annotationLayer.hide();
  4635. }
  4636. if (xfaLayerNode) {
  4637. this.xfaLayer.hide();
  4638. }
  4639. if (!zoomLayerNode) {
  4640. if (this.canvas) {
  4641. this.paintedViewportMap["delete"](this.canvas);
  4642. this.canvas.width = 0;
  4643. this.canvas.height = 0;
  4644. delete this.canvas;
  4645. }
  4646. this._resetZoomLayer();
  4647. }
  4648. if (this.svg) {
  4649. this.paintedViewportMap["delete"](this.svg);
  4650. delete this.svg;
  4651. }
  4652. this.loadingIconDiv = document.createElement("div");
  4653. this.loadingIconDiv.className = "loadingIcon notVisible";
  4654. if (this._isStandalone) {
  4655. this.toggleLoadingIconSpinner(true);
  4656. }
  4657. this.loadingIconDiv.setAttribute("role", "img");
  4658. this.l10n.get("loading").then(function (msg) {
  4659. var _this$loadingIconDiv;
  4660. (_this$loadingIconDiv = _this.loadingIconDiv) === null || _this$loadingIconDiv === void 0 ? void 0 : _this$loadingIconDiv.setAttribute("aria-label", msg);
  4661. });
  4662. div.appendChild(this.loadingIconDiv);
  4663. }
  4664. }, {
  4665. key: "update",
  4666. value: function update(_ref2) {
  4667. var _ref2$scale = _ref2.scale,
  4668. scale = _ref2$scale === void 0 ? 0 : _ref2$scale,
  4669. _ref2$rotation = _ref2.rotation,
  4670. rotation = _ref2$rotation === void 0 ? null : _ref2$rotation,
  4671. _ref2$optionalContent = _ref2.optionalContentConfigPromise,
  4672. optionalContentConfigPromise = _ref2$optionalContent === void 0 ? null : _ref2$optionalContent;
  4673. if (_typeof(arguments[0]) !== "object") {
  4674. console.error("PDFPageView.update called with separate parameters, please use an object instead.");
  4675. this.update({
  4676. scale: arguments[0],
  4677. rotation: arguments[1],
  4678. optionalContentConfigPromise: arguments[2]
  4679. });
  4680. return;
  4681. }
  4682. this.scale = scale || this.scale;
  4683. if (typeof rotation === "number") {
  4684. this.rotation = rotation;
  4685. }
  4686. if (optionalContentConfigPromise instanceof Promise) {
  4687. this._optionalContentConfigPromise = optionalContentConfigPromise;
  4688. }
  4689. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  4690. var viewportScale = this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  4691. this.viewport = this.viewport.clone({
  4692. scale: viewportScale,
  4693. rotation: totalRotation
  4694. });
  4695. if (this._isStandalone) {
  4696. var style = document.documentElement.style;
  4697. style.setProperty("--zoom-factor", this.scale);
  4698. style.setProperty("--viewport-scale-factor", viewportScale);
  4699. }
  4700. if (this.svg) {
  4701. this.cssTransform({
  4702. target: this.svg,
  4703. redrawAnnotationLayer: true,
  4704. redrawXfaLayer: true
  4705. });
  4706. this.eventBus.dispatch("pagerendered", {
  4707. source: this,
  4708. pageNumber: this.id,
  4709. cssTransform: true,
  4710. timestamp: performance.now(),
  4711. error: this._renderError
  4712. });
  4713. return;
  4714. }
  4715. var isScalingRestricted = false;
  4716. if (this.canvas && this.maxCanvasPixels > 0) {
  4717. var outputScale = this.outputScale;
  4718. if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > this.maxCanvasPixels) {
  4719. isScalingRestricted = true;
  4720. }
  4721. }
  4722. if (this.canvas) {
  4723. if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
  4724. this.cssTransform({
  4725. target: this.canvas,
  4726. redrawAnnotationLayer: true,
  4727. redrawXfaLayer: true
  4728. });
  4729. this.eventBus.dispatch("pagerendered", {
  4730. source: this,
  4731. pageNumber: this.id,
  4732. cssTransform: true,
  4733. timestamp: performance.now(),
  4734. error: this._renderError
  4735. });
  4736. return;
  4737. }
  4738. if (!this.zoomLayer && !this.canvas.hidden) {
  4739. this.zoomLayer = this.canvas.parentNode;
  4740. this.zoomLayer.style.position = "absolute";
  4741. }
  4742. }
  4743. if (this.zoomLayer) {
  4744. this.cssTransform({
  4745. target: this.zoomLayer.firstChild
  4746. });
  4747. }
  4748. this.reset({
  4749. keepZoomLayer: true,
  4750. keepAnnotationLayer: true,
  4751. keepXfaLayer: true
  4752. });
  4753. }
  4754. }, {
  4755. key: "cancelRendering",
  4756. value: function cancelRendering() {
  4757. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4758. _ref3$keepAnnotationL = _ref3.keepAnnotationLayer,
  4759. keepAnnotationLayer = _ref3$keepAnnotationL === void 0 ? false : _ref3$keepAnnotationL,
  4760. _ref3$keepXfaLayer = _ref3.keepXfaLayer,
  4761. keepXfaLayer = _ref3$keepXfaLayer === void 0 ? false : _ref3$keepXfaLayer;
  4762. if (this.paintTask) {
  4763. this.paintTask.cancel();
  4764. this.paintTask = null;
  4765. }
  4766. this.resume = null;
  4767. if (this.textLayer) {
  4768. this.textLayer.cancel();
  4769. this.textLayer = null;
  4770. }
  4771. if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
  4772. this.annotationLayer.cancel();
  4773. this.annotationLayer = null;
  4774. this._annotationCanvasMap = null;
  4775. }
  4776. if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
  4777. var _this$textHighlighter;
  4778. this.xfaLayer.cancel();
  4779. this.xfaLayer = null;
  4780. (_this$textHighlighter = this.textHighlighter) === null || _this$textHighlighter === void 0 ? void 0 : _this$textHighlighter.disable();
  4781. }
  4782. if (this._onTextLayerRendered) {
  4783. this.eventBus._off("textlayerrendered", this._onTextLayerRendered);
  4784. this._onTextLayerRendered = null;
  4785. }
  4786. }
  4787. }, {
  4788. key: "cssTransform",
  4789. value: function cssTransform(_ref4) {
  4790. var target = _ref4.target,
  4791. _ref4$redrawAnnotatio = _ref4.redrawAnnotationLayer,
  4792. redrawAnnotationLayer = _ref4$redrawAnnotatio === void 0 ? false : _ref4$redrawAnnotatio,
  4793. _ref4$redrawXfaLayer = _ref4.redrawXfaLayer,
  4794. redrawXfaLayer = _ref4$redrawXfaLayer === void 0 ? false : _ref4$redrawXfaLayer;
  4795. var width = this.viewport.width;
  4796. var height = this.viewport.height;
  4797. var div = this.div;
  4798. target.style.width = target.parentNode.style.width = div.style.width = Math.floor(width) + "px";
  4799. target.style.height = target.parentNode.style.height = div.style.height = Math.floor(height) + "px";
  4800. var relativeRotation = this.viewport.rotation - this.paintedViewportMap.get(target).rotation;
  4801. var absRotation = Math.abs(relativeRotation);
  4802. var scaleX = 1,
  4803. scaleY = 1;
  4804. if (absRotation === 90 || absRotation === 270) {
  4805. scaleX = height / width;
  4806. scaleY = width / height;
  4807. }
  4808. target.style.transform = "rotate(".concat(relativeRotation, "deg) scale(").concat(scaleX, ", ").concat(scaleY, ")");
  4809. if (this.textLayer) {
  4810. var textLayerViewport = this.textLayer.viewport;
  4811. var textRelativeRotation = this.viewport.rotation - textLayerViewport.rotation;
  4812. var textAbsRotation = Math.abs(textRelativeRotation);
  4813. var scale = width / textLayerViewport.width;
  4814. if (textAbsRotation === 90 || textAbsRotation === 270) {
  4815. scale = width / textLayerViewport.height;
  4816. }
  4817. var textLayerDiv = this.textLayer.textLayerDiv;
  4818. var transX, transY;
  4819. switch (textAbsRotation) {
  4820. case 0:
  4821. transX = transY = 0;
  4822. break;
  4823. case 90:
  4824. transX = 0;
  4825. transY = "-" + textLayerDiv.style.height;
  4826. break;
  4827. case 180:
  4828. transX = "-" + textLayerDiv.style.width;
  4829. transY = "-" + textLayerDiv.style.height;
  4830. break;
  4831. case 270:
  4832. transX = "-" + textLayerDiv.style.width;
  4833. transY = 0;
  4834. break;
  4835. default:
  4836. console.error("Bad rotation value.");
  4837. break;
  4838. }
  4839. textLayerDiv.style.transform = "rotate(".concat(textAbsRotation, "deg) ") + "scale(".concat(scale, ") ") + "translate(".concat(transX, ", ").concat(transY, ")");
  4840. textLayerDiv.style.transformOrigin = "0% 0%";
  4841. }
  4842. if (redrawAnnotationLayer && this.annotationLayer) {
  4843. this._renderAnnotationLayer();
  4844. }
  4845. if (redrawXfaLayer && this.xfaLayer) {
  4846. this._renderXfaLayer();
  4847. }
  4848. }
  4849. }, {
  4850. key: "width",
  4851. get: function get() {
  4852. return this.viewport.width;
  4853. }
  4854. }, {
  4855. key: "height",
  4856. get: function get() {
  4857. return this.viewport.height;
  4858. }
  4859. }, {
  4860. key: "getPagePoint",
  4861. value: function getPagePoint(x, y) {
  4862. return this.viewport.convertToPdfPoint(x, y);
  4863. }
  4864. }, {
  4865. key: "toggleLoadingIconSpinner",
  4866. value: function toggleLoadingIconSpinner() {
  4867. var _this$loadingIconDiv2;
  4868. var viewVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4869. (_this$loadingIconDiv2 = this.loadingIconDiv) === null || _this$loadingIconDiv2 === void 0 ? void 0 : _this$loadingIconDiv2.classList.toggle("notVisible", !viewVisible);
  4870. }
  4871. }, {
  4872. key: "draw",
  4873. value: function draw() {
  4874. var _this$annotationLayer2,
  4875. _this$xfaLayer2,
  4876. _this2 = this;
  4877. if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
  4878. console.error("Must be in new state before drawing");
  4879. this.reset();
  4880. }
  4881. var div = this.div,
  4882. pdfPage = this.pdfPage;
  4883. if (!pdfPage) {
  4884. this.renderingState = _ui_utils.RenderingStates.FINISHED;
  4885. if (this.loadingIconDiv) {
  4886. this.loadingIconDiv.remove();
  4887. delete this.loadingIconDiv;
  4888. }
  4889. return Promise.reject(new Error("pdfPage is not loaded"));
  4890. }
  4891. this.renderingState = _ui_utils.RenderingStates.RUNNING;
  4892. var canvasWrapper = document.createElement("div");
  4893. canvasWrapper.style.width = div.style.width;
  4894. canvasWrapper.style.height = div.style.height;
  4895. canvasWrapper.classList.add("canvasWrapper");
  4896. if ((_this$annotationLayer2 = this.annotationLayer) !== null && _this$annotationLayer2 !== void 0 && _this$annotationLayer2.div) {
  4897. div.insertBefore(canvasWrapper, this.annotationLayer.div);
  4898. } else {
  4899. div.appendChild(canvasWrapper);
  4900. }
  4901. var textLayer = null;
  4902. if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) {
  4903. var _this$annotationLayer3;
  4904. var textLayerDiv = document.createElement("div");
  4905. textLayerDiv.className = "textLayer";
  4906. textLayerDiv.style.width = canvasWrapper.style.width;
  4907. textLayerDiv.style.height = canvasWrapper.style.height;
  4908. if ((_this$annotationLayer3 = this.annotationLayer) !== null && _this$annotationLayer3 !== void 0 && _this$annotationLayer3.div) {
  4909. div.insertBefore(textLayerDiv, this.annotationLayer.div);
  4910. } else {
  4911. div.appendChild(textLayerDiv);
  4912. }
  4913. textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, this.eventBus, this.textHighlighter);
  4914. }
  4915. this.textLayer = textLayer;
  4916. if (_classPrivateFieldGet(this, _annotationMode) !== _pdfjsLib.AnnotationMode.DISABLE && this.annotationLayerFactory) {
  4917. this._annotationCanvasMap || (this._annotationCanvasMap = new Map());
  4918. this.annotationLayer || (this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, _classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS, this.l10n, null, null, null, null, this._annotationCanvasMap));
  4919. }
  4920. if ((_this$xfaLayer2 = this.xfaLayer) !== null && _this$xfaLayer2 !== void 0 && _this$xfaLayer2.div) {
  4921. div.appendChild(this.xfaLayer.div);
  4922. }
  4923. var renderContinueCallback = null;
  4924. if (this.renderingQueue) {
  4925. renderContinueCallback = function renderContinueCallback(cont) {
  4926. if (!_this2.renderingQueue.isHighestPriority(_this2)) {
  4927. _this2.renderingState = _ui_utils.RenderingStates.PAUSED;
  4928. _this2.resume = function () {
  4929. _this2.renderingState = _ui_utils.RenderingStates.RUNNING;
  4930. cont();
  4931. };
  4932. return;
  4933. }
  4934. cont();
  4935. };
  4936. }
  4937. var finishPaintTask = /*#__PURE__*/function () {
  4938. var _ref5 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  4939. var error,
  4940. _args4 = arguments;
  4941. return _regenerator["default"].wrap(function _callee4$(_context4) {
  4942. while (1) {
  4943. switch (_context4.prev = _context4.next) {
  4944. case 0:
  4945. error = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
  4946. if (paintTask === _this2.paintTask) {
  4947. _this2.paintTask = null;
  4948. }
  4949. if (!(error instanceof _pdfjsLib.RenderingCancelledException)) {
  4950. _context4.next = 5;
  4951. break;
  4952. }
  4953. _this2._renderError = null;
  4954. return _context4.abrupt("return");
  4955. case 5:
  4956. _this2._renderError = error;
  4957. _this2.renderingState = _ui_utils.RenderingStates.FINISHED;
  4958. if (_this2.loadingIconDiv) {
  4959. _this2.loadingIconDiv.remove();
  4960. delete _this2.loadingIconDiv;
  4961. }
  4962. _this2._resetZoomLayer(true);
  4963. _this2.eventBus.dispatch("pagerendered", {
  4964. source: _this2,
  4965. pageNumber: _this2.id,
  4966. cssTransform: false,
  4967. timestamp: performance.now(),
  4968. error: _this2._renderError
  4969. });
  4970. if (!error) {
  4971. _context4.next = 12;
  4972. break;
  4973. }
  4974. throw error;
  4975. case 12:
  4976. case "end":
  4977. return _context4.stop();
  4978. }
  4979. }
  4980. }, _callee4);
  4981. }));
  4982. return function finishPaintTask() {
  4983. return _ref5.apply(this, arguments);
  4984. };
  4985. }();
  4986. var paintTask = this.renderer === _ui_utils.RendererType.SVG ? this.paintOnSvg(canvasWrapper) : this.paintOnCanvas(canvasWrapper);
  4987. paintTask.onRenderContinue = renderContinueCallback;
  4988. this.paintTask = paintTask;
  4989. var resultPromise = paintTask.promise.then(function () {
  4990. return finishPaintTask(null).then(function () {
  4991. if (textLayer) {
  4992. var readableStream = pdfPage.streamTextContent({
  4993. includeMarkedContent: true
  4994. });
  4995. textLayer.setTextContentStream(readableStream);
  4996. textLayer.render();
  4997. }
  4998. if (_this2.annotationLayer) {
  4999. _this2._renderAnnotationLayer();
  5000. }
  5001. });
  5002. }, function (reason) {
  5003. return finishPaintTask(reason);
  5004. });
  5005. if (this.xfaLayerFactory) {
  5006. if (!this.xfaLayer) {
  5007. this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder(div, pdfPage, null);
  5008. }
  5009. this._renderXfaLayer();
  5010. }
  5011. if (this.structTreeLayerFactory && this.textLayer && this.canvas) {
  5012. this._onTextLayerRendered = function (event) {
  5013. if (event.pageNumber !== _this2.id) {
  5014. return;
  5015. }
  5016. _this2.eventBus._off("textlayerrendered", _this2._onTextLayerRendered);
  5017. _this2._onTextLayerRendered = null;
  5018. if (!_this2.canvas) {
  5019. return;
  5020. }
  5021. _this2.pdfPage.getStructTree().then(function (tree) {
  5022. if (!tree) {
  5023. return;
  5024. }
  5025. if (!_this2.canvas) {
  5026. return;
  5027. }
  5028. var treeDom = _this2.structTreeLayer.render(tree);
  5029. treeDom.classList.add("structTree");
  5030. _this2.canvas.appendChild(treeDom);
  5031. });
  5032. };
  5033. this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
  5034. this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);
  5035. }
  5036. div.setAttribute("data-loaded", true);
  5037. this.eventBus.dispatch("pagerender", {
  5038. source: this,
  5039. pageNumber: this.id
  5040. });
  5041. return resultPromise;
  5042. }
  5043. }, {
  5044. key: "paintOnCanvas",
  5045. value: function paintOnCanvas(canvasWrapper) {
  5046. var renderCapability = (0, _pdfjsLib.createPromiseCapability)();
  5047. var result = {
  5048. promise: renderCapability.promise,
  5049. onRenderContinue: function onRenderContinue(cont) {
  5050. cont();
  5051. },
  5052. cancel: function cancel() {
  5053. renderTask.cancel();
  5054. }
  5055. };
  5056. var viewport = this.viewport;
  5057. var canvas = document.createElement("canvas");
  5058. canvas.hidden = true;
  5059. var isCanvasHidden = true;
  5060. var showCanvas = function showCanvas() {
  5061. if (isCanvasHidden) {
  5062. canvas.hidden = false;
  5063. isCanvasHidden = false;
  5064. }
  5065. };
  5066. canvasWrapper.appendChild(canvas);
  5067. this.canvas = canvas;
  5068. canvas.mozOpaque = true;
  5069. var ctx = canvas.getContext("2d", {
  5070. alpha: false
  5071. });
  5072. var outputScale = this.outputScale = new _ui_utils.OutputScale();
  5073. if (this.useOnlyCssZoom) {
  5074. var actualSizeViewport = viewport.clone({
  5075. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  5076. });
  5077. outputScale.sx *= actualSizeViewport.width / viewport.width;
  5078. outputScale.sy *= actualSizeViewport.height / viewport.height;
  5079. }
  5080. if (this.maxCanvasPixels > 0) {
  5081. var pixelsInViewport = viewport.width * viewport.height;
  5082. var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
  5083. if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
  5084. outputScale.sx = maxScale;
  5085. outputScale.sy = maxScale;
  5086. this.hasRestrictedScaling = true;
  5087. } else {
  5088. this.hasRestrictedScaling = false;
  5089. }
  5090. }
  5091. var sfx = (0, _ui_utils.approximateFraction)(outputScale.sx);
  5092. var sfy = (0, _ui_utils.approximateFraction)(outputScale.sy);
  5093. canvas.width = (0, _ui_utils.roundToDivide)(viewport.width * outputScale.sx, sfx[0]);
  5094. canvas.height = (0, _ui_utils.roundToDivide)(viewport.height * outputScale.sy, sfy[0]);
  5095. canvas.style.width = (0, _ui_utils.roundToDivide)(viewport.width, sfx[1]) + "px";
  5096. canvas.style.height = (0, _ui_utils.roundToDivide)(viewport.height, sfy[1]) + "px";
  5097. this.paintedViewportMap.set(canvas, viewport);
  5098. var transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
  5099. var renderContext = {
  5100. canvasContext: ctx,
  5101. transform: transform,
  5102. viewport: this.viewport,
  5103. annotationMode: _classPrivateFieldGet(this, _annotationMode),
  5104. optionalContentConfigPromise: this._optionalContentConfigPromise,
  5105. annotationCanvasMap: this._annotationCanvasMap
  5106. };
  5107. var renderTask = this.pdfPage.render(renderContext);
  5108. renderTask.onContinue = function (cont) {
  5109. showCanvas();
  5110. if (result.onRenderContinue) {
  5111. result.onRenderContinue(cont);
  5112. } else {
  5113. cont();
  5114. }
  5115. };
  5116. renderTask.promise.then(function () {
  5117. showCanvas();
  5118. renderCapability.resolve();
  5119. }, function (error) {
  5120. showCanvas();
  5121. renderCapability.reject(error);
  5122. });
  5123. return result;
  5124. }
  5125. }, {
  5126. key: "paintOnSvg",
  5127. value: function paintOnSvg(wrapper) {
  5128. var _this3 = this;
  5129. var cancelled = false;
  5130. var ensureNotCancelled = function ensureNotCancelled() {
  5131. if (cancelled) {
  5132. throw new _pdfjsLib.RenderingCancelledException("Rendering cancelled, page ".concat(_this3.id), "svg");
  5133. }
  5134. };
  5135. var pdfPage = this.pdfPage;
  5136. var actualSizeViewport = this.viewport.clone({
  5137. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  5138. });
  5139. var promise = pdfPage.getOperatorList({
  5140. annotationMode: _classPrivateFieldGet(this, _annotationMode)
  5141. }).then(function (opList) {
  5142. ensureNotCancelled();
  5143. var svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs);
  5144. return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) {
  5145. ensureNotCancelled();
  5146. _this3.svg = svg;
  5147. _this3.paintedViewportMap.set(svg, actualSizeViewport);
  5148. svg.style.width = wrapper.style.width;
  5149. svg.style.height = wrapper.style.height;
  5150. _this3.renderingState = _ui_utils.RenderingStates.FINISHED;
  5151. wrapper.appendChild(svg);
  5152. });
  5153. });
  5154. return {
  5155. promise: promise,
  5156. onRenderContinue: function onRenderContinue(cont) {
  5157. cont();
  5158. },
  5159. cancel: function cancel() {
  5160. cancelled = true;
  5161. }
  5162. };
  5163. }
  5164. }, {
  5165. key: "setPageLabel",
  5166. value: function setPageLabel(label) {
  5167. this.pageLabel = typeof label === "string" ? label : null;
  5168. if (this.pageLabel !== null) {
  5169. this.div.setAttribute("data-page-label", this.pageLabel);
  5170. } else {
  5171. this.div.removeAttribute("data-page-label");
  5172. }
  5173. }
  5174. }]);
  5175. return PDFPageView;
  5176. }();
  5177. exports.PDFPageView = PDFPageView;
  5178. /***/ }),
  5179. /* 15 */
  5180. /***/ ((__unused_webpack_module, exports) => {
  5181. Object.defineProperty(exports, "__esModule", ({
  5182. value: true
  5183. }));
  5184. exports.compatibilityParams = exports.OptionKind = exports.AppOptions = void 0;
  5185. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  5186. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5187. 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); } }
  5188. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5189. var compatibilityParams = Object.create(null);
  5190. exports.compatibilityParams = compatibilityParams;
  5191. {
  5192. var userAgent = navigator.userAgent || "";
  5193. var platform = navigator.platform || "";
  5194. var maxTouchPoints = navigator.maxTouchPoints || 1;
  5195. var isAndroid = /Android/.test(userAgent);
  5196. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
  5197. (function checkCanvasSizeLimitation() {
  5198. if (isIOS || isAndroid) {
  5199. compatibilityParams.maxCanvasPixels = 5242880;
  5200. }
  5201. })();
  5202. }
  5203. var OptionKind = {
  5204. VIEWER: 0x02,
  5205. API: 0x04,
  5206. WORKER: 0x08,
  5207. PREFERENCE: 0x80
  5208. };
  5209. exports.OptionKind = OptionKind;
  5210. var defaultOptions = {
  5211. annotationMode: {
  5212. value: 2,
  5213. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5214. },
  5215. cursorToolOnLoad: {
  5216. value: 0,
  5217. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5218. },
  5219. defaultUrl: {
  5220. value: "compressed.tracemonkey-pldi-09.pdf",
  5221. kind: OptionKind.VIEWER
  5222. },
  5223. defaultZoomValue: {
  5224. value: "",
  5225. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5226. },
  5227. disableHistory: {
  5228. value: false,
  5229. kind: OptionKind.VIEWER
  5230. },
  5231. disablePageLabels: {
  5232. value: false,
  5233. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5234. },
  5235. enablePermissions: {
  5236. value: false,
  5237. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5238. },
  5239. enablePrintAutoRotate: {
  5240. value: true,
  5241. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5242. },
  5243. enableScripting: {
  5244. value: true,
  5245. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5246. },
  5247. externalLinkRel: {
  5248. value: "noopener noreferrer nofollow",
  5249. kind: OptionKind.VIEWER
  5250. },
  5251. externalLinkTarget: {
  5252. value: 0,
  5253. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5254. },
  5255. historyUpdateUrl: {
  5256. value: false,
  5257. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5258. },
  5259. ignoreDestinationZoom: {
  5260. value: false,
  5261. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5262. },
  5263. imageResourcesPath: {
  5264. value: "./images/",
  5265. kind: OptionKind.VIEWER
  5266. },
  5267. maxCanvasPixels: {
  5268. value: 16777216,
  5269. compatibility: compatibilityParams.maxCanvasPixels,
  5270. kind: OptionKind.VIEWER
  5271. },
  5272. pdfBugEnabled: {
  5273. value: false,
  5274. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5275. },
  5276. printResolution: {
  5277. value: 150,
  5278. kind: OptionKind.VIEWER
  5279. },
  5280. renderer: {
  5281. value: "canvas",
  5282. kind: OptionKind.VIEWER
  5283. },
  5284. sidebarViewOnLoad: {
  5285. value: -1,
  5286. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5287. },
  5288. scrollModeOnLoad: {
  5289. value: -1,
  5290. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5291. },
  5292. spreadModeOnLoad: {
  5293. value: -1,
  5294. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5295. },
  5296. textLayerMode: {
  5297. value: 1,
  5298. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5299. },
  5300. useOnlyCssZoom: {
  5301. value: false,
  5302. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5303. },
  5304. viewerCssTheme: {
  5305. value: 0,
  5306. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5307. },
  5308. viewOnLoad: {
  5309. value: 0,
  5310. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5311. },
  5312. cMapPacked: {
  5313. value: true,
  5314. kind: OptionKind.API
  5315. },
  5316. cMapUrl: {
  5317. value: "../web/cmaps/",
  5318. kind: OptionKind.API
  5319. },
  5320. disableAutoFetch: {
  5321. value: false,
  5322. kind: OptionKind.API + OptionKind.PREFERENCE
  5323. },
  5324. disableFontFace: {
  5325. value: false,
  5326. kind: OptionKind.API + OptionKind.PREFERENCE
  5327. },
  5328. disableRange: {
  5329. value: false,
  5330. kind: OptionKind.API + OptionKind.PREFERENCE
  5331. },
  5332. disableStream: {
  5333. value: false,
  5334. kind: OptionKind.API + OptionKind.PREFERENCE
  5335. },
  5336. docBaseUrl: {
  5337. value: "",
  5338. kind: OptionKind.API
  5339. },
  5340. enableXfa: {
  5341. value: true,
  5342. kind: OptionKind.API + OptionKind.PREFERENCE
  5343. },
  5344. fontExtraProperties: {
  5345. value: false,
  5346. kind: OptionKind.API
  5347. },
  5348. isEvalSupported: {
  5349. value: true,
  5350. kind: OptionKind.API
  5351. },
  5352. maxImageSize: {
  5353. value: -1,
  5354. kind: OptionKind.API
  5355. },
  5356. pdfBug: {
  5357. value: false,
  5358. kind: OptionKind.API
  5359. },
  5360. standardFontDataUrl: {
  5361. value: "../web/standard_fonts/",
  5362. kind: OptionKind.API
  5363. },
  5364. verbosity: {
  5365. value: 1,
  5366. kind: OptionKind.API
  5367. },
  5368. workerPort: {
  5369. value: null,
  5370. kind: OptionKind.WORKER
  5371. },
  5372. workerSrc: {
  5373. value: "../build/pdf.worker.js",
  5374. kind: OptionKind.WORKER
  5375. }
  5376. };
  5377. {
  5378. defaultOptions.disablePreferences = {
  5379. value: false,
  5380. kind: OptionKind.VIEWER
  5381. };
  5382. defaultOptions.locale = {
  5383. value: navigator.language || "en-US",
  5384. kind: OptionKind.VIEWER
  5385. };
  5386. defaultOptions.sandboxBundleSrc = {
  5387. value: "../build/pdf.sandbox.js",
  5388. kind: OptionKind.VIEWER
  5389. };
  5390. defaultOptions.renderer.kind += OptionKind.PREFERENCE;
  5391. }
  5392. var userOptions = Object.create(null);
  5393. var AppOptions = /*#__PURE__*/function () {
  5394. function AppOptions() {
  5395. _classCallCheck(this, AppOptions);
  5396. throw new Error("Cannot initialize AppOptions.");
  5397. }
  5398. _createClass(AppOptions, null, [{
  5399. key: "get",
  5400. value: function get(name) {
  5401. var userOption = userOptions[name];
  5402. if (userOption !== undefined) {
  5403. return userOption;
  5404. }
  5405. var defaultOption = defaultOptions[name];
  5406. if (defaultOption !== undefined) {
  5407. var _defaultOption$compat;
  5408. return (_defaultOption$compat = defaultOption.compatibility) !== null && _defaultOption$compat !== void 0 ? _defaultOption$compat : defaultOption.value;
  5409. }
  5410. return undefined;
  5411. }
  5412. }, {
  5413. key: "getAll",
  5414. value: function getAll() {
  5415. var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  5416. var options = Object.create(null);
  5417. for (var name in defaultOptions) {
  5418. var _defaultOption$compat2;
  5419. var defaultOption = defaultOptions[name];
  5420. if (kind) {
  5421. if ((kind & defaultOption.kind) === 0) {
  5422. continue;
  5423. }
  5424. if (kind === OptionKind.PREFERENCE) {
  5425. var value = defaultOption.value,
  5426. valueType = _typeof(value);
  5427. if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) {
  5428. options[name] = value;
  5429. continue;
  5430. }
  5431. throw new Error("Invalid type for preference: ".concat(name));
  5432. }
  5433. }
  5434. var userOption = userOptions[name];
  5435. options[name] = userOption !== undefined ? userOption : (_defaultOption$compat2 = defaultOption.compatibility) !== null && _defaultOption$compat2 !== void 0 ? _defaultOption$compat2 : defaultOption.value;
  5436. }
  5437. return options;
  5438. }
  5439. }, {
  5440. key: "set",
  5441. value: function set(name, value) {
  5442. userOptions[name] = value;
  5443. }
  5444. }, {
  5445. key: "setAll",
  5446. value: function setAll(options) {
  5447. for (var name in options) {
  5448. userOptions[name] = options[name];
  5449. }
  5450. }
  5451. }, {
  5452. key: "remove",
  5453. value: function remove(name) {
  5454. delete userOptions[name];
  5455. }
  5456. }, {
  5457. key: "_hasUserOptions",
  5458. value: function _hasUserOptions() {
  5459. return Object.keys(userOptions).length > 0;
  5460. }
  5461. }]);
  5462. return AppOptions;
  5463. }();
  5464. exports.AppOptions = AppOptions;
  5465. /***/ }),
  5466. /* 16 */
  5467. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5468. Object.defineProperty(exports, "__esModule", ({
  5469. value: true
  5470. }));
  5471. exports.PDFRenderingQueue = void 0;
  5472. var _pdfjsLib = __w_pdfjs_require__(5);
  5473. var _ui_utils = __w_pdfjs_require__(8);
  5474. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5475. 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); } }
  5476. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5477. var CLEANUP_TIMEOUT = 30000;
  5478. var PDFRenderingQueue = /*#__PURE__*/function () {
  5479. function PDFRenderingQueue() {
  5480. _classCallCheck(this, PDFRenderingQueue);
  5481. this.pdfViewer = null;
  5482. this.pdfThumbnailViewer = null;
  5483. this.onIdle = null;
  5484. this.highestPriorityPage = null;
  5485. this.idleTimeout = null;
  5486. this.printing = false;
  5487. this.isThumbnailViewEnabled = false;
  5488. }
  5489. _createClass(PDFRenderingQueue, [{
  5490. key: "setViewer",
  5491. value: function setViewer(pdfViewer) {
  5492. this.pdfViewer = pdfViewer;
  5493. }
  5494. }, {
  5495. key: "setThumbnailViewer",
  5496. value: function setThumbnailViewer(pdfThumbnailViewer) {
  5497. this.pdfThumbnailViewer = pdfThumbnailViewer;
  5498. }
  5499. }, {
  5500. key: "isHighestPriority",
  5501. value: function isHighestPriority(view) {
  5502. return this.highestPriorityPage === view.renderingId;
  5503. }
  5504. }, {
  5505. key: "hasViewer",
  5506. value: function hasViewer() {
  5507. return !!this.pdfViewer;
  5508. }
  5509. }, {
  5510. key: "renderHighestPriority",
  5511. value: function renderHighestPriority(currentlyVisiblePages) {
  5512. var _this$pdfThumbnailVie;
  5513. if (this.idleTimeout) {
  5514. clearTimeout(this.idleTimeout);
  5515. this.idleTimeout = null;
  5516. }
  5517. if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
  5518. return;
  5519. }
  5520. if (this.isThumbnailViewEnabled && (_this$pdfThumbnailVie = this.pdfThumbnailViewer) !== null && _this$pdfThumbnailVie !== void 0 && _this$pdfThumbnailVie.forceRendering()) {
  5521. return;
  5522. }
  5523. if (this.printing) {
  5524. return;
  5525. }
  5526. if (this.onIdle) {
  5527. this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
  5528. }
  5529. }
  5530. }, {
  5531. key: "getHighestPriority",
  5532. value: function getHighestPriority(visible, views, scrolledDown) {
  5533. var preRenderExtra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  5534. var visibleViews = visible.views,
  5535. numVisible = visibleViews.length;
  5536. if (numVisible === 0) {
  5537. return null;
  5538. }
  5539. for (var i = 0; i < numVisible; i++) {
  5540. var view = visibleViews[i].view;
  5541. if (!this.isViewFinished(view)) {
  5542. return view;
  5543. }
  5544. }
  5545. var firstId = visible.first.id,
  5546. lastId = visible.last.id;
  5547. if (lastId - firstId + 1 > numVisible) {
  5548. var visibleIds = visible.ids;
  5549. for (var _i = 1, ii = lastId - firstId; _i < ii; _i++) {
  5550. var holeId = scrolledDown ? firstId + _i : lastId - _i;
  5551. if (visibleIds.has(holeId)) {
  5552. continue;
  5553. }
  5554. var holeView = views[holeId - 1];
  5555. if (!this.isViewFinished(holeView)) {
  5556. return holeView;
  5557. }
  5558. }
  5559. }
  5560. var preRenderIndex = scrolledDown ? lastId : firstId - 2;
  5561. var preRenderView = views[preRenderIndex];
  5562. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5563. return preRenderView;
  5564. }
  5565. if (preRenderExtra) {
  5566. preRenderIndex += scrolledDown ? 1 : -1;
  5567. preRenderView = views[preRenderIndex];
  5568. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5569. return preRenderView;
  5570. }
  5571. }
  5572. return null;
  5573. }
  5574. }, {
  5575. key: "isViewFinished",
  5576. value: function isViewFinished(view) {
  5577. return view.renderingState === _ui_utils.RenderingStates.FINISHED;
  5578. }
  5579. }, {
  5580. key: "renderView",
  5581. value: function renderView(view) {
  5582. var _this = this;
  5583. switch (view.renderingState) {
  5584. case _ui_utils.RenderingStates.FINISHED:
  5585. return false;
  5586. case _ui_utils.RenderingStates.PAUSED:
  5587. this.highestPriorityPage = view.renderingId;
  5588. view.resume();
  5589. break;
  5590. case _ui_utils.RenderingStates.RUNNING:
  5591. this.highestPriorityPage = view.renderingId;
  5592. break;
  5593. case _ui_utils.RenderingStates.INITIAL:
  5594. this.highestPriorityPage = view.renderingId;
  5595. view.draw()["finally"](function () {
  5596. _this.renderHighestPriority();
  5597. })["catch"](function (reason) {
  5598. if (reason instanceof _pdfjsLib.RenderingCancelledException) {
  5599. return;
  5600. }
  5601. console.error("renderView: \"".concat(reason, "\""));
  5602. });
  5603. break;
  5604. }
  5605. return true;
  5606. }
  5607. }]);
  5608. return PDFRenderingQueue;
  5609. }();
  5610. exports.PDFRenderingQueue = PDFRenderingQueue;
  5611. /***/ }),
  5612. /* 17 */
  5613. /***/ ((__unused_webpack_module, exports) => {
  5614. Object.defineProperty(exports, "__esModule", ({
  5615. value: true
  5616. }));
  5617. exports.TextHighlighter = void 0;
  5618. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5619. 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); } }
  5620. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5621. var TextHighlighter = /*#__PURE__*/function () {
  5622. function TextHighlighter(_ref) {
  5623. var findController = _ref.findController,
  5624. eventBus = _ref.eventBus,
  5625. pageIndex = _ref.pageIndex;
  5626. _classCallCheck(this, TextHighlighter);
  5627. this.findController = findController;
  5628. this.matches = [];
  5629. this.eventBus = eventBus;
  5630. this.pageIdx = pageIndex;
  5631. this._onUpdateTextLayerMatches = null;
  5632. this.textDivs = null;
  5633. this.textContentItemsStr = null;
  5634. this.enabled = false;
  5635. }
  5636. _createClass(TextHighlighter, [{
  5637. key: "setTextMapping",
  5638. value: function setTextMapping(divs, texts) {
  5639. this.textDivs = divs;
  5640. this.textContentItemsStr = texts;
  5641. }
  5642. }, {
  5643. key: "enable",
  5644. value: function enable() {
  5645. var _this = this;
  5646. if (!this.textDivs || !this.textContentItemsStr) {
  5647. throw new Error("Text divs and strings have not been set.");
  5648. }
  5649. if (this.enabled) {
  5650. throw new Error("TextHighlighter is already enabled.");
  5651. }
  5652. this.enabled = true;
  5653. if (!this._onUpdateTextLayerMatches) {
  5654. this._onUpdateTextLayerMatches = function (evt) {
  5655. if (evt.pageIndex === _this.pageIdx || evt.pageIndex === -1) {
  5656. _this._updateMatches();
  5657. }
  5658. };
  5659. this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
  5660. }
  5661. this._updateMatches();
  5662. }
  5663. }, {
  5664. key: "disable",
  5665. value: function disable() {
  5666. if (!this.enabled) {
  5667. return;
  5668. }
  5669. this.enabled = false;
  5670. if (this._onUpdateTextLayerMatches) {
  5671. this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
  5672. this._onUpdateTextLayerMatches = null;
  5673. }
  5674. }
  5675. }, {
  5676. key: "_convertMatches",
  5677. value: function _convertMatches(matches, matchesLength) {
  5678. if (!matches) {
  5679. return [];
  5680. }
  5681. var textContentItemsStr = this.textContentItemsStr;
  5682. var i = 0,
  5683. iIndex = 0;
  5684. var end = textContentItemsStr.length - 1;
  5685. var result = [];
  5686. for (var m = 0, mm = matches.length; m < mm; m++) {
  5687. var matchIdx = matches[m];
  5688. while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {
  5689. iIndex += textContentItemsStr[i].length;
  5690. i++;
  5691. }
  5692. if (i === textContentItemsStr.length) {
  5693. console.error("Could not find a matching mapping");
  5694. }
  5695. var match = {
  5696. begin: {
  5697. divIdx: i,
  5698. offset: matchIdx - iIndex
  5699. }
  5700. };
  5701. matchIdx += matchesLength[m];
  5702. while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
  5703. iIndex += textContentItemsStr[i].length;
  5704. i++;
  5705. }
  5706. match.end = {
  5707. divIdx: i,
  5708. offset: matchIdx - iIndex
  5709. };
  5710. result.push(match);
  5711. }
  5712. return result;
  5713. }
  5714. }, {
  5715. key: "_renderMatches",
  5716. value: function _renderMatches(matches) {
  5717. if (matches.length === 0) {
  5718. return;
  5719. }
  5720. var findController = this.findController,
  5721. pageIdx = this.pageIdx;
  5722. var textContentItemsStr = this.textContentItemsStr,
  5723. textDivs = this.textDivs;
  5724. var isSelectedPage = pageIdx === findController.selected.pageIdx;
  5725. var selectedMatchIdx = findController.selected.matchIdx;
  5726. var highlightAll = findController.state.highlightAll;
  5727. var prevEnd = null;
  5728. var infinity = {
  5729. divIdx: -1,
  5730. offset: undefined
  5731. };
  5732. function beginText(begin, className) {
  5733. var divIdx = begin.divIdx;
  5734. textDivs[divIdx].textContent = "";
  5735. return appendTextToDiv(divIdx, 0, begin.offset, className);
  5736. }
  5737. function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
  5738. var div = textDivs[divIdx];
  5739. if (div.nodeType === Node.TEXT_NODE) {
  5740. var span = document.createElement("span");
  5741. div.parentNode.insertBefore(span, div);
  5742. span.appendChild(div);
  5743. textDivs[divIdx] = span;
  5744. div = span;
  5745. }
  5746. var content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
  5747. var node = document.createTextNode(content);
  5748. if (className) {
  5749. var _span = document.createElement("span");
  5750. _span.className = "".concat(className, " appended");
  5751. _span.appendChild(node);
  5752. div.appendChild(_span);
  5753. return className.includes("selected") ? _span.offsetLeft : 0;
  5754. }
  5755. div.appendChild(node);
  5756. return 0;
  5757. }
  5758. var i0 = selectedMatchIdx,
  5759. i1 = i0 + 1;
  5760. if (highlightAll) {
  5761. i0 = 0;
  5762. i1 = matches.length;
  5763. } else if (!isSelectedPage) {
  5764. return;
  5765. }
  5766. for (var i = i0; i < i1; i++) {
  5767. var match = matches[i];
  5768. var begin = match.begin;
  5769. var end = match.end;
  5770. var isSelected = isSelectedPage && i === selectedMatchIdx;
  5771. var highlightSuffix = isSelected ? " selected" : "";
  5772. var selectedLeft = 0;
  5773. if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
  5774. if (prevEnd !== null) {
  5775. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  5776. }
  5777. beginText(begin);
  5778. } else {
  5779. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
  5780. }
  5781. if (begin.divIdx === end.divIdx) {
  5782. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);
  5783. } else {
  5784. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);
  5785. for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
  5786. textDivs[n0].className = "highlight middle" + highlightSuffix;
  5787. }
  5788. beginText(end, "highlight end" + highlightSuffix);
  5789. }
  5790. prevEnd = end;
  5791. if (isSelected) {
  5792. findController.scrollMatchIntoView({
  5793. element: textDivs[begin.divIdx],
  5794. selectedLeft: selectedLeft,
  5795. pageIndex: pageIdx,
  5796. matchIndex: selectedMatchIdx
  5797. });
  5798. }
  5799. }
  5800. if (prevEnd) {
  5801. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  5802. }
  5803. }
  5804. }, {
  5805. key: "_updateMatches",
  5806. value: function _updateMatches() {
  5807. if (!this.enabled) {
  5808. return;
  5809. }
  5810. var findController = this.findController,
  5811. matches = this.matches,
  5812. pageIdx = this.pageIdx;
  5813. var textContentItemsStr = this.textContentItemsStr,
  5814. textDivs = this.textDivs;
  5815. var clearedUntilDivIdx = -1;
  5816. for (var i = 0, ii = matches.length; i < ii; i++) {
  5817. var match = matches[i];
  5818. var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
  5819. for (var n = begin, end = match.end.divIdx; n <= end; n++) {
  5820. var div = textDivs[n];
  5821. div.textContent = textContentItemsStr[n];
  5822. div.className = "";
  5823. }
  5824. clearedUntilDivIdx = match.end.divIdx + 1;
  5825. }
  5826. if (!(findController !== null && findController !== void 0 && findController.highlightMatches)) {
  5827. return;
  5828. }
  5829. var pageMatches = findController.pageMatches[pageIdx] || null;
  5830. var pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;
  5831. this.matches = this._convertMatches(pageMatches, pageMatchesLength);
  5832. this._renderMatches(this.matches);
  5833. }
  5834. }]);
  5835. return TextHighlighter;
  5836. }();
  5837. exports.TextHighlighter = TextHighlighter;
  5838. /***/ }),
  5839. /* 18 */
  5840. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5841. Object.defineProperty(exports, "__esModule", ({
  5842. value: true
  5843. }));
  5844. exports.DownloadManager = void 0;
  5845. var _pdfjsLib = __w_pdfjs_require__(5);
  5846. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5847. 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); } }
  5848. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5849. ;
  5850. function _download(blobUrl, filename) {
  5851. var a = document.createElement("a");
  5852. if (!a.click) {
  5853. throw new Error('DownloadManager: "a.click()" is not supported.');
  5854. }
  5855. a.href = blobUrl;
  5856. a.target = "_parent";
  5857. if ("download" in a) {
  5858. a.download = filename;
  5859. }
  5860. (document.body || document.documentElement).appendChild(a);
  5861. a.click();
  5862. a.remove();
  5863. }
  5864. var DownloadManager = /*#__PURE__*/function () {
  5865. function DownloadManager() {
  5866. _classCallCheck(this, DownloadManager);
  5867. this._openBlobUrls = new WeakMap();
  5868. }
  5869. _createClass(DownloadManager, [{
  5870. key: "downloadUrl",
  5871. value: function downloadUrl(url, filename) {
  5872. if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) {
  5873. console.error("downloadUrl - not a valid URL: ".concat(url));
  5874. return;
  5875. }
  5876. _download(url + "#pdfjs.action=download", filename);
  5877. }
  5878. }, {
  5879. key: "downloadData",
  5880. value: function downloadData(data, filename, contentType) {
  5881. var blobUrl = URL.createObjectURL(new Blob([data], {
  5882. type: contentType
  5883. }));
  5884. _download(blobUrl, filename);
  5885. }
  5886. }, {
  5887. key: "openOrDownloadData",
  5888. value: function openOrDownloadData(element, data, filename) {
  5889. var isPdfData = (0, _pdfjsLib.isPdfFile)(filename);
  5890. var contentType = isPdfData ? "application/pdf" : "";
  5891. if (isPdfData) {
  5892. var blobUrl = this._openBlobUrls.get(element);
  5893. if (!blobUrl) {
  5894. blobUrl = URL.createObjectURL(new Blob([data], {
  5895. type: contentType
  5896. }));
  5897. this._openBlobUrls.set(element, blobUrl);
  5898. }
  5899. var viewerUrl;
  5900. viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
  5901. try {
  5902. window.open(viewerUrl);
  5903. return true;
  5904. } catch (ex) {
  5905. console.error("openOrDownloadData: ".concat(ex));
  5906. URL.revokeObjectURL(blobUrl);
  5907. this._openBlobUrls["delete"](element);
  5908. }
  5909. }
  5910. this.downloadData(data, filename, contentType);
  5911. return false;
  5912. }
  5913. }, {
  5914. key: "download",
  5915. value: function download(blob, url, filename) {
  5916. var sourceEventType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "download";
  5917. var blobUrl = URL.createObjectURL(blob);
  5918. _download(blobUrl, filename);
  5919. }
  5920. }]);
  5921. return DownloadManager;
  5922. }();
  5923. exports.DownloadManager = DownloadManager;
  5924. /***/ }),
  5925. /* 19 */
  5926. /***/ ((__unused_webpack_module, exports) => {
  5927. Object.defineProperty(exports, "__esModule", ({
  5928. value: true
  5929. }));
  5930. exports.WaitOnType = exports.EventBus = exports.AutomationEventBus = void 0;
  5931. exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
  5932. 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  5933. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5934. 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); }; }
  5935. 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); }
  5936. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  5937. 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; } }
  5938. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  5939. 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; } } }; }
  5940. 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); }
  5941. 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; }
  5942. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5943. 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); } }
  5944. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5945. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  5946. var WaitOnType = {
  5947. EVENT: "event",
  5948. TIMEOUT: "timeout"
  5949. };
  5950. exports.WaitOnType = WaitOnType;
  5951. function waitOnEventOrTimeout(_ref) {
  5952. var target = _ref.target,
  5953. name = _ref.name,
  5954. _ref$delay = _ref.delay,
  5955. delay = _ref$delay === void 0 ? 0 : _ref$delay;
  5956. return new Promise(function (resolve, reject) {
  5957. if (_typeof(target) !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {
  5958. throw new Error("waitOnEventOrTimeout - invalid parameters.");
  5959. }
  5960. function handler(type) {
  5961. if (target instanceof EventBus) {
  5962. target._off(name, eventHandler);
  5963. } else {
  5964. target.removeEventListener(name, eventHandler);
  5965. }
  5966. if (timeout) {
  5967. clearTimeout(timeout);
  5968. }
  5969. resolve(type);
  5970. }
  5971. var eventHandler = handler.bind(null, WaitOnType.EVENT);
  5972. if (target instanceof EventBus) {
  5973. target._on(name, eventHandler);
  5974. } else {
  5975. target.addEventListener(name, eventHandler);
  5976. }
  5977. var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
  5978. var timeout = setTimeout(timeoutHandler, delay);
  5979. });
  5980. }
  5981. var EventBus = /*#__PURE__*/function () {
  5982. function EventBus() {
  5983. _classCallCheck(this, EventBus);
  5984. this._listeners = Object.create(null);
  5985. }
  5986. _createClass(EventBus, [{
  5987. key: "on",
  5988. value: function on(eventName, listener) {
  5989. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5990. this._on(eventName, listener, {
  5991. external: true,
  5992. once: options === null || options === void 0 ? void 0 : options.once
  5993. });
  5994. }
  5995. }, {
  5996. key: "off",
  5997. value: function off(eventName, listener) {
  5998. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5999. this._off(eventName, listener, {
  6000. external: true,
  6001. once: options === null || options === void 0 ? void 0 : options.once
  6002. });
  6003. }
  6004. }, {
  6005. key: "dispatch",
  6006. value: function dispatch(eventName, data) {
  6007. var eventListeners = this._listeners[eventName];
  6008. if (!eventListeners || eventListeners.length === 0) {
  6009. return;
  6010. }
  6011. var externalListeners;
  6012. var _iterator = _createForOfIteratorHelper(eventListeners.slice(0)),
  6013. _step;
  6014. try {
  6015. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  6016. var _step$value = _step.value,
  6017. _listener = _step$value.listener,
  6018. external = _step$value.external,
  6019. once = _step$value.once;
  6020. if (once) {
  6021. this._off(eventName, _listener);
  6022. }
  6023. if (external) {
  6024. (externalListeners || (externalListeners = [])).push(_listener);
  6025. continue;
  6026. }
  6027. _listener(data);
  6028. }
  6029. } catch (err) {
  6030. _iterator.e(err);
  6031. } finally {
  6032. _iterator.f();
  6033. }
  6034. if (externalListeners) {
  6035. var _iterator2 = _createForOfIteratorHelper(externalListeners),
  6036. _step2;
  6037. try {
  6038. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  6039. var listener = _step2.value;
  6040. listener(data);
  6041. }
  6042. } catch (err) {
  6043. _iterator2.e(err);
  6044. } finally {
  6045. _iterator2.f();
  6046. }
  6047. externalListeners = null;
  6048. }
  6049. }
  6050. }, {
  6051. key: "_on",
  6052. value: function _on(eventName, listener) {
  6053. var _this$_listeners;
  6054. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6055. var eventListeners = (_this$_listeners = this._listeners)[eventName] || (_this$_listeners[eventName] = []);
  6056. eventListeners.push({
  6057. listener: listener,
  6058. external: (options === null || options === void 0 ? void 0 : options.external) === true,
  6059. once: (options === null || options === void 0 ? void 0 : options.once) === true
  6060. });
  6061. }
  6062. }, {
  6063. key: "_off",
  6064. value: function _off(eventName, listener) {
  6065. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6066. var eventListeners = this._listeners[eventName];
  6067. if (!eventListeners) {
  6068. return;
  6069. }
  6070. for (var i = 0, ii = eventListeners.length; i < ii; i++) {
  6071. if (eventListeners[i].listener === listener) {
  6072. eventListeners.splice(i, 1);
  6073. return;
  6074. }
  6075. }
  6076. }
  6077. }]);
  6078. return EventBus;
  6079. }();
  6080. exports.EventBus = EventBus;
  6081. var AutomationEventBus = /*#__PURE__*/function (_EventBus) {
  6082. _inherits(AutomationEventBus, _EventBus);
  6083. var _super = _createSuper(AutomationEventBus);
  6084. function AutomationEventBus() {
  6085. _classCallCheck(this, AutomationEventBus);
  6086. return _super.apply(this, arguments);
  6087. }
  6088. _createClass(AutomationEventBus, [{
  6089. key: "dispatch",
  6090. value: function dispatch(eventName, data) {
  6091. throw new Error("Not implemented: AutomationEventBus.dispatch");
  6092. }
  6093. }]);
  6094. return AutomationEventBus;
  6095. }(EventBus);
  6096. exports.AutomationEventBus = AutomationEventBus;
  6097. /***/ }),
  6098. /* 20 */
  6099. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6100. Object.defineProperty(exports, "__esModule", ({
  6101. value: true
  6102. }));
  6103. exports.GenericL10n = void 0;
  6104. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  6105. __w_pdfjs_require__(21);
  6106. var _l10n_utils = __w_pdfjs_require__(6);
  6107. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6108. 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); } }
  6109. 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); }); }; }
  6110. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6111. 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); } }
  6112. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  6113. var webL10n = document.webL10n;
  6114. var GenericL10n = /*#__PURE__*/function () {
  6115. function GenericL10n(lang) {
  6116. _classCallCheck(this, GenericL10n);
  6117. this._lang = lang;
  6118. this._ready = new Promise(function (resolve, reject) {
  6119. webL10n.setLanguage((0, _l10n_utils.fixupLangCode)(lang), function () {
  6120. resolve(webL10n);
  6121. });
  6122. });
  6123. }
  6124. _createClass(GenericL10n, [{
  6125. key: "getLanguage",
  6126. value: function () {
  6127. var _getLanguage = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  6128. var l10n;
  6129. return _regenerator["default"].wrap(function _callee$(_context) {
  6130. while (1) {
  6131. switch (_context.prev = _context.next) {
  6132. case 0:
  6133. _context.next = 2;
  6134. return this._ready;
  6135. case 2:
  6136. l10n = _context.sent;
  6137. return _context.abrupt("return", l10n.getLanguage());
  6138. case 4:
  6139. case "end":
  6140. return _context.stop();
  6141. }
  6142. }
  6143. }, _callee, this);
  6144. }));
  6145. function getLanguage() {
  6146. return _getLanguage.apply(this, arguments);
  6147. }
  6148. return getLanguage;
  6149. }()
  6150. }, {
  6151. key: "getDirection",
  6152. value: function () {
  6153. var _getDirection = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  6154. var l10n;
  6155. return _regenerator["default"].wrap(function _callee2$(_context2) {
  6156. while (1) {
  6157. switch (_context2.prev = _context2.next) {
  6158. case 0:
  6159. _context2.next = 2;
  6160. return this._ready;
  6161. case 2:
  6162. l10n = _context2.sent;
  6163. return _context2.abrupt("return", l10n.getDirection());
  6164. case 4:
  6165. case "end":
  6166. return _context2.stop();
  6167. }
  6168. }
  6169. }, _callee2, this);
  6170. }));
  6171. function getDirection() {
  6172. return _getDirection.apply(this, arguments);
  6173. }
  6174. return getDirection;
  6175. }()
  6176. }, {
  6177. key: "get",
  6178. value: function () {
  6179. var _get = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(key) {
  6180. var args,
  6181. fallback,
  6182. l10n,
  6183. _args3 = arguments;
  6184. return _regenerator["default"].wrap(function _callee3$(_context3) {
  6185. while (1) {
  6186. switch (_context3.prev = _context3.next) {
  6187. case 0:
  6188. args = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : null;
  6189. fallback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : (0, _l10n_utils.getL10nFallback)(key, args);
  6190. _context3.next = 4;
  6191. return this._ready;
  6192. case 4:
  6193. l10n = _context3.sent;
  6194. return _context3.abrupt("return", l10n.get(key, args, fallback));
  6195. case 6:
  6196. case "end":
  6197. return _context3.stop();
  6198. }
  6199. }
  6200. }, _callee3, this);
  6201. }));
  6202. function get(_x) {
  6203. return _get.apply(this, arguments);
  6204. }
  6205. return get;
  6206. }()
  6207. }, {
  6208. key: "translate",
  6209. value: function () {
  6210. var _translate = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(element) {
  6211. var l10n;
  6212. return _regenerator["default"].wrap(function _callee4$(_context4) {
  6213. while (1) {
  6214. switch (_context4.prev = _context4.next) {
  6215. case 0:
  6216. _context4.next = 2;
  6217. return this._ready;
  6218. case 2:
  6219. l10n = _context4.sent;
  6220. return _context4.abrupt("return", l10n.translate(element));
  6221. case 4:
  6222. case "end":
  6223. return _context4.stop();
  6224. }
  6225. }
  6226. }, _callee4, this);
  6227. }));
  6228. function translate(_x2) {
  6229. return _translate.apply(this, arguments);
  6230. }
  6231. return translate;
  6232. }()
  6233. }]);
  6234. return GenericL10n;
  6235. }();
  6236. exports.GenericL10n = GenericL10n;
  6237. /***/ }),
  6238. /* 21 */
  6239. /***/ (() => {
  6240. document.webL10n = function (window, document, undefined) {
  6241. var gL10nData = {};
  6242. var gTextData = '';
  6243. var gTextProp = 'textContent';
  6244. var gLanguage = '';
  6245. var gMacros = {};
  6246. var gReadyState = 'loading';
  6247. var gAsyncResourceLoading = true;
  6248. function getL10nResourceLinks() {
  6249. return document.querySelectorAll('link[type="application/l10n"]');
  6250. }
  6251. function getL10nDictionary() {
  6252. var script = document.querySelector('script[type="application/l10n"]');
  6253. return script ? JSON.parse(script.innerHTML) : null;
  6254. }
  6255. function getTranslatableChildren(element) {
  6256. return element ? element.querySelectorAll('*[data-l10n-id]') : [];
  6257. }
  6258. function getL10nAttributes(element) {
  6259. if (!element) return {};
  6260. var l10nId = element.getAttribute('data-l10n-id');
  6261. var l10nArgs = element.getAttribute('data-l10n-args');
  6262. var args = {};
  6263. if (l10nArgs) {
  6264. try {
  6265. args = JSON.parse(l10nArgs);
  6266. } catch (e) {
  6267. console.warn('could not parse arguments for #' + l10nId);
  6268. }
  6269. }
  6270. return {
  6271. id: l10nId,
  6272. args: args
  6273. };
  6274. }
  6275. function xhrLoadText(url, onSuccess, onFailure) {
  6276. onSuccess = onSuccess || function _onSuccess(data) {};
  6277. onFailure = onFailure || function _onFailure() {};
  6278. var xhr = new XMLHttpRequest();
  6279. xhr.open('GET', url, gAsyncResourceLoading);
  6280. if (xhr.overrideMimeType) {
  6281. xhr.overrideMimeType('text/plain; charset=utf-8');
  6282. }
  6283. xhr.onreadystatechange = function () {
  6284. if (xhr.readyState == 4) {
  6285. if (xhr.status == 200 || xhr.status === 0) {
  6286. onSuccess(xhr.responseText);
  6287. } else {
  6288. onFailure();
  6289. }
  6290. }
  6291. };
  6292. xhr.onerror = onFailure;
  6293. xhr.ontimeout = onFailure;
  6294. try {
  6295. xhr.send(null);
  6296. } catch (e) {
  6297. onFailure();
  6298. }
  6299. }
  6300. function parseResource(href, lang, successCallback, failureCallback) {
  6301. var baseURL = href.replace(/[^\/]*$/, '') || './';
  6302. function evalString(text) {
  6303. if (text.lastIndexOf('\\') < 0) return text;
  6304. 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, "'");
  6305. }
  6306. function parseProperties(text, parsedPropertiesCallback) {
  6307. var dictionary = {};
  6308. var reBlank = /^\s*|\s*$/;
  6309. var reComment = /^\s*#|^\s*$/;
  6310. var reSection = /^\s*\[(.*)\]\s*$/;
  6311. var reImport = /^\s*@import\s+url\((.*)\)\s*$/i;
  6312. var reSplit = /^([^=\s]*)\s*=\s*(.+)$/;
  6313. function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {
  6314. var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
  6315. var currentLang = '*';
  6316. var genericLang = lang.split('-', 1)[0];
  6317. var skipLang = false;
  6318. var match = '';
  6319. function nextEntry() {
  6320. while (true) {
  6321. if (!entries.length) {
  6322. parsedRawLinesCallback();
  6323. return;
  6324. }
  6325. var line = entries.shift();
  6326. if (reComment.test(line)) continue;
  6327. if (extendedSyntax) {
  6328. match = reSection.exec(line);
  6329. if (match) {
  6330. currentLang = match[1].toLowerCase();
  6331. skipLang = currentLang !== '*' && currentLang !== lang && currentLang !== genericLang;
  6332. continue;
  6333. } else if (skipLang) {
  6334. continue;
  6335. }
  6336. match = reImport.exec(line);
  6337. if (match) {
  6338. loadImport(baseURL + match[1], nextEntry);
  6339. return;
  6340. }
  6341. }
  6342. var tmp = line.match(reSplit);
  6343. if (tmp && tmp.length == 3) {
  6344. dictionary[tmp[1]] = evalString(tmp[2]);
  6345. }
  6346. }
  6347. }
  6348. nextEntry();
  6349. }
  6350. function loadImport(url, callback) {
  6351. xhrLoadText(url, function (content) {
  6352. parseRawLines(content, false, callback);
  6353. }, function () {
  6354. console.warn(url + ' not found.');
  6355. callback();
  6356. });
  6357. }
  6358. parseRawLines(text, true, function () {
  6359. parsedPropertiesCallback(dictionary);
  6360. });
  6361. }
  6362. xhrLoadText(href, function (response) {
  6363. gTextData += response;
  6364. parseProperties(response, function (data) {
  6365. for (var key in data) {
  6366. var id,
  6367. prop,
  6368. index = key.lastIndexOf('.');
  6369. if (index > 0) {
  6370. id = key.substring(0, index);
  6371. prop = key.substring(index + 1);
  6372. } else {
  6373. id = key;
  6374. prop = gTextProp;
  6375. }
  6376. if (!gL10nData[id]) {
  6377. gL10nData[id] = {};
  6378. }
  6379. gL10nData[id][prop] = data[key];
  6380. }
  6381. if (successCallback) {
  6382. successCallback();
  6383. }
  6384. });
  6385. }, failureCallback);
  6386. }
  6387. function loadLocale(lang, callback) {
  6388. if (lang) {
  6389. lang = lang.toLowerCase();
  6390. }
  6391. callback = callback || function _callback() {};
  6392. clear();
  6393. gLanguage = lang;
  6394. var langLinks = getL10nResourceLinks();
  6395. var langCount = langLinks.length;
  6396. if (langCount === 0) {
  6397. var dict = getL10nDictionary();
  6398. if (dict && dict.locales && dict.default_locale) {
  6399. console.log('using the embedded JSON directory, early way out');
  6400. gL10nData = dict.locales[lang];
  6401. if (!gL10nData) {
  6402. var defaultLocale = dict.default_locale.toLowerCase();
  6403. for (var anyCaseLang in dict.locales) {
  6404. anyCaseLang = anyCaseLang.toLowerCase();
  6405. if (anyCaseLang === lang) {
  6406. gL10nData = dict.locales[lang];
  6407. break;
  6408. } else if (anyCaseLang === defaultLocale) {
  6409. gL10nData = dict.locales[defaultLocale];
  6410. }
  6411. }
  6412. }
  6413. callback();
  6414. } else {
  6415. console.log('no resource to load, early way out');
  6416. }
  6417. gReadyState = 'complete';
  6418. return;
  6419. }
  6420. var onResourceLoaded = null;
  6421. var gResourceCount = 0;
  6422. onResourceLoaded = function onResourceLoaded() {
  6423. gResourceCount++;
  6424. if (gResourceCount >= langCount) {
  6425. callback();
  6426. gReadyState = 'complete';
  6427. }
  6428. };
  6429. function L10nResourceLink(link) {
  6430. var href = link.href;
  6431. this.load = function (lang, callback) {
  6432. parseResource(href, lang, callback, function () {
  6433. console.warn(href + ' not found.');
  6434. console.warn('"' + lang + '" resource not found');
  6435. gLanguage = '';
  6436. callback();
  6437. });
  6438. };
  6439. }
  6440. for (var i = 0; i < langCount; i++) {
  6441. var resource = new L10nResourceLink(langLinks[i]);
  6442. resource.load(lang, onResourceLoaded);
  6443. }
  6444. }
  6445. function clear() {
  6446. gL10nData = {};
  6447. gTextData = '';
  6448. gLanguage = '';
  6449. }
  6450. function getPluralRules(lang) {
  6451. var locales2rules = {
  6452. 'af': 3,
  6453. 'ak': 4,
  6454. 'am': 4,
  6455. 'ar': 1,
  6456. 'asa': 3,
  6457. 'az': 0,
  6458. 'be': 11,
  6459. 'bem': 3,
  6460. 'bez': 3,
  6461. 'bg': 3,
  6462. 'bh': 4,
  6463. 'bm': 0,
  6464. 'bn': 3,
  6465. 'bo': 0,
  6466. 'br': 20,
  6467. 'brx': 3,
  6468. 'bs': 11,
  6469. 'ca': 3,
  6470. 'cgg': 3,
  6471. 'chr': 3,
  6472. 'cs': 12,
  6473. 'cy': 17,
  6474. 'da': 3,
  6475. 'de': 3,
  6476. 'dv': 3,
  6477. 'dz': 0,
  6478. 'ee': 3,
  6479. 'el': 3,
  6480. 'en': 3,
  6481. 'eo': 3,
  6482. 'es': 3,
  6483. 'et': 3,
  6484. 'eu': 3,
  6485. 'fa': 0,
  6486. 'ff': 5,
  6487. 'fi': 3,
  6488. 'fil': 4,
  6489. 'fo': 3,
  6490. 'fr': 5,
  6491. 'fur': 3,
  6492. 'fy': 3,
  6493. 'ga': 8,
  6494. 'gd': 24,
  6495. 'gl': 3,
  6496. 'gsw': 3,
  6497. 'gu': 3,
  6498. 'guw': 4,
  6499. 'gv': 23,
  6500. 'ha': 3,
  6501. 'haw': 3,
  6502. 'he': 2,
  6503. 'hi': 4,
  6504. 'hr': 11,
  6505. 'hu': 0,
  6506. 'id': 0,
  6507. 'ig': 0,
  6508. 'ii': 0,
  6509. 'is': 3,
  6510. 'it': 3,
  6511. 'iu': 7,
  6512. 'ja': 0,
  6513. 'jmc': 3,
  6514. 'jv': 0,
  6515. 'ka': 0,
  6516. 'kab': 5,
  6517. 'kaj': 3,
  6518. 'kcg': 3,
  6519. 'kde': 0,
  6520. 'kea': 0,
  6521. 'kk': 3,
  6522. 'kl': 3,
  6523. 'km': 0,
  6524. 'kn': 0,
  6525. 'ko': 0,
  6526. 'ksb': 3,
  6527. 'ksh': 21,
  6528. 'ku': 3,
  6529. 'kw': 7,
  6530. 'lag': 18,
  6531. 'lb': 3,
  6532. 'lg': 3,
  6533. 'ln': 4,
  6534. 'lo': 0,
  6535. 'lt': 10,
  6536. 'lv': 6,
  6537. 'mas': 3,
  6538. 'mg': 4,
  6539. 'mk': 16,
  6540. 'ml': 3,
  6541. 'mn': 3,
  6542. 'mo': 9,
  6543. 'mr': 3,
  6544. 'ms': 0,
  6545. 'mt': 15,
  6546. 'my': 0,
  6547. 'nah': 3,
  6548. 'naq': 7,
  6549. 'nb': 3,
  6550. 'nd': 3,
  6551. 'ne': 3,
  6552. 'nl': 3,
  6553. 'nn': 3,
  6554. 'no': 3,
  6555. 'nr': 3,
  6556. 'nso': 4,
  6557. 'ny': 3,
  6558. 'nyn': 3,
  6559. 'om': 3,
  6560. 'or': 3,
  6561. 'pa': 3,
  6562. 'pap': 3,
  6563. 'pl': 13,
  6564. 'ps': 3,
  6565. 'pt': 3,
  6566. 'rm': 3,
  6567. 'ro': 9,
  6568. 'rof': 3,
  6569. 'ru': 11,
  6570. 'rwk': 3,
  6571. 'sah': 0,
  6572. 'saq': 3,
  6573. 'se': 7,
  6574. 'seh': 3,
  6575. 'ses': 0,
  6576. 'sg': 0,
  6577. 'sh': 11,
  6578. 'shi': 19,
  6579. 'sk': 12,
  6580. 'sl': 14,
  6581. 'sma': 7,
  6582. 'smi': 7,
  6583. 'smj': 7,
  6584. 'smn': 7,
  6585. 'sms': 7,
  6586. 'sn': 3,
  6587. 'so': 3,
  6588. 'sq': 3,
  6589. 'sr': 11,
  6590. 'ss': 3,
  6591. 'ssy': 3,
  6592. 'st': 3,
  6593. 'sv': 3,
  6594. 'sw': 3,
  6595. 'syr': 3,
  6596. 'ta': 3,
  6597. 'te': 3,
  6598. 'teo': 3,
  6599. 'th': 0,
  6600. 'ti': 4,
  6601. 'tig': 3,
  6602. 'tk': 3,
  6603. 'tl': 4,
  6604. 'tn': 3,
  6605. 'to': 0,
  6606. 'tr': 0,
  6607. 'ts': 3,
  6608. 'tzm': 22,
  6609. 'uk': 11,
  6610. 'ur': 3,
  6611. 've': 3,
  6612. 'vi': 0,
  6613. 'vun': 3,
  6614. 'wa': 4,
  6615. 'wae': 3,
  6616. 'wo': 0,
  6617. 'xh': 3,
  6618. 'xog': 3,
  6619. 'yo': 0,
  6620. 'zh': 0,
  6621. 'zu': 3
  6622. };
  6623. function isIn(n, list) {
  6624. return list.indexOf(n) !== -1;
  6625. }
  6626. function isBetween(n, start, end) {
  6627. return start <= n && n <= end;
  6628. }
  6629. var pluralRules = {
  6630. '0': function _(n) {
  6631. return 'other';
  6632. },
  6633. '1': function _(n) {
  6634. if (isBetween(n % 100, 3, 10)) return 'few';
  6635. if (n === 0) return 'zero';
  6636. if (isBetween(n % 100, 11, 99)) return 'many';
  6637. if (n == 2) return 'two';
  6638. if (n == 1) return 'one';
  6639. return 'other';
  6640. },
  6641. '2': function _(n) {
  6642. if (n !== 0 && n % 10 === 0) return 'many';
  6643. if (n == 2) return 'two';
  6644. if (n == 1) return 'one';
  6645. return 'other';
  6646. },
  6647. '3': function _(n) {
  6648. if (n == 1) return 'one';
  6649. return 'other';
  6650. },
  6651. '4': function _(n) {
  6652. if (isBetween(n, 0, 1)) return 'one';
  6653. return 'other';
  6654. },
  6655. '5': function _(n) {
  6656. if (isBetween(n, 0, 2) && n != 2) return 'one';
  6657. return 'other';
  6658. },
  6659. '6': function _(n) {
  6660. if (n === 0) return 'zero';
  6661. if (n % 10 == 1 && n % 100 != 11) return 'one';
  6662. return 'other';
  6663. },
  6664. '7': function _(n) {
  6665. if (n == 2) return 'two';
  6666. if (n == 1) return 'one';
  6667. return 'other';
  6668. },
  6669. '8': function _(n) {
  6670. if (isBetween(n, 3, 6)) return 'few';
  6671. if (isBetween(n, 7, 10)) return 'many';
  6672. if (n == 2) return 'two';
  6673. if (n == 1) return 'one';
  6674. return 'other';
  6675. },
  6676. '9': function _(n) {
  6677. if (n === 0 || n != 1 && isBetween(n % 100, 1, 19)) return 'few';
  6678. if (n == 1) return 'one';
  6679. return 'other';
  6680. },
  6681. '10': function _(n) {
  6682. if (isBetween(n % 10, 2, 9) && !isBetween(n % 100, 11, 19)) return 'few';
  6683. if (n % 10 == 1 && !isBetween(n % 100, 11, 19)) return 'one';
  6684. return 'other';
  6685. },
  6686. '11': function _(n) {
  6687. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  6688. if (n % 10 === 0 || isBetween(n % 10, 5, 9) || isBetween(n % 100, 11, 14)) return 'many';
  6689. if (n % 10 == 1 && n % 100 != 11) return 'one';
  6690. return 'other';
  6691. },
  6692. '12': function _(n) {
  6693. if (isBetween(n, 2, 4)) return 'few';
  6694. if (n == 1) return 'one';
  6695. return 'other';
  6696. },
  6697. '13': function _(n) {
  6698. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  6699. if (n != 1 && isBetween(n % 10, 0, 1) || isBetween(n % 10, 5, 9) || isBetween(n % 100, 12, 14)) return 'many';
  6700. if (n == 1) return 'one';
  6701. return 'other';
  6702. },
  6703. '14': function _(n) {
  6704. if (isBetween(n % 100, 3, 4)) return 'few';
  6705. if (n % 100 == 2) return 'two';
  6706. if (n % 100 == 1) return 'one';
  6707. return 'other';
  6708. },
  6709. '15': function _(n) {
  6710. if (n === 0 || isBetween(n % 100, 2, 10)) return 'few';
  6711. if (isBetween(n % 100, 11, 19)) return 'many';
  6712. if (n == 1) return 'one';
  6713. return 'other';
  6714. },
  6715. '16': function _(n) {
  6716. if (n % 10 == 1 && n != 11) return 'one';
  6717. return 'other';
  6718. },
  6719. '17': function _(n) {
  6720. if (n == 3) return 'few';
  6721. if (n === 0) return 'zero';
  6722. if (n == 6) return 'many';
  6723. if (n == 2) return 'two';
  6724. if (n == 1) return 'one';
  6725. return 'other';
  6726. },
  6727. '18': function _(n) {
  6728. if (n === 0) return 'zero';
  6729. if (isBetween(n, 0, 2) && n !== 0 && n != 2) return 'one';
  6730. return 'other';
  6731. },
  6732. '19': function _(n) {
  6733. if (isBetween(n, 2, 10)) return 'few';
  6734. if (isBetween(n, 0, 1)) return 'one';
  6735. return 'other';
  6736. },
  6737. '20': function _(n) {
  6738. 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';
  6739. if (n % 1000000 === 0 && n !== 0) return 'many';
  6740. if (n % 10 == 2 && !isIn(n % 100, [12, 72, 92])) return 'two';
  6741. if (n % 10 == 1 && !isIn(n % 100, [11, 71, 91])) return 'one';
  6742. return 'other';
  6743. },
  6744. '21': function _(n) {
  6745. if (n === 0) return 'zero';
  6746. if (n == 1) return 'one';
  6747. return 'other';
  6748. },
  6749. '22': function _(n) {
  6750. if (isBetween(n, 0, 1) || isBetween(n, 11, 99)) return 'one';
  6751. return 'other';
  6752. },
  6753. '23': function _(n) {
  6754. if (isBetween(n % 10, 1, 2) || n % 20 === 0) return 'one';
  6755. return 'other';
  6756. },
  6757. '24': function _(n) {
  6758. if (isBetween(n, 3, 10) || isBetween(n, 13, 19)) return 'few';
  6759. if (isIn(n, [2, 12])) return 'two';
  6760. if (isIn(n, [1, 11])) return 'one';
  6761. return 'other';
  6762. }
  6763. };
  6764. var index = locales2rules[lang.replace(/-.*$/, '')];
  6765. if (!(index in pluralRules)) {
  6766. console.warn('plural form unknown for [' + lang + ']');
  6767. return function () {
  6768. return 'other';
  6769. };
  6770. }
  6771. return pluralRules[index];
  6772. }
  6773. gMacros.plural = function (str, param, key, prop) {
  6774. var n = parseFloat(param);
  6775. if (isNaN(n)) return str;
  6776. if (prop != gTextProp) return str;
  6777. if (!gMacros._pluralRules) {
  6778. gMacros._pluralRules = getPluralRules(gLanguage);
  6779. }
  6780. var index = '[' + gMacros._pluralRules(n) + ']';
  6781. if (n === 0 && key + '[zero]' in gL10nData) {
  6782. str = gL10nData[key + '[zero]'][prop];
  6783. } else if (n == 1 && key + '[one]' in gL10nData) {
  6784. str = gL10nData[key + '[one]'][prop];
  6785. } else if (n == 2 && key + '[two]' in gL10nData) {
  6786. str = gL10nData[key + '[two]'][prop];
  6787. } else if (key + index in gL10nData) {
  6788. str = gL10nData[key + index][prop];
  6789. } else if (key + '[other]' in gL10nData) {
  6790. str = gL10nData[key + '[other]'][prop];
  6791. }
  6792. return str;
  6793. };
  6794. function getL10nData(key, args, fallback) {
  6795. var data = gL10nData[key];
  6796. if (!data) {
  6797. console.warn('#' + key + ' is undefined.');
  6798. if (!fallback) {
  6799. return null;
  6800. }
  6801. data = fallback;
  6802. }
  6803. var rv = {};
  6804. for (var prop in data) {
  6805. var str = data[prop];
  6806. str = substIndexes(str, args, key, prop);
  6807. str = substArguments(str, args, key);
  6808. rv[prop] = str;
  6809. }
  6810. return rv;
  6811. }
  6812. function substIndexes(str, args, key, prop) {
  6813. var reIndex = /\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/;
  6814. var reMatch = reIndex.exec(str);
  6815. if (!reMatch || !reMatch.length) return str;
  6816. var macroName = reMatch[1];
  6817. var paramName = reMatch[2];
  6818. var param;
  6819. if (args && paramName in args) {
  6820. param = args[paramName];
  6821. } else if (paramName in gL10nData) {
  6822. param = gL10nData[paramName];
  6823. }
  6824. if (macroName in gMacros) {
  6825. var macro = gMacros[macroName];
  6826. str = macro(str, param, key, prop);
  6827. }
  6828. return str;
  6829. }
  6830. function substArguments(str, args, key) {
  6831. var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
  6832. return str.replace(reArgs, function (matched_text, arg) {
  6833. if (args && arg in args) {
  6834. return args[arg];
  6835. }
  6836. if (arg in gL10nData) {
  6837. return gL10nData[arg];
  6838. }
  6839. console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');
  6840. return matched_text;
  6841. });
  6842. }
  6843. function translateElement(element) {
  6844. var l10n = getL10nAttributes(element);
  6845. if (!l10n.id) return;
  6846. var data = getL10nData(l10n.id, l10n.args);
  6847. if (!data) {
  6848. console.warn('#' + l10n.id + ' is undefined.');
  6849. return;
  6850. }
  6851. if (data[gTextProp]) {
  6852. if (getChildElementCount(element) === 0) {
  6853. element[gTextProp] = data[gTextProp];
  6854. } else {
  6855. var children = element.childNodes;
  6856. var found = false;
  6857. for (var i = 0, l = children.length; i < l; i++) {
  6858. if (children[i].nodeType === 3 && /\S/.test(children[i].nodeValue)) {
  6859. if (found) {
  6860. children[i].nodeValue = '';
  6861. } else {
  6862. children[i].nodeValue = data[gTextProp];
  6863. found = true;
  6864. }
  6865. }
  6866. }
  6867. if (!found) {
  6868. var textNode = document.createTextNode(data[gTextProp]);
  6869. element.insertBefore(textNode, element.firstChild);
  6870. }
  6871. }
  6872. delete data[gTextProp];
  6873. }
  6874. for (var k in data) {
  6875. element[k] = data[k];
  6876. }
  6877. }
  6878. function getChildElementCount(element) {
  6879. if (element.children) {
  6880. return element.children.length;
  6881. }
  6882. if (typeof element.childElementCount !== 'undefined') {
  6883. return element.childElementCount;
  6884. }
  6885. var count = 0;
  6886. for (var i = 0; i < element.childNodes.length; i++) {
  6887. count += element.nodeType === 1 ? 1 : 0;
  6888. }
  6889. return count;
  6890. }
  6891. function translateFragment(element) {
  6892. element = element || document.documentElement;
  6893. var children = getTranslatableChildren(element);
  6894. var elementCount = children.length;
  6895. for (var i = 0; i < elementCount; i++) {
  6896. translateElement(children[i]);
  6897. }
  6898. translateElement(element);
  6899. }
  6900. return {
  6901. get: function get(key, args, fallbackString) {
  6902. var index = key.lastIndexOf('.');
  6903. var prop = gTextProp;
  6904. if (index > 0) {
  6905. prop = key.substring(index + 1);
  6906. key = key.substring(0, index);
  6907. }
  6908. var fallback;
  6909. if (fallbackString) {
  6910. fallback = {};
  6911. fallback[prop] = fallbackString;
  6912. }
  6913. var data = getL10nData(key, args, fallback);
  6914. if (data && prop in data) {
  6915. return data[prop];
  6916. }
  6917. return '{{' + key + '}}';
  6918. },
  6919. getData: function getData() {
  6920. return gL10nData;
  6921. },
  6922. getText: function getText() {
  6923. return gTextData;
  6924. },
  6925. getLanguage: function getLanguage() {
  6926. return gLanguage;
  6927. },
  6928. setLanguage: function setLanguage(lang, callback) {
  6929. loadLocale(lang, function () {
  6930. if (callback) callback();
  6931. });
  6932. },
  6933. getDirection: function getDirection() {
  6934. var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
  6935. var shortCode = gLanguage.split('-', 1)[0];
  6936. return rtlList.indexOf(shortCode) >= 0 ? 'rtl' : 'ltr';
  6937. },
  6938. translate: translateFragment,
  6939. getReadyState: function getReadyState() {
  6940. return gReadyState;
  6941. },
  6942. ready: function ready(callback) {
  6943. if (!callback) {
  6944. return;
  6945. } else if (gReadyState == 'complete' || gReadyState == 'interactive') {
  6946. window.setTimeout(function () {
  6947. callback();
  6948. });
  6949. } else if (document.addEventListener) {
  6950. document.addEventListener('localized', function once() {
  6951. document.removeEventListener('localized', once);
  6952. callback();
  6953. });
  6954. }
  6955. }
  6956. };
  6957. }(window, document);
  6958. /***/ }),
  6959. /* 22 */
  6960. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6961. Object.defineProperty(exports, "__esModule", ({
  6962. value: true
  6963. }));
  6964. exports.PDFFindController = exports.FindState = void 0;
  6965. var _ui_utils = __w_pdfjs_require__(8);
  6966. var _pdfjsLib = __w_pdfjs_require__(5);
  6967. var _pdf_find_utils = __w_pdfjs_require__(23);
  6968. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  6969. 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."); }
  6970. 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; }
  6971. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  6972. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6973. 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); } }
  6974. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  6975. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  6976. 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."); }
  6977. 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); }
  6978. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  6979. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  6980. 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; }
  6981. var FindState = {
  6982. FOUND: 0,
  6983. NOT_FOUND: 1,
  6984. WRAPPED: 2,
  6985. PENDING: 3
  6986. };
  6987. exports.FindState = FindState;
  6988. var FIND_TIMEOUT = 250;
  6989. var MATCH_SCROLL_OFFSET_TOP = -50;
  6990. var MATCH_SCROLL_OFFSET_LEFT = -400;
  6991. var CHARACTERS_TO_NORMALIZE = {
  6992. "\u2010": "-",
  6993. "\u2018": "'",
  6994. "\u2019": "'",
  6995. "\u201A": "'",
  6996. "\u201B": "'",
  6997. "\u201C": '"',
  6998. "\u201D": '"',
  6999. "\u201E": '"',
  7000. "\u201F": '"',
  7001. "\xBC": "1/4",
  7002. "\xBD": "1/2",
  7003. "\xBE": "3/4"
  7004. };
  7005. var DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]);
  7006. var DIACRITICS_EXCEPTION_STR = _toConsumableArray(DIACRITICS_EXCEPTION.values()).map(function (x) {
  7007. return String.fromCharCode(x);
  7008. }).join("");
  7009. var DIACRITICS_REG_EXP = /(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])+/g;
  7010. var SPECIAL_CHARS_REG_EXP = /([\$\(-\+\.\?\[-\^\{-\}])|((?:[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]))|([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+)|((?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]))|((?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]))/g;
  7011. var NOT_DIACRITIC_FROM_END_REG_EXP = /((?:(?![\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])[\s\S]))(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])*$/;
  7012. var NOT_DIACRITIC_FROM_START_REG_EXP = /^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])*((?:(?![\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])[\s\S]))/;
  7013. var normalizationRegex = null;
  7014. function normalize(text) {
  7015. if (!normalizationRegex) {
  7016. var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");
  7017. normalizationRegex = new RegExp("([".concat(replace, "])|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(\\n)"), "gum");
  7018. }
  7019. var rawDiacriticsPositions = [];
  7020. var m;
  7021. while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {
  7022. rawDiacriticsPositions.push([m[0].length, m.index]);
  7023. }
  7024. var normalized = text.normalize("NFD");
  7025. var positions = [[0, 0]];
  7026. var k = 0;
  7027. var shift = 0;
  7028. var shiftOrigin = 0;
  7029. var eol = 0;
  7030. var hasDiacritics = false;
  7031. normalized = normalized.replace(normalizationRegex, function (match, p1, p2, p3, p4, i) {
  7032. i -= shiftOrigin;
  7033. if (p1) {
  7034. var replacement = CHARACTERS_TO_NORMALIZE[match];
  7035. var jj = replacement.length;
  7036. for (var j = 1; j < jj; j++) {
  7037. positions.push([i - shift + j, shift - j]);
  7038. }
  7039. shift -= jj - 1;
  7040. return replacement;
  7041. }
  7042. if (p2) {
  7043. var _rawDiacriticsPositio;
  7044. var hasTrailingDashEOL = p2.endsWith("\n");
  7045. var len = hasTrailingDashEOL ? p2.length - 2 : p2.length;
  7046. hasDiacritics = true;
  7047. var _jj = len;
  7048. if (i + eol === ((_rawDiacriticsPositio = rawDiacriticsPositions[k]) === null || _rawDiacriticsPositio === void 0 ? void 0 : _rawDiacriticsPositio[1])) {
  7049. _jj -= rawDiacriticsPositions[k][0];
  7050. ++k;
  7051. }
  7052. for (var _j = 1; _j < _jj + 1; _j++) {
  7053. positions.push([i - 1 - shift + _j, shift - _j]);
  7054. }
  7055. shift -= _jj;
  7056. shiftOrigin += _jj;
  7057. if (hasTrailingDashEOL) {
  7058. i += len - 1;
  7059. positions.push([i - shift + 1, 1 + shift]);
  7060. shift += 1;
  7061. shiftOrigin += 1;
  7062. eol += 1;
  7063. return p2.slice(0, len);
  7064. }
  7065. return p2;
  7066. }
  7067. if (p3) {
  7068. positions.push([i - shift + 1, 1 + shift]);
  7069. shift += 1;
  7070. shiftOrigin += 1;
  7071. eol += 1;
  7072. return p3.charAt(0);
  7073. }
  7074. positions.push([i - shift + 1, shift - 1]);
  7075. shift -= 1;
  7076. shiftOrigin += 1;
  7077. eol += 1;
  7078. return " ";
  7079. });
  7080. positions.push([normalized.length, shift]);
  7081. return [normalized, positions, hasDiacritics];
  7082. }
  7083. function getOriginalIndex(diffs, pos, len) {
  7084. if (!diffs) {
  7085. return [pos, len];
  7086. }
  7087. var start = pos;
  7088. var end = pos + len;
  7089. var i = (0, _ui_utils.binarySearchFirstItem)(diffs, function (x) {
  7090. return x[0] >= start;
  7091. });
  7092. if (diffs[i][0] > start) {
  7093. --i;
  7094. }
  7095. var j = (0, _ui_utils.binarySearchFirstItem)(diffs, function (x) {
  7096. return x[0] >= end;
  7097. }, i);
  7098. if (diffs[j][0] > end) {
  7099. --j;
  7100. }
  7101. return [start + diffs[i][1], len + diffs[j][1] - diffs[i][1]];
  7102. }
  7103. var PDFFindController = /*#__PURE__*/function () {
  7104. function PDFFindController(_ref) {
  7105. var _this = this;
  7106. var linkService = _ref.linkService,
  7107. eventBus = _ref.eventBus;
  7108. _classCallCheck(this, PDFFindController);
  7109. this._linkService = linkService;
  7110. this._eventBus = eventBus;
  7111. this._reset();
  7112. eventBus._on("find", this._onFind.bind(this));
  7113. eventBus._on("findbarclose", this._onFindBarClose.bind(this));
  7114. this.executeCommand = function (cmd, state) {
  7115. console.error("Deprecated method `PDFFindController.executeCommand` called, " + 'please dispatch a "find"-event using the EventBus instead.');
  7116. var eventState = Object.assign(Object.create(null), state, {
  7117. type: cmd.substring("find".length)
  7118. });
  7119. _this._onFind(eventState);
  7120. };
  7121. }
  7122. _createClass(PDFFindController, [{
  7123. key: "highlightMatches",
  7124. get: function get() {
  7125. return this._highlightMatches;
  7126. }
  7127. }, {
  7128. key: "pageMatches",
  7129. get: function get() {
  7130. return this._pageMatches;
  7131. }
  7132. }, {
  7133. key: "pageMatchesLength",
  7134. get: function get() {
  7135. return this._pageMatchesLength;
  7136. }
  7137. }, {
  7138. key: "selected",
  7139. get: function get() {
  7140. return this._selected;
  7141. }
  7142. }, {
  7143. key: "state",
  7144. get: function get() {
  7145. return this._state;
  7146. }
  7147. }, {
  7148. key: "setDocument",
  7149. value: function setDocument(pdfDocument) {
  7150. if (this._pdfDocument) {
  7151. this._reset();
  7152. }
  7153. if (!pdfDocument) {
  7154. return;
  7155. }
  7156. this._pdfDocument = pdfDocument;
  7157. this._firstPageCapability.resolve();
  7158. }
  7159. }, {
  7160. key: "_onFind",
  7161. value: function _onFind(state) {
  7162. var _this2 = this;
  7163. if (!state) {
  7164. return;
  7165. }
  7166. var pdfDocument = this._pdfDocument;
  7167. var type = state.type;
  7168. if (this._state === null || this._shouldDirtyMatch(state)) {
  7169. this._dirtyMatch = true;
  7170. }
  7171. this._state = state;
  7172. if (type !== "highlightallchange") {
  7173. this._updateUIState(FindState.PENDING);
  7174. }
  7175. this._firstPageCapability.promise.then(function () {
  7176. if (!_this2._pdfDocument || pdfDocument && _this2._pdfDocument !== pdfDocument) {
  7177. return;
  7178. }
  7179. _this2._extractText();
  7180. var findbarClosed = !_this2._highlightMatches;
  7181. var pendingTimeout = !!_this2._findTimeout;
  7182. if (_this2._findTimeout) {
  7183. clearTimeout(_this2._findTimeout);
  7184. _this2._findTimeout = null;
  7185. }
  7186. if (!type) {
  7187. _this2._findTimeout = setTimeout(function () {
  7188. _this2._nextMatch();
  7189. _this2._findTimeout = null;
  7190. }, FIND_TIMEOUT);
  7191. } else if (_this2._dirtyMatch) {
  7192. _this2._nextMatch();
  7193. } else if (type === "again") {
  7194. _this2._nextMatch();
  7195. if (findbarClosed && _this2._state.highlightAll) {
  7196. _this2._updateAllPages();
  7197. }
  7198. } else if (type === "highlightallchange") {
  7199. if (pendingTimeout) {
  7200. _this2._nextMatch();
  7201. } else {
  7202. _this2._highlightMatches = true;
  7203. }
  7204. _this2._updateAllPages();
  7205. } else {
  7206. _this2._nextMatch();
  7207. }
  7208. });
  7209. }
  7210. }, {
  7211. key: "scrollMatchIntoView",
  7212. value: function scrollMatchIntoView(_ref2) {
  7213. var _ref2$element = _ref2.element,
  7214. element = _ref2$element === void 0 ? null : _ref2$element,
  7215. _ref2$selectedLeft = _ref2.selectedLeft,
  7216. selectedLeft = _ref2$selectedLeft === void 0 ? 0 : _ref2$selectedLeft,
  7217. _ref2$pageIndex = _ref2.pageIndex,
  7218. pageIndex = _ref2$pageIndex === void 0 ? -1 : _ref2$pageIndex,
  7219. _ref2$matchIndex = _ref2.matchIndex,
  7220. matchIndex = _ref2$matchIndex === void 0 ? -1 : _ref2$matchIndex;
  7221. if (!this._scrollMatches || !element) {
  7222. return;
  7223. } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {
  7224. return;
  7225. } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {
  7226. return;
  7227. }
  7228. this._scrollMatches = false;
  7229. var spot = {
  7230. top: MATCH_SCROLL_OFFSET_TOP,
  7231. left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT
  7232. };
  7233. (0, _ui_utils.scrollIntoView)(element, spot, true);
  7234. }
  7235. }, {
  7236. key: "_reset",
  7237. value: function _reset() {
  7238. this._highlightMatches = false;
  7239. this._scrollMatches = false;
  7240. this._pdfDocument = null;
  7241. this._pageMatches = [];
  7242. this._pageMatchesLength = [];
  7243. this._state = null;
  7244. this._selected = {
  7245. pageIdx: -1,
  7246. matchIdx: -1
  7247. };
  7248. this._offset = {
  7249. pageIdx: null,
  7250. matchIdx: null,
  7251. wrapped: false
  7252. };
  7253. this._extractTextPromises = [];
  7254. this._pageContents = [];
  7255. this._pageDiffs = [];
  7256. this._hasDiacritics = [];
  7257. this._matchesCountTotal = 0;
  7258. this._pagesToSearch = null;
  7259. this._pendingFindMatches = new Set();
  7260. this._resumePageIdx = null;
  7261. this._dirtyMatch = false;
  7262. clearTimeout(this._findTimeout);
  7263. this._findTimeout = null;
  7264. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  7265. }
  7266. }, {
  7267. key: "_query",
  7268. get: function get() {
  7269. if (this._state.query !== this._rawQuery) {
  7270. this._rawQuery = this._state.query;
  7271. var _normalize = normalize(this._state.query);
  7272. var _normalize2 = _slicedToArray(_normalize, 1);
  7273. this._normalizedQuery = _normalize2[0];
  7274. }
  7275. return this._normalizedQuery;
  7276. }
  7277. }, {
  7278. key: "_shouldDirtyMatch",
  7279. value: function _shouldDirtyMatch(state) {
  7280. if (state.query !== this._state.query) {
  7281. return true;
  7282. }
  7283. switch (state.type) {
  7284. case "again":
  7285. var pageNumber = this._selected.pageIdx + 1;
  7286. var linkService = this._linkService;
  7287. if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) {
  7288. return true;
  7289. }
  7290. return false;
  7291. case "highlightallchange":
  7292. return false;
  7293. }
  7294. return true;
  7295. }
  7296. }, {
  7297. key: "_isEntireWord",
  7298. value: function _isEntireWord(content, startIdx, length) {
  7299. var match = content.slice(0, startIdx).match(NOT_DIACRITIC_FROM_END_REG_EXP);
  7300. if (match) {
  7301. var first = content.charCodeAt(startIdx);
  7302. var limit = match[1].charCodeAt(0);
  7303. if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) {
  7304. return false;
  7305. }
  7306. }
  7307. match = content.slice(startIdx + length).match(NOT_DIACRITIC_FROM_START_REG_EXP);
  7308. if (match) {
  7309. var last = content.charCodeAt(startIdx + length - 1);
  7310. var _limit = match[1].charCodeAt(0);
  7311. if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(_limit)) {
  7312. return false;
  7313. }
  7314. }
  7315. return true;
  7316. }
  7317. }, {
  7318. key: "_calculateRegExpMatch",
  7319. value: function _calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {
  7320. var matches = [],
  7321. matchesLength = [];
  7322. var diffs = this._pageDiffs[pageIndex];
  7323. var match;
  7324. while ((match = query.exec(pageContent)) !== null) {
  7325. if (entireWord && !this._isEntireWord(pageContent, match.index, match[0].length)) {
  7326. continue;
  7327. }
  7328. var _getOriginalIndex = getOriginalIndex(diffs, match.index, match[0].length),
  7329. _getOriginalIndex2 = _slicedToArray(_getOriginalIndex, 2),
  7330. matchPos = _getOriginalIndex2[0],
  7331. matchLen = _getOriginalIndex2[1];
  7332. if (matchLen) {
  7333. matches.push(matchPos);
  7334. matchesLength.push(matchLen);
  7335. }
  7336. }
  7337. this._pageMatches[pageIndex] = matches;
  7338. this._pageMatchesLength[pageIndex] = matchesLength;
  7339. }
  7340. }, {
  7341. key: "_convertToRegExpString",
  7342. value: function _convertToRegExpString(query, hasDiacritics) {
  7343. var matchDiacritics = this._state.matchDiacritics;
  7344. var isUnicode = false;
  7345. query = query.replace(SPECIAL_CHARS_REG_EXP, function (match, p1, p2, p3, p4, p5) {
  7346. if (p1) {
  7347. return "[ ]*\\".concat(p1, "[ ]*");
  7348. }
  7349. if (p2) {
  7350. return "[ ]*".concat(p2, "[ ]*");
  7351. }
  7352. if (p3) {
  7353. return "[ ]+";
  7354. }
  7355. if (matchDiacritics) {
  7356. return p4 || p5;
  7357. }
  7358. if (p4) {
  7359. return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : "";
  7360. }
  7361. if (hasDiacritics) {
  7362. isUnicode = true;
  7363. return "".concat(p5, "\\p{M}*");
  7364. }
  7365. return p5;
  7366. });
  7367. var trailingSpaces = "[ ]*";
  7368. if (query.endsWith(trailingSpaces)) {
  7369. query = query.slice(0, query.length - trailingSpaces.length);
  7370. }
  7371. if (matchDiacritics) {
  7372. if (hasDiacritics) {
  7373. isUnicode = true;
  7374. query = "".concat(query, "(?=[").concat(DIACRITICS_EXCEPTION_STR, "]|[^\\p{M}]|$)");
  7375. }
  7376. }
  7377. return [isUnicode, query];
  7378. }
  7379. }, {
  7380. key: "_calculateMatch",
  7381. value: function _calculateMatch(pageIndex) {
  7382. var _this3 = this;
  7383. var query = this._query;
  7384. if (query.length === 0) {
  7385. return;
  7386. }
  7387. var _this$_state = this._state,
  7388. caseSensitive = _this$_state.caseSensitive,
  7389. entireWord = _this$_state.entireWord,
  7390. phraseSearch = _this$_state.phraseSearch;
  7391. var pageContent = this._pageContents[pageIndex];
  7392. var hasDiacritics = this._hasDiacritics[pageIndex];
  7393. var isUnicode = false;
  7394. if (phraseSearch) {
  7395. var _this$_convertToRegEx = this._convertToRegExpString(query, hasDiacritics);
  7396. var _this$_convertToRegEx2 = _slicedToArray(_this$_convertToRegEx, 2);
  7397. isUnicode = _this$_convertToRegEx2[0];
  7398. query = _this$_convertToRegEx2[1];
  7399. } else {
  7400. var match = query.match(/\S+/g);
  7401. if (match) {
  7402. query = match.sort().reverse().map(function (q) {
  7403. var _this3$_convertToRegE = _this3._convertToRegExpString(q, hasDiacritics),
  7404. _this3$_convertToRegE2 = _slicedToArray(_this3$_convertToRegE, 2),
  7405. isUnicodePart = _this3$_convertToRegE2[0],
  7406. queryPart = _this3$_convertToRegE2[1];
  7407. isUnicode || (isUnicode = isUnicodePart);
  7408. return "(".concat(queryPart, ")");
  7409. }).join("|");
  7410. }
  7411. }
  7412. var flags = "g".concat(isUnicode ? "u" : "").concat(caseSensitive ? "" : "i");
  7413. query = new RegExp(query, flags);
  7414. this._calculateRegExpMatch(query, entireWord, pageIndex, pageContent);
  7415. if (this._state.highlightAll) {
  7416. this._updatePage(pageIndex);
  7417. }
  7418. if (this._resumePageIdx === pageIndex) {
  7419. this._resumePageIdx = null;
  7420. this._nextPageMatch();
  7421. }
  7422. var pageMatchesCount = this._pageMatches[pageIndex].length;
  7423. if (pageMatchesCount > 0) {
  7424. this._matchesCountTotal += pageMatchesCount;
  7425. this._updateUIResultsCount();
  7426. }
  7427. }
  7428. }, {
  7429. key: "_extractText",
  7430. value: function _extractText() {
  7431. var _this4 = this;
  7432. if (this._extractTextPromises.length > 0) {
  7433. return;
  7434. }
  7435. var promise = Promise.resolve();
  7436. var _loop = function _loop(i, ii) {
  7437. var extractTextCapability = (0, _pdfjsLib.createPromiseCapability)();
  7438. _this4._extractTextPromises[i] = extractTextCapability.promise;
  7439. promise = promise.then(function () {
  7440. return _this4._pdfDocument.getPage(i + 1).then(function (pdfPage) {
  7441. return pdfPage.getTextContent();
  7442. }).then(function (textContent) {
  7443. var textItems = textContent.items;
  7444. var strBuf = [];
  7445. for (var j = 0, jj = textItems.length; j < jj; j++) {
  7446. strBuf.push(textItems[j].str);
  7447. if (textItems[j].hasEOL) {
  7448. strBuf.push("\n");
  7449. }
  7450. }
  7451. var _normalize3 = normalize(strBuf.join(""));
  7452. var _normalize4 = _slicedToArray(_normalize3, 3);
  7453. _this4._pageContents[i] = _normalize4[0];
  7454. _this4._pageDiffs[i] = _normalize4[1];
  7455. _this4._hasDiacritics[i] = _normalize4[2];
  7456. extractTextCapability.resolve(i);
  7457. }, function (reason) {
  7458. console.error("Unable to get text content for page ".concat(i + 1), reason);
  7459. _this4._pageContents[i] = "";
  7460. _this4._pageDiffs[i] = null;
  7461. _this4._hasDiacritics[i] = false;
  7462. extractTextCapability.resolve(i);
  7463. });
  7464. });
  7465. };
  7466. for (var i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
  7467. _loop(i, ii);
  7468. }
  7469. }
  7470. }, {
  7471. key: "_updatePage",
  7472. value: function _updatePage(index) {
  7473. if (this._scrollMatches && this._selected.pageIdx === index) {
  7474. this._linkService.page = index + 1;
  7475. }
  7476. this._eventBus.dispatch("updatetextlayermatches", {
  7477. source: this,
  7478. pageIndex: index
  7479. });
  7480. }
  7481. }, {
  7482. key: "_updateAllPages",
  7483. value: function _updateAllPages() {
  7484. this._eventBus.dispatch("updatetextlayermatches", {
  7485. source: this,
  7486. pageIndex: -1
  7487. });
  7488. }
  7489. }, {
  7490. key: "_nextMatch",
  7491. value: function _nextMatch() {
  7492. var _this5 = this;
  7493. var previous = this._state.findPrevious;
  7494. var currentPageIndex = this._linkService.page - 1;
  7495. var numPages = this._linkService.pagesCount;
  7496. this._highlightMatches = true;
  7497. if (this._dirtyMatch) {
  7498. this._dirtyMatch = false;
  7499. this._selected.pageIdx = this._selected.matchIdx = -1;
  7500. this._offset.pageIdx = currentPageIndex;
  7501. this._offset.matchIdx = null;
  7502. this._offset.wrapped = false;
  7503. this._resumePageIdx = null;
  7504. this._pageMatches.length = 0;
  7505. this._pageMatchesLength.length = 0;
  7506. this._matchesCountTotal = 0;
  7507. this._updateAllPages();
  7508. for (var i = 0; i < numPages; i++) {
  7509. if (this._pendingFindMatches.has(i)) {
  7510. continue;
  7511. }
  7512. this._pendingFindMatches.add(i);
  7513. this._extractTextPromises[i].then(function (pageIdx) {
  7514. _this5._pendingFindMatches["delete"](pageIdx);
  7515. _this5._calculateMatch(pageIdx);
  7516. });
  7517. }
  7518. }
  7519. if (this._query === "") {
  7520. this._updateUIState(FindState.FOUND);
  7521. return;
  7522. }
  7523. if (this._resumePageIdx) {
  7524. return;
  7525. }
  7526. var offset = this._offset;
  7527. this._pagesToSearch = numPages;
  7528. if (offset.matchIdx !== null) {
  7529. var numPageMatches = this._pageMatches[offset.pageIdx].length;
  7530. if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
  7531. offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
  7532. this._updateMatch(true);
  7533. return;
  7534. }
  7535. this._advanceOffsetPage(previous);
  7536. }
  7537. this._nextPageMatch();
  7538. }
  7539. }, {
  7540. key: "_matchesReady",
  7541. value: function _matchesReady(matches) {
  7542. var offset = this._offset;
  7543. var numMatches = matches.length;
  7544. var previous = this._state.findPrevious;
  7545. if (numMatches) {
  7546. offset.matchIdx = previous ? numMatches - 1 : 0;
  7547. this._updateMatch(true);
  7548. return true;
  7549. }
  7550. this._advanceOffsetPage(previous);
  7551. if (offset.wrapped) {
  7552. offset.matchIdx = null;
  7553. if (this._pagesToSearch < 0) {
  7554. this._updateMatch(false);
  7555. return true;
  7556. }
  7557. }
  7558. return false;
  7559. }
  7560. }, {
  7561. key: "_nextPageMatch",
  7562. value: function _nextPageMatch() {
  7563. if (this._resumePageIdx !== null) {
  7564. console.error("There can only be one pending page.");
  7565. }
  7566. var matches = null;
  7567. do {
  7568. var pageIdx = this._offset.pageIdx;
  7569. matches = this._pageMatches[pageIdx];
  7570. if (!matches) {
  7571. this._resumePageIdx = pageIdx;
  7572. break;
  7573. }
  7574. } while (!this._matchesReady(matches));
  7575. }
  7576. }, {
  7577. key: "_advanceOffsetPage",
  7578. value: function _advanceOffsetPage(previous) {
  7579. var offset = this._offset;
  7580. var numPages = this._linkService.pagesCount;
  7581. offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
  7582. offset.matchIdx = null;
  7583. this._pagesToSearch--;
  7584. if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
  7585. offset.pageIdx = previous ? numPages - 1 : 0;
  7586. offset.wrapped = true;
  7587. }
  7588. }
  7589. }, {
  7590. key: "_updateMatch",
  7591. value: function _updateMatch() {
  7592. var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7593. var state = FindState.NOT_FOUND;
  7594. var wrapped = this._offset.wrapped;
  7595. this._offset.wrapped = false;
  7596. if (found) {
  7597. var previousPage = this._selected.pageIdx;
  7598. this._selected.pageIdx = this._offset.pageIdx;
  7599. this._selected.matchIdx = this._offset.matchIdx;
  7600. state = wrapped ? FindState.WRAPPED : FindState.FOUND;
  7601. if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
  7602. this._updatePage(previousPage);
  7603. }
  7604. }
  7605. this._updateUIState(state, this._state.findPrevious);
  7606. if (this._selected.pageIdx !== -1) {
  7607. this._scrollMatches = true;
  7608. this._updatePage(this._selected.pageIdx);
  7609. }
  7610. }
  7611. }, {
  7612. key: "_onFindBarClose",
  7613. value: function _onFindBarClose(evt) {
  7614. var _this6 = this;
  7615. var pdfDocument = this._pdfDocument;
  7616. this._firstPageCapability.promise.then(function () {
  7617. if (!_this6._pdfDocument || pdfDocument && _this6._pdfDocument !== pdfDocument) {
  7618. return;
  7619. }
  7620. if (_this6._findTimeout) {
  7621. clearTimeout(_this6._findTimeout);
  7622. _this6._findTimeout = null;
  7623. }
  7624. if (_this6._resumePageIdx) {
  7625. _this6._resumePageIdx = null;
  7626. _this6._dirtyMatch = true;
  7627. }
  7628. _this6._updateUIState(FindState.FOUND);
  7629. _this6._highlightMatches = false;
  7630. _this6._updateAllPages();
  7631. });
  7632. }
  7633. }, {
  7634. key: "_requestMatchesCount",
  7635. value: function _requestMatchesCount() {
  7636. var _this$_selected = this._selected,
  7637. pageIdx = _this$_selected.pageIdx,
  7638. matchIdx = _this$_selected.matchIdx;
  7639. var current = 0,
  7640. total = this._matchesCountTotal;
  7641. if (matchIdx !== -1) {
  7642. for (var i = 0; i < pageIdx; i++) {
  7643. var _this$_pageMatches$i;
  7644. current += ((_this$_pageMatches$i = this._pageMatches[i]) === null || _this$_pageMatches$i === void 0 ? void 0 : _this$_pageMatches$i.length) || 0;
  7645. }
  7646. current += matchIdx + 1;
  7647. }
  7648. if (current < 1 || current > total) {
  7649. current = total = 0;
  7650. }
  7651. return {
  7652. current: current,
  7653. total: total
  7654. };
  7655. }
  7656. }, {
  7657. key: "_updateUIResultsCount",
  7658. value: function _updateUIResultsCount() {
  7659. this._eventBus.dispatch("updatefindmatchescount", {
  7660. source: this,
  7661. matchesCount: this._requestMatchesCount()
  7662. });
  7663. }
  7664. }, {
  7665. key: "_updateUIState",
  7666. value: function _updateUIState(state) {
  7667. var _this$_state$query, _this$_state2;
  7668. var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7669. this._eventBus.dispatch("updatefindcontrolstate", {
  7670. source: this,
  7671. state: state,
  7672. previous: previous,
  7673. matchesCount: this._requestMatchesCount(),
  7674. 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
  7675. });
  7676. }
  7677. }]);
  7678. return PDFFindController;
  7679. }();
  7680. exports.PDFFindController = PDFFindController;
  7681. /***/ }),
  7682. /* 23 */
  7683. /***/ ((__unused_webpack_module, exports) => {
  7684. Object.defineProperty(exports, "__esModule", ({
  7685. value: true
  7686. }));
  7687. exports.CharacterType = void 0;
  7688. exports.getCharacterType = getCharacterType;
  7689. var CharacterType = {
  7690. SPACE: 0,
  7691. ALPHA_LETTER: 1,
  7692. PUNCT: 2,
  7693. HAN_LETTER: 3,
  7694. KATAKANA_LETTER: 4,
  7695. HIRAGANA_LETTER: 5,
  7696. HALFWIDTH_KATAKANA_LETTER: 6,
  7697. THAI_LETTER: 7
  7698. };
  7699. exports.CharacterType = CharacterType;
  7700. function isAlphabeticalScript(charCode) {
  7701. return charCode < 0x2e80;
  7702. }
  7703. function isAscii(charCode) {
  7704. return (charCode & 0xff80) === 0;
  7705. }
  7706. function isAsciiAlpha(charCode) {
  7707. return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a;
  7708. }
  7709. function isAsciiDigit(charCode) {
  7710. return charCode >= 0x30 && charCode <= 0x39;
  7711. }
  7712. function isAsciiSpace(charCode) {
  7713. return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a;
  7714. }
  7715. function isHan(charCode) {
  7716. return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff;
  7717. }
  7718. function isKatakana(charCode) {
  7719. return charCode >= 0x30a0 && charCode <= 0x30ff;
  7720. }
  7721. function isHiragana(charCode) {
  7722. return charCode >= 0x3040 && charCode <= 0x309f;
  7723. }
  7724. function isHalfwidthKatakana(charCode) {
  7725. return charCode >= 0xff60 && charCode <= 0xff9f;
  7726. }
  7727. function isThai(charCode) {
  7728. return (charCode & 0xff80) === 0x0e00;
  7729. }
  7730. function getCharacterType(charCode) {
  7731. if (isAlphabeticalScript(charCode)) {
  7732. if (isAscii(charCode)) {
  7733. if (isAsciiSpace(charCode)) {
  7734. return CharacterType.SPACE;
  7735. } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) {
  7736. return CharacterType.ALPHA_LETTER;
  7737. }
  7738. return CharacterType.PUNCT;
  7739. } else if (isThai(charCode)) {
  7740. return CharacterType.THAI_LETTER;
  7741. } else if (charCode === 0xa0) {
  7742. return CharacterType.SPACE;
  7743. }
  7744. return CharacterType.ALPHA_LETTER;
  7745. }
  7746. if (isHan(charCode)) {
  7747. return CharacterType.HAN_LETTER;
  7748. } else if (isKatakana(charCode)) {
  7749. return CharacterType.KATAKANA_LETTER;
  7750. } else if (isHiragana(charCode)) {
  7751. return CharacterType.HIRAGANA_LETTER;
  7752. } else if (isHalfwidthKatakana(charCode)) {
  7753. return CharacterType.HALFWIDTH_KATAKANA_LETTER;
  7754. }
  7755. return CharacterType.ALPHA_LETTER;
  7756. }
  7757. /***/ }),
  7758. /* 24 */
  7759. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7760. Object.defineProperty(exports, "__esModule", ({
  7761. value: true
  7762. }));
  7763. exports.PDFHistory = void 0;
  7764. exports.isDestArraysEqual = isDestArraysEqual;
  7765. exports.isDestHashesEqual = isDestHashesEqual;
  7766. var _ui_utils = __w_pdfjs_require__(8);
  7767. var _event_utils = __w_pdfjs_require__(19);
  7768. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  7769. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  7770. 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."); }
  7771. 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); }
  7772. 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; }
  7773. 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; }
  7774. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  7775. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7776. 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); } }
  7777. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  7778. var HASH_CHANGE_TIMEOUT = 1000;
  7779. var POSITION_UPDATED_THRESHOLD = 50;
  7780. var UPDATE_VIEWAREA_TIMEOUT = 1000;
  7781. function getCurrentHash() {
  7782. return document.location.hash;
  7783. }
  7784. var PDFHistory = /*#__PURE__*/function () {
  7785. function PDFHistory(_ref) {
  7786. var _this = this;
  7787. var linkService = _ref.linkService,
  7788. eventBus = _ref.eventBus;
  7789. _classCallCheck(this, PDFHistory);
  7790. this.linkService = linkService;
  7791. this.eventBus = eventBus;
  7792. this._initialized = false;
  7793. this._fingerprint = "";
  7794. this.reset();
  7795. this._boundEvents = null;
  7796. this._isViewerInPresentationMode = false;
  7797. this.eventBus._on("presentationmodechanged", function (evt) {
  7798. _this._isViewerInPresentationMode = evt.state !== _ui_utils.PresentationModeState.NORMAL;
  7799. });
  7800. this.eventBus._on("pagesinit", function () {
  7801. _this._isPagesLoaded = false;
  7802. _this.eventBus._on("pagesloaded", function (evt) {
  7803. _this._isPagesLoaded = !!evt.pagesCount;
  7804. }, {
  7805. once: true
  7806. });
  7807. });
  7808. }
  7809. _createClass(PDFHistory, [{
  7810. key: "initialize",
  7811. value: function initialize(_ref2) {
  7812. var fingerprint = _ref2.fingerprint,
  7813. _ref2$resetHistory = _ref2.resetHistory,
  7814. resetHistory = _ref2$resetHistory === void 0 ? false : _ref2$resetHistory,
  7815. _ref2$updateUrl = _ref2.updateUrl,
  7816. updateUrl = _ref2$updateUrl === void 0 ? false : _ref2$updateUrl;
  7817. if (!fingerprint || typeof fingerprint !== "string") {
  7818. console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');
  7819. return;
  7820. }
  7821. if (this._initialized) {
  7822. this.reset();
  7823. }
  7824. var reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;
  7825. this._fingerprint = fingerprint;
  7826. this._updateUrl = updateUrl === true;
  7827. this._initialized = true;
  7828. this._bindEvents();
  7829. var state = window.history.state;
  7830. this._popStateInProgress = false;
  7831. this._blockHashChange = 0;
  7832. this._currentHash = getCurrentHash();
  7833. this._numPositionUpdates = 0;
  7834. this._uid = this._maxUid = 0;
  7835. this._destination = null;
  7836. this._position = null;
  7837. if (!this._isValidState(state, true) || resetHistory) {
  7838. var _this$_parseCurrentHa = this._parseCurrentHash(true),
  7839. hash = _this$_parseCurrentHa.hash,
  7840. page = _this$_parseCurrentHa.page,
  7841. rotation = _this$_parseCurrentHa.rotation;
  7842. if (!hash || reInitialized || resetHistory) {
  7843. this._pushOrReplaceState(null, true);
  7844. return;
  7845. }
  7846. this._pushOrReplaceState({
  7847. hash: hash,
  7848. page: page,
  7849. rotation: rotation
  7850. }, true);
  7851. return;
  7852. }
  7853. var destination = state.destination;
  7854. this._updateInternalState(destination, state.uid, true);
  7855. if (destination.rotation !== undefined) {
  7856. this._initialRotation = destination.rotation;
  7857. }
  7858. if (destination.dest) {
  7859. this._initialBookmark = JSON.stringify(destination.dest);
  7860. this._destination.page = null;
  7861. } else if (destination.hash) {
  7862. this._initialBookmark = destination.hash;
  7863. } else if (destination.page) {
  7864. this._initialBookmark = "page=".concat(destination.page);
  7865. }
  7866. }
  7867. }, {
  7868. key: "reset",
  7869. value: function reset() {
  7870. if (this._initialized) {
  7871. this._pageHide();
  7872. this._initialized = false;
  7873. this._unbindEvents();
  7874. }
  7875. if (this._updateViewareaTimeout) {
  7876. clearTimeout(this._updateViewareaTimeout);
  7877. this._updateViewareaTimeout = null;
  7878. }
  7879. this._initialBookmark = null;
  7880. this._initialRotation = null;
  7881. }
  7882. }, {
  7883. key: "push",
  7884. value: function push(_ref3) {
  7885. var _this2 = this;
  7886. var _ref3$namedDest = _ref3.namedDest,
  7887. namedDest = _ref3$namedDest === void 0 ? null : _ref3$namedDest,
  7888. explicitDest = _ref3.explicitDest,
  7889. pageNumber = _ref3.pageNumber;
  7890. if (!this._initialized) {
  7891. return;
  7892. }
  7893. if (namedDest && typeof namedDest !== "string") {
  7894. console.error("PDFHistory.push: " + "\"".concat(namedDest, "\" is not a valid namedDest parameter."));
  7895. return;
  7896. } else if (!Array.isArray(explicitDest)) {
  7897. console.error("PDFHistory.push: " + "\"".concat(explicitDest, "\" is not a valid explicitDest parameter."));
  7898. return;
  7899. } else if (!this._isValidPage(pageNumber)) {
  7900. if (pageNumber !== null || this._destination) {
  7901. console.error("PDFHistory.push: " + "\"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  7902. return;
  7903. }
  7904. }
  7905. var hash = namedDest || JSON.stringify(explicitDest);
  7906. if (!hash) {
  7907. return;
  7908. }
  7909. var forceReplace = false;
  7910. if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
  7911. if (this._destination.page) {
  7912. return;
  7913. }
  7914. forceReplace = true;
  7915. }
  7916. if (this._popStateInProgress && !forceReplace) {
  7917. return;
  7918. }
  7919. this._pushOrReplaceState({
  7920. dest: explicitDest,
  7921. hash: hash,
  7922. page: pageNumber,
  7923. rotation: this.linkService.rotation
  7924. }, forceReplace);
  7925. if (!this._popStateInProgress) {
  7926. this._popStateInProgress = true;
  7927. Promise.resolve().then(function () {
  7928. _this2._popStateInProgress = false;
  7929. });
  7930. }
  7931. }
  7932. }, {
  7933. key: "pushPage",
  7934. value: function pushPage(pageNumber) {
  7935. var _this$_destination,
  7936. _this3 = this;
  7937. if (!this._initialized) {
  7938. return;
  7939. }
  7940. if (!this._isValidPage(pageNumber)) {
  7941. console.error("PDFHistory.pushPage: \"".concat(pageNumber, "\" is not a valid page number."));
  7942. return;
  7943. }
  7944. if (((_this$_destination = this._destination) === null || _this$_destination === void 0 ? void 0 : _this$_destination.page) === pageNumber) {
  7945. return;
  7946. }
  7947. if (this._popStateInProgress) {
  7948. return;
  7949. }
  7950. this._pushOrReplaceState({
  7951. dest: null,
  7952. hash: "page=".concat(pageNumber),
  7953. page: pageNumber,
  7954. rotation: this.linkService.rotation
  7955. });
  7956. if (!this._popStateInProgress) {
  7957. this._popStateInProgress = true;
  7958. Promise.resolve().then(function () {
  7959. _this3._popStateInProgress = false;
  7960. });
  7961. }
  7962. }
  7963. }, {
  7964. key: "pushCurrentPosition",
  7965. value: function pushCurrentPosition() {
  7966. if (!this._initialized || this._popStateInProgress) {
  7967. return;
  7968. }
  7969. this._tryPushCurrentPosition();
  7970. }
  7971. }, {
  7972. key: "back",
  7973. value: function back() {
  7974. if (!this._initialized || this._popStateInProgress) {
  7975. return;
  7976. }
  7977. var state = window.history.state;
  7978. if (this._isValidState(state) && state.uid > 0) {
  7979. window.history.back();
  7980. }
  7981. }
  7982. }, {
  7983. key: "forward",
  7984. value: function forward() {
  7985. if (!this._initialized || this._popStateInProgress) {
  7986. return;
  7987. }
  7988. var state = window.history.state;
  7989. if (this._isValidState(state) && state.uid < this._maxUid) {
  7990. window.history.forward();
  7991. }
  7992. }
  7993. }, {
  7994. key: "popStateInProgress",
  7995. get: function get() {
  7996. return this._initialized && (this._popStateInProgress || this._blockHashChange > 0);
  7997. }
  7998. }, {
  7999. key: "initialBookmark",
  8000. get: function get() {
  8001. return this._initialized ? this._initialBookmark : null;
  8002. }
  8003. }, {
  8004. key: "initialRotation",
  8005. get: function get() {
  8006. return this._initialized ? this._initialRotation : null;
  8007. }
  8008. }, {
  8009. key: "_pushOrReplaceState",
  8010. value: function _pushOrReplaceState(destination) {
  8011. var forceReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8012. var shouldReplace = forceReplace || !this._destination;
  8013. var newState = {
  8014. fingerprint: this._fingerprint,
  8015. uid: shouldReplace ? this._uid : this._uid + 1,
  8016. destination: destination
  8017. };
  8018. this._updateInternalState(destination, newState.uid);
  8019. var newUrl;
  8020. if (this._updateUrl && destination !== null && destination !== void 0 && destination.hash) {
  8021. var baseUrl = document.location.href.split("#")[0];
  8022. if (!baseUrl.startsWith("file://")) {
  8023. newUrl = "".concat(baseUrl, "#").concat(destination.hash);
  8024. }
  8025. }
  8026. if (shouldReplace) {
  8027. window.history.replaceState(newState, "", newUrl);
  8028. } else {
  8029. window.history.pushState(newState, "", newUrl);
  8030. }
  8031. }
  8032. }, {
  8033. key: "_tryPushCurrentPosition",
  8034. value: function _tryPushCurrentPosition() {
  8035. var temporary = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  8036. if (!this._position) {
  8037. return;
  8038. }
  8039. var position = this._position;
  8040. if (temporary) {
  8041. position = Object.assign(Object.create(null), this._position);
  8042. position.temporary = true;
  8043. }
  8044. if (!this._destination) {
  8045. this._pushOrReplaceState(position);
  8046. return;
  8047. }
  8048. if (this._destination.temporary) {
  8049. this._pushOrReplaceState(position, true);
  8050. return;
  8051. }
  8052. if (this._destination.hash === position.hash) {
  8053. return;
  8054. }
  8055. if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {
  8056. return;
  8057. }
  8058. var forceReplace = false;
  8059. if (this._destination.page >= position.first && this._destination.page <= position.page) {
  8060. if (this._destination.dest !== undefined || !this._destination.first) {
  8061. return;
  8062. }
  8063. forceReplace = true;
  8064. }
  8065. this._pushOrReplaceState(position, forceReplace);
  8066. }
  8067. }, {
  8068. key: "_isValidPage",
  8069. value: function _isValidPage(val) {
  8070. return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount;
  8071. }
  8072. }, {
  8073. key: "_isValidState",
  8074. value: function _isValidState(state) {
  8075. var checkReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8076. if (!state) {
  8077. return false;
  8078. }
  8079. if (state.fingerprint !== this._fingerprint) {
  8080. if (checkReload) {
  8081. if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) {
  8082. return false;
  8083. }
  8084. var _performance$getEntri = performance.getEntriesByType("navigation"),
  8085. _performance$getEntri2 = _slicedToArray(_performance$getEntri, 1),
  8086. perfEntry = _performance$getEntri2[0];
  8087. if ((perfEntry === null || perfEntry === void 0 ? void 0 : perfEntry.type) !== "reload") {
  8088. return false;
  8089. }
  8090. } else {
  8091. return false;
  8092. }
  8093. }
  8094. if (!Number.isInteger(state.uid) || state.uid < 0) {
  8095. return false;
  8096. }
  8097. if (state.destination === null || _typeof(state.destination) !== "object") {
  8098. return false;
  8099. }
  8100. return true;
  8101. }
  8102. }, {
  8103. key: "_updateInternalState",
  8104. value: function _updateInternalState(destination, uid) {
  8105. var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  8106. if (this._updateViewareaTimeout) {
  8107. clearTimeout(this._updateViewareaTimeout);
  8108. this._updateViewareaTimeout = null;
  8109. }
  8110. if (removeTemporary && destination !== null && destination !== void 0 && destination.temporary) {
  8111. delete destination.temporary;
  8112. }
  8113. this._destination = destination;
  8114. this._uid = uid;
  8115. this._maxUid = Math.max(this._maxUid, uid);
  8116. this._numPositionUpdates = 0;
  8117. }
  8118. }, {
  8119. key: "_parseCurrentHash",
  8120. value: function _parseCurrentHash() {
  8121. var checkNameddest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  8122. var hash = unescape(getCurrentHash()).substring(1);
  8123. var params = (0, _ui_utils.parseQueryString)(hash);
  8124. var nameddest = params.get("nameddest") || "";
  8125. var page = params.get("page") | 0;
  8126. if (!this._isValidPage(page) || checkNameddest && nameddest.length > 0) {
  8127. page = null;
  8128. }
  8129. return {
  8130. hash: hash,
  8131. page: page,
  8132. rotation: this.linkService.rotation
  8133. };
  8134. }
  8135. }, {
  8136. key: "_updateViewarea",
  8137. value: function _updateViewarea(_ref4) {
  8138. var _this4 = this;
  8139. var location = _ref4.location;
  8140. if (this._updateViewareaTimeout) {
  8141. clearTimeout(this._updateViewareaTimeout);
  8142. this._updateViewareaTimeout = null;
  8143. }
  8144. this._position = {
  8145. hash: this._isViewerInPresentationMode ? "page=".concat(location.pageNumber) : location.pdfOpenParams.substring(1),
  8146. page: this.linkService.page,
  8147. first: location.pageNumber,
  8148. rotation: location.rotation
  8149. };
  8150. if (this._popStateInProgress) {
  8151. return;
  8152. }
  8153. if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) {
  8154. this._numPositionUpdates++;
  8155. }
  8156. if (UPDATE_VIEWAREA_TIMEOUT > 0) {
  8157. this._updateViewareaTimeout = setTimeout(function () {
  8158. if (!_this4._popStateInProgress) {
  8159. _this4._tryPushCurrentPosition(true);
  8160. }
  8161. _this4._updateViewareaTimeout = null;
  8162. }, UPDATE_VIEWAREA_TIMEOUT);
  8163. }
  8164. }
  8165. }, {
  8166. key: "_popState",
  8167. value: function _popState(_ref5) {
  8168. var _this5 = this;
  8169. var state = _ref5.state;
  8170. var newHash = getCurrentHash(),
  8171. hashChanged = this._currentHash !== newHash;
  8172. this._currentHash = newHash;
  8173. if (!state) {
  8174. this._uid++;
  8175. var _this$_parseCurrentHa2 = this._parseCurrentHash(),
  8176. hash = _this$_parseCurrentHa2.hash,
  8177. page = _this$_parseCurrentHa2.page,
  8178. rotation = _this$_parseCurrentHa2.rotation;
  8179. this._pushOrReplaceState({
  8180. hash: hash,
  8181. page: page,
  8182. rotation: rotation
  8183. }, true);
  8184. return;
  8185. }
  8186. if (!this._isValidState(state)) {
  8187. return;
  8188. }
  8189. this._popStateInProgress = true;
  8190. if (hashChanged) {
  8191. this._blockHashChange++;
  8192. (0, _event_utils.waitOnEventOrTimeout)({
  8193. target: window,
  8194. name: "hashchange",
  8195. delay: HASH_CHANGE_TIMEOUT
  8196. }).then(function () {
  8197. _this5._blockHashChange--;
  8198. });
  8199. }
  8200. var destination = state.destination;
  8201. this._updateInternalState(destination, state.uid, true);
  8202. if ((0, _ui_utils.isValidRotation)(destination.rotation)) {
  8203. this.linkService.rotation = destination.rotation;
  8204. }
  8205. if (destination.dest) {
  8206. this.linkService.goToDestination(destination.dest);
  8207. } else if (destination.hash) {
  8208. this.linkService.setHash(destination.hash);
  8209. } else if (destination.page) {
  8210. this.linkService.page = destination.page;
  8211. }
  8212. Promise.resolve().then(function () {
  8213. _this5._popStateInProgress = false;
  8214. });
  8215. }
  8216. }, {
  8217. key: "_pageHide",
  8218. value: function _pageHide() {
  8219. if (!this._destination || this._destination.temporary) {
  8220. this._tryPushCurrentPosition();
  8221. }
  8222. }
  8223. }, {
  8224. key: "_bindEvents",
  8225. value: function _bindEvents() {
  8226. if (this._boundEvents) {
  8227. return;
  8228. }
  8229. this._boundEvents = {
  8230. updateViewarea: this._updateViewarea.bind(this),
  8231. popState: this._popState.bind(this),
  8232. pageHide: this._pageHide.bind(this)
  8233. };
  8234. this.eventBus._on("updateviewarea", this._boundEvents.updateViewarea);
  8235. window.addEventListener("popstate", this._boundEvents.popState);
  8236. window.addEventListener("pagehide", this._boundEvents.pageHide);
  8237. }
  8238. }, {
  8239. key: "_unbindEvents",
  8240. value: function _unbindEvents() {
  8241. if (!this._boundEvents) {
  8242. return;
  8243. }
  8244. this.eventBus._off("updateviewarea", this._boundEvents.updateViewarea);
  8245. window.removeEventListener("popstate", this._boundEvents.popState);
  8246. window.removeEventListener("pagehide", this._boundEvents.pageHide);
  8247. this._boundEvents = null;
  8248. }
  8249. }]);
  8250. return PDFHistory;
  8251. }();
  8252. exports.PDFHistory = PDFHistory;
  8253. function isDestHashesEqual(destHash, pushHash) {
  8254. if (typeof destHash !== "string" || typeof pushHash !== "string") {
  8255. return false;
  8256. }
  8257. if (destHash === pushHash) {
  8258. return true;
  8259. }
  8260. var nameddest = (0, _ui_utils.parseQueryString)(destHash).get("nameddest");
  8261. if (nameddest === pushHash) {
  8262. return true;
  8263. }
  8264. return false;
  8265. }
  8266. function isDestArraysEqual(firstDest, secondDest) {
  8267. function isEntryEqual(first, second) {
  8268. if (_typeof(first) !== _typeof(second)) {
  8269. return false;
  8270. }
  8271. if (Array.isArray(first) || Array.isArray(second)) {
  8272. return false;
  8273. }
  8274. if (first !== null && _typeof(first) === "object" && second !== null) {
  8275. if (Object.keys(first).length !== Object.keys(second).length) {
  8276. return false;
  8277. }
  8278. for (var key in first) {
  8279. if (!isEntryEqual(first[key], second[key])) {
  8280. return false;
  8281. }
  8282. }
  8283. return true;
  8284. }
  8285. return first === second || Number.isNaN(first) && Number.isNaN(second);
  8286. }
  8287. if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {
  8288. return false;
  8289. }
  8290. if (firstDest.length !== secondDest.length) {
  8291. return false;
  8292. }
  8293. for (var i = 0, ii = firstDest.length; i < ii; i++) {
  8294. if (!isEntryEqual(firstDest[i], secondDest[i])) {
  8295. return false;
  8296. }
  8297. }
  8298. return true;
  8299. }
  8300. /***/ }),
  8301. /* 25 */
  8302. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8303. Object.defineProperty(exports, "__esModule", ({
  8304. value: true
  8305. }));
  8306. exports.PDFScriptingManager = void 0;
  8307. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  8308. var _ui_utils = __w_pdfjs_require__(8);
  8309. var _pdfjsLib = __w_pdfjs_require__(5);
  8310. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8311. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  8312. 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."); }
  8313. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  8314. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  8315. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  8316. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  8317. 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; }
  8318. 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; } } }; }
  8319. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  8320. 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."); }
  8321. 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); }
  8322. 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; }
  8323. 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; }
  8324. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  8325. 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); } }
  8326. 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); }); }; }
  8327. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8328. 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); } }
  8329. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  8330. var PDFScriptingManager = /*#__PURE__*/function () {
  8331. function PDFScriptingManager(_ref) {
  8332. var _this = this;
  8333. var eventBus = _ref.eventBus,
  8334. _ref$sandboxBundleSrc = _ref.sandboxBundleSrc,
  8335. sandboxBundleSrc = _ref$sandboxBundleSrc === void 0 ? null : _ref$sandboxBundleSrc,
  8336. _ref$scriptingFactory = _ref.scriptingFactory,
  8337. scriptingFactory = _ref$scriptingFactory === void 0 ? null : _ref$scriptingFactory,
  8338. _ref$docPropertiesLoo = _ref.docPropertiesLookup,
  8339. docPropertiesLookup = _ref$docPropertiesLoo === void 0 ? null : _ref$docPropertiesLoo;
  8340. _classCallCheck(this, PDFScriptingManager);
  8341. this._pdfDocument = null;
  8342. this._pdfViewer = null;
  8343. this._closeCapability = null;
  8344. this._destroyCapability = null;
  8345. this._scripting = null;
  8346. this._mouseState = Object.create(null);
  8347. this._ready = false;
  8348. this._eventBus = eventBus;
  8349. this._sandboxBundleSrc = sandboxBundleSrc;
  8350. this._scriptingFactory = scriptingFactory;
  8351. this._docPropertiesLookup = docPropertiesLookup;
  8352. if (!this._scriptingFactory) {
  8353. window.addEventListener("updatefromsandbox", function (event) {
  8354. _this._eventBus.dispatch("updatefromsandbox", {
  8355. source: window,
  8356. detail: event.detail
  8357. });
  8358. });
  8359. }
  8360. }
  8361. _createClass(PDFScriptingManager, [{
  8362. key: "setViewer",
  8363. value: function setViewer(pdfViewer) {
  8364. this._pdfViewer = pdfViewer;
  8365. }
  8366. }, {
  8367. key: "setDocument",
  8368. value: function () {
  8369. var _setDocument = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pdfDocument) {
  8370. var _this2 = this,
  8371. _this$_scripting;
  8372. var _yield$Promise$all, _yield$Promise$all2, objects, calculationOrder, docActions, _iterator, _step, _step$value, name, listener, _iterator2, _step2, _step2$value, _name, _listener, docProperties;
  8373. return _regenerator["default"].wrap(function _callee2$(_context2) {
  8374. while (1) {
  8375. switch (_context2.prev = _context2.next) {
  8376. case 0:
  8377. if (!this._pdfDocument) {
  8378. _context2.next = 3;
  8379. break;
  8380. }
  8381. _context2.next = 3;
  8382. return this._destroyScripting();
  8383. case 3:
  8384. this._pdfDocument = pdfDocument;
  8385. if (pdfDocument) {
  8386. _context2.next = 6;
  8387. break;
  8388. }
  8389. return _context2.abrupt("return");
  8390. case 6:
  8391. _context2.next = 8;
  8392. return Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]);
  8393. case 8:
  8394. _yield$Promise$all = _context2.sent;
  8395. _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
  8396. objects = _yield$Promise$all2[0];
  8397. calculationOrder = _yield$Promise$all2[1];
  8398. docActions = _yield$Promise$all2[2];
  8399. if (!(!objects && !docActions)) {
  8400. _context2.next = 17;
  8401. break;
  8402. }
  8403. _context2.next = 16;
  8404. return this._destroyScripting();
  8405. case 16:
  8406. return _context2.abrupt("return");
  8407. case 17:
  8408. if (!(pdfDocument !== this._pdfDocument)) {
  8409. _context2.next = 19;
  8410. break;
  8411. }
  8412. return _context2.abrupt("return");
  8413. case 19:
  8414. _context2.prev = 19;
  8415. this._scripting = this._createScripting();
  8416. _context2.next = 29;
  8417. break;
  8418. case 23:
  8419. _context2.prev = 23;
  8420. _context2.t0 = _context2["catch"](19);
  8421. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message, "\"."));
  8422. _context2.next = 28;
  8423. return this._destroyScripting();
  8424. case 28:
  8425. return _context2.abrupt("return");
  8426. case 29:
  8427. this._internalEvents.set("updatefromsandbox", function (event) {
  8428. if ((event === null || event === void 0 ? void 0 : event.source) !== window) {
  8429. return;
  8430. }
  8431. _this2._updateFromSandbox(event.detail);
  8432. });
  8433. this._internalEvents.set("dispatcheventinsandbox", function (event) {
  8434. var _this2$_scripting;
  8435. (_this2$_scripting = _this2._scripting) === null || _this2$_scripting === void 0 ? void 0 : _this2$_scripting.dispatchEventInSandbox(event.detail);
  8436. });
  8437. this._internalEvents.set("pagechanging", function (_ref2) {
  8438. var pageNumber = _ref2.pageNumber,
  8439. previous = _ref2.previous;
  8440. if (pageNumber === previous) {
  8441. return;
  8442. }
  8443. _this2._dispatchPageClose(previous);
  8444. _this2._dispatchPageOpen(pageNumber);
  8445. });
  8446. this._internalEvents.set("pagerendered", function (_ref3) {
  8447. var pageNumber = _ref3.pageNumber;
  8448. if (!_this2._pageOpenPending.has(pageNumber)) {
  8449. return;
  8450. }
  8451. if (pageNumber !== _this2._pdfViewer.currentPageNumber) {
  8452. return;
  8453. }
  8454. _this2._dispatchPageOpen(pageNumber);
  8455. });
  8456. this._internalEvents.set("pagesdestroy", /*#__PURE__*/function () {
  8457. var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(event) {
  8458. var _this2$_scripting2, _this2$_closeCapabili;
  8459. return _regenerator["default"].wrap(function _callee$(_context) {
  8460. while (1) {
  8461. switch (_context.prev = _context.next) {
  8462. case 0:
  8463. _context.next = 2;
  8464. return _this2._dispatchPageClose(_this2._pdfViewer.currentPageNumber);
  8465. case 2:
  8466. _context.next = 4;
  8467. return (_this2$_scripting2 = _this2._scripting) === null || _this2$_scripting2 === void 0 ? void 0 : _this2$_scripting2.dispatchEventInSandbox({
  8468. id: "doc",
  8469. name: "WillClose"
  8470. });
  8471. case 4:
  8472. (_this2$_closeCapabili = _this2._closeCapability) === null || _this2$_closeCapabili === void 0 ? void 0 : _this2$_closeCapabili.resolve();
  8473. case 5:
  8474. case "end":
  8475. return _context.stop();
  8476. }
  8477. }
  8478. }, _callee);
  8479. }));
  8480. return function (_x2) {
  8481. return _ref4.apply(this, arguments);
  8482. };
  8483. }());
  8484. this._domEvents.set("mousedown", function (event) {
  8485. _this2._mouseState.isDown = true;
  8486. });
  8487. this._domEvents.set("mouseup", function (event) {
  8488. _this2._mouseState.isDown = false;
  8489. });
  8490. _iterator = _createForOfIteratorHelper(this._internalEvents);
  8491. try {
  8492. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  8493. _step$value = _slicedToArray(_step.value, 2), name = _step$value[0], listener = _step$value[1];
  8494. this._eventBus._on(name, listener);
  8495. }
  8496. } catch (err) {
  8497. _iterator.e(err);
  8498. } finally {
  8499. _iterator.f();
  8500. }
  8501. _iterator2 = _createForOfIteratorHelper(this._domEvents);
  8502. try {
  8503. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  8504. _step2$value = _slicedToArray(_step2.value, 2), _name = _step2$value[0], _listener = _step2$value[1];
  8505. window.addEventListener(_name, _listener);
  8506. }
  8507. } catch (err) {
  8508. _iterator2.e(err);
  8509. } finally {
  8510. _iterator2.f();
  8511. }
  8512. _context2.prev = 40;
  8513. _context2.next = 43;
  8514. return this._getDocProperties();
  8515. case 43:
  8516. docProperties = _context2.sent;
  8517. if (!(pdfDocument !== this._pdfDocument)) {
  8518. _context2.next = 46;
  8519. break;
  8520. }
  8521. return _context2.abrupt("return");
  8522. case 46:
  8523. _context2.next = 48;
  8524. return this._scripting.createSandbox({
  8525. objects: objects,
  8526. calculationOrder: calculationOrder,
  8527. appInfo: {
  8528. platform: navigator.platform,
  8529. language: navigator.language
  8530. },
  8531. docInfo: _objectSpread(_objectSpread({}, docProperties), {}, {
  8532. actions: docActions
  8533. })
  8534. });
  8535. case 48:
  8536. this._eventBus.dispatch("sandboxcreated", {
  8537. source: this
  8538. });
  8539. _context2.next = 57;
  8540. break;
  8541. case 51:
  8542. _context2.prev = 51;
  8543. _context2.t1 = _context2["catch"](40);
  8544. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t1 === null || _context2.t1 === void 0 ? void 0 : _context2.t1.message, "\"."));
  8545. _context2.next = 56;
  8546. return this._destroyScripting();
  8547. case 56:
  8548. return _context2.abrupt("return");
  8549. case 57:
  8550. _context2.next = 59;
  8551. return (_this$_scripting = this._scripting) === null || _this$_scripting === void 0 ? void 0 : _this$_scripting.dispatchEventInSandbox({
  8552. id: "doc",
  8553. name: "Open"
  8554. });
  8555. case 59:
  8556. _context2.next = 61;
  8557. return this._dispatchPageOpen(this._pdfViewer.currentPageNumber, true);
  8558. case 61:
  8559. Promise.resolve().then(function () {
  8560. if (pdfDocument === _this2._pdfDocument) {
  8561. _this2._ready = true;
  8562. }
  8563. });
  8564. case 62:
  8565. case "end":
  8566. return _context2.stop();
  8567. }
  8568. }
  8569. }, _callee2, this, [[19, 23], [40, 51]]);
  8570. }));
  8571. function setDocument(_x) {
  8572. return _setDocument.apply(this, arguments);
  8573. }
  8574. return setDocument;
  8575. }()
  8576. }, {
  8577. key: "dispatchWillSave",
  8578. value: function () {
  8579. var _dispatchWillSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(detail) {
  8580. var _this$_scripting2;
  8581. return _regenerator["default"].wrap(function _callee3$(_context3) {
  8582. while (1) {
  8583. switch (_context3.prev = _context3.next) {
  8584. case 0:
  8585. return _context3.abrupt("return", (_this$_scripting2 = this._scripting) === null || _this$_scripting2 === void 0 ? void 0 : _this$_scripting2.dispatchEventInSandbox({
  8586. id: "doc",
  8587. name: "WillSave"
  8588. }));
  8589. case 1:
  8590. case "end":
  8591. return _context3.stop();
  8592. }
  8593. }
  8594. }, _callee3, this);
  8595. }));
  8596. function dispatchWillSave(_x3) {
  8597. return _dispatchWillSave.apply(this, arguments);
  8598. }
  8599. return dispatchWillSave;
  8600. }()
  8601. }, {
  8602. key: "dispatchDidSave",
  8603. value: function () {
  8604. var _dispatchDidSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(detail) {
  8605. var _this$_scripting3;
  8606. return _regenerator["default"].wrap(function _callee4$(_context4) {
  8607. while (1) {
  8608. switch (_context4.prev = _context4.next) {
  8609. case 0:
  8610. return _context4.abrupt("return", (_this$_scripting3 = this._scripting) === null || _this$_scripting3 === void 0 ? void 0 : _this$_scripting3.dispatchEventInSandbox({
  8611. id: "doc",
  8612. name: "DidSave"
  8613. }));
  8614. case 1:
  8615. case "end":
  8616. return _context4.stop();
  8617. }
  8618. }
  8619. }, _callee4, this);
  8620. }));
  8621. function dispatchDidSave(_x4) {
  8622. return _dispatchDidSave.apply(this, arguments);
  8623. }
  8624. return dispatchDidSave;
  8625. }()
  8626. }, {
  8627. key: "dispatchWillPrint",
  8628. value: function () {
  8629. var _dispatchWillPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5(detail) {
  8630. var _this$_scripting4;
  8631. return _regenerator["default"].wrap(function _callee5$(_context5) {
  8632. while (1) {
  8633. switch (_context5.prev = _context5.next) {
  8634. case 0:
  8635. return _context5.abrupt("return", (_this$_scripting4 = this._scripting) === null || _this$_scripting4 === void 0 ? void 0 : _this$_scripting4.dispatchEventInSandbox({
  8636. id: "doc",
  8637. name: "WillPrint"
  8638. }));
  8639. case 1:
  8640. case "end":
  8641. return _context5.stop();
  8642. }
  8643. }
  8644. }, _callee5, this);
  8645. }));
  8646. function dispatchWillPrint(_x5) {
  8647. return _dispatchWillPrint.apply(this, arguments);
  8648. }
  8649. return dispatchWillPrint;
  8650. }()
  8651. }, {
  8652. key: "dispatchDidPrint",
  8653. value: function () {
  8654. var _dispatchDidPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6(detail) {
  8655. var _this$_scripting5;
  8656. return _regenerator["default"].wrap(function _callee6$(_context6) {
  8657. while (1) {
  8658. switch (_context6.prev = _context6.next) {
  8659. case 0:
  8660. return _context6.abrupt("return", (_this$_scripting5 = this._scripting) === null || _this$_scripting5 === void 0 ? void 0 : _this$_scripting5.dispatchEventInSandbox({
  8661. id: "doc",
  8662. name: "DidPrint"
  8663. }));
  8664. case 1:
  8665. case "end":
  8666. return _context6.stop();
  8667. }
  8668. }
  8669. }, _callee6, this);
  8670. }));
  8671. function dispatchDidPrint(_x6) {
  8672. return _dispatchDidPrint.apply(this, arguments);
  8673. }
  8674. return dispatchDidPrint;
  8675. }()
  8676. }, {
  8677. key: "mouseState",
  8678. get: function get() {
  8679. return this._mouseState;
  8680. }
  8681. }, {
  8682. key: "destroyPromise",
  8683. get: function get() {
  8684. var _this$_destroyCapabil;
  8685. return ((_this$_destroyCapabil = this._destroyCapability) === null || _this$_destroyCapabil === void 0 ? void 0 : _this$_destroyCapabil.promise) || null;
  8686. }
  8687. }, {
  8688. key: "ready",
  8689. get: function get() {
  8690. return this._ready;
  8691. }
  8692. }, {
  8693. key: "_internalEvents",
  8694. get: function get() {
  8695. return (0, _pdfjsLib.shadow)(this, "_internalEvents", new Map());
  8696. }
  8697. }, {
  8698. key: "_domEvents",
  8699. get: function get() {
  8700. return (0, _pdfjsLib.shadow)(this, "_domEvents", new Map());
  8701. }
  8702. }, {
  8703. key: "_pageOpenPending",
  8704. get: function get() {
  8705. return (0, _pdfjsLib.shadow)(this, "_pageOpenPending", new Set());
  8706. }
  8707. }, {
  8708. key: "_visitedPages",
  8709. get: function get() {
  8710. return (0, _pdfjsLib.shadow)(this, "_visitedPages", new Map());
  8711. }
  8712. }, {
  8713. key: "_updateFromSandbox",
  8714. value: function () {
  8715. var _updateFromSandbox2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee7(detail) {
  8716. var isInPresentationMode, id, siblings, command, value, modes, ids, _iterator3, _step3, elementId, element, _this$_pdfDocument;
  8717. return _regenerator["default"].wrap(function _callee7$(_context7) {
  8718. while (1) {
  8719. switch (_context7.prev = _context7.next) {
  8720. case 0:
  8721. isInPresentationMode = this._pdfViewer.isInPresentationMode || this._pdfViewer.isChangingPresentationMode;
  8722. id = detail.id, siblings = detail.siblings, command = detail.command, value = detail.value;
  8723. if (id) {
  8724. _context7.next = 46;
  8725. break;
  8726. }
  8727. _context7.t0 = command;
  8728. _context7.next = _context7.t0 === "clear" ? 6 : _context7.t0 === "error" ? 8 : _context7.t0 === "layout" ? 10 : _context7.t0 === "page-num" ? 15 : _context7.t0 === "print" ? 17 : _context7.t0 === "println" ? 21 : _context7.t0 === "zoom" ? 23 : _context7.t0 === "SaveAs" ? 27 : _context7.t0 === "FirstPage" ? 29 : _context7.t0 === "LastPage" ? 31 : _context7.t0 === "NextPage" ? 33 : _context7.t0 === "PrevPage" ? 35 : _context7.t0 === "ZoomViewIn" ? 37 : _context7.t0 === "ZoomViewOut" ? 41 : 45;
  8729. break;
  8730. case 6:
  8731. console.clear();
  8732. return _context7.abrupt("break", 45);
  8733. case 8:
  8734. console.error(value);
  8735. return _context7.abrupt("break", 45);
  8736. case 10:
  8737. if (!isInPresentationMode) {
  8738. _context7.next = 12;
  8739. break;
  8740. }
  8741. return _context7.abrupt("return");
  8742. case 12:
  8743. modes = (0, _ui_utils.apiPageLayoutToViewerModes)(value);
  8744. this._pdfViewer.spreadMode = modes.spreadMode;
  8745. return _context7.abrupt("break", 45);
  8746. case 15:
  8747. this._pdfViewer.currentPageNumber = value + 1;
  8748. return _context7.abrupt("break", 45);
  8749. case 17:
  8750. _context7.next = 19;
  8751. return this._pdfViewer.pagesPromise;
  8752. case 19:
  8753. this._eventBus.dispatch("print", {
  8754. source: this
  8755. });
  8756. return _context7.abrupt("break", 45);
  8757. case 21:
  8758. console.log(value);
  8759. return _context7.abrupt("break", 45);
  8760. case 23:
  8761. if (!isInPresentationMode) {
  8762. _context7.next = 25;
  8763. break;
  8764. }
  8765. return _context7.abrupt("return");
  8766. case 25:
  8767. this._pdfViewer.currentScaleValue = value;
  8768. return _context7.abrupt("break", 45);
  8769. case 27:
  8770. this._eventBus.dispatch("save", {
  8771. source: this
  8772. });
  8773. return _context7.abrupt("break", 45);
  8774. case 29:
  8775. this._pdfViewer.currentPageNumber = 1;
  8776. return _context7.abrupt("break", 45);
  8777. case 31:
  8778. this._pdfViewer.currentPageNumber = this._pdfViewer.pagesCount;
  8779. return _context7.abrupt("break", 45);
  8780. case 33:
  8781. this._pdfViewer.nextPage();
  8782. return _context7.abrupt("break", 45);
  8783. case 35:
  8784. this._pdfViewer.previousPage();
  8785. return _context7.abrupt("break", 45);
  8786. case 37:
  8787. if (!isInPresentationMode) {
  8788. _context7.next = 39;
  8789. break;
  8790. }
  8791. return _context7.abrupt("return");
  8792. case 39:
  8793. this._pdfViewer.increaseScale();
  8794. return _context7.abrupt("break", 45);
  8795. case 41:
  8796. if (!isInPresentationMode) {
  8797. _context7.next = 43;
  8798. break;
  8799. }
  8800. return _context7.abrupt("return");
  8801. case 43:
  8802. this._pdfViewer.decreaseScale();
  8803. return _context7.abrupt("break", 45);
  8804. case 45:
  8805. return _context7.abrupt("return");
  8806. case 46:
  8807. if (!isInPresentationMode) {
  8808. _context7.next = 49;
  8809. break;
  8810. }
  8811. if (!detail.focus) {
  8812. _context7.next = 49;
  8813. break;
  8814. }
  8815. return _context7.abrupt("return");
  8816. case 49:
  8817. delete detail.id;
  8818. delete detail.siblings;
  8819. ids = siblings ? [id].concat(_toConsumableArray(siblings)) : [id];
  8820. _iterator3 = _createForOfIteratorHelper(ids);
  8821. try {
  8822. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  8823. elementId = _step3.value;
  8824. element = document.getElementById(elementId);
  8825. if (element) {
  8826. element.dispatchEvent(new CustomEvent("updatefromsandbox", {
  8827. detail: detail
  8828. }));
  8829. } else {
  8830. (_this$_pdfDocument = this._pdfDocument) === null || _this$_pdfDocument === void 0 ? void 0 : _this$_pdfDocument.annotationStorage.setValue(elementId, detail);
  8831. }
  8832. }
  8833. } catch (err) {
  8834. _iterator3.e(err);
  8835. } finally {
  8836. _iterator3.f();
  8837. }
  8838. case 54:
  8839. case "end":
  8840. return _context7.stop();
  8841. }
  8842. }
  8843. }, _callee7, this);
  8844. }));
  8845. function _updateFromSandbox(_x7) {
  8846. return _updateFromSandbox2.apply(this, arguments);
  8847. }
  8848. return _updateFromSandbox;
  8849. }()
  8850. }, {
  8851. key: "_dispatchPageOpen",
  8852. value: function () {
  8853. var _dispatchPageOpen2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee9(pageNumber) {
  8854. var _this3 = this;
  8855. var initialize,
  8856. pdfDocument,
  8857. visitedPages,
  8858. pageView,
  8859. actionsPromise,
  8860. _args9 = arguments;
  8861. return _regenerator["default"].wrap(function _callee9$(_context9) {
  8862. while (1) {
  8863. switch (_context9.prev = _context9.next) {
  8864. case 0:
  8865. initialize = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : false;
  8866. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  8867. if (initialize) {
  8868. this._closeCapability = (0, _pdfjsLib.createPromiseCapability)();
  8869. }
  8870. if (this._closeCapability) {
  8871. _context9.next = 5;
  8872. break;
  8873. }
  8874. return _context9.abrupt("return");
  8875. case 5:
  8876. pageView = this._pdfViewer.getPageView(pageNumber - 1);
  8877. if (!((pageView === null || pageView === void 0 ? void 0 : pageView.renderingState) !== _ui_utils.RenderingStates.FINISHED)) {
  8878. _context9.next = 9;
  8879. break;
  8880. }
  8881. this._pageOpenPending.add(pageNumber);
  8882. return _context9.abrupt("return");
  8883. case 9:
  8884. this._pageOpenPending["delete"](pageNumber);
  8885. actionsPromise = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
  8886. var _pageView$pdfPage, _this3$_scripting;
  8887. var actions;
  8888. return _regenerator["default"].wrap(function _callee8$(_context8) {
  8889. while (1) {
  8890. switch (_context8.prev = _context8.next) {
  8891. case 0:
  8892. _context8.next = 2;
  8893. return !visitedPages.has(pageNumber) ? (_pageView$pdfPage = pageView.pdfPage) === null || _pageView$pdfPage === void 0 ? void 0 : _pageView$pdfPage.getJSActions() : null;
  8894. case 2:
  8895. actions = _context8.sent;
  8896. if (!(pdfDocument !== _this3._pdfDocument)) {
  8897. _context8.next = 5;
  8898. break;
  8899. }
  8900. return _context8.abrupt("return");
  8901. case 5:
  8902. _context8.next = 7;
  8903. return (_this3$_scripting = _this3._scripting) === null || _this3$_scripting === void 0 ? void 0 : _this3$_scripting.dispatchEventInSandbox({
  8904. id: "page",
  8905. name: "PageOpen",
  8906. pageNumber: pageNumber,
  8907. actions: actions
  8908. });
  8909. case 7:
  8910. case "end":
  8911. return _context8.stop();
  8912. }
  8913. }
  8914. }, _callee8);
  8915. }))();
  8916. visitedPages.set(pageNumber, actionsPromise);
  8917. case 12:
  8918. case "end":
  8919. return _context9.stop();
  8920. }
  8921. }
  8922. }, _callee9, this);
  8923. }));
  8924. function _dispatchPageOpen(_x8) {
  8925. return _dispatchPageOpen2.apply(this, arguments);
  8926. }
  8927. return _dispatchPageOpen;
  8928. }()
  8929. }, {
  8930. key: "_dispatchPageClose",
  8931. value: function () {
  8932. var _dispatchPageClose2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee10(pageNumber) {
  8933. var _this$_scripting6;
  8934. var pdfDocument, visitedPages, actionsPromise;
  8935. return _regenerator["default"].wrap(function _callee10$(_context10) {
  8936. while (1) {
  8937. switch (_context10.prev = _context10.next) {
  8938. case 0:
  8939. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  8940. if (this._closeCapability) {
  8941. _context10.next = 3;
  8942. break;
  8943. }
  8944. return _context10.abrupt("return");
  8945. case 3:
  8946. if (!this._pageOpenPending.has(pageNumber)) {
  8947. _context10.next = 5;
  8948. break;
  8949. }
  8950. return _context10.abrupt("return");
  8951. case 5:
  8952. actionsPromise = visitedPages.get(pageNumber);
  8953. if (actionsPromise) {
  8954. _context10.next = 8;
  8955. break;
  8956. }
  8957. return _context10.abrupt("return");
  8958. case 8:
  8959. visitedPages.set(pageNumber, null);
  8960. _context10.next = 11;
  8961. return actionsPromise;
  8962. case 11:
  8963. if (!(pdfDocument !== this._pdfDocument)) {
  8964. _context10.next = 13;
  8965. break;
  8966. }
  8967. return _context10.abrupt("return");
  8968. case 13:
  8969. _context10.next = 15;
  8970. return (_this$_scripting6 = this._scripting) === null || _this$_scripting6 === void 0 ? void 0 : _this$_scripting6.dispatchEventInSandbox({
  8971. id: "page",
  8972. name: "PageClose",
  8973. pageNumber: pageNumber
  8974. });
  8975. case 15:
  8976. case "end":
  8977. return _context10.stop();
  8978. }
  8979. }
  8980. }, _callee10, this);
  8981. }));
  8982. function _dispatchPageClose(_x9) {
  8983. return _dispatchPageClose2.apply(this, arguments);
  8984. }
  8985. return _dispatchPageClose;
  8986. }()
  8987. }, {
  8988. key: "_getDocProperties",
  8989. value: function () {
  8990. var _getDocProperties2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
  8991. var _require, docPropertiesLookup;
  8992. return _regenerator["default"].wrap(function _callee11$(_context11) {
  8993. while (1) {
  8994. switch (_context11.prev = _context11.next) {
  8995. case 0:
  8996. if (!this._docPropertiesLookup) {
  8997. _context11.next = 2;
  8998. break;
  8999. }
  9000. return _context11.abrupt("return", this._docPropertiesLookup(this._pdfDocument));
  9001. case 2:
  9002. _require = __w_pdfjs_require__(26), docPropertiesLookup = _require.docPropertiesLookup;
  9003. return _context11.abrupt("return", docPropertiesLookup(this._pdfDocument));
  9004. case 4:
  9005. case "end":
  9006. return _context11.stop();
  9007. }
  9008. }
  9009. }, _callee11, this);
  9010. }));
  9011. function _getDocProperties() {
  9012. return _getDocProperties2.apply(this, arguments);
  9013. }
  9014. return _getDocProperties;
  9015. }()
  9016. }, {
  9017. key: "_createScripting",
  9018. value: function _createScripting() {
  9019. this._destroyCapability = (0, _pdfjsLib.createPromiseCapability)();
  9020. if (this._scripting) {
  9021. throw new Error("_createScripting: Scripting already exists.");
  9022. }
  9023. if (this._scriptingFactory) {
  9024. return this._scriptingFactory.createScripting({
  9025. sandboxBundleSrc: this._sandboxBundleSrc
  9026. });
  9027. }
  9028. var _require2 = __w_pdfjs_require__(26),
  9029. GenericScripting = _require2.GenericScripting;
  9030. return new GenericScripting(this._sandboxBundleSrc);
  9031. }
  9032. }, {
  9033. key: "_destroyScripting",
  9034. value: function () {
  9035. var _destroyScripting2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
  9036. var _this$_destroyCapabil3;
  9037. var _this$_destroyCapabil2, _iterator4, _step4, _step4$value, name, listener, _iterator5, _step5, _step5$value, _name2, _listener2;
  9038. return _regenerator["default"].wrap(function _callee12$(_context12) {
  9039. while (1) {
  9040. switch (_context12.prev = _context12.next) {
  9041. case 0:
  9042. if (this._scripting) {
  9043. _context12.next = 4;
  9044. break;
  9045. }
  9046. this._pdfDocument = null;
  9047. (_this$_destroyCapabil2 = this._destroyCapability) === null || _this$_destroyCapabil2 === void 0 ? void 0 : _this$_destroyCapabil2.resolve();
  9048. return _context12.abrupt("return");
  9049. case 4:
  9050. if (!this._closeCapability) {
  9051. _context12.next = 8;
  9052. break;
  9053. }
  9054. _context12.next = 7;
  9055. return Promise.race([this._closeCapability.promise, new Promise(function (resolve) {
  9056. setTimeout(resolve, 1000);
  9057. })])["catch"](function (reason) {});
  9058. case 7:
  9059. this._closeCapability = null;
  9060. case 8:
  9061. this._pdfDocument = null;
  9062. _context12.prev = 9;
  9063. _context12.next = 12;
  9064. return this._scripting.destroySandbox();
  9065. case 12:
  9066. _context12.next = 16;
  9067. break;
  9068. case 14:
  9069. _context12.prev = 14;
  9070. _context12.t0 = _context12["catch"](9);
  9071. case 16:
  9072. _iterator4 = _createForOfIteratorHelper(this._internalEvents);
  9073. try {
  9074. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  9075. _step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], listener = _step4$value[1];
  9076. this._eventBus._off(name, listener);
  9077. }
  9078. } catch (err) {
  9079. _iterator4.e(err);
  9080. } finally {
  9081. _iterator4.f();
  9082. }
  9083. this._internalEvents.clear();
  9084. _iterator5 = _createForOfIteratorHelper(this._domEvents);
  9085. try {
  9086. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  9087. _step5$value = _slicedToArray(_step5.value, 2), _name2 = _step5$value[0], _listener2 = _step5$value[1];
  9088. window.removeEventListener(_name2, _listener2);
  9089. }
  9090. } catch (err) {
  9091. _iterator5.e(err);
  9092. } finally {
  9093. _iterator5.f();
  9094. }
  9095. this._domEvents.clear();
  9096. this._pageOpenPending.clear();
  9097. this._visitedPages.clear();
  9098. this._scripting = null;
  9099. delete this._mouseState.isDown;
  9100. this._ready = false;
  9101. (_this$_destroyCapabil3 = this._destroyCapability) === null || _this$_destroyCapabil3 === void 0 ? void 0 : _this$_destroyCapabil3.resolve();
  9102. case 28:
  9103. case "end":
  9104. return _context12.stop();
  9105. }
  9106. }
  9107. }, _callee12, this, [[9, 14]]);
  9108. }));
  9109. function _destroyScripting() {
  9110. return _destroyScripting2.apply(this, arguments);
  9111. }
  9112. return _destroyScripting;
  9113. }()
  9114. }]);
  9115. return PDFScriptingManager;
  9116. }();
  9117. exports.PDFScriptingManager = PDFScriptingManager;
  9118. /***/ }),
  9119. /* 26 */
  9120. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  9121. Object.defineProperty(exports, "__esModule", ({
  9122. value: true
  9123. }));
  9124. exports.GenericScripting = void 0;
  9125. exports.docPropertiesLookup = docPropertiesLookup;
  9126. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  9127. var _pdfjsLib = __w_pdfjs_require__(5);
  9128. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  9129. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  9130. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  9131. 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; }
  9132. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9133. 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); } }
  9134. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  9135. 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); } }
  9136. 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); }); }; }
  9137. function docPropertiesLookup(_x) {
  9138. return _docPropertiesLookup.apply(this, arguments);
  9139. }
  9140. function _docPropertiesLookup() {
  9141. _docPropertiesLookup = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(pdfDocument) {
  9142. var url, baseUrl, _yield$pdfDocument$ge, info, metadata, contentDispositionFilename, contentLength, _yield$pdfDocument$ge2, length;
  9143. return _regenerator["default"].wrap(function _callee4$(_context4) {
  9144. while (1) {
  9145. switch (_context4.prev = _context4.next) {
  9146. case 0:
  9147. url = "", baseUrl = url.split("#")[0];
  9148. _context4.next = 3;
  9149. return pdfDocument.getMetadata();
  9150. case 3:
  9151. _yield$pdfDocument$ge = _context4.sent;
  9152. info = _yield$pdfDocument$ge.info;
  9153. metadata = _yield$pdfDocument$ge.metadata;
  9154. contentDispositionFilename = _yield$pdfDocument$ge.contentDispositionFilename;
  9155. contentLength = _yield$pdfDocument$ge.contentLength;
  9156. if (contentLength) {
  9157. _context4.next = 14;
  9158. break;
  9159. }
  9160. _context4.next = 11;
  9161. return pdfDocument.getDownloadInfo();
  9162. case 11:
  9163. _yield$pdfDocument$ge2 = _context4.sent;
  9164. length = _yield$pdfDocument$ge2.length;
  9165. contentLength = length;
  9166. case 14:
  9167. return _context4.abrupt("return", _objectSpread(_objectSpread({}, info), {}, {
  9168. baseURL: baseUrl,
  9169. filesize: contentLength,
  9170. filename: contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(url),
  9171. metadata: metadata === null || metadata === void 0 ? void 0 : metadata.getRaw(),
  9172. authors: metadata === null || metadata === void 0 ? void 0 : metadata.get("dc:creator"),
  9173. numPages: pdfDocument.numPages,
  9174. URL: url
  9175. }));
  9176. case 15:
  9177. case "end":
  9178. return _context4.stop();
  9179. }
  9180. }
  9181. }, _callee4);
  9182. }));
  9183. return _docPropertiesLookup.apply(this, arguments);
  9184. }
  9185. var GenericScripting = /*#__PURE__*/function () {
  9186. function GenericScripting(sandboxBundleSrc) {
  9187. _classCallCheck(this, GenericScripting);
  9188. this._ready = (0, _pdfjsLib.loadScript)(sandboxBundleSrc, true).then(function () {
  9189. return window.pdfjsSandbox.QuickJSSandbox();
  9190. });
  9191. }
  9192. _createClass(GenericScripting, [{
  9193. key: "createSandbox",
  9194. value: function () {
  9195. var _createSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
  9196. var sandbox;
  9197. return _regenerator["default"].wrap(function _callee$(_context) {
  9198. while (1) {
  9199. switch (_context.prev = _context.next) {
  9200. case 0:
  9201. _context.next = 2;
  9202. return this._ready;
  9203. case 2:
  9204. sandbox = _context.sent;
  9205. sandbox.create(data);
  9206. case 4:
  9207. case "end":
  9208. return _context.stop();
  9209. }
  9210. }
  9211. }, _callee, this);
  9212. }));
  9213. function createSandbox(_x2) {
  9214. return _createSandbox.apply(this, arguments);
  9215. }
  9216. return createSandbox;
  9217. }()
  9218. }, {
  9219. key: "dispatchEventInSandbox",
  9220. value: function () {
  9221. var _dispatchEventInSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(event) {
  9222. var sandbox;
  9223. return _regenerator["default"].wrap(function _callee2$(_context2) {
  9224. while (1) {
  9225. switch (_context2.prev = _context2.next) {
  9226. case 0:
  9227. _context2.next = 2;
  9228. return this._ready;
  9229. case 2:
  9230. sandbox = _context2.sent;
  9231. setTimeout(function () {
  9232. return sandbox.dispatchEvent(event);
  9233. }, 0);
  9234. case 4:
  9235. case "end":
  9236. return _context2.stop();
  9237. }
  9238. }
  9239. }, _callee2, this);
  9240. }));
  9241. function dispatchEventInSandbox(_x3) {
  9242. return _dispatchEventInSandbox.apply(this, arguments);
  9243. }
  9244. return dispatchEventInSandbox;
  9245. }()
  9246. }, {
  9247. key: "destroySandbox",
  9248. value: function () {
  9249. var _destroySandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  9250. var sandbox;
  9251. return _regenerator["default"].wrap(function _callee3$(_context3) {
  9252. while (1) {
  9253. switch (_context3.prev = _context3.next) {
  9254. case 0:
  9255. _context3.next = 2;
  9256. return this._ready;
  9257. case 2:
  9258. sandbox = _context3.sent;
  9259. sandbox.nukeSandbox();
  9260. case 4:
  9261. case "end":
  9262. return _context3.stop();
  9263. }
  9264. }
  9265. }, _callee3, this);
  9266. }));
  9267. function destroySandbox() {
  9268. return _destroySandbox.apply(this, arguments);
  9269. }
  9270. return destroySandbox;
  9271. }()
  9272. }]);
  9273. return GenericScripting;
  9274. }();
  9275. exports.GenericScripting = GenericScripting;
  9276. /***/ })
  9277. /******/ ]);
  9278. /************************************************************************/
  9279. /******/ // The module cache
  9280. /******/ var __webpack_module_cache__ = {};
  9281. /******/
  9282. /******/ // The require function
  9283. /******/ function __w_pdfjs_require__(moduleId) {
  9284. /******/ // Check if module is in cache
  9285. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  9286. /******/ if (cachedModule !== undefined) {
  9287. /******/ return cachedModule.exports;
  9288. /******/ }
  9289. /******/ // Create a new module (and put it into the cache)
  9290. /******/ var module = __webpack_module_cache__[moduleId] = {
  9291. /******/ id: moduleId,
  9292. /******/ loaded: false,
  9293. /******/ exports: {}
  9294. /******/ };
  9295. /******/
  9296. /******/ // Execute the module function
  9297. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  9298. /******/
  9299. /******/ // Flag the module as loaded
  9300. /******/ module.loaded = true;
  9301. /******/
  9302. /******/ // Return the exports of the module
  9303. /******/ return module.exports;
  9304. /******/ }
  9305. /******/
  9306. /************************************************************************/
  9307. /******/ /* webpack/runtime/node module decorator */
  9308. /******/ (() => {
  9309. /******/ __w_pdfjs_require__.nmd = (module) => {
  9310. /******/ module.paths = [];
  9311. /******/ if (!module.children) module.children = [];
  9312. /******/ return module;
  9313. /******/ };
  9314. /******/ })();
  9315. /******/
  9316. /************************************************************************/
  9317. var __webpack_exports__ = {};
  9318. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  9319. (() => {
  9320. var exports = __webpack_exports__;
  9321. Object.defineProperty(exports, "__esModule", ({
  9322. value: true
  9323. }));
  9324. Object.defineProperty(exports, "AnnotationLayerBuilder", ({
  9325. enumerable: true,
  9326. get: function get() {
  9327. return _annotation_layer_builder.AnnotationLayerBuilder;
  9328. }
  9329. }));
  9330. Object.defineProperty(exports, "DefaultAnnotationLayerFactory", ({
  9331. enumerable: true,
  9332. get: function get() {
  9333. return _default_factory.DefaultAnnotationLayerFactory;
  9334. }
  9335. }));
  9336. Object.defineProperty(exports, "DefaultStructTreeLayerFactory", ({
  9337. enumerable: true,
  9338. get: function get() {
  9339. return _default_factory.DefaultStructTreeLayerFactory;
  9340. }
  9341. }));
  9342. Object.defineProperty(exports, "DefaultTextLayerFactory", ({
  9343. enumerable: true,
  9344. get: function get() {
  9345. return _default_factory.DefaultTextLayerFactory;
  9346. }
  9347. }));
  9348. Object.defineProperty(exports, "DefaultXfaLayerFactory", ({
  9349. enumerable: true,
  9350. get: function get() {
  9351. return _default_factory.DefaultXfaLayerFactory;
  9352. }
  9353. }));
  9354. Object.defineProperty(exports, "DownloadManager", ({
  9355. enumerable: true,
  9356. get: function get() {
  9357. return _download_manager.DownloadManager;
  9358. }
  9359. }));
  9360. Object.defineProperty(exports, "EventBus", ({
  9361. enumerable: true,
  9362. get: function get() {
  9363. return _event_utils.EventBus;
  9364. }
  9365. }));
  9366. Object.defineProperty(exports, "GenericL10n", ({
  9367. enumerable: true,
  9368. get: function get() {
  9369. return _genericl10n.GenericL10n;
  9370. }
  9371. }));
  9372. Object.defineProperty(exports, "LinkTarget", ({
  9373. enumerable: true,
  9374. get: function get() {
  9375. return _pdf_link_service.LinkTarget;
  9376. }
  9377. }));
  9378. Object.defineProperty(exports, "NullL10n", ({
  9379. enumerable: true,
  9380. get: function get() {
  9381. return _l10n_utils.NullL10n;
  9382. }
  9383. }));
  9384. Object.defineProperty(exports, "PDFFindController", ({
  9385. enumerable: true,
  9386. get: function get() {
  9387. return _pdf_find_controller.PDFFindController;
  9388. }
  9389. }));
  9390. Object.defineProperty(exports, "PDFHistory", ({
  9391. enumerable: true,
  9392. get: function get() {
  9393. return _pdf_history.PDFHistory;
  9394. }
  9395. }));
  9396. Object.defineProperty(exports, "PDFLinkService", ({
  9397. enumerable: true,
  9398. get: function get() {
  9399. return _pdf_link_service.PDFLinkService;
  9400. }
  9401. }));
  9402. Object.defineProperty(exports, "PDFPageView", ({
  9403. enumerable: true,
  9404. get: function get() {
  9405. return _pdf_page_view.PDFPageView;
  9406. }
  9407. }));
  9408. Object.defineProperty(exports, "PDFScriptingManager", ({
  9409. enumerable: true,
  9410. get: function get() {
  9411. return _pdf_scripting_manager.PDFScriptingManager;
  9412. }
  9413. }));
  9414. Object.defineProperty(exports, "PDFSinglePageViewer", ({
  9415. enumerable: true,
  9416. get: function get() {
  9417. return _pdf_viewer.PDFSinglePageViewer;
  9418. }
  9419. }));
  9420. Object.defineProperty(exports, "PDFViewer", ({
  9421. enumerable: true,
  9422. get: function get() {
  9423. return _pdf_viewer.PDFViewer;
  9424. }
  9425. }));
  9426. Object.defineProperty(exports, "ProgressBar", ({
  9427. enumerable: true,
  9428. get: function get() {
  9429. return _ui_utils.ProgressBar;
  9430. }
  9431. }));
  9432. Object.defineProperty(exports, "SimpleLinkService", ({
  9433. enumerable: true,
  9434. get: function get() {
  9435. return _pdf_link_service.SimpleLinkService;
  9436. }
  9437. }));
  9438. Object.defineProperty(exports, "StructTreeLayerBuilder", ({
  9439. enumerable: true,
  9440. get: function get() {
  9441. return _struct_tree_layer_builder.StructTreeLayerBuilder;
  9442. }
  9443. }));
  9444. Object.defineProperty(exports, "TextLayerBuilder", ({
  9445. enumerable: true,
  9446. get: function get() {
  9447. return _text_layer_builder.TextLayerBuilder;
  9448. }
  9449. }));
  9450. Object.defineProperty(exports, "XfaLayerBuilder", ({
  9451. enumerable: true,
  9452. get: function get() {
  9453. return _xfa_layer_builder.XfaLayerBuilder;
  9454. }
  9455. }));
  9456. Object.defineProperty(exports, "parseQueryString", ({
  9457. enumerable: true,
  9458. get: function get() {
  9459. return _ui_utils.parseQueryString;
  9460. }
  9461. }));
  9462. var _default_factory = __w_pdfjs_require__(1);
  9463. var _pdf_link_service = __w_pdfjs_require__(7);
  9464. var _ui_utils = __w_pdfjs_require__(8);
  9465. var _pdf_viewer = __w_pdfjs_require__(12);
  9466. var _annotation_layer_builder = __w_pdfjs_require__(2);
  9467. var _download_manager = __w_pdfjs_require__(18);
  9468. var _event_utils = __w_pdfjs_require__(19);
  9469. var _genericl10n = __w_pdfjs_require__(20);
  9470. var _l10n_utils = __w_pdfjs_require__(6);
  9471. var _pdf_find_controller = __w_pdfjs_require__(22);
  9472. var _pdf_history = __w_pdfjs_require__(24);
  9473. var _pdf_page_view = __w_pdfjs_require__(14);
  9474. var _pdf_scripting_manager = __w_pdfjs_require__(25);
  9475. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  9476. var _text_layer_builder = __w_pdfjs_require__(10);
  9477. var _xfa_layer_builder = __w_pdfjs_require__(11);
  9478. var pdfjsVersion = '2.13.216';
  9479. var pdfjsBuild = '399a0ec60';
  9480. })();
  9481. /******/ return __webpack_exports__;
  9482. /******/ })()
  9483. ;
  9484. });
  9485. //# sourceMappingURL=pdf_viewer.js.map