layers-ui.js 662 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // identity function for calling harmony imports with the correct context
  37. /******/ __webpack_require__.i = function(value) { return value; };
  38. /******/
  39. /******/ // define getter function for harmony exports
  40. /******/ __webpack_require__.d = function(exports, name, getter) {
  41. /******/ if(!__webpack_require__.o(exports, name)) {
  42. /******/ Object.defineProperty(exports, name, {
  43. /******/ configurable: false,
  44. /******/ enumerable: true,
  45. /******/ get: getter
  46. /******/ });
  47. /******/ }
  48. /******/ };
  49. /******/
  50. /******/ // getDefaultExport function for compatibility with non-harmony modules
  51. /******/ __webpack_require__.n = function(module) {
  52. /******/ var getter = module && module.__esModule ?
  53. /******/ function getDefault() { return module['default']; } :
  54. /******/ function getModuleExports() { return module; };
  55. /******/ __webpack_require__.d(getter, 'a', getter);
  56. /******/ return getter;
  57. /******/ };
  58. /******/
  59. /******/ // Object.prototype.hasOwnProperty.call
  60. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  61. /******/
  62. /******/ // __webpack_public_path__
  63. /******/ __webpack_require__.p = "";
  64. /******/
  65. /******/ // Load entry module and return exports
  66. /******/ return __webpack_require__(__webpack_require__.s = 28);
  67. /******/ })
  68. /************************************************************************/
  69. /******/ ([
  70. /* 0 */
  71. /***/ (function(module, exports, __webpack_require__) {
  72. "use strict";
  73. Object.defineProperty(exports, "__esModule", {
  74. value: true
  75. });
  76. var _jquery = __webpack_require__(1);
  77. var _jquery2 = _interopRequireDefault(_jquery);
  78. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  79. /**
  80. * --------------------------------------------------------------------------
  81. * Bootstrap (v4.0.0-beta): util.js
  82. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  83. * --------------------------------------------------------------------------
  84. */
  85. var Util = function () {
  86. /**
  87. * ------------------------------------------------------------------------
  88. * Private TransitionEnd Helpers
  89. * ------------------------------------------------------------------------
  90. */
  91. var transition = false;
  92. var MAX_UID = 1000000;
  93. var TransitionEndEvent = {
  94. WebkitTransition: 'webkitTransitionEnd',
  95. MozTransition: 'transitionend',
  96. OTransition: 'oTransitionEnd otransitionend',
  97. transition: 'transitionend'
  98. // shoutout AngusCroll (https://goo.gl/pxwQGp)
  99. };function toType(obj) {
  100. return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
  101. }
  102. function getSpecialTransitionEndEvent() {
  103. return {
  104. bindType: transition.end,
  105. delegateType: transition.end,
  106. handle: function handle(event) {
  107. if ((0, _jquery2.default)(event.target).is(this)) {
  108. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  109. }
  110. return undefined; // eslint-disable-line no-undefined
  111. }
  112. };
  113. }
  114. function transitionEndTest() {
  115. if (window.QUnit) {
  116. return false;
  117. }
  118. var el = document.createElement('bootstrap');
  119. for (var name in TransitionEndEvent) {
  120. if (typeof el.style[name] !== 'undefined') {
  121. return {
  122. end: TransitionEndEvent[name]
  123. };
  124. }
  125. }
  126. return false;
  127. }
  128. function transitionEndEmulator(duration) {
  129. var _this = this;
  130. var called = false;
  131. (0, _jquery2.default)(this).one(Util.TRANSITION_END, function () {
  132. called = true;
  133. });
  134. setTimeout(function () {
  135. if (!called) {
  136. Util.triggerTransitionEnd(_this);
  137. }
  138. }, duration);
  139. return this;
  140. }
  141. function setTransitionEndSupport() {
  142. transition = transitionEndTest();
  143. _jquery2.default.fn.emulateTransitionEnd = transitionEndEmulator;
  144. if (Util.supportsTransitionEnd()) {
  145. _jquery2.default.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  146. }
  147. }
  148. function parseOption(item) {
  149. if ('true' === item) {
  150. return true;
  151. } else if ('false' === item) {
  152. return false;
  153. } else if (!isNaN(item * 1)) {
  154. return parseFloat(item);
  155. } else {
  156. return item;
  157. }
  158. }
  159. /**
  160. * --------------------------------------------------------------------------
  161. * Public Util Api
  162. * --------------------------------------------------------------------------
  163. */
  164. var Util = {
  165. TRANSITION_END: 'bsTransitionEnd',
  166. getUID: function getUID(prefix) {
  167. do {
  168. // eslint-disable-next-line no-bitwise
  169. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  170. } while (document.getElementById(prefix));
  171. return prefix;
  172. },
  173. getSelectorFromElement: function getSelectorFromElement(element) {
  174. var selector = element.getAttribute('data-target');
  175. if (!selector || selector === '#') {
  176. selector = element.getAttribute('href') || '';
  177. }
  178. try {
  179. var $selector = (0, _jquery2.default)(document).find(selector);
  180. return $selector.length > 0 ? selector : null;
  181. } catch (error) {
  182. return null;
  183. }
  184. },
  185. reflow: function reflow(element) {
  186. return element.offsetHeight;
  187. },
  188. triggerTransitionEnd: function triggerTransitionEnd(element) {
  189. (0, _jquery2.default)(element).trigger(transition.end);
  190. },
  191. supportsTransitionEnd: function supportsTransitionEnd() {
  192. return Boolean(transition);
  193. },
  194. isElement: function isElement(obj) {
  195. return (obj[0] || obj).nodeType;
  196. },
  197. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  198. for (var property in configTypes) {
  199. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  200. var expectedTypes = configTypes[property];
  201. var value = config[property];
  202. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  203. if (!new RegExp(expectedTypes).test(valueType)) {
  204. throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
  205. }
  206. }
  207. }
  208. },
  209. parseDataOptions: function parseDataOptions(dataOptions) {
  210. var options = [];
  211. var string = dataOptions.split(';');
  212. string.forEach(function (item, index) {
  213. var option = item.split(':');
  214. option = option.map(function (item) {
  215. return item.trim();
  216. });
  217. if (option[0]) {
  218. options[option[0]] = parseOption(option[1]);
  219. }
  220. });
  221. return options;
  222. }
  223. };
  224. setTransitionEndSupport();
  225. return Util;
  226. }(_jquery2.default);
  227. exports.default = Util;
  228. /***/ }),
  229. /* 1 */
  230. /***/ (function(module, exports) {
  231. module.exports = jQuery;
  232. /***/ }),
  233. /* 2 */,
  234. /* 3 */
  235. /***/ (function(module, exports, __webpack_require__) {
  236. "use strict";
  237. Object.defineProperty(exports, "__esModule", {
  238. value: true
  239. });
  240. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  241. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  242. var SELECTORS = {
  243. inputsContainer: '[data-inputs-container]',
  244. virtualInput: '[data-virtual-input]',
  245. isChecked: 'is-selected',
  246. inputTarget: '[data-input-target]',
  247. dataTargetId: '[data-target-id]',
  248. content: '[data-content]',
  249. contentTarget: '[data-content-target]'
  250. };
  251. var selectInput = function () {
  252. function selectInput(inputGroup, drop) {
  253. _classCallCheck(this, selectInput);
  254. this.inputGroup = inputGroup;
  255. this.type = this.inputGroup.data('inputs-container');
  256. this.drop = drop;
  257. this.virtualInputs = this.inputGroup.find(SELECTORS.virtualInput);
  258. this.bindEvents();
  259. }
  260. _createClass(selectInput, [{
  261. key: 'bindEvents',
  262. value: function bindEvents() {
  263. var _this = this;
  264. this.virtualInputs.on('click', function (event) {
  265. return _this.selectItem(event);
  266. });
  267. }
  268. }, {
  269. key: 'selectItem',
  270. value: function selectItem(event) {
  271. if (this.type == 'checkboxes') {
  272. if ($(event.currentTarget).hasClass('is-selected')) {
  273. $(event.currentTarget).removeClass(SELECTORS.isChecked);
  274. $(event.currentTarget).find('input').prop("checked", false);
  275. } else {
  276. $(event.currentTarget).addClass(SELECTORS.isChecked);
  277. $(event.currentTarget).find('input').prop("checked", true);
  278. }
  279. } else {
  280. this.virtualInputs.removeClass(SELECTORS.isChecked);
  281. this.virtualInputs.find('input').prop("checked", false);
  282. $(event.currentTarget).addClass(SELECTORS.isChecked);
  283. $(event.currentTarget).find('input').prop("checked", true);
  284. }
  285. if (this.drop) {
  286. this.getDropdownContent(event);
  287. this.setDropdownContent();
  288. this.drop.close();
  289. }
  290. }
  291. }, {
  292. key: 'setDropdownContent',
  293. value: function setDropdownContent() {
  294. for (var property in this.data) {
  295. $(this.drop.target).find('[data-view-' + property + ']').text(this.data[property]);
  296. }
  297. }
  298. }, {
  299. key: 'getDropdownContent',
  300. value: function getDropdownContent(event) {
  301. this.data = $(event.currentTarget).data('config');
  302. }
  303. }], [{
  304. key: 'init',
  305. value: function init(container, drop) {
  306. if (container) {
  307. new selectInput($(container).find(SELECTORS.inputsContainer), drop);
  308. } else {
  309. $(SELECTORS.inputsContainer).each(function () {
  310. new selectInput($(this), drop);
  311. });
  312. }
  313. }
  314. }]);
  315. return selectInput;
  316. }();
  317. exports.default = selectInput;
  318. /***/ }),
  319. /* 4 */
  320. /***/ (function(module, exports, __webpack_require__) {
  321. "use strict";
  322. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  323. /**
  324. * Swiper 3.4.2
  325. * Most modern mobile touch slider and framework with hardware accelerated transitions
  326. *
  327. * http://www.idangero.us/swiper/
  328. *
  329. * Copyright 2017, Vladimir Kharlampidi
  330. * The iDangero.us
  331. * http://www.idangero.us/
  332. *
  333. * Licensed under MIT
  334. *
  335. * Released on: March 10, 2017
  336. */
  337. (function () {
  338. 'use strict';
  339. var $;
  340. /*===========================
  341. Swiper
  342. ===========================*/
  343. var Swiper = function Swiper(container, params) {
  344. if (!(this instanceof Swiper)) return new Swiper(container, params);
  345. var defaults = {
  346. direction: 'horizontal',
  347. touchEventsTarget: 'lu-container',
  348. initialSlide: 0,
  349. speed: 300,
  350. // autoplay
  351. autoplay: false,
  352. autoplayDisableOnInteraction: true,
  353. autoplayStopOnLast: false,
  354. // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
  355. iOSEdgeSwipeDetection: false,
  356. iOSEdgeSwipeThreshold: 20,
  357. // Free mode
  358. freeMode: false,
  359. freeModeMomentum: true,
  360. freeModeMomentumRatio: 1,
  361. freeModeMomentumBounce: true,
  362. freeModeMomentumBounceRatio: 1,
  363. freeModeMomentumVelocityRatio: 1,
  364. freeModeSticky: false,
  365. freeModeMinimumVelocity: 0.02,
  366. // Autoheight
  367. autoHeight: false,
  368. // Set wrapper width
  369. setWrapperSize: false,
  370. // Virtual Translate
  371. virtualTranslate: false,
  372. // Effects
  373. effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
  374. coverflow: {
  375. rotate: 50,
  376. stretch: 0,
  377. depth: 100,
  378. modifier: 1,
  379. slideShadows: true
  380. },
  381. flip: {
  382. slideShadows: true,
  383. limitRotation: true
  384. },
  385. cube: {
  386. slideShadows: true,
  387. shadow: true,
  388. shadowOffset: 20,
  389. shadowScale: 0.94
  390. },
  391. fade: {
  392. crossFade: false
  393. },
  394. // Parallax
  395. parallax: false,
  396. // Zoom
  397. zoom: false,
  398. zoomMax: 3,
  399. zoomMin: 1,
  400. zoomToggle: true,
  401. // Scrollbar
  402. scrollbar: null,
  403. scrollbarHide: true,
  404. scrollbarDraggable: false,
  405. scrollbarSnapOnRelease: false,
  406. // Keyboard Mousewheel
  407. keyboardControl: false,
  408. mousewheelControl: false,
  409. mousewheelReleaseOnEdges: false,
  410. mousewheelInvert: false,
  411. mousewheelForceToAxis: false,
  412. mousewheelSensitivity: 1,
  413. mousewheelEventsTarged: 'lu-container',
  414. // Hash Navigation
  415. hashnav: false,
  416. hashnavWatchState: false,
  417. // History
  418. history: false,
  419. // Commong Nav State
  420. replaceState: false,
  421. // Breakpoints
  422. breakpoints: undefined,
  423. // Slides grid
  424. spaceBetween: 0,
  425. slidesPerView: 1,
  426. slidesPerColumn: 1,
  427. slidesPerColumnFill: 'column',
  428. slidesPerGroup: 1,
  429. centeredSlides: false,
  430. slidesOffsetBefore: 0, // in px
  431. slidesOffsetAfter: 0, // in px
  432. // Round length
  433. roundLengths: false,
  434. // Touches
  435. touchRatio: 1,
  436. touchAngle: 45,
  437. simulateTouch: true,
  438. shortSwipes: true,
  439. longSwipes: true,
  440. longSwipesRatio: 0.5,
  441. longSwipesMs: 300,
  442. followFinger: true,
  443. onlyExternal: false,
  444. threshold: 0,
  445. touchMoveStopPropagation: true,
  446. touchReleaseOnEdges: false,
  447. // Unique Navigation Elements
  448. uniqueNavElements: true,
  449. // Pagination
  450. pagination: null,
  451. paginationElement: 'span',
  452. paginationClickable: false,
  453. paginationHide: false,
  454. paginationBulletRender: null,
  455. paginationProgressRender: null,
  456. paginationFractionRender: null,
  457. paginationCustomRender: null,
  458. paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom'
  459. // Resistance
  460. resistance: true,
  461. resistanceRatio: 0.85,
  462. // Next/prev buttons
  463. nextButton: null,
  464. prevButton: null,
  465. // Progress
  466. watchSlidesProgress: false,
  467. watchSlidesVisibility: false,
  468. // Cursor
  469. grabCursor: false,
  470. // Clicks
  471. preventClicks: true,
  472. preventClicksPropagation: true,
  473. slideToClickedSlide: false,
  474. // Lazy Loading
  475. lazyLoading: false,
  476. lazyLoadingInPrevNext: false,
  477. lazyLoadingInPrevNextAmount: 1,
  478. lazyLoadingOnTransitionStart: false,
  479. // Images
  480. preloadImages: true,
  481. updateOnImagesReady: true,
  482. // loop
  483. loop: false,
  484. loopAdditionalSlides: 0,
  485. loopedSlides: null,
  486. // Control
  487. control: undefined,
  488. controlInverse: false,
  489. controlBy: 'slide', //or 'container'
  490. normalizeSlideIndex: true,
  491. // Swiping/no swiping
  492. allowSwipeToPrev: true,
  493. allowSwipeToNext: true,
  494. swipeHandler: null, //'.swipe-handler',
  495. noSwiping: true,
  496. noSwipingClass: 'swiper-no-swiping',
  497. // Passive Listeners
  498. passiveListeners: true,
  499. // NS
  500. containerModifierClass: 'swiper-container-', // NEW
  501. slideClass: 'swiper-slide',
  502. slideActiveClass: 'swiper-slide-active',
  503. slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
  504. slideVisibleClass: 'swiper-slide-visible',
  505. slideDuplicateClass: 'swiper-slide-duplicate',
  506. slideNextClass: 'swiper-slide-next',
  507. slideDuplicateNextClass: 'swiper-slide-duplicate-next',
  508. slidePrevClass: 'swiper-slide-prev',
  509. slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
  510. wrapperClass: 'swiper-wrapper',
  511. bulletClass: 'swiper-pagination-bullet',
  512. bulletActiveClass: 'swiper-pagination-bullet-active',
  513. buttonDisabledClass: 'swiper-button-disabled',
  514. paginationCurrentClass: 'swiper-pagination-current',
  515. paginationTotalClass: 'swiper-pagination-total',
  516. paginationHiddenClass: 'swiper-pagination-hidden',
  517. paginationProgressbarClass: 'swiper-pagination-progressbar',
  518. paginationClickableClass: 'swiper-pagination-clickable', // NEW
  519. paginationModifierClass: 'swiper-pagination-', // NEW
  520. lazyLoadingClass: 'swiper-lazy',
  521. lazyStatusLoadingClass: 'swiper-lazy-loading',
  522. lazyStatusLoadedClass: 'swiper-lazy-loaded',
  523. lazyPreloaderClass: 'swiper-lazy-preloader',
  524. notificationClass: 'swiper-notification',
  525. preloaderClass: 'preloader',
  526. zoomContainerClass: 'swiper-zoom-container',
  527. // Observer
  528. observer: false,
  529. observeParents: false,
  530. // Accessibility
  531. a11y: false,
  532. prevSlideMessage: 'Previous slide',
  533. nextSlideMessage: 'Next slide',
  534. firstSlideMessage: 'This is the first slide',
  535. lastSlideMessage: 'This is the last slide',
  536. paginationBulletMessage: 'Go to slide {{index}}',
  537. // Callbacks
  538. runCallbacksOnInit: true
  539. /*
  540. Callbacks:
  541. onInit: function (swiper)
  542. onDestroy: function (swiper)
  543. onBeforeResize: function (swiper)
  544. onAfterResize: function (swiper)
  545. onClick: function (swiper, e)
  546. onTap: function (swiper, e)
  547. onDoubleTap: function (swiper, e)
  548. onSliderMove: function (swiper, e)
  549. onSlideChangeStart: function (swiper)
  550. onSlideChangeEnd: function (swiper)
  551. onTransitionStart: function (swiper)
  552. onTransitionEnd: function (swiper)
  553. onImagesReady: function (swiper)
  554. onProgress: function (swiper, progress)
  555. onTouchStart: function (swiper, e)
  556. onTouchMove: function (swiper, e)
  557. onTouchMoveOpposite: function (swiper, e)
  558. onTouchEnd: function (swiper, e)
  559. onReachBeginning: function (swiper)
  560. onReachEnd: function (swiper)
  561. onSetTransition: function (swiper, duration)
  562. onSetTranslate: function (swiper, translate)
  563. onAutoplayStart: function (swiper)
  564. onAutoplayStop: function (swiper),
  565. onLazyImageLoad: function (swiper, slide, image)
  566. onLazyImageReady: function (swiper, slide, image)
  567. onKeyPress: function (swiper, keyCode)
  568. */
  569. };
  570. var initialVirtualTranslate = params && params.virtualTranslate;
  571. params = params || {};
  572. var originalParams = {};
  573. for (var param in params) {
  574. if (_typeof(params[param]) === 'object' && params[param] !== null && !(params[param].nodeType || params[param] === window || params[param] === document || typeof Dom7 !== 'undefined' && params[param] instanceof Dom7 || typeof jQuery !== 'undefined' && params[param] instanceof jQuery)) {
  575. originalParams[param] = {};
  576. for (var deepParam in params[param]) {
  577. originalParams[param][deepParam] = params[param][deepParam];
  578. }
  579. } else {
  580. originalParams[param] = params[param];
  581. }
  582. }
  583. for (var def in defaults) {
  584. if (typeof params[def] === 'undefined') {
  585. params[def] = defaults[def];
  586. } else if (_typeof(params[def]) === 'object') {
  587. for (var deepDef in defaults[def]) {
  588. if (typeof params[def][deepDef] === 'undefined') {
  589. params[def][deepDef] = defaults[def][deepDef];
  590. }
  591. }
  592. }
  593. }
  594. // Swiper
  595. var s = this;
  596. // Params
  597. s.params = params;
  598. s.originalParams = originalParams;
  599. // Classname
  600. s.classNames = [];
  601. /*=========================
  602. Dom Library and plugins
  603. ===========================*/
  604. if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined') {
  605. $ = Dom7;
  606. }
  607. if (typeof $ === 'undefined') {
  608. if (typeof Dom7 === 'undefined') {
  609. $ = window.Dom7 || window.Zepto || window.jQuery;
  610. } else {
  611. $ = Dom7;
  612. }
  613. if (!$) return;
  614. }
  615. // Export it to Swiper instance
  616. s.$ = $;
  617. /*=========================
  618. Breakpoints
  619. ===========================*/
  620. s.currentBreakpoint = undefined;
  621. s.getActiveBreakpoint = function () {
  622. //Get breakpoint for window width
  623. if (!s.params.breakpoints) return false;
  624. var breakpoint = false;
  625. var points = [],
  626. point;
  627. for (point in s.params.breakpoints) {
  628. if (s.params.breakpoints.hasOwnProperty(point)) {
  629. points.push(point);
  630. }
  631. }
  632. points.sort(function (a, b) {
  633. return parseInt(a, 10) > parseInt(b, 10);
  634. });
  635. for (var i = 0; i < points.length; i++) {
  636. point = points[i];
  637. if (point >= window.innerWidth && !breakpoint) {
  638. breakpoint = point;
  639. }
  640. }
  641. return breakpoint || 'max';
  642. };
  643. s.setBreakpoint = function () {
  644. //Set breakpoint for window width and update parameters
  645. var breakpoint = s.getActiveBreakpoint();
  646. if (breakpoint && s.currentBreakpoint !== breakpoint) {
  647. var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
  648. var needsReLoop = s.params.loop && breakPointsParams.slidesPerView !== s.params.slidesPerView;
  649. for (var param in breakPointsParams) {
  650. s.params[param] = breakPointsParams[param];
  651. }
  652. s.currentBreakpoint = breakpoint;
  653. if (needsReLoop && s.destroyLoop) {
  654. s.reLoop(true);
  655. }
  656. }
  657. };
  658. // Set breakpoint on load
  659. if (s.params.breakpoints) {
  660. s.setBreakpoint();
  661. }
  662. /*=========================
  663. Preparation - Define Container, Wrapper and Pagination
  664. ===========================*/
  665. s.container = $(container);
  666. if (s.container.length === 0) return;
  667. if (s.container.length > 1) {
  668. var swipers = [];
  669. s.container.each(function () {
  670. var container = this;
  671. swipers.push(new Swiper(this, params));
  672. });
  673. return swipers;
  674. }
  675. // Save instance in container HTML Element and in data
  676. s.container[0].swiper = s;
  677. s.container.data('swiper', s);
  678. s.classNames.push(s.params.containerModifierClass + s.params.direction);
  679. if (s.params.freeMode) {
  680. s.classNames.push(s.params.containerModifierClass + 'free-mode');
  681. }
  682. if (!s.support.flexbox) {
  683. s.classNames.push(s.params.containerModifierClass + 'no-flexbox');
  684. s.params.slidesPerColumn = 1;
  685. }
  686. if (s.params.autoHeight) {
  687. s.classNames.push(s.params.containerModifierClass + 'autoheight');
  688. }
  689. // Enable slides progress when required
  690. if (s.params.parallax || s.params.watchSlidesVisibility) {
  691. s.params.watchSlidesProgress = true;
  692. }
  693. // Max resistance when touchReleaseOnEdges
  694. if (s.params.touchReleaseOnEdges) {
  695. s.params.resistanceRatio = 0;
  696. }
  697. // Coverflow / 3D
  698. if (['cube', 'coverflow', 'flip'].indexOf(s.params.effect) >= 0) {
  699. if (s.support.transforms3d) {
  700. s.params.watchSlidesProgress = true;
  701. s.classNames.push(s.params.containerModifierClass + '3d');
  702. } else {
  703. s.params.effect = 'slide';
  704. }
  705. }
  706. if (s.params.effect !== 'slide') {
  707. s.classNames.push(s.params.containerModifierClass + s.params.effect);
  708. }
  709. if (s.params.effect === 'cube') {
  710. s.params.resistanceRatio = 0;
  711. s.params.slidesPerView = 1;
  712. s.params.slidesPerColumn = 1;
  713. s.params.slidesPerGroup = 1;
  714. s.params.centeredSlides = false;
  715. s.params.spaceBetween = 0;
  716. s.params.virtualTranslate = true;
  717. }
  718. if (s.params.effect === 'fade' || s.params.effect === 'flip') {
  719. s.params.slidesPerView = 1;
  720. s.params.slidesPerColumn = 1;
  721. s.params.slidesPerGroup = 1;
  722. s.params.watchSlidesProgress = true;
  723. s.params.spaceBetween = 0;
  724. if (typeof initialVirtualTranslate === 'undefined') {
  725. s.params.virtualTranslate = true;
  726. }
  727. }
  728. // Grab Cursor
  729. if (s.params.grabCursor && s.support.touch) {
  730. s.params.grabCursor = false;
  731. }
  732. // Wrapper
  733. s.wrapper = s.container.children('.' + s.params.wrapperClass);
  734. // Pagination
  735. if (s.params.pagination) {
  736. s.paginationContainer = $(s.params.pagination);
  737. if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
  738. s.paginationContainer = s.container.find(s.params.pagination);
  739. }
  740. if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
  741. s.paginationContainer.addClass(s.params.paginationModifierClass + 'clickable');
  742. } else {
  743. s.params.paginationClickable = false;
  744. }
  745. s.paginationContainer.addClass(s.params.paginationModifierClass + s.params.paginationType);
  746. }
  747. // Next/Prev Buttons
  748. if (s.params.nextButton || s.params.prevButton) {
  749. if (s.params.nextButton) {
  750. s.nextButton = $(s.params.nextButton);
  751. if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
  752. s.nextButton = s.container.find(s.params.nextButton);
  753. }
  754. }
  755. if (s.params.prevButton) {
  756. s.prevButton = $(s.params.prevButton);
  757. if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
  758. s.prevButton = s.container.find(s.params.prevButton);
  759. }
  760. }
  761. }
  762. // Is Horizontal
  763. s.isHorizontal = function () {
  764. return s.params.direction === 'horizontal';
  765. };
  766. // s.isH = isH;
  767. // RTL
  768. s.rtl = s.isHorizontal() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
  769. if (s.rtl) {
  770. s.classNames.push(s.params.containerModifierClass + 'rtl');
  771. }
  772. // Wrong RTL support
  773. if (s.rtl) {
  774. s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
  775. }
  776. // Columns
  777. if (s.params.slidesPerColumn > 1) {
  778. s.classNames.push(s.params.containerModifierClass + 'multirow');
  779. }
  780. // Check for Android
  781. if (s.device.android) {
  782. s.classNames.push(s.params.containerModifierClass + 'android');
  783. }
  784. // Add classes
  785. s.container.addClass(s.classNames.join(' '));
  786. // Translate
  787. s.translate = 0;
  788. // Progress
  789. s.progress = 0;
  790. // Velocity
  791. s.velocity = 0;
  792. /*=========================
  793. Locks, unlocks
  794. ===========================*/
  795. s.lockSwipeToNext = function () {
  796. s.params.allowSwipeToNext = false;
  797. if (s.params.allowSwipeToPrev === false && s.params.grabCursor) {
  798. s.unsetGrabCursor();
  799. }
  800. };
  801. s.lockSwipeToPrev = function () {
  802. s.params.allowSwipeToPrev = false;
  803. if (s.params.allowSwipeToNext === false && s.params.grabCursor) {
  804. s.unsetGrabCursor();
  805. }
  806. };
  807. s.lockSwipes = function () {
  808. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;
  809. if (s.params.grabCursor) s.unsetGrabCursor();
  810. };
  811. s.unlockSwipeToNext = function () {
  812. s.params.allowSwipeToNext = true;
  813. if (s.params.allowSwipeToPrev === true && s.params.grabCursor) {
  814. s.setGrabCursor();
  815. }
  816. };
  817. s.unlockSwipeToPrev = function () {
  818. s.params.allowSwipeToPrev = true;
  819. if (s.params.allowSwipeToNext === true && s.params.grabCursor) {
  820. s.setGrabCursor();
  821. }
  822. };
  823. s.unlockSwipes = function () {
  824. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;
  825. if (s.params.grabCursor) s.setGrabCursor();
  826. };
  827. /*=========================
  828. Round helper
  829. ===========================*/
  830. function round(a) {
  831. return Math.floor(a);
  832. }
  833. /*=========================
  834. Set grab cursor
  835. ===========================*/
  836. s.setGrabCursor = function (moving) {
  837. s.container[0].style.cursor = 'move';
  838. s.container[0].style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
  839. s.container[0].style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
  840. s.container[0].style.cursor = moving ? 'grabbing' : 'grab';
  841. };
  842. s.unsetGrabCursor = function () {
  843. s.container[0].style.cursor = '';
  844. };
  845. if (s.params.grabCursor) {
  846. s.setGrabCursor();
  847. }
  848. /*=========================
  849. Update on Images Ready
  850. ===========================*/
  851. s.imagesToLoad = [];
  852. s.imagesLoaded = 0;
  853. s.loadImage = function (imgElement, src, srcset, sizes, checkForComplete, callback) {
  854. var image;
  855. function onReady() {
  856. if (callback) callback();
  857. }
  858. if (!imgElement.complete || !checkForComplete) {
  859. if (src) {
  860. image = new window.Image();
  861. image.onload = onReady;
  862. image.onerror = onReady;
  863. if (sizes) {
  864. image.sizes = sizes;
  865. }
  866. if (srcset) {
  867. image.srcset = srcset;
  868. }
  869. if (src) {
  870. image.src = src;
  871. }
  872. } else {
  873. onReady();
  874. }
  875. } else {
  876. //image already loaded...
  877. onReady();
  878. }
  879. };
  880. s.preloadImages = function () {
  881. s.imagesToLoad = s.container.find('img');
  882. function _onReady() {
  883. if (typeof s === 'undefined' || s === null || !s) return;
  884. if (s.imagesLoaded !== undefined) s.imagesLoaded++;
  885. if (s.imagesLoaded === s.imagesToLoad.length) {
  886. if (s.params.updateOnImagesReady) s.update();
  887. s.emit('onImagesReady', s);
  888. }
  889. }
  890. for (var i = 0; i < s.imagesToLoad.length; i++) {
  891. s.loadImage(s.imagesToLoad[i], s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src'), s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset'), s.imagesToLoad[i].sizes || s.imagesToLoad[i].getAttribute('sizes'), true, _onReady);
  892. }
  893. };
  894. /*=========================
  895. Autoplay
  896. ===========================*/
  897. s.autoplayTimeoutId = undefined;
  898. s.autoplaying = false;
  899. s.autoplayPaused = false;
  900. function autoplay() {
  901. var autoplayDelay = s.params.autoplay;
  902. var activeSlide = s.slides.eq(s.activeIndex);
  903. if (activeSlide.attr('data-swiper-autoplay')) {
  904. autoplayDelay = activeSlide.attr('data-swiper-autoplay') || s.params.autoplay;
  905. }
  906. s.autoplayTimeoutId = setTimeout(function () {
  907. if (s.params.loop) {
  908. s.fixLoop();
  909. s._slideNext();
  910. s.emit('onAutoplay', s);
  911. } else {
  912. if (!s.isEnd) {
  913. s._slideNext();
  914. s.emit('onAutoplay', s);
  915. } else {
  916. if (!params.autoplayStopOnLast) {
  917. s._slideTo(0);
  918. s.emit('onAutoplay', s);
  919. } else {
  920. s.stopAutoplay();
  921. }
  922. }
  923. }
  924. }, autoplayDelay);
  925. }
  926. s.startAutoplay = function () {
  927. if (typeof s.autoplayTimeoutId !== 'undefined') return false;
  928. if (!s.params.autoplay) return false;
  929. if (s.autoplaying) return false;
  930. s.autoplaying = true;
  931. s.emit('onAutoplayStart', s);
  932. autoplay();
  933. };
  934. s.stopAutoplay = function (internal) {
  935. if (!s.autoplayTimeoutId) return;
  936. if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
  937. s.autoplaying = false;
  938. s.autoplayTimeoutId = undefined;
  939. s.emit('onAutoplayStop', s);
  940. };
  941. s.pauseAutoplay = function (speed) {
  942. if (s.autoplayPaused) return;
  943. if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
  944. s.autoplayPaused = true;
  945. if (speed === 0) {
  946. s.autoplayPaused = false;
  947. autoplay();
  948. } else {
  949. s.wrapper.transitionEnd(function () {
  950. if (!s) return;
  951. s.autoplayPaused = false;
  952. if (!s.autoplaying) {
  953. s.stopAutoplay();
  954. } else {
  955. autoplay();
  956. }
  957. });
  958. }
  959. };
  960. /*=========================
  961. Min/Max Translate
  962. ===========================*/
  963. s.minTranslate = function () {
  964. return -s.snapGrid[0];
  965. };
  966. s.maxTranslate = function () {
  967. return -s.snapGrid[s.snapGrid.length - 1];
  968. };
  969. /*=========================
  970. Slider/slides sizes
  971. ===========================*/
  972. s.updateAutoHeight = function () {
  973. var activeSlides = [];
  974. var newHeight = 0;
  975. var i;
  976. // Find slides currently in view
  977. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerView > 1) {
  978. for (i = 0; i < Math.ceil(s.params.slidesPerView); i++) {
  979. var index = s.activeIndex + i;
  980. if (index > s.slides.length) break;
  981. activeSlides.push(s.slides.eq(index)[0]);
  982. }
  983. } else {
  984. activeSlides.push(s.slides.eq(s.activeIndex)[0]);
  985. }
  986. // Find new height from heighest slide in view
  987. for (i = 0; i < activeSlides.length; i++) {
  988. if (typeof activeSlides[i] !== 'undefined') {
  989. var height = activeSlides[i].offsetHeight;
  990. newHeight = height > newHeight ? height : newHeight;
  991. }
  992. }
  993. // Update Height
  994. if (newHeight) s.wrapper.css('height', newHeight + 'px');
  995. };
  996. s.updateContainerSize = function () {
  997. var width, height;
  998. if (typeof s.params.width !== 'undefined') {
  999. width = s.params.width;
  1000. } else {
  1001. width = s.container[0].clientWidth;
  1002. }
  1003. if (typeof s.params.height !== 'undefined') {
  1004. height = s.params.height;
  1005. } else {
  1006. height = s.container[0].clientHeight;
  1007. }
  1008. if (width === 0 && s.isHorizontal() || height === 0 && !s.isHorizontal()) {
  1009. return;
  1010. }
  1011. //Subtract paddings
  1012. width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);
  1013. height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);
  1014. // Store values
  1015. s.width = width;
  1016. s.height = height;
  1017. s.size = s.isHorizontal() ? s.width : s.height;
  1018. };
  1019. s.updateSlidesSize = function () {
  1020. s.slides = s.wrapper.children('.' + s.params.slideClass);
  1021. s.snapGrid = [];
  1022. s.slidesGrid = [];
  1023. s.slidesSizesGrid = [];
  1024. var spaceBetween = s.params.spaceBetween,
  1025. slidePosition = -s.params.slidesOffsetBefore,
  1026. i,
  1027. prevSlideSize = 0,
  1028. index = 0;
  1029. if (typeof s.size === 'undefined') return;
  1030. if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
  1031. spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
  1032. }
  1033. s.virtualSize = -spaceBetween;
  1034. // reset margins
  1035. if (s.rtl) s.slides.css({ marginLeft: '', marginTop: '' });else s.slides.css({ marginRight: '', marginBottom: '' });
  1036. var slidesNumberEvenToRows;
  1037. if (s.params.slidesPerColumn > 1) {
  1038. if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {
  1039. slidesNumberEvenToRows = s.slides.length;
  1040. } else {
  1041. slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;
  1042. }
  1043. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {
  1044. slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);
  1045. }
  1046. }
  1047. // Calc slides
  1048. var slideSize;
  1049. var slidesPerColumn = s.params.slidesPerColumn;
  1050. var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
  1051. var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);
  1052. for (i = 0; i < s.slides.length; i++) {
  1053. slideSize = 0;
  1054. var slide = s.slides.eq(i);
  1055. if (s.params.slidesPerColumn > 1) {
  1056. // Set slides order
  1057. var newSlideOrderIndex;
  1058. var column, row;
  1059. if (s.params.slidesPerColumnFill === 'column') {
  1060. column = Math.floor(i / slidesPerColumn);
  1061. row = i - column * slidesPerColumn;
  1062. if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {
  1063. if (++row >= slidesPerColumn) {
  1064. row = 0;
  1065. column++;
  1066. }
  1067. }
  1068. newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
  1069. slide.css({
  1070. '-webkit-box-ordinal-group': newSlideOrderIndex,
  1071. '-moz-box-ordinal-group': newSlideOrderIndex,
  1072. '-ms-flex-order': newSlideOrderIndex,
  1073. '-webkit-order': newSlideOrderIndex,
  1074. 'order': newSlideOrderIndex
  1075. });
  1076. } else {
  1077. row = Math.floor(i / slidesPerRow);
  1078. column = i - row * slidesPerRow;
  1079. }
  1080. slide.css('margin-' + (s.isHorizontal() ? 'top' : 'left'), row !== 0 && s.params.spaceBetween && s.params.spaceBetween + 'px').attr('data-swiper-column', column).attr('data-swiper-row', row);
  1081. }
  1082. if (slide.css('display') === 'none') continue;
  1083. if (s.params.slidesPerView === 'auto') {
  1084. slideSize = s.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
  1085. if (s.params.roundLengths) slideSize = round(slideSize);
  1086. } else {
  1087. slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;
  1088. if (s.params.roundLengths) slideSize = round(slideSize);
  1089. if (s.isHorizontal()) {
  1090. s.slides[i].style.width = slideSize + 'px';
  1091. } else {
  1092. s.slides[i].style.height = slideSize + 'px';
  1093. }
  1094. }
  1095. s.slides[i].swiperSlideSize = slideSize;
  1096. s.slidesSizesGrid.push(slideSize);
  1097. if (s.params.centeredSlides) {
  1098. slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
  1099. if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1100. if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1101. if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
  1102. if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
  1103. s.slidesGrid.push(slidePosition);
  1104. } else {
  1105. if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
  1106. s.slidesGrid.push(slidePosition);
  1107. slidePosition = slidePosition + slideSize + spaceBetween;
  1108. }
  1109. s.virtualSize += slideSize + spaceBetween;
  1110. prevSlideSize = slideSize;
  1111. index++;
  1112. }
  1113. s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;
  1114. var newSlidesGrid;
  1115. if (s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
  1116. s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });
  1117. }
  1118. if (!s.support.flexbox || s.params.setWrapperSize) {
  1119. if (s.isHorizontal()) s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });else s.wrapper.css({ height: s.virtualSize + s.params.spaceBetween + 'px' });
  1120. }
  1121. if (s.params.slidesPerColumn > 1) {
  1122. s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;
  1123. s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;
  1124. if (s.isHorizontal()) s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });else s.wrapper.css({ height: s.virtualSize + s.params.spaceBetween + 'px' });
  1125. if (s.params.centeredSlides) {
  1126. newSlidesGrid = [];
  1127. for (i = 0; i < s.snapGrid.length; i++) {
  1128. if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);
  1129. }
  1130. s.snapGrid = newSlidesGrid;
  1131. }
  1132. }
  1133. // Remove last grid elements depending on width
  1134. if (!s.params.centeredSlides) {
  1135. newSlidesGrid = [];
  1136. for (i = 0; i < s.snapGrid.length; i++) {
  1137. if (s.snapGrid[i] <= s.virtualSize - s.size) {
  1138. newSlidesGrid.push(s.snapGrid[i]);
  1139. }
  1140. }
  1141. s.snapGrid = newSlidesGrid;
  1142. if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
  1143. s.snapGrid.push(s.virtualSize - s.size);
  1144. }
  1145. }
  1146. if (s.snapGrid.length === 0) s.snapGrid = [0];
  1147. if (s.params.spaceBetween !== 0) {
  1148. if (s.isHorizontal()) {
  1149. if (s.rtl) s.slides.css({ marginLeft: spaceBetween + 'px' });else s.slides.css({ marginRight: spaceBetween + 'px' });
  1150. } else s.slides.css({ marginBottom: spaceBetween + 'px' });
  1151. }
  1152. if (s.params.watchSlidesProgress) {
  1153. s.updateSlidesOffset();
  1154. }
  1155. };
  1156. s.updateSlidesOffset = function () {
  1157. for (var i = 0; i < s.slides.length; i++) {
  1158. s.slides[i].swiperSlideOffset = s.isHorizontal() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;
  1159. }
  1160. };
  1161. /*=========================
  1162. Dynamic Slides Per View
  1163. ===========================*/
  1164. s.currentSlidesPerView = function () {
  1165. var spv = 1,
  1166. i,
  1167. j;
  1168. if (s.params.centeredSlides) {
  1169. var size = s.slides[s.activeIndex].swiperSlideSize;
  1170. var breakLoop;
  1171. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1172. if (s.slides[i] && !breakLoop) {
  1173. size += s.slides[i].swiperSlideSize;
  1174. spv++;
  1175. if (size > s.size) breakLoop = true;
  1176. }
  1177. }
  1178. for (j = s.activeIndex - 1; j >= 0; j--) {
  1179. if (s.slides[j] && !breakLoop) {
  1180. size += s.slides[j].swiperSlideSize;
  1181. spv++;
  1182. if (size > s.size) breakLoop = true;
  1183. }
  1184. }
  1185. } else {
  1186. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1187. if (s.slidesGrid[i] - s.slidesGrid[s.activeIndex] < s.size) {
  1188. spv++;
  1189. }
  1190. }
  1191. }
  1192. return spv;
  1193. };
  1194. /*=========================
  1195. Slider/slides progress
  1196. ===========================*/
  1197. s.updateSlidesProgress = function (translate) {
  1198. if (typeof translate === 'undefined') {
  1199. translate = s.translate || 0;
  1200. }
  1201. if (s.slides.length === 0) return;
  1202. if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();
  1203. var offsetCenter = -translate;
  1204. if (s.rtl) offsetCenter = translate;
  1205. // Visible Slides
  1206. s.slides.removeClass(s.params.slideVisibleClass);
  1207. for (var i = 0; i < s.slides.length; i++) {
  1208. var slide = s.slides[i];
  1209. var slideProgress = (offsetCenter + (s.params.centeredSlides ? s.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);
  1210. if (s.params.watchSlidesVisibility) {
  1211. var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
  1212. var slideAfter = slideBefore + s.slidesSizesGrid[i];
  1213. var isVisible = slideBefore >= 0 && slideBefore < s.size || slideAfter > 0 && slideAfter <= s.size || slideBefore <= 0 && slideAfter >= s.size;
  1214. if (isVisible) {
  1215. s.slides.eq(i).addClass(s.params.slideVisibleClass);
  1216. }
  1217. }
  1218. slide.progress = s.rtl ? -slideProgress : slideProgress;
  1219. }
  1220. };
  1221. s.updateProgress = function (translate) {
  1222. if (typeof translate === 'undefined') {
  1223. translate = s.translate || 0;
  1224. }
  1225. var translatesDiff = s.maxTranslate() - s.minTranslate();
  1226. var wasBeginning = s.isBeginning;
  1227. var wasEnd = s.isEnd;
  1228. if (translatesDiff === 0) {
  1229. s.progress = 0;
  1230. s.isBeginning = s.isEnd = true;
  1231. } else {
  1232. s.progress = (translate - s.minTranslate()) / translatesDiff;
  1233. s.isBeginning = s.progress <= 0;
  1234. s.isEnd = s.progress >= 1;
  1235. }
  1236. if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);
  1237. if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);
  1238. if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);
  1239. s.emit('onProgress', s, s.progress);
  1240. };
  1241. s.updateActiveIndex = function () {
  1242. var translate = s.rtl ? s.translate : -s.translate;
  1243. var newActiveIndex, i, snapIndex;
  1244. for (i = 0; i < s.slidesGrid.length; i++) {
  1245. if (typeof s.slidesGrid[i + 1] !== 'undefined') {
  1246. if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {
  1247. newActiveIndex = i;
  1248. } else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {
  1249. newActiveIndex = i + 1;
  1250. }
  1251. } else {
  1252. if (translate >= s.slidesGrid[i]) {
  1253. newActiveIndex = i;
  1254. }
  1255. }
  1256. }
  1257. // Normalize slideIndex
  1258. if (s.params.normalizeSlideIndex) {
  1259. if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
  1260. }
  1261. // for (i = 0; i < s.slidesGrid.length; i++) {
  1262. // if (- translate >= s.slidesGrid[i]) {
  1263. // newActiveIndex = i;
  1264. // }
  1265. // }
  1266. snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);
  1267. if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;
  1268. if (newActiveIndex === s.activeIndex) {
  1269. return;
  1270. }
  1271. s.snapIndex = snapIndex;
  1272. s.previousIndex = s.activeIndex;
  1273. s.activeIndex = newActiveIndex;
  1274. s.updateClasses();
  1275. s.updateRealIndex();
  1276. };
  1277. s.updateRealIndex = function () {
  1278. s.realIndex = parseInt(s.slides.eq(s.activeIndex).attr('data-swiper-slide-index') || s.activeIndex, 10);
  1279. };
  1280. /*=========================
  1281. Classes
  1282. ===========================*/
  1283. s.updateClasses = function () {
  1284. s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass + ' ' + s.params.slideDuplicateActiveClass + ' ' + s.params.slideDuplicateNextClass + ' ' + s.params.slideDuplicatePrevClass);
  1285. var activeSlide = s.slides.eq(s.activeIndex);
  1286. // Active classes
  1287. activeSlide.addClass(s.params.slideActiveClass);
  1288. if (params.loop) {
  1289. // Duplicate to all looped slides
  1290. if (activeSlide.hasClass(s.params.slideDuplicateClass)) {
  1291. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1292. } else {
  1293. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1294. }
  1295. }
  1296. // Next Slide
  1297. var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
  1298. if (s.params.loop && nextSlide.length === 0) {
  1299. nextSlide = s.slides.eq(0);
  1300. nextSlide.addClass(s.params.slideNextClass);
  1301. }
  1302. // Prev Slide
  1303. var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
  1304. if (s.params.loop && prevSlide.length === 0) {
  1305. prevSlide = s.slides.eq(-1);
  1306. prevSlide.addClass(s.params.slidePrevClass);
  1307. }
  1308. if (params.loop) {
  1309. // Duplicate to all looped slides
  1310. if (nextSlide.hasClass(s.params.slideDuplicateClass)) {
  1311. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1312. } else {
  1313. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1314. }
  1315. if (prevSlide.hasClass(s.params.slideDuplicateClass)) {
  1316. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1317. } else {
  1318. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1319. }
  1320. }
  1321. // Pagination
  1322. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1323. // Current/Total
  1324. var current,
  1325. total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1326. if (s.params.loop) {
  1327. current = Math.ceil((s.activeIndex - s.loopedSlides) / s.params.slidesPerGroup);
  1328. if (current > s.slides.length - 1 - s.loopedSlides * 2) {
  1329. current = current - (s.slides.length - s.loopedSlides * 2);
  1330. }
  1331. if (current > total - 1) current = current - total;
  1332. if (current < 0 && s.params.paginationType !== 'bullets') current = total + current;
  1333. } else {
  1334. if (typeof s.snapIndex !== 'undefined') {
  1335. current = s.snapIndex;
  1336. } else {
  1337. current = s.activeIndex || 0;
  1338. }
  1339. }
  1340. // Types
  1341. if (s.params.paginationType === 'bullets' && s.bullets && s.bullets.length > 0) {
  1342. s.bullets.removeClass(s.params.bulletActiveClass);
  1343. if (s.paginationContainer.length > 1) {
  1344. s.bullets.each(function () {
  1345. if ($(this).index() === current) $(this).addClass(s.params.bulletActiveClass);
  1346. });
  1347. } else {
  1348. s.bullets.eq(current).addClass(s.params.bulletActiveClass);
  1349. }
  1350. }
  1351. if (s.params.paginationType === 'fraction') {
  1352. s.paginationContainer.find('.' + s.params.paginationCurrentClass).text(current + 1);
  1353. s.paginationContainer.find('.' + s.params.paginationTotalClass).text(total);
  1354. }
  1355. if (s.params.paginationType === 'progress') {
  1356. var scale = (current + 1) / total,
  1357. scaleX = scale,
  1358. scaleY = 1;
  1359. if (!s.isHorizontal()) {
  1360. scaleY = scale;
  1361. scaleX = 1;
  1362. }
  1363. s.paginationContainer.find('.' + s.params.paginationProgressbarClass).transform('translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')').transition(s.params.speed);
  1364. }
  1365. if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
  1366. s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
  1367. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1368. }
  1369. }
  1370. // Next/active buttons
  1371. if (!s.params.loop) {
  1372. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1373. if (s.isBeginning) {
  1374. s.prevButton.addClass(s.params.buttonDisabledClass);
  1375. if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
  1376. } else {
  1377. s.prevButton.removeClass(s.params.buttonDisabledClass);
  1378. if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
  1379. }
  1380. }
  1381. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1382. if (s.isEnd) {
  1383. s.nextButton.addClass(s.params.buttonDisabledClass);
  1384. if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
  1385. } else {
  1386. s.nextButton.removeClass(s.params.buttonDisabledClass);
  1387. if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
  1388. }
  1389. }
  1390. }
  1391. };
  1392. /*=========================
  1393. Pagination
  1394. ===========================*/
  1395. s.updatePagination = function () {
  1396. if (!s.params.pagination) return;
  1397. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1398. var paginationHTML = '';
  1399. if (s.params.paginationType === 'bullets') {
  1400. var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1401. for (var i = 0; i < numberOfBullets; i++) {
  1402. if (s.params.paginationBulletRender) {
  1403. paginationHTML += s.params.paginationBulletRender(s, i, s.params.bulletClass);
  1404. } else {
  1405. paginationHTML += '<' + s.params.paginationElement + ' class="' + s.params.bulletClass + '"></' + s.params.paginationElement + '>';
  1406. }
  1407. }
  1408. s.paginationContainer.html(paginationHTML);
  1409. s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
  1410. if (s.params.paginationClickable && s.params.a11y && s.a11y) {
  1411. s.a11y.initPagination();
  1412. }
  1413. }
  1414. if (s.params.paginationType === 'fraction') {
  1415. if (s.params.paginationFractionRender) {
  1416. paginationHTML = s.params.paginationFractionRender(s, s.params.paginationCurrentClass, s.params.paginationTotalClass);
  1417. } else {
  1418. paginationHTML = '<span class="' + s.params.paginationCurrentClass + '"></span>' + ' / ' + '<span class="' + s.params.paginationTotalClass + '"></span>';
  1419. }
  1420. s.paginationContainer.html(paginationHTML);
  1421. }
  1422. if (s.params.paginationType === 'progress') {
  1423. if (s.params.paginationProgressRender) {
  1424. paginationHTML = s.params.paginationProgressRender(s, s.params.paginationProgressbarClass);
  1425. } else {
  1426. paginationHTML = '<span class="' + s.params.paginationProgressbarClass + '"></span>';
  1427. }
  1428. s.paginationContainer.html(paginationHTML);
  1429. }
  1430. if (s.params.paginationType !== 'custom') {
  1431. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1432. }
  1433. }
  1434. };
  1435. /*=========================
  1436. Common update method
  1437. ===========================*/
  1438. s.update = function (updateTranslate) {
  1439. if (!s) return;
  1440. s.updateContainerSize();
  1441. s.updateSlidesSize();
  1442. s.updateProgress();
  1443. s.updatePagination();
  1444. s.updateClasses();
  1445. if (s.params.scrollbar && s.scrollbar) {
  1446. s.scrollbar.set();
  1447. }
  1448. var newTranslate;
  1449. function forceSetTranslate() {
  1450. var translate = s.rtl ? -s.translate : s.translate;
  1451. newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1452. s.setWrapperTranslate(newTranslate);
  1453. s.updateActiveIndex();
  1454. s.updateClasses();
  1455. }
  1456. if (updateTranslate) {
  1457. var translated;
  1458. if (s.controller && s.controller.spline) {
  1459. s.controller.spline = undefined;
  1460. }
  1461. if (s.params.freeMode) {
  1462. forceSetTranslate();
  1463. if (s.params.autoHeight) {
  1464. s.updateAutoHeight();
  1465. }
  1466. } else {
  1467. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1468. translated = s.slideTo(s.slides.length - 1, 0, false, true);
  1469. } else {
  1470. translated = s.slideTo(s.activeIndex, 0, false, true);
  1471. }
  1472. if (!translated) {
  1473. forceSetTranslate();
  1474. }
  1475. }
  1476. } else if (s.params.autoHeight) {
  1477. s.updateAutoHeight();
  1478. }
  1479. };
  1480. /*=========================
  1481. Resize Handler
  1482. ===========================*/
  1483. s.onResize = function (forceUpdatePagination) {
  1484. if (s.params.onBeforeResize) s.params.onBeforeResize(s);
  1485. //Breakpoints
  1486. if (s.params.breakpoints) {
  1487. s.setBreakpoint();
  1488. }
  1489. // Disable locks on resize
  1490. var allowSwipeToPrev = s.params.allowSwipeToPrev;
  1491. var allowSwipeToNext = s.params.allowSwipeToNext;
  1492. s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;
  1493. s.updateContainerSize();
  1494. s.updateSlidesSize();
  1495. if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination();
  1496. if (s.params.scrollbar && s.scrollbar) {
  1497. s.scrollbar.set();
  1498. }
  1499. if (s.controller && s.controller.spline) {
  1500. s.controller.spline = undefined;
  1501. }
  1502. var slideChangedBySlideTo = false;
  1503. if (s.params.freeMode) {
  1504. var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1505. s.setWrapperTranslate(newTranslate);
  1506. s.updateActiveIndex();
  1507. s.updateClasses();
  1508. if (s.params.autoHeight) {
  1509. s.updateAutoHeight();
  1510. }
  1511. } else {
  1512. s.updateClasses();
  1513. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1514. slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
  1515. } else {
  1516. slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
  1517. }
  1518. }
  1519. if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
  1520. s.lazy.load();
  1521. }
  1522. // Return locks after resize
  1523. s.params.allowSwipeToPrev = allowSwipeToPrev;
  1524. s.params.allowSwipeToNext = allowSwipeToNext;
  1525. if (s.params.onAfterResize) s.params.onAfterResize(s);
  1526. };
  1527. /*=========================
  1528. Events
  1529. ===========================*/
  1530. //Define Touch Events
  1531. s.touchEventsDesktop = { start: 'mousedown', move: 'mousemove', end: 'mouseup' };
  1532. if (window.navigator.pointerEnabled) s.touchEventsDesktop = { start: 'pointerdown', move: 'pointermove', end: 'pointerup' };else if (window.navigator.msPointerEnabled) s.touchEventsDesktop = { start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp' };
  1533. s.touchEvents = {
  1534. start: s.support.touch || !s.params.simulateTouch ? 'touchstart' : s.touchEventsDesktop.start,
  1535. move: s.support.touch || !s.params.simulateTouch ? 'touchmove' : s.touchEventsDesktop.move,
  1536. end: s.support.touch || !s.params.simulateTouch ? 'touchend' : s.touchEventsDesktop.end
  1537. };
  1538. // WP8 Touch Events Fix
  1539. if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {
  1540. //console.log('1669', s.params.touchEventsTarget);
  1541. (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);
  1542. }
  1543. // Attach/detach events
  1544. s.initEvents = function (detach) {
  1545. var actionDom = detach ? 'off' : 'on';
  1546. var action = detach ? 'removeEventListener' : 'addEventListener';
  1547. var touchEventsTarget = s.params.touchEventsTarget === 'lu-container' ? s.container[0] : s.wrapper[0];
  1548. var target = s.support.touch ? touchEventsTarget : document;
  1549. var moveCapture = s.params.nested ? true : false;
  1550. //Touch Events
  1551. if (s.browser.ie) {
  1552. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
  1553. target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1554. target[action](s.touchEvents.end, s.onTouchEnd, false);
  1555. } else {
  1556. if (s.support.touch) {
  1557. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? { passive: true, capture: false } : false;
  1558. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, passiveListener);
  1559. touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1560. touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, passiveListener);
  1561. }
  1562. if (params.simulateTouch && !s.device.ios && !s.device.android || params.simulateTouch && !s.support.touch && s.device.ios) {
  1563. touchEventsTarget[action]('mousedown', s.onTouchStart, false);
  1564. document[action]('mousemove', s.onTouchMove, moveCapture);
  1565. document[action]('mouseup', s.onTouchEnd, false);
  1566. }
  1567. }
  1568. window[action]('resize', s.onResize);
  1569. // Next, Prev, Index
  1570. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1571. s.nextButton[actionDom]('click', s.onClickNext);
  1572. if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
  1573. }
  1574. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1575. s.prevButton[actionDom]('click', s.onClickPrev);
  1576. if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
  1577. }
  1578. if (s.params.pagination && s.params.paginationClickable) {
  1579. s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
  1580. if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
  1581. }
  1582. // Prevent Links Clicks
  1583. if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
  1584. };
  1585. s.attachEvents = function () {
  1586. s.initEvents();
  1587. };
  1588. s.detachEvents = function () {
  1589. s.initEvents(true);
  1590. };
  1591. /*=========================
  1592. Handle Clicks
  1593. ===========================*/
  1594. // Prevent Clicks
  1595. s.allowClick = true;
  1596. s.preventClicks = function (e) {
  1597. if (!s.allowClick) {
  1598. if (s.params.preventClicks) e.preventDefault();
  1599. if (s.params.preventClicksPropagation && s.animating) {
  1600. e.stopPropagation();
  1601. e.stopImmediatePropagation();
  1602. }
  1603. }
  1604. };
  1605. // Clicks
  1606. s.onClickNext = function (e) {
  1607. e.preventDefault();
  1608. if (s.isEnd && !s.params.loop) return;
  1609. s.slideNext();
  1610. };
  1611. s.onClickPrev = function (e) {
  1612. e.preventDefault();
  1613. if (s.isBeginning && !s.params.loop) return;
  1614. s.slidePrev();
  1615. };
  1616. s.onClickIndex = function (e) {
  1617. e.preventDefault();
  1618. var index = $(this).index() * s.params.slidesPerGroup;
  1619. if (s.params.loop) index = index + s.loopedSlides;
  1620. s.slideTo(index);
  1621. };
  1622. /*=========================
  1623. Handle Touches
  1624. ===========================*/
  1625. function findElementInEvent(e, selector) {
  1626. var el = $(e.target);
  1627. if (!el.is(selector)) {
  1628. if (typeof selector === 'string') {
  1629. el = el.parents(selector);
  1630. } else if (selector.nodeType) {
  1631. var found;
  1632. el.parents().each(function (index, _el) {
  1633. if (_el === selector) found = selector;
  1634. });
  1635. if (!found) return undefined;else return selector;
  1636. }
  1637. }
  1638. if (el.length === 0) {
  1639. return undefined;
  1640. }
  1641. return el[0];
  1642. }
  1643. s.updateClickedSlide = function (e) {
  1644. var slide = findElementInEvent(e, '.' + s.params.slideClass);
  1645. var slideFound = false;
  1646. if (slide) {
  1647. for (var i = 0; i < s.slides.length; i++) {
  1648. if (s.slides[i] === slide) slideFound = true;
  1649. }
  1650. }
  1651. if (slide && slideFound) {
  1652. s.clickedSlide = slide;
  1653. s.clickedIndex = $(slide).index();
  1654. } else {
  1655. s.clickedSlide = undefined;
  1656. s.clickedIndex = undefined;
  1657. return;
  1658. }
  1659. if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
  1660. var slideToIndex = s.clickedIndex,
  1661. realIndex,
  1662. duplicatedSlides,
  1663. slidesPerView = s.params.slidesPerView === 'auto' ? s.currentSlidesPerView() : s.params.slidesPerView;
  1664. if (s.params.loop) {
  1665. if (s.animating) return;
  1666. realIndex = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10);
  1667. if (s.params.centeredSlides) {
  1668. if (slideToIndex < s.loopedSlides - slidesPerView / 2 || slideToIndex > s.slides.length - s.loopedSlides + slidesPerView / 2) {
  1669. s.fixLoop();
  1670. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1671. setTimeout(function () {
  1672. s.slideTo(slideToIndex);
  1673. }, 0);
  1674. } else {
  1675. s.slideTo(slideToIndex);
  1676. }
  1677. } else {
  1678. if (slideToIndex > s.slides.length - slidesPerView) {
  1679. s.fixLoop();
  1680. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1681. setTimeout(function () {
  1682. s.slideTo(slideToIndex);
  1683. }, 0);
  1684. } else {
  1685. s.slideTo(slideToIndex);
  1686. }
  1687. }
  1688. } else {
  1689. s.slideTo(slideToIndex);
  1690. }
  1691. }
  1692. };
  1693. var isTouched,
  1694. isMoved,
  1695. allowTouchCallbacks,
  1696. touchStartTime,
  1697. isScrolling,
  1698. currentTranslate,
  1699. startTranslate,
  1700. allowThresholdMove,
  1701. // Form elements to match
  1702. formElements = 'input, select, textarea, button, video',
  1703. // Last click time
  1704. lastClickTime = Date.now(),
  1705. clickTimeout,
  1706. //Velocities
  1707. velocities = [],
  1708. allowMomentumBounce;
  1709. // Animating Flag
  1710. s.animating = false;
  1711. // Touches information
  1712. s.touches = {
  1713. startX: 0,
  1714. startY: 0,
  1715. currentX: 0,
  1716. currentY: 0,
  1717. diff: 0
  1718. };
  1719. // Touch handlers
  1720. var isTouchEvent, startMoving;
  1721. s.onTouchStart = function (e) {
  1722. if (e.originalEvent) e = e.originalEvent;
  1723. isTouchEvent = e.type === 'touchstart';
  1724. if (!isTouchEvent && 'which' in e && e.which === 3) return;
  1725. if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {
  1726. s.allowClick = true;
  1727. return;
  1728. }
  1729. if (s.params.swipeHandler) {
  1730. if (!findElementInEvent(e, s.params.swipeHandler)) return;
  1731. }
  1732. var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  1733. var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  1734. // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
  1735. if (s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {
  1736. return;
  1737. }
  1738. isTouched = true;
  1739. isMoved = false;
  1740. allowTouchCallbacks = true;
  1741. isScrolling = undefined;
  1742. startMoving = undefined;
  1743. s.touches.startX = startX;
  1744. s.touches.startY = startY;
  1745. touchStartTime = Date.now();
  1746. s.allowClick = true;
  1747. s.updateContainerSize();
  1748. s.swipeDirection = undefined;
  1749. if (s.params.threshold > 0) allowThresholdMove = false;
  1750. if (e.type !== 'touchstart') {
  1751. var preventDefault = true;
  1752. if ($(e.target).is(formElements)) preventDefault = false;
  1753. if (document.activeElement && $(document.activeElement).is(formElements)) {
  1754. document.activeElement.blur();
  1755. }
  1756. if (preventDefault) {
  1757. e.preventDefault();
  1758. }
  1759. }
  1760. s.emit('onTouchStart', s, e);
  1761. };
  1762. s.onTouchMove = function (e) {
  1763. if (e.originalEvent) e = e.originalEvent;
  1764. if (isTouchEvent && e.type === 'mousemove') return;
  1765. if (e.preventedByNestedSwiper) {
  1766. s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1767. s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1768. return;
  1769. }
  1770. if (s.params.onlyExternal) {
  1771. // isMoved = true;
  1772. s.allowClick = false;
  1773. if (isTouched) {
  1774. s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1775. s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1776. touchStartTime = Date.now();
  1777. }
  1778. return;
  1779. }
  1780. if (isTouchEvent && s.params.touchReleaseOnEdges && !s.params.loop) {
  1781. if (!s.isHorizontal()) {
  1782. // Vertical
  1783. if (s.touches.currentY < s.touches.startY && s.translate <= s.maxTranslate() || s.touches.currentY > s.touches.startY && s.translate >= s.minTranslate()) {
  1784. return;
  1785. }
  1786. } else {
  1787. if (s.touches.currentX < s.touches.startX && s.translate <= s.maxTranslate() || s.touches.currentX > s.touches.startX && s.translate >= s.minTranslate()) {
  1788. return;
  1789. }
  1790. }
  1791. }
  1792. if (isTouchEvent && document.activeElement) {
  1793. if (e.target === document.activeElement && $(e.target).is(formElements)) {
  1794. isMoved = true;
  1795. s.allowClick = false;
  1796. return;
  1797. }
  1798. }
  1799. if (allowTouchCallbacks) {
  1800. s.emit('onTouchMove', s, e);
  1801. }
  1802. if (e.targetTouches && e.targetTouches.length > 1) return;
  1803. s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1804. s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1805. if (typeof isScrolling === 'undefined') {
  1806. var touchAngle;
  1807. if (s.isHorizontal() && s.touches.currentY === s.touches.startY || !s.isHorizontal() && s.touches.currentX === s.touches.startX) {
  1808. isScrolling = false;
  1809. } else {
  1810. touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
  1811. isScrolling = s.isHorizontal() ? touchAngle > s.params.touchAngle : 90 - touchAngle > s.params.touchAngle;
  1812. }
  1813. }
  1814. if (isScrolling) {
  1815. s.emit('onTouchMoveOpposite', s, e);
  1816. }
  1817. if (typeof startMoving === 'undefined') {
  1818. if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {
  1819. startMoving = true;
  1820. }
  1821. }
  1822. if (!isTouched) return;
  1823. if (isScrolling) {
  1824. isTouched = false;
  1825. return;
  1826. }
  1827. if (!startMoving) {
  1828. return;
  1829. }
  1830. s.allowClick = false;
  1831. s.emit('onSliderMove', s, e);
  1832. e.preventDefault();
  1833. if (s.params.touchMoveStopPropagation && !s.params.nested) {
  1834. e.stopPropagation();
  1835. }
  1836. if (!isMoved) {
  1837. if (params.loop) {
  1838. s.fixLoop();
  1839. }
  1840. startTranslate = s.getWrapperTranslate();
  1841. s.setWrapperTransition(0);
  1842. if (s.animating) {
  1843. s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
  1844. }
  1845. if (s.params.autoplay && s.autoplaying) {
  1846. if (s.params.autoplayDisableOnInteraction) {
  1847. s.stopAutoplay();
  1848. } else {
  1849. s.pauseAutoplay();
  1850. }
  1851. }
  1852. allowMomentumBounce = false;
  1853. //Grab Cursor
  1854. if (s.params.grabCursor && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  1855. s.setGrabCursor(true);
  1856. }
  1857. }
  1858. isMoved = true;
  1859. var diff = s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  1860. diff = diff * s.params.touchRatio;
  1861. if (s.rtl) diff = -diff;
  1862. s.swipeDirection = diff > 0 ? 'prev' : 'next';
  1863. currentTranslate = diff + startTranslate;
  1864. var disableParentSwiper = true;
  1865. if (diff > 0 && currentTranslate > s.minTranslate()) {
  1866. disableParentSwiper = false;
  1867. if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);
  1868. } else if (diff < 0 && currentTranslate < s.maxTranslate()) {
  1869. disableParentSwiper = false;
  1870. if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);
  1871. }
  1872. if (disableParentSwiper) {
  1873. e.preventedByNestedSwiper = true;
  1874. }
  1875. // Directions locks
  1876. if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
  1877. currentTranslate = startTranslate;
  1878. }
  1879. if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
  1880. currentTranslate = startTranslate;
  1881. }
  1882. // Threshold
  1883. if (s.params.threshold > 0) {
  1884. if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
  1885. if (!allowThresholdMove) {
  1886. allowThresholdMove = true;
  1887. s.touches.startX = s.touches.currentX;
  1888. s.touches.startY = s.touches.currentY;
  1889. currentTranslate = startTranslate;
  1890. s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  1891. return;
  1892. }
  1893. } else {
  1894. currentTranslate = startTranslate;
  1895. return;
  1896. }
  1897. }
  1898. if (!s.params.followFinger) return;
  1899. // Update active index in free mode
  1900. if (s.params.freeMode || s.params.watchSlidesProgress) {
  1901. s.updateActiveIndex();
  1902. }
  1903. if (s.params.freeMode) {
  1904. //Velocity
  1905. if (velocities.length === 0) {
  1906. velocities.push({
  1907. position: s.touches[s.isHorizontal() ? 'startX' : 'startY'],
  1908. time: touchStartTime
  1909. });
  1910. }
  1911. velocities.push({
  1912. position: s.touches[s.isHorizontal() ? 'currentX' : 'currentY'],
  1913. time: new window.Date().getTime()
  1914. });
  1915. }
  1916. // Update progress
  1917. s.updateProgress(currentTranslate);
  1918. // Update translate
  1919. s.setWrapperTranslate(currentTranslate);
  1920. };
  1921. s.onTouchEnd = function (e) {
  1922. if (e.originalEvent) e = e.originalEvent;
  1923. if (allowTouchCallbacks) {
  1924. s.emit('onTouchEnd', s, e);
  1925. }
  1926. allowTouchCallbacks = false;
  1927. if (!isTouched) return;
  1928. //Return Grab Cursor
  1929. if (s.params.grabCursor && isMoved && isTouched && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  1930. s.setGrabCursor(false);
  1931. }
  1932. // Time diff
  1933. var touchEndTime = Date.now();
  1934. var timeDiff = touchEndTime - touchStartTime;
  1935. // Tap, doubleTap, Click
  1936. if (s.allowClick) {
  1937. s.updateClickedSlide(e);
  1938. s.emit('onTap', s, e);
  1939. if (timeDiff < 300 && touchEndTime - lastClickTime > 300) {
  1940. if (clickTimeout) clearTimeout(clickTimeout);
  1941. clickTimeout = setTimeout(function () {
  1942. if (!s) return;
  1943. if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {
  1944. s.paginationContainer.toggleClass(s.params.paginationHiddenClass);
  1945. }
  1946. s.emit('onClick', s, e);
  1947. }, 300);
  1948. }
  1949. if (timeDiff < 300 && touchEndTime - lastClickTime < 300) {
  1950. if (clickTimeout) clearTimeout(clickTimeout);
  1951. s.emit('onDoubleTap', s, e);
  1952. }
  1953. }
  1954. lastClickTime = Date.now();
  1955. setTimeout(function () {
  1956. if (s) s.allowClick = true;
  1957. }, 0);
  1958. if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
  1959. isTouched = isMoved = false;
  1960. return;
  1961. }
  1962. isTouched = isMoved = false;
  1963. var currentPos;
  1964. if (s.params.followFinger) {
  1965. currentPos = s.rtl ? s.translate : -s.translate;
  1966. } else {
  1967. currentPos = -currentTranslate;
  1968. }
  1969. if (s.params.freeMode) {
  1970. if (currentPos < -s.minTranslate()) {
  1971. s.slideTo(s.activeIndex);
  1972. return;
  1973. } else if (currentPos > -s.maxTranslate()) {
  1974. if (s.slides.length < s.snapGrid.length) {
  1975. s.slideTo(s.snapGrid.length - 1);
  1976. } else {
  1977. s.slideTo(s.slides.length - 1);
  1978. }
  1979. return;
  1980. }
  1981. if (s.params.freeModeMomentum) {
  1982. if (velocities.length > 1) {
  1983. var lastMoveEvent = velocities.pop(),
  1984. velocityEvent = velocities.pop();
  1985. var distance = lastMoveEvent.position - velocityEvent.position;
  1986. var time = lastMoveEvent.time - velocityEvent.time;
  1987. s.velocity = distance / time;
  1988. s.velocity = s.velocity / 2;
  1989. if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {
  1990. s.velocity = 0;
  1991. }
  1992. // this implies that the user stopped moving a finger then released.
  1993. // There would be no events with distance zero, so the last event is stale.
  1994. if (time > 150 || new window.Date().getTime() - lastMoveEvent.time > 300) {
  1995. s.velocity = 0;
  1996. }
  1997. } else {
  1998. s.velocity = 0;
  1999. }
  2000. s.velocity = s.velocity * s.params.freeModeMomentumVelocityRatio;
  2001. velocities.length = 0;
  2002. var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
  2003. var momentumDistance = s.velocity * momentumDuration;
  2004. var newPosition = s.translate + momentumDistance;
  2005. if (s.rtl) newPosition = -newPosition;
  2006. var doBounce = false;
  2007. var afterBouncePosition;
  2008. var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
  2009. if (newPosition < s.maxTranslate()) {
  2010. if (s.params.freeModeMomentumBounce) {
  2011. if (newPosition + s.maxTranslate() < -bounceAmount) {
  2012. newPosition = s.maxTranslate() - bounceAmount;
  2013. }
  2014. afterBouncePosition = s.maxTranslate();
  2015. doBounce = true;
  2016. allowMomentumBounce = true;
  2017. } else {
  2018. newPosition = s.maxTranslate();
  2019. }
  2020. } else if (newPosition > s.minTranslate()) {
  2021. if (s.params.freeModeMomentumBounce) {
  2022. if (newPosition - s.minTranslate() > bounceAmount) {
  2023. newPosition = s.minTranslate() + bounceAmount;
  2024. }
  2025. afterBouncePosition = s.minTranslate();
  2026. doBounce = true;
  2027. allowMomentumBounce = true;
  2028. } else {
  2029. newPosition = s.minTranslate();
  2030. }
  2031. } else if (s.params.freeModeSticky) {
  2032. var j = 0,
  2033. nextSlide;
  2034. for (j = 0; j < s.snapGrid.length; j += 1) {
  2035. if (s.snapGrid[j] > -newPosition) {
  2036. nextSlide = j;
  2037. break;
  2038. }
  2039. }
  2040. if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {
  2041. newPosition = s.snapGrid[nextSlide];
  2042. } else {
  2043. newPosition = s.snapGrid[nextSlide - 1];
  2044. }
  2045. if (!s.rtl) newPosition = -newPosition;
  2046. }
  2047. //Fix duration
  2048. if (s.velocity !== 0) {
  2049. if (s.rtl) {
  2050. momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);
  2051. } else {
  2052. momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
  2053. }
  2054. } else if (s.params.freeModeSticky) {
  2055. s.slideReset();
  2056. return;
  2057. }
  2058. if (s.params.freeModeMomentumBounce && doBounce) {
  2059. s.updateProgress(afterBouncePosition);
  2060. s.setWrapperTransition(momentumDuration);
  2061. s.setWrapperTranslate(newPosition);
  2062. s.onTransitionStart();
  2063. s.animating = true;
  2064. s.wrapper.transitionEnd(function () {
  2065. if (!s || !allowMomentumBounce) return;
  2066. s.emit('onMomentumBounce', s);
  2067. s.setWrapperTransition(s.params.speed);
  2068. s.setWrapperTranslate(afterBouncePosition);
  2069. s.wrapper.transitionEnd(function () {
  2070. if (!s) return;
  2071. s.onTransitionEnd();
  2072. });
  2073. });
  2074. } else if (s.velocity) {
  2075. s.updateProgress(newPosition);
  2076. s.setWrapperTransition(momentumDuration);
  2077. s.setWrapperTranslate(newPosition);
  2078. s.onTransitionStart();
  2079. if (!s.animating) {
  2080. s.animating = true;
  2081. s.wrapper.transitionEnd(function () {
  2082. if (!s) return;
  2083. s.onTransitionEnd();
  2084. });
  2085. }
  2086. } else {
  2087. s.updateProgress(newPosition);
  2088. }
  2089. s.updateActiveIndex();
  2090. }
  2091. if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {
  2092. s.updateProgress();
  2093. s.updateActiveIndex();
  2094. }
  2095. return;
  2096. }
  2097. // Find current slide
  2098. var i,
  2099. stopIndex = 0,
  2100. groupSize = s.slidesSizesGrid[0];
  2101. for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {
  2102. if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {
  2103. if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {
  2104. stopIndex = i;
  2105. groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];
  2106. }
  2107. } else {
  2108. if (currentPos >= s.slidesGrid[i]) {
  2109. stopIndex = i;
  2110. groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];
  2111. }
  2112. }
  2113. }
  2114. // Find current slide size
  2115. var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;
  2116. if (timeDiff > s.params.longSwipesMs) {
  2117. // Long touches
  2118. if (!s.params.longSwipes) {
  2119. s.slideTo(s.activeIndex);
  2120. return;
  2121. }
  2122. if (s.swipeDirection === 'next') {
  2123. if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
  2124. }
  2125. if (s.swipeDirection === 'prev') {
  2126. if (ratio > 1 - s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
  2127. }
  2128. } else {
  2129. // Short swipes
  2130. if (!s.params.shortSwipes) {
  2131. s.slideTo(s.activeIndex);
  2132. return;
  2133. }
  2134. if (s.swipeDirection === 'next') {
  2135. s.slideTo(stopIndex + s.params.slidesPerGroup);
  2136. }
  2137. if (s.swipeDirection === 'prev') {
  2138. s.slideTo(stopIndex);
  2139. }
  2140. }
  2141. };
  2142. /*=========================
  2143. Transitions
  2144. ===========================*/
  2145. s._slideTo = function (slideIndex, speed) {
  2146. return s.slideTo(slideIndex, speed, true, true);
  2147. };
  2148. s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
  2149. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2150. if (typeof slideIndex === 'undefined') slideIndex = 0;
  2151. if (slideIndex < 0) slideIndex = 0;
  2152. s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);
  2153. if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;
  2154. var translate = -s.snapGrid[s.snapIndex];
  2155. // Stop autoplay
  2156. if (s.params.autoplay && s.autoplaying) {
  2157. if (internal || !s.params.autoplayDisableOnInteraction) {
  2158. s.pauseAutoplay(speed);
  2159. } else {
  2160. s.stopAutoplay();
  2161. }
  2162. }
  2163. // Update progress
  2164. s.updateProgress(translate);
  2165. // Normalize slideIndex
  2166. if (s.params.normalizeSlideIndex) {
  2167. for (var i = 0; i < s.slidesGrid.length; i++) {
  2168. if (-Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
  2169. slideIndex = i;
  2170. }
  2171. }
  2172. }
  2173. // Directions locks
  2174. if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {
  2175. return false;
  2176. }
  2177. if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {
  2178. if ((s.activeIndex || 0) !== slideIndex) return false;
  2179. }
  2180. // Update Index
  2181. if (typeof speed === 'undefined') speed = s.params.speed;
  2182. s.previousIndex = s.activeIndex || 0;
  2183. s.activeIndex = slideIndex;
  2184. s.updateRealIndex();
  2185. if (s.rtl && -translate === s.translate || !s.rtl && translate === s.translate) {
  2186. // Update Height
  2187. if (s.params.autoHeight) {
  2188. s.updateAutoHeight();
  2189. }
  2190. s.updateClasses();
  2191. if (s.params.effect !== 'slide') {
  2192. s.setWrapperTranslate(translate);
  2193. }
  2194. return false;
  2195. }
  2196. s.updateClasses();
  2197. s.onTransitionStart(runCallbacks);
  2198. if (speed === 0 || s.browser.lteIE9) {
  2199. s.setWrapperTranslate(translate);
  2200. s.setWrapperTransition(0);
  2201. s.onTransitionEnd(runCallbacks);
  2202. } else {
  2203. s.setWrapperTranslate(translate);
  2204. s.setWrapperTransition(speed);
  2205. if (!s.animating) {
  2206. s.animating = true;
  2207. s.wrapper.transitionEnd(function () {
  2208. if (!s) return;
  2209. s.onTransitionEnd(runCallbacks);
  2210. });
  2211. }
  2212. }
  2213. return true;
  2214. };
  2215. s.onTransitionStart = function (runCallbacks) {
  2216. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2217. if (s.params.autoHeight) {
  2218. s.updateAutoHeight();
  2219. }
  2220. if (s.lazy) s.lazy.onTransitionStart();
  2221. if (runCallbacks) {
  2222. s.emit('onTransitionStart', s);
  2223. if (s.activeIndex !== s.previousIndex) {
  2224. s.emit('onSlideChangeStart', s);
  2225. if (s.activeIndex > s.previousIndex) {
  2226. s.emit('onSlideNextStart', s);
  2227. } else {
  2228. s.emit('onSlidePrevStart', s);
  2229. }
  2230. }
  2231. }
  2232. };
  2233. s.onTransitionEnd = function (runCallbacks) {
  2234. s.animating = false;
  2235. s.setWrapperTransition(0);
  2236. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2237. if (s.lazy) s.lazy.onTransitionEnd();
  2238. if (runCallbacks) {
  2239. s.emit('onTransitionEnd', s);
  2240. if (s.activeIndex !== s.previousIndex) {
  2241. s.emit('onSlideChangeEnd', s);
  2242. if (s.activeIndex > s.previousIndex) {
  2243. s.emit('onSlideNextEnd', s);
  2244. } else {
  2245. s.emit('onSlidePrevEnd', s);
  2246. }
  2247. }
  2248. }
  2249. if (s.params.history && s.history) {
  2250. s.history.setHistory(s.params.history, s.activeIndex);
  2251. }
  2252. if (s.params.hashnav && s.hashnav) {
  2253. s.hashnav.setHash();
  2254. }
  2255. };
  2256. s.slideNext = function (runCallbacks, speed, internal) {
  2257. if (s.params.loop) {
  2258. if (s.animating) return false;
  2259. s.fixLoop();
  2260. var clientLeft = s.container[0].clientLeft;
  2261. return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2262. } else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2263. };
  2264. s._slideNext = function (speed) {
  2265. return s.slideNext(true, speed, true);
  2266. };
  2267. s.slidePrev = function (runCallbacks, speed, internal) {
  2268. if (s.params.loop) {
  2269. if (s.animating) return false;
  2270. s.fixLoop();
  2271. var clientLeft = s.container[0].clientLeft;
  2272. return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2273. } else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2274. };
  2275. s._slidePrev = function (speed) {
  2276. return s.slidePrev(true, speed, true);
  2277. };
  2278. s.slideReset = function (runCallbacks, speed, internal) {
  2279. return s.slideTo(s.activeIndex, speed, runCallbacks);
  2280. };
  2281. s.disableTouchControl = function () {
  2282. s.params.onlyExternal = true;
  2283. return true;
  2284. };
  2285. s.enableTouchControl = function () {
  2286. s.params.onlyExternal = false;
  2287. return true;
  2288. };
  2289. /*=========================
  2290. Translate/transition helpers
  2291. ===========================*/
  2292. s.setWrapperTransition = function (duration, byController) {
  2293. s.wrapper.transition(duration);
  2294. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2295. s.effects[s.params.effect].setTransition(duration);
  2296. }
  2297. if (s.params.parallax && s.parallax) {
  2298. s.parallax.setTransition(duration);
  2299. }
  2300. if (s.params.scrollbar && s.scrollbar) {
  2301. s.scrollbar.setTransition(duration);
  2302. }
  2303. if (s.params.control && s.controller) {
  2304. s.controller.setTransition(duration, byController);
  2305. }
  2306. s.emit('onSetTransition', s, duration);
  2307. };
  2308. s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {
  2309. var x = 0,
  2310. y = 0,
  2311. z = 0;
  2312. if (s.isHorizontal()) {
  2313. x = s.rtl ? -translate : translate;
  2314. } else {
  2315. y = translate;
  2316. }
  2317. if (s.params.roundLengths) {
  2318. x = round(x);
  2319. y = round(y);
  2320. }
  2321. if (!s.params.virtualTranslate) {
  2322. if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');
  2323. }
  2324. s.translate = s.isHorizontal() ? x : y;
  2325. // Check if we need to update progress
  2326. var progress;
  2327. var translatesDiff = s.maxTranslate() - s.minTranslate();
  2328. if (translatesDiff === 0) {
  2329. progress = 0;
  2330. } else {
  2331. progress = (translate - s.minTranslate()) / translatesDiff;
  2332. }
  2333. if (progress !== s.progress) {
  2334. s.updateProgress(translate);
  2335. }
  2336. if (updateActiveIndex) s.updateActiveIndex();
  2337. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2338. s.effects[s.params.effect].setTranslate(s.translate);
  2339. }
  2340. if (s.params.parallax && s.parallax) {
  2341. s.parallax.setTranslate(s.translate);
  2342. }
  2343. if (s.params.scrollbar && s.scrollbar) {
  2344. s.scrollbar.setTranslate(s.translate);
  2345. }
  2346. if (s.params.control && s.controller) {
  2347. s.controller.setTranslate(s.translate, byController);
  2348. }
  2349. s.emit('onSetTranslate', s, s.translate);
  2350. };
  2351. s.getTranslate = function (el, axis) {
  2352. var matrix, curTransform, curStyle, transformMatrix;
  2353. // automatic axis detection
  2354. if (typeof axis === 'undefined') {
  2355. axis = 'x';
  2356. }
  2357. if (s.params.virtualTranslate) {
  2358. return s.rtl ? -s.translate : s.translate;
  2359. }
  2360. //console.log(el)
  2361. curStyle = window.getComputedStyle(el, null);
  2362. if (window.WebKitCSSMatrix) {
  2363. curTransform = curStyle.transform || curStyle.webkitTransform;
  2364. if (curTransform.split(',').length > 6) {
  2365. curTransform = curTransform.split(', ').map(function (a) {
  2366. return a.replace(',', '.');
  2367. }).join(', ');
  2368. }
  2369. // Some old versions of Webkit choke when 'none' is passed; pass
  2370. // empty string instead in this case
  2371. transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
  2372. } else {
  2373. transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
  2374. matrix = transformMatrix.toString().split(',');
  2375. }
  2376. if (axis === 'x') {
  2377. //Latest Chrome and webkits Fix
  2378. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
  2379. //Crazy IE10 Matrix
  2380. else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
  2381. //Normal Browsers
  2382. else curTransform = parseFloat(matrix[4]);
  2383. }
  2384. if (axis === 'y') {
  2385. //Latest Chrome and webkits Fix
  2386. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
  2387. //Crazy IE10 Matrix
  2388. else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
  2389. //Normal Browsers
  2390. else curTransform = parseFloat(matrix[5]);
  2391. }
  2392. if (s.rtl && curTransform) curTransform = -curTransform;
  2393. return curTransform || 0;
  2394. };
  2395. s.getWrapperTranslate = function (axis) {
  2396. if (typeof axis === 'undefined') {
  2397. axis = s.isHorizontal() ? 'x' : 'y';
  2398. }
  2399. return s.getTranslate(s.wrapper[0], axis);
  2400. };
  2401. /*=========================
  2402. Observer
  2403. ===========================*/
  2404. s.observers = [];
  2405. function initObserver(target, options) {
  2406. options = options || {};
  2407. // create an observer instance
  2408. var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
  2409. var observer = new ObserverFunc(function (mutations) {
  2410. mutations.forEach(function (mutation) {
  2411. s.onResize(true);
  2412. s.emit('onObserverUpdate', s, mutation);
  2413. });
  2414. });
  2415. observer.observe(target, {
  2416. attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
  2417. childList: typeof options.childList === 'undefined' ? true : options.childList,
  2418. characterData: typeof options.characterData === 'undefined' ? true : options.characterData
  2419. });
  2420. s.observers.push(observer);
  2421. }
  2422. s.initObservers = function () {
  2423. if (s.params.observeParents) {
  2424. var containerParents = s.container.parents();
  2425. for (var i = 0; i < containerParents.length; i++) {
  2426. initObserver(containerParents[i]);
  2427. }
  2428. }
  2429. // Observe container
  2430. initObserver(s.container[0], { childList: false });
  2431. // Observe wrapper
  2432. initObserver(s.wrapper[0], { attributes: false });
  2433. };
  2434. s.disconnectObservers = function () {
  2435. for (var i = 0; i < s.observers.length; i++) {
  2436. s.observers[i].disconnect();
  2437. }
  2438. s.observers = [];
  2439. };
  2440. /*=========================
  2441. Loop
  2442. ===========================*/
  2443. // Create looped slides
  2444. s.createLoop = function () {
  2445. // Remove duplicated slides
  2446. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2447. var slides = s.wrapper.children('.' + s.params.slideClass);
  2448. if (s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;
  2449. s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);
  2450. s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;
  2451. if (s.loopedSlides > slides.length) {
  2452. s.loopedSlides = slides.length;
  2453. }
  2454. var prependSlides = [],
  2455. appendSlides = [],
  2456. i;
  2457. slides.each(function (index, el) {
  2458. var slide = $(this);
  2459. if (index < s.loopedSlides) appendSlides.push(el);
  2460. if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);
  2461. slide.attr('data-swiper-slide-index', index);
  2462. });
  2463. for (i = 0; i < appendSlides.length; i++) {
  2464. s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2465. }
  2466. for (i = prependSlides.length - 1; i >= 0; i--) {
  2467. s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2468. }
  2469. };
  2470. s.destroyLoop = function () {
  2471. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2472. s.slides.removeAttr('data-swiper-slide-index');
  2473. };
  2474. s.reLoop = function (updatePosition) {
  2475. var oldIndex = s.activeIndex - s.loopedSlides;
  2476. s.destroyLoop();
  2477. s.createLoop();
  2478. s.updateSlidesSize();
  2479. if (updatePosition) {
  2480. s.slideTo(oldIndex + s.loopedSlides, 0, false);
  2481. }
  2482. };
  2483. s.fixLoop = function () {
  2484. var newIndex;
  2485. //Fix For Negative Oversliding
  2486. if (s.activeIndex < s.loopedSlides) {
  2487. newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;
  2488. newIndex = newIndex + s.loopedSlides;
  2489. s.slideTo(newIndex, 0, false, true);
  2490. }
  2491. //Fix For Positive Oversliding
  2492. else if (s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2 || s.activeIndex > s.slides.length - s.params.slidesPerView * 2) {
  2493. newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;
  2494. newIndex = newIndex + s.loopedSlides;
  2495. s.slideTo(newIndex, 0, false, true);
  2496. }
  2497. };
  2498. /*=========================
  2499. Append/Prepend/Remove Slides
  2500. ===========================*/
  2501. s.appendSlide = function (slides) {
  2502. if (s.params.loop) {
  2503. s.destroyLoop();
  2504. }
  2505. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2506. for (var i = 0; i < slides.length; i++) {
  2507. if (slides[i]) s.wrapper.append(slides[i]);
  2508. }
  2509. } else {
  2510. s.wrapper.append(slides);
  2511. }
  2512. if (s.params.loop) {
  2513. s.createLoop();
  2514. }
  2515. if (!(s.params.observer && s.support.observer)) {
  2516. s.update(true);
  2517. }
  2518. };
  2519. s.prependSlide = function (slides) {
  2520. if (s.params.loop) {
  2521. s.destroyLoop();
  2522. }
  2523. var newActiveIndex = s.activeIndex + 1;
  2524. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2525. for (var i = 0; i < slides.length; i++) {
  2526. if (slides[i]) s.wrapper.prepend(slides[i]);
  2527. }
  2528. newActiveIndex = s.activeIndex + slides.length;
  2529. } else {
  2530. s.wrapper.prepend(slides);
  2531. }
  2532. if (s.params.loop) {
  2533. s.createLoop();
  2534. }
  2535. if (!(s.params.observer && s.support.observer)) {
  2536. s.update(true);
  2537. }
  2538. s.slideTo(newActiveIndex, 0, false);
  2539. };
  2540. s.removeSlide = function (slidesIndexes) {
  2541. if (s.params.loop) {
  2542. s.destroyLoop();
  2543. s.slides = s.wrapper.children('.' + s.params.slideClass);
  2544. }
  2545. var newActiveIndex = s.activeIndex,
  2546. indexToRemove;
  2547. if ((typeof slidesIndexes === 'undefined' ? 'undefined' : _typeof(slidesIndexes)) === 'object' && slidesIndexes.length) {
  2548. for (var i = 0; i < slidesIndexes.length; i++) {
  2549. indexToRemove = slidesIndexes[i];
  2550. if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
  2551. if (indexToRemove < newActiveIndex) newActiveIndex--;
  2552. }
  2553. newActiveIndex = Math.max(newActiveIndex, 0);
  2554. } else {
  2555. indexToRemove = slidesIndexes;
  2556. if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
  2557. if (indexToRemove < newActiveIndex) newActiveIndex--;
  2558. newActiveIndex = Math.max(newActiveIndex, 0);
  2559. }
  2560. if (s.params.loop) {
  2561. s.createLoop();
  2562. }
  2563. if (!(s.params.observer && s.support.observer)) {
  2564. s.update(true);
  2565. }
  2566. if (s.params.loop) {
  2567. s.slideTo(newActiveIndex + s.loopedSlides, 0, false);
  2568. } else {
  2569. s.slideTo(newActiveIndex, 0, false);
  2570. }
  2571. };
  2572. s.removeAllSlides = function () {
  2573. var slidesIndexes = [];
  2574. for (var i = 0; i < s.slides.length; i++) {
  2575. slidesIndexes.push(i);
  2576. }
  2577. s.removeSlide(slidesIndexes);
  2578. };
  2579. /*=========================
  2580. Effects
  2581. ===========================*/
  2582. s.effects = {
  2583. fade: {
  2584. setTranslate: function setTranslate() {
  2585. for (var i = 0; i < s.slides.length; i++) {
  2586. var slide = s.slides.eq(i);
  2587. var offset = slide[0].swiperSlideOffset;
  2588. var tx = -offset;
  2589. if (!s.params.virtualTranslate) tx = tx - s.translate;
  2590. var ty = 0;
  2591. if (!s.isHorizontal()) {
  2592. ty = tx;
  2593. tx = 0;
  2594. }
  2595. var slideOpacity = s.params.fade.crossFade ? Math.max(1 - Math.abs(slide[0].progress), 0) : 1 + Math.min(Math.max(slide[0].progress, -1), 0);
  2596. slide.css({
  2597. opacity: slideOpacity
  2598. }).transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
  2599. }
  2600. },
  2601. setTransition: function setTransition(duration) {
  2602. s.slides.transition(duration);
  2603. if (s.params.virtualTranslate && duration !== 0) {
  2604. var eventTriggered = false;
  2605. s.slides.transitionEnd(function () {
  2606. if (eventTriggered) return;
  2607. if (!s) return;
  2608. eventTriggered = true;
  2609. s.animating = false;
  2610. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2611. for (var i = 0; i < triggerEvents.length; i++) {
  2612. s.wrapper.trigger(triggerEvents[i]);
  2613. }
  2614. });
  2615. }
  2616. }
  2617. },
  2618. flip: {
  2619. setTranslate: function setTranslate() {
  2620. for (var i = 0; i < s.slides.length; i++) {
  2621. var slide = s.slides.eq(i);
  2622. var progress = slide[0].progress;
  2623. if (s.params.flip.limitRotation) {
  2624. progress = Math.max(Math.min(slide[0].progress, 1), -1);
  2625. }
  2626. var offset = slide[0].swiperSlideOffset;
  2627. var rotate = -180 * progress,
  2628. rotateY = rotate,
  2629. rotateX = 0,
  2630. tx = -offset,
  2631. ty = 0;
  2632. if (!s.isHorizontal()) {
  2633. ty = tx;
  2634. tx = 0;
  2635. rotateX = -rotateY;
  2636. rotateY = 0;
  2637. } else if (s.rtl) {
  2638. rotateY = -rotateY;
  2639. }
  2640. slide[0].style.zIndex = -Math.abs(Math.round(progress)) + s.slides.length;
  2641. if (s.params.flip.slideShadows) {
  2642. //Set shadows
  2643. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2644. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2645. if (shadowBefore.length === 0) {
  2646. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2647. slide.append(shadowBefore);
  2648. }
  2649. if (shadowAfter.length === 0) {
  2650. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2651. slide.append(shadowAfter);
  2652. }
  2653. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  2654. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  2655. }
  2656. slide.transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
  2657. }
  2658. },
  2659. setTransition: function setTransition(duration) {
  2660. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2661. if (s.params.virtualTranslate && duration !== 0) {
  2662. var eventTriggered = false;
  2663. s.slides.eq(s.activeIndex).transitionEnd(function () {
  2664. if (eventTriggered) return;
  2665. if (!s) return;
  2666. if (!$(this).hasClass(s.params.slideActiveClass)) return;
  2667. eventTriggered = true;
  2668. s.animating = false;
  2669. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2670. for (var i = 0; i < triggerEvents.length; i++) {
  2671. s.wrapper.trigger(triggerEvents[i]);
  2672. }
  2673. });
  2674. }
  2675. }
  2676. },
  2677. cube: {
  2678. setTranslate: function setTranslate() {
  2679. var wrapperRotate = 0,
  2680. cubeShadow;
  2681. if (s.params.cube.shadow) {
  2682. if (s.isHorizontal()) {
  2683. cubeShadow = s.wrapper.find('.swiper-cube-shadow');
  2684. if (cubeShadow.length === 0) {
  2685. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2686. s.wrapper.append(cubeShadow);
  2687. }
  2688. cubeShadow.css({ height: s.width + 'px' });
  2689. } else {
  2690. cubeShadow = s.container.find('.swiper-cube-shadow');
  2691. if (cubeShadow.length === 0) {
  2692. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2693. s.container.append(cubeShadow);
  2694. }
  2695. }
  2696. }
  2697. for (var i = 0; i < s.slides.length; i++) {
  2698. var slide = s.slides.eq(i);
  2699. var slideAngle = i * 90;
  2700. var round = Math.floor(slideAngle / 360);
  2701. if (s.rtl) {
  2702. slideAngle = -slideAngle;
  2703. round = Math.floor(-slideAngle / 360);
  2704. }
  2705. var progress = Math.max(Math.min(slide[0].progress, 1), -1);
  2706. var tx = 0,
  2707. ty = 0,
  2708. tz = 0;
  2709. if (i % 4 === 0) {
  2710. tx = -round * 4 * s.size;
  2711. tz = 0;
  2712. } else if ((i - 1) % 4 === 0) {
  2713. tx = 0;
  2714. tz = -round * 4 * s.size;
  2715. } else if ((i - 2) % 4 === 0) {
  2716. tx = s.size + round * 4 * s.size;
  2717. tz = s.size;
  2718. } else if ((i - 3) % 4 === 0) {
  2719. tx = -s.size;
  2720. tz = 3 * s.size + s.size * 4 * round;
  2721. }
  2722. if (s.rtl) {
  2723. tx = -tx;
  2724. }
  2725. if (!s.isHorizontal()) {
  2726. ty = tx;
  2727. tx = 0;
  2728. }
  2729. var transform = 'rotateX(' + (s.isHorizontal() ? 0 : -slideAngle) + 'deg) rotateY(' + (s.isHorizontal() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
  2730. if (progress <= 1 && progress > -1) {
  2731. wrapperRotate = i * 90 + progress * 90;
  2732. if (s.rtl) wrapperRotate = -i * 90 - progress * 90;
  2733. }
  2734. slide.transform(transform);
  2735. if (s.params.cube.slideShadows) {
  2736. //Set shadows
  2737. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2738. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2739. if (shadowBefore.length === 0) {
  2740. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2741. slide.append(shadowBefore);
  2742. }
  2743. if (shadowAfter.length === 0) {
  2744. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2745. slide.append(shadowAfter);
  2746. }
  2747. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  2748. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  2749. }
  2750. }
  2751. s.wrapper.css({
  2752. '-webkit-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2753. '-moz-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2754. '-ms-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2755. 'transform-origin': '50% 50% -' + s.size / 2 + 'px'
  2756. });
  2757. if (s.params.cube.shadow) {
  2758. if (s.isHorizontal()) {
  2759. cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + -s.width / 2 + 'px) rotateX(90deg) rotateZ(0deg) scale(' + s.params.cube.shadowScale + ')');
  2760. } else {
  2761. var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
  2762. var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
  2763. var scale1 = s.params.cube.shadowScale,
  2764. scale2 = s.params.cube.shadowScale / multiplier,
  2765. offset = s.params.cube.shadowOffset;
  2766. cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + -s.height / 2 / scale2 + 'px) rotateX(-90deg)');
  2767. }
  2768. }
  2769. var zFactor = s.isSafari || s.isUiWebView ? -s.size / 2 : 0;
  2770. s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (s.isHorizontal() ? 0 : wrapperRotate) + 'deg) rotateY(' + (s.isHorizontal() ? -wrapperRotate : 0) + 'deg)');
  2771. },
  2772. setTransition: function setTransition(duration) {
  2773. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2774. if (s.params.cube.shadow && !s.isHorizontal()) {
  2775. s.container.find('.swiper-cube-shadow').transition(duration);
  2776. }
  2777. }
  2778. },
  2779. coverflow: {
  2780. setTranslate: function setTranslate() {
  2781. var transform = s.translate;
  2782. var center = s.isHorizontal() ? -transform + s.width / 2 : -transform + s.height / 2;
  2783. var rotate = s.isHorizontal() ? s.params.coverflow.rotate : -s.params.coverflow.rotate;
  2784. var translate = s.params.coverflow.depth;
  2785. //Each slide offset from center
  2786. for (var i = 0, length = s.slides.length; i < length; i++) {
  2787. var slide = s.slides.eq(i);
  2788. var slideSize = s.slidesSizesGrid[i];
  2789. var slideOffset = slide[0].swiperSlideOffset;
  2790. var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;
  2791. var rotateY = s.isHorizontal() ? rotate * offsetMultiplier : 0;
  2792. var rotateX = s.isHorizontal() ? 0 : rotate * offsetMultiplier;
  2793. // var rotateZ = 0
  2794. var translateZ = -translate * Math.abs(offsetMultiplier);
  2795. var translateY = s.isHorizontal() ? 0 : s.params.coverflow.stretch * offsetMultiplier;
  2796. var translateX = s.isHorizontal() ? s.params.coverflow.stretch * offsetMultiplier : 0;
  2797. //Fix for ultra small values
  2798. if (Math.abs(translateX) < 0.001) translateX = 0;
  2799. if (Math.abs(translateY) < 0.001) translateY = 0;
  2800. if (Math.abs(translateZ) < 0.001) translateZ = 0;
  2801. if (Math.abs(rotateY) < 0.001) rotateY = 0;
  2802. if (Math.abs(rotateX) < 0.001) rotateX = 0;
  2803. var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
  2804. slide.transform(slideTransform);
  2805. slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
  2806. if (s.params.coverflow.slideShadows) {
  2807. //Set shadows
  2808. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2809. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2810. if (shadowBefore.length === 0) {
  2811. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2812. slide.append(shadowBefore);
  2813. }
  2814. if (shadowAfter.length === 0) {
  2815. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2816. slide.append(shadowAfter);
  2817. }
  2818. if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
  2819. if (shadowAfter.length) shadowAfter[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
  2820. }
  2821. }
  2822. //Set correct perspective for IE10
  2823. if (s.browser.ie) {
  2824. var ws = s.wrapper[0].style;
  2825. ws.perspectiveOrigin = center + 'px 50%';
  2826. }
  2827. },
  2828. setTransition: function setTransition(duration) {
  2829. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2830. }
  2831. }
  2832. };
  2833. /*=========================
  2834. Images Lazy Loading
  2835. ===========================*/
  2836. s.lazy = {
  2837. initialImageLoaded: false,
  2838. loadImageInSlide: function loadImageInSlide(index, loadInDuplicate) {
  2839. if (typeof index === 'undefined') return;
  2840. if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;
  2841. if (s.slides.length === 0) return;
  2842. var slide = s.slides.eq(index);
  2843. var img = slide.find('.' + s.params.lazyLoadingClass + ':not(.' + s.params.lazyStatusLoadedClass + '):not(.' + s.params.lazyStatusLoadingClass + ')');
  2844. if (slide.hasClass(s.params.lazyLoadingClass) && !slide.hasClass(s.params.lazyStatusLoadedClass) && !slide.hasClass(s.params.lazyStatusLoadingClass)) {
  2845. img = img.add(slide[0]);
  2846. }
  2847. if (img.length === 0) return;
  2848. img.each(function () {
  2849. var _img = $(this);
  2850. _img.addClass(s.params.lazyStatusLoadingClass);
  2851. var background = _img.attr('data-background');
  2852. var src = _img.attr('data-src'),
  2853. srcset = _img.attr('data-srcset'),
  2854. sizes = _img.attr('data-sizes');
  2855. s.loadImage(_img[0], src || background, srcset, sizes, false, function () {
  2856. if (typeof s === 'undefined' || s === null || !s) return;
  2857. if (background) {
  2858. _img.css('background-image', 'url("' + background + '")');
  2859. _img.removeAttr('data-background');
  2860. } else {
  2861. if (srcset) {
  2862. _img.attr('srcset', srcset);
  2863. _img.removeAttr('data-srcset');
  2864. }
  2865. if (sizes) {
  2866. _img.attr('sizes', sizes);
  2867. _img.removeAttr('data-sizes');
  2868. }
  2869. if (src) {
  2870. _img.attr('src', src);
  2871. _img.removeAttr('data-src');
  2872. }
  2873. }
  2874. _img.addClass(s.params.lazyStatusLoadedClass).removeClass(s.params.lazyStatusLoadingClass);
  2875. slide.find('.' + s.params.lazyPreloaderClass + ', .' + s.params.preloaderClass).remove();
  2876. if (s.params.loop && loadInDuplicate) {
  2877. var slideOriginalIndex = slide.attr('data-swiper-slide-index');
  2878. if (slide.hasClass(s.params.slideDuplicateClass)) {
  2879. var originalSlide = s.wrapper.children('[data-swiper-slide-index="' + slideOriginalIndex + '"]:not(.' + s.params.slideDuplicateClass + ')');
  2880. s.lazy.loadImageInSlide(originalSlide.index(), false);
  2881. } else {
  2882. var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + slideOriginalIndex + '"]');
  2883. s.lazy.loadImageInSlide(duplicatedSlide.index(), false);
  2884. }
  2885. }
  2886. s.emit('onLazyImageReady', s, slide[0], _img[0]);
  2887. });
  2888. s.emit('onLazyImageLoad', s, slide[0], _img[0]);
  2889. });
  2890. },
  2891. load: function load() {
  2892. var i;
  2893. var slidesPerView = s.params.slidesPerView;
  2894. if (slidesPerView === 'auto') {
  2895. slidesPerView = 0;
  2896. }
  2897. if (!s.lazy.initialImageLoaded) s.lazy.initialImageLoaded = true;
  2898. if (s.params.watchSlidesVisibility) {
  2899. s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {
  2900. s.lazy.loadImageInSlide($(this).index());
  2901. });
  2902. } else {
  2903. if (slidesPerView > 1) {
  2904. for (i = s.activeIndex; i < s.activeIndex + slidesPerView; i++) {
  2905. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2906. }
  2907. } else {
  2908. s.lazy.loadImageInSlide(s.activeIndex);
  2909. }
  2910. }
  2911. if (s.params.lazyLoadingInPrevNext) {
  2912. if (slidesPerView > 1 || s.params.lazyLoadingInPrevNextAmount && s.params.lazyLoadingInPrevNextAmount > 1) {
  2913. var amount = s.params.lazyLoadingInPrevNextAmount;
  2914. var spv = slidesPerView;
  2915. var maxIndex = Math.min(s.activeIndex + spv + Math.max(amount, spv), s.slides.length);
  2916. var minIndex = Math.max(s.activeIndex - Math.max(spv, amount), 0);
  2917. // Next Slides
  2918. for (i = s.activeIndex + slidesPerView; i < maxIndex; i++) {
  2919. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2920. }
  2921. // Prev Slides
  2922. for (i = minIndex; i < s.activeIndex; i++) {
  2923. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2924. }
  2925. } else {
  2926. var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);
  2927. if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());
  2928. var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);
  2929. if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());
  2930. }
  2931. }
  2932. },
  2933. onTransitionStart: function onTransitionStart() {
  2934. if (s.params.lazyLoading) {
  2935. if (s.params.lazyLoadingOnTransitionStart || !s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded) {
  2936. s.lazy.load();
  2937. }
  2938. }
  2939. },
  2940. onTransitionEnd: function onTransitionEnd() {
  2941. if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {
  2942. s.lazy.load();
  2943. }
  2944. }
  2945. };
  2946. /*=========================
  2947. Scrollbar
  2948. ===========================*/
  2949. s.scrollbar = {
  2950. isTouched: false,
  2951. setDragPosition: function setDragPosition(e) {
  2952. var sb = s.scrollbar;
  2953. var x = 0,
  2954. y = 0;
  2955. var translate;
  2956. var pointerPosition = s.isHorizontal() ? e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX || e.clientX : e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY || e.clientY;
  2957. var position = pointerPosition - sb.track.offset()[s.isHorizontal() ? 'left' : 'top'] - sb.dragSize / 2;
  2958. var positionMin = -s.minTranslate() * sb.moveDivider;
  2959. var positionMax = -s.maxTranslate() * sb.moveDivider;
  2960. if (position < positionMin) {
  2961. position = positionMin;
  2962. } else if (position > positionMax) {
  2963. position = positionMax;
  2964. }
  2965. position = -position / sb.moveDivider;
  2966. s.updateProgress(position);
  2967. s.setWrapperTranslate(position, true);
  2968. },
  2969. dragStart: function dragStart(e) {
  2970. var sb = s.scrollbar;
  2971. sb.isTouched = true;
  2972. e.preventDefault();
  2973. e.stopPropagation();
  2974. sb.setDragPosition(e);
  2975. clearTimeout(sb.dragTimeout);
  2976. sb.track.transition(0);
  2977. if (s.params.scrollbarHide) {
  2978. sb.track.css('opacity', 1);
  2979. }
  2980. s.wrapper.transition(100);
  2981. sb.drag.transition(100);
  2982. s.emit('onScrollbarDragStart', s);
  2983. },
  2984. dragMove: function dragMove(e) {
  2985. var sb = s.scrollbar;
  2986. if (!sb.isTouched) return;
  2987. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  2988. sb.setDragPosition(e);
  2989. s.wrapper.transition(0);
  2990. sb.track.transition(0);
  2991. sb.drag.transition(0);
  2992. s.emit('onScrollbarDragMove', s);
  2993. },
  2994. dragEnd: function dragEnd(e) {
  2995. var sb = s.scrollbar;
  2996. if (!sb.isTouched) return;
  2997. sb.isTouched = false;
  2998. if (s.params.scrollbarHide) {
  2999. clearTimeout(sb.dragTimeout);
  3000. sb.dragTimeout = setTimeout(function () {
  3001. sb.track.css('opacity', 0);
  3002. sb.track.transition(400);
  3003. }, 1000);
  3004. }
  3005. s.emit('onScrollbarDragEnd', s);
  3006. if (s.params.scrollbarSnapOnRelease) {
  3007. s.slideReset();
  3008. }
  3009. },
  3010. draggableEvents: function () {
  3011. if (s.params.simulateTouch === false && !s.support.touch) return s.touchEventsDesktop;else return s.touchEvents;
  3012. }(),
  3013. enableDraggable: function enableDraggable() {
  3014. var sb = s.scrollbar;
  3015. var target = s.support.touch ? sb.track : document;
  3016. $(sb.track).on(sb.draggableEvents.start, sb.dragStart);
  3017. $(target).on(sb.draggableEvents.move, sb.dragMove);
  3018. $(target).on(sb.draggableEvents.end, sb.dragEnd);
  3019. },
  3020. disableDraggable: function disableDraggable() {
  3021. var sb = s.scrollbar;
  3022. var target = s.support.touch ? sb.track : document;
  3023. $(sb.track).off(sb.draggableEvents.start, sb.dragStart);
  3024. $(target).off(sb.draggableEvents.move, sb.dragMove);
  3025. $(target).off(sb.draggableEvents.end, sb.dragEnd);
  3026. },
  3027. set: function set() {
  3028. if (!s.params.scrollbar) return;
  3029. var sb = s.scrollbar;
  3030. sb.track = $(s.params.scrollbar);
  3031. if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
  3032. sb.track = s.container.find(s.params.scrollbar);
  3033. }
  3034. sb.drag = sb.track.find('.swiper-scrollbar-drag');
  3035. if (sb.drag.length === 0) {
  3036. sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
  3037. sb.track.append(sb.drag);
  3038. }
  3039. sb.drag[0].style.width = '';
  3040. sb.drag[0].style.height = '';
  3041. sb.trackSize = s.isHorizontal() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;
  3042. sb.divider = s.size / s.virtualSize;
  3043. sb.moveDivider = sb.divider * (sb.trackSize / s.size);
  3044. sb.dragSize = sb.trackSize * sb.divider;
  3045. if (s.isHorizontal()) {
  3046. sb.drag[0].style.width = sb.dragSize + 'px';
  3047. } else {
  3048. sb.drag[0].style.height = sb.dragSize + 'px';
  3049. }
  3050. if (sb.divider >= 1) {
  3051. sb.track[0].style.display = 'none';
  3052. } else {
  3053. sb.track[0].style.display = '';
  3054. }
  3055. if (s.params.scrollbarHide) {
  3056. sb.track[0].style.opacity = 0;
  3057. }
  3058. },
  3059. setTranslate: function setTranslate() {
  3060. if (!s.params.scrollbar) return;
  3061. var diff;
  3062. var sb = s.scrollbar;
  3063. var translate = s.translate || 0;
  3064. var newPos;
  3065. var newSize = sb.dragSize;
  3066. newPos = (sb.trackSize - sb.dragSize) * s.progress;
  3067. if (s.rtl && s.isHorizontal()) {
  3068. newPos = -newPos;
  3069. if (newPos > 0) {
  3070. newSize = sb.dragSize - newPos;
  3071. newPos = 0;
  3072. } else if (-newPos + sb.dragSize > sb.trackSize) {
  3073. newSize = sb.trackSize + newPos;
  3074. }
  3075. } else {
  3076. if (newPos < 0) {
  3077. newSize = sb.dragSize + newPos;
  3078. newPos = 0;
  3079. } else if (newPos + sb.dragSize > sb.trackSize) {
  3080. newSize = sb.trackSize - newPos;
  3081. }
  3082. }
  3083. if (s.isHorizontal()) {
  3084. if (s.support.transforms3d) {
  3085. sb.drag.transform('translate3d(' + newPos + 'px, 0, 0)');
  3086. } else {
  3087. sb.drag.transform('translateX(' + newPos + 'px)');
  3088. }
  3089. sb.drag[0].style.width = newSize + 'px';
  3090. } else {
  3091. if (s.support.transforms3d) {
  3092. sb.drag.transform('translate3d(0px, ' + newPos + 'px, 0)');
  3093. } else {
  3094. sb.drag.transform('translateY(' + newPos + 'px)');
  3095. }
  3096. sb.drag[0].style.height = newSize + 'px';
  3097. }
  3098. if (s.params.scrollbarHide) {
  3099. clearTimeout(sb.timeout);
  3100. sb.track[0].style.opacity = 1;
  3101. sb.timeout = setTimeout(function () {
  3102. sb.track[0].style.opacity = 0;
  3103. sb.track.transition(400);
  3104. }, 1000);
  3105. }
  3106. },
  3107. setTransition: function setTransition(duration) {
  3108. if (!s.params.scrollbar) return;
  3109. s.scrollbar.drag.transition(duration);
  3110. }
  3111. };
  3112. /*=========================
  3113. Controller
  3114. ===========================*/
  3115. s.controller = {
  3116. LinearSpline: function LinearSpline(x, y) {
  3117. var binarySearch = function () {
  3118. var maxIndex, minIndex, guess;
  3119. return function (array, val) {
  3120. minIndex = -1;
  3121. maxIndex = array.length;
  3122. while (maxIndex - minIndex > 1) {
  3123. if (array[guess = maxIndex + minIndex >> 1] <= val) {
  3124. minIndex = guess;
  3125. } else {
  3126. maxIndex = guess;
  3127. }
  3128. }return maxIndex;
  3129. };
  3130. }();
  3131. this.x = x;
  3132. this.y = y;
  3133. this.lastIndex = x.length - 1;
  3134. // Given an x value (x2), return the expected y2 value:
  3135. // (x1,y1) is the known point before given value,
  3136. // (x3,y3) is the known point after given value.
  3137. var i1, i3;
  3138. var l = this.x.length;
  3139. this.interpolate = function (x2) {
  3140. if (!x2) return 0;
  3141. // Get the indexes of x1 and x3 (the array indexes before and after given x2):
  3142. i3 = binarySearch(this.x, x2);
  3143. i1 = i3 - 1;
  3144. // We have our indexes i1 & i3, so we can calculate already:
  3145. // y2 := ((x2�x1) × (y3�y1)) ÷ (x3�x1) + y1
  3146. return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
  3147. };
  3148. },
  3149. //xxx: for now i will just save one spline function to to
  3150. getInterpolateFunction: function getInterpolateFunction(c) {
  3151. if (!s.controller.spline) s.controller.spline = s.params.loop ? new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) : new s.controller.LinearSpline(s.snapGrid, c.snapGrid);
  3152. },
  3153. setTranslate: function setTranslate(translate, byController) {
  3154. var controlled = s.params.control;
  3155. var multiplier, controlledTranslate;
  3156. function setControlledTranslate(c) {
  3157. // this will create an Interpolate function based on the snapGrids
  3158. // x is the Grid of the scrolled scroller and y will be the controlled scroller
  3159. // it makes sense to create this only once and recall it for the interpolation
  3160. // the function does a lot of value caching for performance
  3161. translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;
  3162. if (s.params.controlBy === 'slide') {
  3163. s.controller.getInterpolateFunction(c);
  3164. // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
  3165. // but it did not work out
  3166. controlledTranslate = -s.controller.spline.interpolate(-translate);
  3167. }
  3168. console.log('3402', s.params.controlBy);
  3169. if (!controlledTranslate || s.params.controlBy === 'container') {
  3170. multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());
  3171. controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();
  3172. }
  3173. if (s.params.controlInverse) {
  3174. controlledTranslate = c.maxTranslate() - controlledTranslate;
  3175. }
  3176. c.updateProgress(controlledTranslate);
  3177. c.setWrapperTranslate(controlledTranslate, false, s);
  3178. c.updateActiveIndex();
  3179. }
  3180. if (Array.isArray(controlled)) {
  3181. for (var i = 0; i < controlled.length; i++) {
  3182. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3183. setControlledTranslate(controlled[i]);
  3184. }
  3185. }
  3186. } else if (controlled instanceof Swiper && byController !== controlled) {
  3187. setControlledTranslate(controlled);
  3188. }
  3189. },
  3190. setTransition: function setTransition(duration, byController) {
  3191. var controlled = s.params.control;
  3192. var i;
  3193. function setControlledTransition(c) {
  3194. c.setWrapperTransition(duration, s);
  3195. if (duration !== 0) {
  3196. c.onTransitionStart();
  3197. c.wrapper.transitionEnd(function () {
  3198. if (!controlled) return;
  3199. if (c.params.loop && s.params.controlBy === 'slide') {
  3200. c.fixLoop();
  3201. }
  3202. c.onTransitionEnd();
  3203. });
  3204. }
  3205. }
  3206. if (Array.isArray(controlled)) {
  3207. for (i = 0; i < controlled.length; i++) {
  3208. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3209. setControlledTransition(controlled[i]);
  3210. }
  3211. }
  3212. } else if (controlled instanceof Swiper && byController !== controlled) {
  3213. setControlledTransition(controlled);
  3214. }
  3215. }
  3216. };
  3217. /*=========================
  3218. Hash Navigation
  3219. ===========================*/
  3220. s.hashnav = {
  3221. onHashCange: function onHashCange(e, a) {
  3222. var newHash = document.location.hash.replace('#', '');
  3223. var activeSlideHash = s.slides.eq(s.activeIndex).attr('data-hash');
  3224. if (newHash !== activeSlideHash) {
  3225. s.slideTo(s.wrapper.children('.' + s.params.slideClass + '[data-hash="' + newHash + '"]').index());
  3226. }
  3227. },
  3228. attachEvents: function attachEvents(detach) {
  3229. var action = detach ? 'off' : 'on';
  3230. $(window)[action]('hashchange', s.hashnav.onHashCange);
  3231. },
  3232. setHash: function setHash() {
  3233. if (!s.hashnav.initialized || !s.params.hashnav) return;
  3234. if (s.params.replaceState && window.history && window.history.replaceState) {
  3235. window.history.replaceState(null, null, '#' + s.slides.eq(s.activeIndex).attr('data-hash') || '');
  3236. } else {
  3237. var slide = s.slides.eq(s.activeIndex);
  3238. var hash = slide.attr('data-hash') || slide.attr('data-history');
  3239. document.location.hash = hash || '';
  3240. }
  3241. },
  3242. init: function init() {
  3243. if (!s.params.hashnav || s.params.history) return;
  3244. s.hashnav.initialized = true;
  3245. var hash = document.location.hash.replace('#', '');
  3246. if (hash) {
  3247. var speed = 0;
  3248. for (var i = 0, length = s.slides.length; i < length; i++) {
  3249. var slide = s.slides.eq(i);
  3250. var slideHash = slide.attr('data-hash') || slide.attr('data-history');
  3251. if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {
  3252. var index = slide.index();
  3253. s.slideTo(index, speed, s.params.runCallbacksOnInit, true);
  3254. }
  3255. }
  3256. }
  3257. if (s.params.hashnavWatchState) s.hashnav.attachEvents();
  3258. },
  3259. destroy: function destroy() {
  3260. if (s.params.hashnavWatchState) s.hashnav.attachEvents(true);
  3261. }
  3262. };
  3263. /*=========================
  3264. History Api with fallback to Hashnav
  3265. ===========================*/
  3266. s.history = {
  3267. init: function init() {
  3268. if (!s.params.history) return;
  3269. if (!window.history || !window.history.pushState) {
  3270. s.params.history = false;
  3271. s.params.hashnav = true;
  3272. return;
  3273. }
  3274. s.history.initialized = true;
  3275. this.paths = this.getPathValues();
  3276. if (!this.paths.key && !this.paths.value) return;
  3277. this.scrollToSlide(0, this.paths.value, s.params.runCallbacksOnInit);
  3278. if (!s.params.replaceState) {
  3279. window.addEventListener('popstate', this.setHistoryPopState);
  3280. }
  3281. },
  3282. setHistoryPopState: function setHistoryPopState() {
  3283. s.history.paths = s.history.getPathValues();
  3284. s.history.scrollToSlide(s.params.speed, s.history.paths.value, false);
  3285. },
  3286. getPathValues: function getPathValues() {
  3287. var pathArray = window.location.pathname.slice(1).split('/');
  3288. var total = pathArray.length;
  3289. var key = pathArray[total - 2];
  3290. var value = pathArray[total - 1];
  3291. return { key: key, value: value };
  3292. },
  3293. setHistory: function setHistory(key, index) {
  3294. if (!s.history.initialized || !s.params.history) return;
  3295. var slide = s.slides.eq(index);
  3296. var value = this.slugify(slide.attr('data-history'));
  3297. if (!window.location.pathname.includes(key)) {
  3298. value = key + '/' + value;
  3299. }
  3300. if (s.params.replaceState) {
  3301. window.history.replaceState(null, null, value);
  3302. } else {
  3303. window.history.pushState(null, null, value);
  3304. }
  3305. },
  3306. slugify: function slugify(text) {
  3307. return text.toString().toLowerCase().replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
  3308. },
  3309. scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
  3310. if (value) {
  3311. for (var i = 0, length = s.slides.length; i < length; i++) {
  3312. var slide = s.slides.eq(i);
  3313. var slideHistory = this.slugify(slide.attr('data-history'));
  3314. if (slideHistory === value && !slide.hasClass(s.params.slideDuplicateClass)) {
  3315. var index = slide.index();
  3316. s.slideTo(index, speed, runCallbacks);
  3317. }
  3318. }
  3319. } else {
  3320. s.slideTo(0, speed, runCallbacks);
  3321. }
  3322. }
  3323. };
  3324. /*=========================
  3325. Keyboard Control
  3326. ===========================*/
  3327. function handleKeyboard(e) {
  3328. if (e.originalEvent) e = e.originalEvent; //jquery fix
  3329. var kc = e.keyCode || e.charCode;
  3330. // Directions locks
  3331. if (!s.params.allowSwipeToNext && (s.isHorizontal() && kc === 39 || !s.isHorizontal() && kc === 40)) {
  3332. return false;
  3333. }
  3334. if (!s.params.allowSwipeToPrev && (s.isHorizontal() && kc === 37 || !s.isHorizontal() && kc === 38)) {
  3335. return false;
  3336. }
  3337. if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
  3338. return;
  3339. }
  3340. if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
  3341. return;
  3342. }
  3343. if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
  3344. var inView = false;
  3345. //Check that swiper should be inside of visible area of window
  3346. if (s.container.parents('.' + s.params.slideClass).length > 0 && s.container.parents('.' + s.params.slideActiveClass).length === 0) {
  3347. return;
  3348. }
  3349. var windowScroll = {
  3350. left: window.pageXOffset,
  3351. top: window.pageYOffset
  3352. };
  3353. var windowWidth = window.innerWidth;
  3354. var windowHeight = window.innerHeight;
  3355. var swiperOffset = s.container.offset();
  3356. if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;
  3357. var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + s.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + s.height], [swiperOffset.left + s.width, swiperOffset.top + s.height]];
  3358. for (var i = 0; i < swiperCoord.length; i++) {
  3359. var point = swiperCoord[i];
  3360. if (point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth && point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight) {
  3361. inView = true;
  3362. }
  3363. }
  3364. if (!inView) return;
  3365. }
  3366. if (s.isHorizontal()) {
  3367. if (kc === 37 || kc === 39) {
  3368. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3369. }
  3370. if (kc === 39 && !s.rtl || kc === 37 && s.rtl) s.slideNext();
  3371. if (kc === 37 && !s.rtl || kc === 39 && s.rtl) s.slidePrev();
  3372. } else {
  3373. if (kc === 38 || kc === 40) {
  3374. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3375. }
  3376. if (kc === 40) s.slideNext();
  3377. if (kc === 38) s.slidePrev();
  3378. }
  3379. s.emit('onKeyPress', s, kc);
  3380. }
  3381. s.disableKeyboardControl = function () {
  3382. s.params.keyboardControl = false;
  3383. $(document).off('keydown', handleKeyboard);
  3384. };
  3385. s.enableKeyboardControl = function () {
  3386. s.params.keyboardControl = true;
  3387. $(document).on('keydown', handleKeyboard);
  3388. };
  3389. /*=========================
  3390. Mousewheel Control
  3391. ===========================*/
  3392. s.mousewheel = {
  3393. event: false,
  3394. lastScrollTime: new window.Date().getTime()
  3395. };
  3396. function isEventSupported() {
  3397. var eventName = 'onwheel';
  3398. var isSupported = eventName in document;
  3399. if (!isSupported) {
  3400. var element = document.createElement('div');
  3401. element.setAttribute(eventName, 'return;');
  3402. isSupported = typeof element[eventName] === 'function';
  3403. }
  3404. if (!isSupported && document.implementation && document.implementation.hasFeature &&
  3405. // always returns true in newer browsers as per the standard.
  3406. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  3407. document.implementation.hasFeature('', '') !== true) {
  3408. // This is the only way to test support for the `wheel` event in IE9+.
  3409. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  3410. }
  3411. return isSupported;
  3412. }
  3413. /**
  3414. * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
  3415. * complicated, thus this doc is long and (hopefully) detailed enough to answer
  3416. * your questions.
  3417. *
  3418. * If you need to react to the mouse wheel in a predictable way, this code is
  3419. * like your bestest friend. * hugs *
  3420. *
  3421. * As of today, there are 4 DOM event types you can listen to:
  3422. *
  3423. * 'wheel' -- Chrome(31+), FF(17+), IE(9+)
  3424. * 'mousewheel' -- Chrome, IE(6+), Opera, Safari
  3425. * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
  3426. * 'DOMMouseScroll' -- FF(0.9.7+) since 2003
  3427. *
  3428. * So what to do? The is the best:
  3429. *
  3430. * normalizeWheel.getEventType();
  3431. *
  3432. * In your event callback, use this code to get sane interpretation of the
  3433. * deltas. This code will return an object with properties:
  3434. *
  3435. * spinX -- normalized spin speed (use for zoom) - x plane
  3436. * spinY -- " - y plane
  3437. * pixelX -- normalized distance (to pixels) - x plane
  3438. * pixelY -- " - y plane
  3439. *
  3440. * Wheel values are provided by the browser assuming you are using the wheel to
  3441. * scroll a web page by a number of lines or pixels (or pages). Values can vary
  3442. * significantly on different platforms and browsers, forgetting that you can
  3443. * scroll at different speeds. Some devices (like trackpads) emit more events
  3444. * at smaller increments with fine granularity, and some emit massive jumps with
  3445. * linear speed or acceleration.
  3446. *
  3447. * This code does its best to normalize the deltas for you:
  3448. *
  3449. * - spin is trying to normalize how far the wheel was spun (or trackpad
  3450. * dragged). This is super useful for zoom support where you want to
  3451. * throw away the chunky scroll steps on the PC and make those equal to
  3452. * the slow and smooth tiny steps on the Mac. Key data: This code tries to
  3453. * resolve a single slow step on a wheel to 1.
  3454. *
  3455. * - pixel is normalizing the desired scroll delta in pixel units. You'll
  3456. * get the crazy differences between browsers, but at least it'll be in
  3457. * pixels!
  3458. *
  3459. * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
  3460. * should translate to positive value zooming IN, negative zooming OUT.
  3461. * This matches the newer 'wheel' event.
  3462. *
  3463. * Why are there spinX, spinY (or pixels)?
  3464. *
  3465. * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
  3466. * with a mouse. It results in side-scrolling in the browser by default.
  3467. *
  3468. * - spinY is what you expect -- it's the classic axis of a mouse wheel.
  3469. *
  3470. * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
  3471. * probably is by browsers in conjunction with fancy 3D controllers .. but
  3472. * you know.
  3473. *
  3474. * Implementation info:
  3475. *
  3476. * Examples of 'wheel' event if you scroll slowly (down) by one step with an
  3477. * average mouse:
  3478. *
  3479. * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
  3480. * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
  3481. * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
  3482. * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
  3483. * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
  3484. *
  3485. * On the trackpad:
  3486. *
  3487. * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
  3488. * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
  3489. *
  3490. * On other/older browsers.. it's more complicated as there can be multiple and
  3491. * also missing delta values.
  3492. *
  3493. * The 'wheel' event is more standard:
  3494. *
  3495. * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
  3496. *
  3497. * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
  3498. * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
  3499. * backward compatibility with older events. Those other values help us
  3500. * better normalize spin speed. Example of what the browsers provide:
  3501. *
  3502. * | event.wheelDelta | event.detail
  3503. * ------------------+------------------+--------------
  3504. * Safari v5/OS X | -120 | 0
  3505. * Safari v5/Win7 | -120 | 0
  3506. * Chrome v17/OS X | -120 | 0
  3507. * Chrome v17/Win7 | -120 | 0
  3508. * IE9/Win7 | -120 | undefined
  3509. * Firefox v4/OS X | undefined | 1
  3510. * Firefox v4/Win7 | undefined | 3
  3511. *
  3512. */
  3513. function normalizeWheel( /*object*/event) /*object*/{
  3514. // Reasonable defaults
  3515. var PIXEL_STEP = 10;
  3516. var LINE_HEIGHT = 40;
  3517. var PAGE_HEIGHT = 800;
  3518. var sX = 0,
  3519. sY = 0,
  3520. // spinX, spinY
  3521. pX = 0,
  3522. pY = 0; // pixelX, pixelY
  3523. // Legacy
  3524. if ('detail' in event) {
  3525. sY = event.detail;
  3526. }
  3527. if ('wheelDelta' in event) {
  3528. sY = -event.wheelDelta / 120;
  3529. }
  3530. if ('wheelDeltaY' in event) {
  3531. sY = -event.wheelDeltaY / 120;
  3532. }
  3533. if ('wheelDeltaX' in event) {
  3534. sX = -event.wheelDeltaX / 120;
  3535. }
  3536. // side scrolling on FF with DOMMouseScroll
  3537. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  3538. sX = sY;
  3539. sY = 0;
  3540. }
  3541. pX = sX * PIXEL_STEP;
  3542. pY = sY * PIXEL_STEP;
  3543. if ('deltaY' in event) {
  3544. pY = event.deltaY;
  3545. }
  3546. if ('deltaX' in event) {
  3547. pX = event.deltaX;
  3548. }
  3549. if ((pX || pY) && event.deltaMode) {
  3550. if (event.deltaMode === 1) {
  3551. // delta in LINE units
  3552. pX *= LINE_HEIGHT;
  3553. pY *= LINE_HEIGHT;
  3554. } else {
  3555. // delta in PAGE units
  3556. pX *= PAGE_HEIGHT;
  3557. pY *= PAGE_HEIGHT;
  3558. }
  3559. }
  3560. // Fall-back if spin cannot be determined
  3561. if (pX && !sX) {
  3562. sX = pX < 1 ? -1 : 1;
  3563. }
  3564. if (pY && !sY) {
  3565. sY = pY < 1 ? -1 : 1;
  3566. }
  3567. return {
  3568. spinX: sX,
  3569. spinY: sY,
  3570. pixelX: pX,
  3571. pixelY: pY
  3572. };
  3573. }
  3574. if (s.params.mousewheelControl) {
  3575. /**
  3576. * The best combination if you prefer spinX + spinY normalization. It favors
  3577. * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with
  3578. * 'wheel' event, making spin speed determination impossible.
  3579. */
  3580. s.mousewheel.event = navigator.userAgent.indexOf('firefox') > -1 ? 'DOMMouseScroll' : isEventSupported() ? 'wheel' : 'mousewheel';
  3581. }
  3582. function handleMousewheel(e) {
  3583. if (e.originalEvent) e = e.originalEvent; //jquery fix
  3584. var delta = 0;
  3585. var rtlFactor = s.rtl ? -1 : 1;
  3586. var data = normalizeWheel(e);
  3587. if (s.params.mousewheelForceToAxis) {
  3588. if (s.isHorizontal()) {
  3589. if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = data.pixelX * rtlFactor;else return;
  3590. } else {
  3591. if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = data.pixelY;else return;
  3592. }
  3593. } else {
  3594. delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
  3595. }
  3596. if (delta === 0) return;
  3597. if (s.params.mousewheelInvert) delta = -delta;
  3598. if (!s.params.freeMode) {
  3599. if (new window.Date().getTime() - s.mousewheel.lastScrollTime > 60) {
  3600. if (delta < 0) {
  3601. if ((!s.isEnd || s.params.loop) && !s.animating) {
  3602. s.slideNext();
  3603. s.emit('onScroll', s, e);
  3604. } else if (s.params.mousewheelReleaseOnEdges) return true;
  3605. } else {
  3606. if ((!s.isBeginning || s.params.loop) && !s.animating) {
  3607. s.slidePrev();
  3608. s.emit('onScroll', s, e);
  3609. } else if (s.params.mousewheelReleaseOnEdges) return true;
  3610. }
  3611. }
  3612. s.mousewheel.lastScrollTime = new window.Date().getTime();
  3613. } else {
  3614. //Freemode or scrollContainer:
  3615. var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;
  3616. var wasBeginning = s.isBeginning,
  3617. wasEnd = s.isEnd;
  3618. if (position >= s.minTranslate()) position = s.minTranslate();
  3619. if (position <= s.maxTranslate()) position = s.maxTranslate();
  3620. s.setWrapperTransition(0);
  3621. s.setWrapperTranslate(position);
  3622. s.updateProgress();
  3623. s.updateActiveIndex();
  3624. if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {
  3625. s.updateClasses();
  3626. }
  3627. if (s.params.freeModeSticky) {
  3628. clearTimeout(s.mousewheel.timeout);
  3629. s.mousewheel.timeout = setTimeout(function () {
  3630. s.slideReset();
  3631. }, 300);
  3632. } else {
  3633. if (s.params.lazyLoading && s.lazy) {
  3634. s.lazy.load();
  3635. }
  3636. }
  3637. // Emit event
  3638. s.emit('onScroll', s, e);
  3639. // Stop autoplay
  3640. if (s.params.autoplay && s.params.autoplayDisableOnInteraction) s.stopAutoplay();
  3641. // Return page scroll on edge positions
  3642. if (position === 0 || position === s.maxTranslate()) return;
  3643. }
  3644. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3645. return false;
  3646. }
  3647. s.disableMousewheelControl = function () {
  3648. if (!s.mousewheel.event) return false;
  3649. var target = s.container;
  3650. console.log('3913', s.params.mousewheelEventsTarged)
  3651. if (s.params.mousewheelEventsTarged !== 'container') {
  3652. target = $(s.params.mousewheelEventsTarged);
  3653. }
  3654. target.off(s.mousewheel.event, handleMousewheel);
  3655. s.params.mousewheelControl = false;
  3656. return true;
  3657. };
  3658. s.enableMousewheelControl = function () {
  3659. if (!s.mousewheel.event) return false;
  3660. var target = s.container;
  3661. console.log('3925', s.params.mousewheelEventsTarged)
  3662. if (s.params.mousewheelEventsTarged !== 'container') {
  3663. target = $(s.params.mousewheelEventsTarged);
  3664. }
  3665. target.on(s.mousewheel.event, handleMousewheel);
  3666. s.params.mousewheelControl = true;
  3667. return true;
  3668. };
  3669. /*=========================
  3670. Parallax
  3671. ===========================*/
  3672. function setParallaxTransform(el, progress) {
  3673. el = $(el);
  3674. var p, pX, pY;
  3675. var rtlFactor = s.rtl ? -1 : 1;
  3676. p = el.attr('data-swiper-parallax') || '0';
  3677. pX = el.attr('data-swiper-parallax-x');
  3678. pY = el.attr('data-swiper-parallax-y');
  3679. if (pX || pY) {
  3680. pX = pX || '0';
  3681. pY = pY || '0';
  3682. } else {
  3683. if (s.isHorizontal()) {
  3684. pX = p;
  3685. pY = '0';
  3686. } else {
  3687. pY = p;
  3688. pX = '0';
  3689. }
  3690. }
  3691. if (pX.indexOf('%') >= 0) {
  3692. pX = parseInt(pX, 10) * progress * rtlFactor + '%';
  3693. } else {
  3694. pX = pX * progress * rtlFactor + 'px';
  3695. }
  3696. if (pY.indexOf('%') >= 0) {
  3697. pY = parseInt(pY, 10) * progress + '%';
  3698. } else {
  3699. pY = pY * progress + 'px';
  3700. }
  3701. el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
  3702. }
  3703. s.parallax = {
  3704. setTranslate: function setTranslate() {
  3705. s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3706. setParallaxTransform(this, s.progress);
  3707. });
  3708. s.slides.each(function () {
  3709. var slide = $(this);
  3710. slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3711. var progress = Math.min(Math.max(slide[0].progress, -1), 1);
  3712. setParallaxTransform(this, progress);
  3713. });
  3714. });
  3715. },
  3716. setTransition: function setTransition(duration) {
  3717. if (typeof duration === 'undefined') duration = s.params.speed;
  3718. s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3719. var el = $(this);
  3720. var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
  3721. if (duration === 0) parallaxDuration = 0;
  3722. el.transition(parallaxDuration);
  3723. });
  3724. }
  3725. };
  3726. /*=========================
  3727. Zoom
  3728. ===========================*/
  3729. s.zoom = {
  3730. // "Global" Props
  3731. scale: 1,
  3732. currentScale: 1,
  3733. isScaling: false,
  3734. gesture: {
  3735. slide: undefined,
  3736. slideWidth: undefined,
  3737. slideHeight: undefined,
  3738. image: undefined,
  3739. imageWrap: undefined,
  3740. zoomMax: s.params.zoomMax
  3741. },
  3742. image: {
  3743. isTouched: undefined,
  3744. isMoved: undefined,
  3745. currentX: undefined,
  3746. currentY: undefined,
  3747. minX: undefined,
  3748. minY: undefined,
  3749. maxX: undefined,
  3750. maxY: undefined,
  3751. width: undefined,
  3752. height: undefined,
  3753. startX: undefined,
  3754. startY: undefined,
  3755. touchesStart: {},
  3756. touchesCurrent: {}
  3757. },
  3758. velocity: {
  3759. x: undefined,
  3760. y: undefined,
  3761. prevPositionX: undefined,
  3762. prevPositionY: undefined,
  3763. prevTime: undefined
  3764. },
  3765. // Calc Scale From Multi-touches
  3766. getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
  3767. if (e.targetTouches.length < 2) return 1;
  3768. var x1 = e.targetTouches[0].pageX,
  3769. y1 = e.targetTouches[0].pageY,
  3770. x2 = e.targetTouches[1].pageX,
  3771. y2 = e.targetTouches[1].pageY;
  3772. var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  3773. return distance;
  3774. },
  3775. // Events
  3776. onGestureStart: function onGestureStart(e) {
  3777. var z = s.zoom;
  3778. if (!s.support.gestures) {
  3779. if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {
  3780. return;
  3781. }
  3782. z.gesture.scaleStart = z.getDistanceBetweenTouches(e);
  3783. }
  3784. if (!z.gesture.slide || !z.gesture.slide.length) {
  3785. z.gesture.slide = $(this);
  3786. if (z.gesture.slide.length === 0) z.gesture.slide = s.slides.eq(s.activeIndex);
  3787. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  3788. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  3789. z.gesture.zoomMax = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  3790. if (z.gesture.imageWrap.length === 0) {
  3791. z.gesture.image = undefined;
  3792. return;
  3793. }
  3794. }
  3795. z.gesture.image.transition(0);
  3796. z.isScaling = true;
  3797. },
  3798. onGestureChange: function onGestureChange(e) {
  3799. var z = s.zoom;
  3800. if (!s.support.gestures) {
  3801. if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {
  3802. return;
  3803. }
  3804. z.gesture.scaleMove = z.getDistanceBetweenTouches(e);
  3805. }
  3806. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3807. if (s.support.gestures) {
  3808. z.scale = e.scale * z.currentScale;
  3809. } else {
  3810. z.scale = z.gesture.scaleMove / z.gesture.scaleStart * z.currentScale;
  3811. }
  3812. if (z.scale > z.gesture.zoomMax) {
  3813. z.scale = z.gesture.zoomMax - 1 + Math.pow(z.scale - z.gesture.zoomMax + 1, 0.5);
  3814. }
  3815. if (z.scale < s.params.zoomMin) {
  3816. z.scale = s.params.zoomMin + 1 - Math.pow(s.params.zoomMin - z.scale + 1, 0.5);
  3817. }
  3818. z.gesture.image.transform('translate3d(0,0,0) scale(' + z.scale + ')');
  3819. },
  3820. onGestureEnd: function onGestureEnd(e) {
  3821. var z = s.zoom;
  3822. if (!s.support.gestures) {
  3823. if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2) {
  3824. return;
  3825. }
  3826. }
  3827. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3828. z.scale = Math.max(Math.min(z.scale, z.gesture.zoomMax), s.params.zoomMin);
  3829. z.gesture.image.transition(s.params.speed).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  3830. z.currentScale = z.scale;
  3831. z.isScaling = false;
  3832. if (z.scale === 1) z.gesture.slide = undefined;
  3833. },
  3834. onTouchStart: function onTouchStart(s, e) {
  3835. var z = s.zoom;
  3836. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3837. if (z.image.isTouched) return;
  3838. if (s.device.os === 'android') e.preventDefault();
  3839. z.image.isTouched = true;
  3840. z.image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  3841. z.image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  3842. },
  3843. onTouchMove: function onTouchMove(e) {
  3844. var z = s.zoom;
  3845. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3846. s.allowClick = false;
  3847. if (!z.image.isTouched || !z.gesture.slide) return;
  3848. if (!z.image.isMoved) {
  3849. z.image.width = z.gesture.image[0].offsetWidth;
  3850. z.image.height = z.gesture.image[0].offsetHeight;
  3851. z.image.startX = s.getTranslate(z.gesture.imageWrap[0], 'x') || 0;
  3852. z.image.startY = s.getTranslate(z.gesture.imageWrap[0], 'y') || 0;
  3853. z.gesture.slideWidth = z.gesture.slide[0].offsetWidth;
  3854. z.gesture.slideHeight = z.gesture.slide[0].offsetHeight;
  3855. z.gesture.imageWrap.transition(0);
  3856. if (s.rtl) z.image.startX = -z.image.startX;
  3857. if (s.rtl) z.image.startY = -z.image.startY;
  3858. }
  3859. // Define if we need image drag
  3860. var scaledWidth = z.image.width * z.scale;
  3861. var scaledHeight = z.image.height * z.scale;
  3862. if (scaledWidth < z.gesture.slideWidth && scaledHeight < z.gesture.slideHeight) return;
  3863. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  3864. z.image.maxX = -z.image.minX;
  3865. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  3866. z.image.maxY = -z.image.minY;
  3867. z.image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  3868. z.image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  3869. if (!z.image.isMoved && !z.isScaling) {
  3870. if (s.isHorizontal() && Math.floor(z.image.minX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x < z.image.touchesStart.x || Math.floor(z.image.maxX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x > z.image.touchesStart.x) {
  3871. z.image.isTouched = false;
  3872. return;
  3873. } else if (!s.isHorizontal() && Math.floor(z.image.minY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y < z.image.touchesStart.y || Math.floor(z.image.maxY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y > z.image.touchesStart.y) {
  3874. z.image.isTouched = false;
  3875. return;
  3876. }
  3877. }
  3878. e.preventDefault();
  3879. e.stopPropagation();
  3880. z.image.isMoved = true;
  3881. z.image.currentX = z.image.touchesCurrent.x - z.image.touchesStart.x + z.image.startX;
  3882. z.image.currentY = z.image.touchesCurrent.y - z.image.touchesStart.y + z.image.startY;
  3883. if (z.image.currentX < z.image.minX) {
  3884. z.image.currentX = z.image.minX + 1 - Math.pow(z.image.minX - z.image.currentX + 1, 0.8);
  3885. }
  3886. if (z.image.currentX > z.image.maxX) {
  3887. z.image.currentX = z.image.maxX - 1 + Math.pow(z.image.currentX - z.image.maxX + 1, 0.8);
  3888. }
  3889. if (z.image.currentY < z.image.minY) {
  3890. z.image.currentY = z.image.minY + 1 - Math.pow(z.image.minY - z.image.currentY + 1, 0.8);
  3891. }
  3892. if (z.image.currentY > z.image.maxY) {
  3893. z.image.currentY = z.image.maxY - 1 + Math.pow(z.image.currentY - z.image.maxY + 1, 0.8);
  3894. }
  3895. //Velocity
  3896. if (!z.velocity.prevPositionX) z.velocity.prevPositionX = z.image.touchesCurrent.x;
  3897. if (!z.velocity.prevPositionY) z.velocity.prevPositionY = z.image.touchesCurrent.y;
  3898. if (!z.velocity.prevTime) z.velocity.prevTime = Date.now();
  3899. z.velocity.x = (z.image.touchesCurrent.x - z.velocity.prevPositionX) / (Date.now() - z.velocity.prevTime) / 2;
  3900. z.velocity.y = (z.image.touchesCurrent.y - z.velocity.prevPositionY) / (Date.now() - z.velocity.prevTime) / 2;
  3901. if (Math.abs(z.image.touchesCurrent.x - z.velocity.prevPositionX) < 2) z.velocity.x = 0;
  3902. if (Math.abs(z.image.touchesCurrent.y - z.velocity.prevPositionY) < 2) z.velocity.y = 0;
  3903. z.velocity.prevPositionX = z.image.touchesCurrent.x;
  3904. z.velocity.prevPositionY = z.image.touchesCurrent.y;
  3905. z.velocity.prevTime = Date.now();
  3906. z.gesture.imageWrap.transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  3907. },
  3908. onTouchEnd: function onTouchEnd(s, e) {
  3909. var z = s.zoom;
  3910. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3911. if (!z.image.isTouched || !z.image.isMoved) {
  3912. z.image.isTouched = false;
  3913. z.image.isMoved = false;
  3914. return;
  3915. }
  3916. z.image.isTouched = false;
  3917. z.image.isMoved = false;
  3918. var momentumDurationX = 300;
  3919. var momentumDurationY = 300;
  3920. var momentumDistanceX = z.velocity.x * momentumDurationX;
  3921. var newPositionX = z.image.currentX + momentumDistanceX;
  3922. var momentumDistanceY = z.velocity.y * momentumDurationY;
  3923. var newPositionY = z.image.currentY + momentumDistanceY;
  3924. //Fix duration
  3925. if (z.velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - z.image.currentX) / z.velocity.x);
  3926. if (z.velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - z.image.currentY) / z.velocity.y);
  3927. var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
  3928. z.image.currentX = newPositionX;
  3929. z.image.currentY = newPositionY;
  3930. // Define if we need image drag
  3931. var scaledWidth = z.image.width * z.scale;
  3932. var scaledHeight = z.image.height * z.scale;
  3933. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  3934. z.image.maxX = -z.image.minX;
  3935. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  3936. z.image.maxY = -z.image.minY;
  3937. z.image.currentX = Math.max(Math.min(z.image.currentX, z.image.maxX), z.image.minX);
  3938. z.image.currentY = Math.max(Math.min(z.image.currentY, z.image.maxY), z.image.minY);
  3939. z.gesture.imageWrap.transition(momentumDuration).transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  3940. },
  3941. onTransitionEnd: function onTransitionEnd(s) {
  3942. var z = s.zoom;
  3943. if (z.gesture.slide && s.previousIndex !== s.activeIndex) {
  3944. z.gesture.image.transform('translate3d(0,0,0) scale(1)');
  3945. z.gesture.imageWrap.transform('translate3d(0,0,0)');
  3946. z.gesture.slide = z.gesture.image = z.gesture.imageWrap = undefined;
  3947. z.scale = z.currentScale = 1;
  3948. }
  3949. },
  3950. // Toggle Zoom
  3951. toggleZoom: function toggleZoom(s, e) {
  3952. var z = s.zoom;
  3953. if (!z.gesture.slide) {
  3954. z.gesture.slide = s.clickedSlide ? $(s.clickedSlide) : s.slides.eq(s.activeIndex);
  3955. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  3956. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  3957. }
  3958. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3959. var touchX, touchY, offsetX, offsetY, diffX, diffY, translateX, translateY, imageWidth, imageHeight, scaledWidth, scaledHeight, translateMinX, translateMinY, translateMaxX, translateMaxY, slideWidth, slideHeight;
  3960. if (typeof z.image.touchesStart.x === 'undefined' && e) {
  3961. touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
  3962. touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
  3963. } else {
  3964. touchX = z.image.touchesStart.x;
  3965. touchY = z.image.touchesStart.y;
  3966. }
  3967. if (z.scale && z.scale !== 1) {
  3968. // Zoom Out
  3969. z.scale = z.currentScale = 1;
  3970. z.gesture.imageWrap.transition(300).transform('translate3d(0,0,0)');
  3971. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(1)');
  3972. z.gesture.slide = undefined;
  3973. } else {
  3974. // Zoom In
  3975. z.scale = z.currentScale = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  3976. if (e) {
  3977. slideWidth = z.gesture.slide[0].offsetWidth;
  3978. slideHeight = z.gesture.slide[0].offsetHeight;
  3979. offsetX = z.gesture.slide.offset().left;
  3980. offsetY = z.gesture.slide.offset().top;
  3981. diffX = offsetX + slideWidth / 2 - touchX;
  3982. diffY = offsetY + slideHeight / 2 - touchY;
  3983. imageWidth = z.gesture.image[0].offsetWidth;
  3984. imageHeight = z.gesture.image[0].offsetHeight;
  3985. scaledWidth = imageWidth * z.scale;
  3986. scaledHeight = imageHeight * z.scale;
  3987. translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
  3988. translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
  3989. translateMaxX = -translateMinX;
  3990. translateMaxY = -translateMinY;
  3991. translateX = diffX * z.scale;
  3992. translateY = diffY * z.scale;
  3993. if (translateX < translateMinX) {
  3994. translateX = translateMinX;
  3995. }
  3996. if (translateX > translateMaxX) {
  3997. translateX = translateMaxX;
  3998. }
  3999. if (translateY < translateMinY) {
  4000. translateY = translateMinY;
  4001. }
  4002. if (translateY > translateMaxY) {
  4003. translateY = translateMaxY;
  4004. }
  4005. } else {
  4006. translateX = 0;
  4007. translateY = 0;
  4008. }
  4009. z.gesture.imageWrap.transition(300).transform('translate3d(' + translateX + 'px, ' + translateY + 'px,0)');
  4010. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  4011. }
  4012. },
  4013. // Attach/Detach Events
  4014. attachEvents: function attachEvents(detach) {
  4015. var action = detach ? 'off' : 'on';
  4016. if (s.params.zoom) {
  4017. var target = s.slides;
  4018. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? { passive: true, capture: false } : false;
  4019. // Scale image
  4020. if (s.support.gestures) {
  4021. s.slides[action]('gesturestart', s.zoom.onGestureStart, passiveListener);
  4022. s.slides[action]('gesturechange', s.zoom.onGestureChange, passiveListener);
  4023. s.slides[action]('gestureend', s.zoom.onGestureEnd, passiveListener);
  4024. } else if (s.touchEvents.start === 'touchstart') {
  4025. s.slides[action](s.touchEvents.start, s.zoom.onGestureStart, passiveListener);
  4026. s.slides[action](s.touchEvents.move, s.zoom.onGestureChange, passiveListener);
  4027. s.slides[action](s.touchEvents.end, s.zoom.onGestureEnd, passiveListener);
  4028. }
  4029. // Move image
  4030. s[action]('touchStart', s.zoom.onTouchStart);
  4031. s.slides.each(function (index, slide) {
  4032. if ($(slide).find('.' + s.params.zoomContainerClass).length > 0) {
  4033. $(slide)[action](s.touchEvents.move, s.zoom.onTouchMove);
  4034. }
  4035. });
  4036. s[action]('touchEnd', s.zoom.onTouchEnd);
  4037. // Scale Out
  4038. s[action]('transitionEnd', s.zoom.onTransitionEnd);
  4039. if (s.params.zoomToggle) {
  4040. s.on('doubleTap', s.zoom.toggleZoom);
  4041. }
  4042. }
  4043. },
  4044. init: function init() {
  4045. s.zoom.attachEvents();
  4046. },
  4047. destroy: function destroy() {
  4048. s.zoom.attachEvents(true);
  4049. }
  4050. };
  4051. /*=========================
  4052. Plugins API. Collect all and init all plugins
  4053. ===========================*/
  4054. s._plugins = [];
  4055. for (var plugin in s.plugins) {
  4056. var p = s.plugins[plugin](s, s.params[plugin]);
  4057. if (p) s._plugins.push(p);
  4058. }
  4059. // Method to call all plugins event/method
  4060. s.callPlugins = function (eventName) {
  4061. for (var i = 0; i < s._plugins.length; i++) {
  4062. if (eventName in s._plugins[i]) {
  4063. s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4064. }
  4065. }
  4066. };
  4067. /*=========================
  4068. Events/Callbacks/Plugins Emitter
  4069. ===========================*/
  4070. function normalizeEventName(eventName) {
  4071. if (eventName.indexOf('on') !== 0) {
  4072. if (eventName[0] !== eventName[0].toUpperCase()) {
  4073. eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);
  4074. } else {
  4075. eventName = 'on' + eventName;
  4076. }
  4077. }
  4078. return eventName;
  4079. }
  4080. s.emitterEventListeners = {};
  4081. s.emit = function (eventName) {
  4082. // Trigger callbacks
  4083. if (s.params[eventName]) {
  4084. s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4085. }
  4086. var i;
  4087. // Trigger events
  4088. if (s.emitterEventListeners[eventName]) {
  4089. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4090. s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4091. }
  4092. }
  4093. // Trigger plugins
  4094. if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4095. };
  4096. s.on = function (eventName, handler) {
  4097. eventName = normalizeEventName(eventName);
  4098. if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];
  4099. s.emitterEventListeners[eventName].push(handler);
  4100. return s;
  4101. };
  4102. s.off = function (eventName, handler) {
  4103. var i;
  4104. eventName = normalizeEventName(eventName);
  4105. if (typeof handler === 'undefined') {
  4106. // Remove all handlers for such event
  4107. s.emitterEventListeners[eventName] = [];
  4108. return s;
  4109. }
  4110. if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;
  4111. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4112. if (s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);
  4113. }
  4114. return s;
  4115. };
  4116. s.once = function (eventName, handler) {
  4117. eventName = normalizeEventName(eventName);
  4118. var _handler = function _handler() {
  4119. handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
  4120. s.off(eventName, _handler);
  4121. };
  4122. s.on(eventName, _handler);
  4123. return s;
  4124. };
  4125. // Accessibility tools
  4126. s.a11y = {
  4127. makeFocusable: function makeFocusable($el) {
  4128. $el.attr('tabIndex', '0');
  4129. return $el;
  4130. },
  4131. addRole: function addRole($el, role) {
  4132. $el.attr('role', role);
  4133. return $el;
  4134. },
  4135. addLabel: function addLabel($el, label) {
  4136. $el.attr('aria-label', label);
  4137. return $el;
  4138. },
  4139. disable: function disable($el) {
  4140. $el.attr('aria-disabled', true);
  4141. return $el;
  4142. },
  4143. enable: function enable($el) {
  4144. $el.attr('aria-disabled', false);
  4145. return $el;
  4146. },
  4147. onEnterKey: function onEnterKey(event) {
  4148. if (event.keyCode !== 13) return;
  4149. if ($(event.target).is(s.params.nextButton)) {
  4150. s.onClickNext(event);
  4151. if (s.isEnd) {
  4152. s.a11y.notify(s.params.lastSlideMessage);
  4153. } else {
  4154. s.a11y.notify(s.params.nextSlideMessage);
  4155. }
  4156. } else if ($(event.target).is(s.params.prevButton)) {
  4157. s.onClickPrev(event);
  4158. if (s.isBeginning) {
  4159. s.a11y.notify(s.params.firstSlideMessage);
  4160. } else {
  4161. s.a11y.notify(s.params.prevSlideMessage);
  4162. }
  4163. }
  4164. if ($(event.target).is('.' + s.params.bulletClass)) {
  4165. $(event.target)[0].click();
  4166. }
  4167. },
  4168. liveRegion: $('<span class="' + s.params.notificationClass + '" aria-live="assertive" aria-atomic="true"></span>'),
  4169. notify: function notify(message) {
  4170. var notification = s.a11y.liveRegion;
  4171. if (notification.length === 0) return;
  4172. notification.html('');
  4173. notification.html(message);
  4174. },
  4175. init: function init() {
  4176. // Setup accessibility
  4177. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  4178. s.a11y.makeFocusable(s.nextButton);
  4179. s.a11y.addRole(s.nextButton, 'button');
  4180. s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
  4181. }
  4182. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  4183. s.a11y.makeFocusable(s.prevButton);
  4184. s.a11y.addRole(s.prevButton, 'button');
  4185. s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
  4186. }
  4187. $(s.container).append(s.a11y.liveRegion);
  4188. },
  4189. initPagination: function initPagination() {
  4190. if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {
  4191. s.bullets.each(function () {
  4192. var bullet = $(this);
  4193. s.a11y.makeFocusable(bullet);
  4194. s.a11y.addRole(bullet, 'button');
  4195. s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));
  4196. });
  4197. }
  4198. },
  4199. destroy: function destroy() {
  4200. if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();
  4201. }
  4202. };
  4203. /*=========================
  4204. Init/Destroy
  4205. ===========================*/
  4206. s.init = function () {
  4207. if (s.params.loop) s.createLoop();
  4208. s.updateContainerSize();
  4209. s.updateSlidesSize();
  4210. s.updatePagination();
  4211. if (s.params.scrollbar && s.scrollbar) {
  4212. s.scrollbar.set();
  4213. if (s.params.scrollbarDraggable) {
  4214. s.scrollbar.enableDraggable();
  4215. }
  4216. }
  4217. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  4218. if (!s.params.loop) s.updateProgress();
  4219. s.effects[s.params.effect].setTranslate();
  4220. }
  4221. if (s.params.loop) {
  4222. s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
  4223. } else {
  4224. s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
  4225. if (s.params.initialSlide === 0) {
  4226. if (s.parallax && s.params.parallax) s.parallax.setTranslate();
  4227. if (s.lazy && s.params.lazyLoading) {
  4228. s.lazy.load();
  4229. s.lazy.initialImageLoaded = true;
  4230. }
  4231. }
  4232. }
  4233. s.attachEvents();
  4234. if (s.params.observer && s.support.observer) {
  4235. s.initObservers();
  4236. }
  4237. if (s.params.preloadImages && !s.params.lazyLoading) {
  4238. s.preloadImages();
  4239. }
  4240. if (s.params.zoom && s.zoom) {
  4241. s.zoom.init();
  4242. }
  4243. if (s.params.autoplay) {
  4244. s.startAutoplay();
  4245. }
  4246. if (s.params.keyboardControl) {
  4247. if (s.enableKeyboardControl) s.enableKeyboardControl();
  4248. }
  4249. if (s.params.mousewheelControl) {
  4250. if (s.enableMousewheelControl) s.enableMousewheelControl();
  4251. }
  4252. // Deprecated hashnavReplaceState changed to replaceState for use in hashnav and history
  4253. if (s.params.hashnavReplaceState) {
  4254. s.params.replaceState = s.params.hashnavReplaceState;
  4255. }
  4256. if (s.params.history) {
  4257. if (s.history) s.history.init();
  4258. }
  4259. if (s.params.hashnav) {
  4260. if (s.hashnav) s.hashnav.init();
  4261. }
  4262. if (s.params.a11y && s.a11y) s.a11y.init();
  4263. s.emit('onInit', s);
  4264. };
  4265. // Cleanup dynamic styles
  4266. s.cleanupStyles = function () {
  4267. // Container
  4268. s.container.removeClass(s.classNames.join(' ')).removeAttr('style');
  4269. // Wrapper
  4270. s.wrapper.removeAttr('style');
  4271. // Slides
  4272. if (s.slides && s.slides.length) {
  4273. s.slides.removeClass([s.params.slideVisibleClass, s.params.slideActiveClass, s.params.slideNextClass, s.params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-column').removeAttr('data-swiper-row');
  4274. }
  4275. // Pagination/Bullets
  4276. if (s.paginationContainer && s.paginationContainer.length) {
  4277. s.paginationContainer.removeClass(s.params.paginationHiddenClass);
  4278. }
  4279. if (s.bullets && s.bullets.length) {
  4280. s.bullets.removeClass(s.params.bulletActiveClass);
  4281. }
  4282. // Buttons
  4283. if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
  4284. if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
  4285. // Scrollbar
  4286. if (s.params.scrollbar && s.scrollbar) {
  4287. if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');
  4288. if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');
  4289. }
  4290. };
  4291. // Destroy
  4292. s.destroy = function (deleteInstance, cleanupStyles) {
  4293. // Detach evebts
  4294. s.detachEvents();
  4295. // Stop autoplay
  4296. s.stopAutoplay();
  4297. // Disable draggable
  4298. if (s.params.scrollbar && s.scrollbar) {
  4299. if (s.params.scrollbarDraggable) {
  4300. s.scrollbar.disableDraggable();
  4301. }
  4302. }
  4303. // Destroy loop
  4304. if (s.params.loop) {
  4305. s.destroyLoop();
  4306. }
  4307. // Cleanup styles
  4308. if (cleanupStyles) {
  4309. s.cleanupStyles();
  4310. }
  4311. // Disconnect observer
  4312. s.disconnectObservers();
  4313. // Destroy zoom
  4314. if (s.params.zoom && s.zoom) {
  4315. s.zoom.destroy();
  4316. }
  4317. // Disable keyboard/mousewheel
  4318. if (s.params.keyboardControl) {
  4319. if (s.disableKeyboardControl) s.disableKeyboardControl();
  4320. }
  4321. if (s.params.mousewheelControl) {
  4322. if (s.disableMousewheelControl) s.disableMousewheelControl();
  4323. }
  4324. // Disable a11y
  4325. if (s.params.a11y && s.a11y) s.a11y.destroy();
  4326. // Delete history popstate
  4327. if (s.params.history && !s.params.replaceState) {
  4328. window.removeEventListener('popstate', s.history.setHistoryPopState);
  4329. }
  4330. if (s.params.hashnav && s.hashnav) {
  4331. s.hashnav.destroy();
  4332. }
  4333. // Destroy callback
  4334. s.emit('onDestroy');
  4335. // Delete instance
  4336. if (deleteInstance !== false) s = null;
  4337. };
  4338. s.init();
  4339. // Return swiper instance
  4340. return s;
  4341. };
  4342. /*==================================================
  4343. Prototype
  4344. ====================================================*/
  4345. Swiper.prototype = {
  4346. isSafari: function () {
  4347. var ua = window.navigator.userAgent.toLowerCase();
  4348. return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
  4349. }(),
  4350. isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),
  4351. isArray: function isArray(arr) {
  4352. return Object.prototype.toString.apply(arr) === '[object Array]';
  4353. },
  4354. /*==================================================
  4355. Browser
  4356. ====================================================*/
  4357. browser: {
  4358. ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
  4359. ieTouch: window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1 || window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1,
  4360. lteIE9: function () {
  4361. // create temporary DIV
  4362. var div = document.createElement('div');
  4363. // add content to tmp DIV which is wrapped into the IE HTML conditional statement
  4364. div.innerHTML = '<!--[if lte IE 9]><i></i><![endif]-->';
  4365. // return true / false value based on what will browser render
  4366. return div.getElementsByTagName('i').length === 1;
  4367. }()
  4368. },
  4369. /*==================================================
  4370. Devices
  4371. ====================================================*/
  4372. device: function () {
  4373. var ua = window.navigator.userAgent;
  4374. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  4375. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  4376. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  4377. var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
  4378. return {
  4379. ios: ipad || iphone || ipod,
  4380. android: android
  4381. };
  4382. }(),
  4383. /*==================================================
  4384. Feature Detection
  4385. ====================================================*/
  4386. support: {
  4387. touch: window.Modernizr && Modernizr.touch === true || function () {
  4388. return !!('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch);
  4389. }(),
  4390. transforms3d: window.Modernizr && Modernizr.csstransforms3d === true || function () {
  4391. var div = document.createElement('div').style;
  4392. return 'webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div;
  4393. }(),
  4394. flexbox: function () {
  4395. var div = document.createElement('div').style;
  4396. var styles = 'alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient'.split(' ');
  4397. for (var i = 0; i < styles.length; i++) {
  4398. if (styles[i] in div) return true;
  4399. }
  4400. }(),
  4401. observer: function () {
  4402. return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
  4403. }(),
  4404. passiveListener: function () {
  4405. var supportsPassive = false;
  4406. try {
  4407. var opts = Object.defineProperty({}, 'passive', {
  4408. get: function get() {
  4409. supportsPassive = true;
  4410. }
  4411. });
  4412. window.addEventListener('testPassiveListener', null, opts);
  4413. } catch (e) {}
  4414. return supportsPassive;
  4415. }(),
  4416. gestures: function () {
  4417. return 'ongesturestart' in window;
  4418. }()
  4419. },
  4420. /*==================================================
  4421. Plugins
  4422. ====================================================*/
  4423. plugins: {}
  4424. };
  4425. /*===========================
  4426. Dom7 Library
  4427. ===========================*/
  4428. var Dom7 = function () {
  4429. var Dom7 = function Dom7(arr) {
  4430. var _this = this,
  4431. i = 0;
  4432. // Create array-like object
  4433. for (i = 0; i < arr.length; i++) {
  4434. _this[i] = arr[i];
  4435. }
  4436. _this.length = arr.length;
  4437. // Return collection with methods
  4438. return this;
  4439. };
  4440. var $ = function $(selector, context) {
  4441. var arr = [],
  4442. i = 0;
  4443. if (selector && !context) {
  4444. if (selector instanceof Dom7) {
  4445. return selector;
  4446. }
  4447. }
  4448. if (selector) {
  4449. // String
  4450. if (typeof selector === 'string') {
  4451. var els,
  4452. tempParent,
  4453. html = selector.trim();
  4454. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  4455. var toCreate = 'div';
  4456. if (html.indexOf('<li') === 0) toCreate = 'ul';
  4457. if (html.indexOf('<tr') === 0) toCreate = 'tbody';
  4458. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
  4459. if (html.indexOf('<tbody') === 0) toCreate = 'table';
  4460. if (html.indexOf('<option') === 0) toCreate = 'select';
  4461. tempParent = document.createElement(toCreate);
  4462. tempParent.innerHTML = selector;
  4463. for (i = 0; i < tempParent.childNodes.length; i++) {
  4464. arr.push(tempParent.childNodes[i]);
  4465. }
  4466. } else {
  4467. if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
  4468. // Pure ID selector
  4469. els = [document.getElementById(selector.split('#')[1])];
  4470. } else {
  4471. // Other selectors
  4472. els = (context || document).querySelectorAll(selector);
  4473. }
  4474. for (i = 0; i < els.length; i++) {
  4475. if (els[i]) arr.push(els[i]);
  4476. }
  4477. }
  4478. }
  4479. // Node/element
  4480. else if (selector.nodeType || selector === window || selector === document) {
  4481. arr.push(selector);
  4482. }
  4483. //Array of elements or instance of Dom
  4484. else if (selector.length > 0 && selector[0].nodeType) {
  4485. for (i = 0; i < selector.length; i++) {
  4486. arr.push(selector[i]);
  4487. }
  4488. }
  4489. }
  4490. return new Dom7(arr);
  4491. };
  4492. Dom7.prototype = {
  4493. // Classes and attriutes
  4494. addClass: function addClass(className) {
  4495. if (typeof className === 'undefined') {
  4496. return this;
  4497. }
  4498. var classes = className.split(' ');
  4499. for (var i = 0; i < classes.length; i++) {
  4500. for (var j = 0; j < this.length; j++) {
  4501. this[j].classList.add(classes[i]);
  4502. }
  4503. }
  4504. return this;
  4505. },
  4506. removeClass: function removeClass(className) {
  4507. var classes = className.split(' ');
  4508. for (var i = 0; i < classes.length; i++) {
  4509. for (var j = 0; j < this.length; j++) {
  4510. this[j].classList.remove(classes[i]);
  4511. }
  4512. }
  4513. return this;
  4514. },
  4515. hasClass: function hasClass(className) {
  4516. if (!this[0]) return false;else return this[0].classList.contains(className);
  4517. },
  4518. toggleClass: function toggleClass(className) {
  4519. var classes = className.split(' ');
  4520. for (var i = 0; i < classes.length; i++) {
  4521. for (var j = 0; j < this.length; j++) {
  4522. this[j].classList.toggle(classes[i]);
  4523. }
  4524. }
  4525. return this;
  4526. },
  4527. attr: function attr(attrs, value) {
  4528. if (arguments.length === 1 && typeof attrs === 'string') {
  4529. // Get attr
  4530. if (this[0]) return this[0].getAttribute(attrs);else return undefined;
  4531. } else {
  4532. // Set attrs
  4533. for (var i = 0; i < this.length; i++) {
  4534. if (arguments.length === 2) {
  4535. // String
  4536. this[i].setAttribute(attrs, value);
  4537. } else {
  4538. // Object
  4539. for (var attrName in attrs) {
  4540. this[i][attrName] = attrs[attrName];
  4541. this[i].setAttribute(attrName, attrs[attrName]);
  4542. }
  4543. }
  4544. }
  4545. return this;
  4546. }
  4547. },
  4548. removeAttr: function removeAttr(attr) {
  4549. for (var i = 0; i < this.length; i++) {
  4550. this[i].removeAttribute(attr);
  4551. }
  4552. return this;
  4553. },
  4554. data: function data(key, value) {
  4555. if (typeof value === 'undefined') {
  4556. // Get value
  4557. if (this[0]) {
  4558. var dataKey = this[0].getAttribute('data-' + key);
  4559. if (dataKey) return dataKey;else if (this[0].dom7ElementDataStorage && key in this[0].dom7ElementDataStorage) return this[0].dom7ElementDataStorage[key];else return undefined;
  4560. } else return undefined;
  4561. } else {
  4562. // Set value
  4563. for (var i = 0; i < this.length; i++) {
  4564. var el = this[i];
  4565. if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
  4566. el.dom7ElementDataStorage[key] = value;
  4567. }
  4568. return this;
  4569. }
  4570. },
  4571. // Transforms
  4572. transform: function transform(_transform) {
  4573. for (var i = 0; i < this.length; i++) {
  4574. var elStyle = this[i].style;
  4575. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = _transform;
  4576. }
  4577. return this;
  4578. },
  4579. transition: function transition(duration) {
  4580. if (typeof duration !== 'string') {
  4581. duration = duration + 'ms';
  4582. }
  4583. for (var i = 0; i < this.length; i++) {
  4584. var elStyle = this[i].style;
  4585. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  4586. }
  4587. return this;
  4588. },
  4589. //Events
  4590. on: function on(eventName, targetSelector, listener, capture) {
  4591. function handleLiveEvent(e) {
  4592. var target = e.target;
  4593. if ($(target).is(targetSelector)) listener.call(target, e);else {
  4594. var parents = $(target).parents();
  4595. for (var k = 0; k < parents.length; k++) {
  4596. if ($(parents[k]).is(targetSelector)) listener.call(parents[k], e);
  4597. }
  4598. }
  4599. }
  4600. var events = eventName.split(' ');
  4601. var i, j;
  4602. for (i = 0; i < this.length; i++) {
  4603. if (typeof targetSelector === 'function' || targetSelector === false) {
  4604. // Usual events
  4605. if (typeof targetSelector === 'function') {
  4606. listener = arguments[1];
  4607. capture = arguments[2] || false;
  4608. }
  4609. for (j = 0; j < events.length; j++) {
  4610. this[i].addEventListener(events[j], listener, capture);
  4611. }
  4612. } else {
  4613. //Live events
  4614. for (j = 0; j < events.length; j++) {
  4615. if (!this[i].dom7LiveListeners) this[i].dom7LiveListeners = [];
  4616. this[i].dom7LiveListeners.push({ listener: listener, liveListener: handleLiveEvent });
  4617. this[i].addEventListener(events[j], handleLiveEvent, capture);
  4618. }
  4619. }
  4620. }
  4621. return this;
  4622. },
  4623. off: function off(eventName, targetSelector, listener, capture) {
  4624. var events = eventName.split(' ');
  4625. for (var i = 0; i < events.length; i++) {
  4626. for (var j = 0; j < this.length; j++) {
  4627. if (typeof targetSelector === 'function' || targetSelector === false) {
  4628. // Usual events
  4629. if (typeof targetSelector === 'function') {
  4630. listener = arguments[1];
  4631. capture = arguments[2] || false;
  4632. }
  4633. this[j].removeEventListener(events[i], listener, capture);
  4634. } else {
  4635. // Live event
  4636. if (this[j].dom7LiveListeners) {
  4637. for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {
  4638. if (this[j].dom7LiveListeners[k].listener === listener) {
  4639. this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);
  4640. }
  4641. }
  4642. }
  4643. }
  4644. }
  4645. }
  4646. return this;
  4647. },
  4648. once: function once(eventName, targetSelector, listener, capture) {
  4649. var dom = this;
  4650. if (typeof targetSelector === 'function') {
  4651. targetSelector = false;
  4652. listener = arguments[1];
  4653. capture = arguments[2];
  4654. }
  4655. function proxy(e) {
  4656. listener(e);
  4657. dom.off(eventName, targetSelector, proxy, capture);
  4658. }
  4659. dom.on(eventName, targetSelector, proxy, capture);
  4660. },
  4661. trigger: function trigger(eventName, eventData) {
  4662. for (var i = 0; i < this.length; i++) {
  4663. var evt;
  4664. try {
  4665. evt = new window.CustomEvent(eventName, { detail: eventData, bubbles: true, cancelable: true });
  4666. } catch (e) {
  4667. evt = document.createEvent('Event');
  4668. evt.initEvent(eventName, true, true);
  4669. evt.detail = eventData;
  4670. }
  4671. this[i].dispatchEvent(evt);
  4672. }
  4673. return this;
  4674. },
  4675. transitionEnd: function transitionEnd(callback) {
  4676. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  4677. i,
  4678. j,
  4679. dom = this;
  4680. function fireCallBack(e) {
  4681. /*jshint validthis:true */
  4682. if (e.target !== this) return;
  4683. callback.call(this, e);
  4684. for (i = 0; i < events.length; i++) {
  4685. dom.off(events[i], fireCallBack);
  4686. }
  4687. }
  4688. if (callback) {
  4689. for (i = 0; i < events.length; i++) {
  4690. dom.on(events[i], fireCallBack);
  4691. }
  4692. }
  4693. return this;
  4694. },
  4695. // Sizing/Styles
  4696. width: function width() {
  4697. if (this[0] === window) {
  4698. return window.innerWidth;
  4699. } else {
  4700. if (this.length > 0) {
  4701. return parseFloat(this.css('width'));
  4702. } else {
  4703. return null;
  4704. }
  4705. }
  4706. },
  4707. outerWidth: function outerWidth(includeMargins) {
  4708. if (this.length > 0) {
  4709. if (includeMargins) return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));else return this[0].offsetWidth;
  4710. } else return null;
  4711. },
  4712. height: function height() {
  4713. if (this[0] === window) {
  4714. return window.innerHeight;
  4715. } else {
  4716. if (this.length > 0) {
  4717. return parseFloat(this.css('height'));
  4718. } else {
  4719. return null;
  4720. }
  4721. }
  4722. },
  4723. outerHeight: function outerHeight(includeMargins) {
  4724. if (this.length > 0) {
  4725. if (includeMargins) return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));else return this[0].offsetHeight;
  4726. } else return null;
  4727. },
  4728. offset: function offset() {
  4729. if (this.length > 0) {
  4730. var el = this[0];
  4731. var box = el.getBoundingClientRect();
  4732. var body = document.body;
  4733. var clientTop = el.clientTop || body.clientTop || 0;
  4734. var clientLeft = el.clientLeft || body.clientLeft || 0;
  4735. var scrollTop = window.pageYOffset || el.scrollTop;
  4736. var scrollLeft = window.pageXOffset || el.scrollLeft;
  4737. return {
  4738. top: box.top + scrollTop - clientTop,
  4739. left: box.left + scrollLeft - clientLeft
  4740. };
  4741. } else {
  4742. return null;
  4743. }
  4744. },
  4745. css: function css(props, value) {
  4746. var i;
  4747. if (arguments.length === 1) {
  4748. if (typeof props === 'string') {
  4749. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  4750. } else {
  4751. for (i = 0; i < this.length; i++) {
  4752. for (var prop in props) {
  4753. this[i].style[prop] = props[prop];
  4754. }
  4755. }
  4756. return this;
  4757. }
  4758. }
  4759. if (arguments.length === 2 && typeof props === 'string') {
  4760. for (i = 0; i < this.length; i++) {
  4761. this[i].style[props] = value;
  4762. }
  4763. return this;
  4764. }
  4765. return this;
  4766. },
  4767. //Dom manipulation
  4768. each: function each(callback) {
  4769. for (var i = 0; i < this.length; i++) {
  4770. callback.call(this[i], i, this[i]);
  4771. }
  4772. return this;
  4773. },
  4774. html: function html(_html) {
  4775. if (typeof _html === 'undefined') {
  4776. return this[0] ? this[0].innerHTML : undefined;
  4777. } else {
  4778. for (var i = 0; i < this.length; i++) {
  4779. this[i].innerHTML = _html;
  4780. }
  4781. return this;
  4782. }
  4783. },
  4784. text: function text(_text) {
  4785. if (typeof _text === 'undefined') {
  4786. if (this[0]) {
  4787. return this[0].textContent.trim();
  4788. } else return null;
  4789. } else {
  4790. for (var i = 0; i < this.length; i++) {
  4791. this[i].textContent = _text;
  4792. }
  4793. return this;
  4794. }
  4795. },
  4796. is: function is(selector) {
  4797. if (!this[0]) return false;
  4798. var compareWith, i;
  4799. if (typeof selector === 'string') {
  4800. var el = this[0];
  4801. if (el === document) return selector === document;
  4802. if (el === window) return selector === window;
  4803. if (el.matches) return el.matches(selector);else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);else if (el.mozMatchesSelector) return el.mozMatchesSelector(selector);else if (el.msMatchesSelector) return el.msMatchesSelector(selector);else {
  4804. compareWith = $(selector);
  4805. for (i = 0; i < compareWith.length; i++) {
  4806. if (compareWith[i] === this[0]) return true;
  4807. }
  4808. return false;
  4809. }
  4810. } else if (selector === document) return this[0] === document;else if (selector === window) return this[0] === window;else {
  4811. if (selector.nodeType || selector instanceof Dom7) {
  4812. compareWith = selector.nodeType ? [selector] : selector;
  4813. for (i = 0; i < compareWith.length; i++) {
  4814. if (compareWith[i] === this[0]) return true;
  4815. }
  4816. return false;
  4817. }
  4818. return false;
  4819. }
  4820. },
  4821. index: function index() {
  4822. if (this[0]) {
  4823. var child = this[0];
  4824. var i = 0;
  4825. while ((child = child.previousSibling) !== null) {
  4826. if (child.nodeType === 1) i++;
  4827. }
  4828. return i;
  4829. } else return undefined;
  4830. },
  4831. eq: function eq(index) {
  4832. if (typeof index === 'undefined') return this;
  4833. var length = this.length;
  4834. var returnIndex;
  4835. if (index > length - 1) {
  4836. return new Dom7([]);
  4837. }
  4838. if (index < 0) {
  4839. returnIndex = length + index;
  4840. if (returnIndex < 0) return new Dom7([]);else return new Dom7([this[returnIndex]]);
  4841. }
  4842. return new Dom7([this[index]]);
  4843. },
  4844. append: function append(newChild) {
  4845. var i, j;
  4846. for (i = 0; i < this.length; i++) {
  4847. if (typeof newChild === 'string') {
  4848. var tempDiv = document.createElement('div');
  4849. tempDiv.innerHTML = newChild;
  4850. while (tempDiv.firstChild) {
  4851. this[i].appendChild(tempDiv.firstChild);
  4852. }
  4853. } else if (newChild instanceof Dom7) {
  4854. for (j = 0; j < newChild.length; j++) {
  4855. this[i].appendChild(newChild[j]);
  4856. }
  4857. } else {
  4858. this[i].appendChild(newChild);
  4859. }
  4860. }
  4861. return this;
  4862. },
  4863. prepend: function prepend(newChild) {
  4864. var i, j;
  4865. for (i = 0; i < this.length; i++) {
  4866. if (typeof newChild === 'string') {
  4867. var tempDiv = document.createElement('div');
  4868. tempDiv.innerHTML = newChild;
  4869. for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {
  4870. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  4871. }
  4872. // this[i].insertAdjacentHTML('afterbegin', newChild);
  4873. } else if (newChild instanceof Dom7) {
  4874. for (j = 0; j < newChild.length; j++) {
  4875. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  4876. }
  4877. } else {
  4878. this[i].insertBefore(newChild, this[i].childNodes[0]);
  4879. }
  4880. }
  4881. return this;
  4882. },
  4883. insertBefore: function insertBefore(selector) {
  4884. var before = $(selector);
  4885. for (var i = 0; i < this.length; i++) {
  4886. if (before.length === 1) {
  4887. before[0].parentNode.insertBefore(this[i], before[0]);
  4888. } else if (before.length > 1) {
  4889. for (var j = 0; j < before.length; j++) {
  4890. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  4891. }
  4892. }
  4893. }
  4894. },
  4895. insertAfter: function insertAfter(selector) {
  4896. var after = $(selector);
  4897. for (var i = 0; i < this.length; i++) {
  4898. if (after.length === 1) {
  4899. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  4900. } else if (after.length > 1) {
  4901. for (var j = 0; j < after.length; j++) {
  4902. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  4903. }
  4904. }
  4905. }
  4906. },
  4907. next: function next(selector) {
  4908. if (this.length > 0) {
  4909. if (selector) {
  4910. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);
  4911. } else {
  4912. if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);
  4913. }
  4914. } else return new Dom7([]);
  4915. },
  4916. nextAll: function nextAll(selector) {
  4917. var nextEls = [];
  4918. var el = this[0];
  4919. if (!el) return new Dom7([]);
  4920. while (el.nextElementSibling) {
  4921. var next = el.nextElementSibling;
  4922. if (selector) {
  4923. if ($(next).is(selector)) nextEls.push(next);
  4924. } else nextEls.push(next);
  4925. el = next;
  4926. }
  4927. return new Dom7(nextEls);
  4928. },
  4929. prev: function prev(selector) {
  4930. if (this.length > 0) {
  4931. if (selector) {
  4932. if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector)) return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);
  4933. } else {
  4934. if (this[0].previousElementSibling) return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);
  4935. }
  4936. } else return new Dom7([]);
  4937. },
  4938. prevAll: function prevAll(selector) {
  4939. var prevEls = [];
  4940. var el = this[0];
  4941. if (!el) return new Dom7([]);
  4942. while (el.previousElementSibling) {
  4943. var prev = el.previousElementSibling;
  4944. if (selector) {
  4945. if ($(prev).is(selector)) prevEls.push(prev);
  4946. } else prevEls.push(prev);
  4947. el = prev;
  4948. }
  4949. return new Dom7(prevEls);
  4950. },
  4951. parent: function parent(selector) {
  4952. var parents = [];
  4953. for (var i = 0; i < this.length; i++) {
  4954. if (selector) {
  4955. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  4956. } else {
  4957. parents.push(this[i].parentNode);
  4958. }
  4959. }
  4960. return $($.unique(parents));
  4961. },
  4962. parents: function parents(selector) {
  4963. var parents = [];
  4964. for (var i = 0; i < this.length; i++) {
  4965. var parent = this[i].parentNode;
  4966. while (parent) {
  4967. if (selector) {
  4968. if ($(parent).is(selector)) parents.push(parent);
  4969. } else {
  4970. parents.push(parent);
  4971. }
  4972. parent = parent.parentNode;
  4973. }
  4974. }
  4975. return $($.unique(parents));
  4976. },
  4977. find: function find(selector) {
  4978. var foundElements = [];
  4979. for (var i = 0; i < this.length; i++) {
  4980. var found = this[i].querySelectorAll(selector);
  4981. for (var j = 0; j < found.length; j++) {
  4982. foundElements.push(found[j]);
  4983. }
  4984. }
  4985. return new Dom7(foundElements);
  4986. },
  4987. children: function children(selector) {
  4988. var children = [];
  4989. for (var i = 0; i < this.length; i++) {
  4990. var childNodes = this[i].childNodes;
  4991. for (var j = 0; j < childNodes.length; j++) {
  4992. if (!selector) {
  4993. if (childNodes[j].nodeType === 1) children.push(childNodes[j]);
  4994. } else {
  4995. if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) children.push(childNodes[j]);
  4996. }
  4997. }
  4998. }
  4999. return new Dom7($.unique(children));
  5000. },
  5001. remove: function remove() {
  5002. for (var i = 0; i < this.length; i++) {
  5003. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  5004. }
  5005. return this;
  5006. },
  5007. add: function add() {
  5008. var dom = this;
  5009. var i, j;
  5010. for (i = 0; i < arguments.length; i++) {
  5011. var toAdd = $(arguments[i]);
  5012. for (j = 0; j < toAdd.length; j++) {
  5013. dom[dom.length] = toAdd[j];
  5014. dom.length++;
  5015. }
  5016. }
  5017. return dom;
  5018. }
  5019. };
  5020. $.fn = Dom7.prototype;
  5021. $.unique = function (arr) {
  5022. var unique = [];
  5023. for (var i = 0; i < arr.length; i++) {
  5024. if (unique.indexOf(arr[i]) === -1) unique.push(arr[i]);
  5025. }
  5026. return unique;
  5027. };
  5028. return $;
  5029. }();
  5030. /*===========================
  5031. Get Dom libraries
  5032. ===========================*/
  5033. var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];
  5034. for (var i = 0; i < swiperDomPlugins.length; i++) {
  5035. if (window[swiperDomPlugins[i]]) {
  5036. addLibraryPlugin(window[swiperDomPlugins[i]]);
  5037. }
  5038. }
  5039. // Required DOM Plugins
  5040. var domLib;
  5041. if (typeof Dom7 === 'undefined') {
  5042. domLib = window.Dom7 || window.Zepto || window.jQuery;
  5043. } else {
  5044. domLib = Dom7;
  5045. }
  5046. /*===========================
  5047. Add .swiper plugin from Dom libraries
  5048. ===========================*/
  5049. function addLibraryPlugin(lib) {
  5050. lib.fn.swiper = function (params) {
  5051. var firstInstance;
  5052. lib(this).each(function () {
  5053. var s = new Swiper(this, params);
  5054. if (!firstInstance) firstInstance = s;
  5055. });
  5056. return firstInstance;
  5057. };
  5058. }
  5059. if (domLib) {
  5060. if (!('transitionEnd' in domLib.fn)) {
  5061. domLib.fn.transitionEnd = function (callback) {
  5062. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  5063. i,
  5064. j,
  5065. dom = this;
  5066. function fireCallBack(e) {
  5067. /*jshint validthis:true */
  5068. if (e.target !== this) return;
  5069. callback.call(this, e);
  5070. for (i = 0; i < events.length; i++) {
  5071. dom.off(events[i], fireCallBack);
  5072. }
  5073. }
  5074. if (callback) {
  5075. for (i = 0; i < events.length; i++) {
  5076. dom.on(events[i], fireCallBack);
  5077. }
  5078. }
  5079. return this;
  5080. };
  5081. }
  5082. if (!('transform' in domLib.fn)) {
  5083. domLib.fn.transform = function (transform) {
  5084. for (var i = 0; i < this.length; i++) {
  5085. var elStyle = this[i].style;
  5086. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
  5087. }
  5088. return this;
  5089. };
  5090. }
  5091. if (!('transition' in domLib.fn)) {
  5092. domLib.fn.transition = function (duration) {
  5093. if (typeof duration !== 'string') {
  5094. duration = duration + 'ms';
  5095. }
  5096. for (var i = 0; i < this.length; i++) {
  5097. var elStyle = this[i].style;
  5098. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  5099. }
  5100. return this;
  5101. };
  5102. }
  5103. if (!('outerWidth' in domLib.fn)) {
  5104. domLib.fn.outerWidth = function (includeMargins) {
  5105. if (this.length > 0) {
  5106. if (includeMargins) return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));else return this[0].offsetWidth;
  5107. } else return null;
  5108. };
  5109. }
  5110. }
  5111. window.Swiper = Swiper;
  5112. })();
  5113. /*===========================
  5114. Swiper AMD Export
  5115. ===========================*/
  5116. if (true) {
  5117. module.exports = window.Swiper;
  5118. } else if (typeof define === 'function' && define.amd) {
  5119. define([], function () {
  5120. 'use strict';
  5121. return window.Swiper;
  5122. });
  5123. }
  5124. //# sourceMappingURL=maps/swiper.js.map
  5125. /***/ }),
  5126. /* 5 */
  5127. /***/ (function(module, exports, __webpack_require__) {
  5128. "use strict";
  5129. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5130. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5131. /*! tether-drop 1.4.1 */
  5132. (function (root, factory) {
  5133. if (true) {
  5134. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(34)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  5135. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  5136. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  5137. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5138. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  5139. module.exports = factory(require('tether'));
  5140. } else {
  5141. root.Drop = factory(root.Tether);
  5142. }
  5143. })(undefined, function (Tether) {
  5144. /* global Tether */
  5145. 'use strict';
  5146. var _bind = Function.prototype.bind;
  5147. var _slicedToArray = function () {
  5148. function sliceIterator(arr, i) {
  5149. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  5150. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  5151. _arr.push(_s.value);if (i && _arr.length === i) break;
  5152. }
  5153. } catch (err) {
  5154. _d = true;_e = err;
  5155. } finally {
  5156. try {
  5157. if (!_n && _i['return']) _i['return']();
  5158. } finally {
  5159. if (_d) throw _e;
  5160. }
  5161. }return _arr;
  5162. }return function (arr, i) {
  5163. if (Array.isArray(arr)) {
  5164. return arr;
  5165. } else if (Symbol.iterator in Object(arr)) {
  5166. return sliceIterator(arr, i);
  5167. } else {
  5168. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  5169. }
  5170. };
  5171. }();
  5172. var _createClass = function () {
  5173. function defineProperties(target, props) {
  5174. for (var i = 0; i < props.length; i++) {
  5175. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  5176. }
  5177. }return function (Constructor, protoProps, staticProps) {
  5178. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  5179. };
  5180. }();
  5181. var _get = function get(_x2, _x3, _x4) {
  5182. var _again = true;_function: while (_again) {
  5183. var object = _x2,
  5184. property = _x3,
  5185. receiver = _x4;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  5186. var parent = Object.getPrototypeOf(object);if (parent === null) {
  5187. return undefined;
  5188. } else {
  5189. _x2 = parent;_x3 = property;_x4 = receiver;_again = true;desc = parent = undefined;continue _function;
  5190. }
  5191. } else if ('value' in desc) {
  5192. return desc.value;
  5193. } else {
  5194. var getter = desc.get;if (getter === undefined) {
  5195. return undefined;
  5196. }return getter.call(receiver);
  5197. }
  5198. }
  5199. };
  5200. function _classCallCheck(instance, Constructor) {
  5201. if (!(instance instanceof Constructor)) {
  5202. throw new TypeError('Cannot call a class as a function');
  5203. }
  5204. }
  5205. function _inherits(subClass, superClass) {
  5206. if (typeof superClass !== 'function' && superClass !== null) {
  5207. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  5208. }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  5209. }
  5210. var _Tether$Utils = Tether.Utils;
  5211. var extend = _Tether$Utils.extend;
  5212. var addClass = _Tether$Utils.addClass;
  5213. var removeClass = _Tether$Utils.removeClass;
  5214. var hasClass = _Tether$Utils.hasClass;
  5215. var Evented = _Tether$Utils.Evented;
  5216. function sortAttach(str) {
  5217. var _str$split = str.split(' ');
  5218. var _str$split2 = _slicedToArray(_str$split, 2);
  5219. var first = _str$split2[0];
  5220. var second = _str$split2[1];
  5221. if (['left', 'right'].indexOf(first) >= 0) {
  5222. var _ref = [second, first];
  5223. first = _ref[0];
  5224. second = _ref[1];
  5225. }
  5226. return [first, second].join(' ');
  5227. }
  5228. function removeFromArray(arr, item) {
  5229. var index = undefined;
  5230. var results = [];
  5231. while ((index = arr.indexOf(item)) !== -1) {
  5232. results.push(arr.splice(index, 1));
  5233. }
  5234. return results;
  5235. }
  5236. var clickEvents = ['click'];
  5237. var transitionEndEvents = {
  5238. 'WebkitTransition': 'webkitTransitionEnd',
  5239. 'MozTransition': 'transitionend',
  5240. 'OTransition': 'otransitionend',
  5241. 'transition': 'transitionend'
  5242. };
  5243. var transitionEndEvent = '';
  5244. for (var _name in transitionEndEvents) {
  5245. if ({}.hasOwnProperty.call(transitionEndEvents, _name)) {
  5246. var tempEl = document.createElement('p');
  5247. if (typeof tempEl.style[_name] !== 'undefined') {
  5248. transitionEndEvent = transitionEndEvents[_name];
  5249. }
  5250. }
  5251. }
  5252. var MIRROR_ATTACH = {
  5253. left: 'right',
  5254. right: 'left',
  5255. top: 'bottom',
  5256. bottom: 'top',
  5257. middle: 'middle',
  5258. center: 'center'
  5259. };
  5260. var allDrops = {};
  5261. // Drop can be included in external libraries. Calling createContext gives you a fresh
  5262. // copy of drop which won't interact with other copies on the page (beyond calling the document events).
  5263. function createContext() {
  5264. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  5265. var drop = function drop() {
  5266. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  5267. args[_key] = arguments[_key];
  5268. }
  5269. return new (_bind.apply(DropInstance, [null].concat(args)))();
  5270. };
  5271. extend(drop, {
  5272. createContext: createContext,
  5273. drops: [],
  5274. defaults: {}
  5275. });
  5276. var defaultOptions = {
  5277. classPrefix: 'drop',
  5278. defaults: {
  5279. position: 'bottom left',
  5280. openOn: 'click',
  5281. beforeClose: null,
  5282. constrainToScrollParent: true,
  5283. constrainToWindow: true,
  5284. classes: '',
  5285. remove: false,
  5286. openDelay: 0,
  5287. closeDelay: 50,
  5288. // inherited from openDelay and closeDelay if not explicitly defined
  5289. focusDelay: null,
  5290. blurDelay: null,
  5291. hoverOpenDelay: null,
  5292. hoverCloseDelay: null,
  5293. tetherOptions: {}
  5294. }
  5295. };
  5296. extend(drop, defaultOptions, options);
  5297. extend(drop.defaults, defaultOptions.defaults, options.defaults);
  5298. if (typeof allDrops[drop.classPrefix] === 'undefined') {
  5299. allDrops[drop.classPrefix] = [];
  5300. }
  5301. drop.updateBodyClasses = function () {
  5302. // There is only one body, so despite the context concept, we still iterate through all
  5303. // drops which share our classPrefix.
  5304. var anyOpen = false;
  5305. var drops = allDrops[drop.classPrefix];
  5306. var len = drops.length;
  5307. for (var i = 0; i < len; ++i) {
  5308. if (drops[i].isOpened()) {
  5309. anyOpen = true;
  5310. break;
  5311. }
  5312. }
  5313. if (anyOpen) {
  5314. addClass(document.body, drop.classPrefix + '-open');
  5315. } else {
  5316. removeClass(document.body, drop.classPrefix + '-open');
  5317. }
  5318. };
  5319. var DropInstance = function (_Evented) {
  5320. _inherits(DropInstance, _Evented);
  5321. function DropInstance(opts) {
  5322. _classCallCheck(this, DropInstance);
  5323. _get(Object.getPrototypeOf(DropInstance.prototype), 'constructor', this).call(this);
  5324. this.options = extend({}, drop.defaults, opts);
  5325. this.target = this.options.target;
  5326. if (typeof this.target === 'undefined') {
  5327. throw new Error('Drop Error: You must provide a target.');
  5328. }
  5329. var dataPrefix = 'data-' + drop.classPrefix;
  5330. var contentAttr = this.target.getAttribute(dataPrefix);
  5331. if (contentAttr && this.options.content == null) {
  5332. this.options.content = contentAttr;
  5333. }
  5334. var attrsOverride = ['position', 'openOn'];
  5335. for (var i = 0; i < attrsOverride.length; ++i) {
  5336. var override = this.target.getAttribute(dataPrefix + '-' + attrsOverride[i]);
  5337. if (override && this.options[attrsOverride[i]] == null) {
  5338. this.options[attrsOverride[i]] = override;
  5339. }
  5340. }
  5341. if (this.options.classes && this.options.addTargetClasses !== false) {
  5342. addClass(this.target, this.options.classes);
  5343. }
  5344. drop.drops.push(this);
  5345. allDrops[drop.classPrefix].push(this);
  5346. this._boundEvents = [];
  5347. this.bindMethods();
  5348. this.setupElements();
  5349. this.setupEvents();
  5350. this.setupTether();
  5351. }
  5352. _createClass(DropInstance, [{
  5353. key: '_on',
  5354. value: function _on(element, event, handler) {
  5355. this._boundEvents.push({ element: element, event: event, handler: handler });
  5356. element.addEventListener(event, handler);
  5357. }
  5358. }, {
  5359. key: 'bindMethods',
  5360. value: function bindMethods() {
  5361. this.transitionEndHandler = this._transitionEndHandler.bind(this);
  5362. }
  5363. }, {
  5364. key: 'setupElements',
  5365. value: function setupElements() {
  5366. var _this = this;
  5367. this.drop = document.createElement('div');
  5368. addClass(this.drop, drop.classPrefix);
  5369. if (this.options.classes) {
  5370. addClass(this.drop, this.options.classes);
  5371. }
  5372. this.content = document.createElement('div');
  5373. addClass(this.content, drop.classPrefix + '-content');
  5374. if (typeof this.options.content === 'function') {
  5375. var generateAndSetContent = function generateAndSetContent() {
  5376. // content function might return a string or an element
  5377. var contentElementOrHTML = _this.options.content.call(_this, _this);
  5378. if (typeof contentElementOrHTML === 'string') {
  5379. _this.content.innerHTML = contentElementOrHTML;
  5380. } else if ((typeof contentElementOrHTML === 'undefined' ? 'undefined' : _typeof(contentElementOrHTML)) === 'object') {
  5381. _this.content.innerHTML = '';
  5382. _this.content.appendChild(contentElementOrHTML);
  5383. } else {
  5384. throw new Error('Drop Error: Content function should return a string or HTMLElement.');
  5385. }
  5386. };
  5387. generateAndSetContent();
  5388. this.on('open', generateAndSetContent.bind(this));
  5389. } else if (_typeof(this.options.content) === 'object') {
  5390. this.content.appendChild(this.options.content);
  5391. } else {
  5392. this.content.innerHTML = this.options.content;
  5393. }
  5394. this.drop.appendChild(this.content);
  5395. }
  5396. }, {
  5397. key: 'setupTether',
  5398. value: function setupTether() {
  5399. // Tether expects two attachment points, one in the target element, one in the
  5400. // drop. We use a single one, and use the order as well, to allow us to put
  5401. // the drop on either side of any of the four corners. This magic converts between
  5402. // the two:
  5403. var dropAttach = this.options.position.split(' ');
  5404. dropAttach[0] = MIRROR_ATTACH[dropAttach[0]];
  5405. dropAttach = dropAttach.join(' ');
  5406. var constraints = [];
  5407. if (this.options.constrainToScrollParent) {
  5408. constraints.push({
  5409. to: 'scrollParent',
  5410. pin: 'top, bottom',
  5411. attachment: 'together none'
  5412. });
  5413. } else {
  5414. // To get 'out of bounds' classes
  5415. constraints.push({
  5416. to: 'scrollParent'
  5417. });
  5418. }
  5419. if (this.options.constrainToWindow !== false) {
  5420. constraints.push({
  5421. to: 'window',
  5422. attachment: 'together'
  5423. });
  5424. } else {
  5425. // To get 'out of bounds' classes
  5426. constraints.push({
  5427. to: 'window'
  5428. });
  5429. }
  5430. var opts = {
  5431. element: this.drop,
  5432. target: this.target,
  5433. attachment: sortAttach(dropAttach),
  5434. targetAttachment: sortAttach(this.options.position),
  5435. classPrefix: drop.classPrefix,
  5436. offset: '0 0',
  5437. targetOffset: '0 0',
  5438. enabled: false,
  5439. constraints: constraints,
  5440. addTargetClasses: this.options.addTargetClasses
  5441. };
  5442. if (this.options.tetherOptions !== false) {
  5443. this.tether = new Tether(extend({}, opts, this.options.tetherOptions));
  5444. }
  5445. }
  5446. }, {
  5447. key: 'setupEvents',
  5448. value: function setupEvents() {
  5449. var _this2 = this;
  5450. if (!this.options.openOn) {
  5451. return;
  5452. }
  5453. if (this.options.openOn === 'always') {
  5454. setTimeout(this.open.bind(this));
  5455. return;
  5456. }
  5457. var events = this.options.openOn.split(' ');
  5458. if (events.indexOf('click') >= 0) {
  5459. var openHandler = function openHandler(event) {
  5460. _this2.toggle(event);
  5461. event.preventDefault();
  5462. };
  5463. var closeHandler = function closeHandler(event) {
  5464. if (!_this2.isOpened()) {
  5465. return;
  5466. }
  5467. // Clicking inside dropdown
  5468. if (event.target === _this2.drop || _this2.drop.contains(event.target)) {
  5469. return;
  5470. }
  5471. // Clicking target
  5472. if (event.target === _this2.target || _this2.target.contains(event.target)) {
  5473. return;
  5474. }
  5475. _this2.close(event);
  5476. };
  5477. for (var i = 0; i < clickEvents.length; ++i) {
  5478. var clickEvent = clickEvents[i];
  5479. this._on(this.target, clickEvent, openHandler);
  5480. this._on(document, clickEvent, closeHandler);
  5481. }
  5482. }
  5483. var inTimeout = null;
  5484. var outTimeout = null;
  5485. var inHandler = function inHandler(event) {
  5486. if (outTimeout !== null) {
  5487. clearTimeout(outTimeout);
  5488. } else {
  5489. inTimeout = setTimeout(function () {
  5490. _this2.open(event);
  5491. inTimeout = null;
  5492. }, (event.type === 'focus' ? _this2.options.focusDelay : _this2.options.hoverOpenDelay) || _this2.options.openDelay);
  5493. }
  5494. };
  5495. var outHandler = function outHandler(event) {
  5496. if (inTimeout !== null) {
  5497. clearTimeout(inTimeout);
  5498. } else {
  5499. outTimeout = setTimeout(function () {
  5500. _this2.close(event);
  5501. outTimeout = null;
  5502. }, (event.type === 'blur' ? _this2.options.blurDelay : _this2.options.hoverCloseDelay) || _this2.options.closeDelay);
  5503. }
  5504. };
  5505. if (events.indexOf('hover') >= 0) {
  5506. this._on(this.target, 'mouseover', inHandler);
  5507. this._on(this.drop, 'mouseover', inHandler);
  5508. this._on(this.target, 'mouseout', outHandler);
  5509. this._on(this.drop, 'mouseout', outHandler);
  5510. }
  5511. if (events.indexOf('focus') >= 0) {
  5512. this._on(this.target, 'focus', inHandler);
  5513. this._on(this.drop, 'focus', inHandler);
  5514. this._on(this.target, 'blur', outHandler);
  5515. this._on(this.drop, 'blur', outHandler);
  5516. }
  5517. }
  5518. }, {
  5519. key: 'isOpened',
  5520. value: function isOpened() {
  5521. if (this.drop) {
  5522. return hasClass(this.drop, drop.classPrefix + '-open');
  5523. }
  5524. }
  5525. }, {
  5526. key: 'toggle',
  5527. value: function toggle(event) {
  5528. if (this.isOpened()) {
  5529. this.close(event);
  5530. } else {
  5531. this.open(event);
  5532. }
  5533. }
  5534. }, {
  5535. key: 'open',
  5536. value: function open(event) {
  5537. var _this3 = this;
  5538. /* eslint no-unused-vars: 0 */
  5539. if (this.isOpened()) {
  5540. return;
  5541. }
  5542. if (!this.drop.parentNode) {
  5543. document.body.appendChild(this.drop);
  5544. }
  5545. if (typeof this.tether !== 'undefined') {
  5546. this.tether.enable();
  5547. }
  5548. addClass(this.drop, drop.classPrefix + '-open');
  5549. addClass(this.drop, drop.classPrefix + '-open-transitionend');
  5550. setTimeout(function () {
  5551. if (_this3.drop) {
  5552. addClass(_this3.drop, drop.classPrefix + '-after-open');
  5553. }
  5554. });
  5555. if (typeof this.tether !== 'undefined') {
  5556. this.tether.position();
  5557. }
  5558. this.trigger('open');
  5559. drop.updateBodyClasses();
  5560. }
  5561. }, {
  5562. key: '_transitionEndHandler',
  5563. value: function _transitionEndHandler(e) {
  5564. if (e.target !== e.currentTarget) {
  5565. return;
  5566. }
  5567. if (!hasClass(this.drop, drop.classPrefix + '-open')) {
  5568. removeClass(this.drop, drop.classPrefix + '-open-transitionend');
  5569. }
  5570. this.drop.removeEventListener(transitionEndEvent, this.transitionEndHandler);
  5571. }
  5572. }, {
  5573. key: 'beforeCloseHandler',
  5574. value: function beforeCloseHandler(event) {
  5575. var shouldClose = true;
  5576. if (!this.isClosing && typeof this.options.beforeClose === 'function') {
  5577. this.isClosing = true;
  5578. shouldClose = this.options.beforeClose(event, this) !== false;
  5579. }
  5580. this.isClosing = false;
  5581. return shouldClose;
  5582. }
  5583. }, {
  5584. key: 'close',
  5585. value: function close(event) {
  5586. if (!this.isOpened()) {
  5587. return;
  5588. }
  5589. if (!this.beforeCloseHandler(event)) {
  5590. return;
  5591. }
  5592. removeClass(this.drop, drop.classPrefix + '-open');
  5593. removeClass(this.drop, drop.classPrefix + '-after-open');
  5594. this.drop.addEventListener(transitionEndEvent, this.transitionEndHandler);
  5595. this.trigger('close');
  5596. if (typeof this.tether !== 'undefined') {
  5597. this.tether.disable();
  5598. }
  5599. drop.updateBodyClasses();
  5600. if (this.options.remove) {
  5601. this.remove(event);
  5602. }
  5603. }
  5604. }, {
  5605. key: 'remove',
  5606. value: function remove(event) {
  5607. this.close(event);
  5608. if (this.drop.parentNode) {
  5609. this.drop.parentNode.removeChild(this.drop);
  5610. }
  5611. }
  5612. }, {
  5613. key: 'position',
  5614. value: function position() {
  5615. if (this.isOpened() && typeof this.tether !== 'undefined') {
  5616. this.tether.position();
  5617. }
  5618. }
  5619. }, {
  5620. key: 'destroy',
  5621. value: function destroy() {
  5622. this.remove();
  5623. if (typeof this.tether !== 'undefined') {
  5624. this.tether.destroy();
  5625. }
  5626. for (var i = 0; i < this._boundEvents.length; ++i) {
  5627. var _boundEvents$i = this._boundEvents[i];
  5628. var element = _boundEvents$i.element;
  5629. var _event = _boundEvents$i.event;
  5630. var handler = _boundEvents$i.handler;
  5631. element.removeEventListener(_event, handler);
  5632. }
  5633. this._boundEvents = [];
  5634. this.tether = null;
  5635. this.drop = null;
  5636. this.content = null;
  5637. this.target = null;
  5638. removeFromArray(allDrops[drop.classPrefix], this);
  5639. removeFromArray(drop.drops, this);
  5640. }
  5641. }]);
  5642. return DropInstance;
  5643. }(Evented);
  5644. return drop;
  5645. }
  5646. var Drop = createContext();
  5647. document.addEventListener('DOMContentLoaded', function () {
  5648. Drop.updateBodyClasses();
  5649. });
  5650. return Drop;
  5651. });
  5652. /***/ }),
  5653. /* 6 */
  5654. /***/ (function(module, exports, __webpack_require__) {
  5655. "use strict";
  5656. Object.defineProperty(exports, "__esModule", {
  5657. value: true
  5658. });
  5659. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5660. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5661. var _jquery = __webpack_require__(1);
  5662. var _jquery2 = _interopRequireDefault(_jquery);
  5663. var _util = __webpack_require__(0);
  5664. var _util2 = _interopRequireDefault(_util);
  5665. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5666. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5667. /**
  5668. * --------------------------------------------------------------------------
  5669. * Bootstrap (v4.0.0-beta): collapse.js
  5670. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5671. * --------------------------------------------------------------------------
  5672. */
  5673. var Collapse = function () {
  5674. /**
  5675. * ------------------------------------------------------------------------
  5676. * Constants
  5677. * ------------------------------------------------------------------------
  5678. */
  5679. var NAME = 'collapse';
  5680. var VERSION = '4.0.0-beta';
  5681. var DATA_KEY = 'bs.collapse';
  5682. var EVENT_KEY = '.' + DATA_KEY;
  5683. var DATA_API_KEY = '.data-api';
  5684. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  5685. var TRANSITION_DURATION = 600;
  5686. var Default = {
  5687. toggle: true,
  5688. parent: ''
  5689. };
  5690. var DefaultType = {
  5691. toggle: 'boolean',
  5692. parent: '(string|element)'
  5693. };
  5694. var Event = {
  5695. SHOW: 'show' + EVENT_KEY,
  5696. SHOWN: 'shown' + EVENT_KEY,
  5697. HIDE: 'hide' + EVENT_KEY,
  5698. HIDDEN: 'hidden' + EVENT_KEY,
  5699. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  5700. };
  5701. var ClassName = {
  5702. SHOW: 'show',
  5703. COLLAPSE: 'collapse',
  5704. COLLAPSING: 'collapsing',
  5705. COLLAPSED: 'collapsed'
  5706. };
  5707. var Dimension = {
  5708. WIDTH: 'width',
  5709. HEIGHT: 'height'
  5710. };
  5711. var Selector = {
  5712. ACTIVES: '.show, .collapsing',
  5713. DATA_TOGGLE: '[data-toggle="lu-collapse"]'
  5714. /**
  5715. * ------------------------------------------------------------------------
  5716. * Class Definition
  5717. * ------------------------------------------------------------------------
  5718. */
  5719. };
  5720. var Collapse = function () {
  5721. function Collapse(element, config) {
  5722. _classCallCheck(this, Collapse);
  5723. this._isTransitioning = false;
  5724. this._element = element;
  5725. this._config = this._getConfig(config);
  5726. this._triggerArray = _jquery2.default.makeArray((0, _jquery2.default)('[data-toggle="lu-collapse"][href="#' + element.id + '"],' + ('[data-toggle="lu-collapse"][data-target="#' + element.id + '"]')));
  5727. var tabToggles = (0, _jquery2.default)(Selector.DATA_TOGGLE);
  5728. for (var i = 0; i < tabToggles.length; i++) {
  5729. var elem = tabToggles[i];
  5730. var selector = _util2.default.getSelectorFromElement(elem);
  5731. if (selector !== null && (0, _jquery2.default)(selector).filter(element).length > 0) {
  5732. this._triggerArray.push(elem);
  5733. }
  5734. }
  5735. this._parent = this._config.parent ? this._getParent() : null;
  5736. if (!this._config.parent) {
  5737. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  5738. }
  5739. if (this._config.toggle) {
  5740. this.toggle();
  5741. }
  5742. }
  5743. // getters
  5744. _createClass(Collapse, [{
  5745. key: 'toggle',
  5746. // public
  5747. value: function toggle() {
  5748. if ((0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5749. this.hide();
  5750. } else {
  5751. this.show();
  5752. }
  5753. }
  5754. }, {
  5755. key: 'show',
  5756. value: function show() {
  5757. var _this = this;
  5758. if (this._isTransitioning || (0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5759. return;
  5760. }
  5761. var actives = void 0;
  5762. var activesData = void 0;
  5763. if (this._parent) {
  5764. actives = _jquery2.default.makeArray((0, _jquery2.default)(this._parent).children().children(Selector.ACTIVES));
  5765. if (!actives.length) {
  5766. actives = null;
  5767. }
  5768. }
  5769. if (actives) {
  5770. activesData = (0, _jquery2.default)(actives).data(DATA_KEY);
  5771. if (activesData && activesData._isTransitioning) {
  5772. return;
  5773. }
  5774. }
  5775. var startEvent = _jquery2.default.Event(Event.SHOW);
  5776. (0, _jquery2.default)(this._element).trigger(startEvent);
  5777. if (startEvent.isDefaultPrevented()) {
  5778. return;
  5779. }
  5780. if (actives) {
  5781. Collapse._jQueryInterface.call((0, _jquery2.default)(actives), 'hide');
  5782. if (!activesData) {
  5783. (0, _jquery2.default)(actives).data(DATA_KEY, null);
  5784. }
  5785. }
  5786. var dimension = this._getDimension();
  5787. (0, _jquery2.default)(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
  5788. this._element.style[dimension] = 0;
  5789. if (this._triggerArray.length) {
  5790. (0, _jquery2.default)(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
  5791. }
  5792. this.setTransitioning(true);
  5793. var complete = function complete() {
  5794. (0, _jquery2.default)(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
  5795. _this._element.style[dimension] = '';
  5796. _this.setTransitioning(false);
  5797. (0, _jquery2.default)(_this._element).trigger(Event.SHOWN);
  5798. };
  5799. if (!_util2.default.supportsTransitionEnd()) {
  5800. complete();
  5801. return;
  5802. }
  5803. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  5804. var scrollSize = 'scroll' + capitalizedDimension;
  5805. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  5806. this._element.style[dimension] = this._element[scrollSize] + 'px';
  5807. }
  5808. }, {
  5809. key: 'hide',
  5810. value: function hide() {
  5811. var _this2 = this;
  5812. if (this._isTransitioning || !(0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5813. return;
  5814. }
  5815. var startEvent = _jquery2.default.Event(Event.HIDE);
  5816. (0, _jquery2.default)(this._element).trigger(startEvent);
  5817. if (startEvent.isDefaultPrevented()) {
  5818. return;
  5819. }
  5820. var dimension = this._getDimension();
  5821. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px';
  5822. _util2.default.reflow(this._element);
  5823. (0, _jquery2.default)(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
  5824. if (this._triggerArray.length) {
  5825. for (var i = 0; i < this._triggerArray.length; i++) {
  5826. var trigger = this._triggerArray[i];
  5827. var selector = _util2.default.getSelectorFromElement(trigger);
  5828. if (selector !== null) {
  5829. var $elem = (0, _jquery2.default)(selector);
  5830. if (!$elem.hasClass(ClassName.SHOW)) {
  5831. (0, _jquery2.default)(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
  5832. }
  5833. }
  5834. }
  5835. }
  5836. this.setTransitioning(true);
  5837. var complete = function complete() {
  5838. _this2.setTransitioning(false);
  5839. (0, _jquery2.default)(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
  5840. };
  5841. this._element.style[dimension] = '';
  5842. if (!_util2.default.supportsTransitionEnd()) {
  5843. complete();
  5844. return;
  5845. }
  5846. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  5847. }
  5848. }, {
  5849. key: 'setTransitioning',
  5850. value: function setTransitioning(isTransitioning) {
  5851. this._isTransitioning = isTransitioning;
  5852. }
  5853. }, {
  5854. key: 'dispose',
  5855. value: function dispose() {
  5856. _jquery2.default.removeData(this._element, DATA_KEY);
  5857. this._config = null;
  5858. this._parent = null;
  5859. this._element = null;
  5860. this._triggerArray = null;
  5861. this._isTransitioning = null;
  5862. }
  5863. // private
  5864. }, {
  5865. key: '_getConfig',
  5866. value: function _getConfig(config) {
  5867. config = _jquery2.default.extend({}, Default, config);
  5868. config.toggle = Boolean(config.toggle); // coerce string values
  5869. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  5870. return config;
  5871. }
  5872. }, {
  5873. key: '_getDimension',
  5874. value: function _getDimension() {
  5875. var hasWidth = (0, _jquery2.default)(this._element).hasClass(Dimension.WIDTH);
  5876. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  5877. }
  5878. }, {
  5879. key: '_getParent',
  5880. value: function _getParent() {
  5881. var _this3 = this;
  5882. var parent = null;
  5883. if (_util2.default.isElement(this._config.parent)) {
  5884. parent = this._config.parent;
  5885. // it's a jQuery object
  5886. if (typeof this._config.parent.jquery !== 'undefined') {
  5887. parent = this._config.parent[0];
  5888. }
  5889. } else {
  5890. parent = (0, _jquery2.default)(this._config.parent)[0];
  5891. }
  5892. var selector = '[data-toggle="lu-collapse"][data-parent="' + this._config.parent + '"]';
  5893. (0, _jquery2.default)(parent).find(selector).each(function (i, element) {
  5894. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  5895. });
  5896. return parent;
  5897. }
  5898. }, {
  5899. key: '_addAriaAndCollapsedClass',
  5900. value: function _addAriaAndCollapsedClass(element, triggerArray) {
  5901. if (element) {
  5902. var isOpen = (0, _jquery2.default)(element).hasClass(ClassName.SHOW);
  5903. if (triggerArray.length) {
  5904. (0, _jquery2.default)(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  5905. }
  5906. }
  5907. }
  5908. // static
  5909. }], [{
  5910. key: '_getTargetFromElement',
  5911. value: function _getTargetFromElement(element) {
  5912. var selector = _util2.default.getSelectorFromElement(element);
  5913. return selector ? (0, _jquery2.default)(selector)[0] : null;
  5914. }
  5915. }, {
  5916. key: '_jQueryInterface',
  5917. value: function _jQueryInterface(config) {
  5918. return this.each(function () {
  5919. var $this = (0, _jquery2.default)(this);
  5920. var data = $this.data(DATA_KEY);
  5921. var _config = _jquery2.default.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  5922. if (!data && _config.toggle && /show|hide/.test(config)) {
  5923. _config.toggle = false;
  5924. }
  5925. if (!data) {
  5926. data = new Collapse(this, _config);
  5927. $this.data(DATA_KEY, data);
  5928. }
  5929. if (typeof config === 'string') {
  5930. if (typeof data[config] === 'undefined') {
  5931. throw new Error('No method named "' + config + '"');
  5932. }
  5933. data[config]();
  5934. }
  5935. });
  5936. }
  5937. }, {
  5938. key: 'VERSION',
  5939. get: function get() {
  5940. return VERSION;
  5941. }
  5942. }, {
  5943. key: 'Default',
  5944. get: function get() {
  5945. return Default;
  5946. }
  5947. }]);
  5948. return Collapse;
  5949. }();
  5950. /**
  5951. * ------------------------------------------------------------------------
  5952. * Data Api implementation
  5953. * ------------------------------------------------------------------------
  5954. */
  5955. (0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  5956. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  5957. if (event.currentTarget.tagName === 'A') {
  5958. event.preventDefault();
  5959. }
  5960. var $trigger = (0, _jquery2.default)(this);
  5961. var selector = _util2.default.getSelectorFromElement(this);
  5962. (0, _jquery2.default)(selector).each(function () {
  5963. var $target = (0, _jquery2.default)(this);
  5964. var data = $target.data(DATA_KEY);
  5965. var config = data ? 'toggle' : $trigger.data();
  5966. Collapse._jQueryInterface.call($target, config);
  5967. });
  5968. });
  5969. /**
  5970. * ------------------------------------------------------------------------
  5971. * jQuery
  5972. * ------------------------------------------------------------------------
  5973. */
  5974. _jquery2.default.fn[NAME] = Collapse._jQueryInterface;
  5975. _jquery2.default.fn[NAME].Constructor = Collapse;
  5976. _jquery2.default.fn[NAME].noConflict = function () {
  5977. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  5978. return Collapse._jQueryInterface;
  5979. };
  5980. return Collapse;
  5981. }(_jquery2.default);
  5982. exports.default = Collapse;
  5983. /***/ }),
  5984. /* 7 */
  5985. /***/ (function(module, exports, __webpack_require__) {
  5986. "use strict";
  5987. Object.defineProperty(exports, "__esModule", {
  5988. value: true
  5989. });
  5990. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5991. var _Swiper = __webpack_require__(4);
  5992. var _Swiper2 = _interopRequireDefault(_Swiper);
  5993. var _util = __webpack_require__(0);
  5994. var _util2 = _interopRequireDefault(_util);
  5995. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5997. var SELECTORS = {
  5998. container: '[data-content-slider]'
  5999. };
  6000. var Default = {
  6001. slideToClickedSlide: false,
  6002. navStorage: 'normal'
  6003. };
  6004. var contentSlider = function () {
  6005. function contentSlider(container, options) {
  6006. _classCallCheck(this, contentSlider);
  6007. this.container = container;
  6008. this.options = options;
  6009. this.isInit = false;
  6010. this.getConfig();
  6011. this.initPLugin();
  6012. this.bindEvents();
  6013. }
  6014. _createClass(contentSlider, [{
  6015. key: 'getConfig',
  6016. value: function getConfig() {
  6017. var dataConfig = this.container.data();
  6018. if (dataConfig.options) {
  6019. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6020. } else {
  6021. this.dataOptions = {};
  6022. }
  6023. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6024. }
  6025. }, {
  6026. key: 'bindEvents',
  6027. value: function bindEvents() {}
  6028. }, {
  6029. key: 'initPLugin',
  6030. value: function initPLugin() {
  6031. var that = this;
  6032. this.swiperInstance = new _Swiper2.default(this.container, {
  6033. scrollbarHide: true,
  6034. effect: false,
  6035. resistance: true,
  6036. resistanceRatio: 0,
  6037. slidesPerView: 'auto',
  6038. watchSlidesVisibility: true,
  6039. onInit: function onInit(swiper) {
  6040. that.onInit(swiper);
  6041. },
  6042. onTap: function onTap(swiper, event) {
  6043. that.changeActiveSlide(swiper);
  6044. if (that.config.slideToClickedSlide) {
  6045. that.slideToClickedSlide(swiper, event);
  6046. }
  6047. that.onClick();
  6048. }
  6049. });
  6050. }
  6051. }, {
  6052. key: 'changeActiveSlide',
  6053. value: function changeActiveSlide(swiper) {
  6054. if (!this.isInit) {
  6055. return;
  6056. }
  6057. var slides = swiper.slides;
  6058. switch (this.config.navStorage) {
  6059. case 'normal':
  6060. break;
  6061. case 'hash':
  6062. break;
  6063. case 'localStorage':
  6064. $(slides).removeClass('is-active');
  6065. window.localStorage.setItem('content-slider-' + this.config.localStorageId, swiper.clickedIndex);
  6066. break;
  6067. }
  6068. }
  6069. }, {
  6070. key: 'slideToClickedSlide',
  6071. value: function slideToClickedSlide(swiper, event) {
  6072. var clickedIndex = swiper.clickedIndex,
  6073. slides = swiper.slides;
  6074. swiper.updateActiveIndex();
  6075. if (!$(slides[clickedIndex - 1]).hasClass('swiper-slide-visible')) {
  6076. swiper.slideTo(swiper.activeIndex - 1);
  6077. }
  6078. if (!$(slides[clickedIndex + 1]).hasClass('swiper-slide-visible')) {
  6079. swiper.slideTo(swiper.activeIndex + 1);
  6080. }
  6081. }
  6082. }, {
  6083. key: 'onInit',
  6084. value: function onInit(swiper) {
  6085. switch (this.config.navStorage) {
  6086. case 'normal':
  6087. var activeSlideIndex = 0,
  6088. slides = swiper.slides;
  6089. $(slides).each(function (index) {
  6090. if ($(this).hasClass('is-active')) {
  6091. activeSlideIndex = index;
  6092. }
  6093. });
  6094. swiper.slideTo(activeSlideIndex, 0);
  6095. break;
  6096. case 'hash':
  6097. if (window.location.hash) {
  6098. var slide = $(swiper.container).find('[href="' + window.location.hash + '"]'),
  6099. slideIndex = slide.closest('.swiper-slide').index();
  6100. slide.trigger('click');
  6101. swiper.slideTo(slideIndex, 0);
  6102. }
  6103. break;
  6104. case 'localStorage':
  6105. var index = window.localStorage.getItem('content-slider-' + this.config.localStorageId);
  6106. if (index) {
  6107. swiper.slideTo(index, 0);
  6108. } else {
  6109. swiper.slideTo(0, 0);
  6110. }
  6111. $(swiper.slides[index]).find('a').trigger('click');
  6112. break;
  6113. }
  6114. this.showSlider(swiper);
  6115. this.isInit = true;
  6116. }
  6117. }, {
  6118. key: 'showSlider',
  6119. value: function showSlider(swiper) {
  6120. swiper.container.css({
  6121. visibility: 'visible'
  6122. });
  6123. }
  6124. }, {
  6125. key: 'onClick',
  6126. value: function onClick() {}
  6127. }, {
  6128. key: 'onSlideChangeStart',
  6129. value: function onSlideChangeStart() {}
  6130. }, {
  6131. key: 'onSlideChangeEnd',
  6132. value: function onSlideChangeEnd() {}
  6133. }]);
  6134. return contentSlider;
  6135. }();
  6136. function initDataSelectors() {
  6137. $(SELECTORS.container).each(function () {
  6138. new contentSlider($(this));
  6139. });
  6140. }
  6141. function initJqueryPlugin() {
  6142. $.fn.luContentSlider = function (options) {
  6143. return this.each(function () {
  6144. new contentSlider($(this), options);
  6145. });
  6146. };
  6147. }
  6148. var init = {
  6149. initDataSelectors: initDataSelectors,
  6150. initJqueryPlugin: initJqueryPlugin
  6151. };
  6152. exports.default = init;
  6153. /***/ }),
  6154. /* 8 */
  6155. /***/ (function(module, exports, __webpack_require__) {
  6156. "use strict";
  6157. Object.defineProperty(exports, "__esModule", {
  6158. value: true
  6159. });
  6160. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6161. var _drop = __webpack_require__(5);
  6162. var _drop2 = _interopRequireDefault(_drop);
  6163. var _selectInput = __webpack_require__(3);
  6164. var _selectInput2 = _interopRequireDefault(_selectInput);
  6165. var _util = __webpack_require__(0);
  6166. var _util2 = _interopRequireDefault(_util);
  6167. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6168. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6169. var SELECTORS = {
  6170. dropdownToggle: '[data-toggle="lu-dropdown"], [data-dropdown]',
  6171. dropdownParent: '.has-dropdown',
  6172. dropdownMenu: '[data-dropdown-menu]',
  6173. dropdownArrowTarget: '[data-arrow-target]',
  6174. dropdownPlacement: '[data-placement]',
  6175. dropdownOpen: '[data-open]',
  6176. dropdownClasses: '[data-class]',
  6177. width: '[data-width]'
  6178. };
  6179. var Default = {
  6180. open: 'click',
  6181. placement: 'bottom left',
  6182. width: null,
  6183. class: ''
  6184. };
  6185. var dropdown = function () {
  6186. function dropdown(_dropdown, options) {
  6187. _classCallCheck(this, dropdown);
  6188. this.dropdown = $(_dropdown);
  6189. this.options = options;
  6190. this.dropdownParent = this.dropdown.closest(SELECTORS.dropdownParent);
  6191. this.dropdownArrowTarget = $(this.dropdownParent).find(SELECTORS.dropdownArrowTarget);
  6192. this.dropdownToggle = $(this.dropdownParent).find(SELECTORS.dropdownToggle);
  6193. this.dropdownMenu = $(this.dropdownParent).find(SELECTORS.dropdownMenu);
  6194. this.getConfig();
  6195. this.initPlugin();
  6196. this.bindEvents();
  6197. if (this.dropdown.find('[data-input-content-target]').length) {
  6198. this.initSelect();
  6199. }
  6200. }
  6201. _createClass(dropdown, [{
  6202. key: 'bindEvents',
  6203. value: function bindEvents() {
  6204. this.dropdown.on('closeDropdown', this.close.bind(this));
  6205. this.dropdown.on('openDropdown', this.open.bind(this));
  6206. }
  6207. }, {
  6208. key: 'getConfig',
  6209. value: function getConfig() {
  6210. var dataConfig = this.dropdown.data();
  6211. if (dataConfig.options) {
  6212. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6213. } else {
  6214. this.dataOptions = {};
  6215. }
  6216. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6217. this.setDropdownWidth();
  6218. if (!this.dropdownArrowTarget.length) {
  6219. this.dropdownArrowTarget = this.dropdown;
  6220. }
  6221. }
  6222. }, {
  6223. key: 'initPlugin',
  6224. value: function initPlugin() {
  6225. this.drop = new _drop2.default({
  6226. target: this.dropdown[0],
  6227. content: this.dropdownMenu[0],
  6228. position: this.config.placement,
  6229. classes: this.config.class,
  6230. openOn: this.config.open
  6231. });
  6232. if (this.config.onInit) {
  6233. this.config.onInit(this.drop);
  6234. }
  6235. this.drop.on('open', this.onOpen.bind(this));
  6236. this.drop.on('close', this.onClose.bind(this));
  6237. }
  6238. }, {
  6239. key: 'getArrowTargetPoition',
  6240. value: function getArrowTargetPoition() {
  6241. var dropdownOffset = this.dropdown.offset();
  6242. var arrowTargetOffset = this.dropdownArrowTarget.offset();
  6243. var arrowTargetWidth = this.dropdownArrowTarget.outerWidth();
  6244. if (/left/i.test(this.config.placement)) {
  6245. this.arrowTargetPosition = arrowTargetOffset.left - dropdownOffset.left + arrowTargetWidth / 2;
  6246. } else if (/right/i.test(this.config.placement)) {
  6247. this.arrowTargetPosition = this.dropdown.outerWidth() - (arrowTargetOffset.left - dropdownOffset.left) - arrowTargetWidth / 2;
  6248. }
  6249. }
  6250. }, {
  6251. key: 'setArrowPostion',
  6252. value: function setArrowPostion() {
  6253. var arrow = $(this.drop.drop).find('[data-arrow]');
  6254. if (!arrow) {
  6255. return;
  6256. }
  6257. this.getArrowTargetPoition();
  6258. var arrowBorderWidth = arrow.outerWidth() / 2;
  6259. if (/center/i.test(this.config.placement)) {
  6260. arrow.css({
  6261. left: '0',
  6262. right: '0',
  6263. margin: 'auto'
  6264. });
  6265. } else if (/left/i.test(this.config.placement)) {
  6266. arrow.css({
  6267. left: this.arrowTargetPosition - arrowBorderWidth
  6268. });
  6269. } else if (/right/i.test(this.config.placement)) {
  6270. arrow.css({
  6271. left: 'auto',
  6272. right: this.arrowTargetPosition - arrowBorderWidth
  6273. });
  6274. }
  6275. }
  6276. }, {
  6277. key: 'setDropdownWidth',
  6278. value: function setDropdownWidth() {
  6279. if (!this.config.width) {
  6280. return;
  6281. }
  6282. $(this.dropdownMenu).css({ opacity: 0, position: 'absolute', left: -10000 });
  6283. var width = parseInt(this.config.width);
  6284. var parentWidth = this.dropdownParent.outerWidth();
  6285. $(this.dropdownMenu).css({
  6286. width: width * parentWidth / 100,
  6287. 'min-width': width * parentWidth / 100
  6288. });
  6289. $(this.dropdownMenu).css({ opacity: '', position: '', left: '' });
  6290. }
  6291. }, {
  6292. key: 'onOpen',
  6293. value: function onOpen() {
  6294. this.setArrowPostion();
  6295. this.setDropdownWidth();
  6296. if (typeof this.config.onOpen === 'function') {
  6297. this.config.onOpen(this.drop);
  6298. }
  6299. }
  6300. }, {
  6301. key: 'onClose',
  6302. value: function onClose() {
  6303. if (typeof this.config.onClose === 'function') {
  6304. this.config.onClose(this.drop);
  6305. }
  6306. }
  6307. }, {
  6308. key: 'open',
  6309. value: function open() {
  6310. this.drop.open();
  6311. }
  6312. }, {
  6313. key: 'close',
  6314. value: function close() {
  6315. this.drop.close();
  6316. }
  6317. }, {
  6318. key: 'initSelect',
  6319. value: function initSelect() {
  6320. _selectInput2.default.init($(this.drop.drop), this.drop);
  6321. }
  6322. }]);
  6323. return dropdown;
  6324. }();
  6325. function initDataSelectors() {
  6326. $(SELECTORS.dropdownToggle).each(function () {
  6327. new dropdown($(this));
  6328. });
  6329. }
  6330. function initJqueryPlugin() {
  6331. $.fn.luDropdown = function (options) {
  6332. return this.each(function () {
  6333. new dropdown($(this), options);
  6334. });
  6335. };
  6336. }
  6337. function closeAllDropdowns() {
  6338. for (var i = 0; i < _drop2.default.drops.length; i++) {
  6339. _drop2.default.drops[i].close();
  6340. }
  6341. }
  6342. var init = {
  6343. initDataSelectors: initDataSelectors,
  6344. initJqueryPlugin: initJqueryPlugin,
  6345. closeAllDropdowns: closeAllDropdowns
  6346. };
  6347. exports.default = init;
  6348. /***/ }),
  6349. /* 9 */
  6350. /***/ (function(module, exports, __webpack_require__) {
  6351. "use strict";
  6352. Object.defineProperty(exports, "__esModule", {
  6353. value: true
  6354. });
  6355. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6356. var _drop = __webpack_require__(5);
  6357. var _drop2 = _interopRequireDefault(_drop);
  6358. var _util = __webpack_require__(0);
  6359. var _util2 = _interopRequireDefault(_util);
  6360. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6361. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6362. var SELECTORS = {
  6363. toggle: '[data-toggle="lu-tooltip"], [data-tooltip]'
  6364. };
  6365. var Default = {
  6366. open: 'hover',
  6367. placement: 'top center',
  6368. class: 'lu-tooltip'
  6369. };
  6370. var tooltip = function () {
  6371. function tooltip(_tooltip, options) {
  6372. _classCallCheck(this, tooltip);
  6373. this.tooltip = $(_tooltip);
  6374. this.options = options;
  6375. this.getConfig();
  6376. this.getContent();
  6377. this.initPlugin();
  6378. }
  6379. _createClass(tooltip, [{
  6380. key: 'getConfig',
  6381. value: function getConfig() {
  6382. var dataConfig = this.tooltip.data();
  6383. if (dataConfig.options) {
  6384. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6385. } else {
  6386. this.dataOptions = {};
  6387. }
  6388. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6389. }
  6390. }, {
  6391. key: 'getContent',
  6392. value: function getContent() {
  6393. if ($(this.tooltip).attr('data-title')) {
  6394. this.tooltipContent = $(this.tooltip).attr('data-title');
  6395. } else {
  6396. $(this.tooltip).attr('data-title', $(this.tooltip).attr('title'));
  6397. $(this.tooltip).removeAttr('title');
  6398. this.tooltipContent = $(this.tooltip).attr('data-title');
  6399. }
  6400. }
  6401. }, {
  6402. key: 'initPlugin',
  6403. value: function initPlugin() {
  6404. this.drop = new _drop2.default({
  6405. target: this.tooltip[0],
  6406. content: this.tooltipContent,
  6407. position: this.config.placement,
  6408. classes: this.config.class,
  6409. openOn: this.config.open
  6410. });
  6411. this.drop.on('open', this.onOpen.bind(this));
  6412. }
  6413. }, {
  6414. key: 'getArrowTargetPoition',
  6415. value: function getArrowTargetPoition() {
  6416. var tooltipwitdh = this.tooltip.outerWidth();
  6417. if (/left/i.test(this.config.placement)) {
  6418. this.arrowTargetPosition = tooltipwitdh / 2;
  6419. } else if (/right/i.test(this.config.placement)) {
  6420. this.arrowTargetPosition = tooltipwitdh / 2;
  6421. }
  6422. }
  6423. }, {
  6424. key: 'setArrowPostion',
  6425. value: function setArrowPostion() {
  6426. $(this.drop.drop).find('.tooltip__arrow').remove();
  6427. $(this.drop.drop).append('<div class="lu-tooltip__arrow" data-arrow></div>');
  6428. var arrow = $(this.drop.drop).find('[data-arrow]');
  6429. if (!arrow) {
  6430. return;
  6431. }
  6432. this.getArrowTargetPoition();
  6433. var arrowBorderWidth = arrow.outerWidth() / 2;
  6434. if (/center/i.test(this.config.placement)) {
  6435. arrow.css({
  6436. left: '0',
  6437. right: '0',
  6438. margin: 'auto'
  6439. });
  6440. } else if (/left/i.test(this.config.placement)) {
  6441. arrow.css({
  6442. left: this.arrowTargetPosition,
  6443. marginLeft: -arrowBorderWidth
  6444. });
  6445. } else if (/right/i.test(this.config.placement)) {
  6446. arrow.css({
  6447. left: 'auto',
  6448. right: this.arrowTargetPosition,
  6449. marginRight: -arrowBorderWidth
  6450. });
  6451. }
  6452. }
  6453. }, {
  6454. key: 'onOpen',
  6455. value: function onOpen() {
  6456. this.setArrowPostion();
  6457. }
  6458. }]);
  6459. return tooltip;
  6460. }();
  6461. function initDataSelectors() {
  6462. $(SELECTORS.toggle).each(function () {
  6463. new tooltip($(this));
  6464. });
  6465. }
  6466. function initJqueryPlugin() {
  6467. $.fn.luTooltip = function (options) {
  6468. return this.each(function () {
  6469. new tooltip($(this), options);
  6470. });
  6471. };
  6472. }
  6473. var init = {
  6474. initDataSelectors: initDataSelectors,
  6475. initJqueryPlugin: initJqueryPlugin
  6476. };
  6477. exports.default = init;
  6478. /***/ }),
  6479. /* 10 */
  6480. /***/ (function(module, exports, __webpack_require__) {
  6481. "use strict";
  6482. Object.defineProperty(exports, "__esModule", {
  6483. value: true
  6484. });
  6485. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6486. var _util = __webpack_require__(0);
  6487. var _util2 = _interopRequireDefault(_util);
  6488. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6489. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6490. var SELECTORS = {
  6491. container: '[data-check-container]',
  6492. checkAll: '[data-check-all]',
  6493. childs: 'input:checkbox.table-mass-action-check:enabled',
  6494. counterView: '[data-checkbox-counter]'
  6495. };
  6496. var Default = {};
  6497. var CheckAll = function () {
  6498. function CheckAll(container, options) {
  6499. _classCallCheck(this, CheckAll);
  6500. this.container = container;
  6501. this.checkAllBtn = this.container.find(SELECTORS.checkAll);
  6502. this.childs = this.container.find(SELECTORS.childs).not(SELECTORS.checkAll);
  6503. this.counterView = this.container.find(SELECTORS.counterView);
  6504. this.checkCounter = 0;
  6505. this.options = options;
  6506. this.getConfig();
  6507. this.initCounter();
  6508. this.bindEvents();
  6509. }
  6510. _createClass(CheckAll, [{
  6511. key: 'bindEvents',
  6512. value: function bindEvents() {
  6513. this.checkAllBtn.on('change', this.checkAll.bind(this));
  6514. this.childs.on('change', this.updateCounter.bind(this));
  6515. }
  6516. }, {
  6517. key: 'getConfig',
  6518. value: function getConfig() {
  6519. var dataConfig = this.container.data();
  6520. if (dataConfig.options) {
  6521. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6522. } else {
  6523. this.dataOptions = {};
  6524. }
  6525. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6526. }
  6527. }, {
  6528. key: 'checkAll',
  6529. value: function checkAll(event) {
  6530. this.childs.prop('checked', event.target.checked);
  6531. if (event.target.checked) {
  6532. this.checkCounter = this.childs.length;
  6533. } else {
  6534. this.checkCounter = 0;
  6535. }
  6536. this.updateCounterView();
  6537. }
  6538. }, {
  6539. key: 'toggleCheckAllBtn',
  6540. value: function toggleCheckAllBtn() {
  6541. if (this.childs.length == this.checkCounter) {
  6542. this.checkAllBtn.prop('checked', true);
  6543. } else {
  6544. this.checkAllBtn.prop('checked', false);
  6545. }
  6546. if (typeof this.config.onCheckAll === 'function') {
  6547. this.config.onCheckAll(this.container, this.checkCounter);
  6548. }
  6549. }
  6550. }, {
  6551. key: 'initCounter',
  6552. value: function initCounter() {
  6553. if (this.checkAllBtn.is(':checked')) {
  6554. this.checkCounter = this.childs.length;
  6555. this.childs.prop('checked', true);
  6556. } else {
  6557. this.checkCounter = this.childs.filter(':checked').length;
  6558. }
  6559. }
  6560. }, {
  6561. key: 'updateCounter',
  6562. value: function updateCounter(event) {
  6563. if (event.target.checked) {
  6564. this.checkCounter++;
  6565. this.toggleCheckAllBtn();
  6566. } else {
  6567. this.checkCounter--;
  6568. this.toggleCheckAllBtn();
  6569. }
  6570. this.updateCounterView();
  6571. }
  6572. }, {
  6573. key: 'updateCounterView',
  6574. value: function updateCounterView() {
  6575. if (typeof this.config.onCheck === 'function') {
  6576. this.config.onCheck(this.container, this.checkCounter);
  6577. }
  6578. this.counterView.text(this.checkCounter);
  6579. }
  6580. }]);
  6581. return CheckAll;
  6582. }();
  6583. function initDataSelectors() {
  6584. $(SELECTORS.container).each(function () {
  6585. new CheckAll($(this));
  6586. });
  6587. }
  6588. function initJqueryPlugin() {
  6589. $.fn.luCheckAll = function (options) {
  6590. return this.each(function () {
  6591. new CheckAll($(this), options);
  6592. });
  6593. };
  6594. }
  6595. var init = {
  6596. initDataSelectors: initDataSelectors,
  6597. initJqueryPlugin: initJqueryPlugin
  6598. };
  6599. exports.default = init;
  6600. /***/ }),
  6601. /* 11 */
  6602. /***/ (function(module, exports, __webpack_require__) {
  6603. "use strict";
  6604. var forms = [].slice.call(document.querySelectorAll('.lu-form-control'));
  6605. forms.forEach(function (item) {
  6606. var $item = $(item);
  6607. item.addEventListener('focus', function () {
  6608. $item.closest('.lu-input-group').addClass('is-focus');
  6609. });
  6610. item.addEventListener('blur', function () {
  6611. $item.closest('.lu-input-group').removeClass('is-focus');
  6612. });
  6613. });
  6614. /***/ }),
  6615. /* 12 */
  6616. /***/ (function(module, exports, __webpack_require__) {
  6617. "use strict";
  6618. Object.defineProperty(exports, "__esModule", {
  6619. value: true
  6620. });
  6621. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6622. __webpack_require__(32);
  6623. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6624. var SELECTORS = {
  6625. container: '[data-range-slider]',
  6626. input: 'input',
  6627. slider: '[data-slider]'
  6628. };
  6629. var rangeSlider = function () {
  6630. function rangeSlider(container) {
  6631. _classCallCheck(this, rangeSlider);
  6632. this.container = container;
  6633. this.input = this.container.find(SELECTORS.input);
  6634. this.slider = this.container.find(SELECTORS.slider);
  6635. this.config = this.container.data();
  6636. this.value = this.input.val();
  6637. this.bindEvents();
  6638. this.initSlider();
  6639. }
  6640. _createClass(rangeSlider, [{
  6641. key: 'bindEvents',
  6642. value: function bindEvents() {
  6643. this.input.on('change', this.updateSlider.bind(this));
  6644. }
  6645. }, {
  6646. key: 'initSlider',
  6647. value: function initSlider() {
  6648. var that = this;
  6649. this.sliderInstance = $(this.slider).slider({
  6650. range: "min",
  6651. value: this.value,
  6652. min: this.config.min,
  6653. max: this.config.max,
  6654. step: this.config.step,
  6655. slide: function slide(event, ui) {
  6656. that.updateInput(ui.value);
  6657. }
  6658. });
  6659. }
  6660. }, {
  6661. key: 'updateInput',
  6662. value: function updateInput(value) {
  6663. this.input.val(value);
  6664. }
  6665. }, {
  6666. key: 'updateSlider',
  6667. value: function updateSlider(evnet) {
  6668. this.sliderInstance.slider("value", event.target.value);
  6669. }
  6670. }], [{
  6671. key: 'init',
  6672. value: function init(container) {
  6673. if (container) {
  6674. new rangeSlider($(container).find(SELECTORS.container));
  6675. } else {
  6676. $(SELECTORS.container).each(function () {
  6677. new rangeSlider($(this));
  6678. });
  6679. }
  6680. }
  6681. }, {
  6682. key: 'reload',
  6683. value: function reload(container) {}
  6684. }]);
  6685. return rangeSlider;
  6686. }();
  6687. function initDataSelectors() {
  6688. $(SELECTORS.select).each(function () {
  6689. new Select($(this));
  6690. });
  6691. }
  6692. function initJqueryPlugin() {
  6693. $.fn.luSelect = function (options) {
  6694. return this.each(function () {
  6695. new Select($(this), options);
  6696. });
  6697. };
  6698. }
  6699. var init = {
  6700. initDataSelectors: initDataSelectors,
  6701. initJqueryPlugin: initJqueryPlugin
  6702. };
  6703. exports.default = rangeSlider;
  6704. /***/ }),
  6705. /* 13 */
  6706. /***/ (function(module, exports, __webpack_require__) {
  6707. "use strict";
  6708. Object.defineProperty(exports, "__esModule", {
  6709. value: true
  6710. });
  6711. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6712. var _Selectize = __webpack_require__(29);
  6713. var _Selectize2 = _interopRequireDefault(_Selectize);
  6714. var _util = __webpack_require__(0);
  6715. var _util2 = _interopRequireDefault(_util);
  6716. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6717. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6718. //init selects only inside of #layers in order not to break other templates
  6719. var SELECTORS = {
  6720. select: '#layers select',
  6721. rawSelect: '#layers .lu-form-control--basic'
  6722. };
  6723. var Default = {
  6724. maxItems: 1,
  6725. removeButton: false,
  6726. resotreOnBackspace: false,
  6727. dragAndDrop: false
  6728. };
  6729. var Select = function () {
  6730. function Select(element, options) {
  6731. _classCallCheck(this, Select);
  6732. this.element = element;
  6733. this.options = options;
  6734. this.getConfig();
  6735. this.directionDetector();
  6736. this.additionalPlugins();
  6737. this.initPlugin();
  6738. }
  6739. _createClass(Select, [{
  6740. key: 'initPlugin',
  6741. value: function initPlugin() {
  6742. var plugins = this.additionalPlugins();
  6743. this.element.selectize({
  6744. placeholder: '',
  6745. maxItems: this.config.maxItems,
  6746. createOnBlur: true,
  6747. plugins: plugins,
  6748. copyClassesToDropdown: false
  6749. });
  6750. }
  6751. }, {
  6752. key: 'getConfig',
  6753. value: function getConfig() {
  6754. var dataConfig = this.element.data();
  6755. if (dataConfig.options) {
  6756. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6757. } else {
  6758. this.dataOptions = {};
  6759. }
  6760. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6761. }
  6762. }, {
  6763. key: 'directionDetector',
  6764. value: function directionDetector() {
  6765. _Selectize2.default.define('directionDetector', function (options) {
  6766. var self = this;
  6767. this.positionDropdown = function () {
  6768. var original = self.positionDropdown;
  6769. return function () {
  6770. this.offset = this.settings.dropdownParent === 'body' ? this.$control.offset() : this.$control.position();
  6771. this.offset.top += this.$control.outerHeight(true);
  6772. var controlHeight = this.$control.innerHeight();
  6773. var controlPositon = $(this.$control).offset().top - $(window).scrollTop();
  6774. var dropdownOffset = controlHeight + controlPositon + this.$dropdown.outerHeight(true);
  6775. if ($(window).innerHeight() - dropdownOffset < 0) {
  6776. this.$dropdown.css({
  6777. 'top': 'auto',
  6778. 'bottom': 8 + controlHeight,
  6779. 'left': this.offset.left,
  6780. 'width': this.$control[0].getBoundingClientRect().width
  6781. });
  6782. } else {
  6783. this.$dropdown.css({
  6784. 'width': this.$control[0].getBoundingClientRect().width,
  6785. 'top': this.offset.top,
  6786. 'left': this.offset.left,
  6787. 'bottom': 'auto'
  6788. });
  6789. }
  6790. };
  6791. }();
  6792. });
  6793. }
  6794. }, {
  6795. key: 'additionalPlugins',
  6796. value: function additionalPlugins() {
  6797. var plugins = ['directionDetector'];
  6798. if (this.config.removeButton) {
  6799. plugins.push('remove_button');
  6800. }
  6801. if (this.config.resotreOnBackspace) {
  6802. plugins.push('restore_on_backspace');
  6803. }
  6804. if (this.config.drag_drop) {
  6805. plugins.push('drag_drop');
  6806. }
  6807. return plugins;
  6808. }
  6809. }]);
  6810. return Select;
  6811. }();
  6812. function initDataSelectors() {
  6813. // $(SELECTORS.select).not(SELECTORS.rawSelect).each(function () {
  6814. // new Select($(this));
  6815. // });
  6816. }
  6817. function initJqueryPlugin() {
  6818. $.fn.luSelect = function (options) {
  6819. return this.each(function () {
  6820. new Select($(this), options);
  6821. });
  6822. };
  6823. }
  6824. var init = {
  6825. initDataSelectors: initDataSelectors,
  6826. initJqueryPlugin: initJqueryPlugin
  6827. };
  6828. exports.default = init;
  6829. /***/ }),
  6830. /* 14 */
  6831. /***/ (function(module, exports, __webpack_require__) {
  6832. "use strict";
  6833. Object.defineProperty(exports, "__esModule", {
  6834. value: true
  6835. });
  6836. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6837. var _autosize = __webpack_require__(30);
  6838. var _autosize2 = _interopRequireDefault(_autosize);
  6839. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6840. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6841. var SELECTORS = {
  6842. container: '[data-editable-cell]',
  6843. input: '[data-editable-input]',
  6844. content: '[data-editable-contnet]',
  6845. init: '[data-init-edit]',
  6846. abort: '[data-abort-edit]',
  6847. accept: '[data-accept-edit]'
  6848. };
  6849. var Default = {};
  6850. var editableCell = function () {
  6851. function editableCell(container, options) {
  6852. _classCallCheck(this, editableCell);
  6853. this.container = container;
  6854. this.options = options;
  6855. this.input = this.container.find(SELECTORS.input);
  6856. this.content = this.container.find(SELECTORS.content);
  6857. this.init = this.container.find(SELECTORS.init);
  6858. this.abort = this.container.find(SELECTORS.abort);
  6859. this.accept = this.container.find(SELECTORS.accept);
  6860. this.oldInputValue = this.input.val().trim();
  6861. this.getConfig();
  6862. this.initEvents();
  6863. this.trimInputContent();
  6864. this.textareaAutosize();
  6865. this.blockNewLine();
  6866. }
  6867. _createClass(editableCell, [{
  6868. key: 'getConfig',
  6869. value: function getConfig() {
  6870. var dataConfig = this.container.data();
  6871. if (dataConfig.options) {
  6872. this.dataOptions = util.parseDataOptions(dataConfig.options);
  6873. } else {
  6874. this.dataOptions = {};
  6875. }
  6876. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6877. }
  6878. }, {
  6879. key: 'bindEvents',
  6880. value: function bindEvents() {
  6881. $(this.init).on('click', this.initEdit.bind(this));
  6882. $(this.abort).on('click', this.abortEdit.bind(this));
  6883. $(this.accept).on('click', this.acceptEdit.bind(this));
  6884. }
  6885. }, {
  6886. key: 'initEdit',
  6887. value: function initEdit(event) {
  6888. this.content.addClass('hidden');
  6889. this.init.addClass('hidden');
  6890. this.accept.removeClass('hidden');
  6891. this.abort.removeClass('hidden');
  6892. this.input.removeClass('hidden');
  6893. this.textareaAutosizeUpdate();
  6894. $(this.input).focus();
  6895. }
  6896. }, {
  6897. key: 'abortEdit',
  6898. value: function abortEdit(event) {
  6899. this.content.removeClass('hidden');
  6900. this.init.removeClass('hidden');
  6901. this.accept.addClass('hidden');
  6902. this.abort.addClass('hidden');
  6903. this.input.addClass('hidden');
  6904. this.input.val(this.oldInputValue);
  6905. }
  6906. }, {
  6907. key: 'textareaAutosize',
  6908. value: function textareaAutosize() {
  6909. (0, _autosize2.default)(this.input);
  6910. }
  6911. }, {
  6912. key: 'textareaAutosizeUpdate',
  6913. value: function textareaAutosizeUpdate() {
  6914. _autosize2.default.update(this.input);
  6915. }
  6916. }, {
  6917. key: 'trimInputContent',
  6918. value: function trimInputContent() {
  6919. $(this.input).val($(this.input).val().trim());
  6920. }
  6921. }, {
  6922. key: 'blockNewLine',
  6923. value: function blockNewLine() {
  6924. $(this.input).on('keypress', function (e) {
  6925. if ((e.keyCode || e.which) == 13) {
  6926. e.preventDefault();
  6927. }
  6928. });
  6929. }
  6930. }, {
  6931. key: 'acceptEdit',
  6932. value: function acceptEdit(event) {
  6933. this.content.text(this.input.val());
  6934. this.content.removeClass('hidden');
  6935. this.init.removeClass('hidden');
  6936. this.accept.addClass('hidden');
  6937. this.abort.addClass('hidden');
  6938. this.input.addClass('hidden');
  6939. }
  6940. }]);
  6941. return editableCell;
  6942. }();
  6943. function initDataSelectors() {
  6944. $(SELECTORS.container).each(function () {
  6945. new editableCell($(this));
  6946. });
  6947. }
  6948. function initJqueryPlugin() {
  6949. $.fn.luEditableCell = function (options) {
  6950. return this.each(function () {
  6951. new editableCell($(this), options);
  6952. });
  6953. };
  6954. }
  6955. var init = {
  6956. initDataSelectors: initDataSelectors,
  6957. initJqueryPlugin: initJqueryPlugin
  6958. };
  6959. exports.default = init;
  6960. /***/ }),
  6961. /* 15 */
  6962. /***/ (function(module, exports, __webpack_require__) {
  6963. "use strict";
  6964. Object.defineProperty(exports, "__esModule", {
  6965. value: true
  6966. });
  6967. var _toastr = __webpack_require__(35);
  6968. var _toastr2 = _interopRequireDefault(_toastr);
  6969. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6970. /**
  6971. * --------------------------------------------------------------------------
  6972. * Bootstrap (v4.0.0-beta): alert.js
  6973. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  6974. * --------------------------------------------------------------------------
  6975. */
  6976. var alert = {
  6977. init: function init() {
  6978. this.cacheDom();
  6979. this.bindEvents();
  6980. },
  6981. cacheDom: function cacheDom() {
  6982. this.$showAlert = $("[data-toggle='lu-alert']");
  6983. this.$alertFixedTop = $('.alert--fixed-top');
  6984. this.$alertFixedBottom = $('.alert--fixed-bottom');
  6985. },
  6986. bindEvents: function bindEvents() {
  6987. this.$showAlert.on('click', this.getData.bind(this));
  6988. },
  6989. //default settings
  6990. settings: function settings() {
  6991. // alert icon true by default
  6992. if (this.$alertIcon == false) {
  6993. this.$icon = '';
  6994. } else {
  6995. this.$icon = 'lu-alert--icon';
  6996. }
  6997. // default alert timeout if not defined in data attributes
  6998. if (!this.$alertTimeout) {
  6999. this.$alertTimeout = 100000;
  7000. }
  7001. if (this.$alertActions) {
  7002. this.$actions = this.$alertActions;
  7003. }
  7004. },
  7005. // create alert with data stored in array
  7006. create: function create(event) {
  7007. this.$alertPosition = event.$alertPosition;
  7008. this.$alertSize = event.$alertSize;
  7009. this.$alertStatus = event.$alertStatus;
  7010. this.$alertTitle = event.$alertTitle;
  7011. this.$alertBody = event.$alertBody;
  7012. this.$alertIcon = event.$alertIcon;
  7013. this.$alertActions = event.$alertActions;
  7014. this.$alertTimeout = event.$alertTimeout;
  7015. this.show(event);
  7016. },
  7017. // get data from data attributes
  7018. getData: function getData(event) {
  7019. var target = $(event.currentTarget);
  7020. this.$alertPosition = target.data('alert-position');
  7021. this.$alertSize = target.data('alert-size');
  7022. this.$alertStatus = target.data('alert-status');
  7023. this.$alertTitle = target.data('alert-title');
  7024. this.$alertBody = target.data('alert-body');
  7025. this.$alertIcon = target.data('alert-icon');
  7026. this.$alertActions = target.data('alert-actions');
  7027. this.$alertTimeout = target.data('alert-timeout');
  7028. this.show(event);
  7029. },
  7030. // main function that showing alerts
  7031. show: function show(event) {
  7032. this.settings();
  7033. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7034. // animation delay
  7035. this.delay = 400;
  7036. var that = this;
  7037. if (this.$alertPosition == 'top') {
  7038. var that = this;
  7039. $('body').prepend(this.getTemplate());
  7040. this.$alertFixedTop = $('.alert--fixed-top');
  7041. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7042. this.$alertFixedTop.css('margin-top', -this.$alertHeight).animate({ 'margin-top': 0 }, this.delay);
  7043. $(window).resize(function () {
  7044. if (that.$alertFixedTop.hasClass('is-active')) {
  7045. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7046. }
  7047. });
  7048. this.$hideAlert = this.$alertFixedTop.closest('.alert').find('.btn--close');
  7049. this.$hideAlert.on('click', this.hideT.bind(this));
  7050. } else {
  7051. $('body').append(this.getTemplate());
  7052. this.$alertFixedBottom = $('.alert--fixed-bottom');
  7053. this.$alertBottomHeight = this.$alertFixedBottom.outerHeight();
  7054. this.$alertFixedBottom.css('margin-bottom', -this.$alertBottomHeight).animate({ 'margin-bottom': '0' }, this.delay);
  7055. this.$hideAlert = this.$alertFixedBottom.closest('.alert').find('.btn--close');
  7056. this.$hideAlert.on('click', this.hideB.bind(this));
  7057. }
  7058. } else {
  7059. _toastr2.default.success(this.getTemplate());
  7060. }
  7061. },
  7062. hideT: function hideT(event) {
  7063. var that = this;
  7064. this.$alertHeight = this.$alertFixedTop.outerHeight();
  7065. this.$alertFixedTop.animate({ 'margin-top': -this.$alertHeight }, this.delay);
  7066. setTimeout(function () {
  7067. that.$alertFixedTop.removeClass('is-active').remove();
  7068. }, this.delay);
  7069. },
  7070. hideB: function hideB() {
  7071. var that = this;
  7072. this.$alertHeight = this.$alertFixedBottom.outerHeight();
  7073. this.$alertFixedBottom.animate({ 'margin-bottom': -this.$alertHeight }, this.delay);
  7074. setTimeout(function () {
  7075. that.$alertFixedBottom.removeClass('is-active').remove();
  7076. }, this.delay);
  7077. },
  7078. getTemplate: function getTemplate() {
  7079. _toastr2.default.options = {
  7080. "positionClass": "lu-toast--" + this.$alertPosition,
  7081. "timeOut": this.$alertTimeout
  7082. };
  7083. this.$actions = '';
  7084. if (this.$alertActions) {
  7085. this.$actions = '<div class="lu-alert__actions">' + this.$alertActions + '</div>';
  7086. }
  7087. var $titleTemplate = '';
  7088. if (this.$alertTitle) {
  7089. $titleTemplate = '<div class="lu-alert__title">' + this.$alertTitle + ' </div>';
  7090. }
  7091. // main alert template
  7092. var $primaryTemplate = '<div class="lu-alert lu-alert--' + this.$alertStatus + ' lu-alert--outline lu-alert--float lu-alert--border-left lu-has-icon">' + '<div class="lu-alert__body">' + $titleTemplate + '<p>' + this.$alertBody + '</p>' + '</div>' + this.$actions + '</div>';
  7093. // template of top and bottom alert
  7094. var $secondaryTemplate = '<div class="lu-alert lu-alert--' + this.$alertStatus + ' lu-alert--' + this.$alertSize + ' lu-alert--fixed lu-alert--fixed-' + this.$alertPosition + ' is-active">' + '<div class="lu-container">' + '<div class="lu-alert__body">' + '<b> ' + this.$alertTitle + ' </b> ' + this.$alertBody + '</div>' + this.$actions + '</div>' + '</div>';
  7095. var $tmpl = $primaryTemplate;
  7096. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7097. $tmpl = $secondaryTemplate;
  7098. }
  7099. return $tmpl;
  7100. }
  7101. };
  7102. exports.default = alert;
  7103. /***/ }),
  7104. /* 16 */
  7105. /***/ (function(module, exports, __webpack_require__) {
  7106. "use strict";
  7107. Object.defineProperty(exports, "__esModule", {
  7108. value: true
  7109. });
  7110. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7111. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7112. var _util = __webpack_require__(0);
  7113. var _util2 = _interopRequireDefault(_util);
  7114. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7115. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7116. /**
  7117. * --------------------------------------------------------------------------
  7118. * Bootstrap (v4.0.0-beta.2): modal.js
  7119. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7120. * --------------------------------------------------------------------------
  7121. */
  7122. var Modal = function () {
  7123. /**
  7124. * ------------------------------------------------------------------------
  7125. * Constants
  7126. * ------------------------------------------------------------------------
  7127. */
  7128. var NAME = 'luModal';
  7129. var VERSION = '4.0.0-beta.2';
  7130. var DATA_KEY = 'bs.modal';
  7131. var EVENT_KEY = '.' + DATA_KEY;
  7132. var DATA_API_KEY = '.data-api';
  7133. var JQUERY_NO_CONFLICT = $.fn[NAME];
  7134. var TRANSITION_DURATION = 300;
  7135. var BACKDROP_TRANSITION_DURATION = 150;
  7136. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  7137. var Default = {
  7138. backdrop: true,
  7139. keyboard: true,
  7140. focus: true,
  7141. show: true
  7142. };
  7143. var DefaultType = {
  7144. backdrop: '(boolean|string)',
  7145. keyboard: 'boolean',
  7146. focus: 'boolean',
  7147. show: 'boolean'
  7148. };
  7149. var Event = {
  7150. HIDE: 'hide' + EVENT_KEY,
  7151. HIDDEN: 'hidden' + EVENT_KEY,
  7152. SHOW: 'show' + EVENT_KEY,
  7153. SHOWN: 'shown' + EVENT_KEY,
  7154. FOCUSIN: 'focusin' + EVENT_KEY,
  7155. RESIZE: 'resize' + EVENT_KEY,
  7156. CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
  7157. KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
  7158. MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
  7159. MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
  7160. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  7161. };
  7162. var ClassName = {
  7163. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  7164. BACKDROP: 'modal-backdrop',
  7165. OPEN: 'modal-open',
  7166. FADE: 'fade',
  7167. SHOW: 'show'
  7168. };
  7169. var Selector = {
  7170. DIALOG: '.modal-dialog, .lu-modal__dialog',
  7171. DATA_TOGGLE: '[data-toggle="lu-modal"], [data-lu-modal]',
  7172. DATA_DISMISS: '[data-dismiss="lu-modal"]',
  7173. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  7174. STICKY_CONTENT: '.sticky-top',
  7175. NAVBAR_TOGGLER: '.navbar-toggler'
  7176. /**
  7177. * ------------------------------------------------------------------------
  7178. * Class Definition
  7179. * ------------------------------------------------------------------------
  7180. */
  7181. };
  7182. var Modal = function () {
  7183. function Modal(element, config) {
  7184. _classCallCheck(this, Modal);
  7185. this._config = this._getConfig(config);
  7186. this._element = element;
  7187. this._dialog = $(element).find(Selector.DIALOG)[0];
  7188. this._backdrop = null;
  7189. this._isShown = false;
  7190. this._isBodyOverflowing = false;
  7191. this._ignoreBackdropClick = false;
  7192. this._originalBodyPadding = 0;
  7193. this._scrollbarWidth = 0;
  7194. }
  7195. // getters
  7196. _createClass(Modal, [{
  7197. key: 'toggle',
  7198. // public
  7199. value: function toggle(relatedTarget) {
  7200. return this._isShown ? this.hide() : this.show(relatedTarget);
  7201. }
  7202. }, {
  7203. key: 'show',
  7204. value: function show(relatedTarget) {
  7205. var _this = this;
  7206. if (this._isTransitioning || this._isShown) {
  7207. return;
  7208. }
  7209. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  7210. this._isTransitioning = true;
  7211. }
  7212. var showEvent = $.Event(Event.SHOW, {
  7213. relatedTarget: relatedTarget
  7214. });
  7215. $(this._element).trigger(showEvent);
  7216. if (this._isShown || showEvent.isDefaultPrevented()) {
  7217. return;
  7218. }
  7219. this._isShown = true;
  7220. this._checkScrollbar();
  7221. this._setScrollbar();
  7222. this._adjustDialog();
  7223. $(document.body).addClass(ClassName.OPEN);
  7224. this._setEscapeEvent();
  7225. this._setResizeEvent();
  7226. $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
  7227. return _this.hide(event);
  7228. });
  7229. $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
  7230. $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
  7231. if ($(event.target).is(_this._element)) {
  7232. _this._ignoreBackdropClick = true;
  7233. }
  7234. });
  7235. });
  7236. this._showBackdrop(function () {
  7237. return _this._showElement(relatedTarget);
  7238. });
  7239. }
  7240. }, {
  7241. key: 'hide',
  7242. value: function hide(event) {
  7243. var _this2 = this;
  7244. if (event) {
  7245. event.preventDefault();
  7246. }
  7247. if (this._isTransitioning || !this._isShown) {
  7248. return;
  7249. }
  7250. var hideEvent = $.Event(Event.HIDE);
  7251. $(this._element).trigger(hideEvent);
  7252. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  7253. return;
  7254. }
  7255. this._isShown = false;
  7256. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7257. if (transition) {
  7258. this._isTransitioning = true;
  7259. }
  7260. this._setEscapeEvent();
  7261. this._setResizeEvent();
  7262. $(document).off(Event.FOCUSIN);
  7263. $(this._element).removeClass(ClassName.SHOW);
  7264. $(this._element).off(Event.CLICK_DISMISS);
  7265. $(this._dialog).off(Event.MOUSEDOWN_DISMISS);
  7266. if (transition) {
  7267. $(this._element).one(_util2.default.TRANSITION_END, function (event) {
  7268. return _this2._hideModal(event);
  7269. }).emulateTransitionEnd(TRANSITION_DURATION);
  7270. } else {
  7271. this._hideModal();
  7272. }
  7273. }
  7274. }, {
  7275. key: 'dispose',
  7276. value: function dispose() {
  7277. $.removeData(this._element, DATA_KEY);
  7278. $(window, document, this._element, this._backdrop).off(EVENT_KEY);
  7279. this._config = null;
  7280. this._element = null;
  7281. this._dialog = null;
  7282. this._backdrop = null;
  7283. this._isShown = null;
  7284. this._isBodyOverflowing = null;
  7285. this._ignoreBackdropClick = null;
  7286. this._scrollbarWidth = null;
  7287. }
  7288. }, {
  7289. key: 'handleUpdate',
  7290. value: function handleUpdate() {
  7291. this._adjustDialog();
  7292. }
  7293. // private
  7294. }, {
  7295. key: '_getConfig',
  7296. value: function _getConfig(config) {
  7297. config = $.extend({}, Default, config);
  7298. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  7299. return config;
  7300. }
  7301. }, {
  7302. key: '_showElement',
  7303. value: function _showElement(relatedTarget) {
  7304. var _this3 = this;
  7305. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7306. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  7307. // don't move modals dom position
  7308. document.body.appendChild(this._element);
  7309. }
  7310. this._element.style.display = 'block';
  7311. this._element.removeAttribute('aria-hidden');
  7312. this._element.scrollTop = 0;
  7313. if (transition) {
  7314. _util2.default.reflow(this._element);
  7315. }
  7316. $(this._element).addClass(ClassName.SHOW);
  7317. if (this._config.focus) {
  7318. this._enforceFocus();
  7319. }
  7320. var shownEvent = $.Event(Event.SHOWN, {
  7321. relatedTarget: relatedTarget
  7322. });
  7323. var transitionComplete = function transitionComplete() {
  7324. if (_this3._config.focus) {
  7325. _this3._element.focus();
  7326. }
  7327. _this3._isTransitioning = false;
  7328. $(_this3._element).trigger(shownEvent);
  7329. };
  7330. if (transition) {
  7331. $(this._dialog).one(_util2.default.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
  7332. } else {
  7333. transitionComplete();
  7334. }
  7335. }
  7336. }, {
  7337. key: '_enforceFocus',
  7338. value: function _enforceFocus() {
  7339. var _this4 = this;
  7340. $(document).off(Event.FOCUSIN) // guard against infinite focus loop
  7341. .on(Event.FOCUSIN, function (event) {
  7342. if (document !== event.target && _this4._element !== event.target && !$(_this4._element).has(event.target).length) {
  7343. _this4._element.focus();
  7344. }
  7345. });
  7346. }
  7347. }, {
  7348. key: '_setEscapeEvent',
  7349. value: function _setEscapeEvent() {
  7350. var _this5 = this;
  7351. if (this._isShown && this._config.keyboard) {
  7352. $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
  7353. if (event.which === ESCAPE_KEYCODE) {
  7354. event.preventDefault();
  7355. _this5.hide();
  7356. }
  7357. });
  7358. } else if (!this._isShown) {
  7359. $(this._element).off(Event.KEYDOWN_DISMISS);
  7360. }
  7361. }
  7362. }, {
  7363. key: '_setResizeEvent',
  7364. value: function _setResizeEvent() {
  7365. var _this6 = this;
  7366. if (this._isShown) {
  7367. $(window).on(Event.RESIZE, function (event) {
  7368. return _this6.handleUpdate(event);
  7369. });
  7370. } else {
  7371. $(window).off(Event.RESIZE);
  7372. }
  7373. }
  7374. }, {
  7375. key: '_hideModal',
  7376. value: function _hideModal() {
  7377. var _this7 = this;
  7378. this._element.style.display = 'none';
  7379. this._element.setAttribute('aria-hidden', true);
  7380. this._isTransitioning = false;
  7381. this._showBackdrop(function () {
  7382. $(document.body).removeClass(ClassName.OPEN);
  7383. _this7._resetAdjustments();
  7384. _this7._resetScrollbar();
  7385. $(_this7._element).trigger(Event.HIDDEN);
  7386. });
  7387. }
  7388. }, {
  7389. key: '_removeBackdrop',
  7390. value: function _removeBackdrop() {
  7391. if (this._backdrop) {
  7392. $(this._backdrop).remove();
  7393. this._backdrop = null;
  7394. }
  7395. }
  7396. }, {
  7397. key: '_showBackdrop',
  7398. value: function _showBackdrop(callback) {
  7399. var _this8 = this;
  7400. var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
  7401. if (this._isShown && this._config.backdrop) {
  7402. var doAnimate = _util2.default.supportsTransitionEnd() && animate;
  7403. this._backdrop = document.createElement('div');
  7404. this._backdrop.className = ClassName.BACKDROP;
  7405. if (animate) {
  7406. $(this._backdrop).addClass(animate);
  7407. }
  7408. $(this._backdrop).appendTo(document.body);
  7409. $(this._element).on(Event.CLICK_DISMISS, function (event) {
  7410. if (_this8._ignoreBackdropClick) {
  7411. _this8._ignoreBackdropClick = false;
  7412. return;
  7413. }
  7414. if (event.target !== event.currentTarget) {
  7415. return;
  7416. }
  7417. if (_this8._config.backdrop === 'static') {
  7418. _this8._element.focus();
  7419. } else {
  7420. _this8.hide();
  7421. }
  7422. });
  7423. if (doAnimate) {
  7424. _util2.default.reflow(this._backdrop);
  7425. }
  7426. $(this._backdrop).addClass(ClassName.SHOW);
  7427. if (!callback) {
  7428. return;
  7429. }
  7430. if (!doAnimate) {
  7431. callback();
  7432. return;
  7433. }
  7434. $(this._backdrop).one(_util2.default.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  7435. } else if (!this._isShown && this._backdrop) {
  7436. $(this._backdrop).removeClass(ClassName.SHOW);
  7437. var callbackRemove = function callbackRemove() {
  7438. _this8._removeBackdrop();
  7439. if (callback) {
  7440. callback();
  7441. }
  7442. };
  7443. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  7444. $(this._backdrop).one(_util2.default.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  7445. } else {
  7446. callbackRemove();
  7447. }
  7448. } else if (callback) {
  7449. callback();
  7450. }
  7451. }
  7452. // ----------------------------------------------------------------------
  7453. // the following methods are used to handle overflowing modals
  7454. // todo (fat): these should probably be refactored out of modal.js
  7455. // ----------------------------------------------------------------------
  7456. }, {
  7457. key: '_adjustDialog',
  7458. value: function _adjustDialog() {
  7459. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  7460. if (!this._isBodyOverflowing && isModalOverflowing) {
  7461. this._element.style.paddingLeft = this._scrollbarWidth + 'px';
  7462. }
  7463. if (this._isBodyOverflowing && !isModalOverflowing) {
  7464. this._element.style.paddingRight = this._scrollbarWidth + 'px';
  7465. }
  7466. }
  7467. }, {
  7468. key: '_resetAdjustments',
  7469. value: function _resetAdjustments() {
  7470. this._element.style.paddingLeft = '';
  7471. this._element.style.paddingRight = '';
  7472. }
  7473. }, {
  7474. key: '_checkScrollbar',
  7475. value: function _checkScrollbar() {
  7476. var rect = document.body.getBoundingClientRect();
  7477. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  7478. this._scrollbarWidth = this._getScrollbarWidth();
  7479. }
  7480. }, {
  7481. key: '_setScrollbar',
  7482. value: function _setScrollbar() {
  7483. var _this9 = this;
  7484. if (this._isBodyOverflowing) {
  7485. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  7486. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  7487. // Adjust fixed content padding
  7488. $(Selector.FIXED_CONTENT).each(function (index, element) {
  7489. var actualPadding = $(element)[0].style.paddingRight;
  7490. var calculatedPadding = $(element).css('padding-right');
  7491. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + 'px');
  7492. });
  7493. // Adjust sticky content margin
  7494. $(Selector.STICKY_CONTENT).each(function (index, element) {
  7495. var actualMargin = $(element)[0].style.marginRight;
  7496. var calculatedMargin = $(element).css('margin-right');
  7497. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + 'px');
  7498. });
  7499. // Adjust navbar-toggler margin
  7500. $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
  7501. var actualMargin = $(element)[0].style.marginRight;
  7502. var calculatedMargin = $(element).css('margin-right');
  7503. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + 'px');
  7504. });
  7505. // Adjust body padding
  7506. var actualPadding = document.body.style.paddingRight;
  7507. var calculatedPadding = $('body').css('padding-right');
  7508. $('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px');
  7509. }
  7510. }
  7511. }, {
  7512. key: '_resetScrollbar',
  7513. value: function _resetScrollbar() {
  7514. // Restore fixed content padding
  7515. $(Selector.FIXED_CONTENT).each(function (index, element) {
  7516. var padding = $(element).data('padding-right');
  7517. if (typeof padding !== 'undefined') {
  7518. $(element).css('padding-right', padding).removeData('padding-right');
  7519. }
  7520. });
  7521. // Restore sticky content and navbar-toggler margin
  7522. $(Selector.STICKY_CONTENT + ', ' + Selector.NAVBAR_TOGGLER).each(function (index, element) {
  7523. var margin = $(element).data('margin-right');
  7524. if (typeof margin !== 'undefined') {
  7525. $(element).css('margin-right', margin).removeData('margin-right');
  7526. }
  7527. });
  7528. // Restore body padding
  7529. var padding = $('body').data('padding-right');
  7530. if (typeof padding !== 'undefined') {
  7531. $('body').css('padding-right', padding).removeData('padding-right');
  7532. }
  7533. }
  7534. }, {
  7535. key: '_getScrollbarWidth',
  7536. value: function _getScrollbarWidth() {
  7537. // thx d.walsh
  7538. var scrollDiv = document.createElement('div');
  7539. scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
  7540. document.body.appendChild(scrollDiv);
  7541. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  7542. document.body.removeChild(scrollDiv);
  7543. return scrollbarWidth;
  7544. }
  7545. // static
  7546. }], [{
  7547. key: '_jQueryInterface',
  7548. value: function _jQueryInterface(config, relatedTarget) {
  7549. return this.each(function () {
  7550. var data = $(this).data(DATA_KEY);
  7551. var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  7552. if (!data) {
  7553. data = new Modal(this, _config);
  7554. $(this).data(DATA_KEY, data);
  7555. }
  7556. if (typeof config === 'string') {
  7557. if (typeof data[config] === 'undefined') {
  7558. throw new Error('No method named "' + config + '"');
  7559. }
  7560. data[config](relatedTarget);
  7561. } else if (_config.show) {
  7562. data.show(relatedTarget);
  7563. }
  7564. });
  7565. }
  7566. }, {
  7567. key: 'VERSION',
  7568. get: function get() {
  7569. return VERSION;
  7570. }
  7571. }, {
  7572. key: 'Default',
  7573. get: function get() {
  7574. return Default;
  7575. }
  7576. }]);
  7577. return Modal;
  7578. }();
  7579. /**
  7580. * ------------------------------------------------------------------------
  7581. * Data Api implementation
  7582. * ------------------------------------------------------------------------
  7583. */
  7584. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  7585. var _this10 = this;
  7586. var target = void 0;
  7587. var selector = _util2.default.getSelectorFromElement(this);
  7588. if (selector) {
  7589. target = $(selector)[0];
  7590. }
  7591. var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
  7592. if (this.tagName === 'A' || this.tagName === 'AREA') {
  7593. event.preventDefault();
  7594. }
  7595. var $target = $(target).one(Event.SHOW, function (showEvent) {
  7596. if (showEvent.isDefaultPrevented()) {
  7597. // only register focus restorer if modal will actually get shown
  7598. return;
  7599. }
  7600. $target.one(Event.HIDDEN, function () {
  7601. if ($(_this10).is(':visible')) {
  7602. _this10.focus();
  7603. }
  7604. });
  7605. });
  7606. Modal._jQueryInterface.call($(target), config, this);
  7607. });
  7608. /**
  7609. * ------------------------------------------------------------------------
  7610. * jQuery
  7611. * ------------------------------------------------------------------------
  7612. */
  7613. $.fn[NAME] = Modal._jQueryInterface;
  7614. $.fn[NAME].Constructor = Modal;
  7615. $.fn[NAME].noConflict = function () {
  7616. $.fn[NAME] = JQUERY_NO_CONFLICT;
  7617. return Modal._jQueryInterface;
  7618. };
  7619. return Modal;
  7620. }(_util2.default.jQuery);
  7621. exports.default = Modal;
  7622. /***/ }),
  7623. /* 17 */
  7624. /***/ (function(module, exports, __webpack_require__) {
  7625. "use strict";
  7626. Object.defineProperty(exports, "__esModule", {
  7627. value: true
  7628. });
  7629. var _enquire = __webpack_require__(31);
  7630. var _enquire2 = _interopRequireDefault(_enquire);
  7631. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7632. var layersNav = {
  7633. init: function init() {
  7634. this.cacheDom();
  7635. this.bindEvents();
  7636. },
  7637. cacheDom: function cacheDom() {
  7638. this.$nav = $('.lu-nav');
  7639. this.$navigationDroDownLi = this.$nav.find('.lu-nav__item.has-dropdown');
  7640. },
  7641. bindEvents: function bindEvents() {
  7642. var that = this;
  7643. this.$navigationDroDownLi.on('click', this.checkDropDownStatus.bind(this));
  7644. var isMobile = false; //initiate as false
  7645. // device detection
  7646. if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4)) || window.ontouchstart !== undefined) {
  7647. isMobile = true;
  7648. };
  7649. _enquire2.default.register("screen and (min-width: 0) and (max-width: 751px)", {
  7650. match: function match() {
  7651. $('.has-dropdown > a').on('click', function (event) {
  7652. event.preventDefault();
  7653. });
  7654. },
  7655. unmatch: function unmatch() {
  7656. $('.has-dropdown > a').on('click', function (event) {
  7657. if (isMobile == true || $(this).parents('.navbar--thin').length == 0) {
  7658. event.preventDefault(); // I need to change that
  7659. }
  7660. });
  7661. }
  7662. });
  7663. _enquire2.default.register("screen and (min-width: 752px)", {
  7664. match: function match(event) {
  7665. $('.has-dropdown > a').on('click', function (event) {
  7666. if ($(this).parents('.navigation').length == 0 && (isMobile == true || $(this).parents('.navbar--thin').length == 0)) {
  7667. event.preventDefault(); // I need to change that
  7668. }
  7669. });
  7670. },
  7671. unmatch: function unmatch() {
  7672. $('.has-dropdown > a').on('click', function (event) {
  7673. event.preventDefault();
  7674. });
  7675. }
  7676. });
  7677. $(window).on('click', function (event) {
  7678. $('.nav .has-dropdown').removeClass('is-open');
  7679. }.bind(this));
  7680. },
  7681. checkDropDownStatus: function checkDropDownStatus(event) {
  7682. var toggleBack = this.$nav.find('[data-toggle="back"]');
  7683. var toggleBackI = this.$nav.find('[data-toggle="back"] i');
  7684. if (toggleBack.is(event.target) || toggleBackI.is(event.target)) {} else {
  7685. if ($(event.currentTarget).hasClass('is-open')) {
  7686. this.hideDropDown(event);
  7687. } else {
  7688. this.showDropDown(event);
  7689. }
  7690. }
  7691. },
  7692. showDropDown: function showDropDown(event) {
  7693. event.stopPropagation(); // I need to change that
  7694. var dropDownElement = $(event.currentTarget);
  7695. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  7696. dropDownElement.closest('.lu-nav').find('.is-open').removeClass('is-open');
  7697. dropDownElement.addClass('is-open');
  7698. },
  7699. hideDropDown: function hideDropDown(event) {
  7700. var dropDownElement = $(event.currentTarget);
  7701. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  7702. dropDownElement.removeClass('is-open');
  7703. }
  7704. }; // import enquire from 'enquire';
  7705. // import superfish from 'superfish';
  7706. // const SELECTORS = {
  7707. // container: '.nav',
  7708. // item: '.has-dropdown',
  7709. // };
  7710. // const Default = {
  7711. // active: '.is-open',
  7712. // open: 'hover'
  7713. // };
  7714. // class Nav{
  7715. // constructor(container, options){
  7716. // this.container = container;
  7717. // this.items = $(container).find(SELECTORS.item);
  7718. // this.options = options;
  7719. // this.getConfig();
  7720. // this.bindEvents();
  7721. // }
  7722. // bindEvents(){
  7723. // this.items.on('click', this.checkStatus.bind(this));
  7724. // $(document).on('click', this.clickOutside.bind(this));
  7725. // }
  7726. // getConfig(){
  7727. // var dataConfig = this.container.data();
  7728. // if(dataConfig.options){
  7729. // this.dataOptions = util.parseDataOptions(dataConfig.options);
  7730. // }else{
  7731. // this.dataOptions = {};
  7732. // }
  7733. // this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7734. // }
  7735. // checkStatus(event){
  7736. // if ($(event.currentTarget).hasClass('is-open')) {
  7737. // this.hide(event);
  7738. // } else {
  7739. // this.show(event);
  7740. // }
  7741. // }
  7742. // show(event) {
  7743. // let item = $(event.currentTarget);
  7744. // event.stopPropagation();
  7745. // if(this.config.open == 'click'){
  7746. // this.hideOld();
  7747. // item.addClass('is-open');
  7748. // }else if(this.config.open == 'hover'){
  7749. // this.initSuperFish();
  7750. // console.log('test');
  7751. // }
  7752. // }
  7753. // hide(event) {
  7754. // let item = $(event.currentTarget);
  7755. // item.removeClass('is-open');
  7756. // }
  7757. // hideOld(){
  7758. // this.container.find('.is-open').removeClass('is-open');
  7759. // }
  7760. // initSuperFish(){
  7761. // $(this.container).superfish({
  7762. // hoverClass: 'is-open',
  7763. // popUpSelector: '.has-dropdown',
  7764. // delay: 600,
  7765. // animation: {}
  7766. // });
  7767. // }
  7768. // clickOutside(){
  7769. // if(!$(event.target).closest(SELECTORS.container).length) {
  7770. // if($(SELECTORS.container).is(":visible")) {
  7771. // this.hideOld();
  7772. // }
  7773. // }
  7774. // }
  7775. // }
  7776. // function initDataSelectors(){
  7777. // $(SELECTORS.container).each(function(){
  7778. // new Nav($(this));
  7779. // });
  7780. // }
  7781. // function initJqueryPlugin(){
  7782. // $.fn.luNav = function( options ) {
  7783. // return this.each(function() {
  7784. // new Nav($(this), options);
  7785. // });
  7786. // };
  7787. // }
  7788. // const init = {
  7789. // initDataSelectors,
  7790. // initJqueryPlugin,
  7791. // };
  7792. // export default init;
  7793. exports.default = layersNav;
  7794. /***/ }),
  7795. /* 18 */
  7796. /***/ (function(module, exports, __webpack_require__) {
  7797. "use strict";
  7798. Object.defineProperty(exports, "__esModule", {
  7799. value: true
  7800. });
  7801. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7802. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7803. /**
  7804. * Switcher.js
  7805. * Copyright 2016, RSstudio
  7806. *
  7807. * http://rsstudio.net
  7808. *
  7809. * All rights reserved
  7810. *
  7811. */
  7812. var SELECTORS = {
  7813. container: '[data-switcher]',
  7814. item: '[data-switcher-item]',
  7815. itemHighlight: '[data-switcher-highlight]'
  7816. };
  7817. var Default = {
  7818. activeElement: 2,
  7819. transition: 'all 500ms cubic-bezier(.250, .250, .000, 1.015)'
  7820. };
  7821. var Switcher = function () {
  7822. function Switcher(element, options) {
  7823. _classCallCheck(this, Switcher);
  7824. this.element = $(element);
  7825. this.items = element.find(SELECTORS.item);
  7826. this.itemHighlight = this.element.find(SELECTORS.itemHighlight);
  7827. this.options = options;
  7828. this.activeItemData = {};
  7829. this.isInit = false;
  7830. this.getConfig();
  7831. this.setActiveItem(this.config.activeElement);
  7832. this.bindEvents();
  7833. }
  7834. _createClass(Switcher, [{
  7835. key: 'getConfig',
  7836. value: function getConfig() {
  7837. var dataConfig = this.element.data();
  7838. if (dataConfig.options) {
  7839. this.dataOptions = util.parseDataOptions(dataConfig.options);
  7840. } else {
  7841. this.dataOptions = {};
  7842. }
  7843. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7844. }
  7845. }, {
  7846. key: 'bindEvents',
  7847. value: function bindEvents() {
  7848. var _this = this;
  7849. this.items.on('click', function (event) {
  7850. return _this.slideToItem(event.currentTarget);
  7851. });
  7852. $(window).on('resize', function (event) {
  7853. return _this.onResize(event);
  7854. });
  7855. }
  7856. }, {
  7857. key: 'setActiveItem',
  7858. value: function setActiveItem(itemIndex) {
  7859. this.slideToItem(this.items[itemIndex]);
  7860. }
  7861. }, {
  7862. key: 'getItemPosition',
  7863. value: function getItemPosition(element) {
  7864. this.activeItemData.element = $(element);
  7865. this.activeItemData.width = $(this.activeItemData.element).outerWidth();
  7866. this.activeItemData.position = $(this.activeItemData.element).position().left;
  7867. }
  7868. }, {
  7869. key: 'slideToItem',
  7870. value: function slideToItem(element) {
  7871. if (this.activeItemData.element) {
  7872. this.activeItemData.element.removeClass('is-active');
  7873. }
  7874. this.getItemPosition(element);
  7875. this.itemHighlight.css({
  7876. 'transform': 'translateX(' + this.activeItemData.position + 'px)',
  7877. 'width': this.activeItemData.width
  7878. });
  7879. if (this.isInit) {
  7880. this.itemHighlight.css({
  7881. transition: this.config.transition
  7882. });
  7883. } else {
  7884. this.onInit();
  7885. this.isInit = true;
  7886. }
  7887. this.onSlide();
  7888. }
  7889. }, {
  7890. key: 'onInit',
  7891. value: function onInit() {
  7892. if (typeof this.config.onInit === 'function') {
  7893. this.config.onInit(this.element, this.activeItemData.element);
  7894. }
  7895. }
  7896. }, {
  7897. key: 'onSlide',
  7898. value: function onSlide() {
  7899. if (typeof this.config.onSlide === 'function') {
  7900. this.config.onSlide(this.element, this.activeItemData.element);
  7901. }
  7902. this.activeItemData.element.addClass('is-active');
  7903. }
  7904. }, {
  7905. key: 'onResize',
  7906. value: function onResize() {
  7907. if (typeof this.config.onSlide === 'function') {
  7908. this.config.onResize(this.element, this.activeItemData.element);
  7909. }
  7910. this.activeItemData.element.trigger('click');
  7911. }
  7912. }]);
  7913. return Switcher;
  7914. }();
  7915. function initDataSelectors() {
  7916. $(document).ready(function () {
  7917. $(SELECTORS.container).each(function () {
  7918. new Switcher($(this));
  7919. });
  7920. });
  7921. }
  7922. function initJqueryPlugin() {
  7923. $.fn.luSwitcher = function (options) {
  7924. return this.each(function () {
  7925. var switcher = new Switcher($(this), options);
  7926. });
  7927. };
  7928. }
  7929. var init = {
  7930. initDataSelectors: initDataSelectors,
  7931. initJqueryPlugin: initJqueryPlugin
  7932. };
  7933. exports.default = init;
  7934. /***/ }),
  7935. /* 19 */
  7936. /***/ (function(module, exports, __webpack_require__) {
  7937. "use strict";
  7938. Object.defineProperty(exports, "__esModule", {
  7939. value: true
  7940. });
  7941. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7942. var _util = __webpack_require__(0);
  7943. var _util2 = _interopRequireDefault(_util);
  7944. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7945. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7946. /**
  7947. * --------------------------------------------------------------------------
  7948. * Bootstrap (v4.0.0-beta.2): tab.js
  7949. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7950. * --------------------------------------------------------------------------
  7951. */
  7952. var Tab = function () {
  7953. /**
  7954. * ------------------------------------------------------------------------
  7955. * Constants
  7956. * ------------------------------------------------------------------------
  7957. */
  7958. var NAME = 'lu-tab';
  7959. var VERSION = '4.0.0-beta.2';
  7960. var DATA_KEY = 'bs.tab';
  7961. var EVENT_KEY = '.' + DATA_KEY;
  7962. var DATA_API_KEY = '.data-api';
  7963. var JQUERY_NO_CONFLICT = $.fn[NAME];
  7964. var TRANSITION_DURATION = 150;
  7965. var Event = {
  7966. HIDE: 'hide' + EVENT_KEY,
  7967. HIDDEN: 'hidden' + EVENT_KEY,
  7968. SHOW: 'show' + EVENT_KEY,
  7969. SHOWN: 'shown' + EVENT_KEY,
  7970. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  7971. };
  7972. var ClassName = {
  7973. DROPDOWN_MENU: 'dropdown-menu',
  7974. ACTIVE: 'is-active',
  7975. DISABLED: 'disabled',
  7976. FADE: 'fade',
  7977. SHOW: 'show'
  7978. };
  7979. var Selector = {
  7980. DROPDOWN: '.dropdown',
  7981. NAV_LIST_GROUP: '.lu-nav, .lu-list-group',
  7982. ACTIVE: '.is-active',
  7983. ACTIVE_UL: '> .is-active',
  7984. DATA_TOGGLE: '[data-toggle="lu-tab"], [data-toggle="pill"], [data-toggle="list"]',
  7985. DROPDOWN_TOGGLE: '.dropdown-toggle',
  7986. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .is-active'
  7987. /**
  7988. * ------------------------------------------------------------------------
  7989. * Class Definition
  7990. * ------------------------------------------------------------------------
  7991. */
  7992. };
  7993. var Tab = function () {
  7994. function Tab(element) {
  7995. _classCallCheck(this, Tab);
  7996. this._element = element;
  7997. }
  7998. // getters
  7999. _createClass(Tab, [{
  8000. key: 'show',
  8001. // public
  8002. value: function show() {
  8003. var _this = this;
  8004. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
  8005. return;
  8006. }
  8007. var target = void 0;
  8008. var previous = void 0;
  8009. var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
  8010. var selector = _util2.default.getSelectorFromElement(this._element);
  8011. if (listElement) {
  8012. var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
  8013. previous = $.makeArray($(listElement).find(itemSelector));
  8014. previous = previous[previous.length - 1];
  8015. }
  8016. var hideEvent = $.Event(Event.HIDE, {
  8017. relatedTarget: this._element
  8018. });
  8019. var showEvent = $.Event(Event.SHOW, {
  8020. relatedTarget: previous
  8021. });
  8022. if (previous) {
  8023. $(previous).trigger(hideEvent);
  8024. }
  8025. $(this._element).trigger(showEvent);
  8026. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  8027. return;
  8028. }
  8029. if (selector) {
  8030. target = $(selector)[0];
  8031. }
  8032. this._activate(this._element, listElement);
  8033. var complete = function complete() {
  8034. var hiddenEvent = $.Event(Event.HIDDEN, {
  8035. relatedTarget: _this._element
  8036. });
  8037. var shownEvent = $.Event(Event.SHOWN, {
  8038. relatedTarget: previous
  8039. });
  8040. $(previous).trigger(hiddenEvent);
  8041. $(_this._element).trigger(shownEvent);
  8042. };
  8043. if (target) {
  8044. this._activate(target, target.parentNode, complete);
  8045. } else {
  8046. complete();
  8047. }
  8048. }
  8049. }, {
  8050. key: 'dispose',
  8051. value: function dispose() {
  8052. $.removeData(this._element, DATA_KEY);
  8053. this._element = null;
  8054. }
  8055. // private
  8056. }, {
  8057. key: '_activate',
  8058. value: function _activate(element, container, callback) {
  8059. var _this2 = this;
  8060. var activeElements = void 0;
  8061. if (container.nodeName === 'UL') {
  8062. activeElements = $(container).find(Selector.ACTIVE_UL);
  8063. } else {
  8064. activeElements = $(container).children(Selector.ACTIVE);
  8065. }
  8066. var active = activeElements[0];
  8067. var isTransitioning = callback && _util2.default.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
  8068. var complete = function complete() {
  8069. return _this2._transitionComplete(element, active, isTransitioning, callback);
  8070. };
  8071. if (active && isTransitioning) {
  8072. $(active).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  8073. } else {
  8074. complete();
  8075. }
  8076. if (active) {
  8077. $(active).removeClass(ClassName.SHOW);
  8078. }
  8079. }
  8080. }, {
  8081. key: '_transitionComplete',
  8082. value: function _transitionComplete(element, active, isTransitioning, callback) {
  8083. if (active) {
  8084. $(active).removeClass(ClassName.ACTIVE);
  8085. var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
  8086. if (dropdownChild) {
  8087. $(dropdownChild).removeClass(ClassName.ACTIVE);
  8088. }
  8089. if (active.getAttribute('role') === 'tab') {
  8090. active.setAttribute('aria-selected', false);
  8091. }
  8092. }
  8093. if ($(element).is("a")) {
  8094. $(element).parent().addClass(ClassName.ACTIVE);
  8095. } else {
  8096. $(element).addClass(ClassName.ACTIVE);
  8097. }
  8098. if (element.getAttribute('role') === 'tab') {
  8099. element.setAttribute('aria-selected', true);
  8100. }
  8101. if (isTransitioning) {
  8102. _util2.default.reflow(element);
  8103. $(element).addClass(ClassName.SHOW);
  8104. } else {
  8105. $(element).removeClass(ClassName.FADE);
  8106. }
  8107. if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
  8108. var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
  8109. if (dropdownElement) {
  8110. $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  8111. }
  8112. element.setAttribute('aria-expanded', true);
  8113. }
  8114. if (callback) {
  8115. callback();
  8116. }
  8117. }
  8118. // static
  8119. }], [{
  8120. key: '_jQueryInterface',
  8121. value: function _jQueryInterface(config) {
  8122. return this.each(function () {
  8123. var $this = $(this);
  8124. var data = $this.data(DATA_KEY);
  8125. if (!data) {
  8126. data = new Tab(this);
  8127. $this.data(DATA_KEY, data);
  8128. }
  8129. if (typeof config === 'string') {
  8130. if (typeof data[config] === 'undefined') {
  8131. throw new Error('No method named "' + config + '"');
  8132. }
  8133. data[config]();
  8134. }
  8135. });
  8136. }
  8137. }, {
  8138. key: 'VERSION',
  8139. get: function get() {
  8140. return VERSION;
  8141. }
  8142. }]);
  8143. return Tab;
  8144. }();
  8145. /**
  8146. * ------------------------------------------------------------------------
  8147. * Data Api implementation
  8148. * ------------------------------------------------------------------------
  8149. */
  8150. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  8151. event.preventDefault();
  8152. Tab._jQueryInterface.call($(this), 'show');
  8153. });
  8154. /**
  8155. * ------------------------------------------------------------------------
  8156. * jQuery
  8157. * ------------------------------------------------------------------------
  8158. */
  8159. $.fn[NAME] = Tab._jQueryInterface;
  8160. $.fn[NAME].Constructor = Tab;
  8161. $.fn[NAME].noConflict = function () {
  8162. $.fn[NAME] = JQUERY_NO_CONFLICT;
  8163. return Tab._jQueryInterface;
  8164. };
  8165. return Tab;
  8166. }(_util2.default.jQuery);
  8167. exports.default = Tab;
  8168. /***/ }),
  8169. /* 20 */
  8170. /***/ (function(module, exports, __webpack_require__) {
  8171. "use strict";
  8172. Object.defineProperty(exports, "__esModule", {
  8173. value: true
  8174. });
  8175. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8176. var _Swiper = __webpack_require__(4);
  8177. var _Swiper2 = _interopRequireDefault(_Swiper);
  8178. var _util = __webpack_require__(0);
  8179. var _util2 = _interopRequireDefault(_util);
  8180. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8181. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8182. var SELECTORS = {
  8183. button: '[data-toggle="offCanvas"]',
  8184. overlayers: '.overlayer',
  8185. dismiss: '[data-dismiss="offCanvas"]'
  8186. };
  8187. var Default = {
  8188. position: 'right',
  8189. activeClass: 'is-open',
  8190. mode: 'normal',
  8191. tranition: 400,
  8192. overlayer: false,
  8193. bodyClass: 'off-canvas-is-active'
  8194. };
  8195. var OffCanvas = function () {
  8196. function OffCanvas(element, options) {
  8197. _classCallCheck(this, OffCanvas);
  8198. this.element = element;
  8199. this.options = options;
  8200. this.getConfig();
  8201. this.bindEvents();
  8202. }
  8203. _createClass(OffCanvas, [{
  8204. key: 'getConfig',
  8205. value: function getConfig() {
  8206. var dataConfig = this.element.data();
  8207. if (dataConfig.options) {
  8208. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8209. } else {
  8210. this.dataOptions = {};
  8211. }
  8212. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8213. this.target = $(this.config.target);
  8214. this.dismiss = this.target.find(SELECTORS.dismiss);
  8215. }
  8216. }, {
  8217. key: 'bindEvents',
  8218. value: function bindEvents() {
  8219. var _this = this;
  8220. this.element.on('click', function (event) {
  8221. return _this.checkState(event);
  8222. });
  8223. this.dismiss.on('click', function () {
  8224. return _this.close();
  8225. });
  8226. $(document).on('click', function (event) {
  8227. return _this.addEventClickOutside(event);
  8228. });
  8229. }
  8230. }, {
  8231. key: 'checkState',
  8232. value: function checkState() {
  8233. if (this.target.hasClass(this.config.activeClass)) {
  8234. this.close();
  8235. } else {
  8236. this.open();
  8237. }
  8238. }
  8239. }, {
  8240. key: 'open',
  8241. value: function open(evnet) {
  8242. $(this.target).addClass(this.config.activeClass);
  8243. $('body').addClass(this.config.bodyClass);
  8244. }
  8245. }, {
  8246. key: 'close',
  8247. value: function close(event) {
  8248. $(this.target).removeClass(this.config.activeClass);
  8249. $('body').removeClass(this.config.bodyClass);
  8250. }
  8251. }, {
  8252. key: 'addEventClickOutside',
  8253. value: function addEventClickOutside(event) {
  8254. if (!$(event.target).closest(this.target).length && !$(event.target).closest(this.element).length) {
  8255. if ($(this.target).is(":visible")) {
  8256. this.close();
  8257. }
  8258. }
  8259. }
  8260. }]);
  8261. return OffCanvas;
  8262. }();
  8263. function initDataSelectors() {
  8264. $(SELECTORS.button).each(function () {
  8265. new OffCanvas($(this));
  8266. });
  8267. }
  8268. function initJqueryPlugin() {
  8269. $.fn.luOffCanvas = function (options) {
  8270. return this.each(function () {
  8271. new OffCanvas($(this), options);
  8272. });
  8273. };
  8274. }
  8275. var init = {
  8276. initDataSelectors: initDataSelectors,
  8277. initJqueryPlugin: initJqueryPlugin
  8278. };
  8279. exports.default = init;
  8280. /***/ }),
  8281. /* 21 */
  8282. /***/ (function(module, exports, __webpack_require__) {
  8283. "use strict";
  8284. Object.defineProperty(exports, "__esModule", {
  8285. value: true
  8286. });
  8287. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8288. var _util = __webpack_require__(0);
  8289. var _util2 = _interopRequireDefault(_util);
  8290. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8291. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8292. var SELECTORS = {
  8293. link: '[data-scroll-to]'
  8294. };
  8295. var Default = {
  8296. topOffset: 10,
  8297. animation: 'normal',
  8298. speed: 400,
  8299. constantSpeed: false
  8300. };
  8301. var ScrollTo = function () {
  8302. function ScrollTo(element, options) {
  8303. _classCallCheck(this, ScrollTo);
  8304. this.element = element;
  8305. this.options = options;
  8306. this.hash = $(element).attr('href');
  8307. this.target = $(this.hash);
  8308. if (!this.target.length) {
  8309. return;
  8310. }
  8311. this.getConfig();
  8312. this.bindEvents();
  8313. this.targetVisibility();
  8314. }
  8315. _createClass(ScrollTo, [{
  8316. key: 'bindEvents',
  8317. value: function bindEvents() {
  8318. var _this = this;
  8319. $(this.element).on('click', function (event) {
  8320. return _this.startScroll(event);
  8321. });
  8322. $(window).on('scroll', function (event) {
  8323. return _this.targetVisibility(event);
  8324. });
  8325. }
  8326. }, {
  8327. key: 'getConfig',
  8328. value: function getConfig() {
  8329. var dataConfig = this.element.data();
  8330. if (dataConfig.options) {
  8331. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8332. } else {
  8333. this.dataOptions = {};
  8334. }
  8335. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8336. }
  8337. }, {
  8338. key: 'startScroll',
  8339. value: function startScroll(event) {
  8340. this.targetPosition = this.target.offset().top + this.config.topOffset;
  8341. console.log(this.getAnimationSpeed());
  8342. $("body, html").stop().animate({
  8343. scrollTop: this.targetPosition
  8344. }, this.config.speed);
  8345. }
  8346. }, {
  8347. key: 'isOnScreen',
  8348. value: function isOnScreen() {
  8349. var win = $(window);
  8350. var viewport = {
  8351. top: win.scrollTop(),
  8352. left: win.scrollLeft()
  8353. };
  8354. viewport.right = viewport.left + win.width();
  8355. viewport.bottom = viewport.top + win.height();
  8356. var bounds = this.target.offset();
  8357. bounds.right = bounds.left + this.target.outerWidth();
  8358. bounds.bottom = bounds.top + this.target.outerHeight();
  8359. return !(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom);
  8360. }
  8361. }, {
  8362. key: 'targetVisibility',
  8363. value: function targetVisibility() {
  8364. if (this.isOnScreen()) {
  8365. this.onScreen();
  8366. } else {
  8367. this.outScreen();
  8368. }
  8369. }
  8370. }, {
  8371. key: 'onScreen',
  8372. value: function onScreen() {
  8373. if (typeof this.config.onScreen === 'function') {
  8374. this.config.onScreen(this.element, this.target);
  8375. }
  8376. }
  8377. }, {
  8378. key: 'outScreen',
  8379. value: function outScreen() {
  8380. if (typeof this.config.outScreen === 'function') {
  8381. this.config.outScreen(this.element, this.target);
  8382. }
  8383. }
  8384. }, {
  8385. key: 'getOffset',
  8386. value: function getOffset() {
  8387. return Math.abs(this.target.offset().top - $(window).scrollTop());
  8388. }
  8389. }, {
  8390. key: 'getAnimationSpeed',
  8391. value: function getAnimationSpeed() {
  8392. return this.getOffset() / this.config.speed * this.config.speed;
  8393. }
  8394. }]);
  8395. return ScrollTo;
  8396. }();
  8397. function initDataSelectors() {
  8398. $(SELECTORS.link).each(function () {
  8399. new ScrollTo($(this));
  8400. });
  8401. }
  8402. function initJqueryPlugin() {
  8403. $.fn.luScrollTo = function (options) {
  8404. return this.each(function () {
  8405. new ScrollTo($(this), options);
  8406. });
  8407. };
  8408. }
  8409. var init = {
  8410. initDataSelectors: initDataSelectors,
  8411. initJqueryPlugin: initJqueryPlugin
  8412. };
  8413. exports.default = init;
  8414. /***/ }),
  8415. /* 22 */
  8416. /***/ (function(module, exports, __webpack_require__) {
  8417. "use strict";
  8418. Object.defineProperty(exports, "__esModule", {
  8419. value: true
  8420. });
  8421. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  8422. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8423. var _jquery = __webpack_require__(1);
  8424. var _jquery2 = _interopRequireDefault(_jquery);
  8425. var _util = __webpack_require__(0);
  8426. var _util2 = _interopRequireDefault(_util);
  8427. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8428. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8429. /**
  8430. * --------------------------------------------------------------------------
  8431. * Bootstrap (v4.0.0-beta): scrollspy.js
  8432. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  8433. * --------------------------------------------------------------------------
  8434. */
  8435. var ScrollSpy = function () {
  8436. /**
  8437. * ------------------------------------------------------------------------
  8438. * Constants
  8439. * ------------------------------------------------------------------------
  8440. */
  8441. var NAME = 'scrollspy';
  8442. var VERSION = '4.0.0-beta';
  8443. var DATA_KEY = 'bs.scrollspy';
  8444. var EVENT_KEY = '.' + DATA_KEY;
  8445. var DATA_API_KEY = '.data-api';
  8446. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  8447. var Default = {
  8448. offset: 10,
  8449. method: 'auto',
  8450. target: ''
  8451. };
  8452. var DefaultType = {
  8453. offset: 'number',
  8454. method: 'string',
  8455. target: '(string|element)'
  8456. };
  8457. var Event = {
  8458. ACTIVATE: 'activate' + EVENT_KEY,
  8459. SCROLL: 'scroll' + EVENT_KEY,
  8460. LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
  8461. };
  8462. var ClassName = {
  8463. DROPDOWN_ITEM: 'dropdown-item',
  8464. DROPDOWN_MENU: 'dropdown-menu',
  8465. ACTIVE: 'is-active'
  8466. };
  8467. var Selector = {
  8468. DATA_SPY: '[data-spy="scroll"]',
  8469. ACTIVE: '.is-active',
  8470. NAV_LIST_GROUP: '.nav, .list-group',
  8471. NAV_LINKS: '.nav__link',
  8472. NAV_ITEMS: '.nav__item',
  8473. LIST_ITEMS: '.list-group-item',
  8474. DROPDOWN: '.dropdown',
  8475. DROPDOWN_ITEMS: '.dropdown-item',
  8476. DROPDOWN_TOGGLE: '.dropdown-toggle'
  8477. };
  8478. var OffsetMethod = {
  8479. OFFSET: 'offset',
  8480. POSITION: 'position'
  8481. /**
  8482. * ------------------------------------------------------------------------
  8483. * Class Definition
  8484. * ------------------------------------------------------------------------
  8485. */
  8486. };
  8487. var ScrollSpy = function () {
  8488. function ScrollSpy(element, config) {
  8489. var _this = this;
  8490. _classCallCheck(this, ScrollSpy);
  8491. this._element = element;
  8492. this._scrollElement = element.tagName === 'BODY' ? window : element;
  8493. this._config = this._getConfig(config);
  8494. this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
  8495. this._offsets = [];
  8496. this._targets = [];
  8497. this._activeTarget = null;
  8498. this._scrollHeight = 0;
  8499. (0, _jquery2.default)(this._scrollElement).on(Event.SCROLL, function (event) {
  8500. return _this._process(event);
  8501. });
  8502. this.refresh();
  8503. this._process();
  8504. }
  8505. // getters
  8506. _createClass(ScrollSpy, [{
  8507. key: 'refresh',
  8508. // public
  8509. value: function refresh() {
  8510. var _this2 = this;
  8511. var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
  8512. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  8513. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  8514. this._offsets = [];
  8515. this._targets = [];
  8516. this._scrollHeight = this._getScrollHeight();
  8517. var targets = _jquery2.default.makeArray((0, _jquery2.default)(this._selector));
  8518. targets.map(function (element) {
  8519. var target = void 0;
  8520. var targetSelector = _util2.default.getSelectorFromElement(element);
  8521. if (targetSelector) {
  8522. target = (0, _jquery2.default)(targetSelector)[0];
  8523. }
  8524. if (target) {
  8525. var targetBCR = target.getBoundingClientRect();
  8526. if (targetBCR.width || targetBCR.height) {
  8527. // todo (fat): remove sketch reliance on jQuery position/offset
  8528. return [(0, _jquery2.default)(target)[offsetMethod]().top + offsetBase, targetSelector];
  8529. }
  8530. }
  8531. return null;
  8532. }).filter(function (item) {
  8533. return item;
  8534. }).sort(function (a, b) {
  8535. return a[0] - b[0];
  8536. }).forEach(function (item) {
  8537. _this2._offsets.push(item[0]);
  8538. _this2._targets.push(item[1]);
  8539. });
  8540. }
  8541. }, {
  8542. key: 'dispose',
  8543. value: function dispose() {
  8544. _jquery2.default.removeData(this._element, DATA_KEY);
  8545. (0, _jquery2.default)(this._scrollElement).off(EVENT_KEY);
  8546. this._element = null;
  8547. this._scrollElement = null;
  8548. this._config = null;
  8549. this._selector = null;
  8550. this._offsets = null;
  8551. this._targets = null;
  8552. this._activeTarget = null;
  8553. this._scrollHeight = null;
  8554. }
  8555. // private
  8556. }, {
  8557. key: '_getConfig',
  8558. value: function _getConfig(config) {
  8559. config = _jquery2.default.extend({}, Default, config);
  8560. if (typeof config.target !== 'string') {
  8561. var id = (0, _jquery2.default)(config.target).attr('id');
  8562. if (!id) {
  8563. id = _util2.default.getUID(NAME);
  8564. (0, _jquery2.default)(config.target).attr('id', id);
  8565. }
  8566. config.target = '#' + id;
  8567. }
  8568. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  8569. return config;
  8570. }
  8571. }, {
  8572. key: '_getScrollTop',
  8573. value: function _getScrollTop() {
  8574. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  8575. }
  8576. }, {
  8577. key: '_getScrollHeight',
  8578. value: function _getScrollHeight() {
  8579. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  8580. }
  8581. }, {
  8582. key: '_getOffsetHeight',
  8583. value: function _getOffsetHeight() {
  8584. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  8585. }
  8586. }, {
  8587. key: '_process',
  8588. value: function _process() {
  8589. var scrollTop = this._getScrollTop() + this._config.offset;
  8590. var scrollHeight = this._getScrollHeight();
  8591. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  8592. if (this._scrollHeight !== scrollHeight) {
  8593. this.refresh();
  8594. }
  8595. if (scrollTop >= maxScroll) {
  8596. var target = this._targets[this._targets.length - 1];
  8597. if (this._activeTarget !== target) {
  8598. this._activate(target);
  8599. }
  8600. return;
  8601. }
  8602. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  8603. this._activeTarget = null;
  8604. this._clear();
  8605. return;
  8606. }
  8607. for (var i = this._offsets.length; i--;) {
  8608. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  8609. if (isActiveTarget) {
  8610. this._activate(this._targets[i]);
  8611. }
  8612. }
  8613. }
  8614. }, {
  8615. key: '_activate',
  8616. value: function _activate(target) {
  8617. this._activeTarget = target;
  8618. this._clear();
  8619. var queries = this._selector.split(',');
  8620. // eslint-disable-next-line arrow-body-style
  8621. queries = queries.map(function (selector) {
  8622. return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
  8623. });
  8624. var $link = (0, _jquery2.default)(queries.join(','));
  8625. if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
  8626. $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  8627. $link.addClass(ClassName.ACTIVE);
  8628. } else {
  8629. // Set triggered link as active
  8630. $link.addClass(ClassName.ACTIVE);
  8631. // Set triggered links parents as active
  8632. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  8633. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
  8634. // Handle special case when .nav-link is inside .nav-item
  8635. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).addClass(ClassName.ACTIVE);
  8636. }
  8637. (0, _jquery2.default)(this._scrollElement).trigger(Event.ACTIVATE, {
  8638. relatedTarget: target
  8639. });
  8640. }
  8641. }, {
  8642. key: '_clear',
  8643. value: function _clear() {
  8644. (0, _jquery2.default)(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  8645. }
  8646. // static
  8647. }], [{
  8648. key: '_jQueryInterface',
  8649. value: function _jQueryInterface(config) {
  8650. return this.each(function () {
  8651. var data = (0, _jquery2.default)(this).data(DATA_KEY);
  8652. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
  8653. if (!data) {
  8654. data = new ScrollSpy(this, _config);
  8655. (0, _jquery2.default)(this).data(DATA_KEY, data);
  8656. }
  8657. if (typeof config === 'string') {
  8658. if (typeof data[config] === 'undefined') {
  8659. throw new Error('No method named "' + config + '"');
  8660. }
  8661. data[config]();
  8662. }
  8663. });
  8664. }
  8665. }, {
  8666. key: 'VERSION',
  8667. get: function get() {
  8668. return VERSION;
  8669. }
  8670. }, {
  8671. key: 'Default',
  8672. get: function get() {
  8673. return Default;
  8674. }
  8675. }]);
  8676. return ScrollSpy;
  8677. }();
  8678. /**
  8679. * ------------------------------------------------------------------------
  8680. * Data Api implementation
  8681. * ------------------------------------------------------------------------
  8682. */
  8683. (0, _jquery2.default)(window).on(Event.LOAD_DATA_API, function () {
  8684. var scrollSpys = _jquery2.default.makeArray((0, _jquery2.default)(Selector.DATA_SPY));
  8685. for (var i = scrollSpys.length; i--;) {
  8686. var $spy = (0, _jquery2.default)(scrollSpys[i]);
  8687. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  8688. }
  8689. });
  8690. /**
  8691. * ------------------------------------------------------------------------
  8692. * jQuery
  8693. * ------------------------------------------------------------------------
  8694. */
  8695. _jquery2.default.fn[NAME] = ScrollSpy._jQueryInterface;
  8696. _jquery2.default.fn[NAME].Constructor = ScrollSpy;
  8697. _jquery2.default.fn[NAME].noConflict = function () {
  8698. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  8699. return ScrollSpy._jQueryInterface;
  8700. };
  8701. return ScrollSpy;
  8702. }(_jquery2.default);
  8703. exports.default = ScrollSpy;
  8704. /***/ }),
  8705. /* 23 */
  8706. /***/ (function(module, exports, __webpack_require__) {
  8707. "use strict";
  8708. Object.defineProperty(exports, "__esModule", {
  8709. value: true
  8710. });
  8711. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8712. var _stickySidebar = __webpack_require__(33);
  8713. var _stickySidebar2 = _interopRequireDefault(_stickySidebar);
  8714. var _util = __webpack_require__(0);
  8715. var _util2 = _interopRequireDefault(_util);
  8716. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8717. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8718. var SELECTORS = {
  8719. stickyElement: '[data-sticky]'
  8720. };
  8721. var Default = {
  8722. topOffset: 0,
  8723. bottomOffset: 0
  8724. };
  8725. var Sticky = function () {
  8726. function Sticky(element, options) {
  8727. _classCallCheck(this, Sticky);
  8728. this.element = element;
  8729. this.options = options;
  8730. this.getConfig();
  8731. this.initPlugn();
  8732. this.bindEvents();
  8733. }
  8734. _createClass(Sticky, [{
  8735. key: 'getConfig',
  8736. value: function getConfig() {
  8737. var dataConfig = this.element.data();
  8738. if (dataConfig.options) {
  8739. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8740. } else {
  8741. this.dataOptions = {};
  8742. }
  8743. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8744. }
  8745. }, {
  8746. key: 'initPlugn',
  8747. value: function initPlugn() {
  8748. this.stickyInstance = new _stickySidebar2.default(this.element[0], {
  8749. topSpacing: this.config.topOffset,
  8750. bottomSpacing: this.config.bottomOffset,
  8751. containerSelector: this.config.container,
  8752. resizeSensor: true,
  8753. stickyClass: 'is-sticky'
  8754. });
  8755. if (typeof this.config.onOpen === 'function') {
  8756. this.config.onInit(this.stickyInstance);
  8757. }
  8758. }
  8759. }, {
  8760. key: 'bindEvents',
  8761. value: function bindEvents() {}
  8762. }]);
  8763. return Sticky;
  8764. }();
  8765. function initDataSelectors() {
  8766. $(SELECTORS.stickyElement).each(function () {
  8767. new Sticky($(this));
  8768. });
  8769. }
  8770. function initJqueryPlugin() {
  8771. $.fn.luSticky = function (options) {
  8772. return this.each(function () {
  8773. new Sticky($(this), options);
  8774. });
  8775. };
  8776. }
  8777. var init = {
  8778. initDataSelectors: initDataSelectors,
  8779. initJqueryPlugin: initJqueryPlugin
  8780. };
  8781. exports.default = init;
  8782. /***/ }),
  8783. /* 24 */
  8784. /***/ (function(module, exports, __webpack_require__) {
  8785. "use strict";
  8786. Object.defineProperty(exports, "__esModule", {
  8787. value: true
  8788. });
  8789. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8790. var _util = __webpack_require__(0);
  8791. var _util2 = _interopRequireDefault(_util);
  8792. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8793. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8794. var SELECTORS = {
  8795. toggler: '[data-toggler]',
  8796. togglerOptions: '[data-toggler-options]'
  8797. };
  8798. var Default = {
  8799. selectors: '',
  8800. container: 'body'
  8801. };
  8802. var Toggler = function () {
  8803. function Toggler(element, options) {
  8804. _classCallCheck(this, Toggler);
  8805. this.element = element;
  8806. this.targets = [];
  8807. this.getConfig();
  8808. this.targetsNames = this.config.selectors.split(',');
  8809. this.setTargetElements();
  8810. this.bindEvents();
  8811. }
  8812. _createClass(Toggler, [{
  8813. key: 'bindEvents',
  8814. value: function bindEvents() {
  8815. var _this = this;
  8816. this.config = this.element.on('click', function () {
  8817. return _this.toggle();
  8818. });
  8819. }
  8820. }, {
  8821. key: 'getConfig',
  8822. value: function getConfig() {
  8823. var dataToggler = this.getTogglerOptions(this.element.data('toggler'));
  8824. this.config = $.extend({}, Default, dataToggler);
  8825. }
  8826. }, {
  8827. key: 'getTogglerOptions',
  8828. value: function getTogglerOptions(options) {
  8829. if (options) {
  8830. return _util2.default.parseDataOptions(options);
  8831. } else {
  8832. return [];
  8833. }
  8834. }
  8835. }, {
  8836. key: 'setTargetElements',
  8837. value: function setTargetElements() {
  8838. this.container = this.element.closest(this.config.container);
  8839. if (this.targetsNames.length > 1) {
  8840. var _iteratorNormalCompletion = true;
  8841. var _didIteratorError = false;
  8842. var _iteratorError = undefined;
  8843. try {
  8844. for (var _iterator = this.targetsNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  8845. var target = _step.value;
  8846. var element = this.container.find(target);
  8847. this.targets.push({
  8848. element: element,
  8849. options: this.getTogglerOptions(element.data('toggler-options'))
  8850. });
  8851. }
  8852. } catch (err) {
  8853. _didIteratorError = true;
  8854. _iteratorError = err;
  8855. } finally {
  8856. try {
  8857. if (!_iteratorNormalCompletion && _iterator.return) {
  8858. _iterator.return();
  8859. }
  8860. } finally {
  8861. if (_didIteratorError) {
  8862. throw _iteratorError;
  8863. }
  8864. }
  8865. }
  8866. }
  8867. if (this.container) {
  8868. this.targets.push({
  8869. element: this.container,
  8870. options: this.getTogglerOptions(this.container.data('toggler-options'))
  8871. });
  8872. }
  8873. }
  8874. }, {
  8875. key: 'toggle',
  8876. value: function toggle() {
  8877. for (var targetName in this.targets) {
  8878. var _targets$targetName = this.targets[targetName],
  8879. element = _targets$targetName.element,
  8880. options = _targets$targetName.options;
  8881. if (options.addClass) element.addClass(options.addClass);
  8882. if (options.removeClass) element.removeClass(options.removeClass);
  8883. if (options.toggleClass) element.toggleClass(options.toggleClass);
  8884. }
  8885. }
  8886. }]);
  8887. return Toggler;
  8888. }();
  8889. function initDataSelectors() {
  8890. $(SELECTORS.toggler).each(function () {
  8891. new Toggler($(this));
  8892. });
  8893. }
  8894. function initJqueryPlugin() {
  8895. $.fn.luToggler = function (options) {
  8896. return this.each(function () {
  8897. new Toggler($(this), options);
  8898. });
  8899. };
  8900. }
  8901. var init = {
  8902. initDataSelectors: initDataSelectors,
  8903. initJqueryPlugin: initJqueryPlugin
  8904. };
  8905. exports.default = init;
  8906. /***/ }),
  8907. /* 25 */,
  8908. /* 26 */,
  8909. /* 27 */,
  8910. /* 28 */
  8911. /***/ (function(module, exports, __webpack_require__) {
  8912. "use strict";
  8913. var _navs = __webpack_require__(17);
  8914. var _navs2 = _interopRequireDefault(_navs);
  8915. var _switcher = __webpack_require__(18);
  8916. var _switcher2 = _interopRequireDefault(_switcher);
  8917. __webpack_require__(19);
  8918. __webpack_require__(11);
  8919. var _selects = __webpack_require__(13);
  8920. var _selects2 = _interopRequireDefault(_selects);
  8921. var _selectInput = __webpack_require__(3);
  8922. var _selectInput2 = _interopRequireDefault(_selectInput);
  8923. var _CheckAll = __webpack_require__(10);
  8924. var _CheckAll2 = _interopRequireDefault(_CheckAll);
  8925. var _rangeSlider = __webpack_require__(12);
  8926. var _rangeSlider2 = _interopRequireDefault(_rangeSlider);
  8927. var _dropdown = __webpack_require__(8);
  8928. var _dropdown2 = _interopRequireDefault(_dropdown);
  8929. var _tooltips = __webpack_require__(9);
  8930. var _tooltips2 = _interopRequireDefault(_tooltips);
  8931. __webpack_require__(16);
  8932. var _alert = __webpack_require__(15);
  8933. var _alert2 = _interopRequireDefault(_alert);
  8934. var _contentSlider = __webpack_require__(7);
  8935. var _contentSlider2 = _interopRequireDefault(_contentSlider);
  8936. var _scrollTo = __webpack_require__(21);
  8937. var _scrollTo2 = _interopRequireDefault(_scrollTo);
  8938. var _offCanvas = __webpack_require__(20);
  8939. var _offCanvas2 = _interopRequireDefault(_offCanvas);
  8940. var _inlineEditor = __webpack_require__(14);
  8941. var _inlineEditor2 = _interopRequireDefault(_inlineEditor);
  8942. __webpack_require__(6);
  8943. var _sticky = __webpack_require__(23);
  8944. var _sticky2 = _interopRequireDefault(_sticky);
  8945. var _toggler = __webpack_require__(24);
  8946. var _toggler2 = _interopRequireDefault(_toggler);
  8947. __webpack_require__(22);
  8948. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8949. $ = window.jQuery;
  8950. //navs
  8951. //forms
  8952. //dropdowns
  8953. //modals
  8954. //other
  8955. // *** Init plugin via data atributes ***
  8956. //init (old)
  8957. _selectInput2.default.init();
  8958. _rangeSlider2.default.init();
  8959. window.layers = {
  8960. alert: _alert2.default
  8961. };
  8962. $(document).ready(function () {
  8963. //navs
  8964. // navs.initDataSelectors();
  8965. // navs.initJqueryPlugin();
  8966. _navs2.default.init();
  8967. //Alerts
  8968. // alert.initDataSelectors();
  8969. // alert.initJqueryPlugin();
  8970. _alert2.default.init();
  8971. //Dropdown
  8972. _dropdown2.default.initDataSelectors();
  8973. //Tooltips
  8974. _tooltips2.default.initDataSelectors();
  8975. //Inline Editor
  8976. _inlineEditor2.default.initDataSelectors();
  8977. //Content Slider
  8978. _contentSlider2.default.initDataSelectors();
  8979. //Selects
  8980. _selects2.default.initDataSelectors();
  8981. //Check all
  8982. _CheckAll2.default.initDataSelectors();
  8983. //Sticky
  8984. _sticky2.default.initDataSelectors();
  8985. //Scroll To
  8986. _scrollTo2.default.initDataSelectors();
  8987. //off Canvas
  8988. _offCanvas2.default.initDataSelectors();
  8989. //toggler
  8990. _toggler2.default.initDataSelectors();
  8991. //Switcher
  8992. _switcher2.default.initDataSelectors();
  8993. });
  8994. //*** Add plugins to juqery interface ***
  8995. //Dropdown
  8996. _dropdown2.default.initJqueryPlugin();
  8997. //Tooltips
  8998. _tooltips2.default.initJqueryPlugin();
  8999. //Inline Editor
  9000. _inlineEditor2.default.initJqueryPlugin();
  9001. //Content Slider
  9002. _contentSlider2.default.initJqueryPlugin();
  9003. //Switcher
  9004. _switcher2.default.initJqueryPlugin();
  9005. //Selects
  9006. _selects2.default.initJqueryPlugin();
  9007. //Check all
  9008. _CheckAll2.default.initJqueryPlugin();
  9009. //Sticky
  9010. _sticky2.default.initJqueryPlugin();
  9011. //Scroll To
  9012. _scrollTo2.default.initJqueryPlugin();
  9013. //off Canvas
  9014. _offCanvas2.default.initJqueryPlugin();
  9015. //toggler
  9016. _toggler2.default.initJqueryPlugin();
  9017. /***/ }),
  9018. /* 29 */
  9019. /***/ (function(module, exports, __webpack_require__) {
  9020. "use strict";
  9021. var __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_0__factory, __WEBPACK_LOCAL_MODULE_0__module;var __WEBPACK_LOCAL_MODULE_1__, __WEBPACK_LOCAL_MODULE_1__factory, __WEBPACK_LOCAL_MODULE_1__module;var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  9022. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  9023. /**
  9024. * sifter.js
  9025. * Copyright (c) 2013 Brian Reavis & contributors
  9026. *
  9027. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9028. * file except in compliance with the License. You may obtain a copy of the License at:
  9029. * http://www.apache.org/licenses/LICENSE-2.0
  9030. *
  9031. * Unless required by applicable law or agreed to in writing, software distributed under
  9032. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9033. * ANY KIND, either express or implied. See the License for the specific language
  9034. * governing permissions and limitations under the License.
  9035. *
  9036. * @author Brian Reavis <brian@thirdroute.com>
  9037. */
  9038. (function (root, factory) {
  9039. if (true) {
  9040. !(__WEBPACK_LOCAL_MODULE_0__factory = (factory), (__WEBPACK_LOCAL_MODULE_0__module = { id: "sifter", exports: {}, loaded: false }), __WEBPACK_LOCAL_MODULE_0__ = (typeof __WEBPACK_LOCAL_MODULE_0__factory === 'function' ? (__WEBPACK_LOCAL_MODULE_0__factory.call(__WEBPACK_LOCAL_MODULE_0__module.exports, __webpack_require__, __WEBPACK_LOCAL_MODULE_0__module.exports, __WEBPACK_LOCAL_MODULE_0__module)) : __WEBPACK_LOCAL_MODULE_0__factory), (__WEBPACK_LOCAL_MODULE_0__module.loaded = true), __WEBPACK_LOCAL_MODULE_0__ === undefined && (__WEBPACK_LOCAL_MODULE_0__ = __WEBPACK_LOCAL_MODULE_0__module.exports));
  9041. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9042. module.exports = factory();
  9043. } else {
  9044. root.Sifter = factory();
  9045. }
  9046. })(undefined, function () {
  9047. /**
  9048. * Textually searches arrays and hashes of objects
  9049. * by property (or multiple properties). Designed
  9050. * specifically for autocomplete.
  9051. *
  9052. * @constructor
  9053. * @param {array|object} items
  9054. * @param {object} items
  9055. */
  9056. var Sifter = function Sifter(items, settings) {
  9057. this.items = items;
  9058. this.settings = settings || { diacritics: true };
  9059. };
  9060. /**
  9061. * Splits a search string into an array of individual
  9062. * regexps to be used to match results.
  9063. *
  9064. * @param {string} query
  9065. * @returns {array}
  9066. */
  9067. Sifter.prototype.tokenize = function (query) {
  9068. query = trim(String(query || '').toLowerCase());
  9069. if (!query || !query.length) return [];
  9070. var i, n, regex, letter;
  9071. var tokens = [];
  9072. var words = query.split(/ +/);
  9073. for (i = 0, n = words.length; i < n; i++) {
  9074. regex = escape_regex(words[i]);
  9075. if (this.settings.diacritics) {
  9076. for (letter in DIACRITICS) {
  9077. if (DIACRITICS.hasOwnProperty(letter)) {
  9078. regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);
  9079. }
  9080. }
  9081. }
  9082. tokens.push({
  9083. string: words[i],
  9084. regex: new RegExp(regex, 'i')
  9085. });
  9086. }
  9087. return tokens;
  9088. };
  9089. /**
  9090. * Iterates over arrays and hashes.
  9091. *
  9092. * ```
  9093. * this.iterator(this.items, function(item, id) {
  9094. * // invoked for each item
  9095. * });
  9096. * ```
  9097. *
  9098. * @param {array|object} object
  9099. */
  9100. Sifter.prototype.iterator = function (object, callback) {
  9101. var iterator;
  9102. if (is_array(object)) {
  9103. iterator = Array.prototype.forEach || function (callback) {
  9104. for (var i = 0, n = this.length; i < n; i++) {
  9105. callback(this[i], i, this);
  9106. }
  9107. };
  9108. } else {
  9109. iterator = function iterator(callback) {
  9110. for (var key in this) {
  9111. if (this.hasOwnProperty(key)) {
  9112. callback(this[key], key, this);
  9113. }
  9114. }
  9115. };
  9116. }
  9117. iterator.apply(object, [callback]);
  9118. };
  9119. /**
  9120. * Returns a function to be used to score individual results.
  9121. *
  9122. * Good matches will have a higher score than poor matches.
  9123. * If an item is not a match, 0 will be returned by the function.
  9124. *
  9125. * @param {object|string} search
  9126. * @param {object} options (optional)
  9127. * @returns {function}
  9128. */
  9129. Sifter.prototype.getScoreFunction = function (search, options) {
  9130. var self, fields, tokens, token_count, nesting;
  9131. self = this;
  9132. search = self.prepareSearch(search, options);
  9133. tokens = search.tokens;
  9134. fields = search.options.fields;
  9135. token_count = tokens.length;
  9136. nesting = search.options.nesting;
  9137. /**
  9138. * Calculates how close of a match the
  9139. * given value is against a search token.
  9140. *
  9141. * @param {mixed} value
  9142. * @param {object} token
  9143. * @return {number}
  9144. */
  9145. var scoreValue = function scoreValue(value, token) {
  9146. var score, pos;
  9147. if (!value) return 0;
  9148. value = String(value || '');
  9149. pos = value.search(token.regex);
  9150. if (pos === -1) return 0;
  9151. score = token.string.length / value.length;
  9152. if (pos === 0) score += 0.5;
  9153. return score;
  9154. };
  9155. /**
  9156. * Calculates the score of an object
  9157. * against the search query.
  9158. *
  9159. * @param {object} token
  9160. * @param {object} data
  9161. * @return {number}
  9162. */
  9163. var scoreObject = function () {
  9164. var field_count = fields.length;
  9165. if (!field_count) {
  9166. return function () {
  9167. return 0;
  9168. };
  9169. }
  9170. if (field_count === 1) {
  9171. return function (token, data) {
  9172. return scoreValue(getattr(data, fields[0], nesting), token);
  9173. };
  9174. }
  9175. return function (token, data) {
  9176. for (var i = 0, sum = 0; i < field_count; i++) {
  9177. sum += scoreValue(getattr(data, fields[i], nesting), token);
  9178. }
  9179. return sum / field_count;
  9180. };
  9181. }();
  9182. if (!token_count) {
  9183. return function () {
  9184. return 0;
  9185. };
  9186. }
  9187. if (token_count === 1) {
  9188. return function (data) {
  9189. return scoreObject(tokens[0], data);
  9190. };
  9191. }
  9192. if (search.options.conjunction === 'and') {
  9193. return function (data) {
  9194. var score;
  9195. for (var i = 0, sum = 0; i < token_count; i++) {
  9196. score = scoreObject(tokens[i], data);
  9197. if (score <= 0) return 0;
  9198. sum += score;
  9199. }
  9200. return sum / token_count;
  9201. };
  9202. } else {
  9203. return function (data) {
  9204. for (var i = 0, sum = 0; i < token_count; i++) {
  9205. sum += scoreObject(tokens[i], data);
  9206. }
  9207. return sum / token_count;
  9208. };
  9209. }
  9210. };
  9211. /**
  9212. * Returns a function that can be used to compare two
  9213. * results, for sorting purposes. If no sorting should
  9214. * be performed, `null` will be returned.
  9215. *
  9216. * @param {string|object} search
  9217. * @param {object} options
  9218. * @return function(a,b)
  9219. */
  9220. Sifter.prototype.getSortFunction = function (search, options) {
  9221. var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
  9222. self = this;
  9223. search = self.prepareSearch(search, options);
  9224. sort = !search.query && options.sort_empty || options.sort;
  9225. /**
  9226. * Fetches the specified sort field value
  9227. * from a search result item.
  9228. *
  9229. * @param {string} name
  9230. * @param {object} result
  9231. * @return {mixed}
  9232. */
  9233. get_field = function get_field(name, result) {
  9234. if (name === '$score') return result.score;
  9235. return getattr(self.items[result.id], name, options.nesting);
  9236. };
  9237. // parse options
  9238. fields = [];
  9239. if (sort) {
  9240. for (i = 0, n = sort.length; i < n; i++) {
  9241. if (search.query || sort[i].field !== '$score') {
  9242. fields.push(sort[i]);
  9243. }
  9244. }
  9245. }
  9246. // the "$score" field is implied to be the primary
  9247. // sort field, unless it's manually specified
  9248. if (search.query) {
  9249. implicit_score = true;
  9250. for (i = 0, n = fields.length; i < n; i++) {
  9251. if (fields[i].field === '$score') {
  9252. implicit_score = false;
  9253. break;
  9254. }
  9255. }
  9256. if (implicit_score) {
  9257. fields.unshift({ field: '$score', direction: 'desc' });
  9258. }
  9259. } else {
  9260. for (i = 0, n = fields.length; i < n; i++) {
  9261. if (fields[i].field === '$score') {
  9262. fields.splice(i, 1);
  9263. break;
  9264. }
  9265. }
  9266. }
  9267. multipliers = [];
  9268. for (i = 0, n = fields.length; i < n; i++) {
  9269. multipliers.push(fields[i].direction === 'desc' ? -1 : 1);
  9270. }
  9271. // build function
  9272. fields_count = fields.length;
  9273. if (!fields_count) {
  9274. return null;
  9275. } else if (fields_count === 1) {
  9276. field = fields[0].field;
  9277. multiplier = multipliers[0];
  9278. return function (a, b) {
  9279. return multiplier * cmp(get_field(field, a), get_field(field, b));
  9280. };
  9281. } else {
  9282. return function (a, b) {
  9283. var i, result, a_value, b_value, field;
  9284. for (i = 0; i < fields_count; i++) {
  9285. field = fields[i].field;
  9286. result = multipliers[i] * cmp(get_field(field, a), get_field(field, b));
  9287. if (result) return result;
  9288. }
  9289. return 0;
  9290. };
  9291. }
  9292. };
  9293. /**
  9294. * Parses a search query and returns an object
  9295. * with tokens and fields ready to be populated
  9296. * with results.
  9297. *
  9298. * @param {string} query
  9299. * @param {object} options
  9300. * @returns {object}
  9301. */
  9302. Sifter.prototype.prepareSearch = function (query, options) {
  9303. if ((typeof query === 'undefined' ? 'undefined' : _typeof(query)) === 'object') return query;
  9304. options = extend({}, options);
  9305. var option_fields = options.fields;
  9306. var option_sort = options.sort;
  9307. var option_sort_empty = options.sort_empty;
  9308. if (option_fields && !is_array(option_fields)) options.fields = [option_fields];
  9309. if (option_sort && !is_array(option_sort)) options.sort = [option_sort];
  9310. if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];
  9311. return {
  9312. options: options,
  9313. query: String(query || '').toLowerCase(),
  9314. tokens: this.tokenize(query),
  9315. total: 0,
  9316. items: []
  9317. };
  9318. };
  9319. /**
  9320. * Searches through all items and returns a sorted array of matches.
  9321. *
  9322. * The `options` parameter can contain:
  9323. *
  9324. * - fields {string|array}
  9325. * - sort {array}
  9326. * - score {function}
  9327. * - filter {bool}
  9328. * - limit {integer}
  9329. *
  9330. * Returns an object containing:
  9331. *
  9332. * - options {object}
  9333. * - query {string}
  9334. * - tokens {array}
  9335. * - total {int}
  9336. * - items {array}
  9337. *
  9338. * @param {string} query
  9339. * @param {object} options
  9340. * @returns {object}
  9341. */
  9342. Sifter.prototype.search = function (query, options) {
  9343. var self = this,
  9344. value,
  9345. score,
  9346. search,
  9347. calculateScore;
  9348. var fn_sort;
  9349. var fn_score;
  9350. search = this.prepareSearch(query, options);
  9351. options = search.options;
  9352. query = search.query;
  9353. // generate result scoring function
  9354. fn_score = options.score || self.getScoreFunction(search);
  9355. // perform search and sort
  9356. if (query.length) {
  9357. self.iterator(self.items, function (item, id) {
  9358. score = fn_score(item);
  9359. if (options.filter === false || score > 0) {
  9360. search.items.push({ 'score': score, 'id': id });
  9361. }
  9362. });
  9363. } else {
  9364. self.iterator(self.items, function (item, id) {
  9365. search.items.push({ 'score': 1, 'id': id });
  9366. });
  9367. }
  9368. fn_sort = self.getSortFunction(search, options);
  9369. if (fn_sort) search.items.sort(fn_sort);
  9370. // apply limits
  9371. search.total = search.items.length;
  9372. if (typeof options.limit === 'number') {
  9373. search.items = search.items.slice(0, options.limit);
  9374. }
  9375. return search;
  9376. };
  9377. // utilities
  9378. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9379. var cmp = function cmp(a, b) {
  9380. if (typeof a === 'number' && typeof b === 'number') {
  9381. return a > b ? 1 : a < b ? -1 : 0;
  9382. }
  9383. a = asciifold(String(a || ''));
  9384. b = asciifold(String(b || ''));
  9385. if (a > b) return 1;
  9386. if (b > a) return -1;
  9387. return 0;
  9388. };
  9389. var extend = function extend(a, b) {
  9390. var i, n, k, object;
  9391. for (i = 1, n = arguments.length; i < n; i++) {
  9392. object = arguments[i];
  9393. if (!object) continue;
  9394. for (k in object) {
  9395. if (object.hasOwnProperty(k)) {
  9396. a[k] = object[k];
  9397. }
  9398. }
  9399. }
  9400. return a;
  9401. };
  9402. /**
  9403. * A property getter resolving dot-notation
  9404. * @param {Object} obj The root object to fetch property on
  9405. * @param {String} name The optionally dotted property name to fetch
  9406. * @param {Boolean} nesting Handle nesting or not
  9407. * @return {Object} The resolved property value
  9408. */
  9409. var getattr = function getattr(obj, name, nesting) {
  9410. if (!obj || !name) return;
  9411. if (!nesting) return obj[name];
  9412. var names = name.split(".");
  9413. while (names.length && (obj = obj[names.shift()])) {}
  9414. return obj;
  9415. };
  9416. var trim = function trim(str) {
  9417. return (str + '').replace(/^\s+|\s+$|/g, '');
  9418. };
  9419. var escape_regex = function escape_regex(str) {
  9420. return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
  9421. };
  9422. var is_array = Array.isArray || typeof $ !== 'undefined' && $.isArray || function (object) {
  9423. return Object.prototype.toString.call(object) === '[object Array]';
  9424. };
  9425. var DIACRITICS = {
  9426. 'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',
  9427. 'b': '[b␢βΒB฿𐌁ᛒ]',
  9428. 'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',
  9429. 'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',
  9430. 'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',
  9431. 'f': '[fƑƒḞḟ]',
  9432. 'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',
  9433. 'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',
  9434. 'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',
  9435. 'j': '[jȷĴĵɈɉʝɟʲ]',
  9436. 'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',
  9437. 'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',
  9438. 'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',
  9439. 'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',
  9440. 'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',
  9441. 'q': '[qꝖꝗʠɊɋꝘꝙq̃]',
  9442. 'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',
  9443. 's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',
  9444. 't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',
  9445. 'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',
  9446. 'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',
  9447. 'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',
  9448. 'x': '[xẌẍẊẋχ]',
  9449. 'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',
  9450. 'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'
  9451. };
  9452. var asciifold = function () {
  9453. var i, n, k, chunk;
  9454. var foreignletters = '';
  9455. var lookup = {};
  9456. for (k in DIACRITICS) {
  9457. if (DIACRITICS.hasOwnProperty(k)) {
  9458. chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);
  9459. foreignletters += chunk;
  9460. for (i = 0, n = chunk.length; i < n; i++) {
  9461. lookup[chunk.charAt(i)] = k;
  9462. }
  9463. }
  9464. }
  9465. var regexp = new RegExp('[' + foreignletters + ']', 'g');
  9466. return function (str) {
  9467. return str.replace(regexp, function (foreignletter) {
  9468. return lookup[foreignletter];
  9469. }).toLowerCase();
  9470. };
  9471. }();
  9472. // export
  9473. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9474. return Sifter;
  9475. });
  9476. /**
  9477. * microplugin.js
  9478. * Copyright (c) 2013 Brian Reavis & contributors
  9479. *
  9480. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9481. * file except in compliance with the License. You may obtain a copy of the License at:
  9482. * http://www.apache.org/licenses/LICENSE-2.0
  9483. *
  9484. * Unless required by applicable law or agreed to in writing, software distributed under
  9485. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9486. * ANY KIND, either express or implied. See the License for the specific language
  9487. * governing permissions and limitations under the License.
  9488. *
  9489. * @author Brian Reavis <brian@thirdroute.com>
  9490. */
  9491. (function (root, factory) {
  9492. if (true) {
  9493. !(__WEBPACK_LOCAL_MODULE_1__factory = (factory), (__WEBPACK_LOCAL_MODULE_1__module = { id: "microplugin", exports: {}, loaded: false }), __WEBPACK_LOCAL_MODULE_1__ = (typeof __WEBPACK_LOCAL_MODULE_1__factory === 'function' ? (__WEBPACK_LOCAL_MODULE_1__factory.call(__WEBPACK_LOCAL_MODULE_1__module.exports, __webpack_require__, __WEBPACK_LOCAL_MODULE_1__module.exports, __WEBPACK_LOCAL_MODULE_1__module)) : __WEBPACK_LOCAL_MODULE_1__factory), (__WEBPACK_LOCAL_MODULE_1__module.loaded = true), __WEBPACK_LOCAL_MODULE_1__ === undefined && (__WEBPACK_LOCAL_MODULE_1__ = __WEBPACK_LOCAL_MODULE_1__module.exports));
  9494. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9495. module.exports = factory();
  9496. } else {
  9497. root.MicroPlugin = factory();
  9498. }
  9499. })(undefined, function () {
  9500. var MicroPlugin = {};
  9501. MicroPlugin.mixin = function (Interface) {
  9502. Interface.plugins = {};
  9503. /**
  9504. * Initializes the listed plugins (with options).
  9505. * Acceptable formats:
  9506. *
  9507. * List (without options):
  9508. * ['a', 'b', 'c']
  9509. *
  9510. * List (with options):
  9511. * [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
  9512. *
  9513. * Hash (with options):
  9514. * {'a': { ... }, 'b': { ... }, 'c': { ... }}
  9515. *
  9516. * @param {mixed} plugins
  9517. */
  9518. Interface.prototype.initializePlugins = function (plugins) {
  9519. var i, n, key;
  9520. var self = this;
  9521. var queue = [];
  9522. self.plugins = {
  9523. names: [],
  9524. settings: {},
  9525. requested: {},
  9526. loaded: {}
  9527. };
  9528. if (utils.isArray(plugins)) {
  9529. for (i = 0, n = plugins.length; i < n; i++) {
  9530. if (typeof plugins[i] === 'string') {
  9531. queue.push(plugins[i]);
  9532. } else {
  9533. self.plugins.settings[plugins[i].name] = plugins[i].options;
  9534. queue.push(plugins[i].name);
  9535. }
  9536. }
  9537. } else if (plugins) {
  9538. for (key in plugins) {
  9539. if (plugins.hasOwnProperty(key)) {
  9540. self.plugins.settings[key] = plugins[key];
  9541. queue.push(key);
  9542. }
  9543. }
  9544. }
  9545. while (queue.length) {
  9546. self.require(queue.shift());
  9547. }
  9548. };
  9549. Interface.prototype.loadPlugin = function (name) {
  9550. var self = this;
  9551. var plugins = self.plugins;
  9552. var plugin = Interface.plugins[name];
  9553. if (!Interface.plugins.hasOwnProperty(name)) {
  9554. //throw new Error('Unable to find "' + name + '" plugin');
  9555. }
  9556. else{
  9557. plugins.requested[name] = true;
  9558. plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
  9559. plugins.names.push(name);
  9560. }
  9561. };
  9562. /**
  9563. * Initializes a plugin.
  9564. *
  9565. * @param {string} name
  9566. */
  9567. Interface.prototype.require = function (name) {
  9568. var self = this;
  9569. var plugins = self.plugins;
  9570. if (!self.plugins.loaded.hasOwnProperty(name)) {
  9571. if (plugins.requested[name]) {
  9572. throw new Error('Plugin has circular dependency ("' + name + '")');
  9573. }
  9574. self.loadPlugin(name);
  9575. }
  9576. return plugins.loaded[name];
  9577. };
  9578. /**
  9579. * Registers a plugin.
  9580. *
  9581. * @param {string} name
  9582. * @param {function} fn
  9583. */
  9584. Interface.define = function (name, fn) {
  9585. Interface.plugins[name] = {
  9586. 'name': name,
  9587. 'fn': fn
  9588. };
  9589. };
  9590. };
  9591. var utils = {
  9592. isArray: Array.isArray || function (vArg) {
  9593. return Object.prototype.toString.call(vArg) === '[object Array]';
  9594. }
  9595. };
  9596. return MicroPlugin;
  9597. });
  9598. /**
  9599. * selectize.js (v0.12.4)
  9600. * Copyright (c) 2013–2015 Brian Reavis & contributors
  9601. *
  9602. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9603. * file except in compliance with the License. You may obtain a copy of the License at:
  9604. * http://www.apache.org/licenses/LICENSE-2.0
  9605. *
  9606. * Unless required by applicable law or agreed to in writing, software distributed under
  9607. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9608. * ANY KIND, either express or implied. See the License for the specific language
  9609. * governing permissions and limitations under the License.
  9610. *
  9611. * @author Brian Reavis <brian@thirdroute.com>
  9612. */
  9613. /*jshint curly:false */
  9614. /*jshint browser:true */
  9615. (function (root, factory) {
  9616. if (true) {
  9617. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_1__], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  9618. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  9619. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  9620. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9621. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9622. module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
  9623. } else {
  9624. root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
  9625. }
  9626. })(undefined, function ($, Sifter, MicroPlugin) {
  9627. 'use strict';
  9628. var highlight = function highlight($element, pattern) {
  9629. if (typeof pattern === 'string' && !pattern.length) return;
  9630. var regex = typeof pattern === 'string' ? new RegExp(pattern, 'i') : pattern;
  9631. var highlight = function highlight(node) {
  9632. var skip = 0;
  9633. if (node.nodeType === 3) {
  9634. var pos = node.data.search(regex);
  9635. if (pos >= 0 && node.data.length > 0) {
  9636. var match = node.data.match(regex);
  9637. var spannode = document.createElement('span');
  9638. spannode.className = 'highlight';
  9639. var middlebit = node.splitText(pos);
  9640. var endbit = middlebit.splitText(match[0].length);
  9641. var middleclone = middlebit.cloneNode(true);
  9642. spannode.appendChild(middleclone);
  9643. middlebit.parentNode.replaceChild(spannode, middlebit);
  9644. skip = 1;
  9645. }
  9646. } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
  9647. for (var i = 0; i < node.childNodes.length; ++i) {
  9648. i += highlight(node.childNodes[i]);
  9649. }
  9650. }
  9651. return skip;
  9652. };
  9653. return $element.each(function () {
  9654. highlight(this);
  9655. });
  9656. };
  9657. /**
  9658. * removeHighlight fn copied from highlight v5 and
  9659. * edited to remove with() and pass js strict mode
  9660. */
  9661. $.fn.removeHighlight = function () {
  9662. return this.find("span.highlight").each(function () {
  9663. this.parentNode.firstChild.nodeName;
  9664. var parent = this.parentNode;
  9665. parent.replaceChild(this.firstChild, this);
  9666. parent.normalize();
  9667. }).end();
  9668. };
  9669. var MicroEvent = function MicroEvent() {};
  9670. MicroEvent.prototype = {
  9671. on: function on(event, fct) {
  9672. this._events = this._events || {};
  9673. this._events[event] = this._events[event] || [];
  9674. this._events[event].push(fct);
  9675. },
  9676. off: function off(event, fct) {
  9677. var n = arguments.length;
  9678. if (n === 0) return delete this._events;
  9679. if (n === 1) return delete this._events[event];
  9680. this._events = this._events || {};
  9681. if (event in this._events === false) return;
  9682. this._events[event].splice(this._events[event].indexOf(fct), 1);
  9683. },
  9684. trigger: function trigger(event /* , args... */) {
  9685. this._events = this._events || {};
  9686. if (event in this._events === false) return;
  9687. for (var i = 0; i < this._events[event].length; i++) {
  9688. this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
  9689. }
  9690. }
  9691. };
  9692. /**
  9693. * Mixin will delegate all MicroEvent.js function in the destination object.
  9694. *
  9695. * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent
  9696. *
  9697. * @param {object} the object which will support MicroEvent
  9698. */
  9699. MicroEvent.mixin = function (destObject) {
  9700. var props = ['on', 'off', 'trigger'];
  9701. for (var i = 0; i < props.length; i++) {
  9702. destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
  9703. }
  9704. };
  9705. var IS_MAC = /Mac/.test(navigator.userAgent);
  9706. var KEY_A = 65;
  9707. var KEY_COMMA = 188;
  9708. var KEY_RETURN = 13;
  9709. var KEY_ESC = 27;
  9710. var KEY_LEFT = 37;
  9711. var KEY_UP = 38;
  9712. var KEY_P = 80;
  9713. var KEY_RIGHT = 39;
  9714. var KEY_DOWN = 40;
  9715. var KEY_N = 78;
  9716. var KEY_BACKSPACE = 8;
  9717. var KEY_DELETE = 46;
  9718. var KEY_SHIFT = 16;
  9719. var KEY_CMD = IS_MAC ? 91 : 17;
  9720. var KEY_CTRL = IS_MAC ? 18 : 17;
  9721. var KEY_TAB = 9;
  9722. var TAG_SELECT = 1;
  9723. var TAG_INPUT = 2;
  9724. // for now, android support in general is too spotty to support validity
  9725. var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
  9726. var isset = function isset(object) {
  9727. return typeof object !== 'undefined';
  9728. };
  9729. /**
  9730. * Converts a scalar to its best string representation
  9731. * for hash keys and HTML attribute values.
  9732. *
  9733. * Transformations:
  9734. * 'str' -> 'str'
  9735. * null -> ''
  9736. * undefined -> ''
  9737. * true -> '1'
  9738. * false -> '0'
  9739. * 0 -> '0'
  9740. * 1 -> '1'
  9741. *
  9742. * @param {string} value
  9743. * @returns {string|null}
  9744. */
  9745. var hash_key = function hash_key(value) {
  9746. if (typeof value === 'undefined' || value === null) return null;
  9747. if (typeof value === 'boolean') return value ? '1' : '0';
  9748. return value + '';
  9749. };
  9750. /**
  9751. * Escapes a string for use within HTML.
  9752. *
  9753. * @param {string} str
  9754. * @returns {string}
  9755. */
  9756. var escape_html = function escape_html(str) {
  9757. return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  9758. };
  9759. /**
  9760. * Escapes "$" characters in replacement strings.
  9761. *
  9762. * @param {string} str
  9763. * @returns {string}
  9764. */
  9765. var escape_replace = function escape_replace(str) {
  9766. return (str + '').replace(/\$/g, '$$$$');
  9767. };
  9768. var hook = {};
  9769. /**
  9770. * Wraps `method` on `self` so that `fn`
  9771. * is invoked before the original method.
  9772. *
  9773. * @param {object} self
  9774. * @param {string} method
  9775. * @param {function} fn
  9776. */
  9777. hook.before = function (self, method, fn) {
  9778. var original = self[method];
  9779. self[method] = function () {
  9780. fn.apply(self, arguments);
  9781. return original.apply(self, arguments);
  9782. };
  9783. };
  9784. /**
  9785. * Wraps `method` on `self` so that `fn`
  9786. * is invoked after the original method.
  9787. *
  9788. * @param {object} self
  9789. * @param {string} method
  9790. * @param {function} fn
  9791. */
  9792. hook.after = function (self, method, fn) {
  9793. var original = self[method];
  9794. self[method] = function () {
  9795. var result = original.apply(self, arguments);
  9796. fn.apply(self, arguments);
  9797. return result;
  9798. };
  9799. };
  9800. /**
  9801. * Wraps `fn` so that it can only be invoked once.
  9802. *
  9803. * @param {function} fn
  9804. * @returns {function}
  9805. */
  9806. var once = function once(fn) {
  9807. var called = false;
  9808. return function () {
  9809. if (called) return;
  9810. called = true;
  9811. fn.apply(this, arguments);
  9812. };
  9813. };
  9814. /**
  9815. * Wraps `fn` so that it can only be called once
  9816. * every `delay` milliseconds (invoked on the falling edge).
  9817. *
  9818. * @param {function} fn
  9819. * @param {int} delay
  9820. * @returns {function}
  9821. */
  9822. var debounce = function debounce(fn, delay) {
  9823. var timeout;
  9824. return function () {
  9825. var self = this;
  9826. var args = arguments;
  9827. window.clearTimeout(timeout);
  9828. timeout = window.setTimeout(function () {
  9829. fn.apply(self, args);
  9830. }, delay);
  9831. };
  9832. };
  9833. /**
  9834. * Debounce all fired events types listed in `types`
  9835. * while executing the provided `fn`.
  9836. *
  9837. * @param {object} self
  9838. * @param {array} types
  9839. * @param {function} fn
  9840. */
  9841. var debounce_events = function debounce_events(self, types, fn) {
  9842. var type;
  9843. var trigger = self.trigger;
  9844. var event_args = {};
  9845. // override trigger method
  9846. self.trigger = function () {
  9847. var type = arguments[0];
  9848. if (types.indexOf(type) !== -1) {
  9849. event_args[type] = arguments;
  9850. } else {
  9851. return trigger.apply(self, arguments);
  9852. }
  9853. };
  9854. // invoke provided function
  9855. fn.apply(self, []);
  9856. self.trigger = trigger;
  9857. // trigger queued events
  9858. for (type in event_args) {
  9859. if (event_args.hasOwnProperty(type)) {
  9860. trigger.apply(self, event_args[type]);
  9861. }
  9862. }
  9863. };
  9864. /**
  9865. * A workaround for http://bugs.jquery.com/ticket/6696
  9866. *
  9867. * @param {object} $parent - Parent element to listen on.
  9868. * @param {string} event - Event name.
  9869. * @param {string} selector - Descendant selector to filter by.
  9870. * @param {function} fn - Event handler.
  9871. */
  9872. var watchChildEvent = function watchChildEvent($parent, event, selector, fn) {
  9873. $parent.on(event, selector, function (e) {
  9874. var child = e.target;
  9875. while (child && child.parentNode !== $parent[0]) {
  9876. child = child.parentNode;
  9877. }
  9878. e.currentTarget = child;
  9879. return fn.apply(this, [e]);
  9880. });
  9881. };
  9882. /**
  9883. * Determines the current selection within a text input control.
  9884. * Returns an object containing:
  9885. * - start
  9886. * - length
  9887. *
  9888. * @param {object} input
  9889. * @returns {object}
  9890. */
  9891. var getSelection = function getSelection(input) {
  9892. var result = {};
  9893. if ('selectionStart' in input) {
  9894. result.start = input.selectionStart;
  9895. result.length = input.selectionEnd - result.start;
  9896. } else if (document.selection) {
  9897. input.focus();
  9898. var sel = document.selection.createRange();
  9899. var selLen = document.selection.createRange().text.length;
  9900. sel.moveStart('character', -input.value.length);
  9901. result.start = sel.text.length - selLen;
  9902. result.length = selLen;
  9903. }
  9904. return result;
  9905. };
  9906. /**
  9907. * Copies CSS properties from one element to another.
  9908. *
  9909. * @param {object} $from
  9910. * @param {object} $to
  9911. * @param {array} properties
  9912. */
  9913. var transferStyles = function transferStyles($from, $to, properties) {
  9914. var i,
  9915. n,
  9916. styles = {};
  9917. if (properties) {
  9918. for (i = 0, n = properties.length; i < n; i++) {
  9919. styles[properties[i]] = $from.css(properties[i]);
  9920. }
  9921. } else {
  9922. styles = $from.css();
  9923. }
  9924. $to.css(styles);
  9925. };
  9926. /**
  9927. * Measures the width of a string within a
  9928. * parent element (in pixels).
  9929. *
  9930. * @param {string} str
  9931. * @param {object} $parent
  9932. * @returns {int}
  9933. */
  9934. var measureString = function measureString(str, $parent) {
  9935. if (!str) {
  9936. return 0;
  9937. }
  9938. var $test = $('<test>').css({
  9939. position: 'absolute',
  9940. top: -99999,
  9941. left: -99999,
  9942. width: 'auto',
  9943. padding: 0,
  9944. whiteSpace: 'pre'
  9945. }).text(str).appendTo('body');
  9946. transferStyles($parent, $test, ['letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform']);
  9947. var width = $test.width();
  9948. $test.remove();
  9949. return width;
  9950. };
  9951. /**
  9952. * Sets up an input to grow horizontally as the user
  9953. * types. If the value is changed manually, you can
  9954. * trigger the "update" handler to resize:
  9955. *
  9956. * $input.trigger('update');
  9957. *
  9958. * @param {object} $input
  9959. */
  9960. var autoGrow = function autoGrow($input) {
  9961. var currentWidth = null;
  9962. var update = function update(e, options) {
  9963. var value, keyCode, printable, placeholder, width;
  9964. var shift, character, selection;
  9965. e = e || window.event || {};
  9966. options = options || {};
  9967. if (e.metaKey || e.altKey) return;
  9968. if (!options.force && $input.data('grow') === false) return;
  9969. value = $input.val();
  9970. if (e.type && e.type.toLowerCase() === 'keydown') {
  9971. keyCode = e.keyCode;
  9972. printable = keyCode >= 97 && keyCode <= 122 || // a-z
  9973. keyCode >= 65 && keyCode <= 90 || // A-Z
  9974. keyCode >= 48 && keyCode <= 57 || // 0-9
  9975. keyCode === 32 // space
  9976. ;
  9977. if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
  9978. selection = getSelection($input[0]);
  9979. if (selection.length) {
  9980. value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
  9981. } else if (keyCode === KEY_BACKSPACE && selection.start) {
  9982. value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
  9983. } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
  9984. value = value.substring(0, selection.start) + value.substring(selection.start + 1);
  9985. }
  9986. } else if (printable) {
  9987. shift = e.shiftKey;
  9988. character = String.fromCharCode(e.keyCode);
  9989. if (shift) character = character.toUpperCase();else character = character.toLowerCase();
  9990. value += character;
  9991. }
  9992. }
  9993. placeholder = $input.attr('placeholder');
  9994. if (!value && placeholder) {
  9995. value = placeholder;
  9996. }
  9997. width = measureString(value, $input) + 4;
  9998. if (width !== currentWidth) {
  9999. currentWidth = width;
  10000. $input.width(width);
  10001. $input.triggerHandler('resize');
  10002. }
  10003. };
  10004. $input.on('keydown keyup update blur', update);
  10005. update();
  10006. };
  10007. var domToString = function domToString(d) {
  10008. var tmp = document.createElement('div');
  10009. tmp.appendChild(d.cloneNode(true));
  10010. return tmp.innerHTML;
  10011. };
  10012. var logError = function logError(message, options) {
  10013. if (!options) options = {};
  10014. var component = "Selectize";
  10015. console.error(component + ": " + message);
  10016. if (options.explanation) {
  10017. // console.group is undefined in <IE11
  10018. if (console.group) console.group();
  10019. console.error(options.explanation);
  10020. if (console.group) console.groupEnd();
  10021. }
  10022. };
  10023. var Selectize = function Selectize($input, settings) {
  10024. var key,
  10025. i,
  10026. n,
  10027. dir,
  10028. input,
  10029. self = this;
  10030. input = $input[0];
  10031. input.selectize = self;
  10032. // detect rtl environment
  10033. var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
  10034. dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
  10035. dir = dir || $input.parents('[dir]:first').attr('dir') || '';
  10036. // setup default state
  10037. $.extend(self, {
  10038. order: 0,
  10039. settings: settings,
  10040. $input: $input,
  10041. tabIndex: $input.attr('tabindex') || '',
  10042. tagType: input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
  10043. rtl: /rtl/i.test(dir),
  10044. eventNS: '.selectize' + ++Selectize.count,
  10045. highlightedValue: null,
  10046. isOpen: false,
  10047. isDisabled: false,
  10048. isRequired: $input.is('[required]'),
  10049. isInvalid: false,
  10050. isLocked: false,
  10051. isFocused: false,
  10052. isInputHidden: false,
  10053. isSetup: false,
  10054. isShiftDown: false,
  10055. isCmdDown: false,
  10056. isCtrlDown: false,
  10057. ignoreFocus: false,
  10058. ignoreBlur: false,
  10059. ignoreHover: false,
  10060. hasOptions: false,
  10061. currentResults: null,
  10062. lastValue: '',
  10063. caretPos: 0,
  10064. loading: 0,
  10065. loadedSearches: {},
  10066. $activeOption: null,
  10067. $activeItems: [],
  10068. optgroups: {},
  10069. options: {},
  10070. userOptions: {},
  10071. items: [],
  10072. renderCache: {},
  10073. onSearchChange: settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
  10074. });
  10075. // search system
  10076. self.sifter = new Sifter(this.options, { diacritics: settings.diacritics });
  10077. // build options table
  10078. if (self.settings.options) {
  10079. for (i = 0, n = self.settings.options.length; i < n; i++) {
  10080. self.registerOption(self.settings.options[i]);
  10081. }
  10082. delete self.settings.options;
  10083. }
  10084. // build optgroup table
  10085. if (self.settings.optgroups) {
  10086. for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
  10087. self.registerOptionGroup(self.settings.optgroups[i]);
  10088. }
  10089. delete self.settings.optgroups;
  10090. }
  10091. // option-dependent defaults
  10092. self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
  10093. if (typeof self.settings.hideSelected !== 'boolean') {
  10094. self.settings.hideSelected = self.settings.mode === 'multi';
  10095. }
  10096. self.initializePlugins(self.settings.plugins);
  10097. self.setupCallbacks();
  10098. self.setupTemplates();
  10099. self.setup();
  10100. };
  10101. // mixins
  10102. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10103. MicroEvent.mixin(Selectize);
  10104. if (typeof MicroPlugin !== "undefined") {
  10105. MicroPlugin.mixin(Selectize);
  10106. } else {
  10107. logError("Dependency MicroPlugin is missing", { explanation: "Make sure you either: (1) are using the \"standalone\" " + "version of Selectize, or (2) require MicroPlugin before you " + "load Selectize." });
  10108. }
  10109. // methods
  10110. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10111. $.extend(Selectize.prototype, {
  10112. /**
  10113. * Creates all elements and sets up event bindings.
  10114. */
  10115. setup: function setup() {
  10116. var self = this;
  10117. var settings = self.settings;
  10118. var eventNS = self.eventNS;
  10119. var $window = $(window);
  10120. var $document = $(document);
  10121. var $input = self.$input;
  10122. var $wrapper;
  10123. var $control;
  10124. var $control_input;
  10125. var $dropdown;
  10126. var $dropdown_content;
  10127. var $dropdown_parent;
  10128. var inputMode;
  10129. var timeout_blur;
  10130. var timeout_focus;
  10131. var classes;
  10132. var classes_plugins;
  10133. var inputId;
  10134. inputMode = self.settings.mode;
  10135. classes = $input.attr('class') || '';
  10136. $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(inputMode);
  10137. $control = $('<div>').addClass(settings.inputClass + ' ' + classes).addClass('items').appendTo($wrapper);
  10138. $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
  10139. $dropdown_parent = $(settings.dropdownParent || $wrapper);
  10140. $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
  10141. $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
  10142. if (inputId = $input.attr('id')) {
  10143. $control_input.attr('id', inputId + '-selectized');
  10144. $("label[for='" + inputId + "']").attr('for', inputId + '-selectized');
  10145. }
  10146. if (self.settings.copyClassesToDropdown) {
  10147. $dropdown.addClass(classes);
  10148. }
  10149. $wrapper.css({
  10150. width: $input[0].style.width
  10151. });
  10152. if (self.plugins.names.length) {
  10153. classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
  10154. $wrapper.addClass(classes_plugins);
  10155. $dropdown.addClass(classes_plugins);
  10156. }
  10157. if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
  10158. $input.attr('multiple', 'multiple');
  10159. }
  10160. if (self.settings.placeholder) {
  10161. $control_input.attr('placeholder', settings.placeholder);
  10162. }
  10163. // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
  10164. if (!self.settings.splitOn && self.settings.delimiter) {
  10165. var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  10166. self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
  10167. }
  10168. if ($input.attr('autocorrect')) {
  10169. $control_input.attr('autocorrect', $input.attr('autocorrect'));
  10170. }
  10171. if ($input.attr('autocapitalize')) {
  10172. $control_input.attr('autocapitalize', $input.attr('autocapitalize'));
  10173. }
  10174. self.$wrapper = $wrapper;
  10175. self.$control = $control;
  10176. self.$control_input = $control_input;
  10177. self.$dropdown = $dropdown;
  10178. self.$dropdown_content = $dropdown_content;
  10179. $dropdown.on('mouseenter', '[data-selectable]', function () {
  10180. return self.onOptionHover.apply(self, arguments);
  10181. });
  10182. $dropdown.on('mousedown click', '[data-selectable]', function () {
  10183. return self.onOptionSelect.apply(self, arguments);
  10184. });
  10185. watchChildEvent($control, 'mousedown', '*:not(input)', function () {
  10186. return self.onItemSelect.apply(self, arguments);
  10187. });
  10188. autoGrow($control_input);
  10189. $control.on({
  10190. mousedown: function mousedown() {
  10191. return self.onMouseDown.apply(self, arguments);
  10192. },
  10193. click: function click() {
  10194. return self.onClick.apply(self, arguments);
  10195. }
  10196. });
  10197. $control_input.on({
  10198. mousedown: function mousedown(e) {
  10199. e.stopPropagation();
  10200. },
  10201. keydown: function keydown() {
  10202. return self.onKeyDown.apply(self, arguments);
  10203. },
  10204. keyup: function keyup() {
  10205. return self.onKeyUp.apply(self, arguments);
  10206. },
  10207. keypress: function keypress() {
  10208. return self.onKeyPress.apply(self, arguments);
  10209. },
  10210. resize: function resize() {
  10211. self.positionDropdown.apply(self, []);
  10212. },
  10213. blur: function blur() {
  10214. return self.onBlur.apply(self, arguments);
  10215. },
  10216. focus: function focus() {
  10217. self.ignoreBlur = false;return self.onFocus.apply(self, arguments);
  10218. },
  10219. paste: function paste() {
  10220. return self.onPaste.apply(self, arguments);
  10221. }
  10222. });
  10223. $document.on('keydown' + eventNS, function (e) {
  10224. self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
  10225. self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
  10226. self.isShiftDown = e.shiftKey;
  10227. });
  10228. $document.on('keyup' + eventNS, function (e) {
  10229. if (e.keyCode === KEY_CTRL) self.isCtrlDown = false;
  10230. if (e.keyCode === KEY_SHIFT) self.isShiftDown = false;
  10231. if (e.keyCode === KEY_CMD) self.isCmdDown = false;
  10232. });
  10233. $document.on('mousedown' + eventNS, function (e) {
  10234. if (self.isFocused) {
  10235. // prevent events on the dropdown scrollbar from causing the control to blur
  10236. if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
  10237. return false;
  10238. }
  10239. // blur on click outside
  10240. if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
  10241. self.blur(e.target);
  10242. }
  10243. }
  10244. });
  10245. $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function () {
  10246. if (self.isOpen) {
  10247. self.positionDropdown.apply(self, arguments);
  10248. }
  10249. });
  10250. $window.on('mousemove' + eventNS, function () {
  10251. self.ignoreHover = false;
  10252. });
  10253. // store original children and tab index so that they can be
  10254. // restored when the destroy() method is called.
  10255. this.revertSettings = {
  10256. $children: $input.children().detach(),
  10257. tabindex: $input.attr('tabindex')
  10258. };
  10259. $input.attr('tabindex', -1).hide().after(self.$wrapper);
  10260. if ($.isArray(settings.items)) {
  10261. self.setValue(settings.items);
  10262. delete settings.items;
  10263. }
  10264. // feature detect for the validation API
  10265. if (SUPPORTS_VALIDITY_API) {
  10266. $input.on('invalid' + eventNS, function (e) {
  10267. e.preventDefault();
  10268. self.isInvalid = true;
  10269. self.refreshState();
  10270. });
  10271. }
  10272. self.updateOriginalInput();
  10273. self.refreshItems();
  10274. self.refreshState();
  10275. self.updatePlaceholder();
  10276. self.isSetup = true;
  10277. if ($input.is(':disabled')) {
  10278. self.disable();
  10279. }
  10280. self.on('change', this.onChange);
  10281. $input.data('selectize', self);
  10282. $input.addClass('selectized');
  10283. self.trigger('initialize');
  10284. // preload options
  10285. if (settings.preload === true) {
  10286. self.onSearchChange('');
  10287. }
  10288. },
  10289. /**
  10290. * Sets up default rendering functions.
  10291. */
  10292. setupTemplates: function setupTemplates() {
  10293. var self = this;
  10294. var field_label = self.settings.labelField;
  10295. var field_optgroup = self.settings.optgroupLabelField;
  10296. var templates = {
  10297. 'optgroup': function optgroup(data) {
  10298. return '<div class="optgroup">' + data.html + '</div>';
  10299. },
  10300. 'optgroup_header': function optgroup_header(data, escape) {
  10301. return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
  10302. },
  10303. 'option': function option(data, escape) {
  10304. return '<div class="option">' + escape(data[field_label]) + '</div>';
  10305. },
  10306. 'item': function item(data, escape) {
  10307. return '<div class="item">' + escape(data[field_label]) + '</div>';
  10308. },
  10309. 'option_create': function option_create(data, escape) {
  10310. return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
  10311. }
  10312. };
  10313. self.settings.render = $.extend({}, templates, self.settings.render);
  10314. },
  10315. /**
  10316. * Maps fired events to callbacks provided
  10317. * in the settings used when creating the control.
  10318. */
  10319. setupCallbacks: function setupCallbacks() {
  10320. var key,
  10321. fn,
  10322. callbacks = {
  10323. 'initialize': 'onInitialize',
  10324. 'change': 'onChange',
  10325. 'item_add': 'onItemAdd',
  10326. 'item_remove': 'onItemRemove',
  10327. 'clear': 'onClear',
  10328. 'option_add': 'onOptionAdd',
  10329. 'option_remove': 'onOptionRemove',
  10330. 'option_clear': 'onOptionClear',
  10331. 'optgroup_add': 'onOptionGroupAdd',
  10332. 'optgroup_remove': 'onOptionGroupRemove',
  10333. 'optgroup_clear': 'onOptionGroupClear',
  10334. 'dropdown_open': 'onDropdownOpen',
  10335. 'dropdown_close': 'onDropdownClose',
  10336. 'type': 'onType',
  10337. 'load': 'onLoad',
  10338. 'focus': 'onFocus',
  10339. 'blur': 'onBlur'
  10340. };
  10341. for (key in callbacks) {
  10342. if (callbacks.hasOwnProperty(key)) {
  10343. fn = this.settings[callbacks[key]];
  10344. if (fn) this.on(key, fn);
  10345. }
  10346. }
  10347. },
  10348. /**
  10349. * Triggered when the main control element
  10350. * has a click event.
  10351. *
  10352. * @param {object} e
  10353. * @return {boolean}
  10354. */
  10355. onClick: function onClick(e) {
  10356. var self = this;
  10357. // necessary for mobile webkit devices (manual focus triggering
  10358. // is ignored unless invoked within a click event)
  10359. if (!self.isFocused) {
  10360. self.focus();
  10361. e.preventDefault();
  10362. }
  10363. },
  10364. /**
  10365. * Triggered when the main control element
  10366. * has a mouse down event.
  10367. *
  10368. * @param {object} e
  10369. * @return {boolean}
  10370. */
  10371. onMouseDown: function onMouseDown(e) {
  10372. var self = this;
  10373. var defaultPrevented = e.isDefaultPrevented();
  10374. var $target = $(e.target);
  10375. if (self.isFocused) {
  10376. // retain focus by preventing native handling. if the
  10377. // event target is the input it should not be modified.
  10378. // otherwise, text selection within the input won't work.
  10379. if (e.target !== self.$control_input[0]) {
  10380. if (self.settings.mode === 'single') {
  10381. // toggle dropdown
  10382. self.isOpen ? self.close() : self.open();
  10383. } else if (!defaultPrevented) {
  10384. self.setActiveItem(null);
  10385. }
  10386. return false;
  10387. }
  10388. } else {
  10389. // give control focus
  10390. if (!defaultPrevented) {
  10391. window.setTimeout(function () {
  10392. self.focus();
  10393. }, 0);
  10394. }
  10395. }
  10396. },
  10397. /**
  10398. * Triggered when the value of the control has been changed.
  10399. * This should propagate the event to the original DOM
  10400. * input / select element.
  10401. */
  10402. onChange: function onChange() {
  10403. this.$input.trigger('change');
  10404. },
  10405. /**
  10406. * Triggered on <input> paste.
  10407. *
  10408. * @param {object} e
  10409. * @returns {boolean}
  10410. */
  10411. onPaste: function onPaste(e) {
  10412. var self = this;
  10413. if (self.isFull() || self.isInputHidden || self.isLocked) {
  10414. e.preventDefault();
  10415. return;
  10416. }
  10417. // If a regex or string is included, this will split the pasted
  10418. // input and create Items for each separate value
  10419. if (self.settings.splitOn) {
  10420. // Wait for pasted text to be recognized in value
  10421. setTimeout(function () {
  10422. var pastedText = self.$control_input.val();
  10423. if (!pastedText.match(self.settings.splitOn)) {
  10424. return;
  10425. }
  10426. var splitInput = $.trim(pastedText).split(self.settings.splitOn);
  10427. for (var i = 0, n = splitInput.length; i < n; i++) {
  10428. self.createItem(splitInput[i]);
  10429. }
  10430. }, 0);
  10431. }
  10432. },
  10433. /**
  10434. * Triggered on <input> keypress.
  10435. *
  10436. * @param {object} e
  10437. * @returns {boolean}
  10438. */
  10439. onKeyPress: function onKeyPress(e) {
  10440. if (this.isLocked) return e && e.preventDefault();
  10441. var character = String.fromCharCode(e.keyCode || e.which);
  10442. if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
  10443. this.createItem();
  10444. e.preventDefault();
  10445. return false;
  10446. }
  10447. },
  10448. /**
  10449. * Triggered on <input> keydown.
  10450. *
  10451. * @param {object} e
  10452. * @returns {boolean}
  10453. */
  10454. onKeyDown: function onKeyDown(e) {
  10455. var isInput = e.target === this.$control_input[0];
  10456. var self = this;
  10457. if (self.isLocked) {
  10458. if (e.keyCode !== KEY_TAB) {
  10459. e.preventDefault();
  10460. }
  10461. return;
  10462. }
  10463. switch (e.keyCode) {
  10464. case KEY_A:
  10465. if (self.isCmdDown) {
  10466. self.selectAll();
  10467. return;
  10468. }
  10469. break;
  10470. case KEY_ESC:
  10471. if (self.isOpen) {
  10472. e.preventDefault();
  10473. e.stopPropagation();
  10474. self.close();
  10475. }
  10476. return;
  10477. case KEY_N:
  10478. if (!e.ctrlKey || e.altKey) break;
  10479. case KEY_DOWN:
  10480. if (!self.isOpen && self.hasOptions) {
  10481. self.open();
  10482. } else if (self.$activeOption) {
  10483. self.ignoreHover = true;
  10484. var $next = self.getAdjacentOption(self.$activeOption, 1);
  10485. if ($next.length) self.setActiveOption($next, true, true);
  10486. }
  10487. e.preventDefault();
  10488. return;
  10489. case KEY_P:
  10490. if (!e.ctrlKey || e.altKey) break;
  10491. case KEY_UP:
  10492. if (self.$activeOption) {
  10493. self.ignoreHover = true;
  10494. var $prev = self.getAdjacentOption(self.$activeOption, -1);
  10495. if ($prev.length) self.setActiveOption($prev, true, true);
  10496. }
  10497. e.preventDefault();
  10498. return;
  10499. case KEY_RETURN:
  10500. if (self.isOpen && self.$activeOption) {
  10501. self.onOptionSelect({ currentTarget: self.$activeOption });
  10502. e.preventDefault();
  10503. }
  10504. return;
  10505. case KEY_LEFT:
  10506. self.advanceSelection(-1, e);
  10507. return;
  10508. case KEY_RIGHT:
  10509. self.advanceSelection(1, e);
  10510. return;
  10511. case KEY_TAB:
  10512. if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
  10513. self.onOptionSelect({ currentTarget: self.$activeOption });
  10514. // Default behaviour is to jump to the next field, we only want this
  10515. // if the current field doesn't accept any more entries
  10516. if (!self.isFull()) {
  10517. e.preventDefault();
  10518. }
  10519. }
  10520. if (self.settings.create && self.createItem()) {
  10521. e.preventDefault();
  10522. }
  10523. return;
  10524. case KEY_BACKSPACE:
  10525. case KEY_DELETE:
  10526. self.deleteSelection(e);
  10527. return;
  10528. }
  10529. if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
  10530. e.preventDefault();
  10531. return;
  10532. }
  10533. },
  10534. /**
  10535. * Triggered on <input> keyup.
  10536. *
  10537. * @param {object} e
  10538. * @returns {boolean}
  10539. */
  10540. onKeyUp: function onKeyUp(e) {
  10541. var self = this;
  10542. if (self.isLocked) return e && e.preventDefault();
  10543. var value = self.$control_input.val() || '';
  10544. if (self.lastValue !== value) {
  10545. self.lastValue = value;
  10546. self.onSearchChange(value);
  10547. self.refreshOptions();
  10548. self.trigger('type', value);
  10549. }
  10550. },
  10551. /**
  10552. * Invokes the user-provide option provider / loader.
  10553. *
  10554. * Note: this function is debounced in the Selectize
  10555. * constructor (by `settings.loadThrottle` milliseconds)
  10556. *
  10557. * @param {string} value
  10558. */
  10559. onSearchChange: function onSearchChange(value) {
  10560. var self = this;
  10561. var fn = self.settings.load;
  10562. if (!fn) return;
  10563. if (self.loadedSearches.hasOwnProperty(value)) return;
  10564. self.loadedSearches[value] = true;
  10565. self.load(function (callback) {
  10566. fn.apply(self, [value, callback]);
  10567. });
  10568. },
  10569. /**
  10570. * Triggered on <input> focus.
  10571. *
  10572. * @param {object} e (optional)
  10573. * @returns {boolean}
  10574. */
  10575. onFocus: function onFocus(e) {
  10576. var self = this;
  10577. var wasFocused = self.isFocused;
  10578. if (self.isDisabled) {
  10579. self.blur();
  10580. e && e.preventDefault();
  10581. return false;
  10582. }
  10583. if (self.ignoreFocus) return;
  10584. self.isFocused = true;
  10585. if (self.settings.preload === 'focus') self.onSearchChange('');
  10586. if (!wasFocused) self.trigger('focus');
  10587. if (!self.$activeItems.length) {
  10588. self.showInput();
  10589. self.setActiveItem(null);
  10590. self.refreshOptions(!!self.settings.openOnFocus);
  10591. }
  10592. self.refreshState();
  10593. },
  10594. /**
  10595. * Triggered on <input> blur.
  10596. *
  10597. * @param {object} e
  10598. * @param {Element} dest
  10599. */
  10600. onBlur: function onBlur(e, dest) {
  10601. var self = this;
  10602. if (!self.isFocused) return;
  10603. self.isFocused = false;
  10604. if (self.ignoreFocus) {
  10605. return;
  10606. } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
  10607. // necessary to prevent IE closing the dropdown when the scrollbar is clicked
  10608. self.ignoreBlur = true;
  10609. self.onFocus(e);
  10610. return;
  10611. }
  10612. var deactivate = function deactivate() {
  10613. self.close();
  10614. self.setTextboxValue('');
  10615. self.setActiveItem(null);
  10616. self.setActiveOption(null);
  10617. self.setCaret(self.items.length);
  10618. self.refreshState();
  10619. // IE11 bug: element still marked as active
  10620. dest && dest.focus && dest.focus();
  10621. self.ignoreFocus = false;
  10622. self.trigger('blur');
  10623. };
  10624. self.ignoreFocus = true;
  10625. if (self.settings.create && self.settings.createOnBlur) {
  10626. self.createItem(null, false, deactivate);
  10627. } else {
  10628. deactivate();
  10629. }
  10630. },
  10631. /**
  10632. * Triggered when the user rolls over
  10633. * an option in the autocomplete dropdown menu.
  10634. *
  10635. * @param {object} e
  10636. * @returns {boolean}
  10637. */
  10638. onOptionHover: function onOptionHover(e) {
  10639. if (this.ignoreHover) return;
  10640. this.setActiveOption(e.currentTarget, false);
  10641. },
  10642. /**
  10643. * Triggered when the user clicks on an option
  10644. * in the autocomplete dropdown menu.
  10645. *
  10646. * @param {object} e
  10647. * @returns {boolean}
  10648. */
  10649. onOptionSelect: function onOptionSelect(e) {
  10650. var value,
  10651. $target,
  10652. $option,
  10653. self = this;
  10654. if (e.preventDefault) {
  10655. e.preventDefault();
  10656. e.stopPropagation();
  10657. }
  10658. $target = $(e.currentTarget);
  10659. if ($target.hasClass('create')) {
  10660. self.createItem(null, function () {
  10661. if (self.settings.closeAfterSelect) {
  10662. self.close();
  10663. }
  10664. });
  10665. } else {
  10666. value = $target.attr('data-value');
  10667. if (typeof value !== 'undefined') {
  10668. self.lastQuery = null;
  10669. self.setTextboxValue('');
  10670. self.addItem(value);
  10671. if (self.settings.closeAfterSelect) {
  10672. self.close();
  10673. } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
  10674. self.setActiveOption(self.getOption(value));
  10675. }
  10676. }
  10677. }
  10678. },
  10679. /**
  10680. * Triggered when the user clicks on an item
  10681. * that has been selected.
  10682. *
  10683. * @param {object} e
  10684. * @returns {boolean}
  10685. */
  10686. onItemSelect: function onItemSelect(e) {
  10687. var self = this;
  10688. if (self.isLocked) return;
  10689. if (self.settings.mode === 'multi') {
  10690. e.preventDefault();
  10691. self.setActiveItem(e.currentTarget, e);
  10692. }
  10693. },
  10694. /**
  10695. * Invokes the provided method that provides
  10696. * results to a callback---which are then added
  10697. * as options to the control.
  10698. *
  10699. * @param {function} fn
  10700. */
  10701. load: function load(fn) {
  10702. var self = this;
  10703. var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
  10704. self.loading++;
  10705. fn.apply(self, [function (results) {
  10706. self.loading = Math.max(self.loading - 1, 0);
  10707. if (results && results.length) {
  10708. self.addOption(results);
  10709. self.refreshOptions(self.isFocused && !self.isInputHidden);
  10710. }
  10711. if (!self.loading) {
  10712. $wrapper.removeClass(self.settings.loadingClass);
  10713. }
  10714. self.trigger('load', results);
  10715. }]);
  10716. },
  10717. /**
  10718. * Sets the input field of the control to the specified value.
  10719. *
  10720. * @param {string} value
  10721. */
  10722. setTextboxValue: function setTextboxValue(value) {
  10723. var $input = this.$control_input;
  10724. var changed = $input.val() !== value;
  10725. if (changed) {
  10726. $input.val(value).triggerHandler('update');
  10727. this.lastValue = value;
  10728. }
  10729. },
  10730. /**
  10731. * Returns the value of the control. If multiple items
  10732. * can be selected (e.g. <select multiple>), this returns
  10733. * an array. If only one item can be selected, this
  10734. * returns a string.
  10735. *
  10736. * @returns {mixed}
  10737. */
  10738. getValue: function getValue() {
  10739. if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
  10740. return this.items;
  10741. } else {
  10742. return this.items.join(this.settings.delimiter);
  10743. }
  10744. },
  10745. /**
  10746. * Resets the selected items to the given value.
  10747. *
  10748. * @param {mixed} value
  10749. */
  10750. setValue: function setValue(value, silent) {
  10751. var events = silent ? [] : ['change'];
  10752. debounce_events(this, events, function () {
  10753. this.clear(silent);
  10754. this.addItems(value, silent);
  10755. });
  10756. },
  10757. /**
  10758. * Sets the selected item.
  10759. *
  10760. * @param {object} $item
  10761. * @param {object} e (optional)
  10762. */
  10763. setActiveItem: function setActiveItem($item, e) {
  10764. var self = this;
  10765. var eventName;
  10766. var i, idx, begin, end, item, swap;
  10767. var $last;
  10768. if (self.settings.mode === 'single') return;
  10769. $item = $($item);
  10770. // clear the active selection
  10771. if (!$item.length) {
  10772. $(self.$activeItems).removeClass('active');
  10773. self.$activeItems = [];
  10774. if (self.isFocused) {
  10775. self.showInput();
  10776. }
  10777. return;
  10778. }
  10779. // modify selection
  10780. eventName = e && e.type.toLowerCase();
  10781. if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
  10782. $last = self.$control.children('.active:last');
  10783. begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
  10784. end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
  10785. if (begin > end) {
  10786. swap = begin;
  10787. begin = end;
  10788. end = swap;
  10789. }
  10790. for (i = begin; i <= end; i++) {
  10791. item = self.$control[0].childNodes[i];
  10792. if (self.$activeItems.indexOf(item) === -1) {
  10793. $(item).addClass('active');
  10794. self.$activeItems.push(item);
  10795. }
  10796. }
  10797. e.preventDefault();
  10798. } else if (eventName === 'mousedown' && self.isCtrlDown || eventName === 'keydown' && this.isShiftDown) {
  10799. if ($item.hasClass('active')) {
  10800. idx = self.$activeItems.indexOf($item[0]);
  10801. self.$activeItems.splice(idx, 1);
  10802. $item.removeClass('active');
  10803. } else {
  10804. self.$activeItems.push($item.addClass('active')[0]);
  10805. }
  10806. } else {
  10807. $(self.$activeItems).removeClass('active');
  10808. self.$activeItems = [$item.addClass('active')[0]];
  10809. }
  10810. // ensure control has focus
  10811. self.hideInput();
  10812. if (!this.isFocused) {
  10813. self.focus();
  10814. }
  10815. },
  10816. /**
  10817. * Sets the selected item in the dropdown menu
  10818. * of available options.
  10819. *
  10820. * @param {object} $object
  10821. * @param {boolean} scroll
  10822. * @param {boolean} animate
  10823. */
  10824. setActiveOption: function setActiveOption($option, scroll, animate) {
  10825. var height_menu, height_item, y;
  10826. var scroll_top, scroll_bottom;
  10827. var self = this;
  10828. if (self.$activeOption) self.$activeOption.removeClass('active');
  10829. self.$activeOption = null;
  10830. $option = $($option);
  10831. if (!$option.length) return;
  10832. self.$activeOption = $option.addClass('active');
  10833. if (scroll || !isset(scroll)) {
  10834. height_menu = self.$dropdown_content.height();
  10835. height_item = self.$activeOption.outerHeight(true);
  10836. scroll = self.$dropdown_content.scrollTop() || 0;
  10837. y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
  10838. scroll_top = y;
  10839. scroll_bottom = y - height_menu + height_item;
  10840. if (y + height_item > height_menu + scroll) {
  10841. self.$dropdown_content.stop().animate({ scrollTop: scroll_bottom }, animate ? self.settings.scrollDuration : 0);
  10842. } else if (y < scroll) {
  10843. self.$dropdown_content.stop().animate({ scrollTop: scroll_top }, animate ? self.settings.scrollDuration : 0);
  10844. }
  10845. }
  10846. },
  10847. /**
  10848. * Selects all items (CTRL + A).
  10849. */
  10850. selectAll: function selectAll() {
  10851. var self = this;
  10852. if (self.settings.mode === 'single') return;
  10853. self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
  10854. if (self.$activeItems.length) {
  10855. self.hideInput();
  10856. self.close();
  10857. }
  10858. self.focus();
  10859. },
  10860. /**
  10861. * Hides the input element out of view, while
  10862. * retaining its focus.
  10863. */
  10864. hideInput: function hideInput() {
  10865. var self = this;
  10866. self.setTextboxValue('');
  10867. self.$control_input.css({ opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000 });
  10868. self.isInputHidden = true;
  10869. },
  10870. /**
  10871. * Restores input visibility.
  10872. */
  10873. showInput: function showInput() {
  10874. this.$control_input.css({ opacity: 1, position: 'relative', left: 0 });
  10875. this.isInputHidden = false;
  10876. },
  10877. /**
  10878. * Gives the control focus.
  10879. */
  10880. focus: function focus() {
  10881. var self = this;
  10882. if (self.isDisabled) return;
  10883. self.ignoreFocus = true;
  10884. self.$control_input[0].focus();
  10885. window.setTimeout(function () {
  10886. self.ignoreFocus = false;
  10887. self.onFocus();
  10888. }, 0);
  10889. },
  10890. /**
  10891. * Forces the control out of focus.
  10892. *
  10893. * @param {Element} dest
  10894. */
  10895. blur: function blur(dest) {
  10896. this.$control_input[0].blur();
  10897. this.onBlur(null, dest);
  10898. },
  10899. /**
  10900. * Returns a function that scores an object
  10901. * to show how good of a match it is to the
  10902. * provided query.
  10903. *
  10904. * @param {string} query
  10905. * @param {object} options
  10906. * @return {function}
  10907. */
  10908. getScoreFunction: function getScoreFunction(query) {
  10909. return this.sifter.getScoreFunction(query, this.getSearchOptions());
  10910. },
  10911. /**
  10912. * Returns search options for sifter (the system
  10913. * for scoring and sorting results).
  10914. *
  10915. * @see https://github.com/brianreavis/sifter.js
  10916. * @return {object}
  10917. */
  10918. getSearchOptions: function getSearchOptions() {
  10919. var settings = this.settings;
  10920. var sort = settings.sortField;
  10921. if (typeof sort === 'string') {
  10922. sort = [{ field: sort }];
  10923. }
  10924. return {
  10925. fields: settings.searchField,
  10926. conjunction: settings.searchConjunction,
  10927. sort: sort
  10928. };
  10929. },
  10930. /**
  10931. * Searches through available options and returns
  10932. * a sorted array of matches.
  10933. *
  10934. * Returns an object containing:
  10935. *
  10936. * - query {string}
  10937. * - tokens {array}
  10938. * - total {int}
  10939. * - items {array}
  10940. *
  10941. * @param {string} query
  10942. * @returns {object}
  10943. */
  10944. search: function search(query) {
  10945. var i, value, score, result, calculateScore;
  10946. var self = this;
  10947. var settings = self.settings;
  10948. var options = this.getSearchOptions();
  10949. // validate user-provided result scoring function
  10950. if (settings.score) {
  10951. calculateScore = self.settings.score.apply(this, [query]);
  10952. if (typeof calculateScore !== 'function') {
  10953. throw new Error('Selectize "score" setting must be a function that returns a function');
  10954. }
  10955. }
  10956. // perform search
  10957. if (query !== self.lastQuery) {
  10958. self.lastQuery = query;
  10959. result = self.sifter.search(query, $.extend(options, { score: calculateScore }));
  10960. self.currentResults = result;
  10961. } else {
  10962. result = $.extend(true, {}, self.currentResults);
  10963. }
  10964. // filter out selected items
  10965. if (settings.hideSelected) {
  10966. for (i = result.items.length - 1; i >= 0; i--) {
  10967. if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
  10968. result.items.splice(i, 1);
  10969. }
  10970. }
  10971. }
  10972. return result;
  10973. },
  10974. /**
  10975. * Refreshes the list of available options shown
  10976. * in the autocomplete dropdown menu.
  10977. *
  10978. * @param {boolean} triggerDropdown
  10979. */
  10980. refreshOptions: function refreshOptions(triggerDropdown) {
  10981. var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
  10982. var $active, $active_before, $create;
  10983. if (typeof triggerDropdown === 'undefined') {
  10984. triggerDropdown = true;
  10985. }
  10986. var self = this;
  10987. var query = $.trim(self.$control_input.val());
  10988. var results = self.search(query);
  10989. var $dropdown_content = self.$dropdown_content;
  10990. var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
  10991. // build markup
  10992. n = results.items.length;
  10993. if (typeof self.settings.maxOptions === 'number') {
  10994. n = Math.min(n, self.settings.maxOptions);
  10995. }
  10996. // render and group available options individually
  10997. groups = {};
  10998. groups_order = [];
  10999. for (i = 0; i < n; i++) {
  11000. option = self.options[results.items[i].id];
  11001. option_html = self.render('option', option);
  11002. optgroup = option[self.settings.optgroupField] || '';
  11003. optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
  11004. for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
  11005. optgroup = optgroups[j];
  11006. if (!self.optgroups.hasOwnProperty(optgroup)) {
  11007. optgroup = '';
  11008. }
  11009. if (!groups.hasOwnProperty(optgroup)) {
  11010. groups[optgroup] = document.createDocumentFragment();
  11011. groups_order.push(optgroup);
  11012. }
  11013. groups[optgroup].appendChild(option_html);
  11014. }
  11015. }
  11016. // sort optgroups
  11017. if (this.settings.lockOptgroupOrder) {
  11018. groups_order.sort(function (a, b) {
  11019. var a_order = self.optgroups[a].$order || 0;
  11020. var b_order = self.optgroups[b].$order || 0;
  11021. return a_order - b_order;
  11022. });
  11023. }
  11024. // render optgroup headers & join groups
  11025. html = document.createDocumentFragment();
  11026. for (i = 0, n = groups_order.length; i < n; i++) {
  11027. optgroup = groups_order[i];
  11028. if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
  11029. // render the optgroup header and options within it,
  11030. // then pass it to the wrapper template
  11031. html_children = document.createDocumentFragment();
  11032. html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
  11033. html_children.appendChild(groups[optgroup]);
  11034. html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
  11035. html: domToString(html_children),
  11036. dom: html_children
  11037. })));
  11038. } else {
  11039. html.appendChild(groups[optgroup]);
  11040. }
  11041. }
  11042. $dropdown_content.html(html);
  11043. // highlight matching terms inline
  11044. if (self.settings.highlight && results.query.length && results.tokens.length) {
  11045. $dropdown_content.removeHighlight();
  11046. for (i = 0, n = results.tokens.length; i < n; i++) {
  11047. highlight($dropdown_content, results.tokens[i].regex);
  11048. }
  11049. }
  11050. // add "selected" class to selected options
  11051. if (!self.settings.hideSelected) {
  11052. for (i = 0, n = self.items.length; i < n; i++) {
  11053. self.getOption(self.items[i]).addClass('selected');
  11054. }
  11055. }
  11056. // add create option
  11057. has_create_option = self.canCreate(query);
  11058. if (has_create_option) {
  11059. $dropdown_content.prepend(self.render('option_create', { input: query }));
  11060. $create = $($dropdown_content[0].childNodes[0]);
  11061. }
  11062. // activate
  11063. self.hasOptions = results.items.length > 0 || has_create_option;
  11064. if (self.hasOptions) {
  11065. if (results.items.length > 0) {
  11066. $active_before = active_before && self.getOption(active_before);
  11067. if ($active_before && $active_before.length) {
  11068. $active = $active_before;
  11069. } else if (self.settings.mode === 'single' && self.items.length) {
  11070. $active = self.getOption(self.items[0]);
  11071. }
  11072. if (!$active || !$active.length) {
  11073. if ($create && !self.settings.addPrecedence) {
  11074. $active = self.getAdjacentOption($create, 1);
  11075. } else {
  11076. $active = $dropdown_content.find('[data-selectable]:first');
  11077. }
  11078. }
  11079. } else {
  11080. $active = $create;
  11081. }
  11082. self.setActiveOption($active);
  11083. if (triggerDropdown && !self.isOpen) {
  11084. self.open();
  11085. }
  11086. } else {
  11087. self.setActiveOption(null);
  11088. if (triggerDropdown && self.isOpen) {
  11089. self.close();
  11090. }
  11091. }
  11092. },
  11093. /**
  11094. * Adds an available option. If it already exists,
  11095. * nothing will happen. Note: this does not refresh
  11096. * the options list dropdown (use `refreshOptions`
  11097. * for that).
  11098. *
  11099. * Usage:
  11100. *
  11101. * this.addOption(data)
  11102. *
  11103. * @param {object|array} data
  11104. */
  11105. addOption: function addOption(data) {
  11106. var i,
  11107. n,
  11108. value,
  11109. self = this;
  11110. if ($.isArray(data)) {
  11111. for (i = 0, n = data.length; i < n; i++) {
  11112. self.addOption(data[i]);
  11113. }
  11114. return;
  11115. }
  11116. if (value = self.registerOption(data)) {
  11117. self.userOptions[value] = true;
  11118. self.lastQuery = null;
  11119. self.trigger('option_add', value, data);
  11120. }
  11121. },
  11122. /**
  11123. * Registers an option to the pool of options.
  11124. *
  11125. * @param {object} data
  11126. * @return {boolean|string}
  11127. */
  11128. registerOption: function registerOption(data) {
  11129. var key = hash_key(data[this.settings.valueField]);
  11130. if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
  11131. data.$order = data.$order || ++this.order;
  11132. this.options[key] = data;
  11133. return key;
  11134. },
  11135. /**
  11136. * Registers an option group to the pool of option groups.
  11137. *
  11138. * @param {object} data
  11139. * @return {boolean|string}
  11140. */
  11141. registerOptionGroup: function registerOptionGroup(data) {
  11142. var key = hash_key(data[this.settings.optgroupValueField]);
  11143. if (!key) return false;
  11144. data.$order = data.$order || ++this.order;
  11145. this.optgroups[key] = data;
  11146. return key;
  11147. },
  11148. /**
  11149. * Registers a new optgroup for options
  11150. * to be bucketed into.
  11151. *
  11152. * @param {string} id
  11153. * @param {object} data
  11154. */
  11155. addOptionGroup: function addOptionGroup(id, data) {
  11156. data[this.settings.optgroupValueField] = id;
  11157. if (id = this.registerOptionGroup(data)) {
  11158. this.trigger('optgroup_add', id, data);
  11159. }
  11160. },
  11161. /**
  11162. * Removes an existing option group.
  11163. *
  11164. * @param {string} id
  11165. */
  11166. removeOptionGroup: function removeOptionGroup(id) {
  11167. if (this.optgroups.hasOwnProperty(id)) {
  11168. delete this.optgroups[id];
  11169. this.renderCache = {};
  11170. this.trigger('optgroup_remove', id);
  11171. }
  11172. },
  11173. /**
  11174. * Clears all existing option groups.
  11175. */
  11176. clearOptionGroups: function clearOptionGroups() {
  11177. this.optgroups = {};
  11178. this.renderCache = {};
  11179. this.trigger('optgroup_clear');
  11180. },
  11181. /**
  11182. * Updates an option available for selection. If
  11183. * it is visible in the selected items or options
  11184. * dropdown, it will be re-rendered automatically.
  11185. *
  11186. * @param {string} value
  11187. * @param {object} data
  11188. */
  11189. updateOption: function updateOption(value, data) {
  11190. var self = this;
  11191. var $item, $item_new;
  11192. var value_new, index_item, cache_items, cache_options, order_old;
  11193. value = hash_key(value);
  11194. value_new = hash_key(data[self.settings.valueField]);
  11195. // sanity checks
  11196. if (value === null) return;
  11197. if (!self.options.hasOwnProperty(value)) return;
  11198. if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
  11199. order_old = self.options[value].$order;
  11200. // update references
  11201. if (value_new !== value) {
  11202. delete self.options[value];
  11203. index_item = self.items.indexOf(value);
  11204. if (index_item !== -1) {
  11205. self.items.splice(index_item, 1, value_new);
  11206. }
  11207. }
  11208. data.$order = data.$order || order_old;
  11209. self.options[value_new] = data;
  11210. // invalidate render cache
  11211. cache_items = self.renderCache['item'];
  11212. cache_options = self.renderCache['option'];
  11213. if (cache_items) {
  11214. delete cache_items[value];
  11215. delete cache_items[value_new];
  11216. }
  11217. if (cache_options) {
  11218. delete cache_options[value];
  11219. delete cache_options[value_new];
  11220. }
  11221. // update the item if it's selected
  11222. if (self.items.indexOf(value_new) !== -1) {
  11223. $item = self.getItem(value);
  11224. $item_new = $(self.render('item', data));
  11225. if ($item.hasClass('active')) $item_new.addClass('active');
  11226. $item.replaceWith($item_new);
  11227. }
  11228. // invalidate last query because we might have updated the sortField
  11229. self.lastQuery = null;
  11230. // update dropdown contents
  11231. if (self.isOpen) {
  11232. self.refreshOptions(false);
  11233. }
  11234. },
  11235. /**
  11236. * Removes a single option.
  11237. *
  11238. * @param {string} value
  11239. * @param {boolean} silent
  11240. */
  11241. removeOption: function removeOption(value, silent) {
  11242. var self = this;
  11243. value = hash_key(value);
  11244. var cache_items = self.renderCache['item'];
  11245. var cache_options = self.renderCache['option'];
  11246. if (cache_items) delete cache_items[value];
  11247. if (cache_options) delete cache_options[value];
  11248. delete self.userOptions[value];
  11249. delete self.options[value];
  11250. self.lastQuery = null;
  11251. self.trigger('option_remove', value);
  11252. self.removeItem(value, silent);
  11253. },
  11254. /**
  11255. * Clears all options.
  11256. */
  11257. clearOptions: function clearOptions() {
  11258. var self = this;
  11259. self.loadedSearches = {};
  11260. self.userOptions = {};
  11261. self.renderCache = {};
  11262. self.options = self.sifter.items = {};
  11263. self.lastQuery = null;
  11264. self.trigger('option_clear');
  11265. self.clear();
  11266. },
  11267. /**
  11268. * Returns the jQuery element of the option
  11269. * matching the given value.
  11270. *
  11271. * @param {string} value
  11272. * @returns {object}
  11273. */
  11274. getOption: function getOption(value) {
  11275. return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
  11276. },
  11277. /**
  11278. * Returns the jQuery element of the next or
  11279. * previous selectable option.
  11280. *
  11281. * @param {object} $option
  11282. * @param {int} direction can be 1 for next or -1 for previous
  11283. * @return {object}
  11284. */
  11285. getAdjacentOption: function getAdjacentOption($option, direction) {
  11286. var $options = this.$dropdown.find('[data-selectable]');
  11287. var index = $options.index($option) + direction;
  11288. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  11289. },
  11290. /**
  11291. * Finds the first element with a "data-value" attribute
  11292. * that matches the given value.
  11293. *
  11294. * @param {mixed} value
  11295. * @param {object} $els
  11296. * @return {object}
  11297. */
  11298. getElementWithValue: function getElementWithValue(value, $els) {
  11299. value = hash_key(value);
  11300. if (typeof value !== 'undefined' && value !== null) {
  11301. for (var i = 0, n = $els.length; i < n; i++) {
  11302. if ($els[i].getAttribute('data-value') === value) {
  11303. return $($els[i]);
  11304. }
  11305. }
  11306. }
  11307. return $();
  11308. },
  11309. /**
  11310. * Returns the jQuery element of the item
  11311. * matching the given value.
  11312. *
  11313. * @param {string} value
  11314. * @returns {object}
  11315. */
  11316. getItem: function getItem(value) {
  11317. return this.getElementWithValue(value, this.$control.children());
  11318. },
  11319. /**
  11320. * "Selects" multiple items at once. Adds them to the list
  11321. * at the current caret position.
  11322. *
  11323. * @param {string} value
  11324. * @param {boolean} silent
  11325. */
  11326. addItems: function addItems(values, silent) {
  11327. var items = $.isArray(values) ? values : [values];
  11328. for (var i = 0, n = items.length; i < n; i++) {
  11329. this.isPending = i < n - 1;
  11330. this.addItem(items[i], silent);
  11331. }
  11332. },
  11333. /**
  11334. * "Selects" an item. Adds it to the list
  11335. * at the current caret position.
  11336. *
  11337. * @param {string} value
  11338. * @param {boolean} silent
  11339. */
  11340. addItem: function addItem(value, silent) {
  11341. var events = silent ? [] : ['change'];
  11342. debounce_events(this, events, function () {
  11343. var $item, $option, $options;
  11344. var self = this;
  11345. var inputMode = self.settings.mode;
  11346. var i, active, value_next, wasFull;
  11347. value = hash_key(value);
  11348. if (self.items.indexOf(value) !== -1) {
  11349. if (inputMode === 'single') self.close();
  11350. return;
  11351. }
  11352. if (!self.options.hasOwnProperty(value)) return;
  11353. if (inputMode === 'single') self.clear(silent);
  11354. if (inputMode === 'multi' && self.isFull()) return;
  11355. $item = $(self.render('item', self.options[value]));
  11356. wasFull = self.isFull();
  11357. self.items.splice(self.caretPos, 0, value);
  11358. self.insertAtCaret($item);
  11359. if (!self.isPending || !wasFull && self.isFull()) {
  11360. self.refreshState();
  11361. }
  11362. if (self.isSetup) {
  11363. $options = self.$dropdown_content.find('[data-selectable]');
  11364. // update menu / remove the option (if this is not one item being added as part of series)
  11365. if (!self.isPending) {
  11366. $option = self.getOption(value);
  11367. value_next = self.getAdjacentOption($option, 1).attr('data-value');
  11368. self.refreshOptions(self.isFocused && inputMode !== 'single');
  11369. if (value_next) {
  11370. self.setActiveOption(self.getOption(value_next));
  11371. }
  11372. }
  11373. // hide the menu if the maximum number of items have been selected or no options are left
  11374. if (!$options.length || self.isFull()) {
  11375. self.close();
  11376. } else {
  11377. self.positionDropdown();
  11378. }
  11379. self.updatePlaceholder();
  11380. self.trigger('item_add', value, $item);
  11381. self.updateOriginalInput({ silent: silent });
  11382. }
  11383. });
  11384. },
  11385. /**
  11386. * Removes the selected item matching
  11387. * the provided value.
  11388. *
  11389. * @param {string} value
  11390. */
  11391. removeItem: function removeItem(value, silent) {
  11392. var self = this;
  11393. var $item, i, idx;
  11394. $item = value instanceof $ ? value : self.getItem(value);
  11395. value = hash_key($item.attr('data-value'));
  11396. i = self.items.indexOf(value);
  11397. if (i !== -1) {
  11398. $item.remove();
  11399. if ($item.hasClass('active')) {
  11400. idx = self.$activeItems.indexOf($item[0]);
  11401. self.$activeItems.splice(idx, 1);
  11402. }
  11403. self.items.splice(i, 1);
  11404. self.lastQuery = null;
  11405. if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
  11406. self.removeOption(value, silent);
  11407. }
  11408. if (i < self.caretPos) {
  11409. self.setCaret(self.caretPos - 1);
  11410. }
  11411. self.refreshState();
  11412. self.updatePlaceholder();
  11413. self.updateOriginalInput({ silent: silent });
  11414. self.positionDropdown();
  11415. self.trigger('item_remove', value, $item);
  11416. }
  11417. },
  11418. /**
  11419. * Invokes the `create` method provided in the
  11420. * selectize options that should provide the data
  11421. * for the new item, given the user input.
  11422. *
  11423. * Once this completes, it will be added
  11424. * to the item list.
  11425. *
  11426. * @param {string} value
  11427. * @param {boolean} [triggerDropdown]
  11428. * @param {function} [callback]
  11429. * @return {boolean}
  11430. */
  11431. createItem: function createItem(input, triggerDropdown) {
  11432. var self = this;
  11433. var caret = self.caretPos;
  11434. input = input || $.trim(self.$control_input.val() || '');
  11435. var callback = arguments[arguments.length - 1];
  11436. if (typeof callback !== 'function') callback = function callback() {};
  11437. if (typeof triggerDropdown !== 'boolean') {
  11438. triggerDropdown = true;
  11439. }
  11440. if (!self.canCreate(input)) {
  11441. callback();
  11442. return false;
  11443. }
  11444. self.lock();
  11445. var setup = typeof self.settings.create === 'function' ? this.settings.create : function (input) {
  11446. var data = {};
  11447. data[self.settings.labelField] = input;
  11448. data[self.settings.valueField] = input;
  11449. return data;
  11450. };
  11451. var create = once(function (data) {
  11452. self.unlock();
  11453. if (!data || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') return callback();
  11454. var value = hash_key(data[self.settings.valueField]);
  11455. if (typeof value !== 'string') return callback();
  11456. self.setTextboxValue('');
  11457. self.addOption(data);
  11458. self.setCaret(caret);
  11459. self.addItem(value);
  11460. self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
  11461. callback(data);
  11462. });
  11463. var output = setup.apply(this, [input, create]);
  11464. if (typeof output !== 'undefined') {
  11465. create(output);
  11466. }
  11467. return true;
  11468. },
  11469. /**
  11470. * Re-renders the selected item lists.
  11471. */
  11472. refreshItems: function refreshItems() {
  11473. this.lastQuery = null;
  11474. if (this.isSetup) {
  11475. this.addItem(this.items);
  11476. }
  11477. this.refreshState();
  11478. this.updateOriginalInput();
  11479. },
  11480. /**
  11481. * Updates all state-dependent attributes
  11482. * and CSS classes.
  11483. */
  11484. refreshState: function refreshState() {
  11485. this.refreshValidityState();
  11486. this.refreshClasses();
  11487. },
  11488. /**
  11489. * Update the `required` attribute of both input and control input.
  11490. *
  11491. * The `required` property needs to be activated on the control input
  11492. * for the error to be displayed at the right place. `required` also
  11493. * needs to be temporarily deactivated on the input since the input is
  11494. * hidden and can't show errors.
  11495. */
  11496. refreshValidityState: function refreshValidityState() {
  11497. if (!this.isRequired) return false;
  11498. var invalid = !this.items.length;
  11499. this.isInvalid = invalid;
  11500. this.$control_input.prop('required', invalid);
  11501. this.$input.prop('required', !invalid);
  11502. },
  11503. /**
  11504. * Updates all state-dependent CSS classes.
  11505. */
  11506. refreshClasses: function refreshClasses() {
  11507. var self = this;
  11508. var isFull = self.isFull();
  11509. var isLocked = self.isLocked;
  11510. self.$wrapper.toggleClass('rtl', self.rtl);
  11511. self.$control.toggleClass('focus', self.isFocused).toggleClass('disabled', self.isDisabled).toggleClass('required', self.isRequired).toggleClass('invalid', self.isInvalid).toggleClass('locked', isLocked).toggleClass('full', isFull).toggleClass('not-full', !isFull).toggleClass('input-active', self.isFocused && !self.isInputHidden).toggleClass('dropdown-active', self.isOpen).toggleClass('has-options', !$.isEmptyObject(self.options)).toggleClass('has-items', self.items.length > 0);
  11512. self.$control_input.data('grow', !isFull && !isLocked);
  11513. },
  11514. /**
  11515. * Determines whether or not more items can be added
  11516. * to the control without exceeding the user-defined maximum.
  11517. *
  11518. * @returns {boolean}
  11519. */
  11520. isFull: function isFull() {
  11521. return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
  11522. },
  11523. /**
  11524. * Refreshes the original <select> or <input>
  11525. * element to reflect the current state.
  11526. */
  11527. updateOriginalInput: function updateOriginalInput(opts) {
  11528. var i,
  11529. n,
  11530. options,
  11531. label,
  11532. self = this;
  11533. opts = opts || {};
  11534. if (self.tagType === TAG_SELECT) {
  11535. options = [];
  11536. for (i = 0, n = self.items.length; i < n; i++) {
  11537. label = self.options[self.items[i]][self.settings.labelField] || '';
  11538. options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
  11539. }
  11540. if (!options.length && !this.$input.attr('multiple')) {
  11541. options.push('<option value="" selected="selected"></option>');
  11542. }
  11543. self.$input.html(options.join(''));
  11544. } else {
  11545. self.$input.val(self.getValue());
  11546. self.$input.attr('value', self.$input.val());
  11547. }
  11548. if (self.isSetup) {
  11549. if (!opts.silent) {
  11550. self.trigger('change', self.$input.val());
  11551. }
  11552. }
  11553. },
  11554. /**
  11555. * Shows/hide the input placeholder depending
  11556. * on if there items in the list already.
  11557. */
  11558. updatePlaceholder: function updatePlaceholder() {
  11559. if (!this.settings.placeholder) return;
  11560. var $input = this.$control_input;
  11561. if (this.items.length) {
  11562. $input.removeAttr('placeholder');
  11563. } else {
  11564. $input.attr('placeholder', this.settings.placeholder);
  11565. }
  11566. $input.triggerHandler('update', { force: true });
  11567. },
  11568. /**
  11569. * Shows the autocomplete dropdown containing
  11570. * the available options.
  11571. */
  11572. open: function open() {
  11573. var self = this;
  11574. if (self.isLocked || self.isOpen || self.settings.mode === 'multi' && self.isFull()) return;
  11575. self.focus();
  11576. self.isOpen = true;
  11577. self.refreshState();
  11578. self.$dropdown.css({ visibility: 'hidden', display: 'block' });
  11579. self.positionDropdown();
  11580. self.$dropdown.css({ visibility: 'visible' });
  11581. self.trigger('dropdown_open', self.$dropdown);
  11582. },
  11583. /**
  11584. * Closes the autocomplete dropdown menu.
  11585. */
  11586. close: function close() {
  11587. var self = this;
  11588. var trigger = self.isOpen;
  11589. if (self.settings.mode === 'single' && self.items.length) {
  11590. self.hideInput();
  11591. self.$control_input.blur(); // close keyboard on iOS
  11592. }
  11593. self.isOpen = false;
  11594. self.$dropdown.hide();
  11595. self.setActiveOption(null);
  11596. self.refreshState();
  11597. if (trigger) self.trigger('dropdown_close', self.$dropdown);
  11598. },
  11599. /**
  11600. * Calculates and applies the appropriate
  11601. * position of the dropdown.
  11602. */
  11603. positionDropdown: function positionDropdown() {
  11604. var $control = this.$control;
  11605. var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
  11606. offset.top += $control.outerHeight(true);
  11607. this.$dropdown.css({
  11608. width: $control.outerWidth(),
  11609. top: offset.top,
  11610. left: offset.left
  11611. });
  11612. },
  11613. /**
  11614. * Resets / clears all selected items
  11615. * from the control.
  11616. *
  11617. * @param {boolean} silent
  11618. */
  11619. clear: function clear(silent) {
  11620. var self = this;
  11621. if (!self.items.length) return;
  11622. self.$control.children(':not(input)').remove();
  11623. self.items = [];
  11624. self.lastQuery = null;
  11625. self.setCaret(0);
  11626. self.setActiveItem(null);
  11627. self.updatePlaceholder();
  11628. self.updateOriginalInput({ silent: silent });
  11629. self.refreshState();
  11630. self.showInput();
  11631. self.trigger('clear');
  11632. },
  11633. /**
  11634. * A helper method for inserting an element
  11635. * at the current caret position.
  11636. *
  11637. * @param {object} $el
  11638. */
  11639. insertAtCaret: function insertAtCaret($el) {
  11640. var caret = Math.min(this.caretPos, this.items.length);
  11641. if (caret === 0) {
  11642. this.$control.prepend($el);
  11643. } else {
  11644. $(this.$control[0].childNodes[caret]).before($el);
  11645. }
  11646. this.setCaret(caret + 1);
  11647. },
  11648. /**
  11649. * Removes the current selected item(s).
  11650. *
  11651. * @param {object} e (optional)
  11652. * @returns {boolean}
  11653. */
  11654. deleteSelection: function deleteSelection(e) {
  11655. var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
  11656. var self = this;
  11657. direction = e && e.keyCode === KEY_BACKSPACE ? -1 : 1;
  11658. selection = getSelection(self.$control_input[0]);
  11659. if (self.$activeOption && !self.settings.hideSelected) {
  11660. option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
  11661. }
  11662. // determine items that will be removed
  11663. values = [];
  11664. if (self.$activeItems.length) {
  11665. $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
  11666. caret = self.$control.children(':not(input)').index($tail);
  11667. if (direction > 0) {
  11668. caret++;
  11669. }
  11670. for (i = 0, n = self.$activeItems.length; i < n; i++) {
  11671. values.push($(self.$activeItems[i]).attr('data-value'));
  11672. }
  11673. if (e) {
  11674. e.preventDefault();
  11675. e.stopPropagation();
  11676. }
  11677. } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
  11678. if (direction < 0 && selection.start === 0 && selection.length === 0) {
  11679. values.push(self.items[self.caretPos - 1]);
  11680. } else if (direction > 0 && selection.start === self.$control_input.val().length) {
  11681. values.push(self.items[self.caretPos]);
  11682. }
  11683. }
  11684. // allow the callback to abort
  11685. if (!values.length || typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false) {
  11686. return false;
  11687. }
  11688. // perform removal
  11689. if (typeof caret !== 'undefined') {
  11690. self.setCaret(caret);
  11691. }
  11692. while (values.length) {
  11693. self.removeItem(values.pop());
  11694. }
  11695. self.showInput();
  11696. self.positionDropdown();
  11697. self.refreshOptions(true);
  11698. // select previous option
  11699. if (option_select) {
  11700. $option_select = self.getOption(option_select);
  11701. if ($option_select.length) {
  11702. self.setActiveOption($option_select);
  11703. }
  11704. }
  11705. return true;
  11706. },
  11707. /**
  11708. * Selects the previous / next item (depending
  11709. * on the `direction` argument).
  11710. *
  11711. * > 0 - right
  11712. * < 0 - left
  11713. *
  11714. * @param {int} direction
  11715. * @param {object} e (optional)
  11716. */
  11717. advanceSelection: function advanceSelection(direction, e) {
  11718. var tail, selection, idx, valueLength, cursorAtEdge, $tail;
  11719. var self = this;
  11720. if (direction === 0) return;
  11721. if (self.rtl) direction *= -1;
  11722. tail = direction > 0 ? 'last' : 'first';
  11723. selection = getSelection(self.$control_input[0]);
  11724. if (self.isFocused && !self.isInputHidden) {
  11725. valueLength = self.$control_input.val().length;
  11726. cursorAtEdge = direction < 0 ? selection.start === 0 && selection.length === 0 : selection.start === valueLength;
  11727. if (cursorAtEdge && !valueLength) {
  11728. self.advanceCaret(direction, e);
  11729. }
  11730. } else {
  11731. $tail = self.$control.children('.active:' + tail);
  11732. if ($tail.length) {
  11733. idx = self.$control.children(':not(input)').index($tail);
  11734. self.setActiveItem(null);
  11735. self.setCaret(direction > 0 ? idx + 1 : idx);
  11736. }
  11737. }
  11738. },
  11739. /**
  11740. * Moves the caret left / right.
  11741. *
  11742. * @param {int} direction
  11743. * @param {object} e (optional)
  11744. */
  11745. advanceCaret: function advanceCaret(direction, e) {
  11746. var self = this,
  11747. fn,
  11748. $adj;
  11749. if (direction === 0) return;
  11750. fn = direction > 0 ? 'next' : 'prev';
  11751. if (self.isShiftDown) {
  11752. $adj = self.$control_input[fn]();
  11753. if ($adj.length) {
  11754. self.hideInput();
  11755. self.setActiveItem($adj);
  11756. e && e.preventDefault();
  11757. }
  11758. } else {
  11759. self.setCaret(self.caretPos + direction);
  11760. }
  11761. },
  11762. /**
  11763. * Moves the caret to the specified index.
  11764. *
  11765. * @param {int} i
  11766. */
  11767. setCaret: function setCaret(i) {
  11768. var self = this;
  11769. if (self.settings.mode === 'single') {
  11770. i = self.items.length;
  11771. } else {
  11772. i = Math.max(0, Math.min(self.items.length, i));
  11773. }
  11774. if (!self.isPending) {
  11775. // the input must be moved by leaving it in place and moving the
  11776. // siblings, due to the fact that focus cannot be restored once lost
  11777. // on mobile webkit devices
  11778. var j, n, fn, $children, $child;
  11779. $children = self.$control.children(':not(input)');
  11780. for (j = 0, n = $children.length; j < n; j++) {
  11781. $child = $($children[j]).detach();
  11782. if (j < i) {
  11783. self.$control_input.before($child);
  11784. } else {
  11785. self.$control.append($child);
  11786. }
  11787. }
  11788. }
  11789. self.caretPos = i;
  11790. },
  11791. /**
  11792. * Disables user input on the control. Used while
  11793. * items are being asynchronously created.
  11794. */
  11795. lock: function lock() {
  11796. this.close();
  11797. this.isLocked = true;
  11798. this.refreshState();
  11799. },
  11800. /**
  11801. * Re-enables user input on the control.
  11802. */
  11803. unlock: function unlock() {
  11804. this.isLocked = false;
  11805. this.refreshState();
  11806. },
  11807. /**
  11808. * Disables user input on the control completely.
  11809. * While disabled, it cannot receive focus.
  11810. */
  11811. disable: function disable() {
  11812. var self = this;
  11813. self.$input.prop('disabled', true);
  11814. self.$control_input.prop('disabled', true).prop('tabindex', -1);
  11815. self.isDisabled = true;
  11816. self.lock();
  11817. },
  11818. /**
  11819. * Enables the control so that it can respond
  11820. * to focus and user input.
  11821. */
  11822. enable: function enable() {
  11823. var self = this;
  11824. self.$input.prop('disabled', false);
  11825. self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
  11826. self.isDisabled = false;
  11827. self.unlock();
  11828. },
  11829. /**
  11830. * Completely destroys the control and
  11831. * unbinds all event listeners so that it can
  11832. * be garbage collected.
  11833. */
  11834. destroy: function destroy() {
  11835. var self = this;
  11836. var eventNS = self.eventNS;
  11837. var revertSettings = self.revertSettings;
  11838. self.trigger('destroy');
  11839. self.off();
  11840. self.$wrapper.remove();
  11841. self.$dropdown.remove();
  11842. self.$input.html('').append(revertSettings.$children).removeAttr('tabindex').removeClass('selectized').attr({ tabindex: revertSettings.tabindex }).show();
  11843. self.$control_input.removeData('grow');
  11844. self.$input.removeData('selectize');
  11845. $(window).off(eventNS);
  11846. $(document).off(eventNS);
  11847. $(document.body).off(eventNS);
  11848. delete self.$input[0].selectize;
  11849. },
  11850. /**
  11851. * A helper method for rendering "item" and
  11852. * "option" templates, given the data.
  11853. *
  11854. * @param {string} templateName
  11855. * @param {object} data
  11856. * @returns {string}
  11857. */
  11858. render: function render(templateName, data) {
  11859. var value, id, label;
  11860. var html = '';
  11861. var cache = false;
  11862. var self = this;
  11863. var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
  11864. if (templateName === 'option' || templateName === 'item') {
  11865. value = hash_key(data[self.settings.valueField]);
  11866. cache = !!value;
  11867. }
  11868. // pull markup from cache if it exists
  11869. if (cache) {
  11870. if (!isset(self.renderCache[templateName])) {
  11871. self.renderCache[templateName] = {};
  11872. }
  11873. if (self.renderCache[templateName].hasOwnProperty(value)) {
  11874. return self.renderCache[templateName][value];
  11875. }
  11876. }
  11877. // render markup
  11878. html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
  11879. // add mandatory attributes
  11880. if (templateName === 'option' || templateName === 'option_create') {
  11881. html.attr('data-selectable', '');
  11882. } else if (templateName === 'optgroup') {
  11883. id = data[self.settings.optgroupValueField] || '';
  11884. html.attr('data-group', id);
  11885. }
  11886. if (templateName === 'option' || templateName === 'item') {
  11887. html.attr('data-value', value || '');
  11888. }
  11889. // update cache
  11890. if (cache) {
  11891. self.renderCache[templateName][value] = html[0];
  11892. }
  11893. return html[0];
  11894. },
  11895. /**
  11896. * Clears the render cache for a template. If
  11897. * no template is given, clears all render
  11898. * caches.
  11899. *
  11900. * @param {string} templateName
  11901. */
  11902. clearCache: function clearCache(templateName) {
  11903. var self = this;
  11904. if (typeof templateName === 'undefined') {
  11905. self.renderCache = {};
  11906. } else {
  11907. delete self.renderCache[templateName];
  11908. }
  11909. },
  11910. /**
  11911. * Determines whether or not to display the
  11912. * create item prompt, given a user input.
  11913. *
  11914. * @param {string} input
  11915. * @return {boolean}
  11916. */
  11917. canCreate: function canCreate(input) {
  11918. var self = this;
  11919. if (!self.settings.create) return false;
  11920. var filter = self.settings.createFilter;
  11921. return input.length && (typeof filter !== 'function' || filter.apply(self, [input])) && (typeof filter !== 'string' || new RegExp(filter).test(input)) && (!(filter instanceof RegExp) || filter.test(input));
  11922. }
  11923. });
  11924. Selectize.count = 0;
  11925. Selectize.defaults = {
  11926. options: [],
  11927. optgroups: [],
  11928. plugins: [],
  11929. delimiter: ',',
  11930. splitOn: null, // regexp or string for splitting up values from a paste command
  11931. persist: true,
  11932. diacritics: true,
  11933. create: false,
  11934. createOnBlur: false,
  11935. createFilter: null,
  11936. highlight: true,
  11937. openOnFocus: true,
  11938. maxOptions: 1000,
  11939. maxItems: null,
  11940. hideSelected: null,
  11941. addPrecedence: false,
  11942. selectOnTab: false,
  11943. preload: false,
  11944. allowEmptyOption: false,
  11945. closeAfterSelect: false,
  11946. scrollDuration: 60,
  11947. loadThrottle: 300,
  11948. loadingClass: 'loading',
  11949. dataAttr: 'data-data',
  11950. optgroupField: 'optgroup',
  11951. valueField: 'value',
  11952. labelField: 'text',
  11953. optgroupLabelField: 'label',
  11954. optgroupValueField: 'value',
  11955. lockOptgroupOrder: false,
  11956. sortField: '$order',
  11957. searchField: ['text'],
  11958. searchConjunction: 'and',
  11959. mode: null,
  11960. wrapperClass: 'selectize-control',
  11961. inputClass: 'selectize-input',
  11962. dropdownClass: 'selectize-dropdown',
  11963. dropdownContentClass: 'selectize-dropdown-content',
  11964. dropdownParent: null,
  11965. copyClassesToDropdown: true,
  11966. /*
  11967. load : null, // function(query, callback) { ... }
  11968. score : null, // function(search) { ... }
  11969. onInitialize : null, // function() { ... }
  11970. onChange : null, // function(value) { ... }
  11971. onItemAdd : null, // function(value, $item) { ... }
  11972. onItemRemove : null, // function(value) { ... }
  11973. onClear : null, // function() { ... }
  11974. onOptionAdd : null, // function(value, data) { ... }
  11975. onOptionRemove : null, // function(value) { ... }
  11976. onOptionClear : null, // function() { ... }
  11977. onOptionGroupAdd : null, // function(id, data) { ... }
  11978. onOptionGroupRemove : null, // function(id) { ... }
  11979. onOptionGroupClear : null, // function() { ... }
  11980. onDropdownOpen : null, // function($dropdown) { ... }
  11981. onDropdownClose : null, // function($dropdown) { ... }
  11982. onType : null, // function(str) { ... }
  11983. onDelete : null, // function(values) { ... }
  11984. */
  11985. render: {
  11986. /*
  11987. item: null,
  11988. optgroup: null,
  11989. optgroup_header: null,
  11990. option: null,
  11991. option_create: null
  11992. */
  11993. }
  11994. };
  11995. $.fn.selectize = function (settings_user) {
  11996. var defaults = $.fn.selectize.defaults;
  11997. var settings = $.extend({}, defaults, settings_user);
  11998. var attr_data = settings.dataAttr;
  11999. var field_label = settings.labelField;
  12000. var field_value = settings.valueField;
  12001. var field_optgroup = settings.optgroupField;
  12002. var field_optgroup_label = settings.optgroupLabelField;
  12003. var field_optgroup_value = settings.optgroupValueField;
  12004. /**
  12005. * Initializes selectize from a <input type="text"> element.
  12006. *
  12007. * @param {object} $input
  12008. * @param {object} settings_element
  12009. */
  12010. var init_textbox = function init_textbox($input, settings_element) {
  12011. var i, n, values, option;
  12012. var data_raw = $input.attr(attr_data);
  12013. if (!data_raw) {
  12014. var value = $.trim($input.val() || '');
  12015. if (!settings.allowEmptyOption && !value.length) return;
  12016. values = value.split(settings.delimiter);
  12017. for (i = 0, n = values.length; i < n; i++) {
  12018. option = {};
  12019. option[field_label] = values[i];
  12020. option[field_value] = values[i];
  12021. settings_element.options.push(option);
  12022. }
  12023. settings_element.items = values;
  12024. } else {
  12025. settings_element.options = JSON.parse(data_raw);
  12026. for (i = 0, n = settings_element.options.length; i < n; i++) {
  12027. settings_element.items.push(settings_element.options[i][field_value]);
  12028. }
  12029. }
  12030. };
  12031. /**
  12032. * Initializes selectize from a <select> element.
  12033. *
  12034. * @param {object} $input
  12035. * @param {object} settings_element
  12036. */
  12037. var init_select = function init_select($input, settings_element) {
  12038. var i,
  12039. n,
  12040. tagName,
  12041. $children,
  12042. order = 0;
  12043. var options = settings_element.options;
  12044. var optionsMap = {};
  12045. var readData = function readData($el) {
  12046. var data = attr_data && $el.attr(attr_data);
  12047. if (typeof data === 'string' && data.length) {
  12048. return JSON.parse(data);
  12049. }
  12050. return null;
  12051. };
  12052. var addOption = function addOption($option, group) {
  12053. $option = $($option);
  12054. var value = hash_key($option.val());
  12055. if (!value && !settings.allowEmptyOption) return;
  12056. // if the option already exists, it's probably been
  12057. // duplicated in another optgroup. in this case, push
  12058. // the current group to the "optgroup" property on the
  12059. // existing option so that it's rendered in both places.
  12060. if (optionsMap.hasOwnProperty(value)) {
  12061. if (group) {
  12062. var arr = optionsMap[value][field_optgroup];
  12063. if (!arr) {
  12064. optionsMap[value][field_optgroup] = group;
  12065. } else if (!$.isArray(arr)) {
  12066. optionsMap[value][field_optgroup] = [arr, group];
  12067. } else {
  12068. arr.push(group);
  12069. }
  12070. }
  12071. return;
  12072. }
  12073. var option = readData($option) || {};
  12074. option[field_label] = option[field_label] || $option.text();
  12075. option[field_value] = option[field_value] || value;
  12076. option[field_optgroup] = option[field_optgroup] || group;
  12077. optionsMap[value] = option;
  12078. options.push(option);
  12079. if ($option.is(':selected')) {
  12080. settings_element.items.push(value);
  12081. }
  12082. };
  12083. var addGroup = function addGroup($optgroup) {
  12084. var i, n, id, optgroup, $options;
  12085. $optgroup = $($optgroup);
  12086. id = $optgroup.attr('label');
  12087. if (id) {
  12088. optgroup = readData($optgroup) || {};
  12089. optgroup[field_optgroup_label] = id;
  12090. optgroup[field_optgroup_value] = id;
  12091. settings_element.optgroups.push(optgroup);
  12092. }
  12093. $options = $('option', $optgroup);
  12094. for (i = 0, n = $options.length; i < n; i++) {
  12095. addOption($options[i], id);
  12096. }
  12097. };
  12098. settings_element.maxItems = $input.attr('multiple') ? null : 1;
  12099. $children = $input.children();
  12100. for (i = 0, n = $children.length; i < n; i++) {
  12101. tagName = $children[i].tagName.toLowerCase();
  12102. if (tagName === 'optgroup') {
  12103. addGroup($children[i]);
  12104. } else if (tagName === 'option') {
  12105. addOption($children[i]);
  12106. }
  12107. }
  12108. };
  12109. return this.each(function () {
  12110. if (this.selectize) return;
  12111. var instance;
  12112. var $input = $(this);
  12113. var tag_name = this.tagName.toLowerCase();
  12114. var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
  12115. if (!placeholder && !settings.allowEmptyOption) {
  12116. placeholder = $input.children('option[value=""]').text();
  12117. }
  12118. var settings_element = {
  12119. 'placeholder': placeholder,
  12120. 'options': [],
  12121. 'optgroups': [],
  12122. 'items': []
  12123. };
  12124. if (tag_name === 'select') {
  12125. init_select($input, settings_element);
  12126. } else {
  12127. init_textbox($input, settings_element);
  12128. }
  12129. instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
  12130. });
  12131. };
  12132. $.fn.selectize.defaults = Selectize.defaults;
  12133. $.fn.selectize.support = {
  12134. validity: SUPPORTS_VALIDITY_API
  12135. };
  12136. Selectize.define('drag_drop', function (options) {
  12137. if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
  12138. if (this.settings.mode !== 'multi') return;
  12139. var self = this;
  12140. self.lock = function () {
  12141. var original = self.lock;
  12142. return function () {
  12143. var sortable = self.$control.data('sortable');
  12144. if (sortable) sortable.disable();
  12145. return original.apply(self, arguments);
  12146. };
  12147. }();
  12148. self.unlock = function () {
  12149. var original = self.unlock;
  12150. return function () {
  12151. var sortable = self.$control.data('sortable');
  12152. if (sortable) sortable.enable();
  12153. return original.apply(self, arguments);
  12154. };
  12155. }();
  12156. self.setup = function () {
  12157. var original = self.setup;
  12158. return function () {
  12159. original.apply(this, arguments);
  12160. var $control = self.$control.sortable({
  12161. items: '[data-value]',
  12162. forcePlaceholderSize: true,
  12163. disabled: self.isLocked,
  12164. start: function start(e, ui) {
  12165. ui.placeholder.css('width', ui.helper.css('width'));
  12166. $control.css({ overflow: 'visible' });
  12167. },
  12168. stop: function stop() {
  12169. $control.css({ overflow: 'hidden' });
  12170. var active = self.$activeItems ? self.$activeItems.slice() : null;
  12171. var values = [];
  12172. $control.children('[data-value]').each(function () {
  12173. values.push($(this).attr('data-value'));
  12174. });
  12175. self.setValue(values);
  12176. self.setActiveItem(active);
  12177. }
  12178. });
  12179. };
  12180. }();
  12181. });
  12182. Selectize.define('dropdown_header', function (options) {
  12183. var self = this;
  12184. options = $.extend({
  12185. title: 'Untitled',
  12186. headerClass: 'selectize-dropdown-header',
  12187. titleRowClass: 'selectize-dropdown-header-title',
  12188. labelClass: 'selectize-dropdown-header-label',
  12189. closeClass: 'selectize-dropdown-header-close',
  12190. html: function html(data) {
  12191. return '<div class="' + data.headerClass + '">' + '<div class="' + data.titleRowClass + '">' + '<span class="' + data.labelClass + '">' + data.title + '</span>' + '<a href="javascript:void(0)" class="' + data.closeClass + '">&times;</a>' + '</div>' + '</div>';
  12192. }
  12193. }, options);
  12194. self.setup = function () {
  12195. var original = self.setup;
  12196. return function () {
  12197. original.apply(self, arguments);
  12198. self.$dropdown_header = $(options.html(options));
  12199. self.$dropdown.prepend(self.$dropdown_header);
  12200. };
  12201. }();
  12202. });
  12203. Selectize.define('optgroup_columns', function (options) {
  12204. var self = this;
  12205. options = $.extend({
  12206. equalizeWidth: true,
  12207. equalizeHeight: true
  12208. }, options);
  12209. this.getAdjacentOption = function ($option, direction) {
  12210. var $options = $option.closest('[data-group]').find('[data-selectable]');
  12211. var index = $options.index($option) + direction;
  12212. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  12213. };
  12214. this.onKeyDown = function () {
  12215. var original = self.onKeyDown;
  12216. return function (e) {
  12217. var index, $option, $options, $optgroup;
  12218. if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
  12219. self.ignoreHover = true;
  12220. $optgroup = this.$activeOption.closest('[data-group]');
  12221. index = $optgroup.find('[data-selectable]').index(this.$activeOption);
  12222. if (e.keyCode === KEY_LEFT) {
  12223. $optgroup = $optgroup.prev('[data-group]');
  12224. } else {
  12225. $optgroup = $optgroup.next('[data-group]');
  12226. }
  12227. $options = $optgroup.find('[data-selectable]');
  12228. $option = $options.eq(Math.min($options.length - 1, index));
  12229. if ($option.length) {
  12230. this.setActiveOption($option);
  12231. }
  12232. return;
  12233. }
  12234. return original.apply(this, arguments);
  12235. };
  12236. }();
  12237. var getScrollbarWidth = function getScrollbarWidth() {
  12238. var div;
  12239. var width = getScrollbarWidth.width;
  12240. var doc = document;
  12241. if (typeof width === 'undefined') {
  12242. div = doc.createElement('div');
  12243. div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
  12244. div = div.firstChild;
  12245. doc.body.appendChild(div);
  12246. width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
  12247. doc.body.removeChild(div);
  12248. }
  12249. return width;
  12250. };
  12251. var equalizeSizes = function equalizeSizes() {
  12252. var i, n, height_max, width, width_last, width_parent, $optgroups;
  12253. $optgroups = $('[data-group]', self.$dropdown_content);
  12254. n = $optgroups.length;
  12255. if (!n || !self.$dropdown_content.width()) return;
  12256. if (options.equalizeHeight) {
  12257. height_max = 0;
  12258. for (i = 0; i < n; i++) {
  12259. height_max = Math.max(height_max, $optgroups.eq(i).height());
  12260. }
  12261. $optgroups.css({ height: height_max });
  12262. }
  12263. if (options.equalizeWidth) {
  12264. width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
  12265. width = Math.round(width_parent / n);
  12266. $optgroups.css({ width: width });
  12267. if (n > 1) {
  12268. width_last = width_parent - width * (n - 1);
  12269. $optgroups.eq(n - 1).css({ width: width_last });
  12270. }
  12271. }
  12272. };
  12273. if (options.equalizeHeight || options.equalizeWidth) {
  12274. hook.after(this, 'positionDropdown', equalizeSizes);
  12275. hook.after(this, 'refreshOptions', equalizeSizes);
  12276. }
  12277. });
  12278. Selectize.define('remove_button', function (options) {
  12279. options = $.extend({
  12280. label: '&times;',
  12281. title: 'Remove',
  12282. className: 'remove',
  12283. append: true
  12284. }, options);
  12285. var singleClose = function singleClose(thisRef, options) {
  12286. options.className = 'remove-single';
  12287. var self = thisRef;
  12288. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12289. /**
  12290. * Appends an element as a child (with raw HTML).
  12291. *
  12292. * @param {string} html_container
  12293. * @param {string} html_element
  12294. * @return {string}
  12295. */
  12296. var append = function append(html_container, html_element) {
  12297. return html_container + html_element;
  12298. };
  12299. thisRef.setup = function () {
  12300. var original = self.setup;
  12301. return function () {
  12302. // override the item rendering method to add the button to each
  12303. if (options.append) {
  12304. var id = $(self.$input.context).attr('id');
  12305. var selectizer = $('#' + id);
  12306. var render_item = self.settings.render.item;
  12307. self.settings.render.item = function (data) {
  12308. return append(render_item.apply(thisRef, arguments), html);
  12309. };
  12310. }
  12311. original.apply(thisRef, arguments);
  12312. // add event listener
  12313. thisRef.$control.on('click', '.' + options.className, function (e) {
  12314. e.preventDefault();
  12315. if (self.isLocked) return;
  12316. self.clear();
  12317. });
  12318. };
  12319. }();
  12320. };
  12321. var multiClose = function multiClose(thisRef, options) {
  12322. var self = thisRef;
  12323. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12324. /**
  12325. * Appends an element as a child (with raw HTML).
  12326. *
  12327. * @param {string} html_container
  12328. * @param {string} html_element
  12329. * @return {string}
  12330. */
  12331. var append = function append(html_container, html_element) {
  12332. var pos = html_container.search(/(<\/[^>]+>\s*)$/);
  12333. return html_container.substring(0, pos) + html_element + html_container.substring(pos);
  12334. };
  12335. thisRef.setup = function () {
  12336. var original = self.setup;
  12337. return function () {
  12338. // override the item rendering method to add the button to each
  12339. if (options.append) {
  12340. var render_item = self.settings.render.item;
  12341. self.settings.render.item = function (data) {
  12342. return append(render_item.apply(thisRef, arguments), html);
  12343. };
  12344. }
  12345. original.apply(thisRef, arguments);
  12346. // add event listener
  12347. thisRef.$control.on('click', '.' + options.className, function (e) {
  12348. e.preventDefault();
  12349. if (self.isLocked) return;
  12350. var $item = $(e.currentTarget).parent();
  12351. self.setActiveItem($item);
  12352. if (self.deleteSelection()) {
  12353. self.setCaret(self.items.length);
  12354. }
  12355. });
  12356. };
  12357. }();
  12358. };
  12359. if (this.settings.mode === 'single') {
  12360. singleClose(this, options);
  12361. return;
  12362. } else {
  12363. multiClose(this, options);
  12364. }
  12365. });
  12366. Selectize.define('restore_on_backspace', function (options) {
  12367. var self = this;
  12368. options.text = options.text || function (option) {
  12369. return option[this.settings.labelField];
  12370. };
  12371. this.onKeyDown = function () {
  12372. var original = self.onKeyDown;
  12373. return function (e) {
  12374. var index, option;
  12375. if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
  12376. index = this.caretPos - 1;
  12377. if (index >= 0 && index < this.items.length) {
  12378. option = this.options[this.items[index]];
  12379. if (this.deleteSelection(e)) {
  12380. this.setTextboxValue(options.text.apply(this, [option]));
  12381. this.refreshOptions(true);
  12382. }
  12383. e.preventDefault();
  12384. return;
  12385. }
  12386. }
  12387. return original.apply(this, arguments);
  12388. };
  12389. }();
  12390. });
  12391. return Selectize;
  12392. });
  12393. /***/ }),
  12394. /* 30 */
  12395. /***/ (function(module, exports, __webpack_require__) {
  12396. "use strict";
  12397. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12398. /*!
  12399. Autosize 4.0.0
  12400. license: MIT
  12401. http://www.jacklmoore.com/autosize
  12402. */
  12403. (function (global, factory) {
  12404. if (true) {
  12405. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12406. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12407. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12408. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12409. } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
  12410. factory(exports, module);
  12411. } else {
  12412. var mod = {
  12413. exports: {}
  12414. };
  12415. factory(mod.exports, mod);
  12416. global.autosize = mod.exports;
  12417. }
  12418. })(undefined, function (exports, module) {
  12419. 'use strict';
  12420. var map = typeof Map === "function" ? new Map() : function () {
  12421. var keys = [];
  12422. var values = [];
  12423. return {
  12424. has: function has(key) {
  12425. return keys.indexOf(key) > -1;
  12426. },
  12427. get: function get(key) {
  12428. return values[keys.indexOf(key)];
  12429. },
  12430. set: function set(key, value) {
  12431. if (keys.indexOf(key) === -1) {
  12432. keys.push(key);
  12433. values.push(value);
  12434. }
  12435. },
  12436. 'delete': function _delete(key) {
  12437. var index = keys.indexOf(key);
  12438. if (index > -1) {
  12439. keys.splice(index, 1);
  12440. values.splice(index, 1);
  12441. }
  12442. }
  12443. };
  12444. }();
  12445. var createEvent = function createEvent(name) {
  12446. return new Event(name, { bubbles: true });
  12447. };
  12448. try {
  12449. new Event('test');
  12450. } catch (e) {
  12451. // IE does not support `new Event()`
  12452. createEvent = function createEvent(name) {
  12453. var evt = document.createEvent('Event');
  12454. evt.initEvent(name, true, false);
  12455. return evt;
  12456. };
  12457. }
  12458. function assign(ta) {
  12459. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  12460. var heightOffset = null;
  12461. var clientWidth = ta.clientWidth;
  12462. var cachedHeight = null;
  12463. function init() {
  12464. var style = window.getComputedStyle(ta, null);
  12465. if (style.resize === 'vertical') {
  12466. ta.style.resize = 'none';
  12467. } else if (style.resize === 'both') {
  12468. ta.style.resize = 'horizontal';
  12469. }
  12470. if (style.boxSizing === 'content-box') {
  12471. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  12472. } else {
  12473. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  12474. }
  12475. // Fix when a textarea is not on document body and heightOffset is Not a Number
  12476. if (isNaN(heightOffset)) {
  12477. heightOffset = 0;
  12478. }
  12479. update();
  12480. }
  12481. function changeOverflow(value) {
  12482. {
  12483. // Chrome/Safari-specific fix:
  12484. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  12485. // made available by removing the scrollbar. The following forces the necessary text reflow.
  12486. var width = ta.style.width;
  12487. ta.style.width = '0px';
  12488. // Force reflow:
  12489. /* jshint ignore:start */
  12490. ta.offsetWidth;
  12491. /* jshint ignore:end */
  12492. ta.style.width = width;
  12493. }
  12494. ta.style.overflowY = value;
  12495. }
  12496. function getParentOverflows(el) {
  12497. var arr = [];
  12498. while (el && el.parentNode && el.parentNode instanceof Element) {
  12499. if (el.parentNode.scrollTop) {
  12500. arr.push({
  12501. node: el.parentNode,
  12502. scrollTop: el.parentNode.scrollTop
  12503. });
  12504. }
  12505. el = el.parentNode;
  12506. }
  12507. return arr;
  12508. }
  12509. function resize() {
  12510. var originalHeight = ta.style.height;
  12511. var overflows = getParentOverflows(ta);
  12512. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  12513. ta.style.height = '';
  12514. var endHeight = ta.scrollHeight + heightOffset;
  12515. if (ta.scrollHeight === 0) {
  12516. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  12517. ta.style.height = originalHeight;
  12518. return;
  12519. }
  12520. ta.style.height = endHeight + 'px';
  12521. // used to check if an update is actually necessary on window.resize
  12522. clientWidth = ta.clientWidth;
  12523. // prevents scroll-position jumping
  12524. overflows.forEach(function (el) {
  12525. el.node.scrollTop = el.scrollTop;
  12526. });
  12527. if (docTop) {
  12528. document.documentElement.scrollTop = docTop;
  12529. }
  12530. }
  12531. function update() {
  12532. resize();
  12533. var styleHeight = Math.round(parseFloat(ta.style.height));
  12534. var computed = window.getComputedStyle(ta, null);
  12535. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  12536. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  12537. // The actual height not matching the style height (set via the resize method) indicates that
  12538. // the max-height has been exceeded, in which case the overflow should be allowed.
  12539. if (actualHeight !== styleHeight) {
  12540. if (computed.overflowY === 'hidden') {
  12541. changeOverflow('scroll');
  12542. resize();
  12543. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12544. }
  12545. } else {
  12546. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  12547. if (computed.overflowY !== 'hidden') {
  12548. changeOverflow('hidden');
  12549. resize();
  12550. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12551. }
  12552. }
  12553. if (cachedHeight !== actualHeight) {
  12554. cachedHeight = actualHeight;
  12555. var evt = createEvent('autosize:resized');
  12556. try {
  12557. ta.dispatchEvent(evt);
  12558. } catch (err) {
  12559. // Firefox will throw an error on dispatchEvent for a detached element
  12560. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  12561. }
  12562. }
  12563. }
  12564. var pageResize = function pageResize() {
  12565. if (ta.clientWidth !== clientWidth) {
  12566. update();
  12567. }
  12568. };
  12569. var destroy = function (style) {
  12570. window.removeEventListener('resize', pageResize, false);
  12571. ta.removeEventListener('input', update, false);
  12572. ta.removeEventListener('keyup', update, false);
  12573. ta.removeEventListener('autosize:destroy', destroy, false);
  12574. ta.removeEventListener('autosize:update', update, false);
  12575. Object.keys(style).forEach(function (key) {
  12576. ta.style[key] = style[key];
  12577. });
  12578. map['delete'](ta);
  12579. }.bind(ta, {
  12580. height: ta.style.height,
  12581. resize: ta.style.resize,
  12582. overflowY: ta.style.overflowY,
  12583. overflowX: ta.style.overflowX,
  12584. wordWrap: ta.style.wordWrap
  12585. });
  12586. ta.addEventListener('autosize:destroy', destroy, false);
  12587. // IE9 does not fire onpropertychange or oninput for deletions,
  12588. // so binding to onkeyup to catch most of those events.
  12589. // There is no way that I know of to detect something like 'cut' in IE9.
  12590. if ('onpropertychange' in ta && 'oninput' in ta) {
  12591. ta.addEventListener('keyup', update, false);
  12592. }
  12593. window.addEventListener('resize', pageResize, false);
  12594. ta.addEventListener('input', update, false);
  12595. ta.addEventListener('autosize:update', update, false);
  12596. ta.style.overflowX = 'hidden';
  12597. ta.style.wordWrap = 'break-word';
  12598. map.set(ta, {
  12599. destroy: destroy,
  12600. update: update
  12601. });
  12602. init();
  12603. }
  12604. function destroy(ta) {
  12605. var methods = map.get(ta);
  12606. if (methods) {
  12607. methods.destroy();
  12608. }
  12609. }
  12610. function update(ta) {
  12611. var methods = map.get(ta);
  12612. if (methods) {
  12613. methods.update();
  12614. }
  12615. }
  12616. var autosize = null;
  12617. // Do nothing in Node.js environment and IE8 (or lower)
  12618. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  12619. autosize = function autosize(el) {
  12620. return el;
  12621. };
  12622. autosize.destroy = function (el) {
  12623. return el;
  12624. };
  12625. autosize.update = function (el) {
  12626. return el;
  12627. };
  12628. } else {
  12629. autosize = function autosize(el, options) {
  12630. if (el) {
  12631. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  12632. return assign(x, options);
  12633. });
  12634. }
  12635. return el;
  12636. };
  12637. autosize.destroy = function (el) {
  12638. if (el) {
  12639. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  12640. }
  12641. return el;
  12642. };
  12643. autosize.update = function (el) {
  12644. if (el) {
  12645. Array.prototype.forEach.call(el.length ? el : [el], update);
  12646. }
  12647. return el;
  12648. };
  12649. }
  12650. module.exports = autosize;
  12651. });
  12652. /***/ }),
  12653. /* 31 */
  12654. /***/ (function(module, exports, __webpack_require__) {
  12655. "use strict";
  12656. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;
  12657. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  12658. /*!
  12659. * enquire.js v2.1.6 - Awesome Media Queries in JavaScript
  12660. * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js
  12661. * License: MIT */
  12662. (function (f) {
  12663. if (( false ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  12664. module.exports = f();
  12665. } else if (true) {
  12666. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
  12667. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12668. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12669. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12670. } else {
  12671. var g;if (typeof window !== "undefined") {
  12672. g = window;
  12673. } else if (typeof global !== "undefined") {
  12674. g = global;
  12675. } else if (typeof self !== "undefined") {
  12676. g = self;
  12677. } else {
  12678. g = this;
  12679. }g.enquire = f();
  12680. }
  12681. })(function () {
  12682. var define, module, exports;return function e(t, n, r) {
  12683. function s(o, u) {
  12684. if (!n[o]) {
  12685. if (!t[o]) {
  12686. var a = typeof require == "function" && require;if (!u && a) return require(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;
  12687. }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
  12688. var n = t[o][1][e];return s(n ? n : e);
  12689. }, l, l.exports, e, t, n, r);
  12690. }return n[o].exports;
  12691. }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
  12692. s(r[o]);
  12693. }return s;
  12694. }({ 1: [function (require, module, exports) {
  12695. var QueryHandler = require(3);
  12696. var each = require(4).each;
  12697. /**
  12698. * Represents a single media query, manages it's state and registered handlers for this query
  12699. *
  12700. * @constructor
  12701. * @param {string} query the media query string
  12702. * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design
  12703. */
  12704. function MediaQuery(query, isUnconditional) {
  12705. this.query = query;
  12706. this.isUnconditional = isUnconditional;
  12707. this.handlers = [];
  12708. this.mql = window.matchMedia(query);
  12709. var self = this;
  12710. this.listener = function (mql) {
  12711. // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
  12712. self.mql = mql.currentTarget || mql;
  12713. self.assess();
  12714. };
  12715. this.mql.addListener(this.listener);
  12716. }
  12717. MediaQuery.prototype = {
  12718. constuctor: MediaQuery,
  12719. /**
  12720. * add a handler for this query, triggering if already active
  12721. *
  12722. * @param {object} handler
  12723. * @param {function} handler.match callback for when query is activated
  12724. * @param {function} [handler.unmatch] callback for when query is deactivated
  12725. * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
  12726. * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
  12727. */
  12728. addHandler: function addHandler(handler) {
  12729. var qh = new QueryHandler(handler);
  12730. this.handlers.push(qh);
  12731. this.matches() && qh.on();
  12732. },
  12733. /**
  12734. * removes the given handler from the collection, and calls it's destroy methods
  12735. *
  12736. * @param {object || function} handler the handler to remove
  12737. */
  12738. removeHandler: function removeHandler(handler) {
  12739. var handlers = this.handlers;
  12740. each(handlers, function (h, i) {
  12741. if (h.equals(handler)) {
  12742. h.destroy();
  12743. return !handlers.splice(i, 1); //remove from array and exit each early
  12744. }
  12745. });
  12746. },
  12747. /**
  12748. * Determine whether the media query should be considered a match
  12749. *
  12750. * @return {Boolean} true if media query can be considered a match, false otherwise
  12751. */
  12752. matches: function matches() {
  12753. return this.mql.matches || this.isUnconditional;
  12754. },
  12755. /**
  12756. * Clears all handlers and unbinds events
  12757. */
  12758. clear: function clear() {
  12759. each(this.handlers, function (handler) {
  12760. handler.destroy();
  12761. });
  12762. this.mql.removeListener(this.listener);
  12763. this.handlers.length = 0; //clear array
  12764. },
  12765. /*
  12766. * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
  12767. */
  12768. assess: function assess() {
  12769. var action = this.matches() ? 'on' : 'off';
  12770. each(this.handlers, function (handler) {
  12771. handler[action]();
  12772. });
  12773. }
  12774. };
  12775. module.exports = MediaQuery;
  12776. }, { "3": 3, "4": 4 }], 2: [function (require, module, exports) {
  12777. var MediaQuery = require(1);
  12778. var Util = require(4);
  12779. var each = Util.each;
  12780. var isFunction = Util.isFunction;
  12781. var isArray = Util.isArray;
  12782. /**
  12783. * Allows for registration of query handlers.
  12784. * Manages the query handler's state and is responsible for wiring up browser events
  12785. *
  12786. * @constructor
  12787. */
  12788. function MediaQueryDispatch() {
  12789. if (!window.matchMedia) {
  12790. throw new Error('matchMedia not present, legacy browsers require a polyfill');
  12791. }
  12792. this.queries = {};
  12793. this.browserIsIncapable = !window.matchMedia('only all').matches;
  12794. }
  12795. MediaQueryDispatch.prototype = {
  12796. constructor: MediaQueryDispatch,
  12797. /**
  12798. * Registers a handler for the given media query
  12799. *
  12800. * @param {string} q the media query
  12801. * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
  12802. * @param {function} options.match fired when query matched
  12803. * @param {function} [options.unmatch] fired when a query is no longer matched
  12804. * @param {function} [options.setup] fired when handler first triggered
  12805. * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
  12806. * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
  12807. */
  12808. register: function register(q, options, shouldDegrade) {
  12809. var queries = this.queries,
  12810. isUnconditional = shouldDegrade && this.browserIsIncapable;
  12811. if (!queries[q]) {
  12812. queries[q] = new MediaQuery(q, isUnconditional);
  12813. }
  12814. //normalise to object in an array
  12815. if (isFunction(options)) {
  12816. options = { match: options };
  12817. }
  12818. if (!isArray(options)) {
  12819. options = [options];
  12820. }
  12821. each(options, function (handler) {
  12822. if (isFunction(handler)) {
  12823. handler = { match: handler };
  12824. }
  12825. queries[q].addHandler(handler);
  12826. });
  12827. return this;
  12828. },
  12829. /**
  12830. * unregisters a query and all it's handlers, or a specific handler for a query
  12831. *
  12832. * @param {string} q the media query to target
  12833. * @param {object || function} [handler] specific handler to unregister
  12834. */
  12835. unregister: function unregister(q, handler) {
  12836. var query = this.queries[q];
  12837. if (query) {
  12838. if (handler) {
  12839. query.removeHandler(handler);
  12840. } else {
  12841. query.clear();
  12842. delete this.queries[q];
  12843. }
  12844. }
  12845. return this;
  12846. }
  12847. };
  12848. module.exports = MediaQueryDispatch;
  12849. }, { "1": 1, "4": 4 }], 3: [function (require, module, exports) {
  12850. /**
  12851. * Delegate to handle a media query being matched and unmatched.
  12852. *
  12853. * @param {object} options
  12854. * @param {function} options.match callback for when the media query is matched
  12855. * @param {function} [options.unmatch] callback for when the media query is unmatched
  12856. * @param {function} [options.setup] one-time callback triggered the first time a query is matched
  12857. * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
  12858. * @constructor
  12859. */
  12860. function QueryHandler(options) {
  12861. this.options = options;
  12862. !options.deferSetup && this.setup();
  12863. }
  12864. QueryHandler.prototype = {
  12865. constructor: QueryHandler,
  12866. /**
  12867. * coordinates setup of the handler
  12868. *
  12869. * @function
  12870. */
  12871. setup: function setup() {
  12872. if (this.options.setup) {
  12873. this.options.setup();
  12874. }
  12875. this.initialised = true;
  12876. },
  12877. /**
  12878. * coordinates setup and triggering of the handler
  12879. *
  12880. * @function
  12881. */
  12882. on: function on() {
  12883. !this.initialised && this.setup();
  12884. this.options.match && this.options.match();
  12885. },
  12886. /**
  12887. * coordinates the unmatch event for the handler
  12888. *
  12889. * @function
  12890. */
  12891. off: function off() {
  12892. this.options.unmatch && this.options.unmatch();
  12893. },
  12894. /**
  12895. * called when a handler is to be destroyed.
  12896. * delegates to the destroy or unmatch callbacks, depending on availability.
  12897. *
  12898. * @function
  12899. */
  12900. destroy: function destroy() {
  12901. this.options.destroy ? this.options.destroy() : this.off();
  12902. },
  12903. /**
  12904. * determines equality by reference.
  12905. * if object is supplied compare options, if function, compare match callback
  12906. *
  12907. * @function
  12908. * @param {object || function} [target] the target for comparison
  12909. */
  12910. equals: function equals(target) {
  12911. return this.options === target || this.options.match === target;
  12912. }
  12913. };
  12914. module.exports = QueryHandler;
  12915. }, {}], 4: [function (require, module, exports) {
  12916. /**
  12917. * Helper function for iterating over a collection
  12918. *
  12919. * @param collection
  12920. * @param fn
  12921. */
  12922. function each(collection, fn) {
  12923. var i = 0,
  12924. length = collection.length,
  12925. cont;
  12926. for (i; i < length; i++) {
  12927. cont = fn(collection[i], i);
  12928. if (cont === false) {
  12929. break; //allow early exit
  12930. }
  12931. }
  12932. }
  12933. /**
  12934. * Helper function for determining whether target object is an array
  12935. *
  12936. * @param target the object under test
  12937. * @return {Boolean} true if array, false otherwise
  12938. */
  12939. function isArray(target) {
  12940. return Object.prototype.toString.apply(target) === '[object Array]';
  12941. }
  12942. /**
  12943. * Helper function for determining whether target object is a function
  12944. *
  12945. * @param target the object under test
  12946. * @return {Boolean} true if function, false otherwise
  12947. */
  12948. function isFunction(target) {
  12949. return typeof target === 'function';
  12950. }
  12951. module.exports = {
  12952. isFunction: isFunction,
  12953. isArray: isArray,
  12954. each: each
  12955. };
  12956. }, {}], 5: [function (require, module, exports) {
  12957. var MediaQueryDispatch = require(2);
  12958. module.exports = new MediaQueryDispatch();
  12959. }, { "2": 2 }] }, {}, [5])(5);
  12960. });
  12961. /***/ }),
  12962. /* 32 */
  12963. /***/ (function(module, exports, __webpack_require__) {
  12964. "use strict";
  12965. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12966. /*! jQuery UI - v1.12.1 - 2017-03-23
  12967. * http://jqueryui.com
  12968. * Includes: widget.js, keycode.js, widgets/mouse.js, widgets/slider.js
  12969. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  12970. (function (factory) {
  12971. if (true) {
  12972. // AMD. Register as an anonymous module.
  12973. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12974. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12975. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12976. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12977. } else {
  12978. // Browser globals
  12979. factory(jQuery);
  12980. }
  12981. })(function ($) {
  12982. $.ui = $.ui || {};
  12983. var version = $.ui.version = "1.12.1";
  12984. /*!
  12985. * jQuery UI Widget 1.12.1
  12986. * http://jqueryui.com
  12987. *
  12988. * Copyright jQuery Foundation and other contributors
  12989. * Released under the MIT license.
  12990. * http://jquery.org/license
  12991. */
  12992. //>>label: Widget
  12993. //>>group: Core
  12994. //>>description: Provides a factory for creating stateful widgets with a common API.
  12995. //>>docs: http://api.jqueryui.com/jQuery.widget/
  12996. //>>demos: http://jqueryui.com/widget/
  12997. var widgetUuid = 0;
  12998. var widgetSlice = Array.prototype.slice;
  12999. $.cleanData = function (orig) {
  13000. return function (elems) {
  13001. var events, elem, i;
  13002. for (i = 0; (elem = elems[i]) != null; i++) {
  13003. try {
  13004. // Only trigger remove when necessary to save time
  13005. events = $._data(elem, "events");
  13006. if (events && events.remove) {
  13007. $(elem).triggerHandler("remove");
  13008. }
  13009. // Http://bugs.jquery.com/ticket/8235
  13010. } catch (e) {}
  13011. }
  13012. orig(elems);
  13013. };
  13014. }($.cleanData);
  13015. $.widget = function (name, base, prototype) {
  13016. var existingConstructor, constructor, basePrototype;
  13017. // ProxiedPrototype allows the provided prototype to remain unmodified
  13018. // so that it can be used as a mixin for multiple widgets (#8876)
  13019. var proxiedPrototype = {};
  13020. var namespace = name.split(".")[0];
  13021. name = name.split(".")[1];
  13022. var fullName = namespace + "-" + name;
  13023. if (!prototype) {
  13024. prototype = base;
  13025. base = $.Widget;
  13026. }
  13027. if ($.isArray(prototype)) {
  13028. prototype = $.extend.apply(null, [{}].concat(prototype));
  13029. }
  13030. // Create selector for plugin
  13031. $.expr[":"][fullName.toLowerCase()] = function (elem) {
  13032. return !!$.data(elem, fullName);
  13033. };
  13034. $[namespace] = $[namespace] || {};
  13035. existingConstructor = $[namespace][name];
  13036. constructor = $[namespace][name] = function (options, element) {
  13037. // Allow instantiation without "new" keyword
  13038. if (!this._createWidget) {
  13039. return new constructor(options, element);
  13040. }
  13041. // Allow instantiation without initializing for simple inheritance
  13042. // must use "new" keyword (the code above always passes args)
  13043. if (arguments.length) {
  13044. this._createWidget(options, element);
  13045. }
  13046. };
  13047. // Extend with the existing constructor to carry over any static properties
  13048. $.extend(constructor, existingConstructor, {
  13049. version: prototype.version,
  13050. // Copy the object used to create the prototype in case we need to
  13051. // redefine the widget later
  13052. _proto: $.extend({}, prototype),
  13053. // Track widgets that inherit from this widget in case this widget is
  13054. // redefined after a widget inherits from it
  13055. _childConstructors: []
  13056. });
  13057. basePrototype = new base();
  13058. // We need to make the options hash a property directly on the new instance
  13059. // otherwise we'll modify the options hash on the prototype that we're
  13060. // inheriting from
  13061. basePrototype.options = $.widget.extend({}, basePrototype.options);
  13062. $.each(prototype, function (prop, value) {
  13063. if (!$.isFunction(value)) {
  13064. proxiedPrototype[prop] = value;
  13065. return;
  13066. }
  13067. proxiedPrototype[prop] = function () {
  13068. function _super() {
  13069. return base.prototype[prop].apply(this, arguments);
  13070. }
  13071. function _superApply(args) {
  13072. return base.prototype[prop].apply(this, args);
  13073. }
  13074. return function () {
  13075. var __super = this._super;
  13076. var __superApply = this._superApply;
  13077. var returnValue;
  13078. this._super = _super;
  13079. this._superApply = _superApply;
  13080. returnValue = value.apply(this, arguments);
  13081. this._super = __super;
  13082. this._superApply = __superApply;
  13083. return returnValue;
  13084. };
  13085. }();
  13086. });
  13087. constructor.prototype = $.widget.extend(basePrototype, {
  13088. // TODO: remove support for widgetEventPrefix
  13089. // always use the name + a colon as the prefix, e.g., draggable:start
  13090. // don't prefix for widgets that aren't DOM-based
  13091. widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name
  13092. }, proxiedPrototype, {
  13093. constructor: constructor,
  13094. namespace: namespace,
  13095. widgetName: name,
  13096. widgetFullName: fullName
  13097. });
  13098. // If this widget is being redefined then we need to find all widgets that
  13099. // are inheriting from it and redefine all of them so that they inherit from
  13100. // the new version of this widget. We're essentially trying to replace one
  13101. // level in the prototype chain.
  13102. if (existingConstructor) {
  13103. $.each(existingConstructor._childConstructors, function (i, child) {
  13104. var childPrototype = child.prototype;
  13105. // Redefine the child widget using the same prototype that was
  13106. // originally used, but inherit from the new version of the base
  13107. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
  13108. });
  13109. // Remove the list of existing child constructors from the old constructor
  13110. // so the old child constructors can be garbage collected
  13111. delete existingConstructor._childConstructors;
  13112. } else {
  13113. base._childConstructors.push(constructor);
  13114. }
  13115. $.widget.bridge(name, constructor);
  13116. return constructor;
  13117. };
  13118. $.widget.extend = function (target) {
  13119. var input = widgetSlice.call(arguments, 1);
  13120. var inputIndex = 0;
  13121. var inputLength = input.length;
  13122. var key;
  13123. var value;
  13124. for (; inputIndex < inputLength; inputIndex++) {
  13125. for (key in input[inputIndex]) {
  13126. value = input[inputIndex][key];
  13127. if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
  13128. // Clone objects
  13129. if ($.isPlainObject(value)) {
  13130. target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) :
  13131. // Don't extend strings, arrays, etc. with objects
  13132. $.widget.extend({}, value);
  13133. // Copy everything else by reference
  13134. } else {
  13135. target[key] = value;
  13136. }
  13137. }
  13138. }
  13139. }
  13140. return target;
  13141. };
  13142. $.widget.bridge = function (name, object) {
  13143. var fullName = object.prototype.widgetFullName || name;
  13144. $.fn[name] = function (options) {
  13145. var isMethodCall = typeof options === "string";
  13146. var args = widgetSlice.call(arguments, 1);
  13147. var returnValue = this;
  13148. if (isMethodCall) {
  13149. // If this is an empty collection, we need to have the instance method
  13150. // return undefined instead of the jQuery instance
  13151. if (!this.length && options === "instance") {
  13152. returnValue = undefined;
  13153. } else {
  13154. this.each(function () {
  13155. var methodValue;
  13156. var instance = $.data(this, fullName);
  13157. if (options === "instance") {
  13158. returnValue = instance;
  13159. return false;
  13160. }
  13161. if (!instance) {
  13162. return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'");
  13163. }
  13164. if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
  13165. return $.error("no such method '" + options + "' for " + name + " widget instance");
  13166. }
  13167. methodValue = instance[options].apply(instance, args);
  13168. if (methodValue !== instance && methodValue !== undefined) {
  13169. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  13170. return false;
  13171. }
  13172. });
  13173. }
  13174. } else {
  13175. // Allow multiple hashes to be passed on init
  13176. if (args.length) {
  13177. options = $.widget.extend.apply(null, [options].concat(args));
  13178. }
  13179. this.each(function () {
  13180. var instance = $.data(this, fullName);
  13181. if (instance) {
  13182. instance.option(options || {});
  13183. if (instance._init) {
  13184. instance._init();
  13185. }
  13186. } else {
  13187. $.data(this, fullName, new object(options, this));
  13188. }
  13189. });
  13190. }
  13191. return returnValue;
  13192. };
  13193. };
  13194. $.Widget = function () /* options, element */{};
  13195. $.Widget._childConstructors = [];
  13196. $.Widget.prototype = {
  13197. widgetName: "widget",
  13198. widgetEventPrefix: "",
  13199. defaultElement: "<div>",
  13200. options: {
  13201. classes: {},
  13202. disabled: false,
  13203. // Callbacks
  13204. create: null
  13205. },
  13206. _createWidget: function _createWidget(options, element) {
  13207. element = $(element || this.defaultElement || this)[0];
  13208. this.element = $(element);
  13209. this.uuid = widgetUuid++;
  13210. this.eventNamespace = "." + this.widgetName + this.uuid;
  13211. this.bindings = $();
  13212. this.hoverable = $();
  13213. this.focusable = $();
  13214. this.classesElementLookup = {};
  13215. if (element !== this) {
  13216. $.data(element, this.widgetFullName, this);
  13217. this._on(true, this.element, {
  13218. remove: function remove(event) {
  13219. if (event.target === element) {
  13220. this.destroy();
  13221. }
  13222. }
  13223. });
  13224. this.document = $(element.style ?
  13225. // Element within the document
  13226. element.ownerDocument :
  13227. // Element is window or document
  13228. element.document || element);
  13229. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  13230. }
  13231. this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
  13232. this._create();
  13233. if (this.options.disabled) {
  13234. this._setOptionDisabled(this.options.disabled);
  13235. }
  13236. this._trigger("create", null, this._getCreateEventData());
  13237. this._init();
  13238. },
  13239. _getCreateOptions: function _getCreateOptions() {
  13240. return {};
  13241. },
  13242. _getCreateEventData: $.noop,
  13243. _create: $.noop,
  13244. _init: $.noop,
  13245. destroy: function destroy() {
  13246. var that = this;
  13247. this._destroy();
  13248. $.each(this.classesElementLookup, function (key, value) {
  13249. that._removeClass(value, key);
  13250. });
  13251. // We can probably remove the unbind calls in 2.0
  13252. // all event bindings should go through this._on()
  13253. this.element.off(this.eventNamespace).removeData(this.widgetFullName);
  13254. this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
  13255. // Clean up events and states
  13256. this.bindings.off(this.eventNamespace);
  13257. },
  13258. _destroy: $.noop,
  13259. widget: function widget() {
  13260. return this.element;
  13261. },
  13262. option: function option(key, value) {
  13263. var options = key;
  13264. var parts;
  13265. var curOption;
  13266. var i;
  13267. if (arguments.length === 0) {
  13268. // Don't return a reference to the internal hash
  13269. return $.widget.extend({}, this.options);
  13270. }
  13271. if (typeof key === "string") {
  13272. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  13273. options = {};
  13274. parts = key.split(".");
  13275. key = parts.shift();
  13276. if (parts.length) {
  13277. curOption = options[key] = $.widget.extend({}, this.options[key]);
  13278. for (i = 0; i < parts.length - 1; i++) {
  13279. curOption[parts[i]] = curOption[parts[i]] || {};
  13280. curOption = curOption[parts[i]];
  13281. }
  13282. key = parts.pop();
  13283. if (arguments.length === 1) {
  13284. return curOption[key] === undefined ? null : curOption[key];
  13285. }
  13286. curOption[key] = value;
  13287. } else {
  13288. if (arguments.length === 1) {
  13289. return this.options[key] === undefined ? null : this.options[key];
  13290. }
  13291. options[key] = value;
  13292. }
  13293. }
  13294. this._setOptions(options);
  13295. return this;
  13296. },
  13297. _setOptions: function _setOptions(options) {
  13298. var key;
  13299. for (key in options) {
  13300. this._setOption(key, options[key]);
  13301. }
  13302. return this;
  13303. },
  13304. _setOption: function _setOption(key, value) {
  13305. if (key === "classes") {
  13306. this._setOptionClasses(value);
  13307. }
  13308. this.options[key] = value;
  13309. if (key === "disabled") {
  13310. this._setOptionDisabled(value);
  13311. }
  13312. return this;
  13313. },
  13314. _setOptionClasses: function _setOptionClasses(value) {
  13315. var classKey, elements, currentElements;
  13316. for (classKey in value) {
  13317. currentElements = this.classesElementLookup[classKey];
  13318. if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) {
  13319. continue;
  13320. }
  13321. // We are doing this to create a new jQuery object because the _removeClass() call
  13322. // on the next line is going to destroy the reference to the current elements being
  13323. // tracked. We need to save a copy of this collection so that we can add the new classes
  13324. // below.
  13325. elements = $(currentElements.get());
  13326. this._removeClass(currentElements, classKey);
  13327. // We don't use _addClass() here, because that uses this.options.classes
  13328. // for generating the string of classes. We want to use the value passed in from
  13329. // _setOption(), this is the new value of the classes option which was passed to
  13330. // _setOption(). We pass this value directly to _classes().
  13331. elements.addClass(this._classes({
  13332. element: elements,
  13333. keys: classKey,
  13334. classes: value,
  13335. add: true
  13336. }));
  13337. }
  13338. },
  13339. _setOptionDisabled: function _setOptionDisabled(value) {
  13340. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  13341. // If the widget is becoming disabled, then nothing is interactive
  13342. if (value) {
  13343. this._removeClass(this.hoverable, null, "ui-state-hover");
  13344. this._removeClass(this.focusable, null, "ui-state-focus");
  13345. }
  13346. },
  13347. enable: function enable() {
  13348. return this._setOptions({ disabled: false });
  13349. },
  13350. disable: function disable() {
  13351. return this._setOptions({ disabled: true });
  13352. },
  13353. _classes: function _classes(options) {
  13354. var full = [];
  13355. var that = this;
  13356. options = $.extend({
  13357. element: this.element,
  13358. classes: this.options.classes || {}
  13359. }, options);
  13360. function processClassString(classes, checkOption) {
  13361. var current, i;
  13362. for (i = 0; i < classes.length; i++) {
  13363. current = that.classesElementLookup[classes[i]] || $();
  13364. if (options.add) {
  13365. current = $($.unique(current.get().concat(options.element.get())));
  13366. } else {
  13367. current = $(current.not(options.element).get());
  13368. }
  13369. that.classesElementLookup[classes[i]] = current;
  13370. full.push(classes[i]);
  13371. if (checkOption && options.classes[classes[i]]) {
  13372. full.push(options.classes[classes[i]]);
  13373. }
  13374. }
  13375. }
  13376. this._on(options.element, {
  13377. "remove": "_untrackClassesElement"
  13378. });
  13379. if (options.keys) {
  13380. processClassString(options.keys.match(/\S+/g) || [], true);
  13381. }
  13382. if (options.extra) {
  13383. processClassString(options.extra.match(/\S+/g) || []);
  13384. }
  13385. return full.join(" ");
  13386. },
  13387. _untrackClassesElement: function _untrackClassesElement(event) {
  13388. var that = this;
  13389. $.each(that.classesElementLookup, function (key, value) {
  13390. if ($.inArray(event.target, value) !== -1) {
  13391. that.classesElementLookup[key] = $(value.not(event.target).get());
  13392. }
  13393. });
  13394. },
  13395. _removeClass: function _removeClass(element, keys, extra) {
  13396. return this._toggleClass(element, keys, extra, false);
  13397. },
  13398. _addClass: function _addClass(element, keys, extra) {
  13399. return this._toggleClass(element, keys, extra, true);
  13400. },
  13401. _toggleClass: function _toggleClass(element, keys, extra, add) {
  13402. add = typeof add === "boolean" ? add : extra;
  13403. var shift = typeof element === "string" || element === null,
  13404. options = {
  13405. extra: shift ? keys : extra,
  13406. keys: shift ? element : keys,
  13407. element: shift ? this.element : element,
  13408. add: add
  13409. };
  13410. options.element.toggleClass(this._classes(options), add);
  13411. return this;
  13412. },
  13413. _on: function _on(suppressDisabledCheck, element, handlers) {
  13414. var delegateElement;
  13415. var instance = this;
  13416. // No suppressDisabledCheck flag, shuffle arguments
  13417. if (typeof suppressDisabledCheck !== "boolean") {
  13418. handlers = element;
  13419. element = suppressDisabledCheck;
  13420. suppressDisabledCheck = false;
  13421. }
  13422. // No element argument, shuffle and use this.element
  13423. if (!handlers) {
  13424. handlers = element;
  13425. element = this.element;
  13426. delegateElement = this.widget();
  13427. } else {
  13428. element = delegateElement = $(element);
  13429. this.bindings = this.bindings.add(element);
  13430. }
  13431. $.each(handlers, function (event, handler) {
  13432. function handlerProxy() {
  13433. // Allow widgets to customize the disabled handling
  13434. // - disabled as an array instead of boolean
  13435. // - disabled class as method for disabling individual parts
  13436. if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) {
  13437. return;
  13438. }
  13439. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13440. }
  13441. // Copy the guid so direct unbinding works
  13442. if (typeof handler !== "string") {
  13443. handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++;
  13444. }
  13445. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  13446. var eventName = match[1] + instance.eventNamespace;
  13447. var selector = match[2];
  13448. if (selector) {
  13449. delegateElement.on(eventName, selector, handlerProxy);
  13450. } else {
  13451. element.on(eventName, handlerProxy);
  13452. }
  13453. });
  13454. },
  13455. _off: function _off(element, eventName) {
  13456. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
  13457. element.off(eventName).off(eventName);
  13458. // Clear the stack to avoid memory leaks (#10056)
  13459. this.bindings = $(this.bindings.not(element).get());
  13460. this.focusable = $(this.focusable.not(element).get());
  13461. this.hoverable = $(this.hoverable.not(element).get());
  13462. },
  13463. _delay: function _delay(handler, delay) {
  13464. function handlerProxy() {
  13465. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13466. }
  13467. var instance = this;
  13468. return setTimeout(handlerProxy, delay || 0);
  13469. },
  13470. _hoverable: function _hoverable(element) {
  13471. this.hoverable = this.hoverable.add(element);
  13472. this._on(element, {
  13473. mouseenter: function mouseenter(event) {
  13474. this._addClass($(event.currentTarget), null, "ui-state-hover");
  13475. },
  13476. mouseleave: function mouseleave(event) {
  13477. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  13478. }
  13479. });
  13480. },
  13481. _focusable: function _focusable(element) {
  13482. this.focusable = this.focusable.add(element);
  13483. this._on(element, {
  13484. focusin: function focusin(event) {
  13485. this._addClass($(event.currentTarget), null, "ui-state-focus");
  13486. },
  13487. focusout: function focusout(event) {
  13488. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  13489. }
  13490. });
  13491. },
  13492. _trigger: function _trigger(type, event, data) {
  13493. var prop, orig;
  13494. var callback = this.options[type];
  13495. data = data || {};
  13496. event = $.Event(event);
  13497. event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
  13498. // The original event may come from any element
  13499. // so we need to reset the target on the new event
  13500. event.target = this.element[0];
  13501. // Copy original event properties over to the new event
  13502. orig = event.originalEvent;
  13503. if (orig) {
  13504. for (prop in orig) {
  13505. if (!(prop in event)) {
  13506. event[prop] = orig[prop];
  13507. }
  13508. }
  13509. }
  13510. this.element.trigger(event, data);
  13511. return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented());
  13512. }
  13513. };
  13514. $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
  13515. $.Widget.prototype["_" + method] = function (element, options, callback) {
  13516. if (typeof options === "string") {
  13517. options = { effect: options };
  13518. }
  13519. var hasOptions;
  13520. var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
  13521. options = options || {};
  13522. if (typeof options === "number") {
  13523. options = { duration: options };
  13524. }
  13525. hasOptions = !$.isEmptyObject(options);
  13526. options.complete = callback;
  13527. if (options.delay) {
  13528. element.delay(options.delay);
  13529. }
  13530. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  13531. element[method](options);
  13532. } else if (effectName !== method && element[effectName]) {
  13533. element[effectName](options.duration, options.easing, callback);
  13534. } else {
  13535. element.queue(function (next) {
  13536. $(this)[method]();
  13537. if (callback) {
  13538. callback.call(element[0]);
  13539. }
  13540. next();
  13541. });
  13542. }
  13543. };
  13544. });
  13545. var widget = $.widget;
  13546. /*!
  13547. * jQuery UI Keycode 1.12.1
  13548. * http://jqueryui.com
  13549. *
  13550. * Copyright jQuery Foundation and other contributors
  13551. * Released under the MIT license.
  13552. * http://jquery.org/license
  13553. */
  13554. //>>label: Keycode
  13555. //>>group: Core
  13556. //>>description: Provide keycodes as keynames
  13557. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  13558. var keycode = $.ui.keyCode = {
  13559. BACKSPACE: 8,
  13560. COMMA: 188,
  13561. DELETE: 46,
  13562. DOWN: 40,
  13563. END: 35,
  13564. ENTER: 13,
  13565. ESCAPE: 27,
  13566. HOME: 36,
  13567. LEFT: 37,
  13568. PAGE_DOWN: 34,
  13569. PAGE_UP: 33,
  13570. PERIOD: 190,
  13571. RIGHT: 39,
  13572. SPACE: 32,
  13573. TAB: 9,
  13574. UP: 38
  13575. };
  13576. // This file is deprecated
  13577. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  13578. /*!
  13579. * jQuery UI Mouse 1.12.1
  13580. * http://jqueryui.com
  13581. *
  13582. * Copyright jQuery Foundation and other contributors
  13583. * Released under the MIT license.
  13584. * http://jquery.org/license
  13585. */
  13586. //>>label: Mouse
  13587. //>>group: Widgets
  13588. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  13589. //>>docs: http://api.jqueryui.com/mouse/
  13590. var mouseHandled = false;
  13591. $(document).on("mouseup", function () {
  13592. mouseHandled = false;
  13593. });
  13594. var widgetsMouse = $.widget("ui.mouse", {
  13595. version: "1.12.1",
  13596. options: {
  13597. cancel: "input, textarea, button, select, option",
  13598. distance: 1,
  13599. delay: 0
  13600. },
  13601. _mouseInit: function _mouseInit() {
  13602. var that = this;
  13603. this.element.on("mousedown." + this.widgetName, function (event) {
  13604. return that._mouseDown(event);
  13605. }).on("click." + this.widgetName, function (event) {
  13606. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  13607. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  13608. event.stopImmediatePropagation();
  13609. return false;
  13610. }
  13611. });
  13612. this.started = false;
  13613. },
  13614. // TODO: make sure destroying one instance of mouse doesn't mess with
  13615. // other instances of mouse
  13616. _mouseDestroy: function _mouseDestroy() {
  13617. this.element.off("." + this.widgetName);
  13618. if (this._mouseMoveDelegate) {
  13619. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13620. }
  13621. },
  13622. _mouseDown: function _mouseDown(event) {
  13623. // don't let more than one widget handle mouseStart
  13624. if (mouseHandled) {
  13625. return;
  13626. }
  13627. this._mouseMoved = false;
  13628. // We may have missed mouseup (out of window)
  13629. this._mouseStarted && this._mouseUp(event);
  13630. this._mouseDownEvent = event;
  13631. var that = this,
  13632. btnIsLeft = event.which === 1,
  13633. // event.target.nodeName works around a bug in IE 8 with
  13634. // disabled inputs (#7620)
  13635. elIsCancel = typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false;
  13636. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  13637. return true;
  13638. }
  13639. this.mouseDelayMet = !this.options.delay;
  13640. if (!this.mouseDelayMet) {
  13641. this._mouseDelayTimer = setTimeout(function () {
  13642. that.mouseDelayMet = true;
  13643. }, this.options.delay);
  13644. }
  13645. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13646. this._mouseStarted = this._mouseStart(event) !== false;
  13647. if (!this._mouseStarted) {
  13648. event.preventDefault();
  13649. return true;
  13650. }
  13651. }
  13652. // Click event may never have fired (Gecko & Opera)
  13653. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  13654. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  13655. }
  13656. // These delegates are required to keep context
  13657. this._mouseMoveDelegate = function (event) {
  13658. return that._mouseMove(event);
  13659. };
  13660. this._mouseUpDelegate = function (event) {
  13661. return that._mouseUp(event);
  13662. };
  13663. this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
  13664. event.preventDefault();
  13665. mouseHandled = true;
  13666. return true;
  13667. },
  13668. _mouseMove: function _mouseMove(event) {
  13669. // Only check for mouseups outside the document if you've moved inside the document
  13670. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  13671. // fire a mousemove event if content is placed under the cursor. See #7778
  13672. // Support: IE <9
  13673. if (this._mouseMoved) {
  13674. // IE mouseup check - mouseup happened when mouse was out of window
  13675. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) {
  13676. return this._mouseUp(event);
  13677. // Iframe mouseup check - mouseup occurred in another document
  13678. } else if (!event.which) {
  13679. // Support: Safari <=8 - 9
  13680. // Safari sets which to 0 if you press any of the following keys
  13681. // during a drag (#14461)
  13682. if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  13683. this.ignoreMissingWhich = true;
  13684. } else if (!this.ignoreMissingWhich) {
  13685. return this._mouseUp(event);
  13686. }
  13687. }
  13688. }
  13689. if (event.which || event.button) {
  13690. this._mouseMoved = true;
  13691. }
  13692. if (this._mouseStarted) {
  13693. this._mouseDrag(event);
  13694. return event.preventDefault();
  13695. }
  13696. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13697. this._mouseStarted = this._mouseStart(this._mouseDownEvent, event) !== false;
  13698. this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event);
  13699. }
  13700. return !this._mouseStarted;
  13701. },
  13702. _mouseUp: function _mouseUp(event) {
  13703. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13704. if (this._mouseStarted) {
  13705. this._mouseStarted = false;
  13706. if (event.target === this._mouseDownEvent.target) {
  13707. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  13708. }
  13709. this._mouseStop(event);
  13710. }
  13711. if (this._mouseDelayTimer) {
  13712. clearTimeout(this._mouseDelayTimer);
  13713. delete this._mouseDelayTimer;
  13714. }
  13715. this.ignoreMissingWhich = false;
  13716. mouseHandled = false;
  13717. event.preventDefault();
  13718. },
  13719. _mouseDistanceMet: function _mouseDistanceMet(event) {
  13720. return Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance;
  13721. },
  13722. _mouseDelayMet: function _mouseDelayMet() /* event */{
  13723. return this.mouseDelayMet;
  13724. },
  13725. // These are placeholder methods, to be overriden by extending plugin
  13726. _mouseStart: function _mouseStart() /* event */{},
  13727. _mouseDrag: function _mouseDrag() /* event */{},
  13728. _mouseStop: function _mouseStop() /* event */{},
  13729. _mouseCapture: function _mouseCapture() /* event */{
  13730. return true;
  13731. }
  13732. });
  13733. /*!
  13734. * jQuery UI Slider 1.12.1
  13735. * http://jqueryui.com
  13736. *
  13737. * Copyright jQuery Foundation and other contributors
  13738. * Released under the MIT license.
  13739. * http://jquery.org/license
  13740. */
  13741. //>>label: Slider
  13742. //>>group: Widgets
  13743. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  13744. //>>docs: http://api.jqueryui.com/slider/
  13745. //>>demos: http://jqueryui.com/slider/
  13746. //>>css.structure: ../../themes/base/core.css
  13747. //>>css.structure: ../../themes/base/slider.css
  13748. //>>css.theme: ../../themes/base/theme.css
  13749. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  13750. version: "1.12.1",
  13751. widgetEventPrefix: "slide",
  13752. options: {
  13753. animate: false,
  13754. classes: {
  13755. "ui-slider": "ui-corner-all",
  13756. "ui-slider-handle": "ui-corner-all",
  13757. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  13758. // element, but worked best visually with a variety of themes
  13759. "ui-slider-range": "ui-corner-all ui-widget-header"
  13760. },
  13761. distance: 0,
  13762. max: 100,
  13763. min: 0,
  13764. orientation: "horizontal",
  13765. range: false,
  13766. step: 1,
  13767. value: 0,
  13768. values: null,
  13769. // Callbacks
  13770. change: null,
  13771. slide: null,
  13772. start: null,
  13773. stop: null
  13774. },
  13775. // Number of pages in a slider
  13776. // (how many times can you page up/down to go through the whole range)
  13777. numPages: 5,
  13778. _create: function _create() {
  13779. this._keySliding = false;
  13780. this._mouseSliding = false;
  13781. this._animateOff = true;
  13782. this._handleIndex = null;
  13783. this._detectOrientation();
  13784. this._mouseInit();
  13785. this._calculateNewMax();
  13786. this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content");
  13787. this._refresh();
  13788. this._animateOff = false;
  13789. },
  13790. _refresh: function _refresh() {
  13791. this._createRange();
  13792. this._createHandles();
  13793. this._setupEvents();
  13794. this._refreshValue();
  13795. },
  13796. _createHandles: function _createHandles() {
  13797. var i,
  13798. handleCount,
  13799. options = this.options,
  13800. existingHandles = this.element.find(".ui-slider-handle"),
  13801. handle = "<span tabindex='0'></span>",
  13802. handles = [];
  13803. handleCount = options.values && options.values.length || 1;
  13804. if (existingHandles.length > handleCount) {
  13805. existingHandles.slice(handleCount).remove();
  13806. existingHandles = existingHandles.slice(0, handleCount);
  13807. }
  13808. for (i = existingHandles.length; i < handleCount; i++) {
  13809. handles.push(handle);
  13810. }
  13811. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  13812. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  13813. this.handle = this.handles.eq(0);
  13814. this.handles.each(function (i) {
  13815. $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0);
  13816. });
  13817. },
  13818. _createRange: function _createRange() {
  13819. var options = this.options;
  13820. if (options.range) {
  13821. if (options.range === true) {
  13822. if (!options.values) {
  13823. options.values = [this._valueMin(), this._valueMin()];
  13824. } else if (options.values.length && options.values.length !== 2) {
  13825. options.values = [options.values[0], options.values[0]];
  13826. } else if ($.isArray(options.values)) {
  13827. options.values = options.values.slice(0);
  13828. }
  13829. }
  13830. if (!this.range || !this.range.length) {
  13831. this.range = $("<div>").appendTo(this.element);
  13832. this._addClass(this.range, "ui-slider-range");
  13833. } else {
  13834. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  13835. // Handle range switching from true to min/max
  13836. this.range.css({
  13837. "left": "",
  13838. "bottom": ""
  13839. });
  13840. }
  13841. if (options.range === "min" || options.range === "max") {
  13842. this._addClass(this.range, "ui-slider-range-" + options.range);
  13843. }
  13844. } else {
  13845. if (this.range) {
  13846. this.range.remove();
  13847. }
  13848. this.range = null;
  13849. }
  13850. },
  13851. _setupEvents: function _setupEvents() {
  13852. this._off(this.handles);
  13853. this._on(this.handles, this._handleEvents);
  13854. this._hoverable(this.handles);
  13855. this._focusable(this.handles);
  13856. },
  13857. _destroy: function _destroy() {
  13858. this.handles.remove();
  13859. if (this.range) {
  13860. this.range.remove();
  13861. }
  13862. this._mouseDestroy();
  13863. },
  13864. _mouseCapture: function _mouseCapture(event) {
  13865. var position,
  13866. normValue,
  13867. distance,
  13868. closestHandle,
  13869. index,
  13870. allowed,
  13871. offset,
  13872. mouseOverHandle,
  13873. that = this,
  13874. o = this.options;
  13875. if (o.disabled) {
  13876. return false;
  13877. }
  13878. this.elementSize = {
  13879. width: this.element.outerWidth(),
  13880. height: this.element.outerHeight()
  13881. };
  13882. this.elementOffset = this.element.offset();
  13883. position = { x: event.pageX, y: event.pageY };
  13884. normValue = this._normValueFromMouse(position);
  13885. distance = this._valueMax() - this._valueMin() + 1;
  13886. this.handles.each(function (i) {
  13887. var thisDistance = Math.abs(normValue - that.values(i));
  13888. if (distance > thisDistance || distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min)) {
  13889. distance = thisDistance;
  13890. closestHandle = $(this);
  13891. index = i;
  13892. }
  13893. });
  13894. allowed = this._start(event, index);
  13895. if (allowed === false) {
  13896. return false;
  13897. }
  13898. this._mouseSliding = true;
  13899. this._handleIndex = index;
  13900. this._addClass(closestHandle, null, "ui-state-active");
  13901. closestHandle.trigger("focus");
  13902. offset = closestHandle.offset();
  13903. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  13904. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  13905. left: event.pageX - offset.left - closestHandle.width() / 2,
  13906. top: event.pageY - offset.top - closestHandle.height() / 2 - (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + (parseInt(closestHandle.css("marginTop"), 10) || 0)
  13907. };
  13908. if (!this.handles.hasClass("ui-state-hover")) {
  13909. this._slide(event, index, normValue);
  13910. }
  13911. this._animateOff = true;
  13912. return true;
  13913. },
  13914. _mouseStart: function _mouseStart() {
  13915. return true;
  13916. },
  13917. _mouseDrag: function _mouseDrag(event) {
  13918. var position = { x: event.pageX, y: event.pageY },
  13919. normValue = this._normValueFromMouse(position);
  13920. this._slide(event, this._handleIndex, normValue);
  13921. return false;
  13922. },
  13923. _mouseStop: function _mouseStop(event) {
  13924. this._removeClass(this.handles, null, "ui-state-active");
  13925. this._mouseSliding = false;
  13926. this._stop(event, this._handleIndex);
  13927. this._change(event, this._handleIndex);
  13928. this._handleIndex = null;
  13929. this._clickOffset = null;
  13930. this._animateOff = false;
  13931. return false;
  13932. },
  13933. _detectOrientation: function _detectOrientation() {
  13934. this.orientation = this.options.orientation === "vertical" ? "vertical" : "horizontal";
  13935. },
  13936. _normValueFromMouse: function _normValueFromMouse(position) {
  13937. var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse;
  13938. if (this.orientation === "horizontal") {
  13939. pixelTotal = this.elementSize.width;
  13940. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  13941. } else {
  13942. pixelTotal = this.elementSize.height;
  13943. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  13944. }
  13945. percentMouse = pixelMouse / pixelTotal;
  13946. if (percentMouse > 1) {
  13947. percentMouse = 1;
  13948. }
  13949. if (percentMouse < 0) {
  13950. percentMouse = 0;
  13951. }
  13952. if (this.orientation === "vertical") {
  13953. percentMouse = 1 - percentMouse;
  13954. }
  13955. valueTotal = this._valueMax() - this._valueMin();
  13956. valueMouse = this._valueMin() + percentMouse * valueTotal;
  13957. return this._trimAlignValue(valueMouse);
  13958. },
  13959. _uiHash: function _uiHash(index, value, values) {
  13960. var uiHash = {
  13961. handle: this.handles[index],
  13962. handleIndex: index,
  13963. value: value !== undefined ? value : this.value()
  13964. };
  13965. if (this._hasMultipleValues()) {
  13966. uiHash.value = value !== undefined ? value : this.values(index);
  13967. uiHash.values = values || this.values();
  13968. }
  13969. return uiHash;
  13970. },
  13971. _hasMultipleValues: function _hasMultipleValues() {
  13972. return this.options.values && this.options.values.length;
  13973. },
  13974. _start: function _start(event, index) {
  13975. return this._trigger("start", event, this._uiHash(index));
  13976. },
  13977. _slide: function _slide(event, index, newVal) {
  13978. var allowed,
  13979. otherVal,
  13980. currentValue = this.value(),
  13981. newValues = this.values();
  13982. if (this._hasMultipleValues()) {
  13983. otherVal = this.values(index ? 0 : 1);
  13984. currentValue = this.values(index);
  13985. if (this.options.values.length === 2 && this.options.range === true) {
  13986. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  13987. }
  13988. newValues[index] = newVal;
  13989. }
  13990. if (newVal === currentValue) {
  13991. return;
  13992. }
  13993. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  13994. // A slide can be canceled by returning false from the slide callback
  13995. if (allowed === false) {
  13996. return;
  13997. }
  13998. if (this._hasMultipleValues()) {
  13999. this.values(index, newVal);
  14000. } else {
  14001. this.value(newVal);
  14002. }
  14003. },
  14004. _stop: function _stop(event, index) {
  14005. this._trigger("stop", event, this._uiHash(index));
  14006. },
  14007. _change: function _change(event, index) {
  14008. if (!this._keySliding && !this._mouseSliding) {
  14009. //store the last changed value index for reference when handles overlap
  14010. this._lastChangedValue = index;
  14011. this._trigger("change", event, this._uiHash(index));
  14012. }
  14013. },
  14014. value: function value(newValue) {
  14015. if (arguments.length) {
  14016. this.options.value = this._trimAlignValue(newValue);
  14017. this._refreshValue();
  14018. this._change(null, 0);
  14019. return;
  14020. }
  14021. return this._value();
  14022. },
  14023. values: function values(index, newValue) {
  14024. var vals, newValues, i;
  14025. if (arguments.length > 1) {
  14026. this.options.values[index] = this._trimAlignValue(newValue);
  14027. this._refreshValue();
  14028. this._change(null, index);
  14029. return;
  14030. }
  14031. if (arguments.length) {
  14032. if ($.isArray(arguments[0])) {
  14033. vals = this.options.values;
  14034. newValues = arguments[0];
  14035. for (i = 0; i < vals.length; i += 1) {
  14036. vals[i] = this._trimAlignValue(newValues[i]);
  14037. this._change(null, i);
  14038. }
  14039. this._refreshValue();
  14040. } else {
  14041. if (this._hasMultipleValues()) {
  14042. return this._values(index);
  14043. } else {
  14044. return this.value();
  14045. }
  14046. }
  14047. } else {
  14048. return this._values();
  14049. }
  14050. },
  14051. _setOption: function _setOption(key, value) {
  14052. var i,
  14053. valsLength = 0;
  14054. if (key === "range" && this.options.range === true) {
  14055. if (value === "min") {
  14056. this.options.value = this._values(0);
  14057. this.options.values = null;
  14058. } else if (value === "max") {
  14059. this.options.value = this._values(this.options.values.length - 1);
  14060. this.options.values = null;
  14061. }
  14062. }
  14063. if ($.isArray(this.options.values)) {
  14064. valsLength = this.options.values.length;
  14065. }
  14066. this._super(key, value);
  14067. switch (key) {
  14068. case "orientation":
  14069. this._detectOrientation();
  14070. this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation);
  14071. this._refreshValue();
  14072. if (this.options.range) {
  14073. this._refreshRange(value);
  14074. }
  14075. // Reset positioning from previous orientation
  14076. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  14077. break;
  14078. case "value":
  14079. this._animateOff = true;
  14080. this._refreshValue();
  14081. this._change(null, 0);
  14082. this._animateOff = false;
  14083. break;
  14084. case "values":
  14085. this._animateOff = true;
  14086. this._refreshValue();
  14087. // Start from the last handle to prevent unreachable handles (#9046)
  14088. for (i = valsLength - 1; i >= 0; i--) {
  14089. this._change(null, i);
  14090. }
  14091. this._animateOff = false;
  14092. break;
  14093. case "step":
  14094. case "min":
  14095. case "max":
  14096. this._animateOff = true;
  14097. this._calculateNewMax();
  14098. this._refreshValue();
  14099. this._animateOff = false;
  14100. break;
  14101. case "range":
  14102. this._animateOff = true;
  14103. this._refresh();
  14104. this._animateOff = false;
  14105. break;
  14106. }
  14107. },
  14108. _setOptionDisabled: function _setOptionDisabled(value) {
  14109. this._super(value);
  14110. this._toggleClass(null, "ui-state-disabled", !!value);
  14111. },
  14112. //internal value getter
  14113. // _value() returns value trimmed by min and max, aligned by step
  14114. _value: function _value() {
  14115. var val = this.options.value;
  14116. val = this._trimAlignValue(val);
  14117. return val;
  14118. },
  14119. //internal values getter
  14120. // _values() returns array of values trimmed by min and max, aligned by step
  14121. // _values( index ) returns single value trimmed by min and max, aligned by step
  14122. _values: function _values(index) {
  14123. var val, vals, i;
  14124. if (arguments.length) {
  14125. val = this.options.values[index];
  14126. val = this._trimAlignValue(val);
  14127. return val;
  14128. } else if (this._hasMultipleValues()) {
  14129. // .slice() creates a copy of the array
  14130. // this copy gets trimmed by min and max and then returned
  14131. vals = this.options.values.slice();
  14132. for (i = 0; i < vals.length; i += 1) {
  14133. vals[i] = this._trimAlignValue(vals[i]);
  14134. }
  14135. return vals;
  14136. } else {
  14137. return [];
  14138. }
  14139. },
  14140. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  14141. _trimAlignValue: function _trimAlignValue(val) {
  14142. if (val <= this._valueMin()) {
  14143. return this._valueMin();
  14144. }
  14145. if (val >= this._valueMax()) {
  14146. return this._valueMax();
  14147. }
  14148. var step = this.options.step > 0 ? this.options.step : 1,
  14149. valModStep = (val - this._valueMin()) % step,
  14150. alignValue = val - valModStep;
  14151. if (Math.abs(valModStep) * 2 >= step) {
  14152. alignValue += valModStep > 0 ? step : -step;
  14153. }
  14154. // Since JavaScript has problems with large floats, round
  14155. // the final value to 5 digits after the decimal point (see #4124)
  14156. return parseFloat(alignValue.toFixed(5));
  14157. },
  14158. _calculateNewMax: function _calculateNewMax() {
  14159. var max = this.options.max,
  14160. min = this._valueMin(),
  14161. step = this.options.step,
  14162. aboveMin = Math.round((max - min) / step) * step;
  14163. max = aboveMin + min;
  14164. if (max > this.options.max) {
  14165. //If max is not divisible by step, rounding off may increase its value
  14166. max -= step;
  14167. }
  14168. this.max = parseFloat(max.toFixed(this._precision()));
  14169. },
  14170. _precision: function _precision() {
  14171. var precision = this._precisionOf(this.options.step);
  14172. if (this.options.min !== null) {
  14173. precision = Math.max(precision, this._precisionOf(this.options.min));
  14174. }
  14175. return precision;
  14176. },
  14177. _precisionOf: function _precisionOf(num) {
  14178. var str = num.toString(),
  14179. decimal = str.indexOf(".");
  14180. return decimal === -1 ? 0 : str.length - decimal - 1;
  14181. },
  14182. _valueMin: function _valueMin() {
  14183. return this.options.min;
  14184. },
  14185. _valueMax: function _valueMax() {
  14186. return this.max;
  14187. },
  14188. _refreshRange: function _refreshRange(orientation) {
  14189. if (orientation === "vertical") {
  14190. this.range.css({ "width": "", "left": "" });
  14191. }
  14192. if (orientation === "horizontal") {
  14193. this.range.css({ "height": "", "bottom": "" });
  14194. }
  14195. },
  14196. _refreshValue: function _refreshValue() {
  14197. var lastValPercent,
  14198. valPercent,
  14199. value,
  14200. valueMin,
  14201. valueMax,
  14202. oRange = this.options.range,
  14203. o = this.options,
  14204. that = this,
  14205. animate = !this._animateOff ? o.animate : false,
  14206. _set = {};
  14207. if (this._hasMultipleValues()) {
  14208. this.handles.each(function (i) {
  14209. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100;
  14210. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14211. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14212. if (that.options.range === true) {
  14213. if (that.orientation === "horizontal") {
  14214. if (i === 0) {
  14215. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14216. left: valPercent + "%"
  14217. }, o.animate);
  14218. }
  14219. if (i === 1) {
  14220. that.range[animate ? "animate" : "css"]({
  14221. width: valPercent - lastValPercent + "%"
  14222. }, {
  14223. queue: false,
  14224. duration: o.animate
  14225. });
  14226. }
  14227. } else {
  14228. if (i === 0) {
  14229. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14230. bottom: valPercent + "%"
  14231. }, o.animate);
  14232. }
  14233. if (i === 1) {
  14234. that.range[animate ? "animate" : "css"]({
  14235. height: valPercent - lastValPercent + "%"
  14236. }, {
  14237. queue: false,
  14238. duration: o.animate
  14239. });
  14240. }
  14241. }
  14242. }
  14243. lastValPercent = valPercent;
  14244. });
  14245. } else {
  14246. value = this.value();
  14247. valueMin = this._valueMin();
  14248. valueMax = this._valueMax();
  14249. valPercent = valueMax !== valueMin ? (value - valueMin) / (valueMax - valueMin) * 100 : 0;
  14250. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14251. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14252. if (oRange === "min" && this.orientation === "horizontal") {
  14253. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14254. width: valPercent + "%"
  14255. }, o.animate);
  14256. }
  14257. if (oRange === "max" && this.orientation === "horizontal") {
  14258. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14259. width: 100 - valPercent + "%"
  14260. }, o.animate);
  14261. }
  14262. if (oRange === "min" && this.orientation === "vertical") {
  14263. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14264. height: valPercent + "%"
  14265. }, o.animate);
  14266. }
  14267. if (oRange === "max" && this.orientation === "vertical") {
  14268. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14269. height: 100 - valPercent + "%"
  14270. }, o.animate);
  14271. }
  14272. }
  14273. },
  14274. _handleEvents: {
  14275. keydown: function keydown(event) {
  14276. var allowed,
  14277. curVal,
  14278. newVal,
  14279. step,
  14280. index = $(event.target).data("ui-slider-handle-index");
  14281. switch (event.keyCode) {
  14282. case $.ui.keyCode.HOME:
  14283. case $.ui.keyCode.END:
  14284. case $.ui.keyCode.PAGE_UP:
  14285. case $.ui.keyCode.PAGE_DOWN:
  14286. case $.ui.keyCode.UP:
  14287. case $.ui.keyCode.RIGHT:
  14288. case $.ui.keyCode.DOWN:
  14289. case $.ui.keyCode.LEFT:
  14290. event.preventDefault();
  14291. if (!this._keySliding) {
  14292. this._keySliding = true;
  14293. this._addClass($(event.target), null, "ui-state-active");
  14294. allowed = this._start(event, index);
  14295. if (allowed === false) {
  14296. return;
  14297. }
  14298. }
  14299. break;
  14300. }
  14301. step = this.options.step;
  14302. if (this._hasMultipleValues()) {
  14303. curVal = newVal = this.values(index);
  14304. } else {
  14305. curVal = newVal = this.value();
  14306. }
  14307. switch (event.keyCode) {
  14308. case $.ui.keyCode.HOME:
  14309. newVal = this._valueMin();
  14310. break;
  14311. case $.ui.keyCode.END:
  14312. newVal = this._valueMax();
  14313. break;
  14314. case $.ui.keyCode.PAGE_UP:
  14315. newVal = this._trimAlignValue(curVal + (this._valueMax() - this._valueMin()) / this.numPages);
  14316. break;
  14317. case $.ui.keyCode.PAGE_DOWN:
  14318. newVal = this._trimAlignValue(curVal - (this._valueMax() - this._valueMin()) / this.numPages);
  14319. break;
  14320. case $.ui.keyCode.UP:
  14321. case $.ui.keyCode.RIGHT:
  14322. if (curVal === this._valueMax()) {
  14323. return;
  14324. }
  14325. newVal = this._trimAlignValue(curVal + step);
  14326. break;
  14327. case $.ui.keyCode.DOWN:
  14328. case $.ui.keyCode.LEFT:
  14329. if (curVal === this._valueMin()) {
  14330. return;
  14331. }
  14332. newVal = this._trimAlignValue(curVal - step);
  14333. break;
  14334. }
  14335. this._slide(event, index, newVal);
  14336. },
  14337. keyup: function keyup(event) {
  14338. var index = $(event.target).data("ui-slider-handle-index");
  14339. if (this._keySliding) {
  14340. this._keySliding = false;
  14341. this._stop(event, index);
  14342. this._change(event, index);
  14343. this._removeClass($(event.target), null, "ui-state-active");
  14344. }
  14345. }
  14346. }
  14347. });
  14348. });
  14349. /***/ }),
  14350. /* 33 */
  14351. /***/ (function(module, exports, __webpack_require__) {
  14352. "use strict";
  14353. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14354. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  14355. (function (global, factory) {
  14356. ( false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14357. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14358. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14359. __WEBPACK_AMD_DEFINE_FACTORY__),
  14360. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : global.StickySidebar = factory();
  14361. })(undefined, function () {
  14362. 'use strict';
  14363. var _createClass = function () {
  14364. function defineProperties(target, props) {
  14365. for (var i = 0; i < props.length; i++) {
  14366. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  14367. }
  14368. }return function (Constructor, protoProps, staticProps) {
  14369. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  14370. };
  14371. }();
  14372. function _classCallCheck(instance, Constructor) {
  14373. if (!(instance instanceof Constructor)) {
  14374. throw new TypeError("Cannot call a class as a function");
  14375. }
  14376. }
  14377. /**
  14378. * Sticky Sidebar JavaScript Plugin.
  14379. * @version 3.2.0
  14380. * @author Ahmed Bouhuolia <a.bouhuolia@gmail.com>
  14381. * @license The MIT License (MIT)
  14382. */
  14383. var StickySidebar = function () {
  14384. // ---------------------------------
  14385. // # Define Constants
  14386. // ---------------------------------
  14387. //
  14388. var EVENT_KEY = '.stickySidebar';
  14389. var DEFAULTS = {
  14390. /**
  14391. * Additional top spacing of the element when it becomes sticky.
  14392. * @type {Numeric|Function}
  14393. */
  14394. topSpacing: 0,
  14395. /**
  14396. * Additional bottom spacing of the element when it becomes sticky.
  14397. * @type {Numeric|Function}
  14398. */
  14399. bottomSpacing: 0,
  14400. /**
  14401. * Container sidebar selector to know what the beginning and end of sticky element.
  14402. * @type {String|False}
  14403. */
  14404. containerSelector: false,
  14405. /**
  14406. * Inner wrapper selector.
  14407. * @type {String}
  14408. */
  14409. innerWrapperSelector: '.inner-wrapper-sticky',
  14410. /**
  14411. * The name of CSS class to apply to elements when they have become stuck.
  14412. * @type {String|False}
  14413. */
  14414. stickyClass: 'is-affixed',
  14415. /**
  14416. * Detect when sidebar and its container change height so re-calculate their dimensions.
  14417. * @type {Boolean}
  14418. */
  14419. resizeSensor: true,
  14420. /**
  14421. * The sidebar returns to its normal position if its width below this value.
  14422. * @type {Numeric}
  14423. */
  14424. minWidth: false
  14425. };
  14426. // ---------------------------------
  14427. // # Class Definition
  14428. // ---------------------------------
  14429. //
  14430. /**
  14431. * Sticky Sidebar Class.
  14432. * @public
  14433. */
  14434. var StickySidebar = function () {
  14435. /**
  14436. * Sticky Sidebar Constructor.
  14437. * @constructor
  14438. * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
  14439. * @param {Object} options - The options of sticky sidebar.
  14440. */
  14441. function StickySidebar(sidebar) {
  14442. var _this = this;
  14443. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  14444. _classCallCheck(this, StickySidebar);
  14445. this.options = StickySidebar.extend(DEFAULTS, options);
  14446. // Sidebar element query if there's no one, throw error.
  14447. this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
  14448. if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
  14449. this.sidebarInner = false;
  14450. this.container = this.sidebar.parentElement;
  14451. // Current Affix Type of sidebar element.
  14452. this.affixedType = 'STATIC';
  14453. this.direction = 'down';
  14454. this.support = {
  14455. transform: false,
  14456. transform3d: false
  14457. };
  14458. this._initialized = false;
  14459. this._breakpoint = false;
  14460. this._resizeListeners = [];
  14461. // Dimenstions of sidebar, container and screen viewport.
  14462. this.dimensions = {
  14463. translateY: 0,
  14464. topSpacing: 0,
  14465. bottomSpacing: 0,
  14466. sidebarHeight: 0,
  14467. sidebarWidth: 0,
  14468. containerTop: 0,
  14469. containerHeight: 0,
  14470. viewportHeight: 0,
  14471. viewportTop: 0,
  14472. lastViewportTop: 0
  14473. };
  14474. // Bind event handlers for referencability.
  14475. ['handleEvent'].forEach(function (method) {
  14476. _this[method] = _this[method].bind(_this);
  14477. });
  14478. // Initialize sticky sidebar for first time.
  14479. this.initialize();
  14480. }
  14481. /**
  14482. * Initializes the sticky sidebar by adding inner wrapper, define its container,
  14483. * min-width breakpoint, calculating dimenstions, adding helper classes and inline style.
  14484. * @private
  14485. */
  14486. _createClass(StickySidebar, [{
  14487. key: 'initialize',
  14488. value: function initialize() {
  14489. var _this2 = this;
  14490. this._setSupportFeatures();
  14491. // Get sticky sidebar inner wrapper, if not found, will create one.
  14492. if (this.options.innerWrapperSelector) {
  14493. this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
  14494. if (null === this.sidebarInner) this.sidebarInner = false;
  14495. }
  14496. if (!this.sidebarInner) {
  14497. var wrapper = document.createElement('div');
  14498. wrapper.setAttribute('class', 'inner-wrapper-sticky');
  14499. this.sidebar.appendChild(wrapper);
  14500. while (this.sidebar.firstChild != wrapper) {
  14501. wrapper.appendChild(this.sidebar.firstChild);
  14502. }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
  14503. }
  14504. // Container wrapper of the sidebar.
  14505. if (this.options.containerSelector) {
  14506. var containers = document.querySelectorAll(this.options.containerSelector);
  14507. containers = Array.prototype.slice.call(containers);
  14508. containers.forEach(function (container, item) {
  14509. if (!container.contains(_this2.sidebar)) return;
  14510. _this2.container = container;
  14511. });
  14512. if (!containers.length) throw new Error("The container does not contains on the sidebar.");
  14513. }
  14514. // If top/bottom spacing is not function parse value to integer.
  14515. if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
  14516. if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
  14517. // Breakdown sticky sidebar if screen width below `options.minWidth`.
  14518. this._widthBreakpoint();
  14519. // Calculate dimensions of sidebar, container and viewport.
  14520. this.calcDimensions();
  14521. // Affix sidebar in proper position.
  14522. this.stickyPosition();
  14523. // Bind all events.
  14524. this.bindEvents();
  14525. // Inform other properties the sticky sidebar is initialized.
  14526. this._initialized = true;
  14527. }
  14528. /**
  14529. * Bind all events of sticky sidebar plugin.
  14530. * @protected
  14531. */
  14532. }, {
  14533. key: 'bindEvents',
  14534. value: function bindEvents() {
  14535. window.addEventListener('resize', this, { passive: true });
  14536. window.addEventListener('scroll', this, { passive: true });
  14537. this.sidebar.addEventListener('update' + EVENT_KEY, this);
  14538. if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14539. new ResizeSensor(this.sidebarInner, this.handleEvent);
  14540. new ResizeSensor(this.container, this.handleEvent);
  14541. }
  14542. }
  14543. /**
  14544. * Handles all events of the plugin.
  14545. * @param {Object} event - Event object passed from listener.
  14546. */
  14547. }, {
  14548. key: 'handleEvent',
  14549. value: function handleEvent(event) {
  14550. this.updateSticky(event);
  14551. }
  14552. /**
  14553. * Calculates dimesntions of sidebar, container and screen viewpoint
  14554. * @public
  14555. */
  14556. }, {
  14557. key: 'calcDimensions',
  14558. value: function calcDimensions() {
  14559. if (this._breakpoint) return;
  14560. var dims = this.dimensions;
  14561. // Container of sticky sidebar dimensions.
  14562. dims.containerTop = StickySidebar.offsetRelative(this.container).top;
  14563. dims.containerHeight = this.container.clientHeight;
  14564. dims.containerBottom = dims.containerTop + dims.containerHeight;
  14565. // Sidebar dimensions.
  14566. dims.sidebarHeight = this.sidebarInner.offsetHeight;
  14567. dims.sidebarWidth = this.sidebar.offsetWidth;
  14568. // Screen viewport dimensions.
  14569. dims.viewportHeight = window.innerHeight;
  14570. this._calcDimensionsWithScroll();
  14571. }
  14572. /**
  14573. * Some dimensions values need to be up-to-date when scrolling the page.
  14574. * @private
  14575. */
  14576. }, {
  14577. key: '_calcDimensionsWithScroll',
  14578. value: function _calcDimensionsWithScroll() {
  14579. var dims = this.dimensions;
  14580. dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
  14581. dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
  14582. dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
  14583. dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  14584. dims.topSpacing = this.options.topSpacing;
  14585. dims.bottomSpacing = this.options.bottomSpacing;
  14586. if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
  14587. if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
  14588. }
  14589. /**
  14590. * Detarmine wheather the sidebar is bigger than viewport.
  14591. * @public
  14592. * @return {Boolean}
  14593. */
  14594. }, {
  14595. key: 'isSidebarFitsViewport',
  14596. value: function isSidebarFitsViewport() {
  14597. return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
  14598. }
  14599. /**
  14600. * Observe browser scrolling direction top and down.
  14601. */
  14602. }, {
  14603. key: 'observeScrollDir',
  14604. value: function observeScrollDir() {
  14605. var dims = this.dimensions;
  14606. if (dims.lastViewportTop === dims.viewportTop) return;
  14607. var furthest = 'down' === this.direction ? Math.min : Math.max;
  14608. // If the browser is scrolling not in the same direction.
  14609. if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
  14610. }
  14611. /**
  14612. * Gets affix type of sidebar according to current scrollTop and scrollLeft.
  14613. * Holds all logical affix of the sidebar when scrolling up and down and when sidebar
  14614. * is bigger than viewport and vice versa.
  14615. * @public
  14616. * @return {String|False} - Proper affix type.
  14617. */
  14618. }, {
  14619. key: 'getAffixType',
  14620. value: function getAffixType() {
  14621. var dims = this.dimensions,
  14622. affixType = false;
  14623. this._calcDimensionsWithScroll();
  14624. var sidebarBottom = dims.sidebarHeight + dims.containerTop;
  14625. var colliderTop = dims.viewportTop + dims.topSpacing;
  14626. var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
  14627. // When browser is scrolling top.
  14628. if ('up' === this.direction) {
  14629. if (colliderTop <= dims.containerTop) {
  14630. dims.translateY = 0;
  14631. affixType = 'STATIC';
  14632. } else if (colliderTop <= dims.translateY + dims.containerTop) {
  14633. dims.translateY = colliderTop - dims.containerTop;
  14634. affixType = 'VIEWPORT-TOP';
  14635. } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) {
  14636. affixType = 'VIEWPORT-UNBOTTOM';
  14637. }
  14638. // When browser is scrolling up.
  14639. } else {
  14640. // When sidebar element is not bigger than screen viewport.
  14641. if (this.isSidebarFitsViewport()) {
  14642. if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
  14643. dims.translateY = dims.containerBottom - sidebarBottom;
  14644. affixType = 'CONTAINER-BOTTOM';
  14645. } else if (colliderTop >= dims.containerTop) {
  14646. dims.translateY = colliderTop - dims.containerTop;
  14647. affixType = 'VIEWPORT-TOP';
  14648. }
  14649. // When sidebar element is bigger than screen viewport.
  14650. } else {
  14651. if (dims.containerBottom <= colliderBottom) {
  14652. dims.translateY = dims.containerBottom - sidebarBottom;
  14653. affixType = 'CONTAINER-BOTTOM';
  14654. } else if (sidebarBottom + dims.translateY <= colliderBottom) {
  14655. dims.translateY = colliderBottom - sidebarBottom;
  14656. affixType = 'VIEWPORT-BOTTOM';
  14657. } else if (dims.containerTop + dims.translateY <= colliderTop) {
  14658. affixType = 'VIEWPORT-UNBOTTOM';
  14659. }
  14660. }
  14661. }
  14662. // Make sure the translate Y is not bigger than container height.
  14663. dims.translateY = Math.max(0, dims.translateY);
  14664. dims.translateY = Math.min(dims.containerHeight, dims.translateY);
  14665. dims.lastViewportTop = dims.viewportTop;
  14666. return affixType;
  14667. }
  14668. /**
  14669. * Gets inline style of sticky sidebar wrapper and inner wrapper according
  14670. * to its affix type.
  14671. * @private
  14672. * @param {String} affixType - Affix type of sticky sidebar.
  14673. * @return {Object}
  14674. */
  14675. }, {
  14676. key: '_getStyle',
  14677. value: function _getStyle(affixType) {
  14678. if ('undefined' === typeof affixType) return;
  14679. var style = { inner: {}, outer: {} };
  14680. var dims = this.dimensions;
  14681. switch (affixType) {
  14682. case 'VIEWPORT-TOP':
  14683. style.inner = { position: 'fixed', top: this.options.topSpacing,
  14684. left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
  14685. break;
  14686. case 'VIEWPORT-BOTTOM':
  14687. style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
  14688. bottom: this.options.bottomSpacing, width: dims.sidebarWidth };
  14689. break;
  14690. case 'CONTAINER-BOTTOM':
  14691. case 'VIEWPORT-UNBOTTOM':
  14692. var translate = this._getTranslate(0, dims.translateY + 'px');
  14693. if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
  14694. break;
  14695. }
  14696. switch (affixType) {
  14697. case 'VIEWPORT-TOP':
  14698. case 'VIEWPORT-BOTTOM':
  14699. case 'VIEWPORT-UNBOTTOM':
  14700. case 'CONTAINER-BOTTOM':
  14701. style.outer = { height: dims.sidebarHeight, position: 'relative' };
  14702. break;
  14703. }
  14704. style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
  14705. style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
  14706. bottom: '', width: '', transform: this._getTranslate() }, style.inner);
  14707. return style;
  14708. }
  14709. /**
  14710. * Cause the sidebar to be sticky according to affix type by adding inline
  14711. * style, adding helper class and trigger events.
  14712. * @function
  14713. * @protected
  14714. * @param {string} force - Update sticky sidebar position by force.
  14715. */
  14716. }, {
  14717. key: 'stickyPosition',
  14718. value: function stickyPosition(force) {
  14719. if (this._breakpoint) return;
  14720. force = force || false;
  14721. var affixType = this.getAffixType();
  14722. var style = this._getStyle(affixType);
  14723. if ((this.affixedType != affixType || force) && affixType) {
  14724. var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
  14725. StickySidebar.eventTrigger(this.sidebar, affixEvent);
  14726. if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
  14727. for (var key in style.outer) {
  14728. this.sidebar.style[key] = style.outer[key];
  14729. }
  14730. for (var _key in style.inner) {
  14731. var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : '';
  14732. this.sidebarInner.style[_key] = style.inner[_key] + _unit2;
  14733. }
  14734. var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport', '') + EVENT_KEY;
  14735. StickySidebar.eventTrigger(this.sidebar, affixedEvent);
  14736. } else {
  14737. if (this._initialized) this.sidebarInner.style.left = style.inner.left;
  14738. }
  14739. this.affixedType = affixType;
  14740. }
  14741. /**
  14742. * Breakdown sticky sidebar when window width is below `options.minWidth` value.
  14743. * @protected
  14744. */
  14745. }, {
  14746. key: '_widthBreakpoint',
  14747. value: function _widthBreakpoint() {
  14748. if (window.innerWidth <= this.options.minWidth) {
  14749. this._breakpoint = true;
  14750. this.affixedType = 'STATIC';
  14751. this.sidebar.removeAttribute('style');
  14752. StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
  14753. this.sidebarInner.removeAttribute('style');
  14754. } else {
  14755. this._breakpoint = false;
  14756. }
  14757. }
  14758. /**
  14759. * Switchs between functions stack for each event type, if there's no
  14760. * event, it will re-initialize sticky sidebar.
  14761. * @public
  14762. */
  14763. }, {
  14764. key: 'updateSticky',
  14765. value: function updateSticky() {
  14766. var _this3 = this;
  14767. var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  14768. if (this._running) return;
  14769. this._running = true;
  14770. (function (eventType) {
  14771. requestAnimationFrame(function () {
  14772. switch (eventType) {
  14773. // When browser is scrolling and re-calculate just dimensions
  14774. // within scroll.
  14775. case 'scroll':
  14776. _this3._calcDimensionsWithScroll();
  14777. _this3.observeScrollDir();
  14778. _this3.stickyPosition();
  14779. break;
  14780. // When browser is resizing or there's no event, observe width
  14781. // breakpoint and re-calculate dimensions.
  14782. case 'resize':
  14783. default:
  14784. _this3._widthBreakpoint();
  14785. _this3.calcDimensions();
  14786. _this3.stickyPosition(true);
  14787. break;
  14788. }
  14789. _this3._running = false;
  14790. });
  14791. })(event.type);
  14792. }
  14793. /**
  14794. * Set browser support features to the public property.
  14795. * @private
  14796. */
  14797. }, {
  14798. key: '_setSupportFeatures',
  14799. value: function _setSupportFeatures() {
  14800. var support = this.support;
  14801. support.transform = StickySidebar.supportTransform();
  14802. support.transform3d = StickySidebar.supportTransform(true);
  14803. }
  14804. /**
  14805. * Get translate value, if the browser supports transfrom3d, it will adopt it.
  14806. * and the same with translate. if browser doesn't support both return false.
  14807. * @param {Number} y - Value of Y-axis.
  14808. * @param {Number} x - Value of X-axis.
  14809. * @param {Number} z - Value of Z-axis.
  14810. * @return {String|False}
  14811. */
  14812. }, {
  14813. key: '_getTranslate',
  14814. value: function _getTranslate() {
  14815. var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  14816. var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  14817. var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  14818. if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
  14819. }
  14820. /**
  14821. * Destroy sticky sidebar plugin.
  14822. * @public
  14823. */
  14824. }, {
  14825. key: 'destroy',
  14826. value: function destroy() {
  14827. window.removeEventListener('resize', this);
  14828. window.removeEventListener('scroll', this);
  14829. this.sidebar.classList.remove(this.options.stickyClass);
  14830. this.sidebar.style.minHeight = '';
  14831. this.sidebar.removeEventListener('update' + EVENT_KEY, this);
  14832. var styleReset = { inner: {}, outer: {} };
  14833. styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
  14834. styleReset.outer = { height: '', position: '' };
  14835. for (var key in styleReset.outer) {
  14836. this.sidebar.style[key] = styleReset.outer[key];
  14837. }for (var _key2 in styleReset.inner) {
  14838. this.sidebarInner.style[_key2] = styleReset.inner[_key2];
  14839. }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14840. ResizeSensor.detach(this.sidebarInner, this.handleEvent);
  14841. ResizeSensor.detach(this.container, this.handleEvent);
  14842. }
  14843. }
  14844. /**
  14845. * Detarmine if the browser supports CSS transfrom feature.
  14846. * @function
  14847. * @static
  14848. * @param {Boolean} transform3d - Detect transform with translate3d.
  14849. * @return {String}
  14850. */
  14851. }], [{
  14852. key: 'supportTransform',
  14853. value: function supportTransform(transform3d) {
  14854. var result = false,
  14855. property = transform3d ? 'perspective' : 'transform',
  14856. upper = property.charAt(0).toUpperCase() + property.slice(1),
  14857. prefixes = ['Webkit', 'Moz', 'O', 'ms'],
  14858. support = document.createElement('support'),
  14859. style = support.style;
  14860. (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
  14861. if (style[property] !== undefined) {
  14862. result = property;
  14863. return false;
  14864. }
  14865. });
  14866. return result;
  14867. }
  14868. /**
  14869. * Trigger custom event.
  14870. * @static
  14871. * @param {DOMObject} element - Target element on the DOM.
  14872. * @param {String} eventName - Event name.
  14873. * @param {Object} data -
  14874. */
  14875. }, {
  14876. key: 'eventTrigger',
  14877. value: function eventTrigger(element, eventName, data) {
  14878. try {
  14879. var event = new CustomEvent(eventName, { detail: data });
  14880. } catch (e) {
  14881. var event = document.createEvent('CustomEvent');
  14882. event.initCustomEvent(eventName, true, true, data);
  14883. }
  14884. element.dispatchEvent(event);
  14885. }
  14886. /**
  14887. * Extend options object with defaults.
  14888. * @function
  14889. * @static
  14890. */
  14891. }, {
  14892. key: 'extend',
  14893. value: function extend(defaults, options) {
  14894. var results = {};
  14895. for (var key in defaults) {
  14896. if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
  14897. }
  14898. return results;
  14899. }
  14900. /**
  14901. * Get current coordinates left and top of specific element.
  14902. * @static
  14903. */
  14904. }, {
  14905. key: 'offsetRelative',
  14906. value: function offsetRelative(element) {
  14907. var result = { left: 0, top: 0 };
  14908. do {
  14909. var offsetTop = element.offsetTop;
  14910. var offsetLeft = element.offsetLeft;
  14911. if (!isNaN(offsetTop)) result.top += offsetTop;
  14912. if (!isNaN(offsetLeft)) result.left += offsetLeft;
  14913. } while (element = element.offsetParent);
  14914. return result;
  14915. }
  14916. /**
  14917. * Add specific class name to specific element.
  14918. * @static
  14919. * @param {ObjectDOM} element
  14920. * @param {String} className
  14921. */
  14922. }, {
  14923. key: 'addClass',
  14924. value: function addClass(element, className) {
  14925. if (!StickySidebar.hasClass(element, className)) {
  14926. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  14927. }
  14928. }
  14929. /**
  14930. * Remove specific class name to specific element
  14931. * @static
  14932. * @param {ObjectDOM} element
  14933. * @param {String} className
  14934. */
  14935. }, {
  14936. key: 'removeClass',
  14937. value: function removeClass(element, className) {
  14938. if (StickySidebar.hasClass(element, className)) {
  14939. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  14940. }
  14941. }
  14942. /**
  14943. * Detarmine weather the element has specific class name.
  14944. * @static
  14945. * @param {ObjectDOM} element
  14946. * @param {String} className
  14947. */
  14948. }, {
  14949. key: 'hasClass',
  14950. value: function hasClass(element, className) {
  14951. if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
  14952. }
  14953. }]);
  14954. return StickySidebar;
  14955. }();
  14956. return StickySidebar;
  14957. }();
  14958. // Global
  14959. // -------------------------
  14960. window.StickySidebar = StickySidebar;
  14961. return StickySidebar;
  14962. });
  14963. //# sourceMappingURL=sticky-sidebar.js.map
  14964. /***/ }),
  14965. /* 34 */
  14966. /***/ (function(module, exports, __webpack_require__) {
  14967. "use strict";
  14968. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14969. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  14970. /*! tether 1.4.0 */
  14971. (function (root, factory) {
  14972. if (true) {
  14973. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14974. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14975. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14976. __WEBPACK_AMD_DEFINE_FACTORY__),
  14977. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  14978. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  14979. module.exports = factory(require, exports, module);
  14980. } else {
  14981. root.Tether = factory();
  14982. }
  14983. })(undefined, function (require, exports, module) {
  14984. 'use strict';
  14985. var _createClass = function () {
  14986. function defineProperties(target, props) {
  14987. for (var i = 0; i < props.length; i++) {
  14988. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  14989. }
  14990. }return function (Constructor, protoProps, staticProps) {
  14991. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  14992. };
  14993. }();
  14994. function _classCallCheck(instance, Constructor) {
  14995. if (!(instance instanceof Constructor)) {
  14996. throw new TypeError('Cannot call a class as a function');
  14997. }
  14998. }
  14999. var TetherBase = undefined;
  15000. if (typeof TetherBase === 'undefined') {
  15001. TetherBase = { modules: [] };
  15002. }
  15003. var zeroElement = null;
  15004. // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
  15005. // if the element lies within a nested document (<frame> or <iframe>-like).
  15006. function getActualBoundingClientRect(node) {
  15007. var boundingRect = node.getBoundingClientRect();
  15008. // The original object returned by getBoundingClientRect is immutable, so we clone it
  15009. // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
  15010. var rect = {};
  15011. for (var k in boundingRect) {
  15012. rect[k] = boundingRect[k];
  15013. }
  15014. if (node.ownerDocument !== document) {
  15015. var _frameElement = node.ownerDocument.defaultView.frameElement;
  15016. if (_frameElement) {
  15017. var frameRect = getActualBoundingClientRect(_frameElement);
  15018. rect.top += frameRect.top;
  15019. rect.bottom += frameRect.top;
  15020. rect.left += frameRect.left;
  15021. rect.right += frameRect.left;
  15022. }
  15023. }
  15024. return rect;
  15025. }
  15026. function getScrollParents(el) {
  15027. // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
  15028. // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  15029. var computedStyle = getComputedStyle(el) || {};
  15030. var position = computedStyle.position;
  15031. var parents = [];
  15032. if (position === 'fixed') {
  15033. return [el];
  15034. }
  15035. var parent = el;
  15036. while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
  15037. var style = undefined;
  15038. try {
  15039. style = getComputedStyle(parent);
  15040. } catch (err) {}
  15041. if (typeof style === 'undefined' || style === null) {
  15042. parents.push(parent);
  15043. return parents;
  15044. }
  15045. var _style = style;
  15046. var overflow = _style.overflow;
  15047. var overflowX = _style.overflowX;
  15048. var overflowY = _style.overflowY;
  15049. if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
  15050. if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
  15051. parents.push(parent);
  15052. }
  15053. }
  15054. }
  15055. parents.push(el.ownerDocument.body);
  15056. // If the node is within a frame, account for the parent window scroll
  15057. if (el.ownerDocument !== document) {
  15058. parents.push(el.ownerDocument.defaultView);
  15059. }
  15060. return parents;
  15061. }
  15062. var uniqueId = function () {
  15063. var id = 0;
  15064. return function () {
  15065. return ++id;
  15066. };
  15067. }();
  15068. var zeroPosCache = {};
  15069. var getOrigin = function getOrigin() {
  15070. // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
  15071. // jitter as the user scrolls that messes with our ability to detect if two positions
  15072. // are equivilant or not. We place an element at the top left of the page that will
  15073. // get the same jitter, so we can cancel the two out.
  15074. var node = zeroElement;
  15075. if (!node || !document.body.contains(node)) {
  15076. node = document.createElement('div');
  15077. node.setAttribute('data-tether-id', uniqueId());
  15078. extend(node.style, {
  15079. top: 0,
  15080. left: 0,
  15081. position: 'absolute'
  15082. });
  15083. document.body.appendChild(node);
  15084. zeroElement = node;
  15085. }
  15086. var id = node.getAttribute('data-tether-id');
  15087. if (typeof zeroPosCache[id] === 'undefined') {
  15088. zeroPosCache[id] = getActualBoundingClientRect(node);
  15089. // Clear the cache when this position call is done
  15090. defer(function () {
  15091. delete zeroPosCache[id];
  15092. });
  15093. }
  15094. return zeroPosCache[id];
  15095. };
  15096. function removeUtilElements() {
  15097. if (zeroElement) {
  15098. document.body.removeChild(zeroElement);
  15099. }
  15100. zeroElement = null;
  15101. };
  15102. function getBounds(el) {
  15103. var doc = undefined;
  15104. if (el === document) {
  15105. doc = document;
  15106. el = document.documentElement;
  15107. } else {
  15108. doc = el.ownerDocument;
  15109. }
  15110. var docEl = doc.documentElement;
  15111. var box = getActualBoundingClientRect(el);
  15112. var origin = getOrigin();
  15113. box.top -= origin.top;
  15114. box.left -= origin.left;
  15115. if (typeof box.width === 'undefined') {
  15116. box.width = document.body.scrollWidth - box.left - box.right;
  15117. }
  15118. if (typeof box.height === 'undefined') {
  15119. box.height = document.body.scrollHeight - box.top - box.bottom;
  15120. }
  15121. box.top = box.top - docEl.clientTop;
  15122. box.left = box.left - docEl.clientLeft;
  15123. box.right = doc.body.clientWidth - box.width - box.left;
  15124. box.bottom = doc.body.clientHeight - box.height - box.top;
  15125. return box;
  15126. }
  15127. function getOffsetParent(el) {
  15128. return el.offsetParent || document.documentElement;
  15129. }
  15130. var _scrollBarSize = null;
  15131. function getScrollBarSize() {
  15132. if (_scrollBarSize) {
  15133. return _scrollBarSize;
  15134. }
  15135. var inner = document.createElement('div');
  15136. inner.style.width = '100%';
  15137. inner.style.height = '200px';
  15138. var outer = document.createElement('div');
  15139. extend(outer.style, {
  15140. position: 'absolute',
  15141. top: 0,
  15142. left: 0,
  15143. pointerEvents: 'none',
  15144. visibility: 'hidden',
  15145. width: '200px',
  15146. height: '150px',
  15147. overflow: 'hidden'
  15148. });
  15149. outer.appendChild(inner);
  15150. document.body.appendChild(outer);
  15151. var widthContained = inner.offsetWidth;
  15152. outer.style.overflow = 'scroll';
  15153. var widthScroll = inner.offsetWidth;
  15154. if (widthContained === widthScroll) {
  15155. widthScroll = outer.clientWidth;
  15156. }
  15157. document.body.removeChild(outer);
  15158. var width = widthContained - widthScroll;
  15159. _scrollBarSize = { width: width, height: width };
  15160. return _scrollBarSize;
  15161. }
  15162. function extend() {
  15163. var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  15164. var args = [];
  15165. Array.prototype.push.apply(args, arguments);
  15166. args.slice(1).forEach(function (obj) {
  15167. if (obj) {
  15168. for (var key in obj) {
  15169. if ({}.hasOwnProperty.call(obj, key)) {
  15170. out[key] = obj[key];
  15171. }
  15172. }
  15173. }
  15174. });
  15175. return out;
  15176. }
  15177. function removeClass(el, name) {
  15178. if (typeof el.classList !== 'undefined') {
  15179. name.split(' ').forEach(function (cls) {
  15180. if (cls.trim()) {
  15181. el.classList.remove(cls);
  15182. }
  15183. });
  15184. } else {
  15185. var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
  15186. var className = getClassName(el).replace(regex, ' ');
  15187. setClassName(el, className);
  15188. }
  15189. }
  15190. function addClass(el, name) {
  15191. if (typeof el.classList !== 'undefined') {
  15192. name.split(' ').forEach(function (cls) {
  15193. if (cls.trim()) {
  15194. el.classList.add(cls);
  15195. }
  15196. });
  15197. } else {
  15198. removeClass(el, name);
  15199. var cls = getClassName(el) + (' ' + name);
  15200. setClassName(el, cls);
  15201. }
  15202. }
  15203. function hasClass(el, name) {
  15204. if (typeof el.classList !== 'undefined') {
  15205. return el.classList.contains(name);
  15206. }
  15207. var className = getClassName(el);
  15208. return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
  15209. }
  15210. function getClassName(el) {
  15211. // Can't use just SVGAnimatedString here since nodes within a Frame in IE have
  15212. // completely separately SVGAnimatedString base classes
  15213. if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
  15214. return el.className.baseVal;
  15215. }
  15216. return el.className;
  15217. }
  15218. function setClassName(el, className) {
  15219. el.setAttribute('class', className);
  15220. }
  15221. function updateClasses(el, add, all) {
  15222. // Of the set of 'all' classes, we need the 'add' classes, and only the
  15223. // 'add' classes to be set.
  15224. all.forEach(function (cls) {
  15225. if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
  15226. removeClass(el, cls);
  15227. }
  15228. });
  15229. add.forEach(function (cls) {
  15230. if (!hasClass(el, cls)) {
  15231. addClass(el, cls);
  15232. }
  15233. });
  15234. }
  15235. var deferred = [];
  15236. var defer = function defer(fn) {
  15237. deferred.push(fn);
  15238. };
  15239. var flush = function flush() {
  15240. var fn = undefined;
  15241. while (fn = deferred.pop()) {
  15242. fn();
  15243. }
  15244. };
  15245. var Evented = function () {
  15246. function Evented() {
  15247. _classCallCheck(this, Evented);
  15248. }
  15249. _createClass(Evented, [{
  15250. key: 'on',
  15251. value: function on(event, handler, ctx) {
  15252. var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
  15253. if (typeof this.bindings === 'undefined') {
  15254. this.bindings = {};
  15255. }
  15256. if (typeof this.bindings[event] === 'undefined') {
  15257. this.bindings[event] = [];
  15258. }
  15259. this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
  15260. }
  15261. }, {
  15262. key: 'once',
  15263. value: function once(event, handler, ctx) {
  15264. this.on(event, handler, ctx, true);
  15265. }
  15266. }, {
  15267. key: 'off',
  15268. value: function off(event, handler) {
  15269. if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
  15270. return;
  15271. }
  15272. if (typeof handler === 'undefined') {
  15273. delete this.bindings[event];
  15274. } else {
  15275. var i = 0;
  15276. while (i < this.bindings[event].length) {
  15277. if (this.bindings[event][i].handler === handler) {
  15278. this.bindings[event].splice(i, 1);
  15279. } else {
  15280. ++i;
  15281. }
  15282. }
  15283. }
  15284. }
  15285. }, {
  15286. key: 'trigger',
  15287. value: function trigger(event) {
  15288. if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
  15289. var i = 0;
  15290. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  15291. args[_key - 1] = arguments[_key];
  15292. }
  15293. while (i < this.bindings[event].length) {
  15294. var _bindings$event$i = this.bindings[event][i];
  15295. var handler = _bindings$event$i.handler;
  15296. var ctx = _bindings$event$i.ctx;
  15297. var once = _bindings$event$i.once;
  15298. var context = ctx;
  15299. if (typeof context === 'undefined') {
  15300. context = this;
  15301. }
  15302. handler.apply(context, args);
  15303. if (once) {
  15304. this.bindings[event].splice(i, 1);
  15305. } else {
  15306. ++i;
  15307. }
  15308. }
  15309. }
  15310. }
  15311. }]);
  15312. return Evented;
  15313. }();
  15314. TetherBase.Utils = {
  15315. getActualBoundingClientRect: getActualBoundingClientRect,
  15316. getScrollParents: getScrollParents,
  15317. getBounds: getBounds,
  15318. getOffsetParent: getOffsetParent,
  15319. extend: extend,
  15320. addClass: addClass,
  15321. removeClass: removeClass,
  15322. hasClass: hasClass,
  15323. updateClasses: updateClasses,
  15324. defer: defer,
  15325. flush: flush,
  15326. uniqueId: uniqueId,
  15327. Evented: Evented,
  15328. getScrollBarSize: getScrollBarSize,
  15329. removeUtilElements: removeUtilElements
  15330. };
  15331. /* globals TetherBase, performance */
  15332. 'use strict';
  15333. var _slicedToArray = function () {
  15334. function sliceIterator(arr, i) {
  15335. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  15336. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  15337. _arr.push(_s.value);if (i && _arr.length === i) break;
  15338. }
  15339. } catch (err) {
  15340. _d = true;_e = err;
  15341. } finally {
  15342. try {
  15343. if (!_n && _i['return']) _i['return']();
  15344. } finally {
  15345. if (_d) throw _e;
  15346. }
  15347. }return _arr;
  15348. }return function (arr, i) {
  15349. if (Array.isArray(arr)) {
  15350. return arr;
  15351. } else if (Symbol.iterator in Object(arr)) {
  15352. return sliceIterator(arr, i);
  15353. } else {
  15354. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  15355. }
  15356. };
  15357. }();
  15358. var _createClass = function () {
  15359. function defineProperties(target, props) {
  15360. for (var i = 0; i < props.length; i++) {
  15361. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  15362. }
  15363. }return function (Constructor, protoProps, staticProps) {
  15364. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15365. };
  15366. }();
  15367. var _get = function get(_x6, _x7, _x8) {
  15368. var _again = true;_function: while (_again) {
  15369. var object = _x6,
  15370. property = _x7,
  15371. receiver = _x8;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  15372. var parent = Object.getPrototypeOf(object);if (parent === null) {
  15373. return undefined;
  15374. } else {
  15375. _x6 = parent;_x7 = property;_x8 = receiver;_again = true;desc = parent = undefined;continue _function;
  15376. }
  15377. } else if ('value' in desc) {
  15378. return desc.value;
  15379. } else {
  15380. var getter = desc.get;if (getter === undefined) {
  15381. return undefined;
  15382. }return getter.call(receiver);
  15383. }
  15384. }
  15385. };
  15386. function _classCallCheck(instance, Constructor) {
  15387. if (!(instance instanceof Constructor)) {
  15388. throw new TypeError('Cannot call a class as a function');
  15389. }
  15390. }
  15391. function _inherits(subClass, superClass) {
  15392. if (typeof superClass !== 'function' && superClass !== null) {
  15393. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  15394. }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  15395. }
  15396. if (typeof TetherBase === 'undefined') {
  15397. throw new Error('You must include the utils.js file before tether.js');
  15398. }
  15399. var _TetherBase$Utils = TetherBase.Utils;
  15400. var getScrollParents = _TetherBase$Utils.getScrollParents;
  15401. var getBounds = _TetherBase$Utils.getBounds;
  15402. var getOffsetParent = _TetherBase$Utils.getOffsetParent;
  15403. var extend = _TetherBase$Utils.extend;
  15404. var addClass = _TetherBase$Utils.addClass;
  15405. var removeClass = _TetherBase$Utils.removeClass;
  15406. var updateClasses = _TetherBase$Utils.updateClasses;
  15407. var defer = _TetherBase$Utils.defer;
  15408. var flush = _TetherBase$Utils.flush;
  15409. var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
  15410. var removeUtilElements = _TetherBase$Utils.removeUtilElements;
  15411. function within(a, b) {
  15412. var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
  15413. return a + diff >= b && b >= a - diff;
  15414. }
  15415. var transformKey = function () {
  15416. if (typeof document === 'undefined') {
  15417. return '';
  15418. }
  15419. var el = document.createElement('div');
  15420. var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
  15421. for (var i = 0; i < transforms.length; ++i) {
  15422. var key = transforms[i];
  15423. if (el.style[key] !== undefined) {
  15424. return key;
  15425. }
  15426. }
  15427. }();
  15428. var tethers = [];
  15429. var position = function position() {
  15430. tethers.forEach(function (tether) {
  15431. tether.position(false);
  15432. });
  15433. flush();
  15434. };
  15435. function now() {
  15436. if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
  15437. return performance.now();
  15438. }
  15439. return +new Date();
  15440. }
  15441. (function () {
  15442. var lastCall = null;
  15443. var lastDuration = null;
  15444. var pendingTimeout = null;
  15445. var tick = function tick() {
  15446. if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
  15447. // We voluntarily throttle ourselves if we can't manage 60fps
  15448. lastDuration = Math.min(lastDuration - 16, 250);
  15449. // Just in case this is the last event, remember to position just once more
  15450. pendingTimeout = setTimeout(tick, 250);
  15451. return;
  15452. }
  15453. if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
  15454. // Some browsers call events a little too frequently, refuse to run more than is reasonable
  15455. return;
  15456. }
  15457. if (pendingTimeout != null) {
  15458. clearTimeout(pendingTimeout);
  15459. pendingTimeout = null;
  15460. }
  15461. lastCall = now();
  15462. position();
  15463. lastDuration = now() - lastCall;
  15464. };
  15465. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
  15466. ['resize', 'scroll', 'touchmove'].forEach(function (event) {
  15467. window.addEventListener(event, tick);
  15468. });
  15469. }
  15470. })();
  15471. var MIRROR_LR = {
  15472. center: 'center',
  15473. left: 'right',
  15474. right: 'left'
  15475. };
  15476. var MIRROR_TB = {
  15477. middle: 'middle',
  15478. top: 'bottom',
  15479. bottom: 'top'
  15480. };
  15481. var OFFSET_MAP = {
  15482. top: 0,
  15483. left: 0,
  15484. middle: '50%',
  15485. center: '50%',
  15486. bottom: '100%',
  15487. right: '100%'
  15488. };
  15489. var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
  15490. var left = attachment.left;
  15491. var top = attachment.top;
  15492. if (left === 'auto') {
  15493. left = MIRROR_LR[relativeToAttachment.left];
  15494. }
  15495. if (top === 'auto') {
  15496. top = MIRROR_TB[relativeToAttachment.top];
  15497. }
  15498. return { left: left, top: top };
  15499. };
  15500. var attachmentToOffset = function attachmentToOffset(attachment) {
  15501. var left = attachment.left;
  15502. var top = attachment.top;
  15503. if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
  15504. left = OFFSET_MAP[attachment.left];
  15505. }
  15506. if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
  15507. top = OFFSET_MAP[attachment.top];
  15508. }
  15509. return { left: left, top: top };
  15510. };
  15511. function addOffset() {
  15512. var out = { top: 0, left: 0 };
  15513. for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
  15514. offsets[_key] = arguments[_key];
  15515. }
  15516. offsets.forEach(function (_ref) {
  15517. var top = _ref.top;
  15518. var left = _ref.left;
  15519. if (typeof top === 'string') {
  15520. top = parseFloat(top, 10);
  15521. }
  15522. if (typeof left === 'string') {
  15523. left = parseFloat(left, 10);
  15524. }
  15525. out.top += top;
  15526. out.left += left;
  15527. });
  15528. return out;
  15529. }
  15530. function offsetToPx(offset, size) {
  15531. if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
  15532. offset.left = parseFloat(offset.left, 10) / 100 * size.width;
  15533. }
  15534. if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
  15535. offset.top = parseFloat(offset.top, 10) / 100 * size.height;
  15536. }
  15537. return offset;
  15538. }
  15539. var parseOffset = function parseOffset(value) {
  15540. var _value$split = value.split(' ');
  15541. var _value$split2 = _slicedToArray(_value$split, 2);
  15542. var top = _value$split2[0];
  15543. var left = _value$split2[1];
  15544. return { top: top, left: left };
  15545. };
  15546. var parseAttachment = parseOffset;
  15547. var TetherClass = function (_Evented) {
  15548. _inherits(TetherClass, _Evented);
  15549. function TetherClass(options) {
  15550. var _this = this;
  15551. _classCallCheck(this, TetherClass);
  15552. _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
  15553. this.position = this.position.bind(this);
  15554. tethers.push(this);
  15555. this.history = [];
  15556. this.setOptions(options, false);
  15557. TetherBase.modules.forEach(function (module) {
  15558. if (typeof module.initialize !== 'undefined') {
  15559. module.initialize.call(_this);
  15560. }
  15561. });
  15562. this.position();
  15563. }
  15564. _createClass(TetherClass, [{
  15565. key: 'getClass',
  15566. value: function getClass() {
  15567. var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  15568. var classes = this.options.classes;
  15569. if (typeof classes !== 'undefined' && classes[key]) {
  15570. return this.options.classes[key];
  15571. } else if (this.options.classPrefix) {
  15572. return this.options.classPrefix + '-' + key;
  15573. } else {
  15574. return key;
  15575. }
  15576. }
  15577. }, {
  15578. key: 'setOptions',
  15579. value: function setOptions(options) {
  15580. var _this2 = this;
  15581. var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  15582. var defaults = {
  15583. offset: '0 0',
  15584. targetOffset: '0 0',
  15585. targetAttachment: 'auto auto',
  15586. classPrefix: 'tether'
  15587. };
  15588. this.options = extend(defaults, options);
  15589. var _options = this.options;
  15590. var element = _options.element;
  15591. var target = _options.target;
  15592. var targetModifier = _options.targetModifier;
  15593. this.element = element;
  15594. this.target = target;
  15595. this.targetModifier = targetModifier;
  15596. if (this.target === 'viewport') {
  15597. this.target = document.body;
  15598. this.targetModifier = 'visible';
  15599. } else if (this.target === 'scroll-handle') {
  15600. this.target = document.body;
  15601. this.targetModifier = 'scroll-handle';
  15602. }
  15603. ['element', 'target'].forEach(function (key) {
  15604. if (typeof _this2[key] === 'undefined') {
  15605. throw new Error('Tether Error: Both element and target must be defined');
  15606. }
  15607. if (typeof _this2[key].jquery !== 'undefined') {
  15608. _this2[key] = _this2[key][0];
  15609. } else if (typeof _this2[key] === 'string') {
  15610. _this2[key] = document.querySelector(_this2[key]);
  15611. }
  15612. });
  15613. addClass(this.element, this.getClass('element'));
  15614. if (!(this.options.addTargetClasses === false)) {
  15615. addClass(this.target, this.getClass('target'));
  15616. }
  15617. if (!this.options.attachment) {
  15618. throw new Error('Tether Error: You must provide an attachment');
  15619. }
  15620. this.targetAttachment = parseAttachment(this.options.targetAttachment);
  15621. this.attachment = parseAttachment(this.options.attachment);
  15622. this.offset = parseOffset(this.options.offset);
  15623. this.targetOffset = parseOffset(this.options.targetOffset);
  15624. if (typeof this.scrollParents !== 'undefined') {
  15625. this.disable();
  15626. }
  15627. if (this.targetModifier === 'scroll-handle') {
  15628. this.scrollParents = [this.target];
  15629. } else {
  15630. this.scrollParents = getScrollParents(this.target);
  15631. }
  15632. if (!(this.options.enabled === false)) {
  15633. this.enable(pos);
  15634. }
  15635. }
  15636. }, {
  15637. key: 'getTargetBounds',
  15638. value: function getTargetBounds() {
  15639. if (typeof this.targetModifier !== 'undefined') {
  15640. if (this.targetModifier === 'visible') {
  15641. if (this.target === document.body) {
  15642. return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
  15643. } else {
  15644. var bounds = getBounds(this.target);
  15645. var out = {
  15646. height: bounds.height,
  15647. width: bounds.width,
  15648. top: bounds.top,
  15649. left: bounds.left
  15650. };
  15651. out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
  15652. out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
  15653. out.height = Math.min(innerHeight, out.height);
  15654. out.height -= 2;
  15655. out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
  15656. out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
  15657. out.width = Math.min(innerWidth, out.width);
  15658. out.width -= 2;
  15659. if (out.top < pageYOffset) {
  15660. out.top = pageYOffset;
  15661. }
  15662. if (out.left < pageXOffset) {
  15663. out.left = pageXOffset;
  15664. }
  15665. return out;
  15666. }
  15667. } else if (this.targetModifier === 'scroll-handle') {
  15668. var bounds = undefined;
  15669. var target = this.target;
  15670. if (target === document.body) {
  15671. target = document.documentElement;
  15672. bounds = {
  15673. left: pageXOffset,
  15674. top: pageYOffset,
  15675. height: innerHeight,
  15676. width: innerWidth
  15677. };
  15678. } else {
  15679. bounds = getBounds(target);
  15680. }
  15681. var style = getComputedStyle(target);
  15682. var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
  15683. var scrollBottom = 0;
  15684. if (hasBottomScroll) {
  15685. scrollBottom = 15;
  15686. }
  15687. var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
  15688. var out = {
  15689. width: 15,
  15690. height: height * 0.975 * (height / target.scrollHeight),
  15691. left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
  15692. };
  15693. var fitAdj = 0;
  15694. if (height < 408 && this.target === document.body) {
  15695. fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
  15696. }
  15697. if (this.target !== document.body) {
  15698. out.height = Math.max(out.height, 24);
  15699. }
  15700. var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
  15701. out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
  15702. if (this.target === document.body) {
  15703. out.height = Math.max(out.height, 24);
  15704. }
  15705. return out;
  15706. }
  15707. } else {
  15708. return getBounds(this.target);
  15709. }
  15710. }
  15711. }, {
  15712. key: 'clearCache',
  15713. value: function clearCache() {
  15714. this._cache = {};
  15715. }
  15716. }, {
  15717. key: 'cache',
  15718. value: function cache(k, getter) {
  15719. // More than one module will often need the same DOM info, so
  15720. // we keep a cache which is cleared on each position call
  15721. if (typeof this._cache === 'undefined') {
  15722. this._cache = {};
  15723. }
  15724. if (typeof this._cache[k] === 'undefined') {
  15725. this._cache[k] = getter.call(this);
  15726. }
  15727. return this._cache[k];
  15728. }
  15729. }, {
  15730. key: 'enable',
  15731. value: function enable() {
  15732. var _this3 = this;
  15733. var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15734. if (!(this.options.addTargetClasses === false)) {
  15735. addClass(this.target, this.getClass('enabled'));
  15736. }
  15737. addClass(this.element, this.getClass('enabled'));
  15738. this.enabled = true;
  15739. this.scrollParents.forEach(function (parent) {
  15740. if (parent !== _this3.target.ownerDocument) {
  15741. parent.addEventListener('scroll', _this3.position);
  15742. }
  15743. });
  15744. if (pos) {
  15745. this.position();
  15746. }
  15747. }
  15748. }, {
  15749. key: 'disable',
  15750. value: function disable() {
  15751. var _this4 = this;
  15752. removeClass(this.target, this.getClass('enabled'));
  15753. removeClass(this.element, this.getClass('enabled'));
  15754. this.enabled = false;
  15755. if (typeof this.scrollParents !== 'undefined') {
  15756. this.scrollParents.forEach(function (parent) {
  15757. parent.removeEventListener('scroll', _this4.position);
  15758. });
  15759. }
  15760. }
  15761. }, {
  15762. key: 'destroy',
  15763. value: function destroy() {
  15764. var _this5 = this;
  15765. this.disable();
  15766. tethers.forEach(function (tether, i) {
  15767. if (tether === _this5) {
  15768. tethers.splice(i, 1);
  15769. }
  15770. });
  15771. // Remove any elements we were using for convenience from the DOM
  15772. if (tethers.length === 0) {
  15773. removeUtilElements();
  15774. }
  15775. }
  15776. }, {
  15777. key: 'updateAttachClasses',
  15778. value: function updateAttachClasses(elementAttach, targetAttach) {
  15779. var _this6 = this;
  15780. elementAttach = elementAttach || this.attachment;
  15781. targetAttach = targetAttach || this.targetAttachment;
  15782. var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
  15783. if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
  15784. // updateAttachClasses can be called more than once in a position call, so
  15785. // we need to clean up after ourselves such that when the last defer gets
  15786. // ran it doesn't add any extra classes from previous calls.
  15787. this._addAttachClasses.splice(0, this._addAttachClasses.length);
  15788. }
  15789. if (typeof this._addAttachClasses === 'undefined') {
  15790. this._addAttachClasses = [];
  15791. }
  15792. var add = this._addAttachClasses;
  15793. if (elementAttach.top) {
  15794. add.push(this.getClass('element-attached') + '-' + elementAttach.top);
  15795. }
  15796. if (elementAttach.left) {
  15797. add.push(this.getClass('element-attached') + '-' + elementAttach.left);
  15798. }
  15799. if (targetAttach.top) {
  15800. add.push(this.getClass('target-attached') + '-' + targetAttach.top);
  15801. }
  15802. if (targetAttach.left) {
  15803. add.push(this.getClass('target-attached') + '-' + targetAttach.left);
  15804. }
  15805. var all = [];
  15806. sides.forEach(function (side) {
  15807. all.push(_this6.getClass('element-attached') + '-' + side);
  15808. all.push(_this6.getClass('target-attached') + '-' + side);
  15809. });
  15810. defer(function () {
  15811. if (!(typeof _this6._addAttachClasses !== 'undefined')) {
  15812. return;
  15813. }
  15814. updateClasses(_this6.element, _this6._addAttachClasses, all);
  15815. if (!(_this6.options.addTargetClasses === false)) {
  15816. updateClasses(_this6.target, _this6._addAttachClasses, all);
  15817. }
  15818. delete _this6._addAttachClasses;
  15819. });
  15820. }
  15821. }, {
  15822. key: 'position',
  15823. value: function position() {
  15824. var _this7 = this;
  15825. var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15826. // flushChanges commits the changes immediately, leave true unless you are positioning multiple
  15827. // tethers (in which case call Tether.Utils.flush yourself when you're done)
  15828. if (!this.enabled) {
  15829. return;
  15830. }
  15831. this.clearCache();
  15832. // Turn 'auto' attachments into the appropriate corner or edge
  15833. var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
  15834. this.updateAttachClasses(this.attachment, targetAttachment);
  15835. var elementPos = this.cache('element-bounds', function () {
  15836. return getBounds(_this7.element);
  15837. });
  15838. var width = elementPos.width;
  15839. var height = elementPos.height;
  15840. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  15841. var _lastSize = this.lastSize;
  15842. // We cache the height and width to make it possible to position elements that are
  15843. // getting hidden.
  15844. width = _lastSize.width;
  15845. height = _lastSize.height;
  15846. } else {
  15847. this.lastSize = { width: width, height: height };
  15848. }
  15849. var targetPos = this.cache('target-bounds', function () {
  15850. return _this7.getTargetBounds();
  15851. });
  15852. var targetSize = targetPos;
  15853. // Get an actual px offset from the attachment
  15854. var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
  15855. var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
  15856. var manualOffset = offsetToPx(this.offset, { width: width, height: height });
  15857. var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
  15858. // Add the manually provided offset
  15859. offset = addOffset(offset, manualOffset);
  15860. targetOffset = addOffset(targetOffset, manualTargetOffset);
  15861. // It's now our goal to make (element position + offset) == (target position + target offset)
  15862. var left = targetPos.left + targetOffset.left - offset.left;
  15863. var top = targetPos.top + targetOffset.top - offset.top;
  15864. for (var i = 0; i < TetherBase.modules.length; ++i) {
  15865. var _module2 = TetherBase.modules[i];
  15866. var ret = _module2.position.call(this, {
  15867. left: left,
  15868. top: top,
  15869. targetAttachment: targetAttachment,
  15870. targetPos: targetPos,
  15871. elementPos: elementPos,
  15872. offset: offset,
  15873. targetOffset: targetOffset,
  15874. manualOffset: manualOffset,
  15875. manualTargetOffset: manualTargetOffset,
  15876. scrollbarSize: scrollbarSize,
  15877. attachment: this.attachment
  15878. });
  15879. if (ret === false) {
  15880. return false;
  15881. } else if (typeof ret === 'undefined' || (typeof ret === 'undefined' ? 'undefined' : _typeof(ret)) !== 'object') {
  15882. continue;
  15883. } else {
  15884. top = ret.top;
  15885. left = ret.left;
  15886. }
  15887. }
  15888. // We describe the position three different ways to give the optimizer
  15889. // a chance to decide the best possible way to position the element
  15890. // with the fewest repaints.
  15891. var next = {
  15892. // It's position relative to the page (absolute positioning when
  15893. // the element is a child of the body)
  15894. page: {
  15895. top: top,
  15896. left: left
  15897. },
  15898. // It's position relative to the viewport (fixed positioning)
  15899. viewport: {
  15900. top: top - pageYOffset,
  15901. bottom: pageYOffset - top - height + innerHeight,
  15902. left: left - pageXOffset,
  15903. right: pageXOffset - left - width + innerWidth
  15904. }
  15905. };
  15906. var doc = this.target.ownerDocument;
  15907. var win = doc.defaultView;
  15908. var scrollbarSize = undefined;
  15909. if (win.innerHeight > doc.documentElement.clientHeight) {
  15910. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15911. next.viewport.bottom -= scrollbarSize.height;
  15912. }
  15913. if (win.innerWidth > doc.documentElement.clientWidth) {
  15914. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15915. next.viewport.right -= scrollbarSize.width;
  15916. }
  15917. if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
  15918. // Absolute positioning in the body will be relative to the page, not the 'initial containing block'
  15919. next.page.bottom = doc.body.scrollHeight - top - height;
  15920. next.page.right = doc.body.scrollWidth - left - width;
  15921. }
  15922. if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
  15923. (function () {
  15924. var offsetParent = _this7.cache('target-offsetparent', function () {
  15925. return getOffsetParent(_this7.target);
  15926. });
  15927. var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
  15928. return getBounds(offsetParent);
  15929. });
  15930. var offsetParentStyle = getComputedStyle(offsetParent);
  15931. var offsetParentSize = offsetPosition;
  15932. var offsetBorder = {};
  15933. ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
  15934. offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
  15935. });
  15936. offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
  15937. offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
  15938. if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
  15939. if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
  15940. // We're within the visible part of the target's scroll parent
  15941. var scrollTop = offsetParent.scrollTop;
  15942. var scrollLeft = offsetParent.scrollLeft;
  15943. // It's position relative to the target's offset parent (absolute positioning when
  15944. // the element is moved to be a child of the target's offset parent).
  15945. next.offset = {
  15946. top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
  15947. left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
  15948. };
  15949. }
  15950. }
  15951. })();
  15952. }
  15953. // We could also travel up the DOM and try each containing context, rather than only
  15954. // looking at the body, but we're gonna get diminishing returns.
  15955. this.move(next);
  15956. this.history.unshift(next);
  15957. if (this.history.length > 3) {
  15958. this.history.pop();
  15959. }
  15960. if (flushChanges) {
  15961. flush();
  15962. }
  15963. return true;
  15964. }
  15965. // THE ISSUE
  15966. }, {
  15967. key: 'move',
  15968. value: function move(pos) {
  15969. var _this8 = this;
  15970. if (!(typeof this.element.parentNode !== 'undefined')) {
  15971. return;
  15972. }
  15973. var same = {};
  15974. for (var type in pos) {
  15975. same[type] = {};
  15976. for (var key in pos[type]) {
  15977. var found = false;
  15978. for (var i = 0; i < this.history.length; ++i) {
  15979. var point = this.history[i];
  15980. if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
  15981. found = true;
  15982. break;
  15983. }
  15984. }
  15985. if (!found) {
  15986. same[type][key] = true;
  15987. }
  15988. }
  15989. }
  15990. var css = { top: '', left: '', right: '', bottom: '' };
  15991. var transcribe = function transcribe(_same, _pos) {
  15992. var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
  15993. var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
  15994. if (gpu !== false) {
  15995. var yPos = undefined,
  15996. xPos = undefined;
  15997. if (_same.top) {
  15998. css.top = 0;
  15999. yPos = _pos.top;
  16000. } else {
  16001. css.bottom = 0;
  16002. yPos = -_pos.bottom;
  16003. }
  16004. if (_same.left) {
  16005. css.left = 0;
  16006. xPos = _pos.left;
  16007. } else {
  16008. css.right = 0;
  16009. xPos = -_pos.right;
  16010. }
  16011. if (window.matchMedia) {
  16012. // HubSpot/tether#207
  16013. var retina = window.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches;
  16014. if (!retina) {
  16015. xPos = Math.round(xPos);
  16016. yPos = Math.round(yPos);
  16017. }
  16018. }
  16019. css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
  16020. if (transformKey !== 'msTransform') {
  16021. // The Z transform will keep this in the GPU (faster, and prevents artifacts),
  16022. // but IE9 doesn't support 3d transforms and will choke.
  16023. css[transformKey] += " translateZ(0)";
  16024. }
  16025. } else {
  16026. if (_same.top) {
  16027. css.top = _pos.top + 'px';
  16028. } else {
  16029. css.bottom = _pos.bottom + 'px';
  16030. }
  16031. if (_same.left) {
  16032. css.left = _pos.left + 'px';
  16033. } else {
  16034. css.right = _pos.right + 'px';
  16035. }
  16036. }
  16037. };
  16038. var moved = false;
  16039. if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
  16040. css.position = 'absolute';
  16041. transcribe(same.page, pos.page);
  16042. } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
  16043. css.position = 'fixed';
  16044. transcribe(same.viewport, pos.viewport);
  16045. } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
  16046. (function () {
  16047. css.position = 'absolute';
  16048. var offsetParent = _this8.cache('target-offsetparent', function () {
  16049. return getOffsetParent(_this8.target);
  16050. });
  16051. if (getOffsetParent(_this8.element) !== offsetParent) {
  16052. defer(function () {
  16053. _this8.element.parentNode.removeChild(_this8.element);
  16054. offsetParent.appendChild(_this8.element);
  16055. });
  16056. }
  16057. transcribe(same.offset, pos.offset);
  16058. moved = true;
  16059. })();
  16060. } else {
  16061. css.position = 'absolute';
  16062. transcribe({ top: true, left: true }, pos.page);
  16063. }
  16064. if (!moved) {
  16065. if (this.options.bodyElement) {
  16066. this.options.bodyElement.appendChild(this.element);
  16067. } else {
  16068. var offsetParentIsBody = true;
  16069. var currentNode = this.element.parentNode;
  16070. while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
  16071. if (getComputedStyle(currentNode).position !== 'static') {
  16072. offsetParentIsBody = false;
  16073. break;
  16074. }
  16075. currentNode = currentNode.parentNode;
  16076. }
  16077. if (!offsetParentIsBody) {
  16078. this.element.parentNode.removeChild(this.element);
  16079. this.element.ownerDocument.body.appendChild(this.element);
  16080. }
  16081. }
  16082. }
  16083. // Any css change will trigger a repaint, so let's avoid one if nothing changed
  16084. var writeCSS = {};
  16085. var write = false;
  16086. for (var key in css) {
  16087. var val = css[key];
  16088. var elVal = this.element.style[key];
  16089. if (elVal !== val) {
  16090. write = true;
  16091. writeCSS[key] = val;
  16092. }
  16093. }
  16094. if (write) {
  16095. defer(function () {
  16096. extend(_this8.element.style, writeCSS);
  16097. _this8.trigger('repositioned');
  16098. });
  16099. }
  16100. }
  16101. }]);
  16102. return TetherClass;
  16103. }(Evented);
  16104. TetherClass.modules = [];
  16105. TetherBase.position = position;
  16106. var Tether = extend(TetherClass, TetherBase);
  16107. /* globals TetherBase */
  16108. 'use strict';
  16109. var _slicedToArray = function () {
  16110. function sliceIterator(arr, i) {
  16111. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16112. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16113. _arr.push(_s.value);if (i && _arr.length === i) break;
  16114. }
  16115. } catch (err) {
  16116. _d = true;_e = err;
  16117. } finally {
  16118. try {
  16119. if (!_n && _i['return']) _i['return']();
  16120. } finally {
  16121. if (_d) throw _e;
  16122. }
  16123. }return _arr;
  16124. }return function (arr, i) {
  16125. if (Array.isArray(arr)) {
  16126. return arr;
  16127. } else if (Symbol.iterator in Object(arr)) {
  16128. return sliceIterator(arr, i);
  16129. } else {
  16130. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16131. }
  16132. };
  16133. }();
  16134. var _TetherBase$Utils = TetherBase.Utils;
  16135. var getBounds = _TetherBase$Utils.getBounds;
  16136. var extend = _TetherBase$Utils.extend;
  16137. var updateClasses = _TetherBase$Utils.updateClasses;
  16138. var defer = _TetherBase$Utils.defer;
  16139. var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
  16140. function getBoundingRect(tether, to) {
  16141. if (to === 'scrollParent') {
  16142. to = tether.scrollParents[0];
  16143. } else if (to === 'window') {
  16144. to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
  16145. }
  16146. if (to === document) {
  16147. to = to.documentElement;
  16148. }
  16149. if (typeof to.nodeType !== 'undefined') {
  16150. (function () {
  16151. var node = to;
  16152. var size = getBounds(to);
  16153. var pos = size;
  16154. var style = getComputedStyle(to);
  16155. to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
  16156. // Account any parent Frames scroll offset
  16157. if (node.ownerDocument !== document) {
  16158. var win = node.ownerDocument.defaultView;
  16159. to[0] += win.pageXOffset;
  16160. to[1] += win.pageYOffset;
  16161. to[2] += win.pageXOffset;
  16162. to[3] += win.pageYOffset;
  16163. }
  16164. BOUNDS_FORMAT.forEach(function (side, i) {
  16165. side = side[0].toUpperCase() + side.substr(1);
  16166. if (side === 'Top' || side === 'Left') {
  16167. to[i] += parseFloat(style['border' + side + 'Width']);
  16168. } else {
  16169. to[i] -= parseFloat(style['border' + side + 'Width']);
  16170. }
  16171. });
  16172. })();
  16173. }
  16174. return to;
  16175. }
  16176. TetherBase.modules.push({
  16177. position: function position(_ref) {
  16178. var _this = this;
  16179. var top = _ref.top;
  16180. var left = _ref.left;
  16181. var targetAttachment = _ref.targetAttachment;
  16182. if (!this.options.constraints) {
  16183. return true;
  16184. }
  16185. var _cache = this.cache('element-bounds', function () {
  16186. return getBounds(_this.element);
  16187. });
  16188. var height = _cache.height;
  16189. var width = _cache.width;
  16190. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  16191. var _lastSize = this.lastSize;
  16192. // Handle the item getting hidden as a result of our positioning without glitching
  16193. // the classes in and out
  16194. width = _lastSize.width;
  16195. height = _lastSize.height;
  16196. }
  16197. var targetSize = this.cache('target-bounds', function () {
  16198. return _this.getTargetBounds();
  16199. });
  16200. var targetHeight = targetSize.height;
  16201. var targetWidth = targetSize.width;
  16202. var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
  16203. this.options.constraints.forEach(function (constraint) {
  16204. var outOfBoundsClass = constraint.outOfBoundsClass;
  16205. var pinnedClass = constraint.pinnedClass;
  16206. if (outOfBoundsClass) {
  16207. allClasses.push(outOfBoundsClass);
  16208. }
  16209. if (pinnedClass) {
  16210. allClasses.push(pinnedClass);
  16211. }
  16212. });
  16213. allClasses.forEach(function (cls) {
  16214. ['left', 'top', 'right', 'bottom'].forEach(function (side) {
  16215. allClasses.push(cls + '-' + side);
  16216. });
  16217. });
  16218. var addClasses = [];
  16219. var tAttachment = extend({}, targetAttachment);
  16220. var eAttachment = extend({}, this.attachment);
  16221. this.options.constraints.forEach(function (constraint) {
  16222. var to = constraint.to;
  16223. var attachment = constraint.attachment;
  16224. var pin = constraint.pin;
  16225. if (typeof attachment === 'undefined') {
  16226. attachment = '';
  16227. }
  16228. var changeAttachX = undefined,
  16229. changeAttachY = undefined;
  16230. if (attachment.indexOf(' ') >= 0) {
  16231. var _attachment$split = attachment.split(' ');
  16232. var _attachment$split2 = _slicedToArray(_attachment$split, 2);
  16233. changeAttachY = _attachment$split2[0];
  16234. changeAttachX = _attachment$split2[1];
  16235. } else {
  16236. changeAttachX = changeAttachY = attachment;
  16237. }
  16238. var bounds = getBoundingRect(_this, to);
  16239. if (changeAttachY === 'target' || changeAttachY === 'both') {
  16240. if (top < bounds[1] && tAttachment.top === 'top') {
  16241. top += targetHeight;
  16242. tAttachment.top = 'bottom';
  16243. }
  16244. if (top + height > bounds[3] && tAttachment.top === 'bottom') {
  16245. top -= targetHeight;
  16246. tAttachment.top = 'top';
  16247. }
  16248. }
  16249. if (changeAttachY === 'together') {
  16250. if (tAttachment.top === 'top') {
  16251. if (eAttachment.top === 'bottom' && top < bounds[1]) {
  16252. top += targetHeight;
  16253. tAttachment.top = 'bottom';
  16254. top += height;
  16255. eAttachment.top = 'top';
  16256. } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
  16257. top -= height - targetHeight;
  16258. tAttachment.top = 'bottom';
  16259. eAttachment.top = 'bottom';
  16260. }
  16261. }
  16262. if (tAttachment.top === 'bottom') {
  16263. if (eAttachment.top === 'top' && top + height > bounds[3]) {
  16264. top -= targetHeight;
  16265. tAttachment.top = 'top';
  16266. top -= height;
  16267. eAttachment.top = 'bottom';
  16268. } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
  16269. top += height - targetHeight;
  16270. tAttachment.top = 'top';
  16271. eAttachment.top = 'top';
  16272. }
  16273. }
  16274. if (tAttachment.top === 'middle') {
  16275. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16276. top -= height;
  16277. eAttachment.top = 'bottom';
  16278. } else if (top < bounds[1] && eAttachment.top === 'bottom') {
  16279. top += height;
  16280. eAttachment.top = 'top';
  16281. }
  16282. }
  16283. }
  16284. if (changeAttachX === 'target' || changeAttachX === 'both') {
  16285. if (left < bounds[0] && tAttachment.left === 'left') {
  16286. left += targetWidth;
  16287. tAttachment.left = 'right';
  16288. }
  16289. if (left + width > bounds[2] && tAttachment.left === 'right') {
  16290. left -= targetWidth;
  16291. tAttachment.left = 'left';
  16292. }
  16293. }
  16294. if (changeAttachX === 'together') {
  16295. if (left < bounds[0] && tAttachment.left === 'left') {
  16296. if (eAttachment.left === 'right') {
  16297. left += targetWidth;
  16298. tAttachment.left = 'right';
  16299. left += width;
  16300. eAttachment.left = 'left';
  16301. } else if (eAttachment.left === 'left') {
  16302. left += targetWidth;
  16303. tAttachment.left = 'right';
  16304. left -= width;
  16305. eAttachment.left = 'right';
  16306. }
  16307. } else if (left + width > bounds[2] && tAttachment.left === 'right') {
  16308. if (eAttachment.left === 'left') {
  16309. left -= targetWidth;
  16310. tAttachment.left = 'left';
  16311. left -= width;
  16312. eAttachment.left = 'right';
  16313. } else if (eAttachment.left === 'right') {
  16314. left -= targetWidth;
  16315. tAttachment.left = 'left';
  16316. left += width;
  16317. eAttachment.left = 'left';
  16318. }
  16319. } else if (tAttachment.left === 'center') {
  16320. if (left + width > bounds[2] && eAttachment.left === 'left') {
  16321. left -= width;
  16322. eAttachment.left = 'right';
  16323. } else if (left < bounds[0] && eAttachment.left === 'right') {
  16324. left += width;
  16325. eAttachment.left = 'left';
  16326. }
  16327. }
  16328. }
  16329. if (changeAttachY === 'element' || changeAttachY === 'both') {
  16330. if (top < bounds[1] && eAttachment.top === 'bottom') {
  16331. top += height;
  16332. eAttachment.top = 'top';
  16333. }
  16334. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16335. top -= height;
  16336. eAttachment.top = 'bottom';
  16337. }
  16338. }
  16339. if (changeAttachX === 'element' || changeAttachX === 'both') {
  16340. if (left < bounds[0]) {
  16341. if (eAttachment.left === 'right') {
  16342. left += width;
  16343. eAttachment.left = 'left';
  16344. } else if (eAttachment.left === 'center') {
  16345. left += width / 2;
  16346. eAttachment.left = 'left';
  16347. }
  16348. }
  16349. if (left + width > bounds[2]) {
  16350. if (eAttachment.left === 'left') {
  16351. left -= width;
  16352. eAttachment.left = 'right';
  16353. } else if (eAttachment.left === 'center') {
  16354. left -= width / 2;
  16355. eAttachment.left = 'right';
  16356. }
  16357. }
  16358. }
  16359. if (typeof pin === 'string') {
  16360. pin = pin.split(',').map(function (p) {
  16361. return p.trim();
  16362. });
  16363. } else if (pin === true) {
  16364. pin = ['top', 'left', 'right', 'bottom'];
  16365. }
  16366. pin = pin || [];
  16367. var pinned = [];
  16368. var oob = [];
  16369. if (top < bounds[1]) {
  16370. if (pin.indexOf('top') >= 0) {
  16371. top = bounds[1];
  16372. pinned.push('top');
  16373. } else {
  16374. oob.push('top');
  16375. }
  16376. }
  16377. if (top + height > bounds[3]) {
  16378. if (pin.indexOf('bottom') >= 0) {
  16379. top = bounds[3] - height;
  16380. pinned.push('bottom');
  16381. } else {
  16382. oob.push('bottom');
  16383. }
  16384. }
  16385. if (left < bounds[0]) {
  16386. if (pin.indexOf('left') >= 0) {
  16387. left = bounds[0];
  16388. pinned.push('left');
  16389. } else {
  16390. oob.push('left');
  16391. }
  16392. }
  16393. if (left + width > bounds[2]) {
  16394. if (pin.indexOf('right') >= 0) {
  16395. left = bounds[2] - width;
  16396. pinned.push('right');
  16397. } else {
  16398. oob.push('right');
  16399. }
  16400. }
  16401. if (pinned.length) {
  16402. (function () {
  16403. var pinnedClass = undefined;
  16404. if (typeof _this.options.pinnedClass !== 'undefined') {
  16405. pinnedClass = _this.options.pinnedClass;
  16406. } else {
  16407. pinnedClass = _this.getClass('pinned');
  16408. }
  16409. addClasses.push(pinnedClass);
  16410. pinned.forEach(function (side) {
  16411. addClasses.push(pinnedClass + '-' + side);
  16412. });
  16413. })();
  16414. }
  16415. if (oob.length) {
  16416. (function () {
  16417. var oobClass = undefined;
  16418. if (typeof _this.options.outOfBoundsClass !== 'undefined') {
  16419. oobClass = _this.options.outOfBoundsClass;
  16420. } else {
  16421. oobClass = _this.getClass('out-of-bounds');
  16422. }
  16423. addClasses.push(oobClass);
  16424. oob.forEach(function (side) {
  16425. addClasses.push(oobClass + '-' + side);
  16426. });
  16427. })();
  16428. }
  16429. if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
  16430. eAttachment.left = tAttachment.left = false;
  16431. }
  16432. if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
  16433. eAttachment.top = tAttachment.top = false;
  16434. }
  16435. if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
  16436. _this.updateAttachClasses(eAttachment, tAttachment);
  16437. _this.trigger('update', {
  16438. attachment: eAttachment,
  16439. targetAttachment: tAttachment
  16440. });
  16441. }
  16442. });
  16443. defer(function () {
  16444. if (!(_this.options.addTargetClasses === false)) {
  16445. updateClasses(_this.target, addClasses, allClasses);
  16446. }
  16447. updateClasses(_this.element, addClasses, allClasses);
  16448. });
  16449. return { top: top, left: left };
  16450. }
  16451. });
  16452. /* globals TetherBase */
  16453. 'use strict';
  16454. var _TetherBase$Utils = TetherBase.Utils;
  16455. var getBounds = _TetherBase$Utils.getBounds;
  16456. var updateClasses = _TetherBase$Utils.updateClasses;
  16457. var defer = _TetherBase$Utils.defer;
  16458. TetherBase.modules.push({
  16459. position: function position(_ref) {
  16460. var _this = this;
  16461. var top = _ref.top;
  16462. var left = _ref.left;
  16463. var _cache = this.cache('element-bounds', function () {
  16464. return getBounds(_this.element);
  16465. });
  16466. var height = _cache.height;
  16467. var width = _cache.width;
  16468. var targetPos = this.getTargetBounds();
  16469. var bottom = top + height;
  16470. var right = left + width;
  16471. var abutted = [];
  16472. if (top <= targetPos.bottom && bottom >= targetPos.top) {
  16473. ['left', 'right'].forEach(function (side) {
  16474. var targetPosSide = targetPos[side];
  16475. if (targetPosSide === left || targetPosSide === right) {
  16476. abutted.push(side);
  16477. }
  16478. });
  16479. }
  16480. if (left <= targetPos.right && right >= targetPos.left) {
  16481. ['top', 'bottom'].forEach(function (side) {
  16482. var targetPosSide = targetPos[side];
  16483. if (targetPosSide === top || targetPosSide === bottom) {
  16484. abutted.push(side);
  16485. }
  16486. });
  16487. }
  16488. var allClasses = [];
  16489. var addClasses = [];
  16490. var sides = ['left', 'top', 'right', 'bottom'];
  16491. allClasses.push(this.getClass('abutted'));
  16492. sides.forEach(function (side) {
  16493. allClasses.push(_this.getClass('abutted') + '-' + side);
  16494. });
  16495. if (abutted.length) {
  16496. addClasses.push(this.getClass('abutted'));
  16497. }
  16498. abutted.forEach(function (side) {
  16499. addClasses.push(_this.getClass('abutted') + '-' + side);
  16500. });
  16501. defer(function () {
  16502. if (!(_this.options.addTargetClasses === false)) {
  16503. updateClasses(_this.target, addClasses, allClasses);
  16504. }
  16505. updateClasses(_this.element, addClasses, allClasses);
  16506. });
  16507. return true;
  16508. }
  16509. });
  16510. /* globals TetherBase */
  16511. 'use strict';
  16512. var _slicedToArray = function () {
  16513. function sliceIterator(arr, i) {
  16514. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16515. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16516. _arr.push(_s.value);if (i && _arr.length === i) break;
  16517. }
  16518. } catch (err) {
  16519. _d = true;_e = err;
  16520. } finally {
  16521. try {
  16522. if (!_n && _i['return']) _i['return']();
  16523. } finally {
  16524. if (_d) throw _e;
  16525. }
  16526. }return _arr;
  16527. }return function (arr, i) {
  16528. if (Array.isArray(arr)) {
  16529. return arr;
  16530. } else if (Symbol.iterator in Object(arr)) {
  16531. return sliceIterator(arr, i);
  16532. } else {
  16533. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16534. }
  16535. };
  16536. }();
  16537. TetherBase.modules.push({
  16538. position: function position(_ref) {
  16539. var top = _ref.top;
  16540. var left = _ref.left;
  16541. if (!this.options.shift) {
  16542. return;
  16543. }
  16544. var shift = this.options.shift;
  16545. if (typeof this.options.shift === 'function') {
  16546. shift = this.options.shift.call(this, { top: top, left: left });
  16547. }
  16548. var shiftTop = undefined,
  16549. shiftLeft = undefined;
  16550. if (typeof shift === 'string') {
  16551. shift = shift.split(' ');
  16552. shift[1] = shift[1] || shift[0];
  16553. var _shift = shift;
  16554. var _shift2 = _slicedToArray(_shift, 2);
  16555. shiftTop = _shift2[0];
  16556. shiftLeft = _shift2[1];
  16557. shiftTop = parseFloat(shiftTop, 10);
  16558. shiftLeft = parseFloat(shiftLeft, 10);
  16559. } else {
  16560. shiftTop = shift.top;
  16561. shiftLeft = shift.left;
  16562. }
  16563. top += shiftTop;
  16564. left += shiftLeft;
  16565. return { top: top, left: left };
  16566. }
  16567. });
  16568. return Tether;
  16569. });
  16570. /***/ }),
  16571. /* 35 */
  16572. /***/ (function(module, exports, __webpack_require__) {
  16573. "use strict";
  16574. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  16575. /*
  16576. * Toastr
  16577. * Copyright 2012-2015
  16578. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  16579. * All Rights Reserved.
  16580. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  16581. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  16582. *
  16583. * ARIA Support: Greta Krafsig
  16584. *
  16585. * Project: https://github.com/CodeSeven/toastr
  16586. */
  16587. /* global define */
  16588. (function (define) {
  16589. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function ($) {
  16590. return function () {
  16591. var $container;
  16592. var listener;
  16593. var toastId = 0;
  16594. var toastType = {
  16595. error: 'error',
  16596. info: 'info',
  16597. success: 'success',
  16598. warning: 'warning'
  16599. };
  16600. var toastr = {
  16601. clear: clear,
  16602. remove: remove,
  16603. error: error,
  16604. getContainer: getContainer,
  16605. info: info,
  16606. options: {},
  16607. subscribe: subscribe,
  16608. success: success,
  16609. version: '2.1.3',
  16610. warning: warning
  16611. };
  16612. var previousToast;
  16613. return toastr;
  16614. ////////////////
  16615. function error(message, title, optionsOverride) {
  16616. return notify({
  16617. type: toastType.error,
  16618. iconClass: getOptions().iconClasses.error,
  16619. message: message,
  16620. optionsOverride: optionsOverride,
  16621. title: title
  16622. });
  16623. }
  16624. function getContainer(options, create) {
  16625. if (!options) {
  16626. options = getOptions();
  16627. }
  16628. $container = $('#' + options.containerId);
  16629. if ($container.length) {
  16630. return $container;
  16631. }
  16632. if (create) {
  16633. $container = createContainer(options);
  16634. }
  16635. return $container;
  16636. }
  16637. function info(message, title, optionsOverride) {
  16638. return notify({
  16639. type: toastType.info,
  16640. iconClass: getOptions().iconClasses.info,
  16641. message: message,
  16642. optionsOverride: optionsOverride,
  16643. title: title
  16644. });
  16645. }
  16646. function subscribe(callback) {
  16647. listener = callback;
  16648. }
  16649. function success(message, title, optionsOverride) {
  16650. return notify({
  16651. type: toastType.success,
  16652. iconClass: getOptions().iconClasses.success,
  16653. message: message,
  16654. optionsOverride: optionsOverride,
  16655. title: title
  16656. });
  16657. }
  16658. function warning(message, title, optionsOverride) {
  16659. return notify({
  16660. type: toastType.warning,
  16661. iconClass: getOptions().iconClasses.warning,
  16662. message: message,
  16663. optionsOverride: optionsOverride,
  16664. title: title
  16665. });
  16666. }
  16667. function clear($toastElement, clearOptions) {
  16668. var options = getOptions();
  16669. if (!$container) {
  16670. getContainer(options);
  16671. }
  16672. if (!clearToast($toastElement, options, clearOptions)) {
  16673. clearContainer(options);
  16674. }
  16675. }
  16676. function remove($toastElement) {
  16677. var options = getOptions();
  16678. if (!$container) {
  16679. getContainer(options);
  16680. }
  16681. if ($toastElement && $(':focus', $toastElement).length === 0) {
  16682. removeToast($toastElement);
  16683. return;
  16684. }
  16685. if ($container.children().length) {
  16686. $container.remove();
  16687. }
  16688. }
  16689. // internal functions
  16690. function clearContainer(options) {
  16691. var toastsToClear = $container.children();
  16692. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  16693. clearToast($(toastsToClear[i]), options);
  16694. }
  16695. }
  16696. function clearToast($toastElement, options, clearOptions) {
  16697. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  16698. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  16699. $toastElement[options.hideMethod]({
  16700. duration: options.hideDuration,
  16701. easing: options.hideEasing,
  16702. complete: function complete() {
  16703. removeToast($toastElement);
  16704. }
  16705. });
  16706. return true;
  16707. }
  16708. return false;
  16709. }
  16710. function createContainer(options) {
  16711. $container = $('<div/>').attr('id', options.containerId).addClass(options.positionClass);
  16712. $container.appendTo($(options.target));
  16713. return $container;
  16714. }
  16715. function getDefaults() {
  16716. return {
  16717. tapToDismiss: true,
  16718. toastClass: 'toast',
  16719. containerId: 'toast-container',
  16720. debug: false,
  16721. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  16722. showDuration: 300,
  16723. showEasing: 'swing', //swing and linear are built into jQuery
  16724. onShown: undefined,
  16725. hideMethod: 'fadeOut',
  16726. hideDuration: 1000,
  16727. hideEasing: 'swing',
  16728. onHidden: undefined,
  16729. closeMethod: false,
  16730. closeDuration: false,
  16731. closeEasing: false,
  16732. closeOnHover: true,
  16733. extendedTimeOut: 1000,
  16734. iconClasses: {
  16735. error: 'toast-error',
  16736. info: 'toast-info',
  16737. success: 'toast-success',
  16738. warning: 'toast-warning'
  16739. },
  16740. iconClass: 'toast-info',
  16741. positionClass: 'toast-top-right',
  16742. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  16743. titleClass: 'toast-title',
  16744. messageClass: 'toast-message',
  16745. escapeHtml: false,
  16746. target: 'body',
  16747. closeHtml: '<button type="button">&times;</button>',
  16748. closeClass: 'toast-close-button',
  16749. newestOnTop: true,
  16750. preventDuplicates: false,
  16751. progressBar: false,
  16752. progressClass: 'toast-progress',
  16753. rtl: false
  16754. };
  16755. }
  16756. function publish(args) {
  16757. if (!listener) {
  16758. return;
  16759. }
  16760. listener(args);
  16761. }
  16762. function notify(map) {
  16763. var options = getOptions();
  16764. var iconClass = map.iconClass || options.iconClass;
  16765. if (typeof map.optionsOverride !== 'undefined') {
  16766. options = $.extend(options, map.optionsOverride);
  16767. iconClass = map.optionsOverride.iconClass || iconClass;
  16768. }
  16769. if (shouldExit(options, map)) {
  16770. return;
  16771. }
  16772. toastId++;
  16773. $container = getContainer(options, true);
  16774. var intervalId = null;
  16775. var $toastElement = $('<div/>');
  16776. var $titleElement = $('<div/>');
  16777. var $messageElement = $('<div/>');
  16778. var $progressElement = $('<div/>');
  16779. var $closeElement = $(options.closeHtml);
  16780. var progressBar = {
  16781. intervalId: null,
  16782. hideEta: null,
  16783. maxHideTime: null
  16784. };
  16785. var response = {
  16786. toastId: toastId,
  16787. state: 'visible',
  16788. startTime: new Date(),
  16789. options: options,
  16790. map: map
  16791. };
  16792. personalizeToast();
  16793. displayToast();
  16794. handleEvents();
  16795. publish(response);
  16796. if (options.debug && console) {
  16797. console.log(response);
  16798. }
  16799. return $toastElement;
  16800. function escapeHtml(source) {
  16801. if (source == null) {
  16802. source = '';
  16803. }
  16804. return source.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  16805. }
  16806. function personalizeToast() {
  16807. setIcon();
  16808. setTitle();
  16809. setMessage();
  16810. setCloseButton();
  16811. setProgressBar();
  16812. setRTL();
  16813. setSequence();
  16814. setAria();
  16815. }
  16816. function setAria() {
  16817. var ariaValue = '';
  16818. switch (map.iconClass) {
  16819. case 'toast-success':
  16820. case 'toast-info':
  16821. ariaValue = 'polite';
  16822. break;
  16823. default:
  16824. ariaValue = 'assertive';
  16825. }
  16826. $toastElement.attr('aria-live', ariaValue);
  16827. }
  16828. function handleEvents() {
  16829. if (options.closeOnHover) {
  16830. $toastElement.hover(stickAround, delayedHideToast);
  16831. }
  16832. if (!options.onclick && options.tapToDismiss) {
  16833. $toastElement.click(hideToast);
  16834. }
  16835. if (options.closeButton && $closeElement) {
  16836. $closeElement.click(function (event) {
  16837. if (event.stopPropagation) {
  16838. event.stopPropagation();
  16839. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  16840. event.cancelBubble = true;
  16841. }
  16842. if (options.onCloseClick) {
  16843. options.onCloseClick(event);
  16844. }
  16845. hideToast(true);
  16846. });
  16847. }
  16848. if (options.onclick) {
  16849. $toastElement.click(function (event) {
  16850. options.onclick(event);
  16851. hideToast();
  16852. });
  16853. }
  16854. }
  16855. function displayToast() {
  16856. $toastElement.hide();
  16857. $toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });
  16858. if (options.timeOut > 0) {
  16859. intervalId = setTimeout(hideToast, options.timeOut);
  16860. progressBar.maxHideTime = parseFloat(options.timeOut);
  16861. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16862. if (options.progressBar) {
  16863. progressBar.intervalId = setInterval(updateProgress, 10);
  16864. }
  16865. }
  16866. }
  16867. function setIcon() {
  16868. if (map.iconClass) {
  16869. $toastElement.addClass(options.toastClass).addClass(iconClass);
  16870. }
  16871. }
  16872. function setSequence() {
  16873. if (options.newestOnTop) {
  16874. $container.prepend($toastElement);
  16875. } else {
  16876. $container.append($toastElement);
  16877. }
  16878. }
  16879. function setTitle() {
  16880. if (map.title) {
  16881. var suffix = map.title;
  16882. if (options.escapeHtml) {
  16883. suffix = escapeHtml(map.title);
  16884. }
  16885. $titleElement.append(suffix).addClass(options.titleClass);
  16886. $toastElement.append($titleElement);
  16887. }
  16888. }
  16889. function setMessage() {
  16890. if (map.message) {
  16891. var suffix = map.message;
  16892. if (options.escapeHtml) {
  16893. suffix = escapeHtml(map.message);
  16894. }
  16895. $messageElement.append(suffix).addClass(options.messageClass);
  16896. $toastElement.append($messageElement);
  16897. }
  16898. }
  16899. function setCloseButton() {
  16900. if (options.closeButton) {
  16901. $closeElement.addClass(options.closeClass).attr('role', 'button');
  16902. $toastElement.prepend($closeElement);
  16903. }
  16904. }
  16905. function setProgressBar() {
  16906. if (options.progressBar) {
  16907. $progressElement.addClass(options.progressClass);
  16908. $toastElement.prepend($progressElement);
  16909. }
  16910. }
  16911. function setRTL() {
  16912. if (options.rtl) {
  16913. $toastElement.addClass('rtl');
  16914. }
  16915. }
  16916. function shouldExit(options, map) {
  16917. if (options.preventDuplicates) {
  16918. if (map.message === previousToast) {
  16919. return true;
  16920. } else {
  16921. previousToast = map.message;
  16922. }
  16923. }
  16924. return false;
  16925. }
  16926. function hideToast(override) {
  16927. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  16928. var duration = override && options.closeDuration !== false ? options.closeDuration : options.hideDuration;
  16929. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  16930. if ($(':focus', $toastElement).length && !override) {
  16931. return;
  16932. }
  16933. clearTimeout(progressBar.intervalId);
  16934. return $toastElement[method]({
  16935. duration: duration,
  16936. easing: easing,
  16937. complete: function complete() {
  16938. removeToast($toastElement);
  16939. clearTimeout(intervalId);
  16940. if (options.onHidden && response.state !== 'hidden') {
  16941. options.onHidden();
  16942. }
  16943. response.state = 'hidden';
  16944. response.endTime = new Date();
  16945. publish(response);
  16946. }
  16947. });
  16948. }
  16949. function delayedHideToast() {
  16950. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  16951. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  16952. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  16953. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16954. }
  16955. }
  16956. function stickAround() {
  16957. clearTimeout(intervalId);
  16958. progressBar.hideEta = 0;
  16959. $toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });
  16960. }
  16961. function updateProgress() {
  16962. var percentage = (progressBar.hideEta - new Date().getTime()) / progressBar.maxHideTime * 100;
  16963. $progressElement.width(percentage + '%');
  16964. }
  16965. }
  16966. function getOptions() {
  16967. return $.extend({}, getDefaults(), toastr.options);
  16968. }
  16969. function removeToast($toastElement) {
  16970. if (!$container) {
  16971. $container = getContainer();
  16972. }
  16973. if ($toastElement.is(':visible')) {
  16974. return;
  16975. }
  16976. $toastElement.remove();
  16977. $toastElement = null;
  16978. if ($container.children().length === 0) {
  16979. $container.remove();
  16980. previousToast = undefined;
  16981. }
  16982. }
  16983. }();
  16984. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16985. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16986. })(__webpack_require__(36));
  16987. /***/ }),
  16988. /* 36 */
  16989. /***/ (function(module, exports) {
  16990. module.exports = function() {
  16991. throw new Error("define cannot be used indirect");
  16992. };
  16993. /***/ })
  16994. /******/ ]);