Layout von Websiten mit Bootstrap und Foundation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bootstrap.bundle.js 224KB

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