bootstrap.bundle.js 212 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818
  1. /*!
  2. * Bootstrap v4.2.1 (https://getbootstrap.com/)
  3. * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
  8. typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
  9. (factory((global.bootstrap = {}),global.jQuery));
  10. }(this, (function (exports,$) { 'use strict';
  11. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  12. function _defineProperties(target, props) {
  13. for (var i = 0; i < props.length; i++) {
  14. var descriptor = props[i];
  15. descriptor.enumerable = descriptor.enumerable || false;
  16. descriptor.configurable = true;
  17. if ("value" in descriptor) descriptor.writable = true;
  18. Object.defineProperty(target, descriptor.key, descriptor);
  19. }
  20. }
  21. function _createClass(Constructor, protoProps, staticProps) {
  22. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  23. if (staticProps) _defineProperties(Constructor, staticProps);
  24. return Constructor;
  25. }
  26. function _defineProperty(obj, key, value) {
  27. if (key in obj) {
  28. Object.defineProperty(obj, key, {
  29. value: value,
  30. enumerable: true,
  31. configurable: true,
  32. writable: true
  33. });
  34. } else {
  35. obj[key] = value;
  36. }
  37. return obj;
  38. }
  39. function _objectSpread(target) {
  40. for (var i = 1; i < arguments.length; i++) {
  41. var source = arguments[i] != null ? arguments[i] : {};
  42. var ownKeys = Object.keys(source);
  43. if (typeof Object.getOwnPropertySymbols === 'function') {
  44. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  45. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  46. }));
  47. }
  48. ownKeys.forEach(function (key) {
  49. _defineProperty(target, key, source[key]);
  50. });
  51. }
  52. return target;
  53. }
  54. function _inheritsLoose(subClass, superClass) {
  55. subClass.prototype = Object.create(superClass.prototype);
  56. subClass.prototype.constructor = subClass;
  57. subClass.__proto__ = superClass;
  58. }
  59. /**
  60. * --------------------------------------------------------------------------
  61. * Bootstrap (v4.2.1): util.js
  62. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  63. * --------------------------------------------------------------------------
  64. */
  65. /**
  66. * ------------------------------------------------------------------------
  67. * Private TransitionEnd Helpers
  68. * ------------------------------------------------------------------------
  69. */
  70. var TRANSITION_END = 'transitionend';
  71. var MAX_UID = 1000000;
  72. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  73. function toType(obj) {
  74. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  75. }
  76. function getSpecialTransitionEndEvent() {
  77. return {
  78. bindType: TRANSITION_END,
  79. delegateType: TRANSITION_END,
  80. handle: function handle(event) {
  81. if ($(event.target).is(this)) {
  82. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  83. }
  84. return undefined; // eslint-disable-line no-undefined
  85. }
  86. };
  87. }
  88. function transitionEndEmulator(duration) {
  89. var _this = this;
  90. var called = false;
  91. $(this).one(Util.TRANSITION_END, function () {
  92. called = true;
  93. });
  94. setTimeout(function () {
  95. if (!called) {
  96. Util.triggerTransitionEnd(_this);
  97. }
  98. }, duration);
  99. return this;
  100. }
  101. function setTransitionEndSupport() {
  102. $.fn.emulateTransitionEnd = transitionEndEmulator;
  103. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  104. }
  105. /**
  106. * --------------------------------------------------------------------------
  107. * Public Util Api
  108. * --------------------------------------------------------------------------
  109. */
  110. var Util = {
  111. TRANSITION_END: 'bsTransitionEnd',
  112. getUID: function getUID(prefix) {
  113. do {
  114. // eslint-disable-next-line no-bitwise
  115. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  116. } while (document.getElementById(prefix));
  117. return prefix;
  118. },
  119. getSelectorFromElement: function getSelectorFromElement(element) {
  120. var selector = element.getAttribute('data-target');
  121. if (!selector || selector === '#') {
  122. var hrefAttr = element.getAttribute('href');
  123. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  124. }
  125. return selector && document.querySelector(selector) ? selector : null;
  126. },
  127. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  128. if (!element) {
  129. return 0;
  130. } // Get transition-duration of the element
  131. var transitionDuration = $(element).css('transition-duration');
  132. var transitionDelay = $(element).css('transition-delay');
  133. var floatTransitionDuration = parseFloat(transitionDuration);
  134. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  135. if (!floatTransitionDuration && !floatTransitionDelay) {
  136. return 0;
  137. } // If multiple durations are defined, take the first
  138. transitionDuration = transitionDuration.split(',')[0];
  139. transitionDelay = transitionDelay.split(',')[0];
  140. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  141. },
  142. reflow: function reflow(element) {
  143. return element.offsetHeight;
  144. },
  145. triggerTransitionEnd: function triggerTransitionEnd(element) {
  146. $(element).trigger(TRANSITION_END);
  147. },
  148. // TODO: Remove in v5
  149. supportsTransitionEnd: function supportsTransitionEnd() {
  150. return Boolean(TRANSITION_END);
  151. },
  152. isElement: function isElement(obj) {
  153. return (obj[0] || obj).nodeType;
  154. },
  155. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  156. for (var property in configTypes) {
  157. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  158. var expectedTypes = configTypes[property];
  159. var value = config[property];
  160. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  161. if (!new RegExp(expectedTypes).test(valueType)) {
  162. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  163. }
  164. }
  165. }
  166. },
  167. findShadowRoot: function findShadowRoot(element) {
  168. if (!document.documentElement.attachShadow) {
  169. return null;
  170. } // Can find the shadow root otherwise it'll return the document
  171. if (typeof element.getRootNode === 'function') {
  172. var root = element.getRootNode();
  173. return root instanceof ShadowRoot ? root : null;
  174. }
  175. if (element instanceof ShadowRoot) {
  176. return element;
  177. } // when we don't find a shadow root
  178. if (!element.parentNode) {
  179. return null;
  180. }
  181. return Util.findShadowRoot(element.parentNode);
  182. }
  183. };
  184. setTransitionEndSupport();
  185. /**
  186. * ------------------------------------------------------------------------
  187. * Constants
  188. * ------------------------------------------------------------------------
  189. */
  190. var NAME = 'alert';
  191. var VERSION = '4.2.1';
  192. var DATA_KEY = 'bs.alert';
  193. var EVENT_KEY = "." + DATA_KEY;
  194. var DATA_API_KEY = '.data-api';
  195. var JQUERY_NO_CONFLICT = $.fn[NAME];
  196. var Selector = {
  197. DISMISS: '[data-dismiss="alert"]'
  198. };
  199. var Event = {
  200. CLOSE: "close" + EVENT_KEY,
  201. CLOSED: "closed" + EVENT_KEY,
  202. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  203. };
  204. var ClassName = {
  205. ALERT: 'alert',
  206. FADE: 'fade',
  207. SHOW: 'show'
  208. /**
  209. * ------------------------------------------------------------------------
  210. * Class Definition
  211. * ------------------------------------------------------------------------
  212. */
  213. };
  214. var Alert =
  215. /*#__PURE__*/
  216. function () {
  217. function Alert(element) {
  218. this._element = element;
  219. } // Getters
  220. var _proto = Alert.prototype;
  221. // Public
  222. _proto.close = function close(element) {
  223. var rootElement = this._element;
  224. if (element) {
  225. rootElement = this._getRootElement(element);
  226. }
  227. var customEvent = this._triggerCloseEvent(rootElement);
  228. if (customEvent.isDefaultPrevented()) {
  229. return;
  230. }
  231. this._removeElement(rootElement);
  232. };
  233. _proto.dispose = function dispose() {
  234. $.removeData(this._element, DATA_KEY);
  235. this._element = null;
  236. }; // Private
  237. _proto._getRootElement = function _getRootElement(element) {
  238. var selector = Util.getSelectorFromElement(element);
  239. var parent = false;
  240. if (selector) {
  241. parent = document.querySelector(selector);
  242. }
  243. if (!parent) {
  244. parent = $(element).closest("." + ClassName.ALERT)[0];
  245. }
  246. return parent;
  247. };
  248. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  249. var closeEvent = $.Event(Event.CLOSE);
  250. $(element).trigger(closeEvent);
  251. return closeEvent;
  252. };
  253. _proto._removeElement = function _removeElement(element) {
  254. var _this = this;
  255. $(element).removeClass(ClassName.SHOW);
  256. if (!$(element).hasClass(ClassName.FADE)) {
  257. this._destroyElement(element);
  258. return;
  259. }
  260. var transitionDuration = Util.getTransitionDurationFromElement(element);
  261. $(element).one(Util.TRANSITION_END, function (event) {
  262. return _this._destroyElement(element, event);
  263. }).emulateTransitionEnd(transitionDuration);
  264. };
  265. _proto._destroyElement = function _destroyElement(element) {
  266. $(element).detach().trigger(Event.CLOSED).remove();
  267. }; // Static
  268. Alert._jQueryInterface = function _jQueryInterface(config) {
  269. return this.each(function () {
  270. var $element = $(this);
  271. var data = $element.data(DATA_KEY);
  272. if (!data) {
  273. data = new Alert(this);
  274. $element.data(DATA_KEY, data);
  275. }
  276. if (config === 'close') {
  277. data[config](this);
  278. }
  279. });
  280. };
  281. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  282. return function (event) {
  283. if (event) {
  284. event.preventDefault();
  285. }
  286. alertInstance.close(this);
  287. };
  288. };
  289. _createClass(Alert, null, [{
  290. key: "VERSION",
  291. get: function get() {
  292. return VERSION;
  293. }
  294. }]);
  295. return Alert;
  296. }();
  297. /**
  298. * ------------------------------------------------------------------------
  299. * Data Api implementation
  300. * ------------------------------------------------------------------------
  301. */
  302. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  303. /**
  304. * ------------------------------------------------------------------------
  305. * jQuery
  306. * ------------------------------------------------------------------------
  307. */
  308. $.fn[NAME] = Alert._jQueryInterface;
  309. $.fn[NAME].Constructor = Alert;
  310. $.fn[NAME].noConflict = function () {
  311. $.fn[NAME] = JQUERY_NO_CONFLICT;
  312. return Alert._jQueryInterface;
  313. };
  314. /**
  315. * ------------------------------------------------------------------------
  316. * Constants
  317. * ------------------------------------------------------------------------
  318. */
  319. var NAME$1 = 'button';
  320. var VERSION$1 = '4.2.1';
  321. var DATA_KEY$1 = 'bs.button';
  322. var EVENT_KEY$1 = "." + DATA_KEY$1;
  323. var DATA_API_KEY$1 = '.data-api';
  324. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  325. var ClassName$1 = {
  326. ACTIVE: 'active',
  327. BUTTON: 'btn',
  328. FOCUS: 'focus'
  329. };
  330. var Selector$1 = {
  331. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  332. DATA_TOGGLE: '[data-toggle="buttons"]',
  333. INPUT: 'input:not([type="hidden"])',
  334. ACTIVE: '.active',
  335. BUTTON: '.btn'
  336. };
  337. var Event$1 = {
  338. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  339. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1)
  340. /**
  341. * ------------------------------------------------------------------------
  342. * Class Definition
  343. * ------------------------------------------------------------------------
  344. */
  345. };
  346. var Button =
  347. /*#__PURE__*/
  348. function () {
  349. function Button(element) {
  350. this._element = element;
  351. } // Getters
  352. var _proto = Button.prototype;
  353. // Public
  354. _proto.toggle = function toggle() {
  355. var triggerChangeEvent = true;
  356. var addAriaPressed = true;
  357. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0];
  358. if (rootElement) {
  359. var input = this._element.querySelector(Selector$1.INPUT);
  360. if (input) {
  361. if (input.type === 'radio') {
  362. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  363. triggerChangeEvent = false;
  364. } else {
  365. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  366. if (activeElement) {
  367. $(activeElement).removeClass(ClassName$1.ACTIVE);
  368. }
  369. }
  370. }
  371. if (triggerChangeEvent) {
  372. if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
  373. return;
  374. }
  375. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  376. $(input).trigger('change');
  377. }
  378. input.focus();
  379. addAriaPressed = false;
  380. }
  381. }
  382. if (addAriaPressed) {
  383. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  384. }
  385. if (triggerChangeEvent) {
  386. $(this._element).toggleClass(ClassName$1.ACTIVE);
  387. }
  388. };
  389. _proto.dispose = function dispose() {
  390. $.removeData(this._element, DATA_KEY$1);
  391. this._element = null;
  392. }; // Static
  393. Button._jQueryInterface = function _jQueryInterface(config) {
  394. return this.each(function () {
  395. var data = $(this).data(DATA_KEY$1);
  396. if (!data) {
  397. data = new Button(this);
  398. $(this).data(DATA_KEY$1, data);
  399. }
  400. if (config === 'toggle') {
  401. data[config]();
  402. }
  403. });
  404. };
  405. _createClass(Button, null, [{
  406. key: "VERSION",
  407. get: function get() {
  408. return VERSION$1;
  409. }
  410. }]);
  411. return Button;
  412. }();
  413. /**
  414. * ------------------------------------------------------------------------
  415. * Data Api implementation
  416. * ------------------------------------------------------------------------
  417. */
  418. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  419. event.preventDefault();
  420. var button = event.target;
  421. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  422. button = $(button).closest(Selector$1.BUTTON);
  423. }
  424. Button._jQueryInterface.call($(button), 'toggle');
  425. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  426. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  427. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  428. });
  429. /**
  430. * ------------------------------------------------------------------------
  431. * jQuery
  432. * ------------------------------------------------------------------------
  433. */
  434. $.fn[NAME$1] = Button._jQueryInterface;
  435. $.fn[NAME$1].Constructor = Button;
  436. $.fn[NAME$1].noConflict = function () {
  437. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  438. return Button._jQueryInterface;
  439. };
  440. /**
  441. * ------------------------------------------------------------------------
  442. * Constants
  443. * ------------------------------------------------------------------------
  444. */
  445. var NAME$2 = 'carousel';
  446. var VERSION$2 = '4.2.1';
  447. var DATA_KEY$2 = 'bs.carousel';
  448. var EVENT_KEY$2 = "." + DATA_KEY$2;
  449. var DATA_API_KEY$2 = '.data-api';
  450. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  451. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  452. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  453. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  454. var SWIPE_THRESHOLD = 40;
  455. var Default = {
  456. interval: 5000,
  457. keyboard: true,
  458. slide: false,
  459. pause: 'hover',
  460. wrap: true,
  461. touch: true
  462. };
  463. var DefaultType = {
  464. interval: '(number|boolean)',
  465. keyboard: 'boolean',
  466. slide: '(boolean|string)',
  467. pause: '(string|boolean)',
  468. wrap: 'boolean',
  469. touch: 'boolean'
  470. };
  471. var Direction = {
  472. NEXT: 'next',
  473. PREV: 'prev',
  474. LEFT: 'left',
  475. RIGHT: 'right'
  476. };
  477. var Event$2 = {
  478. SLIDE: "slide" + EVENT_KEY$2,
  479. SLID: "slid" + EVENT_KEY$2,
  480. KEYDOWN: "keydown" + EVENT_KEY$2,
  481. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  482. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  483. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  484. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  485. TOUCHEND: "touchend" + EVENT_KEY$2,
  486. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  487. POINTERUP: "pointerup" + EVENT_KEY$2,
  488. DRAG_START: "dragstart" + EVENT_KEY$2,
  489. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  490. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  491. };
  492. var ClassName$2 = {
  493. CAROUSEL: 'carousel',
  494. ACTIVE: 'active',
  495. SLIDE: 'slide',
  496. RIGHT: 'carousel-item-right',
  497. LEFT: 'carousel-item-left',
  498. NEXT: 'carousel-item-next',
  499. PREV: 'carousel-item-prev',
  500. ITEM: 'carousel-item',
  501. POINTER_EVENT: 'pointer-event'
  502. };
  503. var Selector$2 = {
  504. ACTIVE: '.active',
  505. ACTIVE_ITEM: '.active.carousel-item',
  506. ITEM: '.carousel-item',
  507. ITEM_IMG: '.carousel-item img',
  508. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  509. INDICATORS: '.carousel-indicators',
  510. DATA_SLIDE: '[data-slide], [data-slide-to]',
  511. DATA_RIDE: '[data-ride="carousel"]'
  512. };
  513. var PointerType = {
  514. TOUCH: 'touch',
  515. PEN: 'pen'
  516. /**
  517. * ------------------------------------------------------------------------
  518. * Class Definition
  519. * ------------------------------------------------------------------------
  520. */
  521. };
  522. var Carousel =
  523. /*#__PURE__*/
  524. function () {
  525. function Carousel(element, config) {
  526. this._items = null;
  527. this._interval = null;
  528. this._activeElement = null;
  529. this._isPaused = false;
  530. this._isSliding = false;
  531. this.touchTimeout = null;
  532. this.touchStartX = 0;
  533. this.touchDeltaX = 0;
  534. this._config = this._getConfig(config);
  535. this._element = element;
  536. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  537. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  538. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  539. this._addEventListeners();
  540. } // Getters
  541. var _proto = Carousel.prototype;
  542. // Public
  543. _proto.next = function next() {
  544. if (!this._isSliding) {
  545. this._slide(Direction.NEXT);
  546. }
  547. };
  548. _proto.nextWhenVisible = function nextWhenVisible() {
  549. // Don't call next when the page isn't visible
  550. // or the carousel or its parent isn't visible
  551. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  552. this.next();
  553. }
  554. };
  555. _proto.prev = function prev() {
  556. if (!this._isSliding) {
  557. this._slide(Direction.PREV);
  558. }
  559. };
  560. _proto.pause = function pause(event) {
  561. if (!event) {
  562. this._isPaused = true;
  563. }
  564. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  565. Util.triggerTransitionEnd(this._element);
  566. this.cycle(true);
  567. }
  568. clearInterval(this._interval);
  569. this._interval = null;
  570. };
  571. _proto.cycle = function cycle(event) {
  572. if (!event) {
  573. this._isPaused = false;
  574. }
  575. if (this._interval) {
  576. clearInterval(this._interval);
  577. this._interval = null;
  578. }
  579. if (this._config.interval && !this._isPaused) {
  580. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  581. }
  582. };
  583. _proto.to = function to(index) {
  584. var _this = this;
  585. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  586. var activeIndex = this._getItemIndex(this._activeElement);
  587. if (index > this._items.length - 1 || index < 0) {
  588. return;
  589. }
  590. if (this._isSliding) {
  591. $(this._element).one(Event$2.SLID, function () {
  592. return _this.to(index);
  593. });
  594. return;
  595. }
  596. if (activeIndex === index) {
  597. this.pause();
  598. this.cycle();
  599. return;
  600. }
  601. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  602. this._slide(direction, this._items[index]);
  603. };
  604. _proto.dispose = function dispose() {
  605. $(this._element).off(EVENT_KEY$2);
  606. $.removeData(this._element, DATA_KEY$2);
  607. this._items = null;
  608. this._config = null;
  609. this._element = null;
  610. this._interval = null;
  611. this._isPaused = null;
  612. this._isSliding = null;
  613. this._activeElement = null;
  614. this._indicatorsElement = null;
  615. }; // Private
  616. _proto._getConfig = function _getConfig(config) {
  617. config = _objectSpread({}, Default, config);
  618. Util.typeCheckConfig(NAME$2, config, DefaultType);
  619. return config;
  620. };
  621. _proto._handleSwipe = function _handleSwipe() {
  622. var absDeltax = Math.abs(this.touchDeltaX);
  623. if (absDeltax <= SWIPE_THRESHOLD) {
  624. return;
  625. }
  626. var direction = absDeltax / this.touchDeltaX; // swipe left
  627. if (direction > 0) {
  628. this.prev();
  629. } // swipe right
  630. if (direction < 0) {
  631. this.next();
  632. }
  633. };
  634. _proto._addEventListeners = function _addEventListeners() {
  635. var _this2 = this;
  636. if (this._config.keyboard) {
  637. $(this._element).on(Event$2.KEYDOWN, function (event) {
  638. return _this2._keydown(event);
  639. });
  640. }
  641. if (this._config.pause === 'hover') {
  642. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  643. return _this2.pause(event);
  644. }).on(Event$2.MOUSELEAVE, function (event) {
  645. return _this2.cycle(event);
  646. });
  647. }
  648. this._addTouchEventListeners();
  649. };
  650. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  651. var _this3 = this;
  652. if (!this._touchSupported) {
  653. return;
  654. }
  655. var start = function start(event) {
  656. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  657. _this3.touchStartX = event.originalEvent.clientX;
  658. } else if (!_this3._pointerEvent) {
  659. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  660. }
  661. };
  662. var move = function move(event) {
  663. // ensure swiping with one touch and not pinching
  664. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  665. _this3.touchDeltaX = 0;
  666. } else {
  667. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  668. }
  669. };
  670. var end = function end(event) {
  671. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  672. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  673. }
  674. _this3._handleSwipe();
  675. if (_this3._config.pause === 'hover') {
  676. // If it's a touch-enabled device, mouseenter/leave are fired as
  677. // part of the mouse compatibility events on first tap - the carousel
  678. // would stop cycling until user tapped out of it;
  679. // here, we listen for touchend, explicitly pause the carousel
  680. // (as if it's the second time we tap on it, mouseenter compat event
  681. // is NOT fired) and after a timeout (to allow for mouse compatibility
  682. // events to fire) we explicitly restart cycling
  683. _this3.pause();
  684. if (_this3.touchTimeout) {
  685. clearTimeout(_this3.touchTimeout);
  686. }
  687. _this3.touchTimeout = setTimeout(function (event) {
  688. return _this3.cycle(event);
  689. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  690. }
  691. };
  692. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  693. return e.preventDefault();
  694. });
  695. if (this._pointerEvent) {
  696. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  697. return start(event);
  698. });
  699. $(this._element).on(Event$2.POINTERUP, function (event) {
  700. return end(event);
  701. });
  702. this._element.classList.add(ClassName$2.POINTER_EVENT);
  703. } else {
  704. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  705. return start(event);
  706. });
  707. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  708. return move(event);
  709. });
  710. $(this._element).on(Event$2.TOUCHEND, function (event) {
  711. return end(event);
  712. });
  713. }
  714. };
  715. _proto._keydown = function _keydown(event) {
  716. if (/input|textarea/i.test(event.target.tagName)) {
  717. return;
  718. }
  719. switch (event.which) {
  720. case ARROW_LEFT_KEYCODE:
  721. event.preventDefault();
  722. this.prev();
  723. break;
  724. case ARROW_RIGHT_KEYCODE:
  725. event.preventDefault();
  726. this.next();
  727. break;
  728. default:
  729. }
  730. };
  731. _proto._getItemIndex = function _getItemIndex(element) {
  732. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  733. return this._items.indexOf(element);
  734. };
  735. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  736. var isNextDirection = direction === Direction.NEXT;
  737. var isPrevDirection = direction === Direction.PREV;
  738. var activeIndex = this._getItemIndex(activeElement);
  739. var lastItemIndex = this._items.length - 1;
  740. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  741. if (isGoingToWrap && !this._config.wrap) {
  742. return activeElement;
  743. }
  744. var delta = direction === Direction.PREV ? -1 : 1;
  745. var itemIndex = (activeIndex + delta) % this._items.length;
  746. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  747. };
  748. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  749. var targetIndex = this._getItemIndex(relatedTarget);
  750. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  751. var slideEvent = $.Event(Event$2.SLIDE, {
  752. relatedTarget: relatedTarget,
  753. direction: eventDirectionName,
  754. from: fromIndex,
  755. to: targetIndex
  756. });
  757. $(this._element).trigger(slideEvent);
  758. return slideEvent;
  759. };
  760. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  761. if (this._indicatorsElement) {
  762. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  763. $(indicators).removeClass(ClassName$2.ACTIVE);
  764. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  765. if (nextIndicator) {
  766. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  767. }
  768. }
  769. };
  770. _proto._slide = function _slide(direction, element) {
  771. var _this4 = this;
  772. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  773. var activeElementIndex = this._getItemIndex(activeElement);
  774. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  775. var nextElementIndex = this._getItemIndex(nextElement);
  776. var isCycling = Boolean(this._interval);
  777. var directionalClassName;
  778. var orderClassName;
  779. var eventDirectionName;
  780. if (direction === Direction.NEXT) {
  781. directionalClassName = ClassName$2.LEFT;
  782. orderClassName = ClassName$2.NEXT;
  783. eventDirectionName = Direction.LEFT;
  784. } else {
  785. directionalClassName = ClassName$2.RIGHT;
  786. orderClassName = ClassName$2.PREV;
  787. eventDirectionName = Direction.RIGHT;
  788. }
  789. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  790. this._isSliding = false;
  791. return;
  792. }
  793. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  794. if (slideEvent.isDefaultPrevented()) {
  795. return;
  796. }
  797. if (!activeElement || !nextElement) {
  798. // Some weirdness is happening, so we bail
  799. return;
  800. }
  801. this._isSliding = true;
  802. if (isCycling) {
  803. this.pause();
  804. }
  805. this._setActiveIndicatorElement(nextElement);
  806. var slidEvent = $.Event(Event$2.SLID, {
  807. relatedTarget: nextElement,
  808. direction: eventDirectionName,
  809. from: activeElementIndex,
  810. to: nextElementIndex
  811. });
  812. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  813. $(nextElement).addClass(orderClassName);
  814. Util.reflow(nextElement);
  815. $(activeElement).addClass(directionalClassName);
  816. $(nextElement).addClass(directionalClassName);
  817. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  818. if (nextElementInterval) {
  819. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  820. this._config.interval = nextElementInterval;
  821. } else {
  822. this._config.interval = this._config.defaultInterval || this._config.interval;
  823. }
  824. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  825. $(activeElement).one(Util.TRANSITION_END, function () {
  826. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  827. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  828. _this4._isSliding = false;
  829. setTimeout(function () {
  830. return $(_this4._element).trigger(slidEvent);
  831. }, 0);
  832. }).emulateTransitionEnd(transitionDuration);
  833. } else {
  834. $(activeElement).removeClass(ClassName$2.ACTIVE);
  835. $(nextElement).addClass(ClassName$2.ACTIVE);
  836. this._isSliding = false;
  837. $(this._element).trigger(slidEvent);
  838. }
  839. if (isCycling) {
  840. this.cycle();
  841. }
  842. }; // Static
  843. Carousel._jQueryInterface = function _jQueryInterface(config) {
  844. return this.each(function () {
  845. var data = $(this).data(DATA_KEY$2);
  846. var _config = _objectSpread({}, Default, $(this).data());
  847. if (typeof config === 'object') {
  848. _config = _objectSpread({}, _config, config);
  849. }
  850. var action = typeof config === 'string' ? config : _config.slide;
  851. if (!data) {
  852. data = new Carousel(this, _config);
  853. $(this).data(DATA_KEY$2, data);
  854. }
  855. if (typeof config === 'number') {
  856. data.to(config);
  857. } else if (typeof action === 'string') {
  858. if (typeof data[action] === 'undefined') {
  859. throw new TypeError("No method named \"" + action + "\"");
  860. }
  861. data[action]();
  862. } else if (_config.interval) {
  863. data.pause();
  864. data.cycle();
  865. }
  866. });
  867. };
  868. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  869. var selector = Util.getSelectorFromElement(this);
  870. if (!selector) {
  871. return;
  872. }
  873. var target = $(selector)[0];
  874. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  875. return;
  876. }
  877. var config = _objectSpread({}, $(target).data(), $(this).data());
  878. var slideIndex = this.getAttribute('data-slide-to');
  879. if (slideIndex) {
  880. config.interval = false;
  881. }
  882. Carousel._jQueryInterface.call($(target), config);
  883. if (slideIndex) {
  884. $(target).data(DATA_KEY$2).to(slideIndex);
  885. }
  886. event.preventDefault();
  887. };
  888. _createClass(Carousel, null, [{
  889. key: "VERSION",
  890. get: function get() {
  891. return VERSION$2;
  892. }
  893. }, {
  894. key: "Default",
  895. get: function get() {
  896. return Default;
  897. }
  898. }]);
  899. return Carousel;
  900. }();
  901. /**
  902. * ------------------------------------------------------------------------
  903. * Data Api implementation
  904. * ------------------------------------------------------------------------
  905. */
  906. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  907. $(window).on(Event$2.LOAD_DATA_API, function () {
  908. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  909. for (var i = 0, len = carousels.length; i < len; i++) {
  910. var $carousel = $(carousels[i]);
  911. Carousel._jQueryInterface.call($carousel, $carousel.data());
  912. }
  913. });
  914. /**
  915. * ------------------------------------------------------------------------
  916. * jQuery
  917. * ------------------------------------------------------------------------
  918. */
  919. $.fn[NAME$2] = Carousel._jQueryInterface;
  920. $.fn[NAME$2].Constructor = Carousel;
  921. $.fn[NAME$2].noConflict = function () {
  922. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  923. return Carousel._jQueryInterface;
  924. };
  925. /**
  926. * ------------------------------------------------------------------------
  927. * Constants
  928. * ------------------------------------------------------------------------
  929. */
  930. var NAME$3 = 'collapse';
  931. var VERSION$3 = '4.2.1';
  932. var DATA_KEY$3 = 'bs.collapse';
  933. var EVENT_KEY$3 = "." + DATA_KEY$3;
  934. var DATA_API_KEY$3 = '.data-api';
  935. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  936. var Default$1 = {
  937. toggle: true,
  938. parent: ''
  939. };
  940. var DefaultType$1 = {
  941. toggle: 'boolean',
  942. parent: '(string|element)'
  943. };
  944. var Event$3 = {
  945. SHOW: "show" + EVENT_KEY$3,
  946. SHOWN: "shown" + EVENT_KEY$3,
  947. HIDE: "hide" + EVENT_KEY$3,
  948. HIDDEN: "hidden" + EVENT_KEY$3,
  949. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  950. };
  951. var ClassName$3 = {
  952. SHOW: 'show',
  953. COLLAPSE: 'collapse',
  954. COLLAPSING: 'collapsing',
  955. COLLAPSED: 'collapsed'
  956. };
  957. var Dimension = {
  958. WIDTH: 'width',
  959. HEIGHT: 'height'
  960. };
  961. var Selector$3 = {
  962. ACTIVES: '.show, .collapsing',
  963. DATA_TOGGLE: '[data-toggle="collapse"]'
  964. /**
  965. * ------------------------------------------------------------------------
  966. * Class Definition
  967. * ------------------------------------------------------------------------
  968. */
  969. };
  970. var Collapse =
  971. /*#__PURE__*/
  972. function () {
  973. function Collapse(element, config) {
  974. this._isTransitioning = false;
  975. this._element = element;
  976. this._config = this._getConfig(config);
  977. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  978. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  979. for (var i = 0, len = toggleList.length; i < len; i++) {
  980. var elem = toggleList[i];
  981. var selector = Util.getSelectorFromElement(elem);
  982. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  983. return foundElem === element;
  984. });
  985. if (selector !== null && filterElement.length > 0) {
  986. this._selector = selector;
  987. this._triggerArray.push(elem);
  988. }
  989. }
  990. this._parent = this._config.parent ? this._getParent() : null;
  991. if (!this._config.parent) {
  992. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  993. }
  994. if (this._config.toggle) {
  995. this.toggle();
  996. }
  997. } // Getters
  998. var _proto = Collapse.prototype;
  999. // Public
  1000. _proto.toggle = function toggle() {
  1001. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  1002. this.hide();
  1003. } else {
  1004. this.show();
  1005. }
  1006. };
  1007. _proto.show = function show() {
  1008. var _this = this;
  1009. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  1010. return;
  1011. }
  1012. var actives;
  1013. var activesData;
  1014. if (this._parent) {
  1015. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  1016. if (typeof _this._config.parent === 'string') {
  1017. return elem.getAttribute('data-parent') === _this._config.parent;
  1018. }
  1019. return elem.classList.contains(ClassName$3.COLLAPSE);
  1020. });
  1021. if (actives.length === 0) {
  1022. actives = null;
  1023. }
  1024. }
  1025. if (actives) {
  1026. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  1027. if (activesData && activesData._isTransitioning) {
  1028. return;
  1029. }
  1030. }
  1031. var startEvent = $.Event(Event$3.SHOW);
  1032. $(this._element).trigger(startEvent);
  1033. if (startEvent.isDefaultPrevented()) {
  1034. return;
  1035. }
  1036. if (actives) {
  1037. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  1038. if (!activesData) {
  1039. $(actives).data(DATA_KEY$3, null);
  1040. }
  1041. }
  1042. var dimension = this._getDimension();
  1043. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  1044. this._element.style[dimension] = 0;
  1045. if (this._triggerArray.length) {
  1046. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  1047. }
  1048. this.setTransitioning(true);
  1049. var complete = function complete() {
  1050. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  1051. _this._element.style[dimension] = '';
  1052. _this.setTransitioning(false);
  1053. $(_this._element).trigger(Event$3.SHOWN);
  1054. };
  1055. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1056. var scrollSize = "scroll" + capitalizedDimension;
  1057. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1058. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1059. this._element.style[dimension] = this._element[scrollSize] + "px";
  1060. };
  1061. _proto.hide = function hide() {
  1062. var _this2 = this;
  1063. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  1064. return;
  1065. }
  1066. var startEvent = $.Event(Event$3.HIDE);
  1067. $(this._element).trigger(startEvent);
  1068. if (startEvent.isDefaultPrevented()) {
  1069. return;
  1070. }
  1071. var dimension = this._getDimension();
  1072. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  1073. Util.reflow(this._element);
  1074. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  1075. var triggerArrayLength = this._triggerArray.length;
  1076. if (triggerArrayLength > 0) {
  1077. for (var i = 0; i < triggerArrayLength; i++) {
  1078. var trigger = this._triggerArray[i];
  1079. var selector = Util.getSelectorFromElement(trigger);
  1080. if (selector !== null) {
  1081. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  1082. if (!$elem.hasClass(ClassName$3.SHOW)) {
  1083. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  1084. }
  1085. }
  1086. }
  1087. }
  1088. this.setTransitioning(true);
  1089. var complete = function complete() {
  1090. _this2.setTransitioning(false);
  1091. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  1092. };
  1093. this._element.style[dimension] = '';
  1094. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1095. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1096. };
  1097. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  1098. this._isTransitioning = isTransitioning;
  1099. };
  1100. _proto.dispose = function dispose() {
  1101. $.removeData(this._element, DATA_KEY$3);
  1102. this._config = null;
  1103. this._parent = null;
  1104. this._element = null;
  1105. this._triggerArray = null;
  1106. this._isTransitioning = null;
  1107. }; // Private
  1108. _proto._getConfig = function _getConfig(config) {
  1109. config = _objectSpread({}, Default$1, config);
  1110. config.toggle = Boolean(config.toggle); // Coerce string values
  1111. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  1112. return config;
  1113. };
  1114. _proto._getDimension = function _getDimension() {
  1115. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  1116. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  1117. };
  1118. _proto._getParent = function _getParent() {
  1119. var _this3 = this;
  1120. var parent;
  1121. if (Util.isElement(this._config.parent)) {
  1122. parent = this._config.parent; // It's a jQuery object
  1123. if (typeof this._config.parent.jquery !== 'undefined') {
  1124. parent = this._config.parent[0];
  1125. }
  1126. } else {
  1127. parent = document.querySelector(this._config.parent);
  1128. }
  1129. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  1130. var children = [].slice.call(parent.querySelectorAll(selector));
  1131. $(children).each(function (i, element) {
  1132. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  1133. });
  1134. return parent;
  1135. };
  1136. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  1137. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  1138. if (triggerArray.length) {
  1139. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  1140. }
  1141. }; // Static
  1142. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  1143. var selector = Util.getSelectorFromElement(element);
  1144. return selector ? document.querySelector(selector) : null;
  1145. };
  1146. Collapse._jQueryInterface = function _jQueryInterface(config) {
  1147. return this.each(function () {
  1148. var $this = $(this);
  1149. var data = $this.data(DATA_KEY$3);
  1150. var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
  1151. if (!data && _config.toggle && /show|hide/.test(config)) {
  1152. _config.toggle = false;
  1153. }
  1154. if (!data) {
  1155. data = new Collapse(this, _config);
  1156. $this.data(DATA_KEY$3, data);
  1157. }
  1158. if (typeof config === 'string') {
  1159. if (typeof data[config] === 'undefined') {
  1160. throw new TypeError("No method named \"" + config + "\"");
  1161. }
  1162. data[config]();
  1163. }
  1164. });
  1165. };
  1166. _createClass(Collapse, null, [{
  1167. key: "VERSION",
  1168. get: function get() {
  1169. return VERSION$3;
  1170. }
  1171. }, {
  1172. key: "Default",
  1173. get: function get() {
  1174. return Default$1;
  1175. }
  1176. }]);
  1177. return Collapse;
  1178. }();
  1179. /**
  1180. * ------------------------------------------------------------------------
  1181. * Data Api implementation
  1182. * ------------------------------------------------------------------------
  1183. */
  1184. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  1185. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1186. if (event.currentTarget.tagName === 'A') {
  1187. event.preventDefault();
  1188. }
  1189. var $trigger = $(this);
  1190. var selector = Util.getSelectorFromElement(this);
  1191. var selectors = [].slice.call(document.querySelectorAll(selector));
  1192. $(selectors).each(function () {
  1193. var $target = $(this);
  1194. var data = $target.data(DATA_KEY$3);
  1195. var config = data ? 'toggle' : $trigger.data();
  1196. Collapse._jQueryInterface.call($target, config);
  1197. });
  1198. });
  1199. /**
  1200. * ------------------------------------------------------------------------
  1201. * jQuery
  1202. * ------------------------------------------------------------------------
  1203. */
  1204. $.fn[NAME$3] = Collapse._jQueryInterface;
  1205. $.fn[NAME$3].Constructor = Collapse;
  1206. $.fn[NAME$3].noConflict = function () {
  1207. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  1208. return Collapse._jQueryInterface;
  1209. };
  1210. /**!
  1211. * @fileOverview Kickass library to create and place poppers near their reference elements.
  1212. * @version 1.14.6
  1213. * @license
  1214. * Copyright (c) 2016 Federico Zivolo and contributors
  1215. *
  1216. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1217. * of this software and associated documentation files (the "Software"), to deal
  1218. * in the Software without restriction, including without limitation the rights
  1219. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1220. * copies of the Software, and to permit persons to whom the Software is
  1221. * furnished to do so, subject to the following conditions:
  1222. *
  1223. * The above copyright notice and this permission notice shall be included in all
  1224. * copies or substantial portions of the Software.
  1225. *
  1226. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1227. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1228. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1229. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1230. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1231. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  1232. * SOFTWARE.
  1233. */
  1234. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
  1235. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  1236. var timeoutDuration = 0;
  1237. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  1238. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  1239. timeoutDuration = 1;
  1240. break;
  1241. }
  1242. }
  1243. function microtaskDebounce(fn) {
  1244. var called = false;
  1245. return function () {
  1246. if (called) {
  1247. return;
  1248. }
  1249. called = true;
  1250. window.Promise.resolve().then(function () {
  1251. called = false;
  1252. fn();
  1253. });
  1254. };
  1255. }
  1256. function taskDebounce(fn) {
  1257. var scheduled = false;
  1258. return function () {
  1259. if (!scheduled) {
  1260. scheduled = true;
  1261. setTimeout(function () {
  1262. scheduled = false;
  1263. fn();
  1264. }, timeoutDuration);
  1265. }
  1266. };
  1267. }
  1268. var supportsMicroTasks = isBrowser && window.Promise;
  1269. /**
  1270. * Create a debounced version of a method, that's asynchronously deferred
  1271. * but called in the minimum time possible.
  1272. *
  1273. * @method
  1274. * @memberof Popper.Utils
  1275. * @argument {Function} fn
  1276. * @returns {Function}
  1277. */
  1278. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  1279. /**
  1280. * Check if the given variable is a function
  1281. * @method
  1282. * @memberof Popper.Utils
  1283. * @argument {Any} functionToCheck - variable to check
  1284. * @returns {Boolean} answer to: is a function?
  1285. */
  1286. function isFunction(functionToCheck) {
  1287. var getType = {};
  1288. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  1289. }
  1290. /**
  1291. * Get CSS computed property of the given element
  1292. * @method
  1293. * @memberof Popper.Utils
  1294. * @argument {Eement} element
  1295. * @argument {String} property
  1296. */
  1297. function getStyleComputedProperty(element, property) {
  1298. if (element.nodeType !== 1) {
  1299. return [];
  1300. }
  1301. // NOTE: 1 DOM access here
  1302. var window = element.ownerDocument.defaultView;
  1303. var css = window.getComputedStyle(element, null);
  1304. return property ? css[property] : css;
  1305. }
  1306. /**
  1307. * Returns the parentNode or the host of the element
  1308. * @method
  1309. * @memberof Popper.Utils
  1310. * @argument {Element} element
  1311. * @returns {Element} parent
  1312. */
  1313. function getParentNode(element) {
  1314. if (element.nodeName === 'HTML') {
  1315. return element;
  1316. }
  1317. return element.parentNode || element.host;
  1318. }
  1319. /**
  1320. * Returns the scrolling parent of the given element
  1321. * @method
  1322. * @memberof Popper.Utils
  1323. * @argument {Element} element
  1324. * @returns {Element} scroll parent
  1325. */
  1326. function getScrollParent(element) {
  1327. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  1328. if (!element) {
  1329. return document.body;
  1330. }
  1331. switch (element.nodeName) {
  1332. case 'HTML':
  1333. case 'BODY':
  1334. return element.ownerDocument.body;
  1335. case '#document':
  1336. return element.body;
  1337. }
  1338. // Firefox want us to check `-x` and `-y` variations as well
  1339. var _getStyleComputedProp = getStyleComputedProperty(element),
  1340. overflow = _getStyleComputedProp.overflow,
  1341. overflowX = _getStyleComputedProp.overflowX,
  1342. overflowY = _getStyleComputedProp.overflowY;
  1343. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  1344. return element;
  1345. }
  1346. return getScrollParent(getParentNode(element));
  1347. }
  1348. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  1349. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  1350. /**
  1351. * Determines if the browser is Internet Explorer
  1352. * @method
  1353. * @memberof Popper.Utils
  1354. * @param {Number} version to check
  1355. * @returns {Boolean} isIE
  1356. */
  1357. function isIE(version) {
  1358. if (version === 11) {
  1359. return isIE11;
  1360. }
  1361. if (version === 10) {
  1362. return isIE10;
  1363. }
  1364. return isIE11 || isIE10;
  1365. }
  1366. /**
  1367. * Returns the offset parent of the given element
  1368. * @method
  1369. * @memberof Popper.Utils
  1370. * @argument {Element} element
  1371. * @returns {Element} offset parent
  1372. */
  1373. function getOffsetParent(element) {
  1374. if (!element) {
  1375. return document.documentElement;
  1376. }
  1377. var noOffsetParent = isIE(10) ? document.body : null;
  1378. // NOTE: 1 DOM access here
  1379. var offsetParent = element.offsetParent || null;
  1380. // Skip hidden elements which don't have an offsetParent
  1381. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  1382. offsetParent = (element = element.nextElementSibling).offsetParent;
  1383. }
  1384. var nodeName = offsetParent && offsetParent.nodeName;
  1385. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  1386. return element ? element.ownerDocument.documentElement : document.documentElement;
  1387. }
  1388. // .offsetParent will return the closest TH, TD or TABLE in case
  1389. // no offsetParent is present, I hate this job...
  1390. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  1391. return getOffsetParent(offsetParent);
  1392. }
  1393. return offsetParent;
  1394. }
  1395. function isOffsetContainer(element) {
  1396. var nodeName = element.nodeName;
  1397. if (nodeName === 'BODY') {
  1398. return false;
  1399. }
  1400. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  1401. }
  1402. /**
  1403. * Finds the root node (document, shadowDOM root) of the given element
  1404. * @method
  1405. * @memberof Popper.Utils
  1406. * @argument {Element} node
  1407. * @returns {Element} root node
  1408. */
  1409. function getRoot(node) {
  1410. if (node.parentNode !== null) {
  1411. return getRoot(node.parentNode);
  1412. }
  1413. return node;
  1414. }
  1415. /**
  1416. * Finds the offset parent common to the two provided nodes
  1417. * @method
  1418. * @memberof Popper.Utils
  1419. * @argument {Element} element1
  1420. * @argument {Element} element2
  1421. * @returns {Element} common offset parent
  1422. */
  1423. function findCommonOffsetParent(element1, element2) {
  1424. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  1425. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  1426. return document.documentElement;
  1427. }
  1428. // Here we make sure to give as "start" the element that comes first in the DOM
  1429. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  1430. var start = order ? element1 : element2;
  1431. var end = order ? element2 : element1;
  1432. // Get common ancestor container
  1433. var range = document.createRange();
  1434. range.setStart(start, 0);
  1435. range.setEnd(end, 0);
  1436. var commonAncestorContainer = range.commonAncestorContainer;
  1437. // Both nodes are inside #document
  1438. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  1439. if (isOffsetContainer(commonAncestorContainer)) {
  1440. return commonAncestorContainer;
  1441. }
  1442. return getOffsetParent(commonAncestorContainer);
  1443. }
  1444. // one of the nodes is inside shadowDOM, find which one
  1445. var element1root = getRoot(element1);
  1446. if (element1root.host) {
  1447. return findCommonOffsetParent(element1root.host, element2);
  1448. } else {
  1449. return findCommonOffsetParent(element1, getRoot(element2).host);
  1450. }
  1451. }
  1452. /**
  1453. * Gets the scroll value of the given element in the given side (top and left)
  1454. * @method
  1455. * @memberof Popper.Utils
  1456. * @argument {Element} element
  1457. * @argument {String} side `top` or `left`
  1458. * @returns {number} amount of scrolled pixels
  1459. */
  1460. function getScroll(element) {
  1461. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  1462. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  1463. var nodeName = element.nodeName;
  1464. if (nodeName === 'BODY' || nodeName === 'HTML') {
  1465. var html = element.ownerDocument.documentElement;
  1466. var scrollingElement = element.ownerDocument.scrollingElement || html;
  1467. return scrollingElement[upperSide];
  1468. }
  1469. return element[upperSide];
  1470. }
  1471. /*
  1472. * Sum or subtract the element scroll values (left and top) from a given rect object
  1473. * @method
  1474. * @memberof Popper.Utils
  1475. * @param {Object} rect - Rect object you want to change
  1476. * @param {HTMLElement} element - The element from the function reads the scroll values
  1477. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  1478. * @return {Object} rect - The modifier rect object
  1479. */
  1480. function includeScroll(rect, element) {
  1481. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1482. var scrollTop = getScroll(element, 'top');
  1483. var scrollLeft = getScroll(element, 'left');
  1484. var modifier = subtract ? -1 : 1;
  1485. rect.top += scrollTop * modifier;
  1486. rect.bottom += scrollTop * modifier;
  1487. rect.left += scrollLeft * modifier;
  1488. rect.right += scrollLeft * modifier;
  1489. return rect;
  1490. }
  1491. /*
  1492. * Helper to detect borders of a given element
  1493. * @method
  1494. * @memberof Popper.Utils
  1495. * @param {CSSStyleDeclaration} styles
  1496. * Result of `getStyleComputedProperty` on the given element
  1497. * @param {String} axis - `x` or `y`
  1498. * @return {number} borders - The borders size of the given axis
  1499. */
  1500. function getBordersSize(styles, axis) {
  1501. var sideA = axis === 'x' ? 'Left' : 'Top';
  1502. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  1503. return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
  1504. }
  1505. function getSize(axis, body, html, computedStyle) {
  1506. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  1507. }
  1508. function getWindowSizes(document) {
  1509. var body = document.body;
  1510. var html = document.documentElement;
  1511. var computedStyle = isIE(10) && getComputedStyle(html);
  1512. return {
  1513. height: getSize('Height', body, html, computedStyle),
  1514. width: getSize('Width', body, html, computedStyle)
  1515. };
  1516. }
  1517. var classCallCheck = function (instance, Constructor) {
  1518. if (!(instance instanceof Constructor)) {
  1519. throw new TypeError("Cannot call a class as a function");
  1520. }
  1521. };
  1522. var createClass = function () {
  1523. function defineProperties(target, props) {
  1524. for (var i = 0; i < props.length; i++) {
  1525. var descriptor = props[i];
  1526. descriptor.enumerable = descriptor.enumerable || false;
  1527. descriptor.configurable = true;
  1528. if ("value" in descriptor) descriptor.writable = true;
  1529. Object.defineProperty(target, descriptor.key, descriptor);
  1530. }
  1531. }
  1532. return function (Constructor, protoProps, staticProps) {
  1533. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  1534. if (staticProps) defineProperties(Constructor, staticProps);
  1535. return Constructor;
  1536. };
  1537. }();
  1538. var defineProperty = function (obj, key, value) {
  1539. if (key in obj) {
  1540. Object.defineProperty(obj, key, {
  1541. value: value,
  1542. enumerable: true,
  1543. configurable: true,
  1544. writable: true
  1545. });
  1546. } else {
  1547. obj[key] = value;
  1548. }
  1549. return obj;
  1550. };
  1551. var _extends = Object.assign || function (target) {
  1552. for (var i = 1; i < arguments.length; i++) {
  1553. var source = arguments[i];
  1554. for (var key in source) {
  1555. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1556. target[key] = source[key];
  1557. }
  1558. }
  1559. }
  1560. return target;
  1561. };
  1562. /**
  1563. * Given element offsets, generate an output similar to getBoundingClientRect
  1564. * @method
  1565. * @memberof Popper.Utils
  1566. * @argument {Object} offsets
  1567. * @returns {Object} ClientRect like output
  1568. */
  1569. function getClientRect(offsets) {
  1570. return _extends({}, offsets, {
  1571. right: offsets.left + offsets.width,
  1572. bottom: offsets.top + offsets.height
  1573. });
  1574. }
  1575. /**
  1576. * Get bounding client rect of given element
  1577. * @method
  1578. * @memberof Popper.Utils
  1579. * @param {HTMLElement} element
  1580. * @return {Object} client rect
  1581. */
  1582. function getBoundingClientRect(element) {
  1583. var rect = {};
  1584. // IE10 10 FIX: Please, don't ask, the element isn't
  1585. // considered in DOM in some circumstances...
  1586. // This isn't reproducible in IE10 compatibility mode of IE11
  1587. try {
  1588. if (isIE(10)) {
  1589. rect = element.getBoundingClientRect();
  1590. var scrollTop = getScroll(element, 'top');
  1591. var scrollLeft = getScroll(element, 'left');
  1592. rect.top += scrollTop;
  1593. rect.left += scrollLeft;
  1594. rect.bottom += scrollTop;
  1595. rect.right += scrollLeft;
  1596. } else {
  1597. rect = element.getBoundingClientRect();
  1598. }
  1599. } catch (e) {}
  1600. var result = {
  1601. left: rect.left,
  1602. top: rect.top,
  1603. width: rect.right - rect.left,
  1604. height: rect.bottom - rect.top
  1605. };
  1606. // subtract scrollbar size from sizes
  1607. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  1608. var width = sizes.width || element.clientWidth || result.right - result.left;
  1609. var height = sizes.height || element.clientHeight || result.bottom - result.top;
  1610. var horizScrollbar = element.offsetWidth - width;
  1611. var vertScrollbar = element.offsetHeight - height;
  1612. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  1613. // we make this check conditional for performance reasons
  1614. if (horizScrollbar || vertScrollbar) {
  1615. var styles = getStyleComputedProperty(element);
  1616. horizScrollbar -= getBordersSize(styles, 'x');
  1617. vertScrollbar -= getBordersSize(styles, 'y');
  1618. result.width -= horizScrollbar;
  1619. result.height -= vertScrollbar;
  1620. }
  1621. return getClientRect(result);
  1622. }
  1623. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  1624. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1625. var isIE10 = isIE(10);
  1626. var isHTML = parent.nodeName === 'HTML';
  1627. var childrenRect = getBoundingClientRect(children);
  1628. var parentRect = getBoundingClientRect(parent);
  1629. var scrollParent = getScrollParent(children);
  1630. var styles = getStyleComputedProperty(parent);
  1631. var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
  1632. var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
  1633. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  1634. if (fixedPosition && isHTML) {
  1635. parentRect.top = Math.max(parentRect.top, 0);
  1636. parentRect.left = Math.max(parentRect.left, 0);
  1637. }
  1638. var offsets = getClientRect({
  1639. top: childrenRect.top - parentRect.top - borderTopWidth,
  1640. left: childrenRect.left - parentRect.left - borderLeftWidth,
  1641. width: childrenRect.width,
  1642. height: childrenRect.height
  1643. });
  1644. offsets.marginTop = 0;
  1645. offsets.marginLeft = 0;
  1646. // Subtract margins of documentElement in case it's being used as parent
  1647. // we do this only on HTML because it's the only element that behaves
  1648. // differently when margins are applied to it. The margins are included in
  1649. // the box of the documentElement, in the other cases not.
  1650. if (!isIE10 && isHTML) {
  1651. var marginTop = parseFloat(styles.marginTop, 10);
  1652. var marginLeft = parseFloat(styles.marginLeft, 10);
  1653. offsets.top -= borderTopWidth - marginTop;
  1654. offsets.bottom -= borderTopWidth - marginTop;
  1655. offsets.left -= borderLeftWidth - marginLeft;
  1656. offsets.right -= borderLeftWidth - marginLeft;
  1657. // Attach marginTop and marginLeft because in some circumstances we may need them
  1658. offsets.marginTop = marginTop;
  1659. offsets.marginLeft = marginLeft;
  1660. }
  1661. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  1662. offsets = includeScroll(offsets, parent);
  1663. }
  1664. return offsets;
  1665. }
  1666. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  1667. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1668. var html = element.ownerDocument.documentElement;
  1669. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  1670. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  1671. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  1672. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  1673. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  1674. var offset = {
  1675. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  1676. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  1677. width: width,
  1678. height: height
  1679. };
  1680. return getClientRect(offset);
  1681. }
  1682. /**
  1683. * Check if the given element is fixed or is inside a fixed parent
  1684. * @method
  1685. * @memberof Popper.Utils
  1686. * @argument {Element} element
  1687. * @argument {Element} customContainer
  1688. * @returns {Boolean} answer to "isFixed?"
  1689. */
  1690. function isFixed(element) {
  1691. var nodeName = element.nodeName;
  1692. if (nodeName === 'BODY' || nodeName === 'HTML') {
  1693. return false;
  1694. }
  1695. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  1696. return true;
  1697. }
  1698. return isFixed(getParentNode(element));
  1699. }
  1700. /**
  1701. * Finds the first parent of an element that has a transformed property defined
  1702. * @method
  1703. * @memberof Popper.Utils
  1704. * @argument {Element} element
  1705. * @returns {Element} first transformed parent or documentElement
  1706. */
  1707. function getFixedPositionOffsetParent(element) {
  1708. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  1709. if (!element || !element.parentElement || isIE()) {
  1710. return document.documentElement;
  1711. }
  1712. var el = element.parentElement;
  1713. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  1714. el = el.parentElement;
  1715. }
  1716. return el || document.documentElement;
  1717. }
  1718. /**
  1719. * Computed the boundaries limits and return them
  1720. * @method
  1721. * @memberof Popper.Utils
  1722. * @param {HTMLElement} popper
  1723. * @param {HTMLElement} reference
  1724. * @param {number} padding
  1725. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  1726. * @param {Boolean} fixedPosition - Is in fixed position mode
  1727. * @returns {Object} Coordinates of the boundaries
  1728. */
  1729. function getBoundaries(popper, reference, padding, boundariesElement) {
  1730. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  1731. // NOTE: 1 DOM access here
  1732. var boundaries = { top: 0, left: 0 };
  1733. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  1734. // Handle viewport case
  1735. if (boundariesElement === 'viewport') {
  1736. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  1737. } else {
  1738. // Handle other cases based on DOM element used as boundaries
  1739. var boundariesNode = void 0;
  1740. if (boundariesElement === 'scrollParent') {
  1741. boundariesNode = getScrollParent(getParentNode(reference));
  1742. if (boundariesNode.nodeName === 'BODY') {
  1743. boundariesNode = popper.ownerDocument.documentElement;
  1744. }
  1745. } else if (boundariesElement === 'window') {
  1746. boundariesNode = popper.ownerDocument.documentElement;
  1747. } else {
  1748. boundariesNode = boundariesElement;
  1749. }
  1750. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  1751. // In case of HTML, we need a different computation
  1752. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  1753. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  1754. height = _getWindowSizes.height,
  1755. width = _getWindowSizes.width;
  1756. boundaries.top += offsets.top - offsets.marginTop;
  1757. boundaries.bottom = height + offsets.top;
  1758. boundaries.left += offsets.left - offsets.marginLeft;
  1759. boundaries.right = width + offsets.left;
  1760. } else {
  1761. // for all the other DOM elements, this one is good
  1762. boundaries = offsets;
  1763. }
  1764. }
  1765. // Add paddings
  1766. padding = padding || 0;
  1767. var isPaddingNumber = typeof padding === 'number';
  1768. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  1769. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  1770. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  1771. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  1772. return boundaries;
  1773. }
  1774. function getArea(_ref) {
  1775. var width = _ref.width,
  1776. height = _ref.height;
  1777. return width * height;
  1778. }
  1779. /**
  1780. * Utility used to transform the `auto` placement to the placement with more
  1781. * available space.
  1782. * @method
  1783. * @memberof Popper.Utils
  1784. * @argument {Object} data - The data object generated by update method
  1785. * @argument {Object} options - Modifiers configuration and options
  1786. * @returns {Object} The data object, properly modified
  1787. */
  1788. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  1789. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  1790. if (placement.indexOf('auto') === -1) {
  1791. return placement;
  1792. }
  1793. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  1794. var rects = {
  1795. top: {
  1796. width: boundaries.width,
  1797. height: refRect.top - boundaries.top
  1798. },
  1799. right: {
  1800. width: boundaries.right - refRect.right,
  1801. height: boundaries.height
  1802. },
  1803. bottom: {
  1804. width: boundaries.width,
  1805. height: boundaries.bottom - refRect.bottom
  1806. },
  1807. left: {
  1808. width: refRect.left - boundaries.left,
  1809. height: boundaries.height
  1810. }
  1811. };
  1812. var sortedAreas = Object.keys(rects).map(function (key) {
  1813. return _extends({
  1814. key: key
  1815. }, rects[key], {
  1816. area: getArea(rects[key])
  1817. });
  1818. }).sort(function (a, b) {
  1819. return b.area - a.area;
  1820. });
  1821. var filteredAreas = sortedAreas.filter(function (_ref2) {
  1822. var width = _ref2.width,
  1823. height = _ref2.height;
  1824. return width >= popper.clientWidth && height >= popper.clientHeight;
  1825. });
  1826. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  1827. var variation = placement.split('-')[1];
  1828. return computedPlacement + (variation ? '-' + variation : '');
  1829. }
  1830. /**
  1831. * Get offsets to the reference element
  1832. * @method
  1833. * @memberof Popper.Utils
  1834. * @param {Object} state
  1835. * @param {Element} popper - the popper element
  1836. * @param {Element} reference - the reference element (the popper will be relative to this)
  1837. * @param {Element} fixedPosition - is in fixed position mode
  1838. * @returns {Object} An object containing the offsets which will be applied to the popper
  1839. */
  1840. function getReferenceOffsets(state, popper, reference) {
  1841. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  1842. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  1843. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  1844. }
  1845. /**
  1846. * Get the outer sizes of the given element (offset size + margins)
  1847. * @method
  1848. * @memberof Popper.Utils
  1849. * @argument {Element} element
  1850. * @returns {Object} object containing width and height properties
  1851. */
  1852. function getOuterSizes(element) {
  1853. var window = element.ownerDocument.defaultView;
  1854. var styles = window.getComputedStyle(element);
  1855. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  1856. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  1857. var result = {
  1858. width: element.offsetWidth + y,
  1859. height: element.offsetHeight + x
  1860. };
  1861. return result;
  1862. }
  1863. /**
  1864. * Get the opposite placement of the given one
  1865. * @method
  1866. * @memberof Popper.Utils
  1867. * @argument {String} placement
  1868. * @returns {String} flipped placement
  1869. */
  1870. function getOppositePlacement(placement) {
  1871. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  1872. return placement.replace(/left|right|bottom|top/g, function (matched) {
  1873. return hash[matched];
  1874. });
  1875. }
  1876. /**
  1877. * Get offsets to the popper
  1878. * @method
  1879. * @memberof Popper.Utils
  1880. * @param {Object} position - CSS position the Popper will get applied
  1881. * @param {HTMLElement} popper - the popper element
  1882. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  1883. * @param {String} placement - one of the valid placement options
  1884. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  1885. */
  1886. function getPopperOffsets(popper, referenceOffsets, placement) {
  1887. placement = placement.split('-')[0];
  1888. // Get popper node sizes
  1889. var popperRect = getOuterSizes(popper);
  1890. // Add position, width and height to our offsets object
  1891. var popperOffsets = {
  1892. width: popperRect.width,
  1893. height: popperRect.height
  1894. };
  1895. // depending by the popper placement we have to compute its offsets slightly differently
  1896. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  1897. var mainSide = isHoriz ? 'top' : 'left';
  1898. var secondarySide = isHoriz ? 'left' : 'top';
  1899. var measurement = isHoriz ? 'height' : 'width';
  1900. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  1901. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  1902. if (placement === secondarySide) {
  1903. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  1904. } else {
  1905. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  1906. }
  1907. return popperOffsets;
  1908. }
  1909. /**
  1910. * Mimics the `find` method of Array
  1911. * @method
  1912. * @memberof Popper.Utils
  1913. * @argument {Array} arr
  1914. * @argument prop
  1915. * @argument value
  1916. * @returns index or -1
  1917. */
  1918. function find(arr, check) {
  1919. // use native find if supported
  1920. if (Array.prototype.find) {
  1921. return arr.find(check);
  1922. }
  1923. // use `filter` to obtain the same behavior of `find`
  1924. return arr.filter(check)[0];
  1925. }
  1926. /**
  1927. * Return the index of the matching object
  1928. * @method
  1929. * @memberof Popper.Utils
  1930. * @argument {Array} arr
  1931. * @argument prop
  1932. * @argument value
  1933. * @returns index or -1
  1934. */
  1935. function findIndex(arr, prop, value) {
  1936. // use native findIndex if supported
  1937. if (Array.prototype.findIndex) {
  1938. return arr.findIndex(function (cur) {
  1939. return cur[prop] === value;
  1940. });
  1941. }
  1942. // use `find` + `indexOf` if `findIndex` isn't supported
  1943. var match = find(arr, function (obj) {
  1944. return obj[prop] === value;
  1945. });
  1946. return arr.indexOf(match);
  1947. }
  1948. /**
  1949. * Loop trough the list of modifiers and run them in order,
  1950. * each of them will then edit the data object.
  1951. * @method
  1952. * @memberof Popper.Utils
  1953. * @param {dataObject} data
  1954. * @param {Array} modifiers
  1955. * @param {String} ends - Optional modifier name used as stopper
  1956. * @returns {dataObject}
  1957. */
  1958. function runModifiers(modifiers, data, ends) {
  1959. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  1960. modifiersToRun.forEach(function (modifier) {
  1961. if (modifier['function']) {
  1962. // eslint-disable-line dot-notation
  1963. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  1964. }
  1965. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  1966. if (modifier.enabled && isFunction(fn)) {
  1967. // Add properties to offsets to make them a complete clientRect object
  1968. // we do this before each modifier to make sure the previous one doesn't
  1969. // mess with these values
  1970. data.offsets.popper = getClientRect(data.offsets.popper);
  1971. data.offsets.reference = getClientRect(data.offsets.reference);
  1972. data = fn(data, modifier);
  1973. }
  1974. });
  1975. return data;
  1976. }
  1977. /**
  1978. * Updates the position of the popper, computing the new offsets and applying
  1979. * the new style.<br />
  1980. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  1981. * @method
  1982. * @memberof Popper
  1983. */
  1984. function update() {
  1985. // if popper is destroyed, don't perform any further update
  1986. if (this.state.isDestroyed) {
  1987. return;
  1988. }
  1989. var data = {
  1990. instance: this,
  1991. styles: {},
  1992. arrowStyles: {},
  1993. attributes: {},
  1994. flipped: false,
  1995. offsets: {}
  1996. };
  1997. // compute reference element offsets
  1998. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  1999. // compute auto placement, store placement inside the data object,
  2000. // modifiers will be able to edit `placement` if needed
  2001. // and refer to originalPlacement to know the original value
  2002. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  2003. // store the computed placement inside `originalPlacement`
  2004. data.originalPlacement = data.placement;
  2005. data.positionFixed = this.options.positionFixed;
  2006. // compute the popper offsets
  2007. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  2008. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  2009. // run the modifiers
  2010. data = runModifiers(this.modifiers, data);
  2011. // the first `update` will call `onCreate` callback
  2012. // the other ones will call `onUpdate` callback
  2013. if (!this.state.isCreated) {
  2014. this.state.isCreated = true;
  2015. this.options.onCreate(data);
  2016. } else {
  2017. this.options.onUpdate(data);
  2018. }
  2019. }
  2020. /**
  2021. * Helper used to know if the given modifier is enabled.
  2022. * @method
  2023. * @memberof Popper.Utils
  2024. * @returns {Boolean}
  2025. */
  2026. function isModifierEnabled(modifiers, modifierName) {
  2027. return modifiers.some(function (_ref) {
  2028. var name = _ref.name,
  2029. enabled = _ref.enabled;
  2030. return enabled && name === modifierName;
  2031. });
  2032. }
  2033. /**
  2034. * Get the prefixed supported property name
  2035. * @method
  2036. * @memberof Popper.Utils
  2037. * @argument {String} property (camelCase)
  2038. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  2039. */
  2040. function getSupportedPropertyName(property) {
  2041. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  2042. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  2043. for (var i = 0; i < prefixes.length; i++) {
  2044. var prefix = prefixes[i];
  2045. var toCheck = prefix ? '' + prefix + upperProp : property;
  2046. if (typeof document.body.style[toCheck] !== 'undefined') {
  2047. return toCheck;
  2048. }
  2049. }
  2050. return null;
  2051. }
  2052. /**
  2053. * Destroys the popper.
  2054. * @method
  2055. * @memberof Popper
  2056. */
  2057. function destroy() {
  2058. this.state.isDestroyed = true;
  2059. // touch DOM only if `applyStyle` modifier is enabled
  2060. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  2061. this.popper.removeAttribute('x-placement');
  2062. this.popper.style.position = '';
  2063. this.popper.style.top = '';
  2064. this.popper.style.left = '';
  2065. this.popper.style.right = '';
  2066. this.popper.style.bottom = '';
  2067. this.popper.style.willChange = '';
  2068. this.popper.style[getSupportedPropertyName('transform')] = '';
  2069. }
  2070. this.disableEventListeners();
  2071. // remove the popper if user explicity asked for the deletion on destroy
  2072. // do not use `remove` because IE11 doesn't support it
  2073. if (this.options.removeOnDestroy) {
  2074. this.popper.parentNode.removeChild(this.popper);
  2075. }
  2076. return this;
  2077. }
  2078. /**
  2079. * Get the window associated with the element
  2080. * @argument {Element} element
  2081. * @returns {Window}
  2082. */
  2083. function getWindow(element) {
  2084. var ownerDocument = element.ownerDocument;
  2085. return ownerDocument ? ownerDocument.defaultView : window;
  2086. }
  2087. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  2088. var isBody = scrollParent.nodeName === 'BODY';
  2089. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  2090. target.addEventListener(event, callback, { passive: true });
  2091. if (!isBody) {
  2092. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  2093. }
  2094. scrollParents.push(target);
  2095. }
  2096. /**
  2097. * Setup needed event listeners used to update the popper position
  2098. * @method
  2099. * @memberof Popper.Utils
  2100. * @private
  2101. */
  2102. function setupEventListeners(reference, options, state, updateBound) {
  2103. // Resize event listener on window
  2104. state.updateBound = updateBound;
  2105. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  2106. // Scroll event listener on scroll parents
  2107. var scrollElement = getScrollParent(reference);
  2108. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  2109. state.scrollElement = scrollElement;
  2110. state.eventsEnabled = true;
  2111. return state;
  2112. }
  2113. /**
  2114. * It will add resize/scroll events and start recalculating
  2115. * position of the popper element when they are triggered.
  2116. * @method
  2117. * @memberof Popper
  2118. */
  2119. function enableEventListeners() {
  2120. if (!this.state.eventsEnabled) {
  2121. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  2122. }
  2123. }
  2124. /**
  2125. * Remove event listeners used to update the popper position
  2126. * @method
  2127. * @memberof Popper.Utils
  2128. * @private
  2129. */
  2130. function removeEventListeners(reference, state) {
  2131. // Remove resize event listener on window
  2132. getWindow(reference).removeEventListener('resize', state.updateBound);
  2133. // Remove scroll event listener on scroll parents
  2134. state.scrollParents.forEach(function (target) {
  2135. target.removeEventListener('scroll', state.updateBound);
  2136. });
  2137. // Reset state
  2138. state.updateBound = null;
  2139. state.scrollParents = [];
  2140. state.scrollElement = null;
  2141. state.eventsEnabled = false;
  2142. return state;
  2143. }
  2144. /**
  2145. * It will remove resize/scroll events and won't recalculate popper position
  2146. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  2147. * unless you call `update` method manually.
  2148. * @method
  2149. * @memberof Popper
  2150. */
  2151. function disableEventListeners() {
  2152. if (this.state.eventsEnabled) {
  2153. cancelAnimationFrame(this.scheduleUpdate);
  2154. this.state = removeEventListeners(this.reference, this.state);
  2155. }
  2156. }
  2157. /**
  2158. * Tells if a given input is a number
  2159. * @method
  2160. * @memberof Popper.Utils
  2161. * @param {*} input to check
  2162. * @return {Boolean}
  2163. */
  2164. function isNumeric(n) {
  2165. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  2166. }
  2167. /**
  2168. * Set the style to the given popper
  2169. * @method
  2170. * @memberof Popper.Utils
  2171. * @argument {Element} element - Element to apply the style to
  2172. * @argument {Object} styles
  2173. * Object with a list of properties and values which will be applied to the element
  2174. */
  2175. function setStyles(element, styles) {
  2176. Object.keys(styles).forEach(function (prop) {
  2177. var unit = '';
  2178. // add unit if the value is numeric and is one of the following
  2179. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  2180. unit = 'px';
  2181. }
  2182. element.style[prop] = styles[prop] + unit;
  2183. });
  2184. }
  2185. /**
  2186. * Set the attributes to the given popper
  2187. * @method
  2188. * @memberof Popper.Utils
  2189. * @argument {Element} element - Element to apply the attributes to
  2190. * @argument {Object} styles
  2191. * Object with a list of properties and values which will be applied to the element
  2192. */
  2193. function setAttributes(element, attributes) {
  2194. Object.keys(attributes).forEach(function (prop) {
  2195. var value = attributes[prop];
  2196. if (value !== false) {
  2197. element.setAttribute(prop, attributes[prop]);
  2198. } else {
  2199. element.removeAttribute(prop);
  2200. }
  2201. });
  2202. }
  2203. /**
  2204. * @function
  2205. * @memberof Modifiers
  2206. * @argument {Object} data - The data object generated by `update` method
  2207. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  2208. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  2209. * @argument {Object} options - Modifiers configuration and options
  2210. * @returns {Object} The same data object
  2211. */
  2212. function applyStyle(data) {
  2213. // any property present in `data.styles` will be applied to the popper,
  2214. // in this way we can make the 3rd party modifiers add custom styles to it
  2215. // Be aware, modifiers could override the properties defined in the previous
  2216. // lines of this modifier!
  2217. setStyles(data.instance.popper, data.styles);
  2218. // any property present in `data.attributes` will be applied to the popper,
  2219. // they will be set as HTML attributes of the element
  2220. setAttributes(data.instance.popper, data.attributes);
  2221. // if arrowElement is defined and arrowStyles has some properties
  2222. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  2223. setStyles(data.arrowElement, data.arrowStyles);
  2224. }
  2225. return data;
  2226. }
  2227. /**
  2228. * Set the x-placement attribute before everything else because it could be used
  2229. * to add margins to the popper margins needs to be calculated to get the
  2230. * correct popper offsets.
  2231. * @method
  2232. * @memberof Popper.modifiers
  2233. * @param {HTMLElement} reference - The reference element used to position the popper
  2234. * @param {HTMLElement} popper - The HTML element used as popper
  2235. * @param {Object} options - Popper.js options
  2236. */
  2237. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  2238. // compute reference element offsets
  2239. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  2240. // compute auto placement, store placement inside the data object,
  2241. // modifiers will be able to edit `placement` if needed
  2242. // and refer to originalPlacement to know the original value
  2243. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  2244. popper.setAttribute('x-placement', placement);
  2245. // Apply `position` to popper before anything else because
  2246. // without the position applied we can't guarantee correct computations
  2247. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  2248. return options;
  2249. }
  2250. /**
  2251. * @function
  2252. * @memberof Popper.Utils
  2253. * @argument {Object} data - The data object generated by `update` method
  2254. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  2255. * @returns {Object} The popper's position offsets rounded
  2256. *
  2257. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  2258. * good as it can be within reason.
  2259. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  2260. *
  2261. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  2262. * as well on High DPI screens).
  2263. *
  2264. * Firefox prefers no rounding for positioning and does not have blurriness on
  2265. * high DPI screens.
  2266. *
  2267. * Only horizontal placement and left/right values need to be considered.
  2268. */
  2269. function getRoundedOffsets(data, shouldRound) {
  2270. var _data$offsets = data.offsets,
  2271. popper = _data$offsets.popper,
  2272. reference = _data$offsets.reference;
  2273. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  2274. var isVariation = data.placement.indexOf('-') !== -1;
  2275. var sameWidthOddness = reference.width % 2 === popper.width % 2;
  2276. var bothOddWidth = reference.width % 2 === 1 && popper.width % 2 === 1;
  2277. var noRound = function noRound(v) {
  2278. return v;
  2279. };
  2280. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthOddness ? Math.round : Math.floor;
  2281. var verticalToInteger = !shouldRound ? noRound : Math.round;
  2282. return {
  2283. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  2284. top: verticalToInteger(popper.top),
  2285. bottom: verticalToInteger(popper.bottom),
  2286. right: horizontalToInteger(popper.right)
  2287. };
  2288. }
  2289. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  2290. /**
  2291. * @function
  2292. * @memberof Modifiers
  2293. * @argument {Object} data - The data object generated by `update` method
  2294. * @argument {Object} options - Modifiers configuration and options
  2295. * @returns {Object} The data object, properly modified
  2296. */
  2297. function computeStyle(data, options) {
  2298. var x = options.x,
  2299. y = options.y;
  2300. var popper = data.offsets.popper;
  2301. // Remove this legacy support in Popper.js v2
  2302. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  2303. return modifier.name === 'applyStyle';
  2304. }).gpuAcceleration;
  2305. if (legacyGpuAccelerationOption !== undefined) {
  2306. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  2307. }
  2308. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  2309. var offsetParent = getOffsetParent(data.instance.popper);
  2310. var offsetParentRect = getBoundingClientRect(offsetParent);
  2311. // Styles
  2312. var styles = {
  2313. position: popper.position
  2314. };
  2315. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  2316. var sideA = x === 'bottom' ? 'top' : 'bottom';
  2317. var sideB = y === 'right' ? 'left' : 'right';
  2318. // if gpuAcceleration is set to `true` and transform is supported,
  2319. // we use `translate3d` to apply the position to the popper we
  2320. // automatically use the supported prefixed version if needed
  2321. var prefixedProperty = getSupportedPropertyName('transform');
  2322. // now, let's make a step back and look at this code closely (wtf?)
  2323. // If the content of the popper grows once it's been positioned, it
  2324. // may happen that the popper gets misplaced because of the new content
  2325. // overflowing its reference element
  2326. // To avoid this problem, we provide two options (x and y), which allow
  2327. // the consumer to define the offset origin.
  2328. // If we position a popper on top of a reference element, we can set
  2329. // `x` to `top` to make the popper grow towards its top instead of
  2330. // its bottom.
  2331. var left = void 0,
  2332. top = void 0;
  2333. if (sideA === 'bottom') {
  2334. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  2335. // and not the bottom of the html element
  2336. if (offsetParent.nodeName === 'HTML') {
  2337. top = -offsetParent.clientHeight + offsets.bottom;
  2338. } else {
  2339. top = -offsetParentRect.height + offsets.bottom;
  2340. }
  2341. } else {
  2342. top = offsets.top;
  2343. }
  2344. if (sideB === 'right') {
  2345. if (offsetParent.nodeName === 'HTML') {
  2346. left = -offsetParent.clientWidth + offsets.right;
  2347. } else {
  2348. left = -offsetParentRect.width + offsets.right;
  2349. }
  2350. } else {
  2351. left = offsets.left;
  2352. }
  2353. if (gpuAcceleration && prefixedProperty) {
  2354. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  2355. styles[sideA] = 0;
  2356. styles[sideB] = 0;
  2357. styles.willChange = 'transform';
  2358. } else {
  2359. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  2360. var invertTop = sideA === 'bottom' ? -1 : 1;
  2361. var invertLeft = sideB === 'right' ? -1 : 1;
  2362. styles[sideA] = top * invertTop;
  2363. styles[sideB] = left * invertLeft;
  2364. styles.willChange = sideA + ', ' + sideB;
  2365. }
  2366. // Attributes
  2367. var attributes = {
  2368. 'x-placement': data.placement
  2369. };
  2370. // Update `data` attributes, styles and arrowStyles
  2371. data.attributes = _extends({}, attributes, data.attributes);
  2372. data.styles = _extends({}, styles, data.styles);
  2373. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  2374. return data;
  2375. }
  2376. /**
  2377. * Helper used to know if the given modifier depends from another one.<br />
  2378. * It checks if the needed modifier is listed and enabled.
  2379. * @method
  2380. * @memberof Popper.Utils
  2381. * @param {Array} modifiers - list of modifiers
  2382. * @param {String} requestingName - name of requesting modifier
  2383. * @param {String} requestedName - name of requested modifier
  2384. * @returns {Boolean}
  2385. */
  2386. function isModifierRequired(modifiers, requestingName, requestedName) {
  2387. var requesting = find(modifiers, function (_ref) {
  2388. var name = _ref.name;
  2389. return name === requestingName;
  2390. });
  2391. var isRequired = !!requesting && modifiers.some(function (modifier) {
  2392. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  2393. });
  2394. if (!isRequired) {
  2395. var _requesting = '`' + requestingName + '`';
  2396. var requested = '`' + requestedName + '`';
  2397. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  2398. }
  2399. return isRequired;
  2400. }
  2401. /**
  2402. * @function
  2403. * @memberof Modifiers
  2404. * @argument {Object} data - The data object generated by update method
  2405. * @argument {Object} options - Modifiers configuration and options
  2406. * @returns {Object} The data object, properly modified
  2407. */
  2408. function arrow(data, options) {
  2409. var _data$offsets$arrow;
  2410. // arrow depends on keepTogether in order to work
  2411. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  2412. return data;
  2413. }
  2414. var arrowElement = options.element;
  2415. // if arrowElement is a string, suppose it's a CSS selector
  2416. if (typeof arrowElement === 'string') {
  2417. arrowElement = data.instance.popper.querySelector(arrowElement);
  2418. // if arrowElement is not found, don't run the modifier
  2419. if (!arrowElement) {
  2420. return data;
  2421. }
  2422. } else {
  2423. // if the arrowElement isn't a query selector we must check that the
  2424. // provided DOM node is child of its popper node
  2425. if (!data.instance.popper.contains(arrowElement)) {
  2426. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  2427. return data;
  2428. }
  2429. }
  2430. var placement = data.placement.split('-')[0];
  2431. var _data$offsets = data.offsets,
  2432. popper = _data$offsets.popper,
  2433. reference = _data$offsets.reference;
  2434. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  2435. var len = isVertical ? 'height' : 'width';
  2436. var sideCapitalized = isVertical ? 'Top' : 'Left';
  2437. var side = sideCapitalized.toLowerCase();
  2438. var altSide = isVertical ? 'left' : 'top';
  2439. var opSide = isVertical ? 'bottom' : 'right';
  2440. var arrowElementSize = getOuterSizes(arrowElement)[len];
  2441. //
  2442. // extends keepTogether behavior making sure the popper and its
  2443. // reference have enough pixels in conjunction
  2444. //
  2445. // top/left side
  2446. if (reference[opSide] - arrowElementSize < popper[side]) {
  2447. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  2448. }
  2449. // bottom/right side
  2450. if (reference[side] + arrowElementSize > popper[opSide]) {
  2451. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  2452. }
  2453. data.offsets.popper = getClientRect(data.offsets.popper);
  2454. // compute center of the popper
  2455. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  2456. // Compute the sideValue using the updated popper offsets
  2457. // take popper margin in account because we don't have this info available
  2458. var css = getStyleComputedProperty(data.instance.popper);
  2459. var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
  2460. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
  2461. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  2462. // prevent arrowElement from being placed not contiguously to its popper
  2463. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  2464. data.arrowElement = arrowElement;
  2465. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  2466. return data;
  2467. }
  2468. /**
  2469. * Get the opposite placement variation of the given one
  2470. * @method
  2471. * @memberof Popper.Utils
  2472. * @argument {String} placement variation
  2473. * @returns {String} flipped placement variation
  2474. */
  2475. function getOppositeVariation(variation) {
  2476. if (variation === 'end') {
  2477. return 'start';
  2478. } else if (variation === 'start') {
  2479. return 'end';
  2480. }
  2481. return variation;
  2482. }
  2483. /**
  2484. * List of accepted placements to use as values of the `placement` option.<br />
  2485. * Valid placements are:
  2486. * - `auto`
  2487. * - `top`
  2488. * - `right`
  2489. * - `bottom`
  2490. * - `left`
  2491. *
  2492. * Each placement can have a variation from this list:
  2493. * - `-start`
  2494. * - `-end`
  2495. *
  2496. * Variations are interpreted easily if you think of them as the left to right
  2497. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  2498. * is right.<br />
  2499. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  2500. *
  2501. * Some valid examples are:
  2502. * - `top-end` (on top of reference, right aligned)
  2503. * - `right-start` (on right of reference, top aligned)
  2504. * - `bottom` (on bottom, centered)
  2505. * - `auto-end` (on the side with more space available, alignment depends by placement)
  2506. *
  2507. * @static
  2508. * @type {Array}
  2509. * @enum {String}
  2510. * @readonly
  2511. * @method placements
  2512. * @memberof Popper
  2513. */
  2514. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  2515. // Get rid of `auto` `auto-start` and `auto-end`
  2516. var validPlacements = placements.slice(3);
  2517. /**
  2518. * Given an initial placement, returns all the subsequent placements
  2519. * clockwise (or counter-clockwise).
  2520. *
  2521. * @method
  2522. * @memberof Popper.Utils
  2523. * @argument {String} placement - A valid placement (it accepts variations)
  2524. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  2525. * @returns {Array} placements including their variations
  2526. */
  2527. function clockwise(placement) {
  2528. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2529. var index = validPlacements.indexOf(placement);
  2530. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  2531. return counter ? arr.reverse() : arr;
  2532. }
  2533. var BEHAVIORS = {
  2534. FLIP: 'flip',
  2535. CLOCKWISE: 'clockwise',
  2536. COUNTERCLOCKWISE: 'counterclockwise'
  2537. };
  2538. /**
  2539. * @function
  2540. * @memberof Modifiers
  2541. * @argument {Object} data - The data object generated by update method
  2542. * @argument {Object} options - Modifiers configuration and options
  2543. * @returns {Object} The data object, properly modified
  2544. */
  2545. function flip(data, options) {
  2546. // if `inner` modifier is enabled, we can't use the `flip` modifier
  2547. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  2548. return data;
  2549. }
  2550. if (data.flipped && data.placement === data.originalPlacement) {
  2551. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  2552. return data;
  2553. }
  2554. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  2555. var placement = data.placement.split('-')[0];
  2556. var placementOpposite = getOppositePlacement(placement);
  2557. var variation = data.placement.split('-')[1] || '';
  2558. var flipOrder = [];
  2559. switch (options.behavior) {
  2560. case BEHAVIORS.FLIP:
  2561. flipOrder = [placement, placementOpposite];
  2562. break;
  2563. case BEHAVIORS.CLOCKWISE:
  2564. flipOrder = clockwise(placement);
  2565. break;
  2566. case BEHAVIORS.COUNTERCLOCKWISE:
  2567. flipOrder = clockwise(placement, true);
  2568. break;
  2569. default:
  2570. flipOrder = options.behavior;
  2571. }
  2572. flipOrder.forEach(function (step, index) {
  2573. if (placement !== step || flipOrder.length === index + 1) {
  2574. return data;
  2575. }
  2576. placement = data.placement.split('-')[0];
  2577. placementOpposite = getOppositePlacement(placement);
  2578. var popperOffsets = data.offsets.popper;
  2579. var refOffsets = data.offsets.reference;
  2580. // using floor because the reference offsets may contain decimals we are not going to consider here
  2581. var floor = Math.floor;
  2582. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  2583. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  2584. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  2585. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  2586. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  2587. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  2588. // flip the variation if required
  2589. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  2590. var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  2591. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  2592. // this boolean to detect any flip loop
  2593. data.flipped = true;
  2594. if (overlapsRef || overflowsBoundaries) {
  2595. placement = flipOrder[index + 1];
  2596. }
  2597. if (flippedVariation) {
  2598. variation = getOppositeVariation(variation);
  2599. }
  2600. data.placement = placement + (variation ? '-' + variation : '');
  2601. // this object contains `position`, we want to preserve it along with
  2602. // any additional property we may add in the future
  2603. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  2604. data = runModifiers(data.instance.modifiers, data, 'flip');
  2605. }
  2606. });
  2607. return data;
  2608. }
  2609. /**
  2610. * @function
  2611. * @memberof Modifiers
  2612. * @argument {Object} data - The data object generated by update method
  2613. * @argument {Object} options - Modifiers configuration and options
  2614. * @returns {Object} The data object, properly modified
  2615. */
  2616. function keepTogether(data) {
  2617. var _data$offsets = data.offsets,
  2618. popper = _data$offsets.popper,
  2619. reference = _data$offsets.reference;
  2620. var placement = data.placement.split('-')[0];
  2621. var floor = Math.floor;
  2622. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  2623. var side = isVertical ? 'right' : 'bottom';
  2624. var opSide = isVertical ? 'left' : 'top';
  2625. var measurement = isVertical ? 'width' : 'height';
  2626. if (popper[side] < floor(reference[opSide])) {
  2627. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  2628. }
  2629. if (popper[opSide] > floor(reference[side])) {
  2630. data.offsets.popper[opSide] = floor(reference[side]);
  2631. }
  2632. return data;
  2633. }
  2634. /**
  2635. * Converts a string containing value + unit into a px value number
  2636. * @function
  2637. * @memberof {modifiers~offset}
  2638. * @private
  2639. * @argument {String} str - Value + unit string
  2640. * @argument {String} measurement - `height` or `width`
  2641. * @argument {Object} popperOffsets
  2642. * @argument {Object} referenceOffsets
  2643. * @returns {Number|String}
  2644. * Value in pixels, or original string if no values were extracted
  2645. */
  2646. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  2647. // separate value from unit
  2648. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  2649. var value = +split[1];
  2650. var unit = split[2];
  2651. // If it's not a number it's an operator, I guess
  2652. if (!value) {
  2653. return str;
  2654. }
  2655. if (unit.indexOf('%') === 0) {
  2656. var element = void 0;
  2657. switch (unit) {
  2658. case '%p':
  2659. element = popperOffsets;
  2660. break;
  2661. case '%':
  2662. case '%r':
  2663. default:
  2664. element = referenceOffsets;
  2665. }
  2666. var rect = getClientRect(element);
  2667. return rect[measurement] / 100 * value;
  2668. } else if (unit === 'vh' || unit === 'vw') {
  2669. // if is a vh or vw, we calculate the size based on the viewport
  2670. var size = void 0;
  2671. if (unit === 'vh') {
  2672. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  2673. } else {
  2674. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  2675. }
  2676. return size / 100 * value;
  2677. } else {
  2678. // if is an explicit pixel unit, we get rid of the unit and keep the value
  2679. // if is an implicit unit, it's px, and we return just the value
  2680. return value;
  2681. }
  2682. }
  2683. /**
  2684. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  2685. * @function
  2686. * @memberof {modifiers~offset}
  2687. * @private
  2688. * @argument {String} offset
  2689. * @argument {Object} popperOffsets
  2690. * @argument {Object} referenceOffsets
  2691. * @argument {String} basePlacement
  2692. * @returns {Array} a two cells array with x and y offsets in numbers
  2693. */
  2694. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  2695. var offsets = [0, 0];
  2696. // Use height if placement is left or right and index is 0 otherwise use width
  2697. // in this way the first offset will use an axis and the second one
  2698. // will use the other one
  2699. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  2700. // Split the offset string to obtain a list of values and operands
  2701. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  2702. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  2703. return frag.trim();
  2704. });
  2705. // Detect if the offset string contains a pair of values or a single one
  2706. // they could be separated by comma or space
  2707. var divider = fragments.indexOf(find(fragments, function (frag) {
  2708. return frag.search(/,|\s/) !== -1;
  2709. }));
  2710. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  2711. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  2712. }
  2713. // If divider is found, we divide the list of values and operands to divide
  2714. // them by ofset X and Y.
  2715. var splitRegex = /\s*,\s*|\s+/;
  2716. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  2717. // Convert the values with units to absolute pixels to allow our computations
  2718. ops = ops.map(function (op, index) {
  2719. // Most of the units rely on the orientation of the popper
  2720. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  2721. var mergeWithPrevious = false;
  2722. return op
  2723. // This aggregates any `+` or `-` sign that aren't considered operators
  2724. // e.g.: 10 + +5 => [10, +, +5]
  2725. .reduce(function (a, b) {
  2726. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  2727. a[a.length - 1] = b;
  2728. mergeWithPrevious = true;
  2729. return a;
  2730. } else if (mergeWithPrevious) {
  2731. a[a.length - 1] += b;
  2732. mergeWithPrevious = false;
  2733. return a;
  2734. } else {
  2735. return a.concat(b);
  2736. }
  2737. }, [])
  2738. // Here we convert the string values into number values (in px)
  2739. .map(function (str) {
  2740. return toValue(str, measurement, popperOffsets, referenceOffsets);
  2741. });
  2742. });
  2743. // Loop trough the offsets arrays and execute the operations
  2744. ops.forEach(function (op, index) {
  2745. op.forEach(function (frag, index2) {
  2746. if (isNumeric(frag)) {
  2747. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  2748. }
  2749. });
  2750. });
  2751. return offsets;
  2752. }
  2753. /**
  2754. * @function
  2755. * @memberof Modifiers
  2756. * @argument {Object} data - The data object generated by update method
  2757. * @argument {Object} options - Modifiers configuration and options
  2758. * @argument {Number|String} options.offset=0
  2759. * The offset value as described in the modifier description
  2760. * @returns {Object} The data object, properly modified
  2761. */
  2762. function offset(data, _ref) {
  2763. var offset = _ref.offset;
  2764. var placement = data.placement,
  2765. _data$offsets = data.offsets,
  2766. popper = _data$offsets.popper,
  2767. reference = _data$offsets.reference;
  2768. var basePlacement = placement.split('-')[0];
  2769. var offsets = void 0;
  2770. if (isNumeric(+offset)) {
  2771. offsets = [+offset, 0];
  2772. } else {
  2773. offsets = parseOffset(offset, popper, reference, basePlacement);
  2774. }
  2775. if (basePlacement === 'left') {
  2776. popper.top += offsets[0];
  2777. popper.left -= offsets[1];
  2778. } else if (basePlacement === 'right') {
  2779. popper.top += offsets[0];
  2780. popper.left += offsets[1];
  2781. } else if (basePlacement === 'top') {
  2782. popper.left += offsets[0];
  2783. popper.top -= offsets[1];
  2784. } else if (basePlacement === 'bottom') {
  2785. popper.left += offsets[0];
  2786. popper.top += offsets[1];
  2787. }
  2788. data.popper = popper;
  2789. return data;
  2790. }
  2791. /**
  2792. * @function
  2793. * @memberof Modifiers
  2794. * @argument {Object} data - The data object generated by `update` method
  2795. * @argument {Object} options - Modifiers configuration and options
  2796. * @returns {Object} The data object, properly modified
  2797. */
  2798. function preventOverflow(data, options) {
  2799. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  2800. // If offsetParent is the reference element, we really want to
  2801. // go one step up and use the next offsetParent as reference to
  2802. // avoid to make this modifier completely useless and look like broken
  2803. if (data.instance.reference === boundariesElement) {
  2804. boundariesElement = getOffsetParent(boundariesElement);
  2805. }
  2806. // NOTE: DOM access here
  2807. // resets the popper's position so that the document size can be calculated excluding
  2808. // the size of the popper element itself
  2809. var transformProp = getSupportedPropertyName('transform');
  2810. var popperStyles = data.instance.popper.style; // assignment to help minification
  2811. var top = popperStyles.top,
  2812. left = popperStyles.left,
  2813. transform = popperStyles[transformProp];
  2814. popperStyles.top = '';
  2815. popperStyles.left = '';
  2816. popperStyles[transformProp] = '';
  2817. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  2818. // NOTE: DOM access here
  2819. // restores the original style properties after the offsets have been computed
  2820. popperStyles.top = top;
  2821. popperStyles.left = left;
  2822. popperStyles[transformProp] = transform;
  2823. options.boundaries = boundaries;
  2824. var order = options.priority;
  2825. var popper = data.offsets.popper;
  2826. var check = {
  2827. primary: function primary(placement) {
  2828. var value = popper[placement];
  2829. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  2830. value = Math.max(popper[placement], boundaries[placement]);
  2831. }
  2832. return defineProperty({}, placement, value);
  2833. },
  2834. secondary: function secondary(placement) {
  2835. var mainSide = placement === 'right' ? 'left' : 'top';
  2836. var value = popper[mainSide];
  2837. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  2838. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  2839. }
  2840. return defineProperty({}, mainSide, value);
  2841. }
  2842. };
  2843. order.forEach(function (placement) {
  2844. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  2845. popper = _extends({}, popper, check[side](placement));
  2846. });
  2847. data.offsets.popper = popper;
  2848. return data;
  2849. }
  2850. /**
  2851. * @function
  2852. * @memberof Modifiers
  2853. * @argument {Object} data - The data object generated by `update` method
  2854. * @argument {Object} options - Modifiers configuration and options
  2855. * @returns {Object} The data object, properly modified
  2856. */
  2857. function shift(data) {
  2858. var placement = data.placement;
  2859. var basePlacement = placement.split('-')[0];
  2860. var shiftvariation = placement.split('-')[1];
  2861. // if shift shiftvariation is specified, run the modifier
  2862. if (shiftvariation) {
  2863. var _data$offsets = data.offsets,
  2864. reference = _data$offsets.reference,
  2865. popper = _data$offsets.popper;
  2866. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  2867. var side = isVertical ? 'left' : 'top';
  2868. var measurement = isVertical ? 'width' : 'height';
  2869. var shiftOffsets = {
  2870. start: defineProperty({}, side, reference[side]),
  2871. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  2872. };
  2873. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  2874. }
  2875. return data;
  2876. }
  2877. /**
  2878. * @function
  2879. * @memberof Modifiers
  2880. * @argument {Object} data - The data object generated by update method
  2881. * @argument {Object} options - Modifiers configuration and options
  2882. * @returns {Object} The data object, properly modified
  2883. */
  2884. function hide(data) {
  2885. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  2886. return data;
  2887. }
  2888. var refRect = data.offsets.reference;
  2889. var bound = find(data.instance.modifiers, function (modifier) {
  2890. return modifier.name === 'preventOverflow';
  2891. }).boundaries;
  2892. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  2893. // Avoid unnecessary DOM access if visibility hasn't changed
  2894. if (data.hide === true) {
  2895. return data;
  2896. }
  2897. data.hide = true;
  2898. data.attributes['x-out-of-boundaries'] = '';
  2899. } else {
  2900. // Avoid unnecessary DOM access if visibility hasn't changed
  2901. if (data.hide === false) {
  2902. return data;
  2903. }
  2904. data.hide = false;
  2905. data.attributes['x-out-of-boundaries'] = false;
  2906. }
  2907. return data;
  2908. }
  2909. /**
  2910. * @function
  2911. * @memberof Modifiers
  2912. * @argument {Object} data - The data object generated by `update` method
  2913. * @argument {Object} options - Modifiers configuration and options
  2914. * @returns {Object} The data object, properly modified
  2915. */
  2916. function inner(data) {
  2917. var placement = data.placement;
  2918. var basePlacement = placement.split('-')[0];
  2919. var _data$offsets = data.offsets,
  2920. popper = _data$offsets.popper,
  2921. reference = _data$offsets.reference;
  2922. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  2923. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  2924. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  2925. data.placement = getOppositePlacement(placement);
  2926. data.offsets.popper = getClientRect(popper);
  2927. return data;
  2928. }
  2929. /**
  2930. * Modifier function, each modifier can have a function of this type assigned
  2931. * to its `fn` property.<br />
  2932. * These functions will be called on each update, this means that you must
  2933. * make sure they are performant enough to avoid performance bottlenecks.
  2934. *
  2935. * @function ModifierFn
  2936. * @argument {dataObject} data - The data object generated by `update` method
  2937. * @argument {Object} options - Modifiers configuration and options
  2938. * @returns {dataObject} The data object, properly modified
  2939. */
  2940. /**
  2941. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  2942. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  2943. * needed by the library.
  2944. *
  2945. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  2946. * All the other properties are configurations that could be tweaked.
  2947. * @namespace modifiers
  2948. */
  2949. var modifiers = {
  2950. /**
  2951. * Modifier used to shift the popper on the start or end of its reference
  2952. * element.<br />
  2953. * It will read the variation of the `placement` property.<br />
  2954. * It can be one either `-end` or `-start`.
  2955. * @memberof modifiers
  2956. * @inner
  2957. */
  2958. shift: {
  2959. /** @prop {number} order=100 - Index used to define the order of execution */
  2960. order: 100,
  2961. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  2962. enabled: true,
  2963. /** @prop {ModifierFn} */
  2964. fn: shift
  2965. },
  2966. /**
  2967. * The `offset` modifier can shift your popper on both its axis.
  2968. *
  2969. * It accepts the following units:
  2970. * - `px` or unit-less, interpreted as pixels
  2971. * - `%` or `%r`, percentage relative to the length of the reference element
  2972. * - `%p`, percentage relative to the length of the popper element
  2973. * - `vw`, CSS viewport width unit
  2974. * - `vh`, CSS viewport height unit
  2975. *
  2976. * For length is intended the main axis relative to the placement of the popper.<br />
  2977. * This means that if the placement is `top` or `bottom`, the length will be the
  2978. * `width`. In case of `left` or `right`, it will be the `height`.
  2979. *
  2980. * You can provide a single value (as `Number` or `String`), or a pair of values
  2981. * as `String` divided by a comma or one (or more) white spaces.<br />
  2982. * The latter is a deprecated method because it leads to confusion and will be
  2983. * removed in v2.<br />
  2984. * Additionally, it accepts additions and subtractions between different units.
  2985. * Note that multiplications and divisions aren't supported.
  2986. *
  2987. * Valid examples are:
  2988. * ```
  2989. * 10
  2990. * '10%'
  2991. * '10, 10'
  2992. * '10%, 10'
  2993. * '10 + 10%'
  2994. * '10 - 5vh + 3%'
  2995. * '-10px + 5vh, 5px - 6%'
  2996. * ```
  2997. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  2998. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  2999. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  3000. *
  3001. * @memberof modifiers
  3002. * @inner
  3003. */
  3004. offset: {
  3005. /** @prop {number} order=200 - Index used to define the order of execution */
  3006. order: 200,
  3007. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3008. enabled: true,
  3009. /** @prop {ModifierFn} */
  3010. fn: offset,
  3011. /** @prop {Number|String} offset=0
  3012. * The offset value as described in the modifier description
  3013. */
  3014. offset: 0
  3015. },
  3016. /**
  3017. * Modifier used to prevent the popper from being positioned outside the boundary.
  3018. *
  3019. * A scenario exists where the reference itself is not within the boundaries.<br />
  3020. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  3021. * In this case we need to decide whether the popper should either:
  3022. *
  3023. * - detach from the reference and remain "trapped" in the boundaries, or
  3024. * - if it should ignore the boundary and "escape with its reference"
  3025. *
  3026. * When `escapeWithReference` is set to`true` and reference is completely
  3027. * outside its boundaries, the popper will overflow (or completely leave)
  3028. * the boundaries in order to remain attached to the edge of the reference.
  3029. *
  3030. * @memberof modifiers
  3031. * @inner
  3032. */
  3033. preventOverflow: {
  3034. /** @prop {number} order=300 - Index used to define the order of execution */
  3035. order: 300,
  3036. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3037. enabled: true,
  3038. /** @prop {ModifierFn} */
  3039. fn: preventOverflow,
  3040. /**
  3041. * @prop {Array} [priority=['left','right','top','bottom']]
  3042. * Popper will try to prevent overflow following these priorities by default,
  3043. * then, it could overflow on the left and on top of the `boundariesElement`
  3044. */
  3045. priority: ['left', 'right', 'top', 'bottom'],
  3046. /**
  3047. * @prop {number} padding=5
  3048. * Amount of pixel used to define a minimum distance between the boundaries
  3049. * and the popper. This makes sure the popper always has a little padding
  3050. * between the edges of its container
  3051. */
  3052. padding: 5,
  3053. /**
  3054. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  3055. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  3056. * `viewport` or any DOM element.
  3057. */
  3058. boundariesElement: 'scrollParent'
  3059. },
  3060. /**
  3061. * Modifier used to make sure the reference and its popper stay near each other
  3062. * without leaving any gap between the two. Especially useful when the arrow is
  3063. * enabled and you want to ensure that it points to its reference element.
  3064. * It cares only about the first axis. You can still have poppers with margin
  3065. * between the popper and its reference element.
  3066. * @memberof modifiers
  3067. * @inner
  3068. */
  3069. keepTogether: {
  3070. /** @prop {number} order=400 - Index used to define the order of execution */
  3071. order: 400,
  3072. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3073. enabled: true,
  3074. /** @prop {ModifierFn} */
  3075. fn: keepTogether
  3076. },
  3077. /**
  3078. * This modifier is used to move the `arrowElement` of the popper to make
  3079. * sure it is positioned between the reference element and its popper element.
  3080. * It will read the outer size of the `arrowElement` node to detect how many
  3081. * pixels of conjunction are needed.
  3082. *
  3083. * It has no effect if no `arrowElement` is provided.
  3084. * @memberof modifiers
  3085. * @inner
  3086. */
  3087. arrow: {
  3088. /** @prop {number} order=500 - Index used to define the order of execution */
  3089. order: 500,
  3090. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3091. enabled: true,
  3092. /** @prop {ModifierFn} */
  3093. fn: arrow,
  3094. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  3095. element: '[x-arrow]'
  3096. },
  3097. /**
  3098. * Modifier used to flip the popper's placement when it starts to overlap its
  3099. * reference element.
  3100. *
  3101. * Requires the `preventOverflow` modifier before it in order to work.
  3102. *
  3103. * **NOTE:** this modifier will interrupt the current update cycle and will
  3104. * restart it if it detects the need to flip the placement.
  3105. * @memberof modifiers
  3106. * @inner
  3107. */
  3108. flip: {
  3109. /** @prop {number} order=600 - Index used to define the order of execution */
  3110. order: 600,
  3111. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3112. enabled: true,
  3113. /** @prop {ModifierFn} */
  3114. fn: flip,
  3115. /**
  3116. * @prop {String|Array} behavior='flip'
  3117. * The behavior used to change the popper's placement. It can be one of
  3118. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  3119. * placements (with optional variations)
  3120. */
  3121. behavior: 'flip',
  3122. /**
  3123. * @prop {number} padding=5
  3124. * The popper will flip if it hits the edges of the `boundariesElement`
  3125. */
  3126. padding: 5,
  3127. /**
  3128. * @prop {String|HTMLElement} boundariesElement='viewport'
  3129. * The element which will define the boundaries of the popper position.
  3130. * The popper will never be placed outside of the defined boundaries
  3131. * (except if `keepTogether` is enabled)
  3132. */
  3133. boundariesElement: 'viewport'
  3134. },
  3135. /**
  3136. * Modifier used to make the popper flow toward the inner of the reference element.
  3137. * By default, when this modifier is disabled, the popper will be placed outside
  3138. * the reference element.
  3139. * @memberof modifiers
  3140. * @inner
  3141. */
  3142. inner: {
  3143. /** @prop {number} order=700 - Index used to define the order of execution */
  3144. order: 700,
  3145. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  3146. enabled: false,
  3147. /** @prop {ModifierFn} */
  3148. fn: inner
  3149. },
  3150. /**
  3151. * Modifier used to hide the popper when its reference element is outside of the
  3152. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  3153. * be used to hide with a CSS selector the popper when its reference is
  3154. * out of boundaries.
  3155. *
  3156. * Requires the `preventOverflow` modifier before it in order to work.
  3157. * @memberof modifiers
  3158. * @inner
  3159. */
  3160. hide: {
  3161. /** @prop {number} order=800 - Index used to define the order of execution */
  3162. order: 800,
  3163. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3164. enabled: true,
  3165. /** @prop {ModifierFn} */
  3166. fn: hide
  3167. },
  3168. /**
  3169. * Computes the style that will be applied to the popper element to gets
  3170. * properly positioned.
  3171. *
  3172. * Note that this modifier will not touch the DOM, it just prepares the styles
  3173. * so that `applyStyle` modifier can apply it. This separation is useful
  3174. * in case you need to replace `applyStyle` with a custom implementation.
  3175. *
  3176. * This modifier has `850` as `order` value to maintain backward compatibility
  3177. * with previous versions of Popper.js. Expect the modifiers ordering method
  3178. * to change in future major versions of the library.
  3179. *
  3180. * @memberof modifiers
  3181. * @inner
  3182. */
  3183. computeStyle: {
  3184. /** @prop {number} order=850 - Index used to define the order of execution */
  3185. order: 850,
  3186. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3187. enabled: true,
  3188. /** @prop {ModifierFn} */
  3189. fn: computeStyle,
  3190. /**
  3191. * @prop {Boolean} gpuAcceleration=true
  3192. * If true, it uses the CSS 3D transformation to position the popper.
  3193. * Otherwise, it will use the `top` and `left` properties
  3194. */
  3195. gpuAcceleration: true,
  3196. /**
  3197. * @prop {string} [x='bottom']
  3198. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  3199. * Change this if your popper should grow in a direction different from `bottom`
  3200. */
  3201. x: 'bottom',
  3202. /**
  3203. * @prop {string} [x='left']
  3204. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  3205. * Change this if your popper should grow in a direction different from `right`
  3206. */
  3207. y: 'right'
  3208. },
  3209. /**
  3210. * Applies the computed styles to the popper element.
  3211. *
  3212. * All the DOM manipulations are limited to this modifier. This is useful in case
  3213. * you want to integrate Popper.js inside a framework or view library and you
  3214. * want to delegate all the DOM manipulations to it.
  3215. *
  3216. * Note that if you disable this modifier, you must make sure the popper element
  3217. * has its position set to `absolute` before Popper.js can do its work!
  3218. *
  3219. * Just disable this modifier and define your own to achieve the desired effect.
  3220. *
  3221. * @memberof modifiers
  3222. * @inner
  3223. */
  3224. applyStyle: {
  3225. /** @prop {number} order=900 - Index used to define the order of execution */
  3226. order: 900,
  3227. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3228. enabled: true,
  3229. /** @prop {ModifierFn} */
  3230. fn: applyStyle,
  3231. /** @prop {Function} */
  3232. onLoad: applyStyleOnLoad,
  3233. /**
  3234. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  3235. * @prop {Boolean} gpuAcceleration=true
  3236. * If true, it uses the CSS 3D transformation to position the popper.
  3237. * Otherwise, it will use the `top` and `left` properties
  3238. */
  3239. gpuAcceleration: undefined
  3240. }
  3241. };
  3242. /**
  3243. * The `dataObject` is an object containing all the information used by Popper.js.
  3244. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  3245. * @name dataObject
  3246. * @property {Object} data.instance The Popper.js instance
  3247. * @property {String} data.placement Placement applied to popper
  3248. * @property {String} data.originalPlacement Placement originally defined on init
  3249. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  3250. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  3251. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  3252. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  3253. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  3254. * @property {Object} data.boundaries Offsets of the popper boundaries
  3255. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  3256. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  3257. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  3258. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  3259. */
  3260. /**
  3261. * Default options provided to Popper.js constructor.<br />
  3262. * These can be overridden using the `options` argument of Popper.js.<br />
  3263. * To override an option, simply pass an object with the same
  3264. * structure of the `options` object, as the 3rd argument. For example:
  3265. * ```
  3266. * new Popper(ref, pop, {
  3267. * modifiers: {
  3268. * preventOverflow: { enabled: false }
  3269. * }
  3270. * })
  3271. * ```
  3272. * @type {Object}
  3273. * @static
  3274. * @memberof Popper
  3275. */
  3276. var Defaults = {
  3277. /**
  3278. * Popper's placement.
  3279. * @prop {Popper.placements} placement='bottom'
  3280. */
  3281. placement: 'bottom',
  3282. /**
  3283. * Set this to true if you want popper to position it self in 'fixed' mode
  3284. * @prop {Boolean} positionFixed=false
  3285. */
  3286. positionFixed: false,
  3287. /**
  3288. * Whether events (resize, scroll) are initially enabled.
  3289. * @prop {Boolean} eventsEnabled=true
  3290. */
  3291. eventsEnabled: true,
  3292. /**
  3293. * Set to true if you want to automatically remove the popper when
  3294. * you call the `destroy` method.
  3295. * @prop {Boolean} removeOnDestroy=false
  3296. */
  3297. removeOnDestroy: false,
  3298. /**
  3299. * Callback called when the popper is created.<br />
  3300. * By default, it is set to no-op.<br />
  3301. * Access Popper.js instance with `data.instance`.
  3302. * @prop {onCreate}
  3303. */
  3304. onCreate: function onCreate() {},
  3305. /**
  3306. * Callback called when the popper is updated. This callback is not called
  3307. * on the initialization/creation of the popper, but only on subsequent
  3308. * updates.<br />
  3309. * By default, it is set to no-op.<br />
  3310. * Access Popper.js instance with `data.instance`.
  3311. * @prop {onUpdate}
  3312. */
  3313. onUpdate: function onUpdate() {},
  3314. /**
  3315. * List of modifiers used to modify the offsets before they are applied to the popper.
  3316. * They provide most of the functionalities of Popper.js.
  3317. * @prop {modifiers}
  3318. */
  3319. modifiers: modifiers
  3320. };
  3321. /**
  3322. * @callback onCreate
  3323. * @param {dataObject} data
  3324. */
  3325. /**
  3326. * @callback onUpdate
  3327. * @param {dataObject} data
  3328. */
  3329. // Utils
  3330. // Methods
  3331. var Popper = function () {
  3332. /**
  3333. * Creates a new Popper.js instance.
  3334. * @class Popper
  3335. * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
  3336. * @param {HTMLElement} popper - The HTML element used as the popper
  3337. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  3338. * @return {Object} instance - The generated Popper.js instance
  3339. */
  3340. function Popper(reference, popper) {
  3341. var _this = this;
  3342. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3343. classCallCheck(this, Popper);
  3344. this.scheduleUpdate = function () {
  3345. return requestAnimationFrame(_this.update);
  3346. };
  3347. // make update() debounced, so that it only runs at most once-per-tick
  3348. this.update = debounce(this.update.bind(this));
  3349. // with {} we create a new object with the options inside it
  3350. this.options = _extends({}, Popper.Defaults, options);
  3351. // init state
  3352. this.state = {
  3353. isDestroyed: false,
  3354. isCreated: false,
  3355. scrollParents: []
  3356. };
  3357. // get reference and popper elements (allow jQuery wrappers)
  3358. this.reference = reference && reference.jquery ? reference[0] : reference;
  3359. this.popper = popper && popper.jquery ? popper[0] : popper;
  3360. // Deep merge modifiers options
  3361. this.options.modifiers = {};
  3362. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  3363. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  3364. });
  3365. // Refactoring modifiers' list (Object => Array)
  3366. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  3367. return _extends({
  3368. name: name
  3369. }, _this.options.modifiers[name]);
  3370. })
  3371. // sort the modifiers by order
  3372. .sort(function (a, b) {
  3373. return a.order - b.order;
  3374. });
  3375. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  3376. // such code is executed in the same order of its modifier
  3377. // they could add new properties to their options configuration
  3378. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  3379. this.modifiers.forEach(function (modifierOptions) {
  3380. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  3381. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  3382. }
  3383. });
  3384. // fire the first update to position the popper in the right place
  3385. this.update();
  3386. var eventsEnabled = this.options.eventsEnabled;
  3387. if (eventsEnabled) {
  3388. // setup event listeners, they will take care of update the position in specific situations
  3389. this.enableEventListeners();
  3390. }
  3391. this.state.eventsEnabled = eventsEnabled;
  3392. }
  3393. // We can't use class properties because they don't get listed in the
  3394. // class prototype and break stuff like Sinon stubs
  3395. createClass(Popper, [{
  3396. key: 'update',
  3397. value: function update$$1() {
  3398. return update.call(this);
  3399. }
  3400. }, {
  3401. key: 'destroy',
  3402. value: function destroy$$1() {
  3403. return destroy.call(this);
  3404. }
  3405. }, {
  3406. key: 'enableEventListeners',
  3407. value: function enableEventListeners$$1() {
  3408. return enableEventListeners.call(this);
  3409. }
  3410. }, {
  3411. key: 'disableEventListeners',
  3412. value: function disableEventListeners$$1() {
  3413. return disableEventListeners.call(this);
  3414. }
  3415. /**
  3416. * Schedules an update. It will run on the next UI update available.
  3417. * @method scheduleUpdate
  3418. * @memberof Popper
  3419. */
  3420. /**
  3421. * Collection of utilities useful when writing custom modifiers.
  3422. * Starting from version 1.7, this method is available only if you
  3423. * include `popper-utils.js` before `popper.js`.
  3424. *
  3425. * **DEPRECATION**: This way to access PopperUtils is deprecated
  3426. * and will be removed in v2! Use the PopperUtils module directly instead.
  3427. * Due to the high instability of the methods contained in Utils, we can't
  3428. * guarantee them to follow semver. Use them at your own risk!
  3429. * @static
  3430. * @private
  3431. * @type {Object}
  3432. * @deprecated since version 1.8
  3433. * @member Utils
  3434. * @memberof Popper
  3435. */
  3436. }]);
  3437. return Popper;
  3438. }();
  3439. /**
  3440. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  3441. * and lets you use it as replacement of a real DOM node.<br />
  3442. * You can use this method to position a popper relatively to a set of coordinates
  3443. * in case you don't have a DOM node to use as reference.
  3444. *
  3445. * ```
  3446. * new Popper(referenceObject, popperNode);
  3447. * ```
  3448. *
  3449. * NB: This feature isn't supported in Internet Explorer 10.
  3450. * @name referenceObject
  3451. * @property {Function} data.getBoundingClientRect
  3452. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  3453. * @property {number} data.clientWidth
  3454. * An ES6 getter that will return the width of the virtual reference element.
  3455. * @property {number} data.clientHeight
  3456. * An ES6 getter that will return the height of the virtual reference element.
  3457. */
  3458. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  3459. Popper.placements = placements;
  3460. Popper.Defaults = Defaults;
  3461. /**
  3462. * ------------------------------------------------------------------------
  3463. * Constants
  3464. * ------------------------------------------------------------------------
  3465. */
  3466. var NAME$4 = 'dropdown';
  3467. var VERSION$4 = '4.2.1';
  3468. var DATA_KEY$4 = 'bs.dropdown';
  3469. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3470. var DATA_API_KEY$4 = '.data-api';
  3471. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3472. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3473. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3474. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3475. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3476. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3477. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3478. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3479. var Event$4 = {
  3480. HIDE: "hide" + EVENT_KEY$4,
  3481. HIDDEN: "hidden" + EVENT_KEY$4,
  3482. SHOW: "show" + EVENT_KEY$4,
  3483. SHOWN: "shown" + EVENT_KEY$4,
  3484. CLICK: "click" + EVENT_KEY$4,
  3485. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3486. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3487. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3488. };
  3489. var ClassName$4 = {
  3490. DISABLED: 'disabled',
  3491. SHOW: 'show',
  3492. DROPUP: 'dropup',
  3493. DROPRIGHT: 'dropright',
  3494. DROPLEFT: 'dropleft',
  3495. MENURIGHT: 'dropdown-menu-right',
  3496. MENULEFT: 'dropdown-menu-left',
  3497. POSITION_STATIC: 'position-static'
  3498. };
  3499. var Selector$4 = {
  3500. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3501. FORM_CHILD: '.dropdown form',
  3502. MENU: '.dropdown-menu',
  3503. NAVBAR_NAV: '.navbar-nav',
  3504. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3505. };
  3506. var AttachmentMap = {
  3507. TOP: 'top-start',
  3508. TOPEND: 'top-end',
  3509. BOTTOM: 'bottom-start',
  3510. BOTTOMEND: 'bottom-end',
  3511. RIGHT: 'right-start',
  3512. RIGHTEND: 'right-end',
  3513. LEFT: 'left-start',
  3514. LEFTEND: 'left-end'
  3515. };
  3516. var Default$2 = {
  3517. offset: 0,
  3518. flip: true,
  3519. boundary: 'scrollParent',
  3520. reference: 'toggle',
  3521. display: 'dynamic'
  3522. };
  3523. var DefaultType$2 = {
  3524. offset: '(number|string|function)',
  3525. flip: 'boolean',
  3526. boundary: '(string|element)',
  3527. reference: '(string|element)',
  3528. display: 'string'
  3529. /**
  3530. * ------------------------------------------------------------------------
  3531. * Class Definition
  3532. * ------------------------------------------------------------------------
  3533. */
  3534. };
  3535. var Dropdown =
  3536. /*#__PURE__*/
  3537. function () {
  3538. function Dropdown(element, config) {
  3539. this._element = element;
  3540. this._popper = null;
  3541. this._config = this._getConfig(config);
  3542. this._menu = this._getMenuElement();
  3543. this._inNavbar = this._detectNavbar();
  3544. this._addEventListeners();
  3545. } // Getters
  3546. var _proto = Dropdown.prototype;
  3547. // Public
  3548. _proto.toggle = function toggle() {
  3549. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3550. return;
  3551. }
  3552. var parent = Dropdown._getParentFromElement(this._element);
  3553. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3554. Dropdown._clearMenus();
  3555. if (isActive) {
  3556. return;
  3557. }
  3558. var relatedTarget = {
  3559. relatedTarget: this._element
  3560. };
  3561. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3562. $(parent).trigger(showEvent);
  3563. if (showEvent.isDefaultPrevented()) {
  3564. return;
  3565. } // Disable totally Popper.js for Dropdown in Navbar
  3566. if (!this._inNavbar) {
  3567. /**
  3568. * Check for Popper dependency
  3569. * Popper - https://popper.js.org
  3570. */
  3571. if (typeof Popper === 'undefined') {
  3572. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3573. }
  3574. var referenceElement = this._element;
  3575. if (this._config.reference === 'parent') {
  3576. referenceElement = parent;
  3577. } else if (Util.isElement(this._config.reference)) {
  3578. referenceElement = this._config.reference; // Check if it's jQuery element
  3579. if (typeof this._config.reference.jquery !== 'undefined') {
  3580. referenceElement = this._config.reference[0];
  3581. }
  3582. } // If boundary is not `scrollParent`, then set position to `static`
  3583. // to allow the menu to "escape" the scroll parent's boundaries
  3584. // https://github.com/twbs/bootstrap/issues/24251
  3585. if (this._config.boundary !== 'scrollParent') {
  3586. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3587. }
  3588. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3589. } // If this is a touch-enabled device we add extra
  3590. // empty mouseover listeners to the body's immediate children;
  3591. // only needed because of broken event delegation on iOS
  3592. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3593. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3594. $(document.body).children().on('mouseover', null, $.noop);
  3595. }
  3596. this._element.focus();
  3597. this._element.setAttribute('aria-expanded', true);
  3598. $(this._menu).toggleClass(ClassName$4.SHOW);
  3599. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3600. };
  3601. _proto.show = function show() {
  3602. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3603. return;
  3604. }
  3605. var relatedTarget = {
  3606. relatedTarget: this._element
  3607. };
  3608. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3609. var parent = Dropdown._getParentFromElement(this._element);
  3610. $(parent).trigger(showEvent);
  3611. if (showEvent.isDefaultPrevented()) {
  3612. return;
  3613. }
  3614. $(this._menu).toggleClass(ClassName$4.SHOW);
  3615. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3616. };
  3617. _proto.hide = function hide() {
  3618. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3619. return;
  3620. }
  3621. var relatedTarget = {
  3622. relatedTarget: this._element
  3623. };
  3624. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3625. var parent = Dropdown._getParentFromElement(this._element);
  3626. $(parent).trigger(hideEvent);
  3627. if (hideEvent.isDefaultPrevented()) {
  3628. return;
  3629. }
  3630. $(this._menu).toggleClass(ClassName$4.SHOW);
  3631. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3632. };
  3633. _proto.dispose = function dispose() {
  3634. $.removeData(this._element, DATA_KEY$4);
  3635. $(this._element).off(EVENT_KEY$4);
  3636. this._element = null;
  3637. this._menu = null;
  3638. if (this._popper !== null) {
  3639. this._popper.destroy();
  3640. this._popper = null;
  3641. }
  3642. };
  3643. _proto.update = function update() {
  3644. this._inNavbar = this._detectNavbar();
  3645. if (this._popper !== null) {
  3646. this._popper.scheduleUpdate();
  3647. }
  3648. }; // Private
  3649. _proto._addEventListeners = function _addEventListeners() {
  3650. var _this = this;
  3651. $(this._element).on(Event$4.CLICK, function (event) {
  3652. event.preventDefault();
  3653. event.stopPropagation();
  3654. _this.toggle();
  3655. });
  3656. };
  3657. _proto._getConfig = function _getConfig(config) {
  3658. config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
  3659. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3660. return config;
  3661. };
  3662. _proto._getMenuElement = function _getMenuElement() {
  3663. if (!this._menu) {
  3664. var parent = Dropdown._getParentFromElement(this._element);
  3665. if (parent) {
  3666. this._menu = parent.querySelector(Selector$4.MENU);
  3667. }
  3668. }
  3669. return this._menu;
  3670. };
  3671. _proto._getPlacement = function _getPlacement() {
  3672. var $parentDropdown = $(this._element.parentNode);
  3673. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3674. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3675. placement = AttachmentMap.TOP;
  3676. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3677. placement = AttachmentMap.TOPEND;
  3678. }
  3679. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3680. placement = AttachmentMap.RIGHT;
  3681. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3682. placement = AttachmentMap.LEFT;
  3683. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3684. placement = AttachmentMap.BOTTOMEND;
  3685. }
  3686. return placement;
  3687. };
  3688. _proto._detectNavbar = function _detectNavbar() {
  3689. return $(this._element).closest('.navbar').length > 0;
  3690. };
  3691. _proto._getPopperConfig = function _getPopperConfig() {
  3692. var _this2 = this;
  3693. var offsetConf = {};
  3694. if (typeof this._config.offset === 'function') {
  3695. offsetConf.fn = function (data) {
  3696. data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets) || {});
  3697. return data;
  3698. };
  3699. } else {
  3700. offsetConf.offset = this._config.offset;
  3701. }
  3702. var popperConfig = {
  3703. placement: this._getPlacement(),
  3704. modifiers: {
  3705. offset: offsetConf,
  3706. flip: {
  3707. enabled: this._config.flip
  3708. },
  3709. preventOverflow: {
  3710. boundariesElement: this._config.boundary
  3711. }
  3712. } // Disable Popper.js if we have a static display
  3713. };
  3714. if (this._config.display === 'static') {
  3715. popperConfig.modifiers.applyStyle = {
  3716. enabled: false
  3717. };
  3718. }
  3719. return popperConfig;
  3720. }; // Static
  3721. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3722. return this.each(function () {
  3723. var data = $(this).data(DATA_KEY$4);
  3724. var _config = typeof config === 'object' ? config : null;
  3725. if (!data) {
  3726. data = new Dropdown(this, _config);
  3727. $(this).data(DATA_KEY$4, data);
  3728. }
  3729. if (typeof config === 'string') {
  3730. if (typeof data[config] === 'undefined') {
  3731. throw new TypeError("No method named \"" + config + "\"");
  3732. }
  3733. data[config]();
  3734. }
  3735. });
  3736. };
  3737. Dropdown._clearMenus = function _clearMenus(event) {
  3738. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3739. return;
  3740. }
  3741. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3742. for (var i = 0, len = toggles.length; i < len; i++) {
  3743. var parent = Dropdown._getParentFromElement(toggles[i]);
  3744. var context = $(toggles[i]).data(DATA_KEY$4);
  3745. var relatedTarget = {
  3746. relatedTarget: toggles[i]
  3747. };
  3748. if (event && event.type === 'click') {
  3749. relatedTarget.clickEvent = event;
  3750. }
  3751. if (!context) {
  3752. continue;
  3753. }
  3754. var dropdownMenu = context._menu;
  3755. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3756. continue;
  3757. }
  3758. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3759. continue;
  3760. }
  3761. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3762. $(parent).trigger(hideEvent);
  3763. if (hideEvent.isDefaultPrevented()) {
  3764. continue;
  3765. } // If this is a touch-enabled device we remove the extra
  3766. // empty mouseover listeners we added for iOS support
  3767. if ('ontouchstart' in document.documentElement) {
  3768. $(document.body).children().off('mouseover', null, $.noop);
  3769. }
  3770. toggles[i].setAttribute('aria-expanded', 'false');
  3771. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3772. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3773. }
  3774. };
  3775. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3776. var parent;
  3777. var selector = Util.getSelectorFromElement(element);
  3778. if (selector) {
  3779. parent = document.querySelector(selector);
  3780. }
  3781. return parent || element.parentNode;
  3782. }; // eslint-disable-next-line complexity
  3783. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3784. // If not input/textarea:
  3785. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3786. // If input/textarea:
  3787. // - If space key => not a dropdown command
  3788. // - If key is other than escape
  3789. // - If key is not up or down => not a dropdown command
  3790. // - If trigger inside the menu => not a dropdown command
  3791. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3792. return;
  3793. }
  3794. event.preventDefault();
  3795. event.stopPropagation();
  3796. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3797. return;
  3798. }
  3799. var parent = Dropdown._getParentFromElement(this);
  3800. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3801. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3802. if (event.which === ESCAPE_KEYCODE) {
  3803. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3804. $(toggle).trigger('focus');
  3805. }
  3806. $(this).trigger('click');
  3807. return;
  3808. }
  3809. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS));
  3810. if (items.length === 0) {
  3811. return;
  3812. }
  3813. var index = items.indexOf(event.target);
  3814. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3815. // Up
  3816. index--;
  3817. }
  3818. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3819. // Down
  3820. index++;
  3821. }
  3822. if (index < 0) {
  3823. index = 0;
  3824. }
  3825. items[index].focus();
  3826. };
  3827. _createClass(Dropdown, null, [{
  3828. key: "VERSION",
  3829. get: function get() {
  3830. return VERSION$4;
  3831. }
  3832. }, {
  3833. key: "Default",
  3834. get: function get() {
  3835. return Default$2;
  3836. }
  3837. }, {
  3838. key: "DefaultType",
  3839. get: function get() {
  3840. return DefaultType$2;
  3841. }
  3842. }]);
  3843. return Dropdown;
  3844. }();
  3845. /**
  3846. * ------------------------------------------------------------------------
  3847. * Data Api implementation
  3848. * ------------------------------------------------------------------------
  3849. */
  3850. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  3851. event.preventDefault();
  3852. event.stopPropagation();
  3853. Dropdown._jQueryInterface.call($(this), 'toggle');
  3854. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3855. e.stopPropagation();
  3856. });
  3857. /**
  3858. * ------------------------------------------------------------------------
  3859. * jQuery
  3860. * ------------------------------------------------------------------------
  3861. */
  3862. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3863. $.fn[NAME$4].Constructor = Dropdown;
  3864. $.fn[NAME$4].noConflict = function () {
  3865. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3866. return Dropdown._jQueryInterface;
  3867. };
  3868. /**
  3869. * ------------------------------------------------------------------------
  3870. * Constants
  3871. * ------------------------------------------------------------------------
  3872. */
  3873. var NAME$5 = 'modal';
  3874. var VERSION$5 = '4.2.1';
  3875. var DATA_KEY$5 = 'bs.modal';
  3876. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3877. var DATA_API_KEY$5 = '.data-api';
  3878. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3879. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3880. var Default$3 = {
  3881. backdrop: true,
  3882. keyboard: true,
  3883. focus: true,
  3884. show: true
  3885. };
  3886. var DefaultType$3 = {
  3887. backdrop: '(boolean|string)',
  3888. keyboard: 'boolean',
  3889. focus: 'boolean',
  3890. show: 'boolean'
  3891. };
  3892. var Event$5 = {
  3893. HIDE: "hide" + EVENT_KEY$5,
  3894. HIDDEN: "hidden" + EVENT_KEY$5,
  3895. SHOW: "show" + EVENT_KEY$5,
  3896. SHOWN: "shown" + EVENT_KEY$5,
  3897. FOCUSIN: "focusin" + EVENT_KEY$5,
  3898. RESIZE: "resize" + EVENT_KEY$5,
  3899. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3900. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3901. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3902. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3903. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3904. };
  3905. var ClassName$5 = {
  3906. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3907. BACKDROP: 'modal-backdrop',
  3908. OPEN: 'modal-open',
  3909. FADE: 'fade',
  3910. SHOW: 'show'
  3911. };
  3912. var Selector$5 = {
  3913. DIALOG: '.modal-dialog',
  3914. DATA_TOGGLE: '[data-toggle="modal"]',
  3915. DATA_DISMISS: '[data-dismiss="modal"]',
  3916. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3917. STICKY_CONTENT: '.sticky-top'
  3918. /**
  3919. * ------------------------------------------------------------------------
  3920. * Class Definition
  3921. * ------------------------------------------------------------------------
  3922. */
  3923. };
  3924. var Modal =
  3925. /*#__PURE__*/
  3926. function () {
  3927. function Modal(element, config) {
  3928. this._config = this._getConfig(config);
  3929. this._element = element;
  3930. this._dialog = element.querySelector(Selector$5.DIALOG);
  3931. this._backdrop = null;
  3932. this._isShown = false;
  3933. this._isBodyOverflowing = false;
  3934. this._ignoreBackdropClick = false;
  3935. this._isTransitioning = false;
  3936. this._scrollbarWidth = 0;
  3937. } // Getters
  3938. var _proto = Modal.prototype;
  3939. // Public
  3940. _proto.toggle = function toggle(relatedTarget) {
  3941. return this._isShown ? this.hide() : this.show(relatedTarget);
  3942. };
  3943. _proto.show = function show(relatedTarget) {
  3944. var _this = this;
  3945. if (this._isShown || this._isTransitioning) {
  3946. return;
  3947. }
  3948. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3949. this._isTransitioning = true;
  3950. }
  3951. var showEvent = $.Event(Event$5.SHOW, {
  3952. relatedTarget: relatedTarget
  3953. });
  3954. $(this._element).trigger(showEvent);
  3955. if (this._isShown || showEvent.isDefaultPrevented()) {
  3956. return;
  3957. }
  3958. this._isShown = true;
  3959. this._checkScrollbar();
  3960. this._setScrollbar();
  3961. this._adjustDialog();
  3962. this._setEscapeEvent();
  3963. this._setResizeEvent();
  3964. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3965. return _this.hide(event);
  3966. });
  3967. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3968. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3969. if ($(event.target).is(_this._element)) {
  3970. _this._ignoreBackdropClick = true;
  3971. }
  3972. });
  3973. });
  3974. this._showBackdrop(function () {
  3975. return _this._showElement(relatedTarget);
  3976. });
  3977. };
  3978. _proto.hide = function hide(event) {
  3979. var _this2 = this;
  3980. if (event) {
  3981. event.preventDefault();
  3982. }
  3983. if (!this._isShown || this._isTransitioning) {
  3984. return;
  3985. }
  3986. var hideEvent = $.Event(Event$5.HIDE);
  3987. $(this._element).trigger(hideEvent);
  3988. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3989. return;
  3990. }
  3991. this._isShown = false;
  3992. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3993. if (transition) {
  3994. this._isTransitioning = true;
  3995. }
  3996. this._setEscapeEvent();
  3997. this._setResizeEvent();
  3998. $(document).off(Event$5.FOCUSIN);
  3999. $(this._element).removeClass(ClassName$5.SHOW);
  4000. $(this._element).off(Event$5.CLICK_DISMISS);
  4001. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4002. if (transition) {
  4003. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4004. $(this._element).one(Util.TRANSITION_END, function (event) {
  4005. return _this2._hideModal(event);
  4006. }).emulateTransitionEnd(transitionDuration);
  4007. } else {
  4008. this._hideModal();
  4009. }
  4010. };
  4011. _proto.dispose = function dispose() {
  4012. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4013. return $(htmlElement).off(EVENT_KEY$5);
  4014. });
  4015. /**
  4016. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4017. * Do not move `document` in `htmlElements` array
  4018. * It will remove `Event.CLICK_DATA_API` event that should remain
  4019. */
  4020. $(document).off(Event$5.FOCUSIN);
  4021. $.removeData(this._element, DATA_KEY$5);
  4022. this._config = null;
  4023. this._element = null;
  4024. this._dialog = null;
  4025. this._backdrop = null;
  4026. this._isShown = null;
  4027. this._isBodyOverflowing = null;
  4028. this._ignoreBackdropClick = null;
  4029. this._isTransitioning = null;
  4030. this._scrollbarWidth = null;
  4031. };
  4032. _proto.handleUpdate = function handleUpdate() {
  4033. this._adjustDialog();
  4034. }; // Private
  4035. _proto._getConfig = function _getConfig(config) {
  4036. config = _objectSpread({}, Default$3, config);
  4037. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4038. return config;
  4039. };
  4040. _proto._showElement = function _showElement(relatedTarget) {
  4041. var _this3 = this;
  4042. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4043. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4044. // Don't move modal's DOM position
  4045. document.body.appendChild(this._element);
  4046. }
  4047. this._element.style.display = 'block';
  4048. this._element.removeAttribute('aria-hidden');
  4049. this._element.setAttribute('aria-modal', true);
  4050. this._element.scrollTop = 0;
  4051. if (transition) {
  4052. Util.reflow(this._element);
  4053. }
  4054. $(this._element).addClass(ClassName$5.SHOW);
  4055. if (this._config.focus) {
  4056. this._enforceFocus();
  4057. }
  4058. var shownEvent = $.Event(Event$5.SHOWN, {
  4059. relatedTarget: relatedTarget
  4060. });
  4061. var transitionComplete = function transitionComplete() {
  4062. if (_this3._config.focus) {
  4063. _this3._element.focus();
  4064. }
  4065. _this3._isTransitioning = false;
  4066. $(_this3._element).trigger(shownEvent);
  4067. };
  4068. if (transition) {
  4069. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4070. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4071. } else {
  4072. transitionComplete();
  4073. }
  4074. };
  4075. _proto._enforceFocus = function _enforceFocus() {
  4076. var _this4 = this;
  4077. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4078. .on(Event$5.FOCUSIN, function (event) {
  4079. if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
  4080. _this4._element.focus();
  4081. }
  4082. });
  4083. };
  4084. _proto._setEscapeEvent = function _setEscapeEvent() {
  4085. var _this5 = this;
  4086. if (this._isShown && this._config.keyboard) {
  4087. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4088. if (event.which === ESCAPE_KEYCODE$1) {
  4089. event.preventDefault();
  4090. _this5.hide();
  4091. }
  4092. });
  4093. } else if (!this._isShown) {
  4094. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4095. }
  4096. };
  4097. _proto._setResizeEvent = function _setResizeEvent() {
  4098. var _this6 = this;
  4099. if (this._isShown) {
  4100. $(window).on(Event$5.RESIZE, function (event) {
  4101. return _this6.handleUpdate(event);
  4102. });
  4103. } else {
  4104. $(window).off(Event$5.RESIZE);
  4105. }
  4106. };
  4107. _proto._hideModal = function _hideModal() {
  4108. var _this7 = this;
  4109. this._element.style.display = 'none';
  4110. this._element.setAttribute('aria-hidden', true);
  4111. this._element.removeAttribute('aria-modal');
  4112. this._isTransitioning = false;
  4113. this._showBackdrop(function () {
  4114. $(document.body).removeClass(ClassName$5.OPEN);
  4115. _this7._resetAdjustments();
  4116. _this7._resetScrollbar();
  4117. $(_this7._element).trigger(Event$5.HIDDEN);
  4118. });
  4119. };
  4120. _proto._removeBackdrop = function _removeBackdrop() {
  4121. if (this._backdrop) {
  4122. $(this._backdrop).remove();
  4123. this._backdrop = null;
  4124. }
  4125. };
  4126. _proto._showBackdrop = function _showBackdrop(callback) {
  4127. var _this8 = this;
  4128. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4129. if (this._isShown && this._config.backdrop) {
  4130. this._backdrop = document.createElement('div');
  4131. this._backdrop.className = ClassName$5.BACKDROP;
  4132. if (animate) {
  4133. this._backdrop.classList.add(animate);
  4134. }
  4135. $(this._backdrop).appendTo(document.body);
  4136. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4137. if (_this8._ignoreBackdropClick) {
  4138. _this8._ignoreBackdropClick = false;
  4139. return;
  4140. }
  4141. if (event.target !== event.currentTarget) {
  4142. return;
  4143. }
  4144. if (_this8._config.backdrop === 'static') {
  4145. _this8._element.focus();
  4146. } else {
  4147. _this8.hide();
  4148. }
  4149. });
  4150. if (animate) {
  4151. Util.reflow(this._backdrop);
  4152. }
  4153. $(this._backdrop).addClass(ClassName$5.SHOW);
  4154. if (!callback) {
  4155. return;
  4156. }
  4157. if (!animate) {
  4158. callback();
  4159. return;
  4160. }
  4161. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4162. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4163. } else if (!this._isShown && this._backdrop) {
  4164. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4165. var callbackRemove = function callbackRemove() {
  4166. _this8._removeBackdrop();
  4167. if (callback) {
  4168. callback();
  4169. }
  4170. };
  4171. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4172. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4173. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4174. } else {
  4175. callbackRemove();
  4176. }
  4177. } else if (callback) {
  4178. callback();
  4179. }
  4180. }; // ----------------------------------------------------------------------
  4181. // the following methods are used to handle overflowing modals
  4182. // todo (fat): these should probably be refactored out of modal.js
  4183. // ----------------------------------------------------------------------
  4184. _proto._adjustDialog = function _adjustDialog() {
  4185. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4186. if (!this._isBodyOverflowing && isModalOverflowing) {
  4187. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4188. }
  4189. if (this._isBodyOverflowing && !isModalOverflowing) {
  4190. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4191. }
  4192. };
  4193. _proto._resetAdjustments = function _resetAdjustments() {
  4194. this._element.style.paddingLeft = '';
  4195. this._element.style.paddingRight = '';
  4196. };
  4197. _proto._checkScrollbar = function _checkScrollbar() {
  4198. var rect = document.body.getBoundingClientRect();
  4199. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4200. this._scrollbarWidth = this._getScrollbarWidth();
  4201. };
  4202. _proto._setScrollbar = function _setScrollbar() {
  4203. var _this9 = this;
  4204. if (this._isBodyOverflowing) {
  4205. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4206. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4207. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4208. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4209. $(fixedContent).each(function (index, element) {
  4210. var actualPadding = element.style.paddingRight;
  4211. var calculatedPadding = $(element).css('padding-right');
  4212. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
  4213. }); // Adjust sticky content margin
  4214. $(stickyContent).each(function (index, element) {
  4215. var actualMargin = element.style.marginRight;
  4216. var calculatedMargin = $(element).css('margin-right');
  4217. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
  4218. }); // Adjust body padding
  4219. var actualPadding = document.body.style.paddingRight;
  4220. var calculatedPadding = $(document.body).css('padding-right');
  4221. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4222. }
  4223. $(document.body).addClass(ClassName$5.OPEN);
  4224. };
  4225. _proto._resetScrollbar = function _resetScrollbar() {
  4226. // Restore fixed content padding
  4227. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4228. $(fixedContent).each(function (index, element) {
  4229. var padding = $(element).data('padding-right');
  4230. $(element).removeData('padding-right');
  4231. element.style.paddingRight = padding ? padding : '';
  4232. }); // Restore sticky content
  4233. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4234. $(elements).each(function (index, element) {
  4235. var margin = $(element).data('margin-right');
  4236. if (typeof margin !== 'undefined') {
  4237. $(element).css('margin-right', margin).removeData('margin-right');
  4238. }
  4239. }); // Restore body padding
  4240. var padding = $(document.body).data('padding-right');
  4241. $(document.body).removeData('padding-right');
  4242. document.body.style.paddingRight = padding ? padding : '';
  4243. };
  4244. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4245. // thx d.walsh
  4246. var scrollDiv = document.createElement('div');
  4247. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4248. document.body.appendChild(scrollDiv);
  4249. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4250. document.body.removeChild(scrollDiv);
  4251. return scrollbarWidth;
  4252. }; // Static
  4253. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4254. return this.each(function () {
  4255. var data = $(this).data(DATA_KEY$5);
  4256. var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
  4257. if (!data) {
  4258. data = new Modal(this, _config);
  4259. $(this).data(DATA_KEY$5, data);
  4260. }
  4261. if (typeof config === 'string') {
  4262. if (typeof data[config] === 'undefined') {
  4263. throw new TypeError("No method named \"" + config + "\"");
  4264. }
  4265. data[config](relatedTarget);
  4266. } else if (_config.show) {
  4267. data.show(relatedTarget);
  4268. }
  4269. });
  4270. };
  4271. _createClass(Modal, null, [{
  4272. key: "VERSION",
  4273. get: function get() {
  4274. return VERSION$5;
  4275. }
  4276. }, {
  4277. key: "Default",
  4278. get: function get() {
  4279. return Default$3;
  4280. }
  4281. }]);
  4282. return Modal;
  4283. }();
  4284. /**
  4285. * ------------------------------------------------------------------------
  4286. * Data Api implementation
  4287. * ------------------------------------------------------------------------
  4288. */
  4289. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4290. var _this10 = this;
  4291. var target;
  4292. var selector = Util.getSelectorFromElement(this);
  4293. if (selector) {
  4294. target = document.querySelector(selector);
  4295. }
  4296. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());
  4297. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4298. event.preventDefault();
  4299. }
  4300. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4301. if (showEvent.isDefaultPrevented()) {
  4302. // Only register focus restorer if modal will actually get shown
  4303. return;
  4304. }
  4305. $target.one(Event$5.HIDDEN, function () {
  4306. if ($(_this10).is(':visible')) {
  4307. _this10.focus();
  4308. }
  4309. });
  4310. });
  4311. Modal._jQueryInterface.call($(target), config, this);
  4312. });
  4313. /**
  4314. * ------------------------------------------------------------------------
  4315. * jQuery
  4316. * ------------------------------------------------------------------------
  4317. */
  4318. $.fn[NAME$5] = Modal._jQueryInterface;
  4319. $.fn[NAME$5].Constructor = Modal;
  4320. $.fn[NAME$5].noConflict = function () {
  4321. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4322. return Modal._jQueryInterface;
  4323. };
  4324. /**
  4325. * ------------------------------------------------------------------------
  4326. * Constants
  4327. * ------------------------------------------------------------------------
  4328. */
  4329. var NAME$6 = 'tooltip';
  4330. var VERSION$6 = '4.2.1';
  4331. var DATA_KEY$6 = 'bs.tooltip';
  4332. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4333. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4334. var CLASS_PREFIX = 'bs-tooltip';
  4335. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4336. var DefaultType$4 = {
  4337. animation: 'boolean',
  4338. template: 'string',
  4339. title: '(string|element|function)',
  4340. trigger: 'string',
  4341. delay: '(number|object)',
  4342. html: 'boolean',
  4343. selector: '(string|boolean)',
  4344. placement: '(string|function)',
  4345. offset: '(number|string)',
  4346. container: '(string|element|boolean)',
  4347. fallbackPlacement: '(string|array)',
  4348. boundary: '(string|element)'
  4349. };
  4350. var AttachmentMap$1 = {
  4351. AUTO: 'auto',
  4352. TOP: 'top',
  4353. RIGHT: 'right',
  4354. BOTTOM: 'bottom',
  4355. LEFT: 'left'
  4356. };
  4357. var Default$4 = {
  4358. animation: true,
  4359. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4360. trigger: 'hover focus',
  4361. title: '',
  4362. delay: 0,
  4363. html: false,
  4364. selector: false,
  4365. placement: 'top',
  4366. offset: 0,
  4367. container: false,
  4368. fallbackPlacement: 'flip',
  4369. boundary: 'scrollParent'
  4370. };
  4371. var HoverState = {
  4372. SHOW: 'show',
  4373. OUT: 'out'
  4374. };
  4375. var Event$6 = {
  4376. HIDE: "hide" + EVENT_KEY$6,
  4377. HIDDEN: "hidden" + EVENT_KEY$6,
  4378. SHOW: "show" + EVENT_KEY$6,
  4379. SHOWN: "shown" + EVENT_KEY$6,
  4380. INSERTED: "inserted" + EVENT_KEY$6,
  4381. CLICK: "click" + EVENT_KEY$6,
  4382. FOCUSIN: "focusin" + EVENT_KEY$6,
  4383. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4384. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4385. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4386. };
  4387. var ClassName$6 = {
  4388. FADE: 'fade',
  4389. SHOW: 'show'
  4390. };
  4391. var Selector$6 = {
  4392. TOOLTIP: '.tooltip',
  4393. TOOLTIP_INNER: '.tooltip-inner',
  4394. ARROW: '.arrow'
  4395. };
  4396. var Trigger = {
  4397. HOVER: 'hover',
  4398. FOCUS: 'focus',
  4399. CLICK: 'click',
  4400. MANUAL: 'manual'
  4401. /**
  4402. * ------------------------------------------------------------------------
  4403. * Class Definition
  4404. * ------------------------------------------------------------------------
  4405. */
  4406. };
  4407. var Tooltip =
  4408. /*#__PURE__*/
  4409. function () {
  4410. function Tooltip(element, config) {
  4411. /**
  4412. * Check for Popper dependency
  4413. * Popper - https://popper.js.org
  4414. */
  4415. if (typeof Popper === 'undefined') {
  4416. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4417. } // private
  4418. this._isEnabled = true;
  4419. this._timeout = 0;
  4420. this._hoverState = '';
  4421. this._activeTrigger = {};
  4422. this._popper = null; // Protected
  4423. this.element = element;
  4424. this.config = this._getConfig(config);
  4425. this.tip = null;
  4426. this._setListeners();
  4427. } // Getters
  4428. var _proto = Tooltip.prototype;
  4429. // Public
  4430. _proto.enable = function enable() {
  4431. this._isEnabled = true;
  4432. };
  4433. _proto.disable = function disable() {
  4434. this._isEnabled = false;
  4435. };
  4436. _proto.toggleEnabled = function toggleEnabled() {
  4437. this._isEnabled = !this._isEnabled;
  4438. };
  4439. _proto.toggle = function toggle(event) {
  4440. if (!this._isEnabled) {
  4441. return;
  4442. }
  4443. if (event) {
  4444. var dataKey = this.constructor.DATA_KEY;
  4445. var context = $(event.currentTarget).data(dataKey);
  4446. if (!context) {
  4447. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4448. $(event.currentTarget).data(dataKey, context);
  4449. }
  4450. context._activeTrigger.click = !context._activeTrigger.click;
  4451. if (context._isWithActiveTrigger()) {
  4452. context._enter(null, context);
  4453. } else {
  4454. context._leave(null, context);
  4455. }
  4456. } else {
  4457. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4458. this._leave(null, this);
  4459. return;
  4460. }
  4461. this._enter(null, this);
  4462. }
  4463. };
  4464. _proto.dispose = function dispose() {
  4465. clearTimeout(this._timeout);
  4466. $.removeData(this.element, this.constructor.DATA_KEY);
  4467. $(this.element).off(this.constructor.EVENT_KEY);
  4468. $(this.element).closest('.modal').off('hide.bs.modal');
  4469. if (this.tip) {
  4470. $(this.tip).remove();
  4471. }
  4472. this._isEnabled = null;
  4473. this._timeout = null;
  4474. this._hoverState = null;
  4475. this._activeTrigger = null;
  4476. if (this._popper !== null) {
  4477. this._popper.destroy();
  4478. }
  4479. this._popper = null;
  4480. this.element = null;
  4481. this.config = null;
  4482. this.tip = null;
  4483. };
  4484. _proto.show = function show() {
  4485. var _this = this;
  4486. if ($(this.element).css('display') === 'none') {
  4487. throw new Error('Please use show on visible elements');
  4488. }
  4489. var showEvent = $.Event(this.constructor.Event.SHOW);
  4490. if (this.isWithContent() && this._isEnabled) {
  4491. $(this.element).trigger(showEvent);
  4492. var shadowRoot = Util.findShadowRoot(this.element);
  4493. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4494. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4495. return;
  4496. }
  4497. var tip = this.getTipElement();
  4498. var tipId = Util.getUID(this.constructor.NAME);
  4499. tip.setAttribute('id', tipId);
  4500. this.element.setAttribute('aria-describedby', tipId);
  4501. this.setContent();
  4502. if (this.config.animation) {
  4503. $(tip).addClass(ClassName$6.FADE);
  4504. }
  4505. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4506. var attachment = this._getAttachment(placement);
  4507. this.addAttachmentClass(attachment);
  4508. var container = this._getContainer();
  4509. $(tip).data(this.constructor.DATA_KEY, this);
  4510. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4511. $(tip).appendTo(container);
  4512. }
  4513. $(this.element).trigger(this.constructor.Event.INSERTED);
  4514. this._popper = new Popper(this.element, tip, {
  4515. placement: attachment,
  4516. modifiers: {
  4517. offset: {
  4518. offset: this.config.offset
  4519. },
  4520. flip: {
  4521. behavior: this.config.fallbackPlacement
  4522. },
  4523. arrow: {
  4524. element: Selector$6.ARROW
  4525. },
  4526. preventOverflow: {
  4527. boundariesElement: this.config.boundary
  4528. }
  4529. },
  4530. onCreate: function onCreate(data) {
  4531. if (data.originalPlacement !== data.placement) {
  4532. _this._handlePopperPlacementChange(data);
  4533. }
  4534. },
  4535. onUpdate: function onUpdate(data) {
  4536. return _this._handlePopperPlacementChange(data);
  4537. }
  4538. });
  4539. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4540. // empty mouseover listeners to the body's immediate children;
  4541. // only needed because of broken event delegation on iOS
  4542. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4543. if ('ontouchstart' in document.documentElement) {
  4544. $(document.body).children().on('mouseover', null, $.noop);
  4545. }
  4546. var complete = function complete() {
  4547. if (_this.config.animation) {
  4548. _this._fixTransition();
  4549. }
  4550. var prevHoverState = _this._hoverState;
  4551. _this._hoverState = null;
  4552. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4553. if (prevHoverState === HoverState.OUT) {
  4554. _this._leave(null, _this);
  4555. }
  4556. };
  4557. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4558. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4559. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4560. } else {
  4561. complete();
  4562. }
  4563. }
  4564. };
  4565. _proto.hide = function hide(callback) {
  4566. var _this2 = this;
  4567. var tip = this.getTipElement();
  4568. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4569. var complete = function complete() {
  4570. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4571. tip.parentNode.removeChild(tip);
  4572. }
  4573. _this2._cleanTipClass();
  4574. _this2.element.removeAttribute('aria-describedby');
  4575. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4576. if (_this2._popper !== null) {
  4577. _this2._popper.destroy();
  4578. }
  4579. if (callback) {
  4580. callback();
  4581. }
  4582. };
  4583. $(this.element).trigger(hideEvent);
  4584. if (hideEvent.isDefaultPrevented()) {
  4585. return;
  4586. }
  4587. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4588. // empty mouseover listeners we added for iOS support
  4589. if ('ontouchstart' in document.documentElement) {
  4590. $(document.body).children().off('mouseover', null, $.noop);
  4591. }
  4592. this._activeTrigger[Trigger.CLICK] = false;
  4593. this._activeTrigger[Trigger.FOCUS] = false;
  4594. this._activeTrigger[Trigger.HOVER] = false;
  4595. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4596. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4597. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4598. } else {
  4599. complete();
  4600. }
  4601. this._hoverState = '';
  4602. };
  4603. _proto.update = function update() {
  4604. if (this._popper !== null) {
  4605. this._popper.scheduleUpdate();
  4606. }
  4607. }; // Protected
  4608. _proto.isWithContent = function isWithContent() {
  4609. return Boolean(this.getTitle());
  4610. };
  4611. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4612. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4613. };
  4614. _proto.getTipElement = function getTipElement() {
  4615. this.tip = this.tip || $(this.config.template)[0];
  4616. return this.tip;
  4617. };
  4618. _proto.setContent = function setContent() {
  4619. var tip = this.getTipElement();
  4620. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4621. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4622. };
  4623. _proto.setElementContent = function setElementContent($element, content) {
  4624. var html = this.config.html;
  4625. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4626. // Content is a DOM node or a jQuery
  4627. if (html) {
  4628. if (!$(content).parent().is($element)) {
  4629. $element.empty().append(content);
  4630. }
  4631. } else {
  4632. $element.text($(content).text());
  4633. }
  4634. } else {
  4635. $element[html ? 'html' : 'text'](content);
  4636. }
  4637. };
  4638. _proto.getTitle = function getTitle() {
  4639. var title = this.element.getAttribute('data-original-title');
  4640. if (!title) {
  4641. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4642. }
  4643. return title;
  4644. }; // Private
  4645. _proto._getContainer = function _getContainer() {
  4646. if (this.config.container === false) {
  4647. return document.body;
  4648. }
  4649. if (Util.isElement(this.config.container)) {
  4650. return $(this.config.container);
  4651. }
  4652. return $(document).find(this.config.container);
  4653. };
  4654. _proto._getAttachment = function _getAttachment(placement) {
  4655. return AttachmentMap$1[placement.toUpperCase()];
  4656. };
  4657. _proto._setListeners = function _setListeners() {
  4658. var _this3 = this;
  4659. var triggers = this.config.trigger.split(' ');
  4660. triggers.forEach(function (trigger) {
  4661. if (trigger === 'click') {
  4662. $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) {
  4663. return _this3.toggle(event);
  4664. });
  4665. } else if (trigger !== Trigger.MANUAL) {
  4666. var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
  4667. var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
  4668. $(_this3.element).on(eventIn, _this3.config.selector, function (event) {
  4669. return _this3._enter(event);
  4670. }).on(eventOut, _this3.config.selector, function (event) {
  4671. return _this3._leave(event);
  4672. });
  4673. }
  4674. });
  4675. $(this.element).closest('.modal').on('hide.bs.modal', function () {
  4676. if (_this3.element) {
  4677. _this3.hide();
  4678. }
  4679. });
  4680. if (this.config.selector) {
  4681. this.config = _objectSpread({}, this.config, {
  4682. trigger: 'manual',
  4683. selector: ''
  4684. });
  4685. } else {
  4686. this._fixTitle();
  4687. }
  4688. };
  4689. _proto._fixTitle = function _fixTitle() {
  4690. var titleType = typeof this.element.getAttribute('data-original-title');
  4691. if (this.element.getAttribute('title') || titleType !== 'string') {
  4692. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4693. this.element.setAttribute('title', '');
  4694. }
  4695. };
  4696. _proto._enter = function _enter(event, context) {
  4697. var dataKey = this.constructor.DATA_KEY;
  4698. context = context || $(event.currentTarget).data(dataKey);
  4699. if (!context) {
  4700. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4701. $(event.currentTarget).data(dataKey, context);
  4702. }
  4703. if (event) {
  4704. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4705. }
  4706. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4707. context._hoverState = HoverState.SHOW;
  4708. return;
  4709. }
  4710. clearTimeout(context._timeout);
  4711. context._hoverState = HoverState.SHOW;
  4712. if (!context.config.delay || !context.config.delay.show) {
  4713. context.show();
  4714. return;
  4715. }
  4716. context._timeout = setTimeout(function () {
  4717. if (context._hoverState === HoverState.SHOW) {
  4718. context.show();
  4719. }
  4720. }, context.config.delay.show);
  4721. };
  4722. _proto._leave = function _leave(event, context) {
  4723. var dataKey = this.constructor.DATA_KEY;
  4724. context = context || $(event.currentTarget).data(dataKey);
  4725. if (!context) {
  4726. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4727. $(event.currentTarget).data(dataKey, context);
  4728. }
  4729. if (event) {
  4730. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4731. }
  4732. if (context._isWithActiveTrigger()) {
  4733. return;
  4734. }
  4735. clearTimeout(context._timeout);
  4736. context._hoverState = HoverState.OUT;
  4737. if (!context.config.delay || !context.config.delay.hide) {
  4738. context.hide();
  4739. return;
  4740. }
  4741. context._timeout = setTimeout(function () {
  4742. if (context._hoverState === HoverState.OUT) {
  4743. context.hide();
  4744. }
  4745. }, context.config.delay.hide);
  4746. };
  4747. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4748. for (var trigger in this._activeTrigger) {
  4749. if (this._activeTrigger[trigger]) {
  4750. return true;
  4751. }
  4752. }
  4753. return false;
  4754. };
  4755. _proto._getConfig = function _getConfig(config) {
  4756. config = _objectSpread({}, this.constructor.Default, $(this.element).data(), typeof config === 'object' && config ? config : {});
  4757. if (typeof config.delay === 'number') {
  4758. config.delay = {
  4759. show: config.delay,
  4760. hide: config.delay
  4761. };
  4762. }
  4763. if (typeof config.title === 'number') {
  4764. config.title = config.title.toString();
  4765. }
  4766. if (typeof config.content === 'number') {
  4767. config.content = config.content.toString();
  4768. }
  4769. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4770. return config;
  4771. };
  4772. _proto._getDelegateConfig = function _getDelegateConfig() {
  4773. var config = {};
  4774. if (this.config) {
  4775. for (var key in this.config) {
  4776. if (this.constructor.Default[key] !== this.config[key]) {
  4777. config[key] = this.config[key];
  4778. }
  4779. }
  4780. }
  4781. return config;
  4782. };
  4783. _proto._cleanTipClass = function _cleanTipClass() {
  4784. var $tip = $(this.getTipElement());
  4785. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4786. if (tabClass !== null && tabClass.length) {
  4787. $tip.removeClass(tabClass.join(''));
  4788. }
  4789. };
  4790. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4791. var popperInstance = popperData.instance;
  4792. this.tip = popperInstance.popper;
  4793. this._cleanTipClass();
  4794. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4795. };
  4796. _proto._fixTransition = function _fixTransition() {
  4797. var tip = this.getTipElement();
  4798. var initConfigAnimation = this.config.animation;
  4799. if (tip.getAttribute('x-placement') !== null) {
  4800. return;
  4801. }
  4802. $(tip).removeClass(ClassName$6.FADE);
  4803. this.config.animation = false;
  4804. this.hide();
  4805. this.show();
  4806. this.config.animation = initConfigAnimation;
  4807. }; // Static
  4808. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4809. return this.each(function () {
  4810. var data = $(this).data(DATA_KEY$6);
  4811. var _config = typeof config === 'object' && config;
  4812. if (!data && /dispose|hide/.test(config)) {
  4813. return;
  4814. }
  4815. if (!data) {
  4816. data = new Tooltip(this, _config);
  4817. $(this).data(DATA_KEY$6, data);
  4818. }
  4819. if (typeof config === 'string') {
  4820. if (typeof data[config] === 'undefined') {
  4821. throw new TypeError("No method named \"" + config + "\"");
  4822. }
  4823. data[config]();
  4824. }
  4825. });
  4826. };
  4827. _createClass(Tooltip, null, [{
  4828. key: "VERSION",
  4829. get: function get() {
  4830. return VERSION$6;
  4831. }
  4832. }, {
  4833. key: "Default",
  4834. get: function get() {
  4835. return Default$4;
  4836. }
  4837. }, {
  4838. key: "NAME",
  4839. get: function get() {
  4840. return NAME$6;
  4841. }
  4842. }, {
  4843. key: "DATA_KEY",
  4844. get: function get() {
  4845. return DATA_KEY$6;
  4846. }
  4847. }, {
  4848. key: "Event",
  4849. get: function get() {
  4850. return Event$6;
  4851. }
  4852. }, {
  4853. key: "EVENT_KEY",
  4854. get: function get() {
  4855. return EVENT_KEY$6;
  4856. }
  4857. }, {
  4858. key: "DefaultType",
  4859. get: function get() {
  4860. return DefaultType$4;
  4861. }
  4862. }]);
  4863. return Tooltip;
  4864. }();
  4865. /**
  4866. * ------------------------------------------------------------------------
  4867. * jQuery
  4868. * ------------------------------------------------------------------------
  4869. */
  4870. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4871. $.fn[NAME$6].Constructor = Tooltip;
  4872. $.fn[NAME$6].noConflict = function () {
  4873. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4874. return Tooltip._jQueryInterface;
  4875. };
  4876. /**
  4877. * ------------------------------------------------------------------------
  4878. * Constants
  4879. * ------------------------------------------------------------------------
  4880. */
  4881. var NAME$7 = 'popover';
  4882. var VERSION$7 = '4.2.1';
  4883. var DATA_KEY$7 = 'bs.popover';
  4884. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4885. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4886. var CLASS_PREFIX$1 = 'bs-popover';
  4887. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4888. var Default$5 = _objectSpread({}, Tooltip.Default, {
  4889. placement: 'right',
  4890. trigger: 'click',
  4891. content: '',
  4892. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4893. });
  4894. var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, {
  4895. content: '(string|element|function)'
  4896. });
  4897. var ClassName$7 = {
  4898. FADE: 'fade',
  4899. SHOW: 'show'
  4900. };
  4901. var Selector$7 = {
  4902. TITLE: '.popover-header',
  4903. CONTENT: '.popover-body'
  4904. };
  4905. var Event$7 = {
  4906. HIDE: "hide" + EVENT_KEY$7,
  4907. HIDDEN: "hidden" + EVENT_KEY$7,
  4908. SHOW: "show" + EVENT_KEY$7,
  4909. SHOWN: "shown" + EVENT_KEY$7,
  4910. INSERTED: "inserted" + EVENT_KEY$7,
  4911. CLICK: "click" + EVENT_KEY$7,
  4912. FOCUSIN: "focusin" + EVENT_KEY$7,
  4913. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4914. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4915. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4916. /**
  4917. * ------------------------------------------------------------------------
  4918. * Class Definition
  4919. * ------------------------------------------------------------------------
  4920. */
  4921. };
  4922. var Popover =
  4923. /*#__PURE__*/
  4924. function (_Tooltip) {
  4925. _inheritsLoose(Popover, _Tooltip);
  4926. function Popover() {
  4927. return _Tooltip.apply(this, arguments) || this;
  4928. }
  4929. var _proto = Popover.prototype;
  4930. // Overrides
  4931. _proto.isWithContent = function isWithContent() {
  4932. return this.getTitle() || this._getContent();
  4933. };
  4934. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4935. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4936. };
  4937. _proto.getTipElement = function getTipElement() {
  4938. this.tip = this.tip || $(this.config.template)[0];
  4939. return this.tip;
  4940. };
  4941. _proto.setContent = function setContent() {
  4942. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4943. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4944. var content = this._getContent();
  4945. if (typeof content === 'function') {
  4946. content = content.call(this.element);
  4947. }
  4948. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4949. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4950. }; // Private
  4951. _proto._getContent = function _getContent() {
  4952. return this.element.getAttribute('data-content') || this.config.content;
  4953. };
  4954. _proto._cleanTipClass = function _cleanTipClass() {
  4955. var $tip = $(this.getTipElement());
  4956. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4957. if (tabClass !== null && tabClass.length > 0) {
  4958. $tip.removeClass(tabClass.join(''));
  4959. }
  4960. }; // Static
  4961. Popover._jQueryInterface = function _jQueryInterface(config) {
  4962. return this.each(function () {
  4963. var data = $(this).data(DATA_KEY$7);
  4964. var _config = typeof config === 'object' ? config : null;
  4965. if (!data && /dispose|hide/.test(config)) {
  4966. return;
  4967. }
  4968. if (!data) {
  4969. data = new Popover(this, _config);
  4970. $(this).data(DATA_KEY$7, data);
  4971. }
  4972. if (typeof config === 'string') {
  4973. if (typeof data[config] === 'undefined') {
  4974. throw new TypeError("No method named \"" + config + "\"");
  4975. }
  4976. data[config]();
  4977. }
  4978. });
  4979. };
  4980. _createClass(Popover, null, [{
  4981. key: "VERSION",
  4982. // Getters
  4983. get: function get() {
  4984. return VERSION$7;
  4985. }
  4986. }, {
  4987. key: "Default",
  4988. get: function get() {
  4989. return Default$5;
  4990. }
  4991. }, {
  4992. key: "NAME",
  4993. get: function get() {
  4994. return NAME$7;
  4995. }
  4996. }, {
  4997. key: "DATA_KEY",
  4998. get: function get() {
  4999. return DATA_KEY$7;
  5000. }
  5001. }, {
  5002. key: "Event",
  5003. get: function get() {
  5004. return Event$7;
  5005. }
  5006. }, {
  5007. key: "EVENT_KEY",
  5008. get: function get() {
  5009. return EVENT_KEY$7;
  5010. }
  5011. }, {
  5012. key: "DefaultType",
  5013. get: function get() {
  5014. return DefaultType$5;
  5015. }
  5016. }]);
  5017. return Popover;
  5018. }(Tooltip);
  5019. /**
  5020. * ------------------------------------------------------------------------
  5021. * jQuery
  5022. * ------------------------------------------------------------------------
  5023. */
  5024. $.fn[NAME$7] = Popover._jQueryInterface;
  5025. $.fn[NAME$7].Constructor = Popover;
  5026. $.fn[NAME$7].noConflict = function () {
  5027. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5028. return Popover._jQueryInterface;
  5029. };
  5030. /**
  5031. * ------------------------------------------------------------------------
  5032. * Constants
  5033. * ------------------------------------------------------------------------
  5034. */
  5035. var NAME$8 = 'scrollspy';
  5036. var VERSION$8 = '4.2.1';
  5037. var DATA_KEY$8 = 'bs.scrollspy';
  5038. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5039. var DATA_API_KEY$6 = '.data-api';
  5040. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5041. var Default$6 = {
  5042. offset: 10,
  5043. method: 'auto',
  5044. target: ''
  5045. };
  5046. var DefaultType$6 = {
  5047. offset: 'number',
  5048. method: 'string',
  5049. target: '(string|element)'
  5050. };
  5051. var Event$8 = {
  5052. ACTIVATE: "activate" + EVENT_KEY$8,
  5053. SCROLL: "scroll" + EVENT_KEY$8,
  5054. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5055. };
  5056. var ClassName$8 = {
  5057. DROPDOWN_ITEM: 'dropdown-item',
  5058. DROPDOWN_MENU: 'dropdown-menu',
  5059. ACTIVE: 'active'
  5060. };
  5061. var Selector$8 = {
  5062. DATA_SPY: '[data-spy="scroll"]',
  5063. ACTIVE: '.active',
  5064. NAV_LIST_GROUP: '.nav, .list-group',
  5065. NAV_LINKS: '.nav-link',
  5066. NAV_ITEMS: '.nav-item',
  5067. LIST_ITEMS: '.list-group-item',
  5068. DROPDOWN: '.dropdown',
  5069. DROPDOWN_ITEMS: '.dropdown-item',
  5070. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5071. };
  5072. var OffsetMethod = {
  5073. OFFSET: 'offset',
  5074. POSITION: 'position'
  5075. /**
  5076. * ------------------------------------------------------------------------
  5077. * Class Definition
  5078. * ------------------------------------------------------------------------
  5079. */
  5080. };
  5081. var ScrollSpy =
  5082. /*#__PURE__*/
  5083. function () {
  5084. function ScrollSpy(element, config) {
  5085. var _this = this;
  5086. this._element = element;
  5087. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5088. this._config = this._getConfig(config);
  5089. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5090. this._offsets = [];
  5091. this._targets = [];
  5092. this._activeTarget = null;
  5093. this._scrollHeight = 0;
  5094. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5095. return _this._process(event);
  5096. });
  5097. this.refresh();
  5098. this._process();
  5099. } // Getters
  5100. var _proto = ScrollSpy.prototype;
  5101. // Public
  5102. _proto.refresh = function refresh() {
  5103. var _this2 = this;
  5104. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5105. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5106. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5107. this._offsets = [];
  5108. this._targets = [];
  5109. this._scrollHeight = this._getScrollHeight();
  5110. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5111. targets.map(function (element) {
  5112. var target;
  5113. var targetSelector = Util.getSelectorFromElement(element);
  5114. if (targetSelector) {
  5115. target = document.querySelector(targetSelector);
  5116. }
  5117. if (target) {
  5118. var targetBCR = target.getBoundingClientRect();
  5119. if (targetBCR.width || targetBCR.height) {
  5120. // TODO (fat): remove sketch reliance on jQuery position/offset
  5121. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5122. }
  5123. }
  5124. return null;
  5125. }).filter(function (item) {
  5126. return item;
  5127. }).sort(function (a, b) {
  5128. return a[0] - b[0];
  5129. }).forEach(function (item) {
  5130. _this2._offsets.push(item[0]);
  5131. _this2._targets.push(item[1]);
  5132. });
  5133. };
  5134. _proto.dispose = function dispose() {
  5135. $.removeData(this._element, DATA_KEY$8);
  5136. $(this._scrollElement).off(EVENT_KEY$8);
  5137. this._element = null;
  5138. this._scrollElement = null;
  5139. this._config = null;
  5140. this._selector = null;
  5141. this._offsets = null;
  5142. this._targets = null;
  5143. this._activeTarget = null;
  5144. this._scrollHeight = null;
  5145. }; // Private
  5146. _proto._getConfig = function _getConfig(config) {
  5147. config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {});
  5148. if (typeof config.target !== 'string') {
  5149. var id = $(config.target).attr('id');
  5150. if (!id) {
  5151. id = Util.getUID(NAME$8);
  5152. $(config.target).attr('id', id);
  5153. }
  5154. config.target = "#" + id;
  5155. }
  5156. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5157. return config;
  5158. };
  5159. _proto._getScrollTop = function _getScrollTop() {
  5160. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5161. };
  5162. _proto._getScrollHeight = function _getScrollHeight() {
  5163. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5164. };
  5165. _proto._getOffsetHeight = function _getOffsetHeight() {
  5166. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5167. };
  5168. _proto._process = function _process() {
  5169. var scrollTop = this._getScrollTop() + this._config.offset;
  5170. var scrollHeight = this._getScrollHeight();
  5171. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5172. if (this._scrollHeight !== scrollHeight) {
  5173. this.refresh();
  5174. }
  5175. if (scrollTop >= maxScroll) {
  5176. var target = this._targets[this._targets.length - 1];
  5177. if (this._activeTarget !== target) {
  5178. this._activate(target);
  5179. }
  5180. return;
  5181. }
  5182. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5183. this._activeTarget = null;
  5184. this._clear();
  5185. return;
  5186. }
  5187. var offsetLength = this._offsets.length;
  5188. for (var i = offsetLength; i--;) {
  5189. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5190. if (isActiveTarget) {
  5191. this._activate(this._targets[i]);
  5192. }
  5193. }
  5194. };
  5195. _proto._activate = function _activate(target) {
  5196. this._activeTarget = target;
  5197. this._clear();
  5198. var queries = this._selector.split(',').map(function (selector) {
  5199. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5200. });
  5201. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5202. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5203. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5204. $link.addClass(ClassName$8.ACTIVE);
  5205. } else {
  5206. // Set triggered link as active
  5207. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5208. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5209. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  5210. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5211. }
  5212. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5213. relatedTarget: target
  5214. });
  5215. };
  5216. _proto._clear = function _clear() {
  5217. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5218. return node.classList.contains(ClassName$8.ACTIVE);
  5219. }).forEach(function (node) {
  5220. return node.classList.remove(ClassName$8.ACTIVE);
  5221. });
  5222. }; // Static
  5223. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5224. return this.each(function () {
  5225. var data = $(this).data(DATA_KEY$8);
  5226. var _config = typeof config === 'object' && config;
  5227. if (!data) {
  5228. data = new ScrollSpy(this, _config);
  5229. $(this).data(DATA_KEY$8, data);
  5230. }
  5231. if (typeof config === 'string') {
  5232. if (typeof data[config] === 'undefined') {
  5233. throw new TypeError("No method named \"" + config + "\"");
  5234. }
  5235. data[config]();
  5236. }
  5237. });
  5238. };
  5239. _createClass(ScrollSpy, null, [{
  5240. key: "VERSION",
  5241. get: function get() {
  5242. return VERSION$8;
  5243. }
  5244. }, {
  5245. key: "Default",
  5246. get: function get() {
  5247. return Default$6;
  5248. }
  5249. }]);
  5250. return ScrollSpy;
  5251. }();
  5252. /**
  5253. * ------------------------------------------------------------------------
  5254. * Data Api implementation
  5255. * ------------------------------------------------------------------------
  5256. */
  5257. $(window).on(Event$8.LOAD_DATA_API, function () {
  5258. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5259. var scrollSpysLength = scrollSpys.length;
  5260. for (var i = scrollSpysLength; i--;) {
  5261. var $spy = $(scrollSpys[i]);
  5262. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5263. }
  5264. });
  5265. /**
  5266. * ------------------------------------------------------------------------
  5267. * jQuery
  5268. * ------------------------------------------------------------------------
  5269. */
  5270. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5271. $.fn[NAME$8].Constructor = ScrollSpy;
  5272. $.fn[NAME$8].noConflict = function () {
  5273. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5274. return ScrollSpy._jQueryInterface;
  5275. };
  5276. /**
  5277. * ------------------------------------------------------------------------
  5278. * Constants
  5279. * ------------------------------------------------------------------------
  5280. */
  5281. var NAME$9 = 'tab';
  5282. var VERSION$9 = '4.2.1';
  5283. var DATA_KEY$9 = 'bs.tab';
  5284. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5285. var DATA_API_KEY$7 = '.data-api';
  5286. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5287. var Event$9 = {
  5288. HIDE: "hide" + EVENT_KEY$9,
  5289. HIDDEN: "hidden" + EVENT_KEY$9,
  5290. SHOW: "show" + EVENT_KEY$9,
  5291. SHOWN: "shown" + EVENT_KEY$9,
  5292. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5293. };
  5294. var ClassName$9 = {
  5295. DROPDOWN_MENU: 'dropdown-menu',
  5296. ACTIVE: 'active',
  5297. DISABLED: 'disabled',
  5298. FADE: 'fade',
  5299. SHOW: 'show'
  5300. };
  5301. var Selector$9 = {
  5302. DROPDOWN: '.dropdown',
  5303. NAV_LIST_GROUP: '.nav, .list-group',
  5304. ACTIVE: '.active',
  5305. ACTIVE_UL: '> li > .active',
  5306. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5307. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5308. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5309. /**
  5310. * ------------------------------------------------------------------------
  5311. * Class Definition
  5312. * ------------------------------------------------------------------------
  5313. */
  5314. };
  5315. var Tab =
  5316. /*#__PURE__*/
  5317. function () {
  5318. function Tab(element) {
  5319. this._element = element;
  5320. } // Getters
  5321. var _proto = Tab.prototype;
  5322. // Public
  5323. _proto.show = function show() {
  5324. var _this = this;
  5325. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5326. return;
  5327. }
  5328. var target;
  5329. var previous;
  5330. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5331. var selector = Util.getSelectorFromElement(this._element);
  5332. if (listElement) {
  5333. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5334. previous = $.makeArray($(listElement).find(itemSelector));
  5335. previous = previous[previous.length - 1];
  5336. }
  5337. var hideEvent = $.Event(Event$9.HIDE, {
  5338. relatedTarget: this._element
  5339. });
  5340. var showEvent = $.Event(Event$9.SHOW, {
  5341. relatedTarget: previous
  5342. });
  5343. if (previous) {
  5344. $(previous).trigger(hideEvent);
  5345. }
  5346. $(this._element).trigger(showEvent);
  5347. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5348. return;
  5349. }
  5350. if (selector) {
  5351. target = document.querySelector(selector);
  5352. }
  5353. this._activate(this._element, listElement);
  5354. var complete = function complete() {
  5355. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5356. relatedTarget: _this._element
  5357. });
  5358. var shownEvent = $.Event(Event$9.SHOWN, {
  5359. relatedTarget: previous
  5360. });
  5361. $(previous).trigger(hiddenEvent);
  5362. $(_this._element).trigger(shownEvent);
  5363. };
  5364. if (target) {
  5365. this._activate(target, target.parentNode, complete);
  5366. } else {
  5367. complete();
  5368. }
  5369. };
  5370. _proto.dispose = function dispose() {
  5371. $.removeData(this._element, DATA_KEY$9);
  5372. this._element = null;
  5373. }; // Private
  5374. _proto._activate = function _activate(element, container, callback) {
  5375. var _this2 = this;
  5376. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5377. var active = activeElements[0];
  5378. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5379. var complete = function complete() {
  5380. return _this2._transitionComplete(element, active, callback);
  5381. };
  5382. if (active && isTransitioning) {
  5383. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5384. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5385. } else {
  5386. complete();
  5387. }
  5388. };
  5389. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5390. if (active) {
  5391. $(active).removeClass(ClassName$9.ACTIVE);
  5392. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5393. if (dropdownChild) {
  5394. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5395. }
  5396. if (active.getAttribute('role') === 'tab') {
  5397. active.setAttribute('aria-selected', false);
  5398. }
  5399. }
  5400. $(element).addClass(ClassName$9.ACTIVE);
  5401. if (element.getAttribute('role') === 'tab') {
  5402. element.setAttribute('aria-selected', true);
  5403. }
  5404. Util.reflow(element);
  5405. $(element).addClass(ClassName$9.SHOW);
  5406. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5407. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5408. if (dropdownElement) {
  5409. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5410. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5411. }
  5412. element.setAttribute('aria-expanded', true);
  5413. }
  5414. if (callback) {
  5415. callback();
  5416. }
  5417. }; // Static
  5418. Tab._jQueryInterface = function _jQueryInterface(config) {
  5419. return this.each(function () {
  5420. var $this = $(this);
  5421. var data = $this.data(DATA_KEY$9);
  5422. if (!data) {
  5423. data = new Tab(this);
  5424. $this.data(DATA_KEY$9, data);
  5425. }
  5426. if (typeof config === 'string') {
  5427. if (typeof data[config] === 'undefined') {
  5428. throw new TypeError("No method named \"" + config + "\"");
  5429. }
  5430. data[config]();
  5431. }
  5432. });
  5433. };
  5434. _createClass(Tab, null, [{
  5435. key: "VERSION",
  5436. get: function get() {
  5437. return VERSION$9;
  5438. }
  5439. }]);
  5440. return Tab;
  5441. }();
  5442. /**
  5443. * ------------------------------------------------------------------------
  5444. * Data Api implementation
  5445. * ------------------------------------------------------------------------
  5446. */
  5447. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5448. event.preventDefault();
  5449. Tab._jQueryInterface.call($(this), 'show');
  5450. });
  5451. /**
  5452. * ------------------------------------------------------------------------
  5453. * jQuery
  5454. * ------------------------------------------------------------------------
  5455. */
  5456. $.fn[NAME$9] = Tab._jQueryInterface;
  5457. $.fn[NAME$9].Constructor = Tab;
  5458. $.fn[NAME$9].noConflict = function () {
  5459. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5460. return Tab._jQueryInterface;
  5461. };
  5462. /**
  5463. * ------------------------------------------------------------------------
  5464. * Constants
  5465. * ------------------------------------------------------------------------
  5466. */
  5467. var NAME$a = 'toast';
  5468. var VERSION$a = '4.2.1';
  5469. var DATA_KEY$a = 'bs.toast';
  5470. var EVENT_KEY$a = "." + DATA_KEY$a;
  5471. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5472. var Event$a = {
  5473. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5474. HIDE: "hide" + EVENT_KEY$a,
  5475. HIDDEN: "hidden" + EVENT_KEY$a,
  5476. SHOW: "show" + EVENT_KEY$a,
  5477. SHOWN: "shown" + EVENT_KEY$a
  5478. };
  5479. var ClassName$a = {
  5480. FADE: 'fade',
  5481. HIDE: 'hide',
  5482. SHOW: 'show',
  5483. SHOWING: 'showing'
  5484. };
  5485. var DefaultType$7 = {
  5486. animation: 'boolean',
  5487. autohide: 'boolean',
  5488. delay: 'number'
  5489. };
  5490. var Default$7 = {
  5491. animation: true,
  5492. autohide: true,
  5493. delay: 500
  5494. };
  5495. var Selector$a = {
  5496. DATA_DISMISS: '[data-dismiss="toast"]'
  5497. /**
  5498. * ------------------------------------------------------------------------
  5499. * Class Definition
  5500. * ------------------------------------------------------------------------
  5501. */
  5502. };
  5503. var Toast =
  5504. /*#__PURE__*/
  5505. function () {
  5506. function Toast(element, config) {
  5507. this._element = element;
  5508. this._config = this._getConfig(config);
  5509. this._timeout = null;
  5510. this._setListeners();
  5511. } // Getters
  5512. var _proto = Toast.prototype;
  5513. // Public
  5514. _proto.show = function show() {
  5515. var _this = this;
  5516. $(this._element).trigger(Event$a.SHOW);
  5517. if (this._config.animation) {
  5518. this._element.classList.add(ClassName$a.FADE);
  5519. }
  5520. var complete = function complete() {
  5521. _this._element.classList.remove(ClassName$a.SHOWING);
  5522. _this._element.classList.add(ClassName$a.SHOW);
  5523. $(_this._element).trigger(Event$a.SHOWN);
  5524. if (_this._config.autohide) {
  5525. _this.hide();
  5526. }
  5527. };
  5528. this._element.classList.remove(ClassName$a.HIDE);
  5529. this._element.classList.add(ClassName$a.SHOWING);
  5530. if (this._config.animation) {
  5531. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5532. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5533. } else {
  5534. complete();
  5535. }
  5536. };
  5537. _proto.hide = function hide(withoutTimeout) {
  5538. var _this2 = this;
  5539. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5540. return;
  5541. }
  5542. $(this._element).trigger(Event$a.HIDE);
  5543. if (withoutTimeout) {
  5544. this._close();
  5545. } else {
  5546. this._timeout = setTimeout(function () {
  5547. _this2._close();
  5548. }, this._config.delay);
  5549. }
  5550. };
  5551. _proto.dispose = function dispose() {
  5552. clearTimeout(this._timeout);
  5553. this._timeout = null;
  5554. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5555. this._element.classList.remove(ClassName$a.SHOW);
  5556. }
  5557. $(this._element).off(Event$a.CLICK_DISMISS);
  5558. $.removeData(this._element, DATA_KEY$a);
  5559. this._element = null;
  5560. this._config = null;
  5561. }; // Private
  5562. _proto._getConfig = function _getConfig(config) {
  5563. config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
  5564. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5565. return config;
  5566. };
  5567. _proto._setListeners = function _setListeners() {
  5568. var _this3 = this;
  5569. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5570. return _this3.hide(true);
  5571. });
  5572. };
  5573. _proto._close = function _close() {
  5574. var _this4 = this;
  5575. var complete = function complete() {
  5576. _this4._element.classList.add(ClassName$a.HIDE);
  5577. $(_this4._element).trigger(Event$a.HIDDEN);
  5578. };
  5579. this._element.classList.remove(ClassName$a.SHOW);
  5580. if (this._config.animation) {
  5581. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5582. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5583. } else {
  5584. complete();
  5585. }
  5586. }; // Static
  5587. Toast._jQueryInterface = function _jQueryInterface(config) {
  5588. return this.each(function () {
  5589. var $element = $(this);
  5590. var data = $element.data(DATA_KEY$a);
  5591. var _config = typeof config === 'object' && config;
  5592. if (!data) {
  5593. data = new Toast(this, _config);
  5594. $element.data(DATA_KEY$a, data);
  5595. }
  5596. if (typeof config === 'string') {
  5597. if (typeof data[config] === 'undefined') {
  5598. throw new TypeError("No method named \"" + config + "\"");
  5599. }
  5600. data[config](this);
  5601. }
  5602. });
  5603. };
  5604. _createClass(Toast, null, [{
  5605. key: "VERSION",
  5606. get: function get() {
  5607. return VERSION$a;
  5608. }
  5609. }, {
  5610. key: "DefaultType",
  5611. get: function get() {
  5612. return DefaultType$7;
  5613. }
  5614. }]);
  5615. return Toast;
  5616. }();
  5617. /**
  5618. * ------------------------------------------------------------------------
  5619. * jQuery
  5620. * ------------------------------------------------------------------------
  5621. */
  5622. $.fn[NAME$a] = Toast._jQueryInterface;
  5623. $.fn[NAME$a].Constructor = Toast;
  5624. $.fn[NAME$a].noConflict = function () {
  5625. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5626. return Toast._jQueryInterface;
  5627. };
  5628. /**
  5629. * --------------------------------------------------------------------------
  5630. * Bootstrap (v4.2.1): index.js
  5631. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5632. * --------------------------------------------------------------------------
  5633. */
  5634. (function () {
  5635. if (typeof $ === 'undefined') {
  5636. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  5637. }
  5638. var version = $.fn.jquery.split(' ')[0].split('.');
  5639. var minMajor = 1;
  5640. var ltMajor = 2;
  5641. var minMinor = 9;
  5642. var minPatch = 1;
  5643. var maxMajor = 4;
  5644. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  5645. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  5646. }
  5647. })();
  5648. exports.Util = Util;
  5649. exports.Alert = Alert;
  5650. exports.Button = Button;
  5651. exports.Carousel = Carousel;
  5652. exports.Collapse = Collapse;
  5653. exports.Dropdown = Dropdown;
  5654. exports.Modal = Modal;
  5655. exports.Popover = Popover;
  5656. exports.Scrollspy = ScrollSpy;
  5657. exports.Tab = Tab;
  5658. exports.Toast = Toast;
  5659. exports.Tooltip = Tooltip;
  5660. Object.defineProperty(exports, '__esModule', { value: true });
  5661. })));
  5662. //# sourceMappingURL=bootstrap.bundle.js.map