bootstrap.bundle.js 225 KB

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