12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952 |
- /*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
- !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}k.fn=k.prototype={jquery:f,constructor:k,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=k.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return k.each(this,e)},map:function(n){return this.pushStack(k.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},k.extend=k.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(k.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||k.isPlainObject(n)?n:{},i=!1,a[t]=k.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},k.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t){b(e,{nonce:t&&t.nonce})},each:function(e,t){var n,r=0;if(d(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(p,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(d(Object(e))?k.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(d(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g.apply([],a)},guid:1,support:y}),"function"==typeof Symbol&&(k.fn[Symbol.iterator]=t[Symbol.iterator]),k.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var h=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,k="sizzle"+1*new Date,m=n.document,S=0,r=0,p=ue(),x=ue(),N=ue(),A=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",$=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",F=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="<a id='"+k+"'></a><select id='"+k+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!==C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!==C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&j.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(D),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(F," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[k]||(a[k]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===S&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[S,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[k]||(a[k]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===S&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[k]||(a[k]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[S,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[k]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace(B,"$1"));return s[k]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[S,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[k]||(e[k]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===S&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[k]&&(v=Ce(v)),y&&!y[k]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[k]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(B,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(B," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=N[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[k]?i.push(a):o.push(a);(a=N(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=S+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t===C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument===C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(S=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(S=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=k.split("").sort(D).join("")===k,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);k.find=h,k.expr=h.selectors,k.expr[":"]=k.expr.pseudos,k.uniqueSort=k.unique=h.uniqueSort,k.text=h.getText,k.isXMLDoc=h.isXML,k.contains=h.contains,k.escapeSelector=h.escape;var T=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&k(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},N=k.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var D=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1<i.call(n,e)!==r}):k.filter(n,e,r)}k.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?k.find.matchesSelector(r,e)?[r]:[]:k.find.matches(e,k.grep(t,function(e){return 1===e.nodeType}))},k.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(k(e).filter(function(){for(t=0;t<r;t++)if(k.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)k.find(e,i[t],n);return 1<r?k.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&N.test(e)?k(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(k.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&k(e);if(!N.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&k.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?k.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(k(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(k.uniqueSort(k.merge(this.get(),k(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),k.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return T(e,"parentNode")},parentsUntil:function(e,t,n){return T(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return T(e,"nextSibling")},prevAll:function(e){return T(e,"previousSibling")},nextUntil:function(e,t,n){return T(e,"nextSibling",n)},prevUntil:function(e,t,n){return T(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return"undefined"!=typeof e.contentDocument?e.contentDocument:(A(e,"template")&&(e=e.content||e),k.merge([],e.childNodes))}},function(r,i){k.fn[r]=function(e,t){var n=k.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=k.filter(t,n)),1<this.length&&(O[r]||k.uniqueSort(n),H.test(r)&&n.reverse()),this.pushStack(n)}});var R=/[^\x20\t\r\n\f]+/g;function M(e){return e}function I(e){throw e}function W(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}k.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},k.each(e.match(R)||[],function(e,t){n[t]=!0}),n):k.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){k.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return k.each(arguments,function(e,t){var n;while(-1<(n=k.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<k.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},k.extend({Deferred:function(e){var o=[["notify","progress",k.Callbacks("memory"),k.Callbacks("memory"),2],["resolve","done",k.Callbacks("once memory"),k.Callbacks("once memory"),0,"resolved"],["reject","fail",k.Callbacks("once memory"),k.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return k.Deferred(function(r){k.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,M,s),l(u,o,I,s)):(u++,t.call(e,l(u,o,M,s),l(u,o,I,s),l(u,o,M,o.notifyWith))):(a!==M&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){k.Deferred.exceptionHook&&k.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==I&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(k.Deferred.getStackHook&&(t.stackTrace=k.Deferred.getStackHook()),C.setTimeout(t))}}return k.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:M,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:M)),o[2][3].add(l(0,e,m(n)?n:I))}).promise()},promise:function(e){return null!=e?k.extend(e,a):a}},s={};return k.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=k.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(W(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)W(i[t],a(t),o.reject);return o.promise()}});var $=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;k.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&$.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},k.readyException=function(e){C.setTimeout(function(){throw e})};var F=k.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),k.ready()}k.fn.ready=function(e){return F.then(e)["catch"](function(e){k.readyException(e)}),this},k.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--k.readyWait:k.isReady)||(k.isReady=!0)!==e&&0<--k.readyWait||F.resolveWith(E,[k])}}),k.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(k.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var _=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)_(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(k(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},z=/^-ms-/,U=/-([a-z])/g;function X(e,t){return t.toUpperCase()}function V(e){return e.replace(z,"ms-").replace(U,X)}var G=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Y(){this.expando=k.expando+Y.uid++}Y.uid=1,Y.prototype={cache:function(e){var t=e[this.expando];return t||(t={},G(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[V(t)]=n;else for(r in t)i[V(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][V(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(V):(t=V(t))in r?[t]:t.match(R)||[]).length;while(n--)delete r[t[n]]}(void 0===t||k.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!k.isEmptyObject(t)}};var Q=new Y,J=new Y,K=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function ee(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Z,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:K.test(i)?JSON.parse(i):i)}catch(e){}J.set(e,t,n)}else n=void 0;return n}k.extend({hasData:function(e){return J.hasData(e)||Q.hasData(e)},data:function(e,t,n){return J.access(e,t,n)},removeData:function(e,t){J.remove(e,t)},_data:function(e,t,n){return Q.access(e,t,n)},_removeData:function(e,t){Q.remove(e,t)}}),k.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=J.get(o),1===o.nodeType&&!Q.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=V(r.slice(5)),ee(o,r,i[r]));Q.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){J.set(this,n)}):_(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=J.get(o,n))?t:void 0!==(t=ee(o,n))?t:void 0;this.each(function(){J.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){J.remove(this,e)})}}),k.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Q.get(e,t),n&&(!r||Array.isArray(n)?r=Q.access(e,t,k.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=k.queue(e,t),r=n.length,i=n.shift(),o=k._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){k.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Q.get(e,n)||Q.access(e,n,{empty:k.Callbacks("once memory").add(function(){Q.remove(e,[t+"queue",n])})})}}),k.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?k.queue(this[0],t):void 0===n?this:this.each(function(){var e=k.queue(this,t,n);k._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&k.dequeue(this,t)})},dequeue:function(e){return this.each(function(){k.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=k.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Q.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var te=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ne=new RegExp("^(?:([+-])=|)("+te+")([a-z%]*)$","i"),re=["Top","Right","Bottom","Left"],ie=E.documentElement,oe=function(e){return k.contains(e.ownerDocument,e)},ae={composed:!0};ie.getRootNode&&(oe=function(e){return k.contains(e.ownerDocument,e)||e.getRootNode(ae)===e.ownerDocument});var se=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&oe(e)&&"none"===k.css(e,"display")},ue=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];for(o in i=n.apply(e,r||[]),t)e.style[o]=a[o];return i};function le(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return k.css(e,t,"")},u=s(),l=n&&n[3]||(k.cssNumber[t]?"":"px"),c=e.nodeType&&(k.cssNumber[t]||"px"!==l&&+u)&&ne.exec(k.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)k.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,k.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ce={};function fe(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Q.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&se(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ce[s])||(o=a.body.appendChild(a.createElement(s)),u=k.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ce[s]=u)))):"none"!==n&&(l[c]="none",Q.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}k.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){se(this)?k(this).show():k(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Q.set(e[n],"globalEval",!t||Q.get(t[n],"globalEval"))}ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;var me,xe,be=/<|&#?\w+;/;function we(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))k.merge(p,o.nodeType?[o]:o);else if(be.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+k.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;k.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<k.inArray(o,r))i&&i.push(o);else if(l=oe(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}me=E.createDocumentFragment().appendChild(E.createElement("div")),(xe=E.createElement("input")).setAttribute("type","radio"),xe.setAttribute("checked","checked"),xe.setAttribute("name","t"),me.appendChild(xe),y.checkClone=me.cloneNode(!0).cloneNode(!0).lastChild.checked,me.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t<arguments.length;t++)u[t]=arguments[t];if(s.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,s)){a=k.event.handlers.call(this,s,l),t=0;while((i=a[t++])&&!s.isPropagationStopped()){s.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!s.isImmediatePropagationStopped())s.rnamespace&&!1!==o.namespace&&!s.rnamespace.test(o.namespace)||(s.handleObj=o,s.data=o.data,void 0!==(r=((k.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,u))&&!1===(s.result=r)&&(s.preventDefault(),s.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,s),s.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<k(i,this).index(l):k.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(k.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[k.expando]?e:new k.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&De(t,"click",ke),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&De(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Q.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},k.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},k.Event=function(e,t){if(!(this instanceof k.Event))return new k.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?ke:Se,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&k.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[k.expando]=!0},k.Event.prototype={constructor:k.Event,isDefaultPrevented:Se,isPropagationStopped:Se,isImmediatePropagationStopped:Se,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=ke,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=ke,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=ke,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},k.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&Te.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Ce.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},k.event.addProp),k.each({focus:"focusin",blur:"focusout"},function(e,t){k.event.special[e]={setup:function(){return De(this,e,Ne),!1},trigger:function(){return De(this,e),!0},delegateType:t}}),k.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){k.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||k.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),k.fn.extend({on:function(e,t,n,r){return Ae(this,e,t,n,r)},one:function(e,t,n,r){return Ae(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,k(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Se),this.each(function(){k.event.remove(this,e,n,t)})}});var je=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/<script|<style|<link/i,Le=/checked\s*(?:[^=]|=\s*.checked.)/i,He=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n<r;n++)k.event.add(t,i,l[i][n]);J.hasData(e)&&(s=J.access(e),u=k.extend({},s),J.set(t,u))}}function Ie(n,r,i,o){r=g.apply([],r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&Le.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),Ie(t,r,i,o)});if(f&&(t=(e=we(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=k.map(ve(e,"script"),Pe)).length;c<f;c++)u=e,c!==p&&(u=k.clone(u,!0,!0),s&&k.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,k.map(a,Re),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Q.access(u,"globalEval")&&k.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?k._evalUrl&&!u.noModule&&k._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")}):b(u.textContent.replace(He,""),u,l))}return n}function We(e,t,n){for(var r,i=t?k.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||k.cleanData(ve(r)),r.parentNode&&(n&&oe(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}k.extend({htmlPrefilter:function(e){return e.replace(je,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Me(o[r],a[r]);else Me(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=k.event.special,o=0;void 0!==(n=e[o]);o++)if(G(n)){if(t=n[Q.expando]){if(t.events)for(r in t.events)i[r]?k.event.remove(n,r):k.removeEvent(n,r,t.handle);n[Q.expando]=void 0}n[J.expando]&&(n[J.expando]=void 0)}}}),k.fn.extend({detach:function(e){return We(this,e,!0)},remove:function(e){return We(this,e)},text:function(e){return _(this,function(e){return void 0===e?k.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Ie(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Oe(this,e).appendChild(e)})},prepend:function(){return Ie(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Oe(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Ie(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Ie(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(k.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return k.clone(this,e,t)})},html:function(e){return _(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!qe.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=k.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(k.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return Ie(this,arguments,function(e){var t=this.parentNode;k.inArray(this,n)<0&&(k.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),k.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){k.fn[e]=function(e){for(var t,n=[],r=k(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),k(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var $e=new RegExp("^("+te+")(?!px)[a-z%]+$","i"),Fe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},Be=new RegExp(re.join("|"),"i");function _e(e,t,n){var r,i,o,a,s=e.style;return(n=n||Fe(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||oe(e)||(a=k.style(e,t)),!y.pixelBoxStyles()&&$e.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function ze(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(u){s.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",u.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",ie.appendChild(s).appendChild(u);var e=C.getComputedStyle(u);n="1%"!==e.top,a=12===t(e.marginLeft),u.style.right="60%",o=36===t(e.right),r=36===t(e.width),u.style.position="absolute",i=12===t(u.offsetWidth/3),ie.removeChild(s),u=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s=E.createElement("div"),u=E.createElement("div");u.style&&(u.style.backgroundClip="content-box",u.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===u.style.backgroundClip,k.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),a},scrollboxSize:function(){return e(),i}}))}();var Ue=["Webkit","Moz","ms"],Xe=E.createElement("div").style,Ve={};function Ge(e){var t=k.cssProps[e]||Ve[e];return t||(e in Xe?e:Ve[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Ue.length;while(n--)if((e=Ue[n]+t)in Xe)return e}(e)||e)}var Ye=/^(none|table(?!-c[ea]).+)/,Qe=/^--/,Je={position:"absolute",visibility:"hidden",display:"block"},Ke={letterSpacing:"0",fontWeight:"400"};function Ze(e,t,n){var r=ne.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function et(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=k.css(e,n+re[a],!0,i)),r?("content"===n&&(u-=k.css(e,"padding"+re[a],!0,i)),"margin"!==n&&(u-=k.css(e,"border"+re[a]+"Width",!0,i))):(u+=k.css(e,"padding"+re[a],!0,i),"padding"!==n?u+=k.css(e,"border"+re[a]+"Width",!0,i):s+=k.css(e,"border"+re[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function tt(e,t,n){var r=Fe(e),i=(!y.boxSizingReliable()||n)&&"border-box"===k.css(e,"boxSizing",!1,r),o=i,a=_e(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if($e.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||"auto"===a||!parseFloat(a)&&"inline"===k.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===k.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+et(e,t,n||(i?"border":"content"),o,r,a)+"px"}function nt(e,t,n,r,i){return new nt.prototype.init(e,t,n,r,i)}k.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=_e(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=V(t),u=Qe.test(t),l=e.style;if(u||(t=Ge(s)),a=k.cssHooks[t]||k.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=ne.exec(n))&&i[1]&&(n=le(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(k.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=V(t);return Qe.test(t)||(t=Ge(s)),(a=k.cssHooks[t]||k.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=_e(e,t,r)),"normal"===i&&t in Ke&&(i=Ke[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),k.each(["height","width"],function(e,u){k.cssHooks[u]={get:function(e,t,n){if(t)return!Ye.test(k.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?tt(e,u,n):ue(e,Je,function(){return tt(e,u,n)})},set:function(e,t,n){var r,i=Fe(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===k.css(e,"boxSizing",!1,i),s=n?et(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-et(e,u,"border",!1,i)-.5)),s&&(r=ne.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=k.css(e,u)),Ze(0,t,s)}}}),k.cssHooks.marginLeft=ze(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(_e(e,"marginLeft"))||e.getBoundingClientRect().left-ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),k.each({margin:"",padding:"",border:"Width"},function(i,o){k.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+re[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(k.cssHooks[i+o].set=Ze)}),k.fn.extend({css:function(e,t){return _(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Fe(e),i=t.length;a<i;a++)o[t[a]]=k.css(e,t[a],!1,r);return o}return void 0!==n?k.style(e,t,n):k.css(e,t)},e,t,1<arguments.length)}}),((k.Tween=nt).prototype={constructor:nt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||k.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(k.cssNumber[n]?"":"px")},cur:function(){var e=nt.propHooks[this.prop];return e&&e.get?e.get(this):nt.propHooks._default.get(this)},run:function(e){var t,n=nt.propHooks[this.prop];return this.options.duration?this.pos=t=k.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):nt.propHooks._default.set(this),this}}).init.prototype=nt.prototype,(nt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=k.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){k.fx.step[e.prop]?k.fx.step[e.prop](e):1!==e.elem.nodeType||!k.cssHooks[e.prop]&&null==e.elem.style[Ge(e.prop)]?e.elem[e.prop]=e.now:k.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=nt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},k.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},k.fx=nt.prototype.init,k.fx.step={};var rt,it,ot,at,st=/^(?:toggle|show|hide)$/,ut=/queueHooks$/;function lt(){it&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(lt):C.setTimeout(lt,k.fx.interval),k.fx.tick())}function ct(){return C.setTimeout(function(){rt=void 0}),rt=Date.now()}function ft(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=re[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function pt(e,t,n){for(var r,i=(dt.tweeners[t]||[]).concat(dt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function dt(o,e,t){var n,a,r=0,i=dt.prefilters.length,s=k.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=rt||ct(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:k.extend({},e),opts:k.extend(!0,{specialEasing:{},easing:k.easing._default},t),originalProperties:e,originalOptions:t,startTime:rt||ct(),duration:t.duration,tweens:[],createTween:function(e,t){var n=k.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=V(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=k.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=dt.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(k._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return k.map(c,pt,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),k.fx.timer(k.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}k.Animation=k.extend(dt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return le(n.elem,e,ne.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(R);for(var n,r=0,i=e.length;r<i;r++)n=e[r],dt.tweeners[n]=dt.tweeners[n]||[],dt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&se(e),v=Q.get(e,"fxshow");for(r in n.queue||(null==(a=k._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,k.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],st.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||k.style(e,r)}if((u=!k.isEmptyObject(t))||!k.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Q.get(e,"display")),"none"===(c=k.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=k.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===k.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Q.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&fe([e],!0),p.done(function(){for(r in g||fe([e]),Q.remove(e,"fxshow"),d)k.style(e,r,d[r])})),u=pt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?dt.prefilters.unshift(e):dt.prefilters.push(e)}}),k.speed=function(e,t,n){var r=e&&"object"==typeof e?k.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return k.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in k.fx.speeds?r.duration=k.fx.speeds[r.duration]:r.duration=k.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&k.dequeue(this,r.queue)},r},k.fn.extend({fadeTo:function(e,t,n,r){return this.filter(se).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=k.isEmptyObject(t),o=k.speed(e,n,r),a=function(){var e=dt(this,k.extend({},t),o);(i||Q.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&!1!==i&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=k.timers,r=Q.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&ut.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||k.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Q.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=k.timers,o=n?n.length:0;for(t.finish=!0,k.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),k.each(["toggle","show","hide"],function(e,r){var i=k.fn[r];k.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(ft(r,!0),e,t,n)}}),k.each({slideDown:ft("show"),slideUp:ft("hide"),slideToggle:ft("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){k.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),k.timers=[],k.fx.tick=function(){var e,t=0,n=k.timers;for(rt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||k.fx.stop(),rt=void 0},k.fx.timer=function(e){k.timers.push(e),k.fx.start()},k.fx.interval=13,k.fx.start=function(){it||(it=!0,lt())},k.fx.stop=function(){it=null},k.fx.speeds={slow:600,fast:200,_default:400},k.fn.delay=function(r,e){return r=k.fx&&k.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},ot=E.createElement("input"),at=E.createElement("select").appendChild(E.createElement("option")),ot.type="checkbox",y.checkOn=""!==ot.value,y.optSelected=at.selected,(ot=E.createElement("input")).value="t",ot.type="radio",y.radioValue="t"===ot.value;var ht,gt=k.expr.attrHandle;k.fn.extend({attr:function(e,t){return _(this,k.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){k.removeAttr(this,e)})}}),k.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?k.prop(e,t,n):(1===o&&k.isXMLDoc(e)||(i=k.attrHooks[t.toLowerCase()]||(k.expr.match.bool.test(t)?ht:void 0)),void 0!==n?null===n?void k.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=k.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(R);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),ht={set:function(e,t,n){return!1===t?k.removeAttr(e,n):e.setAttribute(n,n),n}},k.each(k.expr.match.bool.source.match(/\w+/g),function(e,t){var a=gt[t]||k.find.attr;gt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=gt[o],gt[o]=r,r=null!=a(e,t,n)?o:null,gt[o]=i),r}});var vt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;function mt(e){return(e.match(R)||[]).join(" ")}function xt(e){return e.getAttribute&&e.getAttribute("class")||""}function bt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(R)||[]}k.fn.extend({prop:function(e,t){return _(this,k.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[k.propFix[e]||e]})}}),k.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&k.isXMLDoc(e)||(t=k.propFix[t]||t,i=k.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=k.find.attr(e,"tabindex");return t?parseInt(t,10):vt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(k.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),k.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){k.propFix[this.toLowerCase()]=this}),k.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){k(this).addClass(t.call(this,e,xt(this)))});if((e=bt(t)).length)while(n=this[u++])if(i=xt(n),r=1===n.nodeType&&" "+mt(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=mt(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){k(this).removeClass(t.call(this,e,xt(this)))});if(!arguments.length)return this.attr("class","");if((e=bt(t)).length)while(n=this[u++])if(i=xt(n),r=1===n.nodeType&&" "+mt(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=mt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){k(this).toggleClass(i.call(this,e,xt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=k(this),r=bt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=xt(this))&&Q.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Q.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+mt(xt(n))+" ").indexOf(t))return!0;return!1}});var wt=/\r/g;k.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,k(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=k.map(t,function(e){return null==e?"":e+""})),(r=k.valHooks[this.type]||k.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=k.valHooks[t.type]||k.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(wt,""):null==e?"":e:void 0}}),k.extend({valHooks:{option:{get:function(e){var t=k.find.attr(e,"value");return null!=t?t:mt(k.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=k(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=k.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<k.inArray(k.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),k.each(["radio","checkbox"],function(){k.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<k.inArray(k(e).val(),t)}},y.checkOn||(k.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var Tt=/^(?:focusinfocus|focusoutblur)$/,Ct=function(e){e.stopPropagation()};k.extend(k.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!Tt.test(d+k.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[k.expando]?e:new k.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:k.makeArray(t,[e]),c=k.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,Tt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Q.get(o,"events")||{})[e.type]&&Q.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&G(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!G(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),k.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Ct),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Ct),k.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=k.extend(new k.Event,n,{type:e,isSimulated:!0});k.event.trigger(r,null,t)}}),k.fn.extend({trigger:function(e,t){return this.each(function(){k.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return k.event.trigger(e,t,n,!0)}}),y.focusin||k.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){k.event.simulate(r,e.target,k.event.fix(e))};k.event.special[r]={setup:function(){var e=this.ownerDocument||this,t=Q.access(e,r);t||e.addEventListener(n,i,!0),Q.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this,t=Q.access(e,r)-1;t?Q.access(e,r,t):(e.removeEventListener(n,i,!0),Q.remove(e,r))}}});var Et=C.location,kt=Date.now(),St=/\?/;k.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||k.error("Invalid XML: "+e),t};var Nt=/\[\]$/,At=/\r?\n/g,Dt=/^(?:submit|button|image|reset|file)$/i,jt=/^(?:input|select|textarea|keygen)/i;function qt(n,e,r,i){var t;if(Array.isArray(e))k.each(e,function(e,t){r||Nt.test(n)?i(n,t):qt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)qt(n+"["+t+"]",e[t],r,i)}k.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!k.isPlainObject(e))k.each(e,function(){i(this.name,this.value)});else for(n in e)qt(n,e[n],t,i);return r.join("&")},k.fn.extend({serialize:function(){return k.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=k.prop(this,"elements");return e?k.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!k(this).is(":disabled")&&jt.test(this.nodeName)&&!Dt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=k(this).val();return null==n?null:Array.isArray(n)?k.map(n,function(e){return{name:t.name,value:e.replace(At,"\r\n")}}):{name:t.name,value:n.replace(At,"\r\n")}}).get()}});var Lt=/%20/g,Ht=/#.*$/,Ot=/([?&])_=[^&]*/,Pt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Rt=/^(?:GET|HEAD)$/,Mt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Ft=E.createElement("a");function Bt(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(R)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function _t(t,i,o,a){var s={},u=t===Wt;function l(e){var r;return s[e]=!0,k.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function zt(e,t){var n,r,i=k.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&k.extend(!0,e,r),e}Ft.href=Et.href,k.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":k.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,k.ajaxSettings),t):zt(k.ajaxSettings,e)},ajaxPrefilter:Bt(It),ajaxTransport:Bt(Wt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=k.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?k(y):k.event,x=k.Deferred(),b=k.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Pt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+"").replace(Mt,Et.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(R)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Ft.protocol+"//"+Ft.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=k.param(v.data,v.traditional)),_t(It,v,t,T),h)return T;for(i in(g=k.event&&v.global)&&0==k.active++&&k.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Rt.test(v.type),f=v.url.replace(Ht,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Lt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(St.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Ot,"$1"),o=(St.test(f)?"&":"?")+"_="+kt+++o),v.url=f+o),v.ifModified&&(k.lastModified[f]&&T.setRequestHeader("If-Modified-Since",k.lastModified[f]),k.etag[f]&&T.setRequestHeader("If-None-Match",k.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+$t+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=_t(Wt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(k.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(k.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--k.active||k.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return k.get(e,t,n,"json")},getScript:function(e,t){return k.get(e,void 0,t,"script")}}),k.each(["get","post"],function(e,i){k[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),k.ajax(k.extend({url:e,type:i,dataType:r,data:t,success:n},k.isPlainObject(e)&&e))}}),k._evalUrl=function(e,t){return k.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){k.globalEval(e,t)}})},k.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=k(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){k(this).wrapInner(n.call(this,e))}):this.each(function(){var e=k(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){k(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){k(this).replaceWith(this.childNodes)}),this}}),k.expr.pseudos.hidden=function(e){return!k.expr.pseudos.visible(e)},k.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},k.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var Ut={0:200,1223:204},Xt=k.ajaxSettings.xhr();y.cors=!!Xt&&"withCredentials"in Xt,y.ajax=Xt=!!Xt,k.ajaxTransport(function(i){var o,a;if(y.cors||Xt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Ut[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),k.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),k.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return k.globalEval(e),e}}}),k.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),k.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=k("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=mt(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&k.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?k("<div>").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}}),k.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),k.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),k.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||k.guid++,i},k.holdReady=function(e){e?k.readyWait++:k.ready(!0)},k.isArray=Array.isArray,k.parseJSON=JSON.parse,k.nodeName=A,k.isFunction=m,k.isWindow=x,k.camelCase=V,k.type=w,k.now=Date.now,k.isNumeric=function(e){var t=k.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return k});var Qt=C.jQuery,Jt=C.$;return k.noConflict=function(e){return C.$===k&&(C.$=Jt),e&&C.jQuery===k&&(C.jQuery=Qt),k},e||(C.jQuery=C.$=k),k});
- /**!
- * @fileOverview Kickass library to create and place poppers near their reference elements.
- * @version 1.16.1
- * @license
- * Copyright (c) 2016 Federico Zivolo and contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global.Popper = factory());
- }(this, (function () { 'use strict';
- var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
- var timeoutDuration = function () {
- var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
- for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
- if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
- return 1;
- }
- }
- return 0;
- }();
- function microtaskDebounce(fn) {
- var called = false;
- return function () {
- if (called) {
- return;
- }
- called = true;
- window.Promise.resolve().then(function () {
- called = false;
- fn();
- });
- };
- }
- function taskDebounce(fn) {
- var scheduled = false;
- return function () {
- if (!scheduled) {
- scheduled = true;
- setTimeout(function () {
- scheduled = false;
- fn();
- }, timeoutDuration);
- }
- };
- }
- var supportsMicroTasks = isBrowser && window.Promise;
- /**
- * Create a debounced version of a method, that's asynchronously deferred
- * but called in the minimum time possible.
- *
- * @method
- * @memberof Popper.Utils
- * @argument {Function} fn
- * @returns {Function}
- */
- var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
- /**
- * Check if the given variable is a function
- * @method
- * @memberof Popper.Utils
- * @argument {Any} functionToCheck - variable to check
- * @returns {Boolean} answer to: is a function?
- */
- function isFunction(functionToCheck) {
- var getType = {};
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
- }
- /**
- * Get CSS computed property of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Eement} element
- * @argument {String} property
- */
- function getStyleComputedProperty(element, property) {
- if (element.nodeType !== 1) {
- return [];
- }
- // NOTE: 1 DOM access here
- var window = element.ownerDocument.defaultView;
- var css = window.getComputedStyle(element, null);
- return property ? css[property] : css;
- }
- /**
- * Returns the parentNode or the host of the element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} parent
- */
- function getParentNode(element) {
- if (element.nodeName === 'HTML') {
- return element;
- }
- return element.parentNode || element.host;
- }
- /**
- * Returns the scrolling parent of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} scroll parent
- */
- function getScrollParent(element) {
- // Return body, `getScroll` will take care to get the correct `scrollTop` from it
- if (!element) {
- return document.body;
- }
- switch (element.nodeName) {
- case 'HTML':
- case 'BODY':
- return element.ownerDocument.body;
- case '#document':
- return element.body;
- }
- // Firefox want us to check `-x` and `-y` variations as well
- var _getStyleComputedProp = getStyleComputedProperty(element),
- overflow = _getStyleComputedProp.overflow,
- overflowX = _getStyleComputedProp.overflowX,
- overflowY = _getStyleComputedProp.overflowY;
- if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
- return element;
- }
- return getScrollParent(getParentNode(element));
- }
- /**
- * Returns the reference node of the reference object, or the reference object itself.
- * @method
- * @memberof Popper.Utils
- * @param {Element|Object} reference - the reference element (the popper will be relative to this)
- * @returns {Element} parent
- */
- function getReferenceNode(reference) {
- return reference && reference.referenceNode ? reference.referenceNode : reference;
- }
- var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
- var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
- /**
- * Determines if the browser is Internet Explorer
- * @method
- * @memberof Popper.Utils
- * @param {Number} version to check
- * @returns {Boolean} isIE
- */
- function isIE(version) {
- if (version === 11) {
- return isIE11;
- }
- if (version === 10) {
- return isIE10;
- }
- return isIE11 || isIE10;
- }
- /**
- * Returns the offset parent of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} offset parent
- */
- function getOffsetParent(element) {
- if (!element) {
- return document.documentElement;
- }
- var noOffsetParent = isIE(10) ? document.body : null;
- // NOTE: 1 DOM access here
- var offsetParent = element.offsetParent || null;
- // Skip hidden elements which don't have an offsetParent
- while (offsetParent === noOffsetParent && element.nextElementSibling) {
- offsetParent = (element = element.nextElementSibling).offsetParent;
- }
- var nodeName = offsetParent && offsetParent.nodeName;
- if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
- return element ? element.ownerDocument.documentElement : document.documentElement;
- }
- // .offsetParent will return the closest TH, TD or TABLE in case
- // no offsetParent is present, I hate this job...
- if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
- return getOffsetParent(offsetParent);
- }
- return offsetParent;
- }
- function isOffsetContainer(element) {
- var nodeName = element.nodeName;
- if (nodeName === 'BODY') {
- return false;
- }
- return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
- }
- /**
- * Finds the root node (document, shadowDOM root) of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} node
- * @returns {Element} root node
- */
- function getRoot(node) {
- if (node.parentNode !== null) {
- return getRoot(node.parentNode);
- }
- return node;
- }
- /**
- * Finds the offset parent common to the two provided nodes
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element1
- * @argument {Element} element2
- * @returns {Element} common offset parent
- */
- function findCommonOffsetParent(element1, element2) {
- // This check is needed to avoid errors in case one of the elements isn't defined for any reason
- if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
- return document.documentElement;
- }
- // Here we make sure to give as "start" the element that comes first in the DOM
- var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
- var start = order ? element1 : element2;
- var end = order ? element2 : element1;
- // Get common ancestor container
- var range = document.createRange();
- range.setStart(start, 0);
- range.setEnd(end, 0);
- var commonAncestorContainer = range.commonAncestorContainer;
- // Both nodes are inside #document
- if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
- if (isOffsetContainer(commonAncestorContainer)) {
- return commonAncestorContainer;
- }
- return getOffsetParent(commonAncestorContainer);
- }
- // one of the nodes is inside shadowDOM, find which one
- var element1root = getRoot(element1);
- if (element1root.host) {
- return findCommonOffsetParent(element1root.host, element2);
- } else {
- return findCommonOffsetParent(element1, getRoot(element2).host);
- }
- }
- /**
- * Gets the scroll value of the given element in the given side (top and left)
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @argument {String} side `top` or `left`
- * @returns {number} amount of scrolled pixels
- */
- function getScroll(element) {
- var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
- var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
- var nodeName = element.nodeName;
- if (nodeName === 'BODY' || nodeName === 'HTML') {
- var html = element.ownerDocument.documentElement;
- var scrollingElement = element.ownerDocument.scrollingElement || html;
- return scrollingElement[upperSide];
- }
- return element[upperSide];
- }
- /*
- * Sum or subtract the element scroll values (left and top) from a given rect object
- * @method
- * @memberof Popper.Utils
- * @param {Object} rect - Rect object you want to change
- * @param {HTMLElement} element - The element from the function reads the scroll values
- * @param {Boolean} subtract - set to true if you want to subtract the scroll values
- * @return {Object} rect - The modifier rect object
- */
- function includeScroll(rect, element) {
- var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- var scrollTop = getScroll(element, 'top');
- var scrollLeft = getScroll(element, 'left');
- var modifier = subtract ? -1 : 1;
- rect.top += scrollTop * modifier;
- rect.bottom += scrollTop * modifier;
- rect.left += scrollLeft * modifier;
- rect.right += scrollLeft * modifier;
- return rect;
- }
- /*
- * Helper to detect borders of a given element
- * @method
- * @memberof Popper.Utils
- * @param {CSSStyleDeclaration} styles
- * Result of `getStyleComputedProperty` on the given element
- * @param {String} axis - `x` or `y`
- * @return {number} borders - The borders size of the given axis
- */
- function getBordersSize(styles, axis) {
- var sideA = axis === 'x' ? 'Left' : 'Top';
- var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
- return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
- }
- function getSize(axis, body, html, computedStyle) {
- return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
- }
- function getWindowSizes(document) {
- var body = document.body;
- var html = document.documentElement;
- var computedStyle = isIE(10) && getComputedStyle(html);
- return {
- height: getSize('Height', body, html, computedStyle),
- width: getSize('Width', body, html, computedStyle)
- };
- }
- var classCallCheck = function (instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- };
- 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;
- };
- }();
- var defineProperty = function (obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- };
- var _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- /**
- * Given element offsets, generate an output similar to getBoundingClientRect
- * @method
- * @memberof Popper.Utils
- * @argument {Object} offsets
- * @returns {Object} ClientRect like output
- */
- function getClientRect(offsets) {
- return _extends({}, offsets, {
- right: offsets.left + offsets.width,
- bottom: offsets.top + offsets.height
- });
- }
- /**
- * Get bounding client rect of given element
- * @method
- * @memberof Popper.Utils
- * @param {HTMLElement} element
- * @return {Object} client rect
- */
- function getBoundingClientRect(element) {
- var rect = {};
- // IE10 10 FIX: Please, don't ask, the element isn't
- // considered in DOM in some circumstances...
- // This isn't reproducible in IE10 compatibility mode of IE11
- try {
- if (isIE(10)) {
- rect = element.getBoundingClientRect();
- var scrollTop = getScroll(element, 'top');
- var scrollLeft = getScroll(element, 'left');
- rect.top += scrollTop;
- rect.left += scrollLeft;
- rect.bottom += scrollTop;
- rect.right += scrollLeft;
- } else {
- rect = element.getBoundingClientRect();
- }
- } catch (e) {}
- var result = {
- left: rect.left,
- top: rect.top,
- width: rect.right - rect.left,
- height: rect.bottom - rect.top
- };
- // subtract scrollbar size from sizes
- var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
- var width = sizes.width || element.clientWidth || result.width;
- var height = sizes.height || element.clientHeight || result.height;
- var horizScrollbar = element.offsetWidth - width;
- var vertScrollbar = element.offsetHeight - height;
- // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
- // we make this check conditional for performance reasons
- if (horizScrollbar || vertScrollbar) {
- var styles = getStyleComputedProperty(element);
- horizScrollbar -= getBordersSize(styles, 'x');
- vertScrollbar -= getBordersSize(styles, 'y');
- result.width -= horizScrollbar;
- result.height -= vertScrollbar;
- }
- return getClientRect(result);
- }
- function getOffsetRectRelativeToArbitraryNode(children, parent) {
- var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- var isIE10 = isIE(10);
- var isHTML = parent.nodeName === 'HTML';
- var childrenRect = getBoundingClientRect(children);
- var parentRect = getBoundingClientRect(parent);
- var scrollParent = getScrollParent(children);
- var styles = getStyleComputedProperty(parent);
- var borderTopWidth = parseFloat(styles.borderTopWidth);
- var borderLeftWidth = parseFloat(styles.borderLeftWidth);
- // In cases where the parent is fixed, we must ignore negative scroll in offset calc
- if (fixedPosition && isHTML) {
- parentRect.top = Math.max(parentRect.top, 0);
- parentRect.left = Math.max(parentRect.left, 0);
- }
- var offsets = getClientRect({
- top: childrenRect.top - parentRect.top - borderTopWidth,
- left: childrenRect.left - parentRect.left - borderLeftWidth,
- width: childrenRect.width,
- height: childrenRect.height
- });
- offsets.marginTop = 0;
- offsets.marginLeft = 0;
- // Subtract margins of documentElement in case it's being used as parent
- // we do this only on HTML because it's the only element that behaves
- // differently when margins are applied to it. The margins are included in
- // the box of the documentElement, in the other cases not.
- if (!isIE10 && isHTML) {
- var marginTop = parseFloat(styles.marginTop);
- var marginLeft = parseFloat(styles.marginLeft);
- offsets.top -= borderTopWidth - marginTop;
- offsets.bottom -= borderTopWidth - marginTop;
- offsets.left -= borderLeftWidth - marginLeft;
- offsets.right -= borderLeftWidth - marginLeft;
- // Attach marginTop and marginLeft because in some circumstances we may need them
- offsets.marginTop = marginTop;
- offsets.marginLeft = marginLeft;
- }
- if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
- offsets = includeScroll(offsets, parent);
- }
- return offsets;
- }
- function getViewportOffsetRectRelativeToArtbitraryNode(element) {
- var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var html = element.ownerDocument.documentElement;
- var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
- var width = Math.max(html.clientWidth, window.innerWidth || 0);
- var height = Math.max(html.clientHeight, window.innerHeight || 0);
- var scrollTop = !excludeScroll ? getScroll(html) : 0;
- var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
- var offset = {
- top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
- left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
- width: width,
- height: height
- };
- return getClientRect(offset);
- }
- /**
- * Check if the given element is fixed or is inside a fixed parent
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @argument {Element} customContainer
- * @returns {Boolean} answer to "isFixed?"
- */
- function isFixed(element) {
- var nodeName = element.nodeName;
- if (nodeName === 'BODY' || nodeName === 'HTML') {
- return false;
- }
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
- return true;
- }
- var parentNode = getParentNode(element);
- if (!parentNode) {
- return false;
- }
- return isFixed(parentNode);
- }
- /**
- * Finds the first parent of an element that has a transformed property defined
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} first transformed parent or documentElement
- */
- function getFixedPositionOffsetParent(element) {
- // This check is needed to avoid errors in case one of the elements isn't defined for any reason
- if (!element || !element.parentElement || isIE()) {
- return document.documentElement;
- }
- var el = element.parentElement;
- while (el && getStyleComputedProperty(el, 'transform') === 'none') {
- el = el.parentElement;
- }
- return el || document.documentElement;
- }
- /**
- * Computed the boundaries limits and return them
- * @method
- * @memberof Popper.Utils
- * @param {HTMLElement} popper
- * @param {HTMLElement} reference
- * @param {number} padding
- * @param {HTMLElement} boundariesElement - Element used to define the boundaries
- * @param {Boolean} fixedPosition - Is in fixed position mode
- * @returns {Object} Coordinates of the boundaries
- */
- function getBoundaries(popper, reference, padding, boundariesElement) {
- var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- // NOTE: 1 DOM access here
- var boundaries = { top: 0, left: 0 };
- var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
- // Handle viewport case
- if (boundariesElement === 'viewport') {
- boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
- } else {
- // Handle other cases based on DOM element used as boundaries
- var boundariesNode = void 0;
- if (boundariesElement === 'scrollParent') {
- boundariesNode = getScrollParent(getParentNode(reference));
- if (boundariesNode.nodeName === 'BODY') {
- boundariesNode = popper.ownerDocument.documentElement;
- }
- } else if (boundariesElement === 'window') {
- boundariesNode = popper.ownerDocument.documentElement;
- } else {
- boundariesNode = boundariesElement;
- }
- var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
- // In case of HTML, we need a different computation
- if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
- var _getWindowSizes = getWindowSizes(popper.ownerDocument),
- height = _getWindowSizes.height,
- width = _getWindowSizes.width;
- boundaries.top += offsets.top - offsets.marginTop;
- boundaries.bottom = height + offsets.top;
- boundaries.left += offsets.left - offsets.marginLeft;
- boundaries.right = width + offsets.left;
- } else {
- // for all the other DOM elements, this one is good
- boundaries = offsets;
- }
- }
- // Add paddings
- padding = padding || 0;
- var isPaddingNumber = typeof padding === 'number';
- boundaries.left += isPaddingNumber ? padding : padding.left || 0;
- boundaries.top += isPaddingNumber ? padding : padding.top || 0;
- boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
- boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
- return boundaries;
- }
- function getArea(_ref) {
- var width = _ref.width,
- height = _ref.height;
- return width * height;
- }
- /**
- * Utility used to transform the `auto` placement to the placement with more
- * available space.
- * @method
- * @memberof Popper.Utils
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
- var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
- if (placement.indexOf('auto') === -1) {
- return placement;
- }
- var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
- var rects = {
- top: {
- width: boundaries.width,
- height: refRect.top - boundaries.top
- },
- right: {
- width: boundaries.right - refRect.right,
- height: boundaries.height
- },
- bottom: {
- width: boundaries.width,
- height: boundaries.bottom - refRect.bottom
- },
- left: {
- width: refRect.left - boundaries.left,
- height: boundaries.height
- }
- };
- var sortedAreas = Object.keys(rects).map(function (key) {
- return _extends({
- key: key
- }, rects[key], {
- area: getArea(rects[key])
- });
- }).sort(function (a, b) {
- return b.area - a.area;
- });
- var filteredAreas = sortedAreas.filter(function (_ref2) {
- var width = _ref2.width,
- height = _ref2.height;
- return width >= popper.clientWidth && height >= popper.clientHeight;
- });
- var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
- var variation = placement.split('-')[1];
- return computedPlacement + (variation ? '-' + variation : '');
- }
- /**
- * Get offsets to the reference element
- * @method
- * @memberof Popper.Utils
- * @param {Object} state
- * @param {Element} popper - the popper element
- * @param {Element} reference - the reference element (the popper will be relative to this)
- * @param {Element} fixedPosition - is in fixed position mode
- * @returns {Object} An object containing the offsets which will be applied to the popper
- */
- function getReferenceOffsets(state, popper, reference) {
- var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
- var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
- return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
- }
- /**
- * Get the outer sizes of the given element (offset size + margins)
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Object} object containing width and height properties
- */
- function getOuterSizes(element) {
- var window = element.ownerDocument.defaultView;
- var styles = window.getComputedStyle(element);
- var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
- var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
- var result = {
- width: element.offsetWidth + y,
- height: element.offsetHeight + x
- };
- return result;
- }
- /**
- * Get the opposite placement of the given one
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement
- * @returns {String} flipped placement
- */
- function getOppositePlacement(placement) {
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
- return placement.replace(/left|right|bottom|top/g, function (matched) {
- return hash[matched];
- });
- }
- /**
- * Get offsets to the popper
- * @method
- * @memberof Popper.Utils
- * @param {Object} position - CSS position the Popper will get applied
- * @param {HTMLElement} popper - the popper element
- * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
- * @param {String} placement - one of the valid placement options
- * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
- */
- function getPopperOffsets(popper, referenceOffsets, placement) {
- placement = placement.split('-')[0];
- // Get popper node sizes
- var popperRect = getOuterSizes(popper);
- // Add position, width and height to our offsets object
- var popperOffsets = {
- width: popperRect.width,
- height: popperRect.height
- };
- // depending by the popper placement we have to compute its offsets slightly differently
- var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
- var mainSide = isHoriz ? 'top' : 'left';
- var secondarySide = isHoriz ? 'left' : 'top';
- var measurement = isHoriz ? 'height' : 'width';
- var secondaryMeasurement = !isHoriz ? 'height' : 'width';
- popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
- if (placement === secondarySide) {
- popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
- } else {
- popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
- }
- return popperOffsets;
- }
- /**
- * Mimics the `find` method of Array
- * @method
- * @memberof Popper.Utils
- * @argument {Array} arr
- * @argument prop
- * @argument value
- * @returns index or -1
- */
- function find(arr, check) {
- // use native find if supported
- if (Array.prototype.find) {
- return arr.find(check);
- }
- // use `filter` to obtain the same behavior of `find`
- return arr.filter(check)[0];
- }
- /**
- * Return the index of the matching object
- * @method
- * @memberof Popper.Utils
- * @argument {Array} arr
- * @argument prop
- * @argument value
- * @returns index or -1
- */
- function findIndex(arr, prop, value) {
- // use native findIndex if supported
- if (Array.prototype.findIndex) {
- return arr.findIndex(function (cur) {
- return cur[prop] === value;
- });
- }
- // use `find` + `indexOf` if `findIndex` isn't supported
- var match = find(arr, function (obj) {
- return obj[prop] === value;
- });
- return arr.indexOf(match);
- }
- /**
- * Loop trough the list of modifiers and run them in order,
- * each of them will then edit the data object.
- * @method
- * @memberof Popper.Utils
- * @param {dataObject} data
- * @param {Array} modifiers
- * @param {String} ends - Optional modifier name used as stopper
- * @returns {dataObject}
- */
- function runModifiers(modifiers, data, ends) {
- var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
- modifiersToRun.forEach(function (modifier) {
- if (modifier['function']) {
- // eslint-disable-line dot-notation
- console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
- }
- var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
- if (modifier.enabled && isFunction(fn)) {
- // Add properties to offsets to make them a complete clientRect object
- // we do this before each modifier to make sure the previous one doesn't
- // mess with these values
- data.offsets.popper = getClientRect(data.offsets.popper);
- data.offsets.reference = getClientRect(data.offsets.reference);
- data = fn(data, modifier);
- }
- });
- return data;
- }
- /**
- * Updates the position of the popper, computing the new offsets and applying
- * the new style.<br />
- * Prefer `scheduleUpdate` over `update` because of performance reasons.
- * @method
- * @memberof Popper
- */
- function update() {
- // if popper is destroyed, don't perform any further update
- if (this.state.isDestroyed) {
- return;
- }
- var data = {
- instance: this,
- styles: {},
- arrowStyles: {},
- attributes: {},
- flipped: false,
- offsets: {}
- };
- // compute reference element offsets
- data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
- // compute auto placement, store placement inside the data object,
- // modifiers will be able to edit `placement` if needed
- // and refer to originalPlacement to know the original value
- data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
- // store the computed placement inside `originalPlacement`
- data.originalPlacement = data.placement;
- data.positionFixed = this.options.positionFixed;
- // compute the popper offsets
- data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
- data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
- // run the modifiers
- data = runModifiers(this.modifiers, data);
- // the first `update` will call `onCreate` callback
- // the other ones will call `onUpdate` callback
- if (!this.state.isCreated) {
- this.state.isCreated = true;
- this.options.onCreate(data);
- } else {
- this.options.onUpdate(data);
- }
- }
- /**
- * Helper used to know if the given modifier is enabled.
- * @method
- * @memberof Popper.Utils
- * @returns {Boolean}
- */
- function isModifierEnabled(modifiers, modifierName) {
- return modifiers.some(function (_ref) {
- var name = _ref.name,
- enabled = _ref.enabled;
- return enabled && name === modifierName;
- });
- }
- /**
- * Get the prefixed supported property name
- * @method
- * @memberof Popper.Utils
- * @argument {String} property (camelCase)
- * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
- */
- function getSupportedPropertyName(property) {
- var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
- var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
- for (var i = 0; i < prefixes.length; i++) {
- var prefix = prefixes[i];
- var toCheck = prefix ? '' + prefix + upperProp : property;
- if (typeof document.body.style[toCheck] !== 'undefined') {
- return toCheck;
- }
- }
- return null;
- }
- /**
- * Destroys the popper.
- * @method
- * @memberof Popper
- */
- function destroy() {
- this.state.isDestroyed = true;
- // touch DOM only if `applyStyle` modifier is enabled
- if (isModifierEnabled(this.modifiers, 'applyStyle')) {
- this.popper.removeAttribute('x-placement');
- this.popper.style.position = '';
- this.popper.style.top = '';
- this.popper.style.left = '';
- this.popper.style.right = '';
- this.popper.style.bottom = '';
- this.popper.style.willChange = '';
- this.popper.style[getSupportedPropertyName('transform')] = '';
- }
- this.disableEventListeners();
- // remove the popper if user explicitly asked for the deletion on destroy
- // do not use `remove` because IE11 doesn't support it
- if (this.options.removeOnDestroy) {
- this.popper.parentNode.removeChild(this.popper);
- }
- return this;
- }
- /**
- * Get the window associated with the element
- * @argument {Element} element
- * @returns {Window}
- */
- function getWindow(element) {
- var ownerDocument = element.ownerDocument;
- return ownerDocument ? ownerDocument.defaultView : window;
- }
- function attachToScrollParents(scrollParent, event, callback, scrollParents) {
- var isBody = scrollParent.nodeName === 'BODY';
- var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
- target.addEventListener(event, callback, { passive: true });
- if (!isBody) {
- attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
- }
- scrollParents.push(target);
- }
- /**
- * Setup needed event listeners used to update the popper position
- * @method
- * @memberof Popper.Utils
- * @private
- */
- function setupEventListeners(reference, options, state, updateBound) {
- // Resize event listener on window
- state.updateBound = updateBound;
- getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
- // Scroll event listener on scroll parents
- var scrollElement = getScrollParent(reference);
- attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
- state.scrollElement = scrollElement;
- state.eventsEnabled = true;
- return state;
- }
- /**
- * It will add resize/scroll events and start recalculating
- * position of the popper element when they are triggered.
- * @method
- * @memberof Popper
- */
- function enableEventListeners() {
- if (!this.state.eventsEnabled) {
- this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
- }
- }
- /**
- * Remove event listeners used to update the popper position
- * @method
- * @memberof Popper.Utils
- * @private
- */
- function removeEventListeners(reference, state) {
- // Remove resize event listener on window
- getWindow(reference).removeEventListener('resize', state.updateBound);
- // Remove scroll event listener on scroll parents
- state.scrollParents.forEach(function (target) {
- target.removeEventListener('scroll', state.updateBound);
- });
- // Reset state
- state.updateBound = null;
- state.scrollParents = [];
- state.scrollElement = null;
- state.eventsEnabled = false;
- return state;
- }
- /**
- * It will remove resize/scroll events and won't recalculate popper position
- * when they are triggered. It also won't trigger `onUpdate` callback anymore,
- * unless you call `update` method manually.
- * @method
- * @memberof Popper
- */
- function disableEventListeners() {
- if (this.state.eventsEnabled) {
- cancelAnimationFrame(this.scheduleUpdate);
- this.state = removeEventListeners(this.reference, this.state);
- }
- }
- /**
- * Tells if a given input is a number
- * @method
- * @memberof Popper.Utils
- * @param {*} input to check
- * @return {Boolean}
- */
- function isNumeric(n) {
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
- }
- /**
- * Set the style to the given popper
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element - Element to apply the style to
- * @argument {Object} styles
- * Object with a list of properties and values which will be applied to the element
- */
- function setStyles(element, styles) {
- Object.keys(styles).forEach(function (prop) {
- var unit = '';
- // add unit if the value is numeric and is one of the following
- if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
- unit = 'px';
- }
- element.style[prop] = styles[prop] + unit;
- });
- }
- /**
- * Set the attributes to the given popper
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element - Element to apply the attributes to
- * @argument {Object} styles
- * Object with a list of properties and values which will be applied to the element
- */
- function setAttributes(element, attributes) {
- Object.keys(attributes).forEach(function (prop) {
- var value = attributes[prop];
- if (value !== false) {
- element.setAttribute(prop, attributes[prop]);
- } else {
- element.removeAttribute(prop);
- }
- });
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} data.styles - List of style properties - values to apply to popper element
- * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The same data object
- */
- function applyStyle(data) {
- // any property present in `data.styles` will be applied to the popper,
- // in this way we can make the 3rd party modifiers add custom styles to it
- // Be aware, modifiers could override the properties defined in the previous
- // lines of this modifier!
- setStyles(data.instance.popper, data.styles);
- // any property present in `data.attributes` will be applied to the popper,
- // they will be set as HTML attributes of the element
- setAttributes(data.instance.popper, data.attributes);
- // if arrowElement is defined and arrowStyles has some properties
- if (data.arrowElement && Object.keys(data.arrowStyles).length) {
- setStyles(data.arrowElement, data.arrowStyles);
- }
- return data;
- }
- /**
- * Set the x-placement attribute before everything else because it could be used
- * to add margins to the popper margins needs to be calculated to get the
- * correct popper offsets.
- * @method
- * @memberof Popper.modifiers
- * @param {HTMLElement} reference - The reference element used to position the popper
- * @param {HTMLElement} popper - The HTML element used as popper
- * @param {Object} options - Popper.js options
- */
- function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
- // compute reference element offsets
- var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
- // compute auto placement, store placement inside the data object,
- // modifiers will be able to edit `placement` if needed
- // and refer to originalPlacement to know the original value
- var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
- popper.setAttribute('x-placement', placement);
- // Apply `position` to popper before anything else because
- // without the position applied we can't guarantee correct computations
- setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
- return options;
- }
- /**
- * @function
- * @memberof Popper.Utils
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Boolean} shouldRound - If the offsets should be rounded at all
- * @returns {Object} The popper's position offsets rounded
- *
- * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
- * good as it can be within reason.
- * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
- *
- * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
- * as well on High DPI screens).
- *
- * Firefox prefers no rounding for positioning and does not have blurriness on
- * high DPI screens.
- *
- * Only horizontal placement and left/right values need to be considered.
- */
- function getRoundedOffsets(data, shouldRound) {
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
- var round = Math.round,
- floor = Math.floor;
- var noRound = function noRound(v) {
- return v;
- };
- var referenceWidth = round(reference.width);
- var popperWidth = round(popper.width);
- var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
- var isVariation = data.placement.indexOf('-') !== -1;
- var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
- var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
- var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
- var verticalToInteger = !shouldRound ? noRound : round;
- return {
- left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
- top: verticalToInteger(popper.top),
- bottom: verticalToInteger(popper.bottom),
- right: horizontalToInteger(popper.right)
- };
- }
- var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function computeStyle(data, options) {
- var x = options.x,
- y = options.y;
- var popper = data.offsets.popper;
- // Remove this legacy support in Popper.js v2
- var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
- return modifier.name === 'applyStyle';
- }).gpuAcceleration;
- if (legacyGpuAccelerationOption !== undefined) {
- console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
- }
- var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
- var offsetParent = getOffsetParent(data.instance.popper);
- var offsetParentRect = getBoundingClientRect(offsetParent);
- // Styles
- var styles = {
- position: popper.position
- };
- var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
- var sideA = x === 'bottom' ? 'top' : 'bottom';
- var sideB = y === 'right' ? 'left' : 'right';
- // if gpuAcceleration is set to `true` and transform is supported,
- // we use `translate3d` to apply the position to the popper we
- // automatically use the supported prefixed version if needed
- var prefixedProperty = getSupportedPropertyName('transform');
- // now, let's make a step back and look at this code closely (wtf?)
- // If the content of the popper grows once it's been positioned, it
- // may happen that the popper gets misplaced because of the new content
- // overflowing its reference element
- // To avoid this problem, we provide two options (x and y), which allow
- // the consumer to define the offset origin.
- // If we position a popper on top of a reference element, we can set
- // `x` to `top` to make the popper grow towards its top instead of
- // its bottom.
- var left = void 0,
- top = void 0;
- if (sideA === 'bottom') {
- // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
- // and not the bottom of the html element
- if (offsetParent.nodeName === 'HTML') {
- top = -offsetParent.clientHeight + offsets.bottom;
- } else {
- top = -offsetParentRect.height + offsets.bottom;
- }
- } else {
- top = offsets.top;
- }
- if (sideB === 'right') {
- if (offsetParent.nodeName === 'HTML') {
- left = -offsetParent.clientWidth + offsets.right;
- } else {
- left = -offsetParentRect.width + offsets.right;
- }
- } else {
- left = offsets.left;
- }
- if (gpuAcceleration && prefixedProperty) {
- styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
- styles[sideA] = 0;
- styles[sideB] = 0;
- styles.willChange = 'transform';
- } else {
- // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
- var invertTop = sideA === 'bottom' ? -1 : 1;
- var invertLeft = sideB === 'right' ? -1 : 1;
- styles[sideA] = top * invertTop;
- styles[sideB] = left * invertLeft;
- styles.willChange = sideA + ', ' + sideB;
- }
- // Attributes
- var attributes = {
- 'x-placement': data.placement
- };
- // Update `data` attributes, styles and arrowStyles
- data.attributes = _extends({}, attributes, data.attributes);
- data.styles = _extends({}, styles, data.styles);
- data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
- return data;
- }
- /**
- * Helper used to know if the given modifier depends from another one.<br />
- * It checks if the needed modifier is listed and enabled.
- * @method
- * @memberof Popper.Utils
- * @param {Array} modifiers - list of modifiers
- * @param {String} requestingName - name of requesting modifier
- * @param {String} requestedName - name of requested modifier
- * @returns {Boolean}
- */
- function isModifierRequired(modifiers, requestingName, requestedName) {
- var requesting = find(modifiers, function (_ref) {
- var name = _ref.name;
- return name === requestingName;
- });
- var isRequired = !!requesting && modifiers.some(function (modifier) {
- return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
- });
- if (!isRequired) {
- var _requesting = '`' + requestingName + '`';
- var requested = '`' + requestedName + '`';
- console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
- }
- return isRequired;
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function arrow(data, options) {
- var _data$offsets$arrow;
- // arrow depends on keepTogether in order to work
- if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
- return data;
- }
- var arrowElement = options.element;
- // if arrowElement is a string, suppose it's a CSS selector
- if (typeof arrowElement === 'string') {
- arrowElement = data.instance.popper.querySelector(arrowElement);
- // if arrowElement is not found, don't run the modifier
- if (!arrowElement) {
- return data;
- }
- } else {
- // if the arrowElement isn't a query selector we must check that the
- // provided DOM node is child of its popper node
- if (!data.instance.popper.contains(arrowElement)) {
- console.warn('WARNING: `arrow.element` must be child of its popper element!');
- return data;
- }
- }
- var placement = data.placement.split('-')[0];
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
- var len = isVertical ? 'height' : 'width';
- var sideCapitalized = isVertical ? 'Top' : 'Left';
- var side = sideCapitalized.toLowerCase();
- var altSide = isVertical ? 'left' : 'top';
- var opSide = isVertical ? 'bottom' : 'right';
- var arrowElementSize = getOuterSizes(arrowElement)[len];
- //
- // extends keepTogether behavior making sure the popper and its
- // reference have enough pixels in conjunction
- //
- // top/left side
- if (reference[opSide] - arrowElementSize < popper[side]) {
- data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
- }
- // bottom/right side
- if (reference[side] + arrowElementSize > popper[opSide]) {
- data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
- }
- data.offsets.popper = getClientRect(data.offsets.popper);
- // compute center of the popper
- var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
- // Compute the sideValue using the updated popper offsets
- // take popper margin in account because we don't have this info available
- var css = getStyleComputedProperty(data.instance.popper);
- var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
- var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
- var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
- // prevent arrowElement from being placed not contiguously to its popper
- sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
- data.arrowElement = arrowElement;
- data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
- return data;
- }
- /**
- * Get the opposite placement variation of the given one
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement variation
- * @returns {String} flipped placement variation
- */
- function getOppositeVariation(variation) {
- if (variation === 'end') {
- return 'start';
- } else if (variation === 'start') {
- return 'end';
- }
- return variation;
- }
- /**
- * List of accepted placements to use as values of the `placement` option.<br />
- * Valid placements are:
- * - `auto`
- * - `top`
- * - `right`
- * - `bottom`
- * - `left`
- *
- * Each placement can have a variation from this list:
- * - `-start`
- * - `-end`
- *
- * Variations are interpreted easily if you think of them as the left to right
- * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
- * is right.<br />
- * Vertically (`left` and `right`), `start` is top and `end` is bottom.
- *
- * Some valid examples are:
- * - `top-end` (on top of reference, right aligned)
- * - `right-start` (on right of reference, top aligned)
- * - `bottom` (on bottom, centered)
- * - `auto-end` (on the side with more space available, alignment depends by placement)
- *
- * @static
- * @type {Array}
- * @enum {String}
- * @readonly
- * @method placements
- * @memberof Popper
- */
- var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
- // Get rid of `auto` `auto-start` and `auto-end`
- var validPlacements = placements.slice(3);
- /**
- * Given an initial placement, returns all the subsequent placements
- * clockwise (or counter-clockwise).
- *
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement - A valid placement (it accepts variations)
- * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
- * @returns {Array} placements including their variations
- */
- function clockwise(placement) {
- var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var index = validPlacements.indexOf(placement);
- var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
- return counter ? arr.reverse() : arr;
- }
- var BEHAVIORS = {
- FLIP: 'flip',
- CLOCKWISE: 'clockwise',
- COUNTERCLOCKWISE: 'counterclockwise'
- };
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function flip(data, options) {
- // if `inner` modifier is enabled, we can't use the `flip` modifier
- if (isModifierEnabled(data.instance.modifiers, 'inner')) {
- return data;
- }
- if (data.flipped && data.placement === data.originalPlacement) {
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
- return data;
- }
- var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
- var placement = data.placement.split('-')[0];
- var placementOpposite = getOppositePlacement(placement);
- var variation = data.placement.split('-')[1] || '';
- var flipOrder = [];
- switch (options.behavior) {
- case BEHAVIORS.FLIP:
- flipOrder = [placement, placementOpposite];
- break;
- case BEHAVIORS.CLOCKWISE:
- flipOrder = clockwise(placement);
- break;
- case BEHAVIORS.COUNTERCLOCKWISE:
- flipOrder = clockwise(placement, true);
- break;
- default:
- flipOrder = options.behavior;
- }
- flipOrder.forEach(function (step, index) {
- if (placement !== step || flipOrder.length === index + 1) {
- return data;
- }
- placement = data.placement.split('-')[0];
- placementOpposite = getOppositePlacement(placement);
- var popperOffsets = data.offsets.popper;
- var refOffsets = data.offsets.reference;
- // using floor because the reference offsets may contain decimals we are not going to consider here
- var floor = Math.floor;
- var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
- var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
- var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
- var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
- var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
- var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
- // flip the variation if required
- var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
- // flips variation if reference element overflows boundaries
- var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
- // flips variation if popper content overflows boundaries
- var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
- var flippedVariation = flippedVariationByRef || flippedVariationByContent;
- if (overlapsRef || overflowsBoundaries || flippedVariation) {
- // this boolean to detect any flip loop
- data.flipped = true;
- if (overlapsRef || overflowsBoundaries) {
- placement = flipOrder[index + 1];
- }
- if (flippedVariation) {
- variation = getOppositeVariation(variation);
- }
- data.placement = placement + (variation ? '-' + variation : '');
- // this object contains `position`, we want to preserve it along with
- // any additional property we may add in the future
- data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
- data = runModifiers(data.instance.modifiers, data, 'flip');
- }
- });
- return data;
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function keepTogether(data) {
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
- var placement = data.placement.split('-')[0];
- var floor = Math.floor;
- var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
- var side = isVertical ? 'right' : 'bottom';
- var opSide = isVertical ? 'left' : 'top';
- var measurement = isVertical ? 'width' : 'height';
- if (popper[side] < floor(reference[opSide])) {
- data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
- }
- if (popper[opSide] > floor(reference[side])) {
- data.offsets.popper[opSide] = floor(reference[side]);
- }
- return data;
- }
- /**
- * Converts a string containing value + unit into a px value number
- * @function
- * @memberof {modifiers~offset}
- * @private
- * @argument {String} str - Value + unit string
- * @argument {String} measurement - `height` or `width`
- * @argument {Object} popperOffsets
- * @argument {Object} referenceOffsets
- * @returns {Number|String}
- * Value in pixels, or original string if no values were extracted
- */
- function toValue(str, measurement, popperOffsets, referenceOffsets) {
- // separate value from unit
- var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
- var value = +split[1];
- var unit = split[2];
- // If it's not a number it's an operator, I guess
- if (!value) {
- return str;
- }
- if (unit.indexOf('%') === 0) {
- var element = void 0;
- switch (unit) {
- case '%p':
- element = popperOffsets;
- break;
- case '%':
- case '%r':
- default:
- element = referenceOffsets;
- }
- var rect = getClientRect(element);
- return rect[measurement] / 100 * value;
- } else if (unit === 'vh' || unit === 'vw') {
- // if is a vh or vw, we calculate the size based on the viewport
- var size = void 0;
- if (unit === 'vh') {
- size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
- } else {
- size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
- }
- return size / 100 * value;
- } else {
- // if is an explicit pixel unit, we get rid of the unit and keep the value
- // if is an implicit unit, it's px, and we return just the value
- return value;
- }
- }
- /**
- * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
- * @function
- * @memberof {modifiers~offset}
- * @private
- * @argument {String} offset
- * @argument {Object} popperOffsets
- * @argument {Object} referenceOffsets
- * @argument {String} basePlacement
- * @returns {Array} a two cells array with x and y offsets in numbers
- */
- function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
- var offsets = [0, 0];
- // Use height if placement is left or right and index is 0 otherwise use width
- // in this way the first offset will use an axis and the second one
- // will use the other one
- var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
- // Split the offset string to obtain a list of values and operands
- // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
- var fragments = offset.split(/(\+|\-)/).map(function (frag) {
- return frag.trim();
- });
- // Detect if the offset string contains a pair of values or a single one
- // they could be separated by comma or space
- var divider = fragments.indexOf(find(fragments, function (frag) {
- return frag.search(/,|\s/) !== -1;
- }));
- if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
- console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
- }
- // If divider is found, we divide the list of values and operands to divide
- // them by ofset X and Y.
- var splitRegex = /\s*,\s*|\s+/;
- var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
- // Convert the values with units to absolute pixels to allow our computations
- ops = ops.map(function (op, index) {
- // Most of the units rely on the orientation of the popper
- var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
- var mergeWithPrevious = false;
- return op
- // This aggregates any `+` or `-` sign that aren't considered operators
- // e.g.: 10 + +5 => [10, +, +5]
- .reduce(function (a, b) {
- if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
- a[a.length - 1] = b;
- mergeWithPrevious = true;
- return a;
- } else if (mergeWithPrevious) {
- a[a.length - 1] += b;
- mergeWithPrevious = false;
- return a;
- } else {
- return a.concat(b);
- }
- }, [])
- // Here we convert the string values into number values (in px)
- .map(function (str) {
- return toValue(str, measurement, popperOffsets, referenceOffsets);
- });
- });
- // Loop trough the offsets arrays and execute the operations
- ops.forEach(function (op, index) {
- op.forEach(function (frag, index2) {
- if (isNumeric(frag)) {
- offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
- }
- });
- });
- return offsets;
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @argument {Number|String} options.offset=0
- * The offset value as described in the modifier description
- * @returns {Object} The data object, properly modified
- */
- function offset(data, _ref) {
- var offset = _ref.offset;
- var placement = data.placement,
- _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
- var basePlacement = placement.split('-')[0];
- var offsets = void 0;
- if (isNumeric(+offset)) {
- offsets = [+offset, 0];
- } else {
- offsets = parseOffset(offset, popper, reference, basePlacement);
- }
- if (basePlacement === 'left') {
- popper.top += offsets[0];
- popper.left -= offsets[1];
- } else if (basePlacement === 'right') {
- popper.top += offsets[0];
- popper.left += offsets[1];
- } else if (basePlacement === 'top') {
- popper.left += offsets[0];
- popper.top -= offsets[1];
- } else if (basePlacement === 'bottom') {
- popper.left += offsets[0];
- popper.top += offsets[1];
- }
- data.popper = popper;
- return data;
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function preventOverflow(data, options) {
- var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
- // If offsetParent is the reference element, we really want to
- // go one step up and use the next offsetParent as reference to
- // avoid to make this modifier completely useless and look like broken
- if (data.instance.reference === boundariesElement) {
- boundariesElement = getOffsetParent(boundariesElement);
- }
- // NOTE: DOM access here
- // resets the popper's position so that the document size can be calculated excluding
- // the size of the popper element itself
- var transformProp = getSupportedPropertyName('transform');
- var popperStyles = data.instance.popper.style; // assignment to help minification
- var top = popperStyles.top,
- left = popperStyles.left,
- transform = popperStyles[transformProp];
- popperStyles.top = '';
- popperStyles.left = '';
- popperStyles[transformProp] = '';
- var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
- // NOTE: DOM access here
- // restores the original style properties after the offsets have been computed
- popperStyles.top = top;
- popperStyles.left = left;
- popperStyles[transformProp] = transform;
- options.boundaries = boundaries;
- var order = options.priority;
- var popper = data.offsets.popper;
- var check = {
- primary: function primary(placement) {
- var value = popper[placement];
- if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
- value = Math.max(popper[placement], boundaries[placement]);
- }
- return defineProperty({}, placement, value);
- },
- secondary: function secondary(placement) {
- var mainSide = placement === 'right' ? 'left' : 'top';
- var value = popper[mainSide];
- if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
- value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
- }
- return defineProperty({}, mainSide, value);
- }
- };
- order.forEach(function (placement) {
- var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
- popper = _extends({}, popper, check[side](placement));
- });
- data.offsets.popper = popper;
- return data;
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function shift(data) {
- var placement = data.placement;
- var basePlacement = placement.split('-')[0];
- var shiftvariation = placement.split('-')[1];
- // if shift shiftvariation is specified, run the modifier
- if (shiftvariation) {
- var _data$offsets = data.offsets,
- reference = _data$offsets.reference,
- popper = _data$offsets.popper;
- var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
- var side = isVertical ? 'left' : 'top';
- var measurement = isVertical ? 'width' : 'height';
- var shiftOffsets = {
- start: defineProperty({}, side, reference[side]),
- end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
- };
- data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
- }
- return data;
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function hide(data) {
- if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
- return data;
- }
- var refRect = data.offsets.reference;
- var bound = find(data.instance.modifiers, function (modifier) {
- return modifier.name === 'preventOverflow';
- }).boundaries;
- if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
- // Avoid unnecessary DOM access if visibility hasn't changed
- if (data.hide === true) {
- return data;
- }
- data.hide = true;
- data.attributes['x-out-of-boundaries'] = '';
- } else {
- // Avoid unnecessary DOM access if visibility hasn't changed
- if (data.hide === false) {
- return data;
- }
- data.hide = false;
- data.attributes['x-out-of-boundaries'] = false;
- }
- return data;
- }
- /**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
- function inner(data) {
- var placement = data.placement;
- var basePlacement = placement.split('-')[0];
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
- var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
- var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
- popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
- data.placement = getOppositePlacement(placement);
- data.offsets.popper = getClientRect(popper);
- return data;
- }
- /**
- * Modifier function, each modifier can have a function of this type assigned
- * to its `fn` property.<br />
- * These functions will be called on each update, this means that you must
- * make sure they are performant enough to avoid performance bottlenecks.
- *
- * @function ModifierFn
- * @argument {dataObject} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {dataObject} The data object, properly modified
- */
- /**
- * Modifiers are plugins used to alter the behavior of your poppers.<br />
- * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
- * needed by the library.
- *
- * Usually you don't want to override the `order`, `fn` and `onLoad` props.
- * All the other properties are configurations that could be tweaked.
- * @namespace modifiers
- */
- var modifiers = {
- /**
- * Modifier used to shift the popper on the start or end of its reference
- * element.<br />
- * It will read the variation of the `placement` property.<br />
- * It can be one either `-end` or `-start`.
- * @memberof modifiers
- * @inner
- */
- shift: {
- /** @prop {number} order=100 - Index used to define the order of execution */
- order: 100,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: shift
- },
- /**
- * The `offset` modifier can shift your popper on both its axis.
- *
- * It accepts the following units:
- * - `px` or unit-less, interpreted as pixels
- * - `%` or `%r`, percentage relative to the length of the reference element
- * - `%p`, percentage relative to the length of the popper element
- * - `vw`, CSS viewport width unit
- * - `vh`, CSS viewport height unit
- *
- * For length is intended the main axis relative to the placement of the popper.<br />
- * This means that if the placement is `top` or `bottom`, the length will be the
- * `width`. In case of `left` or `right`, it will be the `height`.
- *
- * You can provide a single value (as `Number` or `String`), or a pair of values
- * as `String` divided by a comma or one (or more) white spaces.<br />
- * The latter is a deprecated method because it leads to confusion and will be
- * removed in v2.<br />
- * Additionally, it accepts additions and subtractions between different units.
- * Note that multiplications and divisions aren't supported.
- *
- * Valid examples are:
- * ```
- * 10
- * '10%'
- * '10, 10'
- * '10%, 10'
- * '10 + 10%'
- * '10 - 5vh + 3%'
- * '-10px + 5vh, 5px - 6%'
- * ```
- * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
- * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
- * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
- *
- * @memberof modifiers
- * @inner
- */
- offset: {
- /** @prop {number} order=200 - Index used to define the order of execution */
- order: 200,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: offset,
- /** @prop {Number|String} offset=0
- * The offset value as described in the modifier description
- */
- offset: 0
- },
- /**
- * Modifier used to prevent the popper from being positioned outside the boundary.
- *
- * A scenario exists where the reference itself is not within the boundaries.<br />
- * We can say it has "escaped the boundaries" — or just "escaped".<br />
- * In this case we need to decide whether the popper should either:
- *
- * - detach from the reference and remain "trapped" in the boundaries, or
- * - if it should ignore the boundary and "escape with its reference"
- *
- * When `escapeWithReference` is set to`true` and reference is completely
- * outside its boundaries, the popper will overflow (or completely leave)
- * the boundaries in order to remain attached to the edge of the reference.
- *
- * @memberof modifiers
- * @inner
- */
- preventOverflow: {
- /** @prop {number} order=300 - Index used to define the order of execution */
- order: 300,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: preventOverflow,
- /**
- * @prop {Array} [priority=['left','right','top','bottom']]
- * Popper will try to prevent overflow following these priorities by default,
- * then, it could overflow on the left and on top of the `boundariesElement`
- */
- priority: ['left', 'right', 'top', 'bottom'],
- /**
- * @prop {number} padding=5
- * Amount of pixel used to define a minimum distance between the boundaries
- * and the popper. This makes sure the popper always has a little padding
- * between the edges of its container
- */
- padding: 5,
- /**
- * @prop {String|HTMLElement} boundariesElement='scrollParent'
- * Boundaries used by the modifier. Can be `scrollParent`, `window`,
- * `viewport` or any DOM element.
- */
- boundariesElement: 'scrollParent'
- },
- /**
- * Modifier used to make sure the reference and its popper stay near each other
- * without leaving any gap between the two. Especially useful when the arrow is
- * enabled and you want to ensure that it points to its reference element.
- * It cares only about the first axis. You can still have poppers with margin
- * between the popper and its reference element.
- * @memberof modifiers
- * @inner
- */
- keepTogether: {
- /** @prop {number} order=400 - Index used to define the order of execution */
- order: 400,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: keepTogether
- },
- /**
- * This modifier is used to move the `arrowElement` of the popper to make
- * sure it is positioned between the reference element and its popper element.
- * It will read the outer size of the `arrowElement` node to detect how many
- * pixels of conjunction are needed.
- *
- * It has no effect if no `arrowElement` is provided.
- * @memberof modifiers
- * @inner
- */
- arrow: {
- /** @prop {number} order=500 - Index used to define the order of execution */
- order: 500,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: arrow,
- /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
- element: '[x-arrow]'
- },
- /**
- * Modifier used to flip the popper's placement when it starts to overlap its
- * reference element.
- *
- * Requires the `preventOverflow` modifier before it in order to work.
- *
- * **NOTE:** this modifier will interrupt the current update cycle and will
- * restart it if it detects the need to flip the placement.
- * @memberof modifiers
- * @inner
- */
- flip: {
- /** @prop {number} order=600 - Index used to define the order of execution */
- order: 600,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: flip,
- /**
- * @prop {String|Array} behavior='flip'
- * The behavior used to change the popper's placement. It can be one of
- * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
- * placements (with optional variations)
- */
- behavior: 'flip',
- /**
- * @prop {number} padding=5
- * The popper will flip if it hits the edges of the `boundariesElement`
- */
- padding: 5,
- /**
- * @prop {String|HTMLElement} boundariesElement='viewport'
- * The element which will define the boundaries of the popper position.
- * The popper will never be placed outside of the defined boundaries
- * (except if `keepTogether` is enabled)
- */
- boundariesElement: 'viewport',
- /**
- * @prop {Boolean} flipVariations=false
- * The popper will switch placement variation between `-start` and `-end` when
- * the reference element overlaps its boundaries.
- *
- * The original placement should have a set variation.
- */
- flipVariations: false,
- /**
- * @prop {Boolean} flipVariationsByContent=false
- * The popper will switch placement variation between `-start` and `-end` when
- * the popper element overlaps its reference boundaries.
- *
- * The original placement should have a set variation.
- */
- flipVariationsByContent: false
- },
- /**
- * Modifier used to make the popper flow toward the inner of the reference element.
- * By default, when this modifier is disabled, the popper will be placed outside
- * the reference element.
- * @memberof modifiers
- * @inner
- */
- inner: {
- /** @prop {number} order=700 - Index used to define the order of execution */
- order: 700,
- /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
- enabled: false,
- /** @prop {ModifierFn} */
- fn: inner
- },
- /**
- * Modifier used to hide the popper when its reference element is outside of the
- * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
- * be used to hide with a CSS selector the popper when its reference is
- * out of boundaries.
- *
- * Requires the `preventOverflow` modifier before it in order to work.
- * @memberof modifiers
- * @inner
- */
- hide: {
- /** @prop {number} order=800 - Index used to define the order of execution */
- order: 800,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: hide
- },
- /**
- * Computes the style that will be applied to the popper element to gets
- * properly positioned.
- *
- * Note that this modifier will not touch the DOM, it just prepares the styles
- * so that `applyStyle` modifier can apply it. This separation is useful
- * in case you need to replace `applyStyle` with a custom implementation.
- *
- * This modifier has `850` as `order` value to maintain backward compatibility
- * with previous versions of Popper.js. Expect the modifiers ordering method
- * to change in future major versions of the library.
- *
- * @memberof modifiers
- * @inner
- */
- computeStyle: {
- /** @prop {number} order=850 - Index used to define the order of execution */
- order: 850,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: computeStyle,
- /**
- * @prop {Boolean} gpuAcceleration=true
- * If true, it uses the CSS 3D transformation to position the popper.
- * Otherwise, it will use the `top` and `left` properties
- */
- gpuAcceleration: true,
- /**
- * @prop {string} [x='bottom']
- * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
- * Change this if your popper should grow in a direction different from `bottom`
- */
- x: 'bottom',
- /**
- * @prop {string} [x='left']
- * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
- * Change this if your popper should grow in a direction different from `right`
- */
- y: 'right'
- },
- /**
- * Applies the computed styles to the popper element.
- *
- * All the DOM manipulations are limited to this modifier. This is useful in case
- * you want to integrate Popper.js inside a framework or view library and you
- * want to delegate all the DOM manipulations to it.
- *
- * Note that if you disable this modifier, you must make sure the popper element
- * has its position set to `absolute` before Popper.js can do its work!
- *
- * Just disable this modifier and define your own to achieve the desired effect.
- *
- * @memberof modifiers
- * @inner
- */
- applyStyle: {
- /** @prop {number} order=900 - Index used to define the order of execution */
- order: 900,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: applyStyle,
- /** @prop {Function} */
- onLoad: applyStyleOnLoad,
- /**
- * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
- * @prop {Boolean} gpuAcceleration=true
- * If true, it uses the CSS 3D transformation to position the popper.
- * Otherwise, it will use the `top` and `left` properties
- */
- gpuAcceleration: undefined
- }
- };
- /**
- * The `dataObject` is an object containing all the information used by Popper.js.
- * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
- * @name dataObject
- * @property {Object} data.instance The Popper.js instance
- * @property {String} data.placement Placement applied to popper
- * @property {String} data.originalPlacement Placement originally defined on init
- * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
- * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
- * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
- * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
- * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
- * @property {Object} data.boundaries Offsets of the popper boundaries
- * @property {Object} data.offsets The measurements of popper, reference and arrow elements
- * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
- * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
- * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
- */
- /**
- * Default options provided to Popper.js constructor.<br />
- * These can be overridden using the `options` argument of Popper.js.<br />
- * To override an option, simply pass an object with the same
- * structure of the `options` object, as the 3rd argument. For example:
- * ```
- * new Popper(ref, pop, {
- * modifiers: {
- * preventOverflow: { enabled: false }
- * }
- * })
- * ```
- * @type {Object}
- * @static
- * @memberof Popper
- */
- var Defaults = {
- /**
- * Popper's placement.
- * @prop {Popper.placements} placement='bottom'
- */
- placement: 'bottom',
- /**
- * Set this to true if you want popper to position it self in 'fixed' mode
- * @prop {Boolean} positionFixed=false
- */
- positionFixed: false,
- /**
- * Whether events (resize, scroll) are initially enabled.
- * @prop {Boolean} eventsEnabled=true
- */
- eventsEnabled: true,
- /**
- * Set to true if you want to automatically remove the popper when
- * you call the `destroy` method.
- * @prop {Boolean} removeOnDestroy=false
- */
- removeOnDestroy: false,
- /**
- * Callback called when the popper is created.<br />
- * By default, it is set to no-op.<br />
- * Access Popper.js instance with `data.instance`.
- * @prop {onCreate}
- */
- onCreate: function onCreate() {},
- /**
- * Callback called when the popper is updated. This callback is not called
- * on the initialization/creation of the popper, but only on subsequent
- * updates.<br />
- * By default, it is set to no-op.<br />
- * Access Popper.js instance with `data.instance`.
- * @prop {onUpdate}
- */
- onUpdate: function onUpdate() {},
- /**
- * List of modifiers used to modify the offsets before they are applied to the popper.
- * They provide most of the functionalities of Popper.js.
- * @prop {modifiers}
- */
- modifiers: modifiers
- };
- /**
- * @callback onCreate
- * @param {dataObject} data
- */
- /**
- * @callback onUpdate
- * @param {dataObject} data
- */
- // Utils
- // Methods
- var Popper = function () {
- /**
- * Creates a new Popper.js instance.
- * @class Popper
- * @param {Element|referenceObject} reference - The reference element used to position the popper
- * @param {Element} popper - The HTML / XML element used as the popper
- * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
- * @return {Object} instance - The generated Popper.js instance
- */
- function Popper(reference, popper) {
- var _this = this;
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- classCallCheck(this, Popper);
- this.scheduleUpdate = function () {
- return requestAnimationFrame(_this.update);
- };
- // make update() debounced, so that it only runs at most once-per-tick
- this.update = debounce(this.update.bind(this));
- // with {} we create a new object with the options inside it
- this.options = _extends({}, Popper.Defaults, options);
- // init state
- this.state = {
- isDestroyed: false,
- isCreated: false,
- scrollParents: []
- };
- // get reference and popper elements (allow jQuery wrappers)
- this.reference = reference && reference.jquery ? reference[0] : reference;
- this.popper = popper && popper.jquery ? popper[0] : popper;
- // Deep merge modifiers options
- this.options.modifiers = {};
- Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
- _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
- });
- // Refactoring modifiers' list (Object => Array)
- this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
- return _extends({
- name: name
- }, _this.options.modifiers[name]);
- })
- // sort the modifiers by order
- .sort(function (a, b) {
- return a.order - b.order;
- });
- // modifiers have the ability to execute arbitrary code when Popper.js get inited
- // such code is executed in the same order of its modifier
- // they could add new properties to their options configuration
- // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
- this.modifiers.forEach(function (modifierOptions) {
- if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
- modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
- }
- });
- // fire the first update to position the popper in the right place
- this.update();
- var eventsEnabled = this.options.eventsEnabled;
- if (eventsEnabled) {
- // setup event listeners, they will take care of update the position in specific situations
- this.enableEventListeners();
- }
- this.state.eventsEnabled = eventsEnabled;
- }
- // We can't use class properties because they don't get listed in the
- // class prototype and break stuff like Sinon stubs
- createClass(Popper, [{
- key: 'update',
- value: function update$$1() {
- return update.call(this);
- }
- }, {
- key: 'destroy',
- value: function destroy$$1() {
- return destroy.call(this);
- }
- }, {
- key: 'enableEventListeners',
- value: function enableEventListeners$$1() {
- return enableEventListeners.call(this);
- }
- }, {
- key: 'disableEventListeners',
- value: function disableEventListeners$$1() {
- return disableEventListeners.call(this);
- }
- /**
- * Schedules an update. It will run on the next UI update available.
- * @method scheduleUpdate
- * @memberof Popper
- */
- /**
- * Collection of utilities useful when writing custom modifiers.
- * Starting from version 1.7, this method is available only if you
- * include `popper-utils.js` before `popper.js`.
- *
- * **DEPRECATION**: This way to access PopperUtils is deprecated
- * and will be removed in v2! Use the PopperUtils module directly instead.
- * Due to the high instability of the methods contained in Utils, we can't
- * guarantee them to follow semver. Use them at your own risk!
- * @static
- * @private
- * @type {Object}
- * @deprecated since version 1.8
- * @member Utils
- * @memberof Popper
- */
- }]);
- return Popper;
- }();
- /**
- * The `referenceObject` is an object that provides an interface compatible with Popper.js
- * and lets you use it as replacement of a real DOM node.<br />
- * You can use this method to position a popper relatively to a set of coordinates
- * in case you don't have a DOM node to use as reference.
- *
- * ```
- * new Popper(referenceObject, popperNode);
- * ```
- *
- * NB: This feature isn't supported in Internet Explorer 10.
- * @name referenceObject
- * @property {Function} data.getBoundingClientRect
- * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
- * @property {number} data.clientWidth
- * An ES6 getter that will return the width of the virtual reference element.
- * @property {number} data.clientHeight
- * An ES6 getter that will return the height of the virtual reference element.
- */
- Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
- Popper.placements = placements;
- Popper.Defaults = Defaults;
- return Popper;
- })));
- //# sourceMappingURL=popper.js.map
- /*!
- * Bootstrap v4.4.1 (https://getbootstrap.com/)
- * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
- typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
- (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
- }(this, (function (exports, $, Popper) { 'use strict';
- $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
- Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
- 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);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
- }
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v4.4.1): util.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * --------------------------------------------------------------------------
- */
- /**
- * ------------------------------------------------------------------------
- * Private TransitionEnd Helpers
- * ------------------------------------------------------------------------
- */
- var TRANSITION_END = 'transitionend';
- var MAX_UID = 1000000;
- var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
- function toType(obj) {
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
- }
- function getSpecialTransitionEndEvent() {
- return {
- bindType: TRANSITION_END,
- delegateType: TRANSITION_END,
- handle: function handle(event) {
- if ($(event.target).is(this)) {
- return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
- }
- return undefined; // eslint-disable-line no-undefined
- }
- };
- }
- function transitionEndEmulator(duration) {
- var _this = this;
- var called = false;
- $(this).one(Util.TRANSITION_END, function () {
- called = true;
- });
- setTimeout(function () {
- if (!called) {
- Util.triggerTransitionEnd(_this);
- }
- }, duration);
- return this;
- }
- function setTransitionEndSupport() {
- $.fn.emulateTransitionEnd = transitionEndEmulator;
- $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
- }
- /**
- * --------------------------------------------------------------------------
- * Public Util Api
- * --------------------------------------------------------------------------
- */
- var Util = {
- TRANSITION_END: 'bsTransitionEnd',
- getUID: function getUID(prefix) {
- do {
- // eslint-disable-next-line no-bitwise
- prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
- } while (document.getElementById(prefix));
- return prefix;
- },
- getSelectorFromElement: function getSelectorFromElement(element) {
- var selector = element.getAttribute('data-target');
- if (!selector || selector === '#') {
- var hrefAttr = element.getAttribute('href');
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
- }
- try {
- return document.querySelector(selector) ? selector : null;
- } catch (err) {
- return null;
- }
- },
- getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
- if (!element) {
- return 0;
- } // Get transition-duration of the element
- var transitionDuration = $(element).css('transition-duration');
- var transitionDelay = $(element).css('transition-delay');
- var floatTransitionDuration = parseFloat(transitionDuration);
- var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
- if (!floatTransitionDuration && !floatTransitionDelay) {
- return 0;
- } // If multiple durations are defined, take the first
- transitionDuration = transitionDuration.split(',')[0];
- transitionDelay = transitionDelay.split(',')[0];
- return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
- },
- reflow: function reflow(element) {
- return element.offsetHeight;
- },
- triggerTransitionEnd: function triggerTransitionEnd(element) {
- $(element).trigger(TRANSITION_END);
- },
- // TODO: Remove in v5
- supportsTransitionEnd: function supportsTransitionEnd() {
- return Boolean(TRANSITION_END);
- },
- isElement: function isElement(obj) {
- return (obj[0] || obj).nodeType;
- },
- typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
- for (var property in configTypes) {
- if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
- var expectedTypes = configTypes[property];
- var value = config[property];
- var valueType = value && Util.isElement(value) ? 'element' : toType(value);
- if (!new RegExp(expectedTypes).test(valueType)) {
- throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
- }
- }
- }
- },
- findShadowRoot: function findShadowRoot(element) {
- if (!document.documentElement.attachShadow) {
- return null;
- } // Can find the shadow root otherwise it'll return the document
- if (typeof element.getRootNode === 'function') {
- var root = element.getRootNode();
- return root instanceof ShadowRoot ? root : null;
- }
- if (element instanceof ShadowRoot) {
- return element;
- } // when we don't find a shadow root
- if (!element.parentNode) {
- return null;
- }
- return Util.findShadowRoot(element.parentNode);
- },
- jQueryDetection: function jQueryDetection() {
- if (typeof $ === 'undefined') {
- throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
- }
- var version = $.fn.jquery.split(' ')[0].split('.');
- var minMajor = 1;
- var ltMajor = 2;
- var minMinor = 9;
- var minPatch = 1;
- var maxMajor = 4;
- if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
- throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
- }
- }
- };
- Util.jQueryDetection();
- setTransitionEndSupport();
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME = 'alert';
- var VERSION = '4.4.1';
- var DATA_KEY = 'bs.alert';
- var EVENT_KEY = "." + DATA_KEY;
- var DATA_API_KEY = '.data-api';
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Selector = {
- DISMISS: '[data-dismiss="alert"]'
- };
- var Event = {
- CLOSE: "close" + EVENT_KEY,
- CLOSED: "closed" + EVENT_KEY,
- CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
- };
- var ClassName = {
- ALERT: 'alert',
- FADE: 'fade',
- SHOW: 'show'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Alert =
- /*#__PURE__*/
- function () {
- function Alert(element) {
- this._element = element;
- } // Getters
- var _proto = Alert.prototype;
- // Public
- _proto.close = function close(element) {
- var rootElement = this._element;
- if (element) {
- rootElement = this._getRootElement(element);
- }
- var customEvent = this._triggerCloseEvent(rootElement);
- if (customEvent.isDefaultPrevented()) {
- return;
- }
- this._removeElement(rootElement);
- };
- _proto.dispose = function dispose() {
- $.removeData(this._element, DATA_KEY);
- this._element = null;
- } // Private
- ;
- _proto._getRootElement = function _getRootElement(element) {
- var selector = Util.getSelectorFromElement(element);
- var parent = false;
- if (selector) {
- parent = document.querySelector(selector);
- }
- if (!parent) {
- parent = $(element).closest("." + ClassName.ALERT)[0];
- }
- return parent;
- };
- _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
- var closeEvent = $.Event(Event.CLOSE);
- $(element).trigger(closeEvent);
- return closeEvent;
- };
- _proto._removeElement = function _removeElement(element) {
- var _this = this;
- $(element).removeClass(ClassName.SHOW);
- if (!$(element).hasClass(ClassName.FADE)) {
- this._destroyElement(element);
- return;
- }
- var transitionDuration = Util.getTransitionDurationFromElement(element);
- $(element).one(Util.TRANSITION_END, function (event) {
- return _this._destroyElement(element, event);
- }).emulateTransitionEnd(transitionDuration);
- };
- _proto._destroyElement = function _destroyElement(element) {
- $(element).detach().trigger(Event.CLOSED).remove();
- } // Static
- ;
- Alert._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $element = $(this);
- var data = $element.data(DATA_KEY);
- if (!data) {
- data = new Alert(this);
- $element.data(DATA_KEY, data);
- }
- if (config === 'close') {
- data[config](this);
- }
- });
- };
- Alert._handleDismiss = function _handleDismiss(alertInstance) {
- return function (event) {
- if (event) {
- event.preventDefault();
- }
- alertInstance.close(this);
- };
- };
- _createClass(Alert, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION;
- }
- }]);
- return Alert;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME] = Alert._jQueryInterface;
- $.fn[NAME].Constructor = Alert;
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return Alert._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$1 = 'button';
- var VERSION$1 = '4.4.1';
- var DATA_KEY$1 = 'bs.button';
- var EVENT_KEY$1 = "." + DATA_KEY$1;
- var DATA_API_KEY$1 = '.data-api';
- var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
- var ClassName$1 = {
- ACTIVE: 'active',
- BUTTON: 'btn',
- FOCUS: 'focus'
- };
- var Selector$1 = {
- DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
- DATA_TOGGLES: '[data-toggle="buttons"]',
- DATA_TOGGLE: '[data-toggle="button"]',
- DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
- INPUT: 'input:not([type="hidden"])',
- ACTIVE: '.active',
- BUTTON: '.btn'
- };
- var Event$1 = {
- CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
- FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
- LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Button =
- /*#__PURE__*/
- function () {
- function Button(element) {
- this._element = element;
- } // Getters
- var _proto = Button.prototype;
- // Public
- _proto.toggle = function toggle() {
- var triggerChangeEvent = true;
- var addAriaPressed = true;
- var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
- if (rootElement) {
- var input = this._element.querySelector(Selector$1.INPUT);
- if (input) {
- if (input.type === 'radio') {
- if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
- triggerChangeEvent = false;
- } else {
- var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
- if (activeElement) {
- $(activeElement).removeClass(ClassName$1.ACTIVE);
- }
- }
- } else if (input.type === 'checkbox') {
- if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
- triggerChangeEvent = false;
- }
- } else {
- // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
- triggerChangeEvent = false;
- }
- if (triggerChangeEvent) {
- input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
- $(input).trigger('change');
- }
- input.focus();
- addAriaPressed = false;
- }
- }
- if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
- if (addAriaPressed) {
- this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
- }
- if (triggerChangeEvent) {
- $(this._element).toggleClass(ClassName$1.ACTIVE);
- }
- }
- };
- _proto.dispose = function dispose() {
- $.removeData(this._element, DATA_KEY$1);
- this._element = null;
- } // Static
- ;
- Button._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY$1);
- if (!data) {
- data = new Button(this);
- $(this).data(DATA_KEY$1, data);
- }
- if (config === 'toggle') {
- data[config]();
- }
- });
- };
- _createClass(Button, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$1;
- }
- }]);
- return Button;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
- var button = event.target;
- if (!$(button).hasClass(ClassName$1.BUTTON)) {
- button = $(button).closest(Selector$1.BUTTON)[0];
- }
- if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
- event.preventDefault(); // work around Firefox bug #1540995
- } else {
- var inputBtn = button.querySelector(Selector$1.INPUT);
- if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
- event.preventDefault(); // work around Firefox bug #1540995
- return;
- }
- Button._jQueryInterface.call($(button), 'toggle');
- }
- }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
- var button = $(event.target).closest(Selector$1.BUTTON)[0];
- $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
- });
- $(window).on(Event$1.LOAD_DATA_API, function () {
- // ensure correct active class is set to match the controls' actual values/states
- // find all checkboxes/readio buttons inside data-toggle groups
- var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
- for (var i = 0, len = buttons.length; i < len; i++) {
- var button = buttons[i];
- var input = button.querySelector(Selector$1.INPUT);
- if (input.checked || input.hasAttribute('checked')) {
- button.classList.add(ClassName$1.ACTIVE);
- } else {
- button.classList.remove(ClassName$1.ACTIVE);
- }
- } // find all button toggles
- buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
- for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
- var _button = buttons[_i];
- if (_button.getAttribute('aria-pressed') === 'true') {
- _button.classList.add(ClassName$1.ACTIVE);
- } else {
- _button.classList.remove(ClassName$1.ACTIVE);
- }
- }
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$1] = Button._jQueryInterface;
- $.fn[NAME$1].Constructor = Button;
- $.fn[NAME$1].noConflict = function () {
- $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
- return Button._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$2 = 'carousel';
- var VERSION$2 = '4.4.1';
- var DATA_KEY$2 = 'bs.carousel';
- var EVENT_KEY$2 = "." + DATA_KEY$2;
- var DATA_API_KEY$2 = '.data-api';
- var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
- var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
- var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
- var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
- var SWIPE_THRESHOLD = 40;
- var Default = {
- interval: 5000,
- keyboard: true,
- slide: false,
- pause: 'hover',
- wrap: true,
- touch: true
- };
- var DefaultType = {
- interval: '(number|boolean)',
- keyboard: 'boolean',
- slide: '(boolean|string)',
- pause: '(string|boolean)',
- wrap: 'boolean',
- touch: 'boolean'
- };
- var Direction = {
- NEXT: 'next',
- PREV: 'prev',
- LEFT: 'left',
- RIGHT: 'right'
- };
- var Event$2 = {
- SLIDE: "slide" + EVENT_KEY$2,
- SLID: "slid" + EVENT_KEY$2,
- KEYDOWN: "keydown" + EVENT_KEY$2,
- MOUSEENTER: "mouseenter" + EVENT_KEY$2,
- MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
- TOUCHSTART: "touchstart" + EVENT_KEY$2,
- TOUCHMOVE: "touchmove" + EVENT_KEY$2,
- TOUCHEND: "touchend" + EVENT_KEY$2,
- POINTERDOWN: "pointerdown" + EVENT_KEY$2,
- POINTERUP: "pointerup" + EVENT_KEY$2,
- DRAG_START: "dragstart" + EVENT_KEY$2,
- LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
- CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
- };
- var ClassName$2 = {
- CAROUSEL: 'carousel',
- ACTIVE: 'active',
- SLIDE: 'slide',
- RIGHT: 'carousel-item-right',
- LEFT: 'carousel-item-left',
- NEXT: 'carousel-item-next',
- PREV: 'carousel-item-prev',
- ITEM: 'carousel-item',
- POINTER_EVENT: 'pointer-event'
- };
- var Selector$2 = {
- ACTIVE: '.active',
- ACTIVE_ITEM: '.active.carousel-item',
- ITEM: '.carousel-item',
- ITEM_IMG: '.carousel-item img',
- NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
- INDICATORS: '.carousel-indicators',
- DATA_SLIDE: '[data-slide], [data-slide-to]',
- DATA_RIDE: '[data-ride="carousel"]'
- };
- var PointerType = {
- TOUCH: 'touch',
- PEN: 'pen'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Carousel =
- /*#__PURE__*/
- function () {
- function Carousel(element, config) {
- this._items = null;
- this._interval = null;
- this._activeElement = null;
- this._isPaused = false;
- this._isSliding = false;
- this.touchTimeout = null;
- this.touchStartX = 0;
- this.touchDeltaX = 0;
- this._config = this._getConfig(config);
- this._element = element;
- this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
- this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
- this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
- this._addEventListeners();
- } // Getters
- var _proto = Carousel.prototype;
- // Public
- _proto.next = function next() {
- if (!this._isSliding) {
- this._slide(Direction.NEXT);
- }
- };
- _proto.nextWhenVisible = function nextWhenVisible() {
- // Don't call next when the page isn't visible
- // or the carousel or its parent isn't visible
- if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
- this.next();
- }
- };
- _proto.prev = function prev() {
- if (!this._isSliding) {
- this._slide(Direction.PREV);
- }
- };
- _proto.pause = function pause(event) {
- if (!event) {
- this._isPaused = true;
- }
- if (this._element.querySelector(Selector$2.NEXT_PREV)) {
- Util.triggerTransitionEnd(this._element);
- this.cycle(true);
- }
- clearInterval(this._interval);
- this._interval = null;
- };
- _proto.cycle = function cycle(event) {
- if (!event) {
- this._isPaused = false;
- }
- if (this._interval) {
- clearInterval(this._interval);
- this._interval = null;
- }
- if (this._config.interval && !this._isPaused) {
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
- }
- };
- _proto.to = function to(index) {
- var _this = this;
- this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
- var activeIndex = this._getItemIndex(this._activeElement);
- if (index > this._items.length - 1 || index < 0) {
- return;
- }
- if (this._isSliding) {
- $(this._element).one(Event$2.SLID, function () {
- return _this.to(index);
- });
- return;
- }
- if (activeIndex === index) {
- this.pause();
- this.cycle();
- return;
- }
- var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
- this._slide(direction, this._items[index]);
- };
- _proto.dispose = function dispose() {
- $(this._element).off(EVENT_KEY$2);
- $.removeData(this._element, DATA_KEY$2);
- this._items = null;
- this._config = null;
- this._element = null;
- this._interval = null;
- this._isPaused = null;
- this._isSliding = null;
- this._activeElement = null;
- this._indicatorsElement = null;
- } // Private
- ;
- _proto._getConfig = function _getConfig(config) {
- config = _objectSpread2({}, Default, {}, config);
- Util.typeCheckConfig(NAME$2, config, DefaultType);
- return config;
- };
- _proto._handleSwipe = function _handleSwipe() {
- var absDeltax = Math.abs(this.touchDeltaX);
- if (absDeltax <= SWIPE_THRESHOLD) {
- return;
- }
- var direction = absDeltax / this.touchDeltaX;
- this.touchDeltaX = 0; // swipe left
- if (direction > 0) {
- this.prev();
- } // swipe right
- if (direction < 0) {
- this.next();
- }
- };
- _proto._addEventListeners = function _addEventListeners() {
- var _this2 = this;
- if (this._config.keyboard) {
- $(this._element).on(Event$2.KEYDOWN, function (event) {
- return _this2._keydown(event);
- });
- }
- if (this._config.pause === 'hover') {
- $(this._element).on(Event$2.MOUSEENTER, function (event) {
- return _this2.pause(event);
- }).on(Event$2.MOUSELEAVE, function (event) {
- return _this2.cycle(event);
- });
- }
- if (this._config.touch) {
- this._addTouchEventListeners();
- }
- };
- _proto._addTouchEventListeners = function _addTouchEventListeners() {
- var _this3 = this;
- if (!this._touchSupported) {
- return;
- }
- var start = function start(event) {
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
- _this3.touchStartX = event.originalEvent.clientX;
- } else if (!_this3._pointerEvent) {
- _this3.touchStartX = event.originalEvent.touches[0].clientX;
- }
- };
- var move = function move(event) {
- // ensure swiping with one touch and not pinching
- if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
- _this3.touchDeltaX = 0;
- } else {
- _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
- }
- };
- var end = function end(event) {
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
- _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
- }
- _this3._handleSwipe();
- if (_this3._config.pause === 'hover') {
- // If it's a touch-enabled device, mouseenter/leave are fired as
- // part of the mouse compatibility events on first tap - the carousel
- // would stop cycling until user tapped out of it;
- // here, we listen for touchend, explicitly pause the carousel
- // (as if it's the second time we tap on it, mouseenter compat event
- // is NOT fired) and after a timeout (to allow for mouse compatibility
- // events to fire) we explicitly restart cycling
- _this3.pause();
- if (_this3.touchTimeout) {
- clearTimeout(_this3.touchTimeout);
- }
- _this3.touchTimeout = setTimeout(function (event) {
- return _this3.cycle(event);
- }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
- }
- };
- $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
- return e.preventDefault();
- });
- if (this._pointerEvent) {
- $(this._element).on(Event$2.POINTERDOWN, function (event) {
- return start(event);
- });
- $(this._element).on(Event$2.POINTERUP, function (event) {
- return end(event);
- });
- this._element.classList.add(ClassName$2.POINTER_EVENT);
- } else {
- $(this._element).on(Event$2.TOUCHSTART, function (event) {
- return start(event);
- });
- $(this._element).on(Event$2.TOUCHMOVE, function (event) {
- return move(event);
- });
- $(this._element).on(Event$2.TOUCHEND, function (event) {
- return end(event);
- });
- }
- };
- _proto._keydown = function _keydown(event) {
- if (/input|textarea/i.test(event.target.tagName)) {
- return;
- }
- switch (event.which) {
- case ARROW_LEFT_KEYCODE:
- event.preventDefault();
- this.prev();
- break;
- case ARROW_RIGHT_KEYCODE:
- event.preventDefault();
- this.next();
- break;
- }
- };
- _proto._getItemIndex = function _getItemIndex(element) {
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
- return this._items.indexOf(element);
- };
- _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
- var isNextDirection = direction === Direction.NEXT;
- var isPrevDirection = direction === Direction.PREV;
- var activeIndex = this._getItemIndex(activeElement);
- var lastItemIndex = this._items.length - 1;
- var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
- if (isGoingToWrap && !this._config.wrap) {
- return activeElement;
- }
- var delta = direction === Direction.PREV ? -1 : 1;
- var itemIndex = (activeIndex + delta) % this._items.length;
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
- };
- _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
- var targetIndex = this._getItemIndex(relatedTarget);
- var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
- var slideEvent = $.Event(Event$2.SLIDE, {
- relatedTarget: relatedTarget,
- direction: eventDirectionName,
- from: fromIndex,
- to: targetIndex
- });
- $(this._element).trigger(slideEvent);
- return slideEvent;
- };
- _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
- if (this._indicatorsElement) {
- var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
- $(indicators).removeClass(ClassName$2.ACTIVE);
- var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
- if (nextIndicator) {
- $(nextIndicator).addClass(ClassName$2.ACTIVE);
- }
- }
- };
- _proto._slide = function _slide(direction, element) {
- var _this4 = this;
- var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
- var activeElementIndex = this._getItemIndex(activeElement);
- var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
- var nextElementIndex = this._getItemIndex(nextElement);
- var isCycling = Boolean(this._interval);
- var directionalClassName;
- var orderClassName;
- var eventDirectionName;
- if (direction === Direction.NEXT) {
- directionalClassName = ClassName$2.LEFT;
- orderClassName = ClassName$2.NEXT;
- eventDirectionName = Direction.LEFT;
- } else {
- directionalClassName = ClassName$2.RIGHT;
- orderClassName = ClassName$2.PREV;
- eventDirectionName = Direction.RIGHT;
- }
- if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
- this._isSliding = false;
- return;
- }
- var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
- if (slideEvent.isDefaultPrevented()) {
- return;
- }
- if (!activeElement || !nextElement) {
- // Some weirdness is happening, so we bail
- return;
- }
- this._isSliding = true;
- if (isCycling) {
- this.pause();
- }
- this._setActiveIndicatorElement(nextElement);
- var slidEvent = $.Event(Event$2.SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
- if ($(this._element).hasClass(ClassName$2.SLIDE)) {
- $(nextElement).addClass(orderClassName);
- Util.reflow(nextElement);
- $(activeElement).addClass(directionalClassName);
- $(nextElement).addClass(directionalClassName);
- var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
- if (nextElementInterval) {
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
- this._config.interval = nextElementInterval;
- } else {
- this._config.interval = this._config.defaultInterval || this._config.interval;
- }
- var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
- $(activeElement).one(Util.TRANSITION_END, function () {
- $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
- $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
- _this4._isSliding = false;
- setTimeout(function () {
- return $(_this4._element).trigger(slidEvent);
- }, 0);
- }).emulateTransitionEnd(transitionDuration);
- } else {
- $(activeElement).removeClass(ClassName$2.ACTIVE);
- $(nextElement).addClass(ClassName$2.ACTIVE);
- this._isSliding = false;
- $(this._element).trigger(slidEvent);
- }
- if (isCycling) {
- this.cycle();
- }
- } // Static
- ;
- Carousel._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY$2);
- var _config = _objectSpread2({}, Default, {}, $(this).data());
- if (typeof config === 'object') {
- _config = _objectSpread2({}, _config, {}, config);
- }
- var action = typeof config === 'string' ? config : _config.slide;
- if (!data) {
- data = new Carousel(this, _config);
- $(this).data(DATA_KEY$2, data);
- }
- if (typeof config === 'number') {
- data.to(config);
- } else if (typeof action === 'string') {
- if (typeof data[action] === 'undefined') {
- throw new TypeError("No method named \"" + action + "\"");
- }
- data[action]();
- } else if (_config.interval && _config.ride) {
- data.pause();
- data.cycle();
- }
- });
- };
- Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
- var selector = Util.getSelectorFromElement(this);
- if (!selector) {
- return;
- }
- var target = $(selector)[0];
- if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
- return;
- }
- var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
- var slideIndex = this.getAttribute('data-slide-to');
- if (slideIndex) {
- config.interval = false;
- }
- Carousel._jQueryInterface.call($(target), config);
- if (slideIndex) {
- $(target).data(DATA_KEY$2).to(slideIndex);
- }
- event.preventDefault();
- };
- _createClass(Carousel, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$2;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default;
- }
- }]);
- return Carousel;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
- $(window).on(Event$2.LOAD_DATA_API, function () {
- var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
- for (var i = 0, len = carousels.length; i < len; i++) {
- var $carousel = $(carousels[i]);
- Carousel._jQueryInterface.call($carousel, $carousel.data());
- }
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$2] = Carousel._jQueryInterface;
- $.fn[NAME$2].Constructor = Carousel;
- $.fn[NAME$2].noConflict = function () {
- $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
- return Carousel._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$3 = 'collapse';
- var VERSION$3 = '4.4.1';
- var DATA_KEY$3 = 'bs.collapse';
- var EVENT_KEY$3 = "." + DATA_KEY$3;
- var DATA_API_KEY$3 = '.data-api';
- var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
- var Default$1 = {
- toggle: true,
- parent: ''
- };
- var DefaultType$1 = {
- toggle: 'boolean',
- parent: '(string|element)'
- };
- var Event$3 = {
- SHOW: "show" + EVENT_KEY$3,
- SHOWN: "shown" + EVENT_KEY$3,
- HIDE: "hide" + EVENT_KEY$3,
- HIDDEN: "hidden" + EVENT_KEY$3,
- CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
- };
- var ClassName$3 = {
- SHOW: 'show',
- COLLAPSE: 'collapse',
- COLLAPSING: 'collapsing',
- COLLAPSED: 'collapsed'
- };
- var Dimension = {
- WIDTH: 'width',
- HEIGHT: 'height'
- };
- var Selector$3 = {
- ACTIVES: '.show, .collapsing',
- DATA_TOGGLE: '[data-toggle="collapse"]'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Collapse =
- /*#__PURE__*/
- function () {
- function Collapse(element, config) {
- this._isTransitioning = false;
- this._element = element;
- this._config = this._getConfig(config);
- this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
- var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
- for (var i = 0, len = toggleList.length; i < len; i++) {
- var elem = toggleList[i];
- var selector = Util.getSelectorFromElement(elem);
- var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
- return foundElem === element;
- });
- if (selector !== null && filterElement.length > 0) {
- this._selector = selector;
- this._triggerArray.push(elem);
- }
- }
- this._parent = this._config.parent ? this._getParent() : null;
- if (!this._config.parent) {
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
- }
- if (this._config.toggle) {
- this.toggle();
- }
- } // Getters
- var _proto = Collapse.prototype;
- // Public
- _proto.toggle = function toggle() {
- if ($(this._element).hasClass(ClassName$3.SHOW)) {
- this.hide();
- } else {
- this.show();
- }
- };
- _proto.show = function show() {
- var _this = this;
- if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
- return;
- }
- var actives;
- var activesData;
- if (this._parent) {
- actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
- if (typeof _this._config.parent === 'string') {
- return elem.getAttribute('data-parent') === _this._config.parent;
- }
- return elem.classList.contains(ClassName$3.COLLAPSE);
- });
- if (actives.length === 0) {
- actives = null;
- }
- }
- if (actives) {
- activesData = $(actives).not(this._selector).data(DATA_KEY$3);
- if (activesData && activesData._isTransitioning) {
- return;
- }
- }
- var startEvent = $.Event(Event$3.SHOW);
- $(this._element).trigger(startEvent);
- if (startEvent.isDefaultPrevented()) {
- return;
- }
- if (actives) {
- Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
- if (!activesData) {
- $(actives).data(DATA_KEY$3, null);
- }
- }
- var dimension = this._getDimension();
- $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
- this._element.style[dimension] = 0;
- if (this._triggerArray.length) {
- $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
- }
- this.setTransitioning(true);
- var complete = function complete() {
- $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
- _this._element.style[dimension] = '';
- _this.setTransitioning(false);
- $(_this._element).trigger(Event$3.SHOWN);
- };
- var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
- var scrollSize = "scroll" + capitalizedDimension;
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- this._element.style[dimension] = this._element[scrollSize] + "px";
- };
- _proto.hide = function hide() {
- var _this2 = this;
- if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
- return;
- }
- var startEvent = $.Event(Event$3.HIDE);
- $(this._element).trigger(startEvent);
- if (startEvent.isDefaultPrevented()) {
- return;
- }
- var dimension = this._getDimension();
- this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
- Util.reflow(this._element);
- $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
- var triggerArrayLength = this._triggerArray.length;
- if (triggerArrayLength > 0) {
- for (var i = 0; i < triggerArrayLength; i++) {
- var trigger = this._triggerArray[i];
- var selector = Util.getSelectorFromElement(trigger);
- if (selector !== null) {
- var $elem = $([].slice.call(document.querySelectorAll(selector)));
- if (!$elem.hasClass(ClassName$3.SHOW)) {
- $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
- }
- }
- }
- }
- this.setTransitioning(true);
- var complete = function complete() {
- _this2.setTransitioning(false);
- $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
- };
- this._element.style[dimension] = '';
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- };
- _proto.setTransitioning = function setTransitioning(isTransitioning) {
- this._isTransitioning = isTransitioning;
- };
- _proto.dispose = function dispose() {
- $.removeData(this._element, DATA_KEY$3);
- this._config = null;
- this._parent = null;
- this._element = null;
- this._triggerArray = null;
- this._isTransitioning = null;
- } // Private
- ;
- _proto._getConfig = function _getConfig(config) {
- config = _objectSpread2({}, Default$1, {}, config);
- config.toggle = Boolean(config.toggle); // Coerce string values
- Util.typeCheckConfig(NAME$3, config, DefaultType$1);
- return config;
- };
- _proto._getDimension = function _getDimension() {
- var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
- return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
- };
- _proto._getParent = function _getParent() {
- var _this3 = this;
- var parent;
- if (Util.isElement(this._config.parent)) {
- parent = this._config.parent; // It's a jQuery object
- if (typeof this._config.parent.jquery !== 'undefined') {
- parent = this._config.parent[0];
- }
- } else {
- parent = document.querySelector(this._config.parent);
- }
- var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
- var children = [].slice.call(parent.querySelectorAll(selector));
- $(children).each(function (i, element) {
- _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
- });
- return parent;
- };
- _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
- var isOpen = $(element).hasClass(ClassName$3.SHOW);
- if (triggerArray.length) {
- $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
- }
- } // Static
- ;
- Collapse._getTargetFromElement = function _getTargetFromElement(element) {
- var selector = Util.getSelectorFromElement(element);
- return selector ? document.querySelector(selector) : null;
- };
- Collapse._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $this = $(this);
- var data = $this.data(DATA_KEY$3);
- var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
- if (!data && _config.toggle && /show|hide/.test(config)) {
- _config.toggle = false;
- }
- if (!data) {
- data = new Collapse(this, _config);
- $this.data(DATA_KEY$3, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config]();
- }
- });
- };
- _createClass(Collapse, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$3;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$1;
- }
- }]);
- return Collapse;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
- // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
- if (event.currentTarget.tagName === 'A') {
- event.preventDefault();
- }
- var $trigger = $(this);
- var selector = Util.getSelectorFromElement(this);
- var selectors = [].slice.call(document.querySelectorAll(selector));
- $(selectors).each(function () {
- var $target = $(this);
- var data = $target.data(DATA_KEY$3);
- var config = data ? 'toggle' : $trigger.data();
- Collapse._jQueryInterface.call($target, config);
- });
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$3] = Collapse._jQueryInterface;
- $.fn[NAME$3].Constructor = Collapse;
- $.fn[NAME$3].noConflict = function () {
- $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
- return Collapse._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$4 = 'dropdown';
- var VERSION$4 = '4.4.1';
- var DATA_KEY$4 = 'bs.dropdown';
- var EVENT_KEY$4 = "." + DATA_KEY$4;
- var DATA_API_KEY$4 = '.data-api';
- var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
- var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
- var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
- var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
- var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
- var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
- var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
- var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
- var Event$4 = {
- HIDE: "hide" + EVENT_KEY$4,
- HIDDEN: "hidden" + EVENT_KEY$4,
- SHOW: "show" + EVENT_KEY$4,
- SHOWN: "shown" + EVENT_KEY$4,
- CLICK: "click" + EVENT_KEY$4,
- CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
- KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
- KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
- };
- var ClassName$4 = {
- DISABLED: 'disabled',
- SHOW: 'show',
- DROPUP: 'dropup',
- DROPRIGHT: 'dropright',
- DROPLEFT: 'dropleft',
- MENURIGHT: 'dropdown-menu-right',
- MENULEFT: 'dropdown-menu-left',
- POSITION_STATIC: 'position-static'
- };
- var Selector$4 = {
- DATA_TOGGLE: '[data-toggle="dropdown"]',
- FORM_CHILD: '.dropdown form',
- MENU: '.dropdown-menu',
- NAVBAR_NAV: '.navbar-nav',
- VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
- };
- var AttachmentMap = {
- TOP: 'top-start',
- TOPEND: 'top-end',
- BOTTOM: 'bottom-start',
- BOTTOMEND: 'bottom-end',
- RIGHT: 'right-start',
- RIGHTEND: 'right-end',
- LEFT: 'left-start',
- LEFTEND: 'left-end'
- };
- var Default$2 = {
- offset: 0,
- flip: true,
- boundary: 'scrollParent',
- reference: 'toggle',
- display: 'dynamic',
- popperConfig: null
- };
- var DefaultType$2 = {
- offset: '(number|string|function)',
- flip: 'boolean',
- boundary: '(string|element)',
- reference: '(string|element)',
- display: 'string',
- popperConfig: '(null|object)'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Dropdown =
- /*#__PURE__*/
- function () {
- function Dropdown(element, config) {
- this._element = element;
- this._popper = null;
- this._config = this._getConfig(config);
- this._menu = this._getMenuElement();
- this._inNavbar = this._detectNavbar();
- this._addEventListeners();
- } // Getters
- var _proto = Dropdown.prototype;
- // Public
- _proto.toggle = function toggle() {
- if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
- return;
- }
- var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
- Dropdown._clearMenus();
- if (isActive) {
- return;
- }
- this.show(true);
- };
- _proto.show = function show(usePopper) {
- if (usePopper === void 0) {
- usePopper = false;
- }
- if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
- return;
- }
- var relatedTarget = {
- relatedTarget: this._element
- };
- var showEvent = $.Event(Event$4.SHOW, relatedTarget);
- var parent = Dropdown._getParentFromElement(this._element);
- $(parent).trigger(showEvent);
- if (showEvent.isDefaultPrevented()) {
- return;
- } // Disable totally Popper.js for Dropdown in Navbar
- if (!this._inNavbar && usePopper) {
- /**
- * Check for Popper dependency
- * Popper - https://popper.js.org
- */
- if (typeof Popper === 'undefined') {
- throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
- }
- var referenceElement = this._element;
- if (this._config.reference === 'parent') {
- referenceElement = parent;
- } else if (Util.isElement(this._config.reference)) {
- referenceElement = this._config.reference; // Check if it's jQuery element
- if (typeof this._config.reference.jquery !== 'undefined') {
- referenceElement = this._config.reference[0];
- }
- } // If boundary is not `scrollParent`, then set position to `static`
- // to allow the menu to "escape" the scroll parent's boundaries
- // https://github.com/twbs/bootstrap/issues/24251
- if (this._config.boundary !== 'scrollParent') {
- $(parent).addClass(ClassName$4.POSITION_STATIC);
- }
- this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
- } // If this is a touch-enabled device we add extra
- // empty mouseover listeners to the body's immediate children;
- // only needed because of broken event delegation on iOS
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
- if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
- $(document.body).children().on('mouseover', null, $.noop);
- }
- this._element.focus();
- this._element.setAttribute('aria-expanded', true);
- $(this._menu).toggleClass(ClassName$4.SHOW);
- $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
- };
- _proto.hide = function hide() {
- if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
- return;
- }
- var relatedTarget = {
- relatedTarget: this._element
- };
- var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
- var parent = Dropdown._getParentFromElement(this._element);
- $(parent).trigger(hideEvent);
- if (hideEvent.isDefaultPrevented()) {
- return;
- }
- if (this._popper) {
- this._popper.destroy();
- }
- $(this._menu).toggleClass(ClassName$4.SHOW);
- $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
- };
- _proto.dispose = function dispose() {
- $.removeData(this._element, DATA_KEY$4);
- $(this._element).off(EVENT_KEY$4);
- this._element = null;
- this._menu = null;
- if (this._popper !== null) {
- this._popper.destroy();
- this._popper = null;
- }
- };
- _proto.update = function update() {
- this._inNavbar = this._detectNavbar();
- if (this._popper !== null) {
- this._popper.scheduleUpdate();
- }
- } // Private
- ;
- _proto._addEventListeners = function _addEventListeners() {
- var _this = this;
- $(this._element).on(Event$4.CLICK, function (event) {
- event.preventDefault();
- event.stopPropagation();
- _this.toggle();
- });
- };
- _proto._getConfig = function _getConfig(config) {
- config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
- Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
- return config;
- };
- _proto._getMenuElement = function _getMenuElement() {
- if (!this._menu) {
- var parent = Dropdown._getParentFromElement(this._element);
- if (parent) {
- this._menu = parent.querySelector(Selector$4.MENU);
- }
- }
- return this._menu;
- };
- _proto._getPlacement = function _getPlacement() {
- var $parentDropdown = $(this._element.parentNode);
- var placement = AttachmentMap.BOTTOM; // Handle dropup
- if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
- placement = AttachmentMap.TOP;
- if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
- placement = AttachmentMap.TOPEND;
- }
- } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
- placement = AttachmentMap.RIGHT;
- } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
- placement = AttachmentMap.LEFT;
- } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
- placement = AttachmentMap.BOTTOMEND;
- }
- return placement;
- };
- _proto._detectNavbar = function _detectNavbar() {
- return $(this._element).closest('.navbar').length > 0;
- };
- _proto._getOffset = function _getOffset() {
- var _this2 = this;
- var offset = {};
- if (typeof this._config.offset === 'function') {
- offset.fn = function (data) {
- data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
- return data;
- };
- } else {
- offset.offset = this._config.offset;
- }
- return offset;
- };
- _proto._getPopperConfig = function _getPopperConfig() {
- var popperConfig = {
- placement: this._getPlacement(),
- modifiers: {
- offset: this._getOffset(),
- flip: {
- enabled: this._config.flip
- },
- preventOverflow: {
- boundariesElement: this._config.boundary
- }
- }
- }; // Disable Popper.js if we have a static display
- if (this._config.display === 'static') {
- popperConfig.modifiers.applyStyle = {
- enabled: false
- };
- }
- return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
- } // Static
- ;
- Dropdown._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY$4);
- var _config = typeof config === 'object' ? config : null;
- if (!data) {
- data = new Dropdown(this, _config);
- $(this).data(DATA_KEY$4, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config]();
- }
- });
- };
- Dropdown._clearMenus = function _clearMenus(event) {
- if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
- return;
- }
- var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
- for (var i = 0, len = toggles.length; i < len; i++) {
- var parent = Dropdown._getParentFromElement(toggles[i]);
- var context = $(toggles[i]).data(DATA_KEY$4);
- var relatedTarget = {
- relatedTarget: toggles[i]
- };
- if (event && event.type === 'click') {
- relatedTarget.clickEvent = event;
- }
- if (!context) {
- continue;
- }
- var dropdownMenu = context._menu;
- if (!$(parent).hasClass(ClassName$4.SHOW)) {
- continue;
- }
- if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
- continue;
- }
- var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
- $(parent).trigger(hideEvent);
- if (hideEvent.isDefaultPrevented()) {
- continue;
- } // If this is a touch-enabled device we remove the extra
- // empty mouseover listeners we added for iOS support
- if ('ontouchstart' in document.documentElement) {
- $(document.body).children().off('mouseover', null, $.noop);
- }
- toggles[i].setAttribute('aria-expanded', 'false');
- if (context._popper) {
- context._popper.destroy();
- }
- $(dropdownMenu).removeClass(ClassName$4.SHOW);
- $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
- }
- };
- Dropdown._getParentFromElement = function _getParentFromElement(element) {
- var parent;
- var selector = Util.getSelectorFromElement(element);
- if (selector) {
- parent = document.querySelector(selector);
- }
- return parent || element.parentNode;
- } // eslint-disable-next-line complexity
- ;
- Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
- // If not input/textarea:
- // - And not a key in REGEXP_KEYDOWN => not a dropdown command
- // If input/textarea:
- // - If space key => not a dropdown command
- // - If key is other than escape
- // - If key is not up or down => not a dropdown command
- // - If trigger inside the menu => not a dropdown command
- if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
- return;
- }
- event.preventDefault();
- event.stopPropagation();
- if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
- return;
- }
- var parent = Dropdown._getParentFromElement(this);
- var isActive = $(parent).hasClass(ClassName$4.SHOW);
- if (!isActive && event.which === ESCAPE_KEYCODE) {
- return;
- }
- if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
- if (event.which === ESCAPE_KEYCODE) {
- var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
- $(toggle).trigger('focus');
- }
- $(this).trigger('click');
- return;
- }
- var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
- return $(item).is(':visible');
- });
- if (items.length === 0) {
- return;
- }
- var index = items.indexOf(event.target);
- if (event.which === ARROW_UP_KEYCODE && index > 0) {
- // Up
- index--;
- }
- if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
- // Down
- index++;
- }
- if (index < 0) {
- index = 0;
- }
- items[index].focus();
- };
- _createClass(Dropdown, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$4;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$2;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$2;
- }
- }]);
- return Dropdown;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
- event.preventDefault();
- event.stopPropagation();
- Dropdown._jQueryInterface.call($(this), 'toggle');
- }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
- e.stopPropagation();
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$4] = Dropdown._jQueryInterface;
- $.fn[NAME$4].Constructor = Dropdown;
- $.fn[NAME$4].noConflict = function () {
- $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
- return Dropdown._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$5 = 'modal';
- var VERSION$5 = '4.4.1';
- var DATA_KEY$5 = 'bs.modal';
- var EVENT_KEY$5 = "." + DATA_KEY$5;
- var DATA_API_KEY$5 = '.data-api';
- var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
- var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
- var Default$3 = {
- backdrop: true,
- keyboard: true,
- focus: true,
- show: true
- };
- var DefaultType$3 = {
- backdrop: '(boolean|string)',
- keyboard: 'boolean',
- focus: 'boolean',
- show: 'boolean'
- };
- var Event$5 = {
- HIDE: "hide" + EVENT_KEY$5,
- HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
- HIDDEN: "hidden" + EVENT_KEY$5,
- SHOW: "show" + EVENT_KEY$5,
- SHOWN: "shown" + EVENT_KEY$5,
- FOCUSIN: "focusin" + EVENT_KEY$5,
- RESIZE: "resize" + EVENT_KEY$5,
- CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
- KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
- MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
- MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
- CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
- };
- var ClassName$5 = {
- SCROLLABLE: 'modal-dialog-scrollable',
- SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
- BACKDROP: 'modal-backdrop',
- OPEN: 'modal-open',
- FADE: 'fade',
- SHOW: 'show',
- STATIC: 'modal-static'
- };
- var Selector$5 = {
- DIALOG: '.modal-dialog',
- MODAL_BODY: '.modal-body',
- DATA_TOGGLE: '[data-toggle="modal"]',
- DATA_DISMISS: '[data-dismiss="modal"]',
- FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
- STICKY_CONTENT: '.sticky-top'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Modal =
- /*#__PURE__*/
- function () {
- function Modal(element, config) {
- this._config = this._getConfig(config);
- this._element = element;
- this._dialog = element.querySelector(Selector$5.DIALOG);
- this._backdrop = null;
- this._isShown = false;
- this._isBodyOverflowing = false;
- this._ignoreBackdropClick = false;
- this._isTransitioning = false;
- this._scrollbarWidth = 0;
- } // Getters
- var _proto = Modal.prototype;
- // Public
- _proto.toggle = function toggle(relatedTarget) {
- return this._isShown ? this.hide() : this.show(relatedTarget);
- };
- _proto.show = function show(relatedTarget) {
- var _this = this;
- if (this._isShown || this._isTransitioning) {
- return;
- }
- if ($(this._element).hasClass(ClassName$5.FADE)) {
- this._isTransitioning = true;
- }
- var showEvent = $.Event(Event$5.SHOW, {
- relatedTarget: relatedTarget
- });
- $(this._element).trigger(showEvent);
- if (this._isShown || showEvent.isDefaultPrevented()) {
- return;
- }
- this._isShown = true;
- this._checkScrollbar();
- this._setScrollbar();
- this._adjustDialog();
- this._setEscapeEvent();
- this._setResizeEvent();
- $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
- return _this.hide(event);
- });
- $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
- $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
- if ($(event.target).is(_this._element)) {
- _this._ignoreBackdropClick = true;
- }
- });
- });
- this._showBackdrop(function () {
- return _this._showElement(relatedTarget);
- });
- };
- _proto.hide = function hide(event) {
- var _this2 = this;
- if (event) {
- event.preventDefault();
- }
- if (!this._isShown || this._isTransitioning) {
- return;
- }
- var hideEvent = $.Event(Event$5.HIDE);
- $(this._element).trigger(hideEvent);
- if (!this._isShown || hideEvent.isDefaultPrevented()) {
- return;
- }
- this._isShown = false;
- var transition = $(this._element).hasClass(ClassName$5.FADE);
- if (transition) {
- this._isTransitioning = true;
- }
- this._setEscapeEvent();
- this._setResizeEvent();
- $(document).off(Event$5.FOCUSIN);
- $(this._element).removeClass(ClassName$5.SHOW);
- $(this._element).off(Event$5.CLICK_DISMISS);
- $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
- if (transition) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $(this._element).one(Util.TRANSITION_END, function (event) {
- return _this2._hideModal(event);
- }).emulateTransitionEnd(transitionDuration);
- } else {
- this._hideModal();
- }
- };
- _proto.dispose = function dispose() {
- [window, this._element, this._dialog].forEach(function (htmlElement) {
- return $(htmlElement).off(EVENT_KEY$5);
- });
- /**
- * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
- * Do not move `document` in `htmlElements` array
- * It will remove `Event.CLICK_DATA_API` event that should remain
- */
- $(document).off(Event$5.FOCUSIN);
- $.removeData(this._element, DATA_KEY$5);
- this._config = null;
- this._element = null;
- this._dialog = null;
- this._backdrop = null;
- this._isShown = null;
- this._isBodyOverflowing = null;
- this._ignoreBackdropClick = null;
- this._isTransitioning = null;
- this._scrollbarWidth = null;
- };
- _proto.handleUpdate = function handleUpdate() {
- this._adjustDialog();
- } // Private
- ;
- _proto._getConfig = function _getConfig(config) {
- config = _objectSpread2({}, Default$3, {}, config);
- Util.typeCheckConfig(NAME$5, config, DefaultType$3);
- return config;
- };
- _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
- var _this3 = this;
- if (this._config.backdrop === 'static') {
- var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
- $(this._element).trigger(hideEventPrevented);
- if (hideEventPrevented.defaultPrevented) {
- return;
- }
- this._element.classList.add(ClassName$5.STATIC);
- var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
- $(this._element).one(Util.TRANSITION_END, function () {
- _this3._element.classList.remove(ClassName$5.STATIC);
- }).emulateTransitionEnd(modalTransitionDuration);
- this._element.focus();
- } else {
- this.hide();
- }
- };
- _proto._showElement = function _showElement(relatedTarget) {
- var _this4 = this;
- var transition = $(this._element).hasClass(ClassName$5.FADE);
- var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
- if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
- // Don't move modal's DOM position
- document.body.appendChild(this._element);
- }
- this._element.style.display = 'block';
- this._element.removeAttribute('aria-hidden');
- this._element.setAttribute('aria-modal', true);
- if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
- modalBody.scrollTop = 0;
- } else {
- this._element.scrollTop = 0;
- }
- if (transition) {
- Util.reflow(this._element);
- }
- $(this._element).addClass(ClassName$5.SHOW);
- if (this._config.focus) {
- this._enforceFocus();
- }
- var shownEvent = $.Event(Event$5.SHOWN, {
- relatedTarget: relatedTarget
- });
- var transitionComplete = function transitionComplete() {
- if (_this4._config.focus) {
- _this4._element.focus();
- }
- _this4._isTransitioning = false;
- $(_this4._element).trigger(shownEvent);
- };
- if (transition) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
- $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
- } else {
- transitionComplete();
- }
- };
- _proto._enforceFocus = function _enforceFocus() {
- var _this5 = this;
- $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
- .on(Event$5.FOCUSIN, function (event) {
- if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
- _this5._element.focus();
- }
- });
- };
- _proto._setEscapeEvent = function _setEscapeEvent() {
- var _this6 = this;
- if (this._isShown && this._config.keyboard) {
- $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
- if (event.which === ESCAPE_KEYCODE$1) {
- _this6._triggerBackdropTransition();
- }
- });
- } else if (!this._isShown) {
- $(this._element).off(Event$5.KEYDOWN_DISMISS);
- }
- };
- _proto._setResizeEvent = function _setResizeEvent() {
- var _this7 = this;
- if (this._isShown) {
- $(window).on(Event$5.RESIZE, function (event) {
- return _this7.handleUpdate(event);
- });
- } else {
- $(window).off(Event$5.RESIZE);
- }
- };
- _proto._hideModal = function _hideModal() {
- var _this8 = this;
- this._element.style.display = 'none';
- this._element.setAttribute('aria-hidden', true);
- this._element.removeAttribute('aria-modal');
- this._isTransitioning = false;
- this._showBackdrop(function () {
- $(document.body).removeClass(ClassName$5.OPEN);
- _this8._resetAdjustments();
- _this8._resetScrollbar();
- $(_this8._element).trigger(Event$5.HIDDEN);
- });
- };
- _proto._removeBackdrop = function _removeBackdrop() {
- if (this._backdrop) {
- $(this._backdrop).remove();
- this._backdrop = null;
- }
- };
- _proto._showBackdrop = function _showBackdrop(callback) {
- var _this9 = this;
- var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
- if (this._isShown && this._config.backdrop) {
- this._backdrop = document.createElement('div');
- this._backdrop.className = ClassName$5.BACKDROP;
- if (animate) {
- this._backdrop.classList.add(animate);
- }
- $(this._backdrop).appendTo(document.body);
- $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
- if (_this9._ignoreBackdropClick) {
- _this9._ignoreBackdropClick = false;
- return;
- }
- if (event.target !== event.currentTarget) {
- return;
- }
- _this9._triggerBackdropTransition();
- });
- if (animate) {
- Util.reflow(this._backdrop);
- }
- $(this._backdrop).addClass(ClassName$5.SHOW);
- if (!callback) {
- return;
- }
- if (!animate) {
- callback();
- return;
- }
- var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
- $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
- } else if (!this._isShown && this._backdrop) {
- $(this._backdrop).removeClass(ClassName$5.SHOW);
- var callbackRemove = function callbackRemove() {
- _this9._removeBackdrop();
- if (callback) {
- callback();
- }
- };
- if ($(this._element).hasClass(ClassName$5.FADE)) {
- var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
- $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
- } else {
- callbackRemove();
- }
- } else if (callback) {
- callback();
- }
- } // ----------------------------------------------------------------------
- // the following methods are used to handle overflowing modals
- // todo (fat): these should probably be refactored out of modal.js
- // ----------------------------------------------------------------------
- ;
- _proto._adjustDialog = function _adjustDialog() {
- var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
- if (!this._isBodyOverflowing && isModalOverflowing) {
- this._element.style.paddingLeft = this._scrollbarWidth + "px";
- }
- if (this._isBodyOverflowing && !isModalOverflowing) {
- this._element.style.paddingRight = this._scrollbarWidth + "px";
- }
- };
- _proto._resetAdjustments = function _resetAdjustments() {
- this._element.style.paddingLeft = '';
- this._element.style.paddingRight = '';
- };
- _proto._checkScrollbar = function _checkScrollbar() {
- var rect = document.body.getBoundingClientRect();
- this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
- this._scrollbarWidth = this._getScrollbarWidth();
- };
- _proto._setScrollbar = function _setScrollbar() {
- var _this10 = this;
- if (this._isBodyOverflowing) {
- // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
- // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
- var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
- var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
- $(fixedContent).each(function (index, element) {
- var actualPadding = element.style.paddingRight;
- var calculatedPadding = $(element).css('padding-right');
- $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
- }); // Adjust sticky content margin
- $(stickyContent).each(function (index, element) {
- var actualMargin = element.style.marginRight;
- var calculatedMargin = $(element).css('margin-right');
- $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
- }); // Adjust body padding
- var actualPadding = document.body.style.paddingRight;
- var calculatedPadding = $(document.body).css('padding-right');
- $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
- }
- $(document.body).addClass(ClassName$5.OPEN);
- };
- _proto._resetScrollbar = function _resetScrollbar() {
- // Restore fixed content padding
- var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
- $(fixedContent).each(function (index, element) {
- var padding = $(element).data('padding-right');
- $(element).removeData('padding-right');
- element.style.paddingRight = padding ? padding : '';
- }); // Restore sticky content
- var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
- $(elements).each(function (index, element) {
- var margin = $(element).data('margin-right');
- if (typeof margin !== 'undefined') {
- $(element).css('margin-right', margin).removeData('margin-right');
- }
- }); // Restore body padding
- var padding = $(document.body).data('padding-right');
- $(document.body).removeData('padding-right');
- document.body.style.paddingRight = padding ? padding : '';
- };
- _proto._getScrollbarWidth = function _getScrollbarWidth() {
- // thx d.walsh
- var scrollDiv = document.createElement('div');
- scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
- document.body.appendChild(scrollDiv);
- var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
- document.body.removeChild(scrollDiv);
- return scrollbarWidth;
- } // Static
- ;
- Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY$5);
- var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
- if (!data) {
- data = new Modal(this, _config);
- $(this).data(DATA_KEY$5, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config](relatedTarget);
- } else if (_config.show) {
- data.show(relatedTarget);
- }
- });
- };
- _createClass(Modal, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$5;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$3;
- }
- }]);
- return Modal;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
- var _this11 = this;
- var target;
- var selector = Util.getSelectorFromElement(this);
- if (selector) {
- target = document.querySelector(selector);
- }
- var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
- if (this.tagName === 'A' || this.tagName === 'AREA') {
- event.preventDefault();
- }
- var $target = $(target).one(Event$5.SHOW, function (showEvent) {
- if (showEvent.isDefaultPrevented()) {
- // Only register focus restorer if modal will actually get shown
- return;
- }
- $target.one(Event$5.HIDDEN, function () {
- if ($(_this11).is(':visible')) {
- _this11.focus();
- }
- });
- });
- Modal._jQueryInterface.call($(target), config, this);
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$5] = Modal._jQueryInterface;
- $.fn[NAME$5].Constructor = Modal;
- $.fn[NAME$5].noConflict = function () {
- $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
- return Modal._jQueryInterface;
- };
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v4.4.1): tools/sanitizer.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * --------------------------------------------------------------------------
- */
- var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
- var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
- var DefaultWhitelist = {
- // Global attributes allowed on any supplied element below.
- '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
- a: ['target', 'href', 'title', 'rel'],
- area: [],
- b: [],
- br: [],
- col: [],
- code: [],
- div: [],
- em: [],
- hr: [],
- h1: [],
- h2: [],
- h3: [],
- h4: [],
- h5: [],
- h6: [],
- i: [],
- img: ['src', 'alt', 'title', 'width', 'height'],
- li: [],
- ol: [],
- p: [],
- pre: [],
- s: [],
- small: [],
- span: [],
- sub: [],
- sup: [],
- strong: [],
- u: [],
- ul: []
- };
- /**
- * A pattern that recognizes a commonly useful subset of URLs that are safe.
- *
- * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
- */
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
- /**
- * A pattern that matches safe data URLs. Only matches image, video and audio types.
- *
- * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
- */
- var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
- function allowedAttribute(attr, allowedAttributeList) {
- var attrName = attr.nodeName.toLowerCase();
- if (allowedAttributeList.indexOf(attrName) !== -1) {
- if (uriAttrs.indexOf(attrName) !== -1) {
- return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
- }
- return true;
- }
- var regExp = allowedAttributeList.filter(function (attrRegex) {
- return attrRegex instanceof RegExp;
- }); // Check if a regular expression validates the attribute.
- for (var i = 0, l = regExp.length; i < l; i++) {
- if (attrName.match(regExp[i])) {
- return true;
- }
- }
- return false;
- }
- function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
- if (unsafeHtml.length === 0) {
- return unsafeHtml;
- }
- if (sanitizeFn && typeof sanitizeFn === 'function') {
- return sanitizeFn(unsafeHtml);
- }
- var domParser = new window.DOMParser();
- var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
- var whitelistKeys = Object.keys(whiteList);
- var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
- var _loop = function _loop(i, len) {
- var el = elements[i];
- var elName = el.nodeName.toLowerCase();
- if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
- el.parentNode.removeChild(el);
- return "continue";
- }
- var attributeList = [].slice.call(el.attributes);
- var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
- attributeList.forEach(function (attr) {
- if (!allowedAttribute(attr, whitelistedAttributes)) {
- el.removeAttribute(attr.nodeName);
- }
- });
- };
- for (var i = 0, len = elements.length; i < len; i++) {
- var _ret = _loop(i);
- if (_ret === "continue") continue;
- }
- return createdDocument.body.innerHTML;
- }
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$6 = 'tooltip';
- var VERSION$6 = '4.4.1';
- var DATA_KEY$6 = 'bs.tooltip';
- var EVENT_KEY$6 = "." + DATA_KEY$6;
- var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
- var CLASS_PREFIX = 'bs-tooltip';
- var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
- var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
- var DefaultType$4 = {
- animation: 'boolean',
- template: 'string',
- title: '(string|element|function)',
- trigger: 'string',
- delay: '(number|object)',
- html: 'boolean',
- selector: '(string|boolean)',
- placement: '(string|function)',
- offset: '(number|string|function)',
- container: '(string|element|boolean)',
- fallbackPlacement: '(string|array)',
- boundary: '(string|element)',
- sanitize: 'boolean',
- sanitizeFn: '(null|function)',
- whiteList: 'object',
- popperConfig: '(null|object)'
- };
- var AttachmentMap$1 = {
- AUTO: 'auto',
- TOP: 'top',
- RIGHT: 'right',
- BOTTOM: 'bottom',
- LEFT: 'left'
- };
- var Default$4 = {
- animation: true,
- template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
- trigger: 'hover focus',
- title: '',
- delay: 0,
- html: false,
- selector: false,
- placement: 'top',
- offset: 0,
- container: false,
- fallbackPlacement: 'flip',
- boundary: 'scrollParent',
- sanitize: true,
- sanitizeFn: null,
- whiteList: DefaultWhitelist,
- popperConfig: null
- };
- var HoverState = {
- SHOW: 'show',
- OUT: 'out'
- };
- var Event$6 = {
- HIDE: "hide" + EVENT_KEY$6,
- HIDDEN: "hidden" + EVENT_KEY$6,
- SHOW: "show" + EVENT_KEY$6,
- SHOWN: "shown" + EVENT_KEY$6,
- INSERTED: "inserted" + EVENT_KEY$6,
- CLICK: "click" + EVENT_KEY$6,
- FOCUSIN: "focusin" + EVENT_KEY$6,
- FOCUSOUT: "focusout" + EVENT_KEY$6,
- MOUSEENTER: "mouseenter" + EVENT_KEY$6,
- MOUSELEAVE: "mouseleave" + EVENT_KEY$6
- };
- var ClassName$6 = {
- FADE: 'fade',
- SHOW: 'show'
- };
- var Selector$6 = {
- TOOLTIP: '.tooltip',
- TOOLTIP_INNER: '.tooltip-inner',
- ARROW: '.arrow'
- };
- var Trigger = {
- HOVER: 'hover',
- FOCUS: 'focus',
- CLICK: 'click',
- MANUAL: 'manual'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Tooltip =
- /*#__PURE__*/
- function () {
- function Tooltip(element, config) {
- if (typeof Popper === 'undefined') {
- throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
- } // private
- this._isEnabled = true;
- this._timeout = 0;
- this._hoverState = '';
- this._activeTrigger = {};
- this._popper = null; // Protected
- this.element = element;
- this.config = this._getConfig(config);
- this.tip = null;
- this._setListeners();
- } // Getters
- var _proto = Tooltip.prototype;
- // Public
- _proto.enable = function enable() {
- this._isEnabled = true;
- };
- _proto.disable = function disable() {
- this._isEnabled = false;
- };
- _proto.toggleEnabled = function toggleEnabled() {
- this._isEnabled = !this._isEnabled;
- };
- _proto.toggle = function toggle(event) {
- if (!this._isEnabled) {
- return;
- }
- if (event) {
- var dataKey = this.constructor.DATA_KEY;
- var context = $(event.currentTarget).data(dataKey);
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $(event.currentTarget).data(dataKey, context);
- }
- context._activeTrigger.click = !context._activeTrigger.click;
- if (context._isWithActiveTrigger()) {
- context._enter(null, context);
- } else {
- context._leave(null, context);
- }
- } else {
- if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
- this._leave(null, this);
- return;
- }
- this._enter(null, this);
- }
- };
- _proto.dispose = function dispose() {
- clearTimeout(this._timeout);
- $.removeData(this.element, this.constructor.DATA_KEY);
- $(this.element).off(this.constructor.EVENT_KEY);
- $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
- if (this.tip) {
- $(this.tip).remove();
- }
- this._isEnabled = null;
- this._timeout = null;
- this._hoverState = null;
- this._activeTrigger = null;
- if (this._popper) {
- this._popper.destroy();
- }
- this._popper = null;
- this.element = null;
- this.config = null;
- this.tip = null;
- };
- _proto.show = function show() {
- var _this = this;
- if ($(this.element).css('display') === 'none') {
- throw new Error('Please use show on visible elements');
- }
- var showEvent = $.Event(this.constructor.Event.SHOW);
- if (this.isWithContent() && this._isEnabled) {
- $(this.element).trigger(showEvent);
- var shadowRoot = Util.findShadowRoot(this.element);
- var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
- if (showEvent.isDefaultPrevented() || !isInTheDom) {
- return;
- }
- var tip = this.getTipElement();
- var tipId = Util.getUID(this.constructor.NAME);
- tip.setAttribute('id', tipId);
- this.element.setAttribute('aria-describedby', tipId);
- this.setContent();
- if (this.config.animation) {
- $(tip).addClass(ClassName$6.FADE);
- }
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
- var attachment = this._getAttachment(placement);
- this.addAttachmentClass(attachment);
- var container = this._getContainer();
- $(tip).data(this.constructor.DATA_KEY, this);
- if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
- $(tip).appendTo(container);
- }
- $(this.element).trigger(this.constructor.Event.INSERTED);
- this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
- $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
- // empty mouseover listeners to the body's immediate children;
- // only needed because of broken event delegation on iOS
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
- if ('ontouchstart' in document.documentElement) {
- $(document.body).children().on('mouseover', null, $.noop);
- }
- var complete = function complete() {
- if (_this.config.animation) {
- _this._fixTransition();
- }
- var prevHoverState = _this._hoverState;
- _this._hoverState = null;
- $(_this.element).trigger(_this.constructor.Event.SHOWN);
- if (prevHoverState === HoverState.OUT) {
- _this._leave(null, _this);
- }
- };
- if ($(this.tip).hasClass(ClassName$6.FADE)) {
- var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
- $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- }
- };
- _proto.hide = function hide(callback) {
- var _this2 = this;
- var tip = this.getTipElement();
- var hideEvent = $.Event(this.constructor.Event.HIDE);
- var complete = function complete() {
- if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
- tip.parentNode.removeChild(tip);
- }
- _this2._cleanTipClass();
- _this2.element.removeAttribute('aria-describedby');
- $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
- if (_this2._popper !== null) {
- _this2._popper.destroy();
- }
- if (callback) {
- callback();
- }
- };
- $(this.element).trigger(hideEvent);
- if (hideEvent.isDefaultPrevented()) {
- return;
- }
- $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
- // empty mouseover listeners we added for iOS support
- if ('ontouchstart' in document.documentElement) {
- $(document.body).children().off('mouseover', null, $.noop);
- }
- this._activeTrigger[Trigger.CLICK] = false;
- this._activeTrigger[Trigger.FOCUS] = false;
- this._activeTrigger[Trigger.HOVER] = false;
- if ($(this.tip).hasClass(ClassName$6.FADE)) {
- var transitionDuration = Util.getTransitionDurationFromElement(tip);
- $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- this._hoverState = '';
- };
- _proto.update = function update() {
- if (this._popper !== null) {
- this._popper.scheduleUpdate();
- }
- } // Protected
- ;
- _proto.isWithContent = function isWithContent() {
- return Boolean(this.getTitle());
- };
- _proto.addAttachmentClass = function addAttachmentClass(attachment) {
- $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
- };
- _proto.getTipElement = function getTipElement() {
- this.tip = this.tip || $(this.config.template)[0];
- return this.tip;
- };
- _proto.setContent = function setContent() {
- var tip = this.getTipElement();
- this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
- $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
- };
- _proto.setElementContent = function setElementContent($element, content) {
- if (typeof content === 'object' && (content.nodeType || content.jquery)) {
- // Content is a DOM node or a jQuery
- if (this.config.html) {
- if (!$(content).parent().is($element)) {
- $element.empty().append(content);
- }
- } else {
- $element.text($(content).text());
- }
- return;
- }
- if (this.config.html) {
- if (this.config.sanitize) {
- content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
- }
- $element.html(content);
- } else {
- $element.text(content);
- }
- };
- _proto.getTitle = function getTitle() {
- var title = this.element.getAttribute('data-original-title');
- if (!title) {
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
- }
- return title;
- } // Private
- ;
- _proto._getPopperConfig = function _getPopperConfig(attachment) {
- var _this3 = this;
- var defaultBsConfig = {
- placement: attachment,
- modifiers: {
- offset: this._getOffset(),
- flip: {
- behavior: this.config.fallbackPlacement
- },
- arrow: {
- element: Selector$6.ARROW
- },
- preventOverflow: {
- boundariesElement: this.config.boundary
- }
- },
- onCreate: function onCreate(data) {
- if (data.originalPlacement !== data.placement) {
- _this3._handlePopperPlacementChange(data);
- }
- },
- onUpdate: function onUpdate(data) {
- return _this3._handlePopperPlacementChange(data);
- }
- };
- return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
- };
- _proto._getOffset = function _getOffset() {
- var _this4 = this;
- var offset = {};
- if (typeof this.config.offset === 'function') {
- offset.fn = function (data) {
- data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
- return data;
- };
- } else {
- offset.offset = this.config.offset;
- }
- return offset;
- };
- _proto._getContainer = function _getContainer() {
- if (this.config.container === false) {
- return document.body;
- }
- if (Util.isElement(this.config.container)) {
- return $(this.config.container);
- }
- return $(document).find(this.config.container);
- };
- _proto._getAttachment = function _getAttachment(placement) {
- return AttachmentMap$1[placement.toUpperCase()];
- };
- _proto._setListeners = function _setListeners() {
- var _this5 = this;
- var triggers = this.config.trigger.split(' ');
- triggers.forEach(function (trigger) {
- if (trigger === 'click') {
- $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
- return _this5.toggle(event);
- });
- } else if (trigger !== Trigger.MANUAL) {
- var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
- var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
- $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
- return _this5._enter(event);
- }).on(eventOut, _this5.config.selector, function (event) {
- return _this5._leave(event);
- });
- }
- });
- this._hideModalHandler = function () {
- if (_this5.element) {
- _this5.hide();
- }
- };
- $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
- if (this.config.selector) {
- this.config = _objectSpread2({}, this.config, {
- trigger: 'manual',
- selector: ''
- });
- } else {
- this._fixTitle();
- }
- };
- _proto._fixTitle = function _fixTitle() {
- var titleType = typeof this.element.getAttribute('data-original-title');
- if (this.element.getAttribute('title') || titleType !== 'string') {
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
- this.element.setAttribute('title', '');
- }
- };
- _proto._enter = function _enter(event, context) {
- var dataKey = this.constructor.DATA_KEY;
- context = context || $(event.currentTarget).data(dataKey);
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $(event.currentTarget).data(dataKey, context);
- }
- if (event) {
- context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
- }
- if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
- context._hoverState = HoverState.SHOW;
- return;
- }
- clearTimeout(context._timeout);
- context._hoverState = HoverState.SHOW;
- if (!context.config.delay || !context.config.delay.show) {
- context.show();
- return;
- }
- context._timeout = setTimeout(function () {
- if (context._hoverState === HoverState.SHOW) {
- context.show();
- }
- }, context.config.delay.show);
- };
- _proto._leave = function _leave(event, context) {
- var dataKey = this.constructor.DATA_KEY;
- context = context || $(event.currentTarget).data(dataKey);
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $(event.currentTarget).data(dataKey, context);
- }
- if (event) {
- context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
- }
- if (context._isWithActiveTrigger()) {
- return;
- }
- clearTimeout(context._timeout);
- context._hoverState = HoverState.OUT;
- if (!context.config.delay || !context.config.delay.hide) {
- context.hide();
- return;
- }
- context._timeout = setTimeout(function () {
- if (context._hoverState === HoverState.OUT) {
- context.hide();
- }
- }, context.config.delay.hide);
- };
- _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
- for (var trigger in this._activeTrigger) {
- if (this._activeTrigger[trigger]) {
- return true;
- }
- }
- return false;
- };
- _proto._getConfig = function _getConfig(config) {
- var dataAttributes = $(this.element).data();
- Object.keys(dataAttributes).forEach(function (dataAttr) {
- if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
- delete dataAttributes[dataAttr];
- }
- });
- config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
- if (typeof config.delay === 'number') {
- config.delay = {
- show: config.delay,
- hide: config.delay
- };
- }
- if (typeof config.title === 'number') {
- config.title = config.title.toString();
- }
- if (typeof config.content === 'number') {
- config.content = config.content.toString();
- }
- Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
- if (config.sanitize) {
- config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
- }
- return config;
- };
- _proto._getDelegateConfig = function _getDelegateConfig() {
- var config = {};
- if (this.config) {
- for (var key in this.config) {
- if (this.constructor.Default[key] !== this.config[key]) {
- config[key] = this.config[key];
- }
- }
- }
- return config;
- };
- _proto._cleanTipClass = function _cleanTipClass() {
- var $tip = $(this.getTipElement());
- var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
- if (tabClass !== null && tabClass.length) {
- $tip.removeClass(tabClass.join(''));
- }
- };
- _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
- var popperInstance = popperData.instance;
- this.tip = popperInstance.popper;
- this._cleanTipClass();
- this.addAttachmentClass(this._getAttachment(popperData.placement));
- };
- _proto._fixTransition = function _fixTransition() {
- var tip = this.getTipElement();
- var initConfigAnimation = this.config.animation;
- if (tip.getAttribute('x-placement') !== null) {
- return;
- }
- $(tip).removeClass(ClassName$6.FADE);
- this.config.animation = false;
- this.hide();
- this.show();
- this.config.animation = initConfigAnimation;
- } // Static
- ;
- Tooltip._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY$6);
- var _config = typeof config === 'object' && config;
- if (!data && /dispose|hide/.test(config)) {
- return;
- }
- if (!data) {
- data = new Tooltip(this, _config);
- $(this).data(DATA_KEY$6, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config]();
- }
- });
- };
- _createClass(Tooltip, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$6;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$4;
- }
- }, {
- key: "NAME",
- get: function get() {
- return NAME$6;
- }
- }, {
- key: "DATA_KEY",
- get: function get() {
- return DATA_KEY$6;
- }
- }, {
- key: "Event",
- get: function get() {
- return Event$6;
- }
- }, {
- key: "EVENT_KEY",
- get: function get() {
- return EVENT_KEY$6;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$4;
- }
- }]);
- return Tooltip;
- }();
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$6] = Tooltip._jQueryInterface;
- $.fn[NAME$6].Constructor = Tooltip;
- $.fn[NAME$6].noConflict = function () {
- $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
- return Tooltip._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$7 = 'popover';
- var VERSION$7 = '4.4.1';
- var DATA_KEY$7 = 'bs.popover';
- var EVENT_KEY$7 = "." + DATA_KEY$7;
- var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
- var CLASS_PREFIX$1 = 'bs-popover';
- var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
- var Default$5 = _objectSpread2({}, Tooltip.Default, {
- placement: 'right',
- trigger: 'click',
- content: '',
- template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
- });
- var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
- content: '(string|element|function)'
- });
- var ClassName$7 = {
- FADE: 'fade',
- SHOW: 'show'
- };
- var Selector$7 = {
- TITLE: '.popover-header',
- CONTENT: '.popover-body'
- };
- var Event$7 = {
- HIDE: "hide" + EVENT_KEY$7,
- HIDDEN: "hidden" + EVENT_KEY$7,
- SHOW: "show" + EVENT_KEY$7,
- SHOWN: "shown" + EVENT_KEY$7,
- INSERTED: "inserted" + EVENT_KEY$7,
- CLICK: "click" + EVENT_KEY$7,
- FOCUSIN: "focusin" + EVENT_KEY$7,
- FOCUSOUT: "focusout" + EVENT_KEY$7,
- MOUSEENTER: "mouseenter" + EVENT_KEY$7,
- MOUSELEAVE: "mouseleave" + EVENT_KEY$7
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Popover =
- /*#__PURE__*/
- function (_Tooltip) {
- _inheritsLoose(Popover, _Tooltip);
- function Popover() {
- return _Tooltip.apply(this, arguments) || this;
- }
- var _proto = Popover.prototype;
- // Overrides
- _proto.isWithContent = function isWithContent() {
- return this.getTitle() || this._getContent();
- };
- _proto.addAttachmentClass = function addAttachmentClass(attachment) {
- $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
- };
- _proto.getTipElement = function getTipElement() {
- this.tip = this.tip || $(this.config.template)[0];
- return this.tip;
- };
- _proto.setContent = function setContent() {
- var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
- this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
- var content = this._getContent();
- if (typeof content === 'function') {
- content = content.call(this.element);
- }
- this.setElementContent($tip.find(Selector$7.CONTENT), content);
- $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
- } // Private
- ;
- _proto._getContent = function _getContent() {
- return this.element.getAttribute('data-content') || this.config.content;
- };
- _proto._cleanTipClass = function _cleanTipClass() {
- var $tip = $(this.getTipElement());
- var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
- if (tabClass !== null && tabClass.length > 0) {
- $tip.removeClass(tabClass.join(''));
- }
- } // Static
- ;
- Popover._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY$7);
- var _config = typeof config === 'object' ? config : null;
- if (!data && /dispose|hide/.test(config)) {
- return;
- }
- if (!data) {
- data = new Popover(this, _config);
- $(this).data(DATA_KEY$7, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config]();
- }
- });
- };
- _createClass(Popover, null, [{
- key: "VERSION",
- // Getters
- get: function get() {
- return VERSION$7;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$5;
- }
- }, {
- key: "NAME",
- get: function get() {
- return NAME$7;
- }
- }, {
- key: "DATA_KEY",
- get: function get() {
- return DATA_KEY$7;
- }
- }, {
- key: "Event",
- get: function get() {
- return Event$7;
- }
- }, {
- key: "EVENT_KEY",
- get: function get() {
- return EVENT_KEY$7;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$5;
- }
- }]);
- return Popover;
- }(Tooltip);
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$7] = Popover._jQueryInterface;
- $.fn[NAME$7].Constructor = Popover;
- $.fn[NAME$7].noConflict = function () {
- $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
- return Popover._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$8 = 'scrollspy';
- var VERSION$8 = '4.4.1';
- var DATA_KEY$8 = 'bs.scrollspy';
- var EVENT_KEY$8 = "." + DATA_KEY$8;
- var DATA_API_KEY$6 = '.data-api';
- var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
- var Default$6 = {
- offset: 10,
- method: 'auto',
- target: ''
- };
- var DefaultType$6 = {
- offset: 'number',
- method: 'string',
- target: '(string|element)'
- };
- var Event$8 = {
- ACTIVATE: "activate" + EVENT_KEY$8,
- SCROLL: "scroll" + EVENT_KEY$8,
- LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
- };
- var ClassName$8 = {
- DROPDOWN_ITEM: 'dropdown-item',
- DROPDOWN_MENU: 'dropdown-menu',
- ACTIVE: 'active'
- };
- var Selector$8 = {
- DATA_SPY: '[data-spy="scroll"]',
- ACTIVE: '.active',
- NAV_LIST_GROUP: '.nav, .list-group',
- NAV_LINKS: '.nav-link',
- NAV_ITEMS: '.nav-item',
- LIST_ITEMS: '.list-group-item',
- DROPDOWN: '.dropdown',
- DROPDOWN_ITEMS: '.dropdown-item',
- DROPDOWN_TOGGLE: '.dropdown-toggle'
- };
- var OffsetMethod = {
- OFFSET: 'offset',
- POSITION: 'position'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var ScrollSpy =
- /*#__PURE__*/
- function () {
- function ScrollSpy(element, config) {
- var _this = this;
- this._element = element;
- this._scrollElement = element.tagName === 'BODY' ? window : element;
- this._config = this._getConfig(config);
- this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
- this._offsets = [];
- this._targets = [];
- this._activeTarget = null;
- this._scrollHeight = 0;
- $(this._scrollElement).on(Event$8.SCROLL, function (event) {
- return _this._process(event);
- });
- this.refresh();
- this._process();
- } // Getters
- var _proto = ScrollSpy.prototype;
- // Public
- _proto.refresh = function refresh() {
- var _this2 = this;
- var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
- var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
- var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
- this._offsets = [];
- this._targets = [];
- this._scrollHeight = this._getScrollHeight();
- var targets = [].slice.call(document.querySelectorAll(this._selector));
- targets.map(function (element) {
- var target;
- var targetSelector = Util.getSelectorFromElement(element);
- if (targetSelector) {
- target = document.querySelector(targetSelector);
- }
- if (target) {
- var targetBCR = target.getBoundingClientRect();
- if (targetBCR.width || targetBCR.height) {
- // TODO (fat): remove sketch reliance on jQuery position/offset
- return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
- }
- }
- return null;
- }).filter(function (item) {
- return item;
- }).sort(function (a, b) {
- return a[0] - b[0];
- }).forEach(function (item) {
- _this2._offsets.push(item[0]);
- _this2._targets.push(item[1]);
- });
- };
- _proto.dispose = function dispose() {
- $.removeData(this._element, DATA_KEY$8);
- $(this._scrollElement).off(EVENT_KEY$8);
- this._element = null;
- this._scrollElement = null;
- this._config = null;
- this._selector = null;
- this._offsets = null;
- this._targets = null;
- this._activeTarget = null;
- this._scrollHeight = null;
- } // Private
- ;
- _proto._getConfig = function _getConfig(config) {
- config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
- if (typeof config.target !== 'string') {
- var id = $(config.target).attr('id');
- if (!id) {
- id = Util.getUID(NAME$8);
- $(config.target).attr('id', id);
- }
- config.target = "#" + id;
- }
- Util.typeCheckConfig(NAME$8, config, DefaultType$6);
- return config;
- };
- _proto._getScrollTop = function _getScrollTop() {
- return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
- };
- _proto._getScrollHeight = function _getScrollHeight() {
- return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
- };
- _proto._getOffsetHeight = function _getOffsetHeight() {
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
- };
- _proto._process = function _process() {
- var scrollTop = this._getScrollTop() + this._config.offset;
- var scrollHeight = this._getScrollHeight();
- var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
- if (this._scrollHeight !== scrollHeight) {
- this.refresh();
- }
- if (scrollTop >= maxScroll) {
- var target = this._targets[this._targets.length - 1];
- if (this._activeTarget !== target) {
- this._activate(target);
- }
- return;
- }
- if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
- this._activeTarget = null;
- this._clear();
- return;
- }
- var offsetLength = this._offsets.length;
- for (var i = offsetLength; i--;) {
- var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
- if (isActiveTarget) {
- this._activate(this._targets[i]);
- }
- }
- };
- _proto._activate = function _activate(target) {
- this._activeTarget = target;
- this._clear();
- var queries = this._selector.split(',').map(function (selector) {
- return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
- });
- var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
- if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
- $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
- $link.addClass(ClassName$8.ACTIVE);
- } else {
- // Set triggered link as active
- $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
- // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
- $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
- $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
- }
- $(this._scrollElement).trigger(Event$8.ACTIVATE, {
- relatedTarget: target
- });
- };
- _proto._clear = function _clear() {
- [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
- return node.classList.contains(ClassName$8.ACTIVE);
- }).forEach(function (node) {
- return node.classList.remove(ClassName$8.ACTIVE);
- });
- } // Static
- ;
- ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY$8);
- var _config = typeof config === 'object' && config;
- if (!data) {
- data = new ScrollSpy(this, _config);
- $(this).data(DATA_KEY$8, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config]();
- }
- });
- };
- _createClass(ScrollSpy, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$8;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$6;
- }
- }]);
- return ScrollSpy;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(window).on(Event$8.LOAD_DATA_API, function () {
- var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
- var scrollSpysLength = scrollSpys.length;
- for (var i = scrollSpysLength; i--;) {
- var $spy = $(scrollSpys[i]);
- ScrollSpy._jQueryInterface.call($spy, $spy.data());
- }
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$8] = ScrollSpy._jQueryInterface;
- $.fn[NAME$8].Constructor = ScrollSpy;
- $.fn[NAME$8].noConflict = function () {
- $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
- return ScrollSpy._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$9 = 'tab';
- var VERSION$9 = '4.4.1';
- var DATA_KEY$9 = 'bs.tab';
- var EVENT_KEY$9 = "." + DATA_KEY$9;
- var DATA_API_KEY$7 = '.data-api';
- var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
- var Event$9 = {
- HIDE: "hide" + EVENT_KEY$9,
- HIDDEN: "hidden" + EVENT_KEY$9,
- SHOW: "show" + EVENT_KEY$9,
- SHOWN: "shown" + EVENT_KEY$9,
- CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
- };
- var ClassName$9 = {
- DROPDOWN_MENU: 'dropdown-menu',
- ACTIVE: 'active',
- DISABLED: 'disabled',
- FADE: 'fade',
- SHOW: 'show'
- };
- var Selector$9 = {
- DROPDOWN: '.dropdown',
- NAV_LIST_GROUP: '.nav, .list-group',
- ACTIVE: '.active',
- ACTIVE_UL: '> li > .active',
- DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
- DROPDOWN_TOGGLE: '.dropdown-toggle',
- DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Tab =
- /*#__PURE__*/
- function () {
- function Tab(element) {
- this._element = element;
- } // Getters
- var _proto = Tab.prototype;
- // Public
- _proto.show = function show() {
- var _this = this;
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
- return;
- }
- var target;
- var previous;
- var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
- var selector = Util.getSelectorFromElement(this._element);
- if (listElement) {
- var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
- previous = $.makeArray($(listElement).find(itemSelector));
- previous = previous[previous.length - 1];
- }
- var hideEvent = $.Event(Event$9.HIDE, {
- relatedTarget: this._element
- });
- var showEvent = $.Event(Event$9.SHOW, {
- relatedTarget: previous
- });
- if (previous) {
- $(previous).trigger(hideEvent);
- }
- $(this._element).trigger(showEvent);
- if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
- return;
- }
- if (selector) {
- target = document.querySelector(selector);
- }
- this._activate(this._element, listElement);
- var complete = function complete() {
- var hiddenEvent = $.Event(Event$9.HIDDEN, {
- relatedTarget: _this._element
- });
- var shownEvent = $.Event(Event$9.SHOWN, {
- relatedTarget: previous
- });
- $(previous).trigger(hiddenEvent);
- $(_this._element).trigger(shownEvent);
- };
- if (target) {
- this._activate(target, target.parentNode, complete);
- } else {
- complete();
- }
- };
- _proto.dispose = function dispose() {
- $.removeData(this._element, DATA_KEY$9);
- this._element = null;
- } // Private
- ;
- _proto._activate = function _activate(element, container, callback) {
- var _this2 = this;
- var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
- var active = activeElements[0];
- var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
- var complete = function complete() {
- return _this2._transitionComplete(element, active, callback);
- };
- if (active && isTransitioning) {
- var transitionDuration = Util.getTransitionDurationFromElement(active);
- $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- };
- _proto._transitionComplete = function _transitionComplete(element, active, callback) {
- if (active) {
- $(active).removeClass(ClassName$9.ACTIVE);
- var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
- if (dropdownChild) {
- $(dropdownChild).removeClass(ClassName$9.ACTIVE);
- }
- if (active.getAttribute('role') === 'tab') {
- active.setAttribute('aria-selected', false);
- }
- }
- $(element).addClass(ClassName$9.ACTIVE);
- if (element.getAttribute('role') === 'tab') {
- element.setAttribute('aria-selected', true);
- }
- Util.reflow(element);
- if (element.classList.contains(ClassName$9.FADE)) {
- element.classList.add(ClassName$9.SHOW);
- }
- if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
- var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
- if (dropdownElement) {
- var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
- $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
- }
- element.setAttribute('aria-expanded', true);
- }
- if (callback) {
- callback();
- }
- } // Static
- ;
- Tab._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $this = $(this);
- var data = $this.data(DATA_KEY$9);
- if (!data) {
- data = new Tab(this);
- $this.data(DATA_KEY$9, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config]();
- }
- });
- };
- _createClass(Tab, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$9;
- }
- }]);
- return Tab;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
- $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
- event.preventDefault();
- Tab._jQueryInterface.call($(this), 'show');
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$9] = Tab._jQueryInterface;
- $.fn[NAME$9].Constructor = Tab;
- $.fn[NAME$9].noConflict = function () {
- $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
- return Tab._jQueryInterface;
- };
- /**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
- */
- var NAME$a = 'toast';
- var VERSION$a = '4.4.1';
- var DATA_KEY$a = 'bs.toast';
- var EVENT_KEY$a = "." + DATA_KEY$a;
- var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
- var Event$a = {
- CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
- HIDE: "hide" + EVENT_KEY$a,
- HIDDEN: "hidden" + EVENT_KEY$a,
- SHOW: "show" + EVENT_KEY$a,
- SHOWN: "shown" + EVENT_KEY$a
- };
- var ClassName$a = {
- FADE: 'fade',
- HIDE: 'hide',
- SHOW: 'show',
- SHOWING: 'showing'
- };
- var DefaultType$7 = {
- animation: 'boolean',
- autohide: 'boolean',
- delay: 'number'
- };
- var Default$7 = {
- animation: true,
- autohide: true,
- delay: 500
- };
- var Selector$a = {
- DATA_DISMISS: '[data-dismiss="toast"]'
- };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- var Toast =
- /*#__PURE__*/
- function () {
- function Toast(element, config) {
- this._element = element;
- this._config = this._getConfig(config);
- this._timeout = null;
- this._setListeners();
- } // Getters
- var _proto = Toast.prototype;
- // Public
- _proto.show = function show() {
- var _this = this;
- var showEvent = $.Event(Event$a.SHOW);
- $(this._element).trigger(showEvent);
- if (showEvent.isDefaultPrevented()) {
- return;
- }
- if (this._config.animation) {
- this._element.classList.add(ClassName$a.FADE);
- }
- var complete = function complete() {
- _this._element.classList.remove(ClassName$a.SHOWING);
- _this._element.classList.add(ClassName$a.SHOW);
- $(_this._element).trigger(Event$a.SHOWN);
- if (_this._config.autohide) {
- _this._timeout = setTimeout(function () {
- _this.hide();
- }, _this._config.delay);
- }
- };
- this._element.classList.remove(ClassName$a.HIDE);
- Util.reflow(this._element);
- this._element.classList.add(ClassName$a.SHOWING);
- if (this._config.animation) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- };
- _proto.hide = function hide() {
- if (!this._element.classList.contains(ClassName$a.SHOW)) {
- return;
- }
- var hideEvent = $.Event(Event$a.HIDE);
- $(this._element).trigger(hideEvent);
- if (hideEvent.isDefaultPrevented()) {
- return;
- }
- this._close();
- };
- _proto.dispose = function dispose() {
- clearTimeout(this._timeout);
- this._timeout = null;
- if (this._element.classList.contains(ClassName$a.SHOW)) {
- this._element.classList.remove(ClassName$a.SHOW);
- }
- $(this._element).off(Event$a.CLICK_DISMISS);
- $.removeData(this._element, DATA_KEY$a);
- this._element = null;
- this._config = null;
- } // Private
- ;
- _proto._getConfig = function _getConfig(config) {
- config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
- Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
- return config;
- };
- _proto._setListeners = function _setListeners() {
- var _this2 = this;
- $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
- return _this2.hide();
- });
- };
- _proto._close = function _close() {
- var _this3 = this;
- var complete = function complete() {
- _this3._element.classList.add(ClassName$a.HIDE);
- $(_this3._element).trigger(Event$a.HIDDEN);
- };
- this._element.classList.remove(ClassName$a.SHOW);
- if (this._config.animation) {
- var transitionDuration = Util.getTransitionDurationFromElement(this._element);
- $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
- } else {
- complete();
- }
- } // Static
- ;
- Toast._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var $element = $(this);
- var data = $element.data(DATA_KEY$a);
- var _config = typeof config === 'object' && config;
- if (!data) {
- data = new Toast(this, _config);
- $element.data(DATA_KEY$a, data);
- }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError("No method named \"" + config + "\"");
- }
- data[config](this);
- }
- });
- };
- _createClass(Toast, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION$a;
- }
- }, {
- key: "DefaultType",
- get: function get() {
- return DefaultType$7;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default$7;
- }
- }]);
- return Toast;
- }();
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
- $.fn[NAME$a] = Toast._jQueryInterface;
- $.fn[NAME$a].Constructor = Toast;
- $.fn[NAME$a].noConflict = function () {
- $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
- return Toast._jQueryInterface;
- };
- exports.Alert = Alert;
- exports.Button = Button;
- exports.Carousel = Carousel;
- exports.Collapse = Collapse;
- exports.Dropdown = Dropdown;
- exports.Modal = Modal;
- exports.Popover = Popover;
- exports.Scrollspy = ScrollSpy;
- exports.Tab = Tab;
- exports.Toast = Toast;
- exports.Tooltip = Tooltip;
- exports.Util = Util;
- Object.defineProperty(exports, '__esModule', { value: true });
- })));
- //# sourceMappingURL=bootstrap.js.map
- /*!
- * Jasny Bootstrap v4.0.0 (http://jasny.github.io/bootstrap)
- * Copyright 2012-2019 Arnold Daniels
- * Licensed under ()
- */
- if("undefined"==typeof jQuery)throw new Error("Jasny Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}void 0===a.support.transition&&(a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()}))}(window.jQuery),function(a){"use strict";var b=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i),c=function(b,d){if(this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.state=null,this.placement=null,this.$calcClone=null,this.calcClone(),this.options.recalc&&a(window).on("resize",a.proxy(this.recalc,this)),this.options.autohide&&!this.options.modal){navigator.userAgent.match(/(iPad|iPhone)/i);a(document).on("click touchstart",a.proxy(this.autohide,this))}a(this.$element).on("shown.bs.dropdown",a.proxy(function(b){a(this.$element).find(".dropdown .dropdown-backdrop").remove()},this)),"boolean"==typeof this.options.disablescrolling&&(this.options.disableScrolling=this.options.disablescrolling,delete this.options.disablescrolling),this.options.toggle&&this.toggle()};c.DEFAULTS={toggle:!0,placement:"auto",autohide:!0,recalc:!0,disableScrolling:!0,modal:!1,backdrop:!1,exclude:null},c.prototype.setWidth=function(){var b=this.$element.outerWidth(),c=a(window).width();c-=68,this.$element.css("width",b>c?c:b)},c.prototype.offset=function(){switch(this.placement){case"left":case"right":return this.$element.outerWidth();case"top":case"bottom":return this.$element.outerHeight()}},c.prototype.calcPlacement=function(){function b(a,b){return"auto"===e.css(b)?a:"auto"===e.css(a)?b:parseInt(e.css(a),10)>parseInt(e.css(b),10)?b:a}if("auto"!==this.options.placement)return void(this.placement=this.options.placement);this.$element.hasClass("in")||this.$element.css("visiblity","hidden !important").addClass("in");var c=a(window).width()/this.$element.outerWidth(),d=a(window).height()/this.$element.outerHeight(),e=this.$element;this.placement=c>d?b("left","right"):b("top","bottom"),"hidden !important"===this.$element.css("visibility")&&this.$element.removeClass("in").css("visiblity","")},c.prototype.opposite=function(a){switch(a){case"top":return"bottom";case"left":return"right";case"bottom":return"top";case"right":return"left"}},c.prototype.getCanvasElements=function(){var b=this.options.canvas?a(this.options.canvas):this.$element,c=b.find("*").filter(function(){return"fixed"===getComputedStyle(this).getPropertyValue("position")}).not(this.options.exclude);return b.add(c)},c.prototype.slide=function(b,c,d){if(!a.support.transition){var e={};return e[this.placement]="+="+c,e[this.opposite(this.placement)]="-="+c,b.animate(e,350,d)}var f=this.placement,g=this.opposite(f);b.each(function(){"auto"!==a(this).css(f)&&a(this).css(f,(parseInt(a(this).css(f),10)||0)+c),"auto"!==a(this).css(g)&&a(this).css(g,(parseInt(a(this).css(g),10)||0)-c)}),this.$element.one(a.support.transition.end,d).emulateTransitionEnd(350)},c.prototype.disableScrolling=function(){var c=a("body").width(),d="padding-right";if(void 0===a("body").data("offcanvas-style")&&a("body").data("offcanvas-style",a("body").attr("style")||""),a("body").css("overflow","hidden"),b&&a("body").addClass("lockIphone"),a("body").width()>c){var e=parseInt(a("body").css(d),10)+a("body").width()-c;setTimeout(function(){a("body").css(d,e)},1)}a("body").on("touchmove.bs",function(b){a(event.target).closest(".offcanvas").length||b.preventDefault()})},c.prototype.enableScrolling=function(){a("body").off("touchmove.bs"),a("body").removeClass("lockIphone")},c.prototype.show=function(){if(!this.state){var c=a.Event("show.bs.offcanvas");this.$element.trigger(c),c.isDefaultPrevented()||this.hideOthers(a.proxy(function(){this.state="slide-in",this.$element.css("width",""),this.calcPlacement(),this.setWidth();var c=this.getCanvasElements(),d=this.placement,e=this.opposite(d),f=this.offset();-1!==c.index(this.$element)&&(a(this.$element).data("offcanvas-style",a(this.$element).attr("style")||""),this.$element.css(d,-1*f),this.$element.css(d)),c.addClass("canvas-sliding").each(function(){var c=a(this);void 0===c.data("offcanvas-style")&&c.data("offcanvas-style",c.attr("style")||""),"static"!==c.css("position")||b||c.css("position","relative"),"auto"!==c.css(d)&&"0px"!==c.css(d)||"auto"!==c.css(e)&&"0px"!==c.css(e)||c.css(d,0)}),this.options.disableScrolling&&this.disableScrolling(),(this.options.modal||this.options.backdrop)&&this.toggleBackdrop();var g=function(){"slide-in"==this.state&&(this.state="slid",c.removeClass("canvas-sliding").addClass("canvas-slid"),this.$element.trigger("shown.bs.offcanvas"))};setTimeout(a.proxy(function(){this.$element.addClass("in"),this.slide(c,f,a.proxy(g,this))},this),1)},this))}},c.prototype.hideOthers=function(b){var c=!1,d=this.$element.attr("id"),e=a('.offcanvas-clone:not([data-id="'+d+'"])');if(!e.length)return b();e.each(function(d,e){var f=a(e).attr("data-id"),g=a("#"+f);(c=g.hasClass("canvas-slid"))&&(g.one("hidden.bs.offcanvas",b),g.offcanvas("hide"))}),c||b()},c.prototype.hide=function(){if("slid"===this.state){var b=a.Event("hide.bs.offcanvas");if(this.$element.trigger(b),!b.isDefaultPrevented()){this.state="slide-out";var c=a(".canvas-slid"),d=(this.placement,-1*this.offset()),e=function(){"slide-out"==this.state&&(this.state=null,this.placement=null,this.$element.removeClass("in"),c.removeClass("canvas-sliding"),c.add(this.$element).add("body").each(function(){a(this).attr("style",a(this).data("offcanvas-style")).removeData("offcanvas-style")}),this.$element.css("width",""),this.$element.trigger("hidden.bs.offcanvas"))};this.options.disableScrolling&&this.enableScrolling(),(this.options.modal||this.options.backdrop)&&this.toggleBackdrop(),c.removeClass("canvas-slid").addClass("canvas-sliding"),setTimeout(a.proxy(function(){this.slide(c,d,a.proxy(e,this))},this),1)}}},c.prototype.toggle=function(){"slide-in"!==this.state&&"slide-out"!==this.state&&this["slid"===this.state?"hide":"show"]()},c.prototype.toggleBackdrop=function(b){b=b||a.noop;var c=150;if("slide-in"==this.state){var d=a("body"),e=a.support.transition;this.$backdrop=a('<div class="modal-backdrop fade" />'),this.options.backdrop?(this.$backdrop.addClass("allow-navbar"),this.options.canvas&&a(this.options.canvas)[0]!==d[0]?(a(this.options.canvas).addClass("limit-backdrop"),this.$backdrop.appendTo(this.options.canvas)):this.$backdrop.insertAfter(this.$element)):this.$backdrop.insertAfter(this.$element),e&&this.$backdrop[0].offsetWidth,d.addClass("modal-open"),this.$backdrop.addClass("show").show(),this.$backdrop.on("click.bs",a.proxy(this.autohide,this)),e?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(c):b()}else if("slide-out"==this.state&&this.$backdrop){var f=this;if(this.$backdrop.hide().removeClass("show"),a("body").removeClass("modal-open").off("touchmove.bs"),a.support.transition?this.$backdrop.one(a.support.transition.end,function(){f.$backdrop.remove(),b(),f.$backdrop=null}).emulateTransitionEnd(c):(this.$backdrop.remove(),this.$backdrop=null,b()),this.options.canvas&&a(this.options.canvas)[0]!==a("body")[0]){var g=this.options.canvas;setTimeout(function(){a(g).removeClass("limit-backdrop")},c)}}else b&&b()},c.prototype.calcClone=function(){var b=this.$element.attr("id");this.$calcClone=a('.offcanvas-clone[data-id="'+b+'"]'),this.$calcClone.length||(this.$calcClone=this.$element.clone().addClass("offcanvas-clone").attr("data-id",b).removeAttr("id").appendTo(a("body")).html("")),this.$calcClone.removeClass("in")},c.prototype.recalc=function(){if("none"!==this.$calcClone.css("display")&&("slid"===this.state||"slide-in"===this.state)){this.state=null,this.placement=null;var b=this.getCanvasElements();this.$element.trigger("hide.bs.offcanvas"),this.$element.removeClass("in"),b.removeClass("canvas-slid"),b.add(this.$element).add("body").each(function(){a(this).attr("style",a(this).data("offcanvas-style")).removeData("offcanvas-style")}),this.$element.trigger("hidden.bs.offcanvas")}},c.prototype.autohide=function(b){var c=a(b.target);!c.hasClass("dropdown-backdrop")&&0===c.closest(this.$element).length&&this.hide()};var d=a.fn.offcanvas;a.fn.offcanvas=function(b){return this.each(function(){var d=a(this),e=d.data("bs.offcanvas"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);d.hasClass("offcanvas-clone")||(e||d.data("bs.offcanvas",e=new c(this,f)),"string"==typeof b&&e[b]())})},a.fn.offcanvas.Constructor=c,a.fn.offcanvas.noConflict=function(){return a.fn.offcanvas=d,this},a(document).on("click.bs.offcanvas.data-api","[data-toggle=offcanvas]",function(b){var c,d=a(this),e=d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.offcanvas"),h=g?"toggle":a.extend(d.data(),f.data());b.preventDefault(),b.stopPropagation(),g?g.toggle():f.offcanvas(h)})}(window.jQuery),function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.$element.on("click.bs.rowlink mouseup.bs.rowlink","td:not(.rowlink-skip)",a.proxy(this.click,this))};b.DEFAULTS={target:"a"},b.prototype.click=function(b,c){var d=a(b.currentTarget).closest("tr").find(this.options.target)[0];if(void 0!==d&&a(b.target)[0]!==d&&("mouseup"!==b.type||2===b.which))if(b.preventDefault(),!(c=c||b.ctrlKey||"mouseup"===b.type&&2===b.which)&&d.click)d.click();else if(document.createEvent){var e=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0,ctrlKey:c});d.dispatchEvent(e)}};var c=a.fn.rowlink;a.fn.rowlink=function(c){return this.each(function(){var d=a(this),e=d.data("bs.rowlink");e||d.data("bs.rowlink",e=new b(this,c))})},a.fn.rowlink.Constructor=b,a.fn.rowlink.noConflict=function(){return a.fn.rowlink=c,this},a(document).on("click.bs.rowlink.data-api mouseup.bs.rowlink.data-api",'[data-link="row"]',function(b){if(("mouseup"!==b.type||2===b.which)&&0===a(b.target).closest(".rowlink-skip").length){var c=a(this);if(!c.data("bs.rowlink")){c.rowlink(c.data());var d=b.ctrlKey||2===b.which;a(b.target).trigger("click.bs.rowlink",[d])}}})}(window.jQuery),function(a){"use strict";var b="Microsoft Internet Explorer"==window.navigator.appName,c=function(b,d){if(this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.$input=this.$element.find(":file"),0!==this.$input.length){this.name=this.$input.attr("name")||d.name,this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]'),0===this.$hidden.length&&(this.$hidden=a('<input type="hidden">').insertBefore(this.$input)),this.$preview=this.$element.find(".fileinput-preview");var e=this.$preview.css("height");"inline"!==this.$preview.css("display")&&"0px"!==e&&"none"!==e&&this.$preview.css("line-height",e),this.original={exists:this.$element.hasClass("fileinput-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()},this.listen(),this.reset()}};c.DEFAULTS={clearName:!0},c.prototype.listen=function(){this.$input.on("change.bs.fileinput",a.proxy(this.change,this)),a(this.$input[0].form).on("reset.bs.fileinput",a.proxy(this.reset,this)),this.$element.find('[data-trigger="fileinput"]').on("click.bs.fileinput",a.proxy(this.trigger,this)),this.$element.find('[data-dismiss="fileinput"]').on("click.bs.fileinput",a.proxy(this.clear,this))},c.prototype.verifySizes=function(a){if(void 0===this.options.maxSize)return!0;var b=parseFloat(this.options.maxSize);if(b!==this.options.maxSize)return!0;for(var c=0;c<a.length;c++){var d=void 0!==a[c].size?a[c].size:null;if(null!==d&&(d=d/1e3/1e3)>b)return!1}return!0},c.prototype.change=function(b){var c=void 0===b.target.files?b.target&&b.target.value?[{name:b.target.value.replace(/^.+\\/,"")}]:[]:b.target.files;if(b.stopPropagation(),0===c.length)return this.clear(),void this.$element.trigger("clear.bs.fileinput");if(!this.verifySizes(c))return this.$element.trigger("max_size.bs.fileinput"),this.clear(),void this.$element.trigger("clear.bs.fileinput");this.$hidden.val(""),this.$hidden.attr("name",""),this.$input.attr("name",this.name);var d=c[0];if(this.$preview.length>0&&(void 0!==d.type?d.type.match(/^image\/(gif|png|jpeg|svg\+xml)$/):d.name.match(/\.(gif|png|jpe?g|svg)$/i))&&"undefined"!=typeof FileReader){var e=this,f=new FileReader,g=this.$preview,h=this.$element;f.onload=function(b){var f=a("<img>");if(f[0].src=b.target.result,c[0].result=b.target.result,h.find(".fileinput-filename").text(d.name),"none"!=g.css("max-height")){var i=parseInt(g.css("max-height"),10)||0,j=parseInt(g.css("padding-top"),10)||0,k=parseInt(g.css("padding-bottom"),10)||0,l=parseInt(g.css("border-top"),10)||0,m=parseInt(g.css("border-bottom"),10)||0;f.css("max-height",i-j-k-l-m)}g.html(f),e.options.exif&&e.setImageTransform(f,d),h.addClass("fileinput-exists").removeClass("fileinput-new"),h.trigger("change.bs.fileinput",c)},f.readAsDataURL(d)}else{var i=d.name,j=this.$element.find(".fileinput-filename");c.length>1&&(i=a.map(c,function(a){return a.name}).join(", ")),j.text(i),this.$preview.text(d.name),this.$element.addClass("fileinput-exists").removeClass("fileinput-new"),this.$element.trigger("change.bs.fileinput")}},c.prototype.setImageTransform=function(a,b){var c=this,d=new FileReader;d.onload=function(b){var e=new DataView(d.result),f=c.getImageExif(e);f&&c.resetOrientation(a,f)},d.readAsArrayBuffer(b)},c.prototype.getImageExif=function(a){if(65496!=a.getUint16(0,!1))return-2;for(var b=a.byteLength,c=2;c<b;){var d=a.getUint16(c,!1);if(c+=2,65505==d){if(1165519206!=a.getUint32(c+=2,!1))return-1;var e=18761==a.getUint16(c+=6,!1);c+=a.getUint32(c+4,e);var f=a.getUint16(c,e);c+=2;for(var g=0;g<f;g++)if(274==a.getUint16(c+12*g,e))return a.getUint16(c+12*g+8,e)}else{if(65280!=(65280&d))break;c+=a.getUint16(c,!1)}}return-1},c.prototype.resetOrientation=function(a,b){var c=new Image;c.onload=function(){var d=c.width,e=c.height,f=document.createElement("canvas"),g=f.getContext("2d");switch([5,6,7,8].indexOf(b)>-1?(f.width=e,f.height=d):(f.width=d,f.height=e),b){case 2:g.transform(-1,0,0,1,d,0);break;case 3:g.transform(-1,0,0,-1,d,e);break;case 4:g.transform(1,0,0,-1,0,e);break;case 5:g.transform(0,1,1,0,0,0);break;case 6:g.transform(0,1,-1,0,e,0);break;case 7:g.transform(0,-1,-1,0,e,d);break;case 8:g.transform(0,-1,1,0,0,d);break;default:g.transform(1,0,0,1,0,0)}g.drawImage(c,0,0),a.attr("src",f.toDataURL())},c.src=a.attr("src")},c.prototype.clear=function(a){if(a&&a.preventDefault(),this.$hidden.val(""),this.$hidden.attr("name",this.name),this.options.clearName&&this.$input.attr("name",""),b){var c=this.$input.clone(!0);this.$input.after(c),this.$input.remove(),this.$input=c}else this.$input.val("");this.$preview.html(""),this.$element.find(".fileinput-filename").text(""),this.$element.addClass("fileinput-new").removeClass("fileinput-exists"),void 0!==a&&(this.$input.trigger("change"),this.$element.trigger("clear.bs.fileinput"))},c.prototype.reset=function(){this.clear(),this.$hidden.val(this.original.hiddenVal),this.$preview.html(this.original.preview),this.$element.find(".fileinput-filename").text(""),this.original.exists?this.$element.addClass("fileinput-exists").removeClass("fileinput-new"):this.$element.addClass("fileinput-new").removeClass("fileinput-exists"),this.$element.trigger("reseted.bs.fileinput")},c.prototype.trigger=function(a){this.$input.trigger("click"),a.preventDefault()};var d=a.fn.fileinput;a.fn.fileinput=function(b){return this.each(function(){var d=a(this),e=d.data("bs.fileinput");e||d.data("bs.fileinput",e=new c(this,b)),"string"==typeof b&&e[b]()})},a.fn.fileinput.Constructor=c,a.fn.fileinput.noConflict=function(){return a.fn.fileinput=d,this},a(document).on("click.fileinput.data-api",'[data-provides="fileinput"]',function(b){var c=a(this);if(!c.data("bs.fileinput")){c.fileinput(c.data());var d=a(b.target).closest('[data-dismiss="fileinput"],[data-trigger="fileinput"]');d.length>0&&(b.preventDefault(),d.trigger("click.bs.fileinput"))}})}(window.jQuery);
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Tt(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function v(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function p(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function k(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function S(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=S(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&D(e[s])!==D(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,s={};for(n in e)m(e,n)&&(t=H(n))&&(s[t]=e[n]);return s}var U={};function F(e,t){U[e]=t}function L(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=b(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=b(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var de={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=D(e)}),t=0;t<e.length;t++)de[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,ve=4,pe=5,we=6,Me=7,ke=8;function Se(e){return De(e)?366:365}function De(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),C("year","y"),F("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):D(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return D(e)+(68<D(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(xe(this,t,e),c.updateOffset(this,n),this):be(this,t)}}function be(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function xe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&De(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?De(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),C("month","M"),F("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=D(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var He="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Re(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=D(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Re(this,e),c.updateOffset(this,!0),this):be(this,"Month")}var Fe=ae;var Le=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t;if(e<100&&0<=e){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return a=o<=0?Se(r=e-1)+o:o>Se(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ot(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[ve]||0!==n[pe]||0!==n[we])?ge:n[ve]<0||59<n[ve]?ve:n[pe]<0||59<n[pe]?pe:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=ke),g(e).overflow=t),e}function ct(e,t,n){return null!=e?e:null!=t?t:n}function ft(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ct(t.GG,e._a[me],Ie(bt(),1,4).year),s=ct(t.W,1),((i=ct(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(bt(),r,a);n=ct(t.gg,e._a[me],l.year),s=ct(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[1])){i=gt[t][0],s=!1!==gt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=vt.length;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!yt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Yt(e)}else e._isValid=!1}var Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function kt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),He.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=Mt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=kt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Yt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),d+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(de,a)&&de[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=h-d,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ft(e),dt(e)}else Dt(e);else wt(e)}function Ot(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||ht(e._l),null===r||void 0===a&&""===r?p({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r)?new M(dt(r)):(d(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Yt(t),v(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?Yt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):d(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(wt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ft(t)):u(n)?function(e){if(!e._d){var t=R(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ft(e)}}(t):h(n)?t._d=new Date(n):c.createFromInputFallback(t),v(e)||(e._d=null),e))}function Tt(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Ot(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function bt(e,t,n,s){return Tt(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:p()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:p()});function Wt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Ct=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=R(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Ct,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Ct.length;++s)if(e[Ct[s]]){if(n)return!1;parseFloat(e[Ct[s]])!==D(e[Ct[s]])&&(n=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ht(),this._bubble()}function Rt(e){return e instanceof Ht}function Ut(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+L(~~(e/60),2)+n+L(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Nt(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Nt(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+D(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(k(e)||d(e)?e.valueOf():bt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):bt(e).local()}function Vt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Et(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var It=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,At=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:D(a[ye])*n,h:D(a[ge])*n,m:D(a[ve])*n,s:D(a[pe])*n,ms:D(Ut(1e3*a[we]))*n}):(a=At.exec(e))?(n="-"===a[1]?-1:1,r={y:Zt(a[2],n),M:Zt(a[3],n),w:Zt(a[4],n),d:Zt(a[5],n),h:Zt(a[6],n),m:Zt(a[7],n),s:Zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(bt(r.from),bt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function Zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,jt(e="string"==typeof e?+e:e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ut(t._days),a=Ut(t._months);e.isValid()&&(s=null==s||s,a&&Re(e,be(e,"Month")+a*n),r&&xe(e,"Date",be(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}jt.fn=Ht.prototype,jt.invalid=function(){return jt(NaN)};var Jt=$t(1,"add"),Bt=$t(-1,"subtract");function Qt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Xt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ht(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Kt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function en(){return this._locale}var tn=126227808e5;function nn(e,t){return(e%t+t)%t}function sn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-tn:new Date(e,t,n).valueOf()}function rn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-tn:Date.UTC(e,t,n)}function an(e,t){I(0,[e,e.length],0,t)}function on(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),an("gggg","weekYear"),an("ggggg","weekYear"),an("GGGG","isoWeekYear"),an("GGGGG","isoWeekYear"),C("weekYear","gg"),C("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),C("quarter","Q"),F("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(D(e)-1)}),I("D",["DD",2],"Do","date"),C("date","D"),F("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=D(e.match(B)[0])});var un=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),C("dayOfYear","DDD"),F("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)}),I("m",["mm",2],0,"minute"),C("minute","m"),F("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],ve);var ln=Te("Minutes",!1);I("s",["ss",2],0,"second"),C("second","s"),F("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],pe);var hn,dn=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),C("millisecond","ms"),F("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),hn="SSSS";hn.length<=9;hn+="S")ue(hn,ne);function cn(e,t){t[we]=D(1e3*("0."+e))}for(hn="S";hn.length<=9;hn+="S")ce(hn,cn);var fn=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var mn=M.prototype;function _n(e){return e}mn.add=Jt,mn.calendar=function(e,t){var n=e||bt(),s=Gt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(b(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,bt(n)))},mn.clone=function(){return new M(this)},mn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:S(r)},mn.endOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-nn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-nn(t,1e3)-1;break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},mn.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.fromNow=function(e){return this.from(bt(),e)},mn.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.toNow=function(e){return this.to(bt(),e)},mn.get=function(e){return b(this[e=H(e)])?this[e]():this},mn.invalidAt=function(){return g(this).overflow},mn.isAfter=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},mn.isBefore=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},mn.isBetween=function(e,t,n,s){var i=k(e)?e:bt(e),r=k(t)?t:bt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n))},mn.isSame=function(e,t){var n,s=k(e)?e:bt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},mn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},mn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},mn.isValid=function(){return v(this)},mn.lang=Kt,mn.locale=Xt,mn.localeData=en,mn.max=Pt,mn.min=xt,mn.parsingFlags=function(){return _({},g(this))},mn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:U[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=R(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(b(this[e=H(e)]))return this[e](t);return this},mn.startOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=nn(t,6e4);break;case"second":t=this._d.valueOf(),t-=nn(t,1e3);break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.subtract=Bt,mn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},mn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},mn.toDate=function(){return new Date(this.valueOf())},mn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.year=Oe,mn.isLeapYear=function(){return De(this.year())},mn.weekYear=function(e){return on.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},mn.isoWeekYear=function(e){return on.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},mn.quarter=mn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},mn.month=Ue,mn.daysInMonth=function(){return Pe(this.year(),this.month())},mn.week=mn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},mn.isoWeek=mn.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},mn.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},mn.isoWeeksInYear=function(){return Ae(this.year(),1,4)},mn.date=un,mn.day=mn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},mn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},mn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},mn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},mn.hour=mn.hours=nt,mn.minute=mn.minutes=ln,mn.second=mn.seconds=dn,mn.millisecond=mn.milliseconds=fn,mn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Vt(this);if("string"==typeof e){if(null===(e=Nt(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Vt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,jt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this},mn.utc=function(e){return this.utcOffset(0,e)},mn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Vt(this),"m")),this},mn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Nt(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},mn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},mn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var yn=P.prototype;function gn(e,t,n,s){var i=ht(),r=y().set(s,t);return i[n](r,e)}function vn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return gn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=gn(e,s,n,"month");return i}function pn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=ht(),a=e?r._week.dow:0;if(null!=n)return gn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=gn(t,(i+a)%7,s,"day");return o}yn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},yn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},yn.invalidDate=function(){return this._invalidDate},yn.ordinal=function(e){return this._ordinal.replace("%d",e)},yn.preparse=_n,yn.postformat=_n,yn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},yn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},yn.set=function(e){var t,n;for(n in e)b(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},yn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},yn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},yn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},yn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},yn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},yn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},yn.firstDayOfYear=function(){return this._week.doy},yn.firstDayOfWeek=function(){return this._week.dow},yn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?je(n,this._week.dow):e?n[e.day()]:n},yn.weekdaysMin=function(e){return!0===e?je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},yn.weekdaysShort=function(e){return!0===e?je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},yn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},yn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},yn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},yn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},yn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},yn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ut("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===D(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ut),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ht);var wn=Math.abs;function Mn(e,t,n,s){var i=jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function kn(e){return e<0?Math.floor(e):Math.ceil(e)}function Sn(e){return 4800*e/146097}function Dn(e){return 146097*e/4800}function Yn(e){return function(){return this.as(e)}}var On=Yn("ms"),Tn=Yn("s"),bn=Yn("m"),xn=Yn("h"),Pn=Yn("d"),Wn=Yn("w"),Cn=Yn("M"),Hn=Yn("Q"),Rn=Yn("y");function Un(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fn=Un("milliseconds"),Ln=Un("seconds"),Nn=Un("minutes"),Gn=Un("hours"),Vn=Un("days"),En=Un("months"),In=Un("years");var An=Math.round,jn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function zn(e){return(0<e)-(e<0)||+e}function $n(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,s=Zn(this._days),i=Zn(this._months);t=S((e=S(n/60))/60),n%=60,e%=60;var r=S(i/12),a=i%=12,o=s,u=t,l=e,h=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var c=d<0?"-":"",f=zn(this._months)!==zn(d)?"-":"",m=zn(this._days)!==zn(d)?"-":"",_=zn(this._milliseconds)!==zn(d)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||h?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(h?_+h+"S":"")}var qn=Ht.prototype;return qn.isValid=function(){return this._isValid},qn.abs=function(){var e=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),e.milliseconds=wn(e.milliseconds),e.seconds=wn(e.seconds),e.minutes=wn(e.minutes),e.hours=wn(e.hours),e.months=wn(e.months),e.years=wn(e.years),this},qn.add=function(e,t){return Mn(this,e,t,1)},qn.subtract=function(e,t){return Mn(this,e,t,-1)},qn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=H(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Sn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Dn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},qn.asMilliseconds=On,qn.asSeconds=Tn,qn.asMinutes=bn,qn.asHours=xn,qn.asDays=Pn,qn.asWeeks=Wn,qn.asMonths=Cn,qn.asQuarters=Hn,qn.asYears=Rn,qn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*D(this._months/12):NaN},qn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*kn(Dn(o)+a),o=a=0),u.milliseconds=r%1e3,e=S(r/1e3),u.seconds=e%60,t=S(e/60),u.minutes=t%60,n=S(t/60),u.hours=n%24,o+=i=S(Sn(a+=S(n/24))),a-=kn(Dn(i)),s=S(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},qn.clone=function(){return jt(this)},qn.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},qn.milliseconds=Fn,qn.seconds=Ln,qn.minutes=Nn,qn.hours=Gn,qn.days=Vn,qn.weeks=function(){return S(this.days()/7)},qn.months=En,qn.years=In,qn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,h,d,c=this.localeData(),f=(n=!e,s=c,i=jt(t=this).abs(),r=An(i.as("s")),a=An(i.as("m")),o=An(i.as("h")),u=An(i.as("d")),l=An(i.as("M")),h=An(i.as("y")),(d=r<=jn.ss&&["s",r]||r<jn.s&&["ss",r]||a<=1&&["m"]||a<jn.m&&["mm",a]||o<=1&&["h"]||o<jn.h&&["hh",o]||u<=1&&["d"]||u<jn.d&&["dd",u]||l<=1&&["M"]||l<jn.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=n,d[3]=0<+t,d[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},qn.toISOString=$n,qn.toString=$n,qn.toJSON=$n,qn.locale=Xt,qn.localeData=en,qn.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$n),qn.lang=Kt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(D(e))}),c.version="2.24.0",e=bt,c.fn=mn,c.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return bt(1e3*e)},c.months=function(e,t){return vn(e,t,"months")},c.isDate=d,c.locale=ut,c.invalid=p,c.duration=jt,c.isMoment=k,c.weekdays=function(e,t,n){return pn(e,t,n,"weekdays")},c.parseZone=function(){return bt.apply(null,arguments).parseZone()},c.localeData=ht,c.isDuration=Rt,c.monthsShort=function(e,t){return vn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return pn(e,t,n,"weekdaysMin")},c.defineLocale=lt,c.updateLocale=function(e,t){if(null!=t){var n,s,i=st;null!=(s=ot(e))&&(i=s._config),(n=new P(t=x(i,t))).parentLocale=it[e],it[e]=n,ut(e)}else null!=it[e]&&(null!=it[e].parentLocale?it[e]=it[e].parentLocale:null!=it[e]&&delete it[e]);return it[e]},c.locales=function(){return s(it)},c.weekdaysShort=function(e,t,n){return pn(e,t,n,"weekdaysShort")},c.normalizeUnits=H,c.relativeTimeRounding=function(e){return void 0===e?An:"function"==typeof e&&(An=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==jn[e]&&(void 0===t?jn[e]:(jn[e]=t,"s"===e&&(jn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=mn,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c});
- /*!
- FullCalendar Core Package v4.4.0
- Docs & License: https://fullcalendar.io/
- (c) 2019 Adam Shaw
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = global || self, factory(global.FullCalendar = {}));
- }(this, function (exports) { 'use strict';
- // Creating
- // ----------------------------------------------------------------------------------------------------------------
- var elementPropHash = {
- className: true,
- colSpan: true,
- rowSpan: true
- };
- var containerTagHash = {
- '<tr': 'tbody',
- '<td': 'tr'
- };
- function createElement(tagName, attrs, content) {
- var el = document.createElement(tagName);
- if (attrs) {
- for (var attrName in attrs) {
- if (attrName === 'style') {
- applyStyle(el, attrs[attrName]);
- }
- else if (elementPropHash[attrName]) {
- el[attrName] = attrs[attrName];
- }
- else {
- el.setAttribute(attrName, attrs[attrName]);
- }
- }
- }
- if (typeof content === 'string') {
- el.innerHTML = content; // shortcut. no need to process HTML in any way
- }
- else if (content != null) {
- appendToElement(el, content);
- }
- return el;
- }
- function htmlToElement(html) {
- html = html.trim();
- var container = document.createElement(computeContainerTag(html));
- container.innerHTML = html;
- return container.firstChild;
- }
- function htmlToElements(html) {
- return Array.prototype.slice.call(htmlToNodeList(html));
- }
- function htmlToNodeList(html) {
- html = html.trim();
- var container = document.createElement(computeContainerTag(html));
- container.innerHTML = html;
- return container.childNodes;
- }
- // assumes html already trimmed and tag names are lowercase
- function computeContainerTag(html) {
- return containerTagHash[html.substr(0, 3) // faster than using regex
- ] || 'div';
- }
- function appendToElement(el, content) {
- var childNodes = normalizeContent(content);
- for (var i = 0; i < childNodes.length; i++) {
- el.appendChild(childNodes[i]);
- }
- }
- function prependToElement(parent, content) {
- var newEls = normalizeContent(content);
- var afterEl = parent.firstChild || null; // if no firstChild, will append to end, but that's okay, b/c there were no children
- for (var i = 0; i < newEls.length; i++) {
- parent.insertBefore(newEls[i], afterEl);
- }
- }
- function insertAfterElement(refEl, content) {
- var newEls = normalizeContent(content);
- var afterEl = refEl.nextSibling || null;
- for (var i = 0; i < newEls.length; i++) {
- refEl.parentNode.insertBefore(newEls[i], afterEl);
- }
- }
- function normalizeContent(content) {
- var els;
- if (typeof content === 'string') {
- els = htmlToElements(content);
- }
- else if (content instanceof Node) {
- els = [content];
- }
- else { // Node[] or NodeList
- els = Array.prototype.slice.call(content);
- }
- return els;
- }
- function removeElement(el) {
- if (el.parentNode) {
- el.parentNode.removeChild(el);
- }
- }
- // Querying
- // ----------------------------------------------------------------------------------------------------------------
- // from https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
- var matchesMethod = Element.prototype.matches ||
- Element.prototype.matchesSelector ||
- Element.prototype.msMatchesSelector;
- var closestMethod = Element.prototype.closest || function (selector) {
- // polyfill
- var el = this;
- if (!document.documentElement.contains(el)) {
- return null;
- }
- do {
- if (elementMatches(el, selector)) {
- return el;
- }
- el = el.parentElement || el.parentNode;
- } while (el !== null && el.nodeType === 1);
- return null;
- };
- function elementClosest(el, selector) {
- return closestMethod.call(el, selector);
- }
- function elementMatches(el, selector) {
- return matchesMethod.call(el, selector);
- }
- // accepts multiple subject els
- // returns a real array. good for methods like forEach
- function findElements(container, selector) {
- var containers = container instanceof HTMLElement ? [container] : container;
- var allMatches = [];
- for (var i = 0; i < containers.length; i++) {
- var matches = containers[i].querySelectorAll(selector);
- for (var j = 0; j < matches.length; j++) {
- allMatches.push(matches[j]);
- }
- }
- return allMatches;
- }
- // accepts multiple subject els
- // only queries direct child elements
- function findChildren(parent, selector) {
- var parents = parent instanceof HTMLElement ? [parent] : parent;
- var allMatches = [];
- for (var i = 0; i < parents.length; i++) {
- var childNodes = parents[i].children; // only ever elements
- for (var j = 0; j < childNodes.length; j++) {
- var childNode = childNodes[j];
- if (!selector || elementMatches(childNode, selector)) {
- allMatches.push(childNode);
- }
- }
- }
- return allMatches;
- }
- // Attributes
- // ----------------------------------------------------------------------------------------------------------------
- function forceClassName(el, className, bool) {
- if (bool) {
- el.classList.add(className);
- }
- else {
- el.classList.remove(className);
- }
- }
- // Style
- // ----------------------------------------------------------------------------------------------------------------
- var PIXEL_PROP_RE = /(top|left|right|bottom|width|height)$/i;
- function applyStyle(el, props) {
- for (var propName in props) {
- applyStyleProp(el, propName, props[propName]);
- }
- }
- function applyStyleProp(el, name, val) {
- if (val == null) {
- el.style[name] = '';
- }
- else if (typeof val === 'number' && PIXEL_PROP_RE.test(name)) {
- el.style[name] = val + 'px';
- }
- else {
- el.style[name] = val;
- }
- }
- function pointInsideRect(point, rect) {
- return point.left >= rect.left &&
- point.left < rect.right &&
- point.top >= rect.top &&
- point.top < rect.bottom;
- }
- // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false
- function intersectRects(rect1, rect2) {
- var res = {
- left: Math.max(rect1.left, rect2.left),
- right: Math.min(rect1.right, rect2.right),
- top: Math.max(rect1.top, rect2.top),
- bottom: Math.min(rect1.bottom, rect2.bottom)
- };
- if (res.left < res.right && res.top < res.bottom) {
- return res;
- }
- return false;
- }
- function translateRect(rect, deltaX, deltaY) {
- return {
- left: rect.left + deltaX,
- right: rect.right + deltaX,
- top: rect.top + deltaY,
- bottom: rect.bottom + deltaY
- };
- }
- // Returns a new point that will have been moved to reside within the given rectangle
- function constrainPoint(point, rect) {
- return {
- left: Math.min(Math.max(point.left, rect.left), rect.right),
- top: Math.min(Math.max(point.top, rect.top), rect.bottom)
- };
- }
- // Returns a point that is the center of the given rectangle
- function getRectCenter(rect) {
- return {
- left: (rect.left + rect.right) / 2,
- top: (rect.top + rect.bottom) / 2
- };
- }
- // Subtracts point2's coordinates from point1's coordinates, returning a delta
- function diffPoints(point1, point2) {
- return {
- left: point1.left - point2.left,
- top: point1.top - point2.top
- };
- }
- // Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side
- var isRtlScrollbarOnLeft = null;
- function getIsRtlScrollbarOnLeft() {
- if (isRtlScrollbarOnLeft === null) {
- isRtlScrollbarOnLeft = computeIsRtlScrollbarOnLeft();
- }
- return isRtlScrollbarOnLeft;
- }
- function computeIsRtlScrollbarOnLeft() {
- var outerEl = createElement('div', {
- style: {
- position: 'absolute',
- top: -1000,
- left: 0,
- border: 0,
- padding: 0,
- overflow: 'scroll',
- direction: 'rtl'
- }
- }, '<div></div>');
- document.body.appendChild(outerEl);
- var innerEl = outerEl.firstChild;
- var res = innerEl.getBoundingClientRect().left > outerEl.getBoundingClientRect().left;
- removeElement(outerEl);
- return res;
- }
- // The scrollbar width computations in computeEdges are sometimes flawed when it comes to
- // retina displays, rounding, and IE11. Massage them into a usable value.
- function sanitizeScrollbarWidth(width) {
- width = Math.max(0, width); // no negatives
- width = Math.round(width);
- return width;
- }
- function computeEdges(el, getPadding) {
- if (getPadding === void 0) { getPadding = false; }
- var computedStyle = window.getComputedStyle(el);
- var borderLeft = parseInt(computedStyle.borderLeftWidth, 10) || 0;
- var borderRight = parseInt(computedStyle.borderRightWidth, 10) || 0;
- var borderTop = parseInt(computedStyle.borderTopWidth, 10) || 0;
- var borderBottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
- // must use offset(Width|Height) because compatible with client(Width|Height)
- var scrollbarLeftRight = sanitizeScrollbarWidth(el.offsetWidth - el.clientWidth - borderLeft - borderRight);
- var scrollbarBottom = sanitizeScrollbarWidth(el.offsetHeight - el.clientHeight - borderTop - borderBottom);
- var res = {
- borderLeft: borderLeft,
- borderRight: borderRight,
- borderTop: borderTop,
- borderBottom: borderBottom,
- scrollbarBottom: scrollbarBottom,
- scrollbarLeft: 0,
- scrollbarRight: 0
- };
- if (getIsRtlScrollbarOnLeft() && computedStyle.direction === 'rtl') { // is the scrollbar on the left side?
- res.scrollbarLeft = scrollbarLeftRight;
- }
- else {
- res.scrollbarRight = scrollbarLeftRight;
- }
- if (getPadding) {
- res.paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
- res.paddingRight = parseInt(computedStyle.paddingRight, 10) || 0;
- res.paddingTop = parseInt(computedStyle.paddingTop, 10) || 0;
- res.paddingBottom = parseInt(computedStyle.paddingBottom, 10) || 0;
- }
- return res;
- }
- function computeInnerRect(el, goWithinPadding) {
- if (goWithinPadding === void 0) { goWithinPadding = false; }
- var outerRect = computeRect(el);
- var edges = computeEdges(el, goWithinPadding);
- var res = {
- left: outerRect.left + edges.borderLeft + edges.scrollbarLeft,
- right: outerRect.right - edges.borderRight - edges.scrollbarRight,
- top: outerRect.top + edges.borderTop,
- bottom: outerRect.bottom - edges.borderBottom - edges.scrollbarBottom
- };
- if (goWithinPadding) {
- res.left += edges.paddingLeft;
- res.right -= edges.paddingRight;
- res.top += edges.paddingTop;
- res.bottom -= edges.paddingBottom;
- }
- return res;
- }
- function computeRect(el) {
- var rect = el.getBoundingClientRect();
- return {
- left: rect.left + window.pageXOffset,
- top: rect.top + window.pageYOffset,
- right: rect.right + window.pageXOffset,
- bottom: rect.bottom + window.pageYOffset
- };
- }
- function computeViewportRect() {
- return {
- left: window.pageXOffset,
- right: window.pageXOffset + document.documentElement.clientWidth,
- top: window.pageYOffset,
- bottom: window.pageYOffset + document.documentElement.clientHeight
- };
- }
- function computeHeightAndMargins(el) {
- return el.getBoundingClientRect().height + computeVMargins(el);
- }
- function computeVMargins(el) {
- var computed = window.getComputedStyle(el);
- return parseInt(computed.marginTop, 10) +
- parseInt(computed.marginBottom, 10);
- }
- // does not return window
- function getClippingParents(el) {
- var parents = [];
- while (el instanceof HTMLElement) { // will stop when gets to document or null
- var computedStyle = window.getComputedStyle(el);
- if (computedStyle.position === 'fixed') {
- break;
- }
- if ((/(auto|scroll)/).test(computedStyle.overflow + computedStyle.overflowY + computedStyle.overflowX)) {
- parents.push(el);
- }
- el = el.parentNode;
- }
- return parents;
- }
- function computeClippingRect(el) {
- return getClippingParents(el)
- .map(function (el) {
- return computeInnerRect(el);
- })
- .concat(computeViewportRect())
- .reduce(function (rect0, rect1) {
- return intersectRects(rect0, rect1) || rect1; // should always intersect
- });
- }
- // Stops a mouse/touch event from doing it's native browser action
- function preventDefault(ev) {
- ev.preventDefault();
- }
- // Event Delegation
- // ----------------------------------------------------------------------------------------------------------------
- function listenBySelector(container, eventType, selector, handler) {
- function realHandler(ev) {
- var matchedChild = elementClosest(ev.target, selector);
- if (matchedChild) {
- handler.call(matchedChild, ev, matchedChild);
- }
- }
- container.addEventListener(eventType, realHandler);
- return function () {
- container.removeEventListener(eventType, realHandler);
- };
- }
- function listenToHoverBySelector(container, selector, onMouseEnter, onMouseLeave) {
- var currentMatchedChild;
- return listenBySelector(container, 'mouseover', selector, function (ev, matchedChild) {
- if (matchedChild !== currentMatchedChild) {
- currentMatchedChild = matchedChild;
- onMouseEnter(ev, matchedChild);
- var realOnMouseLeave_1 = function (ev) {
- currentMatchedChild = null;
- onMouseLeave(ev, matchedChild);
- matchedChild.removeEventListener('mouseleave', realOnMouseLeave_1);
- };
- // listen to the next mouseleave, and then unattach
- matchedChild.addEventListener('mouseleave', realOnMouseLeave_1);
- }
- });
- }
- // Animation
- // ----------------------------------------------------------------------------------------------------------------
- var transitionEventNames = [
- 'webkitTransitionEnd',
- 'otransitionend',
- 'oTransitionEnd',
- 'msTransitionEnd',
- 'transitionend'
- ];
- // triggered only when the next single subsequent transition finishes
- function whenTransitionDone(el, callback) {
- var realCallback = function (ev) {
- callback(ev);
- transitionEventNames.forEach(function (eventName) {
- el.removeEventListener(eventName, realCallback);
- });
- };
- transitionEventNames.forEach(function (eventName) {
- el.addEventListener(eventName, realCallback); // cross-browser way to determine when the transition finishes
- });
- }
- var DAY_IDS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
- // Adding
- function addWeeks(m, n) {
- var a = dateToUtcArray(m);
- a[2] += n * 7;
- return arrayToUtcDate(a);
- }
- function addDays(m, n) {
- var a = dateToUtcArray(m);
- a[2] += n;
- return arrayToUtcDate(a);
- }
- function addMs(m, n) {
- var a = dateToUtcArray(m);
- a[6] += n;
- return arrayToUtcDate(a);
- }
- // Diffing (all return floats)
- function diffWeeks(m0, m1) {
- return diffDays(m0, m1) / 7;
- }
- function diffDays(m0, m1) {
- return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60 * 24);
- }
- function diffHours(m0, m1) {
- return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60);
- }
- function diffMinutes(m0, m1) {
- return (m1.valueOf() - m0.valueOf()) / (1000 * 60);
- }
- function diffSeconds(m0, m1) {
- return (m1.valueOf() - m0.valueOf()) / 1000;
- }
- function diffDayAndTime(m0, m1) {
- var m0day = startOfDay(m0);
- var m1day = startOfDay(m1);
- return {
- years: 0,
- months: 0,
- days: Math.round(diffDays(m0day, m1day)),
- milliseconds: (m1.valueOf() - m1day.valueOf()) - (m0.valueOf() - m0day.valueOf())
- };
- }
- // Diffing Whole Units
- function diffWholeWeeks(m0, m1) {
- var d = diffWholeDays(m0, m1);
- if (d !== null && d % 7 === 0) {
- return d / 7;
- }
- return null;
- }
- function diffWholeDays(m0, m1) {
- if (timeAsMs(m0) === timeAsMs(m1)) {
- return Math.round(diffDays(m0, m1));
- }
- return null;
- }
- // Start-Of
- function startOfDay(m) {
- return arrayToUtcDate([
- m.getUTCFullYear(),
- m.getUTCMonth(),
- m.getUTCDate()
- ]);
- }
- function startOfHour(m) {
- return arrayToUtcDate([
- m.getUTCFullYear(),
- m.getUTCMonth(),
- m.getUTCDate(),
- m.getUTCHours()
- ]);
- }
- function startOfMinute(m) {
- return arrayToUtcDate([
- m.getUTCFullYear(),
- m.getUTCMonth(),
- m.getUTCDate(),
- m.getUTCHours(),
- m.getUTCMinutes()
- ]);
- }
- function startOfSecond(m) {
- return arrayToUtcDate([
- m.getUTCFullYear(),
- m.getUTCMonth(),
- m.getUTCDate(),
- m.getUTCHours(),
- m.getUTCMinutes(),
- m.getUTCSeconds()
- ]);
- }
- // Week Computation
- function weekOfYear(marker, dow, doy) {
- var y = marker.getUTCFullYear();
- var w = weekOfGivenYear(marker, y, dow, doy);
- if (w < 1) {
- return weekOfGivenYear(marker, y - 1, dow, doy);
- }
- var nextW = weekOfGivenYear(marker, y + 1, dow, doy);
- if (nextW >= 1) {
- return Math.min(w, nextW);
- }
- return w;
- }
- function weekOfGivenYear(marker, year, dow, doy) {
- var firstWeekStart = arrayToUtcDate([year, 0, 1 + firstWeekOffset(year, dow, doy)]);
- var dayStart = startOfDay(marker);
- var days = Math.round(diffDays(firstWeekStart, dayStart));
- return Math.floor(days / 7) + 1; // zero-indexed
- }
- // start-of-first-week - start-of-year
- function firstWeekOffset(year, dow, doy) {
- // first-week day -- which january is always in the first week (4 for iso, 1 for other)
- var fwd = 7 + dow - doy;
- // first-week day local weekday -- which local weekday is fwd
- var fwdlw = (7 + arrayToUtcDate([year, 0, fwd]).getUTCDay() - dow) % 7;
- return -fwdlw + fwd - 1;
- }
- // Array Conversion
- function dateToLocalArray(date) {
- return [
- date.getFullYear(),
- date.getMonth(),
- date.getDate(),
- date.getHours(),
- date.getMinutes(),
- date.getSeconds(),
- date.getMilliseconds()
- ];
- }
- function arrayToLocalDate(a) {
- return new Date(a[0], a[1] || 0, a[2] == null ? 1 : a[2], // day of month
- a[3] || 0, a[4] || 0, a[5] || 0);
- }
- function dateToUtcArray(date) {
- return [
- date.getUTCFullYear(),
- date.getUTCMonth(),
- date.getUTCDate(),
- date.getUTCHours(),
- date.getUTCMinutes(),
- date.getUTCSeconds(),
- date.getUTCMilliseconds()
- ];
- }
- function arrayToUtcDate(a) {
- // according to web standards (and Safari), a month index is required.
- // massage if only given a year.
- if (a.length === 1) {
- a = a.concat([0]);
- }
- return new Date(Date.UTC.apply(Date, a));
- }
- // Other Utils
- function isValidDate(m) {
- return !isNaN(m.valueOf());
- }
- function timeAsMs(m) {
- return m.getUTCHours() * 1000 * 60 * 60 +
- m.getUTCMinutes() * 1000 * 60 +
- m.getUTCSeconds() * 1000 +
- m.getUTCMilliseconds();
- }
- var INTERNAL_UNITS = ['years', 'months', 'days', 'milliseconds'];
- var PARSE_RE = /^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;
- // Parsing and Creation
- function createDuration(input, unit) {
- var _a;
- if (typeof input === 'string') {
- return parseString(input);
- }
- else if (typeof input === 'object' && input) { // non-null object
- return normalizeObject(input);
- }
- else if (typeof input === 'number') {
- return normalizeObject((_a = {}, _a[unit || 'milliseconds'] = input, _a));
- }
- else {
- return null;
- }
- }
- function parseString(s) {
- var m = PARSE_RE.exec(s);
- if (m) {
- var sign = m[1] ? -1 : 1;
- return {
- years: 0,
- months: 0,
- days: sign * (m[2] ? parseInt(m[2], 10) : 0),
- milliseconds: sign * ((m[3] ? parseInt(m[3], 10) : 0) * 60 * 60 * 1000 + // hours
- (m[4] ? parseInt(m[4], 10) : 0) * 60 * 1000 + // minutes
- (m[5] ? parseInt(m[5], 10) : 0) * 1000 + // seconds
- (m[6] ? parseInt(m[6], 10) : 0) // ms
- )
- };
- }
- return null;
- }
- function normalizeObject(obj) {
- return {
- years: obj.years || obj.year || 0,
- months: obj.months || obj.month || 0,
- days: (obj.days || obj.day || 0) +
- getWeeksFromInput(obj) * 7,
- milliseconds: (obj.hours || obj.hour || 0) * 60 * 60 * 1000 + // hours
- (obj.minutes || obj.minute || 0) * 60 * 1000 + // minutes
- (obj.seconds || obj.second || 0) * 1000 + // seconds
- (obj.milliseconds || obj.millisecond || obj.ms || 0) // ms
- };
- }
- function getWeeksFromInput(obj) {
- return obj.weeks || obj.week || 0;
- }
- // Equality
- function durationsEqual(d0, d1) {
- return d0.years === d1.years &&
- d0.months === d1.months &&
- d0.days === d1.days &&
- d0.milliseconds === d1.milliseconds;
- }
- function isSingleDay(dur) {
- return dur.years === 0 && dur.months === 0 && dur.days === 1 && dur.milliseconds === 0;
- }
- // Simple Math
- function addDurations(d0, d1) {
- return {
- years: d0.years + d1.years,
- months: d0.months + d1.months,
- days: d0.days + d1.days,
- milliseconds: d0.milliseconds + d1.milliseconds
- };
- }
- function subtractDurations(d1, d0) {
- return {
- years: d1.years - d0.years,
- months: d1.months - d0.months,
- days: d1.days - d0.days,
- milliseconds: d1.milliseconds - d0.milliseconds
- };
- }
- function multiplyDuration(d, n) {
- return {
- years: d.years * n,
- months: d.months * n,
- days: d.days * n,
- milliseconds: d.milliseconds * n
- };
- }
- // Conversions
- // "Rough" because they are based on average-case Gregorian months/years
- function asRoughYears(dur) {
- return asRoughDays(dur) / 365;
- }
- function asRoughMonths(dur) {
- return asRoughDays(dur) / 30;
- }
- function asRoughDays(dur) {
- return asRoughMs(dur) / 864e5;
- }
- function asRoughMinutes(dur) {
- return asRoughMs(dur) / (1000 * 60);
- }
- function asRoughSeconds(dur) {
- return asRoughMs(dur) / 1000;
- }
- function asRoughMs(dur) {
- return dur.years * (365 * 864e5) +
- dur.months * (30 * 864e5) +
- dur.days * 864e5 +
- dur.milliseconds;
- }
- // Advanced Math
- function wholeDivideDurations(numerator, denominator) {
- var res = null;
- for (var i = 0; i < INTERNAL_UNITS.length; i++) {
- var unit = INTERNAL_UNITS[i];
- if (denominator[unit]) {
- var localRes = numerator[unit] / denominator[unit];
- if (!isInt(localRes) || (res !== null && res !== localRes)) {
- return null;
- }
- res = localRes;
- }
- else if (numerator[unit]) {
- // needs to divide by something but can't!
- return null;
- }
- }
- return res;
- }
- function greatestDurationDenominator(dur, dontReturnWeeks) {
- var ms = dur.milliseconds;
- if (ms) {
- if (ms % 1000 !== 0) {
- return { unit: 'millisecond', value: ms };
- }
- if (ms % (1000 * 60) !== 0) {
- return { unit: 'second', value: ms / 1000 };
- }
- if (ms % (1000 * 60 * 60) !== 0) {
- return { unit: 'minute', value: ms / (1000 * 60) };
- }
- if (ms) {
- return { unit: 'hour', value: ms / (1000 * 60 * 60) };
- }
- }
- if (dur.days) {
- if (!dontReturnWeeks && dur.days % 7 === 0) {
- return { unit: 'week', value: dur.days / 7 };
- }
- return { unit: 'day', value: dur.days };
- }
- if (dur.months) {
- return { unit: 'month', value: dur.months };
- }
- if (dur.years) {
- return { unit: 'year', value: dur.years };
- }
- return { unit: 'millisecond', value: 0 };
- }
- /* FullCalendar-specific DOM Utilities
- ----------------------------------------------------------------------------------------------------------------------*/
- // Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left
- // and right space that was offset by the scrollbars. A 1-pixel border first, then margin beyond that.
- function compensateScroll(rowEl, scrollbarWidths) {
- if (scrollbarWidths.left) {
- applyStyle(rowEl, {
- borderLeftWidth: 1,
- marginLeft: scrollbarWidths.left - 1
- });
- }
- if (scrollbarWidths.right) {
- applyStyle(rowEl, {
- borderRightWidth: 1,
- marginRight: scrollbarWidths.right - 1
- });
- }
- }
- // Undoes compensateScroll and restores all borders/margins
- function uncompensateScroll(rowEl) {
- applyStyle(rowEl, {
- marginLeft: '',
- marginRight: '',
- borderLeftWidth: '',
- borderRightWidth: ''
- });
- }
- // Make the mouse cursor express that an event is not allowed in the current area
- function disableCursor() {
- document.body.classList.add('fc-not-allowed');
- }
- // Returns the mouse cursor to its original look
- function enableCursor() {
- document.body.classList.remove('fc-not-allowed');
- }
- // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate.
- // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering
- // any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and
- // reduces the available height.
- function distributeHeight(els, availableHeight, shouldRedistribute) {
- // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions,
- // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars.
- var minOffset1 = Math.floor(availableHeight / els.length); // for non-last element
- var minOffset2 = Math.floor(availableHeight - minOffset1 * (els.length - 1)); // for last element *FLOORING NOTE*
- var flexEls = []; // elements that are allowed to expand. array of DOM nodes
- var flexOffsets = []; // amount of vertical space it takes up
- var flexHeights = []; // actual css height
- var usedHeight = 0;
- undistributeHeight(els); // give all elements their natural height
- // find elements that are below the recommended height (expandable).
- // important to query for heights in a single first pass (to avoid reflow oscillation).
- els.forEach(function (el, i) {
- var minOffset = i === els.length - 1 ? minOffset2 : minOffset1;
- var naturalHeight = el.getBoundingClientRect().height;
- var naturalOffset = naturalHeight + computeVMargins(el);
- if (naturalOffset < minOffset) {
- flexEls.push(el);
- flexOffsets.push(naturalOffset);
- flexHeights.push(naturalHeight);
- }
- else {
- // this element stretches past recommended height (non-expandable). mark the space as occupied.
- usedHeight += naturalOffset;
- }
- });
- // readjust the recommended height to only consider the height available to non-maxed-out rows.
- if (shouldRedistribute) {
- availableHeight -= usedHeight;
- minOffset1 = Math.floor(availableHeight / flexEls.length);
- minOffset2 = Math.floor(availableHeight - minOffset1 * (flexEls.length - 1)); // *FLOORING NOTE*
- }
- // assign heights to all expandable elements
- flexEls.forEach(function (el, i) {
- var minOffset = i === flexEls.length - 1 ? minOffset2 : minOffset1;
- var naturalOffset = flexOffsets[i];
- var naturalHeight = flexHeights[i];
- var newHeight = minOffset - (naturalOffset - naturalHeight); // subtract the margin/padding
- if (naturalOffset < minOffset) { // we check this again because redistribution might have changed things
- el.style.height = newHeight + 'px';
- }
- });
- }
- // Undoes distrubuteHeight, restoring all els to their natural height
- function undistributeHeight(els) {
- els.forEach(function (el) {
- el.style.height = '';
- });
- }
- // Given `els`, a set of <td> cells, find the cell with the largest natural width and set the widths of all the
- // cells to be that width.
- // PREREQUISITE: if you want a cell to take up width, it needs to have a single inner element w/ display:inline
- function matchCellWidths(els) {
- var maxInnerWidth = 0;
- els.forEach(function (el) {
- var innerEl = el.firstChild; // hopefully an element
- if (innerEl instanceof HTMLElement) {
- var innerWidth_1 = innerEl.getBoundingClientRect().width;
- if (innerWidth_1 > maxInnerWidth) {
- maxInnerWidth = innerWidth_1;
- }
- }
- });
- maxInnerWidth++; // sometimes not accurate of width the text needs to stay on one line. insurance
- els.forEach(function (el) {
- el.style.width = maxInnerWidth + 'px';
- });
- return maxInnerWidth;
- }
- // Given one element that resides inside another,
- // Subtracts the height of the inner element from the outer element.
- function subtractInnerElHeight(outerEl, innerEl) {
- // effin' IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked
- var reflowStyleProps = {
- position: 'relative',
- left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll
- };
- applyStyle(outerEl, reflowStyleProps);
- applyStyle(innerEl, reflowStyleProps);
- var diff = // grab the dimensions
- outerEl.getBoundingClientRect().height -
- innerEl.getBoundingClientRect().height;
- // undo hack
- var resetStyleProps = { position: '', left: '' };
- applyStyle(outerEl, resetStyleProps);
- applyStyle(innerEl, resetStyleProps);
- return diff;
- }
- /* Selection
- ----------------------------------------------------------------------------------------------------------------------*/
- function preventSelection(el) {
- el.classList.add('fc-unselectable');
- el.addEventListener('selectstart', preventDefault);
- }
- function allowSelection(el) {
- el.classList.remove('fc-unselectable');
- el.removeEventListener('selectstart', preventDefault);
- }
- /* Context Menu
- ----------------------------------------------------------------------------------------------------------------------*/
- function preventContextMenu(el) {
- el.addEventListener('contextmenu', preventDefault);
- }
- function allowContextMenu(el) {
- el.removeEventListener('contextmenu', preventDefault);
- }
- /* Object Ordering by Field
- ----------------------------------------------------------------------------------------------------------------------*/
- function parseFieldSpecs(input) {
- var specs = [];
- var tokens = [];
- var i;
- var token;
- if (typeof input === 'string') {
- tokens = input.split(/\s*,\s*/);
- }
- else if (typeof input === 'function') {
- tokens = [input];
- }
- else if (Array.isArray(input)) {
- tokens = input;
- }
- for (i = 0; i < tokens.length; i++) {
- token = tokens[i];
- if (typeof token === 'string') {
- specs.push(token.charAt(0) === '-' ?
- { field: token.substring(1), order: -1 } :
- { field: token, order: 1 });
- }
- else if (typeof token === 'function') {
- specs.push({ func: token });
- }
- }
- return specs;
- }
- function compareByFieldSpecs(obj0, obj1, fieldSpecs) {
- var i;
- var cmp;
- for (i = 0; i < fieldSpecs.length; i++) {
- cmp = compareByFieldSpec(obj0, obj1, fieldSpecs[i]);
- if (cmp) {
- return cmp;
- }
- }
- return 0;
- }
- function compareByFieldSpec(obj0, obj1, fieldSpec) {
- if (fieldSpec.func) {
- return fieldSpec.func(obj0, obj1);
- }
- return flexibleCompare(obj0[fieldSpec.field], obj1[fieldSpec.field])
- * (fieldSpec.order || 1);
- }
- function flexibleCompare(a, b) {
- if (!a && !b) {
- return 0;
- }
- if (b == null) {
- return -1;
- }
- if (a == null) {
- return 1;
- }
- if (typeof a === 'string' || typeof b === 'string') {
- return String(a).localeCompare(String(b));
- }
- return a - b;
- }
- /* String Utilities
- ----------------------------------------------------------------------------------------------------------------------*/
- function capitaliseFirstLetter(str) {
- return str.charAt(0).toUpperCase() + str.slice(1);
- }
- function padStart(val, len) {
- var s = String(val);
- return '000'.substr(0, len - s.length) + s;
- }
- /* Number Utilities
- ----------------------------------------------------------------------------------------------------------------------*/
- function compareNumbers(a, b) {
- return a - b;
- }
- function isInt(n) {
- return n % 1 === 0;
- }
- /* Weird Utilities
- ----------------------------------------------------------------------------------------------------------------------*/
- function applyAll(functions, thisObj, args) {
- if (typeof functions === 'function') { // supplied a single function
- functions = [functions];
- }
- if (functions) {
- var i = void 0;
- var ret = void 0;
- for (i = 0; i < functions.length; i++) {
- ret = functions[i].apply(thisObj, args) || ret;
- }
- return ret;
- }
- }
- function firstDefined() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- for (var i = 0; i < args.length; i++) {
- if (args[i] !== undefined) {
- return args[i];
- }
- }
- }
- // Returns a function, that, as long as it continues to be invoked, will not
- // be triggered. The function will be called after it stops being called for
- // N milliseconds. If `immediate` is passed, trigger the function on the
- // leading edge, instead of the trailing.
- // https://github.com/jashkenas/underscore/blob/1.6.0/underscore.js#L714
- function debounce(func, wait) {
- var timeout;
- var args;
- var context;
- var timestamp;
- var result;
- var later = function () {
- var last = new Date().valueOf() - timestamp;
- if (last < wait) {
- timeout = setTimeout(later, wait - last);
- }
- else {
- timeout = null;
- result = func.apply(context, args);
- context = args = null;
- }
- };
- return function () {
- context = this;
- args = arguments;
- timestamp = new Date().valueOf();
- if (!timeout) {
- timeout = setTimeout(later, wait);
- }
- return result;
- };
- }
- // Number and Boolean are only types that defaults or not computed for
- // TODO: write more comments
- function refineProps(rawProps, processors, defaults, leftoverProps) {
- if (defaults === void 0) { defaults = {}; }
- var refined = {};
- for (var key in processors) {
- var processor = processors[key];
- if (rawProps[key] !== undefined) {
- // found
- if (processor === Function) {
- refined[key] = typeof rawProps[key] === 'function' ? rawProps[key] : null;
- }
- else if (processor) { // a refining function?
- refined[key] = processor(rawProps[key]);
- }
- else {
- refined[key] = rawProps[key];
- }
- }
- else if (defaults[key] !== undefined) {
- // there's an explicit default
- refined[key] = defaults[key];
- }
- else {
- // must compute a default
- if (processor === String) {
- refined[key] = ''; // empty string is default for String
- }
- else if (!processor || processor === Number || processor === Boolean || processor === Function) {
- refined[key] = null; // assign null for other non-custom processor funcs
- }
- else {
- refined[key] = processor(null); // run the custom processor func
- }
- }
- }
- if (leftoverProps) {
- for (var key in rawProps) {
- if (processors[key] === undefined) {
- leftoverProps[key] = rawProps[key];
- }
- }
- }
- return refined;
- }
- /* Date stuff that doesn't belong in datelib core
- ----------------------------------------------------------------------------------------------------------------------*/
- // given a timed range, computes an all-day range that has the same exact duration,
- // but whose start time is aligned with the start of the day.
- function computeAlignedDayRange(timedRange) {
- var dayCnt = Math.floor(diffDays(timedRange.start, timedRange.end)) || 1;
- var start = startOfDay(timedRange.start);
- var end = addDays(start, dayCnt);
- return { start: start, end: end };
- }
- // given a timed range, computes an all-day range based on how for the end date bleeds into the next day
- // TODO: give nextDayThreshold a default arg
- function computeVisibleDayRange(timedRange, nextDayThreshold) {
- if (nextDayThreshold === void 0) { nextDayThreshold = createDuration(0); }
- var startDay = null;
- var endDay = null;
- if (timedRange.end) {
- endDay = startOfDay(timedRange.end);
- var endTimeMS = timedRange.end.valueOf() - endDay.valueOf(); // # of milliseconds into `endDay`
- // If the end time is actually inclusively part of the next day and is equal to or
- // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`.
- // Otherwise, leaving it as inclusive will cause it to exclude `endDay`.
- if (endTimeMS && endTimeMS >= asRoughMs(nextDayThreshold)) {
- endDay = addDays(endDay, 1);
- }
- }
- if (timedRange.start) {
- startDay = startOfDay(timedRange.start); // the beginning of the day the range starts
- // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day.
- if (endDay && endDay <= startDay) {
- endDay = addDays(startDay, 1);
- }
- }
- return { start: startDay, end: endDay };
- }
- // spans from one day into another?
- function isMultiDayRange(range) {
- var visibleRange = computeVisibleDayRange(range);
- return diffDays(visibleRange.start, visibleRange.end) > 1;
- }
- function diffDates(date0, date1, dateEnv, largeUnit) {
- if (largeUnit === 'year') {
- return createDuration(dateEnv.diffWholeYears(date0, date1), 'year');
- }
- else if (largeUnit === 'month') {
- return createDuration(dateEnv.diffWholeMonths(date0, date1), 'month');
- }
- else {
- return diffDayAndTime(date0, date1); // returns a duration
- }
- }
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- function parseRecurring(eventInput, allDayDefault, dateEnv, recurringTypes, leftovers) {
- for (var i = 0; i < recurringTypes.length; i++) {
- var localLeftovers = {};
- var parsed = recurringTypes[i].parse(eventInput, localLeftovers, dateEnv);
- if (parsed) {
- var allDay = localLeftovers.allDay;
- delete localLeftovers.allDay; // remove from leftovers
- if (allDay == null) {
- allDay = allDayDefault;
- if (allDay == null) {
- allDay = parsed.allDayGuess;
- if (allDay == null) {
- allDay = false;
- }
- }
- }
- __assign(leftovers, localLeftovers);
- return {
- allDay: allDay,
- duration: parsed.duration,
- typeData: parsed.typeData,
- typeId: i
- };
- }
- }
- return null;
- }
- /*
- Event MUST have a recurringDef
- */
- function expandRecurringRanges(eventDef, duration, framingRange, dateEnv, recurringTypes) {
- var typeDef = recurringTypes[eventDef.recurringDef.typeId];
- var markers = typeDef.expand(eventDef.recurringDef.typeData, {
- start: dateEnv.subtract(framingRange.start, duration),
- end: framingRange.end
- }, dateEnv);
- // the recurrence plugins don't guarantee that all-day events are start-of-day, so we have to
- if (eventDef.allDay) {
- markers = markers.map(startOfDay);
- }
- return markers;
- }
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- // Merges an array of objects into a single object.
- // The second argument allows for an array of property names who's object values will be merged together.
- function mergeProps(propObjs, complexProps) {
- var dest = {};
- var i;
- var name;
- var complexObjs;
- var j;
- var val;
- var props;
- if (complexProps) {
- for (i = 0; i < complexProps.length; i++) {
- name = complexProps[i];
- complexObjs = [];
- // collect the trailing object values, stopping when a non-object is discovered
- for (j = propObjs.length - 1; j >= 0; j--) {
- val = propObjs[j][name];
- if (typeof val === 'object' && val) { // non-null object
- complexObjs.unshift(val);
- }
- else if (val !== undefined) {
- dest[name] = val; // if there were no objects, this value will be used
- break;
- }
- }
- // if the trailing values were objects, use the merged value
- if (complexObjs.length) {
- dest[name] = mergeProps(complexObjs);
- }
- }
- }
- // copy values into the destination, going from last to first
- for (i = propObjs.length - 1; i >= 0; i--) {
- props = propObjs[i];
- for (name in props) {
- if (!(name in dest)) { // if already assigned by previous props or complex props, don't reassign
- dest[name] = props[name];
- }
- }
- }
- return dest;
- }
- function filterHash(hash, func) {
- var filtered = {};
- for (var key in hash) {
- if (func(hash[key], key)) {
- filtered[key] = hash[key];
- }
- }
- return filtered;
- }
- function mapHash(hash, func) {
- var newHash = {};
- for (var key in hash) {
- newHash[key] = func(hash[key], key);
- }
- return newHash;
- }
- function arrayToHash(a) {
- var hash = {};
- for (var _i = 0, a_1 = a; _i < a_1.length; _i++) {
- var item = a_1[_i];
- hash[item] = true;
- }
- return hash;
- }
- function hashValuesToArray(obj) {
- var a = [];
- for (var key in obj) {
- a.push(obj[key]);
- }
- return a;
- }
- function isPropsEqual(obj0, obj1) {
- for (var key in obj0) {
- if (hasOwnProperty.call(obj0, key)) {
- if (!(key in obj1)) {
- return false;
- }
- }
- }
- for (var key in obj1) {
- if (hasOwnProperty.call(obj1, key)) {
- if (obj0[key] !== obj1[key]) {
- return false;
- }
- }
- }
- return true;
- }
- function parseEvents(rawEvents, sourceId, calendar, allowOpenRange) {
- var eventStore = createEmptyEventStore();
- for (var _i = 0, rawEvents_1 = rawEvents; _i < rawEvents_1.length; _i++) {
- var rawEvent = rawEvents_1[_i];
- var tuple = parseEvent(rawEvent, sourceId, calendar, allowOpenRange);
- if (tuple) {
- eventTupleToStore(tuple, eventStore);
- }
- }
- return eventStore;
- }
- function eventTupleToStore(tuple, eventStore) {
- if (eventStore === void 0) { eventStore = createEmptyEventStore(); }
- eventStore.defs[tuple.def.defId] = tuple.def;
- if (tuple.instance) {
- eventStore.instances[tuple.instance.instanceId] = tuple.instance;
- }
- return eventStore;
- }
- function expandRecurring(eventStore, framingRange, calendar) {
- var dateEnv = calendar.dateEnv;
- var defs = eventStore.defs, instances = eventStore.instances;
- // remove existing recurring instances
- instances = filterHash(instances, function (instance) {
- return !defs[instance.defId].recurringDef;
- });
- for (var defId in defs) {
- var def = defs[defId];
- if (def.recurringDef) {
- var duration = def.recurringDef.duration;
- if (!duration) {
- duration = def.allDay ?
- calendar.defaultAllDayEventDuration :
- calendar.defaultTimedEventDuration;
- }
- var starts = expandRecurringRanges(def, duration, framingRange, calendar.dateEnv, calendar.pluginSystem.hooks.recurringTypes);
- for (var _i = 0, starts_1 = starts; _i < starts_1.length; _i++) {
- var start = starts_1[_i];
- var instance = createEventInstance(defId, {
- start: start,
- end: dateEnv.add(start, duration)
- });
- instances[instance.instanceId] = instance;
- }
- }
- }
- return { defs: defs, instances: instances };
- }
- // retrieves events that have the same groupId as the instance specified by `instanceId`
- // or they are the same as the instance.
- // why might instanceId not be in the store? an event from another calendar?
- function getRelevantEvents(eventStore, instanceId) {
- var instance = eventStore.instances[instanceId];
- if (instance) {
- var def_1 = eventStore.defs[instance.defId];
- // get events/instances with same group
- var newStore = filterEventStoreDefs(eventStore, function (lookDef) {
- return isEventDefsGrouped(def_1, lookDef);
- });
- // add the original
- // TODO: wish we could use eventTupleToStore or something like it
- newStore.defs[def_1.defId] = def_1;
- newStore.instances[instance.instanceId] = instance;
- return newStore;
- }
- return createEmptyEventStore();
- }
- function isEventDefsGrouped(def0, def1) {
- return Boolean(def0.groupId && def0.groupId === def1.groupId);
- }
- function transformRawEvents(rawEvents, eventSource, calendar) {
- var calEachTransform = calendar.opt('eventDataTransform');
- var sourceEachTransform = eventSource ? eventSource.eventDataTransform : null;
- if (sourceEachTransform) {
- rawEvents = transformEachRawEvent(rawEvents, sourceEachTransform);
- }
- if (calEachTransform) {
- rawEvents = transformEachRawEvent(rawEvents, calEachTransform);
- }
- return rawEvents;
- }
- function transformEachRawEvent(rawEvents, func) {
- var refinedEvents;
- if (!func) {
- refinedEvents = rawEvents;
- }
- else {
- refinedEvents = [];
- for (var _i = 0, rawEvents_2 = rawEvents; _i < rawEvents_2.length; _i++) {
- var rawEvent = rawEvents_2[_i];
- var refinedEvent = func(rawEvent);
- if (refinedEvent) {
- refinedEvents.push(refinedEvent);
- }
- else if (refinedEvent == null) {
- refinedEvents.push(rawEvent);
- } // if a different falsy value, do nothing
- }
- }
- return refinedEvents;
- }
- function createEmptyEventStore() {
- return { defs: {}, instances: {} };
- }
- function mergeEventStores(store0, store1) {
- return {
- defs: __assign({}, store0.defs, store1.defs),
- instances: __assign({}, store0.instances, store1.instances)
- };
- }
- function filterEventStoreDefs(eventStore, filterFunc) {
- var defs = filterHash(eventStore.defs, filterFunc);
- var instances = filterHash(eventStore.instances, function (instance) {
- return defs[instance.defId]; // still exists?
- });
- return { defs: defs, instances: instances };
- }
- function parseRange(input, dateEnv) {
- var start = null;
- var end = null;
- if (input.start) {
- start = dateEnv.createMarker(input.start);
- }
- if (input.end) {
- end = dateEnv.createMarker(input.end);
- }
- if (!start && !end) {
- return null;
- }
- if (start && end && end < start) {
- return null;
- }
- return { start: start, end: end };
- }
- // SIDE-EFFECT: will mutate ranges.
- // Will return a new array result.
- function invertRanges(ranges, constraintRange) {
- var invertedRanges = [];
- var start = constraintRange.start; // the end of the previous range. the start of the new range
- var i;
- var dateRange;
- // ranges need to be in order. required for our date-walking algorithm
- ranges.sort(compareRanges);
- for (i = 0; i < ranges.length; i++) {
- dateRange = ranges[i];
- // add the span of time before the event (if there is any)
- if (dateRange.start > start) { // compare millisecond time (skip any ambig logic)
- invertedRanges.push({ start: start, end: dateRange.start });
- }
- if (dateRange.end > start) {
- start = dateRange.end;
- }
- }
- // add the span of time after the last event (if there is any)
- if (start < constraintRange.end) { // compare millisecond time (skip any ambig logic)
- invertedRanges.push({ start: start, end: constraintRange.end });
- }
- return invertedRanges;
- }
- function compareRanges(range0, range1) {
- return range0.start.valueOf() - range1.start.valueOf(); // earlier ranges go first
- }
- function intersectRanges(range0, range1) {
- var start = range0.start;
- var end = range0.end;
- var newRange = null;
- if (range1.start !== null) {
- if (start === null) {
- start = range1.start;
- }
- else {
- start = new Date(Math.max(start.valueOf(), range1.start.valueOf()));
- }
- }
- if (range1.end != null) {
- if (end === null) {
- end = range1.end;
- }
- else {
- end = new Date(Math.min(end.valueOf(), range1.end.valueOf()));
- }
- }
- if (start === null || end === null || start < end) {
- newRange = { start: start, end: end };
- }
- return newRange;
- }
- function rangesEqual(range0, range1) {
- return (range0.start === null ? null : range0.start.valueOf()) === (range1.start === null ? null : range1.start.valueOf()) &&
- (range0.end === null ? null : range0.end.valueOf()) === (range1.end === null ? null : range1.end.valueOf());
- }
- function rangesIntersect(range0, range1) {
- return (range0.end === null || range1.start === null || range0.end > range1.start) &&
- (range0.start === null || range1.end === null || range0.start < range1.end);
- }
- function rangeContainsRange(outerRange, innerRange) {
- return (outerRange.start === null || (innerRange.start !== null && innerRange.start >= outerRange.start)) &&
- (outerRange.end === null || (innerRange.end !== null && innerRange.end <= outerRange.end));
- }
- function rangeContainsMarker(range, date) {
- return (range.start === null || date >= range.start) &&
- (range.end === null || date < range.end);
- }
- // If the given date is not within the given range, move it inside.
- // (If it's past the end, make it one millisecond before the end).
- function constrainMarkerToRange(date, range) {
- if (range.start != null && date < range.start) {
- return range.start;
- }
- if (range.end != null && date >= range.end) {
- return new Date(range.end.valueOf() - 1);
- }
- return date;
- }
- function removeExact(array, exactVal) {
- var removeCnt = 0;
- var i = 0;
- while (i < array.length) {
- if (array[i] === exactVal) {
- array.splice(i, 1);
- removeCnt++;
- }
- else {
- i++;
- }
- }
- return removeCnt;
- }
- function isArraysEqual(a0, a1) {
- var len = a0.length;
- var i;
- if (len !== a1.length) { // not array? or not same length?
- return false;
- }
- for (i = 0; i < len; i++) {
- if (a0[i] !== a1[i]) {
- return false;
- }
- }
- return true;
- }
- function memoize(workerFunc) {
- var args;
- var res;
- return function () {
- if (!args || !isArraysEqual(args, arguments)) {
- args = arguments;
- res = workerFunc.apply(this, arguments);
- }
- return res;
- };
- }
- /*
- always executes the workerFunc, but if the result is equal to the previous result,
- return the previous result instead.
- */
- function memoizeOutput(workerFunc, equalityFunc) {
- var cachedRes = null;
- return function () {
- var newRes = workerFunc.apply(this, arguments);
- if (cachedRes === null || !(cachedRes === newRes || equalityFunc(cachedRes, newRes))) {
- cachedRes = newRes;
- }
- return cachedRes;
- };
- }
- var EXTENDED_SETTINGS_AND_SEVERITIES = {
- week: 3,
- separator: 0,
- omitZeroMinute: 0,
- meridiem: 0,
- omitCommas: 0
- };
- var STANDARD_DATE_PROP_SEVERITIES = {
- timeZoneName: 7,
- era: 6,
- year: 5,
- month: 4,
- day: 2,
- weekday: 2,
- hour: 1,
- minute: 1,
- second: 1
- };
- var MERIDIEM_RE = /\s*([ap])\.?m\.?/i; // eats up leading spaces too
- var COMMA_RE = /,/g; // we need re for globalness
- var MULTI_SPACE_RE = /\s+/g;
- var LTR_RE = /\u200e/g; // control character
- var UTC_RE = /UTC|GMT/;
- var NativeFormatter = /** @class */ (function () {
- function NativeFormatter(formatSettings) {
- var standardDateProps = {};
- var extendedSettings = {};
- var severity = 0;
- for (var name_1 in formatSettings) {
- if (name_1 in EXTENDED_SETTINGS_AND_SEVERITIES) {
- extendedSettings[name_1] = formatSettings[name_1];
- severity = Math.max(EXTENDED_SETTINGS_AND_SEVERITIES[name_1], severity);
- }
- else {
- standardDateProps[name_1] = formatSettings[name_1];
- if (name_1 in STANDARD_DATE_PROP_SEVERITIES) {
- severity = Math.max(STANDARD_DATE_PROP_SEVERITIES[name_1], severity);
- }
- }
- }
- this.standardDateProps = standardDateProps;
- this.extendedSettings = extendedSettings;
- this.severity = severity;
- this.buildFormattingFunc = memoize(buildFormattingFunc);
- }
- NativeFormatter.prototype.format = function (date, context) {
- return this.buildFormattingFunc(this.standardDateProps, this.extendedSettings, context)(date);
- };
- NativeFormatter.prototype.formatRange = function (start, end, context) {
- var _a = this, standardDateProps = _a.standardDateProps, extendedSettings = _a.extendedSettings;
- var diffSeverity = computeMarkerDiffSeverity(start.marker, end.marker, context.calendarSystem);
- if (!diffSeverity) {
- return this.format(start, context);
- }
- var biggestUnitForPartial = diffSeverity;
- if (biggestUnitForPartial > 1 && // the two dates are different in a way that's larger scale than time
- (standardDateProps.year === 'numeric' || standardDateProps.year === '2-digit') &&
- (standardDateProps.month === 'numeric' || standardDateProps.month === '2-digit') &&
- (standardDateProps.day === 'numeric' || standardDateProps.day === '2-digit')) {
- biggestUnitForPartial = 1; // make it look like the dates are only different in terms of time
- }
- var full0 = this.format(start, context);
- var full1 = this.format(end, context);
- if (full0 === full1) {
- return full0;
- }
- var partialDateProps = computePartialFormattingOptions(standardDateProps, biggestUnitForPartial);
- var partialFormattingFunc = buildFormattingFunc(partialDateProps, extendedSettings, context);
- var partial0 = partialFormattingFunc(start);
- var partial1 = partialFormattingFunc(end);
- var insertion = findCommonInsertion(full0, partial0, full1, partial1);
- var separator = extendedSettings.separator || '';
- if (insertion) {
- return insertion.before + partial0 + separator + partial1 + insertion.after;
- }
- return full0 + separator + full1;
- };
- NativeFormatter.prototype.getLargestUnit = function () {
- switch (this.severity) {
- case 7:
- case 6:
- case 5:
- return 'year';
- case 4:
- return 'month';
- case 3:
- return 'week';
- default:
- return 'day';
- }
- };
- return NativeFormatter;
- }());
- function buildFormattingFunc(standardDateProps, extendedSettings, context) {
- var standardDatePropCnt = Object.keys(standardDateProps).length;
- if (standardDatePropCnt === 1 && standardDateProps.timeZoneName === 'short') {
- return function (date) {
- return formatTimeZoneOffset(date.timeZoneOffset);
- };
- }
- if (standardDatePropCnt === 0 && extendedSettings.week) {
- return function (date) {
- return formatWeekNumber(context.computeWeekNumber(date.marker), context.weekLabel, context.locale, extendedSettings.week);
- };
- }
- return buildNativeFormattingFunc(standardDateProps, extendedSettings, context);
- }
- function buildNativeFormattingFunc(standardDateProps, extendedSettings, context) {
- standardDateProps = __assign({}, standardDateProps); // copy
- extendedSettings = __assign({}, extendedSettings); // copy
- sanitizeSettings(standardDateProps, extendedSettings);
- standardDateProps.timeZone = 'UTC'; // we leverage the only guaranteed timeZone for our UTC markers
- var normalFormat = new Intl.DateTimeFormat(context.locale.codes, standardDateProps);
- var zeroFormat; // needed?
- if (extendedSettings.omitZeroMinute) {
- var zeroProps = __assign({}, standardDateProps);
- delete zeroProps.minute; // seconds and ms were already considered in sanitizeSettings
- zeroFormat = new Intl.DateTimeFormat(context.locale.codes, zeroProps);
- }
- return function (date) {
- var marker = date.marker;
- var format;
- if (zeroFormat && !marker.getUTCMinutes()) {
- format = zeroFormat;
- }
- else {
- format = normalFormat;
- }
- var s = format.format(marker);
- return postProcess(s, date, standardDateProps, extendedSettings, context);
- };
- }
- function sanitizeSettings(standardDateProps, extendedSettings) {
- // deal with a browser inconsistency where formatting the timezone
- // requires that the hour/minute be present.
- if (standardDateProps.timeZoneName) {
- if (!standardDateProps.hour) {
- standardDateProps.hour = '2-digit';
- }
- if (!standardDateProps.minute) {
- standardDateProps.minute = '2-digit';
- }
- }
- // only support short timezone names
- if (standardDateProps.timeZoneName === 'long') {
- standardDateProps.timeZoneName = 'short';
- }
- // if requesting to display seconds, MUST display minutes
- if (extendedSettings.omitZeroMinute && (standardDateProps.second || standardDateProps.millisecond)) {
- delete extendedSettings.omitZeroMinute;
- }
- }
- function postProcess(s, date, standardDateProps, extendedSettings, context) {
- s = s.replace(LTR_RE, ''); // remove left-to-right control chars. do first. good for other regexes
- if (standardDateProps.timeZoneName === 'short') {
- s = injectTzoStr(s, (context.timeZone === 'UTC' || date.timeZoneOffset == null) ?
- 'UTC' : // important to normalize for IE, which does "GMT"
- formatTimeZoneOffset(date.timeZoneOffset));
- }
- if (extendedSettings.omitCommas) {
- s = s.replace(COMMA_RE, '').trim();
- }
- if (extendedSettings.omitZeroMinute) {
- s = s.replace(':00', ''); // zeroFormat doesn't always achieve this
- }
- // ^ do anything that might create adjacent spaces before this point,
- // because MERIDIEM_RE likes to eat up loading spaces
- if (extendedSettings.meridiem === false) {
- s = s.replace(MERIDIEM_RE, '').trim();
- }
- else if (extendedSettings.meridiem === 'narrow') { // a/p
- s = s.replace(MERIDIEM_RE, function (m0, m1) {
- return m1.toLocaleLowerCase();
- });
- }
- else if (extendedSettings.meridiem === 'short') { // am/pm
- s = s.replace(MERIDIEM_RE, function (m0, m1) {
- return m1.toLocaleLowerCase() + 'm';
- });
- }
- else if (extendedSettings.meridiem === 'lowercase') { // other meridiem transformers already converted to lowercase
- s = s.replace(MERIDIEM_RE, function (m0) {
- return m0.toLocaleLowerCase();
- });
- }
- s = s.replace(MULTI_SPACE_RE, ' ');
- s = s.trim();
- return s;
- }
- function injectTzoStr(s, tzoStr) {
- var replaced = false;
- s = s.replace(UTC_RE, function () {
- replaced = true;
- return tzoStr;
- });
- // IE11 doesn't include UTC/GMT in the original string, so append to end
- if (!replaced) {
- s += ' ' + tzoStr;
- }
- return s;
- }
- function formatWeekNumber(num, weekLabel, locale, display) {
- var parts = [];
- if (display === 'narrow') {
- parts.push(weekLabel);
- }
- else if (display === 'short') {
- parts.push(weekLabel, ' ');
- }
- // otherwise, considered 'numeric'
- parts.push(locale.simpleNumberFormat.format(num));
- if (locale.options.isRtl) { // TODO: use control characters instead?
- parts.reverse();
- }
- return parts.join('');
- }
- // Range Formatting Utils
- // 0 = exactly the same
- // 1 = different by time
- // and bigger
- function computeMarkerDiffSeverity(d0, d1, ca) {
- if (ca.getMarkerYear(d0) !== ca.getMarkerYear(d1)) {
- return 5;
- }
- if (ca.getMarkerMonth(d0) !== ca.getMarkerMonth(d1)) {
- return 4;
- }
- if (ca.getMarkerDay(d0) !== ca.getMarkerDay(d1)) {
- return 2;
- }
- if (timeAsMs(d0) !== timeAsMs(d1)) {
- return 1;
- }
- return 0;
- }
- function computePartialFormattingOptions(options, biggestUnit) {
- var partialOptions = {};
- for (var name_2 in options) {
- if (!(name_2 in STANDARD_DATE_PROP_SEVERITIES) || // not a date part prop (like timeZone)
- STANDARD_DATE_PROP_SEVERITIES[name_2] <= biggestUnit) {
- partialOptions[name_2] = options[name_2];
- }
- }
- return partialOptions;
- }
- function findCommonInsertion(full0, partial0, full1, partial1) {
- var i0 = 0;
- while (i0 < full0.length) {
- var found0 = full0.indexOf(partial0, i0);
- if (found0 === -1) {
- break;
- }
- var before0 = full0.substr(0, found0);
- i0 = found0 + partial0.length;
- var after0 = full0.substr(i0);
- var i1 = 0;
- while (i1 < full1.length) {
- var found1 = full1.indexOf(partial1, i1);
- if (found1 === -1) {
- break;
- }
- var before1 = full1.substr(0, found1);
- i1 = found1 + partial1.length;
- var after1 = full1.substr(i1);
- if (before0 === before1 && after0 === after1) {
- return {
- before: before0,
- after: after0
- };
- }
- }
- }
- return null;
- }
- /*
- TODO: fix the terminology of "formatter" vs "formatting func"
- */
- /*
- At the time of instantiation, this object does not know which cmd-formatting system it will use.
- It receives this at the time of formatting, as a setting.
- */
- var CmdFormatter = /** @class */ (function () {
- function CmdFormatter(cmdStr, separator) {
- this.cmdStr = cmdStr;
- this.separator = separator;
- }
- CmdFormatter.prototype.format = function (date, context) {
- return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(date, null, context, this.separator));
- };
- CmdFormatter.prototype.formatRange = function (start, end, context) {
- return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(start, end, context, this.separator));
- };
- return CmdFormatter;
- }());
- var FuncFormatter = /** @class */ (function () {
- function FuncFormatter(func) {
- this.func = func;
- }
- FuncFormatter.prototype.format = function (date, context) {
- return this.func(createVerboseFormattingArg(date, null, context));
- };
- FuncFormatter.prototype.formatRange = function (start, end, context) {
- return this.func(createVerboseFormattingArg(start, end, context));
- };
- return FuncFormatter;
- }());
- // Formatter Object Creation
- function createFormatter(input, defaultSeparator) {
- if (typeof input === 'object' && input) { // non-null object
- if (typeof defaultSeparator === 'string') {
- input = __assign({ separator: defaultSeparator }, input);
- }
- return new NativeFormatter(input);
- }
- else if (typeof input === 'string') {
- return new CmdFormatter(input, defaultSeparator);
- }
- else if (typeof input === 'function') {
- return new FuncFormatter(input);
- }
- }
- // String Utils
- // timeZoneOffset is in minutes
- function buildIsoString(marker, timeZoneOffset, stripZeroTime) {
- if (stripZeroTime === void 0) { stripZeroTime = false; }
- var s = marker.toISOString();
- s = s.replace('.000', '');
- if (stripZeroTime) {
- s = s.replace('T00:00:00Z', '');
- }
- if (s.length > 10) { // time part wasn't stripped, can add timezone info
- if (timeZoneOffset == null) {
- s = s.replace('Z', '');
- }
- else if (timeZoneOffset !== 0) {
- s = s.replace('Z', formatTimeZoneOffset(timeZoneOffset, true));
- }
- // otherwise, its UTC-0 and we want to keep the Z
- }
- return s;
- }
- function formatIsoTimeString(marker) {
- return padStart(marker.getUTCHours(), 2) + ':' +
- padStart(marker.getUTCMinutes(), 2) + ':' +
- padStart(marker.getUTCSeconds(), 2);
- }
- function formatTimeZoneOffset(minutes, doIso) {
- if (doIso === void 0) { doIso = false; }
- var sign = minutes < 0 ? '-' : '+';
- var abs = Math.abs(minutes);
- var hours = Math.floor(abs / 60);
- var mins = Math.round(abs % 60);
- if (doIso) {
- return sign + padStart(hours, 2) + ':' + padStart(mins, 2);
- }
- else {
- return 'GMT' + sign + hours + (mins ? ':' + padStart(mins, 2) : '');
- }
- }
- // Arg Utils
- function createVerboseFormattingArg(start, end, context, separator) {
- var startInfo = expandZonedMarker(start, context.calendarSystem);
- var endInfo = end ? expandZonedMarker(end, context.calendarSystem) : null;
- return {
- date: startInfo,
- start: startInfo,
- end: endInfo,
- timeZone: context.timeZone,
- localeCodes: context.locale.codes,
- separator: separator
- };
- }
- function expandZonedMarker(dateInfo, calendarSystem) {
- var a = calendarSystem.markerToArray(dateInfo.marker);
- return {
- marker: dateInfo.marker,
- timeZoneOffset: dateInfo.timeZoneOffset,
- array: a,
- year: a[0],
- month: a[1],
- day: a[2],
- hour: a[3],
- minute: a[4],
- second: a[5],
- millisecond: a[6]
- };
- }
- var EventSourceApi = /** @class */ (function () {
- function EventSourceApi(calendar, internalEventSource) {
- this.calendar = calendar;
- this.internalEventSource = internalEventSource;
- }
- EventSourceApi.prototype.remove = function () {
- this.calendar.dispatch({
- type: 'REMOVE_EVENT_SOURCE',
- sourceId: this.internalEventSource.sourceId
- });
- };
- EventSourceApi.prototype.refetch = function () {
- this.calendar.dispatch({
- type: 'FETCH_EVENT_SOURCES',
- sourceIds: [this.internalEventSource.sourceId]
- });
- };
- Object.defineProperty(EventSourceApi.prototype, "id", {
- get: function () {
- return this.internalEventSource.publicId;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventSourceApi.prototype, "url", {
- // only relevant to json-feed event sources
- get: function () {
- return this.internalEventSource.meta.url;
- },
- enumerable: true,
- configurable: true
- });
- return EventSourceApi;
- }());
- var EventApi = /** @class */ (function () {
- function EventApi(calendar, def, instance) {
- this._calendar = calendar;
- this._def = def;
- this._instance = instance || null;
- }
- /*
- TODO: make event struct more responsible for this
- */
- EventApi.prototype.setProp = function (name, val) {
- var _a, _b;
- if (name in DATE_PROPS) ;
- else if (name in NON_DATE_PROPS) {
- if (typeof NON_DATE_PROPS[name] === 'function') {
- val = NON_DATE_PROPS[name](val);
- }
- this.mutate({
- standardProps: (_a = {}, _a[name] = val, _a)
- });
- }
- else if (name in UNSCOPED_EVENT_UI_PROPS) {
- var ui = void 0;
- if (typeof UNSCOPED_EVENT_UI_PROPS[name] === 'function') {
- val = UNSCOPED_EVENT_UI_PROPS[name](val);
- }
- if (name === 'color') {
- ui = { backgroundColor: val, borderColor: val };
- }
- else if (name === 'editable') {
- ui = { startEditable: val, durationEditable: val };
- }
- else {
- ui = (_b = {}, _b[name] = val, _b);
- }
- this.mutate({
- standardProps: { ui: ui }
- });
- }
- };
- EventApi.prototype.setExtendedProp = function (name, val) {
- var _a;
- this.mutate({
- extendedProps: (_a = {}, _a[name] = val, _a)
- });
- };
- EventApi.prototype.setStart = function (startInput, options) {
- if (options === void 0) { options = {}; }
- var dateEnv = this._calendar.dateEnv;
- var start = dateEnv.createMarker(startInput);
- if (start && this._instance) { // TODO: warning if parsed bad
- var instanceRange = this._instance.range;
- var startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity); // what if parsed bad!?
- if (options.maintainDuration) {
- this.mutate({ datesDelta: startDelta });
- }
- else {
- this.mutate({ startDelta: startDelta });
- }
- }
- };
- EventApi.prototype.setEnd = function (endInput, options) {
- if (options === void 0) { options = {}; }
- var dateEnv = this._calendar.dateEnv;
- var end;
- if (endInput != null) {
- end = dateEnv.createMarker(endInput);
- if (!end) {
- return; // TODO: warning if parsed bad
- }
- }
- if (this._instance) {
- if (end) {
- var endDelta = diffDates(this._instance.range.end, end, dateEnv, options.granularity);
- this.mutate({ endDelta: endDelta });
- }
- else {
- this.mutate({ standardProps: { hasEnd: false } });
- }
- }
- };
- EventApi.prototype.setDates = function (startInput, endInput, options) {
- if (options === void 0) { options = {}; }
- var dateEnv = this._calendar.dateEnv;
- var standardProps = { allDay: options.allDay };
- var start = dateEnv.createMarker(startInput);
- var end;
- if (!start) {
- return; // TODO: warning if parsed bad
- }
- if (endInput != null) {
- end = dateEnv.createMarker(endInput);
- if (!end) { // TODO: warning if parsed bad
- return;
- }
- }
- if (this._instance) {
- var instanceRange = this._instance.range;
- // when computing the diff for an event being converted to all-day,
- // compute diff off of the all-day values the way event-mutation does.
- if (options.allDay === true) {
- instanceRange = computeAlignedDayRange(instanceRange);
- }
- var startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity);
- if (end) {
- var endDelta = diffDates(instanceRange.end, end, dateEnv, options.granularity);
- if (durationsEqual(startDelta, endDelta)) {
- this.mutate({ datesDelta: startDelta, standardProps: standardProps });
- }
- else {
- this.mutate({ startDelta: startDelta, endDelta: endDelta, standardProps: standardProps });
- }
- }
- else { // means "clear the end"
- standardProps.hasEnd = false;
- this.mutate({ datesDelta: startDelta, standardProps: standardProps });
- }
- }
- };
- EventApi.prototype.moveStart = function (deltaInput) {
- var delta = createDuration(deltaInput);
- if (delta) { // TODO: warning if parsed bad
- this.mutate({ startDelta: delta });
- }
- };
- EventApi.prototype.moveEnd = function (deltaInput) {
- var delta = createDuration(deltaInput);
- if (delta) { // TODO: warning if parsed bad
- this.mutate({ endDelta: delta });
- }
- };
- EventApi.prototype.moveDates = function (deltaInput) {
- var delta = createDuration(deltaInput);
- if (delta) { // TODO: warning if parsed bad
- this.mutate({ datesDelta: delta });
- }
- };
- EventApi.prototype.setAllDay = function (allDay, options) {
- if (options === void 0) { options = {}; }
- var standardProps = { allDay: allDay };
- var maintainDuration = options.maintainDuration;
- if (maintainDuration == null) {
- maintainDuration = this._calendar.opt('allDayMaintainDuration');
- }
- if (this._def.allDay !== allDay) {
- standardProps.hasEnd = maintainDuration;
- }
- this.mutate({ standardProps: standardProps });
- };
- EventApi.prototype.formatRange = function (formatInput) {
- var dateEnv = this._calendar.dateEnv;
- var instance = this._instance;
- var formatter = createFormatter(formatInput, this._calendar.opt('defaultRangeSeparator'));
- if (this._def.hasEnd) {
- return dateEnv.formatRange(instance.range.start, instance.range.end, formatter, {
- forcedStartTzo: instance.forcedStartTzo,
- forcedEndTzo: instance.forcedEndTzo
- });
- }
- else {
- return dateEnv.format(instance.range.start, formatter, {
- forcedTzo: instance.forcedStartTzo
- });
- }
- };
- EventApi.prototype.mutate = function (mutation) {
- var def = this._def;
- var instance = this._instance;
- if (instance) {
- this._calendar.dispatch({
- type: 'MUTATE_EVENTS',
- instanceId: instance.instanceId,
- mutation: mutation,
- fromApi: true
- });
- var eventStore = this._calendar.state.eventStore;
- this._def = eventStore.defs[def.defId];
- this._instance = eventStore.instances[instance.instanceId];
- }
- };
- EventApi.prototype.remove = function () {
- this._calendar.dispatch({
- type: 'REMOVE_EVENT_DEF',
- defId: this._def.defId
- });
- };
- Object.defineProperty(EventApi.prototype, "source", {
- get: function () {
- var sourceId = this._def.sourceId;
- if (sourceId) {
- return new EventSourceApi(this._calendar, this._calendar.state.eventSources[sourceId]);
- }
- return null;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "start", {
- get: function () {
- return this._instance ?
- this._calendar.dateEnv.toDate(this._instance.range.start) :
- null;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "end", {
- get: function () {
- return (this._instance && this._def.hasEnd) ?
- this._calendar.dateEnv.toDate(this._instance.range.end) :
- null;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "id", {
- // computable props that all access the def
- // TODO: find a TypeScript-compatible way to do this at scale
- get: function () { return this._def.publicId; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "groupId", {
- get: function () { return this._def.groupId; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "allDay", {
- get: function () { return this._def.allDay; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "title", {
- get: function () { return this._def.title; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "url", {
- get: function () { return this._def.url; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "rendering", {
- get: function () { return this._def.rendering; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "startEditable", {
- get: function () { return this._def.ui.startEditable; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "durationEditable", {
- get: function () { return this._def.ui.durationEditable; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "constraint", {
- get: function () { return this._def.ui.constraints[0] || null; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "overlap", {
- get: function () { return this._def.ui.overlap; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "allow", {
- get: function () { return this._def.ui.allows[0] || null; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "backgroundColor", {
- get: function () { return this._def.ui.backgroundColor; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "borderColor", {
- get: function () { return this._def.ui.borderColor; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "textColor", {
- get: function () { return this._def.ui.textColor; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "classNames", {
- // NOTE: user can't modify these because Object.freeze was called in event-def parsing
- get: function () { return this._def.ui.classNames; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EventApi.prototype, "extendedProps", {
- get: function () { return this._def.extendedProps; },
- enumerable: true,
- configurable: true
- });
- return EventApi;
- }());
- /*
- Specifying nextDayThreshold signals that all-day ranges should be sliced.
- */
- function sliceEventStore(eventStore, eventUiBases, framingRange, nextDayThreshold) {
- var inverseBgByGroupId = {};
- var inverseBgByDefId = {};
- var defByGroupId = {};
- var bgRanges = [];
- var fgRanges = [];
- var eventUis = compileEventUis(eventStore.defs, eventUiBases);
- for (var defId in eventStore.defs) {
- var def = eventStore.defs[defId];
- if (def.rendering === 'inverse-background') {
- if (def.groupId) {
- inverseBgByGroupId[def.groupId] = [];
- if (!defByGroupId[def.groupId]) {
- defByGroupId[def.groupId] = def;
- }
- }
- else {
- inverseBgByDefId[defId] = [];
- }
- }
- }
- for (var instanceId in eventStore.instances) {
- var instance = eventStore.instances[instanceId];
- var def = eventStore.defs[instance.defId];
- var ui = eventUis[def.defId];
- var origRange = instance.range;
- var normalRange = (!def.allDay && nextDayThreshold) ?
- computeVisibleDayRange(origRange, nextDayThreshold) :
- origRange;
- var slicedRange = intersectRanges(normalRange, framingRange);
- if (slicedRange) {
- if (def.rendering === 'inverse-background') {
- if (def.groupId) {
- inverseBgByGroupId[def.groupId].push(slicedRange);
- }
- else {
- inverseBgByDefId[instance.defId].push(slicedRange);
- }
- }
- else {
- (def.rendering === 'background' ? bgRanges : fgRanges).push({
- def: def,
- ui: ui,
- instance: instance,
- range: slicedRange,
- isStart: normalRange.start && normalRange.start.valueOf() === slicedRange.start.valueOf(),
- isEnd: normalRange.end && normalRange.end.valueOf() === slicedRange.end.valueOf()
- });
- }
- }
- }
- for (var groupId in inverseBgByGroupId) { // BY GROUP
- var ranges = inverseBgByGroupId[groupId];
- var invertedRanges = invertRanges(ranges, framingRange);
- for (var _i = 0, invertedRanges_1 = invertedRanges; _i < invertedRanges_1.length; _i++) {
- var invertedRange = invertedRanges_1[_i];
- var def = defByGroupId[groupId];
- var ui = eventUis[def.defId];
- bgRanges.push({
- def: def,
- ui: ui,
- instance: null,
- range: invertedRange,
- isStart: false,
- isEnd: false
- });
- }
- }
- for (var defId in inverseBgByDefId) {
- var ranges = inverseBgByDefId[defId];
- var invertedRanges = invertRanges(ranges, framingRange);
- for (var _a = 0, invertedRanges_2 = invertedRanges; _a < invertedRanges_2.length; _a++) {
- var invertedRange = invertedRanges_2[_a];
- bgRanges.push({
- def: eventStore.defs[defId],
- ui: eventUis[defId],
- instance: null,
- range: invertedRange,
- isStart: false,
- isEnd: false
- });
- }
- }
- return { bg: bgRanges, fg: fgRanges };
- }
- function hasBgRendering(def) {
- return def.rendering === 'background' || def.rendering === 'inverse-background';
- }
- function filterSegsViaEls(context, segs, isMirror) {
- var calendar = context.calendar, view = context.view;
- if (calendar.hasPublicHandlers('eventRender')) {
- segs = segs.filter(function (seg) {
- var custom = calendar.publiclyTrigger('eventRender', [
- {
- event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
- isMirror: isMirror,
- isStart: seg.isStart,
- isEnd: seg.isEnd,
- // TODO: include seg.range once all components consistently generate it
- el: seg.el,
- view: view
- }
- ]);
- if (custom === false) { // means don't render at all
- return false;
- }
- else if (custom && custom !== true) {
- seg.el = custom;
- }
- return true;
- });
- }
- for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
- var seg = segs_1[_i];
- setElSeg(seg.el, seg);
- }
- return segs;
- }
- function setElSeg(el, seg) {
- el.fcSeg = seg;
- }
- function getElSeg(el) {
- return el.fcSeg || null;
- }
- // event ui computation
- function compileEventUis(eventDefs, eventUiBases) {
- return mapHash(eventDefs, function (eventDef) {
- return compileEventUi(eventDef, eventUiBases);
- });
- }
- function compileEventUi(eventDef, eventUiBases) {
- var uis = [];
- if (eventUiBases['']) {
- uis.push(eventUiBases['']);
- }
- if (eventUiBases[eventDef.defId]) {
- uis.push(eventUiBases[eventDef.defId]);
- }
- uis.push(eventDef.ui);
- return combineEventUis(uis);
- }
- // triggers
- function triggerRenderedSegs(context, segs, isMirrors) {
- var calendar = context.calendar, view = context.view;
- if (calendar.hasPublicHandlers('eventPositioned')) {
- for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
- var seg = segs_2[_i];
- calendar.publiclyTriggerAfterSizing('eventPositioned', [
- {
- event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
- isMirror: isMirrors,
- isStart: seg.isStart,
- isEnd: seg.isEnd,
- el: seg.el,
- view: view
- }
- ]);
- }
- }
- if (!calendar.state.loadingLevel) { // avoid initial empty state while pending
- calendar.afterSizingTriggers._eventsPositioned = [null]; // fire once
- }
- }
- function triggerWillRemoveSegs(context, segs, isMirrors) {
- var calendar = context.calendar, view = context.view;
- for (var _i = 0, segs_3 = segs; _i < segs_3.length; _i++) {
- var seg = segs_3[_i];
- calendar.trigger('eventElRemove', seg.el);
- }
- if (calendar.hasPublicHandlers('eventDestroy')) {
- for (var _a = 0, segs_4 = segs; _a < segs_4.length; _a++) {
- var seg = segs_4[_a];
- calendar.publiclyTrigger('eventDestroy', [
- {
- event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
- isMirror: isMirrors,
- el: seg.el,
- view: view
- }
- ]);
- }
- }
- }
- // is-interactable
- function computeEventDraggable(context, eventDef, eventUi) {
- var calendar = context.calendar, view = context.view;
- var transformers = calendar.pluginSystem.hooks.isDraggableTransformers;
- var val = eventUi.startEditable;
- for (var _i = 0, transformers_1 = transformers; _i < transformers_1.length; _i++) {
- var transformer = transformers_1[_i];
- val = transformer(val, eventDef, eventUi, view);
- }
- return val;
- }
- function computeEventStartResizable(context, eventDef, eventUi) {
- return eventUi.durationEditable && context.options.eventResizableFromStart;
- }
- function computeEventEndResizable(context, eventDef, eventUi) {
- return eventUi.durationEditable;
- }
- // applies the mutation to ALL defs/instances within the event store
- function applyMutationToEventStore(eventStore, eventConfigBase, mutation, calendar) {
- var eventConfigs = compileEventUis(eventStore.defs, eventConfigBase);
- var dest = createEmptyEventStore();
- for (var defId in eventStore.defs) {
- var def = eventStore.defs[defId];
- dest.defs[defId] = applyMutationToEventDef(def, eventConfigs[defId], mutation, calendar.pluginSystem.hooks.eventDefMutationAppliers, calendar);
- }
- for (var instanceId in eventStore.instances) {
- var instance = eventStore.instances[instanceId];
- var def = dest.defs[instance.defId]; // important to grab the newly modified def
- dest.instances[instanceId] = applyMutationToEventInstance(instance, def, eventConfigs[instance.defId], mutation, calendar);
- }
- return dest;
- }
- function applyMutationToEventDef(eventDef, eventConfig, mutation, appliers, calendar) {
- var standardProps = mutation.standardProps || {};
- // if hasEnd has not been specified, guess a good value based on deltas.
- // if duration will change, there's no way the default duration will persist,
- // and thus, we need to mark the event as having a real end
- if (standardProps.hasEnd == null &&
- eventConfig.durationEditable &&
- (mutation.startDelta || mutation.endDelta)) {
- standardProps.hasEnd = true; // TODO: is this mutation okay?
- }
- var copy = __assign({}, eventDef, standardProps, { ui: __assign({}, eventDef.ui, standardProps.ui) });
- if (mutation.extendedProps) {
- copy.extendedProps = __assign({}, copy.extendedProps, mutation.extendedProps);
- }
- for (var _i = 0, appliers_1 = appliers; _i < appliers_1.length; _i++) {
- var applier = appliers_1[_i];
- applier(copy, mutation, calendar);
- }
- if (!copy.hasEnd && calendar.opt('forceEventDuration')) {
- copy.hasEnd = true;
- }
- return copy;
- }
- function applyMutationToEventInstance(eventInstance, eventDef, // must first be modified by applyMutationToEventDef
- eventConfig, mutation, calendar) {
- var dateEnv = calendar.dateEnv;
- var forceAllDay = mutation.standardProps && mutation.standardProps.allDay === true;
- var clearEnd = mutation.standardProps && mutation.standardProps.hasEnd === false;
- var copy = __assign({}, eventInstance);
- if (forceAllDay) {
- copy.range = computeAlignedDayRange(copy.range);
- }
- if (mutation.datesDelta && eventConfig.startEditable) {
- copy.range = {
- start: dateEnv.add(copy.range.start, mutation.datesDelta),
- end: dateEnv.add(copy.range.end, mutation.datesDelta)
- };
- }
- if (mutation.startDelta && eventConfig.durationEditable) {
- copy.range = {
- start: dateEnv.add(copy.range.start, mutation.startDelta),
- end: copy.range.end
- };
- }
- if (mutation.endDelta && eventConfig.durationEditable) {
- copy.range = {
- start: copy.range.start,
- end: dateEnv.add(copy.range.end, mutation.endDelta)
- };
- }
- if (clearEnd) {
- copy.range = {
- start: copy.range.start,
- end: calendar.getDefaultEventEnd(eventDef.allDay, copy.range.start)
- };
- }
- // in case event was all-day but the supplied deltas were not
- // better util for this?
- if (eventDef.allDay) {
- copy.range = {
- start: startOfDay(copy.range.start),
- end: startOfDay(copy.range.end)
- };
- }
- // handle invalid durations
- if (copy.range.end < copy.range.start) {
- copy.range.end = calendar.getDefaultEventEnd(eventDef.allDay, copy.range.start);
- }
- return copy;
- }
- function reduceEventStore (eventStore, action, eventSources, dateProfile, calendar) {
- switch (action.type) {
- case 'RECEIVE_EVENTS': // raw
- return receiveRawEvents(eventStore, eventSources[action.sourceId], action.fetchId, action.fetchRange, action.rawEvents, calendar);
- case 'ADD_EVENTS': // already parsed, but not expanded
- return addEvent(eventStore, action.eventStore, // new ones
- dateProfile ? dateProfile.activeRange : null, calendar);
- case 'MERGE_EVENTS': // already parsed and expanded
- return mergeEventStores(eventStore, action.eventStore);
- case 'PREV': // TODO: how do we track all actions that affect dateProfile :(
- case 'NEXT':
- case 'SET_DATE':
- case 'SET_VIEW_TYPE':
- if (dateProfile) {
- return expandRecurring(eventStore, dateProfile.activeRange, calendar);
- }
- else {
- return eventStore;
- }
- case 'CHANGE_TIMEZONE':
- return rezoneDates(eventStore, action.oldDateEnv, calendar.dateEnv);
- case 'MUTATE_EVENTS':
- return applyMutationToRelated(eventStore, action.instanceId, action.mutation, action.fromApi, calendar);
- case 'REMOVE_EVENT_INSTANCES':
- return excludeInstances(eventStore, action.instances);
- case 'REMOVE_EVENT_DEF':
- return filterEventStoreDefs(eventStore, function (eventDef) {
- return eventDef.defId !== action.defId;
- });
- case 'REMOVE_EVENT_SOURCE':
- return excludeEventsBySourceId(eventStore, action.sourceId);
- case 'REMOVE_ALL_EVENT_SOURCES':
- return filterEventStoreDefs(eventStore, function (eventDef) {
- return !eventDef.sourceId; // only keep events with no source id
- });
- case 'REMOVE_ALL_EVENTS':
- return createEmptyEventStore();
- case 'RESET_EVENTS':
- return {
- defs: eventStore.defs,
- instances: eventStore.instances
- };
- default:
- return eventStore;
- }
- }
- function receiveRawEvents(eventStore, eventSource, fetchId, fetchRange, rawEvents, calendar) {
- if (eventSource && // not already removed
- fetchId === eventSource.latestFetchId // TODO: wish this logic was always in event-sources
- ) {
- var subset = parseEvents(transformRawEvents(rawEvents, eventSource, calendar), eventSource.sourceId, calendar);
- if (fetchRange) {
- subset = expandRecurring(subset, fetchRange, calendar);
- }
- return mergeEventStores(excludeEventsBySourceId(eventStore, eventSource.sourceId), subset);
- }
- return eventStore;
- }
- function addEvent(eventStore, subset, expandRange, calendar) {
- if (expandRange) {
- subset = expandRecurring(subset, expandRange, calendar);
- }
- return mergeEventStores(eventStore, subset);
- }
- function rezoneDates(eventStore, oldDateEnv, newDateEnv) {
- var defs = eventStore.defs;
- var instances = mapHash(eventStore.instances, function (instance) {
- var def = defs[instance.defId];
- if (def.allDay || def.recurringDef) {
- return instance; // isn't dependent on timezone
- }
- else {
- return __assign({}, instance, { range: {
- start: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.start, instance.forcedStartTzo)),
- end: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.end, instance.forcedEndTzo))
- }, forcedStartTzo: newDateEnv.canComputeOffset ? null : instance.forcedStartTzo, forcedEndTzo: newDateEnv.canComputeOffset ? null : instance.forcedEndTzo });
- }
- });
- return { defs: defs, instances: instances };
- }
- function applyMutationToRelated(eventStore, instanceId, mutation, fromApi, calendar) {
- var relevant = getRelevantEvents(eventStore, instanceId);
- var eventConfigBase = fromApi ?
- { '': {
- startEditable: true,
- durationEditable: true,
- constraints: [],
- overlap: null,
- allows: [],
- backgroundColor: '',
- borderColor: '',
- textColor: '',
- classNames: []
- } } :
- calendar.eventUiBases;
- relevant = applyMutationToEventStore(relevant, eventConfigBase, mutation, calendar);
- return mergeEventStores(eventStore, relevant);
- }
- function excludeEventsBySourceId(eventStore, sourceId) {
- return filterEventStoreDefs(eventStore, function (eventDef) {
- return eventDef.sourceId !== sourceId;
- });
- }
- // QUESTION: why not just return instances? do a general object-property-exclusion util
- function excludeInstances(eventStore, removals) {
- return {
- defs: eventStore.defs,
- instances: filterHash(eventStore.instances, function (instance) {
- return !removals[instance.instanceId];
- })
- };
- }
- // high-level segmenting-aware tester functions
- // ------------------------------------------------------------------------------------------------------------------------
- function isInteractionValid(interaction, calendar) {
- return isNewPropsValid({ eventDrag: interaction }, calendar); // HACK: the eventDrag props is used for ALL interactions
- }
- function isDateSelectionValid(dateSelection, calendar) {
- return isNewPropsValid({ dateSelection: dateSelection }, calendar);
- }
- function isNewPropsValid(newProps, calendar) {
- var view = calendar.view;
- var props = __assign({ businessHours: view ? view.props.businessHours : createEmptyEventStore(), dateSelection: '', eventStore: calendar.state.eventStore, eventUiBases: calendar.eventUiBases, eventSelection: '', eventDrag: null, eventResize: null }, newProps);
- return (calendar.pluginSystem.hooks.isPropsValid || isPropsValid)(props, calendar);
- }
- function isPropsValid(state, calendar, dateSpanMeta, filterConfig) {
- if (dateSpanMeta === void 0) { dateSpanMeta = {}; }
- if (state.eventDrag && !isInteractionPropsValid(state, calendar, dateSpanMeta, filterConfig)) {
- return false;
- }
- if (state.dateSelection && !isDateSelectionPropsValid(state, calendar, dateSpanMeta, filterConfig)) {
- return false;
- }
- return true;
- }
- // Moving Event Validation
- // ------------------------------------------------------------------------------------------------------------------------
- function isInteractionPropsValid(state, calendar, dateSpanMeta, filterConfig) {
- var interaction = state.eventDrag; // HACK: the eventDrag props is used for ALL interactions
- var subjectEventStore = interaction.mutatedEvents;
- var subjectDefs = subjectEventStore.defs;
- var subjectInstances = subjectEventStore.instances;
- var subjectConfigs = compileEventUis(subjectDefs, interaction.isEvent ?
- state.eventUiBases :
- { '': calendar.selectionConfig } // if not a real event, validate as a selection
- );
- if (filterConfig) {
- subjectConfigs = mapHash(subjectConfigs, filterConfig);
- }
- var otherEventStore = excludeInstances(state.eventStore, interaction.affectedEvents.instances); // exclude the subject events. TODO: exclude defs too?
- var otherDefs = otherEventStore.defs;
- var otherInstances = otherEventStore.instances;
- var otherConfigs = compileEventUis(otherDefs, state.eventUiBases);
- for (var subjectInstanceId in subjectInstances) {
- var subjectInstance = subjectInstances[subjectInstanceId];
- var subjectRange = subjectInstance.range;
- var subjectConfig = subjectConfigs[subjectInstance.defId];
- var subjectDef = subjectDefs[subjectInstance.defId];
- // constraint
- if (!allConstraintsPass(subjectConfig.constraints, subjectRange, otherEventStore, state.businessHours, calendar)) {
- return false;
- }
- // overlap
- var overlapFunc = calendar.opt('eventOverlap');
- if (typeof overlapFunc !== 'function') {
- overlapFunc = null;
- }
- for (var otherInstanceId in otherInstances) {
- var otherInstance = otherInstances[otherInstanceId];
- // intersect! evaluate
- if (rangesIntersect(subjectRange, otherInstance.range)) {
- var otherOverlap = otherConfigs[otherInstance.defId].overlap;
- // consider the other event's overlap. only do this if the subject event is a "real" event
- if (otherOverlap === false && interaction.isEvent) {
- return false;
- }
- if (subjectConfig.overlap === false) {
- return false;
- }
- if (overlapFunc && !overlapFunc(new EventApi(calendar, otherDefs[otherInstance.defId], otherInstance), // still event
- new EventApi(calendar, subjectDef, subjectInstance) // moving event
- )) {
- return false;
- }
- }
- }
- // allow (a function)
- var calendarEventStore = calendar.state.eventStore; // need global-to-calendar, not local to component (splittable)state
- for (var _i = 0, _a = subjectConfig.allows; _i < _a.length; _i++) {
- var subjectAllow = _a[_i];
- var subjectDateSpan = __assign({}, dateSpanMeta, { range: subjectInstance.range, allDay: subjectDef.allDay });
- var origDef = calendarEventStore.defs[subjectDef.defId];
- var origInstance = calendarEventStore.instances[subjectInstanceId];
- var eventApi = void 0;
- if (origDef) { // was previously in the calendar
- eventApi = new EventApi(calendar, origDef, origInstance);
- }
- else { // was an external event
- eventApi = new EventApi(calendar, subjectDef); // no instance, because had no dates
- }
- if (!subjectAllow(calendar.buildDateSpanApi(subjectDateSpan), eventApi)) {
- return false;
- }
- }
- }
- return true;
- }
- // Date Selection Validation
- // ------------------------------------------------------------------------------------------------------------------------
- function isDateSelectionPropsValid(state, calendar, dateSpanMeta, filterConfig) {
- var relevantEventStore = state.eventStore;
- var relevantDefs = relevantEventStore.defs;
- var relevantInstances = relevantEventStore.instances;
- var selection = state.dateSelection;
- var selectionRange = selection.range;
- var selectionConfig = calendar.selectionConfig;
- if (filterConfig) {
- selectionConfig = filterConfig(selectionConfig);
- }
- // constraint
- if (!allConstraintsPass(selectionConfig.constraints, selectionRange, relevantEventStore, state.businessHours, calendar)) {
- return false;
- }
- // overlap
- var overlapFunc = calendar.opt('selectOverlap');
- if (typeof overlapFunc !== 'function') {
- overlapFunc = null;
- }
- for (var relevantInstanceId in relevantInstances) {
- var relevantInstance = relevantInstances[relevantInstanceId];
- // intersect! evaluate
- if (rangesIntersect(selectionRange, relevantInstance.range)) {
- if (selectionConfig.overlap === false) {
- return false;
- }
- if (overlapFunc && !overlapFunc(new EventApi(calendar, relevantDefs[relevantInstance.defId], relevantInstance))) {
- return false;
- }
- }
- }
- // allow (a function)
- for (var _i = 0, _a = selectionConfig.allows; _i < _a.length; _i++) {
- var selectionAllow = _a[_i];
- var fullDateSpan = __assign({}, dateSpanMeta, selection);
- if (!selectionAllow(calendar.buildDateSpanApi(fullDateSpan), null)) {
- return false;
- }
- }
- return true;
- }
- // Constraint Utils
- // ------------------------------------------------------------------------------------------------------------------------
- function allConstraintsPass(constraints, subjectRange, otherEventStore, businessHoursUnexpanded, calendar) {
- for (var _i = 0, constraints_1 = constraints; _i < constraints_1.length; _i++) {
- var constraint = constraints_1[_i];
- if (!anyRangesContainRange(constraintToRanges(constraint, subjectRange, otherEventStore, businessHoursUnexpanded, calendar), subjectRange)) {
- return false;
- }
- }
- return true;
- }
- function constraintToRanges(constraint, subjectRange, // for expanding a recurring constraint, or expanding business hours
- otherEventStore, // for if constraint is an even group ID
- businessHoursUnexpanded, // for if constraint is 'businessHours'
- calendar // for expanding businesshours
- ) {
- if (constraint === 'businessHours') {
- return eventStoreToRanges(expandRecurring(businessHoursUnexpanded, subjectRange, calendar));
- }
- else if (typeof constraint === 'string') { // an group ID
- return eventStoreToRanges(filterEventStoreDefs(otherEventStore, function (eventDef) {
- return eventDef.groupId === constraint;
- }));
- }
- else if (typeof constraint === 'object' && constraint) { // non-null object
- return eventStoreToRanges(expandRecurring(constraint, subjectRange, calendar));
- }
- return []; // if it's false
- }
- // TODO: move to event-store file?
- function eventStoreToRanges(eventStore) {
- var instances = eventStore.instances;
- var ranges = [];
- for (var instanceId in instances) {
- ranges.push(instances[instanceId].range);
- }
- return ranges;
- }
- // TODO: move to geom file?
- function anyRangesContainRange(outerRanges, innerRange) {
- for (var _i = 0, outerRanges_1 = outerRanges; _i < outerRanges_1.length; _i++) {
- var outerRange = outerRanges_1[_i];
- if (rangeContainsRange(outerRange, innerRange)) {
- return true;
- }
- }
- return false;
- }
- // Parsing
- // ------------------------------------------------------------------------------------------------------------------------
- function normalizeConstraint(input, calendar) {
- if (Array.isArray(input)) {
- return parseEvents(input, '', calendar, true); // allowOpenRange=true
- }
- else if (typeof input === 'object' && input) { // non-null object
- return parseEvents([input], '', calendar, true); // allowOpenRange=true
- }
- else if (input != null) {
- return String(input);
- }
- else {
- return null;
- }
- }
- function htmlEscape(s) {
- return (s + '').replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/'/g, ''')
- .replace(/"/g, '"')
- .replace(/\n/g, '<br />');
- }
- // Given a hash of CSS properties, returns a string of CSS.
- // Uses property names as-is (no camel-case conversion). Will not make statements for null/undefined values.
- function cssToStr(cssProps) {
- var statements = [];
- for (var name_1 in cssProps) {
- var val = cssProps[name_1];
- if (val != null && val !== '') {
- statements.push(name_1 + ':' + val);
- }
- }
- return statements.join(';');
- }
- // Given an object hash of HTML attribute names to values,
- // generates a string that can be injected between < > in HTML
- function attrsToStr(attrs) {
- var parts = [];
- for (var name_2 in attrs) {
- var val = attrs[name_2];
- if (val != null) {
- parts.push(name_2 + '="' + htmlEscape(val) + '"');
- }
- }
- return parts.join(' ');
- }
- function parseClassName(raw) {
- if (Array.isArray(raw)) {
- return raw;
- }
- else if (typeof raw === 'string') {
- return raw.split(/\s+/);
- }
- else {
- return [];
- }
- }
- var UNSCOPED_EVENT_UI_PROPS = {
- editable: Boolean,
- startEditable: Boolean,
- durationEditable: Boolean,
- constraint: null,
- overlap: null,
- allow: null,
- className: parseClassName,
- classNames: parseClassName,
- color: String,
- backgroundColor: String,
- borderColor: String,
- textColor: String
- };
- function processUnscopedUiProps(rawProps, calendar, leftovers) {
- var props = refineProps(rawProps, UNSCOPED_EVENT_UI_PROPS, {}, leftovers);
- var constraint = normalizeConstraint(props.constraint, calendar);
- return {
- startEditable: props.startEditable != null ? props.startEditable : props.editable,
- durationEditable: props.durationEditable != null ? props.durationEditable : props.editable,
- constraints: constraint != null ? [constraint] : [],
- overlap: props.overlap,
- allows: props.allow != null ? [props.allow] : [],
- backgroundColor: props.backgroundColor || props.color,
- borderColor: props.borderColor || props.color,
- textColor: props.textColor,
- classNames: props.classNames.concat(props.className)
- };
- }
- function processScopedUiProps(prefix, rawScoped, calendar, leftovers) {
- var rawUnscoped = {};
- var wasFound = {};
- for (var key in UNSCOPED_EVENT_UI_PROPS) {
- var scopedKey = prefix + capitaliseFirstLetter(key);
- rawUnscoped[key] = rawScoped[scopedKey];
- wasFound[scopedKey] = true;
- }
- if (prefix === 'event') {
- rawUnscoped.editable = rawScoped.editable; // special case. there is no 'eventEditable', just 'editable'
- }
- if (leftovers) {
- for (var key in rawScoped) {
- if (!wasFound[key]) {
- leftovers[key] = rawScoped[key];
- }
- }
- }
- return processUnscopedUiProps(rawUnscoped, calendar);
- }
- var EMPTY_EVENT_UI = {
- startEditable: null,
- durationEditable: null,
- constraints: [],
- overlap: null,
- allows: [],
- backgroundColor: '',
- borderColor: '',
- textColor: '',
- classNames: []
- };
- // prevent against problems with <2 args!
- function combineEventUis(uis) {
- return uis.reduce(combineTwoEventUis, EMPTY_EVENT_UI);
- }
- function combineTwoEventUis(item0, item1) {
- return {
- startEditable: item1.startEditable != null ? item1.startEditable : item0.startEditable,
- durationEditable: item1.durationEditable != null ? item1.durationEditable : item0.durationEditable,
- constraints: item0.constraints.concat(item1.constraints),
- overlap: typeof item1.overlap === 'boolean' ? item1.overlap : item0.overlap,
- allows: item0.allows.concat(item1.allows),
- backgroundColor: item1.backgroundColor || item0.backgroundColor,
- borderColor: item1.borderColor || item0.borderColor,
- textColor: item1.textColor || item0.textColor,
- classNames: item0.classNames.concat(item1.classNames)
- };
- }
- var NON_DATE_PROPS = {
- id: String,
- groupId: String,
- title: String,
- url: String,
- rendering: String,
- extendedProps: null
- };
- var DATE_PROPS = {
- start: null,
- date: null,
- end: null,
- allDay: null
- };
- var uid = 0;
- function parseEvent(raw, sourceId, calendar, allowOpenRange) {
- var allDayDefault = computeIsAllDayDefault(sourceId, calendar);
- var leftovers0 = {};
- var recurringRes = parseRecurring(raw, // raw, but with single-event stuff stripped out
- allDayDefault, calendar.dateEnv, calendar.pluginSystem.hooks.recurringTypes, leftovers0 // will populate with non-recurring props
- );
- if (recurringRes) {
- var def = parseEventDef(leftovers0, sourceId, recurringRes.allDay, Boolean(recurringRes.duration), calendar);
- def.recurringDef = {
- typeId: recurringRes.typeId,
- typeData: recurringRes.typeData,
- duration: recurringRes.duration
- };
- return { def: def, instance: null };
- }
- else {
- var leftovers1 = {};
- var singleRes = parseSingle(raw, allDayDefault, calendar, leftovers1, allowOpenRange);
- if (singleRes) {
- var def = parseEventDef(leftovers1, sourceId, singleRes.allDay, singleRes.hasEnd, calendar);
- var instance = createEventInstance(def.defId, singleRes.range, singleRes.forcedStartTzo, singleRes.forcedEndTzo);
- return { def: def, instance: instance };
- }
- }
- return null;
- }
- /*
- Will NOT populate extendedProps with the leftover properties.
- Will NOT populate date-related props.
- The EventNonDateInput has been normalized (id => publicId, etc).
- */
- function parseEventDef(raw, sourceId, allDay, hasEnd, calendar) {
- var leftovers = {};
- var def = pluckNonDateProps(raw, calendar, leftovers);
- def.defId = String(uid++);
- def.sourceId = sourceId;
- def.allDay = allDay;
- def.hasEnd = hasEnd;
- for (var _i = 0, _a = calendar.pluginSystem.hooks.eventDefParsers; _i < _a.length; _i++) {
- var eventDefParser = _a[_i];
- var newLeftovers = {};
- eventDefParser(def, leftovers, newLeftovers);
- leftovers = newLeftovers;
- }
- def.extendedProps = __assign(leftovers, def.extendedProps || {});
- // help out EventApi from having user modify props
- Object.freeze(def.ui.classNames);
- Object.freeze(def.extendedProps);
- return def;
- }
- function createEventInstance(defId, range, forcedStartTzo, forcedEndTzo) {
- return {
- instanceId: String(uid++),
- defId: defId,
- range: range,
- forcedStartTzo: forcedStartTzo == null ? null : forcedStartTzo,
- forcedEndTzo: forcedEndTzo == null ? null : forcedEndTzo
- };
- }
- function parseSingle(raw, allDayDefault, calendar, leftovers, allowOpenRange) {
- var props = pluckDateProps(raw, leftovers);
- var allDay = props.allDay;
- var startMeta;
- var startMarker = null;
- var hasEnd = false;
- var endMeta;
- var endMarker = null;
- startMeta = calendar.dateEnv.createMarkerMeta(props.start);
- if (startMeta) {
- startMarker = startMeta.marker;
- }
- else if (!allowOpenRange) {
- return null;
- }
- if (props.end != null) {
- endMeta = calendar.dateEnv.createMarkerMeta(props.end);
- }
- if (allDay == null) {
- if (allDayDefault != null) {
- allDay = allDayDefault;
- }
- else {
- // fall back to the date props LAST
- allDay = (!startMeta || startMeta.isTimeUnspecified) &&
- (!endMeta || endMeta.isTimeUnspecified);
- }
- }
- if (allDay && startMarker) {
- startMarker = startOfDay(startMarker);
- }
- if (endMeta) {
- endMarker = endMeta.marker;
- if (allDay) {
- endMarker = startOfDay(endMarker);
- }
- if (startMarker && endMarker <= startMarker) {
- endMarker = null;
- }
- }
- if (endMarker) {
- hasEnd = true;
- }
- else if (!allowOpenRange) {
- hasEnd = calendar.opt('forceEventDuration') || false;
- endMarker = calendar.dateEnv.add(startMarker, allDay ?
- calendar.defaultAllDayEventDuration :
- calendar.defaultTimedEventDuration);
- }
- return {
- allDay: allDay,
- hasEnd: hasEnd,
- range: { start: startMarker, end: endMarker },
- forcedStartTzo: startMeta ? startMeta.forcedTzo : null,
- forcedEndTzo: endMeta ? endMeta.forcedTzo : null
- };
- }
- function pluckDateProps(raw, leftovers) {
- var props = refineProps(raw, DATE_PROPS, {}, leftovers);
- props.start = (props.start !== null) ? props.start : props.date;
- delete props.date;
- return props;
- }
- function pluckNonDateProps(raw, calendar, leftovers) {
- var preLeftovers = {};
- var props = refineProps(raw, NON_DATE_PROPS, {}, preLeftovers);
- var ui = processUnscopedUiProps(preLeftovers, calendar, leftovers);
- props.publicId = props.id;
- delete props.id;
- props.ui = ui;
- return props;
- }
- function computeIsAllDayDefault(sourceId, calendar) {
- var res = null;
- if (sourceId) {
- var source = calendar.state.eventSources[sourceId];
- res = source.allDayDefault;
- }
- if (res == null) {
- res = calendar.opt('allDayDefault');
- }
- return res;
- }
- var DEF_DEFAULTS = {
- startTime: '09:00',
- endTime: '17:00',
- daysOfWeek: [1, 2, 3, 4, 5],
- rendering: 'inverse-background',
- classNames: 'fc-nonbusiness',
- groupId: '_businessHours' // so multiple defs get grouped
- };
- /*
- TODO: pass around as EventDefHash!!!
- */
- function parseBusinessHours(input, calendar) {
- return parseEvents(refineInputs(input), '', calendar);
- }
- function refineInputs(input) {
- var rawDefs;
- if (input === true) {
- rawDefs = [{}]; // will get DEF_DEFAULTS verbatim
- }
- else if (Array.isArray(input)) {
- // if specifying an array, every sub-definition NEEDS a day-of-week
- rawDefs = input.filter(function (rawDef) {
- return rawDef.daysOfWeek;
- });
- }
- else if (typeof input === 'object' && input) { // non-null object
- rawDefs = [input];
- }
- else { // is probably false
- rawDefs = [];
- }
- rawDefs = rawDefs.map(function (rawDef) {
- return __assign({}, DEF_DEFAULTS, rawDef);
- });
- return rawDefs;
- }
- function memoizeRendering(renderFunc, unrenderFunc, dependencies) {
- if (dependencies === void 0) { dependencies = []; }
- var dependents = [];
- var thisContext;
- var prevArgs;
- function unrender() {
- if (prevArgs) {
- for (var _i = 0, dependents_1 = dependents; _i < dependents_1.length; _i++) {
- var dependent = dependents_1[_i];
- dependent.unrender();
- }
- if (unrenderFunc) {
- unrenderFunc.apply(thisContext, prevArgs);
- }
- prevArgs = null;
- }
- }
- function res() {
- if (!prevArgs || !isArraysEqual(prevArgs, arguments)) {
- unrender();
- thisContext = this;
- prevArgs = arguments;
- renderFunc.apply(this, arguments);
- }
- }
- res.dependents = dependents;
- res.unrender = unrender;
- for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) {
- var dependency = dependencies_1[_i];
- dependency.dependents.push(res);
- }
- return res;
- }
- var EMPTY_EVENT_STORE = createEmptyEventStore(); // for purecomponents. TODO: keep elsewhere
- var Splitter = /** @class */ (function () {
- function Splitter() {
- this.getKeysForEventDefs = memoize(this._getKeysForEventDefs);
- this.splitDateSelection = memoize(this._splitDateSpan);
- this.splitEventStore = memoize(this._splitEventStore);
- this.splitIndividualUi = memoize(this._splitIndividualUi);
- this.splitEventDrag = memoize(this._splitInteraction);
- this.splitEventResize = memoize(this._splitInteraction);
- this.eventUiBuilders = {}; // TODO: typescript protection
- }
- Splitter.prototype.splitProps = function (props) {
- var _this = this;
- var keyInfos = this.getKeyInfo(props);
- var defKeys = this.getKeysForEventDefs(props.eventStore);
- var dateSelections = this.splitDateSelection(props.dateSelection);
- var individualUi = this.splitIndividualUi(props.eventUiBases, defKeys); // the individual *bases*
- var eventStores = this.splitEventStore(props.eventStore, defKeys);
- var eventDrags = this.splitEventDrag(props.eventDrag);
- var eventResizes = this.splitEventResize(props.eventResize);
- var splitProps = {};
- this.eventUiBuilders = mapHash(keyInfos, function (info, key) {
- return _this.eventUiBuilders[key] || memoize(buildEventUiForKey);
- });
- for (var key in keyInfos) {
- var keyInfo = keyInfos[key];
- var eventStore = eventStores[key] || EMPTY_EVENT_STORE;
- var buildEventUi = this.eventUiBuilders[key];
- splitProps[key] = {
- businessHours: keyInfo.businessHours || props.businessHours,
- dateSelection: dateSelections[key] || null,
- eventStore: eventStore,
- eventUiBases: buildEventUi(props.eventUiBases[''], keyInfo.ui, individualUi[key]),
- eventSelection: eventStore.instances[props.eventSelection] ? props.eventSelection : '',
- eventDrag: eventDrags[key] || null,
- eventResize: eventResizes[key] || null
- };
- }
- return splitProps;
- };
- Splitter.prototype._splitDateSpan = function (dateSpan) {
- var dateSpans = {};
- if (dateSpan) {
- var keys = this.getKeysForDateSpan(dateSpan);
- for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
- var key = keys_1[_i];
- dateSpans[key] = dateSpan;
- }
- }
- return dateSpans;
- };
- Splitter.prototype._getKeysForEventDefs = function (eventStore) {
- var _this = this;
- return mapHash(eventStore.defs, function (eventDef) {
- return _this.getKeysForEventDef(eventDef);
- });
- };
- Splitter.prototype._splitEventStore = function (eventStore, defKeys) {
- var defs = eventStore.defs, instances = eventStore.instances;
- var splitStores = {};
- for (var defId in defs) {
- for (var _i = 0, _a = defKeys[defId]; _i < _a.length; _i++) {
- var key = _a[_i];
- if (!splitStores[key]) {
- splitStores[key] = createEmptyEventStore();
- }
- splitStores[key].defs[defId] = defs[defId];
- }
- }
- for (var instanceId in instances) {
- var instance = instances[instanceId];
- for (var _b = 0, _c = defKeys[instance.defId]; _b < _c.length; _b++) {
- var key = _c[_b];
- if (splitStores[key]) { // must have already been created
- splitStores[key].instances[instanceId] = instance;
- }
- }
- }
- return splitStores;
- };
- Splitter.prototype._splitIndividualUi = function (eventUiBases, defKeys) {
- var splitHashes = {};
- for (var defId in eventUiBases) {
- if (defId) { // not the '' key
- for (var _i = 0, _a = defKeys[defId]; _i < _a.length; _i++) {
- var key = _a[_i];
- if (!splitHashes[key]) {
- splitHashes[key] = {};
- }
- splitHashes[key][defId] = eventUiBases[defId];
- }
- }
- }
- return splitHashes;
- };
- Splitter.prototype._splitInteraction = function (interaction) {
- var splitStates = {};
- if (interaction) {
- var affectedStores_1 = this._splitEventStore(interaction.affectedEvents, this._getKeysForEventDefs(interaction.affectedEvents) // can't use cached. might be events from other calendar
- );
- // can't rely on defKeys because event data is mutated
- var mutatedKeysByDefId = this._getKeysForEventDefs(interaction.mutatedEvents);
- var mutatedStores_1 = this._splitEventStore(interaction.mutatedEvents, mutatedKeysByDefId);
- var populate = function (key) {
- if (!splitStates[key]) {
- splitStates[key] = {
- affectedEvents: affectedStores_1[key] || EMPTY_EVENT_STORE,
- mutatedEvents: mutatedStores_1[key] || EMPTY_EVENT_STORE,
- isEvent: interaction.isEvent,
- origSeg: interaction.origSeg
- };
- }
- };
- for (var key in affectedStores_1) {
- populate(key);
- }
- for (var key in mutatedStores_1) {
- populate(key);
- }
- }
- return splitStates;
- };
- return Splitter;
- }());
- function buildEventUiForKey(allUi, eventUiForKey, individualUi) {
- var baseParts = [];
- if (allUi) {
- baseParts.push(allUi);
- }
- if (eventUiForKey) {
- baseParts.push(eventUiForKey);
- }
- var stuff = {
- '': combineEventUis(baseParts)
- };
- if (individualUi) {
- __assign(stuff, individualUi);
- }
- return stuff;
- }
- // Generates HTML for an anchor to another view into the calendar.
- // Will either generate an <a> tag or a non-clickable <span> tag, depending on enabled settings.
- // `gotoOptions` can either be a DateMarker, or an object with the form:
- // { date, type, forceOff }
- // `type` is a view-type like "day" or "week". default value is "day".
- // `attrs` and `innerHtml` are use to generate the rest of the HTML tag.
- function buildGotoAnchorHtml(allOptions, dateEnv, gotoOptions, attrs, innerHtml) {
- var date;
- var type;
- var forceOff;
- var finalOptions;
- if (gotoOptions instanceof Date) {
- date = gotoOptions; // a single date-like input
- }
- else {
- date = gotoOptions.date;
- type = gotoOptions.type;
- forceOff = gotoOptions.forceOff;
- }
- finalOptions = {
- date: dateEnv.formatIso(date, { omitTime: true }),
- type: type || 'day'
- };
- if (typeof attrs === 'string') {
- innerHtml = attrs;
- attrs = null;
- }
- attrs = attrs ? ' ' + attrsToStr(attrs) : ''; // will have a leading space
- innerHtml = innerHtml || '';
- if (!forceOff && allOptions.navLinks) {
- return '<a' + attrs +
- ' data-goto="' + htmlEscape(JSON.stringify(finalOptions)) + '">' +
- innerHtml +
- '</a>';
- }
- else {
- return '<span' + attrs + '>' +
- innerHtml +
- '</span>';
- }
- }
- function getAllDayHtml(allOptions) {
- return allOptions.allDayHtml || htmlEscape(allOptions.allDayText);
- }
- // Computes HTML classNames for a single-day element
- function getDayClasses(date, dateProfile, context, noThemeHighlight) {
- var calendar = context.calendar, options = context.options, theme = context.theme, dateEnv = context.dateEnv;
- var classes = [];
- var todayStart;
- var todayEnd;
- if (!rangeContainsMarker(dateProfile.activeRange, date)) {
- classes.push('fc-disabled-day');
- }
- else {
- classes.push('fc-' + DAY_IDS[date.getUTCDay()]);
- if (options.monthMode &&
- dateEnv.getMonth(date) !== dateEnv.getMonth(dateProfile.currentRange.start)) {
- classes.push('fc-other-month');
- }
- todayStart = startOfDay(calendar.getNow());
- todayEnd = addDays(todayStart, 1);
- if (date < todayStart) {
- classes.push('fc-past');
- }
- else if (date >= todayEnd) {
- classes.push('fc-future');
- }
- else {
- classes.push('fc-today');
- if (noThemeHighlight !== true) {
- classes.push(theme.getClass('today'));
- }
- }
- }
- return classes;
- }
- // given a function that resolves a result asynchronously.
- // the function can either call passed-in success and failure callbacks,
- // or it can return a promise.
- // if you need to pass additional params to func, bind them first.
- function unpromisify(func, success, failure) {
- // guard against success/failure callbacks being called more than once
- // and guard against a promise AND callback being used together.
- var isResolved = false;
- var wrappedSuccess = function () {
- if (!isResolved) {
- isResolved = true;
- success.apply(this, arguments);
- }
- };
- var wrappedFailure = function () {
- if (!isResolved) {
- isResolved = true;
- if (failure) {
- failure.apply(this, arguments);
- }
- }
- };
- var res = func(wrappedSuccess, wrappedFailure);
- if (res && typeof res.then === 'function') {
- res.then(wrappedSuccess, wrappedFailure);
- }
- }
- var Mixin = /** @class */ (function () {
- function Mixin() {
- }
- // mix into a CLASS
- Mixin.mixInto = function (destClass) {
- this.mixIntoObj(destClass.prototype);
- };
- // mix into ANY object
- Mixin.mixIntoObj = function (destObj) {
- var _this = this;
- Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
- if (!destObj[name]) { // if destination doesn't already define it
- destObj[name] = _this.prototype[name];
- }
- });
- };
- /*
- will override existing methods
- TODO: remove! not used anymore
- */
- Mixin.mixOver = function (destClass) {
- var _this = this;
- Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
- destClass.prototype[name] = _this.prototype[name];
- });
- };
- return Mixin;
- }());
- /*
- USAGE:
- import { default as EmitterMixin, EmitterInterface } from './EmitterMixin'
- in class:
- on: EmitterInterface['on']
- one: EmitterInterface['one']
- off: EmitterInterface['off']
- trigger: EmitterInterface['trigger']
- triggerWith: EmitterInterface['triggerWith']
- hasHandlers: EmitterInterface['hasHandlers']
- after class:
- EmitterMixin.mixInto(TheClass)
- */
- var EmitterMixin = /** @class */ (function (_super) {
- __extends(EmitterMixin, _super);
- function EmitterMixin() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- EmitterMixin.prototype.on = function (type, handler) {
- addToHash(this._handlers || (this._handlers = {}), type, handler);
- return this; // for chaining
- };
- // todo: add comments
- EmitterMixin.prototype.one = function (type, handler) {
- addToHash(this._oneHandlers || (this._oneHandlers = {}), type, handler);
- return this; // for chaining
- };
- EmitterMixin.prototype.off = function (type, handler) {
- if (this._handlers) {
- removeFromHash(this._handlers, type, handler);
- }
- if (this._oneHandlers) {
- removeFromHash(this._oneHandlers, type, handler);
- }
- return this; // for chaining
- };
- EmitterMixin.prototype.trigger = function (type) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- this.triggerWith(type, this, args);
- return this; // for chaining
- };
- EmitterMixin.prototype.triggerWith = function (type, context, args) {
- if (this._handlers) {
- applyAll(this._handlers[type], context, args);
- }
- if (this._oneHandlers) {
- applyAll(this._oneHandlers[type], context, args);
- delete this._oneHandlers[type]; // will never fire again
- }
- return this; // for chaining
- };
- EmitterMixin.prototype.hasHandlers = function (type) {
- return (this._handlers && this._handlers[type] && this._handlers[type].length) ||
- (this._oneHandlers && this._oneHandlers[type] && this._oneHandlers[type].length);
- };
- return EmitterMixin;
- }(Mixin));
- function addToHash(hash, type, handler) {
- (hash[type] || (hash[type] = []))
- .push(handler);
- }
- function removeFromHash(hash, type, handler) {
- if (handler) {
- if (hash[type]) {
- hash[type] = hash[type].filter(function (func) {
- return func !== handler;
- });
- }
- }
- else {
- delete hash[type]; // remove all handler funcs for this type
- }
- }
- /*
- Records offset information for a set of elements, relative to an origin element.
- Can record the left/right OR the top/bottom OR both.
- Provides methods for querying the cache by position.
- */
- var PositionCache = /** @class */ (function () {
- function PositionCache(originEl, els, isHorizontal, isVertical) {
- this.originEl = originEl;
- this.els = els;
- this.isHorizontal = isHorizontal;
- this.isVertical = isVertical;
- }
- // Queries the els for coordinates and stores them.
- // Call this method before using and of the get* methods below.
- PositionCache.prototype.build = function () {
- var originEl = this.originEl;
- var originClientRect = this.originClientRect =
- originEl.getBoundingClientRect(); // relative to viewport top-left
- if (this.isHorizontal) {
- this.buildElHorizontals(originClientRect.left);
- }
- if (this.isVertical) {
- this.buildElVerticals(originClientRect.top);
- }
- };
- // Populates the left/right internal coordinate arrays
- PositionCache.prototype.buildElHorizontals = function (originClientLeft) {
- var lefts = [];
- var rights = [];
- for (var _i = 0, _a = this.els; _i < _a.length; _i++) {
- var el = _a[_i];
- var rect = el.getBoundingClientRect();
- lefts.push(rect.left - originClientLeft);
- rights.push(rect.right - originClientLeft);
- }
- this.lefts = lefts;
- this.rights = rights;
- };
- // Populates the top/bottom internal coordinate arrays
- PositionCache.prototype.buildElVerticals = function (originClientTop) {
- var tops = [];
- var bottoms = [];
- for (var _i = 0, _a = this.els; _i < _a.length; _i++) {
- var el = _a[_i];
- var rect = el.getBoundingClientRect();
- tops.push(rect.top - originClientTop);
- bottoms.push(rect.bottom - originClientTop);
- }
- this.tops = tops;
- this.bottoms = bottoms;
- };
- // Given a left offset (from document left), returns the index of the el that it horizontally intersects.
- // If no intersection is made, returns undefined.
- PositionCache.prototype.leftToIndex = function (leftPosition) {
- var lefts = this.lefts;
- var rights = this.rights;
- var len = lefts.length;
- var i;
- for (i = 0; i < len; i++) {
- if (leftPosition >= lefts[i] && leftPosition < rights[i]) {
- return i;
- }
- }
- };
- // Given a top offset (from document top), returns the index of the el that it vertically intersects.
- // If no intersection is made, returns undefined.
- PositionCache.prototype.topToIndex = function (topPosition) {
- var tops = this.tops;
- var bottoms = this.bottoms;
- var len = tops.length;
- var i;
- for (i = 0; i < len; i++) {
- if (topPosition >= tops[i] && topPosition < bottoms[i]) {
- return i;
- }
- }
- };
- // Gets the width of the element at the given index
- PositionCache.prototype.getWidth = function (leftIndex) {
- return this.rights[leftIndex] - this.lefts[leftIndex];
- };
- // Gets the height of the element at the given index
- PositionCache.prototype.getHeight = function (topIndex) {
- return this.bottoms[topIndex] - this.tops[topIndex];
- };
- return PositionCache;
- }());
- /*
- An object for getting/setting scroll-related information for an element.
- Internally, this is done very differently for window versus DOM element,
- so this object serves as a common interface.
- */
- var ScrollController = /** @class */ (function () {
- function ScrollController() {
- }
- ScrollController.prototype.getMaxScrollTop = function () {
- return this.getScrollHeight() - this.getClientHeight();
- };
- ScrollController.prototype.getMaxScrollLeft = function () {
- return this.getScrollWidth() - this.getClientWidth();
- };
- ScrollController.prototype.canScrollVertically = function () {
- return this.getMaxScrollTop() > 0;
- };
- ScrollController.prototype.canScrollHorizontally = function () {
- return this.getMaxScrollLeft() > 0;
- };
- ScrollController.prototype.canScrollUp = function () {
- return this.getScrollTop() > 0;
- };
- ScrollController.prototype.canScrollDown = function () {
- return this.getScrollTop() < this.getMaxScrollTop();
- };
- ScrollController.prototype.canScrollLeft = function () {
- return this.getScrollLeft() > 0;
- };
- ScrollController.prototype.canScrollRight = function () {
- return this.getScrollLeft() < this.getMaxScrollLeft();
- };
- return ScrollController;
- }());
- var ElementScrollController = /** @class */ (function (_super) {
- __extends(ElementScrollController, _super);
- function ElementScrollController(el) {
- var _this = _super.call(this) || this;
- _this.el = el;
- return _this;
- }
- ElementScrollController.prototype.getScrollTop = function () {
- return this.el.scrollTop;
- };
- ElementScrollController.prototype.getScrollLeft = function () {
- return this.el.scrollLeft;
- };
- ElementScrollController.prototype.setScrollTop = function (top) {
- this.el.scrollTop = top;
- };
- ElementScrollController.prototype.setScrollLeft = function (left) {
- this.el.scrollLeft = left;
- };
- ElementScrollController.prototype.getScrollWidth = function () {
- return this.el.scrollWidth;
- };
- ElementScrollController.prototype.getScrollHeight = function () {
- return this.el.scrollHeight;
- };
- ElementScrollController.prototype.getClientHeight = function () {
- return this.el.clientHeight;
- };
- ElementScrollController.prototype.getClientWidth = function () {
- return this.el.clientWidth;
- };
- return ElementScrollController;
- }(ScrollController));
- var WindowScrollController = /** @class */ (function (_super) {
- __extends(WindowScrollController, _super);
- function WindowScrollController() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- WindowScrollController.prototype.getScrollTop = function () {
- return window.pageYOffset;
- };
- WindowScrollController.prototype.getScrollLeft = function () {
- return window.pageXOffset;
- };
- WindowScrollController.prototype.setScrollTop = function (n) {
- window.scroll(window.pageXOffset, n);
- };
- WindowScrollController.prototype.setScrollLeft = function (n) {
- window.scroll(n, window.pageYOffset);
- };
- WindowScrollController.prototype.getScrollWidth = function () {
- return document.documentElement.scrollWidth;
- };
- WindowScrollController.prototype.getScrollHeight = function () {
- return document.documentElement.scrollHeight;
- };
- WindowScrollController.prototype.getClientHeight = function () {
- return document.documentElement.clientHeight;
- };
- WindowScrollController.prototype.getClientWidth = function () {
- return document.documentElement.clientWidth;
- };
- return WindowScrollController;
- }(ScrollController));
- /*
- Embodies a div that has potential scrollbars
- */
- var ScrollComponent = /** @class */ (function (_super) {
- __extends(ScrollComponent, _super);
- function ScrollComponent(overflowX, overflowY) {
- var _this = _super.call(this, createElement('div', {
- className: 'fc-scroller'
- })) || this;
- _this.overflowX = overflowX;
- _this.overflowY = overflowY;
- _this.applyOverflow();
- return _this;
- }
- // sets to natural height, unlocks overflow
- ScrollComponent.prototype.clear = function () {
- this.setHeight('auto');
- this.applyOverflow();
- };
- ScrollComponent.prototype.destroy = function () {
- removeElement(this.el);
- };
- // Overflow
- // -----------------------------------------------------------------------------------------------------------------
- ScrollComponent.prototype.applyOverflow = function () {
- applyStyle(this.el, {
- overflowX: this.overflowX,
- overflowY: this.overflowY
- });
- };
- // Causes any 'auto' overflow values to resolves to 'scroll' or 'hidden'.
- // Useful for preserving scrollbar widths regardless of future resizes.
- // Can pass in scrollbarWidths for optimization.
- ScrollComponent.prototype.lockOverflow = function (scrollbarWidths) {
- var overflowX = this.overflowX;
- var overflowY = this.overflowY;
- scrollbarWidths = scrollbarWidths || this.getScrollbarWidths();
- if (overflowX === 'auto') {
- overflowX = (scrollbarWidths.bottom || // horizontal scrollbars?
- this.canScrollHorizontally() // OR scrolling pane with massless scrollbars?
- ) ? 'scroll' : 'hidden';
- }
- if (overflowY === 'auto') {
- overflowY = (scrollbarWidths.left || scrollbarWidths.right || // horizontal scrollbars?
- this.canScrollVertically() // OR scrolling pane with massless scrollbars?
- ) ? 'scroll' : 'hidden';
- }
- applyStyle(this.el, { overflowX: overflowX, overflowY: overflowY });
- };
- ScrollComponent.prototype.setHeight = function (height) {
- applyStyleProp(this.el, 'height', height);
- };
- ScrollComponent.prototype.getScrollbarWidths = function () {
- var edges = computeEdges(this.el);
- return {
- left: edges.scrollbarLeft,
- right: edges.scrollbarRight,
- bottom: edges.scrollbarBottom
- };
- };
- return ScrollComponent;
- }(ElementScrollController));
- var Theme = /** @class */ (function () {
- function Theme(calendarOptions) {
- this.calendarOptions = calendarOptions;
- this.processIconOverride();
- }
- Theme.prototype.processIconOverride = function () {
- if (this.iconOverrideOption) {
- this.setIconOverride(this.calendarOptions[this.iconOverrideOption]);
- }
- };
- Theme.prototype.setIconOverride = function (iconOverrideHash) {
- var iconClassesCopy;
- var buttonName;
- if (typeof iconOverrideHash === 'object' && iconOverrideHash) { // non-null object
- iconClassesCopy = __assign({}, this.iconClasses);
- for (buttonName in iconOverrideHash) {
- iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]);
- }
- this.iconClasses = iconClassesCopy;
- }
- else if (iconOverrideHash === false) {
- this.iconClasses = {};
- }
- };
- Theme.prototype.applyIconOverridePrefix = function (className) {
- var prefix = this.iconOverridePrefix;
- if (prefix && className.indexOf(prefix) !== 0) { // if not already present
- className = prefix + className;
- }
- return className;
- };
- Theme.prototype.getClass = function (key) {
- return this.classes[key] || '';
- };
- Theme.prototype.getIconClass = function (buttonName) {
- var className = this.iconClasses[buttonName];
- if (className) {
- return this.baseIconClass + ' ' + className;
- }
- return '';
- };
- Theme.prototype.getCustomButtonIconClass = function (customButtonProps) {
- var className;
- if (this.iconOverrideCustomButtonOption) {
- className = customButtonProps[this.iconOverrideCustomButtonOption];
- if (className) {
- return this.baseIconClass + ' ' + this.applyIconOverridePrefix(className);
- }
- }
- return '';
- };
- return Theme;
- }());
- Theme.prototype.classes = {};
- Theme.prototype.iconClasses = {};
- Theme.prototype.baseIconClass = '';
- Theme.prototype.iconOverridePrefix = '';
- var guid = 0;
- var ComponentContext = /** @class */ (function () {
- function ComponentContext(calendar, theme, dateEnv, options, view) {
- this.calendar = calendar;
- this.theme = theme;
- this.dateEnv = dateEnv;
- this.options = options;
- this.view = view;
- this.isRtl = options.dir === 'rtl';
- this.eventOrderSpecs = parseFieldSpecs(options.eventOrder);
- this.nextDayThreshold = createDuration(options.nextDayThreshold);
- }
- ComponentContext.prototype.extend = function (options, view) {
- return new ComponentContext(this.calendar, this.theme, this.dateEnv, options || this.options, view || this.view);
- };
- return ComponentContext;
- }());
- var Component = /** @class */ (function () {
- function Component() {
- this.uid = String(guid++);
- }
- Component.addEqualityFuncs = function (newFuncs) {
- this.prototype.equalityFuncs = __assign({}, this.prototype.equalityFuncs, newFuncs);
- };
- Component.prototype.receiveProps = function (props, context) {
- var oldContext = this.context;
- this.context = context;
- if (!oldContext) {
- this.firstContext(context);
- }
- var _a = recycleProps(this.props || {}, props, this.equalityFuncs), anyChanges = _a.anyChanges, comboProps = _a.comboProps;
- this.props = comboProps;
- if (anyChanges) {
- if (oldContext) {
- this.beforeUpdate();
- }
- this.render(comboProps, context);
- if (oldContext) {
- this.afterUpdate();
- }
- }
- };
- Component.prototype.render = function (props, context) {
- };
- Component.prototype.firstContext = function (context) {
- };
- Component.prototype.beforeUpdate = function () {
- };
- Component.prototype.afterUpdate = function () {
- };
- // after destroy is called, this component won't ever be used again
- Component.prototype.destroy = function () {
- };
- return Component;
- }());
- Component.prototype.equalityFuncs = {};
- /*
- Reuses old values when equal. If anything is unequal, returns newProps as-is.
- Great for PureComponent, but won't be feasible with React, so just eliminate and use React's DOM diffing.
- */
- function recycleProps(oldProps, newProps, equalityFuncs) {
- var comboProps = {}; // some old, some new
- var anyChanges = false;
- for (var key in newProps) {
- if (key in oldProps && (oldProps[key] === newProps[key] ||
- (equalityFuncs[key] && equalityFuncs[key](oldProps[key], newProps[key])))) {
- // equal to old? use old prop
- comboProps[key] = oldProps[key];
- }
- else {
- comboProps[key] = newProps[key];
- anyChanges = true;
- }
- }
- for (var key in oldProps) {
- if (!(key in newProps)) {
- anyChanges = true;
- break;
- }
- }
- return { anyChanges: anyChanges, comboProps: comboProps };
- }
- /*
- PURPOSES:
- - hook up to fg, fill, and mirror renderers
- - interface for dragging and hits
- */
- var DateComponent = /** @class */ (function (_super) {
- __extends(DateComponent, _super);
- function DateComponent(el) {
- var _this = _super.call(this) || this;
- _this.el = el;
- return _this;
- }
- DateComponent.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- removeElement(this.el);
- };
- // Hit System
- // -----------------------------------------------------------------------------------------------------------------
- DateComponent.prototype.buildPositionCaches = function () {
- };
- DateComponent.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) {
- return null; // this should be abstract
- };
- // Validation
- // -----------------------------------------------------------------------------------------------------------------
- DateComponent.prototype.isInteractionValid = function (interaction) {
- var calendar = this.context.calendar;
- var dateProfile = this.props.dateProfile; // HACK
- var instances = interaction.mutatedEvents.instances;
- if (dateProfile) { // HACK for DayTile
- for (var instanceId in instances) {
- if (!rangeContainsRange(dateProfile.validRange, instances[instanceId].range)) {
- return false;
- }
- }
- }
- return isInteractionValid(interaction, calendar);
- };
- DateComponent.prototype.isDateSelectionValid = function (selection) {
- var calendar = this.context.calendar;
- var dateProfile = this.props.dateProfile; // HACK
- if (dateProfile && // HACK for DayTile
- !rangeContainsRange(dateProfile.validRange, selection.range)) {
- return false;
- }
- return isDateSelectionValid(selection, calendar);
- };
- // Pointer Interaction Utils
- // -----------------------------------------------------------------------------------------------------------------
- DateComponent.prototype.isValidSegDownEl = function (el) {
- return !this.props.eventDrag && // HACK
- !this.props.eventResize && // HACK
- !elementClosest(el, '.fc-mirror') &&
- (this.isPopover() || !this.isInPopover(el));
- // ^above line ensures we don't detect a seg interaction within a nested component.
- // it's a HACK because it only supports a popover as the nested component.
- };
- DateComponent.prototype.isValidDateDownEl = function (el) {
- var segEl = elementClosest(el, this.fgSegSelector);
- return (!segEl || segEl.classList.contains('fc-mirror')) &&
- !elementClosest(el, '.fc-more') && // a "more.." link
- !elementClosest(el, 'a[data-goto]') && // a clickable nav link
- !this.isInPopover(el);
- };
- DateComponent.prototype.isPopover = function () {
- return this.el.classList.contains('fc-popover');
- };
- DateComponent.prototype.isInPopover = function (el) {
- return Boolean(elementClosest(el, '.fc-popover'));
- };
- return DateComponent;
- }(Component));
- DateComponent.prototype.fgSegSelector = '.fc-event-container > *';
- DateComponent.prototype.bgSegSelector = '.fc-bgevent:not(.fc-nonbusiness)';
- var uid$1 = 0;
- function createPlugin(input) {
- return {
- id: String(uid$1++),
- deps: input.deps || [],
- reducers: input.reducers || [],
- eventDefParsers: input.eventDefParsers || [],
- isDraggableTransformers: input.isDraggableTransformers || [],
- eventDragMutationMassagers: input.eventDragMutationMassagers || [],
- eventDefMutationAppliers: input.eventDefMutationAppliers || [],
- dateSelectionTransformers: input.dateSelectionTransformers || [],
- datePointTransforms: input.datePointTransforms || [],
- dateSpanTransforms: input.dateSpanTransforms || [],
- views: input.views || {},
- viewPropsTransformers: input.viewPropsTransformers || [],
- isPropsValid: input.isPropsValid || null,
- externalDefTransforms: input.externalDefTransforms || [],
- eventResizeJoinTransforms: input.eventResizeJoinTransforms || [],
- viewContainerModifiers: input.viewContainerModifiers || [],
- eventDropTransformers: input.eventDropTransformers || [],
- componentInteractions: input.componentInteractions || [],
- calendarInteractions: input.calendarInteractions || [],
- themeClasses: input.themeClasses || {},
- eventSourceDefs: input.eventSourceDefs || [],
- cmdFormatter: input.cmdFormatter,
- recurringTypes: input.recurringTypes || [],
- namedTimeZonedImpl: input.namedTimeZonedImpl,
- defaultView: input.defaultView || '',
- elementDraggingImpl: input.elementDraggingImpl,
- optionChangeHandlers: input.optionChangeHandlers || {}
- };
- }
- var PluginSystem = /** @class */ (function () {
- function PluginSystem() {
- this.hooks = {
- reducers: [],
- eventDefParsers: [],
- isDraggableTransformers: [],
- eventDragMutationMassagers: [],
- eventDefMutationAppliers: [],
- dateSelectionTransformers: [],
- datePointTransforms: [],
- dateSpanTransforms: [],
- views: {},
- viewPropsTransformers: [],
- isPropsValid: null,
- externalDefTransforms: [],
- eventResizeJoinTransforms: [],
- viewContainerModifiers: [],
- eventDropTransformers: [],
- componentInteractions: [],
- calendarInteractions: [],
- themeClasses: {},
- eventSourceDefs: [],
- cmdFormatter: null,
- recurringTypes: [],
- namedTimeZonedImpl: null,
- defaultView: '',
- elementDraggingImpl: null,
- optionChangeHandlers: {}
- };
- this.addedHash = {};
- }
- PluginSystem.prototype.add = function (plugin) {
- if (!this.addedHash[plugin.id]) {
- this.addedHash[plugin.id] = true;
- for (var _i = 0, _a = plugin.deps; _i < _a.length; _i++) {
- var dep = _a[_i];
- this.add(dep);
- }
- this.hooks = combineHooks(this.hooks, plugin);
- }
- };
- return PluginSystem;
- }());
- function combineHooks(hooks0, hooks1) {
- return {
- reducers: hooks0.reducers.concat(hooks1.reducers),
- eventDefParsers: hooks0.eventDefParsers.concat(hooks1.eventDefParsers),
- isDraggableTransformers: hooks0.isDraggableTransformers.concat(hooks1.isDraggableTransformers),
- eventDragMutationMassagers: hooks0.eventDragMutationMassagers.concat(hooks1.eventDragMutationMassagers),
- eventDefMutationAppliers: hooks0.eventDefMutationAppliers.concat(hooks1.eventDefMutationAppliers),
- dateSelectionTransformers: hooks0.dateSelectionTransformers.concat(hooks1.dateSelectionTransformers),
- datePointTransforms: hooks0.datePointTransforms.concat(hooks1.datePointTransforms),
- dateSpanTransforms: hooks0.dateSpanTransforms.concat(hooks1.dateSpanTransforms),
- views: __assign({}, hooks0.views, hooks1.views),
- viewPropsTransformers: hooks0.viewPropsTransformers.concat(hooks1.viewPropsTransformers),
- isPropsValid: hooks1.isPropsValid || hooks0.isPropsValid,
- externalDefTransforms: hooks0.externalDefTransforms.concat(hooks1.externalDefTransforms),
- eventResizeJoinTransforms: hooks0.eventResizeJoinTransforms.concat(hooks1.eventResizeJoinTransforms),
- viewContainerModifiers: hooks0.viewContainerModifiers.concat(hooks1.viewContainerModifiers),
- eventDropTransformers: hooks0.eventDropTransformers.concat(hooks1.eventDropTransformers),
- calendarInteractions: hooks0.calendarInteractions.concat(hooks1.calendarInteractions),
- componentInteractions: hooks0.componentInteractions.concat(hooks1.componentInteractions),
- themeClasses: __assign({}, hooks0.themeClasses, hooks1.themeClasses),
- eventSourceDefs: hooks0.eventSourceDefs.concat(hooks1.eventSourceDefs),
- cmdFormatter: hooks1.cmdFormatter || hooks0.cmdFormatter,
- recurringTypes: hooks0.recurringTypes.concat(hooks1.recurringTypes),
- namedTimeZonedImpl: hooks1.namedTimeZonedImpl || hooks0.namedTimeZonedImpl,
- defaultView: hooks0.defaultView || hooks1.defaultView,
- elementDraggingImpl: hooks0.elementDraggingImpl || hooks1.elementDraggingImpl,
- optionChangeHandlers: __assign({}, hooks0.optionChangeHandlers, hooks1.optionChangeHandlers)
- };
- }
- var eventSourceDef = {
- ignoreRange: true,
- parseMeta: function (raw) {
- if (Array.isArray(raw)) { // short form
- return raw;
- }
- else if (Array.isArray(raw.events)) {
- return raw.events;
- }
- return null;
- },
- fetch: function (arg, success) {
- success({
- rawEvents: arg.eventSource.meta
- });
- }
- };
- var ArrayEventSourcePlugin = createPlugin({
- eventSourceDefs: [eventSourceDef]
- });
- var eventSourceDef$1 = {
- parseMeta: function (raw) {
- if (typeof raw === 'function') { // short form
- return raw;
- }
- else if (typeof raw.events === 'function') {
- return raw.events;
- }
- return null;
- },
- fetch: function (arg, success, failure) {
- var dateEnv = arg.calendar.dateEnv;
- var func = arg.eventSource.meta;
- unpromisify(func.bind(null, {
- start: dateEnv.toDate(arg.range.start),
- end: dateEnv.toDate(arg.range.end),
- startStr: dateEnv.formatIso(arg.range.start),
- endStr: dateEnv.formatIso(arg.range.end),
- timeZone: dateEnv.timeZone
- }), function (rawEvents) {
- success({ rawEvents: rawEvents }); // needs an object response
- }, failure // send errorObj directly to failure callback
- );
- }
- };
- var FuncEventSourcePlugin = createPlugin({
- eventSourceDefs: [eventSourceDef$1]
- });
- function requestJson(method, url, params, successCallback, failureCallback) {
- method = method.toUpperCase();
- var body = null;
- if (method === 'GET') {
- url = injectQueryStringParams(url, params);
- }
- else {
- body = encodeParams(params);
- }
- var xhr = new XMLHttpRequest();
- xhr.open(method, url, true);
- if (method !== 'GET') {
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- }
- xhr.onload = function () {
- if (xhr.status >= 200 && xhr.status < 400) {
- try {
- var res = JSON.parse(xhr.responseText);
- successCallback(res, xhr);
- }
- catch (err) {
- failureCallback('Failure parsing JSON', xhr);
- }
- }
- else {
- failureCallback('Request failed', xhr);
- }
- };
- xhr.onerror = function () {
- failureCallback('Request failed', xhr);
- };
- xhr.send(body);
- }
- function injectQueryStringParams(url, params) {
- return url +
- (url.indexOf('?') === -1 ? '?' : '&') +
- encodeParams(params);
- }
- function encodeParams(params) {
- var parts = [];
- for (var key in params) {
- parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
- }
- return parts.join('&');
- }
- var eventSourceDef$2 = {
- parseMeta: function (raw) {
- if (typeof raw === 'string') { // short form
- raw = { url: raw };
- }
- else if (!raw || typeof raw !== 'object' || !raw.url) {
- return null;
- }
- return {
- url: raw.url,
- method: (raw.method || 'GET').toUpperCase(),
- extraParams: raw.extraParams,
- startParam: raw.startParam,
- endParam: raw.endParam,
- timeZoneParam: raw.timeZoneParam
- };
- },
- fetch: function (arg, success, failure) {
- var meta = arg.eventSource.meta;
- var requestParams = buildRequestParams(meta, arg.range, arg.calendar);
- requestJson(meta.method, meta.url, requestParams, function (rawEvents, xhr) {
- success({ rawEvents: rawEvents, xhr: xhr });
- }, function (errorMessage, xhr) {
- failure({ message: errorMessage, xhr: xhr });
- });
- }
- };
- var JsonFeedEventSourcePlugin = createPlugin({
- eventSourceDefs: [eventSourceDef$2]
- });
- function buildRequestParams(meta, range, calendar) {
- var dateEnv = calendar.dateEnv;
- var startParam;
- var endParam;
- var timeZoneParam;
- var customRequestParams;
- var params = {};
- startParam = meta.startParam;
- if (startParam == null) {
- startParam = calendar.opt('startParam');
- }
- endParam = meta.endParam;
- if (endParam == null) {
- endParam = calendar.opt('endParam');
- }
- timeZoneParam = meta.timeZoneParam;
- if (timeZoneParam == null) {
- timeZoneParam = calendar.opt('timeZoneParam');
- }
- // retrieve any outbound GET/POST data from the options
- if (typeof meta.extraParams === 'function') {
- // supplied as a function that returns a key/value object
- customRequestParams = meta.extraParams();
- }
- else {
- // probably supplied as a straight key/value object
- customRequestParams = meta.extraParams || {};
- }
- __assign(params, customRequestParams);
- params[startParam] = dateEnv.formatIso(range.start);
- params[endParam] = dateEnv.formatIso(range.end);
- if (dateEnv.timeZone !== 'local') {
- params[timeZoneParam] = dateEnv.timeZone;
- }
- return params;
- }
- var recurring = {
- parse: function (rawEvent, leftoverProps, dateEnv) {
- var createMarker = dateEnv.createMarker.bind(dateEnv);
- var processors = {
- daysOfWeek: null,
- startTime: createDuration,
- endTime: createDuration,
- startRecur: createMarker,
- endRecur: createMarker
- };
- var props = refineProps(rawEvent, processors, {}, leftoverProps);
- var anyValid = false;
- for (var propName in props) {
- if (props[propName] != null) {
- anyValid = true;
- break;
- }
- }
- if (anyValid) {
- var duration = null;
- if ('duration' in leftoverProps) {
- duration = createDuration(leftoverProps.duration);
- delete leftoverProps.duration;
- }
- if (!duration && props.startTime && props.endTime) {
- duration = subtractDurations(props.endTime, props.startTime);
- }
- return {
- allDayGuess: Boolean(!props.startTime && !props.endTime),
- duration: duration,
- typeData: props // doesn't need endTime anymore but oh well
- };
- }
- return null;
- },
- expand: function (typeData, framingRange, dateEnv) {
- var clippedFramingRange = intersectRanges(framingRange, { start: typeData.startRecur, end: typeData.endRecur });
- if (clippedFramingRange) {
- return expandRanges(typeData.daysOfWeek, typeData.startTime, clippedFramingRange, dateEnv);
- }
- else {
- return [];
- }
- }
- };
- var SimpleRecurrencePlugin = createPlugin({
- recurringTypes: [recurring]
- });
- function expandRanges(daysOfWeek, startTime, framingRange, dateEnv) {
- var dowHash = daysOfWeek ? arrayToHash(daysOfWeek) : null;
- var dayMarker = startOfDay(framingRange.start);
- var endMarker = framingRange.end;
- var instanceStarts = [];
- while (dayMarker < endMarker) {
- var instanceStart
- // if everyday, or this particular day-of-week
- = void 0;
- // if everyday, or this particular day-of-week
- if (!dowHash || dowHash[dayMarker.getUTCDay()]) {
- if (startTime) {
- instanceStart = dateEnv.add(dayMarker, startTime);
- }
- else {
- instanceStart = dayMarker;
- }
- instanceStarts.push(instanceStart);
- }
- dayMarker = addDays(dayMarker, 1);
- }
- return instanceStarts;
- }
- var DefaultOptionChangeHandlers = createPlugin({
- optionChangeHandlers: {
- events: function (events, calendar, deepEqual) {
- handleEventSources([events], calendar, deepEqual);
- },
- eventSources: handleEventSources,
- plugins: handlePlugins
- }
- });
- function handleEventSources(inputs, calendar, deepEqual) {
- var unfoundSources = hashValuesToArray(calendar.state.eventSources);
- var newInputs = [];
- for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {
- var input = inputs_1[_i];
- var inputFound = false;
- for (var i = 0; i < unfoundSources.length; i++) {
- if (deepEqual(unfoundSources[i]._raw, input)) {
- unfoundSources.splice(i, 1); // delete
- inputFound = true;
- break;
- }
- }
- if (!inputFound) {
- newInputs.push(input);
- }
- }
- for (var _a = 0, unfoundSources_1 = unfoundSources; _a < unfoundSources_1.length; _a++) {
- var unfoundSource = unfoundSources_1[_a];
- calendar.dispatch({
- type: 'REMOVE_EVENT_SOURCE',
- sourceId: unfoundSource.sourceId
- });
- }
- for (var _b = 0, newInputs_1 = newInputs; _b < newInputs_1.length; _b++) {
- var newInput = newInputs_1[_b];
- calendar.addEventSource(newInput);
- }
- }
- // shortcoming: won't remove plugins
- function handlePlugins(inputs, calendar) {
- calendar.addPluginInputs(inputs); // will gracefully handle duplicates
- }
- var config = {}; // TODO: make these options
- var globalDefaults = {
- defaultRangeSeparator: ' - ',
- titleRangeSeparator: ' \u2013 ',
- defaultTimedEventDuration: '01:00:00',
- defaultAllDayEventDuration: { day: 1 },
- forceEventDuration: false,
- nextDayThreshold: '00:00:00',
- // display
- columnHeader: true,
- defaultView: '',
- aspectRatio: 1.35,
- header: {
- left: 'title',
- center: '',
- right: 'today prev,next'
- },
- weekends: true,
- weekNumbers: false,
- weekNumberCalculation: 'local',
- editable: false,
- // nowIndicator: false,
- scrollTime: '06:00:00',
- minTime: '00:00:00',
- maxTime: '24:00:00',
- showNonCurrentDates: true,
- // event ajax
- lazyFetching: true,
- startParam: 'start',
- endParam: 'end',
- timeZoneParam: 'timeZone',
- timeZone: 'local',
- // allDayDefault: undefined,
- // locale
- locales: [],
- locale: '',
- // dir: will get this from the default locale
- // buttonIcons: null,
- // allows setting a min-height to the event segment to prevent short events overlapping each other
- timeGridEventMinHeight: 0,
- themeSystem: 'standard',
- // eventResizableFromStart: false,
- dragRevertDuration: 500,
- dragScroll: true,
- allDayMaintainDuration: false,
- // selectable: false,
- unselectAuto: true,
- // selectMinDistance: 0,
- dropAccept: '*',
- eventOrder: 'start,-duration,allDay,title',
- // ^ if start tie, longer events go before shorter. final tie-breaker is title text
- // rerenderDelay: null,
- eventLimit: false,
- eventLimitClick: 'popover',
- dayPopoverFormat: { month: 'long', day: 'numeric', year: 'numeric' },
- handleWindowResize: true,
- windowResizeDelay: 100,
- longPressDelay: 1000,
- eventDragMinDistance: 5 // only applies to mouse
- };
- var rtlDefaults = {
- header: {
- left: 'next,prev today',
- center: '',
- right: 'title'
- },
- buttonIcons: {
- // TODO: make RTL support the responibility of the theme
- prev: 'fc-icon-chevron-right',
- next: 'fc-icon-chevron-left',
- prevYear: 'fc-icon-chevrons-right',
- nextYear: 'fc-icon-chevrons-left'
- }
- };
- var complexOptions = [
- 'header',
- 'footer',
- 'buttonText',
- 'buttonIcons'
- ];
- // Merges an array of option objects into a single object
- function mergeOptions(optionObjs) {
- return mergeProps(optionObjs, complexOptions);
- }
- // TODO: move this stuff to a "plugin"-related file...
- var INTERNAL_PLUGINS = [
- ArrayEventSourcePlugin,
- FuncEventSourcePlugin,
- JsonFeedEventSourcePlugin,
- SimpleRecurrencePlugin,
- DefaultOptionChangeHandlers
- ];
- function refinePluginDefs(pluginInputs) {
- var plugins = [];
- for (var _i = 0, pluginInputs_1 = pluginInputs; _i < pluginInputs_1.length; _i++) {
- var pluginInput = pluginInputs_1[_i];
- if (typeof pluginInput === 'string') {
- var globalName = 'FullCalendar' + capitaliseFirstLetter(pluginInput);
- if (!window[globalName]) {
- console.warn('Plugin file not loaded for ' + pluginInput);
- }
- else {
- plugins.push(window[globalName].default); // is an ES6 module
- }
- }
- else {
- plugins.push(pluginInput);
- }
- }
- return INTERNAL_PLUGINS.concat(plugins);
- }
- var RAW_EN_LOCALE = {
- code: 'en',
- week: {
- dow: 0,
- doy: 4 // 4 days need to be within the year to be considered the first week
- },
- dir: 'ltr',
- buttonText: {
- prev: 'prev',
- next: 'next',
- prevYear: 'prev year',
- nextYear: 'next year',
- year: 'year',
- today: 'today',
- month: 'month',
- week: 'week',
- day: 'day',
- list: 'list'
- },
- weekLabel: 'W',
- allDayText: 'all-day',
- eventLimitText: 'more',
- noEventsMessage: 'No events to display'
- };
- function parseRawLocales(explicitRawLocales) {
- var defaultCode = explicitRawLocales.length > 0 ? explicitRawLocales[0].code : 'en';
- var globalArray = window['FullCalendarLocalesAll'] || []; // from locales-all.js
- var globalObject = window['FullCalendarLocales'] || {}; // from locales/*.js. keys are meaningless
- var allRawLocales = globalArray.concat(// globalArray is low prio
- hashValuesToArray(globalObject), // medium prio
- explicitRawLocales // highest prio
- );
- var rawLocaleMap = {
- en: RAW_EN_LOCALE // necessary?
- };
- for (var _i = 0, allRawLocales_1 = allRawLocales; _i < allRawLocales_1.length; _i++) {
- var rawLocale = allRawLocales_1[_i];
- rawLocaleMap[rawLocale.code] = rawLocale;
- }
- return {
- map: rawLocaleMap,
- defaultCode: defaultCode
- };
- }
- function buildLocale(inputSingular, available) {
- if (typeof inputSingular === 'object' && !Array.isArray(inputSingular)) {
- return parseLocale(inputSingular.code, [inputSingular.code], inputSingular);
- }
- else {
- return queryLocale(inputSingular, available);
- }
- }
- function queryLocale(codeArg, available) {
- var codes = [].concat(codeArg || []); // will convert to array
- var raw = queryRawLocale(codes, available) || RAW_EN_LOCALE;
- return parseLocale(codeArg, codes, raw);
- }
- function queryRawLocale(codes, available) {
- for (var i = 0; i < codes.length; i++) {
- var parts = codes[i].toLocaleLowerCase().split('-');
- for (var j = parts.length; j > 0; j--) {
- var simpleId = parts.slice(0, j).join('-');
- if (available[simpleId]) {
- return available[simpleId];
- }
- }
- }
- return null;
- }
- function parseLocale(codeArg, codes, raw) {
- var merged = mergeProps([RAW_EN_LOCALE, raw], ['buttonText']);
- delete merged.code; // don't want this part of the options
- var week = merged.week;
- delete merged.week;
- return {
- codeArg: codeArg,
- codes: codes,
- week: week,
- simpleNumberFormat: new Intl.NumberFormat(codeArg),
- options: merged
- };
- }
- var OptionsManager = /** @class */ (function () {
- function OptionsManager(overrides) {
- this.overrides = __assign({}, overrides); // make a copy
- this.dynamicOverrides = {};
- this.compute();
- }
- OptionsManager.prototype.mutate = function (updates, removals, isDynamic) {
- if (!Object.keys(updates).length && !removals.length) {
- return;
- }
- var overrideHash = isDynamic ? this.dynamicOverrides : this.overrides;
- __assign(overrideHash, updates);
- for (var _i = 0, removals_1 = removals; _i < removals_1.length; _i++) {
- var propName = removals_1[_i];
- delete overrideHash[propName];
- }
- this.compute();
- };
- // Computes the flattened options hash for the calendar and assigns to `this.options`.
- // Assumes this.overrides and this.dynamicOverrides have already been initialized.
- OptionsManager.prototype.compute = function () {
- // TODO: not a very efficient system
- var locales = firstDefined(// explicit locale option given?
- this.dynamicOverrides.locales, this.overrides.locales, globalDefaults.locales);
- var locale = firstDefined(// explicit locales option given?
- this.dynamicOverrides.locale, this.overrides.locale, globalDefaults.locale);
- var available = parseRawLocales(locales);
- var localeDefaults = buildLocale(locale || available.defaultCode, available.map).options;
- var dir = firstDefined(// based on options computed so far, is direction RTL?
- this.dynamicOverrides.dir, this.overrides.dir, localeDefaults.dir);
- var dirDefaults = dir === 'rtl' ? rtlDefaults : {};
- this.dirDefaults = dirDefaults;
- this.localeDefaults = localeDefaults;
- this.computed = mergeOptions([
- globalDefaults,
- dirDefaults,
- localeDefaults,
- this.overrides,
- this.dynamicOverrides
- ]);
- };
- return OptionsManager;
- }());
- var calendarSystemClassMap = {};
- function registerCalendarSystem(name, theClass) {
- calendarSystemClassMap[name] = theClass;
- }
- function createCalendarSystem(name) {
- return new calendarSystemClassMap[name]();
- }
- var GregorianCalendarSystem = /** @class */ (function () {
- function GregorianCalendarSystem() {
- }
- GregorianCalendarSystem.prototype.getMarkerYear = function (d) {
- return d.getUTCFullYear();
- };
- GregorianCalendarSystem.prototype.getMarkerMonth = function (d) {
- return d.getUTCMonth();
- };
- GregorianCalendarSystem.prototype.getMarkerDay = function (d) {
- return d.getUTCDate();
- };
- GregorianCalendarSystem.prototype.arrayToMarker = function (arr) {
- return arrayToUtcDate(arr);
- };
- GregorianCalendarSystem.prototype.markerToArray = function (marker) {
- return dateToUtcArray(marker);
- };
- return GregorianCalendarSystem;
- }());
- registerCalendarSystem('gregory', GregorianCalendarSystem);
- var ISO_RE = /^\s*(\d{4})(-(\d{2})(-(\d{2})([T ](\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/;
- function parse(str) {
- var m = ISO_RE.exec(str);
- if (m) {
- var marker = new Date(Date.UTC(Number(m[1]), m[3] ? Number(m[3]) - 1 : 0, Number(m[5] || 1), Number(m[7] || 0), Number(m[8] || 0), Number(m[10] || 0), m[12] ? Number('0.' + m[12]) * 1000 : 0));
- if (isValidDate(marker)) {
- var timeZoneOffset = null;
- if (m[13]) {
- timeZoneOffset = (m[15] === '-' ? -1 : 1) * (Number(m[16] || 0) * 60 +
- Number(m[18] || 0));
- }
- return {
- marker: marker,
- isTimeUnspecified: !m[6],
- timeZoneOffset: timeZoneOffset
- };
- }
- }
- return null;
- }
- var DateEnv = /** @class */ (function () {
- function DateEnv(settings) {
- var timeZone = this.timeZone = settings.timeZone;
- var isNamedTimeZone = timeZone !== 'local' && timeZone !== 'UTC';
- if (settings.namedTimeZoneImpl && isNamedTimeZone) {
- this.namedTimeZoneImpl = new settings.namedTimeZoneImpl(timeZone);
- }
- this.canComputeOffset = Boolean(!isNamedTimeZone || this.namedTimeZoneImpl);
- this.calendarSystem = createCalendarSystem(settings.calendarSystem);
- this.locale = settings.locale;
- this.weekDow = settings.locale.week.dow;
- this.weekDoy = settings.locale.week.doy;
- if (settings.weekNumberCalculation === 'ISO') {
- this.weekDow = 1;
- this.weekDoy = 4;
- }
- if (typeof settings.firstDay === 'number') {
- this.weekDow = settings.firstDay;
- }
- if (typeof settings.weekNumberCalculation === 'function') {
- this.weekNumberFunc = settings.weekNumberCalculation;
- }
- this.weekLabel = settings.weekLabel != null ? settings.weekLabel : settings.locale.options.weekLabel;
- this.cmdFormatter = settings.cmdFormatter;
- }
- // Creating / Parsing
- DateEnv.prototype.createMarker = function (input) {
- var meta = this.createMarkerMeta(input);
- if (meta === null) {
- return null;
- }
- return meta.marker;
- };
- DateEnv.prototype.createNowMarker = function () {
- if (this.canComputeOffset) {
- return this.timestampToMarker(new Date().valueOf());
- }
- else {
- // if we can't compute the current date val for a timezone,
- // better to give the current local date vals than UTC
- return arrayToUtcDate(dateToLocalArray(new Date()));
- }
- };
- DateEnv.prototype.createMarkerMeta = function (input) {
- if (typeof input === 'string') {
- return this.parse(input);
- }
- var marker = null;
- if (typeof input === 'number') {
- marker = this.timestampToMarker(input);
- }
- else if (input instanceof Date) {
- input = input.valueOf();
- if (!isNaN(input)) {
- marker = this.timestampToMarker(input);
- }
- }
- else if (Array.isArray(input)) {
- marker = arrayToUtcDate(input);
- }
- if (marker === null || !isValidDate(marker)) {
- return null;
- }
- return { marker: marker, isTimeUnspecified: false, forcedTzo: null };
- };
- DateEnv.prototype.parse = function (s) {
- var parts = parse(s);
- if (parts === null) {
- return null;
- }
- var marker = parts.marker;
- var forcedTzo = null;
- if (parts.timeZoneOffset !== null) {
- if (this.canComputeOffset) {
- marker = this.timestampToMarker(marker.valueOf() - parts.timeZoneOffset * 60 * 1000);
- }
- else {
- forcedTzo = parts.timeZoneOffset;
- }
- }
- return { marker: marker, isTimeUnspecified: parts.isTimeUnspecified, forcedTzo: forcedTzo };
- };
- // Accessors
- DateEnv.prototype.getYear = function (marker) {
- return this.calendarSystem.getMarkerYear(marker);
- };
- DateEnv.prototype.getMonth = function (marker) {
- return this.calendarSystem.getMarkerMonth(marker);
- };
- // Adding / Subtracting
- DateEnv.prototype.add = function (marker, dur) {
- var a = this.calendarSystem.markerToArray(marker);
- a[0] += dur.years;
- a[1] += dur.months;
- a[2] += dur.days;
- a[6] += dur.milliseconds;
- return this.calendarSystem.arrayToMarker(a);
- };
- DateEnv.prototype.subtract = function (marker, dur) {
- var a = this.calendarSystem.markerToArray(marker);
- a[0] -= dur.years;
- a[1] -= dur.months;
- a[2] -= dur.days;
- a[6] -= dur.milliseconds;
- return this.calendarSystem.arrayToMarker(a);
- };
- DateEnv.prototype.addYears = function (marker, n) {
- var a = this.calendarSystem.markerToArray(marker);
- a[0] += n;
- return this.calendarSystem.arrayToMarker(a);
- };
- DateEnv.prototype.addMonths = function (marker, n) {
- var a = this.calendarSystem.markerToArray(marker);
- a[1] += n;
- return this.calendarSystem.arrayToMarker(a);
- };
- // Diffing Whole Units
- DateEnv.prototype.diffWholeYears = function (m0, m1) {
- var calendarSystem = this.calendarSystem;
- if (timeAsMs(m0) === timeAsMs(m1) &&
- calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1) &&
- calendarSystem.getMarkerMonth(m0) === calendarSystem.getMarkerMonth(m1)) {
- return calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0);
- }
- return null;
- };
- DateEnv.prototype.diffWholeMonths = function (m0, m1) {
- var calendarSystem = this.calendarSystem;
- if (timeAsMs(m0) === timeAsMs(m1) &&
- calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1)) {
- return (calendarSystem.getMarkerMonth(m1) - calendarSystem.getMarkerMonth(m0)) +
- (calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0)) * 12;
- }
- return null;
- };
- // Range / Duration
- DateEnv.prototype.greatestWholeUnit = function (m0, m1) {
- var n = this.diffWholeYears(m0, m1);
- if (n !== null) {
- return { unit: 'year', value: n };
- }
- n = this.diffWholeMonths(m0, m1);
- if (n !== null) {
- return { unit: 'month', value: n };
- }
- n = diffWholeWeeks(m0, m1);
- if (n !== null) {
- return { unit: 'week', value: n };
- }
- n = diffWholeDays(m0, m1);
- if (n !== null) {
- return { unit: 'day', value: n };
- }
- n = diffHours(m0, m1);
- if (isInt(n)) {
- return { unit: 'hour', value: n };
- }
- n = diffMinutes(m0, m1);
- if (isInt(n)) {
- return { unit: 'minute', value: n };
- }
- n = diffSeconds(m0, m1);
- if (isInt(n)) {
- return { unit: 'second', value: n };
- }
- return { unit: 'millisecond', value: m1.valueOf() - m0.valueOf() };
- };
- DateEnv.prototype.countDurationsBetween = function (m0, m1, d) {
- // TODO: can use greatestWholeUnit
- var diff;
- if (d.years) {
- diff = this.diffWholeYears(m0, m1);
- if (diff !== null) {
- return diff / asRoughYears(d);
- }
- }
- if (d.months) {
- diff = this.diffWholeMonths(m0, m1);
- if (diff !== null) {
- return diff / asRoughMonths(d);
- }
- }
- if (d.days) {
- diff = diffWholeDays(m0, m1);
- if (diff !== null) {
- return diff / asRoughDays(d);
- }
- }
- return (m1.valueOf() - m0.valueOf()) / asRoughMs(d);
- };
- // Start-Of
- DateEnv.prototype.startOf = function (m, unit) {
- if (unit === 'year') {
- return this.startOfYear(m);
- }
- else if (unit === 'month') {
- return this.startOfMonth(m);
- }
- else if (unit === 'week') {
- return this.startOfWeek(m);
- }
- else if (unit === 'day') {
- return startOfDay(m);
- }
- else if (unit === 'hour') {
- return startOfHour(m);
- }
- else if (unit === 'minute') {
- return startOfMinute(m);
- }
- else if (unit === 'second') {
- return startOfSecond(m);
- }
- };
- DateEnv.prototype.startOfYear = function (m) {
- return this.calendarSystem.arrayToMarker([
- this.calendarSystem.getMarkerYear(m)
- ]);
- };
- DateEnv.prototype.startOfMonth = function (m) {
- return this.calendarSystem.arrayToMarker([
- this.calendarSystem.getMarkerYear(m),
- this.calendarSystem.getMarkerMonth(m)
- ]);
- };
- DateEnv.prototype.startOfWeek = function (m) {
- return this.calendarSystem.arrayToMarker([
- this.calendarSystem.getMarkerYear(m),
- this.calendarSystem.getMarkerMonth(m),
- m.getUTCDate() - ((m.getUTCDay() - this.weekDow + 7) % 7)
- ]);
- };
- // Week Number
- DateEnv.prototype.computeWeekNumber = function (marker) {
- if (this.weekNumberFunc) {
- return this.weekNumberFunc(this.toDate(marker));
- }
- else {
- return weekOfYear(marker, this.weekDow, this.weekDoy);
- }
- };
- // TODO: choke on timeZoneName: long
- DateEnv.prototype.format = function (marker, formatter, dateOptions) {
- if (dateOptions === void 0) { dateOptions = {}; }
- return formatter.format({
- marker: marker,
- timeZoneOffset: dateOptions.forcedTzo != null ?
- dateOptions.forcedTzo :
- this.offsetForMarker(marker)
- }, this);
- };
- DateEnv.prototype.formatRange = function (start, end, formatter, dateOptions) {
- if (dateOptions === void 0) { dateOptions = {}; }
- if (dateOptions.isEndExclusive) {
- end = addMs(end, -1);
- }
- return formatter.formatRange({
- marker: start,
- timeZoneOffset: dateOptions.forcedStartTzo != null ?
- dateOptions.forcedStartTzo :
- this.offsetForMarker(start)
- }, {
- marker: end,
- timeZoneOffset: dateOptions.forcedEndTzo != null ?
- dateOptions.forcedEndTzo :
- this.offsetForMarker(end)
- }, this);
- };
- DateEnv.prototype.formatIso = function (marker, extraOptions) {
- if (extraOptions === void 0) { extraOptions = {}; }
- var timeZoneOffset = null;
- if (!extraOptions.omitTimeZoneOffset) {
- if (extraOptions.forcedTzo != null) {
- timeZoneOffset = extraOptions.forcedTzo;
- }
- else {
- timeZoneOffset = this.offsetForMarker(marker);
- }
- }
- return buildIsoString(marker, timeZoneOffset, extraOptions.omitTime);
- };
- // TimeZone
- DateEnv.prototype.timestampToMarker = function (ms) {
- if (this.timeZone === 'local') {
- return arrayToUtcDate(dateToLocalArray(new Date(ms)));
- }
- else if (this.timeZone === 'UTC' || !this.namedTimeZoneImpl) {
- return new Date(ms);
- }
- else {
- return arrayToUtcDate(this.namedTimeZoneImpl.timestampToArray(ms));
- }
- };
- DateEnv.prototype.offsetForMarker = function (m) {
- if (this.timeZone === 'local') {
- return -arrayToLocalDate(dateToUtcArray(m)).getTimezoneOffset(); // convert "inverse" offset to "normal" offset
- }
- else if (this.timeZone === 'UTC') {
- return 0;
- }
- else if (this.namedTimeZoneImpl) {
- return this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m));
- }
- return null;
- };
- // Conversion
- DateEnv.prototype.toDate = function (m, forcedTzo) {
- if (this.timeZone === 'local') {
- return arrayToLocalDate(dateToUtcArray(m));
- }
- else if (this.timeZone === 'UTC') {
- return new Date(m.valueOf()); // make sure it's a copy
- }
- else if (!this.namedTimeZoneImpl) {
- return new Date(m.valueOf() - (forcedTzo || 0));
- }
- else {
- return new Date(m.valueOf() -
- this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m)) * 1000 * 60 // convert minutes -> ms
- );
- }
- };
- return DateEnv;
- }());
- var SIMPLE_SOURCE_PROPS = {
- id: String,
- allDayDefault: Boolean,
- eventDataTransform: Function,
- success: Function,
- failure: Function
- };
- var uid$2 = 0;
- function doesSourceNeedRange(eventSource, calendar) {
- var defs = calendar.pluginSystem.hooks.eventSourceDefs;
- return !defs[eventSource.sourceDefId].ignoreRange;
- }
- function parseEventSource(raw, calendar) {
- var defs = calendar.pluginSystem.hooks.eventSourceDefs;
- for (var i = defs.length - 1; i >= 0; i--) { // later-added plugins take precedence
- var def = defs[i];
- var meta = def.parseMeta(raw);
- if (meta) {
- var res = parseEventSourceProps(typeof raw === 'object' ? raw : {}, meta, i, calendar);
- res._raw = raw;
- return res;
- }
- }
- return null;
- }
- function parseEventSourceProps(raw, meta, sourceDefId, calendar) {
- var leftovers0 = {};
- var props = refineProps(raw, SIMPLE_SOURCE_PROPS, {}, leftovers0);
- var leftovers1 = {};
- var ui = processUnscopedUiProps(leftovers0, calendar, leftovers1);
- props.isFetching = false;
- props.latestFetchId = '';
- props.fetchRange = null;
- props.publicId = String(raw.id || '');
- props.sourceId = String(uid$2++);
- props.sourceDefId = sourceDefId;
- props.meta = meta;
- props.ui = ui;
- props.extendedProps = leftovers1;
- return props;
- }
- function reduceEventSources (eventSources, action, dateProfile, calendar) {
- switch (action.type) {
- case 'ADD_EVENT_SOURCES': // already parsed
- return addSources(eventSources, action.sources, dateProfile ? dateProfile.activeRange : null, calendar);
- case 'REMOVE_EVENT_SOURCE':
- return removeSource(eventSources, action.sourceId);
- case 'PREV': // TODO: how do we track all actions that affect dateProfile :(
- case 'NEXT':
- case 'SET_DATE':
- case 'SET_VIEW_TYPE':
- if (dateProfile) {
- return fetchDirtySources(eventSources, dateProfile.activeRange, calendar);
- }
- else {
- return eventSources;
- }
- case 'FETCH_EVENT_SOURCES':
- case 'CHANGE_TIMEZONE':
- return fetchSourcesByIds(eventSources, action.sourceIds ?
- arrayToHash(action.sourceIds) :
- excludeStaticSources(eventSources, calendar), dateProfile ? dateProfile.activeRange : null, calendar);
- case 'RECEIVE_EVENTS':
- case 'RECEIVE_EVENT_ERROR':
- return receiveResponse(eventSources, action.sourceId, action.fetchId, action.fetchRange);
- case 'REMOVE_ALL_EVENT_SOURCES':
- return {};
- default:
- return eventSources;
- }
- }
- var uid$3 = 0;
- function addSources(eventSourceHash, sources, fetchRange, calendar) {
- var hash = {};
- for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) {
- var source = sources_1[_i];
- hash[source.sourceId] = source;
- }
- if (fetchRange) {
- hash = fetchDirtySources(hash, fetchRange, calendar);
- }
- return __assign({}, eventSourceHash, hash);
- }
- function removeSource(eventSourceHash, sourceId) {
- return filterHash(eventSourceHash, function (eventSource) {
- return eventSource.sourceId !== sourceId;
- });
- }
- function fetchDirtySources(sourceHash, fetchRange, calendar) {
- return fetchSourcesByIds(sourceHash, filterHash(sourceHash, function (eventSource) {
- return isSourceDirty(eventSource, fetchRange, calendar);
- }), fetchRange, calendar);
- }
- function isSourceDirty(eventSource, fetchRange, calendar) {
- if (!doesSourceNeedRange(eventSource, calendar)) {
- return !eventSource.latestFetchId;
- }
- else {
- return !calendar.opt('lazyFetching') ||
- !eventSource.fetchRange ||
- eventSource.isFetching || // always cancel outdated in-progress fetches
- fetchRange.start < eventSource.fetchRange.start ||
- fetchRange.end > eventSource.fetchRange.end;
- }
- }
- function fetchSourcesByIds(prevSources, sourceIdHash, fetchRange, calendar) {
- var nextSources = {};
- for (var sourceId in prevSources) {
- var source = prevSources[sourceId];
- if (sourceIdHash[sourceId]) {
- nextSources[sourceId] = fetchSource(source, fetchRange, calendar);
- }
- else {
- nextSources[sourceId] = source;
- }
- }
- return nextSources;
- }
- function fetchSource(eventSource, fetchRange, calendar) {
- var sourceDef = calendar.pluginSystem.hooks.eventSourceDefs[eventSource.sourceDefId];
- var fetchId = String(uid$3++);
- sourceDef.fetch({
- eventSource: eventSource,
- calendar: calendar,
- range: fetchRange
- }, function (res) {
- var rawEvents = res.rawEvents;
- var calSuccess = calendar.opt('eventSourceSuccess');
- var calSuccessRes;
- var sourceSuccessRes;
- if (eventSource.success) {
- sourceSuccessRes = eventSource.success(rawEvents, res.xhr);
- }
- if (calSuccess) {
- calSuccessRes = calSuccess(rawEvents, res.xhr);
- }
- rawEvents = sourceSuccessRes || calSuccessRes || rawEvents;
- calendar.dispatch({
- type: 'RECEIVE_EVENTS',
- sourceId: eventSource.sourceId,
- fetchId: fetchId,
- fetchRange: fetchRange,
- rawEvents: rawEvents
- });
- }, function (error) {
- var callFailure = calendar.opt('eventSourceFailure');
- console.warn(error.message, error);
- if (eventSource.failure) {
- eventSource.failure(error);
- }
- if (callFailure) {
- callFailure(error);
- }
- calendar.dispatch({
- type: 'RECEIVE_EVENT_ERROR',
- sourceId: eventSource.sourceId,
- fetchId: fetchId,
- fetchRange: fetchRange,
- error: error
- });
- });
- return __assign({}, eventSource, { isFetching: true, latestFetchId: fetchId });
- }
- function receiveResponse(sourceHash, sourceId, fetchId, fetchRange) {
- var _a;
- var eventSource = sourceHash[sourceId];
- if (eventSource && // not already removed
- fetchId === eventSource.latestFetchId) {
- return __assign({}, sourceHash, (_a = {}, _a[sourceId] = __assign({}, eventSource, { isFetching: false, fetchRange: fetchRange // also serves as a marker that at least one fetch has completed
- }), _a));
- }
- return sourceHash;
- }
- function excludeStaticSources(eventSources, calendar) {
- return filterHash(eventSources, function (eventSource) {
- return doesSourceNeedRange(eventSource, calendar);
- });
- }
- var DateProfileGenerator = /** @class */ (function () {
- function DateProfileGenerator(viewSpec, calendar) {
- this.viewSpec = viewSpec;
- this.options = viewSpec.options;
- this.dateEnv = calendar.dateEnv;
- this.calendar = calendar;
- this.initHiddenDays();
- }
- /* Date Range Computation
- ------------------------------------------------------------------------------------------------------------------*/
- // Builds a structure with info about what the dates/ranges will be for the "prev" view.
- DateProfileGenerator.prototype.buildPrev = function (currentDateProfile, currentDate) {
- var dateEnv = this.dateEnv;
- var prevDate = dateEnv.subtract(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month
- currentDateProfile.dateIncrement);
- return this.build(prevDate, -1);
- };
- // Builds a structure with info about what the dates/ranges will be for the "next" view.
- DateProfileGenerator.prototype.buildNext = function (currentDateProfile, currentDate) {
- var dateEnv = this.dateEnv;
- var nextDate = dateEnv.add(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month
- currentDateProfile.dateIncrement);
- return this.build(nextDate, 1);
- };
- // Builds a structure holding dates/ranges for rendering around the given date.
- // Optional direction param indicates whether the date is being incremented/decremented
- // from its previous value. decremented = -1, incremented = 1 (default).
- DateProfileGenerator.prototype.build = function (currentDate, direction, forceToValid) {
- if (forceToValid === void 0) { forceToValid = false; }
- var validRange;
- var minTime = null;
- var maxTime = null;
- var currentInfo;
- var isRangeAllDay;
- var renderRange;
- var activeRange;
- var isValid;
- validRange = this.buildValidRange();
- validRange = this.trimHiddenDays(validRange);
- if (forceToValid) {
- currentDate = constrainMarkerToRange(currentDate, validRange);
- }
- currentInfo = this.buildCurrentRangeInfo(currentDate, direction);
- isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit);
- renderRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.range), currentInfo.unit, isRangeAllDay);
- renderRange = this.trimHiddenDays(renderRange);
- activeRange = renderRange;
- if (!this.options.showNonCurrentDates) {
- activeRange = intersectRanges(activeRange, currentInfo.range);
- }
- minTime = createDuration(this.options.minTime);
- maxTime = createDuration(this.options.maxTime);
- activeRange = this.adjustActiveRange(activeRange, minTime, maxTime);
- activeRange = intersectRanges(activeRange, validRange); // might return null
- // it's invalid if the originally requested date is not contained,
- // or if the range is completely outside of the valid range.
- isValid = rangesIntersect(currentInfo.range, validRange);
- return {
- // constraint for where prev/next operations can go and where events can be dragged/resized to.
- // an object with optional start and end properties.
- validRange: validRange,
- // range the view is formally responsible for.
- // for example, a month view might have 1st-31st, excluding padded dates
- currentRange: currentInfo.range,
- // name of largest unit being displayed, like "month" or "week"
- currentRangeUnit: currentInfo.unit,
- isRangeAllDay: isRangeAllDay,
- // dates that display events and accept drag-n-drop
- // will be `null` if no dates accept events
- activeRange: activeRange,
- // date range with a rendered skeleton
- // includes not-active days that need some sort of DOM
- renderRange: renderRange,
- // Duration object that denotes the first visible time of any given day
- minTime: minTime,
- // Duration object that denotes the exclusive visible end time of any given day
- maxTime: maxTime,
- isValid: isValid,
- // how far the current date will move for a prev/next operation
- dateIncrement: this.buildDateIncrement(currentInfo.duration)
- // pass a fallback (might be null) ^
- };
- };
- // Builds an object with optional start/end properties.
- // Indicates the minimum/maximum dates to display.
- // not responsible for trimming hidden days.
- DateProfileGenerator.prototype.buildValidRange = function () {
- return this.getRangeOption('validRange', this.calendar.getNow()) ||
- { start: null, end: null }; // completely open-ended
- };
- // Builds a structure with info about the "current" range, the range that is
- // highlighted as being the current month for example.
- // See build() for a description of `direction`.
- // Guaranteed to have `range` and `unit` properties. `duration` is optional.
- DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) {
- var _a = this, viewSpec = _a.viewSpec, dateEnv = _a.dateEnv;
- var duration = null;
- var unit = null;
- var range = null;
- var dayCount;
- if (viewSpec.duration) {
- duration = viewSpec.duration;
- unit = viewSpec.durationUnit;
- range = this.buildRangeFromDuration(date, direction, duration, unit);
- }
- else if ((dayCount = this.options.dayCount)) {
- unit = 'day';
- range = this.buildRangeFromDayCount(date, direction, dayCount);
- }
- else if ((range = this.buildCustomVisibleRange(date))) {
- unit = dateEnv.greatestWholeUnit(range.start, range.end).unit;
- }
- else {
- duration = this.getFallbackDuration();
- unit = greatestDurationDenominator(duration).unit;
- range = this.buildRangeFromDuration(date, direction, duration, unit);
- }
- return { duration: duration, unit: unit, range: range };
- };
- DateProfileGenerator.prototype.getFallbackDuration = function () {
- return createDuration({ day: 1 });
- };
- // Returns a new activeRange to have time values (un-ambiguate)
- // minTime or maxTime causes the range to expand.
- DateProfileGenerator.prototype.adjustActiveRange = function (range, minTime, maxTime) {
- var dateEnv = this.dateEnv;
- var start = range.start;
- var end = range.end;
- if (this.viewSpec.class.prototype.usesMinMaxTime) {
- // expand active range if minTime is negative (why not when positive?)
- if (asRoughDays(minTime) < 0) {
- start = startOfDay(start); // necessary?
- start = dateEnv.add(start, minTime);
- }
- // expand active range if maxTime is beyond one day (why not when positive?)
- if (asRoughDays(maxTime) > 1) {
- end = startOfDay(end); // necessary?
- end = addDays(end, -1);
- end = dateEnv.add(end, maxTime);
- }
- }
- return { start: start, end: end };
- };
- // Builds the "current" range when it is specified as an explicit duration.
- // `unit` is the already-computed greatestDurationDenominator unit of duration.
- DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) {
- var dateEnv = this.dateEnv;
- var alignment = this.options.dateAlignment;
- var dateIncrementInput;
- var dateIncrementDuration;
- var start;
- var end;
- var res;
- // compute what the alignment should be
- if (!alignment) {
- dateIncrementInput = this.options.dateIncrement;
- if (dateIncrementInput) {
- dateIncrementDuration = createDuration(dateIncrementInput);
- // use the smaller of the two units
- if (asRoughMs(dateIncrementDuration) < asRoughMs(duration)) {
- alignment = greatestDurationDenominator(dateIncrementDuration, !getWeeksFromInput(dateIncrementInput)).unit;
- }
- else {
- alignment = unit;
- }
- }
- else {
- alignment = unit;
- }
- }
- // if the view displays a single day or smaller
- if (asRoughDays(duration) <= 1) {
- if (this.isHiddenDay(start)) {
- start = this.skipHiddenDays(start, direction);
- start = startOfDay(start);
- }
- }
- function computeRes() {
- start = dateEnv.startOf(date, alignment);
- end = dateEnv.add(start, duration);
- res = { start: start, end: end };
- }
- computeRes();
- // if range is completely enveloped by hidden days, go past the hidden days
- if (!this.trimHiddenDays(res)) {
- date = this.skipHiddenDays(date, direction);
- computeRes();
- }
- return res;
- };
- // Builds the "current" range when a dayCount is specified.
- DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) {
- var dateEnv = this.dateEnv;
- var customAlignment = this.options.dateAlignment;
- var runningCount = 0;
- var start = date;
- var end;
- if (customAlignment) {
- start = dateEnv.startOf(start, customAlignment);
- }
- start = startOfDay(start);
- start = this.skipHiddenDays(start, direction);
- end = start;
- do {
- end = addDays(end, 1);
- if (!this.isHiddenDay(end)) {
- runningCount++;
- }
- } while (runningCount < dayCount);
- return { start: start, end: end };
- };
- // Builds a normalized range object for the "visible" range,
- // which is a way to define the currentRange and activeRange at the same time.
- DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) {
- var dateEnv = this.dateEnv;
- var visibleRange = this.getRangeOption('visibleRange', dateEnv.toDate(date));
- if (visibleRange && (visibleRange.start == null || visibleRange.end == null)) {
- return null;
- }
- return visibleRange;
- };
- // Computes the range that will represent the element/cells for *rendering*,
- // but which may have voided days/times.
- // not responsible for trimming hidden days.
- DateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) {
- return currentRange;
- };
- // Compute the duration value that should be added/substracted to the current date
- // when a prev/next operation happens.
- DateProfileGenerator.prototype.buildDateIncrement = function (fallback) {
- var dateIncrementInput = this.options.dateIncrement;
- var customAlignment;
- if (dateIncrementInput) {
- return createDuration(dateIncrementInput);
- }
- else if ((customAlignment = this.options.dateAlignment)) {
- return createDuration(1, customAlignment);
- }
- else if (fallback) {
- return fallback;
- }
- else {
- return createDuration({ days: 1 });
- }
- };
- // Arguments after name will be forwarded to a hypothetical function value
- // WARNING: passed-in arguments will be given to generator functions as-is and can cause side-effects.
- // Always clone your objects if you fear mutation.
- DateProfileGenerator.prototype.getRangeOption = function (name) {
- var otherArgs = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- otherArgs[_i - 1] = arguments[_i];
- }
- var val = this.options[name];
- if (typeof val === 'function') {
- val = val.apply(null, otherArgs);
- }
- if (val) {
- val = parseRange(val, this.dateEnv);
- }
- if (val) {
- val = computeVisibleDayRange(val);
- }
- return val;
- };
- /* Hidden Days
- ------------------------------------------------------------------------------------------------------------------*/
- // Initializes internal variables related to calculating hidden days-of-week
- DateProfileGenerator.prototype.initHiddenDays = function () {
- var hiddenDays = this.options.hiddenDays || []; // array of day-of-week indices that are hidden
- var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool)
- var dayCnt = 0;
- var i;
- if (this.options.weekends === false) {
- hiddenDays.push(0, 6); // 0=sunday, 6=saturday
- }
- for (i = 0; i < 7; i++) {
- if (!(isHiddenDayHash[i] = hiddenDays.indexOf(i) !== -1)) {
- dayCnt++;
- }
- }
- if (!dayCnt) {
- throw new Error('invalid hiddenDays'); // all days were hidden? bad.
- }
- this.isHiddenDayHash = isHiddenDayHash;
- };
- // Remove days from the beginning and end of the range that are computed as hidden.
- // If the whole range is trimmed off, returns null
- DateProfileGenerator.prototype.trimHiddenDays = function (range) {
- var start = range.start;
- var end = range.end;
- if (start) {
- start = this.skipHiddenDays(start);
- }
- if (end) {
- end = this.skipHiddenDays(end, -1, true);
- }
- if (start == null || end == null || start < end) {
- return { start: start, end: end };
- }
- return null;
- };
- // Is the current day hidden?
- // `day` is a day-of-week index (0-6), or a Date (used for UTC)
- DateProfileGenerator.prototype.isHiddenDay = function (day) {
- if (day instanceof Date) {
- day = day.getUTCDay();
- }
- return this.isHiddenDayHash[day];
- };
- // Incrementing the current day until it is no longer a hidden day, returning a copy.
- // DOES NOT CONSIDER validRange!
- // If the initial value of `date` is not a hidden day, don't do anything.
- // Pass `isExclusive` as `true` if you are dealing with an end date.
- // `inc` defaults to `1` (increment one day forward each time)
- DateProfileGenerator.prototype.skipHiddenDays = function (date, inc, isExclusive) {
- if (inc === void 0) { inc = 1; }
- if (isExclusive === void 0) { isExclusive = false; }
- while (this.isHiddenDayHash[(date.getUTCDay() + (isExclusive ? inc : 0) + 7) % 7]) {
- date = addDays(date, inc);
- }
- return date;
- };
- return DateProfileGenerator;
- }());
- // TODO: find a way to avoid comparing DateProfiles. it's tedious
- function isDateProfilesEqual(p0, p1) {
- return rangesEqual(p0.validRange, p1.validRange) &&
- rangesEqual(p0.activeRange, p1.activeRange) &&
- rangesEqual(p0.renderRange, p1.renderRange) &&
- durationsEqual(p0.minTime, p1.minTime) &&
- durationsEqual(p0.maxTime, p1.maxTime);
- /*
- TODO: compare more?
- currentRange: DateRange
- currentRangeUnit: string
- isRangeAllDay: boolean
- isValid: boolean
- dateIncrement: Duration
- */
- }
- function reduce (state, action, calendar) {
- var viewType = reduceViewType(state.viewType, action);
- var dateProfile = reduceDateProfile(state.dateProfile, action, state.currentDate, viewType, calendar);
- var eventSources = reduceEventSources(state.eventSources, action, dateProfile, calendar);
- var nextState = __assign({}, state, { viewType: viewType,
- dateProfile: dateProfile, currentDate: reduceCurrentDate(state.currentDate, action, dateProfile), eventSources: eventSources, eventStore: reduceEventStore(state.eventStore, action, eventSources, dateProfile, calendar), dateSelection: reduceDateSelection(state.dateSelection, action, calendar), eventSelection: reduceSelectedEvent(state.eventSelection, action), eventDrag: reduceEventDrag(state.eventDrag, action, eventSources, calendar), eventResize: reduceEventResize(state.eventResize, action, eventSources, calendar), eventSourceLoadingLevel: computeLoadingLevel(eventSources), loadingLevel: computeLoadingLevel(eventSources) });
- for (var _i = 0, _a = calendar.pluginSystem.hooks.reducers; _i < _a.length; _i++) {
- var reducerFunc = _a[_i];
- nextState = reducerFunc(nextState, action, calendar);
- }
- // console.log(action.type, nextState)
- return nextState;
- }
- function reduceViewType(currentViewType, action) {
- switch (action.type) {
- case 'SET_VIEW_TYPE':
- return action.viewType;
- default:
- return currentViewType;
- }
- }
- function reduceDateProfile(currentDateProfile, action, currentDate, viewType, calendar) {
- var newDateProfile;
- switch (action.type) {
- case 'PREV':
- newDateProfile = calendar.dateProfileGenerators[viewType].buildPrev(currentDateProfile, currentDate);
- break;
- case 'NEXT':
- newDateProfile = calendar.dateProfileGenerators[viewType].buildNext(currentDateProfile, currentDate);
- break;
- case 'SET_DATE':
- if (!currentDateProfile.activeRange ||
- !rangeContainsMarker(currentDateProfile.currentRange, action.dateMarker)) {
- newDateProfile = calendar.dateProfileGenerators[viewType].build(action.dateMarker, undefined, true // forceToValid
- );
- }
- break;
- case 'SET_VIEW_TYPE':
- var generator = calendar.dateProfileGenerators[viewType];
- if (!generator) {
- throw new Error(viewType ?
- 'The FullCalendar view "' + viewType + '" does not exist. Make sure your plugins are loaded correctly.' :
- 'No available FullCalendar view plugins.');
- }
- newDateProfile = generator.build(action.dateMarker || currentDate, undefined, true // forceToValid
- );
- break;
- }
- if (newDateProfile &&
- newDateProfile.isValid &&
- !(currentDateProfile && isDateProfilesEqual(currentDateProfile, newDateProfile))) {
- return newDateProfile;
- }
- else {
- return currentDateProfile;
- }
- }
- function reduceCurrentDate(currentDate, action, dateProfile) {
- switch (action.type) {
- case 'PREV':
- case 'NEXT':
- if (!rangeContainsMarker(dateProfile.currentRange, currentDate)) {
- return dateProfile.currentRange.start;
- }
- else {
- return currentDate;
- }
- case 'SET_DATE':
- case 'SET_VIEW_TYPE':
- var newDate = action.dateMarker || currentDate;
- if (dateProfile.activeRange && !rangeContainsMarker(dateProfile.activeRange, newDate)) {
- return dateProfile.currentRange.start;
- }
- else {
- return newDate;
- }
- default:
- return currentDate;
- }
- }
- function reduceDateSelection(currentSelection, action, calendar) {
- switch (action.type) {
- case 'SELECT_DATES':
- return action.selection;
- case 'UNSELECT_DATES':
- return null;
- default:
- return currentSelection;
- }
- }
- function reduceSelectedEvent(currentInstanceId, action) {
- switch (action.type) {
- case 'SELECT_EVENT':
- return action.eventInstanceId;
- case 'UNSELECT_EVENT':
- return '';
- default:
- return currentInstanceId;
- }
- }
- function reduceEventDrag(currentDrag, action, sources, calendar) {
- switch (action.type) {
- case 'SET_EVENT_DRAG':
- var newDrag = action.state;
- return {
- affectedEvents: newDrag.affectedEvents,
- mutatedEvents: newDrag.mutatedEvents,
- isEvent: newDrag.isEvent,
- origSeg: newDrag.origSeg
- };
- case 'UNSET_EVENT_DRAG':
- return null;
- default:
- return currentDrag;
- }
- }
- function reduceEventResize(currentResize, action, sources, calendar) {
- switch (action.type) {
- case 'SET_EVENT_RESIZE':
- var newResize = action.state;
- return {
- affectedEvents: newResize.affectedEvents,
- mutatedEvents: newResize.mutatedEvents,
- isEvent: newResize.isEvent,
- origSeg: newResize.origSeg
- };
- case 'UNSET_EVENT_RESIZE':
- return null;
- default:
- return currentResize;
- }
- }
- function computeLoadingLevel(eventSources) {
- var cnt = 0;
- for (var sourceId in eventSources) {
- if (eventSources[sourceId].isFetching) {
- cnt++;
- }
- }
- return cnt;
- }
- var STANDARD_PROPS = {
- start: null,
- end: null,
- allDay: Boolean
- };
- function parseDateSpan(raw, dateEnv, defaultDuration) {
- var span = parseOpenDateSpan(raw, dateEnv);
- var range = span.range;
- if (!range.start) {
- return null;
- }
- if (!range.end) {
- if (defaultDuration == null) {
- return null;
- }
- else {
- range.end = dateEnv.add(range.start, defaultDuration);
- }
- }
- return span;
- }
- /*
- TODO: somehow combine with parseRange?
- Will return null if the start/end props were present but parsed invalidly.
- */
- function parseOpenDateSpan(raw, dateEnv) {
- var leftovers = {};
- var standardProps = refineProps(raw, STANDARD_PROPS, {}, leftovers);
- var startMeta = standardProps.start ? dateEnv.createMarkerMeta(standardProps.start) : null;
- var endMeta = standardProps.end ? dateEnv.createMarkerMeta(standardProps.end) : null;
- var allDay = standardProps.allDay;
- if (allDay == null) {
- allDay = (startMeta && startMeta.isTimeUnspecified) &&
- (!endMeta || endMeta.isTimeUnspecified);
- }
- // use this leftover object as the selection object
- leftovers.range = {
- start: startMeta ? startMeta.marker : null,
- end: endMeta ? endMeta.marker : null
- };
- leftovers.allDay = allDay;
- return leftovers;
- }
- function isDateSpansEqual(span0, span1) {
- return rangesEqual(span0.range, span1.range) &&
- span0.allDay === span1.allDay &&
- isSpanPropsEqual(span0, span1);
- }
- // the NON-DATE-RELATED props
- function isSpanPropsEqual(span0, span1) {
- for (var propName in span1) {
- if (propName !== 'range' && propName !== 'allDay') {
- if (span0[propName] !== span1[propName]) {
- return false;
- }
- }
- }
- // are there any props that span0 has that span1 DOESN'T have?
- // both have range/allDay, so no need to special-case.
- for (var propName in span0) {
- if (!(propName in span1)) {
- return false;
- }
- }
- return true;
- }
- function buildDateSpanApi(span, dateEnv) {
- return {
- start: dateEnv.toDate(span.range.start),
- end: dateEnv.toDate(span.range.end),
- startStr: dateEnv.formatIso(span.range.start, { omitTime: span.allDay }),
- endStr: dateEnv.formatIso(span.range.end, { omitTime: span.allDay }),
- allDay: span.allDay
- };
- }
- function buildDatePointApi(span, dateEnv) {
- return {
- date: dateEnv.toDate(span.range.start),
- dateStr: dateEnv.formatIso(span.range.start, { omitTime: span.allDay }),
- allDay: span.allDay
- };
- }
- function fabricateEventRange(dateSpan, eventUiBases, calendar) {
- var def = parseEventDef({ editable: false }, '', // sourceId
- dateSpan.allDay, true, // hasEnd
- calendar);
- return {
- def: def,
- ui: compileEventUi(def, eventUiBases),
- instance: createEventInstance(def.defId, dateSpan.range),
- range: dateSpan.range,
- isStart: true,
- isEnd: true
- };
- }
- function compileViewDefs(defaultConfigs, overrideConfigs) {
- var hash = {};
- var viewType;
- for (viewType in defaultConfigs) {
- ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs);
- }
- for (viewType in overrideConfigs) {
- ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs);
- }
- return hash;
- }
- function ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs) {
- if (hash[viewType]) {
- return hash[viewType];
- }
- var viewDef = buildViewDef(viewType, hash, defaultConfigs, overrideConfigs);
- if (viewDef) {
- hash[viewType] = viewDef;
- }
- return viewDef;
- }
- function buildViewDef(viewType, hash, defaultConfigs, overrideConfigs) {
- var defaultConfig = defaultConfigs[viewType];
- var overrideConfig = overrideConfigs[viewType];
- var queryProp = function (name) {
- return (defaultConfig && defaultConfig[name] !== null) ? defaultConfig[name] :
- ((overrideConfig && overrideConfig[name] !== null) ? overrideConfig[name] : null);
- };
- var theClass = queryProp('class');
- var superType = queryProp('superType');
- if (!superType && theClass) {
- superType =
- findViewNameBySubclass(theClass, overrideConfigs) ||
- findViewNameBySubclass(theClass, defaultConfigs);
- }
- var superDef = null;
- if (superType) {
- if (superType === viewType) {
- throw new Error('Can\'t have a custom view type that references itself');
- }
- superDef = ensureViewDef(superType, hash, defaultConfigs, overrideConfigs);
- }
- if (!theClass && superDef) {
- theClass = superDef.class;
- }
- if (!theClass) {
- return null; // don't throw a warning, might be settings for a single-unit view
- }
- return {
- type: viewType,
- class: theClass,
- defaults: __assign({}, (superDef ? superDef.defaults : {}), (defaultConfig ? defaultConfig.options : {})),
- overrides: __assign({}, (superDef ? superDef.overrides : {}), (overrideConfig ? overrideConfig.options : {}))
- };
- }
- function findViewNameBySubclass(viewSubclass, configs) {
- var superProto = Object.getPrototypeOf(viewSubclass.prototype);
- for (var viewType in configs) {
- var parsed = configs[viewType];
- // need DIRECT subclass, so instanceof won't do it
- if (parsed.class && parsed.class.prototype === superProto) {
- return viewType;
- }
- }
- return '';
- }
- function parseViewConfigs(inputs) {
- return mapHash(inputs, parseViewConfig);
- }
- var VIEW_DEF_PROPS = {
- type: String,
- class: null
- };
- function parseViewConfig(input) {
- if (typeof input === 'function') {
- input = { class: input };
- }
- var options = {};
- var props = refineProps(input, VIEW_DEF_PROPS, {}, options);
- return {
- superType: props.type,
- class: props.class,
- options: options
- };
- }
- function buildViewSpecs(defaultInputs, optionsManager) {
- var defaultConfigs = parseViewConfigs(defaultInputs);
- var overrideConfigs = parseViewConfigs(optionsManager.overrides.views);
- var viewDefs = compileViewDefs(defaultConfigs, overrideConfigs);
- return mapHash(viewDefs, function (viewDef) {
- return buildViewSpec(viewDef, overrideConfigs, optionsManager);
- });
- }
- function buildViewSpec(viewDef, overrideConfigs, optionsManager) {
- var durationInput = viewDef.overrides.duration ||
- viewDef.defaults.duration ||
- optionsManager.dynamicOverrides.duration ||
- optionsManager.overrides.duration;
- var duration = null;
- var durationUnit = '';
- var singleUnit = '';
- var singleUnitOverrides = {};
- if (durationInput) {
- duration = createDuration(durationInput);
- if (duration) { // valid?
- var denom = greatestDurationDenominator(duration, !getWeeksFromInput(durationInput));
- durationUnit = denom.unit;
- if (denom.value === 1) {
- singleUnit = durationUnit;
- singleUnitOverrides = overrideConfigs[durationUnit] ? overrideConfigs[durationUnit].options : {};
- }
- }
- }
- var queryButtonText = function (options) {
- var buttonTextMap = options.buttonText || {};
- var buttonTextKey = viewDef.defaults.buttonTextKey;
- if (buttonTextKey != null && buttonTextMap[buttonTextKey] != null) {
- return buttonTextMap[buttonTextKey];
- }
- if (buttonTextMap[viewDef.type] != null) {
- return buttonTextMap[viewDef.type];
- }
- if (buttonTextMap[singleUnit] != null) {
- return buttonTextMap[singleUnit];
- }
- };
- return {
- type: viewDef.type,
- class: viewDef.class,
- duration: duration,
- durationUnit: durationUnit,
- singleUnit: singleUnit,
- options: __assign({}, globalDefaults, viewDef.defaults, optionsManager.dirDefaults, optionsManager.localeDefaults, optionsManager.overrides, singleUnitOverrides, viewDef.overrides, optionsManager.dynamicOverrides),
- buttonTextOverride: queryButtonText(optionsManager.dynamicOverrides) ||
- queryButtonText(optionsManager.overrides) || // constructor-specified buttonText lookup hash takes precedence
- viewDef.overrides.buttonText,
- buttonTextDefault: queryButtonText(optionsManager.localeDefaults) ||
- queryButtonText(optionsManager.dirDefaults) ||
- viewDef.defaults.buttonText ||
- queryButtonText(globalDefaults) ||
- viewDef.type // fall back to given view name
- };
- }
- var Toolbar = /** @class */ (function (_super) {
- __extends(Toolbar, _super);
- function Toolbar(extraClassName) {
- var _this = _super.call(this) || this;
- _this._renderLayout = memoizeRendering(_this.renderLayout, _this.unrenderLayout);
- _this._updateTitle = memoizeRendering(_this.updateTitle, null, [_this._renderLayout]);
- _this._updateActiveButton = memoizeRendering(_this.updateActiveButton, null, [_this._renderLayout]);
- _this._updateToday = memoizeRendering(_this.updateToday, null, [_this._renderLayout]);
- _this._updatePrev = memoizeRendering(_this.updatePrev, null, [_this._renderLayout]);
- _this._updateNext = memoizeRendering(_this.updateNext, null, [_this._renderLayout]);
- _this.el = createElement('div', { className: 'fc-toolbar ' + extraClassName });
- return _this;
- }
- Toolbar.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- this._renderLayout.unrender(); // should unrender everything else
- removeElement(this.el);
- };
- Toolbar.prototype.render = function (props) {
- this._renderLayout(props.layout);
- this._updateTitle(props.title);
- this._updateActiveButton(props.activeButton);
- this._updateToday(props.isTodayEnabled);
- this._updatePrev(props.isPrevEnabled);
- this._updateNext(props.isNextEnabled);
- };
- Toolbar.prototype.renderLayout = function (layout) {
- var el = this.el;
- this.viewsWithButtons = [];
- appendToElement(el, this.renderSection('left', layout.left));
- appendToElement(el, this.renderSection('center', layout.center));
- appendToElement(el, this.renderSection('right', layout.right));
- };
- Toolbar.prototype.unrenderLayout = function () {
- this.el.innerHTML = '';
- };
- Toolbar.prototype.renderSection = function (position, buttonStr) {
- var _this = this;
- var _a = this.context, theme = _a.theme, calendar = _a.calendar;
- var optionsManager = calendar.optionsManager;
- var viewSpecs = calendar.viewSpecs;
- var sectionEl = createElement('div', { className: 'fc-' + position });
- var calendarCustomButtons = optionsManager.computed.customButtons || {};
- var calendarButtonTextOverrides = optionsManager.overrides.buttonText || {};
- var calendarButtonText = optionsManager.computed.buttonText || {};
- if (buttonStr) {
- buttonStr.split(' ').forEach(function (buttonGroupStr, i) {
- var groupChildren = [];
- var isOnlyButtons = true;
- var groupEl;
- buttonGroupStr.split(',').forEach(function (buttonName, j) {
- var customButtonProps;
- var viewSpec;
- var buttonClick;
- var buttonIcon; // only one of these will be set
- var buttonText; // "
- var buttonInnerHtml;
- var buttonClasses;
- var buttonEl;
- var buttonAriaAttr;
- if (buttonName === 'title') {
- groupChildren.push(htmlToElement('<h2> </h2>')); // we always want it to take up height
- isOnlyButtons = false;
- }
- else {
- if ((customButtonProps = calendarCustomButtons[buttonName])) {
- buttonClick = function (ev) {
- if (customButtonProps.click) {
- customButtonProps.click.call(buttonEl, ev);
- }
- };
- (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) ||
- (buttonIcon = theme.getIconClass(buttonName)) ||
- (buttonText = customButtonProps.text);
- }
- else if ((viewSpec = viewSpecs[buttonName])) {
- _this.viewsWithButtons.push(buttonName);
- buttonClick = function () {
- calendar.changeView(buttonName);
- };
- (buttonText = viewSpec.buttonTextOverride) ||
- (buttonIcon = theme.getIconClass(buttonName)) ||
- (buttonText = viewSpec.buttonTextDefault);
- }
- else if (calendar[buttonName]) { // a calendar method
- buttonClick = function () {
- calendar[buttonName]();
- };
- (buttonText = calendarButtonTextOverrides[buttonName]) ||
- (buttonIcon = theme.getIconClass(buttonName)) ||
- (buttonText = calendarButtonText[buttonName]);
- // ^ everything else is considered default
- }
- if (buttonClick) {
- buttonClasses = [
- 'fc-' + buttonName + '-button',
- theme.getClass('button')
- ];
- if (buttonText) {
- buttonInnerHtml = htmlEscape(buttonText);
- buttonAriaAttr = '';
- }
- else if (buttonIcon) {
- buttonInnerHtml = "<span class='" + buttonIcon + "'></span>";
- buttonAriaAttr = ' aria-label="' + buttonName + '"';
- }
- buttonEl = htmlToElement(// type="button" so that it doesn't submit a form
- '<button type="button" class="' + buttonClasses.join(' ') + '"' +
- buttonAriaAttr +
- '>' + buttonInnerHtml + '</button>');
- buttonEl.addEventListener('click', buttonClick);
- groupChildren.push(buttonEl);
- }
- }
- });
- if (groupChildren.length > 1) {
- groupEl = document.createElement('div');
- var buttonGroupClassName = theme.getClass('buttonGroup');
- if (isOnlyButtons && buttonGroupClassName) {
- groupEl.classList.add(buttonGroupClassName);
- }
- appendToElement(groupEl, groupChildren);
- sectionEl.appendChild(groupEl);
- }
- else {
- appendToElement(sectionEl, groupChildren); // 1 or 0 children
- }
- });
- }
- return sectionEl;
- };
- Toolbar.prototype.updateToday = function (isTodayEnabled) {
- this.toggleButtonEnabled('today', isTodayEnabled);
- };
- Toolbar.prototype.updatePrev = function (isPrevEnabled) {
- this.toggleButtonEnabled('prev', isPrevEnabled);
- };
- Toolbar.prototype.updateNext = function (isNextEnabled) {
- this.toggleButtonEnabled('next', isNextEnabled);
- };
- Toolbar.prototype.updateTitle = function (text) {
- findElements(this.el, 'h2').forEach(function (titleEl) {
- titleEl.innerText = text;
- });
- };
- Toolbar.prototype.updateActiveButton = function (buttonName) {
- var theme = this.context.theme;
- var className = theme.getClass('buttonActive');
- findElements(this.el, 'button').forEach(function (buttonEl) {
- if (buttonName && buttonEl.classList.contains('fc-' + buttonName + '-button')) {
- buttonEl.classList.add(className);
- }
- else {
- buttonEl.classList.remove(className);
- }
- });
- };
- Toolbar.prototype.toggleButtonEnabled = function (buttonName, bool) {
- findElements(this.el, '.fc-' + buttonName + '-button').forEach(function (buttonEl) {
- buttonEl.disabled = !bool;
- });
- };
- return Toolbar;
- }(Component));
- var CalendarComponent = /** @class */ (function (_super) {
- __extends(CalendarComponent, _super);
- function CalendarComponent(el) {
- var _this = _super.call(this) || this;
- _this.elClassNames = [];
- _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
- _this.renderToolbars = memoizeRendering(_this._renderToolbars, _this._unrenderToolbars, [_this.renderSkeleton]);
- _this.buildComponentContext = memoize(buildComponentContext);
- _this.buildViewPropTransformers = memoize(buildViewPropTransformers);
- _this.el = el;
- _this.computeTitle = memoize(computeTitle);
- _this.parseBusinessHours = memoize(function (input) {
- return parseBusinessHours(input, _this.context.calendar);
- });
- return _this;
- }
- CalendarComponent.prototype.render = function (props, context) {
- this.freezeHeight();
- var title = this.computeTitle(props.dateProfile, props.viewSpec.options);
- this.renderSkeleton(context);
- this.renderToolbars(props.viewSpec, props.dateProfile, props.currentDate, title);
- this.renderView(props, title);
- this.updateSize();
- this.thawHeight();
- };
- CalendarComponent.prototype.destroy = function () {
- if (this.header) {
- this.header.destroy();
- }
- if (this.footer) {
- this.footer.destroy();
- }
- this.renderSkeleton.unrender(); // will call destroyView
- _super.prototype.destroy.call(this);
- };
- CalendarComponent.prototype._renderSkeleton = function (context) {
- this.updateElClassNames(context);
- prependToElement(this.el, this.contentEl = createElement('div', { className: 'fc-view-container' }));
- var calendar = context.calendar;
- for (var _i = 0, _a = calendar.pluginSystem.hooks.viewContainerModifiers; _i < _a.length; _i++) {
- var modifyViewContainer = _a[_i];
- modifyViewContainer(this.contentEl, calendar);
- }
- };
- CalendarComponent.prototype._unrenderSkeleton = function () {
- // weird to have this here
- if (this.view) {
- this.savedScroll = this.view.queryScroll();
- this.view.destroy();
- this.view = null;
- }
- removeElement(this.contentEl);
- this.removeElClassNames();
- };
- CalendarComponent.prototype.removeElClassNames = function () {
- var classList = this.el.classList;
- for (var _i = 0, _a = this.elClassNames; _i < _a.length; _i++) {
- var className = _a[_i];
- classList.remove(className);
- }
- this.elClassNames = [];
- };
- CalendarComponent.prototype.updateElClassNames = function (context) {
- this.removeElClassNames();
- var theme = context.theme, options = context.options;
- this.elClassNames = [
- 'fc',
- 'fc-' + options.dir,
- theme.getClass('widget')
- ];
- var classList = this.el.classList;
- for (var _i = 0, _a = this.elClassNames; _i < _a.length; _i++) {
- var className = _a[_i];
- classList.add(className);
- }
- };
- CalendarComponent.prototype._renderToolbars = function (viewSpec, dateProfile, currentDate, title) {
- var _a = this, context = _a.context, header = _a.header, footer = _a.footer;
- var options = context.options, calendar = context.calendar;
- var headerLayout = options.header;
- var footerLayout = options.footer;
- var dateProfileGenerator = this.props.dateProfileGenerator;
- var now = calendar.getNow();
- var todayInfo = dateProfileGenerator.build(now);
- var prevInfo = dateProfileGenerator.buildPrev(dateProfile, currentDate);
- var nextInfo = dateProfileGenerator.buildNext(dateProfile, currentDate);
- var toolbarProps = {
- title: title,
- activeButton: viewSpec.type,
- isTodayEnabled: todayInfo.isValid && !rangeContainsMarker(dateProfile.currentRange, now),
- isPrevEnabled: prevInfo.isValid,
- isNextEnabled: nextInfo.isValid
- };
- if (headerLayout) {
- if (!header) {
- header = this.header = new Toolbar('fc-header-toolbar');
- prependToElement(this.el, header.el);
- }
- header.receiveProps(__assign({ layout: headerLayout }, toolbarProps), context);
- }
- else if (header) {
- header.destroy();
- header = this.header = null;
- }
- if (footerLayout) {
- if (!footer) {
- footer = this.footer = new Toolbar('fc-footer-toolbar');
- appendToElement(this.el, footer.el);
- }
- footer.receiveProps(__assign({ layout: footerLayout }, toolbarProps), context);
- }
- else if (footer) {
- footer.destroy();
- footer = this.footer = null;
- }
- };
- CalendarComponent.prototype._unrenderToolbars = function () {
- if (this.header) {
- this.header.destroy();
- this.header = null;
- }
- if (this.footer) {
- this.footer.destroy();
- this.footer = null;
- }
- };
- CalendarComponent.prototype.renderView = function (props, title) {
- var view = this.view;
- var _a = this.context, calendar = _a.calendar, options = _a.options;
- var viewSpec = props.viewSpec, dateProfileGenerator = props.dateProfileGenerator;
- if (!view || view.viewSpec !== viewSpec) {
- if (view) {
- view.destroy();
- }
- view = this.view = new viewSpec['class'](viewSpec, this.contentEl);
- if (this.savedScroll) {
- view.addScroll(this.savedScroll, true);
- this.savedScroll = null;
- }
- }
- view.title = title; // for the API
- var viewProps = {
- dateProfileGenerator: dateProfileGenerator,
- dateProfile: props.dateProfile,
- businessHours: this.parseBusinessHours(viewSpec.options.businessHours),
- eventStore: props.eventStore,
- eventUiBases: props.eventUiBases,
- dateSelection: props.dateSelection,
- eventSelection: props.eventSelection,
- eventDrag: props.eventDrag,
- eventResize: props.eventResize
- };
- var transformers = this.buildViewPropTransformers(calendar.pluginSystem.hooks.viewPropsTransformers);
- for (var _i = 0, transformers_1 = transformers; _i < transformers_1.length; _i++) {
- var transformer = transformers_1[_i];
- __assign(viewProps, transformer.transform(viewProps, viewSpec, props, options));
- }
- view.receiveProps(viewProps, this.buildComponentContext(this.context, viewSpec, view));
- };
- // Sizing
- // -----------------------------------------------------------------------------------------------------------------
- CalendarComponent.prototype.updateSize = function (isResize) {
- if (isResize === void 0) { isResize = false; }
- var view = this.view;
- if (!view) {
- return; // why?
- }
- if (isResize || this.isHeightAuto == null) {
- this.computeHeightVars();
- }
- view.updateSize(isResize, this.viewHeight, this.isHeightAuto);
- view.updateNowIndicator(); // we need to guarantee this will run after updateSize
- view.popScroll(isResize);
- };
- CalendarComponent.prototype.computeHeightVars = function () {
- var calendar = this.context.calendar; // yuck. need to handle dynamic options
- var heightInput = calendar.opt('height');
- var contentHeightInput = calendar.opt('contentHeight');
- this.isHeightAuto = heightInput === 'auto' || contentHeightInput === 'auto';
- if (typeof contentHeightInput === 'number') { // exists and not 'auto'
- this.viewHeight = contentHeightInput;
- }
- else if (typeof contentHeightInput === 'function') { // exists and is a function
- this.viewHeight = contentHeightInput();
- }
- else if (typeof heightInput === 'number') { // exists and not 'auto'
- this.viewHeight = heightInput - this.queryToolbarsHeight();
- }
- else if (typeof heightInput === 'function') { // exists and is a function
- this.viewHeight = heightInput() - this.queryToolbarsHeight();
- }
- else if (heightInput === 'parent') { // set to height of parent element
- var parentEl = this.el.parentNode;
- this.viewHeight = parentEl.getBoundingClientRect().height - this.queryToolbarsHeight();
- }
- else {
- this.viewHeight = Math.round(this.contentEl.getBoundingClientRect().width /
- Math.max(calendar.opt('aspectRatio'), .5));
- }
- };
- CalendarComponent.prototype.queryToolbarsHeight = function () {
- var height = 0;
- if (this.header) {
- height += computeHeightAndMargins(this.header.el);
- }
- if (this.footer) {
- height += computeHeightAndMargins(this.footer.el);
- }
- return height;
- };
- // Height "Freezing"
- // -----------------------------------------------------------------------------------------------------------------
- CalendarComponent.prototype.freezeHeight = function () {
- applyStyle(this.el, {
- height: this.el.getBoundingClientRect().height,
- overflow: 'hidden'
- });
- };
- CalendarComponent.prototype.thawHeight = function () {
- applyStyle(this.el, {
- height: '',
- overflow: ''
- });
- };
- return CalendarComponent;
- }(Component));
- // Title and Date Formatting
- // -----------------------------------------------------------------------------------------------------------------
- // Computes what the title at the top of the calendar should be for this view
- function computeTitle(dateProfile, viewOptions) {
- var range;
- // for views that span a large unit of time, show the proper interval, ignoring stray days before and after
- if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) {
- range = dateProfile.currentRange;
- }
- else { // for day units or smaller, use the actual day range
- range = dateProfile.activeRange;
- }
- return this.context.dateEnv.formatRange(range.start, range.end, createFormatter(viewOptions.titleFormat || computeTitleFormat(dateProfile), viewOptions.titleRangeSeparator), { isEndExclusive: dateProfile.isRangeAllDay });
- }
- // Generates the format string that should be used to generate the title for the current date range.
- // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`.
- function computeTitleFormat(dateProfile) {
- var currentRangeUnit = dateProfile.currentRangeUnit;
- if (currentRangeUnit === 'year') {
- return { year: 'numeric' };
- }
- else if (currentRangeUnit === 'month') {
- return { year: 'numeric', month: 'long' }; // like "September 2014"
- }
- else {
- var days = diffWholeDays(dateProfile.currentRange.start, dateProfile.currentRange.end);
- if (days !== null && days > 1) {
- // multi-day range. shorter, like "Sep 9 - 10 2014"
- return { year: 'numeric', month: 'short', day: 'numeric' };
- }
- else {
- // one day. longer, like "September 9 2014"
- return { year: 'numeric', month: 'long', day: 'numeric' };
- }
- }
- }
- // build a context scoped to the view
- function buildComponentContext(context, viewSpec, view) {
- return context.extend(viewSpec.options, view);
- }
- // Plugin
- // -----------------------------------------------------------------------------------------------------------------
- function buildViewPropTransformers(theClasses) {
- return theClasses.map(function (theClass) {
- return new theClass();
- });
- }
- var Interaction = /** @class */ (function () {
- function Interaction(settings) {
- this.component = settings.component;
- }
- Interaction.prototype.destroy = function () {
- };
- return Interaction;
- }());
- function parseInteractionSettings(component, input) {
- return {
- component: component,
- el: input.el,
- useEventCenter: input.useEventCenter != null ? input.useEventCenter : true
- };
- }
- function interactionSettingsToStore(settings) {
- var _a;
- return _a = {},
- _a[settings.component.uid] = settings,
- _a;
- }
- // global state
- var interactionSettingsStore = {};
- /*
- Detects when the user clicks on an event within a DateComponent
- */
- var EventClicking = /** @class */ (function (_super) {
- __extends(EventClicking, _super);
- function EventClicking(settings) {
- var _this = _super.call(this, settings) || this;
- _this.handleSegClick = function (ev, segEl) {
- var component = _this.component;
- var _a = component.context, calendar = _a.calendar, view = _a.view;
- var seg = getElSeg(segEl);
- if (seg && // might be the <div> surrounding the more link
- component.isValidSegDownEl(ev.target)) {
- // our way to simulate a link click for elements that can't be <a> tags
- // grab before trigger fired in case trigger trashes DOM thru rerendering
- var hasUrlContainer = elementClosest(ev.target, '.fc-has-url');
- var url = hasUrlContainer ? hasUrlContainer.querySelector('a[href]').href : '';
- calendar.publiclyTrigger('eventClick', [
- {
- el: segEl,
- event: new EventApi(component.context.calendar, seg.eventRange.def, seg.eventRange.instance),
- jsEvent: ev,
- view: view
- }
- ]);
- if (url && !ev.defaultPrevented) {
- window.location.href = url;
- }
- }
- };
- var component = settings.component;
- _this.destroy = listenBySelector(component.el, 'click', component.fgSegSelector + ',' + component.bgSegSelector, _this.handleSegClick);
- return _this;
- }
- return EventClicking;
- }(Interaction));
- /*
- Triggers events and adds/removes core classNames when the user's pointer
- enters/leaves event-elements of a component.
- */
- var EventHovering = /** @class */ (function (_super) {
- __extends(EventHovering, _super);
- function EventHovering(settings) {
- var _this = _super.call(this, settings) || this;
- // for simulating an eventMouseLeave when the event el is destroyed while mouse is over it
- _this.handleEventElRemove = function (el) {
- if (el === _this.currentSegEl) {
- _this.handleSegLeave(null, _this.currentSegEl);
- }
- };
- _this.handleSegEnter = function (ev, segEl) {
- if (getElSeg(segEl)) { // TODO: better way to make sure not hovering over more+ link or its wrapper
- segEl.classList.add('fc-allow-mouse-resize');
- _this.currentSegEl = segEl;
- _this.triggerEvent('eventMouseEnter', ev, segEl);
- }
- };
- _this.handleSegLeave = function (ev, segEl) {
- if (_this.currentSegEl) {
- segEl.classList.remove('fc-allow-mouse-resize');
- _this.currentSegEl = null;
- _this.triggerEvent('eventMouseLeave', ev, segEl);
- }
- };
- var component = settings.component;
- _this.removeHoverListeners = listenToHoverBySelector(component.el, component.fgSegSelector + ',' + component.bgSegSelector, _this.handleSegEnter, _this.handleSegLeave);
- // how to make sure component already has context?
- component.context.calendar.on('eventElRemove', _this.handleEventElRemove);
- return _this;
- }
- EventHovering.prototype.destroy = function () {
- this.removeHoverListeners();
- this.component.context.calendar.off('eventElRemove', this.handleEventElRemove);
- };
- EventHovering.prototype.triggerEvent = function (publicEvName, ev, segEl) {
- var component = this.component;
- var _a = component.context, calendar = _a.calendar, view = _a.view;
- var seg = getElSeg(segEl);
- if (!ev || component.isValidSegDownEl(ev.target)) {
- calendar.publiclyTrigger(publicEvName, [
- {
- el: segEl,
- event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
- jsEvent: ev,
- view: view
- }
- ]);
- }
- };
- return EventHovering;
- }(Interaction));
- var StandardTheme = /** @class */ (function (_super) {
- __extends(StandardTheme, _super);
- function StandardTheme() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- return StandardTheme;
- }(Theme));
- StandardTheme.prototype.classes = {
- widget: 'fc-unthemed',
- widgetHeader: 'fc-widget-header',
- widgetContent: 'fc-widget-content',
- buttonGroup: 'fc-button-group',
- button: 'fc-button fc-button-primary',
- buttonActive: 'fc-button-active',
- popoverHeader: 'fc-widget-header',
- popoverContent: 'fc-widget-content',
- // day grid
- headerRow: 'fc-widget-header',
- dayRow: 'fc-widget-content',
- // list view
- listView: 'fc-widget-content'
- };
- StandardTheme.prototype.baseIconClass = 'fc-icon';
- StandardTheme.prototype.iconClasses = {
- close: 'fc-icon-x',
- prev: 'fc-icon-chevron-left',
- next: 'fc-icon-chevron-right',
- prevYear: 'fc-icon-chevrons-left',
- nextYear: 'fc-icon-chevrons-right'
- };
- StandardTheme.prototype.iconOverrideOption = 'buttonIcons';
- StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon';
- StandardTheme.prototype.iconOverridePrefix = 'fc-icon-';
- var Calendar = /** @class */ (function () {
- function Calendar(el, overrides) {
- var _this = this;
- this.buildComponentContext = memoize(buildComponentContext$1);
- this.parseRawLocales = memoize(parseRawLocales);
- this.buildLocale = memoize(buildLocale);
- this.buildDateEnv = memoize(buildDateEnv);
- this.buildTheme = memoize(buildTheme);
- this.buildEventUiSingleBase = memoize(this._buildEventUiSingleBase);
- this.buildSelectionConfig = memoize(this._buildSelectionConfig);
- this.buildEventUiBySource = memoizeOutput(buildEventUiBySource, isPropsEqual);
- this.buildEventUiBases = memoize(buildEventUiBases);
- this.interactionsStore = {};
- this.actionQueue = [];
- this.isReducing = false;
- // isDisplaying: boolean = false // installed in DOM? accepting renders?
- this.needsRerender = false; // needs a render?
- this.isRendering = false; // currently in the executeRender function?
- this.renderingPauseDepth = 0;
- this.buildDelayedRerender = memoize(buildDelayedRerender);
- this.afterSizingTriggers = {};
- this.isViewUpdated = false;
- this.isDatesUpdated = false;
- this.isEventsUpdated = false;
- this.el = el;
- this.optionsManager = new OptionsManager(overrides || {});
- this.pluginSystem = new PluginSystem();
- // only do once. don't do in handleOptions. because can't remove plugins
- this.addPluginInputs(this.optionsManager.computed.plugins || []);
- this.handleOptions(this.optionsManager.computed);
- this.publiclyTrigger('_init'); // for tests
- this.hydrate();
- this.calendarInteractions = this.pluginSystem.hooks.calendarInteractions
- .map(function (calendarInteractionClass) {
- return new calendarInteractionClass(_this);
- });
- }
- Calendar.prototype.addPluginInputs = function (pluginInputs) {
- var pluginDefs = refinePluginDefs(pluginInputs);
- for (var _i = 0, pluginDefs_1 = pluginDefs; _i < pluginDefs_1.length; _i++) {
- var pluginDef = pluginDefs_1[_i];
- this.pluginSystem.add(pluginDef);
- }
- };
- Object.defineProperty(Calendar.prototype, "view", {
- // public API
- get: function () {
- return this.component ? this.component.view : null;
- },
- enumerable: true,
- configurable: true
- });
- // Public API for rendering
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.render = function () {
- if (!this.component) {
- this.component = new CalendarComponent(this.el);
- this.renderableEventStore = createEmptyEventStore();
- this.bindHandlers();
- this.executeRender();
- }
- else {
- this.requestRerender();
- }
- };
- Calendar.prototype.destroy = function () {
- if (this.component) {
- this.unbindHandlers();
- this.component.destroy(); // don't null-out. in case API needs access
- this.component = null; // umm ???
- for (var _i = 0, _a = this.calendarInteractions; _i < _a.length; _i++) {
- var interaction = _a[_i];
- interaction.destroy();
- }
- this.publiclyTrigger('_destroyed');
- }
- };
- // Handlers
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.bindHandlers = function () {
- var _this = this;
- // event delegation for nav links
- this.removeNavLinkListener = listenBySelector(this.el, 'click', 'a[data-goto]', function (ev, anchorEl) {
- var gotoOptions = anchorEl.getAttribute('data-goto');
- gotoOptions = gotoOptions ? JSON.parse(gotoOptions) : {};
- var dateEnv = _this.dateEnv;
- var dateMarker = dateEnv.createMarker(gotoOptions.date);
- var viewType = gotoOptions.type;
- // property like "navLinkDayClick". might be a string or a function
- var customAction = _this.viewOpt('navLink' + capitaliseFirstLetter(viewType) + 'Click');
- if (typeof customAction === 'function') {
- customAction(dateEnv.toDate(dateMarker), ev);
- }
- else {
- if (typeof customAction === 'string') {
- viewType = customAction;
- }
- _this.zoomTo(dateMarker, viewType);
- }
- });
- if (this.opt('handleWindowResize')) {
- window.addEventListener('resize', this.windowResizeProxy = debounce(// prevents rapid calls
- this.windowResize.bind(this), this.opt('windowResizeDelay')));
- }
- };
- Calendar.prototype.unbindHandlers = function () {
- this.removeNavLinkListener();
- if (this.windowResizeProxy) {
- window.removeEventListener('resize', this.windowResizeProxy);
- this.windowResizeProxy = null;
- }
- };
- // Dispatcher
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.hydrate = function () {
- var _this = this;
- this.state = this.buildInitialState();
- var rawSources = this.opt('eventSources') || [];
- var singleRawSource = this.opt('events');
- var sources = []; // parsed
- if (singleRawSource) {
- rawSources.unshift(singleRawSource);
- }
- for (var _i = 0, rawSources_1 = rawSources; _i < rawSources_1.length; _i++) {
- var rawSource = rawSources_1[_i];
- var source = parseEventSource(rawSource, this);
- if (source) {
- sources.push(source);
- }
- }
- this.batchRendering(function () {
- _this.dispatch({ type: 'INIT' }); // pass in sources here?
- _this.dispatch({ type: 'ADD_EVENT_SOURCES', sources: sources });
- _this.dispatch({
- type: 'SET_VIEW_TYPE',
- viewType: _this.opt('defaultView') || _this.pluginSystem.hooks.defaultView
- });
- });
- };
- Calendar.prototype.buildInitialState = function () {
- return {
- viewType: null,
- loadingLevel: 0,
- eventSourceLoadingLevel: 0,
- currentDate: this.getInitialDate(),
- dateProfile: null,
- eventSources: {},
- eventStore: createEmptyEventStore(),
- dateSelection: null,
- eventSelection: '',
- eventDrag: null,
- eventResize: null
- };
- };
- Calendar.prototype.dispatch = function (action) {
- this.actionQueue.push(action);
- if (!this.isReducing) {
- this.isReducing = true;
- var oldState = this.state;
- while (this.actionQueue.length) {
- this.state = this.reduce(this.state, this.actionQueue.shift(), this);
- }
- var newState = this.state;
- this.isReducing = false;
- if (!oldState.loadingLevel && newState.loadingLevel) {
- this.publiclyTrigger('loading', [true]);
- }
- else if (oldState.loadingLevel && !newState.loadingLevel) {
- this.publiclyTrigger('loading', [false]);
- }
- var view = this.component && this.component.view;
- if (oldState.eventStore !== newState.eventStore) {
- if (oldState.eventStore) {
- this.isEventsUpdated = true;
- }
- }
- if (oldState.dateProfile !== newState.dateProfile) {
- if (oldState.dateProfile && view) { // why would view be null!?
- this.publiclyTrigger('datesDestroy', [
- {
- view: view,
- el: view.el
- }
- ]);
- }
- this.isDatesUpdated = true;
- }
- if (oldState.viewType !== newState.viewType) {
- if (oldState.viewType && view) { // why would view be null!?
- this.publiclyTrigger('viewSkeletonDestroy', [
- {
- view: view,
- el: view.el
- }
- ]);
- }
- this.isViewUpdated = true;
- }
- this.requestRerender();
- }
- };
- Calendar.prototype.reduce = function (state, action, calendar) {
- return reduce(state, action, calendar);
- };
- // Render Queue
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.requestRerender = function () {
- this.needsRerender = true;
- this.delayedRerender(); // will call a debounced-version of tryRerender
- };
- Calendar.prototype.tryRerender = function () {
- if (this.component && // must be accepting renders
- this.needsRerender && // indicates that a rerender was requested
- !this.renderingPauseDepth && // not paused
- !this.isRendering // not currently in the render loop
- ) {
- this.executeRender();
- }
- };
- Calendar.prototype.batchRendering = function (func) {
- this.renderingPauseDepth++;
- func();
- this.renderingPauseDepth--;
- if (this.needsRerender) {
- this.requestRerender();
- }
- };
- // Rendering
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.executeRender = function () {
- // clear these BEFORE the render so that new values will accumulate during render
- this.needsRerender = false;
- this.isRendering = true;
- this.renderComponent();
- this.isRendering = false;
- // received a rerender request while rendering
- if (this.needsRerender) {
- this.delayedRerender();
- }
- };
- /*
- don't call this directly. use executeRender instead
- */
- Calendar.prototype.renderComponent = function () {
- var _a = this, state = _a.state, component = _a.component;
- var viewType = state.viewType;
- var viewSpec = this.viewSpecs[viewType];
- if (!viewSpec) {
- throw new Error("View type \"" + viewType + "\" is not valid");
- }
- // if event sources are still loading and progressive rendering hasn't been enabled,
- // keep rendering the last fully loaded set of events
- var renderableEventStore = this.renderableEventStore =
- (state.eventSourceLoadingLevel && !this.opt('progressiveEventRendering')) ?
- this.renderableEventStore :
- state.eventStore;
- var eventUiSingleBase = this.buildEventUiSingleBase(viewSpec.options);
- var eventUiBySource = this.buildEventUiBySource(state.eventSources);
- var eventUiBases = this.eventUiBases = this.buildEventUiBases(renderableEventStore.defs, eventUiSingleBase, eventUiBySource);
- component.receiveProps(__assign({}, state, { viewSpec: viewSpec, dateProfileGenerator: this.dateProfileGenerators[viewType], dateProfile: state.dateProfile, eventStore: renderableEventStore, eventUiBases: eventUiBases, dateSelection: state.dateSelection, eventSelection: state.eventSelection, eventDrag: state.eventDrag, eventResize: state.eventResize }), this.buildComponentContext(this.theme, this.dateEnv, this.optionsManager.computed));
- if (this.isViewUpdated) {
- this.isViewUpdated = false;
- this.publiclyTrigger('viewSkeletonRender', [
- {
- view: component.view,
- el: component.view.el
- }
- ]);
- }
- if (this.isDatesUpdated) {
- this.isDatesUpdated = false;
- this.publiclyTrigger('datesRender', [
- {
- view: component.view,
- el: component.view.el
- }
- ]);
- }
- if (this.isEventsUpdated) {
- this.isEventsUpdated = false;
- }
- this.releaseAfterSizingTriggers();
- };
- // Options
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.setOption = function (name, val) {
- var _a;
- this.mutateOptions((_a = {}, _a[name] = val, _a), [], true);
- };
- Calendar.prototype.getOption = function (name) {
- return this.optionsManager.computed[name];
- };
- Calendar.prototype.opt = function (name) {
- return this.optionsManager.computed[name];
- };
- Calendar.prototype.viewOpt = function (name) {
- return this.viewOpts()[name];
- };
- Calendar.prototype.viewOpts = function () {
- return this.viewSpecs[this.state.viewType].options;
- };
- /*
- handles option changes (like a diff)
- */
- Calendar.prototype.mutateOptions = function (updates, removals, isDynamic, deepEqual) {
- var _this = this;
- var changeHandlers = this.pluginSystem.hooks.optionChangeHandlers;
- var normalUpdates = {};
- var specialUpdates = {};
- var oldDateEnv = this.dateEnv; // do this before handleOptions
- var isTimeZoneDirty = false;
- var isSizeDirty = false;
- var anyDifficultOptions = Boolean(removals.length);
- for (var name_1 in updates) {
- if (changeHandlers[name_1]) {
- specialUpdates[name_1] = updates[name_1];
- }
- else {
- normalUpdates[name_1] = updates[name_1];
- }
- }
- for (var name_2 in normalUpdates) {
- if (/^(height|contentHeight|aspectRatio)$/.test(name_2)) {
- isSizeDirty = true;
- }
- else if (/^(defaultDate|defaultView)$/.test(name_2)) ;
- else {
- anyDifficultOptions = true;
- if (name_2 === 'timeZone') {
- isTimeZoneDirty = true;
- }
- }
- }
- this.optionsManager.mutate(normalUpdates, removals, isDynamic);
- if (anyDifficultOptions) {
- this.handleOptions(this.optionsManager.computed);
- }
- this.batchRendering(function () {
- if (anyDifficultOptions) {
- if (isTimeZoneDirty) {
- _this.dispatch({
- type: 'CHANGE_TIMEZONE',
- oldDateEnv: oldDateEnv
- });
- }
- /* HACK
- has the same effect as calling this.requestRerender()
- but recomputes the state's dateProfile
- */
- _this.dispatch({
- type: 'SET_VIEW_TYPE',
- viewType: _this.state.viewType
- });
- }
- else if (isSizeDirty) {
- _this.updateSize();
- }
- // special updates
- if (deepEqual) {
- for (var name_3 in specialUpdates) {
- changeHandlers[name_3](specialUpdates[name_3], _this, deepEqual);
- }
- }
- });
- };
- /*
- rebuilds things based off of a complete set of refined options
- */
- Calendar.prototype.handleOptions = function (options) {
- var _this = this;
- var pluginHooks = this.pluginSystem.hooks;
- this.defaultAllDayEventDuration = createDuration(options.defaultAllDayEventDuration);
- this.defaultTimedEventDuration = createDuration(options.defaultTimedEventDuration);
- this.delayedRerender = this.buildDelayedRerender(options.rerenderDelay);
- this.theme = this.buildTheme(options);
- var available = this.parseRawLocales(options.locales);
- this.availableRawLocales = available.map;
- var locale = this.buildLocale(options.locale || available.defaultCode, available.map);
- this.dateEnv = this.buildDateEnv(locale, options.timeZone, pluginHooks.namedTimeZonedImpl, options.firstDay, options.weekNumberCalculation, options.weekLabel, pluginHooks.cmdFormatter);
- this.selectionConfig = this.buildSelectionConfig(options); // needs dateEnv. do after :(
- // ineffecient to do every time?
- this.viewSpecs = buildViewSpecs(pluginHooks.views, this.optionsManager);
- // ineffecient to do every time?
- this.dateProfileGenerators = mapHash(this.viewSpecs, function (viewSpec) {
- return new viewSpec.class.prototype.dateProfileGeneratorClass(viewSpec, _this);
- });
- };
- Calendar.prototype.getAvailableLocaleCodes = function () {
- return Object.keys(this.availableRawLocales);
- };
- Calendar.prototype._buildSelectionConfig = function (rawOpts) {
- return processScopedUiProps('select', rawOpts, this);
- };
- Calendar.prototype._buildEventUiSingleBase = function (rawOpts) {
- if (rawOpts.editable) { // so 'editable' affected events
- rawOpts = __assign({}, rawOpts, { eventEditable: true });
- }
- return processScopedUiProps('event', rawOpts, this);
- };
- // Trigger
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.hasPublicHandlers = function (name) {
- return this.hasHandlers(name) ||
- this.opt(name); // handler specified in options
- };
- Calendar.prototype.publiclyTrigger = function (name, args) {
- var optHandler = this.opt(name);
- this.triggerWith(name, this, args);
- if (optHandler) {
- return optHandler.apply(this, args);
- }
- };
- Calendar.prototype.publiclyTriggerAfterSizing = function (name, args) {
- var afterSizingTriggers = this.afterSizingTriggers;
- (afterSizingTriggers[name] || (afterSizingTriggers[name] = [])).push(args);
- };
- Calendar.prototype.releaseAfterSizingTriggers = function () {
- var afterSizingTriggers = this.afterSizingTriggers;
- for (var name_4 in afterSizingTriggers) {
- for (var _i = 0, _a = afterSizingTriggers[name_4]; _i < _a.length; _i++) {
- var args = _a[_i];
- this.publiclyTrigger(name_4, args);
- }
- }
- this.afterSizingTriggers = {};
- };
- // View
- // -----------------------------------------------------------------------------------------------------------------
- // Returns a boolean about whether the view is okay to instantiate at some point
- Calendar.prototype.isValidViewType = function (viewType) {
- return Boolean(this.viewSpecs[viewType]);
- };
- Calendar.prototype.changeView = function (viewType, dateOrRange) {
- var dateMarker = null;
- if (dateOrRange) {
- if (dateOrRange.start && dateOrRange.end) { // a range
- this.optionsManager.mutate({ visibleRange: dateOrRange }, []); // will not rerender
- this.handleOptions(this.optionsManager.computed); // ...but yuck
- }
- else { // a date
- dateMarker = this.dateEnv.createMarker(dateOrRange); // just like gotoDate
- }
- }
- this.unselect();
- this.dispatch({
- type: 'SET_VIEW_TYPE',
- viewType: viewType,
- dateMarker: dateMarker
- });
- };
- // Forces navigation to a view for the given date.
- // `viewType` can be a specific view name or a generic one like "week" or "day".
- // needs to change
- Calendar.prototype.zoomTo = function (dateMarker, viewType) {
- var spec;
- viewType = viewType || 'day'; // day is default zoom
- spec = this.viewSpecs[viewType] ||
- this.getUnitViewSpec(viewType);
- this.unselect();
- if (spec) {
- this.dispatch({
- type: 'SET_VIEW_TYPE',
- viewType: spec.type,
- dateMarker: dateMarker
- });
- }
- else {
- this.dispatch({
- type: 'SET_DATE',
- dateMarker: dateMarker
- });
- }
- };
- // Given a duration singular unit, like "week" or "day", finds a matching view spec.
- // Preference is given to views that have corresponding buttons.
- Calendar.prototype.getUnitViewSpec = function (unit) {
- var component = this.component;
- var viewTypes = [];
- var i;
- var spec;
- // put views that have buttons first. there will be duplicates, but oh
- if (component.header) {
- viewTypes.push.apply(viewTypes, component.header.viewsWithButtons);
- }
- if (component.footer) {
- viewTypes.push.apply(viewTypes, component.footer.viewsWithButtons);
- }
- for (var viewType in this.viewSpecs) {
- viewTypes.push(viewType);
- }
- for (i = 0; i < viewTypes.length; i++) {
- spec = this.viewSpecs[viewTypes[i]];
- if (spec) {
- if (spec.singleUnit === unit) {
- return spec;
- }
- }
- }
- };
- // Current Date
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.getInitialDate = function () {
- var defaultDateInput = this.opt('defaultDate');
- // compute the initial ambig-timezone date
- if (defaultDateInput != null) {
- return this.dateEnv.createMarker(defaultDateInput);
- }
- else {
- return this.getNow(); // getNow already returns unzoned
- }
- };
- Calendar.prototype.prev = function () {
- this.unselect();
- this.dispatch({ type: 'PREV' });
- };
- Calendar.prototype.next = function () {
- this.unselect();
- this.dispatch({ type: 'NEXT' });
- };
- Calendar.prototype.prevYear = function () {
- this.unselect();
- this.dispatch({
- type: 'SET_DATE',
- dateMarker: this.dateEnv.addYears(this.state.currentDate, -1)
- });
- };
- Calendar.prototype.nextYear = function () {
- this.unselect();
- this.dispatch({
- type: 'SET_DATE',
- dateMarker: this.dateEnv.addYears(this.state.currentDate, 1)
- });
- };
- Calendar.prototype.today = function () {
- this.unselect();
- this.dispatch({
- type: 'SET_DATE',
- dateMarker: this.getNow()
- });
- };
- Calendar.prototype.gotoDate = function (zonedDateInput) {
- this.unselect();
- this.dispatch({
- type: 'SET_DATE',
- dateMarker: this.dateEnv.createMarker(zonedDateInput)
- });
- };
- Calendar.prototype.incrementDate = function (deltaInput) {
- var delta = createDuration(deltaInput);
- if (delta) { // else, warn about invalid input?
- this.unselect();
- this.dispatch({
- type: 'SET_DATE',
- dateMarker: this.dateEnv.add(this.state.currentDate, delta)
- });
- }
- };
- // for external API
- Calendar.prototype.getDate = function () {
- return this.dateEnv.toDate(this.state.currentDate);
- };
- // Date Formatting Utils
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.formatDate = function (d, formatter) {
- var dateEnv = this.dateEnv;
- return dateEnv.format(dateEnv.createMarker(d), createFormatter(formatter));
- };
- // `settings` is for formatter AND isEndExclusive
- Calendar.prototype.formatRange = function (d0, d1, settings) {
- var dateEnv = this.dateEnv;
- return dateEnv.formatRange(dateEnv.createMarker(d0), dateEnv.createMarker(d1), createFormatter(settings, this.opt('defaultRangeSeparator')), settings);
- };
- Calendar.prototype.formatIso = function (d, omitTime) {
- var dateEnv = this.dateEnv;
- return dateEnv.formatIso(dateEnv.createMarker(d), { omitTime: omitTime });
- };
- // Sizing
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.windowResize = function (ev) {
- if (!this.isHandlingWindowResize &&
- this.component && // why?
- ev.target === window // not a jqui resize event
- ) {
- this.isHandlingWindowResize = true;
- this.updateSize();
- this.publiclyTrigger('windowResize', [this.view]);
- this.isHandlingWindowResize = false;
- }
- };
- Calendar.prototype.updateSize = function () {
- if (this.component) { // when?
- this.component.updateSize(true);
- }
- };
- // Component Registration
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.registerInteractiveComponent = function (component, settingsInput) {
- var settings = parseInteractionSettings(component, settingsInput);
- var DEFAULT_INTERACTIONS = [
- EventClicking,
- EventHovering
- ];
- var interactionClasses = DEFAULT_INTERACTIONS.concat(this.pluginSystem.hooks.componentInteractions);
- var interactions = interactionClasses.map(function (interactionClass) {
- return new interactionClass(settings);
- });
- this.interactionsStore[component.uid] = interactions;
- interactionSettingsStore[component.uid] = settings;
- };
- Calendar.prototype.unregisterInteractiveComponent = function (component) {
- for (var _i = 0, _a = this.interactionsStore[component.uid]; _i < _a.length; _i++) {
- var listener = _a[_i];
- listener.destroy();
- }
- delete this.interactionsStore[component.uid];
- delete interactionSettingsStore[component.uid];
- };
- // Date Selection / Event Selection / DayClick
- // -----------------------------------------------------------------------------------------------------------------
- // this public method receives start/end dates in any format, with any timezone
- // NOTE: args were changed from v3
- Calendar.prototype.select = function (dateOrObj, endDate) {
- var selectionInput;
- if (endDate == null) {
- if (dateOrObj.start != null) {
- selectionInput = dateOrObj;
- }
- else {
- selectionInput = {
- start: dateOrObj,
- end: null
- };
- }
- }
- else {
- selectionInput = {
- start: dateOrObj,
- end: endDate
- };
- }
- var selection = parseDateSpan(selectionInput, this.dateEnv, createDuration({ days: 1 }) // TODO: cache this?
- );
- if (selection) { // throw parse error otherwise?
- this.dispatch({ type: 'SELECT_DATES', selection: selection });
- this.triggerDateSelect(selection);
- }
- };
- // public method
- Calendar.prototype.unselect = function (pev) {
- if (this.state.dateSelection) {
- this.dispatch({ type: 'UNSELECT_DATES' });
- this.triggerDateUnselect(pev);
- }
- };
- Calendar.prototype.triggerDateSelect = function (selection, pev) {
- var arg = __assign({}, this.buildDateSpanApi(selection), { jsEvent: pev ? pev.origEvent : null, view: this.view });
- this.publiclyTrigger('select', [arg]);
- };
- Calendar.prototype.triggerDateUnselect = function (pev) {
- this.publiclyTrigger('unselect', [
- {
- jsEvent: pev ? pev.origEvent : null,
- view: this.view
- }
- ]);
- };
- // TODO: receive pev?
- Calendar.prototype.triggerDateClick = function (dateSpan, dayEl, view, ev) {
- var arg = __assign({}, this.buildDatePointApi(dateSpan), { dayEl: dayEl, jsEvent: ev, // Is this always a mouse event? See #4655
- view: view });
- this.publiclyTrigger('dateClick', [arg]);
- };
- Calendar.prototype.buildDatePointApi = function (dateSpan) {
- var props = {};
- for (var _i = 0, _a = this.pluginSystem.hooks.datePointTransforms; _i < _a.length; _i++) {
- var transform = _a[_i];
- __assign(props, transform(dateSpan, this));
- }
- __assign(props, buildDatePointApi(dateSpan, this.dateEnv));
- return props;
- };
- Calendar.prototype.buildDateSpanApi = function (dateSpan) {
- var props = {};
- for (var _i = 0, _a = this.pluginSystem.hooks.dateSpanTransforms; _i < _a.length; _i++) {
- var transform = _a[_i];
- __assign(props, transform(dateSpan, this));
- }
- __assign(props, buildDateSpanApi(dateSpan, this.dateEnv));
- return props;
- };
- // Date Utils
- // -----------------------------------------------------------------------------------------------------------------
- // Returns a DateMarker for the current date, as defined by the client's computer or from the `now` option
- Calendar.prototype.getNow = function () {
- var now = this.opt('now');
- if (typeof now === 'function') {
- now = now();
- }
- if (now == null) {
- return this.dateEnv.createNowMarker();
- }
- return this.dateEnv.createMarker(now);
- };
- // Event-Date Utilities
- // -----------------------------------------------------------------------------------------------------------------
- // Given an event's allDay status and start date, return what its fallback end date should be.
- // TODO: rename to computeDefaultEventEnd
- Calendar.prototype.getDefaultEventEnd = function (allDay, marker) {
- var end = marker;
- if (allDay) {
- end = startOfDay(end);
- end = this.dateEnv.add(end, this.defaultAllDayEventDuration);
- }
- else {
- end = this.dateEnv.add(end, this.defaultTimedEventDuration);
- }
- return end;
- };
- // Public Events API
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.addEvent = function (eventInput, sourceInput) {
- if (eventInput instanceof EventApi) {
- var def = eventInput._def;
- var instance = eventInput._instance;
- // not already present? don't want to add an old snapshot
- if (!this.state.eventStore.defs[def.defId]) {
- this.dispatch({
- type: 'ADD_EVENTS',
- eventStore: eventTupleToStore({ def: def, instance: instance }) // TODO: better util for two args?
- });
- }
- return eventInput;
- }
- var sourceId;
- if (sourceInput instanceof EventSourceApi) {
- sourceId = sourceInput.internalEventSource.sourceId;
- }
- else if (sourceInput != null) {
- var sourceApi = this.getEventSourceById(sourceInput); // TODO: use an internal function
- if (!sourceApi) {
- console.warn('Could not find an event source with ID "' + sourceInput + '"'); // TODO: test
- return null;
- }
- else {
- sourceId = sourceApi.internalEventSource.sourceId;
- }
- }
- var tuple = parseEvent(eventInput, sourceId, this);
- if (tuple) {
- this.dispatch({
- type: 'ADD_EVENTS',
- eventStore: eventTupleToStore(tuple)
- });
- return new EventApi(this, tuple.def, tuple.def.recurringDef ? null : tuple.instance);
- }
- return null;
- };
- // TODO: optimize
- Calendar.prototype.getEventById = function (id) {
- var _a = this.state.eventStore, defs = _a.defs, instances = _a.instances;
- id = String(id);
- for (var defId in defs) {
- var def = defs[defId];
- if (def.publicId === id) {
- if (def.recurringDef) {
- return new EventApi(this, def, null);
- }
- else {
- for (var instanceId in instances) {
- var instance = instances[instanceId];
- if (instance.defId === def.defId) {
- return new EventApi(this, def, instance);
- }
- }
- }
- }
- }
- return null;
- };
- Calendar.prototype.getEvents = function () {
- var _a = this.state.eventStore, defs = _a.defs, instances = _a.instances;
- var eventApis = [];
- for (var id in instances) {
- var instance = instances[id];
- var def = defs[instance.defId];
- eventApis.push(new EventApi(this, def, instance));
- }
- return eventApis;
- };
- Calendar.prototype.removeAllEvents = function () {
- this.dispatch({ type: 'REMOVE_ALL_EVENTS' });
- };
- Calendar.prototype.rerenderEvents = function () {
- this.dispatch({ type: 'RESET_EVENTS' });
- };
- // Public Event Sources API
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.getEventSources = function () {
- var sourceHash = this.state.eventSources;
- var sourceApis = [];
- for (var internalId in sourceHash) {
- sourceApis.push(new EventSourceApi(this, sourceHash[internalId]));
- }
- return sourceApis;
- };
- Calendar.prototype.getEventSourceById = function (id) {
- var sourceHash = this.state.eventSources;
- id = String(id);
- for (var sourceId in sourceHash) {
- if (sourceHash[sourceId].publicId === id) {
- return new EventSourceApi(this, sourceHash[sourceId]);
- }
- }
- return null;
- };
- Calendar.prototype.addEventSource = function (sourceInput) {
- if (sourceInput instanceof EventSourceApi) {
- // not already present? don't want to add an old snapshot
- if (!this.state.eventSources[sourceInput.internalEventSource.sourceId]) {
- this.dispatch({
- type: 'ADD_EVENT_SOURCES',
- sources: [sourceInput.internalEventSource]
- });
- }
- return sourceInput;
- }
- var eventSource = parseEventSource(sourceInput, this);
- if (eventSource) { // TODO: error otherwise?
- this.dispatch({ type: 'ADD_EVENT_SOURCES', sources: [eventSource] });
- return new EventSourceApi(this, eventSource);
- }
- return null;
- };
- Calendar.prototype.removeAllEventSources = function () {
- this.dispatch({ type: 'REMOVE_ALL_EVENT_SOURCES' });
- };
- Calendar.prototype.refetchEvents = function () {
- this.dispatch({ type: 'FETCH_EVENT_SOURCES' });
- };
- // Scroll
- // -----------------------------------------------------------------------------------------------------------------
- Calendar.prototype.scrollToTime = function (timeInput) {
- var duration = createDuration(timeInput);
- if (duration) {
- this.component.view.scrollToDuration(duration);
- }
- };
- return Calendar;
- }());
- EmitterMixin.mixInto(Calendar);
- // for memoizers
- // -----------------------------------------------------------------------------------------------------------------
- function buildComponentContext$1(theme, dateEnv, options) {
- return new ComponentContext(this, theme, dateEnv, options, null);
- }
- function buildDateEnv(locale, timeZone, namedTimeZoneImpl, firstDay, weekNumberCalculation, weekLabel, cmdFormatter) {
- return new DateEnv({
- calendarSystem: 'gregory',
- timeZone: timeZone,
- namedTimeZoneImpl: namedTimeZoneImpl,
- locale: locale,
- weekNumberCalculation: weekNumberCalculation,
- firstDay: firstDay,
- weekLabel: weekLabel,
- cmdFormatter: cmdFormatter
- });
- }
- function buildTheme(calendarOptions) {
- var themeClass = this.pluginSystem.hooks.themeClasses[calendarOptions.themeSystem] || StandardTheme;
- return new themeClass(calendarOptions);
- }
- function buildDelayedRerender(wait) {
- var func = this.tryRerender.bind(this);
- if (wait != null) {
- func = debounce(func, wait);
- }
- return func;
- }
- function buildEventUiBySource(eventSources) {
- return mapHash(eventSources, function (eventSource) {
- return eventSource.ui;
- });
- }
- function buildEventUiBases(eventDefs, eventUiSingleBase, eventUiBySource) {
- var eventUiBases = { '': eventUiSingleBase };
- for (var defId in eventDefs) {
- var def = eventDefs[defId];
- if (def.sourceId && eventUiBySource[def.sourceId]) {
- eventUiBases[defId] = eventUiBySource[def.sourceId];
- }
- }
- return eventUiBases;
- }
- var View = /** @class */ (function (_super) {
- __extends(View, _super);
- function View(viewSpec, parentEl) {
- var _this = _super.call(this, createElement('div', { className: 'fc-view fc-' + viewSpec.type + '-view' })) || this;
- _this.renderDatesMem = memoizeRendering(_this.renderDatesWrap, _this.unrenderDatesWrap);
- _this.renderBusinessHoursMem = memoizeRendering(_this.renderBusinessHours, _this.unrenderBusinessHours, [_this.renderDatesMem]);
- _this.renderDateSelectionMem = memoizeRendering(_this.renderDateSelectionWrap, _this.unrenderDateSelectionWrap, [_this.renderDatesMem]);
- _this.renderEventsMem = memoizeRendering(_this.renderEvents, _this.unrenderEvents, [_this.renderDatesMem]);
- _this.renderEventSelectionMem = memoizeRendering(_this.renderEventSelectionWrap, _this.unrenderEventSelectionWrap, [_this.renderEventsMem]);
- _this.renderEventDragMem = memoizeRendering(_this.renderEventDragWrap, _this.unrenderEventDragWrap, [_this.renderDatesMem]);
- _this.renderEventResizeMem = memoizeRendering(_this.renderEventResizeWrap, _this.unrenderEventResizeWrap, [_this.renderDatesMem]);
- _this.viewSpec = viewSpec;
- _this.type = viewSpec.type;
- parentEl.appendChild(_this.el);
- _this.initialize();
- return _this;
- }
- View.prototype.initialize = function () {
- };
- Object.defineProperty(View.prototype, "activeStart", {
- // Date Setting/Unsetting
- // -----------------------------------------------------------------------------------------------------------------
- get: function () {
- return this.context.dateEnv.toDate(this.props.dateProfile.activeRange.start);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(View.prototype, "activeEnd", {
- get: function () {
- return this.context.dateEnv.toDate(this.props.dateProfile.activeRange.end);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(View.prototype, "currentStart", {
- get: function () {
- return this.context.dateEnv.toDate(this.props.dateProfile.currentRange.start);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(View.prototype, "currentEnd", {
- get: function () {
- return this.context.dateEnv.toDate(this.props.dateProfile.currentRange.end);
- },
- enumerable: true,
- configurable: true
- });
- // General Rendering
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.render = function (props, context) {
- this.renderDatesMem(props.dateProfile);
- this.renderBusinessHoursMem(props.businessHours);
- this.renderDateSelectionMem(props.dateSelection);
- this.renderEventsMem(props.eventStore);
- this.renderEventSelectionMem(props.eventSelection);
- this.renderEventDragMem(props.eventDrag);
- this.renderEventResizeMem(props.eventResize);
- };
- View.prototype.beforeUpdate = function () {
- this.addScroll(this.queryScroll());
- };
- View.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- this.renderDatesMem.unrender(); // should unrender everything else
- };
- // Sizing
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.updateSize = function (isResize, viewHeight, isAuto) {
- var calendar = this.context.calendar;
- if (isResize) {
- this.addScroll(this.queryScroll()); // NOTE: same code as in beforeUpdate
- }
- if (isResize || // HACKS...
- calendar.isViewUpdated ||
- calendar.isDatesUpdated ||
- calendar.isEventsUpdated) {
- // sort of the catch-all sizing
- // anything that might cause dimension changes
- this.updateBaseSize(isResize, viewHeight, isAuto);
- }
- // NOTE: popScroll is called by CalendarComponent
- };
- View.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {
- };
- // Date Rendering
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.renderDatesWrap = function (dateProfile) {
- this.renderDates(dateProfile);
- this.addScroll({
- duration: createDuration(this.context.options.scrollTime)
- });
- };
- View.prototype.unrenderDatesWrap = function () {
- this.stopNowIndicator();
- this.unrenderDates();
- };
- View.prototype.renderDates = function (dateProfile) { };
- View.prototype.unrenderDates = function () { };
- // Business Hours
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.renderBusinessHours = function (businessHours) { };
- View.prototype.unrenderBusinessHours = function () { };
- // Date Selection
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.renderDateSelectionWrap = function (selection) {
- if (selection) {
- this.renderDateSelection(selection);
- }
- };
- View.prototype.unrenderDateSelectionWrap = function (selection) {
- if (selection) {
- this.unrenderDateSelection(selection);
- }
- };
- View.prototype.renderDateSelection = function (selection) { };
- View.prototype.unrenderDateSelection = function (selection) { };
- // Event Rendering
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.renderEvents = function (eventStore) { };
- View.prototype.unrenderEvents = function () { };
- // util for subclasses
- View.prototype.sliceEvents = function (eventStore, allDay) {
- var props = this.props;
- return sliceEventStore(eventStore, props.eventUiBases, props.dateProfile.activeRange, allDay ? this.context.nextDayThreshold : null).fg;
- };
- // Event Selection
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.renderEventSelectionWrap = function (instanceId) {
- if (instanceId) {
- this.renderEventSelection(instanceId);
- }
- };
- View.prototype.unrenderEventSelectionWrap = function (instanceId) {
- if (instanceId) {
- this.unrenderEventSelection(instanceId);
- }
- };
- View.prototype.renderEventSelection = function (instanceId) { };
- View.prototype.unrenderEventSelection = function (instanceId) { };
- // Event Drag
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.renderEventDragWrap = function (state) {
- if (state) {
- this.renderEventDrag(state);
- }
- };
- View.prototype.unrenderEventDragWrap = function (state) {
- if (state) {
- this.unrenderEventDrag(state);
- }
- };
- View.prototype.renderEventDrag = function (state) { };
- View.prototype.unrenderEventDrag = function (state) { };
- // Event Resize
- // -----------------------------------------------------------------------------------------------------------------
- View.prototype.renderEventResizeWrap = function (state) {
- if (state) {
- this.renderEventResize(state);
- }
- };
- View.prototype.unrenderEventResizeWrap = function (state) {
- if (state) {
- this.unrenderEventResize(state);
- }
- };
- View.prototype.renderEventResize = function (state) { };
- View.prototype.unrenderEventResize = function (state) { };
- /* Now Indicator
- ------------------------------------------------------------------------------------------------------------------*/
- // Immediately render the current time indicator and begins re-rendering it at an interval,
- // which is defined by this.getNowIndicatorUnit().
- // TODO: somehow do this for the current whole day's background too
- // USAGE: must be called manually from subclasses' render methods! don't need to call stopNowIndicator tho
- View.prototype.startNowIndicator = function (dateProfile, dateProfileGenerator) {
- var _this = this;
- var _a = this.context, calendar = _a.calendar, dateEnv = _a.dateEnv, options = _a.options;
- var unit;
- var update;
- var delay; // ms wait value
- if (options.nowIndicator && !this.initialNowDate) {
- unit = this.getNowIndicatorUnit(dateProfile, dateProfileGenerator);
- if (unit) {
- update = this.updateNowIndicator.bind(this);
- this.initialNowDate = calendar.getNow();
- this.initialNowQueriedMs = new Date().valueOf();
- // wait until the beginning of the next interval
- delay = dateEnv.add(dateEnv.startOf(this.initialNowDate, unit), createDuration(1, unit)).valueOf() - this.initialNowDate.valueOf();
- // TODO: maybe always use setTimeout, waiting until start of next unit
- this.nowIndicatorTimeoutID = setTimeout(function () {
- _this.nowIndicatorTimeoutID = null;
- update();
- if (unit === 'second') {
- delay = 1000; // every second
- }
- else {
- delay = 1000 * 60; // otherwise, every minute
- }
- _this.nowIndicatorIntervalID = setInterval(update, delay); // update every interval
- }, delay);
- }
- // rendering will be initiated in updateSize
- }
- };
- // rerenders the now indicator, computing the new current time from the amount of time that has passed
- // since the initial getNow call.
- View.prototype.updateNowIndicator = function () {
- if (this.props.dateProfile && // a way to determine if dates were rendered yet
- this.initialNowDate // activated before?
- ) {
- this.unrenderNowIndicator(); // won't unrender if unnecessary
- this.renderNowIndicator(addMs(this.initialNowDate, new Date().valueOf() - this.initialNowQueriedMs));
- this.isNowIndicatorRendered = true;
- }
- };
- // Immediately unrenders the view's current time indicator and stops any re-rendering timers.
- // Won't cause side effects if indicator isn't rendered.
- View.prototype.stopNowIndicator = function () {
- if (this.nowIndicatorTimeoutID) {
- clearTimeout(this.nowIndicatorTimeoutID);
- this.nowIndicatorTimeoutID = null;
- }
- if (this.nowIndicatorIntervalID) {
- clearInterval(this.nowIndicatorIntervalID);
- this.nowIndicatorIntervalID = null;
- }
- if (this.isNowIndicatorRendered) {
- this.unrenderNowIndicator();
- this.isNowIndicatorRendered = false;
- }
- };
- View.prototype.getNowIndicatorUnit = function (dateProfile, dateProfileGenerator) {
- // subclasses should implement
- };
- // Renders a current time indicator at the given datetime
- View.prototype.renderNowIndicator = function (date) {
- // SUBCLASSES MUST PASS TO CHILDREN!
- };
- // Undoes the rendering actions from renderNowIndicator
- View.prototype.unrenderNowIndicator = function () {
- // SUBCLASSES MUST PASS TO CHILDREN!
- };
- /* Scroller
- ------------------------------------------------------------------------------------------------------------------*/
- View.prototype.addScroll = function (scroll, isForced) {
- if (isForced) {
- scroll.isForced = isForced;
- }
- __assign(this.queuedScroll || (this.queuedScroll = {}), scroll);
- };
- View.prototype.popScroll = function (isResize) {
- this.applyQueuedScroll(isResize);
- this.queuedScroll = null;
- };
- View.prototype.applyQueuedScroll = function (isResize) {
- if (this.queuedScroll) {
- this.applyScroll(this.queuedScroll, isResize);
- }
- };
- View.prototype.queryScroll = function () {
- var scroll = {};
- if (this.props.dateProfile) { // dates rendered yet?
- __assign(scroll, this.queryDateScroll());
- }
- return scroll;
- };
- View.prototype.applyScroll = function (scroll, isResize) {
- var duration = scroll.duration, isForced = scroll.isForced;
- if (duration != null && !isForced) {
- delete scroll.duration;
- if (this.props.dateProfile) { // dates rendered yet?
- __assign(scroll, this.computeDateScroll(duration));
- }
- }
- if (this.props.dateProfile) { // dates rendered yet?
- this.applyDateScroll(scroll);
- }
- };
- View.prototype.computeDateScroll = function (duration) {
- return {}; // subclasses must implement
- };
- View.prototype.queryDateScroll = function () {
- return {}; // subclasses must implement
- };
- View.prototype.applyDateScroll = function (scroll) {
- // subclasses must implement
- };
- // for API
- View.prototype.scrollToDuration = function (duration) {
- this.applyScroll({ duration: duration }, false);
- };
- return View;
- }(DateComponent));
- EmitterMixin.mixInto(View);
- View.prototype.usesMinMaxTime = false;
- View.prototype.dateProfileGeneratorClass = DateProfileGenerator;
- var FgEventRenderer = /** @class */ (function () {
- function FgEventRenderer() {
- this.segs = [];
- this.isSizeDirty = false;
- }
- FgEventRenderer.prototype.renderSegs = function (context, segs, mirrorInfo) {
- this.context = context;
- this.rangeUpdated(); // called too frequently :(
- // render an `.el` on each seg
- // returns a subset of the segs. segs that were actually rendered
- segs = this.renderSegEls(segs, mirrorInfo);
- this.segs = segs;
- this.attachSegs(segs, mirrorInfo);
- this.isSizeDirty = true;
- triggerRenderedSegs(this.context, this.segs, Boolean(mirrorInfo));
- };
- FgEventRenderer.prototype.unrender = function (context, _segs, mirrorInfo) {
- triggerWillRemoveSegs(this.context, this.segs, Boolean(mirrorInfo));
- this.detachSegs(this.segs);
- this.segs = [];
- };
- // Updates values that rely on options and also relate to range
- FgEventRenderer.prototype.rangeUpdated = function () {
- var options = this.context.options;
- var displayEventTime;
- var displayEventEnd;
- this.eventTimeFormat = createFormatter(options.eventTimeFormat || this.computeEventTimeFormat(), options.defaultRangeSeparator);
- displayEventTime = options.displayEventTime;
- if (displayEventTime == null) {
- displayEventTime = this.computeDisplayEventTime(); // might be based off of range
- }
- displayEventEnd = options.displayEventEnd;
- if (displayEventEnd == null) {
- displayEventEnd = this.computeDisplayEventEnd(); // might be based off of range
- }
- this.displayEventTime = displayEventTime;
- this.displayEventEnd = displayEventEnd;
- };
- // Renders and assigns an `el` property for each foreground event segment.
- // Only returns segments that successfully rendered.
- FgEventRenderer.prototype.renderSegEls = function (segs, mirrorInfo) {
- var html = '';
- var i;
- if (segs.length) { // don't build an empty html string
- // build a large concatenation of event segment HTML
- for (i = 0; i < segs.length; i++) {
- html += this.renderSegHtml(segs[i], mirrorInfo);
- }
- // Grab individual elements from the combined HTML string. Use each as the default rendering.
- // Then, compute the 'el' for each segment. An el might be null if the eventRender callback returned false.
- htmlToElements(html).forEach(function (el, i) {
- var seg = segs[i];
- if (el) {
- seg.el = el;
- }
- });
- segs = filterSegsViaEls(this.context, segs, Boolean(mirrorInfo));
- }
- return segs;
- };
- // Generic utility for generating the HTML classNames for an event segment's element
- FgEventRenderer.prototype.getSegClasses = function (seg, isDraggable, isResizable, mirrorInfo) {
- var classes = [
- 'fc-event',
- seg.isStart ? 'fc-start' : 'fc-not-start',
- seg.isEnd ? 'fc-end' : 'fc-not-end'
- ].concat(seg.eventRange.ui.classNames);
- if (isDraggable) {
- classes.push('fc-draggable');
- }
- if (isResizable) {
- classes.push('fc-resizable');
- }
- if (mirrorInfo) {
- classes.push('fc-mirror');
- if (mirrorInfo.isDragging) {
- classes.push('fc-dragging');
- }
- if (mirrorInfo.isResizing) {
- classes.push('fc-resizing');
- }
- }
- return classes;
- };
- // Compute the text that should be displayed on an event's element.
- // `range` can be the Event object itself, or something range-like, with at least a `start`.
- // If event times are disabled, or the event has no time, will return a blank string.
- // If not specified, formatter will default to the eventTimeFormat setting,
- // and displayEnd will default to the displayEventEnd setting.
- FgEventRenderer.prototype.getTimeText = function (eventRange, formatter, displayEnd) {
- var def = eventRange.def, instance = eventRange.instance;
- return this._getTimeText(instance.range.start, def.hasEnd ? instance.range.end : null, def.allDay, formatter, displayEnd, instance.forcedStartTzo, instance.forcedEndTzo);
- };
- FgEventRenderer.prototype._getTimeText = function (start, end, allDay, formatter, displayEnd, forcedStartTzo, forcedEndTzo) {
- var dateEnv = this.context.dateEnv;
- if (formatter == null) {
- formatter = this.eventTimeFormat;
- }
- if (displayEnd == null) {
- displayEnd = this.displayEventEnd;
- }
- if (this.displayEventTime && !allDay) {
- if (displayEnd && end) {
- return dateEnv.formatRange(start, end, formatter, {
- forcedStartTzo: forcedStartTzo,
- forcedEndTzo: forcedEndTzo
- });
- }
- else {
- return dateEnv.format(start, formatter, {
- forcedTzo: forcedStartTzo
- });
- }
- }
- return '';
- };
- FgEventRenderer.prototype.computeEventTimeFormat = function () {
- return {
- hour: 'numeric',
- minute: '2-digit',
- omitZeroMinute: true
- };
- };
- FgEventRenderer.prototype.computeDisplayEventTime = function () {
- return true;
- };
- FgEventRenderer.prototype.computeDisplayEventEnd = function () {
- return true;
- };
- // Utility for generating event skin-related CSS properties
- FgEventRenderer.prototype.getSkinCss = function (ui) {
- return {
- 'background-color': ui.backgroundColor,
- 'border-color': ui.borderColor,
- color: ui.textColor
- };
- };
- FgEventRenderer.prototype.sortEventSegs = function (segs) {
- var specs = this.context.eventOrderSpecs;
- var objs = segs.map(buildSegCompareObj);
- objs.sort(function (obj0, obj1) {
- return compareByFieldSpecs(obj0, obj1, specs);
- });
- return objs.map(function (c) {
- return c._seg;
- });
- };
- FgEventRenderer.prototype.computeSizes = function (force) {
- if (force || this.isSizeDirty) {
- this.computeSegSizes(this.segs);
- }
- };
- FgEventRenderer.prototype.assignSizes = function (force) {
- if (force || this.isSizeDirty) {
- this.assignSegSizes(this.segs);
- this.isSizeDirty = false;
- }
- };
- FgEventRenderer.prototype.computeSegSizes = function (segs) {
- };
- FgEventRenderer.prototype.assignSegSizes = function (segs) {
- };
- // Manipulation on rendered segs
- FgEventRenderer.prototype.hideByHash = function (hash) {
- if (hash) {
- for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
- var seg = _a[_i];
- if (hash[seg.eventRange.instance.instanceId]) {
- seg.el.style.visibility = 'hidden';
- }
- }
- }
- };
- FgEventRenderer.prototype.showByHash = function (hash) {
- if (hash) {
- for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
- var seg = _a[_i];
- if (hash[seg.eventRange.instance.instanceId]) {
- seg.el.style.visibility = '';
- }
- }
- }
- };
- FgEventRenderer.prototype.selectByInstanceId = function (instanceId) {
- if (instanceId) {
- for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
- var seg = _a[_i];
- var eventInstance = seg.eventRange.instance;
- if (eventInstance && eventInstance.instanceId === instanceId &&
- seg.el // necessary?
- ) {
- seg.el.classList.add('fc-selected');
- }
- }
- }
- };
- FgEventRenderer.prototype.unselectByInstanceId = function (instanceId) {
- if (instanceId) {
- for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
- var seg = _a[_i];
- if (seg.el) { // necessary?
- seg.el.classList.remove('fc-selected');
- }
- }
- }
- };
- return FgEventRenderer;
- }());
- // returns a object with all primitive props that can be compared
- function buildSegCompareObj(seg) {
- var eventDef = seg.eventRange.def;
- var range = seg.eventRange.instance.range;
- var start = range.start ? range.start.valueOf() : 0; // TODO: better support for open-range events
- var end = range.end ? range.end.valueOf() : 0; // "
- return __assign({}, eventDef.extendedProps, eventDef, { id: eventDef.publicId, start: start,
- end: end, duration: end - start, allDay: Number(eventDef.allDay), _seg: seg // for later retrieval
- });
- }
- /*
- TODO: when refactoring this class, make a new FillRenderer instance for each `type`
- */
- var FillRenderer = /** @class */ (function () {
- function FillRenderer() {
- this.fillSegTag = 'div';
- this.dirtySizeFlags = {};
- this.containerElsByType = {};
- this.segsByType = {};
- }
- FillRenderer.prototype.getSegsByType = function (type) {
- return this.segsByType[type] || [];
- };
- FillRenderer.prototype.renderSegs = function (type, context, segs) {
- var _a;
- this.context = context;
- var renderedSegs = this.renderSegEls(type, segs); // assignes `.el` to each seg. returns successfully rendered segs
- var containerEls = this.attachSegs(type, renderedSegs);
- if (containerEls) {
- (_a = (this.containerElsByType[type] || (this.containerElsByType[type] = []))).push.apply(_a, containerEls);
- }
- this.segsByType[type] = renderedSegs;
- if (type === 'bgEvent') {
- triggerRenderedSegs(context, renderedSegs, false); // isMirror=false
- }
- this.dirtySizeFlags[type] = true;
- };
- // Unrenders a specific type of fill that is currently rendered on the grid
- FillRenderer.prototype.unrender = function (type, context) {
- var segs = this.segsByType[type];
- if (segs) {
- if (type === 'bgEvent') {
- triggerWillRemoveSegs(context, segs, false); // isMirror=false
- }
- this.detachSegs(type, segs);
- }
- };
- // Renders and assigns an `el` property for each fill segment. Generic enough to work with different types.
- // Only returns segments that successfully rendered.
- FillRenderer.prototype.renderSegEls = function (type, segs) {
- var _this = this;
- var html = '';
- var i;
- if (segs.length) {
- // build a large concatenation of segment HTML
- for (i = 0; i < segs.length; i++) {
- html += this.renderSegHtml(type, segs[i]);
- }
- // Grab individual elements from the combined HTML string. Use each as the default rendering.
- // Then, compute the 'el' for each segment.
- htmlToElements(html).forEach(function (el, i) {
- var seg = segs[i];
- if (el) {
- seg.el = el;
- }
- });
- if (type === 'bgEvent') {
- segs = filterSegsViaEls(this.context, segs, false // isMirror. background events can never be mirror elements
- );
- }
- // correct element type? (would be bad if a non-TD were inserted into a table for example)
- segs = segs.filter(function (seg) {
- return elementMatches(seg.el, _this.fillSegTag);
- });
- }
- return segs;
- };
- // Builds the HTML needed for one fill segment. Generic enough to work with different types.
- FillRenderer.prototype.renderSegHtml = function (type, seg) {
- var css = null;
- var classNames = [];
- if (type !== 'highlight' && type !== 'businessHours') {
- css = {
- 'background-color': seg.eventRange.ui.backgroundColor
- };
- }
- if (type !== 'highlight') {
- classNames = classNames.concat(seg.eventRange.ui.classNames);
- }
- if (type === 'businessHours') {
- classNames.push('fc-bgevent');
- }
- else {
- classNames.push('fc-' + type.toLowerCase());
- }
- return '<' + this.fillSegTag +
- (classNames.length ? ' class="' + classNames.join(' ') + '"' : '') +
- (css ? ' style="' + cssToStr(css) + '"' : '') +
- '></' + this.fillSegTag + '>';
- };
- FillRenderer.prototype.detachSegs = function (type, segs) {
- var containerEls = this.containerElsByType[type];
- if (containerEls) {
- containerEls.forEach(removeElement);
- delete this.containerElsByType[type];
- }
- };
- FillRenderer.prototype.computeSizes = function (force) {
- for (var type in this.segsByType) {
- if (force || this.dirtySizeFlags[type]) {
- this.computeSegSizes(this.segsByType[type]);
- }
- }
- };
- FillRenderer.prototype.assignSizes = function (force) {
- for (var type in this.segsByType) {
- if (force || this.dirtySizeFlags[type]) {
- this.assignSegSizes(this.segsByType[type]);
- }
- }
- this.dirtySizeFlags = {};
- };
- FillRenderer.prototype.computeSegSizes = function (segs) {
- };
- FillRenderer.prototype.assignSegSizes = function (segs) {
- };
- return FillRenderer;
- }());
- var NamedTimeZoneImpl = /** @class */ (function () {
- function NamedTimeZoneImpl(timeZoneName) {
- this.timeZoneName = timeZoneName;
- }
- return NamedTimeZoneImpl;
- }());
- /*
- An abstraction for a dragging interaction originating on an event.
- Does higher-level things than PointerDragger, such as possibly:
- - a "mirror" that moves with the pointer
- - a minimum number of pixels or other criteria for a true drag to begin
- subclasses must emit:
- - pointerdown
- - dragstart
- - dragmove
- - pointerup
- - dragend
- */
- var ElementDragging = /** @class */ (function () {
- function ElementDragging(el) {
- this.emitter = new EmitterMixin();
- }
- ElementDragging.prototype.destroy = function () {
- };
- ElementDragging.prototype.setMirrorIsVisible = function (bool) {
- // optional if subclass doesn't want to support a mirror
- };
- ElementDragging.prototype.setMirrorNeedsRevert = function (bool) {
- // optional if subclass doesn't want to support a mirror
- };
- ElementDragging.prototype.setAutoScrollEnabled = function (bool) {
- // optional
- };
- return ElementDragging;
- }());
- function formatDate(dateInput, settings) {
- if (settings === void 0) { settings = {}; }
- var dateEnv = buildDateEnv$1(settings);
- var formatter = createFormatter(settings);
- var dateMeta = dateEnv.createMarkerMeta(dateInput);
- if (!dateMeta) { // TODO: warning?
- return '';
- }
- return dateEnv.format(dateMeta.marker, formatter, {
- forcedTzo: dateMeta.forcedTzo
- });
- }
- function formatRange(startInput, endInput, settings // mixture of env and formatter settings
- ) {
- var dateEnv = buildDateEnv$1(typeof settings === 'object' && settings ? settings : {}); // pass in if non-null object
- var formatter = createFormatter(settings, globalDefaults.defaultRangeSeparator);
- var startMeta = dateEnv.createMarkerMeta(startInput);
- var endMeta = dateEnv.createMarkerMeta(endInput);
- if (!startMeta || !endMeta) { // TODO: warning?
- return '';
- }
- return dateEnv.formatRange(startMeta.marker, endMeta.marker, formatter, {
- forcedStartTzo: startMeta.forcedTzo,
- forcedEndTzo: endMeta.forcedTzo,
- isEndExclusive: settings.isEndExclusive
- });
- }
- // TODO: more DRY and optimized
- function buildDateEnv$1(settings) {
- var locale = buildLocale(settings.locale || 'en', parseRawLocales([]).map); // TODO: don't hardcode 'en' everywhere
- // ensure required settings
- settings = __assign({ timeZone: globalDefaults.timeZone, calendarSystem: 'gregory' }, settings, { locale: locale });
- return new DateEnv(settings);
- }
- var DRAG_META_PROPS = {
- startTime: createDuration,
- duration: createDuration,
- create: Boolean,
- sourceId: String
- };
- var DRAG_META_DEFAULTS = {
- create: true
- };
- function parseDragMeta(raw) {
- var leftoverProps = {};
- var refined = refineProps(raw, DRAG_META_PROPS, DRAG_META_DEFAULTS, leftoverProps);
- refined.leftoverProps = leftoverProps;
- return refined;
- }
- // Computes a default column header formatting string if `colFormat` is not explicitly defined
- function computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt) {
- // if more than one week row, or if there are a lot of columns with not much space,
- // put just the day numbers will be in each cell
- if (!datesRepDistinctDays || dayCnt > 10) {
- return { weekday: 'short' }; // "Sat"
- }
- else if (dayCnt > 1) {
- return { weekday: 'short', month: 'numeric', day: 'numeric', omitCommas: true }; // "Sat 11/12"
- }
- else {
- return { weekday: 'long' }; // "Saturday"
- }
- }
- function renderDateCell(dateMarker, dateProfile, datesRepDistinctDays, colCnt, colHeadFormat, context, colspan, otherAttrs) {
- var dateEnv = context.dateEnv, theme = context.theme, options = context.options;
- var isDateValid = rangeContainsMarker(dateProfile.activeRange, dateMarker); // TODO: called too frequently. cache somehow.
- var classNames = [
- 'fc-day-header',
- theme.getClass('widgetHeader')
- ];
- var innerHtml;
- if (typeof options.columnHeaderHtml === 'function') {
- innerHtml = options.columnHeaderHtml(dateEnv.toDate(dateMarker));
- }
- else if (typeof options.columnHeaderText === 'function') {
- innerHtml = htmlEscape(options.columnHeaderText(dateEnv.toDate(dateMarker)));
- }
- else {
- innerHtml = htmlEscape(dateEnv.format(dateMarker, colHeadFormat));
- }
- // if only one row of days, the classNames on the header can represent the specific days beneath
- if (datesRepDistinctDays) {
- classNames = classNames.concat(
- // includes the day-of-week class
- // noThemeHighlight=true (don't highlight the header)
- getDayClasses(dateMarker, dateProfile, context, true));
- }
- else {
- classNames.push('fc-' + DAY_IDS[dateMarker.getUTCDay()]); // only add the day-of-week class
- }
- return '' +
- '<th class="' + classNames.join(' ') + '"' +
- ((isDateValid && datesRepDistinctDays) ?
- ' data-date="' + dateEnv.formatIso(dateMarker, { omitTime: true }) + '"' :
- '') +
- (colspan > 1 ?
- ' colspan="' + colspan + '"' :
- '') +
- (otherAttrs ?
- ' ' + otherAttrs :
- '') +
- '>' +
- (isDateValid ?
- // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff)
- buildGotoAnchorHtml(options, dateEnv, { date: dateMarker, forceOff: !datesRepDistinctDays || colCnt === 1 }, innerHtml) :
- // if not valid, display text, but no link
- innerHtml) +
- '</th>';
- }
- var DayHeader = /** @class */ (function (_super) {
- __extends(DayHeader, _super);
- function DayHeader(parentEl) {
- var _this = _super.call(this) || this;
- _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
- _this.parentEl = parentEl;
- return _this;
- }
- DayHeader.prototype.render = function (props, context) {
- var dates = props.dates, datesRepDistinctDays = props.datesRepDistinctDays;
- var parts = [];
- this.renderSkeleton(context);
- if (props.renderIntroHtml) {
- parts.push(props.renderIntroHtml());
- }
- var colHeadFormat = createFormatter(context.options.columnHeaderFormat ||
- computeFallbackHeaderFormat(datesRepDistinctDays, dates.length));
- for (var _i = 0, dates_1 = dates; _i < dates_1.length; _i++) {
- var date = dates_1[_i];
- parts.push(renderDateCell(date, props.dateProfile, datesRepDistinctDays, dates.length, colHeadFormat, context));
- }
- if (context.isRtl) {
- parts.reverse();
- }
- this.thead.innerHTML = '<tr>' + parts.join('') + '</tr>';
- };
- DayHeader.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- this.renderSkeleton.unrender();
- };
- DayHeader.prototype._renderSkeleton = function (context) {
- var theme = context.theme;
- var parentEl = this.parentEl;
- parentEl.innerHTML = ''; // because might be nbsp
- parentEl.appendChild(this.el = htmlToElement('<div class="fc-row ' + theme.getClass('headerRow') + '">' +
- '<table class="' + theme.getClass('tableGrid') + '">' +
- '<thead></thead>' +
- '</table>' +
- '</div>'));
- this.thead = this.el.querySelector('thead');
- };
- DayHeader.prototype._unrenderSkeleton = function () {
- removeElement(this.el);
- };
- return DayHeader;
- }(Component));
- var DaySeries = /** @class */ (function () {
- function DaySeries(range, dateProfileGenerator) {
- var date = range.start;
- var end = range.end;
- var indices = [];
- var dates = [];
- var dayIndex = -1;
- while (date < end) { // loop each day from start to end
- if (dateProfileGenerator.isHiddenDay(date)) {
- indices.push(dayIndex + 0.5); // mark that it's between indices
- }
- else {
- dayIndex++;
- indices.push(dayIndex);
- dates.push(date);
- }
- date = addDays(date, 1);
- }
- this.dates = dates;
- this.indices = indices;
- this.cnt = dates.length;
- }
- DaySeries.prototype.sliceRange = function (range) {
- var firstIndex = this.getDateDayIndex(range.start); // inclusive first index
- var lastIndex = this.getDateDayIndex(addDays(range.end, -1)); // inclusive last index
- var clippedFirstIndex = Math.max(0, firstIndex);
- var clippedLastIndex = Math.min(this.cnt - 1, lastIndex);
- // deal with in-between indices
- clippedFirstIndex = Math.ceil(clippedFirstIndex); // in-between starts round to next cell
- clippedLastIndex = Math.floor(clippedLastIndex); // in-between ends round to prev cell
- if (clippedFirstIndex <= clippedLastIndex) {
- return {
- firstIndex: clippedFirstIndex,
- lastIndex: clippedLastIndex,
- isStart: firstIndex === clippedFirstIndex,
- isEnd: lastIndex === clippedLastIndex
- };
- }
- else {
- return null;
- }
- };
- // Given a date, returns its chronolocial cell-index from the first cell of the grid.
- // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets.
- // If before the first offset, returns a negative number.
- // If after the last offset, returns an offset past the last cell offset.
- // Only works for *start* dates of cells. Will not work for exclusive end dates for cells.
- DaySeries.prototype.getDateDayIndex = function (date) {
- var indices = this.indices;
- var dayOffset = Math.floor(diffDays(this.dates[0], date));
- if (dayOffset < 0) {
- return indices[0] - 1;
- }
- else if (dayOffset >= indices.length) {
- return indices[indices.length - 1] + 1;
- }
- else {
- return indices[dayOffset];
- }
- };
- return DaySeries;
- }());
- var DayTable = /** @class */ (function () {
- function DayTable(daySeries, breakOnWeeks) {
- var dates = daySeries.dates;
- var daysPerRow;
- var firstDay;
- var rowCnt;
- if (breakOnWeeks) {
- // count columns until the day-of-week repeats
- firstDay = dates[0].getUTCDay();
- for (daysPerRow = 1; daysPerRow < dates.length; daysPerRow++) {
- if (dates[daysPerRow].getUTCDay() === firstDay) {
- break;
- }
- }
- rowCnt = Math.ceil(dates.length / daysPerRow);
- }
- else {
- rowCnt = 1;
- daysPerRow = dates.length;
- }
- this.rowCnt = rowCnt;
- this.colCnt = daysPerRow;
- this.daySeries = daySeries;
- this.cells = this.buildCells();
- this.headerDates = this.buildHeaderDates();
- }
- DayTable.prototype.buildCells = function () {
- var rows = [];
- for (var row = 0; row < this.rowCnt; row++) {
- var cells = [];
- for (var col = 0; col < this.colCnt; col++) {
- cells.push(this.buildCell(row, col));
- }
- rows.push(cells);
- }
- return rows;
- };
- DayTable.prototype.buildCell = function (row, col) {
- return {
- date: this.daySeries.dates[row * this.colCnt + col]
- };
- };
- DayTable.prototype.buildHeaderDates = function () {
- var dates = [];
- for (var col = 0; col < this.colCnt; col++) {
- dates.push(this.cells[0][col].date);
- }
- return dates;
- };
- DayTable.prototype.sliceRange = function (range) {
- var colCnt = this.colCnt;
- var seriesSeg = this.daySeries.sliceRange(range);
- var segs = [];
- if (seriesSeg) {
- var firstIndex = seriesSeg.firstIndex, lastIndex = seriesSeg.lastIndex;
- var index = firstIndex;
- while (index <= lastIndex) {
- var row = Math.floor(index / colCnt);
- var nextIndex = Math.min((row + 1) * colCnt, lastIndex + 1);
- segs.push({
- row: row,
- firstCol: index % colCnt,
- lastCol: (nextIndex - 1) % colCnt,
- isStart: seriesSeg.isStart && index === firstIndex,
- isEnd: seriesSeg.isEnd && (nextIndex - 1) === lastIndex
- });
- index = nextIndex;
- }
- }
- return segs;
- };
- return DayTable;
- }());
- var Slicer = /** @class */ (function () {
- function Slicer() {
- this.sliceBusinessHours = memoize(this._sliceBusinessHours);
- this.sliceDateSelection = memoize(this._sliceDateSpan);
- this.sliceEventStore = memoize(this._sliceEventStore);
- this.sliceEventDrag = memoize(this._sliceInteraction);
- this.sliceEventResize = memoize(this._sliceInteraction);
- }
- Slicer.prototype.sliceProps = function (props, dateProfile, nextDayThreshold, calendar, component) {
- var extraArgs = [];
- for (var _i = 5; _i < arguments.length; _i++) {
- extraArgs[_i - 5] = arguments[_i];
- }
- var eventUiBases = props.eventUiBases;
- var eventSegs = this.sliceEventStore.apply(this, [props.eventStore, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs));
- return {
- dateSelectionSegs: this.sliceDateSelection.apply(this, [props.dateSelection, eventUiBases, component].concat(extraArgs)),
- businessHourSegs: this.sliceBusinessHours.apply(this, [props.businessHours, dateProfile, nextDayThreshold, calendar, component].concat(extraArgs)),
- fgEventSegs: eventSegs.fg,
- bgEventSegs: eventSegs.bg,
- eventDrag: this.sliceEventDrag.apply(this, [props.eventDrag, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs)),
- eventResize: this.sliceEventResize.apply(this, [props.eventResize, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs)),
- eventSelection: props.eventSelection
- }; // TODO: give interactionSegs?
- };
- Slicer.prototype.sliceNowDate = function (// does not memoize
- date, component) {
- var extraArgs = [];
- for (var _i = 2; _i < arguments.length; _i++) {
- extraArgs[_i - 2] = arguments[_i];
- }
- return this._sliceDateSpan.apply(this, [{ range: { start: date, end: addMs(date, 1) }, allDay: false },
- {},
- component].concat(extraArgs));
- };
- Slicer.prototype._sliceBusinessHours = function (businessHours, dateProfile, nextDayThreshold, calendar, component) {
- var extraArgs = [];
- for (var _i = 5; _i < arguments.length; _i++) {
- extraArgs[_i - 5] = arguments[_i];
- }
- if (!businessHours) {
- return [];
- }
- return this._sliceEventStore.apply(this, [expandRecurring(businessHours, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), calendar),
- {},
- dateProfile,
- nextDayThreshold,
- component].concat(extraArgs)).bg;
- };
- Slicer.prototype._sliceEventStore = function (eventStore, eventUiBases, dateProfile, nextDayThreshold, component) {
- var extraArgs = [];
- for (var _i = 5; _i < arguments.length; _i++) {
- extraArgs[_i - 5] = arguments[_i];
- }
- if (eventStore) {
- var rangeRes = sliceEventStore(eventStore, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold);
- return {
- bg: this.sliceEventRanges(rangeRes.bg, component, extraArgs),
- fg: this.sliceEventRanges(rangeRes.fg, component, extraArgs)
- };
- }
- else {
- return { bg: [], fg: [] };
- }
- };
- Slicer.prototype._sliceInteraction = function (interaction, eventUiBases, dateProfile, nextDayThreshold, component) {
- var extraArgs = [];
- for (var _i = 5; _i < arguments.length; _i++) {
- extraArgs[_i - 5] = arguments[_i];
- }
- if (!interaction) {
- return null;
- }
- var rangeRes = sliceEventStore(interaction.mutatedEvents, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold);
- return {
- segs: this.sliceEventRanges(rangeRes.fg, component, extraArgs),
- affectedInstances: interaction.affectedEvents.instances,
- isEvent: interaction.isEvent,
- sourceSeg: interaction.origSeg
- };
- };
- Slicer.prototype._sliceDateSpan = function (dateSpan, eventUiBases, component) {
- var extraArgs = [];
- for (var _i = 3; _i < arguments.length; _i++) {
- extraArgs[_i - 3] = arguments[_i];
- }
- if (!dateSpan) {
- return [];
- }
- var eventRange = fabricateEventRange(dateSpan, eventUiBases, component.context.calendar);
- var segs = this.sliceRange.apply(this, [dateSpan.range].concat(extraArgs));
- for (var _a = 0, segs_1 = segs; _a < segs_1.length; _a++) {
- var seg = segs_1[_a];
- seg.component = component;
- seg.eventRange = eventRange;
- }
- return segs;
- };
- /*
- "complete" seg means it has component and eventRange
- */
- Slicer.prototype.sliceEventRanges = function (eventRanges, component, // TODO: kill
- extraArgs) {
- var segs = [];
- for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) {
- var eventRange = eventRanges_1[_i];
- segs.push.apply(segs, this.sliceEventRange(eventRange, component, extraArgs));
- }
- return segs;
- };
- /*
- "complete" seg means it has component and eventRange
- */
- Slicer.prototype.sliceEventRange = function (eventRange, component, // TODO: kill
- extraArgs) {
- var segs = this.sliceRange.apply(this, [eventRange.range].concat(extraArgs));
- for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
- var seg = segs_2[_i];
- seg.component = component;
- seg.eventRange = eventRange;
- seg.isStart = eventRange.isStart && seg.isStart;
- seg.isEnd = eventRange.isEnd && seg.isEnd;
- }
- return segs;
- };
- return Slicer;
- }());
- /*
- for incorporating minTime/maxTime if appropriate
- TODO: should be part of DateProfile!
- TimelineDateProfile already does this btw
- */
- function computeActiveRange(dateProfile, isComponentAllDay) {
- var range = dateProfile.activeRange;
- if (isComponentAllDay) {
- return range;
- }
- return {
- start: addMs(range.start, dateProfile.minTime.milliseconds),
- end: addMs(range.end, dateProfile.maxTime.milliseconds - 864e5) // 864e5 = ms in a day
- };
- }
- // exports
- // --------------------------------------------------------------------------------------------------
- var version = '4.4.0';
- exports.Calendar = Calendar;
- exports.Component = Component;
- exports.ComponentContext = ComponentContext;
- exports.DateComponent = DateComponent;
- exports.DateEnv = DateEnv;
- exports.DateProfileGenerator = DateProfileGenerator;
- exports.DayHeader = DayHeader;
- exports.DaySeries = DaySeries;
- exports.DayTable = DayTable;
- exports.ElementDragging = ElementDragging;
- exports.ElementScrollController = ElementScrollController;
- exports.EmitterMixin = EmitterMixin;
- exports.EventApi = EventApi;
- exports.FgEventRenderer = FgEventRenderer;
- exports.FillRenderer = FillRenderer;
- exports.Interaction = Interaction;
- exports.Mixin = Mixin;
- exports.NamedTimeZoneImpl = NamedTimeZoneImpl;
- exports.PositionCache = PositionCache;
- exports.ScrollComponent = ScrollComponent;
- exports.ScrollController = ScrollController;
- exports.Slicer = Slicer;
- exports.Splitter = Splitter;
- exports.Theme = Theme;
- exports.View = View;
- exports.WindowScrollController = WindowScrollController;
- exports.addDays = addDays;
- exports.addDurations = addDurations;
- exports.addMs = addMs;
- exports.addWeeks = addWeeks;
- exports.allowContextMenu = allowContextMenu;
- exports.allowSelection = allowSelection;
- exports.appendToElement = appendToElement;
- exports.applyAll = applyAll;
- exports.applyMutationToEventStore = applyMutationToEventStore;
- exports.applyStyle = applyStyle;
- exports.applyStyleProp = applyStyleProp;
- exports.asRoughMinutes = asRoughMinutes;
- exports.asRoughMs = asRoughMs;
- exports.asRoughSeconds = asRoughSeconds;
- exports.buildGotoAnchorHtml = buildGotoAnchorHtml;
- exports.buildSegCompareObj = buildSegCompareObj;
- exports.capitaliseFirstLetter = capitaliseFirstLetter;
- exports.combineEventUis = combineEventUis;
- exports.compareByFieldSpec = compareByFieldSpec;
- exports.compareByFieldSpecs = compareByFieldSpecs;
- exports.compareNumbers = compareNumbers;
- exports.compensateScroll = compensateScroll;
- exports.computeClippingRect = computeClippingRect;
- exports.computeEdges = computeEdges;
- exports.computeEventDraggable = computeEventDraggable;
- exports.computeEventEndResizable = computeEventEndResizable;
- exports.computeEventStartResizable = computeEventStartResizable;
- exports.computeFallbackHeaderFormat = computeFallbackHeaderFormat;
- exports.computeHeightAndMargins = computeHeightAndMargins;
- exports.computeInnerRect = computeInnerRect;
- exports.computeRect = computeRect;
- exports.computeVisibleDayRange = computeVisibleDayRange;
- exports.config = config;
- exports.constrainPoint = constrainPoint;
- exports.createDuration = createDuration;
- exports.createElement = createElement;
- exports.createEmptyEventStore = createEmptyEventStore;
- exports.createEventInstance = createEventInstance;
- exports.createFormatter = createFormatter;
- exports.createPlugin = createPlugin;
- exports.cssToStr = cssToStr;
- exports.debounce = debounce;
- exports.diffDates = diffDates;
- exports.diffDayAndTime = diffDayAndTime;
- exports.diffDays = diffDays;
- exports.diffPoints = diffPoints;
- exports.diffWeeks = diffWeeks;
- exports.diffWholeDays = diffWholeDays;
- exports.diffWholeWeeks = diffWholeWeeks;
- exports.disableCursor = disableCursor;
- exports.distributeHeight = distributeHeight;
- exports.elementClosest = elementClosest;
- exports.elementMatches = elementMatches;
- exports.enableCursor = enableCursor;
- exports.eventTupleToStore = eventTupleToStore;
- exports.filterEventStoreDefs = filterEventStoreDefs;
- exports.filterHash = filterHash;
- exports.findChildren = findChildren;
- exports.findElements = findElements;
- exports.flexibleCompare = flexibleCompare;
- exports.forceClassName = forceClassName;
- exports.formatDate = formatDate;
- exports.formatIsoTimeString = formatIsoTimeString;
- exports.formatRange = formatRange;
- exports.getAllDayHtml = getAllDayHtml;
- exports.getClippingParents = getClippingParents;
- exports.getDayClasses = getDayClasses;
- exports.getElSeg = getElSeg;
- exports.getRectCenter = getRectCenter;
- exports.getRelevantEvents = getRelevantEvents;
- exports.globalDefaults = globalDefaults;
- exports.greatestDurationDenominator = greatestDurationDenominator;
- exports.hasBgRendering = hasBgRendering;
- exports.htmlEscape = htmlEscape;
- exports.htmlToElement = htmlToElement;
- exports.insertAfterElement = insertAfterElement;
- exports.interactionSettingsStore = interactionSettingsStore;
- exports.interactionSettingsToStore = interactionSettingsToStore;
- exports.intersectRanges = intersectRanges;
- exports.intersectRects = intersectRects;
- exports.isArraysEqual = isArraysEqual;
- exports.isDateSpansEqual = isDateSpansEqual;
- exports.isInt = isInt;
- exports.isInteractionValid = isInteractionValid;
- exports.isMultiDayRange = isMultiDayRange;
- exports.isPropsEqual = isPropsEqual;
- exports.isPropsValid = isPropsValid;
- exports.isSingleDay = isSingleDay;
- exports.isValidDate = isValidDate;
- exports.listenBySelector = listenBySelector;
- exports.mapHash = mapHash;
- exports.matchCellWidths = matchCellWidths;
- exports.memoize = memoize;
- exports.memoizeOutput = memoizeOutput;
- exports.memoizeRendering = memoizeRendering;
- exports.mergeEventStores = mergeEventStores;
- exports.multiplyDuration = multiplyDuration;
- exports.padStart = padStart;
- exports.parseBusinessHours = parseBusinessHours;
- exports.parseDragMeta = parseDragMeta;
- exports.parseEventDef = parseEventDef;
- exports.parseFieldSpecs = parseFieldSpecs;
- exports.parseMarker = parse;
- exports.pointInsideRect = pointInsideRect;
- exports.prependToElement = prependToElement;
- exports.preventContextMenu = preventContextMenu;
- exports.preventDefault = preventDefault;
- exports.preventSelection = preventSelection;
- exports.processScopedUiProps = processScopedUiProps;
- exports.rangeContainsMarker = rangeContainsMarker;
- exports.rangeContainsRange = rangeContainsRange;
- exports.rangesEqual = rangesEqual;
- exports.rangesIntersect = rangesIntersect;
- exports.refineProps = refineProps;
- exports.removeElement = removeElement;
- exports.removeExact = removeExact;
- exports.renderDateCell = renderDateCell;
- exports.requestJson = requestJson;
- exports.sliceEventStore = sliceEventStore;
- exports.startOfDay = startOfDay;
- exports.subtractInnerElHeight = subtractInnerElHeight;
- exports.translateRect = translateRect;
- exports.uncompensateScroll = uncompensateScroll;
- exports.undistributeHeight = undistributeHeight;
- exports.unpromisify = unpromisify;
- exports.version = version;
- exports.whenTransitionDone = whenTransitionDone;
- exports.wholeDivideDurations = wholeDivideDurations;
- Object.defineProperty(exports, '__esModule', { value: true });
- }));
- /*!
- FullCalendar Day Grid Plugin v4.4.0
- Docs & License: https://fullcalendar.io/
- (c) 2019 Adam Shaw
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fullcalendar/core')) :
- typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core'], factory) :
- (global = global || self, factory(global.FullCalendarDayGrid = {}, global.FullCalendar));
- }(this, function (exports, core) { 'use strict';
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- var DayGridDateProfileGenerator = /** @class */ (function (_super) {
- __extends(DayGridDateProfileGenerator, _super);
- function DayGridDateProfileGenerator() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- // Computes the date range that will be rendered.
- DayGridDateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) {
- var dateEnv = this.dateEnv;
- var renderRange = _super.prototype.buildRenderRange.call(this, currentRange, currentRangeUnit, isRangeAllDay);
- var start = renderRange.start;
- var end = renderRange.end;
- var endOfWeek;
- // year and month views should be aligned with weeks. this is already done for week
- if (/^(year|month)$/.test(currentRangeUnit)) {
- start = dateEnv.startOfWeek(start);
- // make end-of-week if not already
- endOfWeek = dateEnv.startOfWeek(end);
- if (endOfWeek.valueOf() !== end.valueOf()) {
- end = core.addWeeks(endOfWeek, 1);
- }
- }
- // ensure 6 weeks
- if (this.options.monthMode &&
- this.options.fixedWeekCount) {
- var rowCnt = Math.ceil(// could be partial weeks due to hiddenDays
- core.diffWeeks(start, end));
- end = core.addWeeks(end, 6 - rowCnt);
- }
- return { start: start, end: end };
- };
- return DayGridDateProfileGenerator;
- }(core.DateProfileGenerator));
- /* A rectangular panel that is absolutely positioned over other content
- ------------------------------------------------------------------------------------------------------------------------
- Options:
- - className (string)
- - content (HTML string, element, or element array)
- - parentEl
- - top
- - left
- - right (the x coord of where the right edge should be. not a "CSS" right)
- - autoHide (boolean)
- - show (callback)
- - hide (callback)
- */
- var Popover = /** @class */ (function () {
- function Popover(options) {
- var _this = this;
- this.isHidden = true;
- this.margin = 10; // the space required between the popover and the edges of the scroll container
- // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
- this.documentMousedown = function (ev) {
- // only hide the popover if the click happened outside the popover
- if (_this.el && !_this.el.contains(ev.target)) {
- _this.hide();
- }
- };
- this.options = options;
- }
- // Shows the popover on the specified position. Renders it if not already
- Popover.prototype.show = function () {
- if (this.isHidden) {
- if (!this.el) {
- this.render();
- }
- this.el.style.display = '';
- this.position();
- this.isHidden = false;
- this.trigger('show');
- }
- };
- // Hides the popover, through CSS, but does not remove it from the DOM
- Popover.prototype.hide = function () {
- if (!this.isHidden) {
- this.el.style.display = 'none';
- this.isHidden = true;
- this.trigger('hide');
- }
- };
- // Creates `this.el` and renders content inside of it
- Popover.prototype.render = function () {
- var _this = this;
- var options = this.options;
- var el = this.el = core.createElement('div', {
- className: 'fc-popover ' + (options.className || ''),
- style: {
- top: '0',
- left: '0'
- }
- });
- if (typeof options.content === 'function') {
- options.content(el);
- }
- options.parentEl.appendChild(el);
- // when a click happens on anything inside with a 'fc-close' className, hide the popover
- core.listenBySelector(el, 'click', '.fc-close', function (ev) {
- _this.hide();
- });
- if (options.autoHide) {
- document.addEventListener('mousedown', this.documentMousedown);
- }
- };
- // Hides and unregisters any handlers
- Popover.prototype.destroy = function () {
- this.hide();
- if (this.el) {
- core.removeElement(this.el);
- this.el = null;
- }
- document.removeEventListener('mousedown', this.documentMousedown);
- };
- // Positions the popover optimally, using the top/left/right options
- Popover.prototype.position = function () {
- var options = this.options;
- var el = this.el;
- var elDims = el.getBoundingClientRect(); // only used for width,height
- var origin = core.computeRect(el.offsetParent);
- var clippingRect = core.computeClippingRect(options.parentEl);
- var top; // the "position" (not "offset") values for the popover
- var left; //
- // compute top and left
- top = options.top || 0;
- if (options.left !== undefined) {
- left = options.left;
- }
- else if (options.right !== undefined) {
- left = options.right - elDims.width; // derive the left value from the right value
- }
- else {
- left = 0;
- }
- // constrain to the view port. if constrained by two edges, give precedence to top/left
- top = Math.min(top, clippingRect.bottom - elDims.height - this.margin);
- top = Math.max(top, clippingRect.top + this.margin);
- left = Math.min(left, clippingRect.right - elDims.width - this.margin);
- left = Math.max(left, clippingRect.left + this.margin);
- core.applyStyle(el, {
- top: top - origin.top,
- left: left - origin.left
- });
- };
- // Triggers a callback. Calls a function in the option hash of the same name.
- // Arguments beyond the first `name` are forwarded on.
- // TODO: better code reuse for this. Repeat code
- // can kill this???
- Popover.prototype.trigger = function (name) {
- if (this.options[name]) {
- this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
- }
- };
- return Popover;
- }());
- /* Event-rendering methods for the DayGrid class
- ----------------------------------------------------------------------------------------------------------------------*/
- // "Simple" is bad a name. has nothing to do with SimpleDayGrid
- var SimpleDayGridEventRenderer = /** @class */ (function (_super) {
- __extends(SimpleDayGridEventRenderer, _super);
- function SimpleDayGridEventRenderer() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- // Builds the HTML to be used for the default element for an individual segment
- SimpleDayGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) {
- var context = this.context;
- var eventRange = seg.eventRange;
- var eventDef = eventRange.def;
- var eventUi = eventRange.ui;
- var allDay = eventDef.allDay;
- var isDraggable = core.computeEventDraggable(context, eventDef, eventUi);
- var isResizableFromStart = allDay && seg.isStart && core.computeEventStartResizable(context, eventDef, eventUi);
- var isResizableFromEnd = allDay && seg.isEnd && core.computeEventEndResizable(context, eventDef, eventUi);
- var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo);
- var skinCss = core.cssToStr(this.getSkinCss(eventUi));
- var timeHtml = '';
- var timeText;
- var titleHtml;
- classes.unshift('fc-day-grid-event', 'fc-h-event');
- // Only display a timed events time if it is the starting segment
- if (seg.isStart) {
- timeText = this.getTimeText(eventRange);
- if (timeText) {
- timeHtml = '<span class="fc-time">' + core.htmlEscape(timeText) + '</span>';
- }
- }
- titleHtml =
- '<span class="fc-title">' +
- (core.htmlEscape(eventDef.title || '') || ' ') + // we always want one line of height
- '</span>';
- return '<a class="' + classes.join(' ') + '"' +
- (eventDef.url ?
- ' href="' + core.htmlEscape(eventDef.url) + '"' :
- '') +
- (skinCss ?
- ' style="' + skinCss + '"' :
- '') +
- '>' +
- '<div class="fc-content">' +
- (context.options.dir === 'rtl' ?
- titleHtml + ' ' + timeHtml : // put a natural space in between
- timeHtml + ' ' + titleHtml //
- ) +
- '</div>' +
- (isResizableFromStart ?
- '<div class="fc-resizer fc-start-resizer"></div>' :
- '') +
- (isResizableFromEnd ?
- '<div class="fc-resizer fc-end-resizer"></div>' :
- '') +
- '</a>';
- };
- // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined
- SimpleDayGridEventRenderer.prototype.computeEventTimeFormat = function () {
- return {
- hour: 'numeric',
- minute: '2-digit',
- omitZeroMinute: true,
- meridiem: 'narrow'
- };
- };
- SimpleDayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
- return false; // TODO: somehow consider the originating DayGrid's column count
- };
- return SimpleDayGridEventRenderer;
- }(core.FgEventRenderer));
- /* Event-rendering methods for the DayGrid class
- ----------------------------------------------------------------------------------------------------------------------*/
- var DayGridEventRenderer = /** @class */ (function (_super) {
- __extends(DayGridEventRenderer, _super);
- function DayGridEventRenderer(dayGrid) {
- var _this = _super.call(this) || this;
- _this.dayGrid = dayGrid;
- return _this;
- }
- // Renders the given foreground event segments onto the grid
- DayGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
- var rowStructs = this.rowStructs = this.renderSegRows(segs);
- // append to each row's content skeleton
- this.dayGrid.rowEls.forEach(function (rowNode, i) {
- rowNode.querySelector('.fc-content-skeleton > table').appendChild(rowStructs[i].tbodyEl);
- });
- // removes the "more.." events popover
- if (!mirrorInfo) {
- this.dayGrid.removeSegPopover();
- }
- };
- // Unrenders all currently rendered foreground event segments
- DayGridEventRenderer.prototype.detachSegs = function () {
- var rowStructs = this.rowStructs || [];
- var rowStruct;
- while ((rowStruct = rowStructs.pop())) {
- core.removeElement(rowStruct.tbodyEl);
- }
- this.rowStructs = null;
- };
- // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton.
- // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).
- // PRECONDITION: each segment shoud already have a rendered and assigned `.el`
- DayGridEventRenderer.prototype.renderSegRows = function (segs) {
- var rowStructs = [];
- var segRows;
- var row;
- segRows = this.groupSegRows(segs); // group into nested arrays
- // iterate each row of segment groupings
- for (row = 0; row < segRows.length; row++) {
- rowStructs.push(this.renderSegRow(row, segRows[row]));
- }
- return rowStructs;
- };
- // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains
- // the segments. Returns object with a bunch of internal data about how the render was calculated.
- // NOTE: modifies rowSegs
- DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) {
- var isRtl = this.context.isRtl;
- var dayGrid = this.dayGrid;
- var colCnt = dayGrid.colCnt;
- var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
- var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
- var tbody = document.createElement('tbody');
- var segMatrix = []; // lookup for which segments are rendered into which level+col cells
- var cellMatrix = []; // lookup for all <td> elements of the level+col matrix
- var loneCellMatrix = []; // lookup for <td> elements that only take up a single column
- var i;
- var levelSegs;
- var col;
- var tr;
- var j;
- var seg;
- var td;
- // populates empty cells from the current column (`col`) to `endCol`
- function emptyCellsUntil(endCol) {
- while (col < endCol) {
- // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell
- td = (loneCellMatrix[i - 1] || [])[col];
- if (td) {
- td.rowSpan = (td.rowSpan || 1) + 1;
- }
- else {
- td = document.createElement('td');
- tr.appendChild(td);
- }
- cellMatrix[i][col] = td;
- loneCellMatrix[i][col] = td;
- col++;
- }
- }
- for (i = 0; i < levelCnt; i++) { // iterate through all levels
- levelSegs = segLevels[i];
- col = 0;
- tr = document.createElement('tr');
- segMatrix.push([]);
- cellMatrix.push([]);
- loneCellMatrix.push([]);
- // levelCnt might be 1 even though there are no actual levels. protect against this.
- // this single empty row is useful for styling.
- if (levelSegs) {
- for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level
- seg = levelSegs[j];
- var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
- var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
- emptyCellsUntil(leftCol);
- // create a container that occupies or more columns. append the event element.
- td = core.createElement('td', { className: 'fc-event-container' }, seg.el);
- if (leftCol !== rightCol) {
- td.colSpan = rightCol - leftCol + 1;
- }
- else { // a single-column segment
- loneCellMatrix[i][col] = td;
- }
- while (col <= rightCol) {
- cellMatrix[i][col] = td;
- segMatrix[i][col] = seg;
- col++;
- }
- tr.appendChild(td);
- }
- }
- emptyCellsUntil(colCnt); // finish off the row
- var introHtml = dayGrid.renderProps.renderIntroHtml();
- if (introHtml) {
- if (isRtl) {
- core.appendToElement(tr, introHtml);
- }
- else {
- core.prependToElement(tr, introHtml);
- }
- }
- tbody.appendChild(tr);
- }
- return {
- row: row,
- tbodyEl: tbody,
- cellMatrix: cellMatrix,
- segMatrix: segMatrix,
- segLevels: segLevels,
- segs: rowSegs
- };
- };
- // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.
- // NOTE: modifies segs
- DayGridEventRenderer.prototype.buildSegLevels = function (segs) {
- var isRtl = this.context.isRtl;
- var colCnt = this.dayGrid.colCnt;
- var levels = [];
- var i;
- var seg;
- var j;
- // Give preference to elements with certain criteria, so they have
- // a chance to be closer to the top.
- segs = this.sortEventSegs(segs);
- for (i = 0; i < segs.length; i++) {
- seg = segs[i];
- // loop through levels, starting with the topmost, until the segment doesn't collide with other segments
- for (j = 0; j < levels.length; j++) {
- if (!isDaySegCollision(seg, levels[j])) {
- break;
- }
- }
- // `j` now holds the desired subrow index
- seg.level = j;
- seg.leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; // for sorting only
- seg.rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol // for sorting only
- ;
- (levels[j] || (levels[j] = [])).push(seg);
- }
- // order segments left-to-right. very important if calendar is RTL
- for (j = 0; j < levels.length; j++) {
- levels[j].sort(compareDaySegCols);
- }
- return levels;
- };
- // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row
- DayGridEventRenderer.prototype.groupSegRows = function (segs) {
- var segRows = [];
- var i;
- for (i = 0; i < this.dayGrid.rowCnt; i++) {
- segRows.push([]);
- }
- for (i = 0; i < segs.length; i++) {
- segRows[segs[i].row].push(segs[i]);
- }
- return segRows;
- };
- // Computes a default `displayEventEnd` value if one is not expliclty defined
- DayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
- return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day
- };
- return DayGridEventRenderer;
- }(SimpleDayGridEventRenderer));
- // Computes whether two segments' columns collide. They are assumed to be in the same row.
- function isDaySegCollision(seg, otherSegs) {
- var i;
- var otherSeg;
- for (i = 0; i < otherSegs.length; i++) {
- otherSeg = otherSegs[i];
- if (otherSeg.firstCol <= seg.lastCol &&
- otherSeg.lastCol >= seg.firstCol) {
- return true;
- }
- }
- return false;
- }
- // A cmp function for determining the leftmost event
- function compareDaySegCols(a, b) {
- return a.leftCol - b.leftCol;
- }
- var DayGridMirrorRenderer = /** @class */ (function (_super) {
- __extends(DayGridMirrorRenderer, _super);
- function DayGridMirrorRenderer() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- DayGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
- var sourceSeg = mirrorInfo.sourceSeg;
- var rowStructs = this.rowStructs = this.renderSegRows(segs);
- // inject each new event skeleton into each associated row
- this.dayGrid.rowEls.forEach(function (rowNode, row) {
- var skeletonEl = core.htmlToElement('<div class="fc-mirror-skeleton"><table></table></div>'); // will be absolutely positioned
- var skeletonTopEl;
- var skeletonTop;
- // If there is an original segment, match the top position. Otherwise, put it at the row's top level
- if (sourceSeg && sourceSeg.row === row) {
- skeletonTopEl = sourceSeg.el;
- }
- else {
- skeletonTopEl = rowNode.querySelector('.fc-content-skeleton tbody');
- if (!skeletonTopEl) { // when no events
- skeletonTopEl = rowNode.querySelector('.fc-content-skeleton table');
- }
- }
- skeletonTop = skeletonTopEl.getBoundingClientRect().top -
- rowNode.getBoundingClientRect().top; // the offsetParent origin
- skeletonEl.style.top = skeletonTop + 'px';
- skeletonEl.querySelector('table').appendChild(rowStructs[row].tbodyEl);
- rowNode.appendChild(skeletonEl);
- });
- };
- return DayGridMirrorRenderer;
- }(DayGridEventRenderer));
- var EMPTY_CELL_HTML = '<td style="pointer-events:none"></td>';
- var DayGridFillRenderer = /** @class */ (function (_super) {
- __extends(DayGridFillRenderer, _super);
- function DayGridFillRenderer(dayGrid) {
- var _this = _super.call(this) || this;
- _this.fillSegTag = 'td'; // override the default tag name
- _this.dayGrid = dayGrid;
- return _this;
- }
- DayGridFillRenderer.prototype.renderSegs = function (type, context, segs) {
- // don't render timed background events
- if (type === 'bgEvent') {
- segs = segs.filter(function (seg) {
- return seg.eventRange.def.allDay;
- });
- }
- _super.prototype.renderSegs.call(this, type, context, segs);
- };
- DayGridFillRenderer.prototype.attachSegs = function (type, segs) {
- var els = [];
- var i;
- var seg;
- var skeletonEl;
- for (i = 0; i < segs.length; i++) {
- seg = segs[i];
- skeletonEl = this.renderFillRow(type, seg);
- this.dayGrid.rowEls[seg.row].appendChild(skeletonEl);
- els.push(skeletonEl);
- }
- return els;
- };
- // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.
- DayGridFillRenderer.prototype.renderFillRow = function (type, seg) {
- var dayGrid = this.dayGrid;
- var isRtl = this.context.isRtl;
- var colCnt = dayGrid.colCnt;
- var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
- var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
- var startCol = leftCol;
- var endCol = rightCol + 1;
- var className;
- var skeletonEl;
- var trEl;
- if (type === 'businessHours') {
- className = 'bgevent';
- }
- else {
- className = type.toLowerCase();
- }
- skeletonEl = core.htmlToElement('<div class="fc-' + className + '-skeleton">' +
- '<table><tr></tr></table>' +
- '</div>');
- trEl = skeletonEl.getElementsByTagName('tr')[0];
- if (startCol > 0) {
- core.appendToElement(trEl,
- // will create (startCol + 1) td's
- new Array(startCol + 1).join(EMPTY_CELL_HTML));
- }
- seg.el.colSpan = endCol - startCol;
- trEl.appendChild(seg.el);
- if (endCol < colCnt) {
- core.appendToElement(trEl,
- // will create (colCnt - endCol) td's
- new Array(colCnt - endCol + 1).join(EMPTY_CELL_HTML));
- }
- var introHtml = dayGrid.renderProps.renderIntroHtml();
- if (introHtml) {
- if (isRtl) {
- core.appendToElement(trEl, introHtml);
- }
- else {
- core.prependToElement(trEl, introHtml);
- }
- }
- return skeletonEl;
- };
- return DayGridFillRenderer;
- }(core.FillRenderer));
- var DayTile = /** @class */ (function (_super) {
- __extends(DayTile, _super);
- function DayTile(el) {
- var _this = _super.call(this, el) || this;
- var eventRenderer = _this.eventRenderer = new DayTileEventRenderer(_this);
- var renderFrame = _this.renderFrame = core.memoizeRendering(_this._renderFrame);
- _this.renderFgEvents = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderFrame]);
- _this.renderEventSelection = core.memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
- _this.renderEventDrag = core.memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);
- _this.renderEventResize = core.memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);
- return _this;
- }
- DayTile.prototype.firstContext = function (context) {
- context.calendar.registerInteractiveComponent(this, {
- el: this.el,
- useEventCenter: false
- });
- };
- DayTile.prototype.render = function (props, context) {
- this.renderFrame(props.date);
- this.renderFgEvents(context, props.fgSegs);
- this.renderEventSelection(props.eventSelection);
- this.renderEventDrag(props.eventDragInstances);
- this.renderEventResize(props.eventResizeInstances);
- };
- DayTile.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- this.renderFrame.unrender(); // should unrender everything else
- this.context.calendar.unregisterInteractiveComponent(this);
- };
- DayTile.prototype._renderFrame = function (date) {
- var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;
- var title = dateEnv.format(date, core.createFormatter(options.dayPopoverFormat) // TODO: cache
- );
- this.el.innerHTML =
- '<div class="fc-header ' + theme.getClass('popoverHeader') + '">' +
- '<span class="fc-title">' +
- core.htmlEscape(title) +
- '</span>' +
- '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' +
- '</div>' +
- '<div class="fc-body ' + theme.getClass('popoverContent') + '">' +
- '<div class="fc-event-container"></div>' +
- '</div>';
- this.segContainerEl = this.el.querySelector('.fc-event-container');
- };
- DayTile.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) {
- var date = this.props.date; // HACK
- if (positionLeft < elWidth && positionTop < elHeight) {
- return {
- component: this,
- dateSpan: {
- allDay: true,
- range: { start: date, end: core.addDays(date, 1) }
- },
- dayEl: this.el,
- rect: {
- left: 0,
- top: 0,
- right: elWidth,
- bottom: elHeight
- },
- layer: 1
- };
- }
- };
- return DayTile;
- }(core.DateComponent));
- var DayTileEventRenderer = /** @class */ (function (_super) {
- __extends(DayTileEventRenderer, _super);
- function DayTileEventRenderer(dayTile) {
- var _this = _super.call(this) || this;
- _this.dayTile = dayTile;
- return _this;
- }
- DayTileEventRenderer.prototype.attachSegs = function (segs) {
- for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
- var seg = segs_1[_i];
- this.dayTile.segContainerEl.appendChild(seg.el);
- }
- };
- DayTileEventRenderer.prototype.detachSegs = function (segs) {
- for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
- var seg = segs_2[_i];
- core.removeElement(seg.el);
- }
- };
- return DayTileEventRenderer;
- }(SimpleDayGridEventRenderer));
- var DayBgRow = /** @class */ (function () {
- function DayBgRow(context) {
- this.context = context;
- }
- DayBgRow.prototype.renderHtml = function (props) {
- var parts = [];
- if (props.renderIntroHtml) {
- parts.push(props.renderIntroHtml());
- }
- for (var _i = 0, _a = props.cells; _i < _a.length; _i++) {
- var cell = _a[_i];
- parts.push(renderCellHtml(cell.date, props.dateProfile, this.context, cell.htmlAttrs));
- }
- if (!props.cells.length) {
- parts.push('<td class="fc-day ' + this.context.theme.getClass('widgetContent') + '"></td>');
- }
- if (this.context.options.dir === 'rtl') {
- parts.reverse();
- }
- return '<tr>' + parts.join('') + '</tr>';
- };
- return DayBgRow;
- }());
- function renderCellHtml(date, dateProfile, context, otherAttrs) {
- var dateEnv = context.dateEnv, theme = context.theme;
- var isDateValid = core.rangeContainsMarker(dateProfile.activeRange, date); // TODO: called too frequently. cache somehow.
- var classes = core.getDayClasses(date, dateProfile, context);
- classes.unshift('fc-day', theme.getClass('widgetContent'));
- return '<td class="' + classes.join(' ') + '"' +
- (isDateValid ?
- ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' :
- '') +
- (otherAttrs ?
- ' ' + otherAttrs :
- '') +
- '></td>';
- }
- var DAY_NUM_FORMAT = core.createFormatter({ day: 'numeric' });
- var WEEK_NUM_FORMAT = core.createFormatter({ week: 'numeric' });
- var DayGrid = /** @class */ (function (_super) {
- __extends(DayGrid, _super);
- function DayGrid(el, renderProps) {
- var _this = _super.call(this, el) || this;
- _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid
- _this.isCellSizesDirty = false;
- _this.renderProps = renderProps;
- var eventRenderer = _this.eventRenderer = new DayGridEventRenderer(_this);
- var fillRenderer = _this.fillRenderer = new DayGridFillRenderer(_this);
- _this.mirrorRenderer = new DayGridMirrorRenderer(_this);
- var renderCells = _this.renderCells = core.memoizeRendering(_this._renderCells, _this._unrenderCells);
- _this.renderBusinessHours = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderCells]);
- _this.renderDateSelection = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'highlight'), fillRenderer.unrender.bind(fillRenderer, 'highlight'), [renderCells]);
- _this.renderBgEvents = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderCells]);
- _this.renderFgEvents = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderCells]);
- _this.renderEventSelection = core.memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
- _this.renderEventDrag = core.memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderCells]);
- _this.renderEventResize = core.memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderCells]);
- return _this;
- }
- DayGrid.prototype.render = function (props, context) {
- var cells = props.cells;
- this.rowCnt = cells.length;
- this.colCnt = cells[0].length;
- this.renderCells(cells, props.isRigid);
- this.renderBusinessHours(context, props.businessHourSegs);
- this.renderDateSelection(context, props.dateSelectionSegs);
- this.renderBgEvents(context, props.bgEventSegs);
- this.renderFgEvents(context, props.fgEventSegs);
- this.renderEventSelection(props.eventSelection);
- this.renderEventDrag(props.eventDrag);
- this.renderEventResize(props.eventResize);
- if (this.segPopoverTile) {
- this.updateSegPopoverTile();
- }
- };
- DayGrid.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- this.renderCells.unrender(); // will unrender everything else
- };
- DayGrid.prototype.getCellRange = function (row, col) {
- var start = this.props.cells[row][col].date;
- var end = core.addDays(start, 1);
- return { start: start, end: end };
- };
- DayGrid.prototype.updateSegPopoverTile = function (date, segs) {
- var ownProps = this.props;
- this.segPopoverTile.receiveProps({
- date: date || this.segPopoverTile.props.date,
- fgSegs: segs || this.segPopoverTile.props.fgSegs,
- eventSelection: ownProps.eventSelection,
- eventDragInstances: ownProps.eventDrag ? ownProps.eventDrag.affectedInstances : null,
- eventResizeInstances: ownProps.eventResize ? ownProps.eventResize.affectedInstances : null
- }, this.context);
- };
- /* Date Rendering
- ------------------------------------------------------------------------------------------------------------------*/
- DayGrid.prototype._renderCells = function (cells, isRigid) {
- var _a = this.context, calendar = _a.calendar, view = _a.view, isRtl = _a.isRtl, dateEnv = _a.dateEnv;
- var _b = this, rowCnt = _b.rowCnt, colCnt = _b.colCnt;
- var html = '';
- var row;
- var col;
- for (row = 0; row < rowCnt; row++) {
- html += this.renderDayRowHtml(row, isRigid);
- }
- this.el.innerHTML = html;
- this.rowEls = core.findElements(this.el, '.fc-row');
- this.cellEls = core.findElements(this.el, '.fc-day, .fc-disabled-day');
- if (isRtl) {
- this.cellEls.reverse();
- }
- this.rowPositions = new core.PositionCache(this.el, this.rowEls, false, true // vertical
- );
- this.colPositions = new core.PositionCache(this.el, this.cellEls.slice(0, colCnt), // only the first row
- true, false // horizontal
- );
- // trigger dayRender with each cell's element
- for (row = 0; row < rowCnt; row++) {
- for (col = 0; col < colCnt; col++) {
- calendar.publiclyTrigger('dayRender', [
- {
- date: dateEnv.toDate(cells[row][col].date),
- el: this.getCellEl(row, col),
- view: view
- }
- ]);
- }
- }
- this.isCellSizesDirty = true;
- };
- DayGrid.prototype._unrenderCells = function () {
- this.removeSegPopover();
- };
- // Generates the HTML for a single row, which is a div that wraps a table.
- // `row` is the row number.
- DayGrid.prototype.renderDayRowHtml = function (row, isRigid) {
- var theme = this.context.theme;
- var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')];
- if (isRigid) {
- classes.push('fc-rigid');
- }
- var bgRow = new DayBgRow(this.context);
- return '' +
- '<div class="' + classes.join(' ') + '">' +
- '<div class="fc-bg">' +
- '<table class="' + theme.getClass('tableGrid') + '">' +
- bgRow.renderHtml({
- cells: this.props.cells[row],
- dateProfile: this.props.dateProfile,
- renderIntroHtml: this.renderProps.renderBgIntroHtml
- }) +
- '</table>' +
- '</div>' +
- '<div class="fc-content-skeleton">' +
- '<table>' +
- (this.getIsNumbersVisible() ?
- '<thead>' +
- this.renderNumberTrHtml(row) +
- '</thead>' :
- '') +
- '</table>' +
- '</div>' +
- '</div>';
- };
- DayGrid.prototype.getIsNumbersVisible = function () {
- return this.getIsDayNumbersVisible() ||
- this.renderProps.cellWeekNumbersVisible ||
- this.renderProps.colWeekNumbersVisible;
- };
- DayGrid.prototype.getIsDayNumbersVisible = function () {
- return this.rowCnt > 1;
- };
- /* Grid Number Rendering
- ------------------------------------------------------------------------------------------------------------------*/
- DayGrid.prototype.renderNumberTrHtml = function (row) {
- var isRtl = this.context.isRtl;
- var intro = this.renderProps.renderNumberIntroHtml(row, this);
- return '' +
- '<tr>' +
- (isRtl ? '' : intro) +
- this.renderNumberCellsHtml(row) +
- (isRtl ? intro : '') +
- '</tr>';
- };
- DayGrid.prototype.renderNumberCellsHtml = function (row) {
- var htmls = [];
- var col;
- var date;
- for (col = 0; col < this.colCnt; col++) {
- date = this.props.cells[row][col].date;
- htmls.push(this.renderNumberCellHtml(date));
- }
- if (this.context.isRtl) {
- htmls.reverse();
- }
- return htmls.join('');
- };
- // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
- // The number row will only exist if either day numbers or week numbers are turned on.
- DayGrid.prototype.renderNumberCellHtml = function (date) {
- var _a = this.context, dateEnv = _a.dateEnv, options = _a.options;
- var html = '';
- var isDateValid = core.rangeContainsMarker(this.props.dateProfile.activeRange, date); // TODO: called too frequently. cache somehow.
- var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid;
- var classes;
- var weekCalcFirstDow;
- if (!isDayNumberVisible && !this.renderProps.cellWeekNumbersVisible) {
- // no numbers in day cell (week number must be along the side)
- return '<td></td>'; // will create an empty space above events :(
- }
- classes = core.getDayClasses(date, this.props.dateProfile, this.context);
- classes.unshift('fc-day-top');
- if (this.renderProps.cellWeekNumbersVisible) {
- weekCalcFirstDow = dateEnv.weekDow;
- }
- html += '<td class="' + classes.join(' ') + '"' +
- (isDateValid ?
- ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' :
- '') +
- '>';
- if (this.renderProps.cellWeekNumbersVisible && (date.getUTCDay() === weekCalcFirstDow)) {
- html += core.buildGotoAnchorHtml(options, dateEnv, { date: date, type: 'week' }, { 'class': 'fc-week-number' }, dateEnv.format(date, WEEK_NUM_FORMAT) // inner HTML
- );
- }
- if (isDayNumberVisible) {
- html += core.buildGotoAnchorHtml(options, dateEnv, date, { 'class': 'fc-day-number' }, dateEnv.format(date, DAY_NUM_FORMAT) // inner HTML
- );
- }
- html += '</td>';
- return html;
- };
- /* Sizing
- ------------------------------------------------------------------------------------------------------------------*/
- DayGrid.prototype.updateSize = function (isResize) {
- var calendar = this.context.calendar;
- var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer;
- if (isResize ||
- this.isCellSizesDirty ||
- calendar.isEventsUpdated // hack
- ) {
- this.buildPositionCaches();
- this.isCellSizesDirty = false;
- }
- fillRenderer.computeSizes(isResize);
- eventRenderer.computeSizes(isResize);
- mirrorRenderer.computeSizes(isResize);
- fillRenderer.assignSizes(isResize);
- eventRenderer.assignSizes(isResize);
- mirrorRenderer.assignSizes(isResize);
- };
- DayGrid.prototype.buildPositionCaches = function () {
- this.buildColPositions();
- this.buildRowPositions();
- };
- DayGrid.prototype.buildColPositions = function () {
- this.colPositions.build();
- };
- DayGrid.prototype.buildRowPositions = function () {
- this.rowPositions.build();
- this.rowPositions.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack
- };
- /* Hit System
- ------------------------------------------------------------------------------------------------------------------*/
- DayGrid.prototype.positionToHit = function (leftPosition, topPosition) {
- var _a = this, colPositions = _a.colPositions, rowPositions = _a.rowPositions;
- var col = colPositions.leftToIndex(leftPosition);
- var row = rowPositions.topToIndex(topPosition);
- if (row != null && col != null) {
- return {
- row: row,
- col: col,
- dateSpan: {
- range: this.getCellRange(row, col),
- allDay: true
- },
- dayEl: this.getCellEl(row, col),
- relativeRect: {
- left: colPositions.lefts[col],
- right: colPositions.rights[col],
- top: rowPositions.tops[row],
- bottom: rowPositions.bottoms[row]
- }
- };
- }
- };
- /* Cell System
- ------------------------------------------------------------------------------------------------------------------*/
- // FYI: the first column is the leftmost column, regardless of date
- DayGrid.prototype.getCellEl = function (row, col) {
- return this.cellEls[row * this.colCnt + col];
- };
- /* Event Drag Visualization
- ------------------------------------------------------------------------------------------------------------------*/
- DayGrid.prototype._renderEventDrag = function (state) {
- if (state) {
- this.eventRenderer.hideByHash(state.affectedInstances);
- this.fillRenderer.renderSegs('highlight', this.context, state.segs);
- }
- };
- DayGrid.prototype._unrenderEventDrag = function (state) {
- if (state) {
- this.eventRenderer.showByHash(state.affectedInstances);
- this.fillRenderer.unrender('highlight', this.context);
- }
- };
- /* Event Resize Visualization
- ------------------------------------------------------------------------------------------------------------------*/
- DayGrid.prototype._renderEventResize = function (state) {
- if (state) {
- this.eventRenderer.hideByHash(state.affectedInstances);
- this.fillRenderer.renderSegs('highlight', this.context, state.segs);
- this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
- }
- };
- DayGrid.prototype._unrenderEventResize = function (state) {
- if (state) {
- this.eventRenderer.showByHash(state.affectedInstances);
- this.fillRenderer.unrender('highlight', this.context);
- this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
- }
- };
- /* More+ Link Popover
- ------------------------------------------------------------------------------------------------------------------*/
- DayGrid.prototype.removeSegPopover = function () {
- if (this.segPopover) {
- this.segPopover.hide(); // in handler, will call segPopover's removeElement
- }
- };
- // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid.
- // `levelLimit` can be false (don't limit), a number, or true (should be computed).
- DayGrid.prototype.limitRows = function (levelLimit) {
- var rowStructs = this.eventRenderer.rowStructs || [];
- var row; // row #
- var rowLevelLimit;
- for (row = 0; row < rowStructs.length; row++) {
- this.unlimitRow(row);
- if (!levelLimit) {
- rowLevelLimit = false;
- }
- else if (typeof levelLimit === 'number') {
- rowLevelLimit = levelLimit;
- }
- else {
- rowLevelLimit = this.computeRowLevelLimit(row);
- }
- if (rowLevelLimit !== false) {
- this.limitRow(row, rowLevelLimit);
- }
- }
- };
- // Computes the number of levels a row will accomodate without going outside its bounds.
- // Assumes the row is "rigid" (maintains a constant height regardless of what is inside).
- // `row` is the row number.
- DayGrid.prototype.computeRowLevelLimit = function (row) {
- var rowEl = this.rowEls[row]; // the containing "fake" row div
- var rowBottom = rowEl.getBoundingClientRect().bottom; // relative to viewport!
- var trEls = core.findChildren(this.eventRenderer.rowStructs[row].tbodyEl);
- var i;
- var trEl;
- // Reveal one level <tr> at a time and stop when we find one out of bounds
- for (i = 0; i < trEls.length; i++) {
- trEl = trEls[i];
- trEl.classList.remove('fc-limited'); // reset to original state (reveal)
- if (trEl.getBoundingClientRect().bottom > rowBottom) {
- return i;
- }
- }
- return false; // should not limit at all
- };
- // Limits the given grid row to the maximum number of levels and injects "more" links if necessary.
- // `row` is the row number.
- // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.
- DayGrid.prototype.limitRow = function (row, levelLimit) {
- var _this = this;
- var colCnt = this.colCnt;
- var isRtl = this.context.isRtl;
- var rowStruct = this.eventRenderer.rowStructs[row];
- var moreNodes = []; // array of "more" <a> links and <td> DOM nodes
- var col = 0; // col #, left-to-right (not chronologically)
- var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right
- var cellMatrix; // a matrix (by level, then column) of all <td> elements in the row
- var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes
- var i;
- var seg;
- var segsBelow; // array of segment objects below `seg` in the current `col`
- var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies
- var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)
- var td;
- var rowSpan;
- var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell
- var j;
- var moreTd;
- var moreWrap;
- var moreLink;
- // Iterates through empty level cells and places "more" links inside if need be
- var emptyCellsUntil = function (endCol) {
- while (col < endCol) {
- segsBelow = _this.getCellSegs(row, col, levelLimit);
- if (segsBelow.length) {
- td = cellMatrix[levelLimit - 1][col];
- moreLink = _this.renderMoreLink(row, col, segsBelow);
- moreWrap = core.createElement('div', null, moreLink);
- td.appendChild(moreWrap);
- moreNodes.push(moreWrap);
- }
- col++;
- }
- };
- if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit?
- levelSegs = rowStruct.segLevels[levelLimit - 1];
- cellMatrix = rowStruct.cellMatrix;
- limitedNodes = core.findChildren(rowStruct.tbodyEl).slice(levelLimit); // get level <tr> elements past the limit
- limitedNodes.forEach(function (node) {
- node.classList.add('fc-limited'); // hide elements and get a simple DOM-nodes array
- });
- // iterate though segments in the last allowable level
- for (i = 0; i < levelSegs.length; i++) {
- seg = levelSegs[i];
- var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
- var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
- emptyCellsUntil(leftCol); // process empty cells before the segment
- // determine *all* segments below `seg` that occupy the same columns
- colSegsBelow = [];
- totalSegsBelow = 0;
- while (col <= rightCol) {
- segsBelow = this.getCellSegs(row, col, levelLimit);
- colSegsBelow.push(segsBelow);
- totalSegsBelow += segsBelow.length;
- col++;
- }
- if (totalSegsBelow) { // do we need to replace this segment with one or many "more" links?
- td = cellMatrix[levelLimit - 1][leftCol]; // the segment's parent cell
- rowSpan = td.rowSpan || 1;
- segMoreNodes = [];
- // make a replacement <td> for each column the segment occupies. will be one for each colspan
- for (j = 0; j < colSegsBelow.length; j++) {
- moreTd = core.createElement('td', { className: 'fc-more-cell', rowSpan: rowSpan });
- segsBelow = colSegsBelow[j];
- moreLink = this.renderMoreLink(row, leftCol + j, [seg].concat(segsBelow) // count seg as hidden too
- );
- moreWrap = core.createElement('div', null, moreLink);
- moreTd.appendChild(moreWrap);
- segMoreNodes.push(moreTd);
- moreNodes.push(moreTd);
- }
- td.classList.add('fc-limited');
- core.insertAfterElement(td, segMoreNodes);
- limitedNodes.push(td);
- }
- }
- emptyCellsUntil(this.colCnt); // finish off the level
- rowStruct.moreEls = moreNodes; // for easy undoing later
- rowStruct.limitedEls = limitedNodes; // for easy undoing later
- }
- };
- // Reveals all levels and removes all "more"-related elements for a grid's row.
- // `row` is a row number.
- DayGrid.prototype.unlimitRow = function (row) {
- var rowStruct = this.eventRenderer.rowStructs[row];
- if (rowStruct.moreEls) {
- rowStruct.moreEls.forEach(core.removeElement);
- rowStruct.moreEls = null;
- }
- if (rowStruct.limitedEls) {
- rowStruct.limitedEls.forEach(function (limitedEl) {
- limitedEl.classList.remove('fc-limited');
- });
- rowStruct.limitedEls = null;
- }
- };
- // Renders an <a> element that represents hidden event element for a cell.
- // Responsible for attaching click handler as well.
- DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) {
- var _this = this;
- var _a = this.context, calendar = _a.calendar, view = _a.view, dateEnv = _a.dateEnv, options = _a.options, isRtl = _a.isRtl;
- var a = core.createElement('a', { className: 'fc-more' });
- a.innerText = this.getMoreLinkText(hiddenSegs.length);
- a.addEventListener('click', function (ev) {
- var clickOption = options.eventLimitClick;
- var _col = isRtl ? _this.colCnt - col - 1 : col; // HACK: props.cells has different dir system?
- var date = _this.props.cells[row][_col].date;
- var moreEl = ev.currentTarget;
- var dayEl = _this.getCellEl(row, col);
- var allSegs = _this.getCellSegs(row, col);
- // rescope the segments to be within the cell's date
- var reslicedAllSegs = _this.resliceDaySegs(allSegs, date);
- var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date);
- if (typeof clickOption === 'function') {
- // the returned value can be an atomic option
- clickOption = calendar.publiclyTrigger('eventLimitClick', [
- {
- date: dateEnv.toDate(date),
- allDay: true,
- dayEl: dayEl,
- moreEl: moreEl,
- segs: reslicedAllSegs,
- hiddenSegs: reslicedHiddenSegs,
- jsEvent: ev,
- view: view
- }
- ]);
- }
- if (clickOption === 'popover') {
- _this.showSegPopover(row, col, moreEl, reslicedAllSegs);
- }
- else if (typeof clickOption === 'string') { // a view name
- calendar.zoomTo(date, clickOption);
- }
- });
- return a;
- };
- // Reveals the popover that displays all events within a cell
- DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) {
- var _this = this;
- var _a = this.context, calendar = _a.calendar, view = _a.view, theme = _a.theme, isRtl = _a.isRtl;
- var _col = isRtl ? this.colCnt - col - 1 : col; // HACK: props.cells has different dir system?
- var moreWrap = moreLink.parentNode; // the <div> wrapper around the <a>
- var topEl; // the element we want to match the top coordinate of
- var options;
- if (this.rowCnt === 1) {
- topEl = view.el; // will cause the popover to cover any sort of header
- }
- else {
- topEl = this.rowEls[row]; // will align with top of row
- }
- options = {
- className: 'fc-more-popover ' + theme.getClass('popover'),
- parentEl: view.el,
- top: core.computeRect(topEl).top,
- autoHide: true,
- content: function (el) {
- _this.segPopoverTile = new DayTile(el);
- _this.updateSegPopoverTile(_this.props.cells[row][_col].date, segs);
- },
- hide: function () {
- _this.segPopoverTile.destroy();
- _this.segPopoverTile = null;
- _this.segPopover.destroy();
- _this.segPopover = null;
- }
- };
- // Determine horizontal coordinate.
- // We use the moreWrap instead of the <td> to avoid border confusion.
- if (isRtl) {
- options.right = core.computeRect(moreWrap).right + 1; // +1 to be over cell border
- }
- else {
- options.left = core.computeRect(moreWrap).left - 1; // -1 to be over cell border
- }
- this.segPopover = new Popover(options);
- this.segPopover.show();
- calendar.releaseAfterSizingTriggers(); // hack for eventPositioned
- };
- // Given the events within an array of segment objects, reslice them to be in a single day
- DayGrid.prototype.resliceDaySegs = function (segs, dayDate) {
- var dayStart = dayDate;
- var dayEnd = core.addDays(dayStart, 1);
- var dayRange = { start: dayStart, end: dayEnd };
- var newSegs = [];
- for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
- var seg = segs_1[_i];
- var eventRange = seg.eventRange;
- var origRange = eventRange.range;
- var slicedRange = core.intersectRanges(origRange, dayRange);
- if (slicedRange) {
- newSegs.push(__assign({}, seg, { eventRange: {
- def: eventRange.def,
- ui: __assign({}, eventRange.ui, { durationEditable: false }),
- instance: eventRange.instance,
- range: slicedRange
- }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() }));
- }
- }
- return newSegs;
- };
- // Generates the text that should be inside a "more" link, given the number of events it represents
- DayGrid.prototype.getMoreLinkText = function (num) {
- var opt = this.context.options.eventLimitText;
- if (typeof opt === 'function') {
- return opt(num);
- }
- else {
- return '+' + num + ' ' + opt;
- }
- };
- // Returns segments within a given cell.
- // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.
- DayGrid.prototype.getCellSegs = function (row, col, startLevel) {
- var segMatrix = this.eventRenderer.rowStructs[row].segMatrix;
- var level = startLevel || 0;
- var segs = [];
- var seg;
- while (level < segMatrix.length) {
- seg = segMatrix[level][col];
- if (seg) {
- segs.push(seg);
- }
- level++;
- }
- return segs;
- };
- return DayGrid;
- }(core.DateComponent));
- var WEEK_NUM_FORMAT$1 = core.createFormatter({ week: 'numeric' });
- /* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells.
- ----------------------------------------------------------------------------------------------------------------------*/
- // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
- // It is responsible for managing width/height.
- var AbstractDayGridView = /** @class */ (function (_super) {
- __extends(AbstractDayGridView, _super);
- function AbstractDayGridView() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.processOptions = core.memoize(_this._processOptions);
- _this.renderSkeleton = core.memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
- /* Header Rendering
- ------------------------------------------------------------------------------------------------------------------*/
- // Generates the HTML that will go before the day-of week header cells
- _this.renderHeadIntroHtml = function () {
- var _a = _this.context, theme = _a.theme, options = _a.options;
- if (_this.colWeekNumbersVisible) {
- return '' +
- '<th class="fc-week-number ' + theme.getClass('widgetHeader') + '" ' + _this.weekNumberStyleAttr() + '>' +
- '<span>' + // needed for matchCellWidths
- core.htmlEscape(options.weekLabel) +
- '</span>' +
- '</th>';
- }
- return '';
- };
- /* Day Grid Rendering
- ------------------------------------------------------------------------------------------------------------------*/
- // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
- _this.renderDayGridNumberIntroHtml = function (row, dayGrid) {
- var _a = _this.context, options = _a.options, dateEnv = _a.dateEnv;
- var weekStart = dayGrid.props.cells[row][0].date;
- if (_this.colWeekNumbersVisible) {
- return '' +
- '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '>' +
- core.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
- options, dateEnv, { date: weekStart, type: 'week', forceOff: dayGrid.colCnt === 1 }, dateEnv.format(weekStart, WEEK_NUM_FORMAT$1) // inner HTML
- ) +
- '</td>';
- }
- return '';
- };
- // Generates the HTML that goes before the day bg cells for each day-row
- _this.renderDayGridBgIntroHtml = function () {
- var theme = _this.context.theme;
- if (_this.colWeekNumbersVisible) {
- return '<td class="fc-week-number ' + theme.getClass('widgetContent') + '" ' + _this.weekNumberStyleAttr() + '></td>';
- }
- return '';
- };
- // Generates the HTML that goes before every other type of row generated by DayGrid.
- // Affects mirror-skeleton and highlight-skeleton rows.
- _this.renderDayGridIntroHtml = function () {
- if (_this.colWeekNumbersVisible) {
- return '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '></td>';
- }
- return '';
- };
- return _this;
- }
- AbstractDayGridView.prototype._processOptions = function (options) {
- if (options.weekNumbers) {
- if (options.weekNumbersWithinDays) {
- this.cellWeekNumbersVisible = true;
- this.colWeekNumbersVisible = false;
- }
- else {
- this.cellWeekNumbersVisible = false;
- this.colWeekNumbersVisible = true;
- }
- }
- else {
- this.colWeekNumbersVisible = false;
- this.cellWeekNumbersVisible = false;
- }
- };
- AbstractDayGridView.prototype.render = function (props, context) {
- _super.prototype.render.call(this, props, context);
- this.processOptions(context.options);
- this.renderSkeleton(context);
- };
- AbstractDayGridView.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- this.renderSkeleton.unrender();
- };
- AbstractDayGridView.prototype._renderSkeleton = function (context) {
- this.el.classList.add('fc-dayGrid-view');
- this.el.innerHTML = this.renderSkeletonHtml();
- this.scroller = new core.ScrollComponent('hidden', // overflow x
- 'auto' // overflow y
- );
- var dayGridContainerEl = this.scroller.el;
- this.el.querySelector('.fc-body > tr > td').appendChild(dayGridContainerEl);
- dayGridContainerEl.classList.add('fc-day-grid-container');
- var dayGridEl = core.createElement('div', { className: 'fc-day-grid' });
- dayGridContainerEl.appendChild(dayGridEl);
- this.dayGrid = new DayGrid(dayGridEl, {
- renderNumberIntroHtml: this.renderDayGridNumberIntroHtml,
- renderBgIntroHtml: this.renderDayGridBgIntroHtml,
- renderIntroHtml: this.renderDayGridIntroHtml,
- colWeekNumbersVisible: this.colWeekNumbersVisible,
- cellWeekNumbersVisible: this.cellWeekNumbersVisible
- });
- };
- AbstractDayGridView.prototype._unrenderSkeleton = function () {
- this.el.classList.remove('fc-dayGrid-view');
- this.dayGrid.destroy();
- this.scroller.destroy();
- };
- // Builds the HTML skeleton for the view.
- // The day-grid component will render inside of a container defined by this HTML.
- AbstractDayGridView.prototype.renderSkeletonHtml = function () {
- var _a = this.context, theme = _a.theme, options = _a.options;
- return '' +
- '<table class="' + theme.getClass('tableGrid') + '">' +
- (options.columnHeader ?
- '<thead class="fc-head">' +
- '<tr>' +
- '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '"> </td>' +
- '</tr>' +
- '</thead>' :
- '') +
- '<tbody class="fc-body">' +
- '<tr>' +
- '<td class="' + theme.getClass('widgetContent') + '"></td>' +
- '</tr>' +
- '</tbody>' +
- '</table>';
- };
- // Generates an HTML attribute string for setting the width of the week number column, if it is known
- AbstractDayGridView.prototype.weekNumberStyleAttr = function () {
- if (this.weekNumberWidth != null) {
- return 'style="width:' + this.weekNumberWidth + 'px"';
- }
- return '';
- };
- // Determines whether each row should have a constant height
- AbstractDayGridView.prototype.hasRigidRows = function () {
- var eventLimit = this.context.options.eventLimit;
- return eventLimit && typeof eventLimit !== 'number';
- };
- /* Dimensions
- ------------------------------------------------------------------------------------------------------------------*/
- AbstractDayGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) {
- _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first
- this.dayGrid.updateSize(isResize);
- };
- // Refreshes the horizontal dimensions of the view
- AbstractDayGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {
- var dayGrid = this.dayGrid;
- var eventLimit = this.context.options.eventLimit;
- var headRowEl = this.header ? this.header.el : null; // HACK
- var scrollerHeight;
- var scrollbarWidths;
- // hack to give the view some height prior to dayGrid's columns being rendered
- // TODO: separate setting height from scroller VS dayGrid.
- if (!dayGrid.rowEls) {
- if (!isAuto) {
- scrollerHeight = this.computeScrollerHeight(viewHeight);
- this.scroller.setHeight(scrollerHeight);
- }
- return;
- }
- if (this.colWeekNumbersVisible) {
- // Make sure all week number cells running down the side have the same width.
- this.weekNumberWidth = core.matchCellWidths(core.findElements(this.el, '.fc-week-number'));
- }
- // reset all heights to be natural
- this.scroller.clear();
- if (headRowEl) {
- core.uncompensateScroll(headRowEl);
- }
- dayGrid.removeSegPopover(); // kill the "more" popover if displayed
- // is the event limit a constant level number?
- if (eventLimit && typeof eventLimit === 'number') {
- dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
- }
- // distribute the height to the rows
- // (viewHeight is a "recommended" value if isAuto)
- scrollerHeight = this.computeScrollerHeight(viewHeight);
- this.setGridHeight(scrollerHeight, isAuto);
- // is the event limit dynamically calculated?
- if (eventLimit && typeof eventLimit !== 'number') {
- dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
- }
- if (!isAuto) { // should we force dimensions of the scroll container?
- this.scroller.setHeight(scrollerHeight);
- scrollbarWidths = this.scroller.getScrollbarWidths();
- if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
- if (headRowEl) {
- core.compensateScroll(headRowEl, scrollbarWidths);
- }
- // doing the scrollbar compensation might have created text overflow which created more height. redo
- scrollerHeight = this.computeScrollerHeight(viewHeight);
- this.scroller.setHeight(scrollerHeight);
- }
- // guarantees the same scrollbar widths
- this.scroller.lockOverflow(scrollbarWidths);
- }
- };
- // given a desired total height of the view, returns what the height of the scroller should be
- AbstractDayGridView.prototype.computeScrollerHeight = function (viewHeight) {
- return viewHeight -
- core.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
- };
- // Sets the height of just the DayGrid component in this view
- AbstractDayGridView.prototype.setGridHeight = function (height, isAuto) {
- if (this.context.options.monthMode) {
- // if auto, make the height of each row the height that it would be if there were 6 weeks
- if (isAuto) {
- height *= this.dayGrid.rowCnt / 6;
- }
- core.distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows
- }
- else {
- if (isAuto) {
- core.undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
- }
- else {
- core.distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
- }
- }
- };
- /* Scroll
- ------------------------------------------------------------------------------------------------------------------*/
- AbstractDayGridView.prototype.computeDateScroll = function (duration) {
- return { top: 0 };
- };
- AbstractDayGridView.prototype.queryDateScroll = function () {
- return { top: this.scroller.getScrollTop() };
- };
- AbstractDayGridView.prototype.applyDateScroll = function (scroll) {
- if (scroll.top !== undefined) {
- this.scroller.setScrollTop(scroll.top);
- }
- };
- return AbstractDayGridView;
- }(core.View));
- AbstractDayGridView.prototype.dateProfileGeneratorClass = DayGridDateProfileGenerator;
- var SimpleDayGrid = /** @class */ (function (_super) {
- __extends(SimpleDayGrid, _super);
- function SimpleDayGrid(dayGrid) {
- var _this = _super.call(this, dayGrid.el) || this;
- _this.slicer = new DayGridSlicer();
- _this.dayGrid = dayGrid;
- return _this;
- }
- SimpleDayGrid.prototype.firstContext = function (context) {
- context.calendar.registerInteractiveComponent(this, { el: this.dayGrid.el });
- };
- SimpleDayGrid.prototype.destroy = function () {
- _super.prototype.destroy.call(this);
- this.context.calendar.unregisterInteractiveComponent(this);
- };
- SimpleDayGrid.prototype.render = function (props, context) {
- var dayGrid = this.dayGrid;
- var dateProfile = props.dateProfile, dayTable = props.dayTable;
- dayGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, props.nextDayThreshold, context.calendar, dayGrid, dayTable), { dateProfile: dateProfile, cells: dayTable.cells, isRigid: props.isRigid }), context);
- };
- SimpleDayGrid.prototype.buildPositionCaches = function () {
- this.dayGrid.buildPositionCaches();
- };
- SimpleDayGrid.prototype.queryHit = function (positionLeft, positionTop) {
- var rawHit = this.dayGrid.positionToHit(positionLeft, positionTop);
- if (rawHit) {
- return {
- component: this.dayGrid,
- dateSpan: rawHit.dateSpan,
- dayEl: rawHit.dayEl,
- rect: {
- left: rawHit.relativeRect.left,
- right: rawHit.relativeRect.right,
- top: rawHit.relativeRect.top,
- bottom: rawHit.relativeRect.bottom
- },
- layer: 0
- };
- }
- };
- return SimpleDayGrid;
- }(core.DateComponent));
- var DayGridSlicer = /** @class */ (function (_super) {
- __extends(DayGridSlicer, _super);
- function DayGridSlicer() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- DayGridSlicer.prototype.sliceRange = function (dateRange, dayTable) {
- return dayTable.sliceRange(dateRange);
- };
- return DayGridSlicer;
- }(core.Slicer));
- var DayGridView = /** @class */ (function (_super) {
- __extends(DayGridView, _super);
- function DayGridView() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.buildDayTable = core.memoize(buildDayTable);
- return _this;
- }
- DayGridView.prototype.render = function (props, context) {
- _super.prototype.render.call(this, props, context); // will call _renderSkeleton/_unrenderSkeleton
- var dateProfile = this.props.dateProfile;
- var dayTable = this.dayTable =
- this.buildDayTable(dateProfile, props.dateProfileGenerator);
- if (this.header) {
- this.header.receiveProps({
- dateProfile: dateProfile,
- dates: dayTable.headerDates,
- datesRepDistinctDays: dayTable.rowCnt === 1,
- renderIntroHtml: this.renderHeadIntroHtml
- }, context);
- }
- this.simpleDayGrid.receiveProps({
- dateProfile: dateProfile,
- dayTable: dayTable,
- businessHours: props.businessHours,
- dateSelection: props.dateSelection,
- eventStore: props.eventStore,
- eventUiBases: props.eventUiBases,
- eventSelection: props.eventSelection,
- eventDrag: props.eventDrag,
- eventResize: props.eventResize,
- isRigid: this.hasRigidRows(),
- nextDayThreshold: this.context.nextDayThreshold
- }, context);
- };
- DayGridView.prototype._renderSkeleton = function (context) {
- _super.prototype._renderSkeleton.call(this, context);
- if (context.options.columnHeader) {
- this.header = new core.DayHeader(this.el.querySelector('.fc-head-container'));
- }
- this.simpleDayGrid = new SimpleDayGrid(this.dayGrid);
- };
- DayGridView.prototype._unrenderSkeleton = function () {
- _super.prototype._unrenderSkeleton.call(this);
- if (this.header) {
- this.header.destroy();
- }
- this.simpleDayGrid.destroy();
- };
- return DayGridView;
- }(AbstractDayGridView));
- function buildDayTable(dateProfile, dateProfileGenerator) {
- var daySeries = new core.DaySeries(dateProfile.renderRange, dateProfileGenerator);
- return new core.DayTable(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit));
- }
- var main = core.createPlugin({
- defaultView: 'dayGridMonth',
- views: {
- dayGrid: DayGridView,
- dayGridDay: {
- type: 'dayGrid',
- duration: { days: 1 }
- },
- dayGridWeek: {
- type: 'dayGrid',
- duration: { weeks: 1 }
- },
- dayGridMonth: {
- type: 'dayGrid',
- duration: { months: 1 },
- monthMode: true,
- fixedWeekCount: true
- }
- }
- });
- exports.AbstractDayGridView = AbstractDayGridView;
- exports.DayBgRow = DayBgRow;
- exports.DayGrid = DayGrid;
- exports.DayGridSlicer = DayGridSlicer;
- exports.DayGridView = DayGridView;
- exports.SimpleDayGrid = SimpleDayGrid;
- exports.buildBasicDayTable = buildDayTable;
- exports.default = main;
- Object.defineProperty(exports, '__esModule', { value: true });
- }));
- /*!
- FullCalendar Google Calendar Plugin v4.4.0
- Docs & License: https://fullcalendar.io/
- (c) 2019 Adam Shaw
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fullcalendar/core')) :
- typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core'], factory) :
- (global = global || self, factory(global.FullCalendarGoogleCalendar = {}, global.FullCalendar));
- }(this, function (exports, core) { 'use strict';
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- // TODO: expose somehow
- var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
- var STANDARD_PROPS = {
- url: String,
- googleCalendarApiKey: String,
- googleCalendarId: String,
- googleCalendarApiBase: String,
- data: null
- };
- var eventSourceDef = {
- parseMeta: function (raw) {
- if (typeof raw === 'string') {
- raw = { url: raw };
- }
- if (typeof raw === 'object') {
- var standardProps = core.refineProps(raw, STANDARD_PROPS);
- if (!standardProps.googleCalendarId && standardProps.url) {
- standardProps.googleCalendarId = parseGoogleCalendarId(standardProps.url);
- }
- delete standardProps.url;
- if (standardProps.googleCalendarId) {
- return standardProps;
- }
- }
- return null;
- },
- fetch: function (arg, onSuccess, onFailure) {
- var calendar = arg.calendar;
- var meta = arg.eventSource.meta;
- var apiKey = meta.googleCalendarApiKey || calendar.opt('googleCalendarApiKey');
- if (!apiKey) {
- onFailure({
- message: 'Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/'
- });
- }
- else {
- var url = buildUrl(meta);
- var requestParams_1 = buildRequestParams(arg.range, apiKey, meta.data, calendar.dateEnv);
- core.requestJson('GET', url, requestParams_1, function (body, xhr) {
- if (body.error) {
- onFailure({
- message: 'Google Calendar API: ' + body.error.message,
- errors: body.error.errors,
- xhr: xhr
- });
- }
- else {
- onSuccess({
- rawEvents: gcalItemsToRawEventDefs(body.items, requestParams_1.timeZone),
- xhr: xhr
- });
- }
- }, function (message, xhr) {
- onFailure({ message: message, xhr: xhr });
- });
- }
- }
- };
- function parseGoogleCalendarId(url) {
- var match;
- // detect if the ID was specified as a single string.
- // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars.
- if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) {
- return url;
- }
- else if ((match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) ||
- (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))) {
- return decodeURIComponent(match[1]);
- }
- }
- function buildUrl(meta) {
- var apiBase = meta.googleCalendarApiBase;
- if (!apiBase) {
- apiBase = API_BASE;
- }
- return apiBase + '/' + encodeURIComponent(meta.googleCalendarId) + '/events';
- }
- function buildRequestParams(range, apiKey, extraParams, dateEnv) {
- var params;
- var startStr;
- var endStr;
- if (dateEnv.canComputeOffset) {
- // strings will naturally have offsets, which GCal needs
- startStr = dateEnv.formatIso(range.start);
- endStr = dateEnv.formatIso(range.end);
- }
- else {
- // when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day
- // from the UTC day-start to guarantee we're getting all the events
- // (start/end will be UTC-coerced dates, so toISOString is okay)
- startStr = core.addDays(range.start, -1).toISOString();
- endStr = core.addDays(range.end, 1).toISOString();
- }
- params = __assign({}, (extraParams || {}), { key: apiKey, timeMin: startStr, timeMax: endStr, singleEvents: true, maxResults: 9999 });
- if (dateEnv.timeZone !== 'local') {
- params.timeZone = dateEnv.timeZone;
- }
- return params;
- }
- function gcalItemsToRawEventDefs(items, gcalTimezone) {
- return items.map(function (item) {
- return gcalItemToRawEventDef(item, gcalTimezone);
- });
- }
- function gcalItemToRawEventDef(item, gcalTimezone) {
- var url = item.htmlLink || null;
- // make the URLs for each event show times in the correct timezone
- if (url && gcalTimezone) {
- url = injectQsComponent(url, 'ctz=' + gcalTimezone);
- }
- return {
- id: item.id,
- title: item.summary,
- start: item.start.dateTime || item.start.date,
- end: item.end.dateTime || item.end.date,
- url: url,
- location: item.location,
- description: item.description
- };
- }
- // Injects a string like "arg=value" into the querystring of a URL
- // TODO: move to a general util file?
- function injectQsComponent(url, component) {
- // inject it after the querystring but before the fragment
- return url.replace(/(\?.*?)?(#|$)/, function (whole, qs, hash) {
- return (qs ? qs + '&' : '?') + component + hash;
- });
- }
- var main = core.createPlugin({
- eventSourceDefs: [eventSourceDef]
- });
- exports.default = main;
- Object.defineProperty(exports, '__esModule', { value: true });
- }));
- /* Modernizr 2.8.3 (Custom Build) | MIT & BSD
- * Build: http://modernizr.com/download/#-cssanimations-csstransforms-csstransforms3d-csstransitions-inlinesvg-svg-shiv-cssclasses-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes-load
- */
- ;window.Modernizr=function(a,b,c){function A(a){j.cssText=a}function B(a,b){return A(m.join(a+";")+(b||""))}function C(a,b){return typeof a===b}function D(a,b){return!!~(""+a).indexOf(b)}function E(a,b){for(var d in a){var e=a[d];if(!D(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function F(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:C(f,"function")?f.bind(d||b):f}return!1}function G(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return C(b,"string")||C(b,"undefined")?E(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),F(e,b,c))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={svg:"http://www.w3.org/2000/svg"},r={},s={},t={},u=[],v=u.slice,w,x=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},y={}.hasOwnProperty,z;!C(y,"undefined")&&!C(y.call,"undefined")?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=v.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(v.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(v.call(arguments)))};return e}),r.cssanimations=function(){return G("animationName")},r.csstransforms=function(){return!!G("transform")},r.csstransforms3d=function(){var a=!!G("perspective");return a&&"webkitPerspective"in g.style&&x("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},r.csstransitions=function(){return G("transition")},r.svg=function(){return!!b.createElementNS&&!!b.createElementNS(q.svg,"svg").createSVGRect},r.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==q.svg};for(var H in r)z(r,H)&&(w=H.toLowerCase(),e[w]=r[H](),u.push((e[w]?"":"no-")+w));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)z(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},A(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return E([a])},e.testAllProps=G,e.testStyles=x,e.prefixed=function(a,b,c){return b?G(a,b,c):G(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+u.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
- /*!
- * jQuery Validation Plugin v1.13.1
- *
- * http://jqueryvalidation.org/
- *
- * Copyright (c) 2014 Jörn Zaefferer
- * Released under the MIT license
- */
- (function( factory ) {
- if ( typeof define === "function" && define.amd ) {
- define( ["jquery"], factory );
- } else {
- factory( jQuery );
- }
- }(function( $ ) {
- $.extend($.fn, {
- // http://jqueryvalidation.org/validate/
- validate: function( options ) {
- // if nothing is selected, return nothing; can't chain anyway
- if ( !this.length ) {
- if ( options && options.debug && window.console ) {
- console.warn( "Nothing selected, can't validate, returning nothing." );
- }
- return;
- }
- // check if a validator for this form was already created
- var validator = $.data( this[ 0 ], "validator" );
- if ( validator ) {
- return validator;
- }
- // Add novalidate tag if HTML5.
- this.attr( "novalidate", "novalidate" );
- validator = new $.validator( options, this[ 0 ] );
- $.data( this[ 0 ], "validator", validator );
- if ( validator.settings.onsubmit ) {
- this.validateDelegate( ":submit", "click", function( event ) {
- if ( validator.settings.submitHandler ) {
- validator.submitButton = event.target;
- }
- // allow suppressing validation by adding a cancel class to the submit button
- if ( $( event.target ).hasClass( "cancel" ) ) {
- validator.cancelSubmit = true;
- }
- // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
- if ( $( event.target ).attr( "formnovalidate" ) !== undefined ) {
- validator.cancelSubmit = true;
- }
- });
- // validate the form on submit
- this.submit( function( event ) {
- if ( validator.settings.debug ) {
- // prevent form submit to be able to see console output
- event.preventDefault();
- }
- function handle() {
- var hidden, result;
- if ( validator.settings.submitHandler ) {
- if ( validator.submitButton ) {
- // insert a hidden input as a replacement for the missing submit button
- hidden = $( "<input type='hidden'/>" )
- .attr( "name", validator.submitButton.name )
- .val( $( validator.submitButton ).val() )
- .appendTo( validator.currentForm );
- }
- result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
- if ( validator.submitButton ) {
- // and clean up afterwards; thanks to no-block-scope, hidden can be referenced
- hidden.remove();
- }
- if ( result !== undefined ) {
- return result;
- }
- return false;
- }
- return true;
- }
- // prevent submit for invalid forms or custom submit handlers
- if ( validator.cancelSubmit ) {
- validator.cancelSubmit = false;
- return handle();
- }
- if ( validator.form() ) {
- if ( validator.pendingRequest ) {
- validator.formSubmitted = true;
- return false;
- }
- return handle();
- } else {
- validator.focusInvalid();
- return false;
- }
- });
- }
- return validator;
- },
- // http://jqueryvalidation.org/valid/
- valid: function() {
- var valid, validator;
- if ( $( this[ 0 ] ).is( "form" ) ) {
- valid = this.validate().form();
- } else {
- valid = true;
- validator = $( this[ 0 ].form ).validate();
- this.each( function() {
- valid = validator.element( this ) && valid;
- });
- }
- return valid;
- },
- // attributes: space separated list of attributes to retrieve and remove
- removeAttrs: function( attributes ) {
- var result = {},
- $element = this;
- $.each( attributes.split( /\s/ ), function( index, value ) {
- result[ value ] = $element.attr( value );
- $element.removeAttr( value );
- });
- return result;
- },
- // http://jqueryvalidation.org/rules/
- rules: function( command, argument ) {
- var element = this[ 0 ],
- settings, staticRules, existingRules, data, param, filtered;
- if ( command ) {
- settings = $.data( element.form, "validator" ).settings;
- staticRules = settings.rules;
- existingRules = $.validator.staticRules( element );
- switch ( command ) {
- case "add":
- $.extend( existingRules, $.validator.normalizeRule( argument ) );
- // remove messages from rules, but allow them to be set separately
- delete existingRules.messages;
- staticRules[ element.name ] = existingRules;
- if ( argument.messages ) {
- settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
- }
- break;
- case "remove":
- if ( !argument ) {
- delete staticRules[ element.name ];
- return existingRules;
- }
- filtered = {};
- $.each( argument.split( /\s/ ), function( index, method ) {
- filtered[ method ] = existingRules[ method ];
- delete existingRules[ method ];
- if ( method === "required" ) {
- $( element ).removeAttr( "aria-required" );
- }
- });
- return filtered;
- }
- }
- data = $.validator.normalizeRules(
- $.extend(
- {},
- $.validator.classRules( element ),
- $.validator.attributeRules( element ),
- $.validator.dataRules( element ),
- $.validator.staticRules( element )
- ), element );
- // make sure required is at front
- if ( data.required ) {
- param = data.required;
- delete data.required;
- data = $.extend( { required: param }, data );
- $( element ).attr( "aria-required", "true" );
- }
- // make sure remote is at back
- if ( data.remote ) {
- param = data.remote;
- delete data.remote;
- data = $.extend( data, { remote: param });
- }
- return data;
- }
- });
- // Custom selectors
- $.extend( $.expr[ ":" ], {
- // http://jqueryvalidation.org/blank-selector/
- blank: function( a ) {
- return !$.trim( "" + $( a ).val() );
- },
- // http://jqueryvalidation.org/filled-selector/
- filled: function( a ) {
- return !!$.trim( "" + $( a ).val() );
- },
- // http://jqueryvalidation.org/unchecked-selector/
- unchecked: function( a ) {
- return !$( a ).prop( "checked" );
- }
- });
- // constructor for validator
- $.validator = function( options, form ) {
- this.settings = $.extend( true, {}, $.validator.defaults, options );
- this.currentForm = form;
- this.init();
- };
- // http://jqueryvalidation.org/jQuery.validator.format/
- $.validator.format = function( source, params ) {
- if ( arguments.length === 1 ) {
- return function() {
- var args = $.makeArray( arguments );
- args.unshift( source );
- return $.validator.format.apply( this, args );
- };
- }
- if ( arguments.length > 2 && params.constructor !== Array ) {
- params = $.makeArray( arguments ).slice( 1 );
- }
- if ( params.constructor !== Array ) {
- params = [ params ];
- }
- $.each( params, function( i, n ) {
- source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
- return n;
- });
- });
- return source;
- };
- $.extend( $.validator, {
- defaults: {
- messages: {},
- groups: {},
- rules: {},
- errorClass: "error",
- validClass: "valid",
- errorElement: "label",
- focusCleanup: false,
- focusInvalid: true,
- errorContainer: $( [] ),
- errorLabelContainer: $( [] ),
- onsubmit: true,
- ignore: ":hidden",
- ignoreTitle: false,
- onfocusin: function( element ) {
- this.lastActive = element;
- // Hide error label and remove error class on focus if enabled
- if ( this.settings.focusCleanup ) {
- if ( this.settings.unhighlight ) {
- this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
- }
- this.hideThese( this.errorsFor( element ) );
- }
- },
- onfocusout: function( element ) {
- if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
- this.element( element );
- }
- },
- onkeyup: function( element, event ) {
- if ( event.which === 9 && this.elementValue( element ) === "" ) {
- return;
- } else if ( element.name in this.submitted || element === this.lastElement ) {
- this.element( element );
- }
- },
- onclick: function( element ) {
- // click on selects, radiobuttons and checkboxes
- if ( element.name in this.submitted ) {
- this.element( element );
- // or option elements, check parent select in that case
- } else if ( element.parentNode.name in this.submitted ) {
- this.element( element.parentNode );
- }
- },
- highlight: function( element, errorClass, validClass ) {
- if ( element.type === "radio" ) {
- this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
- } else {
- $( element ).addClass( errorClass ).removeClass( validClass );
- }
- },
- unhighlight: function( element, errorClass, validClass ) {
- if ( element.type === "radio" ) {
- this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
- } else {
- $( element ).removeClass( errorClass ).addClass( validClass );
- }
- }
- },
- // http://jqueryvalidation.org/jQuery.validator.setDefaults/
- setDefaults: function( settings ) {
- $.extend( $.validator.defaults, settings );
- },
- messages: {
- required: "This field is required.",
- remote: "Please fix this field.",
- email: "Please enter a valid email address.",
- url: "Please enter a valid URL.",
- date: "Please enter a valid date.",
- dateISO: "Please enter a valid date ( ISO ).",
- number: "Please enter a valid number.",
- digits: "Please enter only digits.",
- creditcard: "Please enter a valid credit card number.",
- equalTo: "Please enter the same value again.",
- maxlength: $.validator.format( "Please enter no more than {0} characters." ),
- minlength: $.validator.format( "Please enter at least {0} characters." ),
- rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
- range: $.validator.format( "Please enter a value between {0} and {1}." ),
- max: $.validator.format( "Please enter a value less than or equal to {0}." ),
- min: $.validator.format( "Please enter a value greater than or equal to {0}." )
- },
- autoCreateRanges: false,
- prototype: {
- init: function() {
- this.labelContainer = $( this.settings.errorLabelContainer );
- this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
- this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
- this.submitted = {};
- this.valueCache = {};
- this.pendingRequest = 0;
- this.pending = {};
- this.invalid = {};
- this.reset();
- var groups = ( this.groups = {} ),
- rules;
- $.each( this.settings.groups, function( key, value ) {
- if ( typeof value === "string" ) {
- value = value.split( /\s/ );
- }
- $.each( value, function( index, name ) {
- groups[ name ] = key;
- });
- });
- rules = this.settings.rules;
- $.each( rules, function( key, value ) {
- rules[ key ] = $.validator.normalizeRule( value );
- });
- function delegate( event ) {
- var validator = $.data( this[ 0 ].form, "validator" ),
- eventType = "on" + event.type.replace( /^validate/, "" ),
- settings = validator.settings;
- if ( settings[ eventType ] && !this.is( settings.ignore ) ) {
- settings[ eventType ].call( validator, this[ 0 ], event );
- }
- }
- $( this.currentForm )
- .validateDelegate( ":text, [type='password'], [type='file'], select, textarea, " +
- "[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
- "[type='email'], [type='datetime'], [type='date'], [type='month'], " +
- "[type='week'], [type='time'], [type='datetime-local'], " +
- "[type='range'], [type='color'], [type='radio'], [type='checkbox']",
- "focusin focusout keyup", delegate)
- // Support: Chrome, oldIE
- // "select" is provided as event.target when clicking a option
- .validateDelegate("select, option, [type='radio'], [type='checkbox']", "click", delegate);
- if ( this.settings.invalidHandler ) {
- $( this.currentForm ).bind( "invalid-form.validate", this.settings.invalidHandler );
- }
- // Add aria-required to any Static/Data/Class required fields before first validation
- // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html
- $( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" );
- },
- // http://jqueryvalidation.org/Validator.form/
- form: function() {
- this.checkForm();
- $.extend( this.submitted, this.errorMap );
- this.invalid = $.extend({}, this.errorMap );
- if ( !this.valid() ) {
- $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
- }
- this.showErrors();
- return this.valid();
- },
- checkForm: function() {
- this.prepareForm();
- for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
- this.check( elements[ i ] );
- }
- return this.valid();
- },
- // http://jqueryvalidation.org/Validator.element/
- element: function( element ) {
- var cleanElement = this.clean( element ),
- checkElement = this.validationTargetFor( cleanElement ),
- result = true;
- this.lastElement = checkElement;
- if ( checkElement === undefined ) {
- delete this.invalid[ cleanElement.name ];
- } else {
- this.prepareElement( checkElement );
- this.currentElements = $( checkElement );
- result = this.check( checkElement ) !== false;
- if ( result ) {
- delete this.invalid[ checkElement.name ];
- } else {
- this.invalid[ checkElement.name ] = true;
- }
- }
- // Add aria-invalid status for screen readers
- $( element ).attr( "aria-invalid", !result );
- if ( !this.numberOfInvalids() ) {
- // Hide error containers on last error
- this.toHide = this.toHide.add( this.containers );
- }
- this.showErrors();
- return result;
- },
- // http://jqueryvalidation.org/Validator.showErrors/
- showErrors: function( errors ) {
- if ( errors ) {
- // add items to error list and map
- $.extend( this.errorMap, errors );
- this.errorList = [];
- for ( var name in errors ) {
- this.errorList.push({
- message: errors[ name ],
- element: this.findByName( name )[ 0 ]
- });
- }
- // remove items from success list
- this.successList = $.grep( this.successList, function( element ) {
- return !( element.name in errors );
- });
- }
- if ( this.settings.showErrors ) {
- this.settings.showErrors.call( this, this.errorMap, this.errorList );
- } else {
- this.defaultShowErrors();
- }
- },
- // http://jqueryvalidation.org/Validator.resetForm/
- resetForm: function() {
- if ( $.fn.resetForm ) {
- $( this.currentForm ).resetForm();
- }
- this.submitted = {};
- this.lastElement = null;
- this.prepareForm();
- this.hideErrors();
- this.elements()
- .removeClass( this.settings.errorClass )
- .removeData( "previousValue" )
- .removeAttr( "aria-invalid" );
- },
- numberOfInvalids: function() {
- return this.objectLength( this.invalid );
- },
- objectLength: function( obj ) {
- /* jshint unused: false */
- var count = 0,
- i;
- for ( i in obj ) {
- count++;
- }
- return count;
- },
- hideErrors: function() {
- this.hideThese( this.toHide );
- },
- hideThese: function( errors ) {
- errors.not( this.containers ).text( "" );
- this.addWrapper( errors ).hide();
- },
- valid: function() {
- return this.size() === 0;
- },
- size: function() {
- return this.errorList.length;
- },
- focusInvalid: function() {
- if ( this.settings.focusInvalid ) {
- try {
- $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [])
- .filter( ":visible" )
- .focus()
- // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
- .trigger( "focusin" );
- } catch ( e ) {
- // ignore IE throwing errors when focusing hidden elements
- }
- }
- },
- findLastActive: function() {
- var lastActive = this.lastActive;
- return lastActive && $.grep( this.errorList, function( n ) {
- return n.element.name === lastActive.name;
- }).length === 1 && lastActive;
- },
- elements: function() {
- var validator = this,
- rulesCache = {};
- // select all valid inputs inside the form (no submit or reset buttons)
- return $( this.currentForm )
- .find( "input, select, textarea" )
- .not( ":submit, :reset, :image, [disabled], [readonly]" )
- .not( this.settings.ignore )
- .filter( function() {
- if ( !this.name && validator.settings.debug && window.console ) {
- console.error( "%o has no name assigned", this );
- }
- // select only the first element for each name, and only those with rules specified
- if ( this.name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
- return false;
- }
- rulesCache[ this.name ] = true;
- return true;
- });
- },
- clean: function( selector ) {
- return $( selector )[ 0 ];
- },
- errors: function() {
- var errorClass = this.settings.errorClass.split( " " ).join( "." );
- return $( this.settings.errorElement + "." + errorClass, this.errorContext );
- },
- reset: function() {
- this.successList = [];
- this.errorList = [];
- this.errorMap = {};
- this.toShow = $( [] );
- this.toHide = $( [] );
- this.currentElements = $( [] );
- },
- prepareForm: function() {
- this.reset();
- this.toHide = this.errors().add( this.containers );
- },
- prepareElement: function( element ) {
- this.reset();
- this.toHide = this.errorsFor( element );
- },
- elementValue: function( element ) {
- var val,
- $element = $( element ),
- type = element.type;
- if ( type === "radio" || type === "checkbox" ) {
- return $( "input[name='" + element.name + "']:checked" ).val();
- } else if ( type === "number" && typeof element.validity !== "undefined" ) {
- return element.validity.badInput ? false : $element.val();
- }
- val = $element.val();
- if ( typeof val === "string" ) {
- return val.replace(/\r/g, "" );
- }
- return val;
- },
- check: function( element ) {
- element = this.validationTargetFor( this.clean( element ) );
- var rules = $( element ).rules(),
- rulesCount = $.map( rules, function( n, i ) {
- return i;
- }).length,
- dependencyMismatch = false,
- val = this.elementValue( element ),
- result, method, rule;
- for ( method in rules ) {
- rule = { method: method, parameters: rules[ method ] };
- try {
- result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
- // if a method indicates that the field is optional and therefore valid,
- // don't mark it as valid when there are no other rules
- if ( result === "dependency-mismatch" && rulesCount === 1 ) {
- dependencyMismatch = true;
- continue;
- }
- dependencyMismatch = false;
- if ( result === "pending" ) {
- this.toHide = this.toHide.not( this.errorsFor( element ) );
- return;
- }
- if ( !result ) {
- this.formatAndAdd( element, rule );
- return false;
- }
- } catch ( e ) {
- if ( this.settings.debug && window.console ) {
- console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
- }
- throw e;
- }
- }
- if ( dependencyMismatch ) {
- return;
- }
- if ( this.objectLength( rules ) ) {
- this.successList.push( element );
- }
- return true;
- },
- // return the custom message for the given element and validation method
- // specified in the element's HTML5 data attribute
- // return the generic message if present and no method specific message is present
- customDataMessage: function( element, method ) {
- return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
- method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
- },
- // return the custom message for the given element name and validation method
- customMessage: function( name, method ) {
- var m = this.settings.messages[ name ];
- return m && ( m.constructor === String ? m : m[ method ]);
- },
- // return the first defined argument, allowing empty strings
- findDefined: function() {
- for ( var i = 0; i < arguments.length; i++) {
- if ( arguments[ i ] !== undefined ) {
- return arguments[ i ];
- }
- }
- return undefined;
- },
- defaultMessage: function( element, method ) {
- return this.findDefined(
- this.customMessage( element.name, method ),
- this.customDataMessage( element, method ),
- // title is never undefined, so handle empty string as undefined
- !this.settings.ignoreTitle && element.title || undefined,
- $.validator.messages[ method ],
- "<strong>Warning: No message defined for " + element.name + "</strong>"
- );
- },
- formatAndAdd: function( element, rule ) {
- var message = this.defaultMessage( element, rule.method ),
- theregex = /\$?\{(\d+)\}/g;
- if ( typeof message === "function" ) {
- message = message.call( this, rule.parameters, element );
- } else if ( theregex.test( message ) ) {
- message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
- }
- this.errorList.push({
- message: message,
- element: element,
- method: rule.method
- });
- this.errorMap[ element.name ] = message;
- this.submitted[ element.name ] = message;
- },
- addWrapper: function( toToggle ) {
- if ( this.settings.wrapper ) {
- toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
- }
- return toToggle;
- },
- defaultShowErrors: function() {
- var i, elements, error;
- for ( i = 0; this.errorList[ i ]; i++ ) {
- error = this.errorList[ i ];
- if ( this.settings.highlight ) {
- this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
- }
- this.showLabel( error.element, error.message );
- }
- if ( this.errorList.length ) {
- this.toShow = this.toShow.add( this.containers );
- }
- if ( this.settings.success ) {
- for ( i = 0; this.successList[ i ]; i++ ) {
- this.showLabel( this.successList[ i ] );
- }
- }
- if ( this.settings.unhighlight ) {
- for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
- this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
- }
- }
- this.toHide = this.toHide.not( this.toShow );
- this.hideErrors();
- this.addWrapper( this.toShow ).show();
- },
- validElements: function() {
- return this.currentElements.not( this.invalidElements() );
- },
- invalidElements: function() {
- return $( this.errorList ).map(function() {
- return this.element;
- });
- },
- showLabel: function( element, message ) {
- var place, group, errorID,
- error = this.errorsFor( element ),
- elementID = this.idOrName( element ),
- describedBy = $( element ).attr( "aria-describedby" );
- if ( error.length ) {
- // refresh error/success class
- error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
- // replace message on existing label
- error.html( message );
- } else {
- // create error element
- error = $( "<" + this.settings.errorElement + ">" )
- .attr( "id", elementID + "-error" )
- .addClass( this.settings.errorClass )
- .html( message || "" );
- // Maintain reference to the element to be placed into the DOM
- place = error;
- if ( this.settings.wrapper ) {
- // make sure the element is visible, even in IE
- // actually showing the wrapped element is handled elsewhere
- place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
- }
- if ( this.labelContainer.length ) {
- this.labelContainer.append( place );
- } else if ( this.settings.errorPlacement ) {
- this.settings.errorPlacement( place, $( element ) );
- } else {
- place.insertAfter( element );
- }
- // Link error back to the element
- if ( error.is( "label" ) ) {
- // If the error is a label, then associate using 'for'
- error.attr( "for", elementID );
- } else if ( error.parents( "label[for='" + elementID + "']" ).length === 0 ) {
- // If the element is not a child of an associated label, then it's necessary
- // to explicitly apply aria-describedby
- errorID = error.attr( "id" ).replace( /(:|\.|\[|\])/g, "\\$1");
- // Respect existing non-error aria-describedby
- if ( !describedBy ) {
- describedBy = errorID;
- } else if ( !describedBy.match( new RegExp( "\\b" + errorID + "\\b" ) ) ) {
- // Add to end of list if not already present
- describedBy += " " + errorID;
- }
- $( element ).attr( "aria-describedby", describedBy );
- // If this element is grouped, then assign to all elements in the same group
- group = this.groups[ element.name ];
- if ( group ) {
- $.each( this.groups, function( name, testgroup ) {
- if ( testgroup === group ) {
- $( "[name='" + name + "']", this.currentForm )
- .attr( "aria-describedby", error.attr( "id" ) );
- }
- });
- }
- }
- }
- if ( !message && this.settings.success ) {
- error.text( "" );
- if ( typeof this.settings.success === "string" ) {
- error.addClass( this.settings.success );
- } else {
- this.settings.success( error, element );
- }
- }
- this.toShow = this.toShow.add( error );
- },
- errorsFor: function( element ) {
- var name = this.idOrName( element ),
- describer = $( element ).attr( "aria-describedby" ),
- selector = "label[for='" + name + "'], label[for='" + name + "'] *";
- // aria-describedby should directly reference the error element
- if ( describer ) {
- selector = selector + ", #" + describer.replace( /\s+/g, ", #" );
- }
- return this
- .errors()
- .filter( selector );
- },
- idOrName: function( element ) {
- return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
- },
- validationTargetFor: function( element ) {
- // If radio/checkbox, validate first element in group instead
- if ( this.checkable( element ) ) {
- element = this.findByName( element.name );
- }
- // Always apply ignore filter
- return $( element ).not( this.settings.ignore )[ 0 ];
- },
- checkable: function( element ) {
- return ( /radio|checkbox/i ).test( element.type );
- },
- findByName: function( name ) {
- return $( this.currentForm ).find( "[name='" + name + "']" );
- },
- getLength: function( value, element ) {
- switch ( element.nodeName.toLowerCase() ) {
- case "select":
- return $( "option:selected", element ).length;
- case "input":
- if ( this.checkable( element ) ) {
- return this.findByName( element.name ).filter( ":checked" ).length;
- }
- }
- return value.length;
- },
- depend: function( param, element ) {
- return this.dependTypes[typeof param] ? this.dependTypes[typeof param]( param, element ) : true;
- },
- dependTypes: {
- "boolean": function( param ) {
- return param;
- },
- "string": function( param, element ) {
- return !!$( param, element.form ).length;
- },
- "function": function( param, element ) {
- return param( element );
- }
- },
- optional: function( element ) {
- var val = this.elementValue( element );
- return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
- },
- startRequest: function( element ) {
- if ( !this.pending[ element.name ] ) {
- this.pendingRequest++;
- this.pending[ element.name ] = true;
- }
- },
- stopRequest: function( element, valid ) {
- this.pendingRequest--;
- // sometimes synchronization fails, make sure pendingRequest is never < 0
- if ( this.pendingRequest < 0 ) {
- this.pendingRequest = 0;
- }
- delete this.pending[ element.name ];
- if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
- $( this.currentForm ).submit();
- this.formSubmitted = false;
- } else if (!valid && this.pendingRequest === 0 && this.formSubmitted ) {
- $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
- this.formSubmitted = false;
- }
- },
- previousValue: function( element ) {
- return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
- old: null,
- valid: true,
- message: this.defaultMessage( element, "remote" )
- });
- }
- },
- classRuleSettings: {
- required: { required: true },
- email: { email: true },
- url: { url: true },
- date: { date: true },
- dateISO: { dateISO: true },
- number: { number: true },
- digits: { digits: true },
- creditcard: { creditcard: true }
- },
- addClassRules: function( className, rules ) {
- if ( className.constructor === String ) {
- this.classRuleSettings[ className ] = rules;
- } else {
- $.extend( this.classRuleSettings, className );
- }
- },
- classRules: function( element ) {
- var rules = {},
- classes = $( element ).attr( "class" );
- if ( classes ) {
- $.each( classes.split( " " ), function() {
- if ( this in $.validator.classRuleSettings ) {
- $.extend( rules, $.validator.classRuleSettings[ this ]);
- }
- });
- }
- return rules;
- },
- attributeRules: function( element ) {
- var rules = {},
- $element = $( element ),
- type = element.getAttribute( "type" ),
- method, value;
- for ( method in $.validator.methods ) {
- // support for <input required> in both html5 and older browsers
- if ( method === "required" ) {
- value = element.getAttribute( method );
- // Some browsers return an empty string for the required attribute
- // and non-HTML5 browsers might have required="" markup
- if ( value === "" ) {
- value = true;
- }
- // force non-HTML5 browsers to return bool
- value = !!value;
- } else {
- value = $element.attr( method );
- }
- // convert the value to a number for number inputs, and for text for backwards compability
- // allows type="date" and others to be compared as strings
- if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
- value = Number( value );
- }
- if ( value || value === 0 ) {
- rules[ method ] = value;
- } else if ( type === method && type !== "range" ) {
- // exception: the jquery validate 'range' method
- // does not test for the html5 'range' type
- rules[ method ] = true;
- }
- }
- // maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
- if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
- delete rules.maxlength;
- }
- return rules;
- },
- dataRules: function( element ) {
- var method, value,
- rules = {}, $element = $( element );
- for ( method in $.validator.methods ) {
- value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
- if ( value !== undefined ) {
- rules[ method ] = value;
- }
- }
- return rules;
- },
- staticRules: function( element ) {
- var rules = {},
- validator = $.data( element.form, "validator" );
- if ( validator.settings.rules ) {
- rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
- }
- return rules;
- },
- normalizeRules: function( rules, element ) {
- // handle dependency check
- $.each( rules, function( prop, val ) {
- // ignore rule when param is explicitly false, eg. required:false
- if ( val === false ) {
- delete rules[ prop ];
- return;
- }
- if ( val.param || val.depends ) {
- var keepRule = true;
- switch ( typeof val.depends ) {
- case "string":
- keepRule = !!$( val.depends, element.form ).length;
- break;
- case "function":
- keepRule = val.depends.call( element, element );
- break;
- }
- if ( keepRule ) {
- rules[ prop ] = val.param !== undefined ? val.param : true;
- } else {
- delete rules[ prop ];
- }
- }
- });
- // evaluate parameters
- $.each( rules, function( rule, parameter ) {
- rules[ rule ] = $.isFunction( parameter ) ? parameter( element ) : parameter;
- });
- // clean number parameters
- $.each([ "minlength", "maxlength" ], function() {
- if ( rules[ this ] ) {
- rules[ this ] = Number( rules[ this ] );
- }
- });
- $.each([ "rangelength", "range" ], function() {
- var parts;
- if ( rules[ this ] ) {
- if ( $.isArray( rules[ this ] ) ) {
- rules[ this ] = [ Number( rules[ this ][ 0 ]), Number( rules[ this ][ 1 ] ) ];
- } else if ( typeof rules[ this ] === "string" ) {
- parts = rules[ this ].replace(/[\[\]]/g, "" ).split( /[\s,]+/ );
- rules[ this ] = [ Number( parts[ 0 ]), Number( parts[ 1 ] ) ];
- }
- }
- });
- if ( $.validator.autoCreateRanges ) {
- // auto-create ranges
- if ( rules.min != null && rules.max != null ) {
- rules.range = [ rules.min, rules.max ];
- delete rules.min;
- delete rules.max;
- }
- if ( rules.minlength != null && rules.maxlength != null ) {
- rules.rangelength = [ rules.minlength, rules.maxlength ];
- delete rules.minlength;
- delete rules.maxlength;
- }
- }
- return rules;
- },
- // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
- normalizeRule: function( data ) {
- if ( typeof data === "string" ) {
- var transformed = {};
- $.each( data.split( /\s/ ), function() {
- transformed[ this ] = true;
- });
- data = transformed;
- }
- return data;
- },
- // http://jqueryvalidation.org/jQuery.validator.addMethod/
- addMethod: function( name, method, message ) {
- $.validator.methods[ name ] = method;
- $.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
- if ( method.length < 3 ) {
- $.validator.addClassRules( name, $.validator.normalizeRule( name ) );
- }
- },
- methods: {
- // http://jqueryvalidation.org/required-method/
- required: function( value, element, param ) {
- // check if dependency is met
- if ( !this.depend( param, element ) ) {
- return "dependency-mismatch";
- }
- if ( element.nodeName.toLowerCase() === "select" ) {
- // could be an array for select-multiple or a string, both are fine this way
- var val = $( element ).val();
- return val && val.length > 0;
- }
- if ( this.checkable( element ) ) {
- return this.getLength( value, element ) > 0;
- }
- return $.trim( value ).length > 0;
- },
- // http://jqueryvalidation.org/email-method/
- email: function( value, element ) {
- // From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
- // Retrieved 2014-01-14
- // If you have a problem with this implementation, report a bug against the above spec
- // Or use custom methods to implement your own email validation
- return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
- },
- // http://jqueryvalidation.org/url-method/
- url: function( value, element ) {
- // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
- return this.optional( element ) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
- },
- // http://jqueryvalidation.org/date-method/
- date: function( value, element ) {
- return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
- },
- // http://jqueryvalidation.org/dateISO-method/
- dateISO: function( value, element ) {
- return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
- },
- // http://jqueryvalidation.org/number-method/
- number: function( value, element ) {
- return this.optional( element ) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
- },
- // http://jqueryvalidation.org/digits-method/
- digits: function( value, element ) {
- return this.optional( element ) || /^\d+$/.test( value );
- },
- // http://jqueryvalidation.org/creditcard-method/
- // based on http://en.wikipedia.org/wiki/Luhn/
- creditcard: function( value, element ) {
- if ( this.optional( element ) ) {
- return "dependency-mismatch";
- }
- // accept only spaces, digits and dashes
- if ( /[^0-9 \-]+/.test( value ) ) {
- return false;
- }
- var nCheck = 0,
- nDigit = 0,
- bEven = false,
- n, cDigit;
- value = value.replace( /\D/g, "" );
- // Basing min and max length on
- // http://developer.ean.com/general_info/Valid_Credit_Card_Types
- if ( value.length < 13 || value.length > 19 ) {
- return false;
- }
- for ( n = value.length - 1; n >= 0; n--) {
- cDigit = value.charAt( n );
- nDigit = parseInt( cDigit, 10 );
- if ( bEven ) {
- if ( ( nDigit *= 2 ) > 9 ) {
- nDigit -= 9;
- }
- }
- nCheck += nDigit;
- bEven = !bEven;
- }
- return ( nCheck % 10 ) === 0;
- },
- // http://jqueryvalidation.org/minlength-method/
- minlength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( value, element );
- return this.optional( element ) || length >= param;
- },
- // http://jqueryvalidation.org/maxlength-method/
- maxlength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( value, element );
- return this.optional( element ) || length <= param;
- },
- // http://jqueryvalidation.org/rangelength-method/
- rangelength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( value, element );
- return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
- },
- // http://jqueryvalidation.org/min-method/
- min: function( value, element, param ) {
- return this.optional( element ) || value >= param;
- },
- // http://jqueryvalidation.org/max-method/
- max: function( value, element, param ) {
- return this.optional( element ) || value <= param;
- },
- // http://jqueryvalidation.org/range-method/
- range: function( value, element, param ) {
- return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
- },
- // http://jqueryvalidation.org/equalTo-method/
- equalTo: function( value, element, param ) {
- // bind to the blur event of the target in order to revalidate whenever the target field is updated
- // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
- var target = $( param );
- if ( this.settings.onfocusout ) {
- target.unbind( ".validate-equalTo" ).bind( "blur.validate-equalTo", function() {
- $( element ).valid();
- });
- }
- return value === target.val();
- },
- // http://jqueryvalidation.org/remote-method/
- remote: function( value, element, param ) {
- if ( this.optional( element ) ) {
- return "dependency-mismatch";
- }
- var previous = this.previousValue( element ),
- validator, data;
- if (!this.settings.messages[ element.name ] ) {
- this.settings.messages[ element.name ] = {};
- }
- previous.originalMessage = this.settings.messages[ element.name ].remote;
- this.settings.messages[ element.name ].remote = previous.message;
- param = typeof param === "string" && { url: param } || param;
- if ( previous.old === value ) {
- return previous.valid;
- }
- previous.old = value;
- validator = this;
- this.startRequest( element );
- data = {};
- data[ element.name ] = value;
- $.ajax( $.extend( true, {
- url: param,
- mode: "abort",
- port: "validate" + element.name,
- dataType: "json",
- data: data,
- context: validator.currentForm,
- success: function( response ) {
- var valid = response === true || response === "true",
- errors, message, submitted;
- validator.settings.messages[ element.name ].remote = previous.originalMessage;
- if ( valid ) {
- submitted = validator.formSubmitted;
- validator.prepareElement( element );
- validator.formSubmitted = submitted;
- validator.successList.push( element );
- delete validator.invalid[ element.name ];
- validator.showErrors();
- } else {
- errors = {};
- message = response || validator.defaultMessage( element, "remote" );
- errors[ element.name ] = previous.message = $.isFunction( message ) ? message( value ) : message;
- validator.invalid[ element.name ] = true;
- validator.showErrors( errors );
- }
- previous.valid = valid;
- validator.stopRequest( element, valid );
- }
- }, param ) );
- return "pending";
- }
- }
- });
- $.format = function deprecated() {
- throw "$.format has been deprecated. Please use $.validator.format instead.";
- };
- // ajax mode: abort
- // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
- // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
- var pendingRequests = {},
- ajax;
- // Use a prefilter if available (1.5+)
- if ( $.ajaxPrefilter ) {
- $.ajaxPrefilter(function( settings, _, xhr ) {
- var port = settings.port;
- if ( settings.mode === "abort" ) {
- if ( pendingRequests[port] ) {
- pendingRequests[port].abort();
- }
- pendingRequests[port] = xhr;
- }
- });
- } else {
- // Proxy ajax
- ajax = $.ajax;
- $.ajax = function( settings ) {
- var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
- port = ( "port" in settings ? settings : $.ajaxSettings ).port;
- if ( mode === "abort" ) {
- if ( pendingRequests[port] ) {
- pendingRequests[port].abort();
- }
- pendingRequests[port] = ajax.apply(this, arguments);
- return pendingRequests[port];
- }
- return ajax.apply(this, arguments);
- };
- }
- // provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
- // handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
- $.extend($.fn, {
- validateDelegate: function( delegate, type, handler ) {
- return this.bind(type, function( event ) {
- var target = $(event.target);
- if ( target.is(delegate) ) {
- return handler.apply(target, arguments);
- }
- });
- }
- });
- }));
- // ========================== ALL SCRIPTS TOC =============================== //
- // ========== https://github.com/tuupola/jquery_lazyload ==================== //
- // ====== https://github.com/ixisio/bootstrap-touch-carousel ================ //
- // ============ https://github.com/Formstone/Wallpaper ====================== //
- // ========== https://github.com/ccampbell/rainbow ========================== //
- // ============ https://github.com/morr/jquery.appear ======================= //
- // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
- // ============ https://github.com/mattboldt/typed.js/ ====================== //
- // ============ https://github.com/balupton/jquery-scrollto ================= //
- // ==============https://github.com/matthieua/WOW =========================== //
- // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
- // ============ https://github.com/carhartl/jquery-cookie =================== //
- // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
- // ============= https://github.com/kirbysayshi/ghembedder ================= //
- // ============== https://github.com/js-cookie/js-cookie ==================== //
- // --------------------- Lazy Load 1.9.7 ---------------------------------- //
- // ========== https://github.com/tuupola/jquery_lazyload =================== //
- // ------------------------------------------------------------------------- //
- !function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);
- // ------------- Touch Carousel Hammer.js ---------------------------------- //
- // ====== https://github.com/ixisio/bootstrap-touch-carousel =============== //
- // ------------------------------------------------------------------------- //
- +function(a){"use strict";function b(a,b){var c=document.createElement("div").style;for(var d in a)if(void 0!==c[a[d]])return"pfx"==b?a[d]:!0;return!1}function c(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}function d(){var a=["transformProperty","WebkitTransform","MozTransform","msTransform"];return!!b(a)}function e(){return"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix}if(!("ontouchstart"in window||navigator.msMaxTouchPoints))return!1;a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=c(),a.support.csstransforms=d(),a.support.csstransforms3d=e()});var f="touch-carousel",g=function(b,c){return this.$element=a(b),this.$itemsWrapper=this.$element.find(".carousel-inner"),this.$items=this.$element.find(".item"),this.$indicators=this.$element.find(".carousel-indicators"),this.pane_width=this.pane_count=this.current_pane=0,this.onGesture=!1,this.options=c,this._setPaneDimensions(),this.$items.length<=1?this.disable():(this._regTouchGestures(),void a(window).on("orientationchange resize",a.proxy(this._setPaneDimensions,this)))};g.DEFAULTS={interval:!1,toughness:.25},g.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},g.prototype.to=function(a){return a>this.$items.length-1||0>a?void 0:this._showPane(a)},g.prototype.pause=function(a){return a||(this.paused=!0),clearInterval(this.interval),this.interval=null,this},g.prototype._regTouchGestures=function(){this.$itemsWrapper.add(this.$indicators).hammer({drag_lock_to_axis:!0,preventDefault:!0}).on("release dragleft dragright swipeleft swiperight",a.proxy(this._handleGestures,this))},g.prototype._setPaneDimensions=function(){this.pane_width=this.$element.width(),this.pane_count=this.$items.length,this.$itemsWrapper.width(this.pane_width*this.pane_count),this.$items.width(this.pane_width)},g.prototype._showPane=function(a){this.$items.eq(this.current_pane).toggleClass("active"),a>=this.pane_count&&this.pause(),a=Math.max(0,Math.min(a,this.pane_count-1));this.$items.eq(a).toggleClass("active");this.current_pane=a;var b=-(100/this.pane_count*this.current_pane);return this._setContainerOffset(b,!0,a),this},g.prototype._setContainerOffset=function(b,c,d){var e=this;if(this.$itemsWrapper.removeClass("animate"),c&&this.$itemsWrapper.addClass("animate"),a.support.csstransforms3d)this.onGesture=!0,this.$itemsWrapper.css("transform","translate3d("+b+"%,0,0) scale3d(1,1,1)");else if(a.support.csstransforms)this.onGesture=!0,this.$itemsWrapper.css("transform","translate("+b+"%,0)");else{var f=this.pane_width*this.pane_count/100*b;this.$itemsWrapper.css("left",f+"px")}a.support.transition?this.$itemsWrapper.one(a.support.transition.end,function(){e.$itemsWrapper.removeClass("animate"),e.onGesture=!1,e._updateIndicators(d)}):(this.$itemsWrapper.removeClass("animate"),this.onGesture=!1,this._updateIndicators(d))},g.prototype.next=function(){return this._showPane(this.current_pane+1)},g.prototype.prev=function(){return this._showPane(this.current_pane-1)},g.prototype._handleGestures=function(a){if(!this.sliding)switch(this.pause(),a.type){case"dragright":case"dragleft":var b=-(100/this.pane_count)*this.current_pane,c=100/this.pane_width*a.gesture.deltaX/this.pane_count;(0===this.current_pane&&a.gesture.direction==Hammer.DIRECTION_RIGHT||this.current_pane==this.pane_count-1&&a.gesture.direction==Hammer.DIRECTION_LEFT)&&(c*=this.options.toughness),this._setContainerOffset(c+b);break;case"swipeleft":this.next(),a.gesture.stopDetect();break;case"swiperight":this.prev(),a.gesture.stopDetect();break;case"release":Math.abs(a.gesture.deltaX)>this.pane_width/2?"right"==a.gesture.direction?this.prev():this.next():this._showPane(this.current_pane,!0)}},g.prototype.disable=function(){return this.$indicators.hide(),this.$element.removeData(f),!1},g.prototype._updateIndicators=function(a){return this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$indicators.children().eq(a).addClass("active")),this.$element.trigger("slid.bs.carousel"),this};var h=a.fn.carousel;a.fn.carousel=function(b){return this.each(function(){var c=a(this),d=c.data(f),e=a.extend({},g.DEFAULTS,c.data(),"object"==typeof b&&b),h="string"==typeof b?b:e.slide;d||c.data(f,d=new g(this,e)).addClass(f),"number"==typeof b?d.to(b):h?d[h]():e.interval&&d.pause().cycle()})},a.fn.carousel.Constructor=g,a.fn.carousel.noConflict=function(){return a.fn.carousel=h,this},a(document).off("click.bs.carousel").on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),g=a.extend({},e.data(),d.data()),h=d.attr("data-slide-to");h&&(g.interval=!1),e.carousel(g),(h=d.attr("data-slide-to"))&&e.data(f).to(h),b.preventDefault()})}(window.jQuery),function(a,b){"use strict";function c(){if(!d.READY){d.event.determineEventTypes();for(var a in d.gestures)d.gestures.hasOwnProperty(a)&&d.detection.register(d.gestures[a]);d.event.onTouch(d.DOCUMENT,d.EVENT_MOVE,d.detection.detect),d.event.onTouch(d.DOCUMENT,d.EVENT_END,d.detection.detect),d.READY=!0}}var d=function(a,b){return new d.Instance(a,b||{})};d.defaults={stop_browser_behavior:{userSelect:"none",touchAction:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},d.HAS_POINTEREVENTS=a.navigator.pointerEnabled||a.navigator.msPointerEnabled,d.HAS_TOUCHEVENTS="ontouchstart"in a,d.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android|silk/i,d.NO_MOUSEEVENTS=d.HAS_TOUCHEVENTS&&a.navigator.userAgent.match(d.MOBILE_REGEX),d.EVENT_TYPES={},d.DIRECTION_DOWN="down",d.DIRECTION_LEFT="left",d.DIRECTION_UP="up",d.DIRECTION_RIGHT="right",d.POINTER_MOUSE="mouse",d.POINTER_TOUCH="touch",d.POINTER_PEN="pen",d.EVENT_START="start",d.EVENT_MOVE="move",d.EVENT_END="end",d.DOCUMENT=a.document,d.plugins={},d.READY=!1,d.Instance=function(a,b){var e=this;return c(),this.element=a,this.enabled=!0,this.options=d.utils.extend(d.utils.extend({},d.defaults),b||{}),this.options.stop_browser_behavior&&d.utils.stopDefaultBrowserBehavior(this.element,this.options.stop_browser_behavior),d.event.onTouch(a,d.EVENT_START,function(a){e.enabled&&d.detection.startDetect(e,a)}),this},d.Instance.prototype={on:function(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)this.element.addEventListener(c[d],b,!1);return this},off:function(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)this.element.removeEventListener(c[d],b,!1);return this},trigger:function(a,b){b||(b={});var c=d.DOCUMENT.createEvent("Event");c.initEvent(a,!0,!0),c.gesture=b;var e=this.element;return d.utils.hasParent(b.target,e)&&(e=b.target),e.dispatchEvent(c),this},enable:function(a){return this.enabled=a,this}};var e=null,f=!1,g=!1;d.event={bindDom:function(a,b,c){for(var d=b.split(" "),e=0;e<d.length;e++)a.addEventListener(d[e],c,!1)},onTouch:function(a,b,c){var h=this;this.bindDom(a,d.EVENT_TYPES[b],function(i){var j=i.type.toLowerCase();if(!j.match(/mouse/)||!g){j.match(/touch/)||j.match(/pointerdown/)||j.match(/mouse/)&&1===i.which?f=!0:j.match(/mouse/)&&1!==i.which&&(f=!1),j.match(/touch|pointer/)&&(g=!0);var k=0;f&&(d.HAS_POINTEREVENTS&&b!=d.EVENT_END?k=d.PointerEvent.updatePointer(b,i):j.match(/touch/)?k=i.touches.length:g||(k=j.match(/up/)?0:1),k>0&&b==d.EVENT_END?b=d.EVENT_MOVE:k||(b=d.EVENT_END),(k||null===e)&&(e=i),c.call(d.detection,h.collectEventData(a,b,h.getTouchList(e,b),i)),d.HAS_POINTEREVENTS&&b==d.EVENT_END&&(k=d.PointerEvent.updatePointer(b,i))),k||(e=null,f=!1,g=!1,d.PointerEvent.reset())}})},determineEventTypes:function(){var a;a=d.HAS_POINTEREVENTS?d.PointerEvent.getEvents():d.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],d.EVENT_TYPES[d.EVENT_START]=a[0],d.EVENT_TYPES[d.EVENT_MOVE]=a[1],d.EVENT_TYPES[d.EVENT_END]=a[2]},getTouchList:function(a){return d.HAS_POINTEREVENTS?d.PointerEvent.getTouchList():a.touches?a.touches:(a.indentifier=1,[a])},collectEventData:function(a,b,c,e){var f=d.POINTER_TOUCH;return(e.type.match(/mouse/)||d.PointerEvent.matchType(d.POINTER_MOUSE,e))&&(f=d.POINTER_MOUSE),{center:d.utils.getCenter(c),timeStamp:(new Date).getTime(),target:e.target,touches:c,eventType:b,pointerType:f,srcEvent:e,preventDefault:function(){this.srcEvent.preventManipulation&&this.srcEvent.preventManipulation(),this.srcEvent.preventDefault&&this.srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return d.detection.stopDetect()}}}},d.PointerEvent={pointers:{},getTouchList:function(){var a=this,b=[];return Object.keys(a.pointers).sort().forEach(function(c){b.push(a.pointers[c])}),b},updatePointer:function(a,b){return a==d.EVENT_END?this.pointers={}:(b.identifier=b.pointerId,this.pointers[b.pointerId]=b),Object.keys(this.pointers).length},matchType:function(a,b){if(!b.pointerType)return!1;var c={};return c[d.POINTER_MOUSE]=b.pointerType==b.MSPOINTER_TYPE_MOUSE||b.pointerType==d.POINTER_MOUSE,c[d.POINTER_TOUCH]=b.pointerType==b.MSPOINTER_TYPE_TOUCH||b.pointerType==d.POINTER_TOUCH,c[d.POINTER_PEN]=b.pointerType==b.MSPOINTER_TYPE_PEN||b.pointerType==d.POINTER_PEN,c[a]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},d.utils={extend:function(a,c,d){for(var e in c)a[e]!==b&&d||(a[e]=c[e]);return a},hasParent:function(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1},getCenter:function(a){for(var b=[],c=[],d=0,e=a.length;e>d;d++)b.push(a[d].pageX),c.push(a[d].pageY);return{pageX:(Math.min.apply(Math,b)+Math.max.apply(Math,b))/2,pageY:(Math.min.apply(Math,c)+Math.max.apply(Math,c))/2}},getVelocity:function(a,b,c){return{x:Math.abs(b/a)||0,y:Math.abs(c/a)||0}},getAngle:function(a,b){var c=b.pageY-a.pageY,d=b.pageX-a.pageX;return 180*Math.atan2(c,d)/Math.PI},getDirection:function(a,b){var c=Math.abs(a.pageX-b.pageX),e=Math.abs(a.pageY-b.pageY);return c>=e?a.pageX-b.pageX>0?d.DIRECTION_LEFT:d.DIRECTION_RIGHT:a.pageY-b.pageY>0?d.DIRECTION_UP:d.DIRECTION_DOWN},getDistance:function(a,b){var c=b.pageX-a.pageX,d=b.pageY-a.pageY;return Math.sqrt(c*c+d*d)},getScale:function(a,b){return a.length>=2&&b.length>=2?this.getDistance(b[0],b[1])/this.getDistance(a[0],a[1]):1},getRotation:function(a,b){return a.length>=2&&b.length>=2?this.getAngle(b[1],b[0])-this.getAngle(a[1],a[0]):0},isVertical:function(a){return a==d.DIRECTION_UP||a==d.DIRECTION_DOWN},stopDefaultBrowserBehavior:function(a,b){var c,d=["webkit","khtml","moz","Moz","ms","o",""];if(b&&a.style){for(var e=0;e<d.length;e++)for(var f in b)b.hasOwnProperty(f)&&(c=f,d[e]&&(c=d[e]+c.substring(0,1).toUpperCase()+c.substring(1)),a.style[c]=b[f]);"none"==b.userSelect&&(a.onselectstart=function(){return!1}),"none"==b.userDrag&&(a.ondragstart=function(){return!1})}}},d.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(a,b){this.current||(this.stopped=!1,this.current={inst:a,startEvent:d.utils.extend({},b),lastEvent:!1,name:""},this.detect(b))},detect:function(a){if(this.current&&!this.stopped){a=this.extendEventData(a);for(var b=this.current.inst.options,c=0,e=this.gestures.length;e>c;c++){var f=this.gestures[c];if(!this.stopped&&b[f.name]!==!1&&f.handler.call(f,a,this.current.inst)===!1){this.stopDetect();break}}return this.current&&(this.current.lastEvent=a),a.eventType==d.EVENT_END&&!a.touches.length-1&&this.stopDetect(),a}},stopDetect:function(){this.previous=d.utils.extend({},this.current),this.current=null,this.stopped=!0},extendEventData:function(a){var b=this.current.startEvent;if(b&&(a.touches.length!=b.touches.length||a.touches===b.touches)){b.touches=[];for(var c=0,e=a.touches.length;e>c;c++)b.touches.push(d.utils.extend({},a.touches[c]))}var f=a.timeStamp-b.timeStamp,g=a.center.pageX-b.center.pageX,h=a.center.pageY-b.center.pageY,i=d.utils.getVelocity(f,g,h);return d.utils.extend(a,{deltaTime:f,deltaX:g,deltaY:h,velocityX:i.x,velocityY:i.y,distance:d.utils.getDistance(b.center,a.center),angle:d.utils.getAngle(b.center,a.center),interimAngle:this.current.lastEvent&&d.utils.getAngle(this.current.lastEvent.center,a.center),direction:d.utils.getDirection(b.center,a.center),interimDirection:this.current.lastEvent&&d.utils.getDirection(this.current.lastEvent.center,a.center),scale:d.utils.getScale(b.touches,a.touches),rotation:d.utils.getRotation(b.touches,a.touches),startEvent:b}),a},register:function(a){var c=a.defaults||{};return c[a.name]===b&&(c[a.name]=!0),d.utils.extend(d.defaults,c,!0),a.index=a.index||1e3,this.gestures.push(a),this.gestures.sort(function(a,b){return a.index<b.index?-1:a.index>b.index?1:0}),this.gestures}},d.gestures=d.gestures||{},d.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:1},timer:null,handler:function(a,b){switch(a.eventType){case d.EVENT_START:clearTimeout(this.timer),d.detection.current.name=this.name,this.timer=setTimeout(function(){"hold"==d.detection.current.name&&b.trigger("hold",a)},b.options.hold_timeout);break;case d.EVENT_MOVE:a.distance>b.options.hold_threshold&&clearTimeout(this.timer);break;case d.EVENT_END:clearTimeout(this.timer)}}},d.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},handler:function(a,b){if(a.eventType==d.EVENT_END&&"touchcancel"!=a.srcEvent.type){var c=d.detection.previous,e=!1;if(a.deltaTime>b.options.tap_max_touchtime||a.distance>b.options.tap_max_distance)return;c&&"tap"==c.name&&a.timeStamp-c.lastEvent.timeStamp<b.options.doubletap_interval&&a.distance<b.options.doubletap_distance&&(b.trigger("doubletap",a),e=!0),(!e||b.options.tap_always)&&(d.detection.current.name="tap",b.trigger(d.detection.current.name,a))}}},d.gestures.Swipe={name:"swipe",index:40,defaults:{swipe_max_touches:1,swipe_velocity:.7},handler:function(a,b){if(a.eventType==d.EVENT_END){if(b.options.swipe_max_touches>0&&a.touches.length>b.options.swipe_max_touches)return;(a.velocityX>b.options.swipe_velocity||a.velocityY>b.options.swipe_velocity)&&(b.trigger(this.name,a),b.trigger(this.name+a.direction,a))}}},d.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,correct_for_drag_min_distance:!0,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1,drag_lock_min_distance:25},triggered:!1,handler:function(a,b){if(d.detection.current.name!=this.name&&this.triggered)return b.trigger(this.name+"end",a),void(this.triggered=!1);if(!(b.options.drag_max_touches>0&&a.touches.length>b.options.drag_max_touches))switch(a.eventType){case d.EVENT_START:this.triggered=!1;break;case d.EVENT_MOVE:if(a.distance<b.options.drag_min_distance&&d.detection.current.name!=this.name)return;if(d.detection.current.name!=this.name&&(d.detection.current.name=this.name,b.options.correct_for_drag_min_distance)){var c=Math.abs(b.options.drag_min_distance/a.distance);d.detection.current.startEvent.center.pageX+=a.deltaX*c,d.detection.current.startEvent.center.pageY+=a.deltaY*c,a=d.detection.extendEventData(a)}(d.detection.current.lastEvent.drag_locked_to_axis||b.options.drag_lock_to_axis&&b.options.drag_lock_min_distance<=a.distance)&&(a.drag_locked_to_axis=!0);var e=d.detection.current.lastEvent.direction;a.drag_locked_to_axis&&e!==a.direction&&(a.direction=d.utils.isVertical(e)?a.deltaY<0?d.DIRECTION_UP:d.DIRECTION_DOWN:a.deltaX<0?d.DIRECTION_LEFT:d.DIRECTION_RIGHT),this.triggered||(b.trigger(this.name+"start",a),this.triggered=!0),b.trigger(this.name,a),b.trigger(this.name+a.direction,a),(b.options.drag_block_vertical&&d.utils.isVertical(a.direction)||b.options.drag_block_horizontal&&!d.utils.isVertical(a.direction))&&a.preventDefault();break;case d.EVENT_END:this.triggered&&b.trigger(this.name+"end",a),this.triggered=!1}}},d.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1},triggered:!1,handler:function(a,b){if(d.detection.current.name!=this.name&&this.triggered)return b.trigger(this.name+"end",a),void(this.triggered=!1);if(!(a.touches.length<2))switch(b.options.transform_always_block&&a.preventDefault(),a.eventType){case d.EVENT_START:this.triggered=!1;break;case d.EVENT_MOVE:var c=Math.abs(1-a.scale),e=Math.abs(a.rotation);if(c<b.options.transform_min_scale&&e<b.options.transform_min_rotation)return;d.detection.current.name=this.name,this.triggered||(b.trigger(this.name+"start",a),this.triggered=!0),b.trigger(this.name,a),e>b.options.transform_min_rotation&&b.trigger("rotate",a),c>b.options.transform_min_scale&&(b.trigger("pinch",a),b.trigger("pinch"+(a.scale<1?"in":"out"),a));break;case d.EVENT_END:this.triggered&&b.trigger(this.name+"end",a),this.triggered=!1}}},d.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(a,b){return b.options.prevent_mouseevents&&a.pointerType==d.POINTER_MOUSE?void a.stopDetect():(b.options.prevent_default&&a.preventDefault(),void(a.eventType==d.EVENT_START&&b.trigger(this.name,a)))}},d.gestures.Release={name:"release",index:1/0,handler:function(a,b){a.eventType==d.EVENT_END&&b.trigger(this.name,a)}},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return d}):"object"==typeof module&&"object"==typeof module.exports?module.exports=d:a.Hammer=d}(this),function(a){"use strict";var b=function(b,c){return c===a?b:(b.event.bindDom=function(b,d,e){c(b).on(d,function(b){var c=b.originalEvent||b;c.pageX===a&&(c.pageX=b.pageX,c.pageY=b.pageY),c.target||(c.target=b.target),c.which===a&&(c.which=c.button),c.preventDefault||(c.preventDefault=b.preventDefault),c.stopPropagation||(c.stopPropagation=b.stopPropagation),e.call(this,c)})},b.Instance.prototype.on=function(a,b){return c(this.element).on(a,b)},b.Instance.prototype.off=function(a,b){return c(this.element).off(a,b)},b.Instance.prototype.trigger=function(a,b){var d=c(this.element);return d.has(b.target).length&&(d=c(b.target)),d.trigger({type:a,gesture:b})},c.fn.hammer=function(a){return this.each(function(){var d=c(this),e=d.data("hammer");e?e&&a&&b.utils.extend(e.options,a):d.data("hammer",new b(this,a||{}))})},b)};"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("hammer-jquery",["hammer","jquery"],b):b(window.Hammer,window.jQuery||window.Zepto)}();
- // ------------- JQUERY Wallpaper------------------------------------------- //
- // ============ https://github.com/Formstone/Wallpaper ===================== //
- // ------------------------------------------------------------------------- //
- !function(a,b){"use strict";function c(b){var c=a.extend({},F,b);t=a("body"),u=s(),v=u!==!1,v||(u="transitionend.wallpaper");for(var e=a(this),f=0,g=e.length;g>f;f++)d.apply(e.eq(f),[a.extend({},c)]);return t.hasClass("wallpaper-inititalized")||(t.addClass("wallpaper-inititalized"),x.on("resize.wallpaper",c,l)),e}function d(b){var c=a(this);if(!c.hasClass("wallpaper")){a.extend(b,c.data("wallpaper-options")),c.addClass("wallpaper").append('<div class="wallpaper-container"></div>'),b.guid="wallpaper-"+A++,b.youTubeGuid=0,b.$target=c,b.$container=b.$target.find(".wallpaper-container"),b.$target.data("wallpaper",b).on("resize.wallpaper",b,k);var d=b.source;b.source=null,e(d,b,!0),b.onReady.call()}}function e(a,c,d){if(a!==c.source){if(c.source=a,c.isYouTube=!1,"object"==typeof a&&"string"==typeof a.video){var e=a.video.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i);e&&e.length>=1&&(c.isYouTube=!0,c.videoId=e[1])}if(c.isYouTube)c.playing=!1,c.playerReady=!1,c.posterLoaded=!1,h(a,c,d);else if("object"!=typeof a||a.hasOwnProperty("fallback")){if(c.responsiveSource)for(var i in c.responsiveSource)c.responsiveSource.hasOwnProperty(i)&&c.responsiveSource[i].mq.removeListener(m);if(c.responsive=!1,c.responsiveSource=null,"object"==typeof a){var j,k=[];for(var l in a)if(a.hasOwnProperty(l)){var n="fallback"===l?"(min-width: 0px)":l;if(n){var o=b.matchMedia(n.replace(1/0,"100000px"));o.addListener(m),k.push({mq:o,source:a[l]}),o.matches&&(j=a[l])}}c.responsive=!0,c.responsiveSource=k,a=j}f(a,c,!1,d)}else g(a,c,d)}else c.$target.trigger("wallpaper.loaded"),c.onLoad.call(c.$target)}function f(b,c,d,e){var f=a('<div class="wallpaper-media wallpaper-image'+(e!==!0?" animated":"")+'"><img /></div>'),g=f.find("img"),h=b;g.one("load.wallpaper",function(){z&&f.addClass("native").css({backgroundImage:"url('"+h+"')"}),f.on(u,function(b){r(b),a(b.target).is(f)&&(f.off(u),d||i(c))}),setTimeout(function(){f.css({opacity:1}),c.responsive&&e&&i(c)},0),k({data:c}),(!d||e)&&(c.$target.trigger("wallpaper.loaded"),c.onLoad.call(c.$target)),y=a(".wallpaper-responsive")}).attr("src",h),c.responsive&&f.addClass("wallpaper-responsive"),c.$container.append(f),(g[0].complete||4===g[0].readyState)&&g.trigger("load.wallpaper")}function g(b,c,d){if(c.source.poster&&(f(c.source.poster,c,!0,!0),d=!1),!E){var e='<div class="wallpaper-media wallpaper-video'+(d!==!0?" animated":"")+'">';e+="<video",c.loop&&(e+=" loop"),c.mute&&(e+=" muted"),e+=">",c.source.webm&&(e+='<source src="'+c.source.webm+'" type="video/webm" />'),c.source.mp4&&(e+='<source src="'+c.source.mp4+'" type="video/mp4" />'),c.source.ogg&&(e+='<source src="'+c.source.ogg+'" type="video/ogg" />'),e+="</video>",e+="</div>";var g=a(e),h=g.find("video");h.one("loadedmetadata.wallpaper",function(){g.on(u,function(b){r(b),a(b.target).is(g)&&(g.off(u),i(c))}),setTimeout(function(){g.css({opacity:1})},0),k({data:c}),c.$target.trigger("wallpaper.loaded"),c.onLoad.call(c.$target),c.hoverPlay?c.$target.on("mouseover.boxer",G.play).on("mouseout.boxer",G.pause):c.autoPlay&&this.play()}),c.$container.append(g)}}function h(c,d,e){if(!d.videoId){var g=c.match(/^.*(?:youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#\&\?]*).*/);d.videoId=g[1]}if(d.posterLoaded||(d.source.poster||(d.source.poster="http://img.youtube.com/vi/"+d.videoId+"/0.jpg"),d.posterLoaded=!0,f(d.source.poster,d,!0,e),e=!1),!E)if(a("script[src*='youtube.com/iframe_api']").length||a("head").append('<script src="//www.youtube.com/iframe_api"></script>'),B){var h=d.guid+"_"+d.youTubeGuid++,j="";j+='<div class="wallpaper-media wallpaper-embed'+(e!==!0?" animated":"")+'">',j+='<div id="'+h+'"></div>',j+="</div>";var l=a(j);d.$container.append(l),d.player&&(d.oldPlayer=d.player,d.player=null),d.player=new b.YT.Player(h,{videoId:d.videoId,playerVars:{controls:0,rel:0,showinfo:0,wmode:"transparent",enablejsapi:1,version:3,playerapiid:h,loop:d.loop?1:0,autoplay:1,origin:b.location.protocol+"//"+b.location.host},events:{onReady:function(){d.playerReady=!0,d.mute&&d.player.mute(),d.hoverPlay?d.$target.on("mouseover.boxer",G.play).on("mouseout.boxer",G.pause):d.autoPlay&&d.player.playVideo()},onStateChange:function(c){d.playing||c.data!==b.YT.PlayerState.PLAYING?d.loop&&d.playing&&c.data===b.YT.PlayerState.ENDED&&d.player.playVideo():(d.playing=!0,(d.hoverPlay||!d.autoPlay)&&d.player.pauseVideo(),d.$target.trigger("wallpaper.loaded"),d.onLoad.call(d.$target),l.on(u,function(b){r(b),a(b.target).is(l)&&(l.off(u),i(d))}),l.css({opacity:1})),d.$target.find(".wallpaper-embed").addClass("ready")},onPlaybackQualityChange:function(){},onPlaybackRateChange:function(){},onError:function(){},onApiChange:function(){}}}),k({data:d})}else C.push({source:c,data:d})}function i(b){var c=b.$container.find(".wallpaper-media");c.length>=1&&(c.not(":last").remove(),b.oldPlayer=null),y=a(".wallpaper-responsive")}function j(b){var c=b.$container.find(".wallpaper-media");c.length>=1&&c.on(u,function(d){r(d),a(d.target).is(c)&&(a(this).remove(),delete b.source)}).css({opacity:0})}function k(a){r(a);for(var b=a.data,c=b.$container.find(".wallpaper-media"),d=0,e=c.length;e>d;d++){var f=c.eq(d),g=b.isYouTube?"iframe":f.find("video").length?"video":"img",h=f.find(g);if(h.length&&("img"!==g||!b.nativeSupport)){var i=b.$target.outerWidth(),j=b.$target.outerHeight(),k=q(b,h);b.width=k.naturalWidth,b.height=k.naturalHeight,b.left=0,b.top=0;var l=b.isYouTube?b.embedRatio:b.width/b.height;b.height=j,b.width=b.height*l,b.width<i&&(b.width=i,b.height=b.width/l),b.left=-(b.width-i)/2,b.top=-(b.height-j)/2,f.css({height:b.height,width:b.width,left:b.left,top:b.top})}}}function l(){a(".wallpaper").each(function(){var b=a(this).data("wallpaper");k({data:b})})}function m(){w=o(w,5,n)}function n(){p(w),y.each(function(){for(var b=a(this),c=(b.find("img"),b.parents(".wallpaper").data("wallpaper")),d=c.responsiveSource,e=0,g=0,h=d.length;h>g;g++)if(d.hasOwnProperty(g)){var i=d[g].mq;i&&i.matches&&(e=g)}f(d[e].source,c,!1,!0),b.trigger("change.wallpaper")})}function o(a,b,c,d){return p(a,d),setTimeout(c,b)}function p(a){null!==a&&(clearInterval(a),a=null)}function q(a,b){if(a.isYouTube)return{naturalHeight:500,naturalWidth:500/a.embedRatio};if(b.is("img")){var c=b[0];if("undefined"!=typeof c.naturalHeight)return{naturalHeight:c.naturalHeight,naturalWidth:c.naturalWidth};var d=new Image;return d.src=c.src,{naturalHeight:d.height,naturalWidth:d.width}}return{naturalHeight:b[0].videoHeight,naturalWidth:b[0].videoWidth}}function r(a){a.preventDefault&&(a.stopPropagation(),a.preventDefault())}function s(){var a={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},b=document.createElement("div");for(var c in a)if(a.hasOwnProperty(c)&&c in b.style)return a[c]+".wallpaper";return!1}var t,u,v,w,x=a(b),y=null,z="backgroundSize"in document.documentElement.style,A=0,B=!1,C=[],D=b.navigator.userAgent||b.navigator.vendor||b.opera,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(D),F=(D.toLowerCase().indexOf("safari")>=0&&D.toLowerCase().indexOf("chrome")<0,{autoPlay:!0,embedRatio:1.777777,hoverPlay:!1,loop:!0,mute:!0,onLoad:a.noop,onReady:a.noop,source:null}),G={defaults:function(b){return F=a.extend(F,b||{}),"object"==typeof this?a(this):!0},destroy:function(){var b=a(this).each(function(){var b=a(this).data("wallpaper");b&&(b.$container.remove(),b.$target.removeClass("wallpaper").off(".boxer").data("wallpaper",null))});return"undefined"!=typeof t&&"undefined"!=typeof x&&a(".wallpaper").length<1&&(t.removeClass("wallpaper-inititalized"),x.off(".wallpaper")),b},load:function(b){return a(this).each(function(){var c=a(this).data("wallpaper");c&&e(b,c)})},pause:function(){return a(this).each(function(){var b=a(this).data("wallpaper");if(b)if(b.isYouTube&&b.playerReady)b.player.pauseVideo();else{var c=b.$container.find("video");c.length&&c[0].pause()}})},play:function(){return a(this).each(function(){var b=a(this).data("wallpaper");if(b)if(b.isYouTube&&b.playerReady)b.player.playVideo();else{var c=b.$container.find("video");c.length&&c[0].play()}})},stop:function(){G.pause.apply(this)},unload:function(){return a(this).each(function(){var b=a(this).data("wallpaper");b&&j(b)})}};b.onYouTubeIframeAPIReady=function(){B=!0;for(var a in C)C.hasOwnProperty(a)&&h(C[a].source,C[a].data);C=[]},a.fn.wallpaper=function(a){return G[a]?G[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.wallpaper=function(a){"defaults"===a&&G.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window);
- // ------------- Rainbow Syntax Highligher ---------------------------------- //
- // ========== https://github.com/ccampbell/rainbow ========================== //
- // -------------------------------------------------------------------------- //
- /* Rainbow v1.2 rainbowco.de | included languages: c, scheme, java, d, lua, generic, javascript, r, html, python, coffeescript, haskell, smalltalk, csharp, go, shell, php, ruby, css */
- window.Rainbow=function(){function f(a){var b,c=a.getAttribute&&a.getAttribute("data-language")||0;if(!c)for(a=a.attributes,b=0;b<a.length;++b)if("data-language"===a[b].nodeName)return a[b].nodeValue;return c}function n(a){var b=f(a)||f(a.parentNode);if(!b){var c=/\blang(?:uage)?-(\w+)/;(a=a.className.match(c)||a.parentNode.className.match(c))&&(b=a[1])}return b}function p(a,b){for(var c in l[d]){c=parseInt(c,10);var e=l[d][c];if(a==c&&b==e?0:a<=c&&b>=e)delete l[d][c],delete m[d][c];e=l[d][c];if(a>=
- c&&a<e||b>c&&b<e)return!0}return!1}function w(a,b){return'<span class="'+a.replace(/\./g," ")+(s?" "+s:"")+'">'+b+"</span>"}function x(a,b,c,e){if("undefined"===typeof a||null===a)e();else{var h=a.exec(c);if(h){++y;b.name||"string"!=typeof b.matches[0]||(b.name=b.matches[0],delete b.matches[0]);var r=h[0],g=h.index,f=h[0].length+g,k=function(){function h(){x(a,b,c,e)}0<y%100?h():setTimeout(h,0)};if(p(g,f))k();else{var q=z(b.matches),n=function(a,c,e){if(a>=c.length)e(r);else{var d=h[c[a]];if(d){var g=
- b.matches[c[a]],f=g.language,k=g.name&&g.matches?g.matches:g,l=function(b,d,g){var f;f=0;var k;for(k=1;k<c[a];++k)h[k]&&(f+=h[k].length);d=g?w(g,d):d;r=r.substr(0,f)+r.substr(f).replace(b,d);n(++a,c,e)};f?t(d,f,function(a){l(d,a)}):"string"===typeof g?l(d,d,g):A(d,k.length?k:[k],function(a){l(d,a,g.matches?g.name:0)})}else n(++a,c,e)}};n(0,q,function(a){b.name&&(a=w(b.name,a));m[d]||(m[d]={},l[d]={});m[d][g]={replace:h[0],"with":a};l[d][g]=f;k()})}}else e()}}function z(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&
- b.push(c);return b.sort(function(a,b){return b-a})}function A(a,b,c){function e(b,f){f<b.length?x(b[f].pattern,b[f],a,function(){e(b,++f)}):F(a,function(a){delete m[d];delete l[d];--d;c(a)})}++d;e(b,0)}function F(a,b){function c(a,b,e,f){if(e<b.length){++B;var k=b[e],l=m[d][k];a=a.substr(0,k)+a.substr(k).replace(l.replace,l["with"]);k=function(){c(a,b,++e,f)};0<B%250?k():setTimeout(k,0)}else f(a)}var e=z(m[d]);c(a,e,0,b)}function t(a,b,c){var e=q[b]||[],h=q[C]||[];b=D[b]?e:e.concat(h);A(a.replace(/</g,
- "<").replace(/>/g,">").replace(/&(?![\w\#]+;)/g,"&"),b,c)}function u(a,b,c){if(b<a.length){var e=a[b],h=n(e);return-1<(" "+e.className+" ").indexOf(" rainbow ")||!h?u(a,++b,c):(h=h.toLowerCase(),e.className+=e.className?" rainbow":"rainbow",t(e.innerHTML,h,function(d){e.innerHTML=d;m={};l={};v&&v(e,h);setTimeout(function(){u(a,++b,c)},0)}))}c&&c()}function E(a,b){a=a&&"function"==typeof a.getElementsByTagName?a:document;var c=a.getElementsByTagName("pre"),e=a.getElementsByTagName("code"),
- d,f=[],g=[];for(d=0;d<c.length;++d)c[d].getElementsByTagName("code").length?c[d].innerHTML=c[d].innerHTML.replace(/^\s+/,"").replace(/\s+$/,""):f.push(c[d]);for(d=0;d<e.length;++d)g.push(e[d]);u(g.concat(f),0,b)}var m={},l={},q={},D={},d=0,C=0,y=0,B=0,s,v;return{extend:function(a,b,c){1==arguments.length&&(b=a,a=C);D[a]=c;q[a]=b.concat(q[a]||[])},b:function(a){v=a},a:function(a){s=a},color:function(a,b,c){if("string"==typeof a)return t(a,b,c);if("function"==typeof a)return E(0,a);E(a,b)}}}();
- (function(){var f=[];document.onreadystatechange&&f.push(document.onreadystatechange);document.onreadystatechange=function(n){for(var p=0;p<f.length;p++)f[p].call&&f[p].call(this,n);"complete"===document.readyState&&Rainbow.color()}})();Rainbow.onHighlight=Rainbow.b;Rainbow.addClass=Rainbow.a;Rainbow.extend("c",[{name:"meta.preprocessor",matches:{1:[{matches:{1:"keyword.define",2:"entity.name"},pattern:/(\w+)\s(\w+)\b/g},{name:"keyword.define",pattern:/endif/g},{name:"constant.numeric",pattern:/\d+/g},{matches:{1:"keyword.include",2:"string"},pattern:/(include)\s(.*?)$/g}]},pattern:/\#([\S\s]*?)$/gm},{name:"keyword",pattern:/\b(do|goto|typedef)\b/g},{name:"entity.label",pattern:/\w+:/g},{matches:{1:"storage.type",3:"storage.type",4:"entity.name.function"},pattern:/\b((un)?signed|const)? ?(void|char|short|int|long|float|double)\*? +((\w+)(?= ?\())?/g},
- {matches:{2:"entity.name.function"},pattern:/(\w|\*) +((\w+)(?= ?\())/g},{name:"storage.modifier",pattern:/\b(static|extern|auto|register|volatile|inline)\b/g},{name:"support.type",pattern:/\b(struct|union|enum)\b/g}]);Rainbow.extend("scheme",[{name:"plain",pattern:/>|</g},{name:"comment",pattern:/;.*$/gm},{name:"constant.language",pattern:/#t|#f|'\(\)/g},{name:"constant.symbol",pattern:/'[^()\s#]+/g},{name:"constant.number",pattern:/\b\d+(?:\.\d*)?\b/g},{name:"string",pattern:/".+?"/g},{matches:{1:"storage.function",2:"variable"},pattern:/\(\s*(define)\s+\(?(\S+)/g},{matches:{1:"keyword"},pattern:/\(\s*(begin|define\-syntax|if|lambda|quasiquote|quote|set!|syntax\-rules|and|and\-let\*|case|cond|delay|do|else|or|let|let\*|let\-syntax|letrec|letrec\-syntax)(?=[\]()\s#])/g},
- {matches:{1:"entity.function"},pattern:/\(\s*(eqv\?|eq\?|equal\?|number\?|complex\?|real\?|rational\?|integer\?|exact\?|inexact\?|=|<|>|<=|>=|zero\?|positive\?|negative\?|odd\?|even\?|max|min|\+|\-|\*|\/|abs|quotient|remainder|modulo|gcd|lcm|numerator|denominator|floor|ceiling|truncate|round|rationalize|exp|log|sin|cos|tan|asin|acos|atan|sqrt|expt|make\-rectangular|make\-polar|real\-part|imag\-part|magnitude|angle|exact\->inexact|inexact\->exact|number\->string|string\->number|not|boolean\?|pair\?|cons|car|cdr|set\-car!|set\-cdr!|caar|cadr|cdar|cddr|caaar|caadr|cadar|caddr|cdaar|cdadr|cddar|cdddr|caaaar|caaadr|caadar|caaddr|cadaar|cadadr|caddar|cadddr|cdaaar|cdaadr|cdadar|cdaddr|cddaar|cddadr|cdddar|cddddr|null\?|list\?|list|length|append|reverse|list\-tail|list\-ref|memq|memv|member|assq|assv|assoc|symbol\?|symbol\->string|string\->symbol|char\?|char=\?|char<\?|char>\?|char<=\?|char>=\?|char\-ci=\?|char\-ci<\?|char\-ci>\?|char\-ci<=\?|char\-ci>=\?|char\-alphabetic\?|char\-numeric\?|char\-whitespace\?|char\-upper\-case\?|char\-lower\-case\?|char\->integer|integer\->char|char\-upcase|char\-downcase|string\?|make\-string|string|string\-length|string\-ref|string\-set!|string=\?|string\-ci=\?|string<\?|string>\?|string<=\?|string>=\?|string\-ci<\?|string\-ci>\?|string\-ci<=\?|string\-ci>=\?|substring|string\-append|string\->list|list\->string|string\-copy|string\-fill!|vector\?|make\-vector|vector|vector\-length|vector\-ref|vector\-set!|vector\->list|list\->vector|vector\-fill!|procedure\?|apply|map|for\-each|force|call\-with\-current\-continuation|call\/cc|values|call\-with\-values|dynamic\-wind|eval|scheme\-report\-environment|null\-environment|interaction\-environment|call\-with\-input\-file|call\-with\-output\-file|input\-port\?|output\-port\?|current\-input\-port|current\-output\-port|with\-input\-from\-file|with\-output\-to\-file|open\-input\-file|open\-output\-file|close\-input\-port|close\-output\-port|read|read\-char|peek\-char|eof\-object\?|char\-ready\?|write|display|newline|write\-char|load|transcript\-on|transcript\-off)(?=[\]()\s#])/g}],
- !0);Rainbow.extend("java",[{name:"constant",pattern:/\b(false|null|true|[A-Z_]+)\b/g},{matches:{1:"keyword",2:"support.namespace"},pattern:/(import|package)\s(.+)/g},{name:"keyword",pattern:/\b(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/g},
- {name:"string",pattern:/(".*?")/g},{name:"char",pattern:/(')(.|\\.|\\u[\dA-Fa-f]{4})\1/g},{name:"integer",pattern:/\b(0x[\da-f]+|\d+)L?\b/g},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/).*?$/gm},{name:"support.annotation",pattern:/@\w+/g},{matches:{1:"entity.function"},pattern:/([^@\.\s]+)\(/g},{name:"entity.class",pattern:/\b([A-Z]\w*)\b/g},{name:"operator",pattern:/(\+{1,2}|-{1,2}|~|!|\*|\/|%|(?:<){1,2}|(?:>){1,3}|instanceof|(?:&){1,2}|\^|\|{1,2}|\?|:|(?:=|!|\+|-|\*|\/|%|\^|\||(?:<){1,2}|(?:>){1,3})?=)/g}],
- !0);Rainbow.extend("d",[{name:"constant",pattern:/\b(false|null|true)\b/gm},{name:"keyword",pattern:/\b(abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|in|inout|int|interface|invariant|ireal|is|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|size_t|static|string|struct|super|switch|synchronized|template|this|throw|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__FILE__|__LINE__|__gshared|__traits|__vector|__parameters)\b/gm},
- {matches:{1:"keyword",2:{name:"support.class",pattern:/\w+/gm}},pattern:/(typeof)\s([^\$].*?)(\)|;)/gm},{matches:{1:"keyword.namespace",2:{name:"support.namespace",pattern:/\w+/gm}},pattern:/\b(namespace)\s(.*?);/gm},{matches:{1:"storage.modifier",2:"storage.class",3:"entity.name.class",4:"storage.modifier.extends",5:"entity.other.inherited-class"},pattern:/\b(abstract|sealed)?\s?(class)\s(\w+)(\sextends\s)?([\w\\]*)?\s?\{?(\n|\})/gm},{name:"keyword.static",pattern:/\b(static)\b/gm},{matches:{1:"keyword.new",
- 2:{name:"support.class",pattern:/\w+/gm}},pattern:/\b(new)\s([^\$].*?)(?=\)|\(|;|&)/gm},{name:"string",pattern:/("|')(.*?)\1/gm},{name:"integer",pattern:/\b(0x[\da-f]+|\d+)\b/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|\/\+[\s\S]*?\+\/|(\/\/)[\s\S]*?$/gm},{name:"operator",pattern:/(\/|\/=|&=|&&|&|\|=|\|\|\||\-=|\-\-|\-|\+=|\+\+|\+|<=|<<|<|<<=|<>=|<>|>|>>>=|>>=|>=|>>|>>>|!=|!<>=|!<>|!<=|!<|!>=|!>|!|[|]|\$|==|=|\*=|\*|%=|%|\^\^=|\^=|\^\^|\^|~=|~|@|=>|\:)/gm}],
- !0);Rainbow.extend("lua",[{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\-{2}\[{2}\-{2}[\s\S]*?\-{2}\]{2}\-{2}|(\-{2})[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b((a|e)nd|in|repeat|break|local|return|do|for|then|else(if)?|function|not|if|or|until|while)(?=\(|\b)/gi},
- {name:"constant.language",pattern:/true|false|nil/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=|#|\.{2}/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s+(\w+[\:|\.]?\w+?)(?=\()/g},{matches:{1:"support.function"},pattern:/\b(print|require|module|\w+\.\w+)(?=\()/g}],!0);Rainbow.extend([{matches:{1:[{name:"keyword.operator",pattern:/\=|\+/g},{name:"keyword.dot",pattern:/\./g}],2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:|\+|\.)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(and|array|as|b(ool(ean)?|reak)|c(ase|atch|har|lass|on(st|tinue))|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi},
- {name:"constant.language",pattern:/true|false|null/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s(.*?)(?=\()/g}]);Rainbow.extend("javascript",[{name:"selector",pattern:/(\s|^)\$(?=\.|\()/g},{name:"support",pattern:/\b(window|document)\b/g},{matches:{1:"support.property"},pattern:/\.(length|node(Name|Value))\b/g},{matches:{1:"support.function"},pattern:/(setTimeout|setInterval)(?=\()/g},{matches:{1:"support.method"},pattern:/\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g},{name:"string.regexp",matches:{1:"string.regexp.open",2:{name:"constant.regexp.escape",pattern:/\\(.){1}/g},
- 3:"string.regexp.close",4:"string.regexp.modifier"},pattern:/(\/)(?!\*)(.+)(\/)([igm]{0,3})/g},{matches:{1:"storage",3:"entity.function"},pattern:/(var)?(\s|^)(\S*)(?=\s?=\s?function\()/g},{matches:{1:"keyword",2:"entity.function"},pattern:/(new)\s+(.*)(?=\()/g},{name:"entity.function",pattern:/(\w+)(?=:\s{0,}function)/g}]);Rainbow.extend("r",[{matches:{1:{name:"keyword.operator",pattern:/\=|<\-|<-/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm},{matches:{1:"constant.language"},pattern:/\b(NULL|NA|TRUE|FALSE|T|F|NaN|Inf|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/g},{matches:{1:"constant.symbol"},pattern:/[^0-9a-zA-Z\._](LETTERS|letters|month\.(abb|name)|pi)/g},{name:"keyword.operator",pattern:/<-|<-|-|==|<=|<=|>>|>=|<|>|&&|&&|&|&|!=|\|\|?|\*|\+|\^|\/|%%|%\/%|\=|%in%|%\*%|%o%|%x%|\$|:|~|\[{1,2}|\]{1,2}/g},
- {matches:{1:"storage",3:"entity.function"},pattern:/(\s|^)(.*)(?=\s?=\s?function\s\()/g},{matches:{1:"storage.function"},pattern:/[^a-zA-Z0-9._](function)(?=\s*\()/g},{matches:{1:"namespace",2:"keyword.operator",3:"function.call"},pattern:/([a-zA-Z][a-zA-Z0-9._]+)([:]{2,3})([.a-zA-Z][a-zA-Z0-9._]*(?=\s*\())\b/g},{name:"support.function",pattern:/(^|[^0-9a-zA-Z\._])(array|character|complex|data\.frame|double|integer|list|logical|matrix|numeric|vector)(?=\s*\()/g}]);Rainbow.extend("html",[{name:"source.php.embedded",matches:{2:{language:"php"}},pattern:/<\?=?(?!xml)(php)?([\s\S]*?)(\?>)/gm},{name:"source.css.embedded",matches:{1:{matches:{1:"support.tag.style",2:[{name:"entity.tag.style",pattern:/^style/g},{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.style.attribute",pattern:/(\w+)/g}],3:"support.tag.style"},pattern:/(<\/?)(style.*?)(>)/g},2:{language:"css"},3:"support.tag.style",4:"entity.tag.style",5:"support.tag.style"},pattern:/(<style.*?>)([\s\S]*?)(<\/)(style)(>)/gm},
- {name:"source.js.embedded",matches:{1:{matches:{1:"support.tag.script",2:[{name:"entity.tag.script",pattern:/^script/g},{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.script.attribute",pattern:/(\w+)/g}],3:"support.tag.script"},pattern:/(<\/?)(script.*?)(>)/g},2:{language:"javascript"},3:"support.tag.script",4:"entity.tag.script",5:"support.tag.script"},pattern:/(<script(?! src).*?>)([\s\S]*?)(<\/)(script)(>)/gm},{name:"comment.html",pattern:/<\!--[\S\s]*?-->/g},
- {matches:{1:"support.tag.open",2:"support.tag.close"},pattern:/(<)|(\/?\??>)/g},{name:"support.tag",matches:{1:"support.tag",2:"support.tag.special",3:"support.tag-name"},pattern:/(<\??)(\/|\!?)(\w+)/g},{matches:{1:"support.attribute"},pattern:/([a-z-]+)(?=\=)/gi},{matches:{1:"support.operator",2:"string.quote",3:"string.value",4:"string.quote"},pattern:/(=)('|")(.*?)(\2)/g},{matches:{1:"support.operator",2:"support.value"},pattern:/(=)([a-zA-Z\-0-9]*)\b/g},{matches:{1:"support.attribute"},
- pattern:/\s(\w+)(?=\s|>)(?![\s\S]*<)/g}],!0);Rainbow.extend("python",[{name:"variable.self",pattern:/self/g},{name:"constant.language",pattern:/None|True|False|NotImplemented|\.\.\./g},{name:"support.object",pattern:/object/g},{name:"support.function.python",pattern:/\b(bs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|bin|file|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern)(?=\()/g},
- {matches:{1:"keyword"},pattern:/\b(pass|lambda|with|is|not|in|from|elif|raise|del)(?=\(|\b)/g},{matches:{1:"storage.class",2:"entity.name.class",3:"entity.other.inherited-class"},pattern:/(class)\s+(\w+)\((\w+?)\)/g},{matches:{1:"storage.function",2:"support.magic"},pattern:/(def)\s+(__\w+)(?=\()/g},{name:"support.magic",pattern:/__(name)__/g},{matches:{1:"keyword.control",2:"support.exception.type"},pattern:/(except) (\w+):/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(def)\s+(\w+)(?=\()/g},
- {name:"entity.name.function.decorator",pattern:/@([\w\.]+)/g},{name:"comment.docstring",pattern:/('{3}|"{3})[\s\S]*?\1/gm}]);Rainbow.extend("coffeescript",[{name:"comment.block",pattern:/(\#{3})[\s\S]*\1/gm},{name:"string.block",pattern:/('{3}|"{3})[\s\S]*\1/gm},{name:"string.regex",matches:{2:{name:"comment",pattern:/\#(.*?)\n/g}},pattern:/(\/{3})([\s\S]*)\1/gm},{matches:{1:"keyword"},pattern:/\b(in|when|is|isnt|of|not|unless|until|super)(?=\b)/gi},{name:"keyword.operator",pattern:/\?/g},{name:"constant.language",pattern:/\b(undefined|yes|on|no|off)\b/g},{name:"keyword.variable.coffee",pattern:/@(\w+)/gi},{name:"reset",
- pattern:/object|class|print/gi},{matches:{1:"entity.name.function",2:"keyword.operator",3:{name:"function.argument.coffee",pattern:/([\@\w]+)/g},4:"keyword.function"},pattern:/(\w+)\s{0,}(=|:)\s{0,}\((.*?)((-|=)>)/gi},{matches:{1:{name:"function.argument.coffee",pattern:/([\@\w]+)/g},2:"keyword.function"},pattern:/\s\((.*?)\)\s{0,}((-|=)>)/gi},{matches:{1:"entity.name.function",2:"keyword.operator",3:"keyword.function"},pattern:/(\w+)\s{0,}(=|:)\s{0,}((-|=)>)/gi},{matches:{1:"storage.class",
- 2:"entity.name.class",3:"storage.modifier.extends",4:"entity.other.inherited-class"},pattern:/\b(class)\s(\w+)(\sextends\s)?([\w\\]*)?\b/g},{matches:{1:"keyword.new",2:{name:"support.class",pattern:/\w+/g}},pattern:/\b(new)\s(.*?)(?=\s)/g}]);Rainbow.extend("haskell",[{name:"comment",pattern:/\{\-\-[\s\S(\w+)]+[\-\-][\}$]/gm},{name:"comment",pattern:/\-\-(.*)/g},{matches:{1:"keyword",2:"support.namespace"},pattern:/\b(module)\s(\w+)\s[\(]?(\w+)?[\)?]\swhere/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\/\=|\||\@|\:|\.|\+{2}|\:|\*|\=|#|\.{2}|(\\)[a-zA-Z_]/g},{name:"keyword",pattern:/\b(case|class|foreign|hiding|qualified|data|family|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|in|otherwise|module|newtype|of|then|type|where)\b/g},
- {name:"keyword",pattern:/[\`][a-zA-Z_']*?[\`]/g},{matches:{1:"keyword",2:"keyword.operator"},pattern:/\b(infix|infixr|infixl)+\s\d+\s(\w+)*/g},{name:"entity.class",pattern:/\b([A-Z][A-Za-z0-9_']*)/g},{name:"meta.preprocessor",matches:{1:[{matches:{1:"keyword.define",2:"entity.name"},pattern:/(\w+)\s(\w+)\b/g},{name:"keyword.define",pattern:/endif/g},{name:"constant.numeric",pattern:/\d+/g},{matches:{1:"keyword.include",2:"string"},pattern:/(include)\s(.*?)$/g}]},pattern:/^\#([\S\s]*?)$/gm}]);Rainbow.extend("smalltalk",[{name:"keyword.pseudovariable",pattern:/self|thisContext/g},{name:"keyword.constant",pattern:/false|nil|true/g},{name:"string",pattern:/'([^']|'')*'/g},{name:"string.symbol",pattern:/#\w+|#'([^']|'')*'/g},{name:"string.character",pattern:/\$\w+/g},{name:"comment",pattern:/"([^"]|"")*"/g},{name:"constant.numeric",pattern:/-?\d+(\.\d+)?((r-?|s)[A-Za-z0-9]+|e-?[0-9]+)?/g},{name:"entity.name.class",pattern:/\b[A-Z]\w*/g},{name:"entity.name.function",pattern:/\b[a-z]\w*:?/g},
- {name:"entity.name.binary",pattern:/(<|>|&|[=~\|\\\/!@*\-_+])+/g},{name:"operator.delimiter",pattern:/;[\(\)\[\]\{\}]|#\[|#\(^\./g}],!0);Rainbow.extend("csharp",[{name:"constant",pattern:/\b(false|null|true)\b/g},{name:"keyword",pattern:/\b(abstract|add|alias|ascending|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|double|do|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|foreach|for|from|get|global|goto|group|if|implicit|int|interface|internal|into|in|is|join|let|lock|long|namespace|new|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|try|typeof|uint|unchecked|ulong|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/g},
- {matches:{1:"keyword",2:{name:"support.class",pattern:/\w+/g}},pattern:/(typeof)\s([^\$].*?)(\)|;)/g},{matches:{1:"keyword.namespace",2:{name:"support.namespace",pattern:/\w+/g}},pattern:/\b(namespace)\s(.*?);/g},{matches:{1:"storage.modifier",2:"storage.class",3:"entity.name.class",4:"storage.modifier.extends",5:"entity.other.inherited-class"},pattern:/\b(abstract|sealed)?\s?(class)\s(\w+)(\sextends\s)?([\w\\]*)?\s?\{?(\n|\})/g},{name:"keyword.static",pattern:/\b(static)\b/g},{matches:{1:"keyword.new",
- 2:{name:"support.class",pattern:/\w+/g}},pattern:/\b(new)\s([^\$].*?)(?=\)|\(|;|&)/g},{name:"string",pattern:/(")(.*?)\1/g},{name:"integer",pattern:/\b(0x[\da-f]+|\d+)\b/g},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm},{name:"operator",pattern:/(\+\+|\+=|\+|--|-=|-|<<=|<<|<=|=>|>>=|>>|>=|!=|!|~|\^|\|\||&&|&=|&|\?\?|::|:|\*=|\*|\/=|%=|\|=|==|=)/g},{name:"preprocessor",pattern:/(\#if|\#else|\#elif|\#endif|\#define|\#undef|\#warning|\#error|\#line|\#region|\#endregion|\#pragma)[\s\S]*?$/gm}],
- !0);Rainbow.extend("go",[{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\(`|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)((`|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(break|c(ase|onst|ontinue)|d(efault|efer)|else|fallthrough|for|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)(?=\(|\b)/gi},
- {name:"constant.language",pattern:/true|false|null|string|byte|rune|u?int(8|16|32|64)?|float(32|64)|complex(64|128)/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\:?=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(func)\s(.*?)(?=\()/g}]);Rainbow.extend("shell",[{name:"shell",matches:{1:{language:"shell"}},pattern:/\$\(([\s\S]*?)\)/gm},{matches:{2:"string"},pattern:/(\(|\s|\[|\=)(('|")[\s\S]*?(\3))/gm},{name:"keyword.operator",pattern:/<|>|&/g},{name:"comment",pattern:/\#[\s\S]*?$/gm},{name:"storage.function",pattern:/(.+?)(?=\(\)\s{0,}\{)/g},{name:"support.command",pattern:/\b(echo|rm|ls|(mk|rm)dir|cd|find|cp|exit|pwd|exec|trap|source|shift|unset)/g},{matches:{1:"keyword"},pattern:/\b(break|case|continue|do|done|elif|else|esac|eval|export|fi|for|function|if|in|local|return|set|then|unset|until|while)(?=\(|\b)/g}],
- !0);Rainbow.extend("php",[{name:"support",pattern:/\becho\b/g},{matches:{1:"variable.dollar-sign",2:"variable"},pattern:/(\$)(\w+)\b/g},{name:"constant.language",pattern:/true|false|null/ig},{name:"constant",pattern:/\b[A-Z0-9_]{2,}\b/g},{name:"keyword.dot",pattern:/\./g},{name:"keyword",pattern:/\b(die|end(for(each)?|switch|if)|case|require(_once)?|include(_once)?)(?=\(|\b)/g},{matches:{1:"keyword",2:{name:"support.class",pattern:/\w+/g}},pattern:/(instanceof)\s([^\$].*?)(\)|;)/g},{matches:{1:"support.function"},
- pattern:/\b(array(_key_exists|_merge|_keys|_shift)?|isset|count|empty|unset|printf|is_(array|string|numeric|object)|sprintf|each|date|time|substr|pos|str(len|pos|tolower|_replace|totime)?|ord|trim|in_array|implode|end|preg_match|explode|fmod|define|link|list|get_class|serialize|file|sort|mail|dir|idate|log|intval|header|chr|function_exists|dirname|preg_replace|file_exists)(?=\()/g},{name:"variable.language.php-tag",pattern:/(<\?(php)?|\?>)/g},{matches:{1:"keyword.namespace",2:{name:"support.namespace",
- pattern:/\w+/g}},pattern:/\b(namespace|use)\s(.*?);/g},{matches:{1:"storage.modifier",2:"storage.class",3:"entity.name.class",4:"storage.modifier.extends",5:"entity.other.inherited-class",6:"storage.modifier.extends",7:"entity.other.inherited-class"},pattern:/\b(abstract|final)?\s?(class|interface|trait)\s(\w+)(\sextends\s)?([\w\\]*)?(\simplements\s)?([\w\\]*)?\s?\{?(\n|\})/g},{name:"keyword.static",pattern:/self::|static::/g},{matches:{1:"storage.function",2:"support.magic"},pattern:/(function)\s(__.*?)(?=\()/g},
- {matches:{1:"keyword.new",2:{name:"support.class",pattern:/\w+/g}},pattern:/\b(new)\s([^\$].*?)(?=\)|\(|;)/g},{matches:{1:{name:"support.class",pattern:/\w+/g},2:"keyword.static"},pattern:/([\w\\]*?)(::)(?=\b|\$)/g},{matches:{2:{name:"support.class",pattern:/\w+/g}},pattern:/(\(|,\s?)([\w\\]*?)(?=\s\$)/g}]);Rainbow.extend("ruby",[{matches:{1:"variable.language",2:{language:null}},pattern:/^(__END__)\n((?:.*\n)*)/gm},{name:"string",matches:{1:"string.open",2:[{name:"string.interpolation",matches:{1:"string.open",2:{language:"ruby"},3:"string.close"},pattern:/(\#\{)(.*?)(\})/g}],3:"string.close"},pattern:/("|`)(.*?[^\\\1])?(\1)/g},{name:"string",pattern:/('|"|`)([^\\\1\n]|\\.)*?\1/g},{name:"string",pattern:/%[qQ](?=(\(|\[|\{|<|.)(.*?)(?:'|\)|\]|\}|>|\1))(?:\(\2\)|\[\2\]|\{\2\}|\<\2>|\1\2\1)/g},
- {matches:{1:"string",2:"string",3:"string"},pattern:/(<<)(\w+).*?$([\s\S]*?^\2)/gm},{matches:{1:"string",2:"string",3:"string"},pattern:/(<<\-)(\w+).*?$([\s\S]*?\2)/gm},{name:"string.regexp",matches:{1:"string.regexp",2:{name:"string.regexp",pattern:/\\(.){1}/g},3:"string.regexp",4:"string.regexp"},pattern:/(\/)(.*?)(\/)([a-z]*)/g},{name:"string.regexp",matches:{1:"string.regexp",2:{name:"string.regexp",pattern:/\\(.){1}/g},3:"string.regexp",4:"string.regexp"},pattern:/%r(?=(\(|\[|\{|<|.)(.*?)('|\)|\]|\}|>|\1))(?:\(\2\)|\[\2\]|\{\2\}|\<\2>|\1\2\1)([a-z]*)/g},
- {name:"comment",pattern:/#.*$/gm},{name:"comment",pattern:/^\=begin[\s\S]*?\=end$/gm},{matches:{1:"constant"},pattern:/(\w+:)[^:]/g},{matches:{1:"constant.symbol"},pattern:/[^:](:(?:\w+|(?=['"](.*?)['"])(?:"\2"|'\2')))/g},{name:"constant.numeric",pattern:/\b(0x[\da-f]+|\d+)\b/g},{name:"support.class",pattern:/\b[A-Z]\w*(?=((\.|::)[A-Za-z]|\[))/g},{name:"constant",pattern:/\b[A-Z]\w*\b/g},{matches:{1:"storage.class",2:"entity.name.class",3:"entity.other.inherited-class"},pattern:/\s*(class)\s+((?:(?:::)?[A-Z]\w*)+)(?:\s+<\s+((?:(?:::)?[A-Z]\w*)+))?/g},
- {matches:{1:"storage.module",2:"entity.name.class"},pattern:/\s*(module)\s+((?:(?:::)?[A-Z]\w*)+)/g},{name:"variable.global",pattern:/\$([a-zA-Z_]\w*)\b/g},{name:"variable.class",pattern:/@@([a-zA-Z_]\w*)\b/g},{name:"variable.instance",pattern:/@([a-zA-Z_]\w*)\b/g},{matches:{1:"keyword.control"},pattern:/[^\.]\b(BEGIN|begin|case|class|do|else|elsif|END|end|ensure|for|if|in|module|rescue|then|unless|until|when|while)\b(?![?!])/g},{matches:{1:"keyword.control.pseudo-method"},pattern:/[^\.]\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\?/g},
- {matches:{1:"constant.language"},pattern:/\b(nil|true|false)\b(?![?!])/g},{matches:{1:"variable.language"},pattern:/\b(__(FILE|LINE)__|self)\b(?![?!])/g},{matches:{1:"keyword.special-method"},pattern:/\b(require|gem|initialize|new|loop|include|extend|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!])/g},{name:"keyword.operator",pattern:/\s\?\s|=|<<|<<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<<|<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|%|&|\*\*|\*|\+|\-|\/|\||~|>>/g},
- {matches:{1:"keyword.operator.logical"},pattern:/[^\.]\b(and|not|or)\b/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(def)\s(.*?)(?=(\s|\())/g}],!0);Rainbow.extend("css",[{name:"comment",pattern:/\/\*[\s\S]*?\*\//gm},{name:"constant.hex-color",pattern:/#([a-f0-9]{3}|[a-f0-9]{6})(?=;|\s|,|\))/gi},{matches:{1:"constant.numeric",2:"keyword.unit"},pattern:/(\d+)(px|em|cm|s|%)?/g},{name:"string",pattern:/('|")(.*?)\1/g},{name:"support.css-property",matches:{1:"support.vendor-prefix"},pattern:/(-o-|-moz-|-webkit-|-ms-)?[\w-]+(?=\s?:)(?!.*\{)/g},{matches:{1:[{name:"entity.name.sass",pattern:/&/g},{name:"direct-descendant",pattern:/>/g},{name:"entity.name.class",
- pattern:/\.[\w\-_]+/g},{name:"entity.name.id",pattern:/\#[\w\-_]+/g},{name:"entity.name.pseudo",pattern:/:[\w\-_]+/g},{name:"entity.name.tag",pattern:/\w+/g}]},pattern:/([\w\ ,\n:\.\#\&\;\-_]+)(?=.*\{)/g},{matches:{2:"support.vendor-prefix",3:"support.css-value"},pattern:/(:|,)\s*(-o-|-moz-|-webkit-|-ms-)?([a-zA-Z-]*)(?=\b)(?!.*\{)/g}],!0);
- // ------------- JQUERY APPEAR ---------------------------------------------- //
- // ============ https://github.com/morr/jquery.appear ====================== //
- // -------------------------------------------------------------------------- //
- (function($) {
- var selectors = [];
- var check_binded = false;
- var check_lock = false;
- var defaults = {
- interval: 250,
- force_process: false
- }
- var $window = $(window);
- var $prior_appeared;
- function process() {
- check_lock = false;
- for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
- var $appeared = $(selectors[index]).filter(function() {
- return $(this).is(':appeared');
- });
- $appeared.trigger('appear', [$appeared]);
- if ($prior_appeared) {
- var $disappeared = $prior_appeared.not($appeared);
- $disappeared.trigger('disappear', [$disappeared]);
- }
- $prior_appeared = $appeared;
- }
- }
- // "appeared" custom filter
- $.expr[':']['appeared'] = function(element) {
- var $element = $(element);
- if (!$element.is(':visible')) {
- return false;
- }
- var window_left = $window.scrollLeft();
- var window_top = $window.scrollTop();
- var offset = $element.offset();
- var left = offset.left;
- var top = offset.top;
- if (top + $element.height() >= window_top &&
- top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
- left + $element.width() >= window_left &&
- left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
- return true;
- } else {
- return false;
- }
- }
- $.fn.extend({
- // watching for element's appearance in browser viewport
- appear: function(options) {
- var opts = $.extend({}, defaults, options || {});
- var selector = this.selector || this;
- if (!check_binded) {
- var on_check = function() {
- if (check_lock) {
- return;
- }
- check_lock = true;
- setTimeout(process, opts.interval);
- };
- $(window).scroll(on_check).resize(on_check);
- check_binded = true;
- }
- if (opts.force_process) {
- setTimeout(process, opts.interval);
- }
- selectors.push(selector);
- return $(selector);
- }
- });
- $.extend({
- // force elements's appearance check
- force_appear: function() {
- if (check_binded) {
- process();
- return true;
- };
- return false;
- }
- });
- })(jQuery);
- // ------------- DRAW FILL SVG ---------------------------------------------- //
- // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
- // -------------------------------------------------------------------------- //
- (function( window ){
- 'use strict';
- /**
- * Cross browser transition end events
- *
- * Use modernizr to detect cross browser transition end events. Make sure
- * to include Modernizr in your doc and have "Modernizr.prefixed()" checked
- * off in the extensibility section.
- */
- var transEndEventNames = {
- "WebkitTransition" : "webkitTransitionEnd",
- "MozTransition" : "transitionend",
- "OTransition" : "oTransitionEnd",
- "msTransition" : "MSTransitionEnd",
- "transition" : "transitionend"
- },
- transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
- /**
- * Extend obj function
- *
- */
- function extend( a, b ) {
- for( var key in b ) {
- if( b.hasOwnProperty( key ) ) {
- a[key] = b[key];
- }
- }
- return a;
- }
- /**
- * DrawFillSVG constructor
- *
- */
- function DrawFillSVG( options ) {
- this.options = extend( {}, this.options );
- extend( this.options, options );
- this._init();
- }
- /**
- * DrawFillSVG options
- *
- * Available options:
- * elementId - the ID of the element to draw
- */
- DrawFillSVG.prototype.options = {
- elementId : "svg"
- }
- /**
- * DrawFillSVG _init
- *
- * Initialise DrawFillSVG
- */
- DrawFillSVG.prototype._init = function() {
- this.svg = document.getElementById(this.options.elementId);
- this.paths = this.svg.querySelectorAll("path");
- this._initAnimation();
- }
- /**
- * DrawFillSVG _initAnimation()
- *
- * Reset some style properties on our paths, add some transitions, set the
- * stroke-dasharray to the length of the path, and the stroke-dashoffset to
- * the length of the path pushing it out of view initially. Then, set the
- * stroke-dashoffset to 0, animating the strokes in a drawing manner. Then,
- * run the path filler sequence.
- */
- DrawFillSVG.prototype._initAnimation = function() {
- for ( var i = 0; i < this.paths.length; i++ ) {
- var path = this.paths[i];
- var length = path.getTotalLength();
- // reset opacities
- path.style.fillOpacity = 0;
- path.style.strokeOpacity = 1;
- // reset transitions
- path.style.transition = path.style.WebkitTransition = "none";
- // reset stroke dash array and stroke dash offset
- path.style.strokeDasharray = length + " " + length;
- path.style.strokeDashoffset = length;
- path.getBoundingClientRect();
- // apply new transitions
- path.style.transition = path.style.WebkitTransition = "stroke-dashoffset 2s ease-in-out";
- // go baby go
- path.style.strokeDashoffset = 0;
- // fill the path
- this._fillPath( path );
- }
- }
- /**
- * DrawFillSVG _fillPath()
- *
- * Resets the transition props, then fills the path and fades out the stroke
- * by updating the styles.
- */
- DrawFillSVG.prototype._fillPath = function( path ) {
- path.addEventListener( transEndEventName, function() {
- // reset transitions
- path.style.transition = path.style.WebkitTransition = "none";
- path.style.transition = path.style.WebkitTransition = "fill-opacity 1s ease-in-out, stroke-opacity 1s ease-in-out";
- // edit props
- path.style.fillOpacity = 1;
- path.style.strokeOpacity = 0;
- } );
- }
- /**
- * DrawFillSVG replay
- *
- * A public function that allows you to replay the animation if you want. For
- * example, click a button, and replay the animation.
- */
- DrawFillSVG.prototype.replay = function() {
- this._initAnimation();
- }
- /**
- * Add to global namespace
- */
- window.DrawFillSVG = DrawFillSVG;
- })( window );
- // ------------- JQUERY TYPED.JS -------------------------------------------- //
- // ============ https://github.com/mattboldt/typed.js/ ====================== //
- // -------------------------------------------------------------------------- //
- !function($){
- "use strict";
- var Typed = function(el, options){
- // chosen element to manipulate text
- this.el = $(el);
- // options
- this.options = $.extend({}, $.fn.typed.defaults, options);
- // text content of element
- this.baseText = this.el.text() || this.el.attr('placeholder') || '';
- // typing speed
- this.typeSpeed = this.options.typeSpeed;
- // add a delay before typing starts
- this.startDelay = this.options.startDelay;
- // backspacing speed
- this.backSpeed = this.options.backSpeed;
- // amount of time to wait before backspacing
- this.backDelay = this.options.backDelay;
- // input strings of text
- this.strings = this.options.strings;
- // character number position of current string
- this.strPos = 0;
- // current array position
- this.arrayPos = 0;
- // number to stop backspacing on.
- // default 0, can change depending on how many chars
- // you want to remove at the time
- this.stopNum = 0;
- // Looping logic
- this.loop = this.options.loop;
- this.loopCount = this.options.loopCount;
- this.curLoop = 0;
- // for stopping
- this.stop = false;
- // show cursor
- this.showCursor = this.isInput ? false : this.options.showCursor;
- // custom cursor
- this.cursorChar = this.options.cursorChar;
- // attribute to type
- this.isInput = this.el.is('input');
- this.attr = this.options.attr || (this.isInput ? 'placeholder' : null);
- // All systems go!
- this.build();
- };
- Typed.prototype = {
- constructor: Typed
- , init: function(){
- // begin the loop w/ first current string (global self.string)
- // current string will be passed as an argument each time after this
- var self = this;
- self.timeout = setTimeout(function() {
- // Start typing
- self.typewrite(self.strings[self.arrayPos], self.strPos);
- }, self.startDelay);
- }
- , build: function(){
- // Insert cursor
- if (this.showCursor === true){
- this.cursor = $("<span class=\"typed-cursor\">" + this.cursorChar + "</span>");
- this.el.after(this.cursor);
- }
- this.init();
- }
- // pass current string state to each function, types 1 char per call
- , typewrite: function(curString, curStrPos){
- // exit when stopped
- if(this.stop === true)
- return;
- // varying values for setTimeout during typing
- // can't be global since number changes each time loop is executed
- var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed;
- var self = this;
- // ------------- optional ------------- //
- // backpaces a certain string faster
- // ------------------------------------ //
- // if (self.arrayPos == 1){
- // self.backDelay = 50;
- // }
- // else{ self.backDelay = 500; }
- // contain typing function in a timeout humanize'd delay
- self.timeout = setTimeout(function() {
- // check for an escape character before a pause value
- // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^
- // single ^ are removed from string
- var charPause = 0;
- var substr = curString.substr(curStrPos);
- if (substr.charAt(0) === '^') {
- var skip = 1; // skip atleast 1
- if(/^\^\d+/.test(substr)) {
- substr = /\d+/.exec(substr)[0];
- skip += substr.length;
- charPause = parseInt(substr);
- }
- // strip out the escape character and pause value so they're not printed
- curString = curString.substring(0,curStrPos)+curString.substring(curStrPos+skip);
- }
- // timeout for any pause after a character
- self.timeout = setTimeout(function() {
- if(curStrPos === curString.length) {
- // fires callback function
- self.options.onStringTyped(self.arrayPos);
- // is this the final string
- if(self.arrayPos === self.strings.length-1) {
- // animation that occurs on the last typed string
- self.options.callback();
- self.curLoop++;
- // quit if we wont loop back
- if(self.loop === false || self.curLoop === self.loopCount)
- return;
- }
- self.timeout = setTimeout(function(){
- self.backspace(curString, curStrPos);
- }, self.backDelay);
- } else {
- /* call before functions if applicable */
- if(curStrPos === 0)
- self.options.preStringTyped(self.arrayPos);
- // start typing each new char into existing string
- // curString: arg, self.baseText: original text inside element
- var nextString = self.baseText + curString.substr(0, curStrPos+1);
- if (self.attr) {
- self.el.attr(self.attr, nextString);
- } else {
- self.el.text(nextString);
- }
- // add characters one by one
- curStrPos++;
- // loop the function
- self.typewrite(curString, curStrPos);
- }
- // end of character pause
- }, charPause);
- // humanized value for typing
- }, humanize);
- }
- , backspace: function(curString, curStrPos){
- // exit when stopped
- if (this.stop === true) {
- return;
- }
- // varying values for setTimeout during typing
- // can't be global since number changes each time loop is executed
- var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed;
- var self = this;
- self.timeout = setTimeout(function() {
- // ----- this part is optional ----- //
- // check string array position
- // on the first string, only delete one word
- // the stopNum actually represents the amount of chars to
-
- // ------------- CUSTOM OPTIONS --------------------------------------------- //
- // ========================================================================== //
- // -------------------------------------------------------------------------- //
- if (self.arrayPos == 1) {
- self.stopNum = 17;
- self.backDelay = 500;
- }
- else if (self.arrayPos == 2) {
- self.stopNum = 54;
- }
- else{self.stopNum = 0;}
- // ----- continue important stuff ----- //
- // replace text with base text + typed characters
- var nextString = self.baseText + curString.substr(0, curStrPos);
- if (self.attr) {
- self.el.attr(self.attr, nextString);
- } else {
- self.el.text(nextString);
- }
- // if the number (id of character in current string) is
- // less than the stop number, keep going
- if (curStrPos > self.stopNum){
- // subtract characters one by one
- curStrPos--;
- // loop the function
- self.backspace(curString, curStrPos);
- }
- // if the stop number has been reached, increase
- // array position to next string
- else if (curStrPos <= self.stopNum) {
- self.arrayPos++;
- if(self.arrayPos === self.strings.length) {
- self.arrayPos = 0;
- self.init();
- } else
- self.typewrite(self.strings[self.arrayPos], curStrPos);
- }
- // humanized value for typing
- }, humanize);
- }
- // Start & Stop currently not working
- // , stop: function() {
- // var self = this;
- // self.stop = true;
- // clearInterval(self.timeout);
- // }
- // , start: function() {
- // var self = this;
- // if(self.stop === false)
- // return;
- // this.stop = false;
- // this.init();
- // }
- // Reset and rebuild the element
- , reset: function(){
- var self = this;
- clearInterval(self.timeout);
- var id = this.el.attr('id');
- this.el.after('<span id="' + id + '"/>')
- this.el.remove();
- this.cursor.remove();
- // Send the callback
- self.options.resetCallback();
- }
- };
- $.fn.typed = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('typed')
- , options = typeof option == 'object' && option;
- if (!data) $this.data('typed', (data = new Typed(this, options)));
- if (typeof option == 'string') data[option]();
- });
- };
- $.fn.typed.defaults = {
- strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"],
- // typing speed
- typeSpeed: 0,
- // time before typing starts
- startDelay: 0,
- // backspacing speed
- backSpeed: 0,
- // time before backspacing
- backDelay: 500,
- // loop
- loop: false,
- // false = infinite
- loopCount: false,
- // show cursor
- showCursor: true,
- // character for cursor
- cursorChar: "|",
- // attribute to type (null == text)
- attr: null,
- // call when done callback function
- callback: function() {},
- // starting callback function before each string
- preStringTyped: function() {},
- //callback for every typed string
- onStringTyped: function() {},
- // callback for reset
- resetCallback: function() {}
- };
- }(window.jQuery);
- // ------------- JQUERY SCROLLTO--------------------------------------------- //
- // ============ https://github.com/balupton/jquery-scrollto ================= //
- // -------------------------------------------------------------------------- //
- /*global define:false require:false */
- (function (name, context, definition) {
- if (typeof module != 'undefined' && module.exports) module.exports = definition();
- else if (typeof define == 'function' && define.amd) define(definition);
- else context[name] = definition();
- })('jquery-scrollto', this, function(){
- // Prepare
- var jQuery, $, ScrollTo;
- jQuery = $ = window.jQuery || require('jquery');
- // Fix scrolling animations on html/body on safari
- $.propHooks.scrollTop = $.propHooks.scrollLeft = {
- get: function(elem,prop) {
- var result = null;
- if ( elem.tagName === 'HTML' || elem.tagName === 'BODY' ) {
- if ( prop === 'scrollLeft' ) {
- result = window.scrollX;
- } else if ( prop === 'scrollTop' ) {
- result = window.scrollY;
- }
- }
- if ( result == null ) {
- result = elem[prop];
- }
- return result;
- }
- };
- $.Tween.propHooks.scrollTop = $.Tween.propHooks.scrollLeft = {
- get: function(tween) {
- return $.propHooks.scrollTop.get(tween.elem, tween.prop);
- },
- set: function(tween) {
- // Our safari fix
- if ( tween.elem.tagName === 'HTML' || tween.elem.tagName === 'BODY' ) {
- // Defaults
- tween.options.bodyScrollLeft = (tween.options.bodyScrollLeft || window.scrollX);
- tween.options.bodyScrollTop = (tween.options.bodyScrollTop || window.scrollY);
- // Apply
- if ( tween.prop === 'scrollLeft' ) {
- tween.options.bodyScrollLeft = Math.round(tween.now);
- }
- else if ( tween.prop === 'scrollTop' ) {
- tween.options.bodyScrollTop = Math.round(tween.now);
- }
- // Apply
- window.scrollTo(tween.options.bodyScrollLeft, tween.options.bodyScrollTop);
- }
- // jQuery's IE8 Fix
- else if ( tween.elem.nodeType && tween.elem.parentNode ) {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- };
- // jQuery ScrollTo
- ScrollTo = {
- // Configuration
- config: {
- duration: 400,
- easing: 'swing',
- callback: undefined,
- durationMode: 'each',
- offsetTop: 0,
- offsetLeft: 0
- },
- // Set Configuration
- configure: function(options){
- // Apply Options to Config
- $.extend(ScrollTo.config, options||{});
- // Chain
- return this;
- },
- // Perform the Scroll Animation for the Collections
- // We use $inline here, so we can determine the actual offset start for each overflow:scroll item
- // Each collection is for each overflow:scroll item
- scroll: function(collections, config){
- // Prepare
- var collection, $container, container, $target, $inline, position, containerTagName,
- containerScrollTop, containerScrollLeft,
- containerScrollTopEnd, containerScrollLeftEnd,
- startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted,
- startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted,
- scrollOptions,
- callback;
- // Determine the Scroll
- collection = collections.pop();
- $container = collection.$container;
- $target = collection.$target;
- containerTagName = $container.prop('tagName');
- // Prepare the Inline Element of the Container
- $inline = $('<span/>').css({
- 'position': 'absolute',
- 'top': '0px',
- 'left': '0px'
- });
- position = $container.css('position');
- // Insert the Inline Element of the Container
- $container.css({position:'relative'});
- $inline.appendTo($container);
- // Determine the top offset
- startOffsetTop = $inline.offset().top;
- targetOffsetTop = $target.offset().top;
- targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10);
- // Determine the left offset
- startOffsetLeft = $inline.offset().left;
- targetOffsetLeft = $target.offset().left;
- targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10);
- // Determine current scroll positions
- containerScrollTop = $container.prop('scrollTop');
- containerScrollLeft = $container.prop('scrollLeft');
- // Reset the Inline Element of the Container
- $inline.remove();
- $container.css({position:position});
- // Prepare the scroll options
- scrollOptions = {};
- // Prepare the callback
- callback = function(event){
- // Check
- if ( collections.length === 0 ) {
- // Callback
- if ( typeof config.callback === 'function' ) {
- config.callback();
- }
- }
- else {
- // Recurse
- ScrollTo.scroll(collections,config);
- }
- // Return true
- return true;
- };
- // Handle if we only want to scroll if we are outside the viewport
- if ( config.onlyIfOutside ) {
- // Determine current scroll positions
- containerScrollTopEnd = containerScrollTop + $container.height();
- containerScrollLeftEnd = containerScrollLeft + $container.width();
- // Check if we are in the range of the visible area of the container
- if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) {
- targetOffsetTopAdjusted = containerScrollTop;
- }
- if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) {
- targetOffsetLeftAdjusted = containerScrollLeft;
- }
- }
- // Determine the scroll options
- if ( targetOffsetTopAdjusted !== containerScrollTop ) {
- scrollOptions.scrollTop = targetOffsetTopAdjusted;
- }
- if ( targetOffsetLeftAdjusted !== containerScrollLeft ) {
- scrollOptions.scrollLeft = targetOffsetLeftAdjusted;
- }
- // Check to see if the scroll is necessary
- if ( $container.prop('scrollHeight') === $container.width() ) {
- delete scrollOptions.scrollTop;
- }
- if ( $container.prop('scrollWidth') === $container.width() ) {
- delete scrollOptions.scrollLeft;
- }
- // Perform the scroll
- if ( scrollOptions.scrollTop != null || scrollOptions.scrollLeft != null ) {
- $container.animate(scrollOptions, {
- duration: config.duration,
- easing: config.easing,
- complete: callback
- });
- }
- else {
- callback();
- }
- // Return true
- return true;
- },
- // ScrollTo the Element using the Options
- fn: function(options){
- // Prepare
- var collections, config, $container, container;
- collections = [];
- // Prepare
- var $target = $(this);
- if ( $target.length === 0 ) {
- // Chain
- return this;
- }
- // Handle Options
- config = $.extend({},ScrollTo.config,options);
- // Fetch
- $container = $target.parent();
- container = $container.get(0);
- // Cycle through the containers
- while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) {
- // Check Container for scroll differences
- var containerScrollTop, containerScrollLeft;
- containerScrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight;
- containerScrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth;
- if ( containerScrollTop || containerScrollLeft ) {
- // Push the Collection
- collections.push({
- '$container': $container,
- '$target': $target
- });
- // Update the Target
- $target = $container;
- }
- // Update the Container
- $container = $container.parent();
- container = $container.get(0);
- }
- // Add the final collection
- collections.push({
- '$container': $('html'),
- // document.body doesn't work in firefox, html works for all
- // internet explorer starts at the beggining
- '$target': $target
- });
- // Adjust the Config
- if ( config.durationMode === 'all' ) {
- config.duration /= collections.length;
- }
- // Handle
- ScrollTo.scroll(collections,config);
- // Chain
- return this;
- }
- };
- // Apply our extensions to jQuery
- $.ScrollTo = $.ScrollTo || ScrollTo;
- $.fn.ScrollTo = $.fn.ScrollTo || ScrollTo.fn;
- // Export
- return ScrollTo;
- });
- // ------------- WOW ANIMATE ------------------------------------------------ //
- // ==============https://github.com/matthieua/WOW =========================== //
- // -------------------------------------------------------------------------- //
- (function() {
- var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
- __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
- Util = (function() {
- function Util() {}
- Util.prototype.extend = function(custom, defaults) {
- var key, value;
- for (key in defaults) {
- value = defaults[key];
- if (custom[key] == null) {
- custom[key] = value;
- }
- }
- return custom;
- };
- Util.prototype.isMobile = function(agent) {
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
- };
- Util.prototype.addEvent = function(elem, event, fn) {
- if (elem.addEventListener != null) {
- return elem.addEventListener(event, fn, false);
- } else if (elem.attachEvent != null) {
- return elem.attachEvent("on" + event, fn);
- } else {
- return elem[event] = fn;
- }
- };
- Util.prototype.removeEvent = function(elem, event, fn) {
- if (elem.removeEventListener != null) {
- return elem.removeEventListener(event, fn, false);
- } else if (elem.detachEvent != null) {
- return elem.detachEvent("on" + event, fn);
- } else {
- return delete elem[event];
- }
- };
- Util.prototype.innerHeight = function() {
- if ('innerHeight' in window) {
- return window.innerHeight;
- } else {
- return document.documentElement.clientHeight;
- }
- };
- return Util;
- })();
- WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
- function WeakMap() {
- this.keys = [];
- this.values = [];
- }
- WeakMap.prototype.get = function(key) {
- var i, item, _i, _len, _ref;
- _ref = this.keys;
- for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
- item = _ref[i];
- if (item === key) {
- return this.values[i];
- }
- }
- };
- WeakMap.prototype.set = function(key, value) {
- var i, item, _i, _len, _ref;
- _ref = this.keys;
- for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
- item = _ref[i];
- if (item === key) {
- this.values[i] = value;
- return;
- }
- }
- this.keys.push(key);
- return this.values.push(value);
- };
- return WeakMap;
- })());
- MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
- function MutationObserver() {
- if (typeof console !== "undefined" && console !== null) {
- console.warn('MutationObserver is not supported by your browser.');
- }
- if (typeof console !== "undefined" && console !== null) {
- console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
- }
- }
- MutationObserver.notSupported = true;
- MutationObserver.prototype.observe = function() {};
- return MutationObserver;
- })());
- getComputedStyle = this.getComputedStyle || function(el, pseudo) {
- this.getPropertyValue = function(prop) {
- var _ref;
- if (prop === 'float') {
- prop = 'styleFloat';
- }
- if (getComputedStyleRX.test(prop)) {
- prop.replace(getComputedStyleRX, function(_, char) {
- return char.toUpperCase();
- });
- }
- return ((_ref = el.currentStyle) != null ? _ref[prop] : void 0) || null;
- };
- return this;
- };
- getComputedStyleRX = /(\-([a-z]){1})/g;
- this.WOW = (function() {
- WOW.prototype.defaults = {
- boxClass: 'wow',
- animateClass: 'animated',
- offset: 0,
- mobile: true,
- live: true
- };
- function WOW(options) {
- if (options == null) {
- options = {};
- }
- this.scrollCallback = __bind(this.scrollCallback, this);
- this.scrollHandler = __bind(this.scrollHandler, this);
- this.start = __bind(this.start, this);
- this.scrolled = true;
- this.config = this.util().extend(options, this.defaults);
- this.animationNameCache = new WeakMap();
- }
- WOW.prototype.init = function() {
- var _ref;
- this.element = window.document.documentElement;
- if ((_ref = document.readyState) === "interactive" || _ref === "complete") {
- this.start();
- } else {
- this.util().addEvent(document, 'DOMContentLoaded', this.start);
- }
- return this.finished = [];
- };
- WOW.prototype.start = function() {
- var box, _i, _len, _ref;
- this.stopped = false;
- this.boxes = (function() {
- var _i, _len, _ref, _results;
- _ref = this.element.querySelectorAll("." + this.config.boxClass);
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- _results.push(box);
- }
- return _results;
- }).call(this);
- this.all = (function() {
- var _i, _len, _ref, _results;
- _ref = this.boxes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- _results.push(box);
- }
- return _results;
- }).call(this);
- if (this.boxes.length) {
- if (this.disabled()) {
- this.resetStyle();
- } else {
- _ref = this.boxes;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- this.applyStyle(box, true);
- }
- this.util().addEvent(window, 'scroll', this.scrollHandler);
- this.util().addEvent(window, 'resize', this.scrollHandler);
- this.interval = setInterval(this.scrollCallback, 50);
- }
- }
- if (this.config.live) {
- return new MutationObserver((function(_this) {
- return function(records) {
- var node, record, _j, _len1, _results;
- _results = [];
- for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
- record = records[_j];
- _results.push((function() {
- var _k, _len2, _ref1, _results1;
- _ref1 = record.addedNodes || [];
- _results1 = [];
- for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
- node = _ref1[_k];
- _results1.push(this.doSync(node));
- }
- return _results1;
- }).call(_this));
- }
- return _results;
- };
- })(this)).observe(document.body, {
- childList: true,
- subtree: true
- });
- }
- };
- WOW.prototype.stop = function() {
- this.stopped = true;
- this.util().removeEvent(window, 'scroll', this.scrollHandler);
- this.util().removeEvent(window, 'resize', this.scrollHandler);
- if (this.interval != null) {
- return clearInterval(this.interval);
- }
- };
- WOW.prototype.sync = function(element) {
- if (MutationObserver.notSupported) {
- return this.doSync(this.element);
- }
- };
- WOW.prototype.doSync = function(element) {
- var box, _i, _len, _ref, _results;
- if (element == null) {
- element = this.element;
- }
- if (element.nodeType !== 1) {
- return;
- }
- element = element.parentNode || element;
- _ref = element.querySelectorAll("." + this.config.boxClass);
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- if (__indexOf.call(this.all, box) < 0) {
- this.boxes.push(box);
- this.all.push(box);
- if (this.stopped || this.disabled()) {
- this.resetStyle();
- } else {
- this.applyStyle(box, true);
- }
- _results.push(this.scrolled = true);
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
- WOW.prototype.show = function(box) {
- this.applyStyle(box);
- return box.className = "" + box.className + " " + this.config.animateClass;
- };
- WOW.prototype.applyStyle = function(box, hidden) {
- var delay, duration, iteration;
- duration = box.getAttribute('data-wow-duration');
- delay = box.getAttribute('data-wow-delay');
- iteration = box.getAttribute('data-wow-iteration');
- return this.animate((function(_this) {
- return function() {
- return _this.customStyle(box, hidden, duration, delay, iteration);
- };
- })(this));
- };
- WOW.prototype.animate = (function() {
- if ('requestAnimationFrame' in window) {
- return function(callback) {
- return window.requestAnimationFrame(callback);
- };
- } else {
- return function(callback) {
- return callback();
- };
- }
- })();
- WOW.prototype.resetStyle = function() {
- var box, _i, _len, _ref, _results;
- _ref = this.boxes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- _results.push(box.style.visibility = 'visible');
- }
- return _results;
- };
- WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
- if (hidden) {
- this.cacheAnimationName(box);
- }
- box.style.visibility = hidden ? 'hidden' : 'visible';
- if (duration) {
- this.vendorSet(box.style, {
- animationDuration: duration
- });
- }
- if (delay) {
- this.vendorSet(box.style, {
- animationDelay: delay
- });
- }
- if (iteration) {
- this.vendorSet(box.style, {
- animationIterationCount: iteration
- });
- }
- this.vendorSet(box.style, {
- animationName: hidden ? 'none' : this.cachedAnimationName(box)
- });
- return box;
- };
- WOW.prototype.vendors = ["moz", "webkit"];
- WOW.prototype.vendorSet = function(elem, properties) {
- var name, value, vendor, _results;
- _results = [];
- for (name in properties) {
- value = properties[name];
- elem["" + name] = value;
- _results.push((function() {
- var _i, _len, _ref, _results1;
- _ref = this.vendors;
- _results1 = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- vendor = _ref[_i];
- _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
- }
- return _results1;
- }).call(this));
- }
- return _results;
- };
- WOW.prototype.vendorCSS = function(elem, property) {
- var result, style, vendor, _i, _len, _ref;
- style = getComputedStyle(elem);
- result = style.getPropertyCSSValue(property);
- _ref = this.vendors;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- vendor = _ref[_i];
- result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
- }
- return result;
- };
- WOW.prototype.animationName = function(box) {
- var animationName;
- try {
- animationName = this.vendorCSS(box, 'animation-name').cssText;
- } catch (_error) {
- animationName = getComputedStyle(box).getPropertyValue('animation-name');
- }
- if (animationName === 'none') {
- return '';
- } else {
- return animationName;
- }
- };
- WOW.prototype.cacheAnimationName = function(box) {
- return this.animationNameCache.set(box, this.animationName(box));
- };
- WOW.prototype.cachedAnimationName = function(box) {
- return this.animationNameCache.get(box);
- };
- WOW.prototype.scrollHandler = function() {
- return this.scrolled = true;
- };
- WOW.prototype.scrollCallback = function() {
- var box;
- if (this.scrolled) {
- this.scrolled = false;
- this.boxes = (function() {
- var _i, _len, _ref, _results;
- _ref = this.boxes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- if (!(box)) {
- continue;
- }
- if (this.isVisible(box)) {
- this.show(box);
- continue;
- }
- _results.push(box);
- }
- return _results;
- }).call(this);
- if (!(this.boxes.length || this.config.live)) {
- return this.stop();
- }
- }
- };
- WOW.prototype.offsetTop = function(element) {
- var top;
- while (element.offsetTop === void 0) {
- element = element.parentNode;
- }
- top = element.offsetTop;
- while (element = element.offsetParent) {
- top += element.offsetTop;
- }
- return top;
- };
- WOW.prototype.isVisible = function(box) {
- var bottom, offset, top, viewBottom, viewTop;
- offset = box.getAttribute('data-wow-offset') || this.config.offset;
- viewTop = window.pageYOffset;
- viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
- top = this.offsetTop(box);
- bottom = top + box.clientHeight;
- return top <= viewBottom && bottom >= viewTop;
- };
- WOW.prototype.util = function() {
- return this._util != null ? this._util : this._util = new Util();
- };
- WOW.prototype.disabled = function() {
- return !this.config.mobile && this.util().isMobile(navigator.userAgent);
- };
- return WOW;
- })();
- }).call(this);
- // ------------- JQUERY SMOOTHSTATE ----------------------------------------- //
- // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
- // -------------------------------------------------------------------------- //
- ;(function ( $, window, document, undefined ) {
- "use strict";
- var
- /** Used later to scroll page to the top */
- $body = $("html, body"),
-
- /** Used in development mode to console out useful warnings */
- consl = (window.console || false),
-
- /** Plugin default options */
- defaults = {
- /** jquery element string to specify which anchors smoothstate should bind to */
- anchors : "a",
- /** If set to true, smoothState will prefetch a link's contents on hover */
- prefetch : false,
-
- /** A selecor that deinfes with links should be ignored by smoothState */
- blacklist : ".no-smoothstate, [target]",
-
- /** If set to true, smoothState will log useful debug information instead of aborting */
- development : false,
-
- /** The number of pages smoothState will try to store in memory and not request again */
- pageCacheSize : 0,
-
- /** A function that can be used to alter urls before they are used to request content */
- alterRequestUrl : function (url) {
- return url;
- },
-
- /** Run when a link has been activated */
- onStart : {
- duration: 0,
- render: function (url, $container) {
- $body.scrollTop(0);
- }
- },
- /** Run if the page request is still pending and onStart has finished animating */
- onProgress : {
- duration: 0,
- render: function (url, $container) {
- $body.css("cursor", "wait");
- $body.find("a").css("cursor", "wait");
- }
- },
- /** Run when requested content is ready to be injected into the page */
- onEnd : {
- duration: 0,
- render: function (url, $container, $content) {
- $body.css("cursor", "auto");
- $body.find("a").css("cursor", "auto");
- $container.html($content);
- }
- },
- /** Run when content has been injected and all animations are complete */
- callback : function(url, $container, $content) {
- }
- },
-
- /** Utility functions that are decoupled from SmoothState */
- utility = {
- /**
- * Checks to see if the url is external
- * @param {string} url - url being evaluated
- * @see http://stackoverflow.com/questions/6238351/fastest-way-to-detect-external-urls
- *
- */
- isExternal: function (url) {
- var match = url.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);
- if (typeof match[1] === "string" && match[1].length > 0 && match[1].toLowerCase() !== window.location.protocol) {
- return true;
- }
- if (typeof match[2] === "string" && match[2].length > 0 && match[2].replace(new RegExp(":(" + {"http:": 80, "https:": 443}[window.location.protocol] + ")?$"), "") !== window.location.host) {
- return true;
- }
- return false;
- },
- /**
- * Checks to see if the url is an internal hash
- * @param {string} url - url being evaluated
- *
- */
- isHash: function (url) {
- var hasPathname = (url.indexOf(window.location.pathname) > 0) ? true : false,
- hasHash = (url.indexOf("#") > 0) ? true : false;
- return (hasPathname && hasHash) ? true : false;
- },
- /**
- * Checks to see if we should be loading this URL
- * @param {string} url - url being evaluated
- * @param {string} blacklist - jquery selector
- *
- */
- shouldLoad: function ($anchor, blacklist) {
- var url = $anchor.prop("href");
- // URL will only be loaded if it"s not an external link, hash, or blacklisted
- return (!utility.isExternal(url) && !utility.isHash(url) && !$anchor.is(blacklist));
- },
- /**
- * Prevents jQuery from stripping elements from $(html)
- * @param {string} url - url being evaluated
- * @author Ben Alman http://benalman.com/
- * @see https://gist.github.com/cowboy/742952
- *
- */
- htmlDoc: function (html) {
- var parent,
- elems = $(),
- matchTag = /<(\/?)(html|head|body|title|base|meta)(\s+[^>]*)?>/ig,
- prefix = "ss" + Math.round(Math.random() * 100000),
- htmlParsed = html.replace(matchTag, function(tag, slash, name, attrs) {
- var obj = {};
- if (!slash) {
- elems = elems.add("<" + name + "/>");
- if (attrs) {
- $.each($("<div" + attrs + "/>")[0].attributes, function(i, attr) {
- obj[attr.name] = attr.value;
- });
- }
- elems.eq(-1).attr(obj);
- }
- return "<" + slash + "div" + (slash ? "" : " id='" + prefix + (elems.length - 1) + "'") + ">";
- });
- // If no placeholder elements were necessary, just return normal
- // jQuery-parsed HTML.
- if (!elems.length) {
- return $(html);
- }
- // Create parent node if it hasn"t been created yet.
- if (!parent) {
- parent = $("<div/>");
- }
- // Create the parent node and append the parsed, place-held HTML.
- parent.html(htmlParsed);
-
- // Replace each placeholder element with its intended element.
- $.each(elems, function(i) {
- var elem = parent.find("#" + prefix + i).before(elems[i]);
- elems.eq(i).html(elem.contents());
- elem.remove();
- });
- return parent.children().unwrap();
- },
- /**
- * Resets an object if it has too many properties
- *
- * This is used to clear the "cache" object that stores
- * all of the html. This would prevent the client from
- * running out of memory and allow the user to hit the
- * server for a fresh copy of the content.
- *
- * @param {object} obj
- * @param {number} cap
- *
- */
- clearIfOverCapacity: function (obj, cap) {
- // Polyfill Object.keys if it doesn"t exist
- if (!Object.keys) {
- Object.keys = function (obj) {
- var keys = [],
- k;
- for (k in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, k)) {
- keys.push(k);
- }
- }
- return keys;
- };
- }
- if (Object.keys(obj).length > cap) {
- obj = {};
- }
- return obj;
- },
- /**
- * Finds the inner content of an element, by an ID, from a jQuery object
- * @param {string} id
- * @param {object} $html
- *
- */
- getContentById: function (id, $html) {
- $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
- var $insideElem = $html.find(id),
- updatedContainer = ($insideElem.length) ? $.trim($insideElem.html()) : $html.filter(id).html(),
- newContent = (updatedContainer.length) ? $(updatedContainer) : null;
- return newContent;
- },
- /**
- * Stores html content as jquery object in given object
- * @param {object} object - object contents will be stored into
- * @param {string} url - url to be used as the prop
- * @param {jquery} html - contents to store
- *
- */
- storePageIn: function (object, url, $html) {
- $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
- object[url] = { // Content is indexed by the url
- status: "loaded",
- title: $html.find("title").text(), // Stores the title of the page
- html: $html // Stores the contents of the page
- };
- return object;
- },
- /**
- * Triggers an "allanimationend" event when all animations are complete
- * @param {object} $element - jQuery object that should trigger event
- * @param {string} resetOn - which other events to trigger allanimationend on
- *
- */
- triggerAllAnimationEndEvent: function ($element, resetOn) {
- resetOn = " " + resetOn || "";
- var animationCount = 0,
- animationstart = "animationstart webkitAnimationStart oanimationstart MSAnimationStart",
- animationend = "animationend webkitAnimationEnd oanimationend MSAnimationEnd",
- eventname = "allanimationend",
- onAnimationStart = function (e) {
- if ($(e.delegateTarget).is($element)) {
- e.stopPropagation();
- animationCount ++;
- }
- },
- onAnimationEnd = function (e) {
- if ($(e.delegateTarget).is($element)) {
- e.stopPropagation();
- animationCount --;
- if(animationCount === 0) {
- $element.trigger(eventname);
- }
- }
- };
- $element.on(animationstart, onAnimationStart);
- $element.on(animationend, onAnimationEnd);
- $element.on("allanimationend" + resetOn, function(){
- animationCount = 0;
- utility.redraw($element);
- });
- },
- /** Forces browser to redraw elements */
- redraw: function ($element) {
- $element.height(0);
- setTimeout(function(){$element.height("auto");}, 0);
- }
- },
- /** Handles the popstate event, like when the user hits "back" */
- onPopState = function ( e ) {
- if(e.state !== null) {
- var url = window.location.href,
- $page = $("#" + e.state.id),
- page = $page.data("smoothState");
-
- if(page.href !== url && !utility.isHash(url)) {
- page.load(url, true);
- }
- }
- },
- /** Constructor function */
- SmoothState = function ( element, options ) {
- var
- /** Container element smoothState is run on */
- $container = $(element),
-
- /** Variable that stores pages after they are requested */
- cache = {},
-
- /** Url of the content that is currently displayed */
- currentHref = window.location.href,
- /**
- * Loads the contents of a url into our container
- *
- * @param {string} url
- * @param {bool} isPopped - used to determine if whe should
- * add a new item into the history object
- *
- */
- load = function (url, isPopped) {
-
- /** Makes this an optional variable by setting a default */
- isPopped = isPopped || false;
- var
- /** Used to check if the onProgress function has been run */
- hasRunCallback = false,
- callbBackEnded = false,
-
- /** List of responses for the states of the page request */
- responses = {
- /** Page is ready, update the content */
- loaded: function() {
- var eventName = hasRunCallback ? "ss.onProgressEnd" : "ss.onStartEnd";
- if(!callbBackEnded || !hasRunCallback) {
- $container.one(eventName, function(){
- updateContent(url);
- });
- } else if(callbBackEnded) {
- updateContent(url);
- }
- if(!isPopped) {
- window.history.pushState({ id: $container.prop("id") }, cache[url].title, url);
- }
- },
- /** Loading, wait 10 ms and check again */
- fetching: function() {
-
- if(!hasRunCallback) {
-
- hasRunCallback = true;
-
- // Run the onProgress callback and set trigger
- $container.one("ss.onStartEnd", function(){
- options.onProgress.render(url, $container, null);
-
- setTimeout(function(){
- $container.trigger("ss.onProgressEnd");
- callbBackEnded = true;
- }, options.onStart.duration);
-
- });
- }
-
- setTimeout(function () {
- // Might of been canceled, better check!
- if(cache.hasOwnProperty(url)){
- responses[cache[url].status]();
- }
- }, 10);
- },
- /** Error, abort and redirect */
- error: function(){
- window.location = url;
- }
- };
-
- if (!cache.hasOwnProperty(url)) {
- fetch(url);
- }
-
- // Run the onStart callback and set trigger
- options.onStart.render(url, $container, null);
- setTimeout(function(){
- $container.trigger("ss.onStartEnd");
- }, options.onStart.duration);
- // Start checking for the status of content
- responses[cache[url].status]();
- },
- /** Updates the contents from cache[url] */
- updateContent = function (url) {
- // If the content has been requested and is done:
- var containerId = "#" + $container.prop("id"),
- $content = cache[url] ? utility.getContentById(containerId, cache[url].html) : null;
- if($content) {
- document.title = cache[url].title;
- $container.data("smoothState").href = url;
-
- // Call the onEnd callback and set trigger
- options.onEnd.render(url, $container, $content);
- $container.one("ss.onEndEnd", function(){
- options.callback(url, $container, $content);
- });
- setTimeout(function(){
- $container.trigger("ss.onEndEnd");
- }, options.onEnd.duration);
- } else if (!$content && options.development && consl) {
- // Throw warning to help debug in development mode
- consl.warn("No element with an id of " + containerId + " in response from " + url + " in " + cache);
- } else {
- // No content availble to update with, aborting...
- window.location = url;
- }
- },
- /**
- * Fetches the contents of a url and stores it in the "cache" varible
- * @param {string} url
- *
- */
- fetch = function (url) {
- // Don"t fetch we have the content already
- if(cache.hasOwnProperty(url)) {
- return;
- }
- cache = utility.clearIfOverCapacity(cache, options.pageCacheSize);
-
- cache[url] = { status: "fetching" };
- var requestUrl = options.alterRequestUrl(url) || url,
- request = $.ajax(requestUrl);
- // Store contents in cache variable if successful
- request.success(function (html) {
- // Clear cache varible if it"s getting too big
- utility.storePageIn(cache, url, html);
- $container.data("smoothState").cache = cache;
- });
- // Mark as error
- request.error(function () {
- cache[url].status = "error";
- });
- },
- /**
- * Binds to the hover event of a link, used for prefetching content
- *
- * @param {object} event
- *
- */
- hoverAnchor = function (event) {
- var $anchor = $(event.currentTarget),
- url = $anchor.prop("href");
- if (utility.shouldLoad($anchor, options.blacklist)) {
- event.stopPropagation();
- fetch(url);
- }
- },
- /**
- * Binds to the click event of a link, used to show the content
- *
- * @param {object} event
- *
- */
- clickAnchor = function (event) {
- var $anchor = $(event.currentTarget),
- url = $anchor.prop("href");
- // Ctrl (or Cmd) + click must open a new tab
- if (!event.metaKey && !event.ctrlKey && utility.shouldLoad($anchor, options.blacklist)) {
- // stopPropagation so that event doesn"t fire on parent containers.
- event.stopPropagation();
- event.preventDefault();
- load(url);
- }
- },
- /**
- * Binds all events and inits functionality
- *
- * @param {object} event
- *
- */
- bindEventHandlers = function ($element) {
- //@todo: Handle form submissions
- $element.on("click", options.anchors, clickAnchor);
- if (options.prefetch) {
- $element.on("mouseover touchstart", options.anchors, hoverAnchor);
- }
- },
- /** Used to restart css animations with a class */
- toggleAnimationClass = function (classname) {
- var classes = $container.addClass(classname).prop("class");
-
- $container.removeClass(classes);
-
- setTimeout(function(){
- $container.addClass(classes);
- },0);
- $container.one("ss.onStartEnd ss.onProgressEnd ss.onEndEnd", function(){
- $container.removeClass(classname);
- });
-
- };
- /** Override defaults with options passed in */
- options = $.extend(defaults, options);
- /** Sets a default state */
- if(window.history.state === null) {
- window.history.replaceState({ id: $container.prop("id") }, document.title, currentHref);
- }
- /** Stores the current page in cache variable */
- utility.storePageIn(cache, currentHref, document.documentElement.outerHTML);
- /** Bind all of the event handlers on the container, not anchors */
- utility.triggerAllAnimationEndEvent($container, "ss.onStartEnd ss.onProgressEnd ss.onEndEnd");
- /** Bind all of the event handlers on the container, not anchors */
- bindEventHandlers($container);
- /** Public methods */
- return {
- href: currentHref,
- cache: cache,
- load: load,
- fetch: fetch,
- toggleAnimationClass: toggleAnimationClass
- };
- },
- /** Returns elements with SmoothState attached to it */
- declareSmoothState = function ( options ) {
- return this.each(function () {
- // Checks to make sure the smoothState element has an id and isn"t already bound
- if(this.id && !$.data(this, "smoothState")) {
- // Makes public methods available via $("element").data("smoothState");
- $.data(this, "smoothState", new SmoothState(this, options));
- } else if (!this.id && consl) {
- // Throw warning if in development mode
- consl.warn("Every smoothState container needs an id but the following one does not have one:", this);
- }
- });
- };
- /** Sets the popstate function */
- window.onpopstate = onPopState;
- /** Makes utility functions public for unit tests */
- $.smoothStateUtility = utility;
- /** Defines the smoothState plugin */
- $.fn.smoothState = declareSmoothState;
- })(jQuery, window, document);
- // ------------- jQuery Cookie Plugin v1.4.1 -------------------------------- //
- // ============ https://github.com/carhartl/jquery-cookie =================== //
- // -------------------------------------------------------------------------- //
- (function (factory) {
- if (typeof define === 'function' && define.amd) {
- // AMD
- define(['jquery'], factory);
- } else if (typeof exports === 'object') {
- // CommonJS
- factory(require('jquery'));
- } else {
- // Browser globals
- factory(jQuery);
- }
- }(function ($) {
- var pluses = /\+/g;
- function encode(s) {
- return config.raw ? s : encodeURIComponent(s);
- }
- function decode(s) {
- return config.raw ? s : decodeURIComponent(s);
- }
- function stringifyCookieValue(value) {
- return encode(config.json ? JSON.stringify(value) : String(value));
- }
- function parseCookieValue(s) {
- if (s.indexOf('"') === 0) {
- // This is a quoted cookie as according to RFC2068, unescape...
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
- }
- try {
- // Replace server-side written pluses with spaces.
- // If we can't decode the cookie, ignore it, it's unusable.
- // If we can't parse the cookie, ignore it, it's unusable.
- s = decodeURIComponent(s.replace(pluses, ' '));
- return config.json ? JSON.parse(s) : s;
- } catch(e) {}
- }
- function read(s, converter) {
- var value = config.raw ? s : parseCookieValue(s);
- return $.isFunction(converter) ? converter(value) : value;
- }
- var config = $.cookie = function (key, value, options) {
- // Write
- if (arguments.length > 1 && !$.isFunction(value)) {
- options = $.extend({}, config.defaults, options);
- if (typeof options.expires === 'number') {
- var days = options.expires, t = options.expires = new Date();
- t.setTime(+t + days * 864e+5);
- }
- return (document.cookie = [
- encode(key), '=', stringifyCookieValue(value),
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
- options.path ? '; path=' + options.path : '',
- options.domain ? '; domain=' + options.domain : '',
- options.secure ? '; secure' : ''
- ].join(''));
- }
- // Read
- var result = key ? undefined : {};
- // To prevent the for loop in the first place assign an empty array
- // in case there are no cookies at all. Also prevents odd result when
- // calling $.cookie().
- var cookies = document.cookie ? document.cookie.split('; ') : [];
- for (var i = 0, l = cookies.length; i < l; i++) {
- var parts = cookies[i].split('=');
- var name = decode(parts.shift());
- var cookie = parts.join('=');
- if (key && key === name) {
- // If second argument (value) is a function it's a converter...
- result = read(cookie, value);
- break;
- }
- // Prevent storing a cookie that we couldn't decode.
- if (!key && (cookie = read(cookie)) !== undefined) {
- result[name] = cookie;
- }
- }
- return result;
- };
- config.defaults = {};
- $.removeCookie = function (key, options) {
- if ($.cookie(key) === undefined) {
- return false;
- }
- // Must not alter options, thus extending a fresh object...
- $.cookie(key, '', $.extend({}, options, { expires: -1 }));
- return !$.cookie(key);
- };
- }));
- // ----------------- jQuery Waypoints v2.0.5 -------------------------------- //
- // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
- // -------------------------------------------------------------------------- //
- (function() {
- var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
- __slice = [].slice;
- (function(root, factory) {
- if (typeof define === 'function' && define.amd) {
- return define('waypoints', ['jquery'], function($) {
- return factory($, root);
- });
- } else {
- return factory(root.jQuery, root);
- }
- })(window, function($, window) {
- var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
- $w = $(window);
- isTouch = __indexOf.call(window, 'ontouchstart') >= 0;
- allWaypoints = {
- horizontal: {},
- vertical: {}
- };
- contextCounter = 1;
- contexts = {};
- contextKey = 'waypoints-context-id';
- resizeEvent = 'resize.waypoints';
- scrollEvent = 'scroll.waypoints';
- waypointCounter = 1;
- waypointKey = 'waypoints-waypoint-ids';
- wp = 'waypoint';
- wps = 'waypoints';
- Context = (function() {
- function Context($element) {
- var _this = this;
- this.$element = $element;
- this.element = $element[0];
- this.didResize = false;
- this.didScroll = false;
- this.id = 'context' + contextCounter++;
- this.oldScroll = {
- x: $element.scrollLeft(),
- y: $element.scrollTop()
- };
- this.waypoints = {
- horizontal: {},
- vertical: {}
- };
- this.element[contextKey] = this.id;
- contexts[this.id] = this;
- $element.bind(scrollEvent, function() {
- var scrollHandler;
- if (!(_this.didScroll || isTouch)) {
- _this.didScroll = true;
- scrollHandler = function() {
- _this.doScroll();
- return _this.didScroll = false;
- };
- return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
- }
- });
- $element.bind(resizeEvent, function() {
- var resizeHandler;
- if (!_this.didResize) {
- _this.didResize = true;
- resizeHandler = function() {
- $[wps]('refresh');
- return _this.didResize = false;
- };
- return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
- }
- });
- }
- Context.prototype.doScroll = function() {
- var axes,
- _this = this;
- axes = {
- horizontal: {
- newScroll: this.$element.scrollLeft(),
- oldScroll: this.oldScroll.x,
- forward: 'right',
- backward: 'left'
- },
- vertical: {
- newScroll: this.$element.scrollTop(),
- oldScroll: this.oldScroll.y,
- forward: 'down',
- backward: 'up'
- }
- };
- if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) {
- $[wps]('refresh');
- }
- $.each(axes, function(aKey, axis) {
- var direction, isForward, triggered;
- triggered = [];
- isForward = axis.newScroll > axis.oldScroll;
- direction = isForward ? axis.forward : axis.backward;
- $.each(_this.waypoints[aKey], function(wKey, waypoint) {
- var _ref, _ref1;
- if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) {
- return triggered.push(waypoint);
- } else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) {
- return triggered.push(waypoint);
- }
- });
- triggered.sort(function(a, b) {
- return a.offset - b.offset;
- });
- if (!isForward) {
- triggered.reverse();
- }
- return $.each(triggered, function(i, waypoint) {
- if (waypoint.options.continuous || i === triggered.length - 1) {
- return waypoint.trigger([direction]);
- }
- });
- });
- return this.oldScroll = {
- x: axes.horizontal.newScroll,
- y: axes.vertical.newScroll
- };
- };
- Context.prototype.refresh = function() {
- var axes, cOffset, isWin,
- _this = this;
- isWin = $.isWindow(this.element);
- cOffset = this.$element.offset();
- this.doScroll();
- axes = {
- horizontal: {
- contextOffset: isWin ? 0 : cOffset.left,
- contextScroll: isWin ? 0 : this.oldScroll.x,
- contextDimension: this.$element.width(),
- oldScroll: this.oldScroll.x,
- forward: 'right',
- backward: 'left',
- offsetProp: 'left'
- },
- vertical: {
- contextOffset: isWin ? 0 : cOffset.top,
- contextScroll: isWin ? 0 : this.oldScroll.y,
- contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(),
- oldScroll: this.oldScroll.y,
- forward: 'down',
- backward: 'up',
- offsetProp: 'top'
- }
- };
- return $.each(axes, function(aKey, axis) {
- return $.each(_this.waypoints[aKey], function(i, waypoint) {
- var adjustment, elementOffset, oldOffset, _ref, _ref1;
- adjustment = waypoint.options.offset;
- oldOffset = waypoint.offset;
- elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp];
- if ($.isFunction(adjustment)) {
- adjustment = adjustment.apply(waypoint.element);
- } else if (typeof adjustment === 'string') {
- adjustment = parseFloat(adjustment);
- if (waypoint.options.offset.indexOf('%') > -1) {
- adjustment = Math.ceil(axis.contextDimension * adjustment / 100);
- }
- }
- waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
- if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) {
- return;
- }
- if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) {
- return waypoint.trigger([axis.backward]);
- } else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) {
- return waypoint.trigger([axis.forward]);
- } else if (oldOffset === null && axis.oldScroll >= waypoint.offset) {
- return waypoint.trigger([axis.forward]);
- }
- });
- });
- };
- Context.prototype.checkEmpty = function() {
- if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) {
- this.$element.unbind([resizeEvent, scrollEvent].join(' '));
- return delete contexts[this.id];
- }
- };
- return Context;
- })();
- Waypoint = (function() {
- function Waypoint($element, context, options) {
- var idList, _ref;
- if (options.offset === 'bottom-in-view') {
- options.offset = function() {
- var contextHeight;
- contextHeight = $[wps]('viewportHeight');
- if (!$.isWindow(context.element)) {
- contextHeight = context.$element.height();
- }
- return contextHeight - $(this).outerHeight();
- };
- }
- this.$element = $element;
- this.element = $element[0];
- this.axis = options.horizontal ? 'horizontal' : 'vertical';
- this.callback = options.handler;
- this.context = context;
- this.enabled = options.enabled;
- this.id = 'waypoints' + waypointCounter++;
- this.offset = null;
- this.options = options;
- context.waypoints[this.axis][this.id] = this;
- allWaypoints[this.axis][this.id] = this;
- idList = (_ref = this.element[waypointKey]) != null ? _ref : [];
- idList.push(this.id);
- this.element[waypointKey] = idList;
- }
- Waypoint.prototype.trigger = function(args) {
- if (!this.enabled) {
- return;
- }
- if (this.callback != null) {
- this.callback.apply(this.element, args);
- }
- if (this.options.triggerOnce) {
- return this.destroy();
- }
- };
- Waypoint.prototype.disable = function() {
- return this.enabled = false;
- };
- Waypoint.prototype.enable = function() {
- this.context.refresh();
- return this.enabled = true;
- };
- Waypoint.prototype.destroy = function() {
- delete allWaypoints[this.axis][this.id];
- delete this.context.waypoints[this.axis][this.id];
- return this.context.checkEmpty();
- };
- Waypoint.getWaypointsByElement = function(element) {
- var all, ids;
- ids = element[waypointKey];
- if (!ids) {
- return [];
- }
- all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
- return $.map(ids, function(id) {
- return all[id];
- });
- };
- return Waypoint;
- })();
- methods = {
- init: function(f, options) {
- var _ref;
- options = $.extend({}, $.fn[wp].defaults, options);
- if ((_ref = options.handler) == null) {
- options.handler = f;
- }
- this.each(function() {
- var $this, context, contextElement, _ref1;
- $this = $(this);
- contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context;
- if (!$.isWindow(contextElement)) {
- contextElement = $this.closest(contextElement);
- }
- contextElement = $(contextElement);
- context = contexts[contextElement[0][contextKey]];
- if (!context) {
- context = new Context(contextElement);
- }
- return new Waypoint($this, context, options);
- });
- $[wps]('refresh');
- return this;
- },
- disable: function() {
- return methods._invoke.call(this, 'disable');
- },
- enable: function() {
- return methods._invoke.call(this, 'enable');
- },
- destroy: function() {
- return methods._invoke.call(this, 'destroy');
- },
- prev: function(axis, selector) {
- return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
- if (index > 0) {
- return stack.push(waypoints[index - 1]);
- }
- });
- },
- next: function(axis, selector) {
- return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
- if (index < waypoints.length - 1) {
- return stack.push(waypoints[index + 1]);
- }
- });
- },
- _traverse: function(axis, selector, push) {
- var stack, waypoints;
- if (axis == null) {
- axis = 'vertical';
- }
- if (selector == null) {
- selector = window;
- }
- waypoints = jQMethods.aggregate(selector);
- stack = [];
- this.each(function() {
- var index;
- index = $.inArray(this, waypoints[axis]);
- return push(stack, index, waypoints[axis]);
- });
- return this.pushStack(stack);
- },
- _invoke: function(method) {
- this.each(function() {
- var waypoints;
- waypoints = Waypoint.getWaypointsByElement(this);
- return $.each(waypoints, function(i, waypoint) {
- waypoint[method]();
- return true;
- });
- });
- return this;
- }
- };
- $.fn[wp] = function() {
- var args, method;
- method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
- if (methods[method]) {
- return methods[method].apply(this, args);
- } else if ($.isFunction(method)) {
- return methods.init.apply(this, arguments);
- } else if ($.isPlainObject(method)) {
- return methods.init.apply(this, [null, method]);
- } else if (!method) {
- return $.error("jQuery Waypoints needs a callback function or handler option.");
- } else {
- return $.error("The " + method + " method does not exist in jQuery Waypoints.");
- }
- };
- $.fn[wp].defaults = {
- context: window,
- continuous: true,
- enabled: true,
- horizontal: false,
- offset: 0,
- triggerOnce: false
- };
- jQMethods = {
- refresh: function() {
- return $.each(contexts, function(i, context) {
- return context.refresh();
- });
- },
- viewportHeight: function() {
- var _ref;
- return (_ref = window.innerHeight) != null ? _ref : $w.height();
- },
- aggregate: function(contextSelector) {
- var collection, waypoints, _ref;
- collection = allWaypoints;
- if (contextSelector) {
- collection = (_ref = contexts[$(contextSelector)[0][contextKey]]) != null ? _ref.waypoints : void 0;
- }
- if (!collection) {
- return [];
- }
- waypoints = {
- horizontal: [],
- vertical: []
- };
- $.each(waypoints, function(axis, arr) {
- $.each(collection[axis], function(key, waypoint) {
- return arr.push(waypoint);
- });
- arr.sort(function(a, b) {
- return a.offset - b.offset;
- });
- waypoints[axis] = $.map(arr, function(waypoint) {
- return waypoint.element;
- });
- return waypoints[axis] = $.unique(waypoints[axis]);
- });
- return waypoints;
- },
- above: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
- return waypoint.offset <= context.oldScroll.y;
- });
- },
- below: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
- return waypoint.offset > context.oldScroll.y;
- });
- },
- left: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
- return waypoint.offset <= context.oldScroll.x;
- });
- },
- right: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
- return waypoint.offset > context.oldScroll.x;
- });
- },
- enable: function() {
- return jQMethods._invoke('enable');
- },
- disable: function() {
- return jQMethods._invoke('disable');
- },
- destroy: function() {
- return jQMethods._invoke('destroy');
- },
- extendFn: function(methodName, f) {
- return methods[methodName] = f;
- },
- _invoke: function(method) {
- var waypoints;
- waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
- return $.each(waypoints, function(key, waypoint) {
- waypoint[method]();
- return true;
- });
- },
- _filter: function(selector, axis, test) {
- var context, waypoints;
- context = contexts[$(selector)[0][contextKey]];
- if (!context) {
- return [];
- }
- waypoints = [];
- $.each(context.waypoints[axis], function(i, waypoint) {
- if (test(context, waypoint)) {
- return waypoints.push(waypoint);
- }
- });
- waypoints.sort(function(a, b) {
- return a.offset - b.offset;
- });
- return $.map(waypoints, function(waypoint) {
- return waypoint.element;
- });
- }
- };
- $[wps] = function() {
- var args, method;
- method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
- if (jQMethods[method]) {
- return jQMethods[method].apply(null, args);
- } else {
- return jQMethods.aggregate.call(null, method);
- }
- };
- $[wps].settings = {
- resizeThrottle: 100,
- scrollThrottle: 30
- };
- return $w.on('load.waypoints', function() {
- return $[wps]('refresh');
- });
- });
- }).call(this);
- // ----------------- jQuery Github Embedder ----------------------------- //
- // =========== https://github.com/kirbysayshi/ghembedder =============== //
- // ---------------------------------------------------------------------- //
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ghembedder=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var ghe=module.exports={_apiBase:"https://api.github.com",_library:{},_rLeadSlash:/^\/+|\/+$/g,_rWhiteSpace:/\s/g};ghe._decodeContent=function(content){var decoded=window.atob(content.replace(ghe._rWhiteSpace,""));return decoded};ghe._keygen=function(){return"ghembedder_key_"+~~(Math.random()*1e5)};ghe._jsonpCallback=function(key){return window[key]=function(resp){var lib=ghe._library[key],linenos=false,hasLineRange=lib.lineBegin>-1&&lib.lineEnd>-1,decoded,lines,nums,tabSpace=new Array(lib.tabSize+1).join(" ");if(resp.data&&resp.data.content){lib.data=resp.data;decoded=ghe._decodeContent(resp.data.content);decoded=decoded.replace(/[&<>"'`]/g,function(){var chars={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};return function(match){return chars[match]}}());lines=decoded.split("\n");if(hasLineRange){lines=lines.splice(lib.lineBegin-1,lib.lineEnd-lib.lineBegin+1)}if(lib.linenos){linenos=hasLineRange?lib.lineBegin:lib.linenos}lines=lines.map(function(l,i){return'<a class="nocode" id="'+lib.fileName+"-L"+(i+lib.lineBegin)+'">'+(l?"":" ")+"</a>"+l.replace(/\t/gi,tabSpace)});decoded=lines.join("\n");if(exports.prettyPrintOne){decoded=exports.prettyPrintOne(decoded,lib.lang,linenos)}lib.el.className+=" ghe";lib.el.innerHTML='<pre><code data-language="javascript">'+decoded+"</code></pre>"+(lib.annotate?ghe._annotation(key):"");delete window[key];if(lib.onload){lib.onload(null,lib)}}}};ghe._annotation=function(key){var lib=ghe._library[key],hasLineRange=lib.lineBegin>-1&&lib.lineEnd>-1;return'<div class="ghe-annotation">'+lib.fileName+(hasLineRange?", lines "+lib.lineBegin+"-"+lib.lineEnd:"")+(lib.data?'. <a href="'+lib.data._links.html+'" target="_blank">Source</a>':"")+"</div>"};ghe._jsonp=function(fileUrl,cbName){var script=document.createElement("script");script.type="text/javascript";script.src=fileUrl+(fileUrl.indexOf("?")>-1?"&":"?")+"callback="+cbName;document.getElementsByTagName("head")[0].appendChild(script)};ghe._parseNode=function(el){var lines=el.getAttribute("data-ghlines"),path=el.getAttribute("data-ghpath"),start,end;if(lines&&lines.indexOf("-")>-1){lines=lines.split("-");start=parseInt(lines[0],10);end=parseInt(lines[1],10)}else if(lines){start=end=parseInt(lines,10)}else{start=end=-1}return{path:path,userrepo:el.getAttribute("data-ghuserrepo"),ref:el.getAttribute("data-ghref")||"master",lineBegin:start,lineEnd:end,el:el,fileName:path.split("/").pop(),lang:el.getAttribute("data-ghlang"),linenos:el.getAttribute("data-ghlinenos"),annotate:el.getAttribute("data-ghannotate"),tabSize:parseInt(el.getAttribute("data-ghtabsize"),10)||4}};ghe.load=function(cfg,opt_cb){var key=ghe._keygen();if(cfg.nodeName){cfg=ghe._parseNode(cfg)}if(opt_cb){cfg.onload=opt_cb}ghe._jsonpCallback(key);ghe._library[key]=cfg;ghe._jsonp(ghe._apiBase+"/repos/"+cfg.userrepo.replace(ghe._rLeadSlash,"")+"/contents/"+cfg.path.replace(ghe._rLeadSlash,"")+"?ref="+cfg.ref,key)};ghe.autoload=function(){var nodes;if(window.jQuery){nodes=window.jQuery("[data-ghpath]")}else{nodes=document.querySelectorAll("[data-ghpath]")}for(var i=0;i<nodes.length;i++){ghe.load(nodes[i])}}},{}]},{},[1])(1)});
- ghembedder.autoload();
- ;jQuery(document).ready(function($){
-
- var i = 0;
- var box_title_png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAXCAMAAAAx3e/WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJERkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJFMEM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkREQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRFQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+dka2KgAAAEVQTFRFxMTEyMjI0tLSvb29vr6+zc3Ny8vLxcXFz8/P6enp3t7ex8fH0dHR1NTUw8PDwMDAzs7OvLy8wcHBu7u7v7+/zMzM////budQFwAAABd0Uk5T/////////////////////////////wDmQOZeAAAAcklEQVR42tSQSQ7DMAwD6chOukWs5eX/Ty2coo0T9wOdEzEgdRBuzNmnDofgja52JDyz5TCqUp0O6kfrb4bzSXkRiTviEZZ6JKLMJ5VQ2v8iGbtbfEwXmjFMG0VwdQo10hQNxYqtLMv9O6xvpZ/QeAkwAKjwHiJLaJc3AAAAAElFTkSuQmCC';
- var stats_png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAqCAMAAACEJ4viAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJEQkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJEQ0M0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkQ5QzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRBQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+h1kA9gAAAK5QTFRF+fn5sbGx8fHx09PTmpqa2dnZ/f3919fX9PT00NDQ1dXVpKSk+vr6+/v7vb298vLyycnJ8/PztLS0zc3N6enp/v7+q6ur2NjY9/f3srKy/Pz8p6en7u7uoaGhnJyc4eHhtbW1pqam6Ojo9fX17e3toqKirKys1NTUzs7Ox8fHwcHBwMDA5eXlnZ2dpaWl0dHR9vb25ubm4uLi3d3dqqqqwsLCv7+/oKCgmZmZ////8yEsbwAAAMBJREFUeNrE0tcOgjAUBuDSliUoMhTEvfdef9//xUQjgaLX0Ium/ZLT/+SkRPxZpGykvuf5VMJogy5jY9yjDHcWFhqlcRuHc4o6B1QK0BDg+hcZgNDh3NWTwzItH/bRrhvT+g3zSxZkNGCZpoWGIbU0a3Y6zV5VA6keyeDxiw62P0gUqEW0FbDim4nVikFJbU2zZXybUEaxhCqOQqyh5/G0wpWICUwthyqwD4InOMuXJ7/gs7WkoPdVg1vykF8CDACEFanKO3aSYwAAAABJRU5ErkJggg==';
- $('.github-widget').each(function(){
- if(i == 0) $('head').append(
- '<style type="text/css">'
- +'.github-box *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}'
- +'.github-box{font-family:helvetica,arial,sans-serif;font-size:13px;line-height:18px;background:#fafafa;border:1px solid #ddd;color:#666;border-radius:3px}'
- +'.github-box a{color:#4183c4;border:0;text-decoration:none}'
- +'.github-box .github-box-title{position:relative;border-bottom:1px solid #ddd;border-radius:3px 3px 0 0;background:#fcfcfc;background:-moz-linear-gradient(#fcfcfc,#ebebeb);background:-webkit-linear-gradient(#fcfcfc,#ebebeb);}'
- +'.github-box .github-box-title h3{word-wrap:break-word;font-family:helvetica,arial,sans-serif;font-weight:normal;font-size:16px;color:gray;margin:0;padding:10px 10px 10px 30px;background:url('+box_title_png+') 7px center no-repeat; width: auto;}'
- +'.github-box .github-box-title h3 .repo{font-weight:bold}'
- +'.github-box .github-box-title .github-stats{float:right;position:absolute;top:8px;right:10px;font-size:11px;font-weight:bold;line-height:21px;height:auto;min-height:21px}'
- +'.github-box .github-box-title .github-stats a{display:inline-block;height:21px;color:#666;border:1px solid #ddd;border-radius:3px;padding:0 5px 0 18px;background: white url('+stats_png+') no-repeat}'
- +'.github-box .github-box-title .github-stats .watchers{border-right:1px solid #ddd}'
- +'.github-box .github-box-title .github-stats .forks{background-position:-4px -21px;padding-left:15px}'
- +'.github-box .github-box-content{padding:10px;font-weight:300}'
- +'.github-box .github-box-content p{margin:0}'
- +'.github-box .github-box-content .link{font-weight:bold}'
- +'.github-box .github-box-download{position:relative;border-top:1px solid #ddd;background:white;border-radius:0 0 3px 3px;padding:10px;height:auto;min-height:24px;}'
- +'.github-box .github-box-download .updated{word-wrap:break-word;margin:0;font-size:11px;color:#666;line-height:24px;font-weight:300;width:auto}'
- +'.github-box .github-box-download .updated strong{font-weight:bold;color:#000}'
- +'.github-box .github-box-download .download{float:right;position:absolute;top:10px;right:10px;height:24px;line-height:24px;font-size:12px;color:#666;font-weight:bold;text-shadow:0 1px 0 rgba(255,255,255,0.9);padding:0 10px;border:1px solid #ddd;border-bottom-color:#bbb;border-radius:3px;background:#f5f5f5;background:-moz-linear-gradient(#f5f5f5,#e5e5e5);background:-webkit-linear-gradient(#f5f5f5,#e5e5e5);}'
- +'.github-box .github-box-download .download:hover{color:#527894;border-color:#cfe3ed;border-bottom-color:#9fc7db;background:#f1f7fa;background:-moz-linear-gradient(#f1f7fa,#dbeaf1);background:-webkit-linear-gradient(#f1f7fa,#dbeaf1);}'
- +'@media (max-width: 767px) {'
- +'.github-box .github-box-title{height:auto;min-height:60px}'
- +'.github-box .github-box-title h3 .repo{display:block}'
- +'.github-box .github-box-title .github-stats a{display:block;clear:right;float:right;}'
- +'.github-box .github-box-download{height:auto;min-height:46px;}'
- +'.github-box .github-box-download .download{top:32px;}'
- +'}'
- +'</style>'
- );
- i++;
- var $container = $(this), $widget,
- repo = $container.data('repo'),
- vendorName = repo.split('/')[0],
- repoName = repo.split('/')[1],
- vendorUrl = "http://github.com/" + vendorName,
- repoUrl = "http://github.com/" + vendorName + '/' + repoName;
- $widget = $(
- '<div class="github-box repo">'
- +'<div class="github-box-title">'
- +'<h3>'
- +'<a class="owner" href="' + vendorUrl + '" title="' + vendorUrl + '">' + vendorName + '</a>'
- +'/'
- +'<a class="repo" href="' + repoUrl + '" title="' + repoUrl + '">' + repoName + '</a>'
- +'</h3>'
- +'<div class="github-stats">'
- +'<a class="watchers" href="' + repoUrl + '/watchers" title="See watchers">?</a>'
- +'<a class="forks" href="' + repoUrl + '/network/members" title="See forkers">?</a>'
- +'</div>'
- +'</div>'
- +'<div class="github-box-content">'
- +'<p class="description"><span></span> — <a href="' + repoUrl + '#readme">Read More</a></p>'
- +'<p class="link"></p>'
- +'</div>'
- +'<div class="github-box-download">'
- +'<div class="updated"></div>'
- +'<a class="download" href="' + repoUrl + '/zipball/master" title="Get an archive of this repository">Download as zip</a>'
- +'</div>'
- +'</div>'
- );
- $widget.appendTo($container);
- $.ajax({
- url: 'https://api.github.com/repos/' + repo,
- dataType: 'jsonp',
- success: function(results) {
- var repo = results.data, date, pushed_at = 'unknown';
- if (repo.pushed_at) {
- date = new Date(repo.pushed_at);
- pushed_at = (date.getMonth() + 1) + '-' + date.getDate() + '-' + date.getFullYear();
- }
- $widget.find('.watchers').text(repo.watchers);
- $widget.find('.forks').text(repo.forks);
- $widget.find('.description span').text(repo.description);
- $widget.find('.updated').html('Latest commit to the <strong>' + repo.default_branch + '</strong> branch on ' + pushed_at);
- // Don't show "null" if the repo has no homepage URL.
- if(repo.homepage != null) $widget.find('.link').append($('<a />').attr('href', repo.homepage).text(repo.homepage));
- }
- });
- });
- });
- // ----------------- JavaScript Cookie v2.2.0 ----------------------------- //
- // =========== https://github.com/js-cookie/js-cookie =============== //
- // ---------------------------------------------------------------------- //
- ;(function (factory) {
- var registeredInModuleLoader;
- if (typeof define === 'function' && define.amd) {
- define(factory);
- registeredInModuleLoader = true;
- }
- if (typeof exports === 'object') {
- module.exports = factory();
- registeredInModuleLoader = true;
- }
- if (!registeredInModuleLoader) {
- var OldCookies = window.Cookies;
- var api = window.Cookies = factory();
- api.noConflict = function () {
- window.Cookies = OldCookies;
- return api;
- };
- }
- }(function () {
- function extend () {
- var i = 0;
- var result = {};
- for (; i < arguments.length; i++) {
- var attributes = arguments[ i ];
- for (var key in attributes) {
- result[key] = attributes[key];
- }
- }
- return result;
- }
- function decode (s) {
- return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
- }
- function init (converter) {
- function api() {}
- function set (key, value, attributes) {
- if (typeof document === 'undefined') {
- return;
- }
- attributes = extend({
- path: '/'
- }, api.defaults, attributes);
- if (typeof attributes.expires === 'number') {
- attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
- }
- // We're using "expires" because "max-age" is not supported by IE
- attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
- try {
- var result = JSON.stringify(value);
- if (/^[\{\[]/.test(result)) {
- value = result;
- }
- } catch (e) {}
- value = converter.write ?
- converter.write(value, key) :
- encodeURIComponent(String(value))
- .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
- key = encodeURIComponent(String(key))
- .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
- .replace(/[\(\)]/g, escape);
- var stringifiedAttributes = '';
- for (var attributeName in attributes) {
- if (!attributes[attributeName]) {
- continue;
- }
- stringifiedAttributes += '; ' + attributeName;
- if (attributes[attributeName] === true) {
- continue;
- }
- // Considers RFC 6265 section 5.2:
- // ...
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
- // character:
- // Consume the characters of the unparsed-attributes up to,
- // not including, the first %x3B (";") character.
- // ...
- stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
- }
- return (document.cookie = key + '=' + value + stringifiedAttributes);
- }
- function get (key, json) {
- if (typeof document === 'undefined') {
- return;
- }
- var jar = {};
- // To prevent the for loop in the first place assign an empty array
- // in case there are no cookies at all.
- var cookies = document.cookie ? document.cookie.split('; ') : [];
- var i = 0;
- for (; i < cookies.length; i++) {
- var parts = cookies[i].split('=');
- var cookie = parts.slice(1).join('=');
- if (!json && cookie.charAt(0) === '"') {
- cookie = cookie.slice(1, -1);
- }
- try {
- var name = decode(parts[0]);
- cookie = (converter.read || converter)(cookie, name) ||
- decode(cookie);
- if (json) {
- try {
- cookie = JSON.parse(cookie);
- } catch (e) {}
- }
- jar[name] = cookie;
- if (key === name) {
- break;
- }
- } catch (e) {}
- }
- return key ? jar[key] : jar;
- }
- api.set = set;
- api.get = function (key) {
- return get(key, false /* read as raw */);
- };
- api.getJSON = function (key) {
- return get(key, true /* read as json */);
- };
- api.remove = function (key, attributes) {
- set(key, '', extend(attributes, {
- expires: -1
- }));
- };
- api.defaults = {};
- api.withConverter = init;
- return api;
- }
- return init(function () {});
- }));
|