bootstrap.bundle.js 231 KB

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