bootstrap.bundle.js 227 KB

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