bootstrap.bundle.js 263 KB

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