bootstrap.bundle.js 231 KB

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