layers-ui.js 662 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606
  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-toggle="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 (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. * @autor ThurData <info@thurdata.ch>
  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. * @autor ThurData <info@thurdata.ch>
  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. plugins.requested[name] = true;
  9557. plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
  9558. plugins.names.push(name);
  9559. };
  9560. /**
  9561. * Initializes a plugin.
  9562. *
  9563. * @param {string} name
  9564. */
  9565. Interface.prototype.require = function (name) {
  9566. var self = this;
  9567. var plugins = self.plugins;
  9568. if (!self.plugins.loaded.hasOwnProperty(name)) {
  9569. if (plugins.requested[name]) {
  9570. throw new Error('Plugin has circular dependency ("' + name + '")');
  9571. }
  9572. self.loadPlugin(name);
  9573. }
  9574. return plugins.loaded[name];
  9575. };
  9576. /**
  9577. * Registers a plugin.
  9578. *
  9579. * @param {string} name
  9580. * @param {function} fn
  9581. */
  9582. Interface.define = function (name, fn) {
  9583. Interface.plugins[name] = {
  9584. 'name': name,
  9585. 'fn': fn
  9586. };
  9587. };
  9588. };
  9589. var utils = {
  9590. isArray: Array.isArray || function (vArg) {
  9591. return Object.prototype.toString.call(vArg) === '[object Array]';
  9592. }
  9593. };
  9594. return MicroPlugin;
  9595. });
  9596. /**
  9597. * selectize.js (v0.12.4)
  9598. * Copyright (c) 2013–2015 Brian Reavis & contributors
  9599. *
  9600. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9601. * file except in compliance with the License. You may obtain a copy of the License at:
  9602. * http://www.apache.org/licenses/LICENSE-2.0
  9603. *
  9604. * Unless required by applicable law or agreed to in writing, software distributed under
  9605. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9606. * ANY KIND, either express or implied. See the License for the specific language
  9607. * governing permissions and limitations under the License.
  9608. *
  9609. * @autor ThurData <info@thurdata.ch>
  9610. */
  9611. /*jshint curly:false */
  9612. /*jshint browser:true */
  9613. (function (root, factory) {
  9614. if (true) {
  9615. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_1__], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  9616. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  9617. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  9618. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9619. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9620. module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
  9621. } else {
  9622. root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
  9623. }
  9624. })(undefined, function ($, Sifter, MicroPlugin) {
  9625. 'use strict';
  9626. var highlight = function highlight($element, pattern) {
  9627. if (typeof pattern === 'string' && !pattern.length) return;
  9628. var regex = typeof pattern === 'string' ? new RegExp(pattern, 'i') : pattern;
  9629. var highlight = function highlight(node) {
  9630. var skip = 0;
  9631. if (node.nodeType === 3) {
  9632. var pos = node.data.search(regex);
  9633. if (pos >= 0 && node.data.length > 0) {
  9634. var match = node.data.match(regex);
  9635. var spannode = document.createElement('span');
  9636. spannode.className = 'highlight';
  9637. var middlebit = node.splitText(pos);
  9638. var endbit = middlebit.splitText(match[0].length);
  9639. var middleclone = middlebit.cloneNode(true);
  9640. spannode.appendChild(middleclone);
  9641. middlebit.parentNode.replaceChild(spannode, middlebit);
  9642. skip = 1;
  9643. }
  9644. } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
  9645. for (var i = 0; i < node.childNodes.length; ++i) {
  9646. i += highlight(node.childNodes[i]);
  9647. }
  9648. }
  9649. return skip;
  9650. };
  9651. return $element.each(function () {
  9652. highlight(this);
  9653. });
  9654. };
  9655. /**
  9656. * removeHighlight fn copied from highlight v5 and
  9657. * edited to remove with() and pass js strict mode
  9658. */
  9659. $.fn.removeHighlight = function () {
  9660. return this.find("span.highlight").each(function () {
  9661. this.parentNode.firstChild.nodeName;
  9662. var parent = this.parentNode;
  9663. parent.replaceChild(this.firstChild, this);
  9664. parent.normalize();
  9665. }).end();
  9666. };
  9667. var MicroEvent = function MicroEvent() {};
  9668. MicroEvent.prototype = {
  9669. on: function on(event, fct) {
  9670. this._events = this._events || {};
  9671. this._events[event] = this._events[event] || [];
  9672. this._events[event].push(fct);
  9673. },
  9674. off: function off(event, fct) {
  9675. var n = arguments.length;
  9676. if (n === 0) return delete this._events;
  9677. if (n === 1) return delete this._events[event];
  9678. this._events = this._events || {};
  9679. if (event in this._events === false) return;
  9680. this._events[event].splice(this._events[event].indexOf(fct), 1);
  9681. },
  9682. trigger: function trigger(event /* , args... */) {
  9683. this._events = this._events || {};
  9684. if (event in this._events === false) return;
  9685. for (var i = 0; i < this._events[event].length; i++) {
  9686. this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
  9687. }
  9688. }
  9689. };
  9690. /**
  9691. * Mixin will delegate all MicroEvent.js function in the destination object.
  9692. *
  9693. * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent
  9694. *
  9695. * @param {object} the object which will support MicroEvent
  9696. */
  9697. MicroEvent.mixin = function (destObject) {
  9698. var props = ['on', 'off', 'trigger'];
  9699. for (var i = 0; i < props.length; i++) {
  9700. destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
  9701. }
  9702. };
  9703. var IS_MAC = /Mac/.test(navigator.userAgent);
  9704. var KEY_A = 65;
  9705. var KEY_COMMA = 188;
  9706. var KEY_RETURN = 13;
  9707. var KEY_ESC = 27;
  9708. var KEY_LEFT = 37;
  9709. var KEY_UP = 38;
  9710. var KEY_P = 80;
  9711. var KEY_RIGHT = 39;
  9712. var KEY_DOWN = 40;
  9713. var KEY_N = 78;
  9714. var KEY_BACKSPACE = 8;
  9715. var KEY_DELETE = 46;
  9716. var KEY_SHIFT = 16;
  9717. var KEY_CMD = IS_MAC ? 91 : 17;
  9718. var KEY_CTRL = IS_MAC ? 18 : 17;
  9719. var KEY_TAB = 9;
  9720. var TAG_SELECT = 1;
  9721. var TAG_INPUT = 2;
  9722. // for now, android support in general is too spotty to support validity
  9723. var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
  9724. var isset = function isset(object) {
  9725. return typeof object !== 'undefined';
  9726. };
  9727. /**
  9728. * Converts a scalar to its best string representation
  9729. * for hash keys and HTML attribute values.
  9730. *
  9731. * Transformations:
  9732. * 'str' -> 'str'
  9733. * null -> ''
  9734. * undefined -> ''
  9735. * true -> '1'
  9736. * false -> '0'
  9737. * 0 -> '0'
  9738. * 1 -> '1'
  9739. *
  9740. * @param {string} value
  9741. * @returns {string|null}
  9742. */
  9743. var hash_key = function hash_key(value) {
  9744. if (typeof value === 'undefined' || value === null) return null;
  9745. if (typeof value === 'boolean') return value ? '1' : '0';
  9746. return value + '';
  9747. };
  9748. /**
  9749. * Escapes a string for use within HTML.
  9750. *
  9751. * @param {string} str
  9752. * @returns {string}
  9753. */
  9754. var escape_html = function escape_html(str) {
  9755. return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  9756. };
  9757. /**
  9758. * Escapes "$" characters in replacement strings.
  9759. *
  9760. * @param {string} str
  9761. * @returns {string}
  9762. */
  9763. var escape_replace = function escape_replace(str) {
  9764. return (str + '').replace(/\$/g, '$$$$');
  9765. };
  9766. var hook = {};
  9767. /**
  9768. * Wraps `method` on `self` so that `fn`
  9769. * is invoked before the original method.
  9770. *
  9771. * @param {object} self
  9772. * @param {string} method
  9773. * @param {function} fn
  9774. */
  9775. hook.before = function (self, method, fn) {
  9776. var original = self[method];
  9777. self[method] = function () {
  9778. fn.apply(self, arguments);
  9779. return original.apply(self, arguments);
  9780. };
  9781. };
  9782. /**
  9783. * Wraps `method` on `self` so that `fn`
  9784. * is invoked after the original method.
  9785. *
  9786. * @param {object} self
  9787. * @param {string} method
  9788. * @param {function} fn
  9789. */
  9790. hook.after = function (self, method, fn) {
  9791. var original = self[method];
  9792. self[method] = function () {
  9793. var result = original.apply(self, arguments);
  9794. fn.apply(self, arguments);
  9795. return result;
  9796. };
  9797. };
  9798. /**
  9799. * Wraps `fn` so that it can only be invoked once.
  9800. *
  9801. * @param {function} fn
  9802. * @returns {function}
  9803. */
  9804. var once = function once(fn) {
  9805. var called = false;
  9806. return function () {
  9807. if (called) return;
  9808. called = true;
  9809. fn.apply(this, arguments);
  9810. };
  9811. };
  9812. /**
  9813. * Wraps `fn` so that it can only be called once
  9814. * every `delay` milliseconds (invoked on the falling edge).
  9815. *
  9816. * @param {function} fn
  9817. * @param {int} delay
  9818. * @returns {function}
  9819. */
  9820. var debounce = function debounce(fn, delay) {
  9821. var timeout;
  9822. return function () {
  9823. var self = this;
  9824. var args = arguments;
  9825. window.clearTimeout(timeout);
  9826. timeout = window.setTimeout(function () {
  9827. fn.apply(self, args);
  9828. }, delay);
  9829. };
  9830. };
  9831. /**
  9832. * Debounce all fired events types listed in `types`
  9833. * while executing the provided `fn`.
  9834. *
  9835. * @param {object} self
  9836. * @param {array} types
  9837. * @param {function} fn
  9838. */
  9839. var debounce_events = function debounce_events(self, types, fn) {
  9840. var type;
  9841. var trigger = self.trigger;
  9842. var event_args = {};
  9843. // override trigger method
  9844. self.trigger = function () {
  9845. var type = arguments[0];
  9846. if (types.indexOf(type) !== -1) {
  9847. event_args[type] = arguments;
  9848. } else {
  9849. return trigger.apply(self, arguments);
  9850. }
  9851. };
  9852. // invoke provided function
  9853. fn.apply(self, []);
  9854. self.trigger = trigger;
  9855. // trigger queued events
  9856. for (type in event_args) {
  9857. if (event_args.hasOwnProperty(type)) {
  9858. trigger.apply(self, event_args[type]);
  9859. }
  9860. }
  9861. };
  9862. /**
  9863. * A workaround for http://bugs.jquery.com/ticket/6696
  9864. *
  9865. * @param {object} $parent - Parent element to listen on.
  9866. * @param {string} event - Event name.
  9867. * @param {string} selector - Descendant selector to filter by.
  9868. * @param {function} fn - Event handler.
  9869. */
  9870. var watchChildEvent = function watchChildEvent($parent, event, selector, fn) {
  9871. $parent.on(event, selector, function (e) {
  9872. var child = e.target;
  9873. while (child && child.parentNode !== $parent[0]) {
  9874. child = child.parentNode;
  9875. }
  9876. e.currentTarget = child;
  9877. return fn.apply(this, [e]);
  9878. });
  9879. };
  9880. /**
  9881. * Determines the current selection within a text input control.
  9882. * Returns an object containing:
  9883. * - start
  9884. * - length
  9885. *
  9886. * @param {object} input
  9887. * @returns {object}
  9888. */
  9889. var getSelection = function getSelection(input) {
  9890. var result = {};
  9891. if ('selectionStart' in input) {
  9892. result.start = input.selectionStart;
  9893. result.length = input.selectionEnd - result.start;
  9894. } else if (document.selection) {
  9895. input.focus();
  9896. var sel = document.selection.createRange();
  9897. var selLen = document.selection.createRange().text.length;
  9898. sel.moveStart('character', -input.value.length);
  9899. result.start = sel.text.length - selLen;
  9900. result.length = selLen;
  9901. }
  9902. return result;
  9903. };
  9904. /**
  9905. * Copies CSS properties from one element to another.
  9906. *
  9907. * @param {object} $from
  9908. * @param {object} $to
  9909. * @param {array} properties
  9910. */
  9911. var transferStyles = function transferStyles($from, $to, properties) {
  9912. var i,
  9913. n,
  9914. styles = {};
  9915. if (properties) {
  9916. for (i = 0, n = properties.length; i < n; i++) {
  9917. styles[properties[i]] = $from.css(properties[i]);
  9918. }
  9919. } else {
  9920. styles = $from.css();
  9921. }
  9922. $to.css(styles);
  9923. };
  9924. /**
  9925. * Measures the width of a string within a
  9926. * parent element (in pixels).
  9927. *
  9928. * @param {string} str
  9929. * @param {object} $parent
  9930. * @returns {int}
  9931. */
  9932. var measureString = function measureString(str, $parent) {
  9933. if (!str) {
  9934. return 0;
  9935. }
  9936. var $test = $('<test>').css({
  9937. position: 'absolute',
  9938. top: -99999,
  9939. left: -99999,
  9940. width: 'auto',
  9941. padding: 0,
  9942. whiteSpace: 'pre'
  9943. }).text(str).appendTo('body');
  9944. transferStyles($parent, $test, ['letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform']);
  9945. var width = $test.width();
  9946. $test.remove();
  9947. return width;
  9948. };
  9949. /**
  9950. * Sets up an input to grow horizontally as the user
  9951. * types. If the value is changed manually, you can
  9952. * trigger the "update" handler to resize:
  9953. *
  9954. * $input.trigger('update');
  9955. *
  9956. * @param {object} $input
  9957. */
  9958. var autoGrow = function autoGrow($input) {
  9959. var currentWidth = null;
  9960. var update = function update(e, options) {
  9961. var value, keyCode, printable, placeholder, width;
  9962. var shift, character, selection;
  9963. e = e || window.event || {};
  9964. options = options || {};
  9965. if (e.metaKey || e.altKey) return;
  9966. if (!options.force && $input.data('grow') === false) return;
  9967. value = $input.val();
  9968. if (e.type && e.type.toLowerCase() === 'keydown') {
  9969. keyCode = e.keyCode;
  9970. printable = keyCode >= 97 && keyCode <= 122 || // a-z
  9971. keyCode >= 65 && keyCode <= 90 || // A-Z
  9972. keyCode >= 48 && keyCode <= 57 || // 0-9
  9973. keyCode === 32 // space
  9974. ;
  9975. if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
  9976. selection = getSelection($input[0]);
  9977. if (selection.length) {
  9978. value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
  9979. } else if (keyCode === KEY_BACKSPACE && selection.start) {
  9980. value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
  9981. } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
  9982. value = value.substring(0, selection.start) + value.substring(selection.start + 1);
  9983. }
  9984. } else if (printable) {
  9985. shift = e.shiftKey;
  9986. character = String.fromCharCode(e.keyCode);
  9987. if (shift) character = character.toUpperCase();else character = character.toLowerCase();
  9988. value += character;
  9989. }
  9990. }
  9991. placeholder = $input.attr('placeholder');
  9992. if (!value && placeholder) {
  9993. value = placeholder;
  9994. }
  9995. width = measureString(value, $input) + 4;
  9996. if (width !== currentWidth) {
  9997. currentWidth = width;
  9998. $input.width(width);
  9999. $input.triggerHandler('resize');
  10000. }
  10001. };
  10002. $input.on('keydown keyup update blur', update);
  10003. update();
  10004. };
  10005. var domToString = function domToString(d) {
  10006. var tmp = document.createElement('div');
  10007. tmp.appendChild(d.cloneNode(true));
  10008. return tmp.innerHTML;
  10009. };
  10010. var logError = function logError(message, options) {
  10011. if (!options) options = {};
  10012. var component = "Selectize";
  10013. console.error(component + ": " + message);
  10014. if (options.explanation) {
  10015. // console.group is undefined in <IE11
  10016. if (console.group) console.group();
  10017. console.error(options.explanation);
  10018. if (console.group) console.groupEnd();
  10019. }
  10020. };
  10021. var Selectize = function Selectize($input, settings) {
  10022. var key,
  10023. i,
  10024. n,
  10025. dir,
  10026. input,
  10027. self = this;
  10028. input = $input[0];
  10029. input.selectize = self;
  10030. // detect rtl environment
  10031. var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
  10032. dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
  10033. dir = dir || $input.parents('[dir]:first').attr('dir') || '';
  10034. // setup default state
  10035. $.extend(self, {
  10036. order: 0,
  10037. settings: settings,
  10038. $input: $input,
  10039. tabIndex: $input.attr('tabindex') || '',
  10040. tagType: input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
  10041. rtl: /rtl/i.test(dir),
  10042. eventNS: '.selectize' + ++Selectize.count,
  10043. highlightedValue: null,
  10044. isOpen: false,
  10045. isDisabled: false,
  10046. isRequired: $input.is('[required]'),
  10047. isInvalid: false,
  10048. isLocked: false,
  10049. isFocused: false,
  10050. isInputHidden: false,
  10051. isSetup: false,
  10052. isShiftDown: false,
  10053. isCmdDown: false,
  10054. isCtrlDown: false,
  10055. ignoreFocus: false,
  10056. ignoreBlur: false,
  10057. ignoreHover: false,
  10058. hasOptions: false,
  10059. currentResults: null,
  10060. lastValue: '',
  10061. caretPos: 0,
  10062. loading: 0,
  10063. loadedSearches: {},
  10064. $activeOption: null,
  10065. $activeItems: [],
  10066. optgroups: {},
  10067. options: {},
  10068. userOptions: {},
  10069. items: [],
  10070. renderCache: {},
  10071. onSearchChange: settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
  10072. });
  10073. // search system
  10074. self.sifter = new Sifter(this.options, { diacritics: settings.diacritics });
  10075. // build options table
  10076. if (self.settings.options) {
  10077. for (i = 0, n = self.settings.options.length; i < n; i++) {
  10078. self.registerOption(self.settings.options[i]);
  10079. }
  10080. delete self.settings.options;
  10081. }
  10082. // build optgroup table
  10083. if (self.settings.optgroups) {
  10084. for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
  10085. self.registerOptionGroup(self.settings.optgroups[i]);
  10086. }
  10087. delete self.settings.optgroups;
  10088. }
  10089. // option-dependent defaults
  10090. self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
  10091. if (typeof self.settings.hideSelected !== 'boolean') {
  10092. self.settings.hideSelected = self.settings.mode === 'multi';
  10093. }
  10094. self.initializePlugins(self.settings.plugins);
  10095. self.setupCallbacks();
  10096. self.setupTemplates();
  10097. self.setup();
  10098. };
  10099. // mixins
  10100. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10101. MicroEvent.mixin(Selectize);
  10102. if (typeof MicroPlugin !== "undefined") {
  10103. MicroPlugin.mixin(Selectize);
  10104. } else {
  10105. 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." });
  10106. }
  10107. // methods
  10108. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10109. $.extend(Selectize.prototype, {
  10110. /**
  10111. * Creates all elements and sets up event bindings.
  10112. */
  10113. setup: function setup() {
  10114. var self = this;
  10115. var settings = self.settings;
  10116. var eventNS = self.eventNS;
  10117. var $window = $(window);
  10118. var $document = $(document);
  10119. var $input = self.$input;
  10120. var $wrapper;
  10121. var $control;
  10122. var $control_input;
  10123. var $dropdown;
  10124. var $dropdown_content;
  10125. var $dropdown_parent;
  10126. var inputMode;
  10127. var timeout_blur;
  10128. var timeout_focus;
  10129. var classes;
  10130. var classes_plugins;
  10131. var inputId;
  10132. inputMode = self.settings.mode;
  10133. classes = $input.attr('class') || '';
  10134. $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(inputMode);
  10135. $control = $('<div>').addClass(settings.inputClass + ' ' + classes).addClass('items').appendTo($wrapper);
  10136. $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
  10137. $dropdown_parent = $(settings.dropdownParent || $wrapper);
  10138. $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
  10139. $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
  10140. if (inputId = $input.attr('id')) {
  10141. $control_input.attr('id', inputId + '-selectized');
  10142. $("label[for='" + inputId + "']").attr('for', inputId + '-selectized');
  10143. }
  10144. if (self.settings.copyClassesToDropdown) {
  10145. $dropdown.addClass(classes);
  10146. }
  10147. $wrapper.css({
  10148. width: $input[0].style.width
  10149. });
  10150. if (self.plugins.names.length) {
  10151. classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
  10152. $wrapper.addClass(classes_plugins);
  10153. $dropdown.addClass(classes_plugins);
  10154. }
  10155. if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
  10156. $input.attr('multiple', 'multiple');
  10157. }
  10158. if (self.settings.placeholder) {
  10159. $control_input.attr('placeholder', settings.placeholder);
  10160. }
  10161. // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
  10162. if (!self.settings.splitOn && self.settings.delimiter) {
  10163. var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  10164. self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
  10165. }
  10166. if ($input.attr('autocorrect')) {
  10167. $control_input.attr('autocorrect', $input.attr('autocorrect'));
  10168. }
  10169. if ($input.attr('autocapitalize')) {
  10170. $control_input.attr('autocapitalize', $input.attr('autocapitalize'));
  10171. }
  10172. self.$wrapper = $wrapper;
  10173. self.$control = $control;
  10174. self.$control_input = $control_input;
  10175. self.$dropdown = $dropdown;
  10176. self.$dropdown_content = $dropdown_content;
  10177. $dropdown.on('mouseenter', '[data-selectable]', function () {
  10178. return self.onOptionHover.apply(self, arguments);
  10179. });
  10180. $dropdown.on('mousedown click', '[data-selectable]', function () {
  10181. return self.onOptionSelect.apply(self, arguments);
  10182. });
  10183. watchChildEvent($control, 'mousedown', '*:not(input)', function () {
  10184. return self.onItemSelect.apply(self, arguments);
  10185. });
  10186. autoGrow($control_input);
  10187. $control.on({
  10188. mousedown: function mousedown() {
  10189. return self.onMouseDown.apply(self, arguments);
  10190. },
  10191. click: function click() {
  10192. return self.onClick.apply(self, arguments);
  10193. }
  10194. });
  10195. $control_input.on({
  10196. mousedown: function mousedown(e) {
  10197. e.stopPropagation();
  10198. },
  10199. keydown: function keydown() {
  10200. return self.onKeyDown.apply(self, arguments);
  10201. },
  10202. keyup: function keyup() {
  10203. return self.onKeyUp.apply(self, arguments);
  10204. },
  10205. keypress: function keypress() {
  10206. return self.onKeyPress.apply(self, arguments);
  10207. },
  10208. resize: function resize() {
  10209. self.positionDropdown.apply(self, []);
  10210. },
  10211. blur: function blur() {
  10212. return self.onBlur.apply(self, arguments);
  10213. },
  10214. focus: function focus() {
  10215. self.ignoreBlur = false;return self.onFocus.apply(self, arguments);
  10216. },
  10217. paste: function paste() {
  10218. return self.onPaste.apply(self, arguments);
  10219. }
  10220. });
  10221. $document.on('keydown' + eventNS, function (e) {
  10222. self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
  10223. self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
  10224. self.isShiftDown = e.shiftKey;
  10225. });
  10226. $document.on('keyup' + eventNS, function (e) {
  10227. if (e.keyCode === KEY_CTRL) self.isCtrlDown = false;
  10228. if (e.keyCode === KEY_SHIFT) self.isShiftDown = false;
  10229. if (e.keyCode === KEY_CMD) self.isCmdDown = false;
  10230. });
  10231. $document.on('mousedown' + eventNS, function (e) {
  10232. if (self.isFocused) {
  10233. // prevent events on the dropdown scrollbar from causing the control to blur
  10234. if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
  10235. return false;
  10236. }
  10237. // blur on click outside
  10238. if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
  10239. self.blur(e.target);
  10240. }
  10241. }
  10242. });
  10243. $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function () {
  10244. if (self.isOpen) {
  10245. self.positionDropdown.apply(self, arguments);
  10246. }
  10247. });
  10248. $window.on('mousemove' + eventNS, function () {
  10249. self.ignoreHover = false;
  10250. });
  10251. // store original children and tab index so that they can be
  10252. // restored when the destroy() method is called.
  10253. this.revertSettings = {
  10254. $children: $input.children().detach(),
  10255. tabindex: $input.attr('tabindex')
  10256. };
  10257. $input.attr('tabindex', -1).hide().after(self.$wrapper);
  10258. if ($.isArray(settings.items)) {
  10259. self.setValue(settings.items);
  10260. delete settings.items;
  10261. }
  10262. // feature detect for the validation API
  10263. if (SUPPORTS_VALIDITY_API) {
  10264. $input.on('invalid' + eventNS, function (e) {
  10265. e.preventDefault();
  10266. self.isInvalid = true;
  10267. self.refreshState();
  10268. });
  10269. }
  10270. self.updateOriginalInput();
  10271. self.refreshItems();
  10272. self.refreshState();
  10273. self.updatePlaceholder();
  10274. self.isSetup = true;
  10275. if ($input.is(':disabled')) {
  10276. self.disable();
  10277. }
  10278. self.on('change', this.onChange);
  10279. $input.data('selectize', self);
  10280. $input.addClass('selectized');
  10281. self.trigger('initialize');
  10282. // preload options
  10283. if (settings.preload === true) {
  10284. self.onSearchChange('');
  10285. }
  10286. },
  10287. /**
  10288. * Sets up default rendering functions.
  10289. */
  10290. setupTemplates: function setupTemplates() {
  10291. var self = this;
  10292. var field_label = self.settings.labelField;
  10293. var field_optgroup = self.settings.optgroupLabelField;
  10294. var templates = {
  10295. 'optgroup': function optgroup(data) {
  10296. return '<div class="optgroup">' + data.html + '</div>';
  10297. },
  10298. 'optgroup_header': function optgroup_header(data, escape) {
  10299. return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
  10300. },
  10301. 'option': function option(data, escape) {
  10302. return '<div class="option">' + escape(data[field_label]) + '</div>';
  10303. },
  10304. 'item': function item(data, escape) {
  10305. return '<div class="item">' + escape(data[field_label]) + '</div>';
  10306. },
  10307. 'option_create': function option_create(data, escape) {
  10308. return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
  10309. }
  10310. };
  10311. self.settings.render = $.extend({}, templates, self.settings.render);
  10312. },
  10313. /**
  10314. * Maps fired events to callbacks provided
  10315. * in the settings used when creating the control.
  10316. */
  10317. setupCallbacks: function setupCallbacks() {
  10318. var key,
  10319. fn,
  10320. callbacks = {
  10321. 'initialize': 'onInitialize',
  10322. 'change': 'onChange',
  10323. 'item_add': 'onItemAdd',
  10324. 'item_remove': 'onItemRemove',
  10325. 'clear': 'onClear',
  10326. 'option_add': 'onOptionAdd',
  10327. 'option_remove': 'onOptionRemove',
  10328. 'option_clear': 'onOptionClear',
  10329. 'optgroup_add': 'onOptionGroupAdd',
  10330. 'optgroup_remove': 'onOptionGroupRemove',
  10331. 'optgroup_clear': 'onOptionGroupClear',
  10332. 'dropdown_open': 'onDropdownOpen',
  10333. 'dropdown_close': 'onDropdownClose',
  10334. 'type': 'onType',
  10335. 'load': 'onLoad',
  10336. 'focus': 'onFocus',
  10337. 'blur': 'onBlur'
  10338. };
  10339. for (key in callbacks) {
  10340. if (callbacks.hasOwnProperty(key)) {
  10341. fn = this.settings[callbacks[key]];
  10342. if (fn) this.on(key, fn);
  10343. }
  10344. }
  10345. },
  10346. /**
  10347. * Triggered when the main control element
  10348. * has a click event.
  10349. *
  10350. * @param {object} e
  10351. * @return {boolean}
  10352. */
  10353. onClick: function onClick(e) {
  10354. var self = this;
  10355. // necessary for mobile webkit devices (manual focus triggering
  10356. // is ignored unless invoked within a click event)
  10357. if (!self.isFocused) {
  10358. self.focus();
  10359. e.preventDefault();
  10360. }
  10361. },
  10362. /**
  10363. * Triggered when the main control element
  10364. * has a mouse down event.
  10365. *
  10366. * @param {object} e
  10367. * @return {boolean}
  10368. */
  10369. onMouseDown: function onMouseDown(e) {
  10370. var self = this;
  10371. var defaultPrevented = e.isDefaultPrevented();
  10372. var $target = $(e.target);
  10373. if (self.isFocused) {
  10374. // retain focus by preventing native handling. if the
  10375. // event target is the input it should not be modified.
  10376. // otherwise, text selection within the input won't work.
  10377. if (e.target !== self.$control_input[0]) {
  10378. if (self.settings.mode === 'single') {
  10379. // toggle dropdown
  10380. self.isOpen ? self.close() : self.open();
  10381. } else if (!defaultPrevented) {
  10382. self.setActiveItem(null);
  10383. }
  10384. return false;
  10385. }
  10386. } else {
  10387. // give control focus
  10388. if (!defaultPrevented) {
  10389. window.setTimeout(function () {
  10390. self.focus();
  10391. }, 0);
  10392. }
  10393. }
  10394. },
  10395. /**
  10396. * Triggered when the value of the control has been changed.
  10397. * This should propagate the event to the original DOM
  10398. * input / select element.
  10399. */
  10400. onChange: function onChange() {
  10401. this.$input.trigger('change');
  10402. },
  10403. /**
  10404. * Triggered on <input> paste.
  10405. *
  10406. * @param {object} e
  10407. * @returns {boolean}
  10408. */
  10409. onPaste: function onPaste(e) {
  10410. var self = this;
  10411. if (self.isFull() || self.isInputHidden || self.isLocked) {
  10412. e.preventDefault();
  10413. return;
  10414. }
  10415. // If a regex or string is included, this will split the pasted
  10416. // input and create Items for each separate value
  10417. if (self.settings.splitOn) {
  10418. // Wait for pasted text to be recognized in value
  10419. setTimeout(function () {
  10420. var pastedText = self.$control_input.val();
  10421. if (!pastedText.match(self.settings.splitOn)) {
  10422. return;
  10423. }
  10424. var splitInput = $.trim(pastedText).split(self.settings.splitOn);
  10425. for (var i = 0, n = splitInput.length; i < n; i++) {
  10426. self.createItem(splitInput[i]);
  10427. }
  10428. }, 0);
  10429. }
  10430. },
  10431. /**
  10432. * Triggered on <input> keypress.
  10433. *
  10434. * @param {object} e
  10435. * @returns {boolean}
  10436. */
  10437. onKeyPress: function onKeyPress(e) {
  10438. if (this.isLocked) return e && e.preventDefault();
  10439. var character = String.fromCharCode(e.keyCode || e.which);
  10440. if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
  10441. this.createItem();
  10442. e.preventDefault();
  10443. return false;
  10444. }
  10445. },
  10446. /**
  10447. * Triggered on <input> keydown.
  10448. *
  10449. * @param {object} e
  10450. * @returns {boolean}
  10451. */
  10452. onKeyDown: function onKeyDown(e) {
  10453. var isInput = e.target === this.$control_input[0];
  10454. var self = this;
  10455. if (self.isLocked) {
  10456. if (e.keyCode !== KEY_TAB) {
  10457. e.preventDefault();
  10458. }
  10459. return;
  10460. }
  10461. switch (e.keyCode) {
  10462. case KEY_A:
  10463. if (self.isCmdDown) {
  10464. self.selectAll();
  10465. return;
  10466. }
  10467. break;
  10468. case KEY_ESC:
  10469. if (self.isOpen) {
  10470. e.preventDefault();
  10471. e.stopPropagation();
  10472. self.close();
  10473. }
  10474. return;
  10475. case KEY_N:
  10476. if (!e.ctrlKey || e.altKey) break;
  10477. case KEY_DOWN:
  10478. if (!self.isOpen && self.hasOptions) {
  10479. self.open();
  10480. } else if (self.$activeOption) {
  10481. self.ignoreHover = true;
  10482. var $next = self.getAdjacentOption(self.$activeOption, 1);
  10483. if ($next.length) self.setActiveOption($next, true, true);
  10484. }
  10485. e.preventDefault();
  10486. return;
  10487. case KEY_P:
  10488. if (!e.ctrlKey || e.altKey) break;
  10489. case KEY_UP:
  10490. if (self.$activeOption) {
  10491. self.ignoreHover = true;
  10492. var $prev = self.getAdjacentOption(self.$activeOption, -1);
  10493. if ($prev.length) self.setActiveOption($prev, true, true);
  10494. }
  10495. e.preventDefault();
  10496. return;
  10497. case KEY_RETURN:
  10498. if (self.isOpen && self.$activeOption) {
  10499. self.onOptionSelect({ currentTarget: self.$activeOption });
  10500. e.preventDefault();
  10501. }
  10502. return;
  10503. case KEY_LEFT:
  10504. self.advanceSelection(-1, e);
  10505. return;
  10506. case KEY_RIGHT:
  10507. self.advanceSelection(1, e);
  10508. return;
  10509. case KEY_TAB:
  10510. if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
  10511. self.onOptionSelect({ currentTarget: self.$activeOption });
  10512. // Default behaviour is to jump to the next field, we only want this
  10513. // if the current field doesn't accept any more entries
  10514. if (!self.isFull()) {
  10515. e.preventDefault();
  10516. }
  10517. }
  10518. if (self.settings.create && self.createItem()) {
  10519. e.preventDefault();
  10520. }
  10521. return;
  10522. case KEY_BACKSPACE:
  10523. case KEY_DELETE:
  10524. self.deleteSelection(e);
  10525. return;
  10526. }
  10527. if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
  10528. e.preventDefault();
  10529. return;
  10530. }
  10531. },
  10532. /**
  10533. * Triggered on <input> keyup.
  10534. *
  10535. * @param {object} e
  10536. * @returns {boolean}
  10537. */
  10538. onKeyUp: function onKeyUp(e) {
  10539. var self = this;
  10540. if (self.isLocked) return e && e.preventDefault();
  10541. var value = self.$control_input.val() || '';
  10542. if (self.lastValue !== value) {
  10543. self.lastValue = value;
  10544. self.onSearchChange(value);
  10545. self.refreshOptions();
  10546. self.trigger('type', value);
  10547. }
  10548. },
  10549. /**
  10550. * Invokes the user-provide option provider / loader.
  10551. *
  10552. * Note: this function is debounced in the Selectize
  10553. * constructor (by `settings.loadThrottle` milliseconds)
  10554. *
  10555. * @param {string} value
  10556. */
  10557. onSearchChange: function onSearchChange(value) {
  10558. var self = this;
  10559. var fn = self.settings.load;
  10560. if (!fn) return;
  10561. if (self.loadedSearches.hasOwnProperty(value)) return;
  10562. self.loadedSearches[value] = true;
  10563. self.load(function (callback) {
  10564. fn.apply(self, [value, callback]);
  10565. });
  10566. },
  10567. /**
  10568. * Triggered on <input> focus.
  10569. *
  10570. * @param {object} e (optional)
  10571. * @returns {boolean}
  10572. */
  10573. onFocus: function onFocus(e) {
  10574. var self = this;
  10575. var wasFocused = self.isFocused;
  10576. if (self.isDisabled) {
  10577. self.blur();
  10578. e && e.preventDefault();
  10579. return false;
  10580. }
  10581. if (self.ignoreFocus) return;
  10582. self.isFocused = true;
  10583. if (self.settings.preload === 'focus') self.onSearchChange('');
  10584. if (!wasFocused) self.trigger('focus');
  10585. if (!self.$activeItems.length) {
  10586. self.showInput();
  10587. self.setActiveItem(null);
  10588. self.refreshOptions(!!self.settings.openOnFocus);
  10589. }
  10590. self.refreshState();
  10591. },
  10592. /**
  10593. * Triggered on <input> blur.
  10594. *
  10595. * @param {object} e
  10596. * @param {Element} dest
  10597. */
  10598. onBlur: function onBlur(e, dest) {
  10599. var self = this;
  10600. if (!self.isFocused) return;
  10601. self.isFocused = false;
  10602. if (self.ignoreFocus) {
  10603. return;
  10604. } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
  10605. // necessary to prevent IE closing the dropdown when the scrollbar is clicked
  10606. self.ignoreBlur = true;
  10607. self.onFocus(e);
  10608. return;
  10609. }
  10610. var deactivate = function deactivate() {
  10611. self.close();
  10612. self.setTextboxValue('');
  10613. self.setActiveItem(null);
  10614. self.setActiveOption(null);
  10615. self.setCaret(self.items.length);
  10616. self.refreshState();
  10617. // IE11 bug: element still marked as active
  10618. dest && dest.focus && dest.focus();
  10619. self.ignoreFocus = false;
  10620. self.trigger('blur');
  10621. };
  10622. self.ignoreFocus = true;
  10623. if (self.settings.create && self.settings.createOnBlur) {
  10624. self.createItem(null, false, deactivate);
  10625. } else {
  10626. deactivate();
  10627. }
  10628. },
  10629. /**
  10630. * Triggered when the user rolls over
  10631. * an option in the autocomplete dropdown menu.
  10632. *
  10633. * @param {object} e
  10634. * @returns {boolean}
  10635. */
  10636. onOptionHover: function onOptionHover(e) {
  10637. if (this.ignoreHover) return;
  10638. this.setActiveOption(e.currentTarget, false);
  10639. },
  10640. /**
  10641. * Triggered when the user clicks on an option
  10642. * in the autocomplete dropdown menu.
  10643. *
  10644. * @param {object} e
  10645. * @returns {boolean}
  10646. */
  10647. onOptionSelect: function onOptionSelect(e) {
  10648. var value,
  10649. $target,
  10650. $option,
  10651. self = this;
  10652. if (e.preventDefault) {
  10653. e.preventDefault();
  10654. e.stopPropagation();
  10655. }
  10656. $target = $(e.currentTarget);
  10657. if ($target.hasClass('create')) {
  10658. self.createItem(null, function () {
  10659. if (self.settings.closeAfterSelect) {
  10660. self.close();
  10661. }
  10662. });
  10663. } else {
  10664. value = $target.attr('data-value');
  10665. if (typeof value !== 'undefined') {
  10666. self.lastQuery = null;
  10667. self.setTextboxValue('');
  10668. self.addItem(value);
  10669. if (self.settings.closeAfterSelect) {
  10670. self.close();
  10671. } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
  10672. self.setActiveOption(self.getOption(value));
  10673. }
  10674. }
  10675. }
  10676. },
  10677. /**
  10678. * Triggered when the user clicks on an item
  10679. * that has been selected.
  10680. *
  10681. * @param {object} e
  10682. * @returns {boolean}
  10683. */
  10684. onItemSelect: function onItemSelect(e) {
  10685. var self = this;
  10686. if (self.isLocked) return;
  10687. if (self.settings.mode === 'multi') {
  10688. e.preventDefault();
  10689. self.setActiveItem(e.currentTarget, e);
  10690. }
  10691. },
  10692. /**
  10693. * Invokes the provided method that provides
  10694. * results to a callback---which are then added
  10695. * as options to the control.
  10696. *
  10697. * @param {function} fn
  10698. */
  10699. load: function load(fn) {
  10700. var self = this;
  10701. var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
  10702. self.loading++;
  10703. fn.apply(self, [function (results) {
  10704. self.loading = Math.max(self.loading - 1, 0);
  10705. if (results && results.length) {
  10706. self.addOption(results);
  10707. self.refreshOptions(self.isFocused && !self.isInputHidden);
  10708. }
  10709. if (!self.loading) {
  10710. $wrapper.removeClass(self.settings.loadingClass);
  10711. }
  10712. self.trigger('load', results);
  10713. }]);
  10714. },
  10715. /**
  10716. * Sets the input field of the control to the specified value.
  10717. *
  10718. * @param {string} value
  10719. */
  10720. setTextboxValue: function setTextboxValue(value) {
  10721. var $input = this.$control_input;
  10722. var changed = $input.val() !== value;
  10723. if (changed) {
  10724. $input.val(value).triggerHandler('update');
  10725. this.lastValue = value;
  10726. }
  10727. },
  10728. /**
  10729. * Returns the value of the control. If multiple items
  10730. * can be selected (e.g. <select multiple>), this returns
  10731. * an array. If only one item can be selected, this
  10732. * returns a string.
  10733. *
  10734. * @returns {mixed}
  10735. */
  10736. getValue: function getValue() {
  10737. if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
  10738. return this.items;
  10739. } else {
  10740. return this.items.join(this.settings.delimiter);
  10741. }
  10742. },
  10743. /**
  10744. * Resets the selected items to the given value.
  10745. *
  10746. * @param {mixed} value
  10747. */
  10748. setValue: function setValue(value, silent) {
  10749. var events = silent ? [] : ['change'];
  10750. debounce_events(this, events, function () {
  10751. this.clear(silent);
  10752. this.addItems(value, silent);
  10753. });
  10754. },
  10755. /**
  10756. * Sets the selected item.
  10757. *
  10758. * @param {object} $item
  10759. * @param {object} e (optional)
  10760. */
  10761. setActiveItem: function setActiveItem($item, e) {
  10762. var self = this;
  10763. var eventName;
  10764. var i, idx, begin, end, item, swap;
  10765. var $last;
  10766. if (self.settings.mode === 'single') return;
  10767. $item = $($item);
  10768. // clear the active selection
  10769. if (!$item.length) {
  10770. $(self.$activeItems).removeClass('active');
  10771. self.$activeItems = [];
  10772. if (self.isFocused) {
  10773. self.showInput();
  10774. }
  10775. return;
  10776. }
  10777. // modify selection
  10778. eventName = e && e.type.toLowerCase();
  10779. if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
  10780. $last = self.$control.children('.active:last');
  10781. begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
  10782. end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
  10783. if (begin > end) {
  10784. swap = begin;
  10785. begin = end;
  10786. end = swap;
  10787. }
  10788. for (i = begin; i <= end; i++) {
  10789. item = self.$control[0].childNodes[i];
  10790. if (self.$activeItems.indexOf(item) === -1) {
  10791. $(item).addClass('active');
  10792. self.$activeItems.push(item);
  10793. }
  10794. }
  10795. e.preventDefault();
  10796. } else if (eventName === 'mousedown' && self.isCtrlDown || eventName === 'keydown' && this.isShiftDown) {
  10797. if ($item.hasClass('active')) {
  10798. idx = self.$activeItems.indexOf($item[0]);
  10799. self.$activeItems.splice(idx, 1);
  10800. $item.removeClass('active');
  10801. } else {
  10802. self.$activeItems.push($item.addClass('active')[0]);
  10803. }
  10804. } else {
  10805. $(self.$activeItems).removeClass('active');
  10806. self.$activeItems = [$item.addClass('active')[0]];
  10807. }
  10808. // ensure control has focus
  10809. self.hideInput();
  10810. if (!this.isFocused) {
  10811. self.focus();
  10812. }
  10813. },
  10814. /**
  10815. * Sets the selected item in the dropdown menu
  10816. * of available options.
  10817. *
  10818. * @param {object} $object
  10819. * @param {boolean} scroll
  10820. * @param {boolean} animate
  10821. */
  10822. setActiveOption: function setActiveOption($option, scroll, animate) {
  10823. var height_menu, height_item, y;
  10824. var scroll_top, scroll_bottom;
  10825. var self = this;
  10826. if (self.$activeOption) self.$activeOption.removeClass('active');
  10827. self.$activeOption = null;
  10828. $option = $($option);
  10829. if (!$option.length) return;
  10830. self.$activeOption = $option.addClass('active');
  10831. if (scroll || !isset(scroll)) {
  10832. height_menu = self.$dropdown_content.height();
  10833. height_item = self.$activeOption.outerHeight(true);
  10834. scroll = self.$dropdown_content.scrollTop() || 0;
  10835. y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
  10836. scroll_top = y;
  10837. scroll_bottom = y - height_menu + height_item;
  10838. if (y + height_item > height_menu + scroll) {
  10839. self.$dropdown_content.stop().animate({ scrollTop: scroll_bottom }, animate ? self.settings.scrollDuration : 0);
  10840. } else if (y < scroll) {
  10841. self.$dropdown_content.stop().animate({ scrollTop: scroll_top }, animate ? self.settings.scrollDuration : 0);
  10842. }
  10843. }
  10844. },
  10845. /**
  10846. * Selects all items (CTRL + A).
  10847. */
  10848. selectAll: function selectAll() {
  10849. var self = this;
  10850. if (self.settings.mode === 'single') return;
  10851. self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
  10852. if (self.$activeItems.length) {
  10853. self.hideInput();
  10854. self.close();
  10855. }
  10856. self.focus();
  10857. },
  10858. /**
  10859. * Hides the input element out of view, while
  10860. * retaining its focus.
  10861. */
  10862. hideInput: function hideInput() {
  10863. var self = this;
  10864. self.setTextboxValue('');
  10865. self.$control_input.css({ opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000 });
  10866. self.isInputHidden = true;
  10867. },
  10868. /**
  10869. * Restores input visibility.
  10870. */
  10871. showInput: function showInput() {
  10872. this.$control_input.css({ opacity: 1, position: 'relative', left: 0 });
  10873. this.isInputHidden = false;
  10874. },
  10875. /**
  10876. * Gives the control focus.
  10877. */
  10878. focus: function focus() {
  10879. var self = this;
  10880. if (self.isDisabled) return;
  10881. self.ignoreFocus = true;
  10882. self.$control_input[0].focus();
  10883. window.setTimeout(function () {
  10884. self.ignoreFocus = false;
  10885. self.onFocus();
  10886. }, 0);
  10887. },
  10888. /**
  10889. * Forces the control out of focus.
  10890. *
  10891. * @param {Element} dest
  10892. */
  10893. blur: function blur(dest) {
  10894. this.$control_input[0].blur();
  10895. this.onBlur(null, dest);
  10896. },
  10897. /**
  10898. * Returns a function that scores an object
  10899. * to show how good of a match it is to the
  10900. * provided query.
  10901. *
  10902. * @param {string} query
  10903. * @param {object} options
  10904. * @return {function}
  10905. */
  10906. getScoreFunction: function getScoreFunction(query) {
  10907. return this.sifter.getScoreFunction(query, this.getSearchOptions());
  10908. },
  10909. /**
  10910. * Returns search options for sifter (the system
  10911. * for scoring and sorting results).
  10912. *
  10913. * @see https://github.com/brianreavis/sifter.js
  10914. * @return {object}
  10915. */
  10916. getSearchOptions: function getSearchOptions() {
  10917. var settings = this.settings;
  10918. var sort = settings.sortField;
  10919. if (typeof sort === 'string') {
  10920. sort = [{ field: sort }];
  10921. }
  10922. return {
  10923. fields: settings.searchField,
  10924. conjunction: settings.searchConjunction,
  10925. sort: sort
  10926. };
  10927. },
  10928. /**
  10929. * Searches through available options and returns
  10930. * a sorted array of matches.
  10931. *
  10932. * Returns an object containing:
  10933. *
  10934. * - query {string}
  10935. * - tokens {array}
  10936. * - total {int}
  10937. * - items {array}
  10938. *
  10939. * @param {string} query
  10940. * @returns {object}
  10941. */
  10942. search: function search(query) {
  10943. var i, value, score, result, calculateScore;
  10944. var self = this;
  10945. var settings = self.settings;
  10946. var options = this.getSearchOptions();
  10947. // validate user-provided result scoring function
  10948. if (settings.score) {
  10949. calculateScore = self.settings.score.apply(this, [query]);
  10950. if (typeof calculateScore !== 'function') {
  10951. throw new Error('Selectize "score" setting must be a function that returns a function');
  10952. }
  10953. }
  10954. // perform search
  10955. if (query !== self.lastQuery) {
  10956. self.lastQuery = query;
  10957. result = self.sifter.search(query, $.extend(options, { score: calculateScore }));
  10958. self.currentResults = result;
  10959. } else {
  10960. result = $.extend(true, {}, self.currentResults);
  10961. }
  10962. // filter out selected items
  10963. if (settings.hideSelected) {
  10964. for (i = result.items.length - 1; i >= 0; i--) {
  10965. if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
  10966. result.items.splice(i, 1);
  10967. }
  10968. }
  10969. }
  10970. return result;
  10971. },
  10972. /**
  10973. * Refreshes the list of available options shown
  10974. * in the autocomplete dropdown menu.
  10975. *
  10976. * @param {boolean} triggerDropdown
  10977. */
  10978. refreshOptions: function refreshOptions(triggerDropdown) {
  10979. var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
  10980. var $active, $active_before, $create;
  10981. if (typeof triggerDropdown === 'undefined') {
  10982. triggerDropdown = true;
  10983. }
  10984. var self = this;
  10985. var query = $.trim(self.$control_input.val());
  10986. var results = self.search(query);
  10987. var $dropdown_content = self.$dropdown_content;
  10988. var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
  10989. // build markup
  10990. n = results.items.length;
  10991. if (typeof self.settings.maxOptions === 'number') {
  10992. n = Math.min(n, self.settings.maxOptions);
  10993. }
  10994. // render and group available options individually
  10995. groups = {};
  10996. groups_order = [];
  10997. for (i = 0; i < n; i++) {
  10998. option = self.options[results.items[i].id];
  10999. option_html = self.render('option', option);
  11000. optgroup = option[self.settings.optgroupField] || '';
  11001. optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
  11002. for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
  11003. optgroup = optgroups[j];
  11004. if (!self.optgroups.hasOwnProperty(optgroup)) {
  11005. optgroup = '';
  11006. }
  11007. if (!groups.hasOwnProperty(optgroup)) {
  11008. groups[optgroup] = document.createDocumentFragment();
  11009. groups_order.push(optgroup);
  11010. }
  11011. groups[optgroup].appendChild(option_html);
  11012. }
  11013. }
  11014. // sort optgroups
  11015. if (this.settings.lockOptgroupOrder) {
  11016. groups_order.sort(function (a, b) {
  11017. var a_order = self.optgroups[a].$order || 0;
  11018. var b_order = self.optgroups[b].$order || 0;
  11019. return a_order - b_order;
  11020. });
  11021. }
  11022. // render optgroup headers & join groups
  11023. html = document.createDocumentFragment();
  11024. for (i = 0, n = groups_order.length; i < n; i++) {
  11025. optgroup = groups_order[i];
  11026. if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
  11027. // render the optgroup header and options within it,
  11028. // then pass it to the wrapper template
  11029. html_children = document.createDocumentFragment();
  11030. html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
  11031. html_children.appendChild(groups[optgroup]);
  11032. html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
  11033. html: domToString(html_children),
  11034. dom: html_children
  11035. })));
  11036. } else {
  11037. html.appendChild(groups[optgroup]);
  11038. }
  11039. }
  11040. $dropdown_content.html(html);
  11041. // highlight matching terms inline
  11042. if (self.settings.highlight && results.query.length && results.tokens.length) {
  11043. $dropdown_content.removeHighlight();
  11044. for (i = 0, n = results.tokens.length; i < n; i++) {
  11045. highlight($dropdown_content, results.tokens[i].regex);
  11046. }
  11047. }
  11048. // add "selected" class to selected options
  11049. if (!self.settings.hideSelected) {
  11050. for (i = 0, n = self.items.length; i < n; i++) {
  11051. self.getOption(self.items[i]).addClass('selected');
  11052. }
  11053. }
  11054. // add create option
  11055. has_create_option = self.canCreate(query);
  11056. if (has_create_option) {
  11057. $dropdown_content.prepend(self.render('option_create', { input: query }));
  11058. $create = $($dropdown_content[0].childNodes[0]);
  11059. }
  11060. // activate
  11061. self.hasOptions = results.items.length > 0 || has_create_option;
  11062. if (self.hasOptions) {
  11063. if (results.items.length > 0) {
  11064. $active_before = active_before && self.getOption(active_before);
  11065. if ($active_before && $active_before.length) {
  11066. $active = $active_before;
  11067. } else if (self.settings.mode === 'single' && self.items.length) {
  11068. $active = self.getOption(self.items[0]);
  11069. }
  11070. if (!$active || !$active.length) {
  11071. if ($create && !self.settings.addPrecedence) {
  11072. $active = self.getAdjacentOption($create, 1);
  11073. } else {
  11074. $active = $dropdown_content.find('[data-selectable]:first');
  11075. }
  11076. }
  11077. } else {
  11078. $active = $create;
  11079. }
  11080. self.setActiveOption($active);
  11081. if (triggerDropdown && !self.isOpen) {
  11082. self.open();
  11083. }
  11084. } else {
  11085. self.setActiveOption(null);
  11086. if (triggerDropdown && self.isOpen) {
  11087. self.close();
  11088. }
  11089. }
  11090. },
  11091. /**
  11092. * Adds an available option. If it already exists,
  11093. * nothing will happen. Note: this does not refresh
  11094. * the options list dropdown (use `refreshOptions`
  11095. * for that).
  11096. *
  11097. * Usage:
  11098. *
  11099. * this.addOption(data)
  11100. *
  11101. * @param {object|array} data
  11102. */
  11103. addOption: function addOption(data) {
  11104. var i,
  11105. n,
  11106. value,
  11107. self = this;
  11108. if ($.isArray(data)) {
  11109. for (i = 0, n = data.length; i < n; i++) {
  11110. self.addOption(data[i]);
  11111. }
  11112. return;
  11113. }
  11114. if (value = self.registerOption(data)) {
  11115. self.userOptions[value] = true;
  11116. self.lastQuery = null;
  11117. self.trigger('option_add', value, data);
  11118. }
  11119. },
  11120. /**
  11121. * Registers an option to the pool of options.
  11122. *
  11123. * @param {object} data
  11124. * @return {boolean|string}
  11125. */
  11126. registerOption: function registerOption(data) {
  11127. var key = hash_key(data[this.settings.valueField]);
  11128. if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
  11129. data.$order = data.$order || ++this.order;
  11130. this.options[key] = data;
  11131. return key;
  11132. },
  11133. /**
  11134. * Registers an option group to the pool of option groups.
  11135. *
  11136. * @param {object} data
  11137. * @return {boolean|string}
  11138. */
  11139. registerOptionGroup: function registerOptionGroup(data) {
  11140. var key = hash_key(data[this.settings.optgroupValueField]);
  11141. if (!key) return false;
  11142. data.$order = data.$order || ++this.order;
  11143. this.optgroups[key] = data;
  11144. return key;
  11145. },
  11146. /**
  11147. * Registers a new optgroup for options
  11148. * to be bucketed into.
  11149. *
  11150. * @param {string} id
  11151. * @param {object} data
  11152. */
  11153. addOptionGroup: function addOptionGroup(id, data) {
  11154. data[this.settings.optgroupValueField] = id;
  11155. if (id = this.registerOptionGroup(data)) {
  11156. this.trigger('optgroup_add', id, data);
  11157. }
  11158. },
  11159. /**
  11160. * Removes an existing option group.
  11161. *
  11162. * @param {string} id
  11163. */
  11164. removeOptionGroup: function removeOptionGroup(id) {
  11165. if (this.optgroups.hasOwnProperty(id)) {
  11166. delete this.optgroups[id];
  11167. this.renderCache = {};
  11168. this.trigger('optgroup_remove', id);
  11169. }
  11170. },
  11171. /**
  11172. * Clears all existing option groups.
  11173. */
  11174. clearOptionGroups: function clearOptionGroups() {
  11175. this.optgroups = {};
  11176. this.renderCache = {};
  11177. this.trigger('optgroup_clear');
  11178. },
  11179. /**
  11180. * Updates an option available for selection. If
  11181. * it is visible in the selected items or options
  11182. * dropdown, it will be re-rendered automatically.
  11183. *
  11184. * @param {string} value
  11185. * @param {object} data
  11186. */
  11187. updateOption: function updateOption(value, data) {
  11188. var self = this;
  11189. var $item, $item_new;
  11190. var value_new, index_item, cache_items, cache_options, order_old;
  11191. value = hash_key(value);
  11192. value_new = hash_key(data[self.settings.valueField]);
  11193. // sanity checks
  11194. if (value === null) return;
  11195. if (!self.options.hasOwnProperty(value)) return;
  11196. if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
  11197. order_old = self.options[value].$order;
  11198. // update references
  11199. if (value_new !== value) {
  11200. delete self.options[value];
  11201. index_item = self.items.indexOf(value);
  11202. if (index_item !== -1) {
  11203. self.items.splice(index_item, 1, value_new);
  11204. }
  11205. }
  11206. data.$order = data.$order || order_old;
  11207. self.options[value_new] = data;
  11208. // invalidate render cache
  11209. cache_items = self.renderCache['item'];
  11210. cache_options = self.renderCache['option'];
  11211. if (cache_items) {
  11212. delete cache_items[value];
  11213. delete cache_items[value_new];
  11214. }
  11215. if (cache_options) {
  11216. delete cache_options[value];
  11217. delete cache_options[value_new];
  11218. }
  11219. // update the item if it's selected
  11220. if (self.items.indexOf(value_new) !== -1) {
  11221. $item = self.getItem(value);
  11222. $item_new = $(self.render('item', data));
  11223. if ($item.hasClass('active')) $item_new.addClass('active');
  11224. $item.replaceWith($item_new);
  11225. }
  11226. // invalidate last query because we might have updated the sortField
  11227. self.lastQuery = null;
  11228. // update dropdown contents
  11229. if (self.isOpen) {
  11230. self.refreshOptions(false);
  11231. }
  11232. },
  11233. /**
  11234. * Removes a single option.
  11235. *
  11236. * @param {string} value
  11237. * @param {boolean} silent
  11238. */
  11239. removeOption: function removeOption(value, silent) {
  11240. var self = this;
  11241. value = hash_key(value);
  11242. var cache_items = self.renderCache['item'];
  11243. var cache_options = self.renderCache['option'];
  11244. if (cache_items) delete cache_items[value];
  11245. if (cache_options) delete cache_options[value];
  11246. delete self.userOptions[value];
  11247. delete self.options[value];
  11248. self.lastQuery = null;
  11249. self.trigger('option_remove', value);
  11250. self.removeItem(value, silent);
  11251. },
  11252. /**
  11253. * Clears all options.
  11254. */
  11255. clearOptions: function clearOptions() {
  11256. var self = this;
  11257. self.loadedSearches = {};
  11258. self.userOptions = {};
  11259. self.renderCache = {};
  11260. self.options = self.sifter.items = {};
  11261. self.lastQuery = null;
  11262. self.trigger('option_clear');
  11263. self.clear();
  11264. },
  11265. /**
  11266. * Returns the jQuery element of the option
  11267. * matching the given value.
  11268. *
  11269. * @param {string} value
  11270. * @returns {object}
  11271. */
  11272. getOption: function getOption(value) {
  11273. return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
  11274. },
  11275. /**
  11276. * Returns the jQuery element of the next or
  11277. * previous selectable option.
  11278. *
  11279. * @param {object} $option
  11280. * @param {int} direction can be 1 for next or -1 for previous
  11281. * @return {object}
  11282. */
  11283. getAdjacentOption: function getAdjacentOption($option, direction) {
  11284. var $options = this.$dropdown.find('[data-selectable]');
  11285. var index = $options.index($option) + direction;
  11286. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  11287. },
  11288. /**
  11289. * Finds the first element with a "data-value" attribute
  11290. * that matches the given value.
  11291. *
  11292. * @param {mixed} value
  11293. * @param {object} $els
  11294. * @return {object}
  11295. */
  11296. getElementWithValue: function getElementWithValue(value, $els) {
  11297. value = hash_key(value);
  11298. if (typeof value !== 'undefined' && value !== null) {
  11299. for (var i = 0, n = $els.length; i < n; i++) {
  11300. if ($els[i].getAttribute('data-value') === value) {
  11301. return $($els[i]);
  11302. }
  11303. }
  11304. }
  11305. return $();
  11306. },
  11307. /**
  11308. * Returns the jQuery element of the item
  11309. * matching the given value.
  11310. *
  11311. * @param {string} value
  11312. * @returns {object}
  11313. */
  11314. getItem: function getItem(value) {
  11315. return this.getElementWithValue(value, this.$control.children());
  11316. },
  11317. /**
  11318. * "Selects" multiple items at once. Adds them to the list
  11319. * at the current caret position.
  11320. *
  11321. * @param {string} value
  11322. * @param {boolean} silent
  11323. */
  11324. addItems: function addItems(values, silent) {
  11325. var items = $.isArray(values) ? values : [values];
  11326. for (var i = 0, n = items.length; i < n; i++) {
  11327. this.isPending = i < n - 1;
  11328. this.addItem(items[i], silent);
  11329. }
  11330. },
  11331. /**
  11332. * "Selects" an item. Adds it to the list
  11333. * at the current caret position.
  11334. *
  11335. * @param {string} value
  11336. * @param {boolean} silent
  11337. */
  11338. addItem: function addItem(value, silent) {
  11339. var events = silent ? [] : ['change'];
  11340. debounce_events(this, events, function () {
  11341. var $item, $option, $options;
  11342. var self = this;
  11343. var inputMode = self.settings.mode;
  11344. var i, active, value_next, wasFull;
  11345. value = hash_key(value);
  11346. if (self.items.indexOf(value) !== -1) {
  11347. if (inputMode === 'single') self.close();
  11348. return;
  11349. }
  11350. if (!self.options.hasOwnProperty(value)) return;
  11351. if (inputMode === 'single') self.clear(silent);
  11352. if (inputMode === 'multi' && self.isFull()) return;
  11353. $item = $(self.render('item', self.options[value]));
  11354. wasFull = self.isFull();
  11355. self.items.splice(self.caretPos, 0, value);
  11356. self.insertAtCaret($item);
  11357. if (!self.isPending || !wasFull && self.isFull()) {
  11358. self.refreshState();
  11359. }
  11360. if (self.isSetup) {
  11361. $options = self.$dropdown_content.find('[data-selectable]');
  11362. // update menu / remove the option (if this is not one item being added as part of series)
  11363. if (!self.isPending) {
  11364. $option = self.getOption(value);
  11365. value_next = self.getAdjacentOption($option, 1).attr('data-value');
  11366. self.refreshOptions(self.isFocused && inputMode !== 'single');
  11367. if (value_next) {
  11368. self.setActiveOption(self.getOption(value_next));
  11369. }
  11370. }
  11371. // hide the menu if the maximum number of items have been selected or no options are left
  11372. if (!$options.length || self.isFull()) {
  11373. self.close();
  11374. } else {
  11375. self.positionDropdown();
  11376. }
  11377. self.updatePlaceholder();
  11378. self.trigger('item_add', value, $item);
  11379. self.updateOriginalInput({ silent: silent });
  11380. }
  11381. });
  11382. },
  11383. /**
  11384. * Removes the selected item matching
  11385. * the provided value.
  11386. *
  11387. * @param {string} value
  11388. */
  11389. removeItem: function removeItem(value, silent) {
  11390. var self = this;
  11391. var $item, i, idx;
  11392. $item = value instanceof $ ? value : self.getItem(value);
  11393. value = hash_key($item.attr('data-value'));
  11394. i = self.items.indexOf(value);
  11395. if (i !== -1) {
  11396. $item.remove();
  11397. if ($item.hasClass('active')) {
  11398. idx = self.$activeItems.indexOf($item[0]);
  11399. self.$activeItems.splice(idx, 1);
  11400. }
  11401. self.items.splice(i, 1);
  11402. self.lastQuery = null;
  11403. if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
  11404. self.removeOption(value, silent);
  11405. }
  11406. if (i < self.caretPos) {
  11407. self.setCaret(self.caretPos - 1);
  11408. }
  11409. self.refreshState();
  11410. self.updatePlaceholder();
  11411. self.updateOriginalInput({ silent: silent });
  11412. self.positionDropdown();
  11413. self.trigger('item_remove', value, $item);
  11414. }
  11415. },
  11416. /**
  11417. * Invokes the `create` method provided in the
  11418. * selectize options that should provide the data
  11419. * for the new item, given the user input.
  11420. *
  11421. * Once this completes, it will be added
  11422. * to the item list.
  11423. *
  11424. * @param {string} value
  11425. * @param {boolean} [triggerDropdown]
  11426. * @param {function} [callback]
  11427. * @return {boolean}
  11428. */
  11429. createItem: function createItem(input, triggerDropdown) {
  11430. var self = this;
  11431. var caret = self.caretPos;
  11432. input = input || $.trim(self.$control_input.val() || '');
  11433. var callback = arguments[arguments.length - 1];
  11434. if (typeof callback !== 'function') callback = function callback() {};
  11435. if (typeof triggerDropdown !== 'boolean') {
  11436. triggerDropdown = true;
  11437. }
  11438. if (!self.canCreate(input)) {
  11439. callback();
  11440. return false;
  11441. }
  11442. self.lock();
  11443. var setup = typeof self.settings.create === 'function' ? this.settings.create : function (input) {
  11444. var data = {};
  11445. data[self.settings.labelField] = input;
  11446. data[self.settings.valueField] = input;
  11447. return data;
  11448. };
  11449. var create = once(function (data) {
  11450. self.unlock();
  11451. if (!data || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') return callback();
  11452. var value = hash_key(data[self.settings.valueField]);
  11453. if (typeof value !== 'string') return callback();
  11454. self.setTextboxValue('');
  11455. self.addOption(data);
  11456. self.setCaret(caret);
  11457. self.addItem(value);
  11458. self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
  11459. callback(data);
  11460. });
  11461. var output = setup.apply(this, [input, create]);
  11462. if (typeof output !== 'undefined') {
  11463. create(output);
  11464. }
  11465. return true;
  11466. },
  11467. /**
  11468. * Re-renders the selected item lists.
  11469. */
  11470. refreshItems: function refreshItems() {
  11471. this.lastQuery = null;
  11472. if (this.isSetup) {
  11473. this.addItem(this.items);
  11474. }
  11475. this.refreshState();
  11476. this.updateOriginalInput();
  11477. },
  11478. /**
  11479. * Updates all state-dependent attributes
  11480. * and CSS classes.
  11481. */
  11482. refreshState: function refreshState() {
  11483. this.refreshValidityState();
  11484. this.refreshClasses();
  11485. },
  11486. /**
  11487. * Update the `required` attribute of both input and control input.
  11488. *
  11489. * The `required` property needs to be activated on the control input
  11490. * for the error to be displayed at the right place. `required` also
  11491. * needs to be temporarily deactivated on the input since the input is
  11492. * hidden and can't show errors.
  11493. */
  11494. refreshValidityState: function refreshValidityState() {
  11495. if (!this.isRequired) return false;
  11496. var invalid = !this.items.length;
  11497. this.isInvalid = invalid;
  11498. this.$control_input.prop('required', invalid);
  11499. this.$input.prop('required', !invalid);
  11500. },
  11501. /**
  11502. * Updates all state-dependent CSS classes.
  11503. */
  11504. refreshClasses: function refreshClasses() {
  11505. var self = this;
  11506. var isFull = self.isFull();
  11507. var isLocked = self.isLocked;
  11508. self.$wrapper.toggleClass('rtl', self.rtl);
  11509. 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);
  11510. self.$control_input.data('grow', !isFull && !isLocked);
  11511. },
  11512. /**
  11513. * Determines whether or not more items can be added
  11514. * to the control without exceeding the user-defined maximum.
  11515. *
  11516. * @returns {boolean}
  11517. */
  11518. isFull: function isFull() {
  11519. return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
  11520. },
  11521. /**
  11522. * Refreshes the original <select> or <input>
  11523. * element to reflect the current state.
  11524. */
  11525. updateOriginalInput: function updateOriginalInput(opts) {
  11526. var i,
  11527. n,
  11528. options,
  11529. label,
  11530. self = this;
  11531. opts = opts || {};
  11532. if (self.tagType === TAG_SELECT) {
  11533. options = [];
  11534. for (i = 0, n = self.items.length; i < n; i++) {
  11535. label = self.options[self.items[i]][self.settings.labelField] || '';
  11536. options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
  11537. }
  11538. if (!options.length && !this.$input.attr('multiple')) {
  11539. options.push('<option value="" selected="selected"></option>');
  11540. }
  11541. self.$input.html(options.join(''));
  11542. } else {
  11543. self.$input.val(self.getValue());
  11544. self.$input.attr('value', self.$input.val());
  11545. }
  11546. if (self.isSetup) {
  11547. if (!opts.silent) {
  11548. self.trigger('change', self.$input.val());
  11549. }
  11550. }
  11551. },
  11552. /**
  11553. * Shows/hide the input placeholder depending
  11554. * on if there items in the list already.
  11555. */
  11556. updatePlaceholder: function updatePlaceholder() {
  11557. if (!this.settings.placeholder) return;
  11558. var $input = this.$control_input;
  11559. if (this.items.length) {
  11560. $input.removeAttr('placeholder');
  11561. } else {
  11562. $input.attr('placeholder', this.settings.placeholder);
  11563. }
  11564. $input.triggerHandler('update', { force: true });
  11565. },
  11566. /**
  11567. * Shows the autocomplete dropdown containing
  11568. * the available options.
  11569. */
  11570. open: function open() {
  11571. var self = this;
  11572. if (self.isLocked || self.isOpen || self.settings.mode === 'multi' && self.isFull()) return;
  11573. self.focus();
  11574. self.isOpen = true;
  11575. self.refreshState();
  11576. self.$dropdown.css({ visibility: 'hidden', display: 'block' });
  11577. self.positionDropdown();
  11578. self.$dropdown.css({ visibility: 'visible' });
  11579. self.trigger('dropdown_open', self.$dropdown);
  11580. },
  11581. /**
  11582. * Closes the autocomplete dropdown menu.
  11583. */
  11584. close: function close() {
  11585. var self = this;
  11586. var trigger = self.isOpen;
  11587. if (self.settings.mode === 'single' && self.items.length) {
  11588. self.hideInput();
  11589. self.$control_input.blur(); // close keyboard on iOS
  11590. }
  11591. self.isOpen = false;
  11592. self.$dropdown.hide();
  11593. self.setActiveOption(null);
  11594. self.refreshState();
  11595. if (trigger) self.trigger('dropdown_close', self.$dropdown);
  11596. },
  11597. /**
  11598. * Calculates and applies the appropriate
  11599. * position of the dropdown.
  11600. */
  11601. positionDropdown: function positionDropdown() {
  11602. var $control = this.$control;
  11603. var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
  11604. offset.top += $control.outerHeight(true);
  11605. this.$dropdown.css({
  11606. width: $control.outerWidth(),
  11607. top: offset.top,
  11608. left: offset.left
  11609. });
  11610. },
  11611. /**
  11612. * Resets / clears all selected items
  11613. * from the control.
  11614. *
  11615. * @param {boolean} silent
  11616. */
  11617. clear: function clear(silent) {
  11618. var self = this;
  11619. if (!self.items.length) return;
  11620. self.$control.children(':not(input)').remove();
  11621. self.items = [];
  11622. self.lastQuery = null;
  11623. self.setCaret(0);
  11624. self.setActiveItem(null);
  11625. self.updatePlaceholder();
  11626. self.updateOriginalInput({ silent: silent });
  11627. self.refreshState();
  11628. self.showInput();
  11629. self.trigger('clear');
  11630. },
  11631. /**
  11632. * A helper method for inserting an element
  11633. * at the current caret position.
  11634. *
  11635. * @param {object} $el
  11636. */
  11637. insertAtCaret: function insertAtCaret($el) {
  11638. var caret = Math.min(this.caretPos, this.items.length);
  11639. if (caret === 0) {
  11640. this.$control.prepend($el);
  11641. } else {
  11642. $(this.$control[0].childNodes[caret]).before($el);
  11643. }
  11644. this.setCaret(caret + 1);
  11645. },
  11646. /**
  11647. * Removes the current selected item(s).
  11648. *
  11649. * @param {object} e (optional)
  11650. * @returns {boolean}
  11651. */
  11652. deleteSelection: function deleteSelection(e) {
  11653. var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
  11654. var self = this;
  11655. direction = e && e.keyCode === KEY_BACKSPACE ? -1 : 1;
  11656. selection = getSelection(self.$control_input[0]);
  11657. if (self.$activeOption && !self.settings.hideSelected) {
  11658. option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
  11659. }
  11660. // determine items that will be removed
  11661. values = [];
  11662. if (self.$activeItems.length) {
  11663. $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
  11664. caret = self.$control.children(':not(input)').index($tail);
  11665. if (direction > 0) {
  11666. caret++;
  11667. }
  11668. for (i = 0, n = self.$activeItems.length; i < n; i++) {
  11669. values.push($(self.$activeItems[i]).attr('data-value'));
  11670. }
  11671. if (e) {
  11672. e.preventDefault();
  11673. e.stopPropagation();
  11674. }
  11675. } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
  11676. if (direction < 0 && selection.start === 0 && selection.length === 0) {
  11677. values.push(self.items[self.caretPos - 1]);
  11678. } else if (direction > 0 && selection.start === self.$control_input.val().length) {
  11679. values.push(self.items[self.caretPos]);
  11680. }
  11681. }
  11682. // allow the callback to abort
  11683. if (!values.length || typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false) {
  11684. return false;
  11685. }
  11686. // perform removal
  11687. if (typeof caret !== 'undefined') {
  11688. self.setCaret(caret);
  11689. }
  11690. while (values.length) {
  11691. self.removeItem(values.pop());
  11692. }
  11693. self.showInput();
  11694. self.positionDropdown();
  11695. self.refreshOptions(true);
  11696. // select previous option
  11697. if (option_select) {
  11698. $option_select = self.getOption(option_select);
  11699. if ($option_select.length) {
  11700. self.setActiveOption($option_select);
  11701. }
  11702. }
  11703. return true;
  11704. },
  11705. /**
  11706. * Selects the previous / next item (depending
  11707. * on the `direction` argument).
  11708. *
  11709. * > 0 - right
  11710. * < 0 - left
  11711. *
  11712. * @param {int} direction
  11713. * @param {object} e (optional)
  11714. */
  11715. advanceSelection: function advanceSelection(direction, e) {
  11716. var tail, selection, idx, valueLength, cursorAtEdge, $tail;
  11717. var self = this;
  11718. if (direction === 0) return;
  11719. if (self.rtl) direction *= -1;
  11720. tail = direction > 0 ? 'last' : 'first';
  11721. selection = getSelection(self.$control_input[0]);
  11722. if (self.isFocused && !self.isInputHidden) {
  11723. valueLength = self.$control_input.val().length;
  11724. cursorAtEdge = direction < 0 ? selection.start === 0 && selection.length === 0 : selection.start === valueLength;
  11725. if (cursorAtEdge && !valueLength) {
  11726. self.advanceCaret(direction, e);
  11727. }
  11728. } else {
  11729. $tail = self.$control.children('.active:' + tail);
  11730. if ($tail.length) {
  11731. idx = self.$control.children(':not(input)').index($tail);
  11732. self.setActiveItem(null);
  11733. self.setCaret(direction > 0 ? idx + 1 : idx);
  11734. }
  11735. }
  11736. },
  11737. /**
  11738. * Moves the caret left / right.
  11739. *
  11740. * @param {int} direction
  11741. * @param {object} e (optional)
  11742. */
  11743. advanceCaret: function advanceCaret(direction, e) {
  11744. var self = this,
  11745. fn,
  11746. $adj;
  11747. if (direction === 0) return;
  11748. fn = direction > 0 ? 'next' : 'prev';
  11749. if (self.isShiftDown) {
  11750. $adj = self.$control_input[fn]();
  11751. if ($adj.length) {
  11752. self.hideInput();
  11753. self.setActiveItem($adj);
  11754. e && e.preventDefault();
  11755. }
  11756. } else {
  11757. self.setCaret(self.caretPos + direction);
  11758. }
  11759. },
  11760. /**
  11761. * Moves the caret to the specified index.
  11762. *
  11763. * @param {int} i
  11764. */
  11765. setCaret: function setCaret(i) {
  11766. var self = this;
  11767. if (self.settings.mode === 'single') {
  11768. i = self.items.length;
  11769. } else {
  11770. i = Math.max(0, Math.min(self.items.length, i));
  11771. }
  11772. if (!self.isPending) {
  11773. // the input must be moved by leaving it in place and moving the
  11774. // siblings, due to the fact that focus cannot be restored once lost
  11775. // on mobile webkit devices
  11776. var j, n, fn, $children, $child;
  11777. $children = self.$control.children(':not(input)');
  11778. for (j = 0, n = $children.length; j < n; j++) {
  11779. $child = $($children[j]).detach();
  11780. if (j < i) {
  11781. self.$control_input.before($child);
  11782. } else {
  11783. self.$control.append($child);
  11784. }
  11785. }
  11786. }
  11787. self.caretPos = i;
  11788. },
  11789. /**
  11790. * Disables user input on the control. Used while
  11791. * items are being asynchronously created.
  11792. */
  11793. lock: function lock() {
  11794. this.close();
  11795. this.isLocked = true;
  11796. this.refreshState();
  11797. },
  11798. /**
  11799. * Re-enables user input on the control.
  11800. */
  11801. unlock: function unlock() {
  11802. this.isLocked = false;
  11803. this.refreshState();
  11804. },
  11805. /**
  11806. * Disables user input on the control completely.
  11807. * While disabled, it cannot receive focus.
  11808. */
  11809. disable: function disable() {
  11810. var self = this;
  11811. self.$input.prop('disabled', true);
  11812. self.$control_input.prop('disabled', true).prop('tabindex', -1);
  11813. self.isDisabled = true;
  11814. self.lock();
  11815. },
  11816. /**
  11817. * Enables the control so that it can respond
  11818. * to focus and user input.
  11819. */
  11820. enable: function enable() {
  11821. var self = this;
  11822. self.$input.prop('disabled', false);
  11823. self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
  11824. self.isDisabled = false;
  11825. self.unlock();
  11826. },
  11827. /**
  11828. * Completely destroys the control and
  11829. * unbinds all event listeners so that it can
  11830. * be garbage collected.
  11831. */
  11832. destroy: function destroy() {
  11833. var self = this;
  11834. var eventNS = self.eventNS;
  11835. var revertSettings = self.revertSettings;
  11836. self.trigger('destroy');
  11837. self.off();
  11838. self.$wrapper.remove();
  11839. self.$dropdown.remove();
  11840. self.$input.html('').append(revertSettings.$children).removeAttr('tabindex').removeClass('selectized').attr({ tabindex: revertSettings.tabindex }).show();
  11841. self.$control_input.removeData('grow');
  11842. self.$input.removeData('selectize');
  11843. $(window).off(eventNS);
  11844. $(document).off(eventNS);
  11845. $(document.body).off(eventNS);
  11846. delete self.$input[0].selectize;
  11847. },
  11848. /**
  11849. * A helper method for rendering "item" and
  11850. * "option" templates, given the data.
  11851. *
  11852. * @param {string} templateName
  11853. * @param {object} data
  11854. * @returns {string}
  11855. */
  11856. render: function render(templateName, data) {
  11857. var value, id, label;
  11858. var html = '';
  11859. var cache = false;
  11860. var self = this;
  11861. var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
  11862. if (templateName === 'option' || templateName === 'item') {
  11863. value = hash_key(data[self.settings.valueField]);
  11864. cache = !!value;
  11865. }
  11866. // pull markup from cache if it exists
  11867. if (cache) {
  11868. if (!isset(self.renderCache[templateName])) {
  11869. self.renderCache[templateName] = {};
  11870. }
  11871. if (self.renderCache[templateName].hasOwnProperty(value)) {
  11872. return self.renderCache[templateName][value];
  11873. }
  11874. }
  11875. // render markup
  11876. html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
  11877. // add mandatory attributes
  11878. if (templateName === 'option' || templateName === 'option_create') {
  11879. html.attr('data-selectable', '');
  11880. } else if (templateName === 'optgroup') {
  11881. id = data[self.settings.optgroupValueField] || '';
  11882. html.attr('data-group', id);
  11883. }
  11884. if (templateName === 'option' || templateName === 'item') {
  11885. html.attr('data-value', value || '');
  11886. }
  11887. // update cache
  11888. if (cache) {
  11889. self.renderCache[templateName][value] = html[0];
  11890. }
  11891. return html[0];
  11892. },
  11893. /**
  11894. * Clears the render cache for a template. If
  11895. * no template is given, clears all render
  11896. * caches.
  11897. *
  11898. * @param {string} templateName
  11899. */
  11900. clearCache: function clearCache(templateName) {
  11901. var self = this;
  11902. if (typeof templateName === 'undefined') {
  11903. self.renderCache = {};
  11904. } else {
  11905. delete self.renderCache[templateName];
  11906. }
  11907. },
  11908. /**
  11909. * Determines whether or not to display the
  11910. * create item prompt, given a user input.
  11911. *
  11912. * @param {string} input
  11913. * @return {boolean}
  11914. */
  11915. canCreate: function canCreate(input) {
  11916. var self = this;
  11917. if (!self.settings.create) return false;
  11918. var filter = self.settings.createFilter;
  11919. return input.length && (typeof filter !== 'function' || filter.apply(self, [input])) && (typeof filter !== 'string' || new RegExp(filter).test(input)) && (!(filter instanceof RegExp) || filter.test(input));
  11920. }
  11921. });
  11922. Selectize.count = 0;
  11923. Selectize.defaults = {
  11924. options: [],
  11925. optgroups: [],
  11926. plugins: [],
  11927. delimiter: ',',
  11928. splitOn: null, // regexp or string for splitting up values from a paste command
  11929. persist: true,
  11930. diacritics: true,
  11931. create: false,
  11932. createOnBlur: false,
  11933. createFilter: null,
  11934. highlight: true,
  11935. openOnFocus: true,
  11936. maxOptions: 1000,
  11937. maxItems: null,
  11938. hideSelected: null,
  11939. addPrecedence: false,
  11940. selectOnTab: false,
  11941. preload: false,
  11942. allowEmptyOption: false,
  11943. closeAfterSelect: false,
  11944. scrollDuration: 60,
  11945. loadThrottle: 300,
  11946. loadingClass: 'loading',
  11947. dataAttr: 'data-data',
  11948. optgroupField: 'optgroup',
  11949. valueField: 'value',
  11950. labelField: 'text',
  11951. optgroupLabelField: 'label',
  11952. optgroupValueField: 'value',
  11953. lockOptgroupOrder: false,
  11954. sortField: '$order',
  11955. searchField: ['text'],
  11956. searchConjunction: 'and',
  11957. mode: null,
  11958. wrapperClass: 'selectize-control',
  11959. inputClass: 'selectize-input',
  11960. dropdownClass: 'selectize-dropdown',
  11961. dropdownContentClass: 'selectize-dropdown-content',
  11962. dropdownParent: null,
  11963. copyClassesToDropdown: true,
  11964. /*
  11965. load : null, // function(query, callback) { ... }
  11966. score : null, // function(search) { ... }
  11967. onInitialize : null, // function() { ... }
  11968. onChange : null, // function(value) { ... }
  11969. onItemAdd : null, // function(value, $item) { ... }
  11970. onItemRemove : null, // function(value) { ... }
  11971. onClear : null, // function() { ... }
  11972. onOptionAdd : null, // function(value, data) { ... }
  11973. onOptionRemove : null, // function(value) { ... }
  11974. onOptionClear : null, // function() { ... }
  11975. onOptionGroupAdd : null, // function(id, data) { ... }
  11976. onOptionGroupRemove : null, // function(id) { ... }
  11977. onOptionGroupClear : null, // function() { ... }
  11978. onDropdownOpen : null, // function($dropdown) { ... }
  11979. onDropdownClose : null, // function($dropdown) { ... }
  11980. onType : null, // function(str) { ... }
  11981. onDelete : null, // function(values) { ... }
  11982. */
  11983. render: {
  11984. /*
  11985. item: null,
  11986. optgroup: null,
  11987. optgroup_header: null,
  11988. option: null,
  11989. option_create: null
  11990. */
  11991. }
  11992. };
  11993. $.fn.selectize = function (settings_user) {
  11994. var defaults = $.fn.selectize.defaults;
  11995. var settings = $.extend({}, defaults, settings_user);
  11996. var attr_data = settings.dataAttr;
  11997. var field_label = settings.labelField;
  11998. var field_value = settings.valueField;
  11999. var field_optgroup = settings.optgroupField;
  12000. var field_optgroup_label = settings.optgroupLabelField;
  12001. var field_optgroup_value = settings.optgroupValueField;
  12002. /**
  12003. * Initializes selectize from a <input type="text"> element.
  12004. *
  12005. * @param {object} $input
  12006. * @param {object} settings_element
  12007. */
  12008. var init_textbox = function init_textbox($input, settings_element) {
  12009. var i, n, values, option;
  12010. var data_raw = $input.attr(attr_data);
  12011. if (!data_raw) {
  12012. var value = $.trim($input.val() || '');
  12013. if (!settings.allowEmptyOption && !value.length) return;
  12014. values = value.split(settings.delimiter);
  12015. for (i = 0, n = values.length; i < n; i++) {
  12016. option = {};
  12017. option[field_label] = values[i];
  12018. option[field_value] = values[i];
  12019. settings_element.options.push(option);
  12020. }
  12021. settings_element.items = values;
  12022. } else {
  12023. settings_element.options = JSON.parse(data_raw);
  12024. for (i = 0, n = settings_element.options.length; i < n; i++) {
  12025. settings_element.items.push(settings_element.options[i][field_value]);
  12026. }
  12027. }
  12028. };
  12029. /**
  12030. * Initializes selectize from a <select> element.
  12031. *
  12032. * @param {object} $input
  12033. * @param {object} settings_element
  12034. */
  12035. var init_select = function init_select($input, settings_element) {
  12036. var i,
  12037. n,
  12038. tagName,
  12039. $children,
  12040. order = 0;
  12041. var options = settings_element.options;
  12042. var optionsMap = {};
  12043. var readData = function readData($el) {
  12044. var data = attr_data && $el.attr(attr_data);
  12045. if (typeof data === 'string' && data.length) {
  12046. return JSON.parse(data);
  12047. }
  12048. return null;
  12049. };
  12050. var addOption = function addOption($option, group) {
  12051. $option = $($option);
  12052. var value = hash_key($option.val());
  12053. if (!value && !settings.allowEmptyOption) return;
  12054. // if the option already exists, it's probably been
  12055. // duplicated in another optgroup. in this case, push
  12056. // the current group to the "optgroup" property on the
  12057. // existing option so that it's rendered in both places.
  12058. if (optionsMap.hasOwnProperty(value)) {
  12059. if (group) {
  12060. var arr = optionsMap[value][field_optgroup];
  12061. if (!arr) {
  12062. optionsMap[value][field_optgroup] = group;
  12063. } else if (!$.isArray(arr)) {
  12064. optionsMap[value][field_optgroup] = [arr, group];
  12065. } else {
  12066. arr.push(group);
  12067. }
  12068. }
  12069. return;
  12070. }
  12071. var option = readData($option) || {};
  12072. option[field_label] = option[field_label] || $option.text();
  12073. option[field_value] = option[field_value] || value;
  12074. option[field_optgroup] = option[field_optgroup] || group;
  12075. optionsMap[value] = option;
  12076. options.push(option);
  12077. if ($option.is(':selected')) {
  12078. settings_element.items.push(value);
  12079. }
  12080. };
  12081. var addGroup = function addGroup($optgroup) {
  12082. var i, n, id, optgroup, $options;
  12083. $optgroup = $($optgroup);
  12084. id = $optgroup.attr('label');
  12085. if (id) {
  12086. optgroup = readData($optgroup) || {};
  12087. optgroup[field_optgroup_label] = id;
  12088. optgroup[field_optgroup_value] = id;
  12089. settings_element.optgroups.push(optgroup);
  12090. }
  12091. $options = $('option', $optgroup);
  12092. for (i = 0, n = $options.length; i < n; i++) {
  12093. addOption($options[i], id);
  12094. }
  12095. };
  12096. settings_element.maxItems = $input.attr('multiple') ? null : 1;
  12097. $children = $input.children();
  12098. for (i = 0, n = $children.length; i < n; i++) {
  12099. tagName = $children[i].tagName.toLowerCase();
  12100. if (tagName === 'optgroup') {
  12101. addGroup($children[i]);
  12102. } else if (tagName === 'option') {
  12103. addOption($children[i]);
  12104. }
  12105. }
  12106. };
  12107. return this.each(function () {
  12108. if (this.selectize) return;
  12109. var instance;
  12110. var $input = $(this);
  12111. var tag_name = this.tagName.toLowerCase();
  12112. var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
  12113. if (!placeholder && !settings.allowEmptyOption) {
  12114. placeholder = $input.children('option[value=""]').text();
  12115. }
  12116. var settings_element = {
  12117. 'placeholder': placeholder,
  12118. 'options': [],
  12119. 'optgroups': [],
  12120. 'items': []
  12121. };
  12122. if (tag_name === 'select') {
  12123. init_select($input, settings_element);
  12124. } else {
  12125. init_textbox($input, settings_element);
  12126. }
  12127. instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
  12128. });
  12129. };
  12130. $.fn.selectize.defaults = Selectize.defaults;
  12131. $.fn.selectize.support = {
  12132. validity: SUPPORTS_VALIDITY_API
  12133. };
  12134. Selectize.define('drag_drop', function (options) {
  12135. if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
  12136. if (this.settings.mode !== 'multi') return;
  12137. var self = this;
  12138. self.lock = function () {
  12139. var original = self.lock;
  12140. return function () {
  12141. var sortable = self.$control.data('sortable');
  12142. if (sortable) sortable.disable();
  12143. return original.apply(self, arguments);
  12144. };
  12145. }();
  12146. self.unlock = function () {
  12147. var original = self.unlock;
  12148. return function () {
  12149. var sortable = self.$control.data('sortable');
  12150. if (sortable) sortable.enable();
  12151. return original.apply(self, arguments);
  12152. };
  12153. }();
  12154. self.setup = function () {
  12155. var original = self.setup;
  12156. return function () {
  12157. original.apply(this, arguments);
  12158. var $control = self.$control.sortable({
  12159. items: '[data-value]',
  12160. forcePlaceholderSize: true,
  12161. disabled: self.isLocked,
  12162. start: function start(e, ui) {
  12163. ui.placeholder.css('width', ui.helper.css('width'));
  12164. $control.css({ overflow: 'visible' });
  12165. },
  12166. stop: function stop() {
  12167. $control.css({ overflow: 'hidden' });
  12168. var active = self.$activeItems ? self.$activeItems.slice() : null;
  12169. var values = [];
  12170. $control.children('[data-value]').each(function () {
  12171. values.push($(this).attr('data-value'));
  12172. });
  12173. self.setValue(values);
  12174. self.setActiveItem(active);
  12175. }
  12176. });
  12177. };
  12178. }();
  12179. });
  12180. Selectize.define('dropdown_header', function (options) {
  12181. var self = this;
  12182. options = $.extend({
  12183. title: 'Untitled',
  12184. headerClass: 'selectize-dropdown-header',
  12185. titleRowClass: 'selectize-dropdown-header-title',
  12186. labelClass: 'selectize-dropdown-header-label',
  12187. closeClass: 'selectize-dropdown-header-close',
  12188. html: function html(data) {
  12189. 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>';
  12190. }
  12191. }, options);
  12192. self.setup = function () {
  12193. var original = self.setup;
  12194. return function () {
  12195. original.apply(self, arguments);
  12196. self.$dropdown_header = $(options.html(options));
  12197. self.$dropdown.prepend(self.$dropdown_header);
  12198. };
  12199. }();
  12200. });
  12201. Selectize.define('optgroup_columns', function (options) {
  12202. var self = this;
  12203. options = $.extend({
  12204. equalizeWidth: true,
  12205. equalizeHeight: true
  12206. }, options);
  12207. this.getAdjacentOption = function ($option, direction) {
  12208. var $options = $option.closest('[data-group]').find('[data-selectable]');
  12209. var index = $options.index($option) + direction;
  12210. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  12211. };
  12212. this.onKeyDown = function () {
  12213. var original = self.onKeyDown;
  12214. return function (e) {
  12215. var index, $option, $options, $optgroup;
  12216. if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
  12217. self.ignoreHover = true;
  12218. $optgroup = this.$activeOption.closest('[data-group]');
  12219. index = $optgroup.find('[data-selectable]').index(this.$activeOption);
  12220. if (e.keyCode === KEY_LEFT) {
  12221. $optgroup = $optgroup.prev('[data-group]');
  12222. } else {
  12223. $optgroup = $optgroup.next('[data-group]');
  12224. }
  12225. $options = $optgroup.find('[data-selectable]');
  12226. $option = $options.eq(Math.min($options.length - 1, index));
  12227. if ($option.length) {
  12228. this.setActiveOption($option);
  12229. }
  12230. return;
  12231. }
  12232. return original.apply(this, arguments);
  12233. };
  12234. }();
  12235. var getScrollbarWidth = function getScrollbarWidth() {
  12236. var div;
  12237. var width = getScrollbarWidth.width;
  12238. var doc = document;
  12239. if (typeof width === 'undefined') {
  12240. div = doc.createElement('div');
  12241. div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
  12242. div = div.firstChild;
  12243. doc.body.appendChild(div);
  12244. width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
  12245. doc.body.removeChild(div);
  12246. }
  12247. return width;
  12248. };
  12249. var equalizeSizes = function equalizeSizes() {
  12250. var i, n, height_max, width, width_last, width_parent, $optgroups;
  12251. $optgroups = $('[data-group]', self.$dropdown_content);
  12252. n = $optgroups.length;
  12253. if (!n || !self.$dropdown_content.width()) return;
  12254. if (options.equalizeHeight) {
  12255. height_max = 0;
  12256. for (i = 0; i < n; i++) {
  12257. height_max = Math.max(height_max, $optgroups.eq(i).height());
  12258. }
  12259. $optgroups.css({ height: height_max });
  12260. }
  12261. if (options.equalizeWidth) {
  12262. width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
  12263. width = Math.round(width_parent / n);
  12264. $optgroups.css({ width: width });
  12265. if (n > 1) {
  12266. width_last = width_parent - width * (n - 1);
  12267. $optgroups.eq(n - 1).css({ width: width_last });
  12268. }
  12269. }
  12270. };
  12271. if (options.equalizeHeight || options.equalizeWidth) {
  12272. hook.after(this, 'positionDropdown', equalizeSizes);
  12273. hook.after(this, 'refreshOptions', equalizeSizes);
  12274. }
  12275. });
  12276. Selectize.define('remove_button', function (options) {
  12277. options = $.extend({
  12278. label: '&times;',
  12279. title: 'Remove',
  12280. className: 'remove',
  12281. append: true
  12282. }, options);
  12283. var singleClose = function singleClose(thisRef, options) {
  12284. options.className = 'remove-single';
  12285. var self = thisRef;
  12286. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12287. /**
  12288. * Appends an element as a child (with raw HTML).
  12289. *
  12290. * @param {string} html_container
  12291. * @param {string} html_element
  12292. * @return {string}
  12293. */
  12294. var append = function append(html_container, html_element) {
  12295. return html_container + html_element;
  12296. };
  12297. thisRef.setup = function () {
  12298. var original = self.setup;
  12299. return function () {
  12300. // override the item rendering method to add the button to each
  12301. if (options.append) {
  12302. var id = $(self.$input.context).attr('id');
  12303. var selectizer = $('#' + id);
  12304. var render_item = self.settings.render.item;
  12305. self.settings.render.item = function (data) {
  12306. return append(render_item.apply(thisRef, arguments), html);
  12307. };
  12308. }
  12309. original.apply(thisRef, arguments);
  12310. // add event listener
  12311. thisRef.$control.on('click', '.' + options.className, function (e) {
  12312. e.preventDefault();
  12313. if (self.isLocked) return;
  12314. self.clear();
  12315. });
  12316. };
  12317. }();
  12318. };
  12319. var multiClose = function multiClose(thisRef, options) {
  12320. var self = thisRef;
  12321. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12322. /**
  12323. * Appends an element as a child (with raw HTML).
  12324. *
  12325. * @param {string} html_container
  12326. * @param {string} html_element
  12327. * @return {string}
  12328. */
  12329. var append = function append(html_container, html_element) {
  12330. var pos = html_container.search(/(<\/[^>]+>\s*)$/);
  12331. return html_container.substring(0, pos) + html_element + html_container.substring(pos);
  12332. };
  12333. thisRef.setup = function () {
  12334. var original = self.setup;
  12335. return function () {
  12336. // override the item rendering method to add the button to each
  12337. if (options.append) {
  12338. var render_item = self.settings.render.item;
  12339. self.settings.render.item = function (data) {
  12340. return append(render_item.apply(thisRef, arguments), html);
  12341. };
  12342. }
  12343. original.apply(thisRef, arguments);
  12344. // add event listener
  12345. thisRef.$control.on('click', '.' + options.className, function (e) {
  12346. e.preventDefault();
  12347. if (self.isLocked) return;
  12348. var $item = $(e.currentTarget).parent();
  12349. self.setActiveItem($item);
  12350. if (self.deleteSelection()) {
  12351. self.setCaret(self.items.length);
  12352. }
  12353. });
  12354. };
  12355. }();
  12356. };
  12357. if (this.settings.mode === 'single') {
  12358. singleClose(this, options);
  12359. return;
  12360. } else {
  12361. multiClose(this, options);
  12362. }
  12363. });
  12364. Selectize.define('restore_on_backspace', function (options) {
  12365. var self = this;
  12366. options.text = options.text || function (option) {
  12367. return option[this.settings.labelField];
  12368. };
  12369. this.onKeyDown = function () {
  12370. var original = self.onKeyDown;
  12371. return function (e) {
  12372. var index, option;
  12373. if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
  12374. index = this.caretPos - 1;
  12375. if (index >= 0 && index < this.items.length) {
  12376. option = this.options[this.items[index]];
  12377. if (this.deleteSelection(e)) {
  12378. this.setTextboxValue(options.text.apply(this, [option]));
  12379. this.refreshOptions(true);
  12380. }
  12381. e.preventDefault();
  12382. return;
  12383. }
  12384. }
  12385. return original.apply(this, arguments);
  12386. };
  12387. }();
  12388. });
  12389. return Selectize;
  12390. });
  12391. /***/ }),
  12392. /* 30 */
  12393. /***/ (function(module, exports, __webpack_require__) {
  12394. "use strict";
  12395. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12396. /*!
  12397. Autosize 4.0.0
  12398. license: MIT
  12399. http://www.jacklmoore.com/autosize
  12400. */
  12401. (function (global, factory) {
  12402. if (true) {
  12403. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12404. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12405. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12406. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12407. } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
  12408. factory(exports, module);
  12409. } else {
  12410. var mod = {
  12411. exports: {}
  12412. };
  12413. factory(mod.exports, mod);
  12414. global.autosize = mod.exports;
  12415. }
  12416. })(undefined, function (exports, module) {
  12417. 'use strict';
  12418. var map = typeof Map === "function" ? new Map() : function () {
  12419. var keys = [];
  12420. var values = [];
  12421. return {
  12422. has: function has(key) {
  12423. return keys.indexOf(key) > -1;
  12424. },
  12425. get: function get(key) {
  12426. return values[keys.indexOf(key)];
  12427. },
  12428. set: function set(key, value) {
  12429. if (keys.indexOf(key) === -1) {
  12430. keys.push(key);
  12431. values.push(value);
  12432. }
  12433. },
  12434. 'delete': function _delete(key) {
  12435. var index = keys.indexOf(key);
  12436. if (index > -1) {
  12437. keys.splice(index, 1);
  12438. values.splice(index, 1);
  12439. }
  12440. }
  12441. };
  12442. }();
  12443. var createEvent = function createEvent(name) {
  12444. return new Event(name, { bubbles: true });
  12445. };
  12446. try {
  12447. new Event('test');
  12448. } catch (e) {
  12449. // IE does not support `new Event()`
  12450. createEvent = function createEvent(name) {
  12451. var evt = document.createEvent('Event');
  12452. evt.initEvent(name, true, false);
  12453. return evt;
  12454. };
  12455. }
  12456. function assign(ta) {
  12457. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  12458. var heightOffset = null;
  12459. var clientWidth = ta.clientWidth;
  12460. var cachedHeight = null;
  12461. function init() {
  12462. var style = window.getComputedStyle(ta, null);
  12463. if (style.resize === 'vertical') {
  12464. ta.style.resize = 'none';
  12465. } else if (style.resize === 'both') {
  12466. ta.style.resize = 'horizontal';
  12467. }
  12468. if (style.boxSizing === 'content-box') {
  12469. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  12470. } else {
  12471. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  12472. }
  12473. // Fix when a textarea is not on document body and heightOffset is Not a Number
  12474. if (isNaN(heightOffset)) {
  12475. heightOffset = 0;
  12476. }
  12477. update();
  12478. }
  12479. function changeOverflow(value) {
  12480. {
  12481. // Chrome/Safari-specific fix:
  12482. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  12483. // made available by removing the scrollbar. The following forces the necessary text reflow.
  12484. var width = ta.style.width;
  12485. ta.style.width = '0px';
  12486. // Force reflow:
  12487. /* jshint ignore:start */
  12488. ta.offsetWidth;
  12489. /* jshint ignore:end */
  12490. ta.style.width = width;
  12491. }
  12492. ta.style.overflowY = value;
  12493. }
  12494. function getParentOverflows(el) {
  12495. var arr = [];
  12496. while (el && el.parentNode && el.parentNode instanceof Element) {
  12497. if (el.parentNode.scrollTop) {
  12498. arr.push({
  12499. node: el.parentNode,
  12500. scrollTop: el.parentNode.scrollTop
  12501. });
  12502. }
  12503. el = el.parentNode;
  12504. }
  12505. return arr;
  12506. }
  12507. function resize() {
  12508. var originalHeight = ta.style.height;
  12509. var overflows = getParentOverflows(ta);
  12510. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  12511. ta.style.height = '';
  12512. var endHeight = ta.scrollHeight + heightOffset;
  12513. if (ta.scrollHeight === 0) {
  12514. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  12515. ta.style.height = originalHeight;
  12516. return;
  12517. }
  12518. ta.style.height = endHeight + 'px';
  12519. // used to check if an update is actually necessary on window.resize
  12520. clientWidth = ta.clientWidth;
  12521. // prevents scroll-position jumping
  12522. overflows.forEach(function (el) {
  12523. el.node.scrollTop = el.scrollTop;
  12524. });
  12525. if (docTop) {
  12526. document.documentElement.scrollTop = docTop;
  12527. }
  12528. }
  12529. function update() {
  12530. resize();
  12531. var styleHeight = Math.round(parseFloat(ta.style.height));
  12532. var computed = window.getComputedStyle(ta, null);
  12533. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  12534. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  12535. // The actual height not matching the style height (set via the resize method) indicates that
  12536. // the max-height has been exceeded, in which case the overflow should be allowed.
  12537. if (actualHeight !== styleHeight) {
  12538. if (computed.overflowY === 'hidden') {
  12539. changeOverflow('scroll');
  12540. resize();
  12541. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12542. }
  12543. } else {
  12544. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  12545. if (computed.overflowY !== 'hidden') {
  12546. changeOverflow('hidden');
  12547. resize();
  12548. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12549. }
  12550. }
  12551. if (cachedHeight !== actualHeight) {
  12552. cachedHeight = actualHeight;
  12553. var evt = createEvent('autosize:resized');
  12554. try {
  12555. ta.dispatchEvent(evt);
  12556. } catch (err) {
  12557. // Firefox will throw an error on dispatchEvent for a detached element
  12558. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  12559. }
  12560. }
  12561. }
  12562. var pageResize = function pageResize() {
  12563. if (ta.clientWidth !== clientWidth) {
  12564. update();
  12565. }
  12566. };
  12567. var destroy = function (style) {
  12568. window.removeEventListener('resize', pageResize, false);
  12569. ta.removeEventListener('input', update, false);
  12570. ta.removeEventListener('keyup', update, false);
  12571. ta.removeEventListener('autosize:destroy', destroy, false);
  12572. ta.removeEventListener('autosize:update', update, false);
  12573. Object.keys(style).forEach(function (key) {
  12574. ta.style[key] = style[key];
  12575. });
  12576. map['delete'](ta);
  12577. }.bind(ta, {
  12578. height: ta.style.height,
  12579. resize: ta.style.resize,
  12580. overflowY: ta.style.overflowY,
  12581. overflowX: ta.style.overflowX,
  12582. wordWrap: ta.style.wordWrap
  12583. });
  12584. ta.addEventListener('autosize:destroy', destroy, false);
  12585. // IE9 does not fire onpropertychange or oninput for deletions,
  12586. // so binding to onkeyup to catch most of those events.
  12587. // There is no way that I know of to detect something like 'cut' in IE9.
  12588. if ('onpropertychange' in ta && 'oninput' in ta) {
  12589. ta.addEventListener('keyup', update, false);
  12590. }
  12591. window.addEventListener('resize', pageResize, false);
  12592. ta.addEventListener('input', update, false);
  12593. ta.addEventListener('autosize:update', update, false);
  12594. ta.style.overflowX = 'hidden';
  12595. ta.style.wordWrap = 'break-word';
  12596. map.set(ta, {
  12597. destroy: destroy,
  12598. update: update
  12599. });
  12600. init();
  12601. }
  12602. function destroy(ta) {
  12603. var methods = map.get(ta);
  12604. if (methods) {
  12605. methods.destroy();
  12606. }
  12607. }
  12608. function update(ta) {
  12609. var methods = map.get(ta);
  12610. if (methods) {
  12611. methods.update();
  12612. }
  12613. }
  12614. var autosize = null;
  12615. // Do nothing in Node.js environment and IE8 (or lower)
  12616. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  12617. autosize = function autosize(el) {
  12618. return el;
  12619. };
  12620. autosize.destroy = function (el) {
  12621. return el;
  12622. };
  12623. autosize.update = function (el) {
  12624. return el;
  12625. };
  12626. } else {
  12627. autosize = function autosize(el, options) {
  12628. if (el) {
  12629. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  12630. return assign(x, options);
  12631. });
  12632. }
  12633. return el;
  12634. };
  12635. autosize.destroy = function (el) {
  12636. if (el) {
  12637. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  12638. }
  12639. return el;
  12640. };
  12641. autosize.update = function (el) {
  12642. if (el) {
  12643. Array.prototype.forEach.call(el.length ? el : [el], update);
  12644. }
  12645. return el;
  12646. };
  12647. }
  12648. module.exports = autosize;
  12649. });
  12650. /***/ }),
  12651. /* 31 */
  12652. /***/ (function(module, exports, __webpack_require__) {
  12653. "use strict";
  12654. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;
  12655. 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; };
  12656. /*!
  12657. * enquire.js v2.1.6 - Awesome Media Queries in JavaScript
  12658. * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js
  12659. * License: MIT */
  12660. (function (f) {
  12661. if (( false ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  12662. module.exports = f();
  12663. } else if (true) {
  12664. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
  12665. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12666. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12667. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12668. } else {
  12669. var g;if (typeof window !== "undefined") {
  12670. g = window;
  12671. } else if (typeof global !== "undefined") {
  12672. g = global;
  12673. } else if (typeof self !== "undefined") {
  12674. g = self;
  12675. } else {
  12676. g = this;
  12677. }g.enquire = f();
  12678. }
  12679. })(function () {
  12680. var define, module, exports;return function e(t, n, r) {
  12681. function s(o, u) {
  12682. if (!n[o]) {
  12683. if (!t[o]) {
  12684. 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;
  12685. }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
  12686. var n = t[o][1][e];return s(n ? n : e);
  12687. }, l, l.exports, e, t, n, r);
  12688. }return n[o].exports;
  12689. }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
  12690. s(r[o]);
  12691. }return s;
  12692. }({ 1: [function (require, module, exports) {
  12693. var QueryHandler = require(3);
  12694. var each = require(4).each;
  12695. /**
  12696. * Represents a single media query, manages it's state and registered handlers for this query
  12697. *
  12698. * @constructor
  12699. * @param {string} query the media query string
  12700. * @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
  12701. */
  12702. function MediaQuery(query, isUnconditional) {
  12703. this.query = query;
  12704. this.isUnconditional = isUnconditional;
  12705. this.handlers = [];
  12706. this.mql = window.matchMedia(query);
  12707. var self = this;
  12708. this.listener = function (mql) {
  12709. // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
  12710. self.mql = mql.currentTarget || mql;
  12711. self.assess();
  12712. };
  12713. this.mql.addListener(this.listener);
  12714. }
  12715. MediaQuery.prototype = {
  12716. constuctor: MediaQuery,
  12717. /**
  12718. * add a handler for this query, triggering if already active
  12719. *
  12720. * @param {object} handler
  12721. * @param {function} handler.match callback for when query is activated
  12722. * @param {function} [handler.unmatch] callback for when query is deactivated
  12723. * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
  12724. * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
  12725. */
  12726. addHandler: function addHandler(handler) {
  12727. var qh = new QueryHandler(handler);
  12728. this.handlers.push(qh);
  12729. this.matches() && qh.on();
  12730. },
  12731. /**
  12732. * removes the given handler from the collection, and calls it's destroy methods
  12733. *
  12734. * @param {object || function} handler the handler to remove
  12735. */
  12736. removeHandler: function removeHandler(handler) {
  12737. var handlers = this.handlers;
  12738. each(handlers, function (h, i) {
  12739. if (h.equals(handler)) {
  12740. h.destroy();
  12741. return !handlers.splice(i, 1); //remove from array and exit each early
  12742. }
  12743. });
  12744. },
  12745. /**
  12746. * Determine whether the media query should be considered a match
  12747. *
  12748. * @return {Boolean} true if media query can be considered a match, false otherwise
  12749. */
  12750. matches: function matches() {
  12751. return this.mql.matches || this.isUnconditional;
  12752. },
  12753. /**
  12754. * Clears all handlers and unbinds events
  12755. */
  12756. clear: function clear() {
  12757. each(this.handlers, function (handler) {
  12758. handler.destroy();
  12759. });
  12760. this.mql.removeListener(this.listener);
  12761. this.handlers.length = 0; //clear array
  12762. },
  12763. /*
  12764. * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
  12765. */
  12766. assess: function assess() {
  12767. var action = this.matches() ? 'on' : 'off';
  12768. each(this.handlers, function (handler) {
  12769. handler[action]();
  12770. });
  12771. }
  12772. };
  12773. module.exports = MediaQuery;
  12774. }, { "3": 3, "4": 4 }], 2: [function (require, module, exports) {
  12775. var MediaQuery = require(1);
  12776. var Util = require(4);
  12777. var each = Util.each;
  12778. var isFunction = Util.isFunction;
  12779. var isArray = Util.isArray;
  12780. /**
  12781. * Allows for registration of query handlers.
  12782. * Manages the query handler's state and is responsible for wiring up browser events
  12783. *
  12784. * @constructor
  12785. */
  12786. function MediaQueryDispatch() {
  12787. if (!window.matchMedia) {
  12788. throw new Error('matchMedia not present, legacy browsers require a polyfill');
  12789. }
  12790. this.queries = {};
  12791. this.browserIsIncapable = !window.matchMedia('only all').matches;
  12792. }
  12793. MediaQueryDispatch.prototype = {
  12794. constructor: MediaQueryDispatch,
  12795. /**
  12796. * Registers a handler for the given media query
  12797. *
  12798. * @param {string} q the media query
  12799. * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
  12800. * @param {function} options.match fired when query matched
  12801. * @param {function} [options.unmatch] fired when a query is no longer matched
  12802. * @param {function} [options.setup] fired when handler first triggered
  12803. * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
  12804. * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
  12805. */
  12806. register: function register(q, options, shouldDegrade) {
  12807. var queries = this.queries,
  12808. isUnconditional = shouldDegrade && this.browserIsIncapable;
  12809. if (!queries[q]) {
  12810. queries[q] = new MediaQuery(q, isUnconditional);
  12811. }
  12812. //normalise to object in an array
  12813. if (isFunction(options)) {
  12814. options = { match: options };
  12815. }
  12816. if (!isArray(options)) {
  12817. options = [options];
  12818. }
  12819. each(options, function (handler) {
  12820. if (isFunction(handler)) {
  12821. handler = { match: handler };
  12822. }
  12823. queries[q].addHandler(handler);
  12824. });
  12825. return this;
  12826. },
  12827. /**
  12828. * unregisters a query and all it's handlers, or a specific handler for a query
  12829. *
  12830. * @param {string} q the media query to target
  12831. * @param {object || function} [handler] specific handler to unregister
  12832. */
  12833. unregister: function unregister(q, handler) {
  12834. var query = this.queries[q];
  12835. if (query) {
  12836. if (handler) {
  12837. query.removeHandler(handler);
  12838. } else {
  12839. query.clear();
  12840. delete this.queries[q];
  12841. }
  12842. }
  12843. return this;
  12844. }
  12845. };
  12846. module.exports = MediaQueryDispatch;
  12847. }, { "1": 1, "4": 4 }], 3: [function (require, module, exports) {
  12848. /**
  12849. * Delegate to handle a media query being matched and unmatched.
  12850. *
  12851. * @param {object} options
  12852. * @param {function} options.match callback for when the media query is matched
  12853. * @param {function} [options.unmatch] callback for when the media query is unmatched
  12854. * @param {function} [options.setup] one-time callback triggered the first time a query is matched
  12855. * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
  12856. * @constructor
  12857. */
  12858. function QueryHandler(options) {
  12859. this.options = options;
  12860. !options.deferSetup && this.setup();
  12861. }
  12862. QueryHandler.prototype = {
  12863. constructor: QueryHandler,
  12864. /**
  12865. * coordinates setup of the handler
  12866. *
  12867. * @function
  12868. */
  12869. setup: function setup() {
  12870. if (this.options.setup) {
  12871. this.options.setup();
  12872. }
  12873. this.initialised = true;
  12874. },
  12875. /**
  12876. * coordinates setup and triggering of the handler
  12877. *
  12878. * @function
  12879. */
  12880. on: function on() {
  12881. !this.initialised && this.setup();
  12882. this.options.match && this.options.match();
  12883. },
  12884. /**
  12885. * coordinates the unmatch event for the handler
  12886. *
  12887. * @function
  12888. */
  12889. off: function off() {
  12890. this.options.unmatch && this.options.unmatch();
  12891. },
  12892. /**
  12893. * called when a handler is to be destroyed.
  12894. * delegates to the destroy or unmatch callbacks, depending on availability.
  12895. *
  12896. * @function
  12897. */
  12898. destroy: function destroy() {
  12899. this.options.destroy ? this.options.destroy() : this.off();
  12900. },
  12901. /**
  12902. * determines equality by reference.
  12903. * if object is supplied compare options, if function, compare match callback
  12904. *
  12905. * @function
  12906. * @param {object || function} [target] the target for comparison
  12907. */
  12908. equals: function equals(target) {
  12909. return this.options === target || this.options.match === target;
  12910. }
  12911. };
  12912. module.exports = QueryHandler;
  12913. }, {}], 4: [function (require, module, exports) {
  12914. /**
  12915. * Helper function for iterating over a collection
  12916. *
  12917. * @param collection
  12918. * @param fn
  12919. */
  12920. function each(collection, fn) {
  12921. var i = 0,
  12922. length = collection.length,
  12923. cont;
  12924. for (i; i < length; i++) {
  12925. cont = fn(collection[i], i);
  12926. if (cont === false) {
  12927. break; //allow early exit
  12928. }
  12929. }
  12930. }
  12931. /**
  12932. * Helper function for determining whether target object is an array
  12933. *
  12934. * @param target the object under test
  12935. * @return {Boolean} true if array, false otherwise
  12936. */
  12937. function isArray(target) {
  12938. return Object.prototype.toString.apply(target) === '[object Array]';
  12939. }
  12940. /**
  12941. * Helper function for determining whether target object is a function
  12942. *
  12943. * @param target the object under test
  12944. * @return {Boolean} true if function, false otherwise
  12945. */
  12946. function isFunction(target) {
  12947. return typeof target === 'function';
  12948. }
  12949. module.exports = {
  12950. isFunction: isFunction,
  12951. isArray: isArray,
  12952. each: each
  12953. };
  12954. }, {}], 5: [function (require, module, exports) {
  12955. var MediaQueryDispatch = require(2);
  12956. module.exports = new MediaQueryDispatch();
  12957. }, { "2": 2 }] }, {}, [5])(5);
  12958. });
  12959. /***/ }),
  12960. /* 32 */
  12961. /***/ (function(module, exports, __webpack_require__) {
  12962. "use strict";
  12963. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12964. /*! jQuery UI - v1.12.1 - 2017-03-23
  12965. * http://jqueryui.com
  12966. * Includes: widget.js, keycode.js, widgets/mouse.js, widgets/slider.js
  12967. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  12968. (function (factory) {
  12969. if (true) {
  12970. // AMD. Register as an anonymous module.
  12971. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12972. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12973. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12974. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12975. } else {
  12976. // Browser globals
  12977. factory(jQuery);
  12978. }
  12979. })(function ($) {
  12980. $.ui = $.ui || {};
  12981. var version = $.ui.version = "1.12.1";
  12982. /*!
  12983. * jQuery UI Widget 1.12.1
  12984. * http://jqueryui.com
  12985. *
  12986. * Copyright jQuery Foundation and other contributors
  12987. * Released under the MIT license.
  12988. * http://jquery.org/license
  12989. */
  12990. //>>label: Widget
  12991. //>>group: Core
  12992. //>>description: Provides a factory for creating stateful widgets with a common API.
  12993. //>>docs: http://api.jqueryui.com/jQuery.widget/
  12994. //>>demos: http://jqueryui.com/widget/
  12995. var widgetUuid = 0;
  12996. var widgetSlice = Array.prototype.slice;
  12997. $.cleanData = function (orig) {
  12998. return function (elems) {
  12999. var events, elem, i;
  13000. for (i = 0; (elem = elems[i]) != null; i++) {
  13001. try {
  13002. // Only trigger remove when necessary to save time
  13003. events = $._data(elem, "events");
  13004. if (events && events.remove) {
  13005. $(elem).triggerHandler("remove");
  13006. }
  13007. // Http://bugs.jquery.com/ticket/8235
  13008. } catch (e) {}
  13009. }
  13010. orig(elems);
  13011. };
  13012. }($.cleanData);
  13013. $.widget = function (name, base, prototype) {
  13014. var existingConstructor, constructor, basePrototype;
  13015. // ProxiedPrototype allows the provided prototype to remain unmodified
  13016. // so that it can be used as a mixin for multiple widgets (#8876)
  13017. var proxiedPrototype = {};
  13018. var namespace = name.split(".")[0];
  13019. name = name.split(".")[1];
  13020. var fullName = namespace + "-" + name;
  13021. if (!prototype) {
  13022. prototype = base;
  13023. base = $.Widget;
  13024. }
  13025. if ($.isArray(prototype)) {
  13026. prototype = $.extend.apply(null, [{}].concat(prototype));
  13027. }
  13028. // Create selector for plugin
  13029. $.expr[":"][fullName.toLowerCase()] = function (elem) {
  13030. return !!$.data(elem, fullName);
  13031. };
  13032. $[namespace] = $[namespace] || {};
  13033. existingConstructor = $[namespace][name];
  13034. constructor = $[namespace][name] = function (options, element) {
  13035. // Allow instantiation without "new" keyword
  13036. if (!this._createWidget) {
  13037. return new constructor(options, element);
  13038. }
  13039. // Allow instantiation without initializing for simple inheritance
  13040. // must use "new" keyword (the code above always passes args)
  13041. if (arguments.length) {
  13042. this._createWidget(options, element);
  13043. }
  13044. };
  13045. // Extend with the existing constructor to carry over any static properties
  13046. $.extend(constructor, existingConstructor, {
  13047. version: prototype.version,
  13048. // Copy the object used to create the prototype in case we need to
  13049. // redefine the widget later
  13050. _proto: $.extend({}, prototype),
  13051. // Track widgets that inherit from this widget in case this widget is
  13052. // redefined after a widget inherits from it
  13053. _childConstructors: []
  13054. });
  13055. basePrototype = new base();
  13056. // We need to make the options hash a property directly on the new instance
  13057. // otherwise we'll modify the options hash on the prototype that we're
  13058. // inheriting from
  13059. basePrototype.options = $.widget.extend({}, basePrototype.options);
  13060. $.each(prototype, function (prop, value) {
  13061. if (!$.isFunction(value)) {
  13062. proxiedPrototype[prop] = value;
  13063. return;
  13064. }
  13065. proxiedPrototype[prop] = function () {
  13066. function _super() {
  13067. return base.prototype[prop].apply(this, arguments);
  13068. }
  13069. function _superApply(args) {
  13070. return base.prototype[prop].apply(this, args);
  13071. }
  13072. return function () {
  13073. var __super = this._super;
  13074. var __superApply = this._superApply;
  13075. var returnValue;
  13076. this._super = _super;
  13077. this._superApply = _superApply;
  13078. returnValue = value.apply(this, arguments);
  13079. this._super = __super;
  13080. this._superApply = __superApply;
  13081. return returnValue;
  13082. };
  13083. }();
  13084. });
  13085. constructor.prototype = $.widget.extend(basePrototype, {
  13086. // TODO: remove support for widgetEventPrefix
  13087. // always use the name + a colon as the prefix, e.g., draggable:start
  13088. // don't prefix for widgets that aren't DOM-based
  13089. widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name
  13090. }, proxiedPrototype, {
  13091. constructor: constructor,
  13092. namespace: namespace,
  13093. widgetName: name,
  13094. widgetFullName: fullName
  13095. });
  13096. // If this widget is being redefined then we need to find all widgets that
  13097. // are inheriting from it and redefine all of them so that they inherit from
  13098. // the new version of this widget. We're essentially trying to replace one
  13099. // level in the prototype chain.
  13100. if (existingConstructor) {
  13101. $.each(existingConstructor._childConstructors, function (i, child) {
  13102. var childPrototype = child.prototype;
  13103. // Redefine the child widget using the same prototype that was
  13104. // originally used, but inherit from the new version of the base
  13105. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
  13106. });
  13107. // Remove the list of existing child constructors from the old constructor
  13108. // so the old child constructors can be garbage collected
  13109. delete existingConstructor._childConstructors;
  13110. } else {
  13111. base._childConstructors.push(constructor);
  13112. }
  13113. $.widget.bridge(name, constructor);
  13114. return constructor;
  13115. };
  13116. $.widget.extend = function (target) {
  13117. var input = widgetSlice.call(arguments, 1);
  13118. var inputIndex = 0;
  13119. var inputLength = input.length;
  13120. var key;
  13121. var value;
  13122. for (; inputIndex < inputLength; inputIndex++) {
  13123. for (key in input[inputIndex]) {
  13124. value = input[inputIndex][key];
  13125. if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
  13126. // Clone objects
  13127. if ($.isPlainObject(value)) {
  13128. target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) :
  13129. // Don't extend strings, arrays, etc. with objects
  13130. $.widget.extend({}, value);
  13131. // Copy everything else by reference
  13132. } else {
  13133. target[key] = value;
  13134. }
  13135. }
  13136. }
  13137. }
  13138. return target;
  13139. };
  13140. $.widget.bridge = function (name, object) {
  13141. var fullName = object.prototype.widgetFullName || name;
  13142. $.fn[name] = function (options) {
  13143. var isMethodCall = typeof options === "string";
  13144. var args = widgetSlice.call(arguments, 1);
  13145. var returnValue = this;
  13146. if (isMethodCall) {
  13147. // If this is an empty collection, we need to have the instance method
  13148. // return undefined instead of the jQuery instance
  13149. if (!this.length && options === "instance") {
  13150. returnValue = undefined;
  13151. } else {
  13152. this.each(function () {
  13153. var methodValue;
  13154. var instance = $.data(this, fullName);
  13155. if (options === "instance") {
  13156. returnValue = instance;
  13157. return false;
  13158. }
  13159. if (!instance) {
  13160. return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'");
  13161. }
  13162. if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
  13163. return $.error("no such method '" + options + "' for " + name + " widget instance");
  13164. }
  13165. methodValue = instance[options].apply(instance, args);
  13166. if (methodValue !== instance && methodValue !== undefined) {
  13167. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  13168. return false;
  13169. }
  13170. });
  13171. }
  13172. } else {
  13173. // Allow multiple hashes to be passed on init
  13174. if (args.length) {
  13175. options = $.widget.extend.apply(null, [options].concat(args));
  13176. }
  13177. this.each(function () {
  13178. var instance = $.data(this, fullName);
  13179. if (instance) {
  13180. instance.option(options || {});
  13181. if (instance._init) {
  13182. instance._init();
  13183. }
  13184. } else {
  13185. $.data(this, fullName, new object(options, this));
  13186. }
  13187. });
  13188. }
  13189. return returnValue;
  13190. };
  13191. };
  13192. $.Widget = function () /* options, element */{};
  13193. $.Widget._childConstructors = [];
  13194. $.Widget.prototype = {
  13195. widgetName: "widget",
  13196. widgetEventPrefix: "",
  13197. defaultElement: "<div>",
  13198. options: {
  13199. classes: {},
  13200. disabled: false,
  13201. // Callbacks
  13202. create: null
  13203. },
  13204. _createWidget: function _createWidget(options, element) {
  13205. element = $(element || this.defaultElement || this)[0];
  13206. this.element = $(element);
  13207. this.uuid = widgetUuid++;
  13208. this.eventNamespace = "." + this.widgetName + this.uuid;
  13209. this.bindings = $();
  13210. this.hoverable = $();
  13211. this.focusable = $();
  13212. this.classesElementLookup = {};
  13213. if (element !== this) {
  13214. $.data(element, this.widgetFullName, this);
  13215. this._on(true, this.element, {
  13216. remove: function remove(event) {
  13217. if (event.target === element) {
  13218. this.destroy();
  13219. }
  13220. }
  13221. });
  13222. this.document = $(element.style ?
  13223. // Element within the document
  13224. element.ownerDocument :
  13225. // Element is window or document
  13226. element.document || element);
  13227. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  13228. }
  13229. this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
  13230. this._create();
  13231. if (this.options.disabled) {
  13232. this._setOptionDisabled(this.options.disabled);
  13233. }
  13234. this._trigger("create", null, this._getCreateEventData());
  13235. this._init();
  13236. },
  13237. _getCreateOptions: function _getCreateOptions() {
  13238. return {};
  13239. },
  13240. _getCreateEventData: $.noop,
  13241. _create: $.noop,
  13242. _init: $.noop,
  13243. destroy: function destroy() {
  13244. var that = this;
  13245. this._destroy();
  13246. $.each(this.classesElementLookup, function (key, value) {
  13247. that._removeClass(value, key);
  13248. });
  13249. // We can probably remove the unbind calls in 2.0
  13250. // all event bindings should go through this._on()
  13251. this.element.off(this.eventNamespace).removeData(this.widgetFullName);
  13252. this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
  13253. // Clean up events and states
  13254. this.bindings.off(this.eventNamespace);
  13255. },
  13256. _destroy: $.noop,
  13257. widget: function widget() {
  13258. return this.element;
  13259. },
  13260. option: function option(key, value) {
  13261. var options = key;
  13262. var parts;
  13263. var curOption;
  13264. var i;
  13265. if (arguments.length === 0) {
  13266. // Don't return a reference to the internal hash
  13267. return $.widget.extend({}, this.options);
  13268. }
  13269. if (typeof key === "string") {
  13270. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  13271. options = {};
  13272. parts = key.split(".");
  13273. key = parts.shift();
  13274. if (parts.length) {
  13275. curOption = options[key] = $.widget.extend({}, this.options[key]);
  13276. for (i = 0; i < parts.length - 1; i++) {
  13277. curOption[parts[i]] = curOption[parts[i]] || {};
  13278. curOption = curOption[parts[i]];
  13279. }
  13280. key = parts.pop();
  13281. if (arguments.length === 1) {
  13282. return curOption[key] === undefined ? null : curOption[key];
  13283. }
  13284. curOption[key] = value;
  13285. } else {
  13286. if (arguments.length === 1) {
  13287. return this.options[key] === undefined ? null : this.options[key];
  13288. }
  13289. options[key] = value;
  13290. }
  13291. }
  13292. this._setOptions(options);
  13293. return this;
  13294. },
  13295. _setOptions: function _setOptions(options) {
  13296. var key;
  13297. for (key in options) {
  13298. this._setOption(key, options[key]);
  13299. }
  13300. return this;
  13301. },
  13302. _setOption: function _setOption(key, value) {
  13303. if (key === "classes") {
  13304. this._setOptionClasses(value);
  13305. }
  13306. this.options[key] = value;
  13307. if (key === "disabled") {
  13308. this._setOptionDisabled(value);
  13309. }
  13310. return this;
  13311. },
  13312. _setOptionClasses: function _setOptionClasses(value) {
  13313. var classKey, elements, currentElements;
  13314. for (classKey in value) {
  13315. currentElements = this.classesElementLookup[classKey];
  13316. if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) {
  13317. continue;
  13318. }
  13319. // We are doing this to create a new jQuery object because the _removeClass() call
  13320. // on the next line is going to destroy the reference to the current elements being
  13321. // tracked. We need to save a copy of this collection so that we can add the new classes
  13322. // below.
  13323. elements = $(currentElements.get());
  13324. this._removeClass(currentElements, classKey);
  13325. // We don't use _addClass() here, because that uses this.options.classes
  13326. // for generating the string of classes. We want to use the value passed in from
  13327. // _setOption(), this is the new value of the classes option which was passed to
  13328. // _setOption(). We pass this value directly to _classes().
  13329. elements.addClass(this._classes({
  13330. element: elements,
  13331. keys: classKey,
  13332. classes: value,
  13333. add: true
  13334. }));
  13335. }
  13336. },
  13337. _setOptionDisabled: function _setOptionDisabled(value) {
  13338. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  13339. // If the widget is becoming disabled, then nothing is interactive
  13340. if (value) {
  13341. this._removeClass(this.hoverable, null, "ui-state-hover");
  13342. this._removeClass(this.focusable, null, "ui-state-focus");
  13343. }
  13344. },
  13345. enable: function enable() {
  13346. return this._setOptions({ disabled: false });
  13347. },
  13348. disable: function disable() {
  13349. return this._setOptions({ disabled: true });
  13350. },
  13351. _classes: function _classes(options) {
  13352. var full = [];
  13353. var that = this;
  13354. options = $.extend({
  13355. element: this.element,
  13356. classes: this.options.classes || {}
  13357. }, options);
  13358. function processClassString(classes, checkOption) {
  13359. var current, i;
  13360. for (i = 0; i < classes.length; i++) {
  13361. current = that.classesElementLookup[classes[i]] || $();
  13362. if (options.add) {
  13363. current = $($.unique(current.get().concat(options.element.get())));
  13364. } else {
  13365. current = $(current.not(options.element).get());
  13366. }
  13367. that.classesElementLookup[classes[i]] = current;
  13368. full.push(classes[i]);
  13369. if (checkOption && options.classes[classes[i]]) {
  13370. full.push(options.classes[classes[i]]);
  13371. }
  13372. }
  13373. }
  13374. this._on(options.element, {
  13375. "remove": "_untrackClassesElement"
  13376. });
  13377. if (options.keys) {
  13378. processClassString(options.keys.match(/\S+/g) || [], true);
  13379. }
  13380. if (options.extra) {
  13381. processClassString(options.extra.match(/\S+/g) || []);
  13382. }
  13383. return full.join(" ");
  13384. },
  13385. _untrackClassesElement: function _untrackClassesElement(event) {
  13386. var that = this;
  13387. $.each(that.classesElementLookup, function (key, value) {
  13388. if ($.inArray(event.target, value) !== -1) {
  13389. that.classesElementLookup[key] = $(value.not(event.target).get());
  13390. }
  13391. });
  13392. },
  13393. _removeClass: function _removeClass(element, keys, extra) {
  13394. return this._toggleClass(element, keys, extra, false);
  13395. },
  13396. _addClass: function _addClass(element, keys, extra) {
  13397. return this._toggleClass(element, keys, extra, true);
  13398. },
  13399. _toggleClass: function _toggleClass(element, keys, extra, add) {
  13400. add = typeof add === "boolean" ? add : extra;
  13401. var shift = typeof element === "string" || element === null,
  13402. options = {
  13403. extra: shift ? keys : extra,
  13404. keys: shift ? element : keys,
  13405. element: shift ? this.element : element,
  13406. add: add
  13407. };
  13408. options.element.toggleClass(this._classes(options), add);
  13409. return this;
  13410. },
  13411. _on: function _on(suppressDisabledCheck, element, handlers) {
  13412. var delegateElement;
  13413. var instance = this;
  13414. // No suppressDisabledCheck flag, shuffle arguments
  13415. if (typeof suppressDisabledCheck !== "boolean") {
  13416. handlers = element;
  13417. element = suppressDisabledCheck;
  13418. suppressDisabledCheck = false;
  13419. }
  13420. // No element argument, shuffle and use this.element
  13421. if (!handlers) {
  13422. handlers = element;
  13423. element = this.element;
  13424. delegateElement = this.widget();
  13425. } else {
  13426. element = delegateElement = $(element);
  13427. this.bindings = this.bindings.add(element);
  13428. }
  13429. $.each(handlers, function (event, handler) {
  13430. function handlerProxy() {
  13431. // Allow widgets to customize the disabled handling
  13432. // - disabled as an array instead of boolean
  13433. // - disabled class as method for disabling individual parts
  13434. if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) {
  13435. return;
  13436. }
  13437. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13438. }
  13439. // Copy the guid so direct unbinding works
  13440. if (typeof handler !== "string") {
  13441. handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++;
  13442. }
  13443. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  13444. var eventName = match[1] + instance.eventNamespace;
  13445. var selector = match[2];
  13446. if (selector) {
  13447. delegateElement.on(eventName, selector, handlerProxy);
  13448. } else {
  13449. element.on(eventName, handlerProxy);
  13450. }
  13451. });
  13452. },
  13453. _off: function _off(element, eventName) {
  13454. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
  13455. element.off(eventName).off(eventName);
  13456. // Clear the stack to avoid memory leaks (#10056)
  13457. this.bindings = $(this.bindings.not(element).get());
  13458. this.focusable = $(this.focusable.not(element).get());
  13459. this.hoverable = $(this.hoverable.not(element).get());
  13460. },
  13461. _delay: function _delay(handler, delay) {
  13462. function handlerProxy() {
  13463. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13464. }
  13465. var instance = this;
  13466. return setTimeout(handlerProxy, delay || 0);
  13467. },
  13468. _hoverable: function _hoverable(element) {
  13469. this.hoverable = this.hoverable.add(element);
  13470. this._on(element, {
  13471. mouseenter: function mouseenter(event) {
  13472. this._addClass($(event.currentTarget), null, "ui-state-hover");
  13473. },
  13474. mouseleave: function mouseleave(event) {
  13475. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  13476. }
  13477. });
  13478. },
  13479. _focusable: function _focusable(element) {
  13480. this.focusable = this.focusable.add(element);
  13481. this._on(element, {
  13482. focusin: function focusin(event) {
  13483. this._addClass($(event.currentTarget), null, "ui-state-focus");
  13484. },
  13485. focusout: function focusout(event) {
  13486. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  13487. }
  13488. });
  13489. },
  13490. _trigger: function _trigger(type, event, data) {
  13491. var prop, orig;
  13492. var callback = this.options[type];
  13493. data = data || {};
  13494. event = $.Event(event);
  13495. event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
  13496. // The original event may come from any element
  13497. // so we need to reset the target on the new event
  13498. event.target = this.element[0];
  13499. // Copy original event properties over to the new event
  13500. orig = event.originalEvent;
  13501. if (orig) {
  13502. for (prop in orig) {
  13503. if (!(prop in event)) {
  13504. event[prop] = orig[prop];
  13505. }
  13506. }
  13507. }
  13508. this.element.trigger(event, data);
  13509. return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented());
  13510. }
  13511. };
  13512. $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
  13513. $.Widget.prototype["_" + method] = function (element, options, callback) {
  13514. if (typeof options === "string") {
  13515. options = { effect: options };
  13516. }
  13517. var hasOptions;
  13518. var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
  13519. options = options || {};
  13520. if (typeof options === "number") {
  13521. options = { duration: options };
  13522. }
  13523. hasOptions = !$.isEmptyObject(options);
  13524. options.complete = callback;
  13525. if (options.delay) {
  13526. element.delay(options.delay);
  13527. }
  13528. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  13529. element[method](options);
  13530. } else if (effectName !== method && element[effectName]) {
  13531. element[effectName](options.duration, options.easing, callback);
  13532. } else {
  13533. element.queue(function (next) {
  13534. $(this)[method]();
  13535. if (callback) {
  13536. callback.call(element[0]);
  13537. }
  13538. next();
  13539. });
  13540. }
  13541. };
  13542. });
  13543. var widget = $.widget;
  13544. /*!
  13545. * jQuery UI Keycode 1.12.1
  13546. * http://jqueryui.com
  13547. *
  13548. * Copyright jQuery Foundation and other contributors
  13549. * Released under the MIT license.
  13550. * http://jquery.org/license
  13551. */
  13552. //>>label: Keycode
  13553. //>>group: Core
  13554. //>>description: Provide keycodes as keynames
  13555. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  13556. var keycode = $.ui.keyCode = {
  13557. BACKSPACE: 8,
  13558. COMMA: 188,
  13559. DELETE: 46,
  13560. DOWN: 40,
  13561. END: 35,
  13562. ENTER: 13,
  13563. ESCAPE: 27,
  13564. HOME: 36,
  13565. LEFT: 37,
  13566. PAGE_DOWN: 34,
  13567. PAGE_UP: 33,
  13568. PERIOD: 190,
  13569. RIGHT: 39,
  13570. SPACE: 32,
  13571. TAB: 9,
  13572. UP: 38
  13573. };
  13574. // This file is deprecated
  13575. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  13576. /*!
  13577. * jQuery UI Mouse 1.12.1
  13578. * http://jqueryui.com
  13579. *
  13580. * Copyright jQuery Foundation and other contributors
  13581. * Released under the MIT license.
  13582. * http://jquery.org/license
  13583. */
  13584. //>>label: Mouse
  13585. //>>group: Widgets
  13586. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  13587. //>>docs: http://api.jqueryui.com/mouse/
  13588. var mouseHandled = false;
  13589. $(document).on("mouseup", function () {
  13590. mouseHandled = false;
  13591. });
  13592. var widgetsMouse = $.widget("ui.mouse", {
  13593. version: "1.12.1",
  13594. options: {
  13595. cancel: "input, textarea, button, select, option",
  13596. distance: 1,
  13597. delay: 0
  13598. },
  13599. _mouseInit: function _mouseInit() {
  13600. var that = this;
  13601. this.element.on("mousedown." + this.widgetName, function (event) {
  13602. return that._mouseDown(event);
  13603. }).on("click." + this.widgetName, function (event) {
  13604. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  13605. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  13606. event.stopImmediatePropagation();
  13607. return false;
  13608. }
  13609. });
  13610. this.started = false;
  13611. },
  13612. // TODO: make sure destroying one instance of mouse doesn't mess with
  13613. // other instances of mouse
  13614. _mouseDestroy: function _mouseDestroy() {
  13615. this.element.off("." + this.widgetName);
  13616. if (this._mouseMoveDelegate) {
  13617. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13618. }
  13619. },
  13620. _mouseDown: function _mouseDown(event) {
  13621. // don't let more than one widget handle mouseStart
  13622. if (mouseHandled) {
  13623. return;
  13624. }
  13625. this._mouseMoved = false;
  13626. // We may have missed mouseup (out of window)
  13627. this._mouseStarted && this._mouseUp(event);
  13628. this._mouseDownEvent = event;
  13629. var that = this,
  13630. btnIsLeft = event.which === 1,
  13631. // event.target.nodeName works around a bug in IE 8 with
  13632. // disabled inputs (#7620)
  13633. elIsCancel = typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false;
  13634. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  13635. return true;
  13636. }
  13637. this.mouseDelayMet = !this.options.delay;
  13638. if (!this.mouseDelayMet) {
  13639. this._mouseDelayTimer = setTimeout(function () {
  13640. that.mouseDelayMet = true;
  13641. }, this.options.delay);
  13642. }
  13643. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13644. this._mouseStarted = this._mouseStart(event) !== false;
  13645. if (!this._mouseStarted) {
  13646. event.preventDefault();
  13647. return true;
  13648. }
  13649. }
  13650. // Click event may never have fired (Gecko & Opera)
  13651. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  13652. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  13653. }
  13654. // These delegates are required to keep context
  13655. this._mouseMoveDelegate = function (event) {
  13656. return that._mouseMove(event);
  13657. };
  13658. this._mouseUpDelegate = function (event) {
  13659. return that._mouseUp(event);
  13660. };
  13661. this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
  13662. event.preventDefault();
  13663. mouseHandled = true;
  13664. return true;
  13665. },
  13666. _mouseMove: function _mouseMove(event) {
  13667. // Only check for mouseups outside the document if you've moved inside the document
  13668. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  13669. // fire a mousemove event if content is placed under the cursor. See #7778
  13670. // Support: IE <9
  13671. if (this._mouseMoved) {
  13672. // IE mouseup check - mouseup happened when mouse was out of window
  13673. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) {
  13674. return this._mouseUp(event);
  13675. // Iframe mouseup check - mouseup occurred in another document
  13676. } else if (!event.which) {
  13677. // Support: Safari <=8 - 9
  13678. // Safari sets which to 0 if you press any of the following keys
  13679. // during a drag (#14461)
  13680. if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  13681. this.ignoreMissingWhich = true;
  13682. } else if (!this.ignoreMissingWhich) {
  13683. return this._mouseUp(event);
  13684. }
  13685. }
  13686. }
  13687. if (event.which || event.button) {
  13688. this._mouseMoved = true;
  13689. }
  13690. if (this._mouseStarted) {
  13691. this._mouseDrag(event);
  13692. return event.preventDefault();
  13693. }
  13694. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13695. this._mouseStarted = this._mouseStart(this._mouseDownEvent, event) !== false;
  13696. this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event);
  13697. }
  13698. return !this._mouseStarted;
  13699. },
  13700. _mouseUp: function _mouseUp(event) {
  13701. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13702. if (this._mouseStarted) {
  13703. this._mouseStarted = false;
  13704. if (event.target === this._mouseDownEvent.target) {
  13705. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  13706. }
  13707. this._mouseStop(event);
  13708. }
  13709. if (this._mouseDelayTimer) {
  13710. clearTimeout(this._mouseDelayTimer);
  13711. delete this._mouseDelayTimer;
  13712. }
  13713. this.ignoreMissingWhich = false;
  13714. mouseHandled = false;
  13715. event.preventDefault();
  13716. },
  13717. _mouseDistanceMet: function _mouseDistanceMet(event) {
  13718. return Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance;
  13719. },
  13720. _mouseDelayMet: function _mouseDelayMet() /* event */{
  13721. return this.mouseDelayMet;
  13722. },
  13723. // These are placeholder methods, to be overriden by extending plugin
  13724. _mouseStart: function _mouseStart() /* event */{},
  13725. _mouseDrag: function _mouseDrag() /* event */{},
  13726. _mouseStop: function _mouseStop() /* event */{},
  13727. _mouseCapture: function _mouseCapture() /* event */{
  13728. return true;
  13729. }
  13730. });
  13731. /*!
  13732. * jQuery UI Slider 1.12.1
  13733. * http://jqueryui.com
  13734. *
  13735. * Copyright jQuery Foundation and other contributors
  13736. * Released under the MIT license.
  13737. * http://jquery.org/license
  13738. */
  13739. //>>label: Slider
  13740. //>>group: Widgets
  13741. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  13742. //>>docs: http://api.jqueryui.com/slider/
  13743. //>>demos: http://jqueryui.com/slider/
  13744. //>>css.structure: ../../themes/base/core.css
  13745. //>>css.structure: ../../themes/base/slider.css
  13746. //>>css.theme: ../../themes/base/theme.css
  13747. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  13748. version: "1.12.1",
  13749. widgetEventPrefix: "slide",
  13750. options: {
  13751. animate: false,
  13752. classes: {
  13753. "ui-slider": "ui-corner-all",
  13754. "ui-slider-handle": "ui-corner-all",
  13755. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  13756. // element, but worked best visually with a variety of themes
  13757. "ui-slider-range": "ui-corner-all ui-widget-header"
  13758. },
  13759. distance: 0,
  13760. max: 100,
  13761. min: 0,
  13762. orientation: "horizontal",
  13763. range: false,
  13764. step: 1,
  13765. value: 0,
  13766. values: null,
  13767. // Callbacks
  13768. change: null,
  13769. slide: null,
  13770. start: null,
  13771. stop: null
  13772. },
  13773. // Number of pages in a slider
  13774. // (how many times can you page up/down to go through the whole range)
  13775. numPages: 5,
  13776. _create: function _create() {
  13777. this._keySliding = false;
  13778. this._mouseSliding = false;
  13779. this._animateOff = true;
  13780. this._handleIndex = null;
  13781. this._detectOrientation();
  13782. this._mouseInit();
  13783. this._calculateNewMax();
  13784. this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content");
  13785. this._refresh();
  13786. this._animateOff = false;
  13787. },
  13788. _refresh: function _refresh() {
  13789. this._createRange();
  13790. this._createHandles();
  13791. this._setupEvents();
  13792. this._refreshValue();
  13793. },
  13794. _createHandles: function _createHandles() {
  13795. var i,
  13796. handleCount,
  13797. options = this.options,
  13798. existingHandles = this.element.find(".ui-slider-handle"),
  13799. handle = "<span tabindex='0'></span>",
  13800. handles = [];
  13801. handleCount = options.values && options.values.length || 1;
  13802. if (existingHandles.length > handleCount) {
  13803. existingHandles.slice(handleCount).remove();
  13804. existingHandles = existingHandles.slice(0, handleCount);
  13805. }
  13806. for (i = existingHandles.length; i < handleCount; i++) {
  13807. handles.push(handle);
  13808. }
  13809. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  13810. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  13811. this.handle = this.handles.eq(0);
  13812. this.handles.each(function (i) {
  13813. $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0);
  13814. });
  13815. },
  13816. _createRange: function _createRange() {
  13817. var options = this.options;
  13818. if (options.range) {
  13819. if (options.range === true) {
  13820. if (!options.values) {
  13821. options.values = [this._valueMin(), this._valueMin()];
  13822. } else if (options.values.length && options.values.length !== 2) {
  13823. options.values = [options.values[0], options.values[0]];
  13824. } else if ($.isArray(options.values)) {
  13825. options.values = options.values.slice(0);
  13826. }
  13827. }
  13828. if (!this.range || !this.range.length) {
  13829. this.range = $("<div>").appendTo(this.element);
  13830. this._addClass(this.range, "ui-slider-range");
  13831. } else {
  13832. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  13833. // Handle range switching from true to min/max
  13834. this.range.css({
  13835. "left": "",
  13836. "bottom": ""
  13837. });
  13838. }
  13839. if (options.range === "min" || options.range === "max") {
  13840. this._addClass(this.range, "ui-slider-range-" + options.range);
  13841. }
  13842. } else {
  13843. if (this.range) {
  13844. this.range.remove();
  13845. }
  13846. this.range = null;
  13847. }
  13848. },
  13849. _setupEvents: function _setupEvents() {
  13850. this._off(this.handles);
  13851. this._on(this.handles, this._handleEvents);
  13852. this._hoverable(this.handles);
  13853. this._focusable(this.handles);
  13854. },
  13855. _destroy: function _destroy() {
  13856. this.handles.remove();
  13857. if (this.range) {
  13858. this.range.remove();
  13859. }
  13860. this._mouseDestroy();
  13861. },
  13862. _mouseCapture: function _mouseCapture(event) {
  13863. var position,
  13864. normValue,
  13865. distance,
  13866. closestHandle,
  13867. index,
  13868. allowed,
  13869. offset,
  13870. mouseOverHandle,
  13871. that = this,
  13872. o = this.options;
  13873. if (o.disabled) {
  13874. return false;
  13875. }
  13876. this.elementSize = {
  13877. width: this.element.outerWidth(),
  13878. height: this.element.outerHeight()
  13879. };
  13880. this.elementOffset = this.element.offset();
  13881. position = { x: event.pageX, y: event.pageY };
  13882. normValue = this._normValueFromMouse(position);
  13883. distance = this._valueMax() - this._valueMin() + 1;
  13884. this.handles.each(function (i) {
  13885. var thisDistance = Math.abs(normValue - that.values(i));
  13886. if (distance > thisDistance || distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min)) {
  13887. distance = thisDistance;
  13888. closestHandle = $(this);
  13889. index = i;
  13890. }
  13891. });
  13892. allowed = this._start(event, index);
  13893. if (allowed === false) {
  13894. return false;
  13895. }
  13896. this._mouseSliding = true;
  13897. this._handleIndex = index;
  13898. this._addClass(closestHandle, null, "ui-state-active");
  13899. closestHandle.trigger("focus");
  13900. offset = closestHandle.offset();
  13901. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  13902. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  13903. left: event.pageX - offset.left - closestHandle.width() / 2,
  13904. 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)
  13905. };
  13906. if (!this.handles.hasClass("ui-state-hover")) {
  13907. this._slide(event, index, normValue);
  13908. }
  13909. this._animateOff = true;
  13910. return true;
  13911. },
  13912. _mouseStart: function _mouseStart() {
  13913. return true;
  13914. },
  13915. _mouseDrag: function _mouseDrag(event) {
  13916. var position = { x: event.pageX, y: event.pageY },
  13917. normValue = this._normValueFromMouse(position);
  13918. this._slide(event, this._handleIndex, normValue);
  13919. return false;
  13920. },
  13921. _mouseStop: function _mouseStop(event) {
  13922. this._removeClass(this.handles, null, "ui-state-active");
  13923. this._mouseSliding = false;
  13924. this._stop(event, this._handleIndex);
  13925. this._change(event, this._handleIndex);
  13926. this._handleIndex = null;
  13927. this._clickOffset = null;
  13928. this._animateOff = false;
  13929. return false;
  13930. },
  13931. _detectOrientation: function _detectOrientation() {
  13932. this.orientation = this.options.orientation === "vertical" ? "vertical" : "horizontal";
  13933. },
  13934. _normValueFromMouse: function _normValueFromMouse(position) {
  13935. var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse;
  13936. if (this.orientation === "horizontal") {
  13937. pixelTotal = this.elementSize.width;
  13938. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  13939. } else {
  13940. pixelTotal = this.elementSize.height;
  13941. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  13942. }
  13943. percentMouse = pixelMouse / pixelTotal;
  13944. if (percentMouse > 1) {
  13945. percentMouse = 1;
  13946. }
  13947. if (percentMouse < 0) {
  13948. percentMouse = 0;
  13949. }
  13950. if (this.orientation === "vertical") {
  13951. percentMouse = 1 - percentMouse;
  13952. }
  13953. valueTotal = this._valueMax() - this._valueMin();
  13954. valueMouse = this._valueMin() + percentMouse * valueTotal;
  13955. return this._trimAlignValue(valueMouse);
  13956. },
  13957. _uiHash: function _uiHash(index, value, values) {
  13958. var uiHash = {
  13959. handle: this.handles[index],
  13960. handleIndex: index,
  13961. value: value !== undefined ? value : this.value()
  13962. };
  13963. if (this._hasMultipleValues()) {
  13964. uiHash.value = value !== undefined ? value : this.values(index);
  13965. uiHash.values = values || this.values();
  13966. }
  13967. return uiHash;
  13968. },
  13969. _hasMultipleValues: function _hasMultipleValues() {
  13970. return this.options.values && this.options.values.length;
  13971. },
  13972. _start: function _start(event, index) {
  13973. return this._trigger("start", event, this._uiHash(index));
  13974. },
  13975. _slide: function _slide(event, index, newVal) {
  13976. var allowed,
  13977. otherVal,
  13978. currentValue = this.value(),
  13979. newValues = this.values();
  13980. if (this._hasMultipleValues()) {
  13981. otherVal = this.values(index ? 0 : 1);
  13982. currentValue = this.values(index);
  13983. if (this.options.values.length === 2 && this.options.range === true) {
  13984. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  13985. }
  13986. newValues[index] = newVal;
  13987. }
  13988. if (newVal === currentValue) {
  13989. return;
  13990. }
  13991. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  13992. // A slide can be canceled by returning false from the slide callback
  13993. if (allowed === false) {
  13994. return;
  13995. }
  13996. if (this._hasMultipleValues()) {
  13997. this.values(index, newVal);
  13998. } else {
  13999. this.value(newVal);
  14000. }
  14001. },
  14002. _stop: function _stop(event, index) {
  14003. this._trigger("stop", event, this._uiHash(index));
  14004. },
  14005. _change: function _change(event, index) {
  14006. if (!this._keySliding && !this._mouseSliding) {
  14007. //store the last changed value index for reference when handles overlap
  14008. this._lastChangedValue = index;
  14009. this._trigger("change", event, this._uiHash(index));
  14010. }
  14011. },
  14012. value: function value(newValue) {
  14013. if (arguments.length) {
  14014. this.options.value = this._trimAlignValue(newValue);
  14015. this._refreshValue();
  14016. this._change(null, 0);
  14017. return;
  14018. }
  14019. return this._value();
  14020. },
  14021. values: function values(index, newValue) {
  14022. var vals, newValues, i;
  14023. if (arguments.length > 1) {
  14024. this.options.values[index] = this._trimAlignValue(newValue);
  14025. this._refreshValue();
  14026. this._change(null, index);
  14027. return;
  14028. }
  14029. if (arguments.length) {
  14030. if ($.isArray(arguments[0])) {
  14031. vals = this.options.values;
  14032. newValues = arguments[0];
  14033. for (i = 0; i < vals.length; i += 1) {
  14034. vals[i] = this._trimAlignValue(newValues[i]);
  14035. this._change(null, i);
  14036. }
  14037. this._refreshValue();
  14038. } else {
  14039. if (this._hasMultipleValues()) {
  14040. return this._values(index);
  14041. } else {
  14042. return this.value();
  14043. }
  14044. }
  14045. } else {
  14046. return this._values();
  14047. }
  14048. },
  14049. _setOption: function _setOption(key, value) {
  14050. var i,
  14051. valsLength = 0;
  14052. if (key === "range" && this.options.range === true) {
  14053. if (value === "min") {
  14054. this.options.value = this._values(0);
  14055. this.options.values = null;
  14056. } else if (value === "max") {
  14057. this.options.value = this._values(this.options.values.length - 1);
  14058. this.options.values = null;
  14059. }
  14060. }
  14061. if ($.isArray(this.options.values)) {
  14062. valsLength = this.options.values.length;
  14063. }
  14064. this._super(key, value);
  14065. switch (key) {
  14066. case "orientation":
  14067. this._detectOrientation();
  14068. this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation);
  14069. this._refreshValue();
  14070. if (this.options.range) {
  14071. this._refreshRange(value);
  14072. }
  14073. // Reset positioning from previous orientation
  14074. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  14075. break;
  14076. case "value":
  14077. this._animateOff = true;
  14078. this._refreshValue();
  14079. this._change(null, 0);
  14080. this._animateOff = false;
  14081. break;
  14082. case "values":
  14083. this._animateOff = true;
  14084. this._refreshValue();
  14085. // Start from the last handle to prevent unreachable handles (#9046)
  14086. for (i = valsLength - 1; i >= 0; i--) {
  14087. this._change(null, i);
  14088. }
  14089. this._animateOff = false;
  14090. break;
  14091. case "step":
  14092. case "min":
  14093. case "max":
  14094. this._animateOff = true;
  14095. this._calculateNewMax();
  14096. this._refreshValue();
  14097. this._animateOff = false;
  14098. break;
  14099. case "range":
  14100. this._animateOff = true;
  14101. this._refresh();
  14102. this._animateOff = false;
  14103. break;
  14104. }
  14105. },
  14106. _setOptionDisabled: function _setOptionDisabled(value) {
  14107. this._super(value);
  14108. this._toggleClass(null, "ui-state-disabled", !!value);
  14109. },
  14110. //internal value getter
  14111. // _value() returns value trimmed by min and max, aligned by step
  14112. _value: function _value() {
  14113. var val = this.options.value;
  14114. val = this._trimAlignValue(val);
  14115. return val;
  14116. },
  14117. //internal values getter
  14118. // _values() returns array of values trimmed by min and max, aligned by step
  14119. // _values( index ) returns single value trimmed by min and max, aligned by step
  14120. _values: function _values(index) {
  14121. var val, vals, i;
  14122. if (arguments.length) {
  14123. val = this.options.values[index];
  14124. val = this._trimAlignValue(val);
  14125. return val;
  14126. } else if (this._hasMultipleValues()) {
  14127. // .slice() creates a copy of the array
  14128. // this copy gets trimmed by min and max and then returned
  14129. vals = this.options.values.slice();
  14130. for (i = 0; i < vals.length; i += 1) {
  14131. vals[i] = this._trimAlignValue(vals[i]);
  14132. }
  14133. return vals;
  14134. } else {
  14135. return [];
  14136. }
  14137. },
  14138. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  14139. _trimAlignValue: function _trimAlignValue(val) {
  14140. if (val <= this._valueMin()) {
  14141. return this._valueMin();
  14142. }
  14143. if (val >= this._valueMax()) {
  14144. return this._valueMax();
  14145. }
  14146. var step = this.options.step > 0 ? this.options.step : 1,
  14147. valModStep = (val - this._valueMin()) % step,
  14148. alignValue = val - valModStep;
  14149. if (Math.abs(valModStep) * 2 >= step) {
  14150. alignValue += valModStep > 0 ? step : -step;
  14151. }
  14152. // Since JavaScript has problems with large floats, round
  14153. // the final value to 5 digits after the decimal point (see #4124)
  14154. return parseFloat(alignValue.toFixed(5));
  14155. },
  14156. _calculateNewMax: function _calculateNewMax() {
  14157. var max = this.options.max,
  14158. min = this._valueMin(),
  14159. step = this.options.step,
  14160. aboveMin = Math.round((max - min) / step) * step;
  14161. max = aboveMin + min;
  14162. if (max > this.options.max) {
  14163. //If max is not divisible by step, rounding off may increase its value
  14164. max -= step;
  14165. }
  14166. this.max = parseFloat(max.toFixed(this._precision()));
  14167. },
  14168. _precision: function _precision() {
  14169. var precision = this._precisionOf(this.options.step);
  14170. if (this.options.min !== null) {
  14171. precision = Math.max(precision, this._precisionOf(this.options.min));
  14172. }
  14173. return precision;
  14174. },
  14175. _precisionOf: function _precisionOf(num) {
  14176. var str = num.toString(),
  14177. decimal = str.indexOf(".");
  14178. return decimal === -1 ? 0 : str.length - decimal - 1;
  14179. },
  14180. _valueMin: function _valueMin() {
  14181. return this.options.min;
  14182. },
  14183. _valueMax: function _valueMax() {
  14184. return this.max;
  14185. },
  14186. _refreshRange: function _refreshRange(orientation) {
  14187. if (orientation === "vertical") {
  14188. this.range.css({ "width": "", "left": "" });
  14189. }
  14190. if (orientation === "horizontal") {
  14191. this.range.css({ "height": "", "bottom": "" });
  14192. }
  14193. },
  14194. _refreshValue: function _refreshValue() {
  14195. var lastValPercent,
  14196. valPercent,
  14197. value,
  14198. valueMin,
  14199. valueMax,
  14200. oRange = this.options.range,
  14201. o = this.options,
  14202. that = this,
  14203. animate = !this._animateOff ? o.animate : false,
  14204. _set = {};
  14205. if (this._hasMultipleValues()) {
  14206. this.handles.each(function (i) {
  14207. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100;
  14208. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14209. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14210. if (that.options.range === true) {
  14211. if (that.orientation === "horizontal") {
  14212. if (i === 0) {
  14213. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14214. left: valPercent + "%"
  14215. }, o.animate);
  14216. }
  14217. if (i === 1) {
  14218. that.range[animate ? "animate" : "css"]({
  14219. width: valPercent - lastValPercent + "%"
  14220. }, {
  14221. queue: false,
  14222. duration: o.animate
  14223. });
  14224. }
  14225. } else {
  14226. if (i === 0) {
  14227. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14228. bottom: valPercent + "%"
  14229. }, o.animate);
  14230. }
  14231. if (i === 1) {
  14232. that.range[animate ? "animate" : "css"]({
  14233. height: valPercent - lastValPercent + "%"
  14234. }, {
  14235. queue: false,
  14236. duration: o.animate
  14237. });
  14238. }
  14239. }
  14240. }
  14241. lastValPercent = valPercent;
  14242. });
  14243. } else {
  14244. value = this.value();
  14245. valueMin = this._valueMin();
  14246. valueMax = this._valueMax();
  14247. valPercent = valueMax !== valueMin ? (value - valueMin) / (valueMax - valueMin) * 100 : 0;
  14248. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14249. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14250. if (oRange === "min" && this.orientation === "horizontal") {
  14251. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14252. width: valPercent + "%"
  14253. }, o.animate);
  14254. }
  14255. if (oRange === "max" && this.orientation === "horizontal") {
  14256. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14257. width: 100 - valPercent + "%"
  14258. }, o.animate);
  14259. }
  14260. if (oRange === "min" && this.orientation === "vertical") {
  14261. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14262. height: valPercent + "%"
  14263. }, o.animate);
  14264. }
  14265. if (oRange === "max" && this.orientation === "vertical") {
  14266. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14267. height: 100 - valPercent + "%"
  14268. }, o.animate);
  14269. }
  14270. }
  14271. },
  14272. _handleEvents: {
  14273. keydown: function keydown(event) {
  14274. var allowed,
  14275. curVal,
  14276. newVal,
  14277. step,
  14278. index = $(event.target).data("ui-slider-handle-index");
  14279. switch (event.keyCode) {
  14280. case $.ui.keyCode.HOME:
  14281. case $.ui.keyCode.END:
  14282. case $.ui.keyCode.PAGE_UP:
  14283. case $.ui.keyCode.PAGE_DOWN:
  14284. case $.ui.keyCode.UP:
  14285. case $.ui.keyCode.RIGHT:
  14286. case $.ui.keyCode.DOWN:
  14287. case $.ui.keyCode.LEFT:
  14288. event.preventDefault();
  14289. if (!this._keySliding) {
  14290. this._keySliding = true;
  14291. this._addClass($(event.target), null, "ui-state-active");
  14292. allowed = this._start(event, index);
  14293. if (allowed === false) {
  14294. return;
  14295. }
  14296. }
  14297. break;
  14298. }
  14299. step = this.options.step;
  14300. if (this._hasMultipleValues()) {
  14301. curVal = newVal = this.values(index);
  14302. } else {
  14303. curVal = newVal = this.value();
  14304. }
  14305. switch (event.keyCode) {
  14306. case $.ui.keyCode.HOME:
  14307. newVal = this._valueMin();
  14308. break;
  14309. case $.ui.keyCode.END:
  14310. newVal = this._valueMax();
  14311. break;
  14312. case $.ui.keyCode.PAGE_UP:
  14313. newVal = this._trimAlignValue(curVal + (this._valueMax() - this._valueMin()) / this.numPages);
  14314. break;
  14315. case $.ui.keyCode.PAGE_DOWN:
  14316. newVal = this._trimAlignValue(curVal - (this._valueMax() - this._valueMin()) / this.numPages);
  14317. break;
  14318. case $.ui.keyCode.UP:
  14319. case $.ui.keyCode.RIGHT:
  14320. if (curVal === this._valueMax()) {
  14321. return;
  14322. }
  14323. newVal = this._trimAlignValue(curVal + step);
  14324. break;
  14325. case $.ui.keyCode.DOWN:
  14326. case $.ui.keyCode.LEFT:
  14327. if (curVal === this._valueMin()) {
  14328. return;
  14329. }
  14330. newVal = this._trimAlignValue(curVal - step);
  14331. break;
  14332. }
  14333. this._slide(event, index, newVal);
  14334. },
  14335. keyup: function keyup(event) {
  14336. var index = $(event.target).data("ui-slider-handle-index");
  14337. if (this._keySliding) {
  14338. this._keySliding = false;
  14339. this._stop(event, index);
  14340. this._change(event, index);
  14341. this._removeClass($(event.target), null, "ui-state-active");
  14342. }
  14343. }
  14344. }
  14345. });
  14346. });
  14347. /***/ }),
  14348. /* 33 */
  14349. /***/ (function(module, exports, __webpack_require__) {
  14350. "use strict";
  14351. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14352. 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; };
  14353. (function (global, factory) {
  14354. ( false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14355. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14356. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14357. __WEBPACK_AMD_DEFINE_FACTORY__),
  14358. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : global.StickySidebar = factory();
  14359. })(undefined, function () {
  14360. 'use strict';
  14361. var _createClass = function () {
  14362. function defineProperties(target, props) {
  14363. for (var i = 0; i < props.length; i++) {
  14364. 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);
  14365. }
  14366. }return function (Constructor, protoProps, staticProps) {
  14367. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  14368. };
  14369. }();
  14370. function _classCallCheck(instance, Constructor) {
  14371. if (!(instance instanceof Constructor)) {
  14372. throw new TypeError("Cannot call a class as a function");
  14373. }
  14374. }
  14375. /**
  14376. * Sticky Sidebar JavaScript Plugin.
  14377. * @version 3.2.0
  14378. * @autor ThurData <info@thurdata.ch>
  14379. * @license The MIT License (MIT)
  14380. */
  14381. var StickySidebar = function () {
  14382. // ---------------------------------
  14383. // # Define Constants
  14384. // ---------------------------------
  14385. //
  14386. var EVENT_KEY = '.stickySidebar';
  14387. var DEFAULTS = {
  14388. /**
  14389. * Additional top spacing of the element when it becomes sticky.
  14390. * @type {Numeric|Function}
  14391. */
  14392. topSpacing: 0,
  14393. /**
  14394. * Additional bottom spacing of the element when it becomes sticky.
  14395. * @type {Numeric|Function}
  14396. */
  14397. bottomSpacing: 0,
  14398. /**
  14399. * Container sidebar selector to know what the beginning and end of sticky element.
  14400. * @type {String|False}
  14401. */
  14402. containerSelector: false,
  14403. /**
  14404. * Inner wrapper selector.
  14405. * @type {String}
  14406. */
  14407. innerWrapperSelector: '.inner-wrapper-sticky',
  14408. /**
  14409. * The name of CSS class to apply to elements when they have become stuck.
  14410. * @type {String|False}
  14411. */
  14412. stickyClass: 'is-affixed',
  14413. /**
  14414. * Detect when sidebar and its container change height so re-calculate their dimensions.
  14415. * @type {Boolean}
  14416. */
  14417. resizeSensor: true,
  14418. /**
  14419. * The sidebar returns to its normal position if its width below this value.
  14420. * @type {Numeric}
  14421. */
  14422. minWidth: false
  14423. };
  14424. // ---------------------------------
  14425. // # Class Definition
  14426. // ---------------------------------
  14427. //
  14428. /**
  14429. * Sticky Sidebar Class.
  14430. * @public
  14431. */
  14432. var StickySidebar = function () {
  14433. /**
  14434. * Sticky Sidebar Constructor.
  14435. * @constructor
  14436. * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
  14437. * @param {Object} options - The options of sticky sidebar.
  14438. */
  14439. function StickySidebar(sidebar) {
  14440. var _this = this;
  14441. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  14442. _classCallCheck(this, StickySidebar);
  14443. this.options = StickySidebar.extend(DEFAULTS, options);
  14444. // Sidebar element query if there's no one, throw error.
  14445. this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
  14446. if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
  14447. this.sidebarInner = false;
  14448. this.container = this.sidebar.parentElement;
  14449. // Current Affix Type of sidebar element.
  14450. this.affixedType = 'STATIC';
  14451. this.direction = 'down';
  14452. this.support = {
  14453. transform: false,
  14454. transform3d: false
  14455. };
  14456. this._initialized = false;
  14457. this._breakpoint = false;
  14458. this._resizeListeners = [];
  14459. // Dimenstions of sidebar, container and screen viewport.
  14460. this.dimensions = {
  14461. translateY: 0,
  14462. topSpacing: 0,
  14463. bottomSpacing: 0,
  14464. sidebarHeight: 0,
  14465. sidebarWidth: 0,
  14466. containerTop: 0,
  14467. containerHeight: 0,
  14468. viewportHeight: 0,
  14469. viewportTop: 0,
  14470. lastViewportTop: 0
  14471. };
  14472. // Bind event handlers for referencability.
  14473. ['handleEvent'].forEach(function (method) {
  14474. _this[method] = _this[method].bind(_this);
  14475. });
  14476. // Initialize sticky sidebar for first time.
  14477. this.initialize();
  14478. }
  14479. /**
  14480. * Initializes the sticky sidebar by adding inner wrapper, define its container,
  14481. * min-width breakpoint, calculating dimenstions, adding helper classes and inline style.
  14482. * @private
  14483. */
  14484. _createClass(StickySidebar, [{
  14485. key: 'initialize',
  14486. value: function initialize() {
  14487. var _this2 = this;
  14488. this._setSupportFeatures();
  14489. // Get sticky sidebar inner wrapper, if not found, will create one.
  14490. if (this.options.innerWrapperSelector) {
  14491. this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
  14492. if (null === this.sidebarInner) this.sidebarInner = false;
  14493. }
  14494. if (!this.sidebarInner) {
  14495. var wrapper = document.createElement('div');
  14496. wrapper.setAttribute('class', 'inner-wrapper-sticky');
  14497. this.sidebar.appendChild(wrapper);
  14498. while (this.sidebar.firstChild != wrapper) {
  14499. wrapper.appendChild(this.sidebar.firstChild);
  14500. }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
  14501. }
  14502. // Container wrapper of the sidebar.
  14503. if (this.options.containerSelector) {
  14504. var containers = document.querySelectorAll(this.options.containerSelector);
  14505. containers = Array.prototype.slice.call(containers);
  14506. containers.forEach(function (container, item) {
  14507. if (!container.contains(_this2.sidebar)) return;
  14508. _this2.container = container;
  14509. });
  14510. if (!containers.length) throw new Error("The container does not contains on the sidebar.");
  14511. }
  14512. // If top/bottom spacing is not function parse value to integer.
  14513. if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
  14514. if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
  14515. // Breakdown sticky sidebar if screen width below `options.minWidth`.
  14516. this._widthBreakpoint();
  14517. // Calculate dimensions of sidebar, container and viewport.
  14518. this.calcDimensions();
  14519. // Affix sidebar in proper position.
  14520. this.stickyPosition();
  14521. // Bind all events.
  14522. this.bindEvents();
  14523. // Inform other properties the sticky sidebar is initialized.
  14524. this._initialized = true;
  14525. }
  14526. /**
  14527. * Bind all events of sticky sidebar plugin.
  14528. * @protected
  14529. */
  14530. }, {
  14531. key: 'bindEvents',
  14532. value: function bindEvents() {
  14533. window.addEventListener('resize', this, { passive: true });
  14534. window.addEventListener('scroll', this, { passive: true });
  14535. this.sidebar.addEventListener('update' + EVENT_KEY, this);
  14536. if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14537. new ResizeSensor(this.sidebarInner, this.handleEvent);
  14538. new ResizeSensor(this.container, this.handleEvent);
  14539. }
  14540. }
  14541. /**
  14542. * Handles all events of the plugin.
  14543. * @param {Object} event - Event object passed from listener.
  14544. */
  14545. }, {
  14546. key: 'handleEvent',
  14547. value: function handleEvent(event) {
  14548. this.updateSticky(event);
  14549. }
  14550. /**
  14551. * Calculates dimesntions of sidebar, container and screen viewpoint
  14552. * @public
  14553. */
  14554. }, {
  14555. key: 'calcDimensions',
  14556. value: function calcDimensions() {
  14557. if (this._breakpoint) return;
  14558. var dims = this.dimensions;
  14559. // Container of sticky sidebar dimensions.
  14560. dims.containerTop = StickySidebar.offsetRelative(this.container).top;
  14561. dims.containerHeight = this.container.clientHeight;
  14562. dims.containerBottom = dims.containerTop + dims.containerHeight;
  14563. // Sidebar dimensions.
  14564. dims.sidebarHeight = this.sidebarInner.offsetHeight;
  14565. dims.sidebarWidth = this.sidebar.offsetWidth;
  14566. // Screen viewport dimensions.
  14567. dims.viewportHeight = window.innerHeight;
  14568. this._calcDimensionsWithScroll();
  14569. }
  14570. /**
  14571. * Some dimensions values need to be up-to-date when scrolling the page.
  14572. * @private
  14573. */
  14574. }, {
  14575. key: '_calcDimensionsWithScroll',
  14576. value: function _calcDimensionsWithScroll() {
  14577. var dims = this.dimensions;
  14578. dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
  14579. dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
  14580. dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
  14581. dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  14582. dims.topSpacing = this.options.topSpacing;
  14583. dims.bottomSpacing = this.options.bottomSpacing;
  14584. if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
  14585. if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
  14586. }
  14587. /**
  14588. * Detarmine wheather the sidebar is bigger than viewport.
  14589. * @public
  14590. * @return {Boolean}
  14591. */
  14592. }, {
  14593. key: 'isSidebarFitsViewport',
  14594. value: function isSidebarFitsViewport() {
  14595. return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
  14596. }
  14597. /**
  14598. * Observe browser scrolling direction top and down.
  14599. */
  14600. }, {
  14601. key: 'observeScrollDir',
  14602. value: function observeScrollDir() {
  14603. var dims = this.dimensions;
  14604. if (dims.lastViewportTop === dims.viewportTop) return;
  14605. var furthest = 'down' === this.direction ? Math.min : Math.max;
  14606. // If the browser is scrolling not in the same direction.
  14607. if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
  14608. }
  14609. /**
  14610. * Gets affix type of sidebar according to current scrollTop and scrollLeft.
  14611. * Holds all logical affix of the sidebar when scrolling up and down and when sidebar
  14612. * is bigger than viewport and vice versa.
  14613. * @public
  14614. * @return {String|False} - Proper affix type.
  14615. */
  14616. }, {
  14617. key: 'getAffixType',
  14618. value: function getAffixType() {
  14619. var dims = this.dimensions,
  14620. affixType = false;
  14621. this._calcDimensionsWithScroll();
  14622. var sidebarBottom = dims.sidebarHeight + dims.containerTop;
  14623. var colliderTop = dims.viewportTop + dims.topSpacing;
  14624. var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
  14625. // When browser is scrolling top.
  14626. if ('up' === this.direction) {
  14627. if (colliderTop <= dims.containerTop) {
  14628. dims.translateY = 0;
  14629. affixType = 'STATIC';
  14630. } else if (colliderTop <= dims.translateY + dims.containerTop) {
  14631. dims.translateY = colliderTop - dims.containerTop;
  14632. affixType = 'VIEWPORT-TOP';
  14633. } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) {
  14634. affixType = 'VIEWPORT-UNBOTTOM';
  14635. }
  14636. // When browser is scrolling up.
  14637. } else {
  14638. // When sidebar element is not bigger than screen viewport.
  14639. if (this.isSidebarFitsViewport()) {
  14640. if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
  14641. dims.translateY = dims.containerBottom - sidebarBottom;
  14642. affixType = 'CONTAINER-BOTTOM';
  14643. } else if (colliderTop >= dims.containerTop) {
  14644. dims.translateY = colliderTop - dims.containerTop;
  14645. affixType = 'VIEWPORT-TOP';
  14646. }
  14647. // When sidebar element is bigger than screen viewport.
  14648. } else {
  14649. if (dims.containerBottom <= colliderBottom) {
  14650. dims.translateY = dims.containerBottom - sidebarBottom;
  14651. affixType = 'CONTAINER-BOTTOM';
  14652. } else if (sidebarBottom + dims.translateY <= colliderBottom) {
  14653. dims.translateY = colliderBottom - sidebarBottom;
  14654. affixType = 'VIEWPORT-BOTTOM';
  14655. } else if (dims.containerTop + dims.translateY <= colliderTop) {
  14656. affixType = 'VIEWPORT-UNBOTTOM';
  14657. }
  14658. }
  14659. }
  14660. // Make sure the translate Y is not bigger than container height.
  14661. dims.translateY = Math.max(0, dims.translateY);
  14662. dims.translateY = Math.min(dims.containerHeight, dims.translateY);
  14663. dims.lastViewportTop = dims.viewportTop;
  14664. return affixType;
  14665. }
  14666. /**
  14667. * Gets inline style of sticky sidebar wrapper and inner wrapper according
  14668. * to its affix type.
  14669. * @private
  14670. * @param {String} affixType - Affix type of sticky sidebar.
  14671. * @return {Object}
  14672. */
  14673. }, {
  14674. key: '_getStyle',
  14675. value: function _getStyle(affixType) {
  14676. if ('undefined' === typeof affixType) return;
  14677. var style = { inner: {}, outer: {} };
  14678. var dims = this.dimensions;
  14679. switch (affixType) {
  14680. case 'VIEWPORT-TOP':
  14681. style.inner = { position: 'fixed', top: this.options.topSpacing,
  14682. left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
  14683. break;
  14684. case 'VIEWPORT-BOTTOM':
  14685. style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
  14686. bottom: this.options.bottomSpacing, width: dims.sidebarWidth };
  14687. break;
  14688. case 'CONTAINER-BOTTOM':
  14689. case 'VIEWPORT-UNBOTTOM':
  14690. var translate = this._getTranslate(0, dims.translateY + 'px');
  14691. if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
  14692. break;
  14693. }
  14694. switch (affixType) {
  14695. case 'VIEWPORT-TOP':
  14696. case 'VIEWPORT-BOTTOM':
  14697. case 'VIEWPORT-UNBOTTOM':
  14698. case 'CONTAINER-BOTTOM':
  14699. style.outer = { height: dims.sidebarHeight, position: 'relative' };
  14700. break;
  14701. }
  14702. style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
  14703. style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
  14704. bottom: '', width: '', transform: this._getTranslate() }, style.inner);
  14705. return style;
  14706. }
  14707. /**
  14708. * Cause the sidebar to be sticky according to affix type by adding inline
  14709. * style, adding helper class and trigger events.
  14710. * @function
  14711. * @protected
  14712. * @param {string} force - Update sticky sidebar position by force.
  14713. */
  14714. }, {
  14715. key: 'stickyPosition',
  14716. value: function stickyPosition(force) {
  14717. if (this._breakpoint) return;
  14718. force = force || false;
  14719. var affixType = this.getAffixType();
  14720. var style = this._getStyle(affixType);
  14721. if ((this.affixedType != affixType || force) && affixType) {
  14722. var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
  14723. StickySidebar.eventTrigger(this.sidebar, affixEvent);
  14724. if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
  14725. for (var key in style.outer) {
  14726. this.sidebar.style[key] = style.outer[key];
  14727. }
  14728. for (var _key in style.inner) {
  14729. var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : '';
  14730. this.sidebarInner.style[_key] = style.inner[_key] + _unit2;
  14731. }
  14732. var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport', '') + EVENT_KEY;
  14733. StickySidebar.eventTrigger(this.sidebar, affixedEvent);
  14734. } else {
  14735. if (this._initialized) this.sidebarInner.style.left = style.inner.left;
  14736. }
  14737. this.affixedType = affixType;
  14738. }
  14739. /**
  14740. * Breakdown sticky sidebar when window width is below `options.minWidth` value.
  14741. * @protected
  14742. */
  14743. }, {
  14744. key: '_widthBreakpoint',
  14745. value: function _widthBreakpoint() {
  14746. if (window.innerWidth <= this.options.minWidth) {
  14747. this._breakpoint = true;
  14748. this.affixedType = 'STATIC';
  14749. this.sidebar.removeAttribute('style');
  14750. StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
  14751. this.sidebarInner.removeAttribute('style');
  14752. } else {
  14753. this._breakpoint = false;
  14754. }
  14755. }
  14756. /**
  14757. * Switchs between functions stack for each event type, if there's no
  14758. * event, it will re-initialize sticky sidebar.
  14759. * @public
  14760. */
  14761. }, {
  14762. key: 'updateSticky',
  14763. value: function updateSticky() {
  14764. var _this3 = this;
  14765. var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  14766. if (this._running) return;
  14767. this._running = true;
  14768. (function (eventType) {
  14769. requestAnimationFrame(function () {
  14770. switch (eventType) {
  14771. // When browser is scrolling and re-calculate just dimensions
  14772. // within scroll.
  14773. case 'scroll':
  14774. _this3._calcDimensionsWithScroll();
  14775. _this3.observeScrollDir();
  14776. _this3.stickyPosition();
  14777. break;
  14778. // When browser is resizing or there's no event, observe width
  14779. // breakpoint and re-calculate dimensions.
  14780. case 'resize':
  14781. default:
  14782. _this3._widthBreakpoint();
  14783. _this3.calcDimensions();
  14784. _this3.stickyPosition(true);
  14785. break;
  14786. }
  14787. _this3._running = false;
  14788. });
  14789. })(event.type);
  14790. }
  14791. /**
  14792. * Set browser support features to the public property.
  14793. * @private
  14794. */
  14795. }, {
  14796. key: '_setSupportFeatures',
  14797. value: function _setSupportFeatures() {
  14798. var support = this.support;
  14799. support.transform = StickySidebar.supportTransform();
  14800. support.transform3d = StickySidebar.supportTransform(true);
  14801. }
  14802. /**
  14803. * Get translate value, if the browser supports transfrom3d, it will adopt it.
  14804. * and the same with translate. if browser doesn't support both return false.
  14805. * @param {Number} y - Value of Y-axis.
  14806. * @param {Number} x - Value of X-axis.
  14807. * @param {Number} z - Value of Z-axis.
  14808. * @return {String|False}
  14809. */
  14810. }, {
  14811. key: '_getTranslate',
  14812. value: function _getTranslate() {
  14813. var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  14814. var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  14815. var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  14816. if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
  14817. }
  14818. /**
  14819. * Destroy sticky sidebar plugin.
  14820. * @public
  14821. */
  14822. }, {
  14823. key: 'destroy',
  14824. value: function destroy() {
  14825. window.removeEventListener('resize', this);
  14826. window.removeEventListener('scroll', this);
  14827. this.sidebar.classList.remove(this.options.stickyClass);
  14828. this.sidebar.style.minHeight = '';
  14829. this.sidebar.removeEventListener('update' + EVENT_KEY, this);
  14830. var styleReset = { inner: {}, outer: {} };
  14831. styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
  14832. styleReset.outer = { height: '', position: '' };
  14833. for (var key in styleReset.outer) {
  14834. this.sidebar.style[key] = styleReset.outer[key];
  14835. }for (var _key2 in styleReset.inner) {
  14836. this.sidebarInner.style[_key2] = styleReset.inner[_key2];
  14837. }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14838. ResizeSensor.detach(this.sidebarInner, this.handleEvent);
  14839. ResizeSensor.detach(this.container, this.handleEvent);
  14840. }
  14841. }
  14842. /**
  14843. * Detarmine if the browser supports CSS transfrom feature.
  14844. * @function
  14845. * @static
  14846. * @param {Boolean} transform3d - Detect transform with translate3d.
  14847. * @return {String}
  14848. */
  14849. }], [{
  14850. key: 'supportTransform',
  14851. value: function supportTransform(transform3d) {
  14852. var result = false,
  14853. property = transform3d ? 'perspective' : 'transform',
  14854. upper = property.charAt(0).toUpperCase() + property.slice(1),
  14855. prefixes = ['Webkit', 'Moz', 'O', 'ms'],
  14856. support = document.createElement('support'),
  14857. style = support.style;
  14858. (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
  14859. if (style[property] !== undefined) {
  14860. result = property;
  14861. return false;
  14862. }
  14863. });
  14864. return result;
  14865. }
  14866. /**
  14867. * Trigger custom event.
  14868. * @static
  14869. * @param {DOMObject} element - Target element on the DOM.
  14870. * @param {String} eventName - Event name.
  14871. * @param {Object} data -
  14872. */
  14873. }, {
  14874. key: 'eventTrigger',
  14875. value: function eventTrigger(element, eventName, data) {
  14876. try {
  14877. var event = new CustomEvent(eventName, { detail: data });
  14878. } catch (e) {
  14879. var event = document.createEvent('CustomEvent');
  14880. event.initCustomEvent(eventName, true, true, data);
  14881. }
  14882. element.dispatchEvent(event);
  14883. }
  14884. /**
  14885. * Extend options object with defaults.
  14886. * @function
  14887. * @static
  14888. */
  14889. }, {
  14890. key: 'extend',
  14891. value: function extend(defaults, options) {
  14892. var results = {};
  14893. for (var key in defaults) {
  14894. if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
  14895. }
  14896. return results;
  14897. }
  14898. /**
  14899. * Get current coordinates left and top of specific element.
  14900. * @static
  14901. */
  14902. }, {
  14903. key: 'offsetRelative',
  14904. value: function offsetRelative(element) {
  14905. var result = { left: 0, top: 0 };
  14906. do {
  14907. var offsetTop = element.offsetTop;
  14908. var offsetLeft = element.offsetLeft;
  14909. if (!isNaN(offsetTop)) result.top += offsetTop;
  14910. if (!isNaN(offsetLeft)) result.left += offsetLeft;
  14911. } while (element = element.offsetParent);
  14912. return result;
  14913. }
  14914. /**
  14915. * Add specific class name to specific element.
  14916. * @static
  14917. * @param {ObjectDOM} element
  14918. * @param {String} className
  14919. */
  14920. }, {
  14921. key: 'addClass',
  14922. value: function addClass(element, className) {
  14923. if (!StickySidebar.hasClass(element, className)) {
  14924. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  14925. }
  14926. }
  14927. /**
  14928. * Remove specific class name to specific element
  14929. * @static
  14930. * @param {ObjectDOM} element
  14931. * @param {String} className
  14932. */
  14933. }, {
  14934. key: 'removeClass',
  14935. value: function removeClass(element, className) {
  14936. if (StickySidebar.hasClass(element, className)) {
  14937. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  14938. }
  14939. }
  14940. /**
  14941. * Detarmine weather the element has specific class name.
  14942. * @static
  14943. * @param {ObjectDOM} element
  14944. * @param {String} className
  14945. */
  14946. }, {
  14947. key: 'hasClass',
  14948. value: function hasClass(element, className) {
  14949. if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
  14950. }
  14951. }]);
  14952. return StickySidebar;
  14953. }();
  14954. return StickySidebar;
  14955. }();
  14956. // Global
  14957. // -------------------------
  14958. window.StickySidebar = StickySidebar;
  14959. return StickySidebar;
  14960. });
  14961. //# sourceMappingURL=sticky-sidebar.js.map
  14962. /***/ }),
  14963. /* 34 */
  14964. /***/ (function(module, exports, __webpack_require__) {
  14965. "use strict";
  14966. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14967. 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; };
  14968. /*! tether 1.4.0 */
  14969. (function (root, factory) {
  14970. if (true) {
  14971. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14972. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14973. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14974. __WEBPACK_AMD_DEFINE_FACTORY__),
  14975. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  14976. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  14977. module.exports = factory(require, exports, module);
  14978. } else {
  14979. root.Tether = factory();
  14980. }
  14981. })(undefined, function (require, exports, module) {
  14982. 'use strict';
  14983. var _createClass = function () {
  14984. function defineProperties(target, props) {
  14985. for (var i = 0; i < props.length; i++) {
  14986. 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);
  14987. }
  14988. }return function (Constructor, protoProps, staticProps) {
  14989. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  14990. };
  14991. }();
  14992. function _classCallCheck(instance, Constructor) {
  14993. if (!(instance instanceof Constructor)) {
  14994. throw new TypeError('Cannot call a class as a function');
  14995. }
  14996. }
  14997. var TetherBase = undefined;
  14998. if (typeof TetherBase === 'undefined') {
  14999. TetherBase = { modules: [] };
  15000. }
  15001. var zeroElement = null;
  15002. // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
  15003. // if the element lies within a nested document (<frame> or <iframe>-like).
  15004. function getActualBoundingClientRect(node) {
  15005. var boundingRect = node.getBoundingClientRect();
  15006. // The original object returned by getBoundingClientRect is immutable, so we clone it
  15007. // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
  15008. var rect = {};
  15009. for (var k in boundingRect) {
  15010. rect[k] = boundingRect[k];
  15011. }
  15012. if (node.ownerDocument !== document) {
  15013. var _frameElement = node.ownerDocument.defaultView.frameElement;
  15014. if (_frameElement) {
  15015. var frameRect = getActualBoundingClientRect(_frameElement);
  15016. rect.top += frameRect.top;
  15017. rect.bottom += frameRect.top;
  15018. rect.left += frameRect.left;
  15019. rect.right += frameRect.left;
  15020. }
  15021. }
  15022. return rect;
  15023. }
  15024. function getScrollParents(el) {
  15025. // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
  15026. // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  15027. var computedStyle = getComputedStyle(el) || {};
  15028. var position = computedStyle.position;
  15029. var parents = [];
  15030. if (position === 'fixed') {
  15031. return [el];
  15032. }
  15033. var parent = el;
  15034. while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
  15035. var style = undefined;
  15036. try {
  15037. style = getComputedStyle(parent);
  15038. } catch (err) {}
  15039. if (typeof style === 'undefined' || style === null) {
  15040. parents.push(parent);
  15041. return parents;
  15042. }
  15043. var _style = style;
  15044. var overflow = _style.overflow;
  15045. var overflowX = _style.overflowX;
  15046. var overflowY = _style.overflowY;
  15047. if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
  15048. if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
  15049. parents.push(parent);
  15050. }
  15051. }
  15052. }
  15053. parents.push(el.ownerDocument.body);
  15054. // If the node is within a frame, account for the parent window scroll
  15055. if (el.ownerDocument !== document) {
  15056. parents.push(el.ownerDocument.defaultView);
  15057. }
  15058. return parents;
  15059. }
  15060. var uniqueId = function () {
  15061. var id = 0;
  15062. return function () {
  15063. return ++id;
  15064. };
  15065. }();
  15066. var zeroPosCache = {};
  15067. var getOrigin = function getOrigin() {
  15068. // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
  15069. // jitter as the user scrolls that messes with our ability to detect if two positions
  15070. // are equivilant or not. We place an element at the top left of the page that will
  15071. // get the same jitter, so we can cancel the two out.
  15072. var node = zeroElement;
  15073. if (!node || !document.body.contains(node)) {
  15074. node = document.createElement('div');
  15075. node.setAttribute('data-tether-id', uniqueId());
  15076. extend(node.style, {
  15077. top: 0,
  15078. left: 0,
  15079. position: 'absolute'
  15080. });
  15081. document.body.appendChild(node);
  15082. zeroElement = node;
  15083. }
  15084. var id = node.getAttribute('data-tether-id');
  15085. if (typeof zeroPosCache[id] === 'undefined') {
  15086. zeroPosCache[id] = getActualBoundingClientRect(node);
  15087. // Clear the cache when this position call is done
  15088. defer(function () {
  15089. delete zeroPosCache[id];
  15090. });
  15091. }
  15092. return zeroPosCache[id];
  15093. };
  15094. function removeUtilElements() {
  15095. if (zeroElement) {
  15096. document.body.removeChild(zeroElement);
  15097. }
  15098. zeroElement = null;
  15099. };
  15100. function getBounds(el) {
  15101. var doc = undefined;
  15102. if (el === document) {
  15103. doc = document;
  15104. el = document.documentElement;
  15105. } else {
  15106. doc = el.ownerDocument;
  15107. }
  15108. var docEl = doc.documentElement;
  15109. var box = getActualBoundingClientRect(el);
  15110. var origin = getOrigin();
  15111. box.top -= origin.top;
  15112. box.left -= origin.left;
  15113. if (typeof box.width === 'undefined') {
  15114. box.width = document.body.scrollWidth - box.left - box.right;
  15115. }
  15116. if (typeof box.height === 'undefined') {
  15117. box.height = document.body.scrollHeight - box.top - box.bottom;
  15118. }
  15119. box.top = box.top - docEl.clientTop;
  15120. box.left = box.left - docEl.clientLeft;
  15121. box.right = doc.body.clientWidth - box.width - box.left;
  15122. box.bottom = doc.body.clientHeight - box.height - box.top;
  15123. return box;
  15124. }
  15125. function getOffsetParent(el) {
  15126. return el.offsetParent || document.documentElement;
  15127. }
  15128. var _scrollBarSize = null;
  15129. function getScrollBarSize() {
  15130. if (_scrollBarSize) {
  15131. return _scrollBarSize;
  15132. }
  15133. var inner = document.createElement('div');
  15134. inner.style.width = '100%';
  15135. inner.style.height = '200px';
  15136. var outer = document.createElement('div');
  15137. extend(outer.style, {
  15138. position: 'absolute',
  15139. top: 0,
  15140. left: 0,
  15141. pointerEvents: 'none',
  15142. visibility: 'hidden',
  15143. width: '200px',
  15144. height: '150px',
  15145. overflow: 'hidden'
  15146. });
  15147. outer.appendChild(inner);
  15148. document.body.appendChild(outer);
  15149. var widthContained = inner.offsetWidth;
  15150. outer.style.overflow = 'scroll';
  15151. var widthScroll = inner.offsetWidth;
  15152. if (widthContained === widthScroll) {
  15153. widthScroll = outer.clientWidth;
  15154. }
  15155. document.body.removeChild(outer);
  15156. var width = widthContained - widthScroll;
  15157. _scrollBarSize = { width: width, height: width };
  15158. return _scrollBarSize;
  15159. }
  15160. function extend() {
  15161. var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  15162. var args = [];
  15163. Array.prototype.push.apply(args, arguments);
  15164. args.slice(1).forEach(function (obj) {
  15165. if (obj) {
  15166. for (var key in obj) {
  15167. if ({}.hasOwnProperty.call(obj, key)) {
  15168. out[key] = obj[key];
  15169. }
  15170. }
  15171. }
  15172. });
  15173. return out;
  15174. }
  15175. function removeClass(el, name) {
  15176. if (typeof el.classList !== 'undefined') {
  15177. name.split(' ').forEach(function (cls) {
  15178. if (cls.trim()) {
  15179. el.classList.remove(cls);
  15180. }
  15181. });
  15182. } else {
  15183. var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
  15184. var className = getClassName(el).replace(regex, ' ');
  15185. setClassName(el, className);
  15186. }
  15187. }
  15188. function addClass(el, name) {
  15189. if (typeof el.classList !== 'undefined') {
  15190. name.split(' ').forEach(function (cls) {
  15191. if (cls.trim()) {
  15192. el.classList.add(cls);
  15193. }
  15194. });
  15195. } else {
  15196. removeClass(el, name);
  15197. var cls = getClassName(el) + (' ' + name);
  15198. setClassName(el, cls);
  15199. }
  15200. }
  15201. function hasClass(el, name) {
  15202. if (typeof el.classList !== 'undefined') {
  15203. return el.classList.contains(name);
  15204. }
  15205. var className = getClassName(el);
  15206. return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
  15207. }
  15208. function getClassName(el) {
  15209. // Can't use just SVGAnimatedString here since nodes within a Frame in IE have
  15210. // completely separately SVGAnimatedString base classes
  15211. if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
  15212. return el.className.baseVal;
  15213. }
  15214. return el.className;
  15215. }
  15216. function setClassName(el, className) {
  15217. el.setAttribute('class', className);
  15218. }
  15219. function updateClasses(el, add, all) {
  15220. // Of the set of 'all' classes, we need the 'add' classes, and only the
  15221. // 'add' classes to be set.
  15222. all.forEach(function (cls) {
  15223. if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
  15224. removeClass(el, cls);
  15225. }
  15226. });
  15227. add.forEach(function (cls) {
  15228. if (!hasClass(el, cls)) {
  15229. addClass(el, cls);
  15230. }
  15231. });
  15232. }
  15233. var deferred = [];
  15234. var defer = function defer(fn) {
  15235. deferred.push(fn);
  15236. };
  15237. var flush = function flush() {
  15238. var fn = undefined;
  15239. while (fn = deferred.pop()) {
  15240. fn();
  15241. }
  15242. };
  15243. var Evented = function () {
  15244. function Evented() {
  15245. _classCallCheck(this, Evented);
  15246. }
  15247. _createClass(Evented, [{
  15248. key: 'on',
  15249. value: function on(event, handler, ctx) {
  15250. var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
  15251. if (typeof this.bindings === 'undefined') {
  15252. this.bindings = {};
  15253. }
  15254. if (typeof this.bindings[event] === 'undefined') {
  15255. this.bindings[event] = [];
  15256. }
  15257. this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
  15258. }
  15259. }, {
  15260. key: 'once',
  15261. value: function once(event, handler, ctx) {
  15262. this.on(event, handler, ctx, true);
  15263. }
  15264. }, {
  15265. key: 'off',
  15266. value: function off(event, handler) {
  15267. if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
  15268. return;
  15269. }
  15270. if (typeof handler === 'undefined') {
  15271. delete this.bindings[event];
  15272. } else {
  15273. var i = 0;
  15274. while (i < this.bindings[event].length) {
  15275. if (this.bindings[event][i].handler === handler) {
  15276. this.bindings[event].splice(i, 1);
  15277. } else {
  15278. ++i;
  15279. }
  15280. }
  15281. }
  15282. }
  15283. }, {
  15284. key: 'trigger',
  15285. value: function trigger(event) {
  15286. if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
  15287. var i = 0;
  15288. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  15289. args[_key - 1] = arguments[_key];
  15290. }
  15291. while (i < this.bindings[event].length) {
  15292. var _bindings$event$i = this.bindings[event][i];
  15293. var handler = _bindings$event$i.handler;
  15294. var ctx = _bindings$event$i.ctx;
  15295. var once = _bindings$event$i.once;
  15296. var context = ctx;
  15297. if (typeof context === 'undefined') {
  15298. context = this;
  15299. }
  15300. handler.apply(context, args);
  15301. if (once) {
  15302. this.bindings[event].splice(i, 1);
  15303. } else {
  15304. ++i;
  15305. }
  15306. }
  15307. }
  15308. }
  15309. }]);
  15310. return Evented;
  15311. }();
  15312. TetherBase.Utils = {
  15313. getActualBoundingClientRect: getActualBoundingClientRect,
  15314. getScrollParents: getScrollParents,
  15315. getBounds: getBounds,
  15316. getOffsetParent: getOffsetParent,
  15317. extend: extend,
  15318. addClass: addClass,
  15319. removeClass: removeClass,
  15320. hasClass: hasClass,
  15321. updateClasses: updateClasses,
  15322. defer: defer,
  15323. flush: flush,
  15324. uniqueId: uniqueId,
  15325. Evented: Evented,
  15326. getScrollBarSize: getScrollBarSize,
  15327. removeUtilElements: removeUtilElements
  15328. };
  15329. /* globals TetherBase, performance */
  15330. 'use strict';
  15331. var _slicedToArray = function () {
  15332. function sliceIterator(arr, i) {
  15333. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  15334. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  15335. _arr.push(_s.value);if (i && _arr.length === i) break;
  15336. }
  15337. } catch (err) {
  15338. _d = true;_e = err;
  15339. } finally {
  15340. try {
  15341. if (!_n && _i['return']) _i['return']();
  15342. } finally {
  15343. if (_d) throw _e;
  15344. }
  15345. }return _arr;
  15346. }return function (arr, i) {
  15347. if (Array.isArray(arr)) {
  15348. return arr;
  15349. } else if (Symbol.iterator in Object(arr)) {
  15350. return sliceIterator(arr, i);
  15351. } else {
  15352. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  15353. }
  15354. };
  15355. }();
  15356. var _createClass = function () {
  15357. function defineProperties(target, props) {
  15358. for (var i = 0; i < props.length; i++) {
  15359. 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);
  15360. }
  15361. }return function (Constructor, protoProps, staticProps) {
  15362. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15363. };
  15364. }();
  15365. var _get = function get(_x6, _x7, _x8) {
  15366. var _again = true;_function: while (_again) {
  15367. var object = _x6,
  15368. property = _x7,
  15369. receiver = _x8;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  15370. var parent = Object.getPrototypeOf(object);if (parent === null) {
  15371. return undefined;
  15372. } else {
  15373. _x6 = parent;_x7 = property;_x8 = receiver;_again = true;desc = parent = undefined;continue _function;
  15374. }
  15375. } else if ('value' in desc) {
  15376. return desc.value;
  15377. } else {
  15378. var getter = desc.get;if (getter === undefined) {
  15379. return undefined;
  15380. }return getter.call(receiver);
  15381. }
  15382. }
  15383. };
  15384. function _classCallCheck(instance, Constructor) {
  15385. if (!(instance instanceof Constructor)) {
  15386. throw new TypeError('Cannot call a class as a function');
  15387. }
  15388. }
  15389. function _inherits(subClass, superClass) {
  15390. if (typeof superClass !== 'function' && superClass !== null) {
  15391. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  15392. }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;
  15393. }
  15394. if (typeof TetherBase === 'undefined') {
  15395. throw new Error('You must include the utils.js file before tether.js');
  15396. }
  15397. var _TetherBase$Utils = TetherBase.Utils;
  15398. var getScrollParents = _TetherBase$Utils.getScrollParents;
  15399. var getBounds = _TetherBase$Utils.getBounds;
  15400. var getOffsetParent = _TetherBase$Utils.getOffsetParent;
  15401. var extend = _TetherBase$Utils.extend;
  15402. var addClass = _TetherBase$Utils.addClass;
  15403. var removeClass = _TetherBase$Utils.removeClass;
  15404. var updateClasses = _TetherBase$Utils.updateClasses;
  15405. var defer = _TetherBase$Utils.defer;
  15406. var flush = _TetherBase$Utils.flush;
  15407. var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
  15408. var removeUtilElements = _TetherBase$Utils.removeUtilElements;
  15409. function within(a, b) {
  15410. var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
  15411. return a + diff >= b && b >= a - diff;
  15412. }
  15413. var transformKey = function () {
  15414. if (typeof document === 'undefined') {
  15415. return '';
  15416. }
  15417. var el = document.createElement('div');
  15418. var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
  15419. for (var i = 0; i < transforms.length; ++i) {
  15420. var key = transforms[i];
  15421. if (el.style[key] !== undefined) {
  15422. return key;
  15423. }
  15424. }
  15425. }();
  15426. var tethers = [];
  15427. var position = function position() {
  15428. tethers.forEach(function (tether) {
  15429. tether.position(false);
  15430. });
  15431. flush();
  15432. };
  15433. function now() {
  15434. if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
  15435. return performance.now();
  15436. }
  15437. return +new Date();
  15438. }
  15439. (function () {
  15440. var lastCall = null;
  15441. var lastDuration = null;
  15442. var pendingTimeout = null;
  15443. var tick = function tick() {
  15444. if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
  15445. // We voluntarily throttle ourselves if we can't manage 60fps
  15446. lastDuration = Math.min(lastDuration - 16, 250);
  15447. // Just in case this is the last event, remember to position just once more
  15448. pendingTimeout = setTimeout(tick, 250);
  15449. return;
  15450. }
  15451. if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
  15452. // Some browsers call events a little too frequently, refuse to run more than is reasonable
  15453. return;
  15454. }
  15455. if (pendingTimeout != null) {
  15456. clearTimeout(pendingTimeout);
  15457. pendingTimeout = null;
  15458. }
  15459. lastCall = now();
  15460. position();
  15461. lastDuration = now() - lastCall;
  15462. };
  15463. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
  15464. ['resize', 'scroll', 'touchmove'].forEach(function (event) {
  15465. window.addEventListener(event, tick);
  15466. });
  15467. }
  15468. })();
  15469. var MIRROR_LR = {
  15470. center: 'center',
  15471. left: 'right',
  15472. right: 'left'
  15473. };
  15474. var MIRROR_TB = {
  15475. middle: 'middle',
  15476. top: 'bottom',
  15477. bottom: 'top'
  15478. };
  15479. var OFFSET_MAP = {
  15480. top: 0,
  15481. left: 0,
  15482. middle: '50%',
  15483. center: '50%',
  15484. bottom: '100%',
  15485. right: '100%'
  15486. };
  15487. var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
  15488. var left = attachment.left;
  15489. var top = attachment.top;
  15490. if (left === 'auto') {
  15491. left = MIRROR_LR[relativeToAttachment.left];
  15492. }
  15493. if (top === 'auto') {
  15494. top = MIRROR_TB[relativeToAttachment.top];
  15495. }
  15496. return { left: left, top: top };
  15497. };
  15498. var attachmentToOffset = function attachmentToOffset(attachment) {
  15499. var left = attachment.left;
  15500. var top = attachment.top;
  15501. if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
  15502. left = OFFSET_MAP[attachment.left];
  15503. }
  15504. if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
  15505. top = OFFSET_MAP[attachment.top];
  15506. }
  15507. return { left: left, top: top };
  15508. };
  15509. function addOffset() {
  15510. var out = { top: 0, left: 0 };
  15511. for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
  15512. offsets[_key] = arguments[_key];
  15513. }
  15514. offsets.forEach(function (_ref) {
  15515. var top = _ref.top;
  15516. var left = _ref.left;
  15517. if (typeof top === 'string') {
  15518. top = parseFloat(top, 10);
  15519. }
  15520. if (typeof left === 'string') {
  15521. left = parseFloat(left, 10);
  15522. }
  15523. out.top += top;
  15524. out.left += left;
  15525. });
  15526. return out;
  15527. }
  15528. function offsetToPx(offset, size) {
  15529. if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
  15530. offset.left = parseFloat(offset.left, 10) / 100 * size.width;
  15531. }
  15532. if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
  15533. offset.top = parseFloat(offset.top, 10) / 100 * size.height;
  15534. }
  15535. return offset;
  15536. }
  15537. var parseOffset = function parseOffset(value) {
  15538. var _value$split = value.split(' ');
  15539. var _value$split2 = _slicedToArray(_value$split, 2);
  15540. var top = _value$split2[0];
  15541. var left = _value$split2[1];
  15542. return { top: top, left: left };
  15543. };
  15544. var parseAttachment = parseOffset;
  15545. var TetherClass = function (_Evented) {
  15546. _inherits(TetherClass, _Evented);
  15547. function TetherClass(options) {
  15548. var _this = this;
  15549. _classCallCheck(this, TetherClass);
  15550. _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
  15551. this.position = this.position.bind(this);
  15552. tethers.push(this);
  15553. this.history = [];
  15554. this.setOptions(options, false);
  15555. TetherBase.modules.forEach(function (module) {
  15556. if (typeof module.initialize !== 'undefined') {
  15557. module.initialize.call(_this);
  15558. }
  15559. });
  15560. this.position();
  15561. }
  15562. _createClass(TetherClass, [{
  15563. key: 'getClass',
  15564. value: function getClass() {
  15565. var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  15566. var classes = this.options.classes;
  15567. if (typeof classes !== 'undefined' && classes[key]) {
  15568. return this.options.classes[key];
  15569. } else if (this.options.classPrefix) {
  15570. return this.options.classPrefix + '-' + key;
  15571. } else {
  15572. return key;
  15573. }
  15574. }
  15575. }, {
  15576. key: 'setOptions',
  15577. value: function setOptions(options) {
  15578. var _this2 = this;
  15579. var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  15580. var defaults = {
  15581. offset: '0 0',
  15582. targetOffset: '0 0',
  15583. targetAttachment: 'auto auto',
  15584. classPrefix: 'tether'
  15585. };
  15586. this.options = extend(defaults, options);
  15587. var _options = this.options;
  15588. var element = _options.element;
  15589. var target = _options.target;
  15590. var targetModifier = _options.targetModifier;
  15591. this.element = element;
  15592. this.target = target;
  15593. this.targetModifier = targetModifier;
  15594. if (this.target === 'viewport') {
  15595. this.target = document.body;
  15596. this.targetModifier = 'visible';
  15597. } else if (this.target === 'scroll-handle') {
  15598. this.target = document.body;
  15599. this.targetModifier = 'scroll-handle';
  15600. }
  15601. ['element', 'target'].forEach(function (key) {
  15602. if (typeof _this2[key] === 'undefined') {
  15603. throw new Error('Tether Error: Both element and target must be defined');
  15604. }
  15605. if (typeof _this2[key].jquery !== 'undefined') {
  15606. _this2[key] = _this2[key][0];
  15607. } else if (typeof _this2[key] === 'string') {
  15608. _this2[key] = document.querySelector(_this2[key]);
  15609. }
  15610. });
  15611. addClass(this.element, this.getClass('element'));
  15612. if (!(this.options.addTargetClasses === false)) {
  15613. addClass(this.target, this.getClass('target'));
  15614. }
  15615. if (!this.options.attachment) {
  15616. throw new Error('Tether Error: You must provide an attachment');
  15617. }
  15618. this.targetAttachment = parseAttachment(this.options.targetAttachment);
  15619. this.attachment = parseAttachment(this.options.attachment);
  15620. this.offset = parseOffset(this.options.offset);
  15621. this.targetOffset = parseOffset(this.options.targetOffset);
  15622. if (typeof this.scrollParents !== 'undefined') {
  15623. this.disable();
  15624. }
  15625. if (this.targetModifier === 'scroll-handle') {
  15626. this.scrollParents = [this.target];
  15627. } else {
  15628. this.scrollParents = getScrollParents(this.target);
  15629. }
  15630. if (!(this.options.enabled === false)) {
  15631. this.enable(pos);
  15632. }
  15633. }
  15634. }, {
  15635. key: 'getTargetBounds',
  15636. value: function getTargetBounds() {
  15637. if (typeof this.targetModifier !== 'undefined') {
  15638. if (this.targetModifier === 'visible') {
  15639. if (this.target === document.body) {
  15640. return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
  15641. } else {
  15642. var bounds = getBounds(this.target);
  15643. var out = {
  15644. height: bounds.height,
  15645. width: bounds.width,
  15646. top: bounds.top,
  15647. left: bounds.left
  15648. };
  15649. out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
  15650. out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
  15651. out.height = Math.min(innerHeight, out.height);
  15652. out.height -= 2;
  15653. out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
  15654. out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
  15655. out.width = Math.min(innerWidth, out.width);
  15656. out.width -= 2;
  15657. if (out.top < pageYOffset) {
  15658. out.top = pageYOffset;
  15659. }
  15660. if (out.left < pageXOffset) {
  15661. out.left = pageXOffset;
  15662. }
  15663. return out;
  15664. }
  15665. } else if (this.targetModifier === 'scroll-handle') {
  15666. var bounds = undefined;
  15667. var target = this.target;
  15668. if (target === document.body) {
  15669. target = document.documentElement;
  15670. bounds = {
  15671. left: pageXOffset,
  15672. top: pageYOffset,
  15673. height: innerHeight,
  15674. width: innerWidth
  15675. };
  15676. } else {
  15677. bounds = getBounds(target);
  15678. }
  15679. var style = getComputedStyle(target);
  15680. var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
  15681. var scrollBottom = 0;
  15682. if (hasBottomScroll) {
  15683. scrollBottom = 15;
  15684. }
  15685. var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
  15686. var out = {
  15687. width: 15,
  15688. height: height * 0.975 * (height / target.scrollHeight),
  15689. left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
  15690. };
  15691. var fitAdj = 0;
  15692. if (height < 408 && this.target === document.body) {
  15693. fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
  15694. }
  15695. if (this.target !== document.body) {
  15696. out.height = Math.max(out.height, 24);
  15697. }
  15698. var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
  15699. out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
  15700. if (this.target === document.body) {
  15701. out.height = Math.max(out.height, 24);
  15702. }
  15703. return out;
  15704. }
  15705. } else {
  15706. return getBounds(this.target);
  15707. }
  15708. }
  15709. }, {
  15710. key: 'clearCache',
  15711. value: function clearCache() {
  15712. this._cache = {};
  15713. }
  15714. }, {
  15715. key: 'cache',
  15716. value: function cache(k, getter) {
  15717. // More than one module will often need the same DOM info, so
  15718. // we keep a cache which is cleared on each position call
  15719. if (typeof this._cache === 'undefined') {
  15720. this._cache = {};
  15721. }
  15722. if (typeof this._cache[k] === 'undefined') {
  15723. this._cache[k] = getter.call(this);
  15724. }
  15725. return this._cache[k];
  15726. }
  15727. }, {
  15728. key: 'enable',
  15729. value: function enable() {
  15730. var _this3 = this;
  15731. var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15732. if (!(this.options.addTargetClasses === false)) {
  15733. addClass(this.target, this.getClass('enabled'));
  15734. }
  15735. addClass(this.element, this.getClass('enabled'));
  15736. this.enabled = true;
  15737. this.scrollParents.forEach(function (parent) {
  15738. if (parent !== _this3.target.ownerDocument) {
  15739. parent.addEventListener('scroll', _this3.position);
  15740. }
  15741. });
  15742. if (pos) {
  15743. this.position();
  15744. }
  15745. }
  15746. }, {
  15747. key: 'disable',
  15748. value: function disable() {
  15749. var _this4 = this;
  15750. removeClass(this.target, this.getClass('enabled'));
  15751. removeClass(this.element, this.getClass('enabled'));
  15752. this.enabled = false;
  15753. if (typeof this.scrollParents !== 'undefined') {
  15754. this.scrollParents.forEach(function (parent) {
  15755. parent.removeEventListener('scroll', _this4.position);
  15756. });
  15757. }
  15758. }
  15759. }, {
  15760. key: 'destroy',
  15761. value: function destroy() {
  15762. var _this5 = this;
  15763. this.disable();
  15764. tethers.forEach(function (tether, i) {
  15765. if (tether === _this5) {
  15766. tethers.splice(i, 1);
  15767. }
  15768. });
  15769. // Remove any elements we were using for convenience from the DOM
  15770. if (tethers.length === 0) {
  15771. removeUtilElements();
  15772. }
  15773. }
  15774. }, {
  15775. key: 'updateAttachClasses',
  15776. value: function updateAttachClasses(elementAttach, targetAttach) {
  15777. var _this6 = this;
  15778. elementAttach = elementAttach || this.attachment;
  15779. targetAttach = targetAttach || this.targetAttachment;
  15780. var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
  15781. if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
  15782. // updateAttachClasses can be called more than once in a position call, so
  15783. // we need to clean up after ourselves such that when the last defer gets
  15784. // ran it doesn't add any extra classes from previous calls.
  15785. this._addAttachClasses.splice(0, this._addAttachClasses.length);
  15786. }
  15787. if (typeof this._addAttachClasses === 'undefined') {
  15788. this._addAttachClasses = [];
  15789. }
  15790. var add = this._addAttachClasses;
  15791. if (elementAttach.top) {
  15792. add.push(this.getClass('element-attached') + '-' + elementAttach.top);
  15793. }
  15794. if (elementAttach.left) {
  15795. add.push(this.getClass('element-attached') + '-' + elementAttach.left);
  15796. }
  15797. if (targetAttach.top) {
  15798. add.push(this.getClass('target-attached') + '-' + targetAttach.top);
  15799. }
  15800. if (targetAttach.left) {
  15801. add.push(this.getClass('target-attached') + '-' + targetAttach.left);
  15802. }
  15803. var all = [];
  15804. sides.forEach(function (side) {
  15805. all.push(_this6.getClass('element-attached') + '-' + side);
  15806. all.push(_this6.getClass('target-attached') + '-' + side);
  15807. });
  15808. defer(function () {
  15809. if (!(typeof _this6._addAttachClasses !== 'undefined')) {
  15810. return;
  15811. }
  15812. updateClasses(_this6.element, _this6._addAttachClasses, all);
  15813. if (!(_this6.options.addTargetClasses === false)) {
  15814. updateClasses(_this6.target, _this6._addAttachClasses, all);
  15815. }
  15816. delete _this6._addAttachClasses;
  15817. });
  15818. }
  15819. }, {
  15820. key: 'position',
  15821. value: function position() {
  15822. var _this7 = this;
  15823. var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15824. // flushChanges commits the changes immediately, leave true unless you are positioning multiple
  15825. // tethers (in which case call Tether.Utils.flush yourself when you're done)
  15826. if (!this.enabled) {
  15827. return;
  15828. }
  15829. this.clearCache();
  15830. // Turn 'auto' attachments into the appropriate corner or edge
  15831. var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
  15832. this.updateAttachClasses(this.attachment, targetAttachment);
  15833. var elementPos = this.cache('element-bounds', function () {
  15834. return getBounds(_this7.element);
  15835. });
  15836. var width = elementPos.width;
  15837. var height = elementPos.height;
  15838. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  15839. var _lastSize = this.lastSize;
  15840. // We cache the height and width to make it possible to position elements that are
  15841. // getting hidden.
  15842. width = _lastSize.width;
  15843. height = _lastSize.height;
  15844. } else {
  15845. this.lastSize = { width: width, height: height };
  15846. }
  15847. var targetPos = this.cache('target-bounds', function () {
  15848. return _this7.getTargetBounds();
  15849. });
  15850. var targetSize = targetPos;
  15851. // Get an actual px offset from the attachment
  15852. var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
  15853. var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
  15854. var manualOffset = offsetToPx(this.offset, { width: width, height: height });
  15855. var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
  15856. // Add the manually provided offset
  15857. offset = addOffset(offset, manualOffset);
  15858. targetOffset = addOffset(targetOffset, manualTargetOffset);
  15859. // It's now our goal to make (element position + offset) == (target position + target offset)
  15860. var left = targetPos.left + targetOffset.left - offset.left;
  15861. var top = targetPos.top + targetOffset.top - offset.top;
  15862. for (var i = 0; i < TetherBase.modules.length; ++i) {
  15863. var _module2 = TetherBase.modules[i];
  15864. var ret = _module2.position.call(this, {
  15865. left: left,
  15866. top: top,
  15867. targetAttachment: targetAttachment,
  15868. targetPos: targetPos,
  15869. elementPos: elementPos,
  15870. offset: offset,
  15871. targetOffset: targetOffset,
  15872. manualOffset: manualOffset,
  15873. manualTargetOffset: manualTargetOffset,
  15874. scrollbarSize: scrollbarSize,
  15875. attachment: this.attachment
  15876. });
  15877. if (ret === false) {
  15878. return false;
  15879. } else if (typeof ret === 'undefined' || (typeof ret === 'undefined' ? 'undefined' : _typeof(ret)) !== 'object') {
  15880. continue;
  15881. } else {
  15882. top = ret.top;
  15883. left = ret.left;
  15884. }
  15885. }
  15886. // We describe the position three different ways to give the optimizer
  15887. // a chance to decide the best possible way to position the element
  15888. // with the fewest repaints.
  15889. var next = {
  15890. // It's position relative to the page (absolute positioning when
  15891. // the element is a child of the body)
  15892. page: {
  15893. top: top,
  15894. left: left
  15895. },
  15896. // It's position relative to the viewport (fixed positioning)
  15897. viewport: {
  15898. top: top - pageYOffset,
  15899. bottom: pageYOffset - top - height + innerHeight,
  15900. left: left - pageXOffset,
  15901. right: pageXOffset - left - width + innerWidth
  15902. }
  15903. };
  15904. var doc = this.target.ownerDocument;
  15905. var win = doc.defaultView;
  15906. var scrollbarSize = undefined;
  15907. if (win.innerHeight > doc.documentElement.clientHeight) {
  15908. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15909. next.viewport.bottom -= scrollbarSize.height;
  15910. }
  15911. if (win.innerWidth > doc.documentElement.clientWidth) {
  15912. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15913. next.viewport.right -= scrollbarSize.width;
  15914. }
  15915. if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
  15916. // Absolute positioning in the body will be relative to the page, not the 'initial containing block'
  15917. next.page.bottom = doc.body.scrollHeight - top - height;
  15918. next.page.right = doc.body.scrollWidth - left - width;
  15919. }
  15920. if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
  15921. (function () {
  15922. var offsetParent = _this7.cache('target-offsetparent', function () {
  15923. return getOffsetParent(_this7.target);
  15924. });
  15925. var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
  15926. return getBounds(offsetParent);
  15927. });
  15928. var offsetParentStyle = getComputedStyle(offsetParent);
  15929. var offsetParentSize = offsetPosition;
  15930. var offsetBorder = {};
  15931. ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
  15932. offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
  15933. });
  15934. offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
  15935. offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
  15936. if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
  15937. if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
  15938. // We're within the visible part of the target's scroll parent
  15939. var scrollTop = offsetParent.scrollTop;
  15940. var scrollLeft = offsetParent.scrollLeft;
  15941. // It's position relative to the target's offset parent (absolute positioning when
  15942. // the element is moved to be a child of the target's offset parent).
  15943. next.offset = {
  15944. top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
  15945. left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
  15946. };
  15947. }
  15948. }
  15949. })();
  15950. }
  15951. // We could also travel up the DOM and try each containing context, rather than only
  15952. // looking at the body, but we're gonna get diminishing returns.
  15953. this.move(next);
  15954. this.history.unshift(next);
  15955. if (this.history.length > 3) {
  15956. this.history.pop();
  15957. }
  15958. if (flushChanges) {
  15959. flush();
  15960. }
  15961. return true;
  15962. }
  15963. // THE ISSUE
  15964. }, {
  15965. key: 'move',
  15966. value: function move(pos) {
  15967. var _this8 = this;
  15968. if (!(typeof this.element.parentNode !== 'undefined')) {
  15969. return;
  15970. }
  15971. var same = {};
  15972. for (var type in pos) {
  15973. same[type] = {};
  15974. for (var key in pos[type]) {
  15975. var found = false;
  15976. for (var i = 0; i < this.history.length; ++i) {
  15977. var point = this.history[i];
  15978. if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
  15979. found = true;
  15980. break;
  15981. }
  15982. }
  15983. if (!found) {
  15984. same[type][key] = true;
  15985. }
  15986. }
  15987. }
  15988. var css = { top: '', left: '', right: '', bottom: '' };
  15989. var transcribe = function transcribe(_same, _pos) {
  15990. var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
  15991. var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
  15992. if (gpu !== false) {
  15993. var yPos = undefined,
  15994. xPos = undefined;
  15995. if (_same.top) {
  15996. css.top = 0;
  15997. yPos = _pos.top;
  15998. } else {
  15999. css.bottom = 0;
  16000. yPos = -_pos.bottom;
  16001. }
  16002. if (_same.left) {
  16003. css.left = 0;
  16004. xPos = _pos.left;
  16005. } else {
  16006. css.right = 0;
  16007. xPos = -_pos.right;
  16008. }
  16009. if (window.matchMedia) {
  16010. // HubSpot/tether#207
  16011. 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;
  16012. if (!retina) {
  16013. xPos = Math.round(xPos);
  16014. yPos = Math.round(yPos);
  16015. }
  16016. }
  16017. css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
  16018. if (transformKey !== 'msTransform') {
  16019. // The Z transform will keep this in the GPU (faster, and prevents artifacts),
  16020. // but IE9 doesn't support 3d transforms and will choke.
  16021. css[transformKey] += " translateZ(0)";
  16022. }
  16023. } else {
  16024. if (_same.top) {
  16025. css.top = _pos.top + 'px';
  16026. } else {
  16027. css.bottom = _pos.bottom + 'px';
  16028. }
  16029. if (_same.left) {
  16030. css.left = _pos.left + 'px';
  16031. } else {
  16032. css.right = _pos.right + 'px';
  16033. }
  16034. }
  16035. };
  16036. var moved = false;
  16037. if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
  16038. css.position = 'absolute';
  16039. transcribe(same.page, pos.page);
  16040. } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
  16041. css.position = 'fixed';
  16042. transcribe(same.viewport, pos.viewport);
  16043. } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
  16044. (function () {
  16045. css.position = 'absolute';
  16046. var offsetParent = _this8.cache('target-offsetparent', function () {
  16047. return getOffsetParent(_this8.target);
  16048. });
  16049. if (getOffsetParent(_this8.element) !== offsetParent) {
  16050. defer(function () {
  16051. _this8.element.parentNode.removeChild(_this8.element);
  16052. offsetParent.appendChild(_this8.element);
  16053. });
  16054. }
  16055. transcribe(same.offset, pos.offset);
  16056. moved = true;
  16057. })();
  16058. } else {
  16059. css.position = 'absolute';
  16060. transcribe({ top: true, left: true }, pos.page);
  16061. }
  16062. if (!moved) {
  16063. if (this.options.bodyElement) {
  16064. this.options.bodyElement.appendChild(this.element);
  16065. } else {
  16066. var offsetParentIsBody = true;
  16067. var currentNode = this.element.parentNode;
  16068. while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
  16069. if (getComputedStyle(currentNode).position !== 'static') {
  16070. offsetParentIsBody = false;
  16071. break;
  16072. }
  16073. currentNode = currentNode.parentNode;
  16074. }
  16075. if (!offsetParentIsBody) {
  16076. this.element.parentNode.removeChild(this.element);
  16077. this.element.ownerDocument.body.appendChild(this.element);
  16078. }
  16079. }
  16080. }
  16081. // Any css change will trigger a repaint, so let's avoid one if nothing changed
  16082. var writeCSS = {};
  16083. var write = false;
  16084. for (var key in css) {
  16085. var val = css[key];
  16086. var elVal = this.element.style[key];
  16087. if (elVal !== val) {
  16088. write = true;
  16089. writeCSS[key] = val;
  16090. }
  16091. }
  16092. if (write) {
  16093. defer(function () {
  16094. extend(_this8.element.style, writeCSS);
  16095. _this8.trigger('repositioned');
  16096. });
  16097. }
  16098. }
  16099. }]);
  16100. return TetherClass;
  16101. }(Evented);
  16102. TetherClass.modules = [];
  16103. TetherBase.position = position;
  16104. var Tether = extend(TetherClass, TetherBase);
  16105. /* globals TetherBase */
  16106. 'use strict';
  16107. var _slicedToArray = function () {
  16108. function sliceIterator(arr, i) {
  16109. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16110. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16111. _arr.push(_s.value);if (i && _arr.length === i) break;
  16112. }
  16113. } catch (err) {
  16114. _d = true;_e = err;
  16115. } finally {
  16116. try {
  16117. if (!_n && _i['return']) _i['return']();
  16118. } finally {
  16119. if (_d) throw _e;
  16120. }
  16121. }return _arr;
  16122. }return function (arr, i) {
  16123. if (Array.isArray(arr)) {
  16124. return arr;
  16125. } else if (Symbol.iterator in Object(arr)) {
  16126. return sliceIterator(arr, i);
  16127. } else {
  16128. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16129. }
  16130. };
  16131. }();
  16132. var _TetherBase$Utils = TetherBase.Utils;
  16133. var getBounds = _TetherBase$Utils.getBounds;
  16134. var extend = _TetherBase$Utils.extend;
  16135. var updateClasses = _TetherBase$Utils.updateClasses;
  16136. var defer = _TetherBase$Utils.defer;
  16137. var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
  16138. function getBoundingRect(tether, to) {
  16139. if (to === 'scrollParent') {
  16140. to = tether.scrollParents[0];
  16141. } else if (to === 'window') {
  16142. to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
  16143. }
  16144. if (to === document) {
  16145. to = to.documentElement;
  16146. }
  16147. if (typeof to.nodeType !== 'undefined') {
  16148. (function () {
  16149. var node = to;
  16150. var size = getBounds(to);
  16151. var pos = size;
  16152. var style = getComputedStyle(to);
  16153. to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
  16154. // Account any parent Frames scroll offset
  16155. if (node.ownerDocument !== document) {
  16156. var win = node.ownerDocument.defaultView;
  16157. to[0] += win.pageXOffset;
  16158. to[1] += win.pageYOffset;
  16159. to[2] += win.pageXOffset;
  16160. to[3] += win.pageYOffset;
  16161. }
  16162. BOUNDS_FORMAT.forEach(function (side, i) {
  16163. side = side[0].toUpperCase() + side.substr(1);
  16164. if (side === 'Top' || side === 'Left') {
  16165. to[i] += parseFloat(style['border' + side + 'Width']);
  16166. } else {
  16167. to[i] -= parseFloat(style['border' + side + 'Width']);
  16168. }
  16169. });
  16170. })();
  16171. }
  16172. return to;
  16173. }
  16174. TetherBase.modules.push({
  16175. position: function position(_ref) {
  16176. var _this = this;
  16177. var top = _ref.top;
  16178. var left = _ref.left;
  16179. var targetAttachment = _ref.targetAttachment;
  16180. if (!this.options.constraints) {
  16181. return true;
  16182. }
  16183. var _cache = this.cache('element-bounds', function () {
  16184. return getBounds(_this.element);
  16185. });
  16186. var height = _cache.height;
  16187. var width = _cache.width;
  16188. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  16189. var _lastSize = this.lastSize;
  16190. // Handle the item getting hidden as a result of our positioning without glitching
  16191. // the classes in and out
  16192. width = _lastSize.width;
  16193. height = _lastSize.height;
  16194. }
  16195. var targetSize = this.cache('target-bounds', function () {
  16196. return _this.getTargetBounds();
  16197. });
  16198. var targetHeight = targetSize.height;
  16199. var targetWidth = targetSize.width;
  16200. var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
  16201. this.options.constraints.forEach(function (constraint) {
  16202. var outOfBoundsClass = constraint.outOfBoundsClass;
  16203. var pinnedClass = constraint.pinnedClass;
  16204. if (outOfBoundsClass) {
  16205. allClasses.push(outOfBoundsClass);
  16206. }
  16207. if (pinnedClass) {
  16208. allClasses.push(pinnedClass);
  16209. }
  16210. });
  16211. allClasses.forEach(function (cls) {
  16212. ['left', 'top', 'right', 'bottom'].forEach(function (side) {
  16213. allClasses.push(cls + '-' + side);
  16214. });
  16215. });
  16216. var addClasses = [];
  16217. var tAttachment = extend({}, targetAttachment);
  16218. var eAttachment = extend({}, this.attachment);
  16219. this.options.constraints.forEach(function (constraint) {
  16220. var to = constraint.to;
  16221. var attachment = constraint.attachment;
  16222. var pin = constraint.pin;
  16223. if (typeof attachment === 'undefined') {
  16224. attachment = '';
  16225. }
  16226. var changeAttachX = undefined,
  16227. changeAttachY = undefined;
  16228. if (attachment.indexOf(' ') >= 0) {
  16229. var _attachment$split = attachment.split(' ');
  16230. var _attachment$split2 = _slicedToArray(_attachment$split, 2);
  16231. changeAttachY = _attachment$split2[0];
  16232. changeAttachX = _attachment$split2[1];
  16233. } else {
  16234. changeAttachX = changeAttachY = attachment;
  16235. }
  16236. var bounds = getBoundingRect(_this, to);
  16237. if (changeAttachY === 'target' || changeAttachY === 'both') {
  16238. if (top < bounds[1] && tAttachment.top === 'top') {
  16239. top += targetHeight;
  16240. tAttachment.top = 'bottom';
  16241. }
  16242. if (top + height > bounds[3] && tAttachment.top === 'bottom') {
  16243. top -= targetHeight;
  16244. tAttachment.top = 'top';
  16245. }
  16246. }
  16247. if (changeAttachY === 'together') {
  16248. if (tAttachment.top === 'top') {
  16249. if (eAttachment.top === 'bottom' && top < bounds[1]) {
  16250. top += targetHeight;
  16251. tAttachment.top = 'bottom';
  16252. top += height;
  16253. eAttachment.top = 'top';
  16254. } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
  16255. top -= height - targetHeight;
  16256. tAttachment.top = 'bottom';
  16257. eAttachment.top = 'bottom';
  16258. }
  16259. }
  16260. if (tAttachment.top === 'bottom') {
  16261. if (eAttachment.top === 'top' && top + height > bounds[3]) {
  16262. top -= targetHeight;
  16263. tAttachment.top = 'top';
  16264. top -= height;
  16265. eAttachment.top = 'bottom';
  16266. } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
  16267. top += height - targetHeight;
  16268. tAttachment.top = 'top';
  16269. eAttachment.top = 'top';
  16270. }
  16271. }
  16272. if (tAttachment.top === 'middle') {
  16273. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16274. top -= height;
  16275. eAttachment.top = 'bottom';
  16276. } else if (top < bounds[1] && eAttachment.top === 'bottom') {
  16277. top += height;
  16278. eAttachment.top = 'top';
  16279. }
  16280. }
  16281. }
  16282. if (changeAttachX === 'target' || changeAttachX === 'both') {
  16283. if (left < bounds[0] && tAttachment.left === 'left') {
  16284. left += targetWidth;
  16285. tAttachment.left = 'right';
  16286. }
  16287. if (left + width > bounds[2] && tAttachment.left === 'right') {
  16288. left -= targetWidth;
  16289. tAttachment.left = 'left';
  16290. }
  16291. }
  16292. if (changeAttachX === 'together') {
  16293. if (left < bounds[0] && tAttachment.left === 'left') {
  16294. if (eAttachment.left === 'right') {
  16295. left += targetWidth;
  16296. tAttachment.left = 'right';
  16297. left += width;
  16298. eAttachment.left = 'left';
  16299. } else if (eAttachment.left === 'left') {
  16300. left += targetWidth;
  16301. tAttachment.left = 'right';
  16302. left -= width;
  16303. eAttachment.left = 'right';
  16304. }
  16305. } else if (left + width > bounds[2] && tAttachment.left === 'right') {
  16306. if (eAttachment.left === 'left') {
  16307. left -= targetWidth;
  16308. tAttachment.left = 'left';
  16309. left -= width;
  16310. eAttachment.left = 'right';
  16311. } else if (eAttachment.left === 'right') {
  16312. left -= targetWidth;
  16313. tAttachment.left = 'left';
  16314. left += width;
  16315. eAttachment.left = 'left';
  16316. }
  16317. } else if (tAttachment.left === 'center') {
  16318. if (left + width > bounds[2] && eAttachment.left === 'left') {
  16319. left -= width;
  16320. eAttachment.left = 'right';
  16321. } else if (left < bounds[0] && eAttachment.left === 'right') {
  16322. left += width;
  16323. eAttachment.left = 'left';
  16324. }
  16325. }
  16326. }
  16327. if (changeAttachY === 'element' || changeAttachY === 'both') {
  16328. if (top < bounds[1] && eAttachment.top === 'bottom') {
  16329. top += height;
  16330. eAttachment.top = 'top';
  16331. }
  16332. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16333. top -= height;
  16334. eAttachment.top = 'bottom';
  16335. }
  16336. }
  16337. if (changeAttachX === 'element' || changeAttachX === 'both') {
  16338. if (left < bounds[0]) {
  16339. if (eAttachment.left === 'right') {
  16340. left += width;
  16341. eAttachment.left = 'left';
  16342. } else if (eAttachment.left === 'center') {
  16343. left += width / 2;
  16344. eAttachment.left = 'left';
  16345. }
  16346. }
  16347. if (left + width > bounds[2]) {
  16348. if (eAttachment.left === 'left') {
  16349. left -= width;
  16350. eAttachment.left = 'right';
  16351. } else if (eAttachment.left === 'center') {
  16352. left -= width / 2;
  16353. eAttachment.left = 'right';
  16354. }
  16355. }
  16356. }
  16357. if (typeof pin === 'string') {
  16358. pin = pin.split(',').map(function (p) {
  16359. return p.trim();
  16360. });
  16361. } else if (pin === true) {
  16362. pin = ['top', 'left', 'right', 'bottom'];
  16363. }
  16364. pin = pin || [];
  16365. var pinned = [];
  16366. var oob = [];
  16367. if (top < bounds[1]) {
  16368. if (pin.indexOf('top') >= 0) {
  16369. top = bounds[1];
  16370. pinned.push('top');
  16371. } else {
  16372. oob.push('top');
  16373. }
  16374. }
  16375. if (top + height > bounds[3]) {
  16376. if (pin.indexOf('bottom') >= 0) {
  16377. top = bounds[3] - height;
  16378. pinned.push('bottom');
  16379. } else {
  16380. oob.push('bottom');
  16381. }
  16382. }
  16383. if (left < bounds[0]) {
  16384. if (pin.indexOf('left') >= 0) {
  16385. left = bounds[0];
  16386. pinned.push('left');
  16387. } else {
  16388. oob.push('left');
  16389. }
  16390. }
  16391. if (left + width > bounds[2]) {
  16392. if (pin.indexOf('right') >= 0) {
  16393. left = bounds[2] - width;
  16394. pinned.push('right');
  16395. } else {
  16396. oob.push('right');
  16397. }
  16398. }
  16399. if (pinned.length) {
  16400. (function () {
  16401. var pinnedClass = undefined;
  16402. if (typeof _this.options.pinnedClass !== 'undefined') {
  16403. pinnedClass = _this.options.pinnedClass;
  16404. } else {
  16405. pinnedClass = _this.getClass('pinned');
  16406. }
  16407. addClasses.push(pinnedClass);
  16408. pinned.forEach(function (side) {
  16409. addClasses.push(pinnedClass + '-' + side);
  16410. });
  16411. })();
  16412. }
  16413. if (oob.length) {
  16414. (function () {
  16415. var oobClass = undefined;
  16416. if (typeof _this.options.outOfBoundsClass !== 'undefined') {
  16417. oobClass = _this.options.outOfBoundsClass;
  16418. } else {
  16419. oobClass = _this.getClass('out-of-bounds');
  16420. }
  16421. addClasses.push(oobClass);
  16422. oob.forEach(function (side) {
  16423. addClasses.push(oobClass + '-' + side);
  16424. });
  16425. })();
  16426. }
  16427. if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
  16428. eAttachment.left = tAttachment.left = false;
  16429. }
  16430. if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
  16431. eAttachment.top = tAttachment.top = false;
  16432. }
  16433. if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
  16434. _this.updateAttachClasses(eAttachment, tAttachment);
  16435. _this.trigger('update', {
  16436. attachment: eAttachment,
  16437. targetAttachment: tAttachment
  16438. });
  16439. }
  16440. });
  16441. defer(function () {
  16442. if (!(_this.options.addTargetClasses === false)) {
  16443. updateClasses(_this.target, addClasses, allClasses);
  16444. }
  16445. updateClasses(_this.element, addClasses, allClasses);
  16446. });
  16447. return { top: top, left: left };
  16448. }
  16449. });
  16450. /* globals TetherBase */
  16451. 'use strict';
  16452. var _TetherBase$Utils = TetherBase.Utils;
  16453. var getBounds = _TetherBase$Utils.getBounds;
  16454. var updateClasses = _TetherBase$Utils.updateClasses;
  16455. var defer = _TetherBase$Utils.defer;
  16456. TetherBase.modules.push({
  16457. position: function position(_ref) {
  16458. var _this = this;
  16459. var top = _ref.top;
  16460. var left = _ref.left;
  16461. var _cache = this.cache('element-bounds', function () {
  16462. return getBounds(_this.element);
  16463. });
  16464. var height = _cache.height;
  16465. var width = _cache.width;
  16466. var targetPos = this.getTargetBounds();
  16467. var bottom = top + height;
  16468. var right = left + width;
  16469. var abutted = [];
  16470. if (top <= targetPos.bottom && bottom >= targetPos.top) {
  16471. ['left', 'right'].forEach(function (side) {
  16472. var targetPosSide = targetPos[side];
  16473. if (targetPosSide === left || targetPosSide === right) {
  16474. abutted.push(side);
  16475. }
  16476. });
  16477. }
  16478. if (left <= targetPos.right && right >= targetPos.left) {
  16479. ['top', 'bottom'].forEach(function (side) {
  16480. var targetPosSide = targetPos[side];
  16481. if (targetPosSide === top || targetPosSide === bottom) {
  16482. abutted.push(side);
  16483. }
  16484. });
  16485. }
  16486. var allClasses = [];
  16487. var addClasses = [];
  16488. var sides = ['left', 'top', 'right', 'bottom'];
  16489. allClasses.push(this.getClass('abutted'));
  16490. sides.forEach(function (side) {
  16491. allClasses.push(_this.getClass('abutted') + '-' + side);
  16492. });
  16493. if (abutted.length) {
  16494. addClasses.push(this.getClass('abutted'));
  16495. }
  16496. abutted.forEach(function (side) {
  16497. addClasses.push(_this.getClass('abutted') + '-' + side);
  16498. });
  16499. defer(function () {
  16500. if (!(_this.options.addTargetClasses === false)) {
  16501. updateClasses(_this.target, addClasses, allClasses);
  16502. }
  16503. updateClasses(_this.element, addClasses, allClasses);
  16504. });
  16505. return true;
  16506. }
  16507. });
  16508. /* globals TetherBase */
  16509. 'use strict';
  16510. var _slicedToArray = function () {
  16511. function sliceIterator(arr, i) {
  16512. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16513. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16514. _arr.push(_s.value);if (i && _arr.length === i) break;
  16515. }
  16516. } catch (err) {
  16517. _d = true;_e = err;
  16518. } finally {
  16519. try {
  16520. if (!_n && _i['return']) _i['return']();
  16521. } finally {
  16522. if (_d) throw _e;
  16523. }
  16524. }return _arr;
  16525. }return function (arr, i) {
  16526. if (Array.isArray(arr)) {
  16527. return arr;
  16528. } else if (Symbol.iterator in Object(arr)) {
  16529. return sliceIterator(arr, i);
  16530. } else {
  16531. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16532. }
  16533. };
  16534. }();
  16535. TetherBase.modules.push({
  16536. position: function position(_ref) {
  16537. var top = _ref.top;
  16538. var left = _ref.left;
  16539. if (!this.options.shift) {
  16540. return;
  16541. }
  16542. var shift = this.options.shift;
  16543. if (typeof this.options.shift === 'function') {
  16544. shift = this.options.shift.call(this, { top: top, left: left });
  16545. }
  16546. var shiftTop = undefined,
  16547. shiftLeft = undefined;
  16548. if (typeof shift === 'string') {
  16549. shift = shift.split(' ');
  16550. shift[1] = shift[1] || shift[0];
  16551. var _shift = shift;
  16552. var _shift2 = _slicedToArray(_shift, 2);
  16553. shiftTop = _shift2[0];
  16554. shiftLeft = _shift2[1];
  16555. shiftTop = parseFloat(shiftTop, 10);
  16556. shiftLeft = parseFloat(shiftLeft, 10);
  16557. } else {
  16558. shiftTop = shift.top;
  16559. shiftLeft = shift.left;
  16560. }
  16561. top += shiftTop;
  16562. left += shiftLeft;
  16563. return { top: top, left: left };
  16564. }
  16565. });
  16566. return Tether;
  16567. });
  16568. /***/ }),
  16569. /* 35 */
  16570. /***/ (function(module, exports, __webpack_require__) {
  16571. "use strict";
  16572. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  16573. /*
  16574. * Toastr
  16575. * Copyright 2012-2015
  16576. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  16577. * All Rights Reserved.
  16578. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  16579. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  16580. *
  16581. * ARIA Support: Greta Krafsig
  16582. *
  16583. * Project: https://github.com/CodeSeven/toastr
  16584. */
  16585. /* global define */
  16586. (function (define) {
  16587. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function ($) {
  16588. return function () {
  16589. var $container;
  16590. var listener;
  16591. var toastId = 0;
  16592. var toastType = {
  16593. error: 'error',
  16594. info: 'info',
  16595. success: 'success',
  16596. warning: 'warning'
  16597. };
  16598. var toastr = {
  16599. clear: clear,
  16600. remove: remove,
  16601. error: error,
  16602. getContainer: getContainer,
  16603. info: info,
  16604. options: {},
  16605. subscribe: subscribe,
  16606. success: success,
  16607. version: '2.1.3',
  16608. warning: warning
  16609. };
  16610. var previousToast;
  16611. return toastr;
  16612. ////////////////
  16613. function error(message, title, optionsOverride) {
  16614. return notify({
  16615. type: toastType.error,
  16616. iconClass: getOptions().iconClasses.error,
  16617. message: message,
  16618. optionsOverride: optionsOverride,
  16619. title: title
  16620. });
  16621. }
  16622. function getContainer(options, create) {
  16623. if (!options) {
  16624. options = getOptions();
  16625. }
  16626. $container = $('#' + options.containerId);
  16627. if ($container.length) {
  16628. return $container;
  16629. }
  16630. if (create) {
  16631. $container = createContainer(options);
  16632. }
  16633. return $container;
  16634. }
  16635. function info(message, title, optionsOverride) {
  16636. return notify({
  16637. type: toastType.info,
  16638. iconClass: getOptions().iconClasses.info,
  16639. message: message,
  16640. optionsOverride: optionsOverride,
  16641. title: title
  16642. });
  16643. }
  16644. function subscribe(callback) {
  16645. listener = callback;
  16646. }
  16647. function success(message, title, optionsOverride) {
  16648. return notify({
  16649. type: toastType.success,
  16650. iconClass: getOptions().iconClasses.success,
  16651. message: message,
  16652. optionsOverride: optionsOverride,
  16653. title: title
  16654. });
  16655. }
  16656. function warning(message, title, optionsOverride) {
  16657. return notify({
  16658. type: toastType.warning,
  16659. iconClass: getOptions().iconClasses.warning,
  16660. message: message,
  16661. optionsOverride: optionsOverride,
  16662. title: title
  16663. });
  16664. }
  16665. function clear($toastElement, clearOptions) {
  16666. var options = getOptions();
  16667. if (!$container) {
  16668. getContainer(options);
  16669. }
  16670. if (!clearToast($toastElement, options, clearOptions)) {
  16671. clearContainer(options);
  16672. }
  16673. }
  16674. function remove($toastElement) {
  16675. var options = getOptions();
  16676. if (!$container) {
  16677. getContainer(options);
  16678. }
  16679. if ($toastElement && $(':focus', $toastElement).length === 0) {
  16680. removeToast($toastElement);
  16681. return;
  16682. }
  16683. if ($container.children().length) {
  16684. $container.remove();
  16685. }
  16686. }
  16687. // internal functions
  16688. function clearContainer(options) {
  16689. var toastsToClear = $container.children();
  16690. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  16691. clearToast($(toastsToClear[i]), options);
  16692. }
  16693. }
  16694. function clearToast($toastElement, options, clearOptions) {
  16695. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  16696. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  16697. $toastElement[options.hideMethod]({
  16698. duration: options.hideDuration,
  16699. easing: options.hideEasing,
  16700. complete: function complete() {
  16701. removeToast($toastElement);
  16702. }
  16703. });
  16704. return true;
  16705. }
  16706. return false;
  16707. }
  16708. function createContainer(options) {
  16709. $container = $('<div/>').attr('id', options.containerId).addClass(options.positionClass);
  16710. $container.appendTo($(options.target));
  16711. return $container;
  16712. }
  16713. function getDefaults() {
  16714. return {
  16715. tapToDismiss: true,
  16716. toastClass: 'toast',
  16717. containerId: 'toast-container',
  16718. debug: false,
  16719. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  16720. showDuration: 300,
  16721. showEasing: 'swing', //swing and linear are built into jQuery
  16722. onShown: undefined,
  16723. hideMethod: 'fadeOut',
  16724. hideDuration: 1000,
  16725. hideEasing: 'swing',
  16726. onHidden: undefined,
  16727. closeMethod: false,
  16728. closeDuration: false,
  16729. closeEasing: false,
  16730. closeOnHover: true,
  16731. extendedTimeOut: 1000,
  16732. iconClasses: {
  16733. error: 'toast-error',
  16734. info: 'toast-info',
  16735. success: 'toast-success',
  16736. warning: 'toast-warning'
  16737. },
  16738. iconClass: 'toast-info',
  16739. positionClass: 'toast-top-right',
  16740. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  16741. titleClass: 'toast-title',
  16742. messageClass: 'toast-message',
  16743. escapeHtml: false,
  16744. target: 'body',
  16745. closeHtml: '<button type="button">&times;</button>',
  16746. closeClass: 'toast-close-button',
  16747. newestOnTop: true,
  16748. preventDuplicates: false,
  16749. progressBar: false,
  16750. progressClass: 'toast-progress',
  16751. rtl: false
  16752. };
  16753. }
  16754. function publish(args) {
  16755. if (!listener) {
  16756. return;
  16757. }
  16758. listener(args);
  16759. }
  16760. function notify(map) {
  16761. var options = getOptions();
  16762. var iconClass = map.iconClass || options.iconClass;
  16763. if (typeof map.optionsOverride !== 'undefined') {
  16764. options = $.extend(options, map.optionsOverride);
  16765. iconClass = map.optionsOverride.iconClass || iconClass;
  16766. }
  16767. if (shouldExit(options, map)) {
  16768. return;
  16769. }
  16770. toastId++;
  16771. $container = getContainer(options, true);
  16772. var intervalId = null;
  16773. var $toastElement = $('<div/>');
  16774. var $titleElement = $('<div/>');
  16775. var $messageElement = $('<div/>');
  16776. var $progressElement = $('<div/>');
  16777. var $closeElement = $(options.closeHtml);
  16778. var progressBar = {
  16779. intervalId: null,
  16780. hideEta: null,
  16781. maxHideTime: null
  16782. };
  16783. var response = {
  16784. toastId: toastId,
  16785. state: 'visible',
  16786. startTime: new Date(),
  16787. options: options,
  16788. map: map
  16789. };
  16790. personalizeToast();
  16791. displayToast();
  16792. handleEvents();
  16793. publish(response);
  16794. if (options.debug && console) {
  16795. console.log(response);
  16796. }
  16797. return $toastElement;
  16798. function escapeHtml(source) {
  16799. if (source == null) {
  16800. source = '';
  16801. }
  16802. return source.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  16803. }
  16804. function personalizeToast() {
  16805. setIcon();
  16806. setTitle();
  16807. setMessage();
  16808. setCloseButton();
  16809. setProgressBar();
  16810. setRTL();
  16811. setSequence();
  16812. setAria();
  16813. }
  16814. function setAria() {
  16815. var ariaValue = '';
  16816. switch (map.iconClass) {
  16817. case 'toast-success':
  16818. case 'toast-info':
  16819. ariaValue = 'polite';
  16820. break;
  16821. default:
  16822. ariaValue = 'assertive';
  16823. }
  16824. $toastElement.attr('aria-live', ariaValue);
  16825. }
  16826. function handleEvents() {
  16827. if (options.closeOnHover) {
  16828. $toastElement.hover(stickAround, delayedHideToast);
  16829. }
  16830. if (!options.onclick && options.tapToDismiss) {
  16831. $toastElement.click(hideToast);
  16832. }
  16833. if (options.closeButton && $closeElement) {
  16834. $closeElement.click(function (event) {
  16835. if (event.stopPropagation) {
  16836. event.stopPropagation();
  16837. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  16838. event.cancelBubble = true;
  16839. }
  16840. if (options.onCloseClick) {
  16841. options.onCloseClick(event);
  16842. }
  16843. hideToast(true);
  16844. });
  16845. }
  16846. if (options.onclick) {
  16847. $toastElement.click(function (event) {
  16848. options.onclick(event);
  16849. hideToast();
  16850. });
  16851. }
  16852. }
  16853. function displayToast() {
  16854. $toastElement.hide();
  16855. $toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });
  16856. if (options.timeOut > 0) {
  16857. intervalId = setTimeout(hideToast, options.timeOut);
  16858. progressBar.maxHideTime = parseFloat(options.timeOut);
  16859. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16860. if (options.progressBar) {
  16861. progressBar.intervalId = setInterval(updateProgress, 10);
  16862. }
  16863. }
  16864. }
  16865. function setIcon() {
  16866. if (map.iconClass) {
  16867. $toastElement.addClass(options.toastClass).addClass(iconClass).addClass('mg-toast');
  16868. }
  16869. }
  16870. function setSequence() {
  16871. if (options.newestOnTop) {
  16872. $container.prepend($toastElement);
  16873. } else {
  16874. $container.append($toastElement);
  16875. }
  16876. }
  16877. function setTitle() {
  16878. if (map.title) {
  16879. var suffix = map.title;
  16880. if (options.escapeHtml) {
  16881. suffix = escapeHtml(map.title);
  16882. }
  16883. $titleElement.append(suffix).addClass(options.titleClass);
  16884. $toastElement.append($titleElement);
  16885. }
  16886. }
  16887. function setMessage() {
  16888. if (map.message) {
  16889. var suffix = map.message;
  16890. if (options.escapeHtml) {
  16891. suffix = escapeHtml(map.message);
  16892. }
  16893. $messageElement.append(suffix).addClass(options.messageClass);
  16894. $toastElement.append($messageElement);
  16895. }
  16896. }
  16897. function setCloseButton() {
  16898. if (options.closeButton) {
  16899. $closeElement.addClass(options.closeClass).attr('role', 'button');
  16900. $toastElement.prepend($closeElement);
  16901. }
  16902. }
  16903. function setProgressBar() {
  16904. if (options.progressBar) {
  16905. $progressElement.addClass(options.progressClass);
  16906. $toastElement.prepend($progressElement);
  16907. }
  16908. }
  16909. function setRTL() {
  16910. if (options.rtl) {
  16911. $toastElement.addClass('rtl');
  16912. }
  16913. }
  16914. function shouldExit(options, map) {
  16915. if (options.preventDuplicates) {
  16916. if (map.message === previousToast) {
  16917. return true;
  16918. } else {
  16919. previousToast = map.message;
  16920. }
  16921. }
  16922. return false;
  16923. }
  16924. function hideToast(override) {
  16925. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  16926. var duration = override && options.closeDuration !== false ? options.closeDuration : options.hideDuration;
  16927. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  16928. if ($(':focus', $toastElement).length && !override) {
  16929. return;
  16930. }
  16931. clearTimeout(progressBar.intervalId);
  16932. return $toastElement[method]({
  16933. duration: duration,
  16934. easing: easing,
  16935. complete: function complete() {
  16936. removeToast($toastElement);
  16937. clearTimeout(intervalId);
  16938. if (options.onHidden && response.state !== 'hidden') {
  16939. options.onHidden();
  16940. }
  16941. response.state = 'hidden';
  16942. response.endTime = new Date();
  16943. publish(response);
  16944. }
  16945. });
  16946. }
  16947. function delayedHideToast() {
  16948. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  16949. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  16950. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  16951. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16952. }
  16953. }
  16954. function stickAround() {
  16955. clearTimeout(intervalId);
  16956. progressBar.hideEta = 0;
  16957. $toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });
  16958. }
  16959. function updateProgress() {
  16960. var percentage = (progressBar.hideEta - new Date().getTime()) / progressBar.maxHideTime * 100;
  16961. $progressElement.width(percentage + '%');
  16962. }
  16963. }
  16964. function getOptions() {
  16965. return $.extend({}, getDefaults(), toastr.options);
  16966. }
  16967. function removeToast($toastElement) {
  16968. if (!$container) {
  16969. $container = getContainer();
  16970. }
  16971. if ($toastElement.is(':visible')) {
  16972. return;
  16973. }
  16974. $toastElement.remove();
  16975. $toastElement = null;
  16976. if ($container.children().length === 0) {
  16977. $container.remove();
  16978. previousToast = undefined;
  16979. }
  16980. }
  16981. }();
  16982. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16983. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16984. })(__webpack_require__(36));
  16985. /***/ }),
  16986. /* 36 */
  16987. /***/ (function(module, exports) {
  16988. module.exports = function() {
  16989. throw new Error("define cannot be used indirect");
  16990. };
  16991. /***/ })
  16992. /******/ ]);