v3-script.min.js 1.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952
  1. /*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
  2. !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});
  3. /**!
  4. * @fileOverview Kickass library to create and place poppers near their reference elements.
  5. * @version 1.16.1
  6. * @license
  7. * Copyright (c) 2016 Federico Zivolo and contributors
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in all
  17. * copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  25. * SOFTWARE.
  26. */
  27. (function (global, factory) {
  28. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  29. typeof define === 'function' && define.amd ? define(factory) :
  30. (global.Popper = factory());
  31. }(this, (function () { 'use strict';
  32. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  33. var timeoutDuration = function () {
  34. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  36. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  37. return 1;
  38. }
  39. }
  40. return 0;
  41. }();
  42. function microtaskDebounce(fn) {
  43. var called = false;
  44. return function () {
  45. if (called) {
  46. return;
  47. }
  48. called = true;
  49. window.Promise.resolve().then(function () {
  50. called = false;
  51. fn();
  52. });
  53. };
  54. }
  55. function taskDebounce(fn) {
  56. var scheduled = false;
  57. return function () {
  58. if (!scheduled) {
  59. scheduled = true;
  60. setTimeout(function () {
  61. scheduled = false;
  62. fn();
  63. }, timeoutDuration);
  64. }
  65. };
  66. }
  67. var supportsMicroTasks = isBrowser && window.Promise;
  68. /**
  69. * Create a debounced version of a method, that's asynchronously deferred
  70. * but called in the minimum time possible.
  71. *
  72. * @method
  73. * @memberof Popper.Utils
  74. * @argument {Function} fn
  75. * @returns {Function}
  76. */
  77. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  78. /**
  79. * Check if the given variable is a function
  80. * @method
  81. * @memberof Popper.Utils
  82. * @argument {Any} functionToCheck - variable to check
  83. * @returns {Boolean} answer to: is a function?
  84. */
  85. function isFunction(functionToCheck) {
  86. var getType = {};
  87. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  88. }
  89. /**
  90. * Get CSS computed property of the given element
  91. * @method
  92. * @memberof Popper.Utils
  93. * @argument {Eement} element
  94. * @argument {String} property
  95. */
  96. function getStyleComputedProperty(element, property) {
  97. if (element.nodeType !== 1) {
  98. return [];
  99. }
  100. // NOTE: 1 DOM access here
  101. var window = element.ownerDocument.defaultView;
  102. var css = window.getComputedStyle(element, null);
  103. return property ? css[property] : css;
  104. }
  105. /**
  106. * Returns the parentNode or the host of the element
  107. * @method
  108. * @memberof Popper.Utils
  109. * @argument {Element} element
  110. * @returns {Element} parent
  111. */
  112. function getParentNode(element) {
  113. if (element.nodeName === 'HTML') {
  114. return element;
  115. }
  116. return element.parentNode || element.host;
  117. }
  118. /**
  119. * Returns the scrolling parent of the given element
  120. * @method
  121. * @memberof Popper.Utils
  122. * @argument {Element} element
  123. * @returns {Element} scroll parent
  124. */
  125. function getScrollParent(element) {
  126. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  127. if (!element) {
  128. return document.body;
  129. }
  130. switch (element.nodeName) {
  131. case 'HTML':
  132. case 'BODY':
  133. return element.ownerDocument.body;
  134. case '#document':
  135. return element.body;
  136. }
  137. // Firefox want us to check `-x` and `-y` variations as well
  138. var _getStyleComputedProp = getStyleComputedProperty(element),
  139. overflow = _getStyleComputedProp.overflow,
  140. overflowX = _getStyleComputedProp.overflowX,
  141. overflowY = _getStyleComputedProp.overflowY;
  142. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  143. return element;
  144. }
  145. return getScrollParent(getParentNode(element));
  146. }
  147. /**
  148. * Returns the reference node of the reference object, or the reference object itself.
  149. * @method
  150. * @memberof Popper.Utils
  151. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  152. * @returns {Element} parent
  153. */
  154. function getReferenceNode(reference) {
  155. return reference && reference.referenceNode ? reference.referenceNode : reference;
  156. }
  157. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  158. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  159. /**
  160. * Determines if the browser is Internet Explorer
  161. * @method
  162. * @memberof Popper.Utils
  163. * @param {Number} version to check
  164. * @returns {Boolean} isIE
  165. */
  166. function isIE(version) {
  167. if (version === 11) {
  168. return isIE11;
  169. }
  170. if (version === 10) {
  171. return isIE10;
  172. }
  173. return isIE11 || isIE10;
  174. }
  175. /**
  176. * Returns the offset parent of the given element
  177. * @method
  178. * @memberof Popper.Utils
  179. * @argument {Element} element
  180. * @returns {Element} offset parent
  181. */
  182. function getOffsetParent(element) {
  183. if (!element) {
  184. return document.documentElement;
  185. }
  186. var noOffsetParent = isIE(10) ? document.body : null;
  187. // NOTE: 1 DOM access here
  188. var offsetParent = element.offsetParent || null;
  189. // Skip hidden elements which don't have an offsetParent
  190. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  191. offsetParent = (element = element.nextElementSibling).offsetParent;
  192. }
  193. var nodeName = offsetParent && offsetParent.nodeName;
  194. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  195. return element ? element.ownerDocument.documentElement : document.documentElement;
  196. }
  197. // .offsetParent will return the closest TH, TD or TABLE in case
  198. // no offsetParent is present, I hate this job...
  199. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  200. return getOffsetParent(offsetParent);
  201. }
  202. return offsetParent;
  203. }
  204. function isOffsetContainer(element) {
  205. var nodeName = element.nodeName;
  206. if (nodeName === 'BODY') {
  207. return false;
  208. }
  209. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  210. }
  211. /**
  212. * Finds the root node (document, shadowDOM root) of the given element
  213. * @method
  214. * @memberof Popper.Utils
  215. * @argument {Element} node
  216. * @returns {Element} root node
  217. */
  218. function getRoot(node) {
  219. if (node.parentNode !== null) {
  220. return getRoot(node.parentNode);
  221. }
  222. return node;
  223. }
  224. /**
  225. * Finds the offset parent common to the two provided nodes
  226. * @method
  227. * @memberof Popper.Utils
  228. * @argument {Element} element1
  229. * @argument {Element} element2
  230. * @returns {Element} common offset parent
  231. */
  232. function findCommonOffsetParent(element1, element2) {
  233. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  234. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  235. return document.documentElement;
  236. }
  237. // Here we make sure to give as "start" the element that comes first in the DOM
  238. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  239. var start = order ? element1 : element2;
  240. var end = order ? element2 : element1;
  241. // Get common ancestor container
  242. var range = document.createRange();
  243. range.setStart(start, 0);
  244. range.setEnd(end, 0);
  245. var commonAncestorContainer = range.commonAncestorContainer;
  246. // Both nodes are inside #document
  247. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  248. if (isOffsetContainer(commonAncestorContainer)) {
  249. return commonAncestorContainer;
  250. }
  251. return getOffsetParent(commonAncestorContainer);
  252. }
  253. // one of the nodes is inside shadowDOM, find which one
  254. var element1root = getRoot(element1);
  255. if (element1root.host) {
  256. return findCommonOffsetParent(element1root.host, element2);
  257. } else {
  258. return findCommonOffsetParent(element1, getRoot(element2).host);
  259. }
  260. }
  261. /**
  262. * Gets the scroll value of the given element in the given side (top and left)
  263. * @method
  264. * @memberof Popper.Utils
  265. * @argument {Element} element
  266. * @argument {String} side `top` or `left`
  267. * @returns {number} amount of scrolled pixels
  268. */
  269. function getScroll(element) {
  270. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  271. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  272. var nodeName = element.nodeName;
  273. if (nodeName === 'BODY' || nodeName === 'HTML') {
  274. var html = element.ownerDocument.documentElement;
  275. var scrollingElement = element.ownerDocument.scrollingElement || html;
  276. return scrollingElement[upperSide];
  277. }
  278. return element[upperSide];
  279. }
  280. /*
  281. * Sum or subtract the element scroll values (left and top) from a given rect object
  282. * @method
  283. * @memberof Popper.Utils
  284. * @param {Object} rect - Rect object you want to change
  285. * @param {HTMLElement} element - The element from the function reads the scroll values
  286. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  287. * @return {Object} rect - The modifier rect object
  288. */
  289. function includeScroll(rect, element) {
  290. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  291. var scrollTop = getScroll(element, 'top');
  292. var scrollLeft = getScroll(element, 'left');
  293. var modifier = subtract ? -1 : 1;
  294. rect.top += scrollTop * modifier;
  295. rect.bottom += scrollTop * modifier;
  296. rect.left += scrollLeft * modifier;
  297. rect.right += scrollLeft * modifier;
  298. return rect;
  299. }
  300. /*
  301. * Helper to detect borders of a given element
  302. * @method
  303. * @memberof Popper.Utils
  304. * @param {CSSStyleDeclaration} styles
  305. * Result of `getStyleComputedProperty` on the given element
  306. * @param {String} axis - `x` or `y`
  307. * @return {number} borders - The borders size of the given axis
  308. */
  309. function getBordersSize(styles, axis) {
  310. var sideA = axis === 'x' ? 'Left' : 'Top';
  311. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  312. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  313. }
  314. function getSize(axis, body, html, computedStyle) {
  315. 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);
  316. }
  317. function getWindowSizes(document) {
  318. var body = document.body;
  319. var html = document.documentElement;
  320. var computedStyle = isIE(10) && getComputedStyle(html);
  321. return {
  322. height: getSize('Height', body, html, computedStyle),
  323. width: getSize('Width', body, html, computedStyle)
  324. };
  325. }
  326. var classCallCheck = function (instance, Constructor) {
  327. if (!(instance instanceof Constructor)) {
  328. throw new TypeError("Cannot call a class as a function");
  329. }
  330. };
  331. var createClass = function () {
  332. function defineProperties(target, props) {
  333. for (var i = 0; i < props.length; i++) {
  334. var descriptor = props[i];
  335. descriptor.enumerable = descriptor.enumerable || false;
  336. descriptor.configurable = true;
  337. if ("value" in descriptor) descriptor.writable = true;
  338. Object.defineProperty(target, descriptor.key, descriptor);
  339. }
  340. }
  341. return function (Constructor, protoProps, staticProps) {
  342. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  343. if (staticProps) defineProperties(Constructor, staticProps);
  344. return Constructor;
  345. };
  346. }();
  347. var defineProperty = function (obj, key, value) {
  348. if (key in obj) {
  349. Object.defineProperty(obj, key, {
  350. value: value,
  351. enumerable: true,
  352. configurable: true,
  353. writable: true
  354. });
  355. } else {
  356. obj[key] = value;
  357. }
  358. return obj;
  359. };
  360. var _extends = Object.assign || function (target) {
  361. for (var i = 1; i < arguments.length; i++) {
  362. var source = arguments[i];
  363. for (var key in source) {
  364. if (Object.prototype.hasOwnProperty.call(source, key)) {
  365. target[key] = source[key];
  366. }
  367. }
  368. }
  369. return target;
  370. };
  371. /**
  372. * Given element offsets, generate an output similar to getBoundingClientRect
  373. * @method
  374. * @memberof Popper.Utils
  375. * @argument {Object} offsets
  376. * @returns {Object} ClientRect like output
  377. */
  378. function getClientRect(offsets) {
  379. return _extends({}, offsets, {
  380. right: offsets.left + offsets.width,
  381. bottom: offsets.top + offsets.height
  382. });
  383. }
  384. /**
  385. * Get bounding client rect of given element
  386. * @method
  387. * @memberof Popper.Utils
  388. * @param {HTMLElement} element
  389. * @return {Object} client rect
  390. */
  391. function getBoundingClientRect(element) {
  392. var rect = {};
  393. // IE10 10 FIX: Please, don't ask, the element isn't
  394. // considered in DOM in some circumstances...
  395. // This isn't reproducible in IE10 compatibility mode of IE11
  396. try {
  397. if (isIE(10)) {
  398. rect = element.getBoundingClientRect();
  399. var scrollTop = getScroll(element, 'top');
  400. var scrollLeft = getScroll(element, 'left');
  401. rect.top += scrollTop;
  402. rect.left += scrollLeft;
  403. rect.bottom += scrollTop;
  404. rect.right += scrollLeft;
  405. } else {
  406. rect = element.getBoundingClientRect();
  407. }
  408. } catch (e) {}
  409. var result = {
  410. left: rect.left,
  411. top: rect.top,
  412. width: rect.right - rect.left,
  413. height: rect.bottom - rect.top
  414. };
  415. // subtract scrollbar size from sizes
  416. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  417. var width = sizes.width || element.clientWidth || result.width;
  418. var height = sizes.height || element.clientHeight || result.height;
  419. var horizScrollbar = element.offsetWidth - width;
  420. var vertScrollbar = element.offsetHeight - height;
  421. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  422. // we make this check conditional for performance reasons
  423. if (horizScrollbar || vertScrollbar) {
  424. var styles = getStyleComputedProperty(element);
  425. horizScrollbar -= getBordersSize(styles, 'x');
  426. vertScrollbar -= getBordersSize(styles, 'y');
  427. result.width -= horizScrollbar;
  428. result.height -= vertScrollbar;
  429. }
  430. return getClientRect(result);
  431. }
  432. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  433. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  434. var isIE10 = isIE(10);
  435. var isHTML = parent.nodeName === 'HTML';
  436. var childrenRect = getBoundingClientRect(children);
  437. var parentRect = getBoundingClientRect(parent);
  438. var scrollParent = getScrollParent(children);
  439. var styles = getStyleComputedProperty(parent);
  440. var borderTopWidth = parseFloat(styles.borderTopWidth);
  441. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  442. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  443. if (fixedPosition && isHTML) {
  444. parentRect.top = Math.max(parentRect.top, 0);
  445. parentRect.left = Math.max(parentRect.left, 0);
  446. }
  447. var offsets = getClientRect({
  448. top: childrenRect.top - parentRect.top - borderTopWidth,
  449. left: childrenRect.left - parentRect.left - borderLeftWidth,
  450. width: childrenRect.width,
  451. height: childrenRect.height
  452. });
  453. offsets.marginTop = 0;
  454. offsets.marginLeft = 0;
  455. // Subtract margins of documentElement in case it's being used as parent
  456. // we do this only on HTML because it's the only element that behaves
  457. // differently when margins are applied to it. The margins are included in
  458. // the box of the documentElement, in the other cases not.
  459. if (!isIE10 && isHTML) {
  460. var marginTop = parseFloat(styles.marginTop);
  461. var marginLeft = parseFloat(styles.marginLeft);
  462. offsets.top -= borderTopWidth - marginTop;
  463. offsets.bottom -= borderTopWidth - marginTop;
  464. offsets.left -= borderLeftWidth - marginLeft;
  465. offsets.right -= borderLeftWidth - marginLeft;
  466. // Attach marginTop and marginLeft because in some circumstances we may need them
  467. offsets.marginTop = marginTop;
  468. offsets.marginLeft = marginLeft;
  469. }
  470. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  471. offsets = includeScroll(offsets, parent);
  472. }
  473. return offsets;
  474. }
  475. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  476. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  477. var html = element.ownerDocument.documentElement;
  478. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  479. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  480. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  481. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  482. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  483. var offset = {
  484. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  485. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  486. width: width,
  487. height: height
  488. };
  489. return getClientRect(offset);
  490. }
  491. /**
  492. * Check if the given element is fixed or is inside a fixed parent
  493. * @method
  494. * @memberof Popper.Utils
  495. * @argument {Element} element
  496. * @argument {Element} customContainer
  497. * @returns {Boolean} answer to "isFixed?"
  498. */
  499. function isFixed(element) {
  500. var nodeName = element.nodeName;
  501. if (nodeName === 'BODY' || nodeName === 'HTML') {
  502. return false;
  503. }
  504. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  505. return true;
  506. }
  507. var parentNode = getParentNode(element);
  508. if (!parentNode) {
  509. return false;
  510. }
  511. return isFixed(parentNode);
  512. }
  513. /**
  514. * Finds the first parent of an element that has a transformed property defined
  515. * @method
  516. * @memberof Popper.Utils
  517. * @argument {Element} element
  518. * @returns {Element} first transformed parent or documentElement
  519. */
  520. function getFixedPositionOffsetParent(element) {
  521. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  522. if (!element || !element.parentElement || isIE()) {
  523. return document.documentElement;
  524. }
  525. var el = element.parentElement;
  526. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  527. el = el.parentElement;
  528. }
  529. return el || document.documentElement;
  530. }
  531. /**
  532. * Computed the boundaries limits and return them
  533. * @method
  534. * @memberof Popper.Utils
  535. * @param {HTMLElement} popper
  536. * @param {HTMLElement} reference
  537. * @param {number} padding
  538. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  539. * @param {Boolean} fixedPosition - Is in fixed position mode
  540. * @returns {Object} Coordinates of the boundaries
  541. */
  542. function getBoundaries(popper, reference, padding, boundariesElement) {
  543. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  544. // NOTE: 1 DOM access here
  545. var boundaries = { top: 0, left: 0 };
  546. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  547. // Handle viewport case
  548. if (boundariesElement === 'viewport') {
  549. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  550. } else {
  551. // Handle other cases based on DOM element used as boundaries
  552. var boundariesNode = void 0;
  553. if (boundariesElement === 'scrollParent') {
  554. boundariesNode = getScrollParent(getParentNode(reference));
  555. if (boundariesNode.nodeName === 'BODY') {
  556. boundariesNode = popper.ownerDocument.documentElement;
  557. }
  558. } else if (boundariesElement === 'window') {
  559. boundariesNode = popper.ownerDocument.documentElement;
  560. } else {
  561. boundariesNode = boundariesElement;
  562. }
  563. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  564. // In case of HTML, we need a different computation
  565. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  566. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  567. height = _getWindowSizes.height,
  568. width = _getWindowSizes.width;
  569. boundaries.top += offsets.top - offsets.marginTop;
  570. boundaries.bottom = height + offsets.top;
  571. boundaries.left += offsets.left - offsets.marginLeft;
  572. boundaries.right = width + offsets.left;
  573. } else {
  574. // for all the other DOM elements, this one is good
  575. boundaries = offsets;
  576. }
  577. }
  578. // Add paddings
  579. padding = padding || 0;
  580. var isPaddingNumber = typeof padding === 'number';
  581. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  582. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  583. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  584. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  585. return boundaries;
  586. }
  587. function getArea(_ref) {
  588. var width = _ref.width,
  589. height = _ref.height;
  590. return width * height;
  591. }
  592. /**
  593. * Utility used to transform the `auto` placement to the placement with more
  594. * available space.
  595. * @method
  596. * @memberof Popper.Utils
  597. * @argument {Object} data - The data object generated by update method
  598. * @argument {Object} options - Modifiers configuration and options
  599. * @returns {Object} The data object, properly modified
  600. */
  601. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  602. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  603. if (placement.indexOf('auto') === -1) {
  604. return placement;
  605. }
  606. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  607. var rects = {
  608. top: {
  609. width: boundaries.width,
  610. height: refRect.top - boundaries.top
  611. },
  612. right: {
  613. width: boundaries.right - refRect.right,
  614. height: boundaries.height
  615. },
  616. bottom: {
  617. width: boundaries.width,
  618. height: boundaries.bottom - refRect.bottom
  619. },
  620. left: {
  621. width: refRect.left - boundaries.left,
  622. height: boundaries.height
  623. }
  624. };
  625. var sortedAreas = Object.keys(rects).map(function (key) {
  626. return _extends({
  627. key: key
  628. }, rects[key], {
  629. area: getArea(rects[key])
  630. });
  631. }).sort(function (a, b) {
  632. return b.area - a.area;
  633. });
  634. var filteredAreas = sortedAreas.filter(function (_ref2) {
  635. var width = _ref2.width,
  636. height = _ref2.height;
  637. return width >= popper.clientWidth && height >= popper.clientHeight;
  638. });
  639. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  640. var variation = placement.split('-')[1];
  641. return computedPlacement + (variation ? '-' + variation : '');
  642. }
  643. /**
  644. * Get offsets to the reference element
  645. * @method
  646. * @memberof Popper.Utils
  647. * @param {Object} state
  648. * @param {Element} popper - the popper element
  649. * @param {Element} reference - the reference element (the popper will be relative to this)
  650. * @param {Element} fixedPosition - is in fixed position mode
  651. * @returns {Object} An object containing the offsets which will be applied to the popper
  652. */
  653. function getReferenceOffsets(state, popper, reference) {
  654. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  655. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  656. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  657. }
  658. /**
  659. * Get the outer sizes of the given element (offset size + margins)
  660. * @method
  661. * @memberof Popper.Utils
  662. * @argument {Element} element
  663. * @returns {Object} object containing width and height properties
  664. */
  665. function getOuterSizes(element) {
  666. var window = element.ownerDocument.defaultView;
  667. var styles = window.getComputedStyle(element);
  668. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  669. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  670. var result = {
  671. width: element.offsetWidth + y,
  672. height: element.offsetHeight + x
  673. };
  674. return result;
  675. }
  676. /**
  677. * Get the opposite placement of the given one
  678. * @method
  679. * @memberof Popper.Utils
  680. * @argument {String} placement
  681. * @returns {String} flipped placement
  682. */
  683. function getOppositePlacement(placement) {
  684. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  685. return placement.replace(/left|right|bottom|top/g, function (matched) {
  686. return hash[matched];
  687. });
  688. }
  689. /**
  690. * Get offsets to the popper
  691. * @method
  692. * @memberof Popper.Utils
  693. * @param {Object} position - CSS position the Popper will get applied
  694. * @param {HTMLElement} popper - the popper element
  695. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  696. * @param {String} placement - one of the valid placement options
  697. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  698. */
  699. function getPopperOffsets(popper, referenceOffsets, placement) {
  700. placement = placement.split('-')[0];
  701. // Get popper node sizes
  702. var popperRect = getOuterSizes(popper);
  703. // Add position, width and height to our offsets object
  704. var popperOffsets = {
  705. width: popperRect.width,
  706. height: popperRect.height
  707. };
  708. // depending by the popper placement we have to compute its offsets slightly differently
  709. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  710. var mainSide = isHoriz ? 'top' : 'left';
  711. var secondarySide = isHoriz ? 'left' : 'top';
  712. var measurement = isHoriz ? 'height' : 'width';
  713. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  714. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  715. if (placement === secondarySide) {
  716. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  717. } else {
  718. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  719. }
  720. return popperOffsets;
  721. }
  722. /**
  723. * Mimics the `find` method of Array
  724. * @method
  725. * @memberof Popper.Utils
  726. * @argument {Array} arr
  727. * @argument prop
  728. * @argument value
  729. * @returns index or -1
  730. */
  731. function find(arr, check) {
  732. // use native find if supported
  733. if (Array.prototype.find) {
  734. return arr.find(check);
  735. }
  736. // use `filter` to obtain the same behavior of `find`
  737. return arr.filter(check)[0];
  738. }
  739. /**
  740. * Return the index of the matching object
  741. * @method
  742. * @memberof Popper.Utils
  743. * @argument {Array} arr
  744. * @argument prop
  745. * @argument value
  746. * @returns index or -1
  747. */
  748. function findIndex(arr, prop, value) {
  749. // use native findIndex if supported
  750. if (Array.prototype.findIndex) {
  751. return arr.findIndex(function (cur) {
  752. return cur[prop] === value;
  753. });
  754. }
  755. // use `find` + `indexOf` if `findIndex` isn't supported
  756. var match = find(arr, function (obj) {
  757. return obj[prop] === value;
  758. });
  759. return arr.indexOf(match);
  760. }
  761. /**
  762. * Loop trough the list of modifiers and run them in order,
  763. * each of them will then edit the data object.
  764. * @method
  765. * @memberof Popper.Utils
  766. * @param {dataObject} data
  767. * @param {Array} modifiers
  768. * @param {String} ends - Optional modifier name used as stopper
  769. * @returns {dataObject}
  770. */
  771. function runModifiers(modifiers, data, ends) {
  772. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  773. modifiersToRun.forEach(function (modifier) {
  774. if (modifier['function']) {
  775. // eslint-disable-line dot-notation
  776. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  777. }
  778. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  779. if (modifier.enabled && isFunction(fn)) {
  780. // Add properties to offsets to make them a complete clientRect object
  781. // we do this before each modifier to make sure the previous one doesn't
  782. // mess with these values
  783. data.offsets.popper = getClientRect(data.offsets.popper);
  784. data.offsets.reference = getClientRect(data.offsets.reference);
  785. data = fn(data, modifier);
  786. }
  787. });
  788. return data;
  789. }
  790. /**
  791. * Updates the position of the popper, computing the new offsets and applying
  792. * the new style.<br />
  793. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  794. * @method
  795. * @memberof Popper
  796. */
  797. function update() {
  798. // if popper is destroyed, don't perform any further update
  799. if (this.state.isDestroyed) {
  800. return;
  801. }
  802. var data = {
  803. instance: this,
  804. styles: {},
  805. arrowStyles: {},
  806. attributes: {},
  807. flipped: false,
  808. offsets: {}
  809. };
  810. // compute reference element offsets
  811. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  812. // compute auto placement, store placement inside the data object,
  813. // modifiers will be able to edit `placement` if needed
  814. // and refer to originalPlacement to know the original value
  815. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  816. // store the computed placement inside `originalPlacement`
  817. data.originalPlacement = data.placement;
  818. data.positionFixed = this.options.positionFixed;
  819. // compute the popper offsets
  820. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  821. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  822. // run the modifiers
  823. data = runModifiers(this.modifiers, data);
  824. // the first `update` will call `onCreate` callback
  825. // the other ones will call `onUpdate` callback
  826. if (!this.state.isCreated) {
  827. this.state.isCreated = true;
  828. this.options.onCreate(data);
  829. } else {
  830. this.options.onUpdate(data);
  831. }
  832. }
  833. /**
  834. * Helper used to know if the given modifier is enabled.
  835. * @method
  836. * @memberof Popper.Utils
  837. * @returns {Boolean}
  838. */
  839. function isModifierEnabled(modifiers, modifierName) {
  840. return modifiers.some(function (_ref) {
  841. var name = _ref.name,
  842. enabled = _ref.enabled;
  843. return enabled && name === modifierName;
  844. });
  845. }
  846. /**
  847. * Get the prefixed supported property name
  848. * @method
  849. * @memberof Popper.Utils
  850. * @argument {String} property (camelCase)
  851. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  852. */
  853. function getSupportedPropertyName(property) {
  854. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  855. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  856. for (var i = 0; i < prefixes.length; i++) {
  857. var prefix = prefixes[i];
  858. var toCheck = prefix ? '' + prefix + upperProp : property;
  859. if (typeof document.body.style[toCheck] !== 'undefined') {
  860. return toCheck;
  861. }
  862. }
  863. return null;
  864. }
  865. /**
  866. * Destroys the popper.
  867. * @method
  868. * @memberof Popper
  869. */
  870. function destroy() {
  871. this.state.isDestroyed = true;
  872. // touch DOM only if `applyStyle` modifier is enabled
  873. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  874. this.popper.removeAttribute('x-placement');
  875. this.popper.style.position = '';
  876. this.popper.style.top = '';
  877. this.popper.style.left = '';
  878. this.popper.style.right = '';
  879. this.popper.style.bottom = '';
  880. this.popper.style.willChange = '';
  881. this.popper.style[getSupportedPropertyName('transform')] = '';
  882. }
  883. this.disableEventListeners();
  884. // remove the popper if user explicitly asked for the deletion on destroy
  885. // do not use `remove` because IE11 doesn't support it
  886. if (this.options.removeOnDestroy) {
  887. this.popper.parentNode.removeChild(this.popper);
  888. }
  889. return this;
  890. }
  891. /**
  892. * Get the window associated with the element
  893. * @argument {Element} element
  894. * @returns {Window}
  895. */
  896. function getWindow(element) {
  897. var ownerDocument = element.ownerDocument;
  898. return ownerDocument ? ownerDocument.defaultView : window;
  899. }
  900. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  901. var isBody = scrollParent.nodeName === 'BODY';
  902. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  903. target.addEventListener(event, callback, { passive: true });
  904. if (!isBody) {
  905. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  906. }
  907. scrollParents.push(target);
  908. }
  909. /**
  910. * Setup needed event listeners used to update the popper position
  911. * @method
  912. * @memberof Popper.Utils
  913. * @private
  914. */
  915. function setupEventListeners(reference, options, state, updateBound) {
  916. // Resize event listener on window
  917. state.updateBound = updateBound;
  918. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  919. // Scroll event listener on scroll parents
  920. var scrollElement = getScrollParent(reference);
  921. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  922. state.scrollElement = scrollElement;
  923. state.eventsEnabled = true;
  924. return state;
  925. }
  926. /**
  927. * It will add resize/scroll events and start recalculating
  928. * position of the popper element when they are triggered.
  929. * @method
  930. * @memberof Popper
  931. */
  932. function enableEventListeners() {
  933. if (!this.state.eventsEnabled) {
  934. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  935. }
  936. }
  937. /**
  938. * Remove event listeners used to update the popper position
  939. * @method
  940. * @memberof Popper.Utils
  941. * @private
  942. */
  943. function removeEventListeners(reference, state) {
  944. // Remove resize event listener on window
  945. getWindow(reference).removeEventListener('resize', state.updateBound);
  946. // Remove scroll event listener on scroll parents
  947. state.scrollParents.forEach(function (target) {
  948. target.removeEventListener('scroll', state.updateBound);
  949. });
  950. // Reset state
  951. state.updateBound = null;
  952. state.scrollParents = [];
  953. state.scrollElement = null;
  954. state.eventsEnabled = false;
  955. return state;
  956. }
  957. /**
  958. * It will remove resize/scroll events and won't recalculate popper position
  959. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  960. * unless you call `update` method manually.
  961. * @method
  962. * @memberof Popper
  963. */
  964. function disableEventListeners() {
  965. if (this.state.eventsEnabled) {
  966. cancelAnimationFrame(this.scheduleUpdate);
  967. this.state = removeEventListeners(this.reference, this.state);
  968. }
  969. }
  970. /**
  971. * Tells if a given input is a number
  972. * @method
  973. * @memberof Popper.Utils
  974. * @param {*} input to check
  975. * @return {Boolean}
  976. */
  977. function isNumeric(n) {
  978. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  979. }
  980. /**
  981. * Set the style to the given popper
  982. * @method
  983. * @memberof Popper.Utils
  984. * @argument {Element} element - Element to apply the style to
  985. * @argument {Object} styles
  986. * Object with a list of properties and values which will be applied to the element
  987. */
  988. function setStyles(element, styles) {
  989. Object.keys(styles).forEach(function (prop) {
  990. var unit = '';
  991. // add unit if the value is numeric and is one of the following
  992. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  993. unit = 'px';
  994. }
  995. element.style[prop] = styles[prop] + unit;
  996. });
  997. }
  998. /**
  999. * Set the attributes to the given popper
  1000. * @method
  1001. * @memberof Popper.Utils
  1002. * @argument {Element} element - Element to apply the attributes to
  1003. * @argument {Object} styles
  1004. * Object with a list of properties and values which will be applied to the element
  1005. */
  1006. function setAttributes(element, attributes) {
  1007. Object.keys(attributes).forEach(function (prop) {
  1008. var value = attributes[prop];
  1009. if (value !== false) {
  1010. element.setAttribute(prop, attributes[prop]);
  1011. } else {
  1012. element.removeAttribute(prop);
  1013. }
  1014. });
  1015. }
  1016. /**
  1017. * @function
  1018. * @memberof Modifiers
  1019. * @argument {Object} data - The data object generated by `update` method
  1020. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  1021. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  1022. * @argument {Object} options - Modifiers configuration and options
  1023. * @returns {Object} The same data object
  1024. */
  1025. function applyStyle(data) {
  1026. // any property present in `data.styles` will be applied to the popper,
  1027. // in this way we can make the 3rd party modifiers add custom styles to it
  1028. // Be aware, modifiers could override the properties defined in the previous
  1029. // lines of this modifier!
  1030. setStyles(data.instance.popper, data.styles);
  1031. // any property present in `data.attributes` will be applied to the popper,
  1032. // they will be set as HTML attributes of the element
  1033. setAttributes(data.instance.popper, data.attributes);
  1034. // if arrowElement is defined and arrowStyles has some properties
  1035. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  1036. setStyles(data.arrowElement, data.arrowStyles);
  1037. }
  1038. return data;
  1039. }
  1040. /**
  1041. * Set the x-placement attribute before everything else because it could be used
  1042. * to add margins to the popper margins needs to be calculated to get the
  1043. * correct popper offsets.
  1044. * @method
  1045. * @memberof Popper.modifiers
  1046. * @param {HTMLElement} reference - The reference element used to position the popper
  1047. * @param {HTMLElement} popper - The HTML element used as popper
  1048. * @param {Object} options - Popper.js options
  1049. */
  1050. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  1051. // compute reference element offsets
  1052. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  1053. // compute auto placement, store placement inside the data object,
  1054. // modifiers will be able to edit `placement` if needed
  1055. // and refer to originalPlacement to know the original value
  1056. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  1057. popper.setAttribute('x-placement', placement);
  1058. // Apply `position` to popper before anything else because
  1059. // without the position applied we can't guarantee correct computations
  1060. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  1061. return options;
  1062. }
  1063. /**
  1064. * @function
  1065. * @memberof Popper.Utils
  1066. * @argument {Object} data - The data object generated by `update` method
  1067. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  1068. * @returns {Object} The popper's position offsets rounded
  1069. *
  1070. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  1071. * good as it can be within reason.
  1072. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  1073. *
  1074. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  1075. * as well on High DPI screens).
  1076. *
  1077. * Firefox prefers no rounding for positioning and does not have blurriness on
  1078. * high DPI screens.
  1079. *
  1080. * Only horizontal placement and left/right values need to be considered.
  1081. */
  1082. function getRoundedOffsets(data, shouldRound) {
  1083. var _data$offsets = data.offsets,
  1084. popper = _data$offsets.popper,
  1085. reference = _data$offsets.reference;
  1086. var round = Math.round,
  1087. floor = Math.floor;
  1088. var noRound = function noRound(v) {
  1089. return v;
  1090. };
  1091. var referenceWidth = round(reference.width);
  1092. var popperWidth = round(popper.width);
  1093. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  1094. var isVariation = data.placement.indexOf('-') !== -1;
  1095. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  1096. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  1097. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  1098. var verticalToInteger = !shouldRound ? noRound : round;
  1099. return {
  1100. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  1101. top: verticalToInteger(popper.top),
  1102. bottom: verticalToInteger(popper.bottom),
  1103. right: horizontalToInteger(popper.right)
  1104. };
  1105. }
  1106. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  1107. /**
  1108. * @function
  1109. * @memberof Modifiers
  1110. * @argument {Object} data - The data object generated by `update` method
  1111. * @argument {Object} options - Modifiers configuration and options
  1112. * @returns {Object} The data object, properly modified
  1113. */
  1114. function computeStyle(data, options) {
  1115. var x = options.x,
  1116. y = options.y;
  1117. var popper = data.offsets.popper;
  1118. // Remove this legacy support in Popper.js v2
  1119. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  1120. return modifier.name === 'applyStyle';
  1121. }).gpuAcceleration;
  1122. if (legacyGpuAccelerationOption !== undefined) {
  1123. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  1124. }
  1125. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  1126. var offsetParent = getOffsetParent(data.instance.popper);
  1127. var offsetParentRect = getBoundingClientRect(offsetParent);
  1128. // Styles
  1129. var styles = {
  1130. position: popper.position
  1131. };
  1132. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  1133. var sideA = x === 'bottom' ? 'top' : 'bottom';
  1134. var sideB = y === 'right' ? 'left' : 'right';
  1135. // if gpuAcceleration is set to `true` and transform is supported,
  1136. // we use `translate3d` to apply the position to the popper we
  1137. // automatically use the supported prefixed version if needed
  1138. var prefixedProperty = getSupportedPropertyName('transform');
  1139. // now, let's make a step back and look at this code closely (wtf?)
  1140. // If the content of the popper grows once it's been positioned, it
  1141. // may happen that the popper gets misplaced because of the new content
  1142. // overflowing its reference element
  1143. // To avoid this problem, we provide two options (x and y), which allow
  1144. // the consumer to define the offset origin.
  1145. // If we position a popper on top of a reference element, we can set
  1146. // `x` to `top` to make the popper grow towards its top instead of
  1147. // its bottom.
  1148. var left = void 0,
  1149. top = void 0;
  1150. if (sideA === 'bottom') {
  1151. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  1152. // and not the bottom of the html element
  1153. if (offsetParent.nodeName === 'HTML') {
  1154. top = -offsetParent.clientHeight + offsets.bottom;
  1155. } else {
  1156. top = -offsetParentRect.height + offsets.bottom;
  1157. }
  1158. } else {
  1159. top = offsets.top;
  1160. }
  1161. if (sideB === 'right') {
  1162. if (offsetParent.nodeName === 'HTML') {
  1163. left = -offsetParent.clientWidth + offsets.right;
  1164. } else {
  1165. left = -offsetParentRect.width + offsets.right;
  1166. }
  1167. } else {
  1168. left = offsets.left;
  1169. }
  1170. if (gpuAcceleration && prefixedProperty) {
  1171. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  1172. styles[sideA] = 0;
  1173. styles[sideB] = 0;
  1174. styles.willChange = 'transform';
  1175. } else {
  1176. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  1177. var invertTop = sideA === 'bottom' ? -1 : 1;
  1178. var invertLeft = sideB === 'right' ? -1 : 1;
  1179. styles[sideA] = top * invertTop;
  1180. styles[sideB] = left * invertLeft;
  1181. styles.willChange = sideA + ', ' + sideB;
  1182. }
  1183. // Attributes
  1184. var attributes = {
  1185. 'x-placement': data.placement
  1186. };
  1187. // Update `data` attributes, styles and arrowStyles
  1188. data.attributes = _extends({}, attributes, data.attributes);
  1189. data.styles = _extends({}, styles, data.styles);
  1190. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  1191. return data;
  1192. }
  1193. /**
  1194. * Helper used to know if the given modifier depends from another one.<br />
  1195. * It checks if the needed modifier is listed and enabled.
  1196. * @method
  1197. * @memberof Popper.Utils
  1198. * @param {Array} modifiers - list of modifiers
  1199. * @param {String} requestingName - name of requesting modifier
  1200. * @param {String} requestedName - name of requested modifier
  1201. * @returns {Boolean}
  1202. */
  1203. function isModifierRequired(modifiers, requestingName, requestedName) {
  1204. var requesting = find(modifiers, function (_ref) {
  1205. var name = _ref.name;
  1206. return name === requestingName;
  1207. });
  1208. var isRequired = !!requesting && modifiers.some(function (modifier) {
  1209. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  1210. });
  1211. if (!isRequired) {
  1212. var _requesting = '`' + requestingName + '`';
  1213. var requested = '`' + requestedName + '`';
  1214. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  1215. }
  1216. return isRequired;
  1217. }
  1218. /**
  1219. * @function
  1220. * @memberof Modifiers
  1221. * @argument {Object} data - The data object generated by update method
  1222. * @argument {Object} options - Modifiers configuration and options
  1223. * @returns {Object} The data object, properly modified
  1224. */
  1225. function arrow(data, options) {
  1226. var _data$offsets$arrow;
  1227. // arrow depends on keepTogether in order to work
  1228. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  1229. return data;
  1230. }
  1231. var arrowElement = options.element;
  1232. // if arrowElement is a string, suppose it's a CSS selector
  1233. if (typeof arrowElement === 'string') {
  1234. arrowElement = data.instance.popper.querySelector(arrowElement);
  1235. // if arrowElement is not found, don't run the modifier
  1236. if (!arrowElement) {
  1237. return data;
  1238. }
  1239. } else {
  1240. // if the arrowElement isn't a query selector we must check that the
  1241. // provided DOM node is child of its popper node
  1242. if (!data.instance.popper.contains(arrowElement)) {
  1243. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  1244. return data;
  1245. }
  1246. }
  1247. var placement = data.placement.split('-')[0];
  1248. var _data$offsets = data.offsets,
  1249. popper = _data$offsets.popper,
  1250. reference = _data$offsets.reference;
  1251. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  1252. var len = isVertical ? 'height' : 'width';
  1253. var sideCapitalized = isVertical ? 'Top' : 'Left';
  1254. var side = sideCapitalized.toLowerCase();
  1255. var altSide = isVertical ? 'left' : 'top';
  1256. var opSide = isVertical ? 'bottom' : 'right';
  1257. var arrowElementSize = getOuterSizes(arrowElement)[len];
  1258. //
  1259. // extends keepTogether behavior making sure the popper and its
  1260. // reference have enough pixels in conjunction
  1261. //
  1262. // top/left side
  1263. if (reference[opSide] - arrowElementSize < popper[side]) {
  1264. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  1265. }
  1266. // bottom/right side
  1267. if (reference[side] + arrowElementSize > popper[opSide]) {
  1268. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  1269. }
  1270. data.offsets.popper = getClientRect(data.offsets.popper);
  1271. // compute center of the popper
  1272. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  1273. // Compute the sideValue using the updated popper offsets
  1274. // take popper margin in account because we don't have this info available
  1275. var css = getStyleComputedProperty(data.instance.popper);
  1276. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  1277. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  1278. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  1279. // prevent arrowElement from being placed not contiguously to its popper
  1280. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  1281. data.arrowElement = arrowElement;
  1282. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  1283. return data;
  1284. }
  1285. /**
  1286. * Get the opposite placement variation of the given one
  1287. * @method
  1288. * @memberof Popper.Utils
  1289. * @argument {String} placement variation
  1290. * @returns {String} flipped placement variation
  1291. */
  1292. function getOppositeVariation(variation) {
  1293. if (variation === 'end') {
  1294. return 'start';
  1295. } else if (variation === 'start') {
  1296. return 'end';
  1297. }
  1298. return variation;
  1299. }
  1300. /**
  1301. * List of accepted placements to use as values of the `placement` option.<br />
  1302. * Valid placements are:
  1303. * - `auto`
  1304. * - `top`
  1305. * - `right`
  1306. * - `bottom`
  1307. * - `left`
  1308. *
  1309. * Each placement can have a variation from this list:
  1310. * - `-start`
  1311. * - `-end`
  1312. *
  1313. * Variations are interpreted easily if you think of them as the left to right
  1314. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  1315. * is right.<br />
  1316. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  1317. *
  1318. * Some valid examples are:
  1319. * - `top-end` (on top of reference, right aligned)
  1320. * - `right-start` (on right of reference, top aligned)
  1321. * - `bottom` (on bottom, centered)
  1322. * - `auto-end` (on the side with more space available, alignment depends by placement)
  1323. *
  1324. * @static
  1325. * @type {Array}
  1326. * @enum {String}
  1327. * @readonly
  1328. * @method placements
  1329. * @memberof Popper
  1330. */
  1331. 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'];
  1332. // Get rid of `auto` `auto-start` and `auto-end`
  1333. var validPlacements = placements.slice(3);
  1334. /**
  1335. * Given an initial placement, returns all the subsequent placements
  1336. * clockwise (or counter-clockwise).
  1337. *
  1338. * @method
  1339. * @memberof Popper.Utils
  1340. * @argument {String} placement - A valid placement (it accepts variations)
  1341. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  1342. * @returns {Array} placements including their variations
  1343. */
  1344. function clockwise(placement) {
  1345. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1346. var index = validPlacements.indexOf(placement);
  1347. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  1348. return counter ? arr.reverse() : arr;
  1349. }
  1350. var BEHAVIORS = {
  1351. FLIP: 'flip',
  1352. CLOCKWISE: 'clockwise',
  1353. COUNTERCLOCKWISE: 'counterclockwise'
  1354. };
  1355. /**
  1356. * @function
  1357. * @memberof Modifiers
  1358. * @argument {Object} data - The data object generated by update method
  1359. * @argument {Object} options - Modifiers configuration and options
  1360. * @returns {Object} The data object, properly modified
  1361. */
  1362. function flip(data, options) {
  1363. // if `inner` modifier is enabled, we can't use the `flip` modifier
  1364. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  1365. return data;
  1366. }
  1367. if (data.flipped && data.placement === data.originalPlacement) {
  1368. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  1369. return data;
  1370. }
  1371. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  1372. var placement = data.placement.split('-')[0];
  1373. var placementOpposite = getOppositePlacement(placement);
  1374. var variation = data.placement.split('-')[1] || '';
  1375. var flipOrder = [];
  1376. switch (options.behavior) {
  1377. case BEHAVIORS.FLIP:
  1378. flipOrder = [placement, placementOpposite];
  1379. break;
  1380. case BEHAVIORS.CLOCKWISE:
  1381. flipOrder = clockwise(placement);
  1382. break;
  1383. case BEHAVIORS.COUNTERCLOCKWISE:
  1384. flipOrder = clockwise(placement, true);
  1385. break;
  1386. default:
  1387. flipOrder = options.behavior;
  1388. }
  1389. flipOrder.forEach(function (step, index) {
  1390. if (placement !== step || flipOrder.length === index + 1) {
  1391. return data;
  1392. }
  1393. placement = data.placement.split('-')[0];
  1394. placementOpposite = getOppositePlacement(placement);
  1395. var popperOffsets = data.offsets.popper;
  1396. var refOffsets = data.offsets.reference;
  1397. // using floor because the reference offsets may contain decimals we are not going to consider here
  1398. var floor = Math.floor;
  1399. 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);
  1400. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  1401. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  1402. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  1403. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  1404. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  1405. // flip the variation if required
  1406. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  1407. // flips variation if reference element overflows boundaries
  1408. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  1409. // flips variation if popper content overflows boundaries
  1410. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  1411. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  1412. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  1413. // this boolean to detect any flip loop
  1414. data.flipped = true;
  1415. if (overlapsRef || overflowsBoundaries) {
  1416. placement = flipOrder[index + 1];
  1417. }
  1418. if (flippedVariation) {
  1419. variation = getOppositeVariation(variation);
  1420. }
  1421. data.placement = placement + (variation ? '-' + variation : '');
  1422. // this object contains `position`, we want to preserve it along with
  1423. // any additional property we may add in the future
  1424. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  1425. data = runModifiers(data.instance.modifiers, data, 'flip');
  1426. }
  1427. });
  1428. return data;
  1429. }
  1430. /**
  1431. * @function
  1432. * @memberof Modifiers
  1433. * @argument {Object} data - The data object generated by update method
  1434. * @argument {Object} options - Modifiers configuration and options
  1435. * @returns {Object} The data object, properly modified
  1436. */
  1437. function keepTogether(data) {
  1438. var _data$offsets = data.offsets,
  1439. popper = _data$offsets.popper,
  1440. reference = _data$offsets.reference;
  1441. var placement = data.placement.split('-')[0];
  1442. var floor = Math.floor;
  1443. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  1444. var side = isVertical ? 'right' : 'bottom';
  1445. var opSide = isVertical ? 'left' : 'top';
  1446. var measurement = isVertical ? 'width' : 'height';
  1447. if (popper[side] < floor(reference[opSide])) {
  1448. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  1449. }
  1450. if (popper[opSide] > floor(reference[side])) {
  1451. data.offsets.popper[opSide] = floor(reference[side]);
  1452. }
  1453. return data;
  1454. }
  1455. /**
  1456. * Converts a string containing value + unit into a px value number
  1457. * @function
  1458. * @memberof {modifiers~offset}
  1459. * @private
  1460. * @argument {String} str - Value + unit string
  1461. * @argument {String} measurement - `height` or `width`
  1462. * @argument {Object} popperOffsets
  1463. * @argument {Object} referenceOffsets
  1464. * @returns {Number|String}
  1465. * Value in pixels, or original string if no values were extracted
  1466. */
  1467. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  1468. // separate value from unit
  1469. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  1470. var value = +split[1];
  1471. var unit = split[2];
  1472. // If it's not a number it's an operator, I guess
  1473. if (!value) {
  1474. return str;
  1475. }
  1476. if (unit.indexOf('%') === 0) {
  1477. var element = void 0;
  1478. switch (unit) {
  1479. case '%p':
  1480. element = popperOffsets;
  1481. break;
  1482. case '%':
  1483. case '%r':
  1484. default:
  1485. element = referenceOffsets;
  1486. }
  1487. var rect = getClientRect(element);
  1488. return rect[measurement] / 100 * value;
  1489. } else if (unit === 'vh' || unit === 'vw') {
  1490. // if is a vh or vw, we calculate the size based on the viewport
  1491. var size = void 0;
  1492. if (unit === 'vh') {
  1493. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  1494. } else {
  1495. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  1496. }
  1497. return size / 100 * value;
  1498. } else {
  1499. // if is an explicit pixel unit, we get rid of the unit and keep the value
  1500. // if is an implicit unit, it's px, and we return just the value
  1501. return value;
  1502. }
  1503. }
  1504. /**
  1505. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  1506. * @function
  1507. * @memberof {modifiers~offset}
  1508. * @private
  1509. * @argument {String} offset
  1510. * @argument {Object} popperOffsets
  1511. * @argument {Object} referenceOffsets
  1512. * @argument {String} basePlacement
  1513. * @returns {Array} a two cells array with x and y offsets in numbers
  1514. */
  1515. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  1516. var offsets = [0, 0];
  1517. // Use height if placement is left or right and index is 0 otherwise use width
  1518. // in this way the first offset will use an axis and the second one
  1519. // will use the other one
  1520. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  1521. // Split the offset string to obtain a list of values and operands
  1522. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  1523. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  1524. return frag.trim();
  1525. });
  1526. // Detect if the offset string contains a pair of values or a single one
  1527. // they could be separated by comma or space
  1528. var divider = fragments.indexOf(find(fragments, function (frag) {
  1529. return frag.search(/,|\s/) !== -1;
  1530. }));
  1531. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  1532. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  1533. }
  1534. // If divider is found, we divide the list of values and operands to divide
  1535. // them by ofset X and Y.
  1536. var splitRegex = /\s*,\s*|\s+/;
  1537. 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];
  1538. // Convert the values with units to absolute pixels to allow our computations
  1539. ops = ops.map(function (op, index) {
  1540. // Most of the units rely on the orientation of the popper
  1541. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  1542. var mergeWithPrevious = false;
  1543. return op
  1544. // This aggregates any `+` or `-` sign that aren't considered operators
  1545. // e.g.: 10 + +5 => [10, +, +5]
  1546. .reduce(function (a, b) {
  1547. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  1548. a[a.length - 1] = b;
  1549. mergeWithPrevious = true;
  1550. return a;
  1551. } else if (mergeWithPrevious) {
  1552. a[a.length - 1] += b;
  1553. mergeWithPrevious = false;
  1554. return a;
  1555. } else {
  1556. return a.concat(b);
  1557. }
  1558. }, [])
  1559. // Here we convert the string values into number values (in px)
  1560. .map(function (str) {
  1561. return toValue(str, measurement, popperOffsets, referenceOffsets);
  1562. });
  1563. });
  1564. // Loop trough the offsets arrays and execute the operations
  1565. ops.forEach(function (op, index) {
  1566. op.forEach(function (frag, index2) {
  1567. if (isNumeric(frag)) {
  1568. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  1569. }
  1570. });
  1571. });
  1572. return offsets;
  1573. }
  1574. /**
  1575. * @function
  1576. * @memberof Modifiers
  1577. * @argument {Object} data - The data object generated by update method
  1578. * @argument {Object} options - Modifiers configuration and options
  1579. * @argument {Number|String} options.offset=0
  1580. * The offset value as described in the modifier description
  1581. * @returns {Object} The data object, properly modified
  1582. */
  1583. function offset(data, _ref) {
  1584. var offset = _ref.offset;
  1585. var placement = data.placement,
  1586. _data$offsets = data.offsets,
  1587. popper = _data$offsets.popper,
  1588. reference = _data$offsets.reference;
  1589. var basePlacement = placement.split('-')[0];
  1590. var offsets = void 0;
  1591. if (isNumeric(+offset)) {
  1592. offsets = [+offset, 0];
  1593. } else {
  1594. offsets = parseOffset(offset, popper, reference, basePlacement);
  1595. }
  1596. if (basePlacement === 'left') {
  1597. popper.top += offsets[0];
  1598. popper.left -= offsets[1];
  1599. } else if (basePlacement === 'right') {
  1600. popper.top += offsets[0];
  1601. popper.left += offsets[1];
  1602. } else if (basePlacement === 'top') {
  1603. popper.left += offsets[0];
  1604. popper.top -= offsets[1];
  1605. } else if (basePlacement === 'bottom') {
  1606. popper.left += offsets[0];
  1607. popper.top += offsets[1];
  1608. }
  1609. data.popper = popper;
  1610. return data;
  1611. }
  1612. /**
  1613. * @function
  1614. * @memberof Modifiers
  1615. * @argument {Object} data - The data object generated by `update` method
  1616. * @argument {Object} options - Modifiers configuration and options
  1617. * @returns {Object} The data object, properly modified
  1618. */
  1619. function preventOverflow(data, options) {
  1620. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  1621. // If offsetParent is the reference element, we really want to
  1622. // go one step up and use the next offsetParent as reference to
  1623. // avoid to make this modifier completely useless and look like broken
  1624. if (data.instance.reference === boundariesElement) {
  1625. boundariesElement = getOffsetParent(boundariesElement);
  1626. }
  1627. // NOTE: DOM access here
  1628. // resets the popper's position so that the document size can be calculated excluding
  1629. // the size of the popper element itself
  1630. var transformProp = getSupportedPropertyName('transform');
  1631. var popperStyles = data.instance.popper.style; // assignment to help minification
  1632. var top = popperStyles.top,
  1633. left = popperStyles.left,
  1634. transform = popperStyles[transformProp];
  1635. popperStyles.top = '';
  1636. popperStyles.left = '';
  1637. popperStyles[transformProp] = '';
  1638. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  1639. // NOTE: DOM access here
  1640. // restores the original style properties after the offsets have been computed
  1641. popperStyles.top = top;
  1642. popperStyles.left = left;
  1643. popperStyles[transformProp] = transform;
  1644. options.boundaries = boundaries;
  1645. var order = options.priority;
  1646. var popper = data.offsets.popper;
  1647. var check = {
  1648. primary: function primary(placement) {
  1649. var value = popper[placement];
  1650. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  1651. value = Math.max(popper[placement], boundaries[placement]);
  1652. }
  1653. return defineProperty({}, placement, value);
  1654. },
  1655. secondary: function secondary(placement) {
  1656. var mainSide = placement === 'right' ? 'left' : 'top';
  1657. var value = popper[mainSide];
  1658. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  1659. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  1660. }
  1661. return defineProperty({}, mainSide, value);
  1662. }
  1663. };
  1664. order.forEach(function (placement) {
  1665. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  1666. popper = _extends({}, popper, check[side](placement));
  1667. });
  1668. data.offsets.popper = popper;
  1669. return data;
  1670. }
  1671. /**
  1672. * @function
  1673. * @memberof Modifiers
  1674. * @argument {Object} data - The data object generated by `update` method
  1675. * @argument {Object} options - Modifiers configuration and options
  1676. * @returns {Object} The data object, properly modified
  1677. */
  1678. function shift(data) {
  1679. var placement = data.placement;
  1680. var basePlacement = placement.split('-')[0];
  1681. var shiftvariation = placement.split('-')[1];
  1682. // if shift shiftvariation is specified, run the modifier
  1683. if (shiftvariation) {
  1684. var _data$offsets = data.offsets,
  1685. reference = _data$offsets.reference,
  1686. popper = _data$offsets.popper;
  1687. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  1688. var side = isVertical ? 'left' : 'top';
  1689. var measurement = isVertical ? 'width' : 'height';
  1690. var shiftOffsets = {
  1691. start: defineProperty({}, side, reference[side]),
  1692. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  1693. };
  1694. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  1695. }
  1696. return data;
  1697. }
  1698. /**
  1699. * @function
  1700. * @memberof Modifiers
  1701. * @argument {Object} data - The data object generated by update method
  1702. * @argument {Object} options - Modifiers configuration and options
  1703. * @returns {Object} The data object, properly modified
  1704. */
  1705. function hide(data) {
  1706. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  1707. return data;
  1708. }
  1709. var refRect = data.offsets.reference;
  1710. var bound = find(data.instance.modifiers, function (modifier) {
  1711. return modifier.name === 'preventOverflow';
  1712. }).boundaries;
  1713. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  1714. // Avoid unnecessary DOM access if visibility hasn't changed
  1715. if (data.hide === true) {
  1716. return data;
  1717. }
  1718. data.hide = true;
  1719. data.attributes['x-out-of-boundaries'] = '';
  1720. } else {
  1721. // Avoid unnecessary DOM access if visibility hasn't changed
  1722. if (data.hide === false) {
  1723. return data;
  1724. }
  1725. data.hide = false;
  1726. data.attributes['x-out-of-boundaries'] = false;
  1727. }
  1728. return data;
  1729. }
  1730. /**
  1731. * @function
  1732. * @memberof Modifiers
  1733. * @argument {Object} data - The data object generated by `update` method
  1734. * @argument {Object} options - Modifiers configuration and options
  1735. * @returns {Object} The data object, properly modified
  1736. */
  1737. function inner(data) {
  1738. var placement = data.placement;
  1739. var basePlacement = placement.split('-')[0];
  1740. var _data$offsets = data.offsets,
  1741. popper = _data$offsets.popper,
  1742. reference = _data$offsets.reference;
  1743. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  1744. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  1745. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  1746. data.placement = getOppositePlacement(placement);
  1747. data.offsets.popper = getClientRect(popper);
  1748. return data;
  1749. }
  1750. /**
  1751. * Modifier function, each modifier can have a function of this type assigned
  1752. * to its `fn` property.<br />
  1753. * These functions will be called on each update, this means that you must
  1754. * make sure they are performant enough to avoid performance bottlenecks.
  1755. *
  1756. * @function ModifierFn
  1757. * @argument {dataObject} data - The data object generated by `update` method
  1758. * @argument {Object} options - Modifiers configuration and options
  1759. * @returns {dataObject} The data object, properly modified
  1760. */
  1761. /**
  1762. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  1763. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  1764. * needed by the library.
  1765. *
  1766. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  1767. * All the other properties are configurations that could be tweaked.
  1768. * @namespace modifiers
  1769. */
  1770. var modifiers = {
  1771. /**
  1772. * Modifier used to shift the popper on the start or end of its reference
  1773. * element.<br />
  1774. * It will read the variation of the `placement` property.<br />
  1775. * It can be one either `-end` or `-start`.
  1776. * @memberof modifiers
  1777. * @inner
  1778. */
  1779. shift: {
  1780. /** @prop {number} order=100 - Index used to define the order of execution */
  1781. order: 100,
  1782. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  1783. enabled: true,
  1784. /** @prop {ModifierFn} */
  1785. fn: shift
  1786. },
  1787. /**
  1788. * The `offset` modifier can shift your popper on both its axis.
  1789. *
  1790. * It accepts the following units:
  1791. * - `px` or unit-less, interpreted as pixels
  1792. * - `%` or `%r`, percentage relative to the length of the reference element
  1793. * - `%p`, percentage relative to the length of the popper element
  1794. * - `vw`, CSS viewport width unit
  1795. * - `vh`, CSS viewport height unit
  1796. *
  1797. * For length is intended the main axis relative to the placement of the popper.<br />
  1798. * This means that if the placement is `top` or `bottom`, the length will be the
  1799. * `width`. In case of `left` or `right`, it will be the `height`.
  1800. *
  1801. * You can provide a single value (as `Number` or `String`), or a pair of values
  1802. * as `String` divided by a comma or one (or more) white spaces.<br />
  1803. * The latter is a deprecated method because it leads to confusion and will be
  1804. * removed in v2.<br />
  1805. * Additionally, it accepts additions and subtractions between different units.
  1806. * Note that multiplications and divisions aren't supported.
  1807. *
  1808. * Valid examples are:
  1809. * ```
  1810. * 10
  1811. * '10%'
  1812. * '10, 10'
  1813. * '10%, 10'
  1814. * '10 + 10%'
  1815. * '10 - 5vh + 3%'
  1816. * '-10px + 5vh, 5px - 6%'
  1817. * ```
  1818. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  1819. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  1820. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  1821. *
  1822. * @memberof modifiers
  1823. * @inner
  1824. */
  1825. offset: {
  1826. /** @prop {number} order=200 - Index used to define the order of execution */
  1827. order: 200,
  1828. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  1829. enabled: true,
  1830. /** @prop {ModifierFn} */
  1831. fn: offset,
  1832. /** @prop {Number|String} offset=0
  1833. * The offset value as described in the modifier description
  1834. */
  1835. offset: 0
  1836. },
  1837. /**
  1838. * Modifier used to prevent the popper from being positioned outside the boundary.
  1839. *
  1840. * A scenario exists where the reference itself is not within the boundaries.<br />
  1841. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  1842. * In this case we need to decide whether the popper should either:
  1843. *
  1844. * - detach from the reference and remain "trapped" in the boundaries, or
  1845. * - if it should ignore the boundary and "escape with its reference"
  1846. *
  1847. * When `escapeWithReference` is set to`true` and reference is completely
  1848. * outside its boundaries, the popper will overflow (or completely leave)
  1849. * the boundaries in order to remain attached to the edge of the reference.
  1850. *
  1851. * @memberof modifiers
  1852. * @inner
  1853. */
  1854. preventOverflow: {
  1855. /** @prop {number} order=300 - Index used to define the order of execution */
  1856. order: 300,
  1857. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  1858. enabled: true,
  1859. /** @prop {ModifierFn} */
  1860. fn: preventOverflow,
  1861. /**
  1862. * @prop {Array} [priority=['left','right','top','bottom']]
  1863. * Popper will try to prevent overflow following these priorities by default,
  1864. * then, it could overflow on the left and on top of the `boundariesElement`
  1865. */
  1866. priority: ['left', 'right', 'top', 'bottom'],
  1867. /**
  1868. * @prop {number} padding=5
  1869. * Amount of pixel used to define a minimum distance between the boundaries
  1870. * and the popper. This makes sure the popper always has a little padding
  1871. * between the edges of its container
  1872. */
  1873. padding: 5,
  1874. /**
  1875. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  1876. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  1877. * `viewport` or any DOM element.
  1878. */
  1879. boundariesElement: 'scrollParent'
  1880. },
  1881. /**
  1882. * Modifier used to make sure the reference and its popper stay near each other
  1883. * without leaving any gap between the two. Especially useful when the arrow is
  1884. * enabled and you want to ensure that it points to its reference element.
  1885. * It cares only about the first axis. You can still have poppers with margin
  1886. * between the popper and its reference element.
  1887. * @memberof modifiers
  1888. * @inner
  1889. */
  1890. keepTogether: {
  1891. /** @prop {number} order=400 - Index used to define the order of execution */
  1892. order: 400,
  1893. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  1894. enabled: true,
  1895. /** @prop {ModifierFn} */
  1896. fn: keepTogether
  1897. },
  1898. /**
  1899. * This modifier is used to move the `arrowElement` of the popper to make
  1900. * sure it is positioned between the reference element and its popper element.
  1901. * It will read the outer size of the `arrowElement` node to detect how many
  1902. * pixels of conjunction are needed.
  1903. *
  1904. * It has no effect if no `arrowElement` is provided.
  1905. * @memberof modifiers
  1906. * @inner
  1907. */
  1908. arrow: {
  1909. /** @prop {number} order=500 - Index used to define the order of execution */
  1910. order: 500,
  1911. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  1912. enabled: true,
  1913. /** @prop {ModifierFn} */
  1914. fn: arrow,
  1915. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  1916. element: '[x-arrow]'
  1917. },
  1918. /**
  1919. * Modifier used to flip the popper's placement when it starts to overlap its
  1920. * reference element.
  1921. *
  1922. * Requires the `preventOverflow` modifier before it in order to work.
  1923. *
  1924. * **NOTE:** this modifier will interrupt the current update cycle and will
  1925. * restart it if it detects the need to flip the placement.
  1926. * @memberof modifiers
  1927. * @inner
  1928. */
  1929. flip: {
  1930. /** @prop {number} order=600 - Index used to define the order of execution */
  1931. order: 600,
  1932. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  1933. enabled: true,
  1934. /** @prop {ModifierFn} */
  1935. fn: flip,
  1936. /**
  1937. * @prop {String|Array} behavior='flip'
  1938. * The behavior used to change the popper's placement. It can be one of
  1939. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  1940. * placements (with optional variations)
  1941. */
  1942. behavior: 'flip',
  1943. /**
  1944. * @prop {number} padding=5
  1945. * The popper will flip if it hits the edges of the `boundariesElement`
  1946. */
  1947. padding: 5,
  1948. /**
  1949. * @prop {String|HTMLElement} boundariesElement='viewport'
  1950. * The element which will define the boundaries of the popper position.
  1951. * The popper will never be placed outside of the defined boundaries
  1952. * (except if `keepTogether` is enabled)
  1953. */
  1954. boundariesElement: 'viewport',
  1955. /**
  1956. * @prop {Boolean} flipVariations=false
  1957. * The popper will switch placement variation between `-start` and `-end` when
  1958. * the reference element overlaps its boundaries.
  1959. *
  1960. * The original placement should have a set variation.
  1961. */
  1962. flipVariations: false,
  1963. /**
  1964. * @prop {Boolean} flipVariationsByContent=false
  1965. * The popper will switch placement variation between `-start` and `-end` when
  1966. * the popper element overlaps its reference boundaries.
  1967. *
  1968. * The original placement should have a set variation.
  1969. */
  1970. flipVariationsByContent: false
  1971. },
  1972. /**
  1973. * Modifier used to make the popper flow toward the inner of the reference element.
  1974. * By default, when this modifier is disabled, the popper will be placed outside
  1975. * the reference element.
  1976. * @memberof modifiers
  1977. * @inner
  1978. */
  1979. inner: {
  1980. /** @prop {number} order=700 - Index used to define the order of execution */
  1981. order: 700,
  1982. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  1983. enabled: false,
  1984. /** @prop {ModifierFn} */
  1985. fn: inner
  1986. },
  1987. /**
  1988. * Modifier used to hide the popper when its reference element is outside of the
  1989. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  1990. * be used to hide with a CSS selector the popper when its reference is
  1991. * out of boundaries.
  1992. *
  1993. * Requires the `preventOverflow` modifier before it in order to work.
  1994. * @memberof modifiers
  1995. * @inner
  1996. */
  1997. hide: {
  1998. /** @prop {number} order=800 - Index used to define the order of execution */
  1999. order: 800,
  2000. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  2001. enabled: true,
  2002. /** @prop {ModifierFn} */
  2003. fn: hide
  2004. },
  2005. /**
  2006. * Computes the style that will be applied to the popper element to gets
  2007. * properly positioned.
  2008. *
  2009. * Note that this modifier will not touch the DOM, it just prepares the styles
  2010. * so that `applyStyle` modifier can apply it. This separation is useful
  2011. * in case you need to replace `applyStyle` with a custom implementation.
  2012. *
  2013. * This modifier has `850` as `order` value to maintain backward compatibility
  2014. * with previous versions of Popper.js. Expect the modifiers ordering method
  2015. * to change in future major versions of the library.
  2016. *
  2017. * @memberof modifiers
  2018. * @inner
  2019. */
  2020. computeStyle: {
  2021. /** @prop {number} order=850 - Index used to define the order of execution */
  2022. order: 850,
  2023. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  2024. enabled: true,
  2025. /** @prop {ModifierFn} */
  2026. fn: computeStyle,
  2027. /**
  2028. * @prop {Boolean} gpuAcceleration=true
  2029. * If true, it uses the CSS 3D transformation to position the popper.
  2030. * Otherwise, it will use the `top` and `left` properties
  2031. */
  2032. gpuAcceleration: true,
  2033. /**
  2034. * @prop {string} [x='bottom']
  2035. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  2036. * Change this if your popper should grow in a direction different from `bottom`
  2037. */
  2038. x: 'bottom',
  2039. /**
  2040. * @prop {string} [x='left']
  2041. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  2042. * Change this if your popper should grow in a direction different from `right`
  2043. */
  2044. y: 'right'
  2045. },
  2046. /**
  2047. * Applies the computed styles to the popper element.
  2048. *
  2049. * All the DOM manipulations are limited to this modifier. This is useful in case
  2050. * you want to integrate Popper.js inside a framework or view library and you
  2051. * want to delegate all the DOM manipulations to it.
  2052. *
  2053. * Note that if you disable this modifier, you must make sure the popper element
  2054. * has its position set to `absolute` before Popper.js can do its work!
  2055. *
  2056. * Just disable this modifier and define your own to achieve the desired effect.
  2057. *
  2058. * @memberof modifiers
  2059. * @inner
  2060. */
  2061. applyStyle: {
  2062. /** @prop {number} order=900 - Index used to define the order of execution */
  2063. order: 900,
  2064. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  2065. enabled: true,
  2066. /** @prop {ModifierFn} */
  2067. fn: applyStyle,
  2068. /** @prop {Function} */
  2069. onLoad: applyStyleOnLoad,
  2070. /**
  2071. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  2072. * @prop {Boolean} gpuAcceleration=true
  2073. * If true, it uses the CSS 3D transformation to position the popper.
  2074. * Otherwise, it will use the `top` and `left` properties
  2075. */
  2076. gpuAcceleration: undefined
  2077. }
  2078. };
  2079. /**
  2080. * The `dataObject` is an object containing all the information used by Popper.js.
  2081. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  2082. * @name dataObject
  2083. * @property {Object} data.instance The Popper.js instance
  2084. * @property {String} data.placement Placement applied to popper
  2085. * @property {String} data.originalPlacement Placement originally defined on init
  2086. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  2087. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  2088. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  2089. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  2090. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  2091. * @property {Object} data.boundaries Offsets of the popper boundaries
  2092. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  2093. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  2094. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  2095. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  2096. */
  2097. /**
  2098. * Default options provided to Popper.js constructor.<br />
  2099. * These can be overridden using the `options` argument of Popper.js.<br />
  2100. * To override an option, simply pass an object with the same
  2101. * structure of the `options` object, as the 3rd argument. For example:
  2102. * ```
  2103. * new Popper(ref, pop, {
  2104. * modifiers: {
  2105. * preventOverflow: { enabled: false }
  2106. * }
  2107. * })
  2108. * ```
  2109. * @type {Object}
  2110. * @static
  2111. * @memberof Popper
  2112. */
  2113. var Defaults = {
  2114. /**
  2115. * Popper's placement.
  2116. * @prop {Popper.placements} placement='bottom'
  2117. */
  2118. placement: 'bottom',
  2119. /**
  2120. * Set this to true if you want popper to position it self in 'fixed' mode
  2121. * @prop {Boolean} positionFixed=false
  2122. */
  2123. positionFixed: false,
  2124. /**
  2125. * Whether events (resize, scroll) are initially enabled.
  2126. * @prop {Boolean} eventsEnabled=true
  2127. */
  2128. eventsEnabled: true,
  2129. /**
  2130. * Set to true if you want to automatically remove the popper when
  2131. * you call the `destroy` method.
  2132. * @prop {Boolean} removeOnDestroy=false
  2133. */
  2134. removeOnDestroy: false,
  2135. /**
  2136. * Callback called when the popper is created.<br />
  2137. * By default, it is set to no-op.<br />
  2138. * Access Popper.js instance with `data.instance`.
  2139. * @prop {onCreate}
  2140. */
  2141. onCreate: function onCreate() {},
  2142. /**
  2143. * Callback called when the popper is updated. This callback is not called
  2144. * on the initialization/creation of the popper, but only on subsequent
  2145. * updates.<br />
  2146. * By default, it is set to no-op.<br />
  2147. * Access Popper.js instance with `data.instance`.
  2148. * @prop {onUpdate}
  2149. */
  2150. onUpdate: function onUpdate() {},
  2151. /**
  2152. * List of modifiers used to modify the offsets before they are applied to the popper.
  2153. * They provide most of the functionalities of Popper.js.
  2154. * @prop {modifiers}
  2155. */
  2156. modifiers: modifiers
  2157. };
  2158. /**
  2159. * @callback onCreate
  2160. * @param {dataObject} data
  2161. */
  2162. /**
  2163. * @callback onUpdate
  2164. * @param {dataObject} data
  2165. */
  2166. // Utils
  2167. // Methods
  2168. var Popper = function () {
  2169. /**
  2170. * Creates a new Popper.js instance.
  2171. * @class Popper
  2172. * @param {Element|referenceObject} reference - The reference element used to position the popper
  2173. * @param {Element} popper - The HTML / XML element used as the popper
  2174. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  2175. * @return {Object} instance - The generated Popper.js instance
  2176. */
  2177. function Popper(reference, popper) {
  2178. var _this = this;
  2179. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2180. classCallCheck(this, Popper);
  2181. this.scheduleUpdate = function () {
  2182. return requestAnimationFrame(_this.update);
  2183. };
  2184. // make update() debounced, so that it only runs at most once-per-tick
  2185. this.update = debounce(this.update.bind(this));
  2186. // with {} we create a new object with the options inside it
  2187. this.options = _extends({}, Popper.Defaults, options);
  2188. // init state
  2189. this.state = {
  2190. isDestroyed: false,
  2191. isCreated: false,
  2192. scrollParents: []
  2193. };
  2194. // get reference and popper elements (allow jQuery wrappers)
  2195. this.reference = reference && reference.jquery ? reference[0] : reference;
  2196. this.popper = popper && popper.jquery ? popper[0] : popper;
  2197. // Deep merge modifiers options
  2198. this.options.modifiers = {};
  2199. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  2200. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  2201. });
  2202. // Refactoring modifiers' list (Object => Array)
  2203. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  2204. return _extends({
  2205. name: name
  2206. }, _this.options.modifiers[name]);
  2207. })
  2208. // sort the modifiers by order
  2209. .sort(function (a, b) {
  2210. return a.order - b.order;
  2211. });
  2212. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  2213. // such code is executed in the same order of its modifier
  2214. // they could add new properties to their options configuration
  2215. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  2216. this.modifiers.forEach(function (modifierOptions) {
  2217. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  2218. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  2219. }
  2220. });
  2221. // fire the first update to position the popper in the right place
  2222. this.update();
  2223. var eventsEnabled = this.options.eventsEnabled;
  2224. if (eventsEnabled) {
  2225. // setup event listeners, they will take care of update the position in specific situations
  2226. this.enableEventListeners();
  2227. }
  2228. this.state.eventsEnabled = eventsEnabled;
  2229. }
  2230. // We can't use class properties because they don't get listed in the
  2231. // class prototype and break stuff like Sinon stubs
  2232. createClass(Popper, [{
  2233. key: 'update',
  2234. value: function update$$1() {
  2235. return update.call(this);
  2236. }
  2237. }, {
  2238. key: 'destroy',
  2239. value: function destroy$$1() {
  2240. return destroy.call(this);
  2241. }
  2242. }, {
  2243. key: 'enableEventListeners',
  2244. value: function enableEventListeners$$1() {
  2245. return enableEventListeners.call(this);
  2246. }
  2247. }, {
  2248. key: 'disableEventListeners',
  2249. value: function disableEventListeners$$1() {
  2250. return disableEventListeners.call(this);
  2251. }
  2252. /**
  2253. * Schedules an update. It will run on the next UI update available.
  2254. * @method scheduleUpdate
  2255. * @memberof Popper
  2256. */
  2257. /**
  2258. * Collection of utilities useful when writing custom modifiers.
  2259. * Starting from version 1.7, this method is available only if you
  2260. * include `popper-utils.js` before `popper.js`.
  2261. *
  2262. * **DEPRECATION**: This way to access PopperUtils is deprecated
  2263. * and will be removed in v2! Use the PopperUtils module directly instead.
  2264. * Due to the high instability of the methods contained in Utils, we can't
  2265. * guarantee them to follow semver. Use them at your own risk!
  2266. * @static
  2267. * @private
  2268. * @type {Object}
  2269. * @deprecated since version 1.8
  2270. * @member Utils
  2271. * @memberof Popper
  2272. */
  2273. }]);
  2274. return Popper;
  2275. }();
  2276. /**
  2277. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  2278. * and lets you use it as replacement of a real DOM node.<br />
  2279. * You can use this method to position a popper relatively to a set of coordinates
  2280. * in case you don't have a DOM node to use as reference.
  2281. *
  2282. * ```
  2283. * new Popper(referenceObject, popperNode);
  2284. * ```
  2285. *
  2286. * NB: This feature isn't supported in Internet Explorer 10.
  2287. * @name referenceObject
  2288. * @property {Function} data.getBoundingClientRect
  2289. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  2290. * @property {number} data.clientWidth
  2291. * An ES6 getter that will return the width of the virtual reference element.
  2292. * @property {number} data.clientHeight
  2293. * An ES6 getter that will return the height of the virtual reference element.
  2294. */
  2295. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  2296. Popper.placements = placements;
  2297. Popper.Defaults = Defaults;
  2298. return Popper;
  2299. })));
  2300. //# sourceMappingURL=popper.js.map
  2301. /*!
  2302. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2303. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2304. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2305. */
  2306. (function (global, factory) {
  2307. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
  2308. typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  2309. (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
  2310. }(this, (function (exports, $, Popper) { 'use strict';
  2311. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2312. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2313. function _defineProperties(target, props) {
  2314. for (var i = 0; i < props.length; i++) {
  2315. var descriptor = props[i];
  2316. descriptor.enumerable = descriptor.enumerable || false;
  2317. descriptor.configurable = true;
  2318. if ("value" in descriptor) descriptor.writable = true;
  2319. Object.defineProperty(target, descriptor.key, descriptor);
  2320. }
  2321. }
  2322. function _createClass(Constructor, protoProps, staticProps) {
  2323. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2324. if (staticProps) _defineProperties(Constructor, staticProps);
  2325. return Constructor;
  2326. }
  2327. function _defineProperty(obj, key, value) {
  2328. if (key in obj) {
  2329. Object.defineProperty(obj, key, {
  2330. value: value,
  2331. enumerable: true,
  2332. configurable: true,
  2333. writable: true
  2334. });
  2335. } else {
  2336. obj[key] = value;
  2337. }
  2338. return obj;
  2339. }
  2340. function ownKeys(object, enumerableOnly) {
  2341. var keys = Object.keys(object);
  2342. if (Object.getOwnPropertySymbols) {
  2343. var symbols = Object.getOwnPropertySymbols(object);
  2344. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2345. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2346. });
  2347. keys.push.apply(keys, symbols);
  2348. }
  2349. return keys;
  2350. }
  2351. function _objectSpread2(target) {
  2352. for (var i = 1; i < arguments.length; i++) {
  2353. var source = arguments[i] != null ? arguments[i] : {};
  2354. if (i % 2) {
  2355. ownKeys(Object(source), true).forEach(function (key) {
  2356. _defineProperty(target, key, source[key]);
  2357. });
  2358. } else if (Object.getOwnPropertyDescriptors) {
  2359. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2360. } else {
  2361. ownKeys(Object(source)).forEach(function (key) {
  2362. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2363. });
  2364. }
  2365. }
  2366. return target;
  2367. }
  2368. function _inheritsLoose(subClass, superClass) {
  2369. subClass.prototype = Object.create(superClass.prototype);
  2370. subClass.prototype.constructor = subClass;
  2371. subClass.__proto__ = superClass;
  2372. }
  2373. /**
  2374. * --------------------------------------------------------------------------
  2375. * Bootstrap (v4.4.1): util.js
  2376. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2377. * --------------------------------------------------------------------------
  2378. */
  2379. /**
  2380. * ------------------------------------------------------------------------
  2381. * Private TransitionEnd Helpers
  2382. * ------------------------------------------------------------------------
  2383. */
  2384. var TRANSITION_END = 'transitionend';
  2385. var MAX_UID = 1000000;
  2386. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2387. function toType(obj) {
  2388. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2389. }
  2390. function getSpecialTransitionEndEvent() {
  2391. return {
  2392. bindType: TRANSITION_END,
  2393. delegateType: TRANSITION_END,
  2394. handle: function handle(event) {
  2395. if ($(event.target).is(this)) {
  2396. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2397. }
  2398. return undefined; // eslint-disable-line no-undefined
  2399. }
  2400. };
  2401. }
  2402. function transitionEndEmulator(duration) {
  2403. var _this = this;
  2404. var called = false;
  2405. $(this).one(Util.TRANSITION_END, function () {
  2406. called = true;
  2407. });
  2408. setTimeout(function () {
  2409. if (!called) {
  2410. Util.triggerTransitionEnd(_this);
  2411. }
  2412. }, duration);
  2413. return this;
  2414. }
  2415. function setTransitionEndSupport() {
  2416. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2417. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2418. }
  2419. /**
  2420. * --------------------------------------------------------------------------
  2421. * Public Util Api
  2422. * --------------------------------------------------------------------------
  2423. */
  2424. var Util = {
  2425. TRANSITION_END: 'bsTransitionEnd',
  2426. getUID: function getUID(prefix) {
  2427. do {
  2428. // eslint-disable-next-line no-bitwise
  2429. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2430. } while (document.getElementById(prefix));
  2431. return prefix;
  2432. },
  2433. getSelectorFromElement: function getSelectorFromElement(element) {
  2434. var selector = element.getAttribute('data-target');
  2435. if (!selector || selector === '#') {
  2436. var hrefAttr = element.getAttribute('href');
  2437. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2438. }
  2439. try {
  2440. return document.querySelector(selector) ? selector : null;
  2441. } catch (err) {
  2442. return null;
  2443. }
  2444. },
  2445. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2446. if (!element) {
  2447. return 0;
  2448. } // Get transition-duration of the element
  2449. var transitionDuration = $(element).css('transition-duration');
  2450. var transitionDelay = $(element).css('transition-delay');
  2451. var floatTransitionDuration = parseFloat(transitionDuration);
  2452. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2453. if (!floatTransitionDuration && !floatTransitionDelay) {
  2454. return 0;
  2455. } // If multiple durations are defined, take the first
  2456. transitionDuration = transitionDuration.split(',')[0];
  2457. transitionDelay = transitionDelay.split(',')[0];
  2458. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2459. },
  2460. reflow: function reflow(element) {
  2461. return element.offsetHeight;
  2462. },
  2463. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2464. $(element).trigger(TRANSITION_END);
  2465. },
  2466. // TODO: Remove in v5
  2467. supportsTransitionEnd: function supportsTransitionEnd() {
  2468. return Boolean(TRANSITION_END);
  2469. },
  2470. isElement: function isElement(obj) {
  2471. return (obj[0] || obj).nodeType;
  2472. },
  2473. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2474. for (var property in configTypes) {
  2475. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2476. var expectedTypes = configTypes[property];
  2477. var value = config[property];
  2478. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2479. if (!new RegExp(expectedTypes).test(valueType)) {
  2480. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2481. }
  2482. }
  2483. }
  2484. },
  2485. findShadowRoot: function findShadowRoot(element) {
  2486. if (!document.documentElement.attachShadow) {
  2487. return null;
  2488. } // Can find the shadow root otherwise it'll return the document
  2489. if (typeof element.getRootNode === 'function') {
  2490. var root = element.getRootNode();
  2491. return root instanceof ShadowRoot ? root : null;
  2492. }
  2493. if (element instanceof ShadowRoot) {
  2494. return element;
  2495. } // when we don't find a shadow root
  2496. if (!element.parentNode) {
  2497. return null;
  2498. }
  2499. return Util.findShadowRoot(element.parentNode);
  2500. },
  2501. jQueryDetection: function jQueryDetection() {
  2502. if (typeof $ === 'undefined') {
  2503. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2504. }
  2505. var version = $.fn.jquery.split(' ')[0].split('.');
  2506. var minMajor = 1;
  2507. var ltMajor = 2;
  2508. var minMinor = 9;
  2509. var minPatch = 1;
  2510. var maxMajor = 4;
  2511. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2512. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2513. }
  2514. }
  2515. };
  2516. Util.jQueryDetection();
  2517. setTransitionEndSupport();
  2518. /**
  2519. * ------------------------------------------------------------------------
  2520. * Constants
  2521. * ------------------------------------------------------------------------
  2522. */
  2523. var NAME = 'alert';
  2524. var VERSION = '4.4.1';
  2525. var DATA_KEY = 'bs.alert';
  2526. var EVENT_KEY = "." + DATA_KEY;
  2527. var DATA_API_KEY = '.data-api';
  2528. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2529. var Selector = {
  2530. DISMISS: '[data-dismiss="alert"]'
  2531. };
  2532. var Event = {
  2533. CLOSE: "close" + EVENT_KEY,
  2534. CLOSED: "closed" + EVENT_KEY,
  2535. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2536. };
  2537. var ClassName = {
  2538. ALERT: 'alert',
  2539. FADE: 'fade',
  2540. SHOW: 'show'
  2541. };
  2542. /**
  2543. * ------------------------------------------------------------------------
  2544. * Class Definition
  2545. * ------------------------------------------------------------------------
  2546. */
  2547. var Alert =
  2548. /*#__PURE__*/
  2549. function () {
  2550. function Alert(element) {
  2551. this._element = element;
  2552. } // Getters
  2553. var _proto = Alert.prototype;
  2554. // Public
  2555. _proto.close = function close(element) {
  2556. var rootElement = this._element;
  2557. if (element) {
  2558. rootElement = this._getRootElement(element);
  2559. }
  2560. var customEvent = this._triggerCloseEvent(rootElement);
  2561. if (customEvent.isDefaultPrevented()) {
  2562. return;
  2563. }
  2564. this._removeElement(rootElement);
  2565. };
  2566. _proto.dispose = function dispose() {
  2567. $.removeData(this._element, DATA_KEY);
  2568. this._element = null;
  2569. } // Private
  2570. ;
  2571. _proto._getRootElement = function _getRootElement(element) {
  2572. var selector = Util.getSelectorFromElement(element);
  2573. var parent = false;
  2574. if (selector) {
  2575. parent = document.querySelector(selector);
  2576. }
  2577. if (!parent) {
  2578. parent = $(element).closest("." + ClassName.ALERT)[0];
  2579. }
  2580. return parent;
  2581. };
  2582. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2583. var closeEvent = $.Event(Event.CLOSE);
  2584. $(element).trigger(closeEvent);
  2585. return closeEvent;
  2586. };
  2587. _proto._removeElement = function _removeElement(element) {
  2588. var _this = this;
  2589. $(element).removeClass(ClassName.SHOW);
  2590. if (!$(element).hasClass(ClassName.FADE)) {
  2591. this._destroyElement(element);
  2592. return;
  2593. }
  2594. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2595. $(element).one(Util.TRANSITION_END, function (event) {
  2596. return _this._destroyElement(element, event);
  2597. }).emulateTransitionEnd(transitionDuration);
  2598. };
  2599. _proto._destroyElement = function _destroyElement(element) {
  2600. $(element).detach().trigger(Event.CLOSED).remove();
  2601. } // Static
  2602. ;
  2603. Alert._jQueryInterface = function _jQueryInterface(config) {
  2604. return this.each(function () {
  2605. var $element = $(this);
  2606. var data = $element.data(DATA_KEY);
  2607. if (!data) {
  2608. data = new Alert(this);
  2609. $element.data(DATA_KEY, data);
  2610. }
  2611. if (config === 'close') {
  2612. data[config](this);
  2613. }
  2614. });
  2615. };
  2616. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2617. return function (event) {
  2618. if (event) {
  2619. event.preventDefault();
  2620. }
  2621. alertInstance.close(this);
  2622. };
  2623. };
  2624. _createClass(Alert, null, [{
  2625. key: "VERSION",
  2626. get: function get() {
  2627. return VERSION;
  2628. }
  2629. }]);
  2630. return Alert;
  2631. }();
  2632. /**
  2633. * ------------------------------------------------------------------------
  2634. * Data Api implementation
  2635. * ------------------------------------------------------------------------
  2636. */
  2637. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2638. /**
  2639. * ------------------------------------------------------------------------
  2640. * jQuery
  2641. * ------------------------------------------------------------------------
  2642. */
  2643. $.fn[NAME] = Alert._jQueryInterface;
  2644. $.fn[NAME].Constructor = Alert;
  2645. $.fn[NAME].noConflict = function () {
  2646. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2647. return Alert._jQueryInterface;
  2648. };
  2649. /**
  2650. * ------------------------------------------------------------------------
  2651. * Constants
  2652. * ------------------------------------------------------------------------
  2653. */
  2654. var NAME$1 = 'button';
  2655. var VERSION$1 = '4.4.1';
  2656. var DATA_KEY$1 = 'bs.button';
  2657. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2658. var DATA_API_KEY$1 = '.data-api';
  2659. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2660. var ClassName$1 = {
  2661. ACTIVE: 'active',
  2662. BUTTON: 'btn',
  2663. FOCUS: 'focus'
  2664. };
  2665. var Selector$1 = {
  2666. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2667. DATA_TOGGLES: '[data-toggle="buttons"]',
  2668. DATA_TOGGLE: '[data-toggle="button"]',
  2669. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2670. INPUT: 'input:not([type="hidden"])',
  2671. ACTIVE: '.active',
  2672. BUTTON: '.btn'
  2673. };
  2674. var Event$1 = {
  2675. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2676. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2677. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2678. };
  2679. /**
  2680. * ------------------------------------------------------------------------
  2681. * Class Definition
  2682. * ------------------------------------------------------------------------
  2683. */
  2684. var Button =
  2685. /*#__PURE__*/
  2686. function () {
  2687. function Button(element) {
  2688. this._element = element;
  2689. } // Getters
  2690. var _proto = Button.prototype;
  2691. // Public
  2692. _proto.toggle = function toggle() {
  2693. var triggerChangeEvent = true;
  2694. var addAriaPressed = true;
  2695. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2696. if (rootElement) {
  2697. var input = this._element.querySelector(Selector$1.INPUT);
  2698. if (input) {
  2699. if (input.type === 'radio') {
  2700. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2701. triggerChangeEvent = false;
  2702. } else {
  2703. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2704. if (activeElement) {
  2705. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2706. }
  2707. }
  2708. } else if (input.type === 'checkbox') {
  2709. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2710. triggerChangeEvent = false;
  2711. }
  2712. } else {
  2713. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2714. triggerChangeEvent = false;
  2715. }
  2716. if (triggerChangeEvent) {
  2717. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2718. $(input).trigger('change');
  2719. }
  2720. input.focus();
  2721. addAriaPressed = false;
  2722. }
  2723. }
  2724. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2725. if (addAriaPressed) {
  2726. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2727. }
  2728. if (triggerChangeEvent) {
  2729. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2730. }
  2731. }
  2732. };
  2733. _proto.dispose = function dispose() {
  2734. $.removeData(this._element, DATA_KEY$1);
  2735. this._element = null;
  2736. } // Static
  2737. ;
  2738. Button._jQueryInterface = function _jQueryInterface(config) {
  2739. return this.each(function () {
  2740. var data = $(this).data(DATA_KEY$1);
  2741. if (!data) {
  2742. data = new Button(this);
  2743. $(this).data(DATA_KEY$1, data);
  2744. }
  2745. if (config === 'toggle') {
  2746. data[config]();
  2747. }
  2748. });
  2749. };
  2750. _createClass(Button, null, [{
  2751. key: "VERSION",
  2752. get: function get() {
  2753. return VERSION$1;
  2754. }
  2755. }]);
  2756. return Button;
  2757. }();
  2758. /**
  2759. * ------------------------------------------------------------------------
  2760. * Data Api implementation
  2761. * ------------------------------------------------------------------------
  2762. */
  2763. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2764. var button = event.target;
  2765. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2766. button = $(button).closest(Selector$1.BUTTON)[0];
  2767. }
  2768. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2769. event.preventDefault(); // work around Firefox bug #1540995
  2770. } else {
  2771. var inputBtn = button.querySelector(Selector$1.INPUT);
  2772. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2773. event.preventDefault(); // work around Firefox bug #1540995
  2774. return;
  2775. }
  2776. Button._jQueryInterface.call($(button), 'toggle');
  2777. }
  2778. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2779. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2780. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2781. });
  2782. $(window).on(Event$1.LOAD_DATA_API, function () {
  2783. // ensure correct active class is set to match the controls' actual values/states
  2784. // find all checkboxes/readio buttons inside data-toggle groups
  2785. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2786. for (var i = 0, len = buttons.length; i < len; i++) {
  2787. var button = buttons[i];
  2788. var input = button.querySelector(Selector$1.INPUT);
  2789. if (input.checked || input.hasAttribute('checked')) {
  2790. button.classList.add(ClassName$1.ACTIVE);
  2791. } else {
  2792. button.classList.remove(ClassName$1.ACTIVE);
  2793. }
  2794. } // find all button toggles
  2795. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2796. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2797. var _button = buttons[_i];
  2798. if (_button.getAttribute('aria-pressed') === 'true') {
  2799. _button.classList.add(ClassName$1.ACTIVE);
  2800. } else {
  2801. _button.classList.remove(ClassName$1.ACTIVE);
  2802. }
  2803. }
  2804. });
  2805. /**
  2806. * ------------------------------------------------------------------------
  2807. * jQuery
  2808. * ------------------------------------------------------------------------
  2809. */
  2810. $.fn[NAME$1] = Button._jQueryInterface;
  2811. $.fn[NAME$1].Constructor = Button;
  2812. $.fn[NAME$1].noConflict = function () {
  2813. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2814. return Button._jQueryInterface;
  2815. };
  2816. /**
  2817. * ------------------------------------------------------------------------
  2818. * Constants
  2819. * ------------------------------------------------------------------------
  2820. */
  2821. var NAME$2 = 'carousel';
  2822. var VERSION$2 = '4.4.1';
  2823. var DATA_KEY$2 = 'bs.carousel';
  2824. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2825. var DATA_API_KEY$2 = '.data-api';
  2826. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2827. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2828. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2829. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2830. var SWIPE_THRESHOLD = 40;
  2831. var Default = {
  2832. interval: 5000,
  2833. keyboard: true,
  2834. slide: false,
  2835. pause: 'hover',
  2836. wrap: true,
  2837. touch: true
  2838. };
  2839. var DefaultType = {
  2840. interval: '(number|boolean)',
  2841. keyboard: 'boolean',
  2842. slide: '(boolean|string)',
  2843. pause: '(string|boolean)',
  2844. wrap: 'boolean',
  2845. touch: 'boolean'
  2846. };
  2847. var Direction = {
  2848. NEXT: 'next',
  2849. PREV: 'prev',
  2850. LEFT: 'left',
  2851. RIGHT: 'right'
  2852. };
  2853. var Event$2 = {
  2854. SLIDE: "slide" + EVENT_KEY$2,
  2855. SLID: "slid" + EVENT_KEY$2,
  2856. KEYDOWN: "keydown" + EVENT_KEY$2,
  2857. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2858. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2859. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2860. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2861. TOUCHEND: "touchend" + EVENT_KEY$2,
  2862. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2863. POINTERUP: "pointerup" + EVENT_KEY$2,
  2864. DRAG_START: "dragstart" + EVENT_KEY$2,
  2865. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2866. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2867. };
  2868. var ClassName$2 = {
  2869. CAROUSEL: 'carousel',
  2870. ACTIVE: 'active',
  2871. SLIDE: 'slide',
  2872. RIGHT: 'carousel-item-right',
  2873. LEFT: 'carousel-item-left',
  2874. NEXT: 'carousel-item-next',
  2875. PREV: 'carousel-item-prev',
  2876. ITEM: 'carousel-item',
  2877. POINTER_EVENT: 'pointer-event'
  2878. };
  2879. var Selector$2 = {
  2880. ACTIVE: '.active',
  2881. ACTIVE_ITEM: '.active.carousel-item',
  2882. ITEM: '.carousel-item',
  2883. ITEM_IMG: '.carousel-item img',
  2884. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2885. INDICATORS: '.carousel-indicators',
  2886. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2887. DATA_RIDE: '[data-ride="carousel"]'
  2888. };
  2889. var PointerType = {
  2890. TOUCH: 'touch',
  2891. PEN: 'pen'
  2892. };
  2893. /**
  2894. * ------------------------------------------------------------------------
  2895. * Class Definition
  2896. * ------------------------------------------------------------------------
  2897. */
  2898. var Carousel =
  2899. /*#__PURE__*/
  2900. function () {
  2901. function Carousel(element, config) {
  2902. this._items = null;
  2903. this._interval = null;
  2904. this._activeElement = null;
  2905. this._isPaused = false;
  2906. this._isSliding = false;
  2907. this.touchTimeout = null;
  2908. this.touchStartX = 0;
  2909. this.touchDeltaX = 0;
  2910. this._config = this._getConfig(config);
  2911. this._element = element;
  2912. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2913. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2914. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2915. this._addEventListeners();
  2916. } // Getters
  2917. var _proto = Carousel.prototype;
  2918. // Public
  2919. _proto.next = function next() {
  2920. if (!this._isSliding) {
  2921. this._slide(Direction.NEXT);
  2922. }
  2923. };
  2924. _proto.nextWhenVisible = function nextWhenVisible() {
  2925. // Don't call next when the page isn't visible
  2926. // or the carousel or its parent isn't visible
  2927. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2928. this.next();
  2929. }
  2930. };
  2931. _proto.prev = function prev() {
  2932. if (!this._isSliding) {
  2933. this._slide(Direction.PREV);
  2934. }
  2935. };
  2936. _proto.pause = function pause(event) {
  2937. if (!event) {
  2938. this._isPaused = true;
  2939. }
  2940. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2941. Util.triggerTransitionEnd(this._element);
  2942. this.cycle(true);
  2943. }
  2944. clearInterval(this._interval);
  2945. this._interval = null;
  2946. };
  2947. _proto.cycle = function cycle(event) {
  2948. if (!event) {
  2949. this._isPaused = false;
  2950. }
  2951. if (this._interval) {
  2952. clearInterval(this._interval);
  2953. this._interval = null;
  2954. }
  2955. if (this._config.interval && !this._isPaused) {
  2956. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2957. }
  2958. };
  2959. _proto.to = function to(index) {
  2960. var _this = this;
  2961. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2962. var activeIndex = this._getItemIndex(this._activeElement);
  2963. if (index > this._items.length - 1 || index < 0) {
  2964. return;
  2965. }
  2966. if (this._isSliding) {
  2967. $(this._element).one(Event$2.SLID, function () {
  2968. return _this.to(index);
  2969. });
  2970. return;
  2971. }
  2972. if (activeIndex === index) {
  2973. this.pause();
  2974. this.cycle();
  2975. return;
  2976. }
  2977. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2978. this._slide(direction, this._items[index]);
  2979. };
  2980. _proto.dispose = function dispose() {
  2981. $(this._element).off(EVENT_KEY$2);
  2982. $.removeData(this._element, DATA_KEY$2);
  2983. this._items = null;
  2984. this._config = null;
  2985. this._element = null;
  2986. this._interval = null;
  2987. this._isPaused = null;
  2988. this._isSliding = null;
  2989. this._activeElement = null;
  2990. this._indicatorsElement = null;
  2991. } // Private
  2992. ;
  2993. _proto._getConfig = function _getConfig(config) {
  2994. config = _objectSpread2({}, Default, {}, config);
  2995. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2996. return config;
  2997. };
  2998. _proto._handleSwipe = function _handleSwipe() {
  2999. var absDeltax = Math.abs(this.touchDeltaX);
  3000. if (absDeltax <= SWIPE_THRESHOLD) {
  3001. return;
  3002. }
  3003. var direction = absDeltax / this.touchDeltaX;
  3004. this.touchDeltaX = 0; // swipe left
  3005. if (direction > 0) {
  3006. this.prev();
  3007. } // swipe right
  3008. if (direction < 0) {
  3009. this.next();
  3010. }
  3011. };
  3012. _proto._addEventListeners = function _addEventListeners() {
  3013. var _this2 = this;
  3014. if (this._config.keyboard) {
  3015. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3016. return _this2._keydown(event);
  3017. });
  3018. }
  3019. if (this._config.pause === 'hover') {
  3020. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3021. return _this2.pause(event);
  3022. }).on(Event$2.MOUSELEAVE, function (event) {
  3023. return _this2.cycle(event);
  3024. });
  3025. }
  3026. if (this._config.touch) {
  3027. this._addTouchEventListeners();
  3028. }
  3029. };
  3030. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3031. var _this3 = this;
  3032. if (!this._touchSupported) {
  3033. return;
  3034. }
  3035. var start = function start(event) {
  3036. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3037. _this3.touchStartX = event.originalEvent.clientX;
  3038. } else if (!_this3._pointerEvent) {
  3039. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3040. }
  3041. };
  3042. var move = function move(event) {
  3043. // ensure swiping with one touch and not pinching
  3044. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3045. _this3.touchDeltaX = 0;
  3046. } else {
  3047. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3048. }
  3049. };
  3050. var end = function end(event) {
  3051. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3052. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3053. }
  3054. _this3._handleSwipe();
  3055. if (_this3._config.pause === 'hover') {
  3056. // If it's a touch-enabled device, mouseenter/leave are fired as
  3057. // part of the mouse compatibility events on first tap - the carousel
  3058. // would stop cycling until user tapped out of it;
  3059. // here, we listen for touchend, explicitly pause the carousel
  3060. // (as if it's the second time we tap on it, mouseenter compat event
  3061. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3062. // events to fire) we explicitly restart cycling
  3063. _this3.pause();
  3064. if (_this3.touchTimeout) {
  3065. clearTimeout(_this3.touchTimeout);
  3066. }
  3067. _this3.touchTimeout = setTimeout(function (event) {
  3068. return _this3.cycle(event);
  3069. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3070. }
  3071. };
  3072. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3073. return e.preventDefault();
  3074. });
  3075. if (this._pointerEvent) {
  3076. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3077. return start(event);
  3078. });
  3079. $(this._element).on(Event$2.POINTERUP, function (event) {
  3080. return end(event);
  3081. });
  3082. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3083. } else {
  3084. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3085. return start(event);
  3086. });
  3087. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3088. return move(event);
  3089. });
  3090. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3091. return end(event);
  3092. });
  3093. }
  3094. };
  3095. _proto._keydown = function _keydown(event) {
  3096. if (/input|textarea/i.test(event.target.tagName)) {
  3097. return;
  3098. }
  3099. switch (event.which) {
  3100. case ARROW_LEFT_KEYCODE:
  3101. event.preventDefault();
  3102. this.prev();
  3103. break;
  3104. case ARROW_RIGHT_KEYCODE:
  3105. event.preventDefault();
  3106. this.next();
  3107. break;
  3108. }
  3109. };
  3110. _proto._getItemIndex = function _getItemIndex(element) {
  3111. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3112. return this._items.indexOf(element);
  3113. };
  3114. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3115. var isNextDirection = direction === Direction.NEXT;
  3116. var isPrevDirection = direction === Direction.PREV;
  3117. var activeIndex = this._getItemIndex(activeElement);
  3118. var lastItemIndex = this._items.length - 1;
  3119. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3120. if (isGoingToWrap && !this._config.wrap) {
  3121. return activeElement;
  3122. }
  3123. var delta = direction === Direction.PREV ? -1 : 1;
  3124. var itemIndex = (activeIndex + delta) % this._items.length;
  3125. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3126. };
  3127. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3128. var targetIndex = this._getItemIndex(relatedTarget);
  3129. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3130. var slideEvent = $.Event(Event$2.SLIDE, {
  3131. relatedTarget: relatedTarget,
  3132. direction: eventDirectionName,
  3133. from: fromIndex,
  3134. to: targetIndex
  3135. });
  3136. $(this._element).trigger(slideEvent);
  3137. return slideEvent;
  3138. };
  3139. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3140. if (this._indicatorsElement) {
  3141. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3142. $(indicators).removeClass(ClassName$2.ACTIVE);
  3143. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3144. if (nextIndicator) {
  3145. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3146. }
  3147. }
  3148. };
  3149. _proto._slide = function _slide(direction, element) {
  3150. var _this4 = this;
  3151. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3152. var activeElementIndex = this._getItemIndex(activeElement);
  3153. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3154. var nextElementIndex = this._getItemIndex(nextElement);
  3155. var isCycling = Boolean(this._interval);
  3156. var directionalClassName;
  3157. var orderClassName;
  3158. var eventDirectionName;
  3159. if (direction === Direction.NEXT) {
  3160. directionalClassName = ClassName$2.LEFT;
  3161. orderClassName = ClassName$2.NEXT;
  3162. eventDirectionName = Direction.LEFT;
  3163. } else {
  3164. directionalClassName = ClassName$2.RIGHT;
  3165. orderClassName = ClassName$2.PREV;
  3166. eventDirectionName = Direction.RIGHT;
  3167. }
  3168. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3169. this._isSliding = false;
  3170. return;
  3171. }
  3172. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3173. if (slideEvent.isDefaultPrevented()) {
  3174. return;
  3175. }
  3176. if (!activeElement || !nextElement) {
  3177. // Some weirdness is happening, so we bail
  3178. return;
  3179. }
  3180. this._isSliding = true;
  3181. if (isCycling) {
  3182. this.pause();
  3183. }
  3184. this._setActiveIndicatorElement(nextElement);
  3185. var slidEvent = $.Event(Event$2.SLID, {
  3186. relatedTarget: nextElement,
  3187. direction: eventDirectionName,
  3188. from: activeElementIndex,
  3189. to: nextElementIndex
  3190. });
  3191. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3192. $(nextElement).addClass(orderClassName);
  3193. Util.reflow(nextElement);
  3194. $(activeElement).addClass(directionalClassName);
  3195. $(nextElement).addClass(directionalClassName);
  3196. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3197. if (nextElementInterval) {
  3198. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3199. this._config.interval = nextElementInterval;
  3200. } else {
  3201. this._config.interval = this._config.defaultInterval || this._config.interval;
  3202. }
  3203. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3204. $(activeElement).one(Util.TRANSITION_END, function () {
  3205. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3206. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3207. _this4._isSliding = false;
  3208. setTimeout(function () {
  3209. return $(_this4._element).trigger(slidEvent);
  3210. }, 0);
  3211. }).emulateTransitionEnd(transitionDuration);
  3212. } else {
  3213. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3214. $(nextElement).addClass(ClassName$2.ACTIVE);
  3215. this._isSliding = false;
  3216. $(this._element).trigger(slidEvent);
  3217. }
  3218. if (isCycling) {
  3219. this.cycle();
  3220. }
  3221. } // Static
  3222. ;
  3223. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3224. return this.each(function () {
  3225. var data = $(this).data(DATA_KEY$2);
  3226. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3227. if (typeof config === 'object') {
  3228. _config = _objectSpread2({}, _config, {}, config);
  3229. }
  3230. var action = typeof config === 'string' ? config : _config.slide;
  3231. if (!data) {
  3232. data = new Carousel(this, _config);
  3233. $(this).data(DATA_KEY$2, data);
  3234. }
  3235. if (typeof config === 'number') {
  3236. data.to(config);
  3237. } else if (typeof action === 'string') {
  3238. if (typeof data[action] === 'undefined') {
  3239. throw new TypeError("No method named \"" + action + "\"");
  3240. }
  3241. data[action]();
  3242. } else if (_config.interval && _config.ride) {
  3243. data.pause();
  3244. data.cycle();
  3245. }
  3246. });
  3247. };
  3248. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3249. var selector = Util.getSelectorFromElement(this);
  3250. if (!selector) {
  3251. return;
  3252. }
  3253. var target = $(selector)[0];
  3254. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3255. return;
  3256. }
  3257. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3258. var slideIndex = this.getAttribute('data-slide-to');
  3259. if (slideIndex) {
  3260. config.interval = false;
  3261. }
  3262. Carousel._jQueryInterface.call($(target), config);
  3263. if (slideIndex) {
  3264. $(target).data(DATA_KEY$2).to(slideIndex);
  3265. }
  3266. event.preventDefault();
  3267. };
  3268. _createClass(Carousel, null, [{
  3269. key: "VERSION",
  3270. get: function get() {
  3271. return VERSION$2;
  3272. }
  3273. }, {
  3274. key: "Default",
  3275. get: function get() {
  3276. return Default;
  3277. }
  3278. }]);
  3279. return Carousel;
  3280. }();
  3281. /**
  3282. * ------------------------------------------------------------------------
  3283. * Data Api implementation
  3284. * ------------------------------------------------------------------------
  3285. */
  3286. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3287. $(window).on(Event$2.LOAD_DATA_API, function () {
  3288. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3289. for (var i = 0, len = carousels.length; i < len; i++) {
  3290. var $carousel = $(carousels[i]);
  3291. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3292. }
  3293. });
  3294. /**
  3295. * ------------------------------------------------------------------------
  3296. * jQuery
  3297. * ------------------------------------------------------------------------
  3298. */
  3299. $.fn[NAME$2] = Carousel._jQueryInterface;
  3300. $.fn[NAME$2].Constructor = Carousel;
  3301. $.fn[NAME$2].noConflict = function () {
  3302. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3303. return Carousel._jQueryInterface;
  3304. };
  3305. /**
  3306. * ------------------------------------------------------------------------
  3307. * Constants
  3308. * ------------------------------------------------------------------------
  3309. */
  3310. var NAME$3 = 'collapse';
  3311. var VERSION$3 = '4.4.1';
  3312. var DATA_KEY$3 = 'bs.collapse';
  3313. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3314. var DATA_API_KEY$3 = '.data-api';
  3315. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3316. var Default$1 = {
  3317. toggle: true,
  3318. parent: ''
  3319. };
  3320. var DefaultType$1 = {
  3321. toggle: 'boolean',
  3322. parent: '(string|element)'
  3323. };
  3324. var Event$3 = {
  3325. SHOW: "show" + EVENT_KEY$3,
  3326. SHOWN: "shown" + EVENT_KEY$3,
  3327. HIDE: "hide" + EVENT_KEY$3,
  3328. HIDDEN: "hidden" + EVENT_KEY$3,
  3329. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3330. };
  3331. var ClassName$3 = {
  3332. SHOW: 'show',
  3333. COLLAPSE: 'collapse',
  3334. COLLAPSING: 'collapsing',
  3335. COLLAPSED: 'collapsed'
  3336. };
  3337. var Dimension = {
  3338. WIDTH: 'width',
  3339. HEIGHT: 'height'
  3340. };
  3341. var Selector$3 = {
  3342. ACTIVES: '.show, .collapsing',
  3343. DATA_TOGGLE: '[data-toggle="collapse"]'
  3344. };
  3345. /**
  3346. * ------------------------------------------------------------------------
  3347. * Class Definition
  3348. * ------------------------------------------------------------------------
  3349. */
  3350. var Collapse =
  3351. /*#__PURE__*/
  3352. function () {
  3353. function Collapse(element, config) {
  3354. this._isTransitioning = false;
  3355. this._element = element;
  3356. this._config = this._getConfig(config);
  3357. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3358. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3359. for (var i = 0, len = toggleList.length; i < len; i++) {
  3360. var elem = toggleList[i];
  3361. var selector = Util.getSelectorFromElement(elem);
  3362. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3363. return foundElem === element;
  3364. });
  3365. if (selector !== null && filterElement.length > 0) {
  3366. this._selector = selector;
  3367. this._triggerArray.push(elem);
  3368. }
  3369. }
  3370. this._parent = this._config.parent ? this._getParent() : null;
  3371. if (!this._config.parent) {
  3372. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3373. }
  3374. if (this._config.toggle) {
  3375. this.toggle();
  3376. }
  3377. } // Getters
  3378. var _proto = Collapse.prototype;
  3379. // Public
  3380. _proto.toggle = function toggle() {
  3381. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3382. this.hide();
  3383. } else {
  3384. this.show();
  3385. }
  3386. };
  3387. _proto.show = function show() {
  3388. var _this = this;
  3389. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3390. return;
  3391. }
  3392. var actives;
  3393. var activesData;
  3394. if (this._parent) {
  3395. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3396. if (typeof _this._config.parent === 'string') {
  3397. return elem.getAttribute('data-parent') === _this._config.parent;
  3398. }
  3399. return elem.classList.contains(ClassName$3.COLLAPSE);
  3400. });
  3401. if (actives.length === 0) {
  3402. actives = null;
  3403. }
  3404. }
  3405. if (actives) {
  3406. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3407. if (activesData && activesData._isTransitioning) {
  3408. return;
  3409. }
  3410. }
  3411. var startEvent = $.Event(Event$3.SHOW);
  3412. $(this._element).trigger(startEvent);
  3413. if (startEvent.isDefaultPrevented()) {
  3414. return;
  3415. }
  3416. if (actives) {
  3417. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3418. if (!activesData) {
  3419. $(actives).data(DATA_KEY$3, null);
  3420. }
  3421. }
  3422. var dimension = this._getDimension();
  3423. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3424. this._element.style[dimension] = 0;
  3425. if (this._triggerArray.length) {
  3426. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3427. }
  3428. this.setTransitioning(true);
  3429. var complete = function complete() {
  3430. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3431. _this._element.style[dimension] = '';
  3432. _this.setTransitioning(false);
  3433. $(_this._element).trigger(Event$3.SHOWN);
  3434. };
  3435. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3436. var scrollSize = "scroll" + capitalizedDimension;
  3437. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3438. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3439. this._element.style[dimension] = this._element[scrollSize] + "px";
  3440. };
  3441. _proto.hide = function hide() {
  3442. var _this2 = this;
  3443. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3444. return;
  3445. }
  3446. var startEvent = $.Event(Event$3.HIDE);
  3447. $(this._element).trigger(startEvent);
  3448. if (startEvent.isDefaultPrevented()) {
  3449. return;
  3450. }
  3451. var dimension = this._getDimension();
  3452. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3453. Util.reflow(this._element);
  3454. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3455. var triggerArrayLength = this._triggerArray.length;
  3456. if (triggerArrayLength > 0) {
  3457. for (var i = 0; i < triggerArrayLength; i++) {
  3458. var trigger = this._triggerArray[i];
  3459. var selector = Util.getSelectorFromElement(trigger);
  3460. if (selector !== null) {
  3461. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3462. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3463. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3464. }
  3465. }
  3466. }
  3467. }
  3468. this.setTransitioning(true);
  3469. var complete = function complete() {
  3470. _this2.setTransitioning(false);
  3471. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3472. };
  3473. this._element.style[dimension] = '';
  3474. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3475. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3476. };
  3477. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3478. this._isTransitioning = isTransitioning;
  3479. };
  3480. _proto.dispose = function dispose() {
  3481. $.removeData(this._element, DATA_KEY$3);
  3482. this._config = null;
  3483. this._parent = null;
  3484. this._element = null;
  3485. this._triggerArray = null;
  3486. this._isTransitioning = null;
  3487. } // Private
  3488. ;
  3489. _proto._getConfig = function _getConfig(config) {
  3490. config = _objectSpread2({}, Default$1, {}, config);
  3491. config.toggle = Boolean(config.toggle); // Coerce string values
  3492. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3493. return config;
  3494. };
  3495. _proto._getDimension = function _getDimension() {
  3496. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3497. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3498. };
  3499. _proto._getParent = function _getParent() {
  3500. var _this3 = this;
  3501. var parent;
  3502. if (Util.isElement(this._config.parent)) {
  3503. parent = this._config.parent; // It's a jQuery object
  3504. if (typeof this._config.parent.jquery !== 'undefined') {
  3505. parent = this._config.parent[0];
  3506. }
  3507. } else {
  3508. parent = document.querySelector(this._config.parent);
  3509. }
  3510. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3511. var children = [].slice.call(parent.querySelectorAll(selector));
  3512. $(children).each(function (i, element) {
  3513. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3514. });
  3515. return parent;
  3516. };
  3517. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3518. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3519. if (triggerArray.length) {
  3520. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3521. }
  3522. } // Static
  3523. ;
  3524. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3525. var selector = Util.getSelectorFromElement(element);
  3526. return selector ? document.querySelector(selector) : null;
  3527. };
  3528. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3529. return this.each(function () {
  3530. var $this = $(this);
  3531. var data = $this.data(DATA_KEY$3);
  3532. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3533. if (!data && _config.toggle && /show|hide/.test(config)) {
  3534. _config.toggle = false;
  3535. }
  3536. if (!data) {
  3537. data = new Collapse(this, _config);
  3538. $this.data(DATA_KEY$3, data);
  3539. }
  3540. if (typeof config === 'string') {
  3541. if (typeof data[config] === 'undefined') {
  3542. throw new TypeError("No method named \"" + config + "\"");
  3543. }
  3544. data[config]();
  3545. }
  3546. });
  3547. };
  3548. _createClass(Collapse, null, [{
  3549. key: "VERSION",
  3550. get: function get() {
  3551. return VERSION$3;
  3552. }
  3553. }, {
  3554. key: "Default",
  3555. get: function get() {
  3556. return Default$1;
  3557. }
  3558. }]);
  3559. return Collapse;
  3560. }();
  3561. /**
  3562. * ------------------------------------------------------------------------
  3563. * Data Api implementation
  3564. * ------------------------------------------------------------------------
  3565. */
  3566. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3567. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3568. if (event.currentTarget.tagName === 'A') {
  3569. event.preventDefault();
  3570. }
  3571. var $trigger = $(this);
  3572. var selector = Util.getSelectorFromElement(this);
  3573. var selectors = [].slice.call(document.querySelectorAll(selector));
  3574. $(selectors).each(function () {
  3575. var $target = $(this);
  3576. var data = $target.data(DATA_KEY$3);
  3577. var config = data ? 'toggle' : $trigger.data();
  3578. Collapse._jQueryInterface.call($target, config);
  3579. });
  3580. });
  3581. /**
  3582. * ------------------------------------------------------------------------
  3583. * jQuery
  3584. * ------------------------------------------------------------------------
  3585. */
  3586. $.fn[NAME$3] = Collapse._jQueryInterface;
  3587. $.fn[NAME$3].Constructor = Collapse;
  3588. $.fn[NAME$3].noConflict = function () {
  3589. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3590. return Collapse._jQueryInterface;
  3591. };
  3592. /**
  3593. * ------------------------------------------------------------------------
  3594. * Constants
  3595. * ------------------------------------------------------------------------
  3596. */
  3597. var NAME$4 = 'dropdown';
  3598. var VERSION$4 = '4.4.1';
  3599. var DATA_KEY$4 = 'bs.dropdown';
  3600. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3601. var DATA_API_KEY$4 = '.data-api';
  3602. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3603. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3604. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3605. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3606. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3607. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3608. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3609. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3610. var Event$4 = {
  3611. HIDE: "hide" + EVENT_KEY$4,
  3612. HIDDEN: "hidden" + EVENT_KEY$4,
  3613. SHOW: "show" + EVENT_KEY$4,
  3614. SHOWN: "shown" + EVENT_KEY$4,
  3615. CLICK: "click" + EVENT_KEY$4,
  3616. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3617. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3618. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3619. };
  3620. var ClassName$4 = {
  3621. DISABLED: 'disabled',
  3622. SHOW: 'show',
  3623. DROPUP: 'dropup',
  3624. DROPRIGHT: 'dropright',
  3625. DROPLEFT: 'dropleft',
  3626. MENURIGHT: 'dropdown-menu-right',
  3627. MENULEFT: 'dropdown-menu-left',
  3628. POSITION_STATIC: 'position-static'
  3629. };
  3630. var Selector$4 = {
  3631. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3632. FORM_CHILD: '.dropdown form',
  3633. MENU: '.dropdown-menu',
  3634. NAVBAR_NAV: '.navbar-nav',
  3635. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3636. };
  3637. var AttachmentMap = {
  3638. TOP: 'top-start',
  3639. TOPEND: 'top-end',
  3640. BOTTOM: 'bottom-start',
  3641. BOTTOMEND: 'bottom-end',
  3642. RIGHT: 'right-start',
  3643. RIGHTEND: 'right-end',
  3644. LEFT: 'left-start',
  3645. LEFTEND: 'left-end'
  3646. };
  3647. var Default$2 = {
  3648. offset: 0,
  3649. flip: true,
  3650. boundary: 'scrollParent',
  3651. reference: 'toggle',
  3652. display: 'dynamic',
  3653. popperConfig: null
  3654. };
  3655. var DefaultType$2 = {
  3656. offset: '(number|string|function)',
  3657. flip: 'boolean',
  3658. boundary: '(string|element)',
  3659. reference: '(string|element)',
  3660. display: 'string',
  3661. popperConfig: '(null|object)'
  3662. };
  3663. /**
  3664. * ------------------------------------------------------------------------
  3665. * Class Definition
  3666. * ------------------------------------------------------------------------
  3667. */
  3668. var Dropdown =
  3669. /*#__PURE__*/
  3670. function () {
  3671. function Dropdown(element, config) {
  3672. this._element = element;
  3673. this._popper = null;
  3674. this._config = this._getConfig(config);
  3675. this._menu = this._getMenuElement();
  3676. this._inNavbar = this._detectNavbar();
  3677. this._addEventListeners();
  3678. } // Getters
  3679. var _proto = Dropdown.prototype;
  3680. // Public
  3681. _proto.toggle = function toggle() {
  3682. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3683. return;
  3684. }
  3685. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3686. Dropdown._clearMenus();
  3687. if (isActive) {
  3688. return;
  3689. }
  3690. this.show(true);
  3691. };
  3692. _proto.show = function show(usePopper) {
  3693. if (usePopper === void 0) {
  3694. usePopper = false;
  3695. }
  3696. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3697. return;
  3698. }
  3699. var relatedTarget = {
  3700. relatedTarget: this._element
  3701. };
  3702. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3703. var parent = Dropdown._getParentFromElement(this._element);
  3704. $(parent).trigger(showEvent);
  3705. if (showEvent.isDefaultPrevented()) {
  3706. return;
  3707. } // Disable totally Popper.js for Dropdown in Navbar
  3708. if (!this._inNavbar && usePopper) {
  3709. /**
  3710. * Check for Popper dependency
  3711. * Popper - https://popper.js.org
  3712. */
  3713. if (typeof Popper === 'undefined') {
  3714. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3715. }
  3716. var referenceElement = this._element;
  3717. if (this._config.reference === 'parent') {
  3718. referenceElement = parent;
  3719. } else if (Util.isElement(this._config.reference)) {
  3720. referenceElement = this._config.reference; // Check if it's jQuery element
  3721. if (typeof this._config.reference.jquery !== 'undefined') {
  3722. referenceElement = this._config.reference[0];
  3723. }
  3724. } // If boundary is not `scrollParent`, then set position to `static`
  3725. // to allow the menu to "escape" the scroll parent's boundaries
  3726. // https://github.com/twbs/bootstrap/issues/24251
  3727. if (this._config.boundary !== 'scrollParent') {
  3728. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3729. }
  3730. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3731. } // If this is a touch-enabled device we add extra
  3732. // empty mouseover listeners to the body's immediate children;
  3733. // only needed because of broken event delegation on iOS
  3734. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3735. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3736. $(document.body).children().on('mouseover', null, $.noop);
  3737. }
  3738. this._element.focus();
  3739. this._element.setAttribute('aria-expanded', true);
  3740. $(this._menu).toggleClass(ClassName$4.SHOW);
  3741. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3742. };
  3743. _proto.hide = function hide() {
  3744. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3745. return;
  3746. }
  3747. var relatedTarget = {
  3748. relatedTarget: this._element
  3749. };
  3750. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3751. var parent = Dropdown._getParentFromElement(this._element);
  3752. $(parent).trigger(hideEvent);
  3753. if (hideEvent.isDefaultPrevented()) {
  3754. return;
  3755. }
  3756. if (this._popper) {
  3757. this._popper.destroy();
  3758. }
  3759. $(this._menu).toggleClass(ClassName$4.SHOW);
  3760. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3761. };
  3762. _proto.dispose = function dispose() {
  3763. $.removeData(this._element, DATA_KEY$4);
  3764. $(this._element).off(EVENT_KEY$4);
  3765. this._element = null;
  3766. this._menu = null;
  3767. if (this._popper !== null) {
  3768. this._popper.destroy();
  3769. this._popper = null;
  3770. }
  3771. };
  3772. _proto.update = function update() {
  3773. this._inNavbar = this._detectNavbar();
  3774. if (this._popper !== null) {
  3775. this._popper.scheduleUpdate();
  3776. }
  3777. } // Private
  3778. ;
  3779. _proto._addEventListeners = function _addEventListeners() {
  3780. var _this = this;
  3781. $(this._element).on(Event$4.CLICK, function (event) {
  3782. event.preventDefault();
  3783. event.stopPropagation();
  3784. _this.toggle();
  3785. });
  3786. };
  3787. _proto._getConfig = function _getConfig(config) {
  3788. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3789. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3790. return config;
  3791. };
  3792. _proto._getMenuElement = function _getMenuElement() {
  3793. if (!this._menu) {
  3794. var parent = Dropdown._getParentFromElement(this._element);
  3795. if (parent) {
  3796. this._menu = parent.querySelector(Selector$4.MENU);
  3797. }
  3798. }
  3799. return this._menu;
  3800. };
  3801. _proto._getPlacement = function _getPlacement() {
  3802. var $parentDropdown = $(this._element.parentNode);
  3803. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3804. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3805. placement = AttachmentMap.TOP;
  3806. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3807. placement = AttachmentMap.TOPEND;
  3808. }
  3809. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3810. placement = AttachmentMap.RIGHT;
  3811. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3812. placement = AttachmentMap.LEFT;
  3813. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3814. placement = AttachmentMap.BOTTOMEND;
  3815. }
  3816. return placement;
  3817. };
  3818. _proto._detectNavbar = function _detectNavbar() {
  3819. return $(this._element).closest('.navbar').length > 0;
  3820. };
  3821. _proto._getOffset = function _getOffset() {
  3822. var _this2 = this;
  3823. var offset = {};
  3824. if (typeof this._config.offset === 'function') {
  3825. offset.fn = function (data) {
  3826. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3827. return data;
  3828. };
  3829. } else {
  3830. offset.offset = this._config.offset;
  3831. }
  3832. return offset;
  3833. };
  3834. _proto._getPopperConfig = function _getPopperConfig() {
  3835. var popperConfig = {
  3836. placement: this._getPlacement(),
  3837. modifiers: {
  3838. offset: this._getOffset(),
  3839. flip: {
  3840. enabled: this._config.flip
  3841. },
  3842. preventOverflow: {
  3843. boundariesElement: this._config.boundary
  3844. }
  3845. }
  3846. }; // Disable Popper.js if we have a static display
  3847. if (this._config.display === 'static') {
  3848. popperConfig.modifiers.applyStyle = {
  3849. enabled: false
  3850. };
  3851. }
  3852. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3853. } // Static
  3854. ;
  3855. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3856. return this.each(function () {
  3857. var data = $(this).data(DATA_KEY$4);
  3858. var _config = typeof config === 'object' ? config : null;
  3859. if (!data) {
  3860. data = new Dropdown(this, _config);
  3861. $(this).data(DATA_KEY$4, data);
  3862. }
  3863. if (typeof config === 'string') {
  3864. if (typeof data[config] === 'undefined') {
  3865. throw new TypeError("No method named \"" + config + "\"");
  3866. }
  3867. data[config]();
  3868. }
  3869. });
  3870. };
  3871. Dropdown._clearMenus = function _clearMenus(event) {
  3872. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3873. return;
  3874. }
  3875. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3876. for (var i = 0, len = toggles.length; i < len; i++) {
  3877. var parent = Dropdown._getParentFromElement(toggles[i]);
  3878. var context = $(toggles[i]).data(DATA_KEY$4);
  3879. var relatedTarget = {
  3880. relatedTarget: toggles[i]
  3881. };
  3882. if (event && event.type === 'click') {
  3883. relatedTarget.clickEvent = event;
  3884. }
  3885. if (!context) {
  3886. continue;
  3887. }
  3888. var dropdownMenu = context._menu;
  3889. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3890. continue;
  3891. }
  3892. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3893. continue;
  3894. }
  3895. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3896. $(parent).trigger(hideEvent);
  3897. if (hideEvent.isDefaultPrevented()) {
  3898. continue;
  3899. } // If this is a touch-enabled device we remove the extra
  3900. // empty mouseover listeners we added for iOS support
  3901. if ('ontouchstart' in document.documentElement) {
  3902. $(document.body).children().off('mouseover', null, $.noop);
  3903. }
  3904. toggles[i].setAttribute('aria-expanded', 'false');
  3905. if (context._popper) {
  3906. context._popper.destroy();
  3907. }
  3908. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3909. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3910. }
  3911. };
  3912. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3913. var parent;
  3914. var selector = Util.getSelectorFromElement(element);
  3915. if (selector) {
  3916. parent = document.querySelector(selector);
  3917. }
  3918. return parent || element.parentNode;
  3919. } // eslint-disable-next-line complexity
  3920. ;
  3921. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3922. // If not input/textarea:
  3923. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3924. // If input/textarea:
  3925. // - If space key => not a dropdown command
  3926. // - If key is other than escape
  3927. // - If key is not up or down => not a dropdown command
  3928. // - If trigger inside the menu => not a dropdown command
  3929. 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)) {
  3930. return;
  3931. }
  3932. event.preventDefault();
  3933. event.stopPropagation();
  3934. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3935. return;
  3936. }
  3937. var parent = Dropdown._getParentFromElement(this);
  3938. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3939. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3940. return;
  3941. }
  3942. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3943. if (event.which === ESCAPE_KEYCODE) {
  3944. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3945. $(toggle).trigger('focus');
  3946. }
  3947. $(this).trigger('click');
  3948. return;
  3949. }
  3950. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3951. return $(item).is(':visible');
  3952. });
  3953. if (items.length === 0) {
  3954. return;
  3955. }
  3956. var index = items.indexOf(event.target);
  3957. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3958. // Up
  3959. index--;
  3960. }
  3961. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3962. // Down
  3963. index++;
  3964. }
  3965. if (index < 0) {
  3966. index = 0;
  3967. }
  3968. items[index].focus();
  3969. };
  3970. _createClass(Dropdown, null, [{
  3971. key: "VERSION",
  3972. get: function get() {
  3973. return VERSION$4;
  3974. }
  3975. }, {
  3976. key: "Default",
  3977. get: function get() {
  3978. return Default$2;
  3979. }
  3980. }, {
  3981. key: "DefaultType",
  3982. get: function get() {
  3983. return DefaultType$2;
  3984. }
  3985. }]);
  3986. return Dropdown;
  3987. }();
  3988. /**
  3989. * ------------------------------------------------------------------------
  3990. * Data Api implementation
  3991. * ------------------------------------------------------------------------
  3992. */
  3993. $(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) {
  3994. event.preventDefault();
  3995. event.stopPropagation();
  3996. Dropdown._jQueryInterface.call($(this), 'toggle');
  3997. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3998. e.stopPropagation();
  3999. });
  4000. /**
  4001. * ------------------------------------------------------------------------
  4002. * jQuery
  4003. * ------------------------------------------------------------------------
  4004. */
  4005. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4006. $.fn[NAME$4].Constructor = Dropdown;
  4007. $.fn[NAME$4].noConflict = function () {
  4008. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4009. return Dropdown._jQueryInterface;
  4010. };
  4011. /**
  4012. * ------------------------------------------------------------------------
  4013. * Constants
  4014. * ------------------------------------------------------------------------
  4015. */
  4016. var NAME$5 = 'modal';
  4017. var VERSION$5 = '4.4.1';
  4018. var DATA_KEY$5 = 'bs.modal';
  4019. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4020. var DATA_API_KEY$5 = '.data-api';
  4021. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4022. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4023. var Default$3 = {
  4024. backdrop: true,
  4025. keyboard: true,
  4026. focus: true,
  4027. show: true
  4028. };
  4029. var DefaultType$3 = {
  4030. backdrop: '(boolean|string)',
  4031. keyboard: 'boolean',
  4032. focus: 'boolean',
  4033. show: 'boolean'
  4034. };
  4035. var Event$5 = {
  4036. HIDE: "hide" + EVENT_KEY$5,
  4037. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4038. HIDDEN: "hidden" + EVENT_KEY$5,
  4039. SHOW: "show" + EVENT_KEY$5,
  4040. SHOWN: "shown" + EVENT_KEY$5,
  4041. FOCUSIN: "focusin" + EVENT_KEY$5,
  4042. RESIZE: "resize" + EVENT_KEY$5,
  4043. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4044. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4045. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4046. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4047. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4048. };
  4049. var ClassName$5 = {
  4050. SCROLLABLE: 'modal-dialog-scrollable',
  4051. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4052. BACKDROP: 'modal-backdrop',
  4053. OPEN: 'modal-open',
  4054. FADE: 'fade',
  4055. SHOW: 'show',
  4056. STATIC: 'modal-static'
  4057. };
  4058. var Selector$5 = {
  4059. DIALOG: '.modal-dialog',
  4060. MODAL_BODY: '.modal-body',
  4061. DATA_TOGGLE: '[data-toggle="modal"]',
  4062. DATA_DISMISS: '[data-dismiss="modal"]',
  4063. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4064. STICKY_CONTENT: '.sticky-top'
  4065. };
  4066. /**
  4067. * ------------------------------------------------------------------------
  4068. * Class Definition
  4069. * ------------------------------------------------------------------------
  4070. */
  4071. var Modal =
  4072. /*#__PURE__*/
  4073. function () {
  4074. function Modal(element, config) {
  4075. this._config = this._getConfig(config);
  4076. this._element = element;
  4077. this._dialog = element.querySelector(Selector$5.DIALOG);
  4078. this._backdrop = null;
  4079. this._isShown = false;
  4080. this._isBodyOverflowing = false;
  4081. this._ignoreBackdropClick = false;
  4082. this._isTransitioning = false;
  4083. this._scrollbarWidth = 0;
  4084. } // Getters
  4085. var _proto = Modal.prototype;
  4086. // Public
  4087. _proto.toggle = function toggle(relatedTarget) {
  4088. return this._isShown ? this.hide() : this.show(relatedTarget);
  4089. };
  4090. _proto.show = function show(relatedTarget) {
  4091. var _this = this;
  4092. if (this._isShown || this._isTransitioning) {
  4093. return;
  4094. }
  4095. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4096. this._isTransitioning = true;
  4097. }
  4098. var showEvent = $.Event(Event$5.SHOW, {
  4099. relatedTarget: relatedTarget
  4100. });
  4101. $(this._element).trigger(showEvent);
  4102. if (this._isShown || showEvent.isDefaultPrevented()) {
  4103. return;
  4104. }
  4105. this._isShown = true;
  4106. this._checkScrollbar();
  4107. this._setScrollbar();
  4108. this._adjustDialog();
  4109. this._setEscapeEvent();
  4110. this._setResizeEvent();
  4111. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4112. return _this.hide(event);
  4113. });
  4114. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4115. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4116. if ($(event.target).is(_this._element)) {
  4117. _this._ignoreBackdropClick = true;
  4118. }
  4119. });
  4120. });
  4121. this._showBackdrop(function () {
  4122. return _this._showElement(relatedTarget);
  4123. });
  4124. };
  4125. _proto.hide = function hide(event) {
  4126. var _this2 = this;
  4127. if (event) {
  4128. event.preventDefault();
  4129. }
  4130. if (!this._isShown || this._isTransitioning) {
  4131. return;
  4132. }
  4133. var hideEvent = $.Event(Event$5.HIDE);
  4134. $(this._element).trigger(hideEvent);
  4135. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4136. return;
  4137. }
  4138. this._isShown = false;
  4139. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4140. if (transition) {
  4141. this._isTransitioning = true;
  4142. }
  4143. this._setEscapeEvent();
  4144. this._setResizeEvent();
  4145. $(document).off(Event$5.FOCUSIN);
  4146. $(this._element).removeClass(ClassName$5.SHOW);
  4147. $(this._element).off(Event$5.CLICK_DISMISS);
  4148. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4149. if (transition) {
  4150. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4151. $(this._element).one(Util.TRANSITION_END, function (event) {
  4152. return _this2._hideModal(event);
  4153. }).emulateTransitionEnd(transitionDuration);
  4154. } else {
  4155. this._hideModal();
  4156. }
  4157. };
  4158. _proto.dispose = function dispose() {
  4159. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4160. return $(htmlElement).off(EVENT_KEY$5);
  4161. });
  4162. /**
  4163. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4164. * Do not move `document` in `htmlElements` array
  4165. * It will remove `Event.CLICK_DATA_API` event that should remain
  4166. */
  4167. $(document).off(Event$5.FOCUSIN);
  4168. $.removeData(this._element, DATA_KEY$5);
  4169. this._config = null;
  4170. this._element = null;
  4171. this._dialog = null;
  4172. this._backdrop = null;
  4173. this._isShown = null;
  4174. this._isBodyOverflowing = null;
  4175. this._ignoreBackdropClick = null;
  4176. this._isTransitioning = null;
  4177. this._scrollbarWidth = null;
  4178. };
  4179. _proto.handleUpdate = function handleUpdate() {
  4180. this._adjustDialog();
  4181. } // Private
  4182. ;
  4183. _proto._getConfig = function _getConfig(config) {
  4184. config = _objectSpread2({}, Default$3, {}, config);
  4185. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4186. return config;
  4187. };
  4188. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4189. var _this3 = this;
  4190. if (this._config.backdrop === 'static') {
  4191. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4192. $(this._element).trigger(hideEventPrevented);
  4193. if (hideEventPrevented.defaultPrevented) {
  4194. return;
  4195. }
  4196. this._element.classList.add(ClassName$5.STATIC);
  4197. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4198. $(this._element).one(Util.TRANSITION_END, function () {
  4199. _this3._element.classList.remove(ClassName$5.STATIC);
  4200. }).emulateTransitionEnd(modalTransitionDuration);
  4201. this._element.focus();
  4202. } else {
  4203. this.hide();
  4204. }
  4205. };
  4206. _proto._showElement = function _showElement(relatedTarget) {
  4207. var _this4 = this;
  4208. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4209. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4210. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4211. // Don't move modal's DOM position
  4212. document.body.appendChild(this._element);
  4213. }
  4214. this._element.style.display = 'block';
  4215. this._element.removeAttribute('aria-hidden');
  4216. this._element.setAttribute('aria-modal', true);
  4217. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4218. modalBody.scrollTop = 0;
  4219. } else {
  4220. this._element.scrollTop = 0;
  4221. }
  4222. if (transition) {
  4223. Util.reflow(this._element);
  4224. }
  4225. $(this._element).addClass(ClassName$5.SHOW);
  4226. if (this._config.focus) {
  4227. this._enforceFocus();
  4228. }
  4229. var shownEvent = $.Event(Event$5.SHOWN, {
  4230. relatedTarget: relatedTarget
  4231. });
  4232. var transitionComplete = function transitionComplete() {
  4233. if (_this4._config.focus) {
  4234. _this4._element.focus();
  4235. }
  4236. _this4._isTransitioning = false;
  4237. $(_this4._element).trigger(shownEvent);
  4238. };
  4239. if (transition) {
  4240. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4241. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4242. } else {
  4243. transitionComplete();
  4244. }
  4245. };
  4246. _proto._enforceFocus = function _enforceFocus() {
  4247. var _this5 = this;
  4248. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4249. .on(Event$5.FOCUSIN, function (event) {
  4250. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4251. _this5._element.focus();
  4252. }
  4253. });
  4254. };
  4255. _proto._setEscapeEvent = function _setEscapeEvent() {
  4256. var _this6 = this;
  4257. if (this._isShown && this._config.keyboard) {
  4258. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4259. if (event.which === ESCAPE_KEYCODE$1) {
  4260. _this6._triggerBackdropTransition();
  4261. }
  4262. });
  4263. } else if (!this._isShown) {
  4264. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4265. }
  4266. };
  4267. _proto._setResizeEvent = function _setResizeEvent() {
  4268. var _this7 = this;
  4269. if (this._isShown) {
  4270. $(window).on(Event$5.RESIZE, function (event) {
  4271. return _this7.handleUpdate(event);
  4272. });
  4273. } else {
  4274. $(window).off(Event$5.RESIZE);
  4275. }
  4276. };
  4277. _proto._hideModal = function _hideModal() {
  4278. var _this8 = this;
  4279. this._element.style.display = 'none';
  4280. this._element.setAttribute('aria-hidden', true);
  4281. this._element.removeAttribute('aria-modal');
  4282. this._isTransitioning = false;
  4283. this._showBackdrop(function () {
  4284. $(document.body).removeClass(ClassName$5.OPEN);
  4285. _this8._resetAdjustments();
  4286. _this8._resetScrollbar();
  4287. $(_this8._element).trigger(Event$5.HIDDEN);
  4288. });
  4289. };
  4290. _proto._removeBackdrop = function _removeBackdrop() {
  4291. if (this._backdrop) {
  4292. $(this._backdrop).remove();
  4293. this._backdrop = null;
  4294. }
  4295. };
  4296. _proto._showBackdrop = function _showBackdrop(callback) {
  4297. var _this9 = this;
  4298. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4299. if (this._isShown && this._config.backdrop) {
  4300. this._backdrop = document.createElement('div');
  4301. this._backdrop.className = ClassName$5.BACKDROP;
  4302. if (animate) {
  4303. this._backdrop.classList.add(animate);
  4304. }
  4305. $(this._backdrop).appendTo(document.body);
  4306. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4307. if (_this9._ignoreBackdropClick) {
  4308. _this9._ignoreBackdropClick = false;
  4309. return;
  4310. }
  4311. if (event.target !== event.currentTarget) {
  4312. return;
  4313. }
  4314. _this9._triggerBackdropTransition();
  4315. });
  4316. if (animate) {
  4317. Util.reflow(this._backdrop);
  4318. }
  4319. $(this._backdrop).addClass(ClassName$5.SHOW);
  4320. if (!callback) {
  4321. return;
  4322. }
  4323. if (!animate) {
  4324. callback();
  4325. return;
  4326. }
  4327. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4328. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4329. } else if (!this._isShown && this._backdrop) {
  4330. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4331. var callbackRemove = function callbackRemove() {
  4332. _this9._removeBackdrop();
  4333. if (callback) {
  4334. callback();
  4335. }
  4336. };
  4337. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4338. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4339. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4340. } else {
  4341. callbackRemove();
  4342. }
  4343. } else if (callback) {
  4344. callback();
  4345. }
  4346. } // ----------------------------------------------------------------------
  4347. // the following methods are used to handle overflowing modals
  4348. // todo (fat): these should probably be refactored out of modal.js
  4349. // ----------------------------------------------------------------------
  4350. ;
  4351. _proto._adjustDialog = function _adjustDialog() {
  4352. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4353. if (!this._isBodyOverflowing && isModalOverflowing) {
  4354. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4355. }
  4356. if (this._isBodyOverflowing && !isModalOverflowing) {
  4357. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4358. }
  4359. };
  4360. _proto._resetAdjustments = function _resetAdjustments() {
  4361. this._element.style.paddingLeft = '';
  4362. this._element.style.paddingRight = '';
  4363. };
  4364. _proto._checkScrollbar = function _checkScrollbar() {
  4365. var rect = document.body.getBoundingClientRect();
  4366. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4367. this._scrollbarWidth = this._getScrollbarWidth();
  4368. };
  4369. _proto._setScrollbar = function _setScrollbar() {
  4370. var _this10 = this;
  4371. if (this._isBodyOverflowing) {
  4372. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4373. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4374. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4375. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4376. $(fixedContent).each(function (index, element) {
  4377. var actualPadding = element.style.paddingRight;
  4378. var calculatedPadding = $(element).css('padding-right');
  4379. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4380. }); // Adjust sticky content margin
  4381. $(stickyContent).each(function (index, element) {
  4382. var actualMargin = element.style.marginRight;
  4383. var calculatedMargin = $(element).css('margin-right');
  4384. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4385. }); // Adjust body padding
  4386. var actualPadding = document.body.style.paddingRight;
  4387. var calculatedPadding = $(document.body).css('padding-right');
  4388. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4389. }
  4390. $(document.body).addClass(ClassName$5.OPEN);
  4391. };
  4392. _proto._resetScrollbar = function _resetScrollbar() {
  4393. // Restore fixed content padding
  4394. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4395. $(fixedContent).each(function (index, element) {
  4396. var padding = $(element).data('padding-right');
  4397. $(element).removeData('padding-right');
  4398. element.style.paddingRight = padding ? padding : '';
  4399. }); // Restore sticky content
  4400. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4401. $(elements).each(function (index, element) {
  4402. var margin = $(element).data('margin-right');
  4403. if (typeof margin !== 'undefined') {
  4404. $(element).css('margin-right', margin).removeData('margin-right');
  4405. }
  4406. }); // Restore body padding
  4407. var padding = $(document.body).data('padding-right');
  4408. $(document.body).removeData('padding-right');
  4409. document.body.style.paddingRight = padding ? padding : '';
  4410. };
  4411. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4412. // thx d.walsh
  4413. var scrollDiv = document.createElement('div');
  4414. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4415. document.body.appendChild(scrollDiv);
  4416. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4417. document.body.removeChild(scrollDiv);
  4418. return scrollbarWidth;
  4419. } // Static
  4420. ;
  4421. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4422. return this.each(function () {
  4423. var data = $(this).data(DATA_KEY$5);
  4424. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4425. if (!data) {
  4426. data = new Modal(this, _config);
  4427. $(this).data(DATA_KEY$5, data);
  4428. }
  4429. if (typeof config === 'string') {
  4430. if (typeof data[config] === 'undefined') {
  4431. throw new TypeError("No method named \"" + config + "\"");
  4432. }
  4433. data[config](relatedTarget);
  4434. } else if (_config.show) {
  4435. data.show(relatedTarget);
  4436. }
  4437. });
  4438. };
  4439. _createClass(Modal, null, [{
  4440. key: "VERSION",
  4441. get: function get() {
  4442. return VERSION$5;
  4443. }
  4444. }, {
  4445. key: "Default",
  4446. get: function get() {
  4447. return Default$3;
  4448. }
  4449. }]);
  4450. return Modal;
  4451. }();
  4452. /**
  4453. * ------------------------------------------------------------------------
  4454. * Data Api implementation
  4455. * ------------------------------------------------------------------------
  4456. */
  4457. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4458. var _this11 = this;
  4459. var target;
  4460. var selector = Util.getSelectorFromElement(this);
  4461. if (selector) {
  4462. target = document.querySelector(selector);
  4463. }
  4464. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4465. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4466. event.preventDefault();
  4467. }
  4468. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4469. if (showEvent.isDefaultPrevented()) {
  4470. // Only register focus restorer if modal will actually get shown
  4471. return;
  4472. }
  4473. $target.one(Event$5.HIDDEN, function () {
  4474. if ($(_this11).is(':visible')) {
  4475. _this11.focus();
  4476. }
  4477. });
  4478. });
  4479. Modal._jQueryInterface.call($(target), config, this);
  4480. });
  4481. /**
  4482. * ------------------------------------------------------------------------
  4483. * jQuery
  4484. * ------------------------------------------------------------------------
  4485. */
  4486. $.fn[NAME$5] = Modal._jQueryInterface;
  4487. $.fn[NAME$5].Constructor = Modal;
  4488. $.fn[NAME$5].noConflict = function () {
  4489. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4490. return Modal._jQueryInterface;
  4491. };
  4492. /**
  4493. * --------------------------------------------------------------------------
  4494. * Bootstrap (v4.4.1): tools/sanitizer.js
  4495. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4496. * --------------------------------------------------------------------------
  4497. */
  4498. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4499. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4500. var DefaultWhitelist = {
  4501. // Global attributes allowed on any supplied element below.
  4502. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4503. a: ['target', 'href', 'title', 'rel'],
  4504. area: [],
  4505. b: [],
  4506. br: [],
  4507. col: [],
  4508. code: [],
  4509. div: [],
  4510. em: [],
  4511. hr: [],
  4512. h1: [],
  4513. h2: [],
  4514. h3: [],
  4515. h4: [],
  4516. h5: [],
  4517. h6: [],
  4518. i: [],
  4519. img: ['src', 'alt', 'title', 'width', 'height'],
  4520. li: [],
  4521. ol: [],
  4522. p: [],
  4523. pre: [],
  4524. s: [],
  4525. small: [],
  4526. span: [],
  4527. sub: [],
  4528. sup: [],
  4529. strong: [],
  4530. u: [],
  4531. ul: []
  4532. };
  4533. /**
  4534. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4535. *
  4536. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4537. */
  4538. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4539. /**
  4540. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4541. *
  4542. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4543. */
  4544. 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;
  4545. function allowedAttribute(attr, allowedAttributeList) {
  4546. var attrName = attr.nodeName.toLowerCase();
  4547. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4548. if (uriAttrs.indexOf(attrName) !== -1) {
  4549. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4550. }
  4551. return true;
  4552. }
  4553. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4554. return attrRegex instanceof RegExp;
  4555. }); // Check if a regular expression validates the attribute.
  4556. for (var i = 0, l = regExp.length; i < l; i++) {
  4557. if (attrName.match(regExp[i])) {
  4558. return true;
  4559. }
  4560. }
  4561. return false;
  4562. }
  4563. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4564. if (unsafeHtml.length === 0) {
  4565. return unsafeHtml;
  4566. }
  4567. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4568. return sanitizeFn(unsafeHtml);
  4569. }
  4570. var domParser = new window.DOMParser();
  4571. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4572. var whitelistKeys = Object.keys(whiteList);
  4573. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4574. var _loop = function _loop(i, len) {
  4575. var el = elements[i];
  4576. var elName = el.nodeName.toLowerCase();
  4577. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4578. el.parentNode.removeChild(el);
  4579. return "continue";
  4580. }
  4581. var attributeList = [].slice.call(el.attributes);
  4582. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4583. attributeList.forEach(function (attr) {
  4584. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4585. el.removeAttribute(attr.nodeName);
  4586. }
  4587. });
  4588. };
  4589. for (var i = 0, len = elements.length; i < len; i++) {
  4590. var _ret = _loop(i);
  4591. if (_ret === "continue") continue;
  4592. }
  4593. return createdDocument.body.innerHTML;
  4594. }
  4595. /**
  4596. * ------------------------------------------------------------------------
  4597. * Constants
  4598. * ------------------------------------------------------------------------
  4599. */
  4600. var NAME$6 = 'tooltip';
  4601. var VERSION$6 = '4.4.1';
  4602. var DATA_KEY$6 = 'bs.tooltip';
  4603. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4604. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4605. var CLASS_PREFIX = 'bs-tooltip';
  4606. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4607. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4608. var DefaultType$4 = {
  4609. animation: 'boolean',
  4610. template: 'string',
  4611. title: '(string|element|function)',
  4612. trigger: 'string',
  4613. delay: '(number|object)',
  4614. html: 'boolean',
  4615. selector: '(string|boolean)',
  4616. placement: '(string|function)',
  4617. offset: '(number|string|function)',
  4618. container: '(string|element|boolean)',
  4619. fallbackPlacement: '(string|array)',
  4620. boundary: '(string|element)',
  4621. sanitize: 'boolean',
  4622. sanitizeFn: '(null|function)',
  4623. whiteList: 'object',
  4624. popperConfig: '(null|object)'
  4625. };
  4626. var AttachmentMap$1 = {
  4627. AUTO: 'auto',
  4628. TOP: 'top',
  4629. RIGHT: 'right',
  4630. BOTTOM: 'bottom',
  4631. LEFT: 'left'
  4632. };
  4633. var Default$4 = {
  4634. animation: true,
  4635. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4636. trigger: 'hover focus',
  4637. title: '',
  4638. delay: 0,
  4639. html: false,
  4640. selector: false,
  4641. placement: 'top',
  4642. offset: 0,
  4643. container: false,
  4644. fallbackPlacement: 'flip',
  4645. boundary: 'scrollParent',
  4646. sanitize: true,
  4647. sanitizeFn: null,
  4648. whiteList: DefaultWhitelist,
  4649. popperConfig: null
  4650. };
  4651. var HoverState = {
  4652. SHOW: 'show',
  4653. OUT: 'out'
  4654. };
  4655. var Event$6 = {
  4656. HIDE: "hide" + EVENT_KEY$6,
  4657. HIDDEN: "hidden" + EVENT_KEY$6,
  4658. SHOW: "show" + EVENT_KEY$6,
  4659. SHOWN: "shown" + EVENT_KEY$6,
  4660. INSERTED: "inserted" + EVENT_KEY$6,
  4661. CLICK: "click" + EVENT_KEY$6,
  4662. FOCUSIN: "focusin" + EVENT_KEY$6,
  4663. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4664. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4665. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4666. };
  4667. var ClassName$6 = {
  4668. FADE: 'fade',
  4669. SHOW: 'show'
  4670. };
  4671. var Selector$6 = {
  4672. TOOLTIP: '.tooltip',
  4673. TOOLTIP_INNER: '.tooltip-inner',
  4674. ARROW: '.arrow'
  4675. };
  4676. var Trigger = {
  4677. HOVER: 'hover',
  4678. FOCUS: 'focus',
  4679. CLICK: 'click',
  4680. MANUAL: 'manual'
  4681. };
  4682. /**
  4683. * ------------------------------------------------------------------------
  4684. * Class Definition
  4685. * ------------------------------------------------------------------------
  4686. */
  4687. var Tooltip =
  4688. /*#__PURE__*/
  4689. function () {
  4690. function Tooltip(element, config) {
  4691. if (typeof Popper === 'undefined') {
  4692. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4693. } // private
  4694. this._isEnabled = true;
  4695. this._timeout = 0;
  4696. this._hoverState = '';
  4697. this._activeTrigger = {};
  4698. this._popper = null; // Protected
  4699. this.element = element;
  4700. this.config = this._getConfig(config);
  4701. this.tip = null;
  4702. this._setListeners();
  4703. } // Getters
  4704. var _proto = Tooltip.prototype;
  4705. // Public
  4706. _proto.enable = function enable() {
  4707. this._isEnabled = true;
  4708. };
  4709. _proto.disable = function disable() {
  4710. this._isEnabled = false;
  4711. };
  4712. _proto.toggleEnabled = function toggleEnabled() {
  4713. this._isEnabled = !this._isEnabled;
  4714. };
  4715. _proto.toggle = function toggle(event) {
  4716. if (!this._isEnabled) {
  4717. return;
  4718. }
  4719. if (event) {
  4720. var dataKey = this.constructor.DATA_KEY;
  4721. var context = $(event.currentTarget).data(dataKey);
  4722. if (!context) {
  4723. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4724. $(event.currentTarget).data(dataKey, context);
  4725. }
  4726. context._activeTrigger.click = !context._activeTrigger.click;
  4727. if (context._isWithActiveTrigger()) {
  4728. context._enter(null, context);
  4729. } else {
  4730. context._leave(null, context);
  4731. }
  4732. } else {
  4733. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4734. this._leave(null, this);
  4735. return;
  4736. }
  4737. this._enter(null, this);
  4738. }
  4739. };
  4740. _proto.dispose = function dispose() {
  4741. clearTimeout(this._timeout);
  4742. $.removeData(this.element, this.constructor.DATA_KEY);
  4743. $(this.element).off(this.constructor.EVENT_KEY);
  4744. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4745. if (this.tip) {
  4746. $(this.tip).remove();
  4747. }
  4748. this._isEnabled = null;
  4749. this._timeout = null;
  4750. this._hoverState = null;
  4751. this._activeTrigger = null;
  4752. if (this._popper) {
  4753. this._popper.destroy();
  4754. }
  4755. this._popper = null;
  4756. this.element = null;
  4757. this.config = null;
  4758. this.tip = null;
  4759. };
  4760. _proto.show = function show() {
  4761. var _this = this;
  4762. if ($(this.element).css('display') === 'none') {
  4763. throw new Error('Please use show on visible elements');
  4764. }
  4765. var showEvent = $.Event(this.constructor.Event.SHOW);
  4766. if (this.isWithContent() && this._isEnabled) {
  4767. $(this.element).trigger(showEvent);
  4768. var shadowRoot = Util.findShadowRoot(this.element);
  4769. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4770. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4771. return;
  4772. }
  4773. var tip = this.getTipElement();
  4774. var tipId = Util.getUID(this.constructor.NAME);
  4775. tip.setAttribute('id', tipId);
  4776. this.element.setAttribute('aria-describedby', tipId);
  4777. this.setContent();
  4778. if (this.config.animation) {
  4779. $(tip).addClass(ClassName$6.FADE);
  4780. }
  4781. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4782. var attachment = this._getAttachment(placement);
  4783. this.addAttachmentClass(attachment);
  4784. var container = this._getContainer();
  4785. $(tip).data(this.constructor.DATA_KEY, this);
  4786. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4787. $(tip).appendTo(container);
  4788. }
  4789. $(this.element).trigger(this.constructor.Event.INSERTED);
  4790. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4791. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4792. // empty mouseover listeners to the body's immediate children;
  4793. // only needed because of broken event delegation on iOS
  4794. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4795. if ('ontouchstart' in document.documentElement) {
  4796. $(document.body).children().on('mouseover', null, $.noop);
  4797. }
  4798. var complete = function complete() {
  4799. if (_this.config.animation) {
  4800. _this._fixTransition();
  4801. }
  4802. var prevHoverState = _this._hoverState;
  4803. _this._hoverState = null;
  4804. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4805. if (prevHoverState === HoverState.OUT) {
  4806. _this._leave(null, _this);
  4807. }
  4808. };
  4809. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4810. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4811. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4812. } else {
  4813. complete();
  4814. }
  4815. }
  4816. };
  4817. _proto.hide = function hide(callback) {
  4818. var _this2 = this;
  4819. var tip = this.getTipElement();
  4820. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4821. var complete = function complete() {
  4822. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4823. tip.parentNode.removeChild(tip);
  4824. }
  4825. _this2._cleanTipClass();
  4826. _this2.element.removeAttribute('aria-describedby');
  4827. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4828. if (_this2._popper !== null) {
  4829. _this2._popper.destroy();
  4830. }
  4831. if (callback) {
  4832. callback();
  4833. }
  4834. };
  4835. $(this.element).trigger(hideEvent);
  4836. if (hideEvent.isDefaultPrevented()) {
  4837. return;
  4838. }
  4839. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4840. // empty mouseover listeners we added for iOS support
  4841. if ('ontouchstart' in document.documentElement) {
  4842. $(document.body).children().off('mouseover', null, $.noop);
  4843. }
  4844. this._activeTrigger[Trigger.CLICK] = false;
  4845. this._activeTrigger[Trigger.FOCUS] = false;
  4846. this._activeTrigger[Trigger.HOVER] = false;
  4847. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4848. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4849. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4850. } else {
  4851. complete();
  4852. }
  4853. this._hoverState = '';
  4854. };
  4855. _proto.update = function update() {
  4856. if (this._popper !== null) {
  4857. this._popper.scheduleUpdate();
  4858. }
  4859. } // Protected
  4860. ;
  4861. _proto.isWithContent = function isWithContent() {
  4862. return Boolean(this.getTitle());
  4863. };
  4864. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4865. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4866. };
  4867. _proto.getTipElement = function getTipElement() {
  4868. this.tip = this.tip || $(this.config.template)[0];
  4869. return this.tip;
  4870. };
  4871. _proto.setContent = function setContent() {
  4872. var tip = this.getTipElement();
  4873. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4874. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4875. };
  4876. _proto.setElementContent = function setElementContent($element, content) {
  4877. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4878. // Content is a DOM node or a jQuery
  4879. if (this.config.html) {
  4880. if (!$(content).parent().is($element)) {
  4881. $element.empty().append(content);
  4882. }
  4883. } else {
  4884. $element.text($(content).text());
  4885. }
  4886. return;
  4887. }
  4888. if (this.config.html) {
  4889. if (this.config.sanitize) {
  4890. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4891. }
  4892. $element.html(content);
  4893. } else {
  4894. $element.text(content);
  4895. }
  4896. };
  4897. _proto.getTitle = function getTitle() {
  4898. var title = this.element.getAttribute('data-original-title');
  4899. if (!title) {
  4900. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4901. }
  4902. return title;
  4903. } // Private
  4904. ;
  4905. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4906. var _this3 = this;
  4907. var defaultBsConfig = {
  4908. placement: attachment,
  4909. modifiers: {
  4910. offset: this._getOffset(),
  4911. flip: {
  4912. behavior: this.config.fallbackPlacement
  4913. },
  4914. arrow: {
  4915. element: Selector$6.ARROW
  4916. },
  4917. preventOverflow: {
  4918. boundariesElement: this.config.boundary
  4919. }
  4920. },
  4921. onCreate: function onCreate(data) {
  4922. if (data.originalPlacement !== data.placement) {
  4923. _this3._handlePopperPlacementChange(data);
  4924. }
  4925. },
  4926. onUpdate: function onUpdate(data) {
  4927. return _this3._handlePopperPlacementChange(data);
  4928. }
  4929. };
  4930. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4931. };
  4932. _proto._getOffset = function _getOffset() {
  4933. var _this4 = this;
  4934. var offset = {};
  4935. if (typeof this.config.offset === 'function') {
  4936. offset.fn = function (data) {
  4937. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4938. return data;
  4939. };
  4940. } else {
  4941. offset.offset = this.config.offset;
  4942. }
  4943. return offset;
  4944. };
  4945. _proto._getContainer = function _getContainer() {
  4946. if (this.config.container === false) {
  4947. return document.body;
  4948. }
  4949. if (Util.isElement(this.config.container)) {
  4950. return $(this.config.container);
  4951. }
  4952. return $(document).find(this.config.container);
  4953. };
  4954. _proto._getAttachment = function _getAttachment(placement) {
  4955. return AttachmentMap$1[placement.toUpperCase()];
  4956. };
  4957. _proto._setListeners = function _setListeners() {
  4958. var _this5 = this;
  4959. var triggers = this.config.trigger.split(' ');
  4960. triggers.forEach(function (trigger) {
  4961. if (trigger === 'click') {
  4962. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4963. return _this5.toggle(event);
  4964. });
  4965. } else if (trigger !== Trigger.MANUAL) {
  4966. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4967. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4968. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4969. return _this5._enter(event);
  4970. }).on(eventOut, _this5.config.selector, function (event) {
  4971. return _this5._leave(event);
  4972. });
  4973. }
  4974. });
  4975. this._hideModalHandler = function () {
  4976. if (_this5.element) {
  4977. _this5.hide();
  4978. }
  4979. };
  4980. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4981. if (this.config.selector) {
  4982. this.config = _objectSpread2({}, this.config, {
  4983. trigger: 'manual',
  4984. selector: ''
  4985. });
  4986. } else {
  4987. this._fixTitle();
  4988. }
  4989. };
  4990. _proto._fixTitle = function _fixTitle() {
  4991. var titleType = typeof this.element.getAttribute('data-original-title');
  4992. if (this.element.getAttribute('title') || titleType !== 'string') {
  4993. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4994. this.element.setAttribute('title', '');
  4995. }
  4996. };
  4997. _proto._enter = function _enter(event, context) {
  4998. var dataKey = this.constructor.DATA_KEY;
  4999. context = context || $(event.currentTarget).data(dataKey);
  5000. if (!context) {
  5001. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5002. $(event.currentTarget).data(dataKey, context);
  5003. }
  5004. if (event) {
  5005. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5006. }
  5007. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5008. context._hoverState = HoverState.SHOW;
  5009. return;
  5010. }
  5011. clearTimeout(context._timeout);
  5012. context._hoverState = HoverState.SHOW;
  5013. if (!context.config.delay || !context.config.delay.show) {
  5014. context.show();
  5015. return;
  5016. }
  5017. context._timeout = setTimeout(function () {
  5018. if (context._hoverState === HoverState.SHOW) {
  5019. context.show();
  5020. }
  5021. }, context.config.delay.show);
  5022. };
  5023. _proto._leave = function _leave(event, context) {
  5024. var dataKey = this.constructor.DATA_KEY;
  5025. context = context || $(event.currentTarget).data(dataKey);
  5026. if (!context) {
  5027. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5028. $(event.currentTarget).data(dataKey, context);
  5029. }
  5030. if (event) {
  5031. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5032. }
  5033. if (context._isWithActiveTrigger()) {
  5034. return;
  5035. }
  5036. clearTimeout(context._timeout);
  5037. context._hoverState = HoverState.OUT;
  5038. if (!context.config.delay || !context.config.delay.hide) {
  5039. context.hide();
  5040. return;
  5041. }
  5042. context._timeout = setTimeout(function () {
  5043. if (context._hoverState === HoverState.OUT) {
  5044. context.hide();
  5045. }
  5046. }, context.config.delay.hide);
  5047. };
  5048. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5049. for (var trigger in this._activeTrigger) {
  5050. if (this._activeTrigger[trigger]) {
  5051. return true;
  5052. }
  5053. }
  5054. return false;
  5055. };
  5056. _proto._getConfig = function _getConfig(config) {
  5057. var dataAttributes = $(this.element).data();
  5058. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5059. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5060. delete dataAttributes[dataAttr];
  5061. }
  5062. });
  5063. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5064. if (typeof config.delay === 'number') {
  5065. config.delay = {
  5066. show: config.delay,
  5067. hide: config.delay
  5068. };
  5069. }
  5070. if (typeof config.title === 'number') {
  5071. config.title = config.title.toString();
  5072. }
  5073. if (typeof config.content === 'number') {
  5074. config.content = config.content.toString();
  5075. }
  5076. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5077. if (config.sanitize) {
  5078. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5079. }
  5080. return config;
  5081. };
  5082. _proto._getDelegateConfig = function _getDelegateConfig() {
  5083. var config = {};
  5084. if (this.config) {
  5085. for (var key in this.config) {
  5086. if (this.constructor.Default[key] !== this.config[key]) {
  5087. config[key] = this.config[key];
  5088. }
  5089. }
  5090. }
  5091. return config;
  5092. };
  5093. _proto._cleanTipClass = function _cleanTipClass() {
  5094. var $tip = $(this.getTipElement());
  5095. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5096. if (tabClass !== null && tabClass.length) {
  5097. $tip.removeClass(tabClass.join(''));
  5098. }
  5099. };
  5100. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5101. var popperInstance = popperData.instance;
  5102. this.tip = popperInstance.popper;
  5103. this._cleanTipClass();
  5104. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5105. };
  5106. _proto._fixTransition = function _fixTransition() {
  5107. var tip = this.getTipElement();
  5108. var initConfigAnimation = this.config.animation;
  5109. if (tip.getAttribute('x-placement') !== null) {
  5110. return;
  5111. }
  5112. $(tip).removeClass(ClassName$6.FADE);
  5113. this.config.animation = false;
  5114. this.hide();
  5115. this.show();
  5116. this.config.animation = initConfigAnimation;
  5117. } // Static
  5118. ;
  5119. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5120. return this.each(function () {
  5121. var data = $(this).data(DATA_KEY$6);
  5122. var _config = typeof config === 'object' && config;
  5123. if (!data && /dispose|hide/.test(config)) {
  5124. return;
  5125. }
  5126. if (!data) {
  5127. data = new Tooltip(this, _config);
  5128. $(this).data(DATA_KEY$6, data);
  5129. }
  5130. if (typeof config === 'string') {
  5131. if (typeof data[config] === 'undefined') {
  5132. throw new TypeError("No method named \"" + config + "\"");
  5133. }
  5134. data[config]();
  5135. }
  5136. });
  5137. };
  5138. _createClass(Tooltip, null, [{
  5139. key: "VERSION",
  5140. get: function get() {
  5141. return VERSION$6;
  5142. }
  5143. }, {
  5144. key: "Default",
  5145. get: function get() {
  5146. return Default$4;
  5147. }
  5148. }, {
  5149. key: "NAME",
  5150. get: function get() {
  5151. return NAME$6;
  5152. }
  5153. }, {
  5154. key: "DATA_KEY",
  5155. get: function get() {
  5156. return DATA_KEY$6;
  5157. }
  5158. }, {
  5159. key: "Event",
  5160. get: function get() {
  5161. return Event$6;
  5162. }
  5163. }, {
  5164. key: "EVENT_KEY",
  5165. get: function get() {
  5166. return EVENT_KEY$6;
  5167. }
  5168. }, {
  5169. key: "DefaultType",
  5170. get: function get() {
  5171. return DefaultType$4;
  5172. }
  5173. }]);
  5174. return Tooltip;
  5175. }();
  5176. /**
  5177. * ------------------------------------------------------------------------
  5178. * jQuery
  5179. * ------------------------------------------------------------------------
  5180. */
  5181. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5182. $.fn[NAME$6].Constructor = Tooltip;
  5183. $.fn[NAME$6].noConflict = function () {
  5184. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5185. return Tooltip._jQueryInterface;
  5186. };
  5187. /**
  5188. * ------------------------------------------------------------------------
  5189. * Constants
  5190. * ------------------------------------------------------------------------
  5191. */
  5192. var NAME$7 = 'popover';
  5193. var VERSION$7 = '4.4.1';
  5194. var DATA_KEY$7 = 'bs.popover';
  5195. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5196. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5197. var CLASS_PREFIX$1 = 'bs-popover';
  5198. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5199. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5200. placement: 'right',
  5201. trigger: 'click',
  5202. content: '',
  5203. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5204. });
  5205. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5206. content: '(string|element|function)'
  5207. });
  5208. var ClassName$7 = {
  5209. FADE: 'fade',
  5210. SHOW: 'show'
  5211. };
  5212. var Selector$7 = {
  5213. TITLE: '.popover-header',
  5214. CONTENT: '.popover-body'
  5215. };
  5216. var Event$7 = {
  5217. HIDE: "hide" + EVENT_KEY$7,
  5218. HIDDEN: "hidden" + EVENT_KEY$7,
  5219. SHOW: "show" + EVENT_KEY$7,
  5220. SHOWN: "shown" + EVENT_KEY$7,
  5221. INSERTED: "inserted" + EVENT_KEY$7,
  5222. CLICK: "click" + EVENT_KEY$7,
  5223. FOCUSIN: "focusin" + EVENT_KEY$7,
  5224. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5225. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5226. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5227. };
  5228. /**
  5229. * ------------------------------------------------------------------------
  5230. * Class Definition
  5231. * ------------------------------------------------------------------------
  5232. */
  5233. var Popover =
  5234. /*#__PURE__*/
  5235. function (_Tooltip) {
  5236. _inheritsLoose(Popover, _Tooltip);
  5237. function Popover() {
  5238. return _Tooltip.apply(this, arguments) || this;
  5239. }
  5240. var _proto = Popover.prototype;
  5241. // Overrides
  5242. _proto.isWithContent = function isWithContent() {
  5243. return this.getTitle() || this._getContent();
  5244. };
  5245. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5246. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5247. };
  5248. _proto.getTipElement = function getTipElement() {
  5249. this.tip = this.tip || $(this.config.template)[0];
  5250. return this.tip;
  5251. };
  5252. _proto.setContent = function setContent() {
  5253. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5254. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5255. var content = this._getContent();
  5256. if (typeof content === 'function') {
  5257. content = content.call(this.element);
  5258. }
  5259. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5260. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5261. } // Private
  5262. ;
  5263. _proto._getContent = function _getContent() {
  5264. return this.element.getAttribute('data-content') || this.config.content;
  5265. };
  5266. _proto._cleanTipClass = function _cleanTipClass() {
  5267. var $tip = $(this.getTipElement());
  5268. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5269. if (tabClass !== null && tabClass.length > 0) {
  5270. $tip.removeClass(tabClass.join(''));
  5271. }
  5272. } // Static
  5273. ;
  5274. Popover._jQueryInterface = function _jQueryInterface(config) {
  5275. return this.each(function () {
  5276. var data = $(this).data(DATA_KEY$7);
  5277. var _config = typeof config === 'object' ? config : null;
  5278. if (!data && /dispose|hide/.test(config)) {
  5279. return;
  5280. }
  5281. if (!data) {
  5282. data = new Popover(this, _config);
  5283. $(this).data(DATA_KEY$7, data);
  5284. }
  5285. if (typeof config === 'string') {
  5286. if (typeof data[config] === 'undefined') {
  5287. throw new TypeError("No method named \"" + config + "\"");
  5288. }
  5289. data[config]();
  5290. }
  5291. });
  5292. };
  5293. _createClass(Popover, null, [{
  5294. key: "VERSION",
  5295. // Getters
  5296. get: function get() {
  5297. return VERSION$7;
  5298. }
  5299. }, {
  5300. key: "Default",
  5301. get: function get() {
  5302. return Default$5;
  5303. }
  5304. }, {
  5305. key: "NAME",
  5306. get: function get() {
  5307. return NAME$7;
  5308. }
  5309. }, {
  5310. key: "DATA_KEY",
  5311. get: function get() {
  5312. return DATA_KEY$7;
  5313. }
  5314. }, {
  5315. key: "Event",
  5316. get: function get() {
  5317. return Event$7;
  5318. }
  5319. }, {
  5320. key: "EVENT_KEY",
  5321. get: function get() {
  5322. return EVENT_KEY$7;
  5323. }
  5324. }, {
  5325. key: "DefaultType",
  5326. get: function get() {
  5327. return DefaultType$5;
  5328. }
  5329. }]);
  5330. return Popover;
  5331. }(Tooltip);
  5332. /**
  5333. * ------------------------------------------------------------------------
  5334. * jQuery
  5335. * ------------------------------------------------------------------------
  5336. */
  5337. $.fn[NAME$7] = Popover._jQueryInterface;
  5338. $.fn[NAME$7].Constructor = Popover;
  5339. $.fn[NAME$7].noConflict = function () {
  5340. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5341. return Popover._jQueryInterface;
  5342. };
  5343. /**
  5344. * ------------------------------------------------------------------------
  5345. * Constants
  5346. * ------------------------------------------------------------------------
  5347. */
  5348. var NAME$8 = 'scrollspy';
  5349. var VERSION$8 = '4.4.1';
  5350. var DATA_KEY$8 = 'bs.scrollspy';
  5351. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5352. var DATA_API_KEY$6 = '.data-api';
  5353. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5354. var Default$6 = {
  5355. offset: 10,
  5356. method: 'auto',
  5357. target: ''
  5358. };
  5359. var DefaultType$6 = {
  5360. offset: 'number',
  5361. method: 'string',
  5362. target: '(string|element)'
  5363. };
  5364. var Event$8 = {
  5365. ACTIVATE: "activate" + EVENT_KEY$8,
  5366. SCROLL: "scroll" + EVENT_KEY$8,
  5367. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5368. };
  5369. var ClassName$8 = {
  5370. DROPDOWN_ITEM: 'dropdown-item',
  5371. DROPDOWN_MENU: 'dropdown-menu',
  5372. ACTIVE: 'active'
  5373. };
  5374. var Selector$8 = {
  5375. DATA_SPY: '[data-spy="scroll"]',
  5376. ACTIVE: '.active',
  5377. NAV_LIST_GROUP: '.nav, .list-group',
  5378. NAV_LINKS: '.nav-link',
  5379. NAV_ITEMS: '.nav-item',
  5380. LIST_ITEMS: '.list-group-item',
  5381. DROPDOWN: '.dropdown',
  5382. DROPDOWN_ITEMS: '.dropdown-item',
  5383. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5384. };
  5385. var OffsetMethod = {
  5386. OFFSET: 'offset',
  5387. POSITION: 'position'
  5388. };
  5389. /**
  5390. * ------------------------------------------------------------------------
  5391. * Class Definition
  5392. * ------------------------------------------------------------------------
  5393. */
  5394. var ScrollSpy =
  5395. /*#__PURE__*/
  5396. function () {
  5397. function ScrollSpy(element, config) {
  5398. var _this = this;
  5399. this._element = element;
  5400. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5401. this._config = this._getConfig(config);
  5402. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5403. this._offsets = [];
  5404. this._targets = [];
  5405. this._activeTarget = null;
  5406. this._scrollHeight = 0;
  5407. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5408. return _this._process(event);
  5409. });
  5410. this.refresh();
  5411. this._process();
  5412. } // Getters
  5413. var _proto = ScrollSpy.prototype;
  5414. // Public
  5415. _proto.refresh = function refresh() {
  5416. var _this2 = this;
  5417. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5418. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5419. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5420. this._offsets = [];
  5421. this._targets = [];
  5422. this._scrollHeight = this._getScrollHeight();
  5423. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5424. targets.map(function (element) {
  5425. var target;
  5426. var targetSelector = Util.getSelectorFromElement(element);
  5427. if (targetSelector) {
  5428. target = document.querySelector(targetSelector);
  5429. }
  5430. if (target) {
  5431. var targetBCR = target.getBoundingClientRect();
  5432. if (targetBCR.width || targetBCR.height) {
  5433. // TODO (fat): remove sketch reliance on jQuery position/offset
  5434. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5435. }
  5436. }
  5437. return null;
  5438. }).filter(function (item) {
  5439. return item;
  5440. }).sort(function (a, b) {
  5441. return a[0] - b[0];
  5442. }).forEach(function (item) {
  5443. _this2._offsets.push(item[0]);
  5444. _this2._targets.push(item[1]);
  5445. });
  5446. };
  5447. _proto.dispose = function dispose() {
  5448. $.removeData(this._element, DATA_KEY$8);
  5449. $(this._scrollElement).off(EVENT_KEY$8);
  5450. this._element = null;
  5451. this._scrollElement = null;
  5452. this._config = null;
  5453. this._selector = null;
  5454. this._offsets = null;
  5455. this._targets = null;
  5456. this._activeTarget = null;
  5457. this._scrollHeight = null;
  5458. } // Private
  5459. ;
  5460. _proto._getConfig = function _getConfig(config) {
  5461. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5462. if (typeof config.target !== 'string') {
  5463. var id = $(config.target).attr('id');
  5464. if (!id) {
  5465. id = Util.getUID(NAME$8);
  5466. $(config.target).attr('id', id);
  5467. }
  5468. config.target = "#" + id;
  5469. }
  5470. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5471. return config;
  5472. };
  5473. _proto._getScrollTop = function _getScrollTop() {
  5474. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5475. };
  5476. _proto._getScrollHeight = function _getScrollHeight() {
  5477. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5478. };
  5479. _proto._getOffsetHeight = function _getOffsetHeight() {
  5480. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5481. };
  5482. _proto._process = function _process() {
  5483. var scrollTop = this._getScrollTop() + this._config.offset;
  5484. var scrollHeight = this._getScrollHeight();
  5485. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5486. if (this._scrollHeight !== scrollHeight) {
  5487. this.refresh();
  5488. }
  5489. if (scrollTop >= maxScroll) {
  5490. var target = this._targets[this._targets.length - 1];
  5491. if (this._activeTarget !== target) {
  5492. this._activate(target);
  5493. }
  5494. return;
  5495. }
  5496. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5497. this._activeTarget = null;
  5498. this._clear();
  5499. return;
  5500. }
  5501. var offsetLength = this._offsets.length;
  5502. for (var i = offsetLength; i--;) {
  5503. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5504. if (isActiveTarget) {
  5505. this._activate(this._targets[i]);
  5506. }
  5507. }
  5508. };
  5509. _proto._activate = function _activate(target) {
  5510. this._activeTarget = target;
  5511. this._clear();
  5512. var queries = this._selector.split(',').map(function (selector) {
  5513. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5514. });
  5515. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5516. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5517. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5518. $link.addClass(ClassName$8.ACTIVE);
  5519. } else {
  5520. // Set triggered link as active
  5521. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5522. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5523. $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
  5524. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5525. }
  5526. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5527. relatedTarget: target
  5528. });
  5529. };
  5530. _proto._clear = function _clear() {
  5531. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5532. return node.classList.contains(ClassName$8.ACTIVE);
  5533. }).forEach(function (node) {
  5534. return node.classList.remove(ClassName$8.ACTIVE);
  5535. });
  5536. } // Static
  5537. ;
  5538. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5539. return this.each(function () {
  5540. var data = $(this).data(DATA_KEY$8);
  5541. var _config = typeof config === 'object' && config;
  5542. if (!data) {
  5543. data = new ScrollSpy(this, _config);
  5544. $(this).data(DATA_KEY$8, data);
  5545. }
  5546. if (typeof config === 'string') {
  5547. if (typeof data[config] === 'undefined') {
  5548. throw new TypeError("No method named \"" + config + "\"");
  5549. }
  5550. data[config]();
  5551. }
  5552. });
  5553. };
  5554. _createClass(ScrollSpy, null, [{
  5555. key: "VERSION",
  5556. get: function get() {
  5557. return VERSION$8;
  5558. }
  5559. }, {
  5560. key: "Default",
  5561. get: function get() {
  5562. return Default$6;
  5563. }
  5564. }]);
  5565. return ScrollSpy;
  5566. }();
  5567. /**
  5568. * ------------------------------------------------------------------------
  5569. * Data Api implementation
  5570. * ------------------------------------------------------------------------
  5571. */
  5572. $(window).on(Event$8.LOAD_DATA_API, function () {
  5573. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5574. var scrollSpysLength = scrollSpys.length;
  5575. for (var i = scrollSpysLength; i--;) {
  5576. var $spy = $(scrollSpys[i]);
  5577. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5578. }
  5579. });
  5580. /**
  5581. * ------------------------------------------------------------------------
  5582. * jQuery
  5583. * ------------------------------------------------------------------------
  5584. */
  5585. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5586. $.fn[NAME$8].Constructor = ScrollSpy;
  5587. $.fn[NAME$8].noConflict = function () {
  5588. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5589. return ScrollSpy._jQueryInterface;
  5590. };
  5591. /**
  5592. * ------------------------------------------------------------------------
  5593. * Constants
  5594. * ------------------------------------------------------------------------
  5595. */
  5596. var NAME$9 = 'tab';
  5597. var VERSION$9 = '4.4.1';
  5598. var DATA_KEY$9 = 'bs.tab';
  5599. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5600. var DATA_API_KEY$7 = '.data-api';
  5601. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5602. var Event$9 = {
  5603. HIDE: "hide" + EVENT_KEY$9,
  5604. HIDDEN: "hidden" + EVENT_KEY$9,
  5605. SHOW: "show" + EVENT_KEY$9,
  5606. SHOWN: "shown" + EVENT_KEY$9,
  5607. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5608. };
  5609. var ClassName$9 = {
  5610. DROPDOWN_MENU: 'dropdown-menu',
  5611. ACTIVE: 'active',
  5612. DISABLED: 'disabled',
  5613. FADE: 'fade',
  5614. SHOW: 'show'
  5615. };
  5616. var Selector$9 = {
  5617. DROPDOWN: '.dropdown',
  5618. NAV_LIST_GROUP: '.nav, .list-group',
  5619. ACTIVE: '.active',
  5620. ACTIVE_UL: '> li > .active',
  5621. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5622. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5623. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5624. };
  5625. /**
  5626. * ------------------------------------------------------------------------
  5627. * Class Definition
  5628. * ------------------------------------------------------------------------
  5629. */
  5630. var Tab =
  5631. /*#__PURE__*/
  5632. function () {
  5633. function Tab(element) {
  5634. this._element = element;
  5635. } // Getters
  5636. var _proto = Tab.prototype;
  5637. // Public
  5638. _proto.show = function show() {
  5639. var _this = this;
  5640. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5641. return;
  5642. }
  5643. var target;
  5644. var previous;
  5645. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5646. var selector = Util.getSelectorFromElement(this._element);
  5647. if (listElement) {
  5648. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5649. previous = $.makeArray($(listElement).find(itemSelector));
  5650. previous = previous[previous.length - 1];
  5651. }
  5652. var hideEvent = $.Event(Event$9.HIDE, {
  5653. relatedTarget: this._element
  5654. });
  5655. var showEvent = $.Event(Event$9.SHOW, {
  5656. relatedTarget: previous
  5657. });
  5658. if (previous) {
  5659. $(previous).trigger(hideEvent);
  5660. }
  5661. $(this._element).trigger(showEvent);
  5662. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5663. return;
  5664. }
  5665. if (selector) {
  5666. target = document.querySelector(selector);
  5667. }
  5668. this._activate(this._element, listElement);
  5669. var complete = function complete() {
  5670. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5671. relatedTarget: _this._element
  5672. });
  5673. var shownEvent = $.Event(Event$9.SHOWN, {
  5674. relatedTarget: previous
  5675. });
  5676. $(previous).trigger(hiddenEvent);
  5677. $(_this._element).trigger(shownEvent);
  5678. };
  5679. if (target) {
  5680. this._activate(target, target.parentNode, complete);
  5681. } else {
  5682. complete();
  5683. }
  5684. };
  5685. _proto.dispose = function dispose() {
  5686. $.removeData(this._element, DATA_KEY$9);
  5687. this._element = null;
  5688. } // Private
  5689. ;
  5690. _proto._activate = function _activate(element, container, callback) {
  5691. var _this2 = this;
  5692. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5693. var active = activeElements[0];
  5694. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5695. var complete = function complete() {
  5696. return _this2._transitionComplete(element, active, callback);
  5697. };
  5698. if (active && isTransitioning) {
  5699. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5700. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5701. } else {
  5702. complete();
  5703. }
  5704. };
  5705. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5706. if (active) {
  5707. $(active).removeClass(ClassName$9.ACTIVE);
  5708. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5709. if (dropdownChild) {
  5710. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5711. }
  5712. if (active.getAttribute('role') === 'tab') {
  5713. active.setAttribute('aria-selected', false);
  5714. }
  5715. }
  5716. $(element).addClass(ClassName$9.ACTIVE);
  5717. if (element.getAttribute('role') === 'tab') {
  5718. element.setAttribute('aria-selected', true);
  5719. }
  5720. Util.reflow(element);
  5721. if (element.classList.contains(ClassName$9.FADE)) {
  5722. element.classList.add(ClassName$9.SHOW);
  5723. }
  5724. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5725. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5726. if (dropdownElement) {
  5727. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5728. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5729. }
  5730. element.setAttribute('aria-expanded', true);
  5731. }
  5732. if (callback) {
  5733. callback();
  5734. }
  5735. } // Static
  5736. ;
  5737. Tab._jQueryInterface = function _jQueryInterface(config) {
  5738. return this.each(function () {
  5739. var $this = $(this);
  5740. var data = $this.data(DATA_KEY$9);
  5741. if (!data) {
  5742. data = new Tab(this);
  5743. $this.data(DATA_KEY$9, data);
  5744. }
  5745. if (typeof config === 'string') {
  5746. if (typeof data[config] === 'undefined') {
  5747. throw new TypeError("No method named \"" + config + "\"");
  5748. }
  5749. data[config]();
  5750. }
  5751. });
  5752. };
  5753. _createClass(Tab, null, [{
  5754. key: "VERSION",
  5755. get: function get() {
  5756. return VERSION$9;
  5757. }
  5758. }]);
  5759. return Tab;
  5760. }();
  5761. /**
  5762. * ------------------------------------------------------------------------
  5763. * Data Api implementation
  5764. * ------------------------------------------------------------------------
  5765. */
  5766. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5767. event.preventDefault();
  5768. Tab._jQueryInterface.call($(this), 'show');
  5769. });
  5770. /**
  5771. * ------------------------------------------------------------------------
  5772. * jQuery
  5773. * ------------------------------------------------------------------------
  5774. */
  5775. $.fn[NAME$9] = Tab._jQueryInterface;
  5776. $.fn[NAME$9].Constructor = Tab;
  5777. $.fn[NAME$9].noConflict = function () {
  5778. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5779. return Tab._jQueryInterface;
  5780. };
  5781. /**
  5782. * ------------------------------------------------------------------------
  5783. * Constants
  5784. * ------------------------------------------------------------------------
  5785. */
  5786. var NAME$a = 'toast';
  5787. var VERSION$a = '4.4.1';
  5788. var DATA_KEY$a = 'bs.toast';
  5789. var EVENT_KEY$a = "." + DATA_KEY$a;
  5790. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5791. var Event$a = {
  5792. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5793. HIDE: "hide" + EVENT_KEY$a,
  5794. HIDDEN: "hidden" + EVENT_KEY$a,
  5795. SHOW: "show" + EVENT_KEY$a,
  5796. SHOWN: "shown" + EVENT_KEY$a
  5797. };
  5798. var ClassName$a = {
  5799. FADE: 'fade',
  5800. HIDE: 'hide',
  5801. SHOW: 'show',
  5802. SHOWING: 'showing'
  5803. };
  5804. var DefaultType$7 = {
  5805. animation: 'boolean',
  5806. autohide: 'boolean',
  5807. delay: 'number'
  5808. };
  5809. var Default$7 = {
  5810. animation: true,
  5811. autohide: true,
  5812. delay: 500
  5813. };
  5814. var Selector$a = {
  5815. DATA_DISMISS: '[data-dismiss="toast"]'
  5816. };
  5817. /**
  5818. * ------------------------------------------------------------------------
  5819. * Class Definition
  5820. * ------------------------------------------------------------------------
  5821. */
  5822. var Toast =
  5823. /*#__PURE__*/
  5824. function () {
  5825. function Toast(element, config) {
  5826. this._element = element;
  5827. this._config = this._getConfig(config);
  5828. this._timeout = null;
  5829. this._setListeners();
  5830. } // Getters
  5831. var _proto = Toast.prototype;
  5832. // Public
  5833. _proto.show = function show() {
  5834. var _this = this;
  5835. var showEvent = $.Event(Event$a.SHOW);
  5836. $(this._element).trigger(showEvent);
  5837. if (showEvent.isDefaultPrevented()) {
  5838. return;
  5839. }
  5840. if (this._config.animation) {
  5841. this._element.classList.add(ClassName$a.FADE);
  5842. }
  5843. var complete = function complete() {
  5844. _this._element.classList.remove(ClassName$a.SHOWING);
  5845. _this._element.classList.add(ClassName$a.SHOW);
  5846. $(_this._element).trigger(Event$a.SHOWN);
  5847. if (_this._config.autohide) {
  5848. _this._timeout = setTimeout(function () {
  5849. _this.hide();
  5850. }, _this._config.delay);
  5851. }
  5852. };
  5853. this._element.classList.remove(ClassName$a.HIDE);
  5854. Util.reflow(this._element);
  5855. this._element.classList.add(ClassName$a.SHOWING);
  5856. if (this._config.animation) {
  5857. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5858. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5859. } else {
  5860. complete();
  5861. }
  5862. };
  5863. _proto.hide = function hide() {
  5864. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5865. return;
  5866. }
  5867. var hideEvent = $.Event(Event$a.HIDE);
  5868. $(this._element).trigger(hideEvent);
  5869. if (hideEvent.isDefaultPrevented()) {
  5870. return;
  5871. }
  5872. this._close();
  5873. };
  5874. _proto.dispose = function dispose() {
  5875. clearTimeout(this._timeout);
  5876. this._timeout = null;
  5877. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5878. this._element.classList.remove(ClassName$a.SHOW);
  5879. }
  5880. $(this._element).off(Event$a.CLICK_DISMISS);
  5881. $.removeData(this._element, DATA_KEY$a);
  5882. this._element = null;
  5883. this._config = null;
  5884. } // Private
  5885. ;
  5886. _proto._getConfig = function _getConfig(config) {
  5887. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5888. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5889. return config;
  5890. };
  5891. _proto._setListeners = function _setListeners() {
  5892. var _this2 = this;
  5893. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5894. return _this2.hide();
  5895. });
  5896. };
  5897. _proto._close = function _close() {
  5898. var _this3 = this;
  5899. var complete = function complete() {
  5900. _this3._element.classList.add(ClassName$a.HIDE);
  5901. $(_this3._element).trigger(Event$a.HIDDEN);
  5902. };
  5903. this._element.classList.remove(ClassName$a.SHOW);
  5904. if (this._config.animation) {
  5905. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5906. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5907. } else {
  5908. complete();
  5909. }
  5910. } // Static
  5911. ;
  5912. Toast._jQueryInterface = function _jQueryInterface(config) {
  5913. return this.each(function () {
  5914. var $element = $(this);
  5915. var data = $element.data(DATA_KEY$a);
  5916. var _config = typeof config === 'object' && config;
  5917. if (!data) {
  5918. data = new Toast(this, _config);
  5919. $element.data(DATA_KEY$a, data);
  5920. }
  5921. if (typeof config === 'string') {
  5922. if (typeof data[config] === 'undefined') {
  5923. throw new TypeError("No method named \"" + config + "\"");
  5924. }
  5925. data[config](this);
  5926. }
  5927. });
  5928. };
  5929. _createClass(Toast, null, [{
  5930. key: "VERSION",
  5931. get: function get() {
  5932. return VERSION$a;
  5933. }
  5934. }, {
  5935. key: "DefaultType",
  5936. get: function get() {
  5937. return DefaultType$7;
  5938. }
  5939. }, {
  5940. key: "Default",
  5941. get: function get() {
  5942. return Default$7;
  5943. }
  5944. }]);
  5945. return Toast;
  5946. }();
  5947. /**
  5948. * ------------------------------------------------------------------------
  5949. * jQuery
  5950. * ------------------------------------------------------------------------
  5951. */
  5952. $.fn[NAME$a] = Toast._jQueryInterface;
  5953. $.fn[NAME$a].Constructor = Toast;
  5954. $.fn[NAME$a].noConflict = function () {
  5955. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5956. return Toast._jQueryInterface;
  5957. };
  5958. exports.Alert = Alert;
  5959. exports.Button = Button;
  5960. exports.Carousel = Carousel;
  5961. exports.Collapse = Collapse;
  5962. exports.Dropdown = Dropdown;
  5963. exports.Modal = Modal;
  5964. exports.Popover = Popover;
  5965. exports.Scrollspy = ScrollSpy;
  5966. exports.Tab = Tab;
  5967. exports.Toast = Toast;
  5968. exports.Tooltip = Tooltip;
  5969. exports.Util = Util;
  5970. Object.defineProperty(exports, '__esModule', { value: true });
  5971. })));
  5972. //# sourceMappingURL=bootstrap.js.map
  5973. /*!
  5974. * Jasny Bootstrap v4.0.0 (http://jasny.github.io/bootstrap)
  5975. * Copyright 2012-2019 Arnold Daniels
  5976. * Licensed under ()
  5977. */
  5978. 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);
  5979. !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});
  5980. /*!
  5981. FullCalendar Core Package v4.4.0
  5982. Docs & License: https://fullcalendar.io/
  5983. (c) 2019 Adam Shaw
  5984. */
  5985. (function (global, factory) {
  5986. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  5987. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  5988. (global = global || self, factory(global.FullCalendar = {}));
  5989. }(this, function (exports) { 'use strict';
  5990. // Creating
  5991. // ----------------------------------------------------------------------------------------------------------------
  5992. var elementPropHash = {
  5993. className: true,
  5994. colSpan: true,
  5995. rowSpan: true
  5996. };
  5997. var containerTagHash = {
  5998. '<tr': 'tbody',
  5999. '<td': 'tr'
  6000. };
  6001. function createElement(tagName, attrs, content) {
  6002. var el = document.createElement(tagName);
  6003. if (attrs) {
  6004. for (var attrName in attrs) {
  6005. if (attrName === 'style') {
  6006. applyStyle(el, attrs[attrName]);
  6007. }
  6008. else if (elementPropHash[attrName]) {
  6009. el[attrName] = attrs[attrName];
  6010. }
  6011. else {
  6012. el.setAttribute(attrName, attrs[attrName]);
  6013. }
  6014. }
  6015. }
  6016. if (typeof content === 'string') {
  6017. el.innerHTML = content; // shortcut. no need to process HTML in any way
  6018. }
  6019. else if (content != null) {
  6020. appendToElement(el, content);
  6021. }
  6022. return el;
  6023. }
  6024. function htmlToElement(html) {
  6025. html = html.trim();
  6026. var container = document.createElement(computeContainerTag(html));
  6027. container.innerHTML = html;
  6028. return container.firstChild;
  6029. }
  6030. function htmlToElements(html) {
  6031. return Array.prototype.slice.call(htmlToNodeList(html));
  6032. }
  6033. function htmlToNodeList(html) {
  6034. html = html.trim();
  6035. var container = document.createElement(computeContainerTag(html));
  6036. container.innerHTML = html;
  6037. return container.childNodes;
  6038. }
  6039. // assumes html already trimmed and tag names are lowercase
  6040. function computeContainerTag(html) {
  6041. return containerTagHash[html.substr(0, 3) // faster than using regex
  6042. ] || 'div';
  6043. }
  6044. function appendToElement(el, content) {
  6045. var childNodes = normalizeContent(content);
  6046. for (var i = 0; i < childNodes.length; i++) {
  6047. el.appendChild(childNodes[i]);
  6048. }
  6049. }
  6050. function prependToElement(parent, content) {
  6051. var newEls = normalizeContent(content);
  6052. var afterEl = parent.firstChild || null; // if no firstChild, will append to end, but that's okay, b/c there were no children
  6053. for (var i = 0; i < newEls.length; i++) {
  6054. parent.insertBefore(newEls[i], afterEl);
  6055. }
  6056. }
  6057. function insertAfterElement(refEl, content) {
  6058. var newEls = normalizeContent(content);
  6059. var afterEl = refEl.nextSibling || null;
  6060. for (var i = 0; i < newEls.length; i++) {
  6061. refEl.parentNode.insertBefore(newEls[i], afterEl);
  6062. }
  6063. }
  6064. function normalizeContent(content) {
  6065. var els;
  6066. if (typeof content === 'string') {
  6067. els = htmlToElements(content);
  6068. }
  6069. else if (content instanceof Node) {
  6070. els = [content];
  6071. }
  6072. else { // Node[] or NodeList
  6073. els = Array.prototype.slice.call(content);
  6074. }
  6075. return els;
  6076. }
  6077. function removeElement(el) {
  6078. if (el.parentNode) {
  6079. el.parentNode.removeChild(el);
  6080. }
  6081. }
  6082. // Querying
  6083. // ----------------------------------------------------------------------------------------------------------------
  6084. // from https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
  6085. var matchesMethod = Element.prototype.matches ||
  6086. Element.prototype.matchesSelector ||
  6087. Element.prototype.msMatchesSelector;
  6088. var closestMethod = Element.prototype.closest || function (selector) {
  6089. // polyfill
  6090. var el = this;
  6091. if (!document.documentElement.contains(el)) {
  6092. return null;
  6093. }
  6094. do {
  6095. if (elementMatches(el, selector)) {
  6096. return el;
  6097. }
  6098. el = el.parentElement || el.parentNode;
  6099. } while (el !== null && el.nodeType === 1);
  6100. return null;
  6101. };
  6102. function elementClosest(el, selector) {
  6103. return closestMethod.call(el, selector);
  6104. }
  6105. function elementMatches(el, selector) {
  6106. return matchesMethod.call(el, selector);
  6107. }
  6108. // accepts multiple subject els
  6109. // returns a real array. good for methods like forEach
  6110. function findElements(container, selector) {
  6111. var containers = container instanceof HTMLElement ? [container] : container;
  6112. var allMatches = [];
  6113. for (var i = 0; i < containers.length; i++) {
  6114. var matches = containers[i].querySelectorAll(selector);
  6115. for (var j = 0; j < matches.length; j++) {
  6116. allMatches.push(matches[j]);
  6117. }
  6118. }
  6119. return allMatches;
  6120. }
  6121. // accepts multiple subject els
  6122. // only queries direct child elements
  6123. function findChildren(parent, selector) {
  6124. var parents = parent instanceof HTMLElement ? [parent] : parent;
  6125. var allMatches = [];
  6126. for (var i = 0; i < parents.length; i++) {
  6127. var childNodes = parents[i].children; // only ever elements
  6128. for (var j = 0; j < childNodes.length; j++) {
  6129. var childNode = childNodes[j];
  6130. if (!selector || elementMatches(childNode, selector)) {
  6131. allMatches.push(childNode);
  6132. }
  6133. }
  6134. }
  6135. return allMatches;
  6136. }
  6137. // Attributes
  6138. // ----------------------------------------------------------------------------------------------------------------
  6139. function forceClassName(el, className, bool) {
  6140. if (bool) {
  6141. el.classList.add(className);
  6142. }
  6143. else {
  6144. el.classList.remove(className);
  6145. }
  6146. }
  6147. // Style
  6148. // ----------------------------------------------------------------------------------------------------------------
  6149. var PIXEL_PROP_RE = /(top|left|right|bottom|width|height)$/i;
  6150. function applyStyle(el, props) {
  6151. for (var propName in props) {
  6152. applyStyleProp(el, propName, props[propName]);
  6153. }
  6154. }
  6155. function applyStyleProp(el, name, val) {
  6156. if (val == null) {
  6157. el.style[name] = '';
  6158. }
  6159. else if (typeof val === 'number' && PIXEL_PROP_RE.test(name)) {
  6160. el.style[name] = val + 'px';
  6161. }
  6162. else {
  6163. el.style[name] = val;
  6164. }
  6165. }
  6166. function pointInsideRect(point, rect) {
  6167. return point.left >= rect.left &&
  6168. point.left < rect.right &&
  6169. point.top >= rect.top &&
  6170. point.top < rect.bottom;
  6171. }
  6172. // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false
  6173. function intersectRects(rect1, rect2) {
  6174. var res = {
  6175. left: Math.max(rect1.left, rect2.left),
  6176. right: Math.min(rect1.right, rect2.right),
  6177. top: Math.max(rect1.top, rect2.top),
  6178. bottom: Math.min(rect1.bottom, rect2.bottom)
  6179. };
  6180. if (res.left < res.right && res.top < res.bottom) {
  6181. return res;
  6182. }
  6183. return false;
  6184. }
  6185. function translateRect(rect, deltaX, deltaY) {
  6186. return {
  6187. left: rect.left + deltaX,
  6188. right: rect.right + deltaX,
  6189. top: rect.top + deltaY,
  6190. bottom: rect.bottom + deltaY
  6191. };
  6192. }
  6193. // Returns a new point that will have been moved to reside within the given rectangle
  6194. function constrainPoint(point, rect) {
  6195. return {
  6196. left: Math.min(Math.max(point.left, rect.left), rect.right),
  6197. top: Math.min(Math.max(point.top, rect.top), rect.bottom)
  6198. };
  6199. }
  6200. // Returns a point that is the center of the given rectangle
  6201. function getRectCenter(rect) {
  6202. return {
  6203. left: (rect.left + rect.right) / 2,
  6204. top: (rect.top + rect.bottom) / 2
  6205. };
  6206. }
  6207. // Subtracts point2's coordinates from point1's coordinates, returning a delta
  6208. function diffPoints(point1, point2) {
  6209. return {
  6210. left: point1.left - point2.left,
  6211. top: point1.top - point2.top
  6212. };
  6213. }
  6214. // Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side
  6215. var isRtlScrollbarOnLeft = null;
  6216. function getIsRtlScrollbarOnLeft() {
  6217. if (isRtlScrollbarOnLeft === null) {
  6218. isRtlScrollbarOnLeft = computeIsRtlScrollbarOnLeft();
  6219. }
  6220. return isRtlScrollbarOnLeft;
  6221. }
  6222. function computeIsRtlScrollbarOnLeft() {
  6223. var outerEl = createElement('div', {
  6224. style: {
  6225. position: 'absolute',
  6226. top: -1000,
  6227. left: 0,
  6228. border: 0,
  6229. padding: 0,
  6230. overflow: 'scroll',
  6231. direction: 'rtl'
  6232. }
  6233. }, '<div></div>');
  6234. document.body.appendChild(outerEl);
  6235. var innerEl = outerEl.firstChild;
  6236. var res = innerEl.getBoundingClientRect().left > outerEl.getBoundingClientRect().left;
  6237. removeElement(outerEl);
  6238. return res;
  6239. }
  6240. // The scrollbar width computations in computeEdges are sometimes flawed when it comes to
  6241. // retina displays, rounding, and IE11. Massage them into a usable value.
  6242. function sanitizeScrollbarWidth(width) {
  6243. width = Math.max(0, width); // no negatives
  6244. width = Math.round(width);
  6245. return width;
  6246. }
  6247. function computeEdges(el, getPadding) {
  6248. if (getPadding === void 0) { getPadding = false; }
  6249. var computedStyle = window.getComputedStyle(el);
  6250. var borderLeft = parseInt(computedStyle.borderLeftWidth, 10) || 0;
  6251. var borderRight = parseInt(computedStyle.borderRightWidth, 10) || 0;
  6252. var borderTop = parseInt(computedStyle.borderTopWidth, 10) || 0;
  6253. var borderBottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
  6254. // must use offset(Width|Height) because compatible with client(Width|Height)
  6255. var scrollbarLeftRight = sanitizeScrollbarWidth(el.offsetWidth - el.clientWidth - borderLeft - borderRight);
  6256. var scrollbarBottom = sanitizeScrollbarWidth(el.offsetHeight - el.clientHeight - borderTop - borderBottom);
  6257. var res = {
  6258. borderLeft: borderLeft,
  6259. borderRight: borderRight,
  6260. borderTop: borderTop,
  6261. borderBottom: borderBottom,
  6262. scrollbarBottom: scrollbarBottom,
  6263. scrollbarLeft: 0,
  6264. scrollbarRight: 0
  6265. };
  6266. if (getIsRtlScrollbarOnLeft() && computedStyle.direction === 'rtl') { // is the scrollbar on the left side?
  6267. res.scrollbarLeft = scrollbarLeftRight;
  6268. }
  6269. else {
  6270. res.scrollbarRight = scrollbarLeftRight;
  6271. }
  6272. if (getPadding) {
  6273. res.paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
  6274. res.paddingRight = parseInt(computedStyle.paddingRight, 10) || 0;
  6275. res.paddingTop = parseInt(computedStyle.paddingTop, 10) || 0;
  6276. res.paddingBottom = parseInt(computedStyle.paddingBottom, 10) || 0;
  6277. }
  6278. return res;
  6279. }
  6280. function computeInnerRect(el, goWithinPadding) {
  6281. if (goWithinPadding === void 0) { goWithinPadding = false; }
  6282. var outerRect = computeRect(el);
  6283. var edges = computeEdges(el, goWithinPadding);
  6284. var res = {
  6285. left: outerRect.left + edges.borderLeft + edges.scrollbarLeft,
  6286. right: outerRect.right - edges.borderRight - edges.scrollbarRight,
  6287. top: outerRect.top + edges.borderTop,
  6288. bottom: outerRect.bottom - edges.borderBottom - edges.scrollbarBottom
  6289. };
  6290. if (goWithinPadding) {
  6291. res.left += edges.paddingLeft;
  6292. res.right -= edges.paddingRight;
  6293. res.top += edges.paddingTop;
  6294. res.bottom -= edges.paddingBottom;
  6295. }
  6296. return res;
  6297. }
  6298. function computeRect(el) {
  6299. var rect = el.getBoundingClientRect();
  6300. return {
  6301. left: rect.left + window.pageXOffset,
  6302. top: rect.top + window.pageYOffset,
  6303. right: rect.right + window.pageXOffset,
  6304. bottom: rect.bottom + window.pageYOffset
  6305. };
  6306. }
  6307. function computeViewportRect() {
  6308. return {
  6309. left: window.pageXOffset,
  6310. right: window.pageXOffset + document.documentElement.clientWidth,
  6311. top: window.pageYOffset,
  6312. bottom: window.pageYOffset + document.documentElement.clientHeight
  6313. };
  6314. }
  6315. function computeHeightAndMargins(el) {
  6316. return el.getBoundingClientRect().height + computeVMargins(el);
  6317. }
  6318. function computeVMargins(el) {
  6319. var computed = window.getComputedStyle(el);
  6320. return parseInt(computed.marginTop, 10) +
  6321. parseInt(computed.marginBottom, 10);
  6322. }
  6323. // does not return window
  6324. function getClippingParents(el) {
  6325. var parents = [];
  6326. while (el instanceof HTMLElement) { // will stop when gets to document or null
  6327. var computedStyle = window.getComputedStyle(el);
  6328. if (computedStyle.position === 'fixed') {
  6329. break;
  6330. }
  6331. if ((/(auto|scroll)/).test(computedStyle.overflow + computedStyle.overflowY + computedStyle.overflowX)) {
  6332. parents.push(el);
  6333. }
  6334. el = el.parentNode;
  6335. }
  6336. return parents;
  6337. }
  6338. function computeClippingRect(el) {
  6339. return getClippingParents(el)
  6340. .map(function (el) {
  6341. return computeInnerRect(el);
  6342. })
  6343. .concat(computeViewportRect())
  6344. .reduce(function (rect0, rect1) {
  6345. return intersectRects(rect0, rect1) || rect1; // should always intersect
  6346. });
  6347. }
  6348. // Stops a mouse/touch event from doing it's native browser action
  6349. function preventDefault(ev) {
  6350. ev.preventDefault();
  6351. }
  6352. // Event Delegation
  6353. // ----------------------------------------------------------------------------------------------------------------
  6354. function listenBySelector(container, eventType, selector, handler) {
  6355. function realHandler(ev) {
  6356. var matchedChild = elementClosest(ev.target, selector);
  6357. if (matchedChild) {
  6358. handler.call(matchedChild, ev, matchedChild);
  6359. }
  6360. }
  6361. container.addEventListener(eventType, realHandler);
  6362. return function () {
  6363. container.removeEventListener(eventType, realHandler);
  6364. };
  6365. }
  6366. function listenToHoverBySelector(container, selector, onMouseEnter, onMouseLeave) {
  6367. var currentMatchedChild;
  6368. return listenBySelector(container, 'mouseover', selector, function (ev, matchedChild) {
  6369. if (matchedChild !== currentMatchedChild) {
  6370. currentMatchedChild = matchedChild;
  6371. onMouseEnter(ev, matchedChild);
  6372. var realOnMouseLeave_1 = function (ev) {
  6373. currentMatchedChild = null;
  6374. onMouseLeave(ev, matchedChild);
  6375. matchedChild.removeEventListener('mouseleave', realOnMouseLeave_1);
  6376. };
  6377. // listen to the next mouseleave, and then unattach
  6378. matchedChild.addEventListener('mouseleave', realOnMouseLeave_1);
  6379. }
  6380. });
  6381. }
  6382. // Animation
  6383. // ----------------------------------------------------------------------------------------------------------------
  6384. var transitionEventNames = [
  6385. 'webkitTransitionEnd',
  6386. 'otransitionend',
  6387. 'oTransitionEnd',
  6388. 'msTransitionEnd',
  6389. 'transitionend'
  6390. ];
  6391. // triggered only when the next single subsequent transition finishes
  6392. function whenTransitionDone(el, callback) {
  6393. var realCallback = function (ev) {
  6394. callback(ev);
  6395. transitionEventNames.forEach(function (eventName) {
  6396. el.removeEventListener(eventName, realCallback);
  6397. });
  6398. };
  6399. transitionEventNames.forEach(function (eventName) {
  6400. el.addEventListener(eventName, realCallback); // cross-browser way to determine when the transition finishes
  6401. });
  6402. }
  6403. var DAY_IDS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
  6404. // Adding
  6405. function addWeeks(m, n) {
  6406. var a = dateToUtcArray(m);
  6407. a[2] += n * 7;
  6408. return arrayToUtcDate(a);
  6409. }
  6410. function addDays(m, n) {
  6411. var a = dateToUtcArray(m);
  6412. a[2] += n;
  6413. return arrayToUtcDate(a);
  6414. }
  6415. function addMs(m, n) {
  6416. var a = dateToUtcArray(m);
  6417. a[6] += n;
  6418. return arrayToUtcDate(a);
  6419. }
  6420. // Diffing (all return floats)
  6421. function diffWeeks(m0, m1) {
  6422. return diffDays(m0, m1) / 7;
  6423. }
  6424. function diffDays(m0, m1) {
  6425. return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60 * 24);
  6426. }
  6427. function diffHours(m0, m1) {
  6428. return (m1.valueOf() - m0.valueOf()) / (1000 * 60 * 60);
  6429. }
  6430. function diffMinutes(m0, m1) {
  6431. return (m1.valueOf() - m0.valueOf()) / (1000 * 60);
  6432. }
  6433. function diffSeconds(m0, m1) {
  6434. return (m1.valueOf() - m0.valueOf()) / 1000;
  6435. }
  6436. function diffDayAndTime(m0, m1) {
  6437. var m0day = startOfDay(m0);
  6438. var m1day = startOfDay(m1);
  6439. return {
  6440. years: 0,
  6441. months: 0,
  6442. days: Math.round(diffDays(m0day, m1day)),
  6443. milliseconds: (m1.valueOf() - m1day.valueOf()) - (m0.valueOf() - m0day.valueOf())
  6444. };
  6445. }
  6446. // Diffing Whole Units
  6447. function diffWholeWeeks(m0, m1) {
  6448. var d = diffWholeDays(m0, m1);
  6449. if (d !== null && d % 7 === 0) {
  6450. return d / 7;
  6451. }
  6452. return null;
  6453. }
  6454. function diffWholeDays(m0, m1) {
  6455. if (timeAsMs(m0) === timeAsMs(m1)) {
  6456. return Math.round(diffDays(m0, m1));
  6457. }
  6458. return null;
  6459. }
  6460. // Start-Of
  6461. function startOfDay(m) {
  6462. return arrayToUtcDate([
  6463. m.getUTCFullYear(),
  6464. m.getUTCMonth(),
  6465. m.getUTCDate()
  6466. ]);
  6467. }
  6468. function startOfHour(m) {
  6469. return arrayToUtcDate([
  6470. m.getUTCFullYear(),
  6471. m.getUTCMonth(),
  6472. m.getUTCDate(),
  6473. m.getUTCHours()
  6474. ]);
  6475. }
  6476. function startOfMinute(m) {
  6477. return arrayToUtcDate([
  6478. m.getUTCFullYear(),
  6479. m.getUTCMonth(),
  6480. m.getUTCDate(),
  6481. m.getUTCHours(),
  6482. m.getUTCMinutes()
  6483. ]);
  6484. }
  6485. function startOfSecond(m) {
  6486. return arrayToUtcDate([
  6487. m.getUTCFullYear(),
  6488. m.getUTCMonth(),
  6489. m.getUTCDate(),
  6490. m.getUTCHours(),
  6491. m.getUTCMinutes(),
  6492. m.getUTCSeconds()
  6493. ]);
  6494. }
  6495. // Week Computation
  6496. function weekOfYear(marker, dow, doy) {
  6497. var y = marker.getUTCFullYear();
  6498. var w = weekOfGivenYear(marker, y, dow, doy);
  6499. if (w < 1) {
  6500. return weekOfGivenYear(marker, y - 1, dow, doy);
  6501. }
  6502. var nextW = weekOfGivenYear(marker, y + 1, dow, doy);
  6503. if (nextW >= 1) {
  6504. return Math.min(w, nextW);
  6505. }
  6506. return w;
  6507. }
  6508. function weekOfGivenYear(marker, year, dow, doy) {
  6509. var firstWeekStart = arrayToUtcDate([year, 0, 1 + firstWeekOffset(year, dow, doy)]);
  6510. var dayStart = startOfDay(marker);
  6511. var days = Math.round(diffDays(firstWeekStart, dayStart));
  6512. return Math.floor(days / 7) + 1; // zero-indexed
  6513. }
  6514. // start-of-first-week - start-of-year
  6515. function firstWeekOffset(year, dow, doy) {
  6516. // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  6517. var fwd = 7 + dow - doy;
  6518. // first-week day local weekday -- which local weekday is fwd
  6519. var fwdlw = (7 + arrayToUtcDate([year, 0, fwd]).getUTCDay() - dow) % 7;
  6520. return -fwdlw + fwd - 1;
  6521. }
  6522. // Array Conversion
  6523. function dateToLocalArray(date) {
  6524. return [
  6525. date.getFullYear(),
  6526. date.getMonth(),
  6527. date.getDate(),
  6528. date.getHours(),
  6529. date.getMinutes(),
  6530. date.getSeconds(),
  6531. date.getMilliseconds()
  6532. ];
  6533. }
  6534. function arrayToLocalDate(a) {
  6535. return new Date(a[0], a[1] || 0, a[2] == null ? 1 : a[2], // day of month
  6536. a[3] || 0, a[4] || 0, a[5] || 0);
  6537. }
  6538. function dateToUtcArray(date) {
  6539. return [
  6540. date.getUTCFullYear(),
  6541. date.getUTCMonth(),
  6542. date.getUTCDate(),
  6543. date.getUTCHours(),
  6544. date.getUTCMinutes(),
  6545. date.getUTCSeconds(),
  6546. date.getUTCMilliseconds()
  6547. ];
  6548. }
  6549. function arrayToUtcDate(a) {
  6550. // according to web standards (and Safari), a month index is required.
  6551. // massage if only given a year.
  6552. if (a.length === 1) {
  6553. a = a.concat([0]);
  6554. }
  6555. return new Date(Date.UTC.apply(Date, a));
  6556. }
  6557. // Other Utils
  6558. function isValidDate(m) {
  6559. return !isNaN(m.valueOf());
  6560. }
  6561. function timeAsMs(m) {
  6562. return m.getUTCHours() * 1000 * 60 * 60 +
  6563. m.getUTCMinutes() * 1000 * 60 +
  6564. m.getUTCSeconds() * 1000 +
  6565. m.getUTCMilliseconds();
  6566. }
  6567. var INTERNAL_UNITS = ['years', 'months', 'days', 'milliseconds'];
  6568. var PARSE_RE = /^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;
  6569. // Parsing and Creation
  6570. function createDuration(input, unit) {
  6571. var _a;
  6572. if (typeof input === 'string') {
  6573. return parseString(input);
  6574. }
  6575. else if (typeof input === 'object' && input) { // non-null object
  6576. return normalizeObject(input);
  6577. }
  6578. else if (typeof input === 'number') {
  6579. return normalizeObject((_a = {}, _a[unit || 'milliseconds'] = input, _a));
  6580. }
  6581. else {
  6582. return null;
  6583. }
  6584. }
  6585. function parseString(s) {
  6586. var m = PARSE_RE.exec(s);
  6587. if (m) {
  6588. var sign = m[1] ? -1 : 1;
  6589. return {
  6590. years: 0,
  6591. months: 0,
  6592. days: sign * (m[2] ? parseInt(m[2], 10) : 0),
  6593. milliseconds: sign * ((m[3] ? parseInt(m[3], 10) : 0) * 60 * 60 * 1000 + // hours
  6594. (m[4] ? parseInt(m[4], 10) : 0) * 60 * 1000 + // minutes
  6595. (m[5] ? parseInt(m[5], 10) : 0) * 1000 + // seconds
  6596. (m[6] ? parseInt(m[6], 10) : 0) // ms
  6597. )
  6598. };
  6599. }
  6600. return null;
  6601. }
  6602. function normalizeObject(obj) {
  6603. return {
  6604. years: obj.years || obj.year || 0,
  6605. months: obj.months || obj.month || 0,
  6606. days: (obj.days || obj.day || 0) +
  6607. getWeeksFromInput(obj) * 7,
  6608. milliseconds: (obj.hours || obj.hour || 0) * 60 * 60 * 1000 + // hours
  6609. (obj.minutes || obj.minute || 0) * 60 * 1000 + // minutes
  6610. (obj.seconds || obj.second || 0) * 1000 + // seconds
  6611. (obj.milliseconds || obj.millisecond || obj.ms || 0) // ms
  6612. };
  6613. }
  6614. function getWeeksFromInput(obj) {
  6615. return obj.weeks || obj.week || 0;
  6616. }
  6617. // Equality
  6618. function durationsEqual(d0, d1) {
  6619. return d0.years === d1.years &&
  6620. d0.months === d1.months &&
  6621. d0.days === d1.days &&
  6622. d0.milliseconds === d1.milliseconds;
  6623. }
  6624. function isSingleDay(dur) {
  6625. return dur.years === 0 && dur.months === 0 && dur.days === 1 && dur.milliseconds === 0;
  6626. }
  6627. // Simple Math
  6628. function addDurations(d0, d1) {
  6629. return {
  6630. years: d0.years + d1.years,
  6631. months: d0.months + d1.months,
  6632. days: d0.days + d1.days,
  6633. milliseconds: d0.milliseconds + d1.milliseconds
  6634. };
  6635. }
  6636. function subtractDurations(d1, d0) {
  6637. return {
  6638. years: d1.years - d0.years,
  6639. months: d1.months - d0.months,
  6640. days: d1.days - d0.days,
  6641. milliseconds: d1.milliseconds - d0.milliseconds
  6642. };
  6643. }
  6644. function multiplyDuration(d, n) {
  6645. return {
  6646. years: d.years * n,
  6647. months: d.months * n,
  6648. days: d.days * n,
  6649. milliseconds: d.milliseconds * n
  6650. };
  6651. }
  6652. // Conversions
  6653. // "Rough" because they are based on average-case Gregorian months/years
  6654. function asRoughYears(dur) {
  6655. return asRoughDays(dur) / 365;
  6656. }
  6657. function asRoughMonths(dur) {
  6658. return asRoughDays(dur) / 30;
  6659. }
  6660. function asRoughDays(dur) {
  6661. return asRoughMs(dur) / 864e5;
  6662. }
  6663. function asRoughMinutes(dur) {
  6664. return asRoughMs(dur) / (1000 * 60);
  6665. }
  6666. function asRoughSeconds(dur) {
  6667. return asRoughMs(dur) / 1000;
  6668. }
  6669. function asRoughMs(dur) {
  6670. return dur.years * (365 * 864e5) +
  6671. dur.months * (30 * 864e5) +
  6672. dur.days * 864e5 +
  6673. dur.milliseconds;
  6674. }
  6675. // Advanced Math
  6676. function wholeDivideDurations(numerator, denominator) {
  6677. var res = null;
  6678. for (var i = 0; i < INTERNAL_UNITS.length; i++) {
  6679. var unit = INTERNAL_UNITS[i];
  6680. if (denominator[unit]) {
  6681. var localRes = numerator[unit] / denominator[unit];
  6682. if (!isInt(localRes) || (res !== null && res !== localRes)) {
  6683. return null;
  6684. }
  6685. res = localRes;
  6686. }
  6687. else if (numerator[unit]) {
  6688. // needs to divide by something but can't!
  6689. return null;
  6690. }
  6691. }
  6692. return res;
  6693. }
  6694. function greatestDurationDenominator(dur, dontReturnWeeks) {
  6695. var ms = dur.milliseconds;
  6696. if (ms) {
  6697. if (ms % 1000 !== 0) {
  6698. return { unit: 'millisecond', value: ms };
  6699. }
  6700. if (ms % (1000 * 60) !== 0) {
  6701. return { unit: 'second', value: ms / 1000 };
  6702. }
  6703. if (ms % (1000 * 60 * 60) !== 0) {
  6704. return { unit: 'minute', value: ms / (1000 * 60) };
  6705. }
  6706. if (ms) {
  6707. return { unit: 'hour', value: ms / (1000 * 60 * 60) };
  6708. }
  6709. }
  6710. if (dur.days) {
  6711. if (!dontReturnWeeks && dur.days % 7 === 0) {
  6712. return { unit: 'week', value: dur.days / 7 };
  6713. }
  6714. return { unit: 'day', value: dur.days };
  6715. }
  6716. if (dur.months) {
  6717. return { unit: 'month', value: dur.months };
  6718. }
  6719. if (dur.years) {
  6720. return { unit: 'year', value: dur.years };
  6721. }
  6722. return { unit: 'millisecond', value: 0 };
  6723. }
  6724. /* FullCalendar-specific DOM Utilities
  6725. ----------------------------------------------------------------------------------------------------------------------*/
  6726. // Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left
  6727. // and right space that was offset by the scrollbars. A 1-pixel border first, then margin beyond that.
  6728. function compensateScroll(rowEl, scrollbarWidths) {
  6729. if (scrollbarWidths.left) {
  6730. applyStyle(rowEl, {
  6731. borderLeftWidth: 1,
  6732. marginLeft: scrollbarWidths.left - 1
  6733. });
  6734. }
  6735. if (scrollbarWidths.right) {
  6736. applyStyle(rowEl, {
  6737. borderRightWidth: 1,
  6738. marginRight: scrollbarWidths.right - 1
  6739. });
  6740. }
  6741. }
  6742. // Undoes compensateScroll and restores all borders/margins
  6743. function uncompensateScroll(rowEl) {
  6744. applyStyle(rowEl, {
  6745. marginLeft: '',
  6746. marginRight: '',
  6747. borderLeftWidth: '',
  6748. borderRightWidth: ''
  6749. });
  6750. }
  6751. // Make the mouse cursor express that an event is not allowed in the current area
  6752. function disableCursor() {
  6753. document.body.classList.add('fc-not-allowed');
  6754. }
  6755. // Returns the mouse cursor to its original look
  6756. function enableCursor() {
  6757. document.body.classList.remove('fc-not-allowed');
  6758. }
  6759. // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate.
  6760. // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering
  6761. // any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and
  6762. // reduces the available height.
  6763. function distributeHeight(els, availableHeight, shouldRedistribute) {
  6764. // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions,
  6765. // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars.
  6766. var minOffset1 = Math.floor(availableHeight / els.length); // for non-last element
  6767. var minOffset2 = Math.floor(availableHeight - minOffset1 * (els.length - 1)); // for last element *FLOORING NOTE*
  6768. var flexEls = []; // elements that are allowed to expand. array of DOM nodes
  6769. var flexOffsets = []; // amount of vertical space it takes up
  6770. var flexHeights = []; // actual css height
  6771. var usedHeight = 0;
  6772. undistributeHeight(els); // give all elements their natural height
  6773. // find elements that are below the recommended height (expandable).
  6774. // important to query for heights in a single first pass (to avoid reflow oscillation).
  6775. els.forEach(function (el, i) {
  6776. var minOffset = i === els.length - 1 ? minOffset2 : minOffset1;
  6777. var naturalHeight = el.getBoundingClientRect().height;
  6778. var naturalOffset = naturalHeight + computeVMargins(el);
  6779. if (naturalOffset < minOffset) {
  6780. flexEls.push(el);
  6781. flexOffsets.push(naturalOffset);
  6782. flexHeights.push(naturalHeight);
  6783. }
  6784. else {
  6785. // this element stretches past recommended height (non-expandable). mark the space as occupied.
  6786. usedHeight += naturalOffset;
  6787. }
  6788. });
  6789. // readjust the recommended height to only consider the height available to non-maxed-out rows.
  6790. if (shouldRedistribute) {
  6791. availableHeight -= usedHeight;
  6792. minOffset1 = Math.floor(availableHeight / flexEls.length);
  6793. minOffset2 = Math.floor(availableHeight - minOffset1 * (flexEls.length - 1)); // *FLOORING NOTE*
  6794. }
  6795. // assign heights to all expandable elements
  6796. flexEls.forEach(function (el, i) {
  6797. var minOffset = i === flexEls.length - 1 ? minOffset2 : minOffset1;
  6798. var naturalOffset = flexOffsets[i];
  6799. var naturalHeight = flexHeights[i];
  6800. var newHeight = minOffset - (naturalOffset - naturalHeight); // subtract the margin/padding
  6801. if (naturalOffset < minOffset) { // we check this again because redistribution might have changed things
  6802. el.style.height = newHeight + 'px';
  6803. }
  6804. });
  6805. }
  6806. // Undoes distrubuteHeight, restoring all els to their natural height
  6807. function undistributeHeight(els) {
  6808. els.forEach(function (el) {
  6809. el.style.height = '';
  6810. });
  6811. }
  6812. // Given `els`, a set of <td> cells, find the cell with the largest natural width and set the widths of all the
  6813. // cells to be that width.
  6814. // PREREQUISITE: if you want a cell to take up width, it needs to have a single inner element w/ display:inline
  6815. function matchCellWidths(els) {
  6816. var maxInnerWidth = 0;
  6817. els.forEach(function (el) {
  6818. var innerEl = el.firstChild; // hopefully an element
  6819. if (innerEl instanceof HTMLElement) {
  6820. var innerWidth_1 = innerEl.getBoundingClientRect().width;
  6821. if (innerWidth_1 > maxInnerWidth) {
  6822. maxInnerWidth = innerWidth_1;
  6823. }
  6824. }
  6825. });
  6826. maxInnerWidth++; // sometimes not accurate of width the text needs to stay on one line. insurance
  6827. els.forEach(function (el) {
  6828. el.style.width = maxInnerWidth + 'px';
  6829. });
  6830. return maxInnerWidth;
  6831. }
  6832. // Given one element that resides inside another,
  6833. // Subtracts the height of the inner element from the outer element.
  6834. function subtractInnerElHeight(outerEl, innerEl) {
  6835. // effin' IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked
  6836. var reflowStyleProps = {
  6837. position: 'relative',
  6838. left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll
  6839. };
  6840. applyStyle(outerEl, reflowStyleProps);
  6841. applyStyle(innerEl, reflowStyleProps);
  6842. var diff = // grab the dimensions
  6843. outerEl.getBoundingClientRect().height -
  6844. innerEl.getBoundingClientRect().height;
  6845. // undo hack
  6846. var resetStyleProps = { position: '', left: '' };
  6847. applyStyle(outerEl, resetStyleProps);
  6848. applyStyle(innerEl, resetStyleProps);
  6849. return diff;
  6850. }
  6851. /* Selection
  6852. ----------------------------------------------------------------------------------------------------------------------*/
  6853. function preventSelection(el) {
  6854. el.classList.add('fc-unselectable');
  6855. el.addEventListener('selectstart', preventDefault);
  6856. }
  6857. function allowSelection(el) {
  6858. el.classList.remove('fc-unselectable');
  6859. el.removeEventListener('selectstart', preventDefault);
  6860. }
  6861. /* Context Menu
  6862. ----------------------------------------------------------------------------------------------------------------------*/
  6863. function preventContextMenu(el) {
  6864. el.addEventListener('contextmenu', preventDefault);
  6865. }
  6866. function allowContextMenu(el) {
  6867. el.removeEventListener('contextmenu', preventDefault);
  6868. }
  6869. /* Object Ordering by Field
  6870. ----------------------------------------------------------------------------------------------------------------------*/
  6871. function parseFieldSpecs(input) {
  6872. var specs = [];
  6873. var tokens = [];
  6874. var i;
  6875. var token;
  6876. if (typeof input === 'string') {
  6877. tokens = input.split(/\s*,\s*/);
  6878. }
  6879. else if (typeof input === 'function') {
  6880. tokens = [input];
  6881. }
  6882. else if (Array.isArray(input)) {
  6883. tokens = input;
  6884. }
  6885. for (i = 0; i < tokens.length; i++) {
  6886. token = tokens[i];
  6887. if (typeof token === 'string') {
  6888. specs.push(token.charAt(0) === '-' ?
  6889. { field: token.substring(1), order: -1 } :
  6890. { field: token, order: 1 });
  6891. }
  6892. else if (typeof token === 'function') {
  6893. specs.push({ func: token });
  6894. }
  6895. }
  6896. return specs;
  6897. }
  6898. function compareByFieldSpecs(obj0, obj1, fieldSpecs) {
  6899. var i;
  6900. var cmp;
  6901. for (i = 0; i < fieldSpecs.length; i++) {
  6902. cmp = compareByFieldSpec(obj0, obj1, fieldSpecs[i]);
  6903. if (cmp) {
  6904. return cmp;
  6905. }
  6906. }
  6907. return 0;
  6908. }
  6909. function compareByFieldSpec(obj0, obj1, fieldSpec) {
  6910. if (fieldSpec.func) {
  6911. return fieldSpec.func(obj0, obj1);
  6912. }
  6913. return flexibleCompare(obj0[fieldSpec.field], obj1[fieldSpec.field])
  6914. * (fieldSpec.order || 1);
  6915. }
  6916. function flexibleCompare(a, b) {
  6917. if (!a && !b) {
  6918. return 0;
  6919. }
  6920. if (b == null) {
  6921. return -1;
  6922. }
  6923. if (a == null) {
  6924. return 1;
  6925. }
  6926. if (typeof a === 'string' || typeof b === 'string') {
  6927. return String(a).localeCompare(String(b));
  6928. }
  6929. return a - b;
  6930. }
  6931. /* String Utilities
  6932. ----------------------------------------------------------------------------------------------------------------------*/
  6933. function capitaliseFirstLetter(str) {
  6934. return str.charAt(0).toUpperCase() + str.slice(1);
  6935. }
  6936. function padStart(val, len) {
  6937. var s = String(val);
  6938. return '000'.substr(0, len - s.length) + s;
  6939. }
  6940. /* Number Utilities
  6941. ----------------------------------------------------------------------------------------------------------------------*/
  6942. function compareNumbers(a, b) {
  6943. return a - b;
  6944. }
  6945. function isInt(n) {
  6946. return n % 1 === 0;
  6947. }
  6948. /* Weird Utilities
  6949. ----------------------------------------------------------------------------------------------------------------------*/
  6950. function applyAll(functions, thisObj, args) {
  6951. if (typeof functions === 'function') { // supplied a single function
  6952. functions = [functions];
  6953. }
  6954. if (functions) {
  6955. var i = void 0;
  6956. var ret = void 0;
  6957. for (i = 0; i < functions.length; i++) {
  6958. ret = functions[i].apply(thisObj, args) || ret;
  6959. }
  6960. return ret;
  6961. }
  6962. }
  6963. function firstDefined() {
  6964. var args = [];
  6965. for (var _i = 0; _i < arguments.length; _i++) {
  6966. args[_i] = arguments[_i];
  6967. }
  6968. for (var i = 0; i < args.length; i++) {
  6969. if (args[i] !== undefined) {
  6970. return args[i];
  6971. }
  6972. }
  6973. }
  6974. // Returns a function, that, as long as it continues to be invoked, will not
  6975. // be triggered. The function will be called after it stops being called for
  6976. // N milliseconds. If `immediate` is passed, trigger the function on the
  6977. // leading edge, instead of the trailing.
  6978. // https://github.com/jashkenas/underscore/blob/1.6.0/underscore.js#L714
  6979. function debounce(func, wait) {
  6980. var timeout;
  6981. var args;
  6982. var context;
  6983. var timestamp;
  6984. var result;
  6985. var later = function () {
  6986. var last = new Date().valueOf() - timestamp;
  6987. if (last < wait) {
  6988. timeout = setTimeout(later, wait - last);
  6989. }
  6990. else {
  6991. timeout = null;
  6992. result = func.apply(context, args);
  6993. context = args = null;
  6994. }
  6995. };
  6996. return function () {
  6997. context = this;
  6998. args = arguments;
  6999. timestamp = new Date().valueOf();
  7000. if (!timeout) {
  7001. timeout = setTimeout(later, wait);
  7002. }
  7003. return result;
  7004. };
  7005. }
  7006. // Number and Boolean are only types that defaults or not computed for
  7007. // TODO: write more comments
  7008. function refineProps(rawProps, processors, defaults, leftoverProps) {
  7009. if (defaults === void 0) { defaults = {}; }
  7010. var refined = {};
  7011. for (var key in processors) {
  7012. var processor = processors[key];
  7013. if (rawProps[key] !== undefined) {
  7014. // found
  7015. if (processor === Function) {
  7016. refined[key] = typeof rawProps[key] === 'function' ? rawProps[key] : null;
  7017. }
  7018. else if (processor) { // a refining function?
  7019. refined[key] = processor(rawProps[key]);
  7020. }
  7021. else {
  7022. refined[key] = rawProps[key];
  7023. }
  7024. }
  7025. else if (defaults[key] !== undefined) {
  7026. // there's an explicit default
  7027. refined[key] = defaults[key];
  7028. }
  7029. else {
  7030. // must compute a default
  7031. if (processor === String) {
  7032. refined[key] = ''; // empty string is default for String
  7033. }
  7034. else if (!processor || processor === Number || processor === Boolean || processor === Function) {
  7035. refined[key] = null; // assign null for other non-custom processor funcs
  7036. }
  7037. else {
  7038. refined[key] = processor(null); // run the custom processor func
  7039. }
  7040. }
  7041. }
  7042. if (leftoverProps) {
  7043. for (var key in rawProps) {
  7044. if (processors[key] === undefined) {
  7045. leftoverProps[key] = rawProps[key];
  7046. }
  7047. }
  7048. }
  7049. return refined;
  7050. }
  7051. /* Date stuff that doesn't belong in datelib core
  7052. ----------------------------------------------------------------------------------------------------------------------*/
  7053. // given a timed range, computes an all-day range that has the same exact duration,
  7054. // but whose start time is aligned with the start of the day.
  7055. function computeAlignedDayRange(timedRange) {
  7056. var dayCnt = Math.floor(diffDays(timedRange.start, timedRange.end)) || 1;
  7057. var start = startOfDay(timedRange.start);
  7058. var end = addDays(start, dayCnt);
  7059. return { start: start, end: end };
  7060. }
  7061. // given a timed range, computes an all-day range based on how for the end date bleeds into the next day
  7062. // TODO: give nextDayThreshold a default arg
  7063. function computeVisibleDayRange(timedRange, nextDayThreshold) {
  7064. if (nextDayThreshold === void 0) { nextDayThreshold = createDuration(0); }
  7065. var startDay = null;
  7066. var endDay = null;
  7067. if (timedRange.end) {
  7068. endDay = startOfDay(timedRange.end);
  7069. var endTimeMS = timedRange.end.valueOf() - endDay.valueOf(); // # of milliseconds into `endDay`
  7070. // If the end time is actually inclusively part of the next day and is equal to or
  7071. // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`.
  7072. // Otherwise, leaving it as inclusive will cause it to exclude `endDay`.
  7073. if (endTimeMS && endTimeMS >= asRoughMs(nextDayThreshold)) {
  7074. endDay = addDays(endDay, 1);
  7075. }
  7076. }
  7077. if (timedRange.start) {
  7078. startDay = startOfDay(timedRange.start); // the beginning of the day the range starts
  7079. // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day.
  7080. if (endDay && endDay <= startDay) {
  7081. endDay = addDays(startDay, 1);
  7082. }
  7083. }
  7084. return { start: startDay, end: endDay };
  7085. }
  7086. // spans from one day into another?
  7087. function isMultiDayRange(range) {
  7088. var visibleRange = computeVisibleDayRange(range);
  7089. return diffDays(visibleRange.start, visibleRange.end) > 1;
  7090. }
  7091. function diffDates(date0, date1, dateEnv, largeUnit) {
  7092. if (largeUnit === 'year') {
  7093. return createDuration(dateEnv.diffWholeYears(date0, date1), 'year');
  7094. }
  7095. else if (largeUnit === 'month') {
  7096. return createDuration(dateEnv.diffWholeMonths(date0, date1), 'month');
  7097. }
  7098. else {
  7099. return diffDayAndTime(date0, date1); // returns a duration
  7100. }
  7101. }
  7102. /*! *****************************************************************************
  7103. Copyright (c) Microsoft Corporation. All rights reserved.
  7104. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  7105. this file except in compliance with the License. You may obtain a copy of the
  7106. License at http://www.apache.org/licenses/LICENSE-2.0
  7107. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  7108. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  7109. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  7110. MERCHANTABLITY OR NON-INFRINGEMENT.
  7111. See the Apache Version 2.0 License for specific language governing permissions
  7112. and limitations under the License.
  7113. ***************************************************************************** */
  7114. /* global Reflect, Promise */
  7115. var extendStatics = function(d, b) {
  7116. extendStatics = Object.setPrototypeOf ||
  7117. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7118. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7119. return extendStatics(d, b);
  7120. };
  7121. function __extends(d, b) {
  7122. extendStatics(d, b);
  7123. function __() { this.constructor = d; }
  7124. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7125. }
  7126. var __assign = function() {
  7127. __assign = Object.assign || function __assign(t) {
  7128. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7129. s = arguments[i];
  7130. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7131. }
  7132. return t;
  7133. };
  7134. return __assign.apply(this, arguments);
  7135. };
  7136. function parseRecurring(eventInput, allDayDefault, dateEnv, recurringTypes, leftovers) {
  7137. for (var i = 0; i < recurringTypes.length; i++) {
  7138. var localLeftovers = {};
  7139. var parsed = recurringTypes[i].parse(eventInput, localLeftovers, dateEnv);
  7140. if (parsed) {
  7141. var allDay = localLeftovers.allDay;
  7142. delete localLeftovers.allDay; // remove from leftovers
  7143. if (allDay == null) {
  7144. allDay = allDayDefault;
  7145. if (allDay == null) {
  7146. allDay = parsed.allDayGuess;
  7147. if (allDay == null) {
  7148. allDay = false;
  7149. }
  7150. }
  7151. }
  7152. __assign(leftovers, localLeftovers);
  7153. return {
  7154. allDay: allDay,
  7155. duration: parsed.duration,
  7156. typeData: parsed.typeData,
  7157. typeId: i
  7158. };
  7159. }
  7160. }
  7161. return null;
  7162. }
  7163. /*
  7164. Event MUST have a recurringDef
  7165. */
  7166. function expandRecurringRanges(eventDef, duration, framingRange, dateEnv, recurringTypes) {
  7167. var typeDef = recurringTypes[eventDef.recurringDef.typeId];
  7168. var markers = typeDef.expand(eventDef.recurringDef.typeData, {
  7169. start: dateEnv.subtract(framingRange.start, duration),
  7170. end: framingRange.end
  7171. }, dateEnv);
  7172. // the recurrence plugins don't guarantee that all-day events are start-of-day, so we have to
  7173. if (eventDef.allDay) {
  7174. markers = markers.map(startOfDay);
  7175. }
  7176. return markers;
  7177. }
  7178. var hasOwnProperty = Object.prototype.hasOwnProperty;
  7179. // Merges an array of objects into a single object.
  7180. // The second argument allows for an array of property names who's object values will be merged together.
  7181. function mergeProps(propObjs, complexProps) {
  7182. var dest = {};
  7183. var i;
  7184. var name;
  7185. var complexObjs;
  7186. var j;
  7187. var val;
  7188. var props;
  7189. if (complexProps) {
  7190. for (i = 0; i < complexProps.length; i++) {
  7191. name = complexProps[i];
  7192. complexObjs = [];
  7193. // collect the trailing object values, stopping when a non-object is discovered
  7194. for (j = propObjs.length - 1; j >= 0; j--) {
  7195. val = propObjs[j][name];
  7196. if (typeof val === 'object' && val) { // non-null object
  7197. complexObjs.unshift(val);
  7198. }
  7199. else if (val !== undefined) {
  7200. dest[name] = val; // if there were no objects, this value will be used
  7201. break;
  7202. }
  7203. }
  7204. // if the trailing values were objects, use the merged value
  7205. if (complexObjs.length) {
  7206. dest[name] = mergeProps(complexObjs);
  7207. }
  7208. }
  7209. }
  7210. // copy values into the destination, going from last to first
  7211. for (i = propObjs.length - 1; i >= 0; i--) {
  7212. props = propObjs[i];
  7213. for (name in props) {
  7214. if (!(name in dest)) { // if already assigned by previous props or complex props, don't reassign
  7215. dest[name] = props[name];
  7216. }
  7217. }
  7218. }
  7219. return dest;
  7220. }
  7221. function filterHash(hash, func) {
  7222. var filtered = {};
  7223. for (var key in hash) {
  7224. if (func(hash[key], key)) {
  7225. filtered[key] = hash[key];
  7226. }
  7227. }
  7228. return filtered;
  7229. }
  7230. function mapHash(hash, func) {
  7231. var newHash = {};
  7232. for (var key in hash) {
  7233. newHash[key] = func(hash[key], key);
  7234. }
  7235. return newHash;
  7236. }
  7237. function arrayToHash(a) {
  7238. var hash = {};
  7239. for (var _i = 0, a_1 = a; _i < a_1.length; _i++) {
  7240. var item = a_1[_i];
  7241. hash[item] = true;
  7242. }
  7243. return hash;
  7244. }
  7245. function hashValuesToArray(obj) {
  7246. var a = [];
  7247. for (var key in obj) {
  7248. a.push(obj[key]);
  7249. }
  7250. return a;
  7251. }
  7252. function isPropsEqual(obj0, obj1) {
  7253. for (var key in obj0) {
  7254. if (hasOwnProperty.call(obj0, key)) {
  7255. if (!(key in obj1)) {
  7256. return false;
  7257. }
  7258. }
  7259. }
  7260. for (var key in obj1) {
  7261. if (hasOwnProperty.call(obj1, key)) {
  7262. if (obj0[key] !== obj1[key]) {
  7263. return false;
  7264. }
  7265. }
  7266. }
  7267. return true;
  7268. }
  7269. function parseEvents(rawEvents, sourceId, calendar, allowOpenRange) {
  7270. var eventStore = createEmptyEventStore();
  7271. for (var _i = 0, rawEvents_1 = rawEvents; _i < rawEvents_1.length; _i++) {
  7272. var rawEvent = rawEvents_1[_i];
  7273. var tuple = parseEvent(rawEvent, sourceId, calendar, allowOpenRange);
  7274. if (tuple) {
  7275. eventTupleToStore(tuple, eventStore);
  7276. }
  7277. }
  7278. return eventStore;
  7279. }
  7280. function eventTupleToStore(tuple, eventStore) {
  7281. if (eventStore === void 0) { eventStore = createEmptyEventStore(); }
  7282. eventStore.defs[tuple.def.defId] = tuple.def;
  7283. if (tuple.instance) {
  7284. eventStore.instances[tuple.instance.instanceId] = tuple.instance;
  7285. }
  7286. return eventStore;
  7287. }
  7288. function expandRecurring(eventStore, framingRange, calendar) {
  7289. var dateEnv = calendar.dateEnv;
  7290. var defs = eventStore.defs, instances = eventStore.instances;
  7291. // remove existing recurring instances
  7292. instances = filterHash(instances, function (instance) {
  7293. return !defs[instance.defId].recurringDef;
  7294. });
  7295. for (var defId in defs) {
  7296. var def = defs[defId];
  7297. if (def.recurringDef) {
  7298. var duration = def.recurringDef.duration;
  7299. if (!duration) {
  7300. duration = def.allDay ?
  7301. calendar.defaultAllDayEventDuration :
  7302. calendar.defaultTimedEventDuration;
  7303. }
  7304. var starts = expandRecurringRanges(def, duration, framingRange, calendar.dateEnv, calendar.pluginSystem.hooks.recurringTypes);
  7305. for (var _i = 0, starts_1 = starts; _i < starts_1.length; _i++) {
  7306. var start = starts_1[_i];
  7307. var instance = createEventInstance(defId, {
  7308. start: start,
  7309. end: dateEnv.add(start, duration)
  7310. });
  7311. instances[instance.instanceId] = instance;
  7312. }
  7313. }
  7314. }
  7315. return { defs: defs, instances: instances };
  7316. }
  7317. // retrieves events that have the same groupId as the instance specified by `instanceId`
  7318. // or they are the same as the instance.
  7319. // why might instanceId not be in the store? an event from another calendar?
  7320. function getRelevantEvents(eventStore, instanceId) {
  7321. var instance = eventStore.instances[instanceId];
  7322. if (instance) {
  7323. var def_1 = eventStore.defs[instance.defId];
  7324. // get events/instances with same group
  7325. var newStore = filterEventStoreDefs(eventStore, function (lookDef) {
  7326. return isEventDefsGrouped(def_1, lookDef);
  7327. });
  7328. // add the original
  7329. // TODO: wish we could use eventTupleToStore or something like it
  7330. newStore.defs[def_1.defId] = def_1;
  7331. newStore.instances[instance.instanceId] = instance;
  7332. return newStore;
  7333. }
  7334. return createEmptyEventStore();
  7335. }
  7336. function isEventDefsGrouped(def0, def1) {
  7337. return Boolean(def0.groupId && def0.groupId === def1.groupId);
  7338. }
  7339. function transformRawEvents(rawEvents, eventSource, calendar) {
  7340. var calEachTransform = calendar.opt('eventDataTransform');
  7341. var sourceEachTransform = eventSource ? eventSource.eventDataTransform : null;
  7342. if (sourceEachTransform) {
  7343. rawEvents = transformEachRawEvent(rawEvents, sourceEachTransform);
  7344. }
  7345. if (calEachTransform) {
  7346. rawEvents = transformEachRawEvent(rawEvents, calEachTransform);
  7347. }
  7348. return rawEvents;
  7349. }
  7350. function transformEachRawEvent(rawEvents, func) {
  7351. var refinedEvents;
  7352. if (!func) {
  7353. refinedEvents = rawEvents;
  7354. }
  7355. else {
  7356. refinedEvents = [];
  7357. for (var _i = 0, rawEvents_2 = rawEvents; _i < rawEvents_2.length; _i++) {
  7358. var rawEvent = rawEvents_2[_i];
  7359. var refinedEvent = func(rawEvent);
  7360. if (refinedEvent) {
  7361. refinedEvents.push(refinedEvent);
  7362. }
  7363. else if (refinedEvent == null) {
  7364. refinedEvents.push(rawEvent);
  7365. } // if a different falsy value, do nothing
  7366. }
  7367. }
  7368. return refinedEvents;
  7369. }
  7370. function createEmptyEventStore() {
  7371. return { defs: {}, instances: {} };
  7372. }
  7373. function mergeEventStores(store0, store1) {
  7374. return {
  7375. defs: __assign({}, store0.defs, store1.defs),
  7376. instances: __assign({}, store0.instances, store1.instances)
  7377. };
  7378. }
  7379. function filterEventStoreDefs(eventStore, filterFunc) {
  7380. var defs = filterHash(eventStore.defs, filterFunc);
  7381. var instances = filterHash(eventStore.instances, function (instance) {
  7382. return defs[instance.defId]; // still exists?
  7383. });
  7384. return { defs: defs, instances: instances };
  7385. }
  7386. function parseRange(input, dateEnv) {
  7387. var start = null;
  7388. var end = null;
  7389. if (input.start) {
  7390. start = dateEnv.createMarker(input.start);
  7391. }
  7392. if (input.end) {
  7393. end = dateEnv.createMarker(input.end);
  7394. }
  7395. if (!start && !end) {
  7396. return null;
  7397. }
  7398. if (start && end && end < start) {
  7399. return null;
  7400. }
  7401. return { start: start, end: end };
  7402. }
  7403. // SIDE-EFFECT: will mutate ranges.
  7404. // Will return a new array result.
  7405. function invertRanges(ranges, constraintRange) {
  7406. var invertedRanges = [];
  7407. var start = constraintRange.start; // the end of the previous range. the start of the new range
  7408. var i;
  7409. var dateRange;
  7410. // ranges need to be in order. required for our date-walking algorithm
  7411. ranges.sort(compareRanges);
  7412. for (i = 0; i < ranges.length; i++) {
  7413. dateRange = ranges[i];
  7414. // add the span of time before the event (if there is any)
  7415. if (dateRange.start > start) { // compare millisecond time (skip any ambig logic)
  7416. invertedRanges.push({ start: start, end: dateRange.start });
  7417. }
  7418. if (dateRange.end > start) {
  7419. start = dateRange.end;
  7420. }
  7421. }
  7422. // add the span of time after the last event (if there is any)
  7423. if (start < constraintRange.end) { // compare millisecond time (skip any ambig logic)
  7424. invertedRanges.push({ start: start, end: constraintRange.end });
  7425. }
  7426. return invertedRanges;
  7427. }
  7428. function compareRanges(range0, range1) {
  7429. return range0.start.valueOf() - range1.start.valueOf(); // earlier ranges go first
  7430. }
  7431. function intersectRanges(range0, range1) {
  7432. var start = range0.start;
  7433. var end = range0.end;
  7434. var newRange = null;
  7435. if (range1.start !== null) {
  7436. if (start === null) {
  7437. start = range1.start;
  7438. }
  7439. else {
  7440. start = new Date(Math.max(start.valueOf(), range1.start.valueOf()));
  7441. }
  7442. }
  7443. if (range1.end != null) {
  7444. if (end === null) {
  7445. end = range1.end;
  7446. }
  7447. else {
  7448. end = new Date(Math.min(end.valueOf(), range1.end.valueOf()));
  7449. }
  7450. }
  7451. if (start === null || end === null || start < end) {
  7452. newRange = { start: start, end: end };
  7453. }
  7454. return newRange;
  7455. }
  7456. function rangesEqual(range0, range1) {
  7457. return (range0.start === null ? null : range0.start.valueOf()) === (range1.start === null ? null : range1.start.valueOf()) &&
  7458. (range0.end === null ? null : range0.end.valueOf()) === (range1.end === null ? null : range1.end.valueOf());
  7459. }
  7460. function rangesIntersect(range0, range1) {
  7461. return (range0.end === null || range1.start === null || range0.end > range1.start) &&
  7462. (range0.start === null || range1.end === null || range0.start < range1.end);
  7463. }
  7464. function rangeContainsRange(outerRange, innerRange) {
  7465. return (outerRange.start === null || (innerRange.start !== null && innerRange.start >= outerRange.start)) &&
  7466. (outerRange.end === null || (innerRange.end !== null && innerRange.end <= outerRange.end));
  7467. }
  7468. function rangeContainsMarker(range, date) {
  7469. return (range.start === null || date >= range.start) &&
  7470. (range.end === null || date < range.end);
  7471. }
  7472. // If the given date is not within the given range, move it inside.
  7473. // (If it's past the end, make it one millisecond before the end).
  7474. function constrainMarkerToRange(date, range) {
  7475. if (range.start != null && date < range.start) {
  7476. return range.start;
  7477. }
  7478. if (range.end != null && date >= range.end) {
  7479. return new Date(range.end.valueOf() - 1);
  7480. }
  7481. return date;
  7482. }
  7483. function removeExact(array, exactVal) {
  7484. var removeCnt = 0;
  7485. var i = 0;
  7486. while (i < array.length) {
  7487. if (array[i] === exactVal) {
  7488. array.splice(i, 1);
  7489. removeCnt++;
  7490. }
  7491. else {
  7492. i++;
  7493. }
  7494. }
  7495. return removeCnt;
  7496. }
  7497. function isArraysEqual(a0, a1) {
  7498. var len = a0.length;
  7499. var i;
  7500. if (len !== a1.length) { // not array? or not same length?
  7501. return false;
  7502. }
  7503. for (i = 0; i < len; i++) {
  7504. if (a0[i] !== a1[i]) {
  7505. return false;
  7506. }
  7507. }
  7508. return true;
  7509. }
  7510. function memoize(workerFunc) {
  7511. var args;
  7512. var res;
  7513. return function () {
  7514. if (!args || !isArraysEqual(args, arguments)) {
  7515. args = arguments;
  7516. res = workerFunc.apply(this, arguments);
  7517. }
  7518. return res;
  7519. };
  7520. }
  7521. /*
  7522. always executes the workerFunc, but if the result is equal to the previous result,
  7523. return the previous result instead.
  7524. */
  7525. function memoizeOutput(workerFunc, equalityFunc) {
  7526. var cachedRes = null;
  7527. return function () {
  7528. var newRes = workerFunc.apply(this, arguments);
  7529. if (cachedRes === null || !(cachedRes === newRes || equalityFunc(cachedRes, newRes))) {
  7530. cachedRes = newRes;
  7531. }
  7532. return cachedRes;
  7533. };
  7534. }
  7535. var EXTENDED_SETTINGS_AND_SEVERITIES = {
  7536. week: 3,
  7537. separator: 0,
  7538. omitZeroMinute: 0,
  7539. meridiem: 0,
  7540. omitCommas: 0
  7541. };
  7542. var STANDARD_DATE_PROP_SEVERITIES = {
  7543. timeZoneName: 7,
  7544. era: 6,
  7545. year: 5,
  7546. month: 4,
  7547. day: 2,
  7548. weekday: 2,
  7549. hour: 1,
  7550. minute: 1,
  7551. second: 1
  7552. };
  7553. var MERIDIEM_RE = /\s*([ap])\.?m\.?/i; // eats up leading spaces too
  7554. var COMMA_RE = /,/g; // we need re for globalness
  7555. var MULTI_SPACE_RE = /\s+/g;
  7556. var LTR_RE = /\u200e/g; // control character
  7557. var UTC_RE = /UTC|GMT/;
  7558. var NativeFormatter = /** @class */ (function () {
  7559. function NativeFormatter(formatSettings) {
  7560. var standardDateProps = {};
  7561. var extendedSettings = {};
  7562. var severity = 0;
  7563. for (var name_1 in formatSettings) {
  7564. if (name_1 in EXTENDED_SETTINGS_AND_SEVERITIES) {
  7565. extendedSettings[name_1] = formatSettings[name_1];
  7566. severity = Math.max(EXTENDED_SETTINGS_AND_SEVERITIES[name_1], severity);
  7567. }
  7568. else {
  7569. standardDateProps[name_1] = formatSettings[name_1];
  7570. if (name_1 in STANDARD_DATE_PROP_SEVERITIES) {
  7571. severity = Math.max(STANDARD_DATE_PROP_SEVERITIES[name_1], severity);
  7572. }
  7573. }
  7574. }
  7575. this.standardDateProps = standardDateProps;
  7576. this.extendedSettings = extendedSettings;
  7577. this.severity = severity;
  7578. this.buildFormattingFunc = memoize(buildFormattingFunc);
  7579. }
  7580. NativeFormatter.prototype.format = function (date, context) {
  7581. return this.buildFormattingFunc(this.standardDateProps, this.extendedSettings, context)(date);
  7582. };
  7583. NativeFormatter.prototype.formatRange = function (start, end, context) {
  7584. var _a = this, standardDateProps = _a.standardDateProps, extendedSettings = _a.extendedSettings;
  7585. var diffSeverity = computeMarkerDiffSeverity(start.marker, end.marker, context.calendarSystem);
  7586. if (!diffSeverity) {
  7587. return this.format(start, context);
  7588. }
  7589. var biggestUnitForPartial = diffSeverity;
  7590. if (biggestUnitForPartial > 1 && // the two dates are different in a way that's larger scale than time
  7591. (standardDateProps.year === 'numeric' || standardDateProps.year === '2-digit') &&
  7592. (standardDateProps.month === 'numeric' || standardDateProps.month === '2-digit') &&
  7593. (standardDateProps.day === 'numeric' || standardDateProps.day === '2-digit')) {
  7594. biggestUnitForPartial = 1; // make it look like the dates are only different in terms of time
  7595. }
  7596. var full0 = this.format(start, context);
  7597. var full1 = this.format(end, context);
  7598. if (full0 === full1) {
  7599. return full0;
  7600. }
  7601. var partialDateProps = computePartialFormattingOptions(standardDateProps, biggestUnitForPartial);
  7602. var partialFormattingFunc = buildFormattingFunc(partialDateProps, extendedSettings, context);
  7603. var partial0 = partialFormattingFunc(start);
  7604. var partial1 = partialFormattingFunc(end);
  7605. var insertion = findCommonInsertion(full0, partial0, full1, partial1);
  7606. var separator = extendedSettings.separator || '';
  7607. if (insertion) {
  7608. return insertion.before + partial0 + separator + partial1 + insertion.after;
  7609. }
  7610. return full0 + separator + full1;
  7611. };
  7612. NativeFormatter.prototype.getLargestUnit = function () {
  7613. switch (this.severity) {
  7614. case 7:
  7615. case 6:
  7616. case 5:
  7617. return 'year';
  7618. case 4:
  7619. return 'month';
  7620. case 3:
  7621. return 'week';
  7622. default:
  7623. return 'day';
  7624. }
  7625. };
  7626. return NativeFormatter;
  7627. }());
  7628. function buildFormattingFunc(standardDateProps, extendedSettings, context) {
  7629. var standardDatePropCnt = Object.keys(standardDateProps).length;
  7630. if (standardDatePropCnt === 1 && standardDateProps.timeZoneName === 'short') {
  7631. return function (date) {
  7632. return formatTimeZoneOffset(date.timeZoneOffset);
  7633. };
  7634. }
  7635. if (standardDatePropCnt === 0 && extendedSettings.week) {
  7636. return function (date) {
  7637. return formatWeekNumber(context.computeWeekNumber(date.marker), context.weekLabel, context.locale, extendedSettings.week);
  7638. };
  7639. }
  7640. return buildNativeFormattingFunc(standardDateProps, extendedSettings, context);
  7641. }
  7642. function buildNativeFormattingFunc(standardDateProps, extendedSettings, context) {
  7643. standardDateProps = __assign({}, standardDateProps); // copy
  7644. extendedSettings = __assign({}, extendedSettings); // copy
  7645. sanitizeSettings(standardDateProps, extendedSettings);
  7646. standardDateProps.timeZone = 'UTC'; // we leverage the only guaranteed timeZone for our UTC markers
  7647. var normalFormat = new Intl.DateTimeFormat(context.locale.codes, standardDateProps);
  7648. var zeroFormat; // needed?
  7649. if (extendedSettings.omitZeroMinute) {
  7650. var zeroProps = __assign({}, standardDateProps);
  7651. delete zeroProps.minute; // seconds and ms were already considered in sanitizeSettings
  7652. zeroFormat = new Intl.DateTimeFormat(context.locale.codes, zeroProps);
  7653. }
  7654. return function (date) {
  7655. var marker = date.marker;
  7656. var format;
  7657. if (zeroFormat && !marker.getUTCMinutes()) {
  7658. format = zeroFormat;
  7659. }
  7660. else {
  7661. format = normalFormat;
  7662. }
  7663. var s = format.format(marker);
  7664. return postProcess(s, date, standardDateProps, extendedSettings, context);
  7665. };
  7666. }
  7667. function sanitizeSettings(standardDateProps, extendedSettings) {
  7668. // deal with a browser inconsistency where formatting the timezone
  7669. // requires that the hour/minute be present.
  7670. if (standardDateProps.timeZoneName) {
  7671. if (!standardDateProps.hour) {
  7672. standardDateProps.hour = '2-digit';
  7673. }
  7674. if (!standardDateProps.minute) {
  7675. standardDateProps.minute = '2-digit';
  7676. }
  7677. }
  7678. // only support short timezone names
  7679. if (standardDateProps.timeZoneName === 'long') {
  7680. standardDateProps.timeZoneName = 'short';
  7681. }
  7682. // if requesting to display seconds, MUST display minutes
  7683. if (extendedSettings.omitZeroMinute && (standardDateProps.second || standardDateProps.millisecond)) {
  7684. delete extendedSettings.omitZeroMinute;
  7685. }
  7686. }
  7687. function postProcess(s, date, standardDateProps, extendedSettings, context) {
  7688. s = s.replace(LTR_RE, ''); // remove left-to-right control chars. do first. good for other regexes
  7689. if (standardDateProps.timeZoneName === 'short') {
  7690. s = injectTzoStr(s, (context.timeZone === 'UTC' || date.timeZoneOffset == null) ?
  7691. 'UTC' : // important to normalize for IE, which does "GMT"
  7692. formatTimeZoneOffset(date.timeZoneOffset));
  7693. }
  7694. if (extendedSettings.omitCommas) {
  7695. s = s.replace(COMMA_RE, '').trim();
  7696. }
  7697. if (extendedSettings.omitZeroMinute) {
  7698. s = s.replace(':00', ''); // zeroFormat doesn't always achieve this
  7699. }
  7700. // ^ do anything that might create adjacent spaces before this point,
  7701. // because MERIDIEM_RE likes to eat up loading spaces
  7702. if (extendedSettings.meridiem === false) {
  7703. s = s.replace(MERIDIEM_RE, '').trim();
  7704. }
  7705. else if (extendedSettings.meridiem === 'narrow') { // a/p
  7706. s = s.replace(MERIDIEM_RE, function (m0, m1) {
  7707. return m1.toLocaleLowerCase();
  7708. });
  7709. }
  7710. else if (extendedSettings.meridiem === 'short') { // am/pm
  7711. s = s.replace(MERIDIEM_RE, function (m0, m1) {
  7712. return m1.toLocaleLowerCase() + 'm';
  7713. });
  7714. }
  7715. else if (extendedSettings.meridiem === 'lowercase') { // other meridiem transformers already converted to lowercase
  7716. s = s.replace(MERIDIEM_RE, function (m0) {
  7717. return m0.toLocaleLowerCase();
  7718. });
  7719. }
  7720. s = s.replace(MULTI_SPACE_RE, ' ');
  7721. s = s.trim();
  7722. return s;
  7723. }
  7724. function injectTzoStr(s, tzoStr) {
  7725. var replaced = false;
  7726. s = s.replace(UTC_RE, function () {
  7727. replaced = true;
  7728. return tzoStr;
  7729. });
  7730. // IE11 doesn't include UTC/GMT in the original string, so append to end
  7731. if (!replaced) {
  7732. s += ' ' + tzoStr;
  7733. }
  7734. return s;
  7735. }
  7736. function formatWeekNumber(num, weekLabel, locale, display) {
  7737. var parts = [];
  7738. if (display === 'narrow') {
  7739. parts.push(weekLabel);
  7740. }
  7741. else if (display === 'short') {
  7742. parts.push(weekLabel, ' ');
  7743. }
  7744. // otherwise, considered 'numeric'
  7745. parts.push(locale.simpleNumberFormat.format(num));
  7746. if (locale.options.isRtl) { // TODO: use control characters instead?
  7747. parts.reverse();
  7748. }
  7749. return parts.join('');
  7750. }
  7751. // Range Formatting Utils
  7752. // 0 = exactly the same
  7753. // 1 = different by time
  7754. // and bigger
  7755. function computeMarkerDiffSeverity(d0, d1, ca) {
  7756. if (ca.getMarkerYear(d0) !== ca.getMarkerYear(d1)) {
  7757. return 5;
  7758. }
  7759. if (ca.getMarkerMonth(d0) !== ca.getMarkerMonth(d1)) {
  7760. return 4;
  7761. }
  7762. if (ca.getMarkerDay(d0) !== ca.getMarkerDay(d1)) {
  7763. return 2;
  7764. }
  7765. if (timeAsMs(d0) !== timeAsMs(d1)) {
  7766. return 1;
  7767. }
  7768. return 0;
  7769. }
  7770. function computePartialFormattingOptions(options, biggestUnit) {
  7771. var partialOptions = {};
  7772. for (var name_2 in options) {
  7773. if (!(name_2 in STANDARD_DATE_PROP_SEVERITIES) || // not a date part prop (like timeZone)
  7774. STANDARD_DATE_PROP_SEVERITIES[name_2] <= biggestUnit) {
  7775. partialOptions[name_2] = options[name_2];
  7776. }
  7777. }
  7778. return partialOptions;
  7779. }
  7780. function findCommonInsertion(full0, partial0, full1, partial1) {
  7781. var i0 = 0;
  7782. while (i0 < full0.length) {
  7783. var found0 = full0.indexOf(partial0, i0);
  7784. if (found0 === -1) {
  7785. break;
  7786. }
  7787. var before0 = full0.substr(0, found0);
  7788. i0 = found0 + partial0.length;
  7789. var after0 = full0.substr(i0);
  7790. var i1 = 0;
  7791. while (i1 < full1.length) {
  7792. var found1 = full1.indexOf(partial1, i1);
  7793. if (found1 === -1) {
  7794. break;
  7795. }
  7796. var before1 = full1.substr(0, found1);
  7797. i1 = found1 + partial1.length;
  7798. var after1 = full1.substr(i1);
  7799. if (before0 === before1 && after0 === after1) {
  7800. return {
  7801. before: before0,
  7802. after: after0
  7803. };
  7804. }
  7805. }
  7806. }
  7807. return null;
  7808. }
  7809. /*
  7810. TODO: fix the terminology of "formatter" vs "formatting func"
  7811. */
  7812. /*
  7813. At the time of instantiation, this object does not know which cmd-formatting system it will use.
  7814. It receives this at the time of formatting, as a setting.
  7815. */
  7816. var CmdFormatter = /** @class */ (function () {
  7817. function CmdFormatter(cmdStr, separator) {
  7818. this.cmdStr = cmdStr;
  7819. this.separator = separator;
  7820. }
  7821. CmdFormatter.prototype.format = function (date, context) {
  7822. return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(date, null, context, this.separator));
  7823. };
  7824. CmdFormatter.prototype.formatRange = function (start, end, context) {
  7825. return context.cmdFormatter(this.cmdStr, createVerboseFormattingArg(start, end, context, this.separator));
  7826. };
  7827. return CmdFormatter;
  7828. }());
  7829. var FuncFormatter = /** @class */ (function () {
  7830. function FuncFormatter(func) {
  7831. this.func = func;
  7832. }
  7833. FuncFormatter.prototype.format = function (date, context) {
  7834. return this.func(createVerboseFormattingArg(date, null, context));
  7835. };
  7836. FuncFormatter.prototype.formatRange = function (start, end, context) {
  7837. return this.func(createVerboseFormattingArg(start, end, context));
  7838. };
  7839. return FuncFormatter;
  7840. }());
  7841. // Formatter Object Creation
  7842. function createFormatter(input, defaultSeparator) {
  7843. if (typeof input === 'object' && input) { // non-null object
  7844. if (typeof defaultSeparator === 'string') {
  7845. input = __assign({ separator: defaultSeparator }, input);
  7846. }
  7847. return new NativeFormatter(input);
  7848. }
  7849. else if (typeof input === 'string') {
  7850. return new CmdFormatter(input, defaultSeparator);
  7851. }
  7852. else if (typeof input === 'function') {
  7853. return new FuncFormatter(input);
  7854. }
  7855. }
  7856. // String Utils
  7857. // timeZoneOffset is in minutes
  7858. function buildIsoString(marker, timeZoneOffset, stripZeroTime) {
  7859. if (stripZeroTime === void 0) { stripZeroTime = false; }
  7860. var s = marker.toISOString();
  7861. s = s.replace('.000', '');
  7862. if (stripZeroTime) {
  7863. s = s.replace('T00:00:00Z', '');
  7864. }
  7865. if (s.length > 10) { // time part wasn't stripped, can add timezone info
  7866. if (timeZoneOffset == null) {
  7867. s = s.replace('Z', '');
  7868. }
  7869. else if (timeZoneOffset !== 0) {
  7870. s = s.replace('Z', formatTimeZoneOffset(timeZoneOffset, true));
  7871. }
  7872. // otherwise, its UTC-0 and we want to keep the Z
  7873. }
  7874. return s;
  7875. }
  7876. function formatIsoTimeString(marker) {
  7877. return padStart(marker.getUTCHours(), 2) + ':' +
  7878. padStart(marker.getUTCMinutes(), 2) + ':' +
  7879. padStart(marker.getUTCSeconds(), 2);
  7880. }
  7881. function formatTimeZoneOffset(minutes, doIso) {
  7882. if (doIso === void 0) { doIso = false; }
  7883. var sign = minutes < 0 ? '-' : '+';
  7884. var abs = Math.abs(minutes);
  7885. var hours = Math.floor(abs / 60);
  7886. var mins = Math.round(abs % 60);
  7887. if (doIso) {
  7888. return sign + padStart(hours, 2) + ':' + padStart(mins, 2);
  7889. }
  7890. else {
  7891. return 'GMT' + sign + hours + (mins ? ':' + padStart(mins, 2) : '');
  7892. }
  7893. }
  7894. // Arg Utils
  7895. function createVerboseFormattingArg(start, end, context, separator) {
  7896. var startInfo = expandZonedMarker(start, context.calendarSystem);
  7897. var endInfo = end ? expandZonedMarker(end, context.calendarSystem) : null;
  7898. return {
  7899. date: startInfo,
  7900. start: startInfo,
  7901. end: endInfo,
  7902. timeZone: context.timeZone,
  7903. localeCodes: context.locale.codes,
  7904. separator: separator
  7905. };
  7906. }
  7907. function expandZonedMarker(dateInfo, calendarSystem) {
  7908. var a = calendarSystem.markerToArray(dateInfo.marker);
  7909. return {
  7910. marker: dateInfo.marker,
  7911. timeZoneOffset: dateInfo.timeZoneOffset,
  7912. array: a,
  7913. year: a[0],
  7914. month: a[1],
  7915. day: a[2],
  7916. hour: a[3],
  7917. minute: a[4],
  7918. second: a[5],
  7919. millisecond: a[6]
  7920. };
  7921. }
  7922. var EventSourceApi = /** @class */ (function () {
  7923. function EventSourceApi(calendar, internalEventSource) {
  7924. this.calendar = calendar;
  7925. this.internalEventSource = internalEventSource;
  7926. }
  7927. EventSourceApi.prototype.remove = function () {
  7928. this.calendar.dispatch({
  7929. type: 'REMOVE_EVENT_SOURCE',
  7930. sourceId: this.internalEventSource.sourceId
  7931. });
  7932. };
  7933. EventSourceApi.prototype.refetch = function () {
  7934. this.calendar.dispatch({
  7935. type: 'FETCH_EVENT_SOURCES',
  7936. sourceIds: [this.internalEventSource.sourceId]
  7937. });
  7938. };
  7939. Object.defineProperty(EventSourceApi.prototype, "id", {
  7940. get: function () {
  7941. return this.internalEventSource.publicId;
  7942. },
  7943. enumerable: true,
  7944. configurable: true
  7945. });
  7946. Object.defineProperty(EventSourceApi.prototype, "url", {
  7947. // only relevant to json-feed event sources
  7948. get: function () {
  7949. return this.internalEventSource.meta.url;
  7950. },
  7951. enumerable: true,
  7952. configurable: true
  7953. });
  7954. return EventSourceApi;
  7955. }());
  7956. var EventApi = /** @class */ (function () {
  7957. function EventApi(calendar, def, instance) {
  7958. this._calendar = calendar;
  7959. this._def = def;
  7960. this._instance = instance || null;
  7961. }
  7962. /*
  7963. TODO: make event struct more responsible for this
  7964. */
  7965. EventApi.prototype.setProp = function (name, val) {
  7966. var _a, _b;
  7967. if (name in DATE_PROPS) ;
  7968. else if (name in NON_DATE_PROPS) {
  7969. if (typeof NON_DATE_PROPS[name] === 'function') {
  7970. val = NON_DATE_PROPS[name](val);
  7971. }
  7972. this.mutate({
  7973. standardProps: (_a = {}, _a[name] = val, _a)
  7974. });
  7975. }
  7976. else if (name in UNSCOPED_EVENT_UI_PROPS) {
  7977. var ui = void 0;
  7978. if (typeof UNSCOPED_EVENT_UI_PROPS[name] === 'function') {
  7979. val = UNSCOPED_EVENT_UI_PROPS[name](val);
  7980. }
  7981. if (name === 'color') {
  7982. ui = { backgroundColor: val, borderColor: val };
  7983. }
  7984. else if (name === 'editable') {
  7985. ui = { startEditable: val, durationEditable: val };
  7986. }
  7987. else {
  7988. ui = (_b = {}, _b[name] = val, _b);
  7989. }
  7990. this.mutate({
  7991. standardProps: { ui: ui }
  7992. });
  7993. }
  7994. };
  7995. EventApi.prototype.setExtendedProp = function (name, val) {
  7996. var _a;
  7997. this.mutate({
  7998. extendedProps: (_a = {}, _a[name] = val, _a)
  7999. });
  8000. };
  8001. EventApi.prototype.setStart = function (startInput, options) {
  8002. if (options === void 0) { options = {}; }
  8003. var dateEnv = this._calendar.dateEnv;
  8004. var start = dateEnv.createMarker(startInput);
  8005. if (start && this._instance) { // TODO: warning if parsed bad
  8006. var instanceRange = this._instance.range;
  8007. var startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity); // what if parsed bad!?
  8008. if (options.maintainDuration) {
  8009. this.mutate({ datesDelta: startDelta });
  8010. }
  8011. else {
  8012. this.mutate({ startDelta: startDelta });
  8013. }
  8014. }
  8015. };
  8016. EventApi.prototype.setEnd = function (endInput, options) {
  8017. if (options === void 0) { options = {}; }
  8018. var dateEnv = this._calendar.dateEnv;
  8019. var end;
  8020. if (endInput != null) {
  8021. end = dateEnv.createMarker(endInput);
  8022. if (!end) {
  8023. return; // TODO: warning if parsed bad
  8024. }
  8025. }
  8026. if (this._instance) {
  8027. if (end) {
  8028. var endDelta = diffDates(this._instance.range.end, end, dateEnv, options.granularity);
  8029. this.mutate({ endDelta: endDelta });
  8030. }
  8031. else {
  8032. this.mutate({ standardProps: { hasEnd: false } });
  8033. }
  8034. }
  8035. };
  8036. EventApi.prototype.setDates = function (startInput, endInput, options) {
  8037. if (options === void 0) { options = {}; }
  8038. var dateEnv = this._calendar.dateEnv;
  8039. var standardProps = { allDay: options.allDay };
  8040. var start = dateEnv.createMarker(startInput);
  8041. var end;
  8042. if (!start) {
  8043. return; // TODO: warning if parsed bad
  8044. }
  8045. if (endInput != null) {
  8046. end = dateEnv.createMarker(endInput);
  8047. if (!end) { // TODO: warning if parsed bad
  8048. return;
  8049. }
  8050. }
  8051. if (this._instance) {
  8052. var instanceRange = this._instance.range;
  8053. // when computing the diff for an event being converted to all-day,
  8054. // compute diff off of the all-day values the way event-mutation does.
  8055. if (options.allDay === true) {
  8056. instanceRange = computeAlignedDayRange(instanceRange);
  8057. }
  8058. var startDelta = diffDates(instanceRange.start, start, dateEnv, options.granularity);
  8059. if (end) {
  8060. var endDelta = diffDates(instanceRange.end, end, dateEnv, options.granularity);
  8061. if (durationsEqual(startDelta, endDelta)) {
  8062. this.mutate({ datesDelta: startDelta, standardProps: standardProps });
  8063. }
  8064. else {
  8065. this.mutate({ startDelta: startDelta, endDelta: endDelta, standardProps: standardProps });
  8066. }
  8067. }
  8068. else { // means "clear the end"
  8069. standardProps.hasEnd = false;
  8070. this.mutate({ datesDelta: startDelta, standardProps: standardProps });
  8071. }
  8072. }
  8073. };
  8074. EventApi.prototype.moveStart = function (deltaInput) {
  8075. var delta = createDuration(deltaInput);
  8076. if (delta) { // TODO: warning if parsed bad
  8077. this.mutate({ startDelta: delta });
  8078. }
  8079. };
  8080. EventApi.prototype.moveEnd = function (deltaInput) {
  8081. var delta = createDuration(deltaInput);
  8082. if (delta) { // TODO: warning if parsed bad
  8083. this.mutate({ endDelta: delta });
  8084. }
  8085. };
  8086. EventApi.prototype.moveDates = function (deltaInput) {
  8087. var delta = createDuration(deltaInput);
  8088. if (delta) { // TODO: warning if parsed bad
  8089. this.mutate({ datesDelta: delta });
  8090. }
  8091. };
  8092. EventApi.prototype.setAllDay = function (allDay, options) {
  8093. if (options === void 0) { options = {}; }
  8094. var standardProps = { allDay: allDay };
  8095. var maintainDuration = options.maintainDuration;
  8096. if (maintainDuration == null) {
  8097. maintainDuration = this._calendar.opt('allDayMaintainDuration');
  8098. }
  8099. if (this._def.allDay !== allDay) {
  8100. standardProps.hasEnd = maintainDuration;
  8101. }
  8102. this.mutate({ standardProps: standardProps });
  8103. };
  8104. EventApi.prototype.formatRange = function (formatInput) {
  8105. var dateEnv = this._calendar.dateEnv;
  8106. var instance = this._instance;
  8107. var formatter = createFormatter(formatInput, this._calendar.opt('defaultRangeSeparator'));
  8108. if (this._def.hasEnd) {
  8109. return dateEnv.formatRange(instance.range.start, instance.range.end, formatter, {
  8110. forcedStartTzo: instance.forcedStartTzo,
  8111. forcedEndTzo: instance.forcedEndTzo
  8112. });
  8113. }
  8114. else {
  8115. return dateEnv.format(instance.range.start, formatter, {
  8116. forcedTzo: instance.forcedStartTzo
  8117. });
  8118. }
  8119. };
  8120. EventApi.prototype.mutate = function (mutation) {
  8121. var def = this._def;
  8122. var instance = this._instance;
  8123. if (instance) {
  8124. this._calendar.dispatch({
  8125. type: 'MUTATE_EVENTS',
  8126. instanceId: instance.instanceId,
  8127. mutation: mutation,
  8128. fromApi: true
  8129. });
  8130. var eventStore = this._calendar.state.eventStore;
  8131. this._def = eventStore.defs[def.defId];
  8132. this._instance = eventStore.instances[instance.instanceId];
  8133. }
  8134. };
  8135. EventApi.prototype.remove = function () {
  8136. this._calendar.dispatch({
  8137. type: 'REMOVE_EVENT_DEF',
  8138. defId: this._def.defId
  8139. });
  8140. };
  8141. Object.defineProperty(EventApi.prototype, "source", {
  8142. get: function () {
  8143. var sourceId = this._def.sourceId;
  8144. if (sourceId) {
  8145. return new EventSourceApi(this._calendar, this._calendar.state.eventSources[sourceId]);
  8146. }
  8147. return null;
  8148. },
  8149. enumerable: true,
  8150. configurable: true
  8151. });
  8152. Object.defineProperty(EventApi.prototype, "start", {
  8153. get: function () {
  8154. return this._instance ?
  8155. this._calendar.dateEnv.toDate(this._instance.range.start) :
  8156. null;
  8157. },
  8158. enumerable: true,
  8159. configurable: true
  8160. });
  8161. Object.defineProperty(EventApi.prototype, "end", {
  8162. get: function () {
  8163. return (this._instance && this._def.hasEnd) ?
  8164. this._calendar.dateEnv.toDate(this._instance.range.end) :
  8165. null;
  8166. },
  8167. enumerable: true,
  8168. configurable: true
  8169. });
  8170. Object.defineProperty(EventApi.prototype, "id", {
  8171. // computable props that all access the def
  8172. // TODO: find a TypeScript-compatible way to do this at scale
  8173. get: function () { return this._def.publicId; },
  8174. enumerable: true,
  8175. configurable: true
  8176. });
  8177. Object.defineProperty(EventApi.prototype, "groupId", {
  8178. get: function () { return this._def.groupId; },
  8179. enumerable: true,
  8180. configurable: true
  8181. });
  8182. Object.defineProperty(EventApi.prototype, "allDay", {
  8183. get: function () { return this._def.allDay; },
  8184. enumerable: true,
  8185. configurable: true
  8186. });
  8187. Object.defineProperty(EventApi.prototype, "title", {
  8188. get: function () { return this._def.title; },
  8189. enumerable: true,
  8190. configurable: true
  8191. });
  8192. Object.defineProperty(EventApi.prototype, "url", {
  8193. get: function () { return this._def.url; },
  8194. enumerable: true,
  8195. configurable: true
  8196. });
  8197. Object.defineProperty(EventApi.prototype, "rendering", {
  8198. get: function () { return this._def.rendering; },
  8199. enumerable: true,
  8200. configurable: true
  8201. });
  8202. Object.defineProperty(EventApi.prototype, "startEditable", {
  8203. get: function () { return this._def.ui.startEditable; },
  8204. enumerable: true,
  8205. configurable: true
  8206. });
  8207. Object.defineProperty(EventApi.prototype, "durationEditable", {
  8208. get: function () { return this._def.ui.durationEditable; },
  8209. enumerable: true,
  8210. configurable: true
  8211. });
  8212. Object.defineProperty(EventApi.prototype, "constraint", {
  8213. get: function () { return this._def.ui.constraints[0] || null; },
  8214. enumerable: true,
  8215. configurable: true
  8216. });
  8217. Object.defineProperty(EventApi.prototype, "overlap", {
  8218. get: function () { return this._def.ui.overlap; },
  8219. enumerable: true,
  8220. configurable: true
  8221. });
  8222. Object.defineProperty(EventApi.prototype, "allow", {
  8223. get: function () { return this._def.ui.allows[0] || null; },
  8224. enumerable: true,
  8225. configurable: true
  8226. });
  8227. Object.defineProperty(EventApi.prototype, "backgroundColor", {
  8228. get: function () { return this._def.ui.backgroundColor; },
  8229. enumerable: true,
  8230. configurable: true
  8231. });
  8232. Object.defineProperty(EventApi.prototype, "borderColor", {
  8233. get: function () { return this._def.ui.borderColor; },
  8234. enumerable: true,
  8235. configurable: true
  8236. });
  8237. Object.defineProperty(EventApi.prototype, "textColor", {
  8238. get: function () { return this._def.ui.textColor; },
  8239. enumerable: true,
  8240. configurable: true
  8241. });
  8242. Object.defineProperty(EventApi.prototype, "classNames", {
  8243. // NOTE: user can't modify these because Object.freeze was called in event-def parsing
  8244. get: function () { return this._def.ui.classNames; },
  8245. enumerable: true,
  8246. configurable: true
  8247. });
  8248. Object.defineProperty(EventApi.prototype, "extendedProps", {
  8249. get: function () { return this._def.extendedProps; },
  8250. enumerable: true,
  8251. configurable: true
  8252. });
  8253. return EventApi;
  8254. }());
  8255. /*
  8256. Specifying nextDayThreshold signals that all-day ranges should be sliced.
  8257. */
  8258. function sliceEventStore(eventStore, eventUiBases, framingRange, nextDayThreshold) {
  8259. var inverseBgByGroupId = {};
  8260. var inverseBgByDefId = {};
  8261. var defByGroupId = {};
  8262. var bgRanges = [];
  8263. var fgRanges = [];
  8264. var eventUis = compileEventUis(eventStore.defs, eventUiBases);
  8265. for (var defId in eventStore.defs) {
  8266. var def = eventStore.defs[defId];
  8267. if (def.rendering === 'inverse-background') {
  8268. if (def.groupId) {
  8269. inverseBgByGroupId[def.groupId] = [];
  8270. if (!defByGroupId[def.groupId]) {
  8271. defByGroupId[def.groupId] = def;
  8272. }
  8273. }
  8274. else {
  8275. inverseBgByDefId[defId] = [];
  8276. }
  8277. }
  8278. }
  8279. for (var instanceId in eventStore.instances) {
  8280. var instance = eventStore.instances[instanceId];
  8281. var def = eventStore.defs[instance.defId];
  8282. var ui = eventUis[def.defId];
  8283. var origRange = instance.range;
  8284. var normalRange = (!def.allDay && nextDayThreshold) ?
  8285. computeVisibleDayRange(origRange, nextDayThreshold) :
  8286. origRange;
  8287. var slicedRange = intersectRanges(normalRange, framingRange);
  8288. if (slicedRange) {
  8289. if (def.rendering === 'inverse-background') {
  8290. if (def.groupId) {
  8291. inverseBgByGroupId[def.groupId].push(slicedRange);
  8292. }
  8293. else {
  8294. inverseBgByDefId[instance.defId].push(slicedRange);
  8295. }
  8296. }
  8297. else {
  8298. (def.rendering === 'background' ? bgRanges : fgRanges).push({
  8299. def: def,
  8300. ui: ui,
  8301. instance: instance,
  8302. range: slicedRange,
  8303. isStart: normalRange.start && normalRange.start.valueOf() === slicedRange.start.valueOf(),
  8304. isEnd: normalRange.end && normalRange.end.valueOf() === slicedRange.end.valueOf()
  8305. });
  8306. }
  8307. }
  8308. }
  8309. for (var groupId in inverseBgByGroupId) { // BY GROUP
  8310. var ranges = inverseBgByGroupId[groupId];
  8311. var invertedRanges = invertRanges(ranges, framingRange);
  8312. for (var _i = 0, invertedRanges_1 = invertedRanges; _i < invertedRanges_1.length; _i++) {
  8313. var invertedRange = invertedRanges_1[_i];
  8314. var def = defByGroupId[groupId];
  8315. var ui = eventUis[def.defId];
  8316. bgRanges.push({
  8317. def: def,
  8318. ui: ui,
  8319. instance: null,
  8320. range: invertedRange,
  8321. isStart: false,
  8322. isEnd: false
  8323. });
  8324. }
  8325. }
  8326. for (var defId in inverseBgByDefId) {
  8327. var ranges = inverseBgByDefId[defId];
  8328. var invertedRanges = invertRanges(ranges, framingRange);
  8329. for (var _a = 0, invertedRanges_2 = invertedRanges; _a < invertedRanges_2.length; _a++) {
  8330. var invertedRange = invertedRanges_2[_a];
  8331. bgRanges.push({
  8332. def: eventStore.defs[defId],
  8333. ui: eventUis[defId],
  8334. instance: null,
  8335. range: invertedRange,
  8336. isStart: false,
  8337. isEnd: false
  8338. });
  8339. }
  8340. }
  8341. return { bg: bgRanges, fg: fgRanges };
  8342. }
  8343. function hasBgRendering(def) {
  8344. return def.rendering === 'background' || def.rendering === 'inverse-background';
  8345. }
  8346. function filterSegsViaEls(context, segs, isMirror) {
  8347. var calendar = context.calendar, view = context.view;
  8348. if (calendar.hasPublicHandlers('eventRender')) {
  8349. segs = segs.filter(function (seg) {
  8350. var custom = calendar.publiclyTrigger('eventRender', [
  8351. {
  8352. event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
  8353. isMirror: isMirror,
  8354. isStart: seg.isStart,
  8355. isEnd: seg.isEnd,
  8356. // TODO: include seg.range once all components consistently generate it
  8357. el: seg.el,
  8358. view: view
  8359. }
  8360. ]);
  8361. if (custom === false) { // means don't render at all
  8362. return false;
  8363. }
  8364. else if (custom && custom !== true) {
  8365. seg.el = custom;
  8366. }
  8367. return true;
  8368. });
  8369. }
  8370. for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
  8371. var seg = segs_1[_i];
  8372. setElSeg(seg.el, seg);
  8373. }
  8374. return segs;
  8375. }
  8376. function setElSeg(el, seg) {
  8377. el.fcSeg = seg;
  8378. }
  8379. function getElSeg(el) {
  8380. return el.fcSeg || null;
  8381. }
  8382. // event ui computation
  8383. function compileEventUis(eventDefs, eventUiBases) {
  8384. return mapHash(eventDefs, function (eventDef) {
  8385. return compileEventUi(eventDef, eventUiBases);
  8386. });
  8387. }
  8388. function compileEventUi(eventDef, eventUiBases) {
  8389. var uis = [];
  8390. if (eventUiBases['']) {
  8391. uis.push(eventUiBases['']);
  8392. }
  8393. if (eventUiBases[eventDef.defId]) {
  8394. uis.push(eventUiBases[eventDef.defId]);
  8395. }
  8396. uis.push(eventDef.ui);
  8397. return combineEventUis(uis);
  8398. }
  8399. // triggers
  8400. function triggerRenderedSegs(context, segs, isMirrors) {
  8401. var calendar = context.calendar, view = context.view;
  8402. if (calendar.hasPublicHandlers('eventPositioned')) {
  8403. for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
  8404. var seg = segs_2[_i];
  8405. calendar.publiclyTriggerAfterSizing('eventPositioned', [
  8406. {
  8407. event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
  8408. isMirror: isMirrors,
  8409. isStart: seg.isStart,
  8410. isEnd: seg.isEnd,
  8411. el: seg.el,
  8412. view: view
  8413. }
  8414. ]);
  8415. }
  8416. }
  8417. if (!calendar.state.loadingLevel) { // avoid initial empty state while pending
  8418. calendar.afterSizingTriggers._eventsPositioned = [null]; // fire once
  8419. }
  8420. }
  8421. function triggerWillRemoveSegs(context, segs, isMirrors) {
  8422. var calendar = context.calendar, view = context.view;
  8423. for (var _i = 0, segs_3 = segs; _i < segs_3.length; _i++) {
  8424. var seg = segs_3[_i];
  8425. calendar.trigger('eventElRemove', seg.el);
  8426. }
  8427. if (calendar.hasPublicHandlers('eventDestroy')) {
  8428. for (var _a = 0, segs_4 = segs; _a < segs_4.length; _a++) {
  8429. var seg = segs_4[_a];
  8430. calendar.publiclyTrigger('eventDestroy', [
  8431. {
  8432. event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
  8433. isMirror: isMirrors,
  8434. el: seg.el,
  8435. view: view
  8436. }
  8437. ]);
  8438. }
  8439. }
  8440. }
  8441. // is-interactable
  8442. function computeEventDraggable(context, eventDef, eventUi) {
  8443. var calendar = context.calendar, view = context.view;
  8444. var transformers = calendar.pluginSystem.hooks.isDraggableTransformers;
  8445. var val = eventUi.startEditable;
  8446. for (var _i = 0, transformers_1 = transformers; _i < transformers_1.length; _i++) {
  8447. var transformer = transformers_1[_i];
  8448. val = transformer(val, eventDef, eventUi, view);
  8449. }
  8450. return val;
  8451. }
  8452. function computeEventStartResizable(context, eventDef, eventUi) {
  8453. return eventUi.durationEditable && context.options.eventResizableFromStart;
  8454. }
  8455. function computeEventEndResizable(context, eventDef, eventUi) {
  8456. return eventUi.durationEditable;
  8457. }
  8458. // applies the mutation to ALL defs/instances within the event store
  8459. function applyMutationToEventStore(eventStore, eventConfigBase, mutation, calendar) {
  8460. var eventConfigs = compileEventUis(eventStore.defs, eventConfigBase);
  8461. var dest = createEmptyEventStore();
  8462. for (var defId in eventStore.defs) {
  8463. var def = eventStore.defs[defId];
  8464. dest.defs[defId] = applyMutationToEventDef(def, eventConfigs[defId], mutation, calendar.pluginSystem.hooks.eventDefMutationAppliers, calendar);
  8465. }
  8466. for (var instanceId in eventStore.instances) {
  8467. var instance = eventStore.instances[instanceId];
  8468. var def = dest.defs[instance.defId]; // important to grab the newly modified def
  8469. dest.instances[instanceId] = applyMutationToEventInstance(instance, def, eventConfigs[instance.defId], mutation, calendar);
  8470. }
  8471. return dest;
  8472. }
  8473. function applyMutationToEventDef(eventDef, eventConfig, mutation, appliers, calendar) {
  8474. var standardProps = mutation.standardProps || {};
  8475. // if hasEnd has not been specified, guess a good value based on deltas.
  8476. // if duration will change, there's no way the default duration will persist,
  8477. // and thus, we need to mark the event as having a real end
  8478. if (standardProps.hasEnd == null &&
  8479. eventConfig.durationEditable &&
  8480. (mutation.startDelta || mutation.endDelta)) {
  8481. standardProps.hasEnd = true; // TODO: is this mutation okay?
  8482. }
  8483. var copy = __assign({}, eventDef, standardProps, { ui: __assign({}, eventDef.ui, standardProps.ui) });
  8484. if (mutation.extendedProps) {
  8485. copy.extendedProps = __assign({}, copy.extendedProps, mutation.extendedProps);
  8486. }
  8487. for (var _i = 0, appliers_1 = appliers; _i < appliers_1.length; _i++) {
  8488. var applier = appliers_1[_i];
  8489. applier(copy, mutation, calendar);
  8490. }
  8491. if (!copy.hasEnd && calendar.opt('forceEventDuration')) {
  8492. copy.hasEnd = true;
  8493. }
  8494. return copy;
  8495. }
  8496. function applyMutationToEventInstance(eventInstance, eventDef, // must first be modified by applyMutationToEventDef
  8497. eventConfig, mutation, calendar) {
  8498. var dateEnv = calendar.dateEnv;
  8499. var forceAllDay = mutation.standardProps && mutation.standardProps.allDay === true;
  8500. var clearEnd = mutation.standardProps && mutation.standardProps.hasEnd === false;
  8501. var copy = __assign({}, eventInstance);
  8502. if (forceAllDay) {
  8503. copy.range = computeAlignedDayRange(copy.range);
  8504. }
  8505. if (mutation.datesDelta && eventConfig.startEditable) {
  8506. copy.range = {
  8507. start: dateEnv.add(copy.range.start, mutation.datesDelta),
  8508. end: dateEnv.add(copy.range.end, mutation.datesDelta)
  8509. };
  8510. }
  8511. if (mutation.startDelta && eventConfig.durationEditable) {
  8512. copy.range = {
  8513. start: dateEnv.add(copy.range.start, mutation.startDelta),
  8514. end: copy.range.end
  8515. };
  8516. }
  8517. if (mutation.endDelta && eventConfig.durationEditable) {
  8518. copy.range = {
  8519. start: copy.range.start,
  8520. end: dateEnv.add(copy.range.end, mutation.endDelta)
  8521. };
  8522. }
  8523. if (clearEnd) {
  8524. copy.range = {
  8525. start: copy.range.start,
  8526. end: calendar.getDefaultEventEnd(eventDef.allDay, copy.range.start)
  8527. };
  8528. }
  8529. // in case event was all-day but the supplied deltas were not
  8530. // better util for this?
  8531. if (eventDef.allDay) {
  8532. copy.range = {
  8533. start: startOfDay(copy.range.start),
  8534. end: startOfDay(copy.range.end)
  8535. };
  8536. }
  8537. // handle invalid durations
  8538. if (copy.range.end < copy.range.start) {
  8539. copy.range.end = calendar.getDefaultEventEnd(eventDef.allDay, copy.range.start);
  8540. }
  8541. return copy;
  8542. }
  8543. function reduceEventStore (eventStore, action, eventSources, dateProfile, calendar) {
  8544. switch (action.type) {
  8545. case 'RECEIVE_EVENTS': // raw
  8546. return receiveRawEvents(eventStore, eventSources[action.sourceId], action.fetchId, action.fetchRange, action.rawEvents, calendar);
  8547. case 'ADD_EVENTS': // already parsed, but not expanded
  8548. return addEvent(eventStore, action.eventStore, // new ones
  8549. dateProfile ? dateProfile.activeRange : null, calendar);
  8550. case 'MERGE_EVENTS': // already parsed and expanded
  8551. return mergeEventStores(eventStore, action.eventStore);
  8552. case 'PREV': // TODO: how do we track all actions that affect dateProfile :(
  8553. case 'NEXT':
  8554. case 'SET_DATE':
  8555. case 'SET_VIEW_TYPE':
  8556. if (dateProfile) {
  8557. return expandRecurring(eventStore, dateProfile.activeRange, calendar);
  8558. }
  8559. else {
  8560. return eventStore;
  8561. }
  8562. case 'CHANGE_TIMEZONE':
  8563. return rezoneDates(eventStore, action.oldDateEnv, calendar.dateEnv);
  8564. case 'MUTATE_EVENTS':
  8565. return applyMutationToRelated(eventStore, action.instanceId, action.mutation, action.fromApi, calendar);
  8566. case 'REMOVE_EVENT_INSTANCES':
  8567. return excludeInstances(eventStore, action.instances);
  8568. case 'REMOVE_EVENT_DEF':
  8569. return filterEventStoreDefs(eventStore, function (eventDef) {
  8570. return eventDef.defId !== action.defId;
  8571. });
  8572. case 'REMOVE_EVENT_SOURCE':
  8573. return excludeEventsBySourceId(eventStore, action.sourceId);
  8574. case 'REMOVE_ALL_EVENT_SOURCES':
  8575. return filterEventStoreDefs(eventStore, function (eventDef) {
  8576. return !eventDef.sourceId; // only keep events with no source id
  8577. });
  8578. case 'REMOVE_ALL_EVENTS':
  8579. return createEmptyEventStore();
  8580. case 'RESET_EVENTS':
  8581. return {
  8582. defs: eventStore.defs,
  8583. instances: eventStore.instances
  8584. };
  8585. default:
  8586. return eventStore;
  8587. }
  8588. }
  8589. function receiveRawEvents(eventStore, eventSource, fetchId, fetchRange, rawEvents, calendar) {
  8590. if (eventSource && // not already removed
  8591. fetchId === eventSource.latestFetchId // TODO: wish this logic was always in event-sources
  8592. ) {
  8593. var subset = parseEvents(transformRawEvents(rawEvents, eventSource, calendar), eventSource.sourceId, calendar);
  8594. if (fetchRange) {
  8595. subset = expandRecurring(subset, fetchRange, calendar);
  8596. }
  8597. return mergeEventStores(excludeEventsBySourceId(eventStore, eventSource.sourceId), subset);
  8598. }
  8599. return eventStore;
  8600. }
  8601. function addEvent(eventStore, subset, expandRange, calendar) {
  8602. if (expandRange) {
  8603. subset = expandRecurring(subset, expandRange, calendar);
  8604. }
  8605. return mergeEventStores(eventStore, subset);
  8606. }
  8607. function rezoneDates(eventStore, oldDateEnv, newDateEnv) {
  8608. var defs = eventStore.defs;
  8609. var instances = mapHash(eventStore.instances, function (instance) {
  8610. var def = defs[instance.defId];
  8611. if (def.allDay || def.recurringDef) {
  8612. return instance; // isn't dependent on timezone
  8613. }
  8614. else {
  8615. return __assign({}, instance, { range: {
  8616. start: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.start, instance.forcedStartTzo)),
  8617. end: newDateEnv.createMarker(oldDateEnv.toDate(instance.range.end, instance.forcedEndTzo))
  8618. }, forcedStartTzo: newDateEnv.canComputeOffset ? null : instance.forcedStartTzo, forcedEndTzo: newDateEnv.canComputeOffset ? null : instance.forcedEndTzo });
  8619. }
  8620. });
  8621. return { defs: defs, instances: instances };
  8622. }
  8623. function applyMutationToRelated(eventStore, instanceId, mutation, fromApi, calendar) {
  8624. var relevant = getRelevantEvents(eventStore, instanceId);
  8625. var eventConfigBase = fromApi ?
  8626. { '': {
  8627. startEditable: true,
  8628. durationEditable: true,
  8629. constraints: [],
  8630. overlap: null,
  8631. allows: [],
  8632. backgroundColor: '',
  8633. borderColor: '',
  8634. textColor: '',
  8635. classNames: []
  8636. } } :
  8637. calendar.eventUiBases;
  8638. relevant = applyMutationToEventStore(relevant, eventConfigBase, mutation, calendar);
  8639. return mergeEventStores(eventStore, relevant);
  8640. }
  8641. function excludeEventsBySourceId(eventStore, sourceId) {
  8642. return filterEventStoreDefs(eventStore, function (eventDef) {
  8643. return eventDef.sourceId !== sourceId;
  8644. });
  8645. }
  8646. // QUESTION: why not just return instances? do a general object-property-exclusion util
  8647. function excludeInstances(eventStore, removals) {
  8648. return {
  8649. defs: eventStore.defs,
  8650. instances: filterHash(eventStore.instances, function (instance) {
  8651. return !removals[instance.instanceId];
  8652. })
  8653. };
  8654. }
  8655. // high-level segmenting-aware tester functions
  8656. // ------------------------------------------------------------------------------------------------------------------------
  8657. function isInteractionValid(interaction, calendar) {
  8658. return isNewPropsValid({ eventDrag: interaction }, calendar); // HACK: the eventDrag props is used for ALL interactions
  8659. }
  8660. function isDateSelectionValid(dateSelection, calendar) {
  8661. return isNewPropsValid({ dateSelection: dateSelection }, calendar);
  8662. }
  8663. function isNewPropsValid(newProps, calendar) {
  8664. var view = calendar.view;
  8665. var props = __assign({ businessHours: view ? view.props.businessHours : createEmptyEventStore(), dateSelection: '', eventStore: calendar.state.eventStore, eventUiBases: calendar.eventUiBases, eventSelection: '', eventDrag: null, eventResize: null }, newProps);
  8666. return (calendar.pluginSystem.hooks.isPropsValid || isPropsValid)(props, calendar);
  8667. }
  8668. function isPropsValid(state, calendar, dateSpanMeta, filterConfig) {
  8669. if (dateSpanMeta === void 0) { dateSpanMeta = {}; }
  8670. if (state.eventDrag && !isInteractionPropsValid(state, calendar, dateSpanMeta, filterConfig)) {
  8671. return false;
  8672. }
  8673. if (state.dateSelection && !isDateSelectionPropsValid(state, calendar, dateSpanMeta, filterConfig)) {
  8674. return false;
  8675. }
  8676. return true;
  8677. }
  8678. // Moving Event Validation
  8679. // ------------------------------------------------------------------------------------------------------------------------
  8680. function isInteractionPropsValid(state, calendar, dateSpanMeta, filterConfig) {
  8681. var interaction = state.eventDrag; // HACK: the eventDrag props is used for ALL interactions
  8682. var subjectEventStore = interaction.mutatedEvents;
  8683. var subjectDefs = subjectEventStore.defs;
  8684. var subjectInstances = subjectEventStore.instances;
  8685. var subjectConfigs = compileEventUis(subjectDefs, interaction.isEvent ?
  8686. state.eventUiBases :
  8687. { '': calendar.selectionConfig } // if not a real event, validate as a selection
  8688. );
  8689. if (filterConfig) {
  8690. subjectConfigs = mapHash(subjectConfigs, filterConfig);
  8691. }
  8692. var otherEventStore = excludeInstances(state.eventStore, interaction.affectedEvents.instances); // exclude the subject events. TODO: exclude defs too?
  8693. var otherDefs = otherEventStore.defs;
  8694. var otherInstances = otherEventStore.instances;
  8695. var otherConfigs = compileEventUis(otherDefs, state.eventUiBases);
  8696. for (var subjectInstanceId in subjectInstances) {
  8697. var subjectInstance = subjectInstances[subjectInstanceId];
  8698. var subjectRange = subjectInstance.range;
  8699. var subjectConfig = subjectConfigs[subjectInstance.defId];
  8700. var subjectDef = subjectDefs[subjectInstance.defId];
  8701. // constraint
  8702. if (!allConstraintsPass(subjectConfig.constraints, subjectRange, otherEventStore, state.businessHours, calendar)) {
  8703. return false;
  8704. }
  8705. // overlap
  8706. var overlapFunc = calendar.opt('eventOverlap');
  8707. if (typeof overlapFunc !== 'function') {
  8708. overlapFunc = null;
  8709. }
  8710. for (var otherInstanceId in otherInstances) {
  8711. var otherInstance = otherInstances[otherInstanceId];
  8712. // intersect! evaluate
  8713. if (rangesIntersect(subjectRange, otherInstance.range)) {
  8714. var otherOverlap = otherConfigs[otherInstance.defId].overlap;
  8715. // consider the other event's overlap. only do this if the subject event is a "real" event
  8716. if (otherOverlap === false && interaction.isEvent) {
  8717. return false;
  8718. }
  8719. if (subjectConfig.overlap === false) {
  8720. return false;
  8721. }
  8722. if (overlapFunc && !overlapFunc(new EventApi(calendar, otherDefs[otherInstance.defId], otherInstance), // still event
  8723. new EventApi(calendar, subjectDef, subjectInstance) // moving event
  8724. )) {
  8725. return false;
  8726. }
  8727. }
  8728. }
  8729. // allow (a function)
  8730. var calendarEventStore = calendar.state.eventStore; // need global-to-calendar, not local to component (splittable)state
  8731. for (var _i = 0, _a = subjectConfig.allows; _i < _a.length; _i++) {
  8732. var subjectAllow = _a[_i];
  8733. var subjectDateSpan = __assign({}, dateSpanMeta, { range: subjectInstance.range, allDay: subjectDef.allDay });
  8734. var origDef = calendarEventStore.defs[subjectDef.defId];
  8735. var origInstance = calendarEventStore.instances[subjectInstanceId];
  8736. var eventApi = void 0;
  8737. if (origDef) { // was previously in the calendar
  8738. eventApi = new EventApi(calendar, origDef, origInstance);
  8739. }
  8740. else { // was an external event
  8741. eventApi = new EventApi(calendar, subjectDef); // no instance, because had no dates
  8742. }
  8743. if (!subjectAllow(calendar.buildDateSpanApi(subjectDateSpan), eventApi)) {
  8744. return false;
  8745. }
  8746. }
  8747. }
  8748. return true;
  8749. }
  8750. // Date Selection Validation
  8751. // ------------------------------------------------------------------------------------------------------------------------
  8752. function isDateSelectionPropsValid(state, calendar, dateSpanMeta, filterConfig) {
  8753. var relevantEventStore = state.eventStore;
  8754. var relevantDefs = relevantEventStore.defs;
  8755. var relevantInstances = relevantEventStore.instances;
  8756. var selection = state.dateSelection;
  8757. var selectionRange = selection.range;
  8758. var selectionConfig = calendar.selectionConfig;
  8759. if (filterConfig) {
  8760. selectionConfig = filterConfig(selectionConfig);
  8761. }
  8762. // constraint
  8763. if (!allConstraintsPass(selectionConfig.constraints, selectionRange, relevantEventStore, state.businessHours, calendar)) {
  8764. return false;
  8765. }
  8766. // overlap
  8767. var overlapFunc = calendar.opt('selectOverlap');
  8768. if (typeof overlapFunc !== 'function') {
  8769. overlapFunc = null;
  8770. }
  8771. for (var relevantInstanceId in relevantInstances) {
  8772. var relevantInstance = relevantInstances[relevantInstanceId];
  8773. // intersect! evaluate
  8774. if (rangesIntersect(selectionRange, relevantInstance.range)) {
  8775. if (selectionConfig.overlap === false) {
  8776. return false;
  8777. }
  8778. if (overlapFunc && !overlapFunc(new EventApi(calendar, relevantDefs[relevantInstance.defId], relevantInstance))) {
  8779. return false;
  8780. }
  8781. }
  8782. }
  8783. // allow (a function)
  8784. for (var _i = 0, _a = selectionConfig.allows; _i < _a.length; _i++) {
  8785. var selectionAllow = _a[_i];
  8786. var fullDateSpan = __assign({}, dateSpanMeta, selection);
  8787. if (!selectionAllow(calendar.buildDateSpanApi(fullDateSpan), null)) {
  8788. return false;
  8789. }
  8790. }
  8791. return true;
  8792. }
  8793. // Constraint Utils
  8794. // ------------------------------------------------------------------------------------------------------------------------
  8795. function allConstraintsPass(constraints, subjectRange, otherEventStore, businessHoursUnexpanded, calendar) {
  8796. for (var _i = 0, constraints_1 = constraints; _i < constraints_1.length; _i++) {
  8797. var constraint = constraints_1[_i];
  8798. if (!anyRangesContainRange(constraintToRanges(constraint, subjectRange, otherEventStore, businessHoursUnexpanded, calendar), subjectRange)) {
  8799. return false;
  8800. }
  8801. }
  8802. return true;
  8803. }
  8804. function constraintToRanges(constraint, subjectRange, // for expanding a recurring constraint, or expanding business hours
  8805. otherEventStore, // for if constraint is an even group ID
  8806. businessHoursUnexpanded, // for if constraint is 'businessHours'
  8807. calendar // for expanding businesshours
  8808. ) {
  8809. if (constraint === 'businessHours') {
  8810. return eventStoreToRanges(expandRecurring(businessHoursUnexpanded, subjectRange, calendar));
  8811. }
  8812. else if (typeof constraint === 'string') { // an group ID
  8813. return eventStoreToRanges(filterEventStoreDefs(otherEventStore, function (eventDef) {
  8814. return eventDef.groupId === constraint;
  8815. }));
  8816. }
  8817. else if (typeof constraint === 'object' && constraint) { // non-null object
  8818. return eventStoreToRanges(expandRecurring(constraint, subjectRange, calendar));
  8819. }
  8820. return []; // if it's false
  8821. }
  8822. // TODO: move to event-store file?
  8823. function eventStoreToRanges(eventStore) {
  8824. var instances = eventStore.instances;
  8825. var ranges = [];
  8826. for (var instanceId in instances) {
  8827. ranges.push(instances[instanceId].range);
  8828. }
  8829. return ranges;
  8830. }
  8831. // TODO: move to geom file?
  8832. function anyRangesContainRange(outerRanges, innerRange) {
  8833. for (var _i = 0, outerRanges_1 = outerRanges; _i < outerRanges_1.length; _i++) {
  8834. var outerRange = outerRanges_1[_i];
  8835. if (rangeContainsRange(outerRange, innerRange)) {
  8836. return true;
  8837. }
  8838. }
  8839. return false;
  8840. }
  8841. // Parsing
  8842. // ------------------------------------------------------------------------------------------------------------------------
  8843. function normalizeConstraint(input, calendar) {
  8844. if (Array.isArray(input)) {
  8845. return parseEvents(input, '', calendar, true); // allowOpenRange=true
  8846. }
  8847. else if (typeof input === 'object' && input) { // non-null object
  8848. return parseEvents([input], '', calendar, true); // allowOpenRange=true
  8849. }
  8850. else if (input != null) {
  8851. return String(input);
  8852. }
  8853. else {
  8854. return null;
  8855. }
  8856. }
  8857. function htmlEscape(s) {
  8858. return (s + '').replace(/&/g, '&amp;')
  8859. .replace(/</g, '&lt;')
  8860. .replace(/>/g, '&gt;')
  8861. .replace(/'/g, '&#039;')
  8862. .replace(/"/g, '&quot;')
  8863. .replace(/\n/g, '<br />');
  8864. }
  8865. // Given a hash of CSS properties, returns a string of CSS.
  8866. // Uses property names as-is (no camel-case conversion). Will not make statements for null/undefined values.
  8867. function cssToStr(cssProps) {
  8868. var statements = [];
  8869. for (var name_1 in cssProps) {
  8870. var val = cssProps[name_1];
  8871. if (val != null && val !== '') {
  8872. statements.push(name_1 + ':' + val);
  8873. }
  8874. }
  8875. return statements.join(';');
  8876. }
  8877. // Given an object hash of HTML attribute names to values,
  8878. // generates a string that can be injected between < > in HTML
  8879. function attrsToStr(attrs) {
  8880. var parts = [];
  8881. for (var name_2 in attrs) {
  8882. var val = attrs[name_2];
  8883. if (val != null) {
  8884. parts.push(name_2 + '="' + htmlEscape(val) + '"');
  8885. }
  8886. }
  8887. return parts.join(' ');
  8888. }
  8889. function parseClassName(raw) {
  8890. if (Array.isArray(raw)) {
  8891. return raw;
  8892. }
  8893. else if (typeof raw === 'string') {
  8894. return raw.split(/\s+/);
  8895. }
  8896. else {
  8897. return [];
  8898. }
  8899. }
  8900. var UNSCOPED_EVENT_UI_PROPS = {
  8901. editable: Boolean,
  8902. startEditable: Boolean,
  8903. durationEditable: Boolean,
  8904. constraint: null,
  8905. overlap: null,
  8906. allow: null,
  8907. className: parseClassName,
  8908. classNames: parseClassName,
  8909. color: String,
  8910. backgroundColor: String,
  8911. borderColor: String,
  8912. textColor: String
  8913. };
  8914. function processUnscopedUiProps(rawProps, calendar, leftovers) {
  8915. var props = refineProps(rawProps, UNSCOPED_EVENT_UI_PROPS, {}, leftovers);
  8916. var constraint = normalizeConstraint(props.constraint, calendar);
  8917. return {
  8918. startEditable: props.startEditable != null ? props.startEditable : props.editable,
  8919. durationEditable: props.durationEditable != null ? props.durationEditable : props.editable,
  8920. constraints: constraint != null ? [constraint] : [],
  8921. overlap: props.overlap,
  8922. allows: props.allow != null ? [props.allow] : [],
  8923. backgroundColor: props.backgroundColor || props.color,
  8924. borderColor: props.borderColor || props.color,
  8925. textColor: props.textColor,
  8926. classNames: props.classNames.concat(props.className)
  8927. };
  8928. }
  8929. function processScopedUiProps(prefix, rawScoped, calendar, leftovers) {
  8930. var rawUnscoped = {};
  8931. var wasFound = {};
  8932. for (var key in UNSCOPED_EVENT_UI_PROPS) {
  8933. var scopedKey = prefix + capitaliseFirstLetter(key);
  8934. rawUnscoped[key] = rawScoped[scopedKey];
  8935. wasFound[scopedKey] = true;
  8936. }
  8937. if (prefix === 'event') {
  8938. rawUnscoped.editable = rawScoped.editable; // special case. there is no 'eventEditable', just 'editable'
  8939. }
  8940. if (leftovers) {
  8941. for (var key in rawScoped) {
  8942. if (!wasFound[key]) {
  8943. leftovers[key] = rawScoped[key];
  8944. }
  8945. }
  8946. }
  8947. return processUnscopedUiProps(rawUnscoped, calendar);
  8948. }
  8949. var EMPTY_EVENT_UI = {
  8950. startEditable: null,
  8951. durationEditable: null,
  8952. constraints: [],
  8953. overlap: null,
  8954. allows: [],
  8955. backgroundColor: '',
  8956. borderColor: '',
  8957. textColor: '',
  8958. classNames: []
  8959. };
  8960. // prevent against problems with <2 args!
  8961. function combineEventUis(uis) {
  8962. return uis.reduce(combineTwoEventUis, EMPTY_EVENT_UI);
  8963. }
  8964. function combineTwoEventUis(item0, item1) {
  8965. return {
  8966. startEditable: item1.startEditable != null ? item1.startEditable : item0.startEditable,
  8967. durationEditable: item1.durationEditable != null ? item1.durationEditable : item0.durationEditable,
  8968. constraints: item0.constraints.concat(item1.constraints),
  8969. overlap: typeof item1.overlap === 'boolean' ? item1.overlap : item0.overlap,
  8970. allows: item0.allows.concat(item1.allows),
  8971. backgroundColor: item1.backgroundColor || item0.backgroundColor,
  8972. borderColor: item1.borderColor || item0.borderColor,
  8973. textColor: item1.textColor || item0.textColor,
  8974. classNames: item0.classNames.concat(item1.classNames)
  8975. };
  8976. }
  8977. var NON_DATE_PROPS = {
  8978. id: String,
  8979. groupId: String,
  8980. title: String,
  8981. url: String,
  8982. rendering: String,
  8983. extendedProps: null
  8984. };
  8985. var DATE_PROPS = {
  8986. start: null,
  8987. date: null,
  8988. end: null,
  8989. allDay: null
  8990. };
  8991. var uid = 0;
  8992. function parseEvent(raw, sourceId, calendar, allowOpenRange) {
  8993. var allDayDefault = computeIsAllDayDefault(sourceId, calendar);
  8994. var leftovers0 = {};
  8995. var recurringRes = parseRecurring(raw, // raw, but with single-event stuff stripped out
  8996. allDayDefault, calendar.dateEnv, calendar.pluginSystem.hooks.recurringTypes, leftovers0 // will populate with non-recurring props
  8997. );
  8998. if (recurringRes) {
  8999. var def = parseEventDef(leftovers0, sourceId, recurringRes.allDay, Boolean(recurringRes.duration), calendar);
  9000. def.recurringDef = {
  9001. typeId: recurringRes.typeId,
  9002. typeData: recurringRes.typeData,
  9003. duration: recurringRes.duration
  9004. };
  9005. return { def: def, instance: null };
  9006. }
  9007. else {
  9008. var leftovers1 = {};
  9009. var singleRes = parseSingle(raw, allDayDefault, calendar, leftovers1, allowOpenRange);
  9010. if (singleRes) {
  9011. var def = parseEventDef(leftovers1, sourceId, singleRes.allDay, singleRes.hasEnd, calendar);
  9012. var instance = createEventInstance(def.defId, singleRes.range, singleRes.forcedStartTzo, singleRes.forcedEndTzo);
  9013. return { def: def, instance: instance };
  9014. }
  9015. }
  9016. return null;
  9017. }
  9018. /*
  9019. Will NOT populate extendedProps with the leftover properties.
  9020. Will NOT populate date-related props.
  9021. The EventNonDateInput has been normalized (id => publicId, etc).
  9022. */
  9023. function parseEventDef(raw, sourceId, allDay, hasEnd, calendar) {
  9024. var leftovers = {};
  9025. var def = pluckNonDateProps(raw, calendar, leftovers);
  9026. def.defId = String(uid++);
  9027. def.sourceId = sourceId;
  9028. def.allDay = allDay;
  9029. def.hasEnd = hasEnd;
  9030. for (var _i = 0, _a = calendar.pluginSystem.hooks.eventDefParsers; _i < _a.length; _i++) {
  9031. var eventDefParser = _a[_i];
  9032. var newLeftovers = {};
  9033. eventDefParser(def, leftovers, newLeftovers);
  9034. leftovers = newLeftovers;
  9035. }
  9036. def.extendedProps = __assign(leftovers, def.extendedProps || {});
  9037. // help out EventApi from having user modify props
  9038. Object.freeze(def.ui.classNames);
  9039. Object.freeze(def.extendedProps);
  9040. return def;
  9041. }
  9042. function createEventInstance(defId, range, forcedStartTzo, forcedEndTzo) {
  9043. return {
  9044. instanceId: String(uid++),
  9045. defId: defId,
  9046. range: range,
  9047. forcedStartTzo: forcedStartTzo == null ? null : forcedStartTzo,
  9048. forcedEndTzo: forcedEndTzo == null ? null : forcedEndTzo
  9049. };
  9050. }
  9051. function parseSingle(raw, allDayDefault, calendar, leftovers, allowOpenRange) {
  9052. var props = pluckDateProps(raw, leftovers);
  9053. var allDay = props.allDay;
  9054. var startMeta;
  9055. var startMarker = null;
  9056. var hasEnd = false;
  9057. var endMeta;
  9058. var endMarker = null;
  9059. startMeta = calendar.dateEnv.createMarkerMeta(props.start);
  9060. if (startMeta) {
  9061. startMarker = startMeta.marker;
  9062. }
  9063. else if (!allowOpenRange) {
  9064. return null;
  9065. }
  9066. if (props.end != null) {
  9067. endMeta = calendar.dateEnv.createMarkerMeta(props.end);
  9068. }
  9069. if (allDay == null) {
  9070. if (allDayDefault != null) {
  9071. allDay = allDayDefault;
  9072. }
  9073. else {
  9074. // fall back to the date props LAST
  9075. allDay = (!startMeta || startMeta.isTimeUnspecified) &&
  9076. (!endMeta || endMeta.isTimeUnspecified);
  9077. }
  9078. }
  9079. if (allDay && startMarker) {
  9080. startMarker = startOfDay(startMarker);
  9081. }
  9082. if (endMeta) {
  9083. endMarker = endMeta.marker;
  9084. if (allDay) {
  9085. endMarker = startOfDay(endMarker);
  9086. }
  9087. if (startMarker && endMarker <= startMarker) {
  9088. endMarker = null;
  9089. }
  9090. }
  9091. if (endMarker) {
  9092. hasEnd = true;
  9093. }
  9094. else if (!allowOpenRange) {
  9095. hasEnd = calendar.opt('forceEventDuration') || false;
  9096. endMarker = calendar.dateEnv.add(startMarker, allDay ?
  9097. calendar.defaultAllDayEventDuration :
  9098. calendar.defaultTimedEventDuration);
  9099. }
  9100. return {
  9101. allDay: allDay,
  9102. hasEnd: hasEnd,
  9103. range: { start: startMarker, end: endMarker },
  9104. forcedStartTzo: startMeta ? startMeta.forcedTzo : null,
  9105. forcedEndTzo: endMeta ? endMeta.forcedTzo : null
  9106. };
  9107. }
  9108. function pluckDateProps(raw, leftovers) {
  9109. var props = refineProps(raw, DATE_PROPS, {}, leftovers);
  9110. props.start = (props.start !== null) ? props.start : props.date;
  9111. delete props.date;
  9112. return props;
  9113. }
  9114. function pluckNonDateProps(raw, calendar, leftovers) {
  9115. var preLeftovers = {};
  9116. var props = refineProps(raw, NON_DATE_PROPS, {}, preLeftovers);
  9117. var ui = processUnscopedUiProps(preLeftovers, calendar, leftovers);
  9118. props.publicId = props.id;
  9119. delete props.id;
  9120. props.ui = ui;
  9121. return props;
  9122. }
  9123. function computeIsAllDayDefault(sourceId, calendar) {
  9124. var res = null;
  9125. if (sourceId) {
  9126. var source = calendar.state.eventSources[sourceId];
  9127. res = source.allDayDefault;
  9128. }
  9129. if (res == null) {
  9130. res = calendar.opt('allDayDefault');
  9131. }
  9132. return res;
  9133. }
  9134. var DEF_DEFAULTS = {
  9135. startTime: '09:00',
  9136. endTime: '17:00',
  9137. daysOfWeek: [1, 2, 3, 4, 5],
  9138. rendering: 'inverse-background',
  9139. classNames: 'fc-nonbusiness',
  9140. groupId: '_businessHours' // so multiple defs get grouped
  9141. };
  9142. /*
  9143. TODO: pass around as EventDefHash!!!
  9144. */
  9145. function parseBusinessHours(input, calendar) {
  9146. return parseEvents(refineInputs(input), '', calendar);
  9147. }
  9148. function refineInputs(input) {
  9149. var rawDefs;
  9150. if (input === true) {
  9151. rawDefs = [{}]; // will get DEF_DEFAULTS verbatim
  9152. }
  9153. else if (Array.isArray(input)) {
  9154. // if specifying an array, every sub-definition NEEDS a day-of-week
  9155. rawDefs = input.filter(function (rawDef) {
  9156. return rawDef.daysOfWeek;
  9157. });
  9158. }
  9159. else if (typeof input === 'object' && input) { // non-null object
  9160. rawDefs = [input];
  9161. }
  9162. else { // is probably false
  9163. rawDefs = [];
  9164. }
  9165. rawDefs = rawDefs.map(function (rawDef) {
  9166. return __assign({}, DEF_DEFAULTS, rawDef);
  9167. });
  9168. return rawDefs;
  9169. }
  9170. function memoizeRendering(renderFunc, unrenderFunc, dependencies) {
  9171. if (dependencies === void 0) { dependencies = []; }
  9172. var dependents = [];
  9173. var thisContext;
  9174. var prevArgs;
  9175. function unrender() {
  9176. if (prevArgs) {
  9177. for (var _i = 0, dependents_1 = dependents; _i < dependents_1.length; _i++) {
  9178. var dependent = dependents_1[_i];
  9179. dependent.unrender();
  9180. }
  9181. if (unrenderFunc) {
  9182. unrenderFunc.apply(thisContext, prevArgs);
  9183. }
  9184. prevArgs = null;
  9185. }
  9186. }
  9187. function res() {
  9188. if (!prevArgs || !isArraysEqual(prevArgs, arguments)) {
  9189. unrender();
  9190. thisContext = this;
  9191. prevArgs = arguments;
  9192. renderFunc.apply(this, arguments);
  9193. }
  9194. }
  9195. res.dependents = dependents;
  9196. res.unrender = unrender;
  9197. for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) {
  9198. var dependency = dependencies_1[_i];
  9199. dependency.dependents.push(res);
  9200. }
  9201. return res;
  9202. }
  9203. var EMPTY_EVENT_STORE = createEmptyEventStore(); // for purecomponents. TODO: keep elsewhere
  9204. var Splitter = /** @class */ (function () {
  9205. function Splitter() {
  9206. this.getKeysForEventDefs = memoize(this._getKeysForEventDefs);
  9207. this.splitDateSelection = memoize(this._splitDateSpan);
  9208. this.splitEventStore = memoize(this._splitEventStore);
  9209. this.splitIndividualUi = memoize(this._splitIndividualUi);
  9210. this.splitEventDrag = memoize(this._splitInteraction);
  9211. this.splitEventResize = memoize(this._splitInteraction);
  9212. this.eventUiBuilders = {}; // TODO: typescript protection
  9213. }
  9214. Splitter.prototype.splitProps = function (props) {
  9215. var _this = this;
  9216. var keyInfos = this.getKeyInfo(props);
  9217. var defKeys = this.getKeysForEventDefs(props.eventStore);
  9218. var dateSelections = this.splitDateSelection(props.dateSelection);
  9219. var individualUi = this.splitIndividualUi(props.eventUiBases, defKeys); // the individual *bases*
  9220. var eventStores = this.splitEventStore(props.eventStore, defKeys);
  9221. var eventDrags = this.splitEventDrag(props.eventDrag);
  9222. var eventResizes = this.splitEventResize(props.eventResize);
  9223. var splitProps = {};
  9224. this.eventUiBuilders = mapHash(keyInfos, function (info, key) {
  9225. return _this.eventUiBuilders[key] || memoize(buildEventUiForKey);
  9226. });
  9227. for (var key in keyInfos) {
  9228. var keyInfo = keyInfos[key];
  9229. var eventStore = eventStores[key] || EMPTY_EVENT_STORE;
  9230. var buildEventUi = this.eventUiBuilders[key];
  9231. splitProps[key] = {
  9232. businessHours: keyInfo.businessHours || props.businessHours,
  9233. dateSelection: dateSelections[key] || null,
  9234. eventStore: eventStore,
  9235. eventUiBases: buildEventUi(props.eventUiBases[''], keyInfo.ui, individualUi[key]),
  9236. eventSelection: eventStore.instances[props.eventSelection] ? props.eventSelection : '',
  9237. eventDrag: eventDrags[key] || null,
  9238. eventResize: eventResizes[key] || null
  9239. };
  9240. }
  9241. return splitProps;
  9242. };
  9243. Splitter.prototype._splitDateSpan = function (dateSpan) {
  9244. var dateSpans = {};
  9245. if (dateSpan) {
  9246. var keys = this.getKeysForDateSpan(dateSpan);
  9247. for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
  9248. var key = keys_1[_i];
  9249. dateSpans[key] = dateSpan;
  9250. }
  9251. }
  9252. return dateSpans;
  9253. };
  9254. Splitter.prototype._getKeysForEventDefs = function (eventStore) {
  9255. var _this = this;
  9256. return mapHash(eventStore.defs, function (eventDef) {
  9257. return _this.getKeysForEventDef(eventDef);
  9258. });
  9259. };
  9260. Splitter.prototype._splitEventStore = function (eventStore, defKeys) {
  9261. var defs = eventStore.defs, instances = eventStore.instances;
  9262. var splitStores = {};
  9263. for (var defId in defs) {
  9264. for (var _i = 0, _a = defKeys[defId]; _i < _a.length; _i++) {
  9265. var key = _a[_i];
  9266. if (!splitStores[key]) {
  9267. splitStores[key] = createEmptyEventStore();
  9268. }
  9269. splitStores[key].defs[defId] = defs[defId];
  9270. }
  9271. }
  9272. for (var instanceId in instances) {
  9273. var instance = instances[instanceId];
  9274. for (var _b = 0, _c = defKeys[instance.defId]; _b < _c.length; _b++) {
  9275. var key = _c[_b];
  9276. if (splitStores[key]) { // must have already been created
  9277. splitStores[key].instances[instanceId] = instance;
  9278. }
  9279. }
  9280. }
  9281. return splitStores;
  9282. };
  9283. Splitter.prototype._splitIndividualUi = function (eventUiBases, defKeys) {
  9284. var splitHashes = {};
  9285. for (var defId in eventUiBases) {
  9286. if (defId) { // not the '' key
  9287. for (var _i = 0, _a = defKeys[defId]; _i < _a.length; _i++) {
  9288. var key = _a[_i];
  9289. if (!splitHashes[key]) {
  9290. splitHashes[key] = {};
  9291. }
  9292. splitHashes[key][defId] = eventUiBases[defId];
  9293. }
  9294. }
  9295. }
  9296. return splitHashes;
  9297. };
  9298. Splitter.prototype._splitInteraction = function (interaction) {
  9299. var splitStates = {};
  9300. if (interaction) {
  9301. var affectedStores_1 = this._splitEventStore(interaction.affectedEvents, this._getKeysForEventDefs(interaction.affectedEvents) // can't use cached. might be events from other calendar
  9302. );
  9303. // can't rely on defKeys because event data is mutated
  9304. var mutatedKeysByDefId = this._getKeysForEventDefs(interaction.mutatedEvents);
  9305. var mutatedStores_1 = this._splitEventStore(interaction.mutatedEvents, mutatedKeysByDefId);
  9306. var populate = function (key) {
  9307. if (!splitStates[key]) {
  9308. splitStates[key] = {
  9309. affectedEvents: affectedStores_1[key] || EMPTY_EVENT_STORE,
  9310. mutatedEvents: mutatedStores_1[key] || EMPTY_EVENT_STORE,
  9311. isEvent: interaction.isEvent,
  9312. origSeg: interaction.origSeg
  9313. };
  9314. }
  9315. };
  9316. for (var key in affectedStores_1) {
  9317. populate(key);
  9318. }
  9319. for (var key in mutatedStores_1) {
  9320. populate(key);
  9321. }
  9322. }
  9323. return splitStates;
  9324. };
  9325. return Splitter;
  9326. }());
  9327. function buildEventUiForKey(allUi, eventUiForKey, individualUi) {
  9328. var baseParts = [];
  9329. if (allUi) {
  9330. baseParts.push(allUi);
  9331. }
  9332. if (eventUiForKey) {
  9333. baseParts.push(eventUiForKey);
  9334. }
  9335. var stuff = {
  9336. '': combineEventUis(baseParts)
  9337. };
  9338. if (individualUi) {
  9339. __assign(stuff, individualUi);
  9340. }
  9341. return stuff;
  9342. }
  9343. // Generates HTML for an anchor to another view into the calendar.
  9344. // Will either generate an <a> tag or a non-clickable <span> tag, depending on enabled settings.
  9345. // `gotoOptions` can either be a DateMarker, or an object with the form:
  9346. // { date, type, forceOff }
  9347. // `type` is a view-type like "day" or "week". default value is "day".
  9348. // `attrs` and `innerHtml` are use to generate the rest of the HTML tag.
  9349. function buildGotoAnchorHtml(allOptions, dateEnv, gotoOptions, attrs, innerHtml) {
  9350. var date;
  9351. var type;
  9352. var forceOff;
  9353. var finalOptions;
  9354. if (gotoOptions instanceof Date) {
  9355. date = gotoOptions; // a single date-like input
  9356. }
  9357. else {
  9358. date = gotoOptions.date;
  9359. type = gotoOptions.type;
  9360. forceOff = gotoOptions.forceOff;
  9361. }
  9362. finalOptions = {
  9363. date: dateEnv.formatIso(date, { omitTime: true }),
  9364. type: type || 'day'
  9365. };
  9366. if (typeof attrs === 'string') {
  9367. innerHtml = attrs;
  9368. attrs = null;
  9369. }
  9370. attrs = attrs ? ' ' + attrsToStr(attrs) : ''; // will have a leading space
  9371. innerHtml = innerHtml || '';
  9372. if (!forceOff && allOptions.navLinks) {
  9373. return '<a' + attrs +
  9374. ' data-goto="' + htmlEscape(JSON.stringify(finalOptions)) + '">' +
  9375. innerHtml +
  9376. '</a>';
  9377. }
  9378. else {
  9379. return '<span' + attrs + '>' +
  9380. innerHtml +
  9381. '</span>';
  9382. }
  9383. }
  9384. function getAllDayHtml(allOptions) {
  9385. return allOptions.allDayHtml || htmlEscape(allOptions.allDayText);
  9386. }
  9387. // Computes HTML classNames for a single-day element
  9388. function getDayClasses(date, dateProfile, context, noThemeHighlight) {
  9389. var calendar = context.calendar, options = context.options, theme = context.theme, dateEnv = context.dateEnv;
  9390. var classes = [];
  9391. var todayStart;
  9392. var todayEnd;
  9393. if (!rangeContainsMarker(dateProfile.activeRange, date)) {
  9394. classes.push('fc-disabled-day');
  9395. }
  9396. else {
  9397. classes.push('fc-' + DAY_IDS[date.getUTCDay()]);
  9398. if (options.monthMode &&
  9399. dateEnv.getMonth(date) !== dateEnv.getMonth(dateProfile.currentRange.start)) {
  9400. classes.push('fc-other-month');
  9401. }
  9402. todayStart = startOfDay(calendar.getNow());
  9403. todayEnd = addDays(todayStart, 1);
  9404. if (date < todayStart) {
  9405. classes.push('fc-past');
  9406. }
  9407. else if (date >= todayEnd) {
  9408. classes.push('fc-future');
  9409. }
  9410. else {
  9411. classes.push('fc-today');
  9412. if (noThemeHighlight !== true) {
  9413. classes.push(theme.getClass('today'));
  9414. }
  9415. }
  9416. }
  9417. return classes;
  9418. }
  9419. // given a function that resolves a result asynchronously.
  9420. // the function can either call passed-in success and failure callbacks,
  9421. // or it can return a promise.
  9422. // if you need to pass additional params to func, bind them first.
  9423. function unpromisify(func, success, failure) {
  9424. // guard against success/failure callbacks being called more than once
  9425. // and guard against a promise AND callback being used together.
  9426. var isResolved = false;
  9427. var wrappedSuccess = function () {
  9428. if (!isResolved) {
  9429. isResolved = true;
  9430. success.apply(this, arguments);
  9431. }
  9432. };
  9433. var wrappedFailure = function () {
  9434. if (!isResolved) {
  9435. isResolved = true;
  9436. if (failure) {
  9437. failure.apply(this, arguments);
  9438. }
  9439. }
  9440. };
  9441. var res = func(wrappedSuccess, wrappedFailure);
  9442. if (res && typeof res.then === 'function') {
  9443. res.then(wrappedSuccess, wrappedFailure);
  9444. }
  9445. }
  9446. var Mixin = /** @class */ (function () {
  9447. function Mixin() {
  9448. }
  9449. // mix into a CLASS
  9450. Mixin.mixInto = function (destClass) {
  9451. this.mixIntoObj(destClass.prototype);
  9452. };
  9453. // mix into ANY object
  9454. Mixin.mixIntoObj = function (destObj) {
  9455. var _this = this;
  9456. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  9457. if (!destObj[name]) { // if destination doesn't already define it
  9458. destObj[name] = _this.prototype[name];
  9459. }
  9460. });
  9461. };
  9462. /*
  9463. will override existing methods
  9464. TODO: remove! not used anymore
  9465. */
  9466. Mixin.mixOver = function (destClass) {
  9467. var _this = this;
  9468. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  9469. destClass.prototype[name] = _this.prototype[name];
  9470. });
  9471. };
  9472. return Mixin;
  9473. }());
  9474. /*
  9475. USAGE:
  9476. import { default as EmitterMixin, EmitterInterface } from './EmitterMixin'
  9477. in class:
  9478. on: EmitterInterface['on']
  9479. one: EmitterInterface['one']
  9480. off: EmitterInterface['off']
  9481. trigger: EmitterInterface['trigger']
  9482. triggerWith: EmitterInterface['triggerWith']
  9483. hasHandlers: EmitterInterface['hasHandlers']
  9484. after class:
  9485. EmitterMixin.mixInto(TheClass)
  9486. */
  9487. var EmitterMixin = /** @class */ (function (_super) {
  9488. __extends(EmitterMixin, _super);
  9489. function EmitterMixin() {
  9490. return _super !== null && _super.apply(this, arguments) || this;
  9491. }
  9492. EmitterMixin.prototype.on = function (type, handler) {
  9493. addToHash(this._handlers || (this._handlers = {}), type, handler);
  9494. return this; // for chaining
  9495. };
  9496. // todo: add comments
  9497. EmitterMixin.prototype.one = function (type, handler) {
  9498. addToHash(this._oneHandlers || (this._oneHandlers = {}), type, handler);
  9499. return this; // for chaining
  9500. };
  9501. EmitterMixin.prototype.off = function (type, handler) {
  9502. if (this._handlers) {
  9503. removeFromHash(this._handlers, type, handler);
  9504. }
  9505. if (this._oneHandlers) {
  9506. removeFromHash(this._oneHandlers, type, handler);
  9507. }
  9508. return this; // for chaining
  9509. };
  9510. EmitterMixin.prototype.trigger = function (type) {
  9511. var args = [];
  9512. for (var _i = 1; _i < arguments.length; _i++) {
  9513. args[_i - 1] = arguments[_i];
  9514. }
  9515. this.triggerWith(type, this, args);
  9516. return this; // for chaining
  9517. };
  9518. EmitterMixin.prototype.triggerWith = function (type, context, args) {
  9519. if (this._handlers) {
  9520. applyAll(this._handlers[type], context, args);
  9521. }
  9522. if (this._oneHandlers) {
  9523. applyAll(this._oneHandlers[type], context, args);
  9524. delete this._oneHandlers[type]; // will never fire again
  9525. }
  9526. return this; // for chaining
  9527. };
  9528. EmitterMixin.prototype.hasHandlers = function (type) {
  9529. return (this._handlers && this._handlers[type] && this._handlers[type].length) ||
  9530. (this._oneHandlers && this._oneHandlers[type] && this._oneHandlers[type].length);
  9531. };
  9532. return EmitterMixin;
  9533. }(Mixin));
  9534. function addToHash(hash, type, handler) {
  9535. (hash[type] || (hash[type] = []))
  9536. .push(handler);
  9537. }
  9538. function removeFromHash(hash, type, handler) {
  9539. if (handler) {
  9540. if (hash[type]) {
  9541. hash[type] = hash[type].filter(function (func) {
  9542. return func !== handler;
  9543. });
  9544. }
  9545. }
  9546. else {
  9547. delete hash[type]; // remove all handler funcs for this type
  9548. }
  9549. }
  9550. /*
  9551. Records offset information for a set of elements, relative to an origin element.
  9552. Can record the left/right OR the top/bottom OR both.
  9553. Provides methods for querying the cache by position.
  9554. */
  9555. var PositionCache = /** @class */ (function () {
  9556. function PositionCache(originEl, els, isHorizontal, isVertical) {
  9557. this.originEl = originEl;
  9558. this.els = els;
  9559. this.isHorizontal = isHorizontal;
  9560. this.isVertical = isVertical;
  9561. }
  9562. // Queries the els for coordinates and stores them.
  9563. // Call this method before using and of the get* methods below.
  9564. PositionCache.prototype.build = function () {
  9565. var originEl = this.originEl;
  9566. var originClientRect = this.originClientRect =
  9567. originEl.getBoundingClientRect(); // relative to viewport top-left
  9568. if (this.isHorizontal) {
  9569. this.buildElHorizontals(originClientRect.left);
  9570. }
  9571. if (this.isVertical) {
  9572. this.buildElVerticals(originClientRect.top);
  9573. }
  9574. };
  9575. // Populates the left/right internal coordinate arrays
  9576. PositionCache.prototype.buildElHorizontals = function (originClientLeft) {
  9577. var lefts = [];
  9578. var rights = [];
  9579. for (var _i = 0, _a = this.els; _i < _a.length; _i++) {
  9580. var el = _a[_i];
  9581. var rect = el.getBoundingClientRect();
  9582. lefts.push(rect.left - originClientLeft);
  9583. rights.push(rect.right - originClientLeft);
  9584. }
  9585. this.lefts = lefts;
  9586. this.rights = rights;
  9587. };
  9588. // Populates the top/bottom internal coordinate arrays
  9589. PositionCache.prototype.buildElVerticals = function (originClientTop) {
  9590. var tops = [];
  9591. var bottoms = [];
  9592. for (var _i = 0, _a = this.els; _i < _a.length; _i++) {
  9593. var el = _a[_i];
  9594. var rect = el.getBoundingClientRect();
  9595. tops.push(rect.top - originClientTop);
  9596. bottoms.push(rect.bottom - originClientTop);
  9597. }
  9598. this.tops = tops;
  9599. this.bottoms = bottoms;
  9600. };
  9601. // Given a left offset (from document left), returns the index of the el that it horizontally intersects.
  9602. // If no intersection is made, returns undefined.
  9603. PositionCache.prototype.leftToIndex = function (leftPosition) {
  9604. var lefts = this.lefts;
  9605. var rights = this.rights;
  9606. var len = lefts.length;
  9607. var i;
  9608. for (i = 0; i < len; i++) {
  9609. if (leftPosition >= lefts[i] && leftPosition < rights[i]) {
  9610. return i;
  9611. }
  9612. }
  9613. };
  9614. // Given a top offset (from document top), returns the index of the el that it vertically intersects.
  9615. // If no intersection is made, returns undefined.
  9616. PositionCache.prototype.topToIndex = function (topPosition) {
  9617. var tops = this.tops;
  9618. var bottoms = this.bottoms;
  9619. var len = tops.length;
  9620. var i;
  9621. for (i = 0; i < len; i++) {
  9622. if (topPosition >= tops[i] && topPosition < bottoms[i]) {
  9623. return i;
  9624. }
  9625. }
  9626. };
  9627. // Gets the width of the element at the given index
  9628. PositionCache.prototype.getWidth = function (leftIndex) {
  9629. return this.rights[leftIndex] - this.lefts[leftIndex];
  9630. };
  9631. // Gets the height of the element at the given index
  9632. PositionCache.prototype.getHeight = function (topIndex) {
  9633. return this.bottoms[topIndex] - this.tops[topIndex];
  9634. };
  9635. return PositionCache;
  9636. }());
  9637. /*
  9638. An object for getting/setting scroll-related information for an element.
  9639. Internally, this is done very differently for window versus DOM element,
  9640. so this object serves as a common interface.
  9641. */
  9642. var ScrollController = /** @class */ (function () {
  9643. function ScrollController() {
  9644. }
  9645. ScrollController.prototype.getMaxScrollTop = function () {
  9646. return this.getScrollHeight() - this.getClientHeight();
  9647. };
  9648. ScrollController.prototype.getMaxScrollLeft = function () {
  9649. return this.getScrollWidth() - this.getClientWidth();
  9650. };
  9651. ScrollController.prototype.canScrollVertically = function () {
  9652. return this.getMaxScrollTop() > 0;
  9653. };
  9654. ScrollController.prototype.canScrollHorizontally = function () {
  9655. return this.getMaxScrollLeft() > 0;
  9656. };
  9657. ScrollController.prototype.canScrollUp = function () {
  9658. return this.getScrollTop() > 0;
  9659. };
  9660. ScrollController.prototype.canScrollDown = function () {
  9661. return this.getScrollTop() < this.getMaxScrollTop();
  9662. };
  9663. ScrollController.prototype.canScrollLeft = function () {
  9664. return this.getScrollLeft() > 0;
  9665. };
  9666. ScrollController.prototype.canScrollRight = function () {
  9667. return this.getScrollLeft() < this.getMaxScrollLeft();
  9668. };
  9669. return ScrollController;
  9670. }());
  9671. var ElementScrollController = /** @class */ (function (_super) {
  9672. __extends(ElementScrollController, _super);
  9673. function ElementScrollController(el) {
  9674. var _this = _super.call(this) || this;
  9675. _this.el = el;
  9676. return _this;
  9677. }
  9678. ElementScrollController.prototype.getScrollTop = function () {
  9679. return this.el.scrollTop;
  9680. };
  9681. ElementScrollController.prototype.getScrollLeft = function () {
  9682. return this.el.scrollLeft;
  9683. };
  9684. ElementScrollController.prototype.setScrollTop = function (top) {
  9685. this.el.scrollTop = top;
  9686. };
  9687. ElementScrollController.prototype.setScrollLeft = function (left) {
  9688. this.el.scrollLeft = left;
  9689. };
  9690. ElementScrollController.prototype.getScrollWidth = function () {
  9691. return this.el.scrollWidth;
  9692. };
  9693. ElementScrollController.prototype.getScrollHeight = function () {
  9694. return this.el.scrollHeight;
  9695. };
  9696. ElementScrollController.prototype.getClientHeight = function () {
  9697. return this.el.clientHeight;
  9698. };
  9699. ElementScrollController.prototype.getClientWidth = function () {
  9700. return this.el.clientWidth;
  9701. };
  9702. return ElementScrollController;
  9703. }(ScrollController));
  9704. var WindowScrollController = /** @class */ (function (_super) {
  9705. __extends(WindowScrollController, _super);
  9706. function WindowScrollController() {
  9707. return _super !== null && _super.apply(this, arguments) || this;
  9708. }
  9709. WindowScrollController.prototype.getScrollTop = function () {
  9710. return window.pageYOffset;
  9711. };
  9712. WindowScrollController.prototype.getScrollLeft = function () {
  9713. return window.pageXOffset;
  9714. };
  9715. WindowScrollController.prototype.setScrollTop = function (n) {
  9716. window.scroll(window.pageXOffset, n);
  9717. };
  9718. WindowScrollController.prototype.setScrollLeft = function (n) {
  9719. window.scroll(n, window.pageYOffset);
  9720. };
  9721. WindowScrollController.prototype.getScrollWidth = function () {
  9722. return document.documentElement.scrollWidth;
  9723. };
  9724. WindowScrollController.prototype.getScrollHeight = function () {
  9725. return document.documentElement.scrollHeight;
  9726. };
  9727. WindowScrollController.prototype.getClientHeight = function () {
  9728. return document.documentElement.clientHeight;
  9729. };
  9730. WindowScrollController.prototype.getClientWidth = function () {
  9731. return document.documentElement.clientWidth;
  9732. };
  9733. return WindowScrollController;
  9734. }(ScrollController));
  9735. /*
  9736. Embodies a div that has potential scrollbars
  9737. */
  9738. var ScrollComponent = /** @class */ (function (_super) {
  9739. __extends(ScrollComponent, _super);
  9740. function ScrollComponent(overflowX, overflowY) {
  9741. var _this = _super.call(this, createElement('div', {
  9742. className: 'fc-scroller'
  9743. })) || this;
  9744. _this.overflowX = overflowX;
  9745. _this.overflowY = overflowY;
  9746. _this.applyOverflow();
  9747. return _this;
  9748. }
  9749. // sets to natural height, unlocks overflow
  9750. ScrollComponent.prototype.clear = function () {
  9751. this.setHeight('auto');
  9752. this.applyOverflow();
  9753. };
  9754. ScrollComponent.prototype.destroy = function () {
  9755. removeElement(this.el);
  9756. };
  9757. // Overflow
  9758. // -----------------------------------------------------------------------------------------------------------------
  9759. ScrollComponent.prototype.applyOverflow = function () {
  9760. applyStyle(this.el, {
  9761. overflowX: this.overflowX,
  9762. overflowY: this.overflowY
  9763. });
  9764. };
  9765. // Causes any 'auto' overflow values to resolves to 'scroll' or 'hidden'.
  9766. // Useful for preserving scrollbar widths regardless of future resizes.
  9767. // Can pass in scrollbarWidths for optimization.
  9768. ScrollComponent.prototype.lockOverflow = function (scrollbarWidths) {
  9769. var overflowX = this.overflowX;
  9770. var overflowY = this.overflowY;
  9771. scrollbarWidths = scrollbarWidths || this.getScrollbarWidths();
  9772. if (overflowX === 'auto') {
  9773. overflowX = (scrollbarWidths.bottom || // horizontal scrollbars?
  9774. this.canScrollHorizontally() // OR scrolling pane with massless scrollbars?
  9775. ) ? 'scroll' : 'hidden';
  9776. }
  9777. if (overflowY === 'auto') {
  9778. overflowY = (scrollbarWidths.left || scrollbarWidths.right || // horizontal scrollbars?
  9779. this.canScrollVertically() // OR scrolling pane with massless scrollbars?
  9780. ) ? 'scroll' : 'hidden';
  9781. }
  9782. applyStyle(this.el, { overflowX: overflowX, overflowY: overflowY });
  9783. };
  9784. ScrollComponent.prototype.setHeight = function (height) {
  9785. applyStyleProp(this.el, 'height', height);
  9786. };
  9787. ScrollComponent.prototype.getScrollbarWidths = function () {
  9788. var edges = computeEdges(this.el);
  9789. return {
  9790. left: edges.scrollbarLeft,
  9791. right: edges.scrollbarRight,
  9792. bottom: edges.scrollbarBottom
  9793. };
  9794. };
  9795. return ScrollComponent;
  9796. }(ElementScrollController));
  9797. var Theme = /** @class */ (function () {
  9798. function Theme(calendarOptions) {
  9799. this.calendarOptions = calendarOptions;
  9800. this.processIconOverride();
  9801. }
  9802. Theme.prototype.processIconOverride = function () {
  9803. if (this.iconOverrideOption) {
  9804. this.setIconOverride(this.calendarOptions[this.iconOverrideOption]);
  9805. }
  9806. };
  9807. Theme.prototype.setIconOverride = function (iconOverrideHash) {
  9808. var iconClassesCopy;
  9809. var buttonName;
  9810. if (typeof iconOverrideHash === 'object' && iconOverrideHash) { // non-null object
  9811. iconClassesCopy = __assign({}, this.iconClasses);
  9812. for (buttonName in iconOverrideHash) {
  9813. iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]);
  9814. }
  9815. this.iconClasses = iconClassesCopy;
  9816. }
  9817. else if (iconOverrideHash === false) {
  9818. this.iconClasses = {};
  9819. }
  9820. };
  9821. Theme.prototype.applyIconOverridePrefix = function (className) {
  9822. var prefix = this.iconOverridePrefix;
  9823. if (prefix && className.indexOf(prefix) !== 0) { // if not already present
  9824. className = prefix + className;
  9825. }
  9826. return className;
  9827. };
  9828. Theme.prototype.getClass = function (key) {
  9829. return this.classes[key] || '';
  9830. };
  9831. Theme.prototype.getIconClass = function (buttonName) {
  9832. var className = this.iconClasses[buttonName];
  9833. if (className) {
  9834. return this.baseIconClass + ' ' + className;
  9835. }
  9836. return '';
  9837. };
  9838. Theme.prototype.getCustomButtonIconClass = function (customButtonProps) {
  9839. var className;
  9840. if (this.iconOverrideCustomButtonOption) {
  9841. className = customButtonProps[this.iconOverrideCustomButtonOption];
  9842. if (className) {
  9843. return this.baseIconClass + ' ' + this.applyIconOverridePrefix(className);
  9844. }
  9845. }
  9846. return '';
  9847. };
  9848. return Theme;
  9849. }());
  9850. Theme.prototype.classes = {};
  9851. Theme.prototype.iconClasses = {};
  9852. Theme.prototype.baseIconClass = '';
  9853. Theme.prototype.iconOverridePrefix = '';
  9854. var guid = 0;
  9855. var ComponentContext = /** @class */ (function () {
  9856. function ComponentContext(calendar, theme, dateEnv, options, view) {
  9857. this.calendar = calendar;
  9858. this.theme = theme;
  9859. this.dateEnv = dateEnv;
  9860. this.options = options;
  9861. this.view = view;
  9862. this.isRtl = options.dir === 'rtl';
  9863. this.eventOrderSpecs = parseFieldSpecs(options.eventOrder);
  9864. this.nextDayThreshold = createDuration(options.nextDayThreshold);
  9865. }
  9866. ComponentContext.prototype.extend = function (options, view) {
  9867. return new ComponentContext(this.calendar, this.theme, this.dateEnv, options || this.options, view || this.view);
  9868. };
  9869. return ComponentContext;
  9870. }());
  9871. var Component = /** @class */ (function () {
  9872. function Component() {
  9873. this.uid = String(guid++);
  9874. }
  9875. Component.addEqualityFuncs = function (newFuncs) {
  9876. this.prototype.equalityFuncs = __assign({}, this.prototype.equalityFuncs, newFuncs);
  9877. };
  9878. Component.prototype.receiveProps = function (props, context) {
  9879. var oldContext = this.context;
  9880. this.context = context;
  9881. if (!oldContext) {
  9882. this.firstContext(context);
  9883. }
  9884. var _a = recycleProps(this.props || {}, props, this.equalityFuncs), anyChanges = _a.anyChanges, comboProps = _a.comboProps;
  9885. this.props = comboProps;
  9886. if (anyChanges) {
  9887. if (oldContext) {
  9888. this.beforeUpdate();
  9889. }
  9890. this.render(comboProps, context);
  9891. if (oldContext) {
  9892. this.afterUpdate();
  9893. }
  9894. }
  9895. };
  9896. Component.prototype.render = function (props, context) {
  9897. };
  9898. Component.prototype.firstContext = function (context) {
  9899. };
  9900. Component.prototype.beforeUpdate = function () {
  9901. };
  9902. Component.prototype.afterUpdate = function () {
  9903. };
  9904. // after destroy is called, this component won't ever be used again
  9905. Component.prototype.destroy = function () {
  9906. };
  9907. return Component;
  9908. }());
  9909. Component.prototype.equalityFuncs = {};
  9910. /*
  9911. Reuses old values when equal. If anything is unequal, returns newProps as-is.
  9912. Great for PureComponent, but won't be feasible with React, so just eliminate and use React's DOM diffing.
  9913. */
  9914. function recycleProps(oldProps, newProps, equalityFuncs) {
  9915. var comboProps = {}; // some old, some new
  9916. var anyChanges = false;
  9917. for (var key in newProps) {
  9918. if (key in oldProps && (oldProps[key] === newProps[key] ||
  9919. (equalityFuncs[key] && equalityFuncs[key](oldProps[key], newProps[key])))) {
  9920. // equal to old? use old prop
  9921. comboProps[key] = oldProps[key];
  9922. }
  9923. else {
  9924. comboProps[key] = newProps[key];
  9925. anyChanges = true;
  9926. }
  9927. }
  9928. for (var key in oldProps) {
  9929. if (!(key in newProps)) {
  9930. anyChanges = true;
  9931. break;
  9932. }
  9933. }
  9934. return { anyChanges: anyChanges, comboProps: comboProps };
  9935. }
  9936. /*
  9937. PURPOSES:
  9938. - hook up to fg, fill, and mirror renderers
  9939. - interface for dragging and hits
  9940. */
  9941. var DateComponent = /** @class */ (function (_super) {
  9942. __extends(DateComponent, _super);
  9943. function DateComponent(el) {
  9944. var _this = _super.call(this) || this;
  9945. _this.el = el;
  9946. return _this;
  9947. }
  9948. DateComponent.prototype.destroy = function () {
  9949. _super.prototype.destroy.call(this);
  9950. removeElement(this.el);
  9951. };
  9952. // Hit System
  9953. // -----------------------------------------------------------------------------------------------------------------
  9954. DateComponent.prototype.buildPositionCaches = function () {
  9955. };
  9956. DateComponent.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) {
  9957. return null; // this should be abstract
  9958. };
  9959. // Validation
  9960. // -----------------------------------------------------------------------------------------------------------------
  9961. DateComponent.prototype.isInteractionValid = function (interaction) {
  9962. var calendar = this.context.calendar;
  9963. var dateProfile = this.props.dateProfile; // HACK
  9964. var instances = interaction.mutatedEvents.instances;
  9965. if (dateProfile) { // HACK for DayTile
  9966. for (var instanceId in instances) {
  9967. if (!rangeContainsRange(dateProfile.validRange, instances[instanceId].range)) {
  9968. return false;
  9969. }
  9970. }
  9971. }
  9972. return isInteractionValid(interaction, calendar);
  9973. };
  9974. DateComponent.prototype.isDateSelectionValid = function (selection) {
  9975. var calendar = this.context.calendar;
  9976. var dateProfile = this.props.dateProfile; // HACK
  9977. if (dateProfile && // HACK for DayTile
  9978. !rangeContainsRange(dateProfile.validRange, selection.range)) {
  9979. return false;
  9980. }
  9981. return isDateSelectionValid(selection, calendar);
  9982. };
  9983. // Pointer Interaction Utils
  9984. // -----------------------------------------------------------------------------------------------------------------
  9985. DateComponent.prototype.isValidSegDownEl = function (el) {
  9986. return !this.props.eventDrag && // HACK
  9987. !this.props.eventResize && // HACK
  9988. !elementClosest(el, '.fc-mirror') &&
  9989. (this.isPopover() || !this.isInPopover(el));
  9990. // ^above line ensures we don't detect a seg interaction within a nested component.
  9991. // it's a HACK because it only supports a popover as the nested component.
  9992. };
  9993. DateComponent.prototype.isValidDateDownEl = function (el) {
  9994. var segEl = elementClosest(el, this.fgSegSelector);
  9995. return (!segEl || segEl.classList.contains('fc-mirror')) &&
  9996. !elementClosest(el, '.fc-more') && // a "more.." link
  9997. !elementClosest(el, 'a[data-goto]') && // a clickable nav link
  9998. !this.isInPopover(el);
  9999. };
  10000. DateComponent.prototype.isPopover = function () {
  10001. return this.el.classList.contains('fc-popover');
  10002. };
  10003. DateComponent.prototype.isInPopover = function (el) {
  10004. return Boolean(elementClosest(el, '.fc-popover'));
  10005. };
  10006. return DateComponent;
  10007. }(Component));
  10008. DateComponent.prototype.fgSegSelector = '.fc-event-container > *';
  10009. DateComponent.prototype.bgSegSelector = '.fc-bgevent:not(.fc-nonbusiness)';
  10010. var uid$1 = 0;
  10011. function createPlugin(input) {
  10012. return {
  10013. id: String(uid$1++),
  10014. deps: input.deps || [],
  10015. reducers: input.reducers || [],
  10016. eventDefParsers: input.eventDefParsers || [],
  10017. isDraggableTransformers: input.isDraggableTransformers || [],
  10018. eventDragMutationMassagers: input.eventDragMutationMassagers || [],
  10019. eventDefMutationAppliers: input.eventDefMutationAppliers || [],
  10020. dateSelectionTransformers: input.dateSelectionTransformers || [],
  10021. datePointTransforms: input.datePointTransforms || [],
  10022. dateSpanTransforms: input.dateSpanTransforms || [],
  10023. views: input.views || {},
  10024. viewPropsTransformers: input.viewPropsTransformers || [],
  10025. isPropsValid: input.isPropsValid || null,
  10026. externalDefTransforms: input.externalDefTransforms || [],
  10027. eventResizeJoinTransforms: input.eventResizeJoinTransforms || [],
  10028. viewContainerModifiers: input.viewContainerModifiers || [],
  10029. eventDropTransformers: input.eventDropTransformers || [],
  10030. componentInteractions: input.componentInteractions || [],
  10031. calendarInteractions: input.calendarInteractions || [],
  10032. themeClasses: input.themeClasses || {},
  10033. eventSourceDefs: input.eventSourceDefs || [],
  10034. cmdFormatter: input.cmdFormatter,
  10035. recurringTypes: input.recurringTypes || [],
  10036. namedTimeZonedImpl: input.namedTimeZonedImpl,
  10037. defaultView: input.defaultView || '',
  10038. elementDraggingImpl: input.elementDraggingImpl,
  10039. optionChangeHandlers: input.optionChangeHandlers || {}
  10040. };
  10041. }
  10042. var PluginSystem = /** @class */ (function () {
  10043. function PluginSystem() {
  10044. this.hooks = {
  10045. reducers: [],
  10046. eventDefParsers: [],
  10047. isDraggableTransformers: [],
  10048. eventDragMutationMassagers: [],
  10049. eventDefMutationAppliers: [],
  10050. dateSelectionTransformers: [],
  10051. datePointTransforms: [],
  10052. dateSpanTransforms: [],
  10053. views: {},
  10054. viewPropsTransformers: [],
  10055. isPropsValid: null,
  10056. externalDefTransforms: [],
  10057. eventResizeJoinTransforms: [],
  10058. viewContainerModifiers: [],
  10059. eventDropTransformers: [],
  10060. componentInteractions: [],
  10061. calendarInteractions: [],
  10062. themeClasses: {},
  10063. eventSourceDefs: [],
  10064. cmdFormatter: null,
  10065. recurringTypes: [],
  10066. namedTimeZonedImpl: null,
  10067. defaultView: '',
  10068. elementDraggingImpl: null,
  10069. optionChangeHandlers: {}
  10070. };
  10071. this.addedHash = {};
  10072. }
  10073. PluginSystem.prototype.add = function (plugin) {
  10074. if (!this.addedHash[plugin.id]) {
  10075. this.addedHash[plugin.id] = true;
  10076. for (var _i = 0, _a = plugin.deps; _i < _a.length; _i++) {
  10077. var dep = _a[_i];
  10078. this.add(dep);
  10079. }
  10080. this.hooks = combineHooks(this.hooks, plugin);
  10081. }
  10082. };
  10083. return PluginSystem;
  10084. }());
  10085. function combineHooks(hooks0, hooks1) {
  10086. return {
  10087. reducers: hooks0.reducers.concat(hooks1.reducers),
  10088. eventDefParsers: hooks0.eventDefParsers.concat(hooks1.eventDefParsers),
  10089. isDraggableTransformers: hooks0.isDraggableTransformers.concat(hooks1.isDraggableTransformers),
  10090. eventDragMutationMassagers: hooks0.eventDragMutationMassagers.concat(hooks1.eventDragMutationMassagers),
  10091. eventDefMutationAppliers: hooks0.eventDefMutationAppliers.concat(hooks1.eventDefMutationAppliers),
  10092. dateSelectionTransformers: hooks0.dateSelectionTransformers.concat(hooks1.dateSelectionTransformers),
  10093. datePointTransforms: hooks0.datePointTransforms.concat(hooks1.datePointTransforms),
  10094. dateSpanTransforms: hooks0.dateSpanTransforms.concat(hooks1.dateSpanTransforms),
  10095. views: __assign({}, hooks0.views, hooks1.views),
  10096. viewPropsTransformers: hooks0.viewPropsTransformers.concat(hooks1.viewPropsTransformers),
  10097. isPropsValid: hooks1.isPropsValid || hooks0.isPropsValid,
  10098. externalDefTransforms: hooks0.externalDefTransforms.concat(hooks1.externalDefTransforms),
  10099. eventResizeJoinTransforms: hooks0.eventResizeJoinTransforms.concat(hooks1.eventResizeJoinTransforms),
  10100. viewContainerModifiers: hooks0.viewContainerModifiers.concat(hooks1.viewContainerModifiers),
  10101. eventDropTransformers: hooks0.eventDropTransformers.concat(hooks1.eventDropTransformers),
  10102. calendarInteractions: hooks0.calendarInteractions.concat(hooks1.calendarInteractions),
  10103. componentInteractions: hooks0.componentInteractions.concat(hooks1.componentInteractions),
  10104. themeClasses: __assign({}, hooks0.themeClasses, hooks1.themeClasses),
  10105. eventSourceDefs: hooks0.eventSourceDefs.concat(hooks1.eventSourceDefs),
  10106. cmdFormatter: hooks1.cmdFormatter || hooks0.cmdFormatter,
  10107. recurringTypes: hooks0.recurringTypes.concat(hooks1.recurringTypes),
  10108. namedTimeZonedImpl: hooks1.namedTimeZonedImpl || hooks0.namedTimeZonedImpl,
  10109. defaultView: hooks0.defaultView || hooks1.defaultView,
  10110. elementDraggingImpl: hooks0.elementDraggingImpl || hooks1.elementDraggingImpl,
  10111. optionChangeHandlers: __assign({}, hooks0.optionChangeHandlers, hooks1.optionChangeHandlers)
  10112. };
  10113. }
  10114. var eventSourceDef = {
  10115. ignoreRange: true,
  10116. parseMeta: function (raw) {
  10117. if (Array.isArray(raw)) { // short form
  10118. return raw;
  10119. }
  10120. else if (Array.isArray(raw.events)) {
  10121. return raw.events;
  10122. }
  10123. return null;
  10124. },
  10125. fetch: function (arg, success) {
  10126. success({
  10127. rawEvents: arg.eventSource.meta
  10128. });
  10129. }
  10130. };
  10131. var ArrayEventSourcePlugin = createPlugin({
  10132. eventSourceDefs: [eventSourceDef]
  10133. });
  10134. var eventSourceDef$1 = {
  10135. parseMeta: function (raw) {
  10136. if (typeof raw === 'function') { // short form
  10137. return raw;
  10138. }
  10139. else if (typeof raw.events === 'function') {
  10140. return raw.events;
  10141. }
  10142. return null;
  10143. },
  10144. fetch: function (arg, success, failure) {
  10145. var dateEnv = arg.calendar.dateEnv;
  10146. var func = arg.eventSource.meta;
  10147. unpromisify(func.bind(null, {
  10148. start: dateEnv.toDate(arg.range.start),
  10149. end: dateEnv.toDate(arg.range.end),
  10150. startStr: dateEnv.formatIso(arg.range.start),
  10151. endStr: dateEnv.formatIso(arg.range.end),
  10152. timeZone: dateEnv.timeZone
  10153. }), function (rawEvents) {
  10154. success({ rawEvents: rawEvents }); // needs an object response
  10155. }, failure // send errorObj directly to failure callback
  10156. );
  10157. }
  10158. };
  10159. var FuncEventSourcePlugin = createPlugin({
  10160. eventSourceDefs: [eventSourceDef$1]
  10161. });
  10162. function requestJson(method, url, params, successCallback, failureCallback) {
  10163. method = method.toUpperCase();
  10164. var body = null;
  10165. if (method === 'GET') {
  10166. url = injectQueryStringParams(url, params);
  10167. }
  10168. else {
  10169. body = encodeParams(params);
  10170. }
  10171. var xhr = new XMLHttpRequest();
  10172. xhr.open(method, url, true);
  10173. if (method !== 'GET') {
  10174. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  10175. }
  10176. xhr.onload = function () {
  10177. if (xhr.status >= 200 && xhr.status < 400) {
  10178. try {
  10179. var res = JSON.parse(xhr.responseText);
  10180. successCallback(res, xhr);
  10181. }
  10182. catch (err) {
  10183. failureCallback('Failure parsing JSON', xhr);
  10184. }
  10185. }
  10186. else {
  10187. failureCallback('Request failed', xhr);
  10188. }
  10189. };
  10190. xhr.onerror = function () {
  10191. failureCallback('Request failed', xhr);
  10192. };
  10193. xhr.send(body);
  10194. }
  10195. function injectQueryStringParams(url, params) {
  10196. return url +
  10197. (url.indexOf('?') === -1 ? '?' : '&') +
  10198. encodeParams(params);
  10199. }
  10200. function encodeParams(params) {
  10201. var parts = [];
  10202. for (var key in params) {
  10203. parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
  10204. }
  10205. return parts.join('&');
  10206. }
  10207. var eventSourceDef$2 = {
  10208. parseMeta: function (raw) {
  10209. if (typeof raw === 'string') { // short form
  10210. raw = { url: raw };
  10211. }
  10212. else if (!raw || typeof raw !== 'object' || !raw.url) {
  10213. return null;
  10214. }
  10215. return {
  10216. url: raw.url,
  10217. method: (raw.method || 'GET').toUpperCase(),
  10218. extraParams: raw.extraParams,
  10219. startParam: raw.startParam,
  10220. endParam: raw.endParam,
  10221. timeZoneParam: raw.timeZoneParam
  10222. };
  10223. },
  10224. fetch: function (arg, success, failure) {
  10225. var meta = arg.eventSource.meta;
  10226. var requestParams = buildRequestParams(meta, arg.range, arg.calendar);
  10227. requestJson(meta.method, meta.url, requestParams, function (rawEvents, xhr) {
  10228. success({ rawEvents: rawEvents, xhr: xhr });
  10229. }, function (errorMessage, xhr) {
  10230. failure({ message: errorMessage, xhr: xhr });
  10231. });
  10232. }
  10233. };
  10234. var JsonFeedEventSourcePlugin = createPlugin({
  10235. eventSourceDefs: [eventSourceDef$2]
  10236. });
  10237. function buildRequestParams(meta, range, calendar) {
  10238. var dateEnv = calendar.dateEnv;
  10239. var startParam;
  10240. var endParam;
  10241. var timeZoneParam;
  10242. var customRequestParams;
  10243. var params = {};
  10244. startParam = meta.startParam;
  10245. if (startParam == null) {
  10246. startParam = calendar.opt('startParam');
  10247. }
  10248. endParam = meta.endParam;
  10249. if (endParam == null) {
  10250. endParam = calendar.opt('endParam');
  10251. }
  10252. timeZoneParam = meta.timeZoneParam;
  10253. if (timeZoneParam == null) {
  10254. timeZoneParam = calendar.opt('timeZoneParam');
  10255. }
  10256. // retrieve any outbound GET/POST data from the options
  10257. if (typeof meta.extraParams === 'function') {
  10258. // supplied as a function that returns a key/value object
  10259. customRequestParams = meta.extraParams();
  10260. }
  10261. else {
  10262. // probably supplied as a straight key/value object
  10263. customRequestParams = meta.extraParams || {};
  10264. }
  10265. __assign(params, customRequestParams);
  10266. params[startParam] = dateEnv.formatIso(range.start);
  10267. params[endParam] = dateEnv.formatIso(range.end);
  10268. if (dateEnv.timeZone !== 'local') {
  10269. params[timeZoneParam] = dateEnv.timeZone;
  10270. }
  10271. return params;
  10272. }
  10273. var recurring = {
  10274. parse: function (rawEvent, leftoverProps, dateEnv) {
  10275. var createMarker = dateEnv.createMarker.bind(dateEnv);
  10276. var processors = {
  10277. daysOfWeek: null,
  10278. startTime: createDuration,
  10279. endTime: createDuration,
  10280. startRecur: createMarker,
  10281. endRecur: createMarker
  10282. };
  10283. var props = refineProps(rawEvent, processors, {}, leftoverProps);
  10284. var anyValid = false;
  10285. for (var propName in props) {
  10286. if (props[propName] != null) {
  10287. anyValid = true;
  10288. break;
  10289. }
  10290. }
  10291. if (anyValid) {
  10292. var duration = null;
  10293. if ('duration' in leftoverProps) {
  10294. duration = createDuration(leftoverProps.duration);
  10295. delete leftoverProps.duration;
  10296. }
  10297. if (!duration && props.startTime && props.endTime) {
  10298. duration = subtractDurations(props.endTime, props.startTime);
  10299. }
  10300. return {
  10301. allDayGuess: Boolean(!props.startTime && !props.endTime),
  10302. duration: duration,
  10303. typeData: props // doesn't need endTime anymore but oh well
  10304. };
  10305. }
  10306. return null;
  10307. },
  10308. expand: function (typeData, framingRange, dateEnv) {
  10309. var clippedFramingRange = intersectRanges(framingRange, { start: typeData.startRecur, end: typeData.endRecur });
  10310. if (clippedFramingRange) {
  10311. return expandRanges(typeData.daysOfWeek, typeData.startTime, clippedFramingRange, dateEnv);
  10312. }
  10313. else {
  10314. return [];
  10315. }
  10316. }
  10317. };
  10318. var SimpleRecurrencePlugin = createPlugin({
  10319. recurringTypes: [recurring]
  10320. });
  10321. function expandRanges(daysOfWeek, startTime, framingRange, dateEnv) {
  10322. var dowHash = daysOfWeek ? arrayToHash(daysOfWeek) : null;
  10323. var dayMarker = startOfDay(framingRange.start);
  10324. var endMarker = framingRange.end;
  10325. var instanceStarts = [];
  10326. while (dayMarker < endMarker) {
  10327. var instanceStart
  10328. // if everyday, or this particular day-of-week
  10329. = void 0;
  10330. // if everyday, or this particular day-of-week
  10331. if (!dowHash || dowHash[dayMarker.getUTCDay()]) {
  10332. if (startTime) {
  10333. instanceStart = dateEnv.add(dayMarker, startTime);
  10334. }
  10335. else {
  10336. instanceStart = dayMarker;
  10337. }
  10338. instanceStarts.push(instanceStart);
  10339. }
  10340. dayMarker = addDays(dayMarker, 1);
  10341. }
  10342. return instanceStarts;
  10343. }
  10344. var DefaultOptionChangeHandlers = createPlugin({
  10345. optionChangeHandlers: {
  10346. events: function (events, calendar, deepEqual) {
  10347. handleEventSources([events], calendar, deepEqual);
  10348. },
  10349. eventSources: handleEventSources,
  10350. plugins: handlePlugins
  10351. }
  10352. });
  10353. function handleEventSources(inputs, calendar, deepEqual) {
  10354. var unfoundSources = hashValuesToArray(calendar.state.eventSources);
  10355. var newInputs = [];
  10356. for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {
  10357. var input = inputs_1[_i];
  10358. var inputFound = false;
  10359. for (var i = 0; i < unfoundSources.length; i++) {
  10360. if (deepEqual(unfoundSources[i]._raw, input)) {
  10361. unfoundSources.splice(i, 1); // delete
  10362. inputFound = true;
  10363. break;
  10364. }
  10365. }
  10366. if (!inputFound) {
  10367. newInputs.push(input);
  10368. }
  10369. }
  10370. for (var _a = 0, unfoundSources_1 = unfoundSources; _a < unfoundSources_1.length; _a++) {
  10371. var unfoundSource = unfoundSources_1[_a];
  10372. calendar.dispatch({
  10373. type: 'REMOVE_EVENT_SOURCE',
  10374. sourceId: unfoundSource.sourceId
  10375. });
  10376. }
  10377. for (var _b = 0, newInputs_1 = newInputs; _b < newInputs_1.length; _b++) {
  10378. var newInput = newInputs_1[_b];
  10379. calendar.addEventSource(newInput);
  10380. }
  10381. }
  10382. // shortcoming: won't remove plugins
  10383. function handlePlugins(inputs, calendar) {
  10384. calendar.addPluginInputs(inputs); // will gracefully handle duplicates
  10385. }
  10386. var config = {}; // TODO: make these options
  10387. var globalDefaults = {
  10388. defaultRangeSeparator: ' - ',
  10389. titleRangeSeparator: ' \u2013 ',
  10390. defaultTimedEventDuration: '01:00:00',
  10391. defaultAllDayEventDuration: { day: 1 },
  10392. forceEventDuration: false,
  10393. nextDayThreshold: '00:00:00',
  10394. // display
  10395. columnHeader: true,
  10396. defaultView: '',
  10397. aspectRatio: 1.35,
  10398. header: {
  10399. left: 'title',
  10400. center: '',
  10401. right: 'today prev,next'
  10402. },
  10403. weekends: true,
  10404. weekNumbers: false,
  10405. weekNumberCalculation: 'local',
  10406. editable: false,
  10407. // nowIndicator: false,
  10408. scrollTime: '06:00:00',
  10409. minTime: '00:00:00',
  10410. maxTime: '24:00:00',
  10411. showNonCurrentDates: true,
  10412. // event ajax
  10413. lazyFetching: true,
  10414. startParam: 'start',
  10415. endParam: 'end',
  10416. timeZoneParam: 'timeZone',
  10417. timeZone: 'local',
  10418. // allDayDefault: undefined,
  10419. // locale
  10420. locales: [],
  10421. locale: '',
  10422. // dir: will get this from the default locale
  10423. // buttonIcons: null,
  10424. // allows setting a min-height to the event segment to prevent short events overlapping each other
  10425. timeGridEventMinHeight: 0,
  10426. themeSystem: 'standard',
  10427. // eventResizableFromStart: false,
  10428. dragRevertDuration: 500,
  10429. dragScroll: true,
  10430. allDayMaintainDuration: false,
  10431. // selectable: false,
  10432. unselectAuto: true,
  10433. // selectMinDistance: 0,
  10434. dropAccept: '*',
  10435. eventOrder: 'start,-duration,allDay,title',
  10436. // ^ if start tie, longer events go before shorter. final tie-breaker is title text
  10437. // rerenderDelay: null,
  10438. eventLimit: false,
  10439. eventLimitClick: 'popover',
  10440. dayPopoverFormat: { month: 'long', day: 'numeric', year: 'numeric' },
  10441. handleWindowResize: true,
  10442. windowResizeDelay: 100,
  10443. longPressDelay: 1000,
  10444. eventDragMinDistance: 5 // only applies to mouse
  10445. };
  10446. var rtlDefaults = {
  10447. header: {
  10448. left: 'next,prev today',
  10449. center: '',
  10450. right: 'title'
  10451. },
  10452. buttonIcons: {
  10453. // TODO: make RTL support the responibility of the theme
  10454. prev: 'fc-icon-chevron-right',
  10455. next: 'fc-icon-chevron-left',
  10456. prevYear: 'fc-icon-chevrons-right',
  10457. nextYear: 'fc-icon-chevrons-left'
  10458. }
  10459. };
  10460. var complexOptions = [
  10461. 'header',
  10462. 'footer',
  10463. 'buttonText',
  10464. 'buttonIcons'
  10465. ];
  10466. // Merges an array of option objects into a single object
  10467. function mergeOptions(optionObjs) {
  10468. return mergeProps(optionObjs, complexOptions);
  10469. }
  10470. // TODO: move this stuff to a "plugin"-related file...
  10471. var INTERNAL_PLUGINS = [
  10472. ArrayEventSourcePlugin,
  10473. FuncEventSourcePlugin,
  10474. JsonFeedEventSourcePlugin,
  10475. SimpleRecurrencePlugin,
  10476. DefaultOptionChangeHandlers
  10477. ];
  10478. function refinePluginDefs(pluginInputs) {
  10479. var plugins = [];
  10480. for (var _i = 0, pluginInputs_1 = pluginInputs; _i < pluginInputs_1.length; _i++) {
  10481. var pluginInput = pluginInputs_1[_i];
  10482. if (typeof pluginInput === 'string') {
  10483. var globalName = 'FullCalendar' + capitaliseFirstLetter(pluginInput);
  10484. if (!window[globalName]) {
  10485. console.warn('Plugin file not loaded for ' + pluginInput);
  10486. }
  10487. else {
  10488. plugins.push(window[globalName].default); // is an ES6 module
  10489. }
  10490. }
  10491. else {
  10492. plugins.push(pluginInput);
  10493. }
  10494. }
  10495. return INTERNAL_PLUGINS.concat(plugins);
  10496. }
  10497. var RAW_EN_LOCALE = {
  10498. code: 'en',
  10499. week: {
  10500. dow: 0,
  10501. doy: 4 // 4 days need to be within the year to be considered the first week
  10502. },
  10503. dir: 'ltr',
  10504. buttonText: {
  10505. prev: 'prev',
  10506. next: 'next',
  10507. prevYear: 'prev year',
  10508. nextYear: 'next year',
  10509. year: 'year',
  10510. today: 'today',
  10511. month: 'month',
  10512. week: 'week',
  10513. day: 'day',
  10514. list: 'list'
  10515. },
  10516. weekLabel: 'W',
  10517. allDayText: 'all-day',
  10518. eventLimitText: 'more',
  10519. noEventsMessage: 'No events to display'
  10520. };
  10521. function parseRawLocales(explicitRawLocales) {
  10522. var defaultCode = explicitRawLocales.length > 0 ? explicitRawLocales[0].code : 'en';
  10523. var globalArray = window['FullCalendarLocalesAll'] || []; // from locales-all.js
  10524. var globalObject = window['FullCalendarLocales'] || {}; // from locales/*.js. keys are meaningless
  10525. var allRawLocales = globalArray.concat(// globalArray is low prio
  10526. hashValuesToArray(globalObject), // medium prio
  10527. explicitRawLocales // highest prio
  10528. );
  10529. var rawLocaleMap = {
  10530. en: RAW_EN_LOCALE // necessary?
  10531. };
  10532. for (var _i = 0, allRawLocales_1 = allRawLocales; _i < allRawLocales_1.length; _i++) {
  10533. var rawLocale = allRawLocales_1[_i];
  10534. rawLocaleMap[rawLocale.code] = rawLocale;
  10535. }
  10536. return {
  10537. map: rawLocaleMap,
  10538. defaultCode: defaultCode
  10539. };
  10540. }
  10541. function buildLocale(inputSingular, available) {
  10542. if (typeof inputSingular === 'object' && !Array.isArray(inputSingular)) {
  10543. return parseLocale(inputSingular.code, [inputSingular.code], inputSingular);
  10544. }
  10545. else {
  10546. return queryLocale(inputSingular, available);
  10547. }
  10548. }
  10549. function queryLocale(codeArg, available) {
  10550. var codes = [].concat(codeArg || []); // will convert to array
  10551. var raw = queryRawLocale(codes, available) || RAW_EN_LOCALE;
  10552. return parseLocale(codeArg, codes, raw);
  10553. }
  10554. function queryRawLocale(codes, available) {
  10555. for (var i = 0; i < codes.length; i++) {
  10556. var parts = codes[i].toLocaleLowerCase().split('-');
  10557. for (var j = parts.length; j > 0; j--) {
  10558. var simpleId = parts.slice(0, j).join('-');
  10559. if (available[simpleId]) {
  10560. return available[simpleId];
  10561. }
  10562. }
  10563. }
  10564. return null;
  10565. }
  10566. function parseLocale(codeArg, codes, raw) {
  10567. var merged = mergeProps([RAW_EN_LOCALE, raw], ['buttonText']);
  10568. delete merged.code; // don't want this part of the options
  10569. var week = merged.week;
  10570. delete merged.week;
  10571. return {
  10572. codeArg: codeArg,
  10573. codes: codes,
  10574. week: week,
  10575. simpleNumberFormat: new Intl.NumberFormat(codeArg),
  10576. options: merged
  10577. };
  10578. }
  10579. var OptionsManager = /** @class */ (function () {
  10580. function OptionsManager(overrides) {
  10581. this.overrides = __assign({}, overrides); // make a copy
  10582. this.dynamicOverrides = {};
  10583. this.compute();
  10584. }
  10585. OptionsManager.prototype.mutate = function (updates, removals, isDynamic) {
  10586. if (!Object.keys(updates).length && !removals.length) {
  10587. return;
  10588. }
  10589. var overrideHash = isDynamic ? this.dynamicOverrides : this.overrides;
  10590. __assign(overrideHash, updates);
  10591. for (var _i = 0, removals_1 = removals; _i < removals_1.length; _i++) {
  10592. var propName = removals_1[_i];
  10593. delete overrideHash[propName];
  10594. }
  10595. this.compute();
  10596. };
  10597. // Computes the flattened options hash for the calendar and assigns to `this.options`.
  10598. // Assumes this.overrides and this.dynamicOverrides have already been initialized.
  10599. OptionsManager.prototype.compute = function () {
  10600. // TODO: not a very efficient system
  10601. var locales = firstDefined(// explicit locale option given?
  10602. this.dynamicOverrides.locales, this.overrides.locales, globalDefaults.locales);
  10603. var locale = firstDefined(// explicit locales option given?
  10604. this.dynamicOverrides.locale, this.overrides.locale, globalDefaults.locale);
  10605. var available = parseRawLocales(locales);
  10606. var localeDefaults = buildLocale(locale || available.defaultCode, available.map).options;
  10607. var dir = firstDefined(// based on options computed so far, is direction RTL?
  10608. this.dynamicOverrides.dir, this.overrides.dir, localeDefaults.dir);
  10609. var dirDefaults = dir === 'rtl' ? rtlDefaults : {};
  10610. this.dirDefaults = dirDefaults;
  10611. this.localeDefaults = localeDefaults;
  10612. this.computed = mergeOptions([
  10613. globalDefaults,
  10614. dirDefaults,
  10615. localeDefaults,
  10616. this.overrides,
  10617. this.dynamicOverrides
  10618. ]);
  10619. };
  10620. return OptionsManager;
  10621. }());
  10622. var calendarSystemClassMap = {};
  10623. function registerCalendarSystem(name, theClass) {
  10624. calendarSystemClassMap[name] = theClass;
  10625. }
  10626. function createCalendarSystem(name) {
  10627. return new calendarSystemClassMap[name]();
  10628. }
  10629. var GregorianCalendarSystem = /** @class */ (function () {
  10630. function GregorianCalendarSystem() {
  10631. }
  10632. GregorianCalendarSystem.prototype.getMarkerYear = function (d) {
  10633. return d.getUTCFullYear();
  10634. };
  10635. GregorianCalendarSystem.prototype.getMarkerMonth = function (d) {
  10636. return d.getUTCMonth();
  10637. };
  10638. GregorianCalendarSystem.prototype.getMarkerDay = function (d) {
  10639. return d.getUTCDate();
  10640. };
  10641. GregorianCalendarSystem.prototype.arrayToMarker = function (arr) {
  10642. return arrayToUtcDate(arr);
  10643. };
  10644. GregorianCalendarSystem.prototype.markerToArray = function (marker) {
  10645. return dateToUtcArray(marker);
  10646. };
  10647. return GregorianCalendarSystem;
  10648. }());
  10649. registerCalendarSystem('gregory', GregorianCalendarSystem);
  10650. var ISO_RE = /^\s*(\d{4})(-(\d{2})(-(\d{2})([T ](\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/;
  10651. function parse(str) {
  10652. var m = ISO_RE.exec(str);
  10653. if (m) {
  10654. 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));
  10655. if (isValidDate(marker)) {
  10656. var timeZoneOffset = null;
  10657. if (m[13]) {
  10658. timeZoneOffset = (m[15] === '-' ? -1 : 1) * (Number(m[16] || 0) * 60 +
  10659. Number(m[18] || 0));
  10660. }
  10661. return {
  10662. marker: marker,
  10663. isTimeUnspecified: !m[6],
  10664. timeZoneOffset: timeZoneOffset
  10665. };
  10666. }
  10667. }
  10668. return null;
  10669. }
  10670. var DateEnv = /** @class */ (function () {
  10671. function DateEnv(settings) {
  10672. var timeZone = this.timeZone = settings.timeZone;
  10673. var isNamedTimeZone = timeZone !== 'local' && timeZone !== 'UTC';
  10674. if (settings.namedTimeZoneImpl && isNamedTimeZone) {
  10675. this.namedTimeZoneImpl = new settings.namedTimeZoneImpl(timeZone);
  10676. }
  10677. this.canComputeOffset = Boolean(!isNamedTimeZone || this.namedTimeZoneImpl);
  10678. this.calendarSystem = createCalendarSystem(settings.calendarSystem);
  10679. this.locale = settings.locale;
  10680. this.weekDow = settings.locale.week.dow;
  10681. this.weekDoy = settings.locale.week.doy;
  10682. if (settings.weekNumberCalculation === 'ISO') {
  10683. this.weekDow = 1;
  10684. this.weekDoy = 4;
  10685. }
  10686. if (typeof settings.firstDay === 'number') {
  10687. this.weekDow = settings.firstDay;
  10688. }
  10689. if (typeof settings.weekNumberCalculation === 'function') {
  10690. this.weekNumberFunc = settings.weekNumberCalculation;
  10691. }
  10692. this.weekLabel = settings.weekLabel != null ? settings.weekLabel : settings.locale.options.weekLabel;
  10693. this.cmdFormatter = settings.cmdFormatter;
  10694. }
  10695. // Creating / Parsing
  10696. DateEnv.prototype.createMarker = function (input) {
  10697. var meta = this.createMarkerMeta(input);
  10698. if (meta === null) {
  10699. return null;
  10700. }
  10701. return meta.marker;
  10702. };
  10703. DateEnv.prototype.createNowMarker = function () {
  10704. if (this.canComputeOffset) {
  10705. return this.timestampToMarker(new Date().valueOf());
  10706. }
  10707. else {
  10708. // if we can't compute the current date val for a timezone,
  10709. // better to give the current local date vals than UTC
  10710. return arrayToUtcDate(dateToLocalArray(new Date()));
  10711. }
  10712. };
  10713. DateEnv.prototype.createMarkerMeta = function (input) {
  10714. if (typeof input === 'string') {
  10715. return this.parse(input);
  10716. }
  10717. var marker = null;
  10718. if (typeof input === 'number') {
  10719. marker = this.timestampToMarker(input);
  10720. }
  10721. else if (input instanceof Date) {
  10722. input = input.valueOf();
  10723. if (!isNaN(input)) {
  10724. marker = this.timestampToMarker(input);
  10725. }
  10726. }
  10727. else if (Array.isArray(input)) {
  10728. marker = arrayToUtcDate(input);
  10729. }
  10730. if (marker === null || !isValidDate(marker)) {
  10731. return null;
  10732. }
  10733. return { marker: marker, isTimeUnspecified: false, forcedTzo: null };
  10734. };
  10735. DateEnv.prototype.parse = function (s) {
  10736. var parts = parse(s);
  10737. if (parts === null) {
  10738. return null;
  10739. }
  10740. var marker = parts.marker;
  10741. var forcedTzo = null;
  10742. if (parts.timeZoneOffset !== null) {
  10743. if (this.canComputeOffset) {
  10744. marker = this.timestampToMarker(marker.valueOf() - parts.timeZoneOffset * 60 * 1000);
  10745. }
  10746. else {
  10747. forcedTzo = parts.timeZoneOffset;
  10748. }
  10749. }
  10750. return { marker: marker, isTimeUnspecified: parts.isTimeUnspecified, forcedTzo: forcedTzo };
  10751. };
  10752. // Accessors
  10753. DateEnv.prototype.getYear = function (marker) {
  10754. return this.calendarSystem.getMarkerYear(marker);
  10755. };
  10756. DateEnv.prototype.getMonth = function (marker) {
  10757. return this.calendarSystem.getMarkerMonth(marker);
  10758. };
  10759. // Adding / Subtracting
  10760. DateEnv.prototype.add = function (marker, dur) {
  10761. var a = this.calendarSystem.markerToArray(marker);
  10762. a[0] += dur.years;
  10763. a[1] += dur.months;
  10764. a[2] += dur.days;
  10765. a[6] += dur.milliseconds;
  10766. return this.calendarSystem.arrayToMarker(a);
  10767. };
  10768. DateEnv.prototype.subtract = function (marker, dur) {
  10769. var a = this.calendarSystem.markerToArray(marker);
  10770. a[0] -= dur.years;
  10771. a[1] -= dur.months;
  10772. a[2] -= dur.days;
  10773. a[6] -= dur.milliseconds;
  10774. return this.calendarSystem.arrayToMarker(a);
  10775. };
  10776. DateEnv.prototype.addYears = function (marker, n) {
  10777. var a = this.calendarSystem.markerToArray(marker);
  10778. a[0] += n;
  10779. return this.calendarSystem.arrayToMarker(a);
  10780. };
  10781. DateEnv.prototype.addMonths = function (marker, n) {
  10782. var a = this.calendarSystem.markerToArray(marker);
  10783. a[1] += n;
  10784. return this.calendarSystem.arrayToMarker(a);
  10785. };
  10786. // Diffing Whole Units
  10787. DateEnv.prototype.diffWholeYears = function (m0, m1) {
  10788. var calendarSystem = this.calendarSystem;
  10789. if (timeAsMs(m0) === timeAsMs(m1) &&
  10790. calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1) &&
  10791. calendarSystem.getMarkerMonth(m0) === calendarSystem.getMarkerMonth(m1)) {
  10792. return calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0);
  10793. }
  10794. return null;
  10795. };
  10796. DateEnv.prototype.diffWholeMonths = function (m0, m1) {
  10797. var calendarSystem = this.calendarSystem;
  10798. if (timeAsMs(m0) === timeAsMs(m1) &&
  10799. calendarSystem.getMarkerDay(m0) === calendarSystem.getMarkerDay(m1)) {
  10800. return (calendarSystem.getMarkerMonth(m1) - calendarSystem.getMarkerMonth(m0)) +
  10801. (calendarSystem.getMarkerYear(m1) - calendarSystem.getMarkerYear(m0)) * 12;
  10802. }
  10803. return null;
  10804. };
  10805. // Range / Duration
  10806. DateEnv.prototype.greatestWholeUnit = function (m0, m1) {
  10807. var n = this.diffWholeYears(m0, m1);
  10808. if (n !== null) {
  10809. return { unit: 'year', value: n };
  10810. }
  10811. n = this.diffWholeMonths(m0, m1);
  10812. if (n !== null) {
  10813. return { unit: 'month', value: n };
  10814. }
  10815. n = diffWholeWeeks(m0, m1);
  10816. if (n !== null) {
  10817. return { unit: 'week', value: n };
  10818. }
  10819. n = diffWholeDays(m0, m1);
  10820. if (n !== null) {
  10821. return { unit: 'day', value: n };
  10822. }
  10823. n = diffHours(m0, m1);
  10824. if (isInt(n)) {
  10825. return { unit: 'hour', value: n };
  10826. }
  10827. n = diffMinutes(m0, m1);
  10828. if (isInt(n)) {
  10829. return { unit: 'minute', value: n };
  10830. }
  10831. n = diffSeconds(m0, m1);
  10832. if (isInt(n)) {
  10833. return { unit: 'second', value: n };
  10834. }
  10835. return { unit: 'millisecond', value: m1.valueOf() - m0.valueOf() };
  10836. };
  10837. DateEnv.prototype.countDurationsBetween = function (m0, m1, d) {
  10838. // TODO: can use greatestWholeUnit
  10839. var diff;
  10840. if (d.years) {
  10841. diff = this.diffWholeYears(m0, m1);
  10842. if (diff !== null) {
  10843. return diff / asRoughYears(d);
  10844. }
  10845. }
  10846. if (d.months) {
  10847. diff = this.diffWholeMonths(m0, m1);
  10848. if (diff !== null) {
  10849. return diff / asRoughMonths(d);
  10850. }
  10851. }
  10852. if (d.days) {
  10853. diff = diffWholeDays(m0, m1);
  10854. if (diff !== null) {
  10855. return diff / asRoughDays(d);
  10856. }
  10857. }
  10858. return (m1.valueOf() - m0.valueOf()) / asRoughMs(d);
  10859. };
  10860. // Start-Of
  10861. DateEnv.prototype.startOf = function (m, unit) {
  10862. if (unit === 'year') {
  10863. return this.startOfYear(m);
  10864. }
  10865. else if (unit === 'month') {
  10866. return this.startOfMonth(m);
  10867. }
  10868. else if (unit === 'week') {
  10869. return this.startOfWeek(m);
  10870. }
  10871. else if (unit === 'day') {
  10872. return startOfDay(m);
  10873. }
  10874. else if (unit === 'hour') {
  10875. return startOfHour(m);
  10876. }
  10877. else if (unit === 'minute') {
  10878. return startOfMinute(m);
  10879. }
  10880. else if (unit === 'second') {
  10881. return startOfSecond(m);
  10882. }
  10883. };
  10884. DateEnv.prototype.startOfYear = function (m) {
  10885. return this.calendarSystem.arrayToMarker([
  10886. this.calendarSystem.getMarkerYear(m)
  10887. ]);
  10888. };
  10889. DateEnv.prototype.startOfMonth = function (m) {
  10890. return this.calendarSystem.arrayToMarker([
  10891. this.calendarSystem.getMarkerYear(m),
  10892. this.calendarSystem.getMarkerMonth(m)
  10893. ]);
  10894. };
  10895. DateEnv.prototype.startOfWeek = function (m) {
  10896. return this.calendarSystem.arrayToMarker([
  10897. this.calendarSystem.getMarkerYear(m),
  10898. this.calendarSystem.getMarkerMonth(m),
  10899. m.getUTCDate() - ((m.getUTCDay() - this.weekDow + 7) % 7)
  10900. ]);
  10901. };
  10902. // Week Number
  10903. DateEnv.prototype.computeWeekNumber = function (marker) {
  10904. if (this.weekNumberFunc) {
  10905. return this.weekNumberFunc(this.toDate(marker));
  10906. }
  10907. else {
  10908. return weekOfYear(marker, this.weekDow, this.weekDoy);
  10909. }
  10910. };
  10911. // TODO: choke on timeZoneName: long
  10912. DateEnv.prototype.format = function (marker, formatter, dateOptions) {
  10913. if (dateOptions === void 0) { dateOptions = {}; }
  10914. return formatter.format({
  10915. marker: marker,
  10916. timeZoneOffset: dateOptions.forcedTzo != null ?
  10917. dateOptions.forcedTzo :
  10918. this.offsetForMarker(marker)
  10919. }, this);
  10920. };
  10921. DateEnv.prototype.formatRange = function (start, end, formatter, dateOptions) {
  10922. if (dateOptions === void 0) { dateOptions = {}; }
  10923. if (dateOptions.isEndExclusive) {
  10924. end = addMs(end, -1);
  10925. }
  10926. return formatter.formatRange({
  10927. marker: start,
  10928. timeZoneOffset: dateOptions.forcedStartTzo != null ?
  10929. dateOptions.forcedStartTzo :
  10930. this.offsetForMarker(start)
  10931. }, {
  10932. marker: end,
  10933. timeZoneOffset: dateOptions.forcedEndTzo != null ?
  10934. dateOptions.forcedEndTzo :
  10935. this.offsetForMarker(end)
  10936. }, this);
  10937. };
  10938. DateEnv.prototype.formatIso = function (marker, extraOptions) {
  10939. if (extraOptions === void 0) { extraOptions = {}; }
  10940. var timeZoneOffset = null;
  10941. if (!extraOptions.omitTimeZoneOffset) {
  10942. if (extraOptions.forcedTzo != null) {
  10943. timeZoneOffset = extraOptions.forcedTzo;
  10944. }
  10945. else {
  10946. timeZoneOffset = this.offsetForMarker(marker);
  10947. }
  10948. }
  10949. return buildIsoString(marker, timeZoneOffset, extraOptions.omitTime);
  10950. };
  10951. // TimeZone
  10952. DateEnv.prototype.timestampToMarker = function (ms) {
  10953. if (this.timeZone === 'local') {
  10954. return arrayToUtcDate(dateToLocalArray(new Date(ms)));
  10955. }
  10956. else if (this.timeZone === 'UTC' || !this.namedTimeZoneImpl) {
  10957. return new Date(ms);
  10958. }
  10959. else {
  10960. return arrayToUtcDate(this.namedTimeZoneImpl.timestampToArray(ms));
  10961. }
  10962. };
  10963. DateEnv.prototype.offsetForMarker = function (m) {
  10964. if (this.timeZone === 'local') {
  10965. return -arrayToLocalDate(dateToUtcArray(m)).getTimezoneOffset(); // convert "inverse" offset to "normal" offset
  10966. }
  10967. else if (this.timeZone === 'UTC') {
  10968. return 0;
  10969. }
  10970. else if (this.namedTimeZoneImpl) {
  10971. return this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m));
  10972. }
  10973. return null;
  10974. };
  10975. // Conversion
  10976. DateEnv.prototype.toDate = function (m, forcedTzo) {
  10977. if (this.timeZone === 'local') {
  10978. return arrayToLocalDate(dateToUtcArray(m));
  10979. }
  10980. else if (this.timeZone === 'UTC') {
  10981. return new Date(m.valueOf()); // make sure it's a copy
  10982. }
  10983. else if (!this.namedTimeZoneImpl) {
  10984. return new Date(m.valueOf() - (forcedTzo || 0));
  10985. }
  10986. else {
  10987. return new Date(m.valueOf() -
  10988. this.namedTimeZoneImpl.offsetForArray(dateToUtcArray(m)) * 1000 * 60 // convert minutes -> ms
  10989. );
  10990. }
  10991. };
  10992. return DateEnv;
  10993. }());
  10994. var SIMPLE_SOURCE_PROPS = {
  10995. id: String,
  10996. allDayDefault: Boolean,
  10997. eventDataTransform: Function,
  10998. success: Function,
  10999. failure: Function
  11000. };
  11001. var uid$2 = 0;
  11002. function doesSourceNeedRange(eventSource, calendar) {
  11003. var defs = calendar.pluginSystem.hooks.eventSourceDefs;
  11004. return !defs[eventSource.sourceDefId].ignoreRange;
  11005. }
  11006. function parseEventSource(raw, calendar) {
  11007. var defs = calendar.pluginSystem.hooks.eventSourceDefs;
  11008. for (var i = defs.length - 1; i >= 0; i--) { // later-added plugins take precedence
  11009. var def = defs[i];
  11010. var meta = def.parseMeta(raw);
  11011. if (meta) {
  11012. var res = parseEventSourceProps(typeof raw === 'object' ? raw : {}, meta, i, calendar);
  11013. res._raw = raw;
  11014. return res;
  11015. }
  11016. }
  11017. return null;
  11018. }
  11019. function parseEventSourceProps(raw, meta, sourceDefId, calendar) {
  11020. var leftovers0 = {};
  11021. var props = refineProps(raw, SIMPLE_SOURCE_PROPS, {}, leftovers0);
  11022. var leftovers1 = {};
  11023. var ui = processUnscopedUiProps(leftovers0, calendar, leftovers1);
  11024. props.isFetching = false;
  11025. props.latestFetchId = '';
  11026. props.fetchRange = null;
  11027. props.publicId = String(raw.id || '');
  11028. props.sourceId = String(uid$2++);
  11029. props.sourceDefId = sourceDefId;
  11030. props.meta = meta;
  11031. props.ui = ui;
  11032. props.extendedProps = leftovers1;
  11033. return props;
  11034. }
  11035. function reduceEventSources (eventSources, action, dateProfile, calendar) {
  11036. switch (action.type) {
  11037. case 'ADD_EVENT_SOURCES': // already parsed
  11038. return addSources(eventSources, action.sources, dateProfile ? dateProfile.activeRange : null, calendar);
  11039. case 'REMOVE_EVENT_SOURCE':
  11040. return removeSource(eventSources, action.sourceId);
  11041. case 'PREV': // TODO: how do we track all actions that affect dateProfile :(
  11042. case 'NEXT':
  11043. case 'SET_DATE':
  11044. case 'SET_VIEW_TYPE':
  11045. if (dateProfile) {
  11046. return fetchDirtySources(eventSources, dateProfile.activeRange, calendar);
  11047. }
  11048. else {
  11049. return eventSources;
  11050. }
  11051. case 'FETCH_EVENT_SOURCES':
  11052. case 'CHANGE_TIMEZONE':
  11053. return fetchSourcesByIds(eventSources, action.sourceIds ?
  11054. arrayToHash(action.sourceIds) :
  11055. excludeStaticSources(eventSources, calendar), dateProfile ? dateProfile.activeRange : null, calendar);
  11056. case 'RECEIVE_EVENTS':
  11057. case 'RECEIVE_EVENT_ERROR':
  11058. return receiveResponse(eventSources, action.sourceId, action.fetchId, action.fetchRange);
  11059. case 'REMOVE_ALL_EVENT_SOURCES':
  11060. return {};
  11061. default:
  11062. return eventSources;
  11063. }
  11064. }
  11065. var uid$3 = 0;
  11066. function addSources(eventSourceHash, sources, fetchRange, calendar) {
  11067. var hash = {};
  11068. for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) {
  11069. var source = sources_1[_i];
  11070. hash[source.sourceId] = source;
  11071. }
  11072. if (fetchRange) {
  11073. hash = fetchDirtySources(hash, fetchRange, calendar);
  11074. }
  11075. return __assign({}, eventSourceHash, hash);
  11076. }
  11077. function removeSource(eventSourceHash, sourceId) {
  11078. return filterHash(eventSourceHash, function (eventSource) {
  11079. return eventSource.sourceId !== sourceId;
  11080. });
  11081. }
  11082. function fetchDirtySources(sourceHash, fetchRange, calendar) {
  11083. return fetchSourcesByIds(sourceHash, filterHash(sourceHash, function (eventSource) {
  11084. return isSourceDirty(eventSource, fetchRange, calendar);
  11085. }), fetchRange, calendar);
  11086. }
  11087. function isSourceDirty(eventSource, fetchRange, calendar) {
  11088. if (!doesSourceNeedRange(eventSource, calendar)) {
  11089. return !eventSource.latestFetchId;
  11090. }
  11091. else {
  11092. return !calendar.opt('lazyFetching') ||
  11093. !eventSource.fetchRange ||
  11094. eventSource.isFetching || // always cancel outdated in-progress fetches
  11095. fetchRange.start < eventSource.fetchRange.start ||
  11096. fetchRange.end > eventSource.fetchRange.end;
  11097. }
  11098. }
  11099. function fetchSourcesByIds(prevSources, sourceIdHash, fetchRange, calendar) {
  11100. var nextSources = {};
  11101. for (var sourceId in prevSources) {
  11102. var source = prevSources[sourceId];
  11103. if (sourceIdHash[sourceId]) {
  11104. nextSources[sourceId] = fetchSource(source, fetchRange, calendar);
  11105. }
  11106. else {
  11107. nextSources[sourceId] = source;
  11108. }
  11109. }
  11110. return nextSources;
  11111. }
  11112. function fetchSource(eventSource, fetchRange, calendar) {
  11113. var sourceDef = calendar.pluginSystem.hooks.eventSourceDefs[eventSource.sourceDefId];
  11114. var fetchId = String(uid$3++);
  11115. sourceDef.fetch({
  11116. eventSource: eventSource,
  11117. calendar: calendar,
  11118. range: fetchRange
  11119. }, function (res) {
  11120. var rawEvents = res.rawEvents;
  11121. var calSuccess = calendar.opt('eventSourceSuccess');
  11122. var calSuccessRes;
  11123. var sourceSuccessRes;
  11124. if (eventSource.success) {
  11125. sourceSuccessRes = eventSource.success(rawEvents, res.xhr);
  11126. }
  11127. if (calSuccess) {
  11128. calSuccessRes = calSuccess(rawEvents, res.xhr);
  11129. }
  11130. rawEvents = sourceSuccessRes || calSuccessRes || rawEvents;
  11131. calendar.dispatch({
  11132. type: 'RECEIVE_EVENTS',
  11133. sourceId: eventSource.sourceId,
  11134. fetchId: fetchId,
  11135. fetchRange: fetchRange,
  11136. rawEvents: rawEvents
  11137. });
  11138. }, function (error) {
  11139. var callFailure = calendar.opt('eventSourceFailure');
  11140. console.warn(error.message, error);
  11141. if (eventSource.failure) {
  11142. eventSource.failure(error);
  11143. }
  11144. if (callFailure) {
  11145. callFailure(error);
  11146. }
  11147. calendar.dispatch({
  11148. type: 'RECEIVE_EVENT_ERROR',
  11149. sourceId: eventSource.sourceId,
  11150. fetchId: fetchId,
  11151. fetchRange: fetchRange,
  11152. error: error
  11153. });
  11154. });
  11155. return __assign({}, eventSource, { isFetching: true, latestFetchId: fetchId });
  11156. }
  11157. function receiveResponse(sourceHash, sourceId, fetchId, fetchRange) {
  11158. var _a;
  11159. var eventSource = sourceHash[sourceId];
  11160. if (eventSource && // not already removed
  11161. fetchId === eventSource.latestFetchId) {
  11162. return __assign({}, sourceHash, (_a = {}, _a[sourceId] = __assign({}, eventSource, { isFetching: false, fetchRange: fetchRange // also serves as a marker that at least one fetch has completed
  11163. }), _a));
  11164. }
  11165. return sourceHash;
  11166. }
  11167. function excludeStaticSources(eventSources, calendar) {
  11168. return filterHash(eventSources, function (eventSource) {
  11169. return doesSourceNeedRange(eventSource, calendar);
  11170. });
  11171. }
  11172. var DateProfileGenerator = /** @class */ (function () {
  11173. function DateProfileGenerator(viewSpec, calendar) {
  11174. this.viewSpec = viewSpec;
  11175. this.options = viewSpec.options;
  11176. this.dateEnv = calendar.dateEnv;
  11177. this.calendar = calendar;
  11178. this.initHiddenDays();
  11179. }
  11180. /* Date Range Computation
  11181. ------------------------------------------------------------------------------------------------------------------*/
  11182. // Builds a structure with info about what the dates/ranges will be for the "prev" view.
  11183. DateProfileGenerator.prototype.buildPrev = function (currentDateProfile, currentDate) {
  11184. var dateEnv = this.dateEnv;
  11185. var prevDate = dateEnv.subtract(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month
  11186. currentDateProfile.dateIncrement);
  11187. return this.build(prevDate, -1);
  11188. };
  11189. // Builds a structure with info about what the dates/ranges will be for the "next" view.
  11190. DateProfileGenerator.prototype.buildNext = function (currentDateProfile, currentDate) {
  11191. var dateEnv = this.dateEnv;
  11192. var nextDate = dateEnv.add(dateEnv.startOf(currentDate, currentDateProfile.currentRangeUnit), // important for start-of-month
  11193. currentDateProfile.dateIncrement);
  11194. return this.build(nextDate, 1);
  11195. };
  11196. // Builds a structure holding dates/ranges for rendering around the given date.
  11197. // Optional direction param indicates whether the date is being incremented/decremented
  11198. // from its previous value. decremented = -1, incremented = 1 (default).
  11199. DateProfileGenerator.prototype.build = function (currentDate, direction, forceToValid) {
  11200. if (forceToValid === void 0) { forceToValid = false; }
  11201. var validRange;
  11202. var minTime = null;
  11203. var maxTime = null;
  11204. var currentInfo;
  11205. var isRangeAllDay;
  11206. var renderRange;
  11207. var activeRange;
  11208. var isValid;
  11209. validRange = this.buildValidRange();
  11210. validRange = this.trimHiddenDays(validRange);
  11211. if (forceToValid) {
  11212. currentDate = constrainMarkerToRange(currentDate, validRange);
  11213. }
  11214. currentInfo = this.buildCurrentRangeInfo(currentDate, direction);
  11215. isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit);
  11216. renderRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.range), currentInfo.unit, isRangeAllDay);
  11217. renderRange = this.trimHiddenDays(renderRange);
  11218. activeRange = renderRange;
  11219. if (!this.options.showNonCurrentDates) {
  11220. activeRange = intersectRanges(activeRange, currentInfo.range);
  11221. }
  11222. minTime = createDuration(this.options.minTime);
  11223. maxTime = createDuration(this.options.maxTime);
  11224. activeRange = this.adjustActiveRange(activeRange, minTime, maxTime);
  11225. activeRange = intersectRanges(activeRange, validRange); // might return null
  11226. // it's invalid if the originally requested date is not contained,
  11227. // or if the range is completely outside of the valid range.
  11228. isValid = rangesIntersect(currentInfo.range, validRange);
  11229. return {
  11230. // constraint for where prev/next operations can go and where events can be dragged/resized to.
  11231. // an object with optional start and end properties.
  11232. validRange: validRange,
  11233. // range the view is formally responsible for.
  11234. // for example, a month view might have 1st-31st, excluding padded dates
  11235. currentRange: currentInfo.range,
  11236. // name of largest unit being displayed, like "month" or "week"
  11237. currentRangeUnit: currentInfo.unit,
  11238. isRangeAllDay: isRangeAllDay,
  11239. // dates that display events and accept drag-n-drop
  11240. // will be `null` if no dates accept events
  11241. activeRange: activeRange,
  11242. // date range with a rendered skeleton
  11243. // includes not-active days that need some sort of DOM
  11244. renderRange: renderRange,
  11245. // Duration object that denotes the first visible time of any given day
  11246. minTime: minTime,
  11247. // Duration object that denotes the exclusive visible end time of any given day
  11248. maxTime: maxTime,
  11249. isValid: isValid,
  11250. // how far the current date will move for a prev/next operation
  11251. dateIncrement: this.buildDateIncrement(currentInfo.duration)
  11252. // pass a fallback (might be null) ^
  11253. };
  11254. };
  11255. // Builds an object with optional start/end properties.
  11256. // Indicates the minimum/maximum dates to display.
  11257. // not responsible for trimming hidden days.
  11258. DateProfileGenerator.prototype.buildValidRange = function () {
  11259. return this.getRangeOption('validRange', this.calendar.getNow()) ||
  11260. { start: null, end: null }; // completely open-ended
  11261. };
  11262. // Builds a structure with info about the "current" range, the range that is
  11263. // highlighted as being the current month for example.
  11264. // See build() for a description of `direction`.
  11265. // Guaranteed to have `range` and `unit` properties. `duration` is optional.
  11266. DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) {
  11267. var _a = this, viewSpec = _a.viewSpec, dateEnv = _a.dateEnv;
  11268. var duration = null;
  11269. var unit = null;
  11270. var range = null;
  11271. var dayCount;
  11272. if (viewSpec.duration) {
  11273. duration = viewSpec.duration;
  11274. unit = viewSpec.durationUnit;
  11275. range = this.buildRangeFromDuration(date, direction, duration, unit);
  11276. }
  11277. else if ((dayCount = this.options.dayCount)) {
  11278. unit = 'day';
  11279. range = this.buildRangeFromDayCount(date, direction, dayCount);
  11280. }
  11281. else if ((range = this.buildCustomVisibleRange(date))) {
  11282. unit = dateEnv.greatestWholeUnit(range.start, range.end).unit;
  11283. }
  11284. else {
  11285. duration = this.getFallbackDuration();
  11286. unit = greatestDurationDenominator(duration).unit;
  11287. range = this.buildRangeFromDuration(date, direction, duration, unit);
  11288. }
  11289. return { duration: duration, unit: unit, range: range };
  11290. };
  11291. DateProfileGenerator.prototype.getFallbackDuration = function () {
  11292. return createDuration({ day: 1 });
  11293. };
  11294. // Returns a new activeRange to have time values (un-ambiguate)
  11295. // minTime or maxTime causes the range to expand.
  11296. DateProfileGenerator.prototype.adjustActiveRange = function (range, minTime, maxTime) {
  11297. var dateEnv = this.dateEnv;
  11298. var start = range.start;
  11299. var end = range.end;
  11300. if (this.viewSpec.class.prototype.usesMinMaxTime) {
  11301. // expand active range if minTime is negative (why not when positive?)
  11302. if (asRoughDays(minTime) < 0) {
  11303. start = startOfDay(start); // necessary?
  11304. start = dateEnv.add(start, minTime);
  11305. }
  11306. // expand active range if maxTime is beyond one day (why not when positive?)
  11307. if (asRoughDays(maxTime) > 1) {
  11308. end = startOfDay(end); // necessary?
  11309. end = addDays(end, -1);
  11310. end = dateEnv.add(end, maxTime);
  11311. }
  11312. }
  11313. return { start: start, end: end };
  11314. };
  11315. // Builds the "current" range when it is specified as an explicit duration.
  11316. // `unit` is the already-computed greatestDurationDenominator unit of duration.
  11317. DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) {
  11318. var dateEnv = this.dateEnv;
  11319. var alignment = this.options.dateAlignment;
  11320. var dateIncrementInput;
  11321. var dateIncrementDuration;
  11322. var start;
  11323. var end;
  11324. var res;
  11325. // compute what the alignment should be
  11326. if (!alignment) {
  11327. dateIncrementInput = this.options.dateIncrement;
  11328. if (dateIncrementInput) {
  11329. dateIncrementDuration = createDuration(dateIncrementInput);
  11330. // use the smaller of the two units
  11331. if (asRoughMs(dateIncrementDuration) < asRoughMs(duration)) {
  11332. alignment = greatestDurationDenominator(dateIncrementDuration, !getWeeksFromInput(dateIncrementInput)).unit;
  11333. }
  11334. else {
  11335. alignment = unit;
  11336. }
  11337. }
  11338. else {
  11339. alignment = unit;
  11340. }
  11341. }
  11342. // if the view displays a single day or smaller
  11343. if (asRoughDays(duration) <= 1) {
  11344. if (this.isHiddenDay(start)) {
  11345. start = this.skipHiddenDays(start, direction);
  11346. start = startOfDay(start);
  11347. }
  11348. }
  11349. function computeRes() {
  11350. start = dateEnv.startOf(date, alignment);
  11351. end = dateEnv.add(start, duration);
  11352. res = { start: start, end: end };
  11353. }
  11354. computeRes();
  11355. // if range is completely enveloped by hidden days, go past the hidden days
  11356. if (!this.trimHiddenDays(res)) {
  11357. date = this.skipHiddenDays(date, direction);
  11358. computeRes();
  11359. }
  11360. return res;
  11361. };
  11362. // Builds the "current" range when a dayCount is specified.
  11363. DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) {
  11364. var dateEnv = this.dateEnv;
  11365. var customAlignment = this.options.dateAlignment;
  11366. var runningCount = 0;
  11367. var start = date;
  11368. var end;
  11369. if (customAlignment) {
  11370. start = dateEnv.startOf(start, customAlignment);
  11371. }
  11372. start = startOfDay(start);
  11373. start = this.skipHiddenDays(start, direction);
  11374. end = start;
  11375. do {
  11376. end = addDays(end, 1);
  11377. if (!this.isHiddenDay(end)) {
  11378. runningCount++;
  11379. }
  11380. } while (runningCount < dayCount);
  11381. return { start: start, end: end };
  11382. };
  11383. // Builds a normalized range object for the "visible" range,
  11384. // which is a way to define the currentRange and activeRange at the same time.
  11385. DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) {
  11386. var dateEnv = this.dateEnv;
  11387. var visibleRange = this.getRangeOption('visibleRange', dateEnv.toDate(date));
  11388. if (visibleRange && (visibleRange.start == null || visibleRange.end == null)) {
  11389. return null;
  11390. }
  11391. return visibleRange;
  11392. };
  11393. // Computes the range that will represent the element/cells for *rendering*,
  11394. // but which may have voided days/times.
  11395. // not responsible for trimming hidden days.
  11396. DateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) {
  11397. return currentRange;
  11398. };
  11399. // Compute the duration value that should be added/substracted to the current date
  11400. // when a prev/next operation happens.
  11401. DateProfileGenerator.prototype.buildDateIncrement = function (fallback) {
  11402. var dateIncrementInput = this.options.dateIncrement;
  11403. var customAlignment;
  11404. if (dateIncrementInput) {
  11405. return createDuration(dateIncrementInput);
  11406. }
  11407. else if ((customAlignment = this.options.dateAlignment)) {
  11408. return createDuration(1, customAlignment);
  11409. }
  11410. else if (fallback) {
  11411. return fallback;
  11412. }
  11413. else {
  11414. return createDuration({ days: 1 });
  11415. }
  11416. };
  11417. // Arguments after name will be forwarded to a hypothetical function value
  11418. // WARNING: passed-in arguments will be given to generator functions as-is and can cause side-effects.
  11419. // Always clone your objects if you fear mutation.
  11420. DateProfileGenerator.prototype.getRangeOption = function (name) {
  11421. var otherArgs = [];
  11422. for (var _i = 1; _i < arguments.length; _i++) {
  11423. otherArgs[_i - 1] = arguments[_i];
  11424. }
  11425. var val = this.options[name];
  11426. if (typeof val === 'function') {
  11427. val = val.apply(null, otherArgs);
  11428. }
  11429. if (val) {
  11430. val = parseRange(val, this.dateEnv);
  11431. }
  11432. if (val) {
  11433. val = computeVisibleDayRange(val);
  11434. }
  11435. return val;
  11436. };
  11437. /* Hidden Days
  11438. ------------------------------------------------------------------------------------------------------------------*/
  11439. // Initializes internal variables related to calculating hidden days-of-week
  11440. DateProfileGenerator.prototype.initHiddenDays = function () {
  11441. var hiddenDays = this.options.hiddenDays || []; // array of day-of-week indices that are hidden
  11442. var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool)
  11443. var dayCnt = 0;
  11444. var i;
  11445. if (this.options.weekends === false) {
  11446. hiddenDays.push(0, 6); // 0=sunday, 6=saturday
  11447. }
  11448. for (i = 0; i < 7; i++) {
  11449. if (!(isHiddenDayHash[i] = hiddenDays.indexOf(i) !== -1)) {
  11450. dayCnt++;
  11451. }
  11452. }
  11453. if (!dayCnt) {
  11454. throw new Error('invalid hiddenDays'); // all days were hidden? bad.
  11455. }
  11456. this.isHiddenDayHash = isHiddenDayHash;
  11457. };
  11458. // Remove days from the beginning and end of the range that are computed as hidden.
  11459. // If the whole range is trimmed off, returns null
  11460. DateProfileGenerator.prototype.trimHiddenDays = function (range) {
  11461. var start = range.start;
  11462. var end = range.end;
  11463. if (start) {
  11464. start = this.skipHiddenDays(start);
  11465. }
  11466. if (end) {
  11467. end = this.skipHiddenDays(end, -1, true);
  11468. }
  11469. if (start == null || end == null || start < end) {
  11470. return { start: start, end: end };
  11471. }
  11472. return null;
  11473. };
  11474. // Is the current day hidden?
  11475. // `day` is a day-of-week index (0-6), or a Date (used for UTC)
  11476. DateProfileGenerator.prototype.isHiddenDay = function (day) {
  11477. if (day instanceof Date) {
  11478. day = day.getUTCDay();
  11479. }
  11480. return this.isHiddenDayHash[day];
  11481. };
  11482. // Incrementing the current day until it is no longer a hidden day, returning a copy.
  11483. // DOES NOT CONSIDER validRange!
  11484. // If the initial value of `date` is not a hidden day, don't do anything.
  11485. // Pass `isExclusive` as `true` if you are dealing with an end date.
  11486. // `inc` defaults to `1` (increment one day forward each time)
  11487. DateProfileGenerator.prototype.skipHiddenDays = function (date, inc, isExclusive) {
  11488. if (inc === void 0) { inc = 1; }
  11489. if (isExclusive === void 0) { isExclusive = false; }
  11490. while (this.isHiddenDayHash[(date.getUTCDay() + (isExclusive ? inc : 0) + 7) % 7]) {
  11491. date = addDays(date, inc);
  11492. }
  11493. return date;
  11494. };
  11495. return DateProfileGenerator;
  11496. }());
  11497. // TODO: find a way to avoid comparing DateProfiles. it's tedious
  11498. function isDateProfilesEqual(p0, p1) {
  11499. return rangesEqual(p0.validRange, p1.validRange) &&
  11500. rangesEqual(p0.activeRange, p1.activeRange) &&
  11501. rangesEqual(p0.renderRange, p1.renderRange) &&
  11502. durationsEqual(p0.minTime, p1.minTime) &&
  11503. durationsEqual(p0.maxTime, p1.maxTime);
  11504. /*
  11505. TODO: compare more?
  11506. currentRange: DateRange
  11507. currentRangeUnit: string
  11508. isRangeAllDay: boolean
  11509. isValid: boolean
  11510. dateIncrement: Duration
  11511. */
  11512. }
  11513. function reduce (state, action, calendar) {
  11514. var viewType = reduceViewType(state.viewType, action);
  11515. var dateProfile = reduceDateProfile(state.dateProfile, action, state.currentDate, viewType, calendar);
  11516. var eventSources = reduceEventSources(state.eventSources, action, dateProfile, calendar);
  11517. var nextState = __assign({}, state, { viewType: viewType,
  11518. 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) });
  11519. for (var _i = 0, _a = calendar.pluginSystem.hooks.reducers; _i < _a.length; _i++) {
  11520. var reducerFunc = _a[_i];
  11521. nextState = reducerFunc(nextState, action, calendar);
  11522. }
  11523. // console.log(action.type, nextState)
  11524. return nextState;
  11525. }
  11526. function reduceViewType(currentViewType, action) {
  11527. switch (action.type) {
  11528. case 'SET_VIEW_TYPE':
  11529. return action.viewType;
  11530. default:
  11531. return currentViewType;
  11532. }
  11533. }
  11534. function reduceDateProfile(currentDateProfile, action, currentDate, viewType, calendar) {
  11535. var newDateProfile;
  11536. switch (action.type) {
  11537. case 'PREV':
  11538. newDateProfile = calendar.dateProfileGenerators[viewType].buildPrev(currentDateProfile, currentDate);
  11539. break;
  11540. case 'NEXT':
  11541. newDateProfile = calendar.dateProfileGenerators[viewType].buildNext(currentDateProfile, currentDate);
  11542. break;
  11543. case 'SET_DATE':
  11544. if (!currentDateProfile.activeRange ||
  11545. !rangeContainsMarker(currentDateProfile.currentRange, action.dateMarker)) {
  11546. newDateProfile = calendar.dateProfileGenerators[viewType].build(action.dateMarker, undefined, true // forceToValid
  11547. );
  11548. }
  11549. break;
  11550. case 'SET_VIEW_TYPE':
  11551. var generator = calendar.dateProfileGenerators[viewType];
  11552. if (!generator) {
  11553. throw new Error(viewType ?
  11554. 'The FullCalendar view "' + viewType + '" does not exist. Make sure your plugins are loaded correctly.' :
  11555. 'No available FullCalendar view plugins.');
  11556. }
  11557. newDateProfile = generator.build(action.dateMarker || currentDate, undefined, true // forceToValid
  11558. );
  11559. break;
  11560. }
  11561. if (newDateProfile &&
  11562. newDateProfile.isValid &&
  11563. !(currentDateProfile && isDateProfilesEqual(currentDateProfile, newDateProfile))) {
  11564. return newDateProfile;
  11565. }
  11566. else {
  11567. return currentDateProfile;
  11568. }
  11569. }
  11570. function reduceCurrentDate(currentDate, action, dateProfile) {
  11571. switch (action.type) {
  11572. case 'PREV':
  11573. case 'NEXT':
  11574. if (!rangeContainsMarker(dateProfile.currentRange, currentDate)) {
  11575. return dateProfile.currentRange.start;
  11576. }
  11577. else {
  11578. return currentDate;
  11579. }
  11580. case 'SET_DATE':
  11581. case 'SET_VIEW_TYPE':
  11582. var newDate = action.dateMarker || currentDate;
  11583. if (dateProfile.activeRange && !rangeContainsMarker(dateProfile.activeRange, newDate)) {
  11584. return dateProfile.currentRange.start;
  11585. }
  11586. else {
  11587. return newDate;
  11588. }
  11589. default:
  11590. return currentDate;
  11591. }
  11592. }
  11593. function reduceDateSelection(currentSelection, action, calendar) {
  11594. switch (action.type) {
  11595. case 'SELECT_DATES':
  11596. return action.selection;
  11597. case 'UNSELECT_DATES':
  11598. return null;
  11599. default:
  11600. return currentSelection;
  11601. }
  11602. }
  11603. function reduceSelectedEvent(currentInstanceId, action) {
  11604. switch (action.type) {
  11605. case 'SELECT_EVENT':
  11606. return action.eventInstanceId;
  11607. case 'UNSELECT_EVENT':
  11608. return '';
  11609. default:
  11610. return currentInstanceId;
  11611. }
  11612. }
  11613. function reduceEventDrag(currentDrag, action, sources, calendar) {
  11614. switch (action.type) {
  11615. case 'SET_EVENT_DRAG':
  11616. var newDrag = action.state;
  11617. return {
  11618. affectedEvents: newDrag.affectedEvents,
  11619. mutatedEvents: newDrag.mutatedEvents,
  11620. isEvent: newDrag.isEvent,
  11621. origSeg: newDrag.origSeg
  11622. };
  11623. case 'UNSET_EVENT_DRAG':
  11624. return null;
  11625. default:
  11626. return currentDrag;
  11627. }
  11628. }
  11629. function reduceEventResize(currentResize, action, sources, calendar) {
  11630. switch (action.type) {
  11631. case 'SET_EVENT_RESIZE':
  11632. var newResize = action.state;
  11633. return {
  11634. affectedEvents: newResize.affectedEvents,
  11635. mutatedEvents: newResize.mutatedEvents,
  11636. isEvent: newResize.isEvent,
  11637. origSeg: newResize.origSeg
  11638. };
  11639. case 'UNSET_EVENT_RESIZE':
  11640. return null;
  11641. default:
  11642. return currentResize;
  11643. }
  11644. }
  11645. function computeLoadingLevel(eventSources) {
  11646. var cnt = 0;
  11647. for (var sourceId in eventSources) {
  11648. if (eventSources[sourceId].isFetching) {
  11649. cnt++;
  11650. }
  11651. }
  11652. return cnt;
  11653. }
  11654. var STANDARD_PROPS = {
  11655. start: null,
  11656. end: null,
  11657. allDay: Boolean
  11658. };
  11659. function parseDateSpan(raw, dateEnv, defaultDuration) {
  11660. var span = parseOpenDateSpan(raw, dateEnv);
  11661. var range = span.range;
  11662. if (!range.start) {
  11663. return null;
  11664. }
  11665. if (!range.end) {
  11666. if (defaultDuration == null) {
  11667. return null;
  11668. }
  11669. else {
  11670. range.end = dateEnv.add(range.start, defaultDuration);
  11671. }
  11672. }
  11673. return span;
  11674. }
  11675. /*
  11676. TODO: somehow combine with parseRange?
  11677. Will return null if the start/end props were present but parsed invalidly.
  11678. */
  11679. function parseOpenDateSpan(raw, dateEnv) {
  11680. var leftovers = {};
  11681. var standardProps = refineProps(raw, STANDARD_PROPS, {}, leftovers);
  11682. var startMeta = standardProps.start ? dateEnv.createMarkerMeta(standardProps.start) : null;
  11683. var endMeta = standardProps.end ? dateEnv.createMarkerMeta(standardProps.end) : null;
  11684. var allDay = standardProps.allDay;
  11685. if (allDay == null) {
  11686. allDay = (startMeta && startMeta.isTimeUnspecified) &&
  11687. (!endMeta || endMeta.isTimeUnspecified);
  11688. }
  11689. // use this leftover object as the selection object
  11690. leftovers.range = {
  11691. start: startMeta ? startMeta.marker : null,
  11692. end: endMeta ? endMeta.marker : null
  11693. };
  11694. leftovers.allDay = allDay;
  11695. return leftovers;
  11696. }
  11697. function isDateSpansEqual(span0, span1) {
  11698. return rangesEqual(span0.range, span1.range) &&
  11699. span0.allDay === span1.allDay &&
  11700. isSpanPropsEqual(span0, span1);
  11701. }
  11702. // the NON-DATE-RELATED props
  11703. function isSpanPropsEqual(span0, span1) {
  11704. for (var propName in span1) {
  11705. if (propName !== 'range' && propName !== 'allDay') {
  11706. if (span0[propName] !== span1[propName]) {
  11707. return false;
  11708. }
  11709. }
  11710. }
  11711. // are there any props that span0 has that span1 DOESN'T have?
  11712. // both have range/allDay, so no need to special-case.
  11713. for (var propName in span0) {
  11714. if (!(propName in span1)) {
  11715. return false;
  11716. }
  11717. }
  11718. return true;
  11719. }
  11720. function buildDateSpanApi(span, dateEnv) {
  11721. return {
  11722. start: dateEnv.toDate(span.range.start),
  11723. end: dateEnv.toDate(span.range.end),
  11724. startStr: dateEnv.formatIso(span.range.start, { omitTime: span.allDay }),
  11725. endStr: dateEnv.formatIso(span.range.end, { omitTime: span.allDay }),
  11726. allDay: span.allDay
  11727. };
  11728. }
  11729. function buildDatePointApi(span, dateEnv) {
  11730. return {
  11731. date: dateEnv.toDate(span.range.start),
  11732. dateStr: dateEnv.formatIso(span.range.start, { omitTime: span.allDay }),
  11733. allDay: span.allDay
  11734. };
  11735. }
  11736. function fabricateEventRange(dateSpan, eventUiBases, calendar) {
  11737. var def = parseEventDef({ editable: false }, '', // sourceId
  11738. dateSpan.allDay, true, // hasEnd
  11739. calendar);
  11740. return {
  11741. def: def,
  11742. ui: compileEventUi(def, eventUiBases),
  11743. instance: createEventInstance(def.defId, dateSpan.range),
  11744. range: dateSpan.range,
  11745. isStart: true,
  11746. isEnd: true
  11747. };
  11748. }
  11749. function compileViewDefs(defaultConfigs, overrideConfigs) {
  11750. var hash = {};
  11751. var viewType;
  11752. for (viewType in defaultConfigs) {
  11753. ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs);
  11754. }
  11755. for (viewType in overrideConfigs) {
  11756. ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs);
  11757. }
  11758. return hash;
  11759. }
  11760. function ensureViewDef(viewType, hash, defaultConfigs, overrideConfigs) {
  11761. if (hash[viewType]) {
  11762. return hash[viewType];
  11763. }
  11764. var viewDef = buildViewDef(viewType, hash, defaultConfigs, overrideConfigs);
  11765. if (viewDef) {
  11766. hash[viewType] = viewDef;
  11767. }
  11768. return viewDef;
  11769. }
  11770. function buildViewDef(viewType, hash, defaultConfigs, overrideConfigs) {
  11771. var defaultConfig = defaultConfigs[viewType];
  11772. var overrideConfig = overrideConfigs[viewType];
  11773. var queryProp = function (name) {
  11774. return (defaultConfig && defaultConfig[name] !== null) ? defaultConfig[name] :
  11775. ((overrideConfig && overrideConfig[name] !== null) ? overrideConfig[name] : null);
  11776. };
  11777. var theClass = queryProp('class');
  11778. var superType = queryProp('superType');
  11779. if (!superType && theClass) {
  11780. superType =
  11781. findViewNameBySubclass(theClass, overrideConfigs) ||
  11782. findViewNameBySubclass(theClass, defaultConfigs);
  11783. }
  11784. var superDef = null;
  11785. if (superType) {
  11786. if (superType === viewType) {
  11787. throw new Error('Can\'t have a custom view type that references itself');
  11788. }
  11789. superDef = ensureViewDef(superType, hash, defaultConfigs, overrideConfigs);
  11790. }
  11791. if (!theClass && superDef) {
  11792. theClass = superDef.class;
  11793. }
  11794. if (!theClass) {
  11795. return null; // don't throw a warning, might be settings for a single-unit view
  11796. }
  11797. return {
  11798. type: viewType,
  11799. class: theClass,
  11800. defaults: __assign({}, (superDef ? superDef.defaults : {}), (defaultConfig ? defaultConfig.options : {})),
  11801. overrides: __assign({}, (superDef ? superDef.overrides : {}), (overrideConfig ? overrideConfig.options : {}))
  11802. };
  11803. }
  11804. function findViewNameBySubclass(viewSubclass, configs) {
  11805. var superProto = Object.getPrototypeOf(viewSubclass.prototype);
  11806. for (var viewType in configs) {
  11807. var parsed = configs[viewType];
  11808. // need DIRECT subclass, so instanceof won't do it
  11809. if (parsed.class && parsed.class.prototype === superProto) {
  11810. return viewType;
  11811. }
  11812. }
  11813. return '';
  11814. }
  11815. function parseViewConfigs(inputs) {
  11816. return mapHash(inputs, parseViewConfig);
  11817. }
  11818. var VIEW_DEF_PROPS = {
  11819. type: String,
  11820. class: null
  11821. };
  11822. function parseViewConfig(input) {
  11823. if (typeof input === 'function') {
  11824. input = { class: input };
  11825. }
  11826. var options = {};
  11827. var props = refineProps(input, VIEW_DEF_PROPS, {}, options);
  11828. return {
  11829. superType: props.type,
  11830. class: props.class,
  11831. options: options
  11832. };
  11833. }
  11834. function buildViewSpecs(defaultInputs, optionsManager) {
  11835. var defaultConfigs = parseViewConfigs(defaultInputs);
  11836. var overrideConfigs = parseViewConfigs(optionsManager.overrides.views);
  11837. var viewDefs = compileViewDefs(defaultConfigs, overrideConfigs);
  11838. return mapHash(viewDefs, function (viewDef) {
  11839. return buildViewSpec(viewDef, overrideConfigs, optionsManager);
  11840. });
  11841. }
  11842. function buildViewSpec(viewDef, overrideConfigs, optionsManager) {
  11843. var durationInput = viewDef.overrides.duration ||
  11844. viewDef.defaults.duration ||
  11845. optionsManager.dynamicOverrides.duration ||
  11846. optionsManager.overrides.duration;
  11847. var duration = null;
  11848. var durationUnit = '';
  11849. var singleUnit = '';
  11850. var singleUnitOverrides = {};
  11851. if (durationInput) {
  11852. duration = createDuration(durationInput);
  11853. if (duration) { // valid?
  11854. var denom = greatestDurationDenominator(duration, !getWeeksFromInput(durationInput));
  11855. durationUnit = denom.unit;
  11856. if (denom.value === 1) {
  11857. singleUnit = durationUnit;
  11858. singleUnitOverrides = overrideConfigs[durationUnit] ? overrideConfigs[durationUnit].options : {};
  11859. }
  11860. }
  11861. }
  11862. var queryButtonText = function (options) {
  11863. var buttonTextMap = options.buttonText || {};
  11864. var buttonTextKey = viewDef.defaults.buttonTextKey;
  11865. if (buttonTextKey != null && buttonTextMap[buttonTextKey] != null) {
  11866. return buttonTextMap[buttonTextKey];
  11867. }
  11868. if (buttonTextMap[viewDef.type] != null) {
  11869. return buttonTextMap[viewDef.type];
  11870. }
  11871. if (buttonTextMap[singleUnit] != null) {
  11872. return buttonTextMap[singleUnit];
  11873. }
  11874. };
  11875. return {
  11876. type: viewDef.type,
  11877. class: viewDef.class,
  11878. duration: duration,
  11879. durationUnit: durationUnit,
  11880. singleUnit: singleUnit,
  11881. options: __assign({}, globalDefaults, viewDef.defaults, optionsManager.dirDefaults, optionsManager.localeDefaults, optionsManager.overrides, singleUnitOverrides, viewDef.overrides, optionsManager.dynamicOverrides),
  11882. buttonTextOverride: queryButtonText(optionsManager.dynamicOverrides) ||
  11883. queryButtonText(optionsManager.overrides) || // constructor-specified buttonText lookup hash takes precedence
  11884. viewDef.overrides.buttonText,
  11885. buttonTextDefault: queryButtonText(optionsManager.localeDefaults) ||
  11886. queryButtonText(optionsManager.dirDefaults) ||
  11887. viewDef.defaults.buttonText ||
  11888. queryButtonText(globalDefaults) ||
  11889. viewDef.type // fall back to given view name
  11890. };
  11891. }
  11892. var Toolbar = /** @class */ (function (_super) {
  11893. __extends(Toolbar, _super);
  11894. function Toolbar(extraClassName) {
  11895. var _this = _super.call(this) || this;
  11896. _this._renderLayout = memoizeRendering(_this.renderLayout, _this.unrenderLayout);
  11897. _this._updateTitle = memoizeRendering(_this.updateTitle, null, [_this._renderLayout]);
  11898. _this._updateActiveButton = memoizeRendering(_this.updateActiveButton, null, [_this._renderLayout]);
  11899. _this._updateToday = memoizeRendering(_this.updateToday, null, [_this._renderLayout]);
  11900. _this._updatePrev = memoizeRendering(_this.updatePrev, null, [_this._renderLayout]);
  11901. _this._updateNext = memoizeRendering(_this.updateNext, null, [_this._renderLayout]);
  11902. _this.el = createElement('div', { className: 'fc-toolbar ' + extraClassName });
  11903. return _this;
  11904. }
  11905. Toolbar.prototype.destroy = function () {
  11906. _super.prototype.destroy.call(this);
  11907. this._renderLayout.unrender(); // should unrender everything else
  11908. removeElement(this.el);
  11909. };
  11910. Toolbar.prototype.render = function (props) {
  11911. this._renderLayout(props.layout);
  11912. this._updateTitle(props.title);
  11913. this._updateActiveButton(props.activeButton);
  11914. this._updateToday(props.isTodayEnabled);
  11915. this._updatePrev(props.isPrevEnabled);
  11916. this._updateNext(props.isNextEnabled);
  11917. };
  11918. Toolbar.prototype.renderLayout = function (layout) {
  11919. var el = this.el;
  11920. this.viewsWithButtons = [];
  11921. appendToElement(el, this.renderSection('left', layout.left));
  11922. appendToElement(el, this.renderSection('center', layout.center));
  11923. appendToElement(el, this.renderSection('right', layout.right));
  11924. };
  11925. Toolbar.prototype.unrenderLayout = function () {
  11926. this.el.innerHTML = '';
  11927. };
  11928. Toolbar.prototype.renderSection = function (position, buttonStr) {
  11929. var _this = this;
  11930. var _a = this.context, theme = _a.theme, calendar = _a.calendar;
  11931. var optionsManager = calendar.optionsManager;
  11932. var viewSpecs = calendar.viewSpecs;
  11933. var sectionEl = createElement('div', { className: 'fc-' + position });
  11934. var calendarCustomButtons = optionsManager.computed.customButtons || {};
  11935. var calendarButtonTextOverrides = optionsManager.overrides.buttonText || {};
  11936. var calendarButtonText = optionsManager.computed.buttonText || {};
  11937. if (buttonStr) {
  11938. buttonStr.split(' ').forEach(function (buttonGroupStr, i) {
  11939. var groupChildren = [];
  11940. var isOnlyButtons = true;
  11941. var groupEl;
  11942. buttonGroupStr.split(',').forEach(function (buttonName, j) {
  11943. var customButtonProps;
  11944. var viewSpec;
  11945. var buttonClick;
  11946. var buttonIcon; // only one of these will be set
  11947. var buttonText; // "
  11948. var buttonInnerHtml;
  11949. var buttonClasses;
  11950. var buttonEl;
  11951. var buttonAriaAttr;
  11952. if (buttonName === 'title') {
  11953. groupChildren.push(htmlToElement('<h2>&nbsp;</h2>')); // we always want it to take up height
  11954. isOnlyButtons = false;
  11955. }
  11956. else {
  11957. if ((customButtonProps = calendarCustomButtons[buttonName])) {
  11958. buttonClick = function (ev) {
  11959. if (customButtonProps.click) {
  11960. customButtonProps.click.call(buttonEl, ev);
  11961. }
  11962. };
  11963. (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) ||
  11964. (buttonIcon = theme.getIconClass(buttonName)) ||
  11965. (buttonText = customButtonProps.text);
  11966. }
  11967. else if ((viewSpec = viewSpecs[buttonName])) {
  11968. _this.viewsWithButtons.push(buttonName);
  11969. buttonClick = function () {
  11970. calendar.changeView(buttonName);
  11971. };
  11972. (buttonText = viewSpec.buttonTextOverride) ||
  11973. (buttonIcon = theme.getIconClass(buttonName)) ||
  11974. (buttonText = viewSpec.buttonTextDefault);
  11975. }
  11976. else if (calendar[buttonName]) { // a calendar method
  11977. buttonClick = function () {
  11978. calendar[buttonName]();
  11979. };
  11980. (buttonText = calendarButtonTextOverrides[buttonName]) ||
  11981. (buttonIcon = theme.getIconClass(buttonName)) ||
  11982. (buttonText = calendarButtonText[buttonName]);
  11983. // ^ everything else is considered default
  11984. }
  11985. if (buttonClick) {
  11986. buttonClasses = [
  11987. 'fc-' + buttonName + '-button',
  11988. theme.getClass('button')
  11989. ];
  11990. if (buttonText) {
  11991. buttonInnerHtml = htmlEscape(buttonText);
  11992. buttonAriaAttr = '';
  11993. }
  11994. else if (buttonIcon) {
  11995. buttonInnerHtml = "<span class='" + buttonIcon + "'></span>";
  11996. buttonAriaAttr = ' aria-label="' + buttonName + '"';
  11997. }
  11998. buttonEl = htmlToElement(// type="button" so that it doesn't submit a form
  11999. '<button type="button" class="' + buttonClasses.join(' ') + '"' +
  12000. buttonAriaAttr +
  12001. '>' + buttonInnerHtml + '</button>');
  12002. buttonEl.addEventListener('click', buttonClick);
  12003. groupChildren.push(buttonEl);
  12004. }
  12005. }
  12006. });
  12007. if (groupChildren.length > 1) {
  12008. groupEl = document.createElement('div');
  12009. var buttonGroupClassName = theme.getClass('buttonGroup');
  12010. if (isOnlyButtons && buttonGroupClassName) {
  12011. groupEl.classList.add(buttonGroupClassName);
  12012. }
  12013. appendToElement(groupEl, groupChildren);
  12014. sectionEl.appendChild(groupEl);
  12015. }
  12016. else {
  12017. appendToElement(sectionEl, groupChildren); // 1 or 0 children
  12018. }
  12019. });
  12020. }
  12021. return sectionEl;
  12022. };
  12023. Toolbar.prototype.updateToday = function (isTodayEnabled) {
  12024. this.toggleButtonEnabled('today', isTodayEnabled);
  12025. };
  12026. Toolbar.prototype.updatePrev = function (isPrevEnabled) {
  12027. this.toggleButtonEnabled('prev', isPrevEnabled);
  12028. };
  12029. Toolbar.prototype.updateNext = function (isNextEnabled) {
  12030. this.toggleButtonEnabled('next', isNextEnabled);
  12031. };
  12032. Toolbar.prototype.updateTitle = function (text) {
  12033. findElements(this.el, 'h2').forEach(function (titleEl) {
  12034. titleEl.innerText = text;
  12035. });
  12036. };
  12037. Toolbar.prototype.updateActiveButton = function (buttonName) {
  12038. var theme = this.context.theme;
  12039. var className = theme.getClass('buttonActive');
  12040. findElements(this.el, 'button').forEach(function (buttonEl) {
  12041. if (buttonName && buttonEl.classList.contains('fc-' + buttonName + '-button')) {
  12042. buttonEl.classList.add(className);
  12043. }
  12044. else {
  12045. buttonEl.classList.remove(className);
  12046. }
  12047. });
  12048. };
  12049. Toolbar.prototype.toggleButtonEnabled = function (buttonName, bool) {
  12050. findElements(this.el, '.fc-' + buttonName + '-button').forEach(function (buttonEl) {
  12051. buttonEl.disabled = !bool;
  12052. });
  12053. };
  12054. return Toolbar;
  12055. }(Component));
  12056. var CalendarComponent = /** @class */ (function (_super) {
  12057. __extends(CalendarComponent, _super);
  12058. function CalendarComponent(el) {
  12059. var _this = _super.call(this) || this;
  12060. _this.elClassNames = [];
  12061. _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
  12062. _this.renderToolbars = memoizeRendering(_this._renderToolbars, _this._unrenderToolbars, [_this.renderSkeleton]);
  12063. _this.buildComponentContext = memoize(buildComponentContext);
  12064. _this.buildViewPropTransformers = memoize(buildViewPropTransformers);
  12065. _this.el = el;
  12066. _this.computeTitle = memoize(computeTitle);
  12067. _this.parseBusinessHours = memoize(function (input) {
  12068. return parseBusinessHours(input, _this.context.calendar);
  12069. });
  12070. return _this;
  12071. }
  12072. CalendarComponent.prototype.render = function (props, context) {
  12073. this.freezeHeight();
  12074. var title = this.computeTitle(props.dateProfile, props.viewSpec.options);
  12075. this.renderSkeleton(context);
  12076. this.renderToolbars(props.viewSpec, props.dateProfile, props.currentDate, title);
  12077. this.renderView(props, title);
  12078. this.updateSize();
  12079. this.thawHeight();
  12080. };
  12081. CalendarComponent.prototype.destroy = function () {
  12082. if (this.header) {
  12083. this.header.destroy();
  12084. }
  12085. if (this.footer) {
  12086. this.footer.destroy();
  12087. }
  12088. this.renderSkeleton.unrender(); // will call destroyView
  12089. _super.prototype.destroy.call(this);
  12090. };
  12091. CalendarComponent.prototype._renderSkeleton = function (context) {
  12092. this.updateElClassNames(context);
  12093. prependToElement(this.el, this.contentEl = createElement('div', { className: 'fc-view-container' }));
  12094. var calendar = context.calendar;
  12095. for (var _i = 0, _a = calendar.pluginSystem.hooks.viewContainerModifiers; _i < _a.length; _i++) {
  12096. var modifyViewContainer = _a[_i];
  12097. modifyViewContainer(this.contentEl, calendar);
  12098. }
  12099. };
  12100. CalendarComponent.prototype._unrenderSkeleton = function () {
  12101. // weird to have this here
  12102. if (this.view) {
  12103. this.savedScroll = this.view.queryScroll();
  12104. this.view.destroy();
  12105. this.view = null;
  12106. }
  12107. removeElement(this.contentEl);
  12108. this.removeElClassNames();
  12109. };
  12110. CalendarComponent.prototype.removeElClassNames = function () {
  12111. var classList = this.el.classList;
  12112. for (var _i = 0, _a = this.elClassNames; _i < _a.length; _i++) {
  12113. var className = _a[_i];
  12114. classList.remove(className);
  12115. }
  12116. this.elClassNames = [];
  12117. };
  12118. CalendarComponent.prototype.updateElClassNames = function (context) {
  12119. this.removeElClassNames();
  12120. var theme = context.theme, options = context.options;
  12121. this.elClassNames = [
  12122. 'fc',
  12123. 'fc-' + options.dir,
  12124. theme.getClass('widget')
  12125. ];
  12126. var classList = this.el.classList;
  12127. for (var _i = 0, _a = this.elClassNames; _i < _a.length; _i++) {
  12128. var className = _a[_i];
  12129. classList.add(className);
  12130. }
  12131. };
  12132. CalendarComponent.prototype._renderToolbars = function (viewSpec, dateProfile, currentDate, title) {
  12133. var _a = this, context = _a.context, header = _a.header, footer = _a.footer;
  12134. var options = context.options, calendar = context.calendar;
  12135. var headerLayout = options.header;
  12136. var footerLayout = options.footer;
  12137. var dateProfileGenerator = this.props.dateProfileGenerator;
  12138. var now = calendar.getNow();
  12139. var todayInfo = dateProfileGenerator.build(now);
  12140. var prevInfo = dateProfileGenerator.buildPrev(dateProfile, currentDate);
  12141. var nextInfo = dateProfileGenerator.buildNext(dateProfile, currentDate);
  12142. var toolbarProps = {
  12143. title: title,
  12144. activeButton: viewSpec.type,
  12145. isTodayEnabled: todayInfo.isValid && !rangeContainsMarker(dateProfile.currentRange, now),
  12146. isPrevEnabled: prevInfo.isValid,
  12147. isNextEnabled: nextInfo.isValid
  12148. };
  12149. if (headerLayout) {
  12150. if (!header) {
  12151. header = this.header = new Toolbar('fc-header-toolbar');
  12152. prependToElement(this.el, header.el);
  12153. }
  12154. header.receiveProps(__assign({ layout: headerLayout }, toolbarProps), context);
  12155. }
  12156. else if (header) {
  12157. header.destroy();
  12158. header = this.header = null;
  12159. }
  12160. if (footerLayout) {
  12161. if (!footer) {
  12162. footer = this.footer = new Toolbar('fc-footer-toolbar');
  12163. appendToElement(this.el, footer.el);
  12164. }
  12165. footer.receiveProps(__assign({ layout: footerLayout }, toolbarProps), context);
  12166. }
  12167. else if (footer) {
  12168. footer.destroy();
  12169. footer = this.footer = null;
  12170. }
  12171. };
  12172. CalendarComponent.prototype._unrenderToolbars = function () {
  12173. if (this.header) {
  12174. this.header.destroy();
  12175. this.header = null;
  12176. }
  12177. if (this.footer) {
  12178. this.footer.destroy();
  12179. this.footer = null;
  12180. }
  12181. };
  12182. CalendarComponent.prototype.renderView = function (props, title) {
  12183. var view = this.view;
  12184. var _a = this.context, calendar = _a.calendar, options = _a.options;
  12185. var viewSpec = props.viewSpec, dateProfileGenerator = props.dateProfileGenerator;
  12186. if (!view || view.viewSpec !== viewSpec) {
  12187. if (view) {
  12188. view.destroy();
  12189. }
  12190. view = this.view = new viewSpec['class'](viewSpec, this.contentEl);
  12191. if (this.savedScroll) {
  12192. view.addScroll(this.savedScroll, true);
  12193. this.savedScroll = null;
  12194. }
  12195. }
  12196. view.title = title; // for the API
  12197. var viewProps = {
  12198. dateProfileGenerator: dateProfileGenerator,
  12199. dateProfile: props.dateProfile,
  12200. businessHours: this.parseBusinessHours(viewSpec.options.businessHours),
  12201. eventStore: props.eventStore,
  12202. eventUiBases: props.eventUiBases,
  12203. dateSelection: props.dateSelection,
  12204. eventSelection: props.eventSelection,
  12205. eventDrag: props.eventDrag,
  12206. eventResize: props.eventResize
  12207. };
  12208. var transformers = this.buildViewPropTransformers(calendar.pluginSystem.hooks.viewPropsTransformers);
  12209. for (var _i = 0, transformers_1 = transformers; _i < transformers_1.length; _i++) {
  12210. var transformer = transformers_1[_i];
  12211. __assign(viewProps, transformer.transform(viewProps, viewSpec, props, options));
  12212. }
  12213. view.receiveProps(viewProps, this.buildComponentContext(this.context, viewSpec, view));
  12214. };
  12215. // Sizing
  12216. // -----------------------------------------------------------------------------------------------------------------
  12217. CalendarComponent.prototype.updateSize = function (isResize) {
  12218. if (isResize === void 0) { isResize = false; }
  12219. var view = this.view;
  12220. if (!view) {
  12221. return; // why?
  12222. }
  12223. if (isResize || this.isHeightAuto == null) {
  12224. this.computeHeightVars();
  12225. }
  12226. view.updateSize(isResize, this.viewHeight, this.isHeightAuto);
  12227. view.updateNowIndicator(); // we need to guarantee this will run after updateSize
  12228. view.popScroll(isResize);
  12229. };
  12230. CalendarComponent.prototype.computeHeightVars = function () {
  12231. var calendar = this.context.calendar; // yuck. need to handle dynamic options
  12232. var heightInput = calendar.opt('height');
  12233. var contentHeightInput = calendar.opt('contentHeight');
  12234. this.isHeightAuto = heightInput === 'auto' || contentHeightInput === 'auto';
  12235. if (typeof contentHeightInput === 'number') { // exists and not 'auto'
  12236. this.viewHeight = contentHeightInput;
  12237. }
  12238. else if (typeof contentHeightInput === 'function') { // exists and is a function
  12239. this.viewHeight = contentHeightInput();
  12240. }
  12241. else if (typeof heightInput === 'number') { // exists and not 'auto'
  12242. this.viewHeight = heightInput - this.queryToolbarsHeight();
  12243. }
  12244. else if (typeof heightInput === 'function') { // exists and is a function
  12245. this.viewHeight = heightInput() - this.queryToolbarsHeight();
  12246. }
  12247. else if (heightInput === 'parent') { // set to height of parent element
  12248. var parentEl = this.el.parentNode;
  12249. this.viewHeight = parentEl.getBoundingClientRect().height - this.queryToolbarsHeight();
  12250. }
  12251. else {
  12252. this.viewHeight = Math.round(this.contentEl.getBoundingClientRect().width /
  12253. Math.max(calendar.opt('aspectRatio'), .5));
  12254. }
  12255. };
  12256. CalendarComponent.prototype.queryToolbarsHeight = function () {
  12257. var height = 0;
  12258. if (this.header) {
  12259. height += computeHeightAndMargins(this.header.el);
  12260. }
  12261. if (this.footer) {
  12262. height += computeHeightAndMargins(this.footer.el);
  12263. }
  12264. return height;
  12265. };
  12266. // Height "Freezing"
  12267. // -----------------------------------------------------------------------------------------------------------------
  12268. CalendarComponent.prototype.freezeHeight = function () {
  12269. applyStyle(this.el, {
  12270. height: this.el.getBoundingClientRect().height,
  12271. overflow: 'hidden'
  12272. });
  12273. };
  12274. CalendarComponent.prototype.thawHeight = function () {
  12275. applyStyle(this.el, {
  12276. height: '',
  12277. overflow: ''
  12278. });
  12279. };
  12280. return CalendarComponent;
  12281. }(Component));
  12282. // Title and Date Formatting
  12283. // -----------------------------------------------------------------------------------------------------------------
  12284. // Computes what the title at the top of the calendar should be for this view
  12285. function computeTitle(dateProfile, viewOptions) {
  12286. var range;
  12287. // for views that span a large unit of time, show the proper interval, ignoring stray days before and after
  12288. if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) {
  12289. range = dateProfile.currentRange;
  12290. }
  12291. else { // for day units or smaller, use the actual day range
  12292. range = dateProfile.activeRange;
  12293. }
  12294. return this.context.dateEnv.formatRange(range.start, range.end, createFormatter(viewOptions.titleFormat || computeTitleFormat(dateProfile), viewOptions.titleRangeSeparator), { isEndExclusive: dateProfile.isRangeAllDay });
  12295. }
  12296. // Generates the format string that should be used to generate the title for the current date range.
  12297. // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`.
  12298. function computeTitleFormat(dateProfile) {
  12299. var currentRangeUnit = dateProfile.currentRangeUnit;
  12300. if (currentRangeUnit === 'year') {
  12301. return { year: 'numeric' };
  12302. }
  12303. else if (currentRangeUnit === 'month') {
  12304. return { year: 'numeric', month: 'long' }; // like "September 2014"
  12305. }
  12306. else {
  12307. var days = diffWholeDays(dateProfile.currentRange.start, dateProfile.currentRange.end);
  12308. if (days !== null && days > 1) {
  12309. // multi-day range. shorter, like "Sep 9 - 10 2014"
  12310. return { year: 'numeric', month: 'short', day: 'numeric' };
  12311. }
  12312. else {
  12313. // one day. longer, like "September 9 2014"
  12314. return { year: 'numeric', month: 'long', day: 'numeric' };
  12315. }
  12316. }
  12317. }
  12318. // build a context scoped to the view
  12319. function buildComponentContext(context, viewSpec, view) {
  12320. return context.extend(viewSpec.options, view);
  12321. }
  12322. // Plugin
  12323. // -----------------------------------------------------------------------------------------------------------------
  12324. function buildViewPropTransformers(theClasses) {
  12325. return theClasses.map(function (theClass) {
  12326. return new theClass();
  12327. });
  12328. }
  12329. var Interaction = /** @class */ (function () {
  12330. function Interaction(settings) {
  12331. this.component = settings.component;
  12332. }
  12333. Interaction.prototype.destroy = function () {
  12334. };
  12335. return Interaction;
  12336. }());
  12337. function parseInteractionSettings(component, input) {
  12338. return {
  12339. component: component,
  12340. el: input.el,
  12341. useEventCenter: input.useEventCenter != null ? input.useEventCenter : true
  12342. };
  12343. }
  12344. function interactionSettingsToStore(settings) {
  12345. var _a;
  12346. return _a = {},
  12347. _a[settings.component.uid] = settings,
  12348. _a;
  12349. }
  12350. // global state
  12351. var interactionSettingsStore = {};
  12352. /*
  12353. Detects when the user clicks on an event within a DateComponent
  12354. */
  12355. var EventClicking = /** @class */ (function (_super) {
  12356. __extends(EventClicking, _super);
  12357. function EventClicking(settings) {
  12358. var _this = _super.call(this, settings) || this;
  12359. _this.handleSegClick = function (ev, segEl) {
  12360. var component = _this.component;
  12361. var _a = component.context, calendar = _a.calendar, view = _a.view;
  12362. var seg = getElSeg(segEl);
  12363. if (seg && // might be the <div> surrounding the more link
  12364. component.isValidSegDownEl(ev.target)) {
  12365. // our way to simulate a link click for elements that can't be <a> tags
  12366. // grab before trigger fired in case trigger trashes DOM thru rerendering
  12367. var hasUrlContainer = elementClosest(ev.target, '.fc-has-url');
  12368. var url = hasUrlContainer ? hasUrlContainer.querySelector('a[href]').href : '';
  12369. calendar.publiclyTrigger('eventClick', [
  12370. {
  12371. el: segEl,
  12372. event: new EventApi(component.context.calendar, seg.eventRange.def, seg.eventRange.instance),
  12373. jsEvent: ev,
  12374. view: view
  12375. }
  12376. ]);
  12377. if (url && !ev.defaultPrevented) {
  12378. window.location.href = url;
  12379. }
  12380. }
  12381. };
  12382. var component = settings.component;
  12383. _this.destroy = listenBySelector(component.el, 'click', component.fgSegSelector + ',' + component.bgSegSelector, _this.handleSegClick);
  12384. return _this;
  12385. }
  12386. return EventClicking;
  12387. }(Interaction));
  12388. /*
  12389. Triggers events and adds/removes core classNames when the user's pointer
  12390. enters/leaves event-elements of a component.
  12391. */
  12392. var EventHovering = /** @class */ (function (_super) {
  12393. __extends(EventHovering, _super);
  12394. function EventHovering(settings) {
  12395. var _this = _super.call(this, settings) || this;
  12396. // for simulating an eventMouseLeave when the event el is destroyed while mouse is over it
  12397. _this.handleEventElRemove = function (el) {
  12398. if (el === _this.currentSegEl) {
  12399. _this.handleSegLeave(null, _this.currentSegEl);
  12400. }
  12401. };
  12402. _this.handleSegEnter = function (ev, segEl) {
  12403. if (getElSeg(segEl)) { // TODO: better way to make sure not hovering over more+ link or its wrapper
  12404. segEl.classList.add('fc-allow-mouse-resize');
  12405. _this.currentSegEl = segEl;
  12406. _this.triggerEvent('eventMouseEnter', ev, segEl);
  12407. }
  12408. };
  12409. _this.handleSegLeave = function (ev, segEl) {
  12410. if (_this.currentSegEl) {
  12411. segEl.classList.remove('fc-allow-mouse-resize');
  12412. _this.currentSegEl = null;
  12413. _this.triggerEvent('eventMouseLeave', ev, segEl);
  12414. }
  12415. };
  12416. var component = settings.component;
  12417. _this.removeHoverListeners = listenToHoverBySelector(component.el, component.fgSegSelector + ',' + component.bgSegSelector, _this.handleSegEnter, _this.handleSegLeave);
  12418. // how to make sure component already has context?
  12419. component.context.calendar.on('eventElRemove', _this.handleEventElRemove);
  12420. return _this;
  12421. }
  12422. EventHovering.prototype.destroy = function () {
  12423. this.removeHoverListeners();
  12424. this.component.context.calendar.off('eventElRemove', this.handleEventElRemove);
  12425. };
  12426. EventHovering.prototype.triggerEvent = function (publicEvName, ev, segEl) {
  12427. var component = this.component;
  12428. var _a = component.context, calendar = _a.calendar, view = _a.view;
  12429. var seg = getElSeg(segEl);
  12430. if (!ev || component.isValidSegDownEl(ev.target)) {
  12431. calendar.publiclyTrigger(publicEvName, [
  12432. {
  12433. el: segEl,
  12434. event: new EventApi(calendar, seg.eventRange.def, seg.eventRange.instance),
  12435. jsEvent: ev,
  12436. view: view
  12437. }
  12438. ]);
  12439. }
  12440. };
  12441. return EventHovering;
  12442. }(Interaction));
  12443. var StandardTheme = /** @class */ (function (_super) {
  12444. __extends(StandardTheme, _super);
  12445. function StandardTheme() {
  12446. return _super !== null && _super.apply(this, arguments) || this;
  12447. }
  12448. return StandardTheme;
  12449. }(Theme));
  12450. StandardTheme.prototype.classes = {
  12451. widget: 'fc-unthemed',
  12452. widgetHeader: 'fc-widget-header',
  12453. widgetContent: 'fc-widget-content',
  12454. buttonGroup: 'fc-button-group',
  12455. button: 'fc-button fc-button-primary',
  12456. buttonActive: 'fc-button-active',
  12457. popoverHeader: 'fc-widget-header',
  12458. popoverContent: 'fc-widget-content',
  12459. // day grid
  12460. headerRow: 'fc-widget-header',
  12461. dayRow: 'fc-widget-content',
  12462. // list view
  12463. listView: 'fc-widget-content'
  12464. };
  12465. StandardTheme.prototype.baseIconClass = 'fc-icon';
  12466. StandardTheme.prototype.iconClasses = {
  12467. close: 'fc-icon-x',
  12468. prev: 'fc-icon-chevron-left',
  12469. next: 'fc-icon-chevron-right',
  12470. prevYear: 'fc-icon-chevrons-left',
  12471. nextYear: 'fc-icon-chevrons-right'
  12472. };
  12473. StandardTheme.prototype.iconOverrideOption = 'buttonIcons';
  12474. StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon';
  12475. StandardTheme.prototype.iconOverridePrefix = 'fc-icon-';
  12476. var Calendar = /** @class */ (function () {
  12477. function Calendar(el, overrides) {
  12478. var _this = this;
  12479. this.buildComponentContext = memoize(buildComponentContext$1);
  12480. this.parseRawLocales = memoize(parseRawLocales);
  12481. this.buildLocale = memoize(buildLocale);
  12482. this.buildDateEnv = memoize(buildDateEnv);
  12483. this.buildTheme = memoize(buildTheme);
  12484. this.buildEventUiSingleBase = memoize(this._buildEventUiSingleBase);
  12485. this.buildSelectionConfig = memoize(this._buildSelectionConfig);
  12486. this.buildEventUiBySource = memoizeOutput(buildEventUiBySource, isPropsEqual);
  12487. this.buildEventUiBases = memoize(buildEventUiBases);
  12488. this.interactionsStore = {};
  12489. this.actionQueue = [];
  12490. this.isReducing = false;
  12491. // isDisplaying: boolean = false // installed in DOM? accepting renders?
  12492. this.needsRerender = false; // needs a render?
  12493. this.isRendering = false; // currently in the executeRender function?
  12494. this.renderingPauseDepth = 0;
  12495. this.buildDelayedRerender = memoize(buildDelayedRerender);
  12496. this.afterSizingTriggers = {};
  12497. this.isViewUpdated = false;
  12498. this.isDatesUpdated = false;
  12499. this.isEventsUpdated = false;
  12500. this.el = el;
  12501. this.optionsManager = new OptionsManager(overrides || {});
  12502. this.pluginSystem = new PluginSystem();
  12503. // only do once. don't do in handleOptions. because can't remove plugins
  12504. this.addPluginInputs(this.optionsManager.computed.plugins || []);
  12505. this.handleOptions(this.optionsManager.computed);
  12506. this.publiclyTrigger('_init'); // for tests
  12507. this.hydrate();
  12508. this.calendarInteractions = this.pluginSystem.hooks.calendarInteractions
  12509. .map(function (calendarInteractionClass) {
  12510. return new calendarInteractionClass(_this);
  12511. });
  12512. }
  12513. Calendar.prototype.addPluginInputs = function (pluginInputs) {
  12514. var pluginDefs = refinePluginDefs(pluginInputs);
  12515. for (var _i = 0, pluginDefs_1 = pluginDefs; _i < pluginDefs_1.length; _i++) {
  12516. var pluginDef = pluginDefs_1[_i];
  12517. this.pluginSystem.add(pluginDef);
  12518. }
  12519. };
  12520. Object.defineProperty(Calendar.prototype, "view", {
  12521. // public API
  12522. get: function () {
  12523. return this.component ? this.component.view : null;
  12524. },
  12525. enumerable: true,
  12526. configurable: true
  12527. });
  12528. // Public API for rendering
  12529. // -----------------------------------------------------------------------------------------------------------------
  12530. Calendar.prototype.render = function () {
  12531. if (!this.component) {
  12532. this.component = new CalendarComponent(this.el);
  12533. this.renderableEventStore = createEmptyEventStore();
  12534. this.bindHandlers();
  12535. this.executeRender();
  12536. }
  12537. else {
  12538. this.requestRerender();
  12539. }
  12540. };
  12541. Calendar.prototype.destroy = function () {
  12542. if (this.component) {
  12543. this.unbindHandlers();
  12544. this.component.destroy(); // don't null-out. in case API needs access
  12545. this.component = null; // umm ???
  12546. for (var _i = 0, _a = this.calendarInteractions; _i < _a.length; _i++) {
  12547. var interaction = _a[_i];
  12548. interaction.destroy();
  12549. }
  12550. this.publiclyTrigger('_destroyed');
  12551. }
  12552. };
  12553. // Handlers
  12554. // -----------------------------------------------------------------------------------------------------------------
  12555. Calendar.prototype.bindHandlers = function () {
  12556. var _this = this;
  12557. // event delegation for nav links
  12558. this.removeNavLinkListener = listenBySelector(this.el, 'click', 'a[data-goto]', function (ev, anchorEl) {
  12559. var gotoOptions = anchorEl.getAttribute('data-goto');
  12560. gotoOptions = gotoOptions ? JSON.parse(gotoOptions) : {};
  12561. var dateEnv = _this.dateEnv;
  12562. var dateMarker = dateEnv.createMarker(gotoOptions.date);
  12563. var viewType = gotoOptions.type;
  12564. // property like "navLinkDayClick". might be a string or a function
  12565. var customAction = _this.viewOpt('navLink' + capitaliseFirstLetter(viewType) + 'Click');
  12566. if (typeof customAction === 'function') {
  12567. customAction(dateEnv.toDate(dateMarker), ev);
  12568. }
  12569. else {
  12570. if (typeof customAction === 'string') {
  12571. viewType = customAction;
  12572. }
  12573. _this.zoomTo(dateMarker, viewType);
  12574. }
  12575. });
  12576. if (this.opt('handleWindowResize')) {
  12577. window.addEventListener('resize', this.windowResizeProxy = debounce(// prevents rapid calls
  12578. this.windowResize.bind(this), this.opt('windowResizeDelay')));
  12579. }
  12580. };
  12581. Calendar.prototype.unbindHandlers = function () {
  12582. this.removeNavLinkListener();
  12583. if (this.windowResizeProxy) {
  12584. window.removeEventListener('resize', this.windowResizeProxy);
  12585. this.windowResizeProxy = null;
  12586. }
  12587. };
  12588. // Dispatcher
  12589. // -----------------------------------------------------------------------------------------------------------------
  12590. Calendar.prototype.hydrate = function () {
  12591. var _this = this;
  12592. this.state = this.buildInitialState();
  12593. var rawSources = this.opt('eventSources') || [];
  12594. var singleRawSource = this.opt('events');
  12595. var sources = []; // parsed
  12596. if (singleRawSource) {
  12597. rawSources.unshift(singleRawSource);
  12598. }
  12599. for (var _i = 0, rawSources_1 = rawSources; _i < rawSources_1.length; _i++) {
  12600. var rawSource = rawSources_1[_i];
  12601. var source = parseEventSource(rawSource, this);
  12602. if (source) {
  12603. sources.push(source);
  12604. }
  12605. }
  12606. this.batchRendering(function () {
  12607. _this.dispatch({ type: 'INIT' }); // pass in sources here?
  12608. _this.dispatch({ type: 'ADD_EVENT_SOURCES', sources: sources });
  12609. _this.dispatch({
  12610. type: 'SET_VIEW_TYPE',
  12611. viewType: _this.opt('defaultView') || _this.pluginSystem.hooks.defaultView
  12612. });
  12613. });
  12614. };
  12615. Calendar.prototype.buildInitialState = function () {
  12616. return {
  12617. viewType: null,
  12618. loadingLevel: 0,
  12619. eventSourceLoadingLevel: 0,
  12620. currentDate: this.getInitialDate(),
  12621. dateProfile: null,
  12622. eventSources: {},
  12623. eventStore: createEmptyEventStore(),
  12624. dateSelection: null,
  12625. eventSelection: '',
  12626. eventDrag: null,
  12627. eventResize: null
  12628. };
  12629. };
  12630. Calendar.prototype.dispatch = function (action) {
  12631. this.actionQueue.push(action);
  12632. if (!this.isReducing) {
  12633. this.isReducing = true;
  12634. var oldState = this.state;
  12635. while (this.actionQueue.length) {
  12636. this.state = this.reduce(this.state, this.actionQueue.shift(), this);
  12637. }
  12638. var newState = this.state;
  12639. this.isReducing = false;
  12640. if (!oldState.loadingLevel && newState.loadingLevel) {
  12641. this.publiclyTrigger('loading', [true]);
  12642. }
  12643. else if (oldState.loadingLevel && !newState.loadingLevel) {
  12644. this.publiclyTrigger('loading', [false]);
  12645. }
  12646. var view = this.component && this.component.view;
  12647. if (oldState.eventStore !== newState.eventStore) {
  12648. if (oldState.eventStore) {
  12649. this.isEventsUpdated = true;
  12650. }
  12651. }
  12652. if (oldState.dateProfile !== newState.dateProfile) {
  12653. if (oldState.dateProfile && view) { // why would view be null!?
  12654. this.publiclyTrigger('datesDestroy', [
  12655. {
  12656. view: view,
  12657. el: view.el
  12658. }
  12659. ]);
  12660. }
  12661. this.isDatesUpdated = true;
  12662. }
  12663. if (oldState.viewType !== newState.viewType) {
  12664. if (oldState.viewType && view) { // why would view be null!?
  12665. this.publiclyTrigger('viewSkeletonDestroy', [
  12666. {
  12667. view: view,
  12668. el: view.el
  12669. }
  12670. ]);
  12671. }
  12672. this.isViewUpdated = true;
  12673. }
  12674. this.requestRerender();
  12675. }
  12676. };
  12677. Calendar.prototype.reduce = function (state, action, calendar) {
  12678. return reduce(state, action, calendar);
  12679. };
  12680. // Render Queue
  12681. // -----------------------------------------------------------------------------------------------------------------
  12682. Calendar.prototype.requestRerender = function () {
  12683. this.needsRerender = true;
  12684. this.delayedRerender(); // will call a debounced-version of tryRerender
  12685. };
  12686. Calendar.prototype.tryRerender = function () {
  12687. if (this.component && // must be accepting renders
  12688. this.needsRerender && // indicates that a rerender was requested
  12689. !this.renderingPauseDepth && // not paused
  12690. !this.isRendering // not currently in the render loop
  12691. ) {
  12692. this.executeRender();
  12693. }
  12694. };
  12695. Calendar.prototype.batchRendering = function (func) {
  12696. this.renderingPauseDepth++;
  12697. func();
  12698. this.renderingPauseDepth--;
  12699. if (this.needsRerender) {
  12700. this.requestRerender();
  12701. }
  12702. };
  12703. // Rendering
  12704. // -----------------------------------------------------------------------------------------------------------------
  12705. Calendar.prototype.executeRender = function () {
  12706. // clear these BEFORE the render so that new values will accumulate during render
  12707. this.needsRerender = false;
  12708. this.isRendering = true;
  12709. this.renderComponent();
  12710. this.isRendering = false;
  12711. // received a rerender request while rendering
  12712. if (this.needsRerender) {
  12713. this.delayedRerender();
  12714. }
  12715. };
  12716. /*
  12717. don't call this directly. use executeRender instead
  12718. */
  12719. Calendar.prototype.renderComponent = function () {
  12720. var _a = this, state = _a.state, component = _a.component;
  12721. var viewType = state.viewType;
  12722. var viewSpec = this.viewSpecs[viewType];
  12723. if (!viewSpec) {
  12724. throw new Error("View type \"" + viewType + "\" is not valid");
  12725. }
  12726. // if event sources are still loading and progressive rendering hasn't been enabled,
  12727. // keep rendering the last fully loaded set of events
  12728. var renderableEventStore = this.renderableEventStore =
  12729. (state.eventSourceLoadingLevel && !this.opt('progressiveEventRendering')) ?
  12730. this.renderableEventStore :
  12731. state.eventStore;
  12732. var eventUiSingleBase = this.buildEventUiSingleBase(viewSpec.options);
  12733. var eventUiBySource = this.buildEventUiBySource(state.eventSources);
  12734. var eventUiBases = this.eventUiBases = this.buildEventUiBases(renderableEventStore.defs, eventUiSingleBase, eventUiBySource);
  12735. 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));
  12736. if (this.isViewUpdated) {
  12737. this.isViewUpdated = false;
  12738. this.publiclyTrigger('viewSkeletonRender', [
  12739. {
  12740. view: component.view,
  12741. el: component.view.el
  12742. }
  12743. ]);
  12744. }
  12745. if (this.isDatesUpdated) {
  12746. this.isDatesUpdated = false;
  12747. this.publiclyTrigger('datesRender', [
  12748. {
  12749. view: component.view,
  12750. el: component.view.el
  12751. }
  12752. ]);
  12753. }
  12754. if (this.isEventsUpdated) {
  12755. this.isEventsUpdated = false;
  12756. }
  12757. this.releaseAfterSizingTriggers();
  12758. };
  12759. // Options
  12760. // -----------------------------------------------------------------------------------------------------------------
  12761. Calendar.prototype.setOption = function (name, val) {
  12762. var _a;
  12763. this.mutateOptions((_a = {}, _a[name] = val, _a), [], true);
  12764. };
  12765. Calendar.prototype.getOption = function (name) {
  12766. return this.optionsManager.computed[name];
  12767. };
  12768. Calendar.prototype.opt = function (name) {
  12769. return this.optionsManager.computed[name];
  12770. };
  12771. Calendar.prototype.viewOpt = function (name) {
  12772. return this.viewOpts()[name];
  12773. };
  12774. Calendar.prototype.viewOpts = function () {
  12775. return this.viewSpecs[this.state.viewType].options;
  12776. };
  12777. /*
  12778. handles option changes (like a diff)
  12779. */
  12780. Calendar.prototype.mutateOptions = function (updates, removals, isDynamic, deepEqual) {
  12781. var _this = this;
  12782. var changeHandlers = this.pluginSystem.hooks.optionChangeHandlers;
  12783. var normalUpdates = {};
  12784. var specialUpdates = {};
  12785. var oldDateEnv = this.dateEnv; // do this before handleOptions
  12786. var isTimeZoneDirty = false;
  12787. var isSizeDirty = false;
  12788. var anyDifficultOptions = Boolean(removals.length);
  12789. for (var name_1 in updates) {
  12790. if (changeHandlers[name_1]) {
  12791. specialUpdates[name_1] = updates[name_1];
  12792. }
  12793. else {
  12794. normalUpdates[name_1] = updates[name_1];
  12795. }
  12796. }
  12797. for (var name_2 in normalUpdates) {
  12798. if (/^(height|contentHeight|aspectRatio)$/.test(name_2)) {
  12799. isSizeDirty = true;
  12800. }
  12801. else if (/^(defaultDate|defaultView)$/.test(name_2)) ;
  12802. else {
  12803. anyDifficultOptions = true;
  12804. if (name_2 === 'timeZone') {
  12805. isTimeZoneDirty = true;
  12806. }
  12807. }
  12808. }
  12809. this.optionsManager.mutate(normalUpdates, removals, isDynamic);
  12810. if (anyDifficultOptions) {
  12811. this.handleOptions(this.optionsManager.computed);
  12812. }
  12813. this.batchRendering(function () {
  12814. if (anyDifficultOptions) {
  12815. if (isTimeZoneDirty) {
  12816. _this.dispatch({
  12817. type: 'CHANGE_TIMEZONE',
  12818. oldDateEnv: oldDateEnv
  12819. });
  12820. }
  12821. /* HACK
  12822. has the same effect as calling this.requestRerender()
  12823. but recomputes the state's dateProfile
  12824. */
  12825. _this.dispatch({
  12826. type: 'SET_VIEW_TYPE',
  12827. viewType: _this.state.viewType
  12828. });
  12829. }
  12830. else if (isSizeDirty) {
  12831. _this.updateSize();
  12832. }
  12833. // special updates
  12834. if (deepEqual) {
  12835. for (var name_3 in specialUpdates) {
  12836. changeHandlers[name_3](specialUpdates[name_3], _this, deepEqual);
  12837. }
  12838. }
  12839. });
  12840. };
  12841. /*
  12842. rebuilds things based off of a complete set of refined options
  12843. */
  12844. Calendar.prototype.handleOptions = function (options) {
  12845. var _this = this;
  12846. var pluginHooks = this.pluginSystem.hooks;
  12847. this.defaultAllDayEventDuration = createDuration(options.defaultAllDayEventDuration);
  12848. this.defaultTimedEventDuration = createDuration(options.defaultTimedEventDuration);
  12849. this.delayedRerender = this.buildDelayedRerender(options.rerenderDelay);
  12850. this.theme = this.buildTheme(options);
  12851. var available = this.parseRawLocales(options.locales);
  12852. this.availableRawLocales = available.map;
  12853. var locale = this.buildLocale(options.locale || available.defaultCode, available.map);
  12854. this.dateEnv = this.buildDateEnv(locale, options.timeZone, pluginHooks.namedTimeZonedImpl, options.firstDay, options.weekNumberCalculation, options.weekLabel, pluginHooks.cmdFormatter);
  12855. this.selectionConfig = this.buildSelectionConfig(options); // needs dateEnv. do after :(
  12856. // ineffecient to do every time?
  12857. this.viewSpecs = buildViewSpecs(pluginHooks.views, this.optionsManager);
  12858. // ineffecient to do every time?
  12859. this.dateProfileGenerators = mapHash(this.viewSpecs, function (viewSpec) {
  12860. return new viewSpec.class.prototype.dateProfileGeneratorClass(viewSpec, _this);
  12861. });
  12862. };
  12863. Calendar.prototype.getAvailableLocaleCodes = function () {
  12864. return Object.keys(this.availableRawLocales);
  12865. };
  12866. Calendar.prototype._buildSelectionConfig = function (rawOpts) {
  12867. return processScopedUiProps('select', rawOpts, this);
  12868. };
  12869. Calendar.prototype._buildEventUiSingleBase = function (rawOpts) {
  12870. if (rawOpts.editable) { // so 'editable' affected events
  12871. rawOpts = __assign({}, rawOpts, { eventEditable: true });
  12872. }
  12873. return processScopedUiProps('event', rawOpts, this);
  12874. };
  12875. // Trigger
  12876. // -----------------------------------------------------------------------------------------------------------------
  12877. Calendar.prototype.hasPublicHandlers = function (name) {
  12878. return this.hasHandlers(name) ||
  12879. this.opt(name); // handler specified in options
  12880. };
  12881. Calendar.prototype.publiclyTrigger = function (name, args) {
  12882. var optHandler = this.opt(name);
  12883. this.triggerWith(name, this, args);
  12884. if (optHandler) {
  12885. return optHandler.apply(this, args);
  12886. }
  12887. };
  12888. Calendar.prototype.publiclyTriggerAfterSizing = function (name, args) {
  12889. var afterSizingTriggers = this.afterSizingTriggers;
  12890. (afterSizingTriggers[name] || (afterSizingTriggers[name] = [])).push(args);
  12891. };
  12892. Calendar.prototype.releaseAfterSizingTriggers = function () {
  12893. var afterSizingTriggers = this.afterSizingTriggers;
  12894. for (var name_4 in afterSizingTriggers) {
  12895. for (var _i = 0, _a = afterSizingTriggers[name_4]; _i < _a.length; _i++) {
  12896. var args = _a[_i];
  12897. this.publiclyTrigger(name_4, args);
  12898. }
  12899. }
  12900. this.afterSizingTriggers = {};
  12901. };
  12902. // View
  12903. // -----------------------------------------------------------------------------------------------------------------
  12904. // Returns a boolean about whether the view is okay to instantiate at some point
  12905. Calendar.prototype.isValidViewType = function (viewType) {
  12906. return Boolean(this.viewSpecs[viewType]);
  12907. };
  12908. Calendar.prototype.changeView = function (viewType, dateOrRange) {
  12909. var dateMarker = null;
  12910. if (dateOrRange) {
  12911. if (dateOrRange.start && dateOrRange.end) { // a range
  12912. this.optionsManager.mutate({ visibleRange: dateOrRange }, []); // will not rerender
  12913. this.handleOptions(this.optionsManager.computed); // ...but yuck
  12914. }
  12915. else { // a date
  12916. dateMarker = this.dateEnv.createMarker(dateOrRange); // just like gotoDate
  12917. }
  12918. }
  12919. this.unselect();
  12920. this.dispatch({
  12921. type: 'SET_VIEW_TYPE',
  12922. viewType: viewType,
  12923. dateMarker: dateMarker
  12924. });
  12925. };
  12926. // Forces navigation to a view for the given date.
  12927. // `viewType` can be a specific view name or a generic one like "week" or "day".
  12928. // needs to change
  12929. Calendar.prototype.zoomTo = function (dateMarker, viewType) {
  12930. var spec;
  12931. viewType = viewType || 'day'; // day is default zoom
  12932. spec = this.viewSpecs[viewType] ||
  12933. this.getUnitViewSpec(viewType);
  12934. this.unselect();
  12935. if (spec) {
  12936. this.dispatch({
  12937. type: 'SET_VIEW_TYPE',
  12938. viewType: spec.type,
  12939. dateMarker: dateMarker
  12940. });
  12941. }
  12942. else {
  12943. this.dispatch({
  12944. type: 'SET_DATE',
  12945. dateMarker: dateMarker
  12946. });
  12947. }
  12948. };
  12949. // Given a duration singular unit, like "week" or "day", finds a matching view spec.
  12950. // Preference is given to views that have corresponding buttons.
  12951. Calendar.prototype.getUnitViewSpec = function (unit) {
  12952. var component = this.component;
  12953. var viewTypes = [];
  12954. var i;
  12955. var spec;
  12956. // put views that have buttons first. there will be duplicates, but oh
  12957. if (component.header) {
  12958. viewTypes.push.apply(viewTypes, component.header.viewsWithButtons);
  12959. }
  12960. if (component.footer) {
  12961. viewTypes.push.apply(viewTypes, component.footer.viewsWithButtons);
  12962. }
  12963. for (var viewType in this.viewSpecs) {
  12964. viewTypes.push(viewType);
  12965. }
  12966. for (i = 0; i < viewTypes.length; i++) {
  12967. spec = this.viewSpecs[viewTypes[i]];
  12968. if (spec) {
  12969. if (spec.singleUnit === unit) {
  12970. return spec;
  12971. }
  12972. }
  12973. }
  12974. };
  12975. // Current Date
  12976. // -----------------------------------------------------------------------------------------------------------------
  12977. Calendar.prototype.getInitialDate = function () {
  12978. var defaultDateInput = this.opt('defaultDate');
  12979. // compute the initial ambig-timezone date
  12980. if (defaultDateInput != null) {
  12981. return this.dateEnv.createMarker(defaultDateInput);
  12982. }
  12983. else {
  12984. return this.getNow(); // getNow already returns unzoned
  12985. }
  12986. };
  12987. Calendar.prototype.prev = function () {
  12988. this.unselect();
  12989. this.dispatch({ type: 'PREV' });
  12990. };
  12991. Calendar.prototype.next = function () {
  12992. this.unselect();
  12993. this.dispatch({ type: 'NEXT' });
  12994. };
  12995. Calendar.prototype.prevYear = function () {
  12996. this.unselect();
  12997. this.dispatch({
  12998. type: 'SET_DATE',
  12999. dateMarker: this.dateEnv.addYears(this.state.currentDate, -1)
  13000. });
  13001. };
  13002. Calendar.prototype.nextYear = function () {
  13003. this.unselect();
  13004. this.dispatch({
  13005. type: 'SET_DATE',
  13006. dateMarker: this.dateEnv.addYears(this.state.currentDate, 1)
  13007. });
  13008. };
  13009. Calendar.prototype.today = function () {
  13010. this.unselect();
  13011. this.dispatch({
  13012. type: 'SET_DATE',
  13013. dateMarker: this.getNow()
  13014. });
  13015. };
  13016. Calendar.prototype.gotoDate = function (zonedDateInput) {
  13017. this.unselect();
  13018. this.dispatch({
  13019. type: 'SET_DATE',
  13020. dateMarker: this.dateEnv.createMarker(zonedDateInput)
  13021. });
  13022. };
  13023. Calendar.prototype.incrementDate = function (deltaInput) {
  13024. var delta = createDuration(deltaInput);
  13025. if (delta) { // else, warn about invalid input?
  13026. this.unselect();
  13027. this.dispatch({
  13028. type: 'SET_DATE',
  13029. dateMarker: this.dateEnv.add(this.state.currentDate, delta)
  13030. });
  13031. }
  13032. };
  13033. // for external API
  13034. Calendar.prototype.getDate = function () {
  13035. return this.dateEnv.toDate(this.state.currentDate);
  13036. };
  13037. // Date Formatting Utils
  13038. // -----------------------------------------------------------------------------------------------------------------
  13039. Calendar.prototype.formatDate = function (d, formatter) {
  13040. var dateEnv = this.dateEnv;
  13041. return dateEnv.format(dateEnv.createMarker(d), createFormatter(formatter));
  13042. };
  13043. // `settings` is for formatter AND isEndExclusive
  13044. Calendar.prototype.formatRange = function (d0, d1, settings) {
  13045. var dateEnv = this.dateEnv;
  13046. return dateEnv.formatRange(dateEnv.createMarker(d0), dateEnv.createMarker(d1), createFormatter(settings, this.opt('defaultRangeSeparator')), settings);
  13047. };
  13048. Calendar.prototype.formatIso = function (d, omitTime) {
  13049. var dateEnv = this.dateEnv;
  13050. return dateEnv.formatIso(dateEnv.createMarker(d), { omitTime: omitTime });
  13051. };
  13052. // Sizing
  13053. // -----------------------------------------------------------------------------------------------------------------
  13054. Calendar.prototype.windowResize = function (ev) {
  13055. if (!this.isHandlingWindowResize &&
  13056. this.component && // why?
  13057. ev.target === window // not a jqui resize event
  13058. ) {
  13059. this.isHandlingWindowResize = true;
  13060. this.updateSize();
  13061. this.publiclyTrigger('windowResize', [this.view]);
  13062. this.isHandlingWindowResize = false;
  13063. }
  13064. };
  13065. Calendar.prototype.updateSize = function () {
  13066. if (this.component) { // when?
  13067. this.component.updateSize(true);
  13068. }
  13069. };
  13070. // Component Registration
  13071. // -----------------------------------------------------------------------------------------------------------------
  13072. Calendar.prototype.registerInteractiveComponent = function (component, settingsInput) {
  13073. var settings = parseInteractionSettings(component, settingsInput);
  13074. var DEFAULT_INTERACTIONS = [
  13075. EventClicking,
  13076. EventHovering
  13077. ];
  13078. var interactionClasses = DEFAULT_INTERACTIONS.concat(this.pluginSystem.hooks.componentInteractions);
  13079. var interactions = interactionClasses.map(function (interactionClass) {
  13080. return new interactionClass(settings);
  13081. });
  13082. this.interactionsStore[component.uid] = interactions;
  13083. interactionSettingsStore[component.uid] = settings;
  13084. };
  13085. Calendar.prototype.unregisterInteractiveComponent = function (component) {
  13086. for (var _i = 0, _a = this.interactionsStore[component.uid]; _i < _a.length; _i++) {
  13087. var listener = _a[_i];
  13088. listener.destroy();
  13089. }
  13090. delete this.interactionsStore[component.uid];
  13091. delete interactionSettingsStore[component.uid];
  13092. };
  13093. // Date Selection / Event Selection / DayClick
  13094. // -----------------------------------------------------------------------------------------------------------------
  13095. // this public method receives start/end dates in any format, with any timezone
  13096. // NOTE: args were changed from v3
  13097. Calendar.prototype.select = function (dateOrObj, endDate) {
  13098. var selectionInput;
  13099. if (endDate == null) {
  13100. if (dateOrObj.start != null) {
  13101. selectionInput = dateOrObj;
  13102. }
  13103. else {
  13104. selectionInput = {
  13105. start: dateOrObj,
  13106. end: null
  13107. };
  13108. }
  13109. }
  13110. else {
  13111. selectionInput = {
  13112. start: dateOrObj,
  13113. end: endDate
  13114. };
  13115. }
  13116. var selection = parseDateSpan(selectionInput, this.dateEnv, createDuration({ days: 1 }) // TODO: cache this?
  13117. );
  13118. if (selection) { // throw parse error otherwise?
  13119. this.dispatch({ type: 'SELECT_DATES', selection: selection });
  13120. this.triggerDateSelect(selection);
  13121. }
  13122. };
  13123. // public method
  13124. Calendar.prototype.unselect = function (pev) {
  13125. if (this.state.dateSelection) {
  13126. this.dispatch({ type: 'UNSELECT_DATES' });
  13127. this.triggerDateUnselect(pev);
  13128. }
  13129. };
  13130. Calendar.prototype.triggerDateSelect = function (selection, pev) {
  13131. var arg = __assign({}, this.buildDateSpanApi(selection), { jsEvent: pev ? pev.origEvent : null, view: this.view });
  13132. this.publiclyTrigger('select', [arg]);
  13133. };
  13134. Calendar.prototype.triggerDateUnselect = function (pev) {
  13135. this.publiclyTrigger('unselect', [
  13136. {
  13137. jsEvent: pev ? pev.origEvent : null,
  13138. view: this.view
  13139. }
  13140. ]);
  13141. };
  13142. // TODO: receive pev?
  13143. Calendar.prototype.triggerDateClick = function (dateSpan, dayEl, view, ev) {
  13144. var arg = __assign({}, this.buildDatePointApi(dateSpan), { dayEl: dayEl, jsEvent: ev, // Is this always a mouse event? See #4655
  13145. view: view });
  13146. this.publiclyTrigger('dateClick', [arg]);
  13147. };
  13148. Calendar.prototype.buildDatePointApi = function (dateSpan) {
  13149. var props = {};
  13150. for (var _i = 0, _a = this.pluginSystem.hooks.datePointTransforms; _i < _a.length; _i++) {
  13151. var transform = _a[_i];
  13152. __assign(props, transform(dateSpan, this));
  13153. }
  13154. __assign(props, buildDatePointApi(dateSpan, this.dateEnv));
  13155. return props;
  13156. };
  13157. Calendar.prototype.buildDateSpanApi = function (dateSpan) {
  13158. var props = {};
  13159. for (var _i = 0, _a = this.pluginSystem.hooks.dateSpanTransforms; _i < _a.length; _i++) {
  13160. var transform = _a[_i];
  13161. __assign(props, transform(dateSpan, this));
  13162. }
  13163. __assign(props, buildDateSpanApi(dateSpan, this.dateEnv));
  13164. return props;
  13165. };
  13166. // Date Utils
  13167. // -----------------------------------------------------------------------------------------------------------------
  13168. // Returns a DateMarker for the current date, as defined by the client's computer or from the `now` option
  13169. Calendar.prototype.getNow = function () {
  13170. var now = this.opt('now');
  13171. if (typeof now === 'function') {
  13172. now = now();
  13173. }
  13174. if (now == null) {
  13175. return this.dateEnv.createNowMarker();
  13176. }
  13177. return this.dateEnv.createMarker(now);
  13178. };
  13179. // Event-Date Utilities
  13180. // -----------------------------------------------------------------------------------------------------------------
  13181. // Given an event's allDay status and start date, return what its fallback end date should be.
  13182. // TODO: rename to computeDefaultEventEnd
  13183. Calendar.prototype.getDefaultEventEnd = function (allDay, marker) {
  13184. var end = marker;
  13185. if (allDay) {
  13186. end = startOfDay(end);
  13187. end = this.dateEnv.add(end, this.defaultAllDayEventDuration);
  13188. }
  13189. else {
  13190. end = this.dateEnv.add(end, this.defaultTimedEventDuration);
  13191. }
  13192. return end;
  13193. };
  13194. // Public Events API
  13195. // -----------------------------------------------------------------------------------------------------------------
  13196. Calendar.prototype.addEvent = function (eventInput, sourceInput) {
  13197. if (eventInput instanceof EventApi) {
  13198. var def = eventInput._def;
  13199. var instance = eventInput._instance;
  13200. // not already present? don't want to add an old snapshot
  13201. if (!this.state.eventStore.defs[def.defId]) {
  13202. this.dispatch({
  13203. type: 'ADD_EVENTS',
  13204. eventStore: eventTupleToStore({ def: def, instance: instance }) // TODO: better util for two args?
  13205. });
  13206. }
  13207. return eventInput;
  13208. }
  13209. var sourceId;
  13210. if (sourceInput instanceof EventSourceApi) {
  13211. sourceId = sourceInput.internalEventSource.sourceId;
  13212. }
  13213. else if (sourceInput != null) {
  13214. var sourceApi = this.getEventSourceById(sourceInput); // TODO: use an internal function
  13215. if (!sourceApi) {
  13216. console.warn('Could not find an event source with ID "' + sourceInput + '"'); // TODO: test
  13217. return null;
  13218. }
  13219. else {
  13220. sourceId = sourceApi.internalEventSource.sourceId;
  13221. }
  13222. }
  13223. var tuple = parseEvent(eventInput, sourceId, this);
  13224. if (tuple) {
  13225. this.dispatch({
  13226. type: 'ADD_EVENTS',
  13227. eventStore: eventTupleToStore(tuple)
  13228. });
  13229. return new EventApi(this, tuple.def, tuple.def.recurringDef ? null : tuple.instance);
  13230. }
  13231. return null;
  13232. };
  13233. // TODO: optimize
  13234. Calendar.prototype.getEventById = function (id) {
  13235. var _a = this.state.eventStore, defs = _a.defs, instances = _a.instances;
  13236. id = String(id);
  13237. for (var defId in defs) {
  13238. var def = defs[defId];
  13239. if (def.publicId === id) {
  13240. if (def.recurringDef) {
  13241. return new EventApi(this, def, null);
  13242. }
  13243. else {
  13244. for (var instanceId in instances) {
  13245. var instance = instances[instanceId];
  13246. if (instance.defId === def.defId) {
  13247. return new EventApi(this, def, instance);
  13248. }
  13249. }
  13250. }
  13251. }
  13252. }
  13253. return null;
  13254. };
  13255. Calendar.prototype.getEvents = function () {
  13256. var _a = this.state.eventStore, defs = _a.defs, instances = _a.instances;
  13257. var eventApis = [];
  13258. for (var id in instances) {
  13259. var instance = instances[id];
  13260. var def = defs[instance.defId];
  13261. eventApis.push(new EventApi(this, def, instance));
  13262. }
  13263. return eventApis;
  13264. };
  13265. Calendar.prototype.removeAllEvents = function () {
  13266. this.dispatch({ type: 'REMOVE_ALL_EVENTS' });
  13267. };
  13268. Calendar.prototype.rerenderEvents = function () {
  13269. this.dispatch({ type: 'RESET_EVENTS' });
  13270. };
  13271. // Public Event Sources API
  13272. // -----------------------------------------------------------------------------------------------------------------
  13273. Calendar.prototype.getEventSources = function () {
  13274. var sourceHash = this.state.eventSources;
  13275. var sourceApis = [];
  13276. for (var internalId in sourceHash) {
  13277. sourceApis.push(new EventSourceApi(this, sourceHash[internalId]));
  13278. }
  13279. return sourceApis;
  13280. };
  13281. Calendar.prototype.getEventSourceById = function (id) {
  13282. var sourceHash = this.state.eventSources;
  13283. id = String(id);
  13284. for (var sourceId in sourceHash) {
  13285. if (sourceHash[sourceId].publicId === id) {
  13286. return new EventSourceApi(this, sourceHash[sourceId]);
  13287. }
  13288. }
  13289. return null;
  13290. };
  13291. Calendar.prototype.addEventSource = function (sourceInput) {
  13292. if (sourceInput instanceof EventSourceApi) {
  13293. // not already present? don't want to add an old snapshot
  13294. if (!this.state.eventSources[sourceInput.internalEventSource.sourceId]) {
  13295. this.dispatch({
  13296. type: 'ADD_EVENT_SOURCES',
  13297. sources: [sourceInput.internalEventSource]
  13298. });
  13299. }
  13300. return sourceInput;
  13301. }
  13302. var eventSource = parseEventSource(sourceInput, this);
  13303. if (eventSource) { // TODO: error otherwise?
  13304. this.dispatch({ type: 'ADD_EVENT_SOURCES', sources: [eventSource] });
  13305. return new EventSourceApi(this, eventSource);
  13306. }
  13307. return null;
  13308. };
  13309. Calendar.prototype.removeAllEventSources = function () {
  13310. this.dispatch({ type: 'REMOVE_ALL_EVENT_SOURCES' });
  13311. };
  13312. Calendar.prototype.refetchEvents = function () {
  13313. this.dispatch({ type: 'FETCH_EVENT_SOURCES' });
  13314. };
  13315. // Scroll
  13316. // -----------------------------------------------------------------------------------------------------------------
  13317. Calendar.prototype.scrollToTime = function (timeInput) {
  13318. var duration = createDuration(timeInput);
  13319. if (duration) {
  13320. this.component.view.scrollToDuration(duration);
  13321. }
  13322. };
  13323. return Calendar;
  13324. }());
  13325. EmitterMixin.mixInto(Calendar);
  13326. // for memoizers
  13327. // -----------------------------------------------------------------------------------------------------------------
  13328. function buildComponentContext$1(theme, dateEnv, options) {
  13329. return new ComponentContext(this, theme, dateEnv, options, null);
  13330. }
  13331. function buildDateEnv(locale, timeZone, namedTimeZoneImpl, firstDay, weekNumberCalculation, weekLabel, cmdFormatter) {
  13332. return new DateEnv({
  13333. calendarSystem: 'gregory',
  13334. timeZone: timeZone,
  13335. namedTimeZoneImpl: namedTimeZoneImpl,
  13336. locale: locale,
  13337. weekNumberCalculation: weekNumberCalculation,
  13338. firstDay: firstDay,
  13339. weekLabel: weekLabel,
  13340. cmdFormatter: cmdFormatter
  13341. });
  13342. }
  13343. function buildTheme(calendarOptions) {
  13344. var themeClass = this.pluginSystem.hooks.themeClasses[calendarOptions.themeSystem] || StandardTheme;
  13345. return new themeClass(calendarOptions);
  13346. }
  13347. function buildDelayedRerender(wait) {
  13348. var func = this.tryRerender.bind(this);
  13349. if (wait != null) {
  13350. func = debounce(func, wait);
  13351. }
  13352. return func;
  13353. }
  13354. function buildEventUiBySource(eventSources) {
  13355. return mapHash(eventSources, function (eventSource) {
  13356. return eventSource.ui;
  13357. });
  13358. }
  13359. function buildEventUiBases(eventDefs, eventUiSingleBase, eventUiBySource) {
  13360. var eventUiBases = { '': eventUiSingleBase };
  13361. for (var defId in eventDefs) {
  13362. var def = eventDefs[defId];
  13363. if (def.sourceId && eventUiBySource[def.sourceId]) {
  13364. eventUiBases[defId] = eventUiBySource[def.sourceId];
  13365. }
  13366. }
  13367. return eventUiBases;
  13368. }
  13369. var View = /** @class */ (function (_super) {
  13370. __extends(View, _super);
  13371. function View(viewSpec, parentEl) {
  13372. var _this = _super.call(this, createElement('div', { className: 'fc-view fc-' + viewSpec.type + '-view' })) || this;
  13373. _this.renderDatesMem = memoizeRendering(_this.renderDatesWrap, _this.unrenderDatesWrap);
  13374. _this.renderBusinessHoursMem = memoizeRendering(_this.renderBusinessHours, _this.unrenderBusinessHours, [_this.renderDatesMem]);
  13375. _this.renderDateSelectionMem = memoizeRendering(_this.renderDateSelectionWrap, _this.unrenderDateSelectionWrap, [_this.renderDatesMem]);
  13376. _this.renderEventsMem = memoizeRendering(_this.renderEvents, _this.unrenderEvents, [_this.renderDatesMem]);
  13377. _this.renderEventSelectionMem = memoizeRendering(_this.renderEventSelectionWrap, _this.unrenderEventSelectionWrap, [_this.renderEventsMem]);
  13378. _this.renderEventDragMem = memoizeRendering(_this.renderEventDragWrap, _this.unrenderEventDragWrap, [_this.renderDatesMem]);
  13379. _this.renderEventResizeMem = memoizeRendering(_this.renderEventResizeWrap, _this.unrenderEventResizeWrap, [_this.renderDatesMem]);
  13380. _this.viewSpec = viewSpec;
  13381. _this.type = viewSpec.type;
  13382. parentEl.appendChild(_this.el);
  13383. _this.initialize();
  13384. return _this;
  13385. }
  13386. View.prototype.initialize = function () {
  13387. };
  13388. Object.defineProperty(View.prototype, "activeStart", {
  13389. // Date Setting/Unsetting
  13390. // -----------------------------------------------------------------------------------------------------------------
  13391. get: function () {
  13392. return this.context.dateEnv.toDate(this.props.dateProfile.activeRange.start);
  13393. },
  13394. enumerable: true,
  13395. configurable: true
  13396. });
  13397. Object.defineProperty(View.prototype, "activeEnd", {
  13398. get: function () {
  13399. return this.context.dateEnv.toDate(this.props.dateProfile.activeRange.end);
  13400. },
  13401. enumerable: true,
  13402. configurable: true
  13403. });
  13404. Object.defineProperty(View.prototype, "currentStart", {
  13405. get: function () {
  13406. return this.context.dateEnv.toDate(this.props.dateProfile.currentRange.start);
  13407. },
  13408. enumerable: true,
  13409. configurable: true
  13410. });
  13411. Object.defineProperty(View.prototype, "currentEnd", {
  13412. get: function () {
  13413. return this.context.dateEnv.toDate(this.props.dateProfile.currentRange.end);
  13414. },
  13415. enumerable: true,
  13416. configurable: true
  13417. });
  13418. // General Rendering
  13419. // -----------------------------------------------------------------------------------------------------------------
  13420. View.prototype.render = function (props, context) {
  13421. this.renderDatesMem(props.dateProfile);
  13422. this.renderBusinessHoursMem(props.businessHours);
  13423. this.renderDateSelectionMem(props.dateSelection);
  13424. this.renderEventsMem(props.eventStore);
  13425. this.renderEventSelectionMem(props.eventSelection);
  13426. this.renderEventDragMem(props.eventDrag);
  13427. this.renderEventResizeMem(props.eventResize);
  13428. };
  13429. View.prototype.beforeUpdate = function () {
  13430. this.addScroll(this.queryScroll());
  13431. };
  13432. View.prototype.destroy = function () {
  13433. _super.prototype.destroy.call(this);
  13434. this.renderDatesMem.unrender(); // should unrender everything else
  13435. };
  13436. // Sizing
  13437. // -----------------------------------------------------------------------------------------------------------------
  13438. View.prototype.updateSize = function (isResize, viewHeight, isAuto) {
  13439. var calendar = this.context.calendar;
  13440. if (isResize) {
  13441. this.addScroll(this.queryScroll()); // NOTE: same code as in beforeUpdate
  13442. }
  13443. if (isResize || // HACKS...
  13444. calendar.isViewUpdated ||
  13445. calendar.isDatesUpdated ||
  13446. calendar.isEventsUpdated) {
  13447. // sort of the catch-all sizing
  13448. // anything that might cause dimension changes
  13449. this.updateBaseSize(isResize, viewHeight, isAuto);
  13450. }
  13451. // NOTE: popScroll is called by CalendarComponent
  13452. };
  13453. View.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {
  13454. };
  13455. // Date Rendering
  13456. // -----------------------------------------------------------------------------------------------------------------
  13457. View.prototype.renderDatesWrap = function (dateProfile) {
  13458. this.renderDates(dateProfile);
  13459. this.addScroll({
  13460. duration: createDuration(this.context.options.scrollTime)
  13461. });
  13462. };
  13463. View.prototype.unrenderDatesWrap = function () {
  13464. this.stopNowIndicator();
  13465. this.unrenderDates();
  13466. };
  13467. View.prototype.renderDates = function (dateProfile) { };
  13468. View.prototype.unrenderDates = function () { };
  13469. // Business Hours
  13470. // -----------------------------------------------------------------------------------------------------------------
  13471. View.prototype.renderBusinessHours = function (businessHours) { };
  13472. View.prototype.unrenderBusinessHours = function () { };
  13473. // Date Selection
  13474. // -----------------------------------------------------------------------------------------------------------------
  13475. View.prototype.renderDateSelectionWrap = function (selection) {
  13476. if (selection) {
  13477. this.renderDateSelection(selection);
  13478. }
  13479. };
  13480. View.prototype.unrenderDateSelectionWrap = function (selection) {
  13481. if (selection) {
  13482. this.unrenderDateSelection(selection);
  13483. }
  13484. };
  13485. View.prototype.renderDateSelection = function (selection) { };
  13486. View.prototype.unrenderDateSelection = function (selection) { };
  13487. // Event Rendering
  13488. // -----------------------------------------------------------------------------------------------------------------
  13489. View.prototype.renderEvents = function (eventStore) { };
  13490. View.prototype.unrenderEvents = function () { };
  13491. // util for subclasses
  13492. View.prototype.sliceEvents = function (eventStore, allDay) {
  13493. var props = this.props;
  13494. return sliceEventStore(eventStore, props.eventUiBases, props.dateProfile.activeRange, allDay ? this.context.nextDayThreshold : null).fg;
  13495. };
  13496. // Event Selection
  13497. // -----------------------------------------------------------------------------------------------------------------
  13498. View.prototype.renderEventSelectionWrap = function (instanceId) {
  13499. if (instanceId) {
  13500. this.renderEventSelection(instanceId);
  13501. }
  13502. };
  13503. View.prototype.unrenderEventSelectionWrap = function (instanceId) {
  13504. if (instanceId) {
  13505. this.unrenderEventSelection(instanceId);
  13506. }
  13507. };
  13508. View.prototype.renderEventSelection = function (instanceId) { };
  13509. View.prototype.unrenderEventSelection = function (instanceId) { };
  13510. // Event Drag
  13511. // -----------------------------------------------------------------------------------------------------------------
  13512. View.prototype.renderEventDragWrap = function (state) {
  13513. if (state) {
  13514. this.renderEventDrag(state);
  13515. }
  13516. };
  13517. View.prototype.unrenderEventDragWrap = function (state) {
  13518. if (state) {
  13519. this.unrenderEventDrag(state);
  13520. }
  13521. };
  13522. View.prototype.renderEventDrag = function (state) { };
  13523. View.prototype.unrenderEventDrag = function (state) { };
  13524. // Event Resize
  13525. // -----------------------------------------------------------------------------------------------------------------
  13526. View.prototype.renderEventResizeWrap = function (state) {
  13527. if (state) {
  13528. this.renderEventResize(state);
  13529. }
  13530. };
  13531. View.prototype.unrenderEventResizeWrap = function (state) {
  13532. if (state) {
  13533. this.unrenderEventResize(state);
  13534. }
  13535. };
  13536. View.prototype.renderEventResize = function (state) { };
  13537. View.prototype.unrenderEventResize = function (state) { };
  13538. /* Now Indicator
  13539. ------------------------------------------------------------------------------------------------------------------*/
  13540. // Immediately render the current time indicator and begins re-rendering it at an interval,
  13541. // which is defined by this.getNowIndicatorUnit().
  13542. // TODO: somehow do this for the current whole day's background too
  13543. // USAGE: must be called manually from subclasses' render methods! don't need to call stopNowIndicator tho
  13544. View.prototype.startNowIndicator = function (dateProfile, dateProfileGenerator) {
  13545. var _this = this;
  13546. var _a = this.context, calendar = _a.calendar, dateEnv = _a.dateEnv, options = _a.options;
  13547. var unit;
  13548. var update;
  13549. var delay; // ms wait value
  13550. if (options.nowIndicator && !this.initialNowDate) {
  13551. unit = this.getNowIndicatorUnit(dateProfile, dateProfileGenerator);
  13552. if (unit) {
  13553. update = this.updateNowIndicator.bind(this);
  13554. this.initialNowDate = calendar.getNow();
  13555. this.initialNowQueriedMs = new Date().valueOf();
  13556. // wait until the beginning of the next interval
  13557. delay = dateEnv.add(dateEnv.startOf(this.initialNowDate, unit), createDuration(1, unit)).valueOf() - this.initialNowDate.valueOf();
  13558. // TODO: maybe always use setTimeout, waiting until start of next unit
  13559. this.nowIndicatorTimeoutID = setTimeout(function () {
  13560. _this.nowIndicatorTimeoutID = null;
  13561. update();
  13562. if (unit === 'second') {
  13563. delay = 1000; // every second
  13564. }
  13565. else {
  13566. delay = 1000 * 60; // otherwise, every minute
  13567. }
  13568. _this.nowIndicatorIntervalID = setInterval(update, delay); // update every interval
  13569. }, delay);
  13570. }
  13571. // rendering will be initiated in updateSize
  13572. }
  13573. };
  13574. // rerenders the now indicator, computing the new current time from the amount of time that has passed
  13575. // since the initial getNow call.
  13576. View.prototype.updateNowIndicator = function () {
  13577. if (this.props.dateProfile && // a way to determine if dates were rendered yet
  13578. this.initialNowDate // activated before?
  13579. ) {
  13580. this.unrenderNowIndicator(); // won't unrender if unnecessary
  13581. this.renderNowIndicator(addMs(this.initialNowDate, new Date().valueOf() - this.initialNowQueriedMs));
  13582. this.isNowIndicatorRendered = true;
  13583. }
  13584. };
  13585. // Immediately unrenders the view's current time indicator and stops any re-rendering timers.
  13586. // Won't cause side effects if indicator isn't rendered.
  13587. View.prototype.stopNowIndicator = function () {
  13588. if (this.nowIndicatorTimeoutID) {
  13589. clearTimeout(this.nowIndicatorTimeoutID);
  13590. this.nowIndicatorTimeoutID = null;
  13591. }
  13592. if (this.nowIndicatorIntervalID) {
  13593. clearInterval(this.nowIndicatorIntervalID);
  13594. this.nowIndicatorIntervalID = null;
  13595. }
  13596. if (this.isNowIndicatorRendered) {
  13597. this.unrenderNowIndicator();
  13598. this.isNowIndicatorRendered = false;
  13599. }
  13600. };
  13601. View.prototype.getNowIndicatorUnit = function (dateProfile, dateProfileGenerator) {
  13602. // subclasses should implement
  13603. };
  13604. // Renders a current time indicator at the given datetime
  13605. View.prototype.renderNowIndicator = function (date) {
  13606. // SUBCLASSES MUST PASS TO CHILDREN!
  13607. };
  13608. // Undoes the rendering actions from renderNowIndicator
  13609. View.prototype.unrenderNowIndicator = function () {
  13610. // SUBCLASSES MUST PASS TO CHILDREN!
  13611. };
  13612. /* Scroller
  13613. ------------------------------------------------------------------------------------------------------------------*/
  13614. View.prototype.addScroll = function (scroll, isForced) {
  13615. if (isForced) {
  13616. scroll.isForced = isForced;
  13617. }
  13618. __assign(this.queuedScroll || (this.queuedScroll = {}), scroll);
  13619. };
  13620. View.prototype.popScroll = function (isResize) {
  13621. this.applyQueuedScroll(isResize);
  13622. this.queuedScroll = null;
  13623. };
  13624. View.prototype.applyQueuedScroll = function (isResize) {
  13625. if (this.queuedScroll) {
  13626. this.applyScroll(this.queuedScroll, isResize);
  13627. }
  13628. };
  13629. View.prototype.queryScroll = function () {
  13630. var scroll = {};
  13631. if (this.props.dateProfile) { // dates rendered yet?
  13632. __assign(scroll, this.queryDateScroll());
  13633. }
  13634. return scroll;
  13635. };
  13636. View.prototype.applyScroll = function (scroll, isResize) {
  13637. var duration = scroll.duration, isForced = scroll.isForced;
  13638. if (duration != null && !isForced) {
  13639. delete scroll.duration;
  13640. if (this.props.dateProfile) { // dates rendered yet?
  13641. __assign(scroll, this.computeDateScroll(duration));
  13642. }
  13643. }
  13644. if (this.props.dateProfile) { // dates rendered yet?
  13645. this.applyDateScroll(scroll);
  13646. }
  13647. };
  13648. View.prototype.computeDateScroll = function (duration) {
  13649. return {}; // subclasses must implement
  13650. };
  13651. View.prototype.queryDateScroll = function () {
  13652. return {}; // subclasses must implement
  13653. };
  13654. View.prototype.applyDateScroll = function (scroll) {
  13655. // subclasses must implement
  13656. };
  13657. // for API
  13658. View.prototype.scrollToDuration = function (duration) {
  13659. this.applyScroll({ duration: duration }, false);
  13660. };
  13661. return View;
  13662. }(DateComponent));
  13663. EmitterMixin.mixInto(View);
  13664. View.prototype.usesMinMaxTime = false;
  13665. View.prototype.dateProfileGeneratorClass = DateProfileGenerator;
  13666. var FgEventRenderer = /** @class */ (function () {
  13667. function FgEventRenderer() {
  13668. this.segs = [];
  13669. this.isSizeDirty = false;
  13670. }
  13671. FgEventRenderer.prototype.renderSegs = function (context, segs, mirrorInfo) {
  13672. this.context = context;
  13673. this.rangeUpdated(); // called too frequently :(
  13674. // render an `.el` on each seg
  13675. // returns a subset of the segs. segs that were actually rendered
  13676. segs = this.renderSegEls(segs, mirrorInfo);
  13677. this.segs = segs;
  13678. this.attachSegs(segs, mirrorInfo);
  13679. this.isSizeDirty = true;
  13680. triggerRenderedSegs(this.context, this.segs, Boolean(mirrorInfo));
  13681. };
  13682. FgEventRenderer.prototype.unrender = function (context, _segs, mirrorInfo) {
  13683. triggerWillRemoveSegs(this.context, this.segs, Boolean(mirrorInfo));
  13684. this.detachSegs(this.segs);
  13685. this.segs = [];
  13686. };
  13687. // Updates values that rely on options and also relate to range
  13688. FgEventRenderer.prototype.rangeUpdated = function () {
  13689. var options = this.context.options;
  13690. var displayEventTime;
  13691. var displayEventEnd;
  13692. this.eventTimeFormat = createFormatter(options.eventTimeFormat || this.computeEventTimeFormat(), options.defaultRangeSeparator);
  13693. displayEventTime = options.displayEventTime;
  13694. if (displayEventTime == null) {
  13695. displayEventTime = this.computeDisplayEventTime(); // might be based off of range
  13696. }
  13697. displayEventEnd = options.displayEventEnd;
  13698. if (displayEventEnd == null) {
  13699. displayEventEnd = this.computeDisplayEventEnd(); // might be based off of range
  13700. }
  13701. this.displayEventTime = displayEventTime;
  13702. this.displayEventEnd = displayEventEnd;
  13703. };
  13704. // Renders and assigns an `el` property for each foreground event segment.
  13705. // Only returns segments that successfully rendered.
  13706. FgEventRenderer.prototype.renderSegEls = function (segs, mirrorInfo) {
  13707. var html = '';
  13708. var i;
  13709. if (segs.length) { // don't build an empty html string
  13710. // build a large concatenation of event segment HTML
  13711. for (i = 0; i < segs.length; i++) {
  13712. html += this.renderSegHtml(segs[i], mirrorInfo);
  13713. }
  13714. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  13715. // Then, compute the 'el' for each segment. An el might be null if the eventRender callback returned false.
  13716. htmlToElements(html).forEach(function (el, i) {
  13717. var seg = segs[i];
  13718. if (el) {
  13719. seg.el = el;
  13720. }
  13721. });
  13722. segs = filterSegsViaEls(this.context, segs, Boolean(mirrorInfo));
  13723. }
  13724. return segs;
  13725. };
  13726. // Generic utility for generating the HTML classNames for an event segment's element
  13727. FgEventRenderer.prototype.getSegClasses = function (seg, isDraggable, isResizable, mirrorInfo) {
  13728. var classes = [
  13729. 'fc-event',
  13730. seg.isStart ? 'fc-start' : 'fc-not-start',
  13731. seg.isEnd ? 'fc-end' : 'fc-not-end'
  13732. ].concat(seg.eventRange.ui.classNames);
  13733. if (isDraggable) {
  13734. classes.push('fc-draggable');
  13735. }
  13736. if (isResizable) {
  13737. classes.push('fc-resizable');
  13738. }
  13739. if (mirrorInfo) {
  13740. classes.push('fc-mirror');
  13741. if (mirrorInfo.isDragging) {
  13742. classes.push('fc-dragging');
  13743. }
  13744. if (mirrorInfo.isResizing) {
  13745. classes.push('fc-resizing');
  13746. }
  13747. }
  13748. return classes;
  13749. };
  13750. // Compute the text that should be displayed on an event's element.
  13751. // `range` can be the Event object itself, or something range-like, with at least a `start`.
  13752. // If event times are disabled, or the event has no time, will return a blank string.
  13753. // If not specified, formatter will default to the eventTimeFormat setting,
  13754. // and displayEnd will default to the displayEventEnd setting.
  13755. FgEventRenderer.prototype.getTimeText = function (eventRange, formatter, displayEnd) {
  13756. var def = eventRange.def, instance = eventRange.instance;
  13757. return this._getTimeText(instance.range.start, def.hasEnd ? instance.range.end : null, def.allDay, formatter, displayEnd, instance.forcedStartTzo, instance.forcedEndTzo);
  13758. };
  13759. FgEventRenderer.prototype._getTimeText = function (start, end, allDay, formatter, displayEnd, forcedStartTzo, forcedEndTzo) {
  13760. var dateEnv = this.context.dateEnv;
  13761. if (formatter == null) {
  13762. formatter = this.eventTimeFormat;
  13763. }
  13764. if (displayEnd == null) {
  13765. displayEnd = this.displayEventEnd;
  13766. }
  13767. if (this.displayEventTime && !allDay) {
  13768. if (displayEnd && end) {
  13769. return dateEnv.formatRange(start, end, formatter, {
  13770. forcedStartTzo: forcedStartTzo,
  13771. forcedEndTzo: forcedEndTzo
  13772. });
  13773. }
  13774. else {
  13775. return dateEnv.format(start, formatter, {
  13776. forcedTzo: forcedStartTzo
  13777. });
  13778. }
  13779. }
  13780. return '';
  13781. };
  13782. FgEventRenderer.prototype.computeEventTimeFormat = function () {
  13783. return {
  13784. hour: 'numeric',
  13785. minute: '2-digit',
  13786. omitZeroMinute: true
  13787. };
  13788. };
  13789. FgEventRenderer.prototype.computeDisplayEventTime = function () {
  13790. return true;
  13791. };
  13792. FgEventRenderer.prototype.computeDisplayEventEnd = function () {
  13793. return true;
  13794. };
  13795. // Utility for generating event skin-related CSS properties
  13796. FgEventRenderer.prototype.getSkinCss = function (ui) {
  13797. return {
  13798. 'background-color': ui.backgroundColor,
  13799. 'border-color': ui.borderColor,
  13800. color: ui.textColor
  13801. };
  13802. };
  13803. FgEventRenderer.prototype.sortEventSegs = function (segs) {
  13804. var specs = this.context.eventOrderSpecs;
  13805. var objs = segs.map(buildSegCompareObj);
  13806. objs.sort(function (obj0, obj1) {
  13807. return compareByFieldSpecs(obj0, obj1, specs);
  13808. });
  13809. return objs.map(function (c) {
  13810. return c._seg;
  13811. });
  13812. };
  13813. FgEventRenderer.prototype.computeSizes = function (force) {
  13814. if (force || this.isSizeDirty) {
  13815. this.computeSegSizes(this.segs);
  13816. }
  13817. };
  13818. FgEventRenderer.prototype.assignSizes = function (force) {
  13819. if (force || this.isSizeDirty) {
  13820. this.assignSegSizes(this.segs);
  13821. this.isSizeDirty = false;
  13822. }
  13823. };
  13824. FgEventRenderer.prototype.computeSegSizes = function (segs) {
  13825. };
  13826. FgEventRenderer.prototype.assignSegSizes = function (segs) {
  13827. };
  13828. // Manipulation on rendered segs
  13829. FgEventRenderer.prototype.hideByHash = function (hash) {
  13830. if (hash) {
  13831. for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
  13832. var seg = _a[_i];
  13833. if (hash[seg.eventRange.instance.instanceId]) {
  13834. seg.el.style.visibility = 'hidden';
  13835. }
  13836. }
  13837. }
  13838. };
  13839. FgEventRenderer.prototype.showByHash = function (hash) {
  13840. if (hash) {
  13841. for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
  13842. var seg = _a[_i];
  13843. if (hash[seg.eventRange.instance.instanceId]) {
  13844. seg.el.style.visibility = '';
  13845. }
  13846. }
  13847. }
  13848. };
  13849. FgEventRenderer.prototype.selectByInstanceId = function (instanceId) {
  13850. if (instanceId) {
  13851. for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
  13852. var seg = _a[_i];
  13853. var eventInstance = seg.eventRange.instance;
  13854. if (eventInstance && eventInstance.instanceId === instanceId &&
  13855. seg.el // necessary?
  13856. ) {
  13857. seg.el.classList.add('fc-selected');
  13858. }
  13859. }
  13860. }
  13861. };
  13862. FgEventRenderer.prototype.unselectByInstanceId = function (instanceId) {
  13863. if (instanceId) {
  13864. for (var _i = 0, _a = this.segs; _i < _a.length; _i++) {
  13865. var seg = _a[_i];
  13866. if (seg.el) { // necessary?
  13867. seg.el.classList.remove('fc-selected');
  13868. }
  13869. }
  13870. }
  13871. };
  13872. return FgEventRenderer;
  13873. }());
  13874. // returns a object with all primitive props that can be compared
  13875. function buildSegCompareObj(seg) {
  13876. var eventDef = seg.eventRange.def;
  13877. var range = seg.eventRange.instance.range;
  13878. var start = range.start ? range.start.valueOf() : 0; // TODO: better support for open-range events
  13879. var end = range.end ? range.end.valueOf() : 0; // "
  13880. return __assign({}, eventDef.extendedProps, eventDef, { id: eventDef.publicId, start: start,
  13881. end: end, duration: end - start, allDay: Number(eventDef.allDay), _seg: seg // for later retrieval
  13882. });
  13883. }
  13884. /*
  13885. TODO: when refactoring this class, make a new FillRenderer instance for each `type`
  13886. */
  13887. var FillRenderer = /** @class */ (function () {
  13888. function FillRenderer() {
  13889. this.fillSegTag = 'div';
  13890. this.dirtySizeFlags = {};
  13891. this.containerElsByType = {};
  13892. this.segsByType = {};
  13893. }
  13894. FillRenderer.prototype.getSegsByType = function (type) {
  13895. return this.segsByType[type] || [];
  13896. };
  13897. FillRenderer.prototype.renderSegs = function (type, context, segs) {
  13898. var _a;
  13899. this.context = context;
  13900. var renderedSegs = this.renderSegEls(type, segs); // assignes `.el` to each seg. returns successfully rendered segs
  13901. var containerEls = this.attachSegs(type, renderedSegs);
  13902. if (containerEls) {
  13903. (_a = (this.containerElsByType[type] || (this.containerElsByType[type] = []))).push.apply(_a, containerEls);
  13904. }
  13905. this.segsByType[type] = renderedSegs;
  13906. if (type === 'bgEvent') {
  13907. triggerRenderedSegs(context, renderedSegs, false); // isMirror=false
  13908. }
  13909. this.dirtySizeFlags[type] = true;
  13910. };
  13911. // Unrenders a specific type of fill that is currently rendered on the grid
  13912. FillRenderer.prototype.unrender = function (type, context) {
  13913. var segs = this.segsByType[type];
  13914. if (segs) {
  13915. if (type === 'bgEvent') {
  13916. triggerWillRemoveSegs(context, segs, false); // isMirror=false
  13917. }
  13918. this.detachSegs(type, segs);
  13919. }
  13920. };
  13921. // Renders and assigns an `el` property for each fill segment. Generic enough to work with different types.
  13922. // Only returns segments that successfully rendered.
  13923. FillRenderer.prototype.renderSegEls = function (type, segs) {
  13924. var _this = this;
  13925. var html = '';
  13926. var i;
  13927. if (segs.length) {
  13928. // build a large concatenation of segment HTML
  13929. for (i = 0; i < segs.length; i++) {
  13930. html += this.renderSegHtml(type, segs[i]);
  13931. }
  13932. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  13933. // Then, compute the 'el' for each segment.
  13934. htmlToElements(html).forEach(function (el, i) {
  13935. var seg = segs[i];
  13936. if (el) {
  13937. seg.el = el;
  13938. }
  13939. });
  13940. if (type === 'bgEvent') {
  13941. segs = filterSegsViaEls(this.context, segs, false // isMirror. background events can never be mirror elements
  13942. );
  13943. }
  13944. // correct element type? (would be bad if a non-TD were inserted into a table for example)
  13945. segs = segs.filter(function (seg) {
  13946. return elementMatches(seg.el, _this.fillSegTag);
  13947. });
  13948. }
  13949. return segs;
  13950. };
  13951. // Builds the HTML needed for one fill segment. Generic enough to work with different types.
  13952. FillRenderer.prototype.renderSegHtml = function (type, seg) {
  13953. var css = null;
  13954. var classNames = [];
  13955. if (type !== 'highlight' && type !== 'businessHours') {
  13956. css = {
  13957. 'background-color': seg.eventRange.ui.backgroundColor
  13958. };
  13959. }
  13960. if (type !== 'highlight') {
  13961. classNames = classNames.concat(seg.eventRange.ui.classNames);
  13962. }
  13963. if (type === 'businessHours') {
  13964. classNames.push('fc-bgevent');
  13965. }
  13966. else {
  13967. classNames.push('fc-' + type.toLowerCase());
  13968. }
  13969. return '<' + this.fillSegTag +
  13970. (classNames.length ? ' class="' + classNames.join(' ') + '"' : '') +
  13971. (css ? ' style="' + cssToStr(css) + '"' : '') +
  13972. '></' + this.fillSegTag + '>';
  13973. };
  13974. FillRenderer.prototype.detachSegs = function (type, segs) {
  13975. var containerEls = this.containerElsByType[type];
  13976. if (containerEls) {
  13977. containerEls.forEach(removeElement);
  13978. delete this.containerElsByType[type];
  13979. }
  13980. };
  13981. FillRenderer.prototype.computeSizes = function (force) {
  13982. for (var type in this.segsByType) {
  13983. if (force || this.dirtySizeFlags[type]) {
  13984. this.computeSegSizes(this.segsByType[type]);
  13985. }
  13986. }
  13987. };
  13988. FillRenderer.prototype.assignSizes = function (force) {
  13989. for (var type in this.segsByType) {
  13990. if (force || this.dirtySizeFlags[type]) {
  13991. this.assignSegSizes(this.segsByType[type]);
  13992. }
  13993. }
  13994. this.dirtySizeFlags = {};
  13995. };
  13996. FillRenderer.prototype.computeSegSizes = function (segs) {
  13997. };
  13998. FillRenderer.prototype.assignSegSizes = function (segs) {
  13999. };
  14000. return FillRenderer;
  14001. }());
  14002. var NamedTimeZoneImpl = /** @class */ (function () {
  14003. function NamedTimeZoneImpl(timeZoneName) {
  14004. this.timeZoneName = timeZoneName;
  14005. }
  14006. return NamedTimeZoneImpl;
  14007. }());
  14008. /*
  14009. An abstraction for a dragging interaction originating on an event.
  14010. Does higher-level things than PointerDragger, such as possibly:
  14011. - a "mirror" that moves with the pointer
  14012. - a minimum number of pixels or other criteria for a true drag to begin
  14013. subclasses must emit:
  14014. - pointerdown
  14015. - dragstart
  14016. - dragmove
  14017. - pointerup
  14018. - dragend
  14019. */
  14020. var ElementDragging = /** @class */ (function () {
  14021. function ElementDragging(el) {
  14022. this.emitter = new EmitterMixin();
  14023. }
  14024. ElementDragging.prototype.destroy = function () {
  14025. };
  14026. ElementDragging.prototype.setMirrorIsVisible = function (bool) {
  14027. // optional if subclass doesn't want to support a mirror
  14028. };
  14029. ElementDragging.prototype.setMirrorNeedsRevert = function (bool) {
  14030. // optional if subclass doesn't want to support a mirror
  14031. };
  14032. ElementDragging.prototype.setAutoScrollEnabled = function (bool) {
  14033. // optional
  14034. };
  14035. return ElementDragging;
  14036. }());
  14037. function formatDate(dateInput, settings) {
  14038. if (settings === void 0) { settings = {}; }
  14039. var dateEnv = buildDateEnv$1(settings);
  14040. var formatter = createFormatter(settings);
  14041. var dateMeta = dateEnv.createMarkerMeta(dateInput);
  14042. if (!dateMeta) { // TODO: warning?
  14043. return '';
  14044. }
  14045. return dateEnv.format(dateMeta.marker, formatter, {
  14046. forcedTzo: dateMeta.forcedTzo
  14047. });
  14048. }
  14049. function formatRange(startInput, endInput, settings // mixture of env and formatter settings
  14050. ) {
  14051. var dateEnv = buildDateEnv$1(typeof settings === 'object' && settings ? settings : {}); // pass in if non-null object
  14052. var formatter = createFormatter(settings, globalDefaults.defaultRangeSeparator);
  14053. var startMeta = dateEnv.createMarkerMeta(startInput);
  14054. var endMeta = dateEnv.createMarkerMeta(endInput);
  14055. if (!startMeta || !endMeta) { // TODO: warning?
  14056. return '';
  14057. }
  14058. return dateEnv.formatRange(startMeta.marker, endMeta.marker, formatter, {
  14059. forcedStartTzo: startMeta.forcedTzo,
  14060. forcedEndTzo: endMeta.forcedTzo,
  14061. isEndExclusive: settings.isEndExclusive
  14062. });
  14063. }
  14064. // TODO: more DRY and optimized
  14065. function buildDateEnv$1(settings) {
  14066. var locale = buildLocale(settings.locale || 'en', parseRawLocales([]).map); // TODO: don't hardcode 'en' everywhere
  14067. // ensure required settings
  14068. settings = __assign({ timeZone: globalDefaults.timeZone, calendarSystem: 'gregory' }, settings, { locale: locale });
  14069. return new DateEnv(settings);
  14070. }
  14071. var DRAG_META_PROPS = {
  14072. startTime: createDuration,
  14073. duration: createDuration,
  14074. create: Boolean,
  14075. sourceId: String
  14076. };
  14077. var DRAG_META_DEFAULTS = {
  14078. create: true
  14079. };
  14080. function parseDragMeta(raw) {
  14081. var leftoverProps = {};
  14082. var refined = refineProps(raw, DRAG_META_PROPS, DRAG_META_DEFAULTS, leftoverProps);
  14083. refined.leftoverProps = leftoverProps;
  14084. return refined;
  14085. }
  14086. // Computes a default column header formatting string if `colFormat` is not explicitly defined
  14087. function computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt) {
  14088. // if more than one week row, or if there are a lot of columns with not much space,
  14089. // put just the day numbers will be in each cell
  14090. if (!datesRepDistinctDays || dayCnt > 10) {
  14091. return { weekday: 'short' }; // "Sat"
  14092. }
  14093. else if (dayCnt > 1) {
  14094. return { weekday: 'short', month: 'numeric', day: 'numeric', omitCommas: true }; // "Sat 11/12"
  14095. }
  14096. else {
  14097. return { weekday: 'long' }; // "Saturday"
  14098. }
  14099. }
  14100. function renderDateCell(dateMarker, dateProfile, datesRepDistinctDays, colCnt, colHeadFormat, context, colspan, otherAttrs) {
  14101. var dateEnv = context.dateEnv, theme = context.theme, options = context.options;
  14102. var isDateValid = rangeContainsMarker(dateProfile.activeRange, dateMarker); // TODO: called too frequently. cache somehow.
  14103. var classNames = [
  14104. 'fc-day-header',
  14105. theme.getClass('widgetHeader')
  14106. ];
  14107. var innerHtml;
  14108. if (typeof options.columnHeaderHtml === 'function') {
  14109. innerHtml = options.columnHeaderHtml(dateEnv.toDate(dateMarker));
  14110. }
  14111. else if (typeof options.columnHeaderText === 'function') {
  14112. innerHtml = htmlEscape(options.columnHeaderText(dateEnv.toDate(dateMarker)));
  14113. }
  14114. else {
  14115. innerHtml = htmlEscape(dateEnv.format(dateMarker, colHeadFormat));
  14116. }
  14117. // if only one row of days, the classNames on the header can represent the specific days beneath
  14118. if (datesRepDistinctDays) {
  14119. classNames = classNames.concat(
  14120. // includes the day-of-week class
  14121. // noThemeHighlight=true (don't highlight the header)
  14122. getDayClasses(dateMarker, dateProfile, context, true));
  14123. }
  14124. else {
  14125. classNames.push('fc-' + DAY_IDS[dateMarker.getUTCDay()]); // only add the day-of-week class
  14126. }
  14127. return '' +
  14128. '<th class="' + classNames.join(' ') + '"' +
  14129. ((isDateValid && datesRepDistinctDays) ?
  14130. ' data-date="' + dateEnv.formatIso(dateMarker, { omitTime: true }) + '"' :
  14131. '') +
  14132. (colspan > 1 ?
  14133. ' colspan="' + colspan + '"' :
  14134. '') +
  14135. (otherAttrs ?
  14136. ' ' + otherAttrs :
  14137. '') +
  14138. '>' +
  14139. (isDateValid ?
  14140. // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff)
  14141. buildGotoAnchorHtml(options, dateEnv, { date: dateMarker, forceOff: !datesRepDistinctDays || colCnt === 1 }, innerHtml) :
  14142. // if not valid, display text, but no link
  14143. innerHtml) +
  14144. '</th>';
  14145. }
  14146. var DayHeader = /** @class */ (function (_super) {
  14147. __extends(DayHeader, _super);
  14148. function DayHeader(parentEl) {
  14149. var _this = _super.call(this) || this;
  14150. _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
  14151. _this.parentEl = parentEl;
  14152. return _this;
  14153. }
  14154. DayHeader.prototype.render = function (props, context) {
  14155. var dates = props.dates, datesRepDistinctDays = props.datesRepDistinctDays;
  14156. var parts = [];
  14157. this.renderSkeleton(context);
  14158. if (props.renderIntroHtml) {
  14159. parts.push(props.renderIntroHtml());
  14160. }
  14161. var colHeadFormat = createFormatter(context.options.columnHeaderFormat ||
  14162. computeFallbackHeaderFormat(datesRepDistinctDays, dates.length));
  14163. for (var _i = 0, dates_1 = dates; _i < dates_1.length; _i++) {
  14164. var date = dates_1[_i];
  14165. parts.push(renderDateCell(date, props.dateProfile, datesRepDistinctDays, dates.length, colHeadFormat, context));
  14166. }
  14167. if (context.isRtl) {
  14168. parts.reverse();
  14169. }
  14170. this.thead.innerHTML = '<tr>' + parts.join('') + '</tr>';
  14171. };
  14172. DayHeader.prototype.destroy = function () {
  14173. _super.prototype.destroy.call(this);
  14174. this.renderSkeleton.unrender();
  14175. };
  14176. DayHeader.prototype._renderSkeleton = function (context) {
  14177. var theme = context.theme;
  14178. var parentEl = this.parentEl;
  14179. parentEl.innerHTML = ''; // because might be nbsp
  14180. parentEl.appendChild(this.el = htmlToElement('<div class="fc-row ' + theme.getClass('headerRow') + '">' +
  14181. '<table class="' + theme.getClass('tableGrid') + '">' +
  14182. '<thead></thead>' +
  14183. '</table>' +
  14184. '</div>'));
  14185. this.thead = this.el.querySelector('thead');
  14186. };
  14187. DayHeader.prototype._unrenderSkeleton = function () {
  14188. removeElement(this.el);
  14189. };
  14190. return DayHeader;
  14191. }(Component));
  14192. var DaySeries = /** @class */ (function () {
  14193. function DaySeries(range, dateProfileGenerator) {
  14194. var date = range.start;
  14195. var end = range.end;
  14196. var indices = [];
  14197. var dates = [];
  14198. var dayIndex = -1;
  14199. while (date < end) { // loop each day from start to end
  14200. if (dateProfileGenerator.isHiddenDay(date)) {
  14201. indices.push(dayIndex + 0.5); // mark that it's between indices
  14202. }
  14203. else {
  14204. dayIndex++;
  14205. indices.push(dayIndex);
  14206. dates.push(date);
  14207. }
  14208. date = addDays(date, 1);
  14209. }
  14210. this.dates = dates;
  14211. this.indices = indices;
  14212. this.cnt = dates.length;
  14213. }
  14214. DaySeries.prototype.sliceRange = function (range) {
  14215. var firstIndex = this.getDateDayIndex(range.start); // inclusive first index
  14216. var lastIndex = this.getDateDayIndex(addDays(range.end, -1)); // inclusive last index
  14217. var clippedFirstIndex = Math.max(0, firstIndex);
  14218. var clippedLastIndex = Math.min(this.cnt - 1, lastIndex);
  14219. // deal with in-between indices
  14220. clippedFirstIndex = Math.ceil(clippedFirstIndex); // in-between starts round to next cell
  14221. clippedLastIndex = Math.floor(clippedLastIndex); // in-between ends round to prev cell
  14222. if (clippedFirstIndex <= clippedLastIndex) {
  14223. return {
  14224. firstIndex: clippedFirstIndex,
  14225. lastIndex: clippedLastIndex,
  14226. isStart: firstIndex === clippedFirstIndex,
  14227. isEnd: lastIndex === clippedLastIndex
  14228. };
  14229. }
  14230. else {
  14231. return null;
  14232. }
  14233. };
  14234. // Given a date, returns its chronolocial cell-index from the first cell of the grid.
  14235. // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets.
  14236. // If before the first offset, returns a negative number.
  14237. // If after the last offset, returns an offset past the last cell offset.
  14238. // Only works for *start* dates of cells. Will not work for exclusive end dates for cells.
  14239. DaySeries.prototype.getDateDayIndex = function (date) {
  14240. var indices = this.indices;
  14241. var dayOffset = Math.floor(diffDays(this.dates[0], date));
  14242. if (dayOffset < 0) {
  14243. return indices[0] - 1;
  14244. }
  14245. else if (dayOffset >= indices.length) {
  14246. return indices[indices.length - 1] + 1;
  14247. }
  14248. else {
  14249. return indices[dayOffset];
  14250. }
  14251. };
  14252. return DaySeries;
  14253. }());
  14254. var DayTable = /** @class */ (function () {
  14255. function DayTable(daySeries, breakOnWeeks) {
  14256. var dates = daySeries.dates;
  14257. var daysPerRow;
  14258. var firstDay;
  14259. var rowCnt;
  14260. if (breakOnWeeks) {
  14261. // count columns until the day-of-week repeats
  14262. firstDay = dates[0].getUTCDay();
  14263. for (daysPerRow = 1; daysPerRow < dates.length; daysPerRow++) {
  14264. if (dates[daysPerRow].getUTCDay() === firstDay) {
  14265. break;
  14266. }
  14267. }
  14268. rowCnt = Math.ceil(dates.length / daysPerRow);
  14269. }
  14270. else {
  14271. rowCnt = 1;
  14272. daysPerRow = dates.length;
  14273. }
  14274. this.rowCnt = rowCnt;
  14275. this.colCnt = daysPerRow;
  14276. this.daySeries = daySeries;
  14277. this.cells = this.buildCells();
  14278. this.headerDates = this.buildHeaderDates();
  14279. }
  14280. DayTable.prototype.buildCells = function () {
  14281. var rows = [];
  14282. for (var row = 0; row < this.rowCnt; row++) {
  14283. var cells = [];
  14284. for (var col = 0; col < this.colCnt; col++) {
  14285. cells.push(this.buildCell(row, col));
  14286. }
  14287. rows.push(cells);
  14288. }
  14289. return rows;
  14290. };
  14291. DayTable.prototype.buildCell = function (row, col) {
  14292. return {
  14293. date: this.daySeries.dates[row * this.colCnt + col]
  14294. };
  14295. };
  14296. DayTable.prototype.buildHeaderDates = function () {
  14297. var dates = [];
  14298. for (var col = 0; col < this.colCnt; col++) {
  14299. dates.push(this.cells[0][col].date);
  14300. }
  14301. return dates;
  14302. };
  14303. DayTable.prototype.sliceRange = function (range) {
  14304. var colCnt = this.colCnt;
  14305. var seriesSeg = this.daySeries.sliceRange(range);
  14306. var segs = [];
  14307. if (seriesSeg) {
  14308. var firstIndex = seriesSeg.firstIndex, lastIndex = seriesSeg.lastIndex;
  14309. var index = firstIndex;
  14310. while (index <= lastIndex) {
  14311. var row = Math.floor(index / colCnt);
  14312. var nextIndex = Math.min((row + 1) * colCnt, lastIndex + 1);
  14313. segs.push({
  14314. row: row,
  14315. firstCol: index % colCnt,
  14316. lastCol: (nextIndex - 1) % colCnt,
  14317. isStart: seriesSeg.isStart && index === firstIndex,
  14318. isEnd: seriesSeg.isEnd && (nextIndex - 1) === lastIndex
  14319. });
  14320. index = nextIndex;
  14321. }
  14322. }
  14323. return segs;
  14324. };
  14325. return DayTable;
  14326. }());
  14327. var Slicer = /** @class */ (function () {
  14328. function Slicer() {
  14329. this.sliceBusinessHours = memoize(this._sliceBusinessHours);
  14330. this.sliceDateSelection = memoize(this._sliceDateSpan);
  14331. this.sliceEventStore = memoize(this._sliceEventStore);
  14332. this.sliceEventDrag = memoize(this._sliceInteraction);
  14333. this.sliceEventResize = memoize(this._sliceInteraction);
  14334. }
  14335. Slicer.prototype.sliceProps = function (props, dateProfile, nextDayThreshold, calendar, component) {
  14336. var extraArgs = [];
  14337. for (var _i = 5; _i < arguments.length; _i++) {
  14338. extraArgs[_i - 5] = arguments[_i];
  14339. }
  14340. var eventUiBases = props.eventUiBases;
  14341. var eventSegs = this.sliceEventStore.apply(this, [props.eventStore, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs));
  14342. return {
  14343. dateSelectionSegs: this.sliceDateSelection.apply(this, [props.dateSelection, eventUiBases, component].concat(extraArgs)),
  14344. businessHourSegs: this.sliceBusinessHours.apply(this, [props.businessHours, dateProfile, nextDayThreshold, calendar, component].concat(extraArgs)),
  14345. fgEventSegs: eventSegs.fg,
  14346. bgEventSegs: eventSegs.bg,
  14347. eventDrag: this.sliceEventDrag.apply(this, [props.eventDrag, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs)),
  14348. eventResize: this.sliceEventResize.apply(this, [props.eventResize, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs)),
  14349. eventSelection: props.eventSelection
  14350. }; // TODO: give interactionSegs?
  14351. };
  14352. Slicer.prototype.sliceNowDate = function (// does not memoize
  14353. date, component) {
  14354. var extraArgs = [];
  14355. for (var _i = 2; _i < arguments.length; _i++) {
  14356. extraArgs[_i - 2] = arguments[_i];
  14357. }
  14358. return this._sliceDateSpan.apply(this, [{ range: { start: date, end: addMs(date, 1) }, allDay: false },
  14359. {},
  14360. component].concat(extraArgs));
  14361. };
  14362. Slicer.prototype._sliceBusinessHours = function (businessHours, dateProfile, nextDayThreshold, calendar, component) {
  14363. var extraArgs = [];
  14364. for (var _i = 5; _i < arguments.length; _i++) {
  14365. extraArgs[_i - 5] = arguments[_i];
  14366. }
  14367. if (!businessHours) {
  14368. return [];
  14369. }
  14370. return this._sliceEventStore.apply(this, [expandRecurring(businessHours, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), calendar),
  14371. {},
  14372. dateProfile,
  14373. nextDayThreshold,
  14374. component].concat(extraArgs)).bg;
  14375. };
  14376. Slicer.prototype._sliceEventStore = function (eventStore, eventUiBases, dateProfile, nextDayThreshold, component) {
  14377. var extraArgs = [];
  14378. for (var _i = 5; _i < arguments.length; _i++) {
  14379. extraArgs[_i - 5] = arguments[_i];
  14380. }
  14381. if (eventStore) {
  14382. var rangeRes = sliceEventStore(eventStore, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold);
  14383. return {
  14384. bg: this.sliceEventRanges(rangeRes.bg, component, extraArgs),
  14385. fg: this.sliceEventRanges(rangeRes.fg, component, extraArgs)
  14386. };
  14387. }
  14388. else {
  14389. return { bg: [], fg: [] };
  14390. }
  14391. };
  14392. Slicer.prototype._sliceInteraction = function (interaction, eventUiBases, dateProfile, nextDayThreshold, component) {
  14393. var extraArgs = [];
  14394. for (var _i = 5; _i < arguments.length; _i++) {
  14395. extraArgs[_i - 5] = arguments[_i];
  14396. }
  14397. if (!interaction) {
  14398. return null;
  14399. }
  14400. var rangeRes = sliceEventStore(interaction.mutatedEvents, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold);
  14401. return {
  14402. segs: this.sliceEventRanges(rangeRes.fg, component, extraArgs),
  14403. affectedInstances: interaction.affectedEvents.instances,
  14404. isEvent: interaction.isEvent,
  14405. sourceSeg: interaction.origSeg
  14406. };
  14407. };
  14408. Slicer.prototype._sliceDateSpan = function (dateSpan, eventUiBases, component) {
  14409. var extraArgs = [];
  14410. for (var _i = 3; _i < arguments.length; _i++) {
  14411. extraArgs[_i - 3] = arguments[_i];
  14412. }
  14413. if (!dateSpan) {
  14414. return [];
  14415. }
  14416. var eventRange = fabricateEventRange(dateSpan, eventUiBases, component.context.calendar);
  14417. var segs = this.sliceRange.apply(this, [dateSpan.range].concat(extraArgs));
  14418. for (var _a = 0, segs_1 = segs; _a < segs_1.length; _a++) {
  14419. var seg = segs_1[_a];
  14420. seg.component = component;
  14421. seg.eventRange = eventRange;
  14422. }
  14423. return segs;
  14424. };
  14425. /*
  14426. "complete" seg means it has component and eventRange
  14427. */
  14428. Slicer.prototype.sliceEventRanges = function (eventRanges, component, // TODO: kill
  14429. extraArgs) {
  14430. var segs = [];
  14431. for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) {
  14432. var eventRange = eventRanges_1[_i];
  14433. segs.push.apply(segs, this.sliceEventRange(eventRange, component, extraArgs));
  14434. }
  14435. return segs;
  14436. };
  14437. /*
  14438. "complete" seg means it has component and eventRange
  14439. */
  14440. Slicer.prototype.sliceEventRange = function (eventRange, component, // TODO: kill
  14441. extraArgs) {
  14442. var segs = this.sliceRange.apply(this, [eventRange.range].concat(extraArgs));
  14443. for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
  14444. var seg = segs_2[_i];
  14445. seg.component = component;
  14446. seg.eventRange = eventRange;
  14447. seg.isStart = eventRange.isStart && seg.isStart;
  14448. seg.isEnd = eventRange.isEnd && seg.isEnd;
  14449. }
  14450. return segs;
  14451. };
  14452. return Slicer;
  14453. }());
  14454. /*
  14455. for incorporating minTime/maxTime if appropriate
  14456. TODO: should be part of DateProfile!
  14457. TimelineDateProfile already does this btw
  14458. */
  14459. function computeActiveRange(dateProfile, isComponentAllDay) {
  14460. var range = dateProfile.activeRange;
  14461. if (isComponentAllDay) {
  14462. return range;
  14463. }
  14464. return {
  14465. start: addMs(range.start, dateProfile.minTime.milliseconds),
  14466. end: addMs(range.end, dateProfile.maxTime.milliseconds - 864e5) // 864e5 = ms in a day
  14467. };
  14468. }
  14469. // exports
  14470. // --------------------------------------------------------------------------------------------------
  14471. var version = '4.4.0';
  14472. exports.Calendar = Calendar;
  14473. exports.Component = Component;
  14474. exports.ComponentContext = ComponentContext;
  14475. exports.DateComponent = DateComponent;
  14476. exports.DateEnv = DateEnv;
  14477. exports.DateProfileGenerator = DateProfileGenerator;
  14478. exports.DayHeader = DayHeader;
  14479. exports.DaySeries = DaySeries;
  14480. exports.DayTable = DayTable;
  14481. exports.ElementDragging = ElementDragging;
  14482. exports.ElementScrollController = ElementScrollController;
  14483. exports.EmitterMixin = EmitterMixin;
  14484. exports.EventApi = EventApi;
  14485. exports.FgEventRenderer = FgEventRenderer;
  14486. exports.FillRenderer = FillRenderer;
  14487. exports.Interaction = Interaction;
  14488. exports.Mixin = Mixin;
  14489. exports.NamedTimeZoneImpl = NamedTimeZoneImpl;
  14490. exports.PositionCache = PositionCache;
  14491. exports.ScrollComponent = ScrollComponent;
  14492. exports.ScrollController = ScrollController;
  14493. exports.Slicer = Slicer;
  14494. exports.Splitter = Splitter;
  14495. exports.Theme = Theme;
  14496. exports.View = View;
  14497. exports.WindowScrollController = WindowScrollController;
  14498. exports.addDays = addDays;
  14499. exports.addDurations = addDurations;
  14500. exports.addMs = addMs;
  14501. exports.addWeeks = addWeeks;
  14502. exports.allowContextMenu = allowContextMenu;
  14503. exports.allowSelection = allowSelection;
  14504. exports.appendToElement = appendToElement;
  14505. exports.applyAll = applyAll;
  14506. exports.applyMutationToEventStore = applyMutationToEventStore;
  14507. exports.applyStyle = applyStyle;
  14508. exports.applyStyleProp = applyStyleProp;
  14509. exports.asRoughMinutes = asRoughMinutes;
  14510. exports.asRoughMs = asRoughMs;
  14511. exports.asRoughSeconds = asRoughSeconds;
  14512. exports.buildGotoAnchorHtml = buildGotoAnchorHtml;
  14513. exports.buildSegCompareObj = buildSegCompareObj;
  14514. exports.capitaliseFirstLetter = capitaliseFirstLetter;
  14515. exports.combineEventUis = combineEventUis;
  14516. exports.compareByFieldSpec = compareByFieldSpec;
  14517. exports.compareByFieldSpecs = compareByFieldSpecs;
  14518. exports.compareNumbers = compareNumbers;
  14519. exports.compensateScroll = compensateScroll;
  14520. exports.computeClippingRect = computeClippingRect;
  14521. exports.computeEdges = computeEdges;
  14522. exports.computeEventDraggable = computeEventDraggable;
  14523. exports.computeEventEndResizable = computeEventEndResizable;
  14524. exports.computeEventStartResizable = computeEventStartResizable;
  14525. exports.computeFallbackHeaderFormat = computeFallbackHeaderFormat;
  14526. exports.computeHeightAndMargins = computeHeightAndMargins;
  14527. exports.computeInnerRect = computeInnerRect;
  14528. exports.computeRect = computeRect;
  14529. exports.computeVisibleDayRange = computeVisibleDayRange;
  14530. exports.config = config;
  14531. exports.constrainPoint = constrainPoint;
  14532. exports.createDuration = createDuration;
  14533. exports.createElement = createElement;
  14534. exports.createEmptyEventStore = createEmptyEventStore;
  14535. exports.createEventInstance = createEventInstance;
  14536. exports.createFormatter = createFormatter;
  14537. exports.createPlugin = createPlugin;
  14538. exports.cssToStr = cssToStr;
  14539. exports.debounce = debounce;
  14540. exports.diffDates = diffDates;
  14541. exports.diffDayAndTime = diffDayAndTime;
  14542. exports.diffDays = diffDays;
  14543. exports.diffPoints = diffPoints;
  14544. exports.diffWeeks = diffWeeks;
  14545. exports.diffWholeDays = diffWholeDays;
  14546. exports.diffWholeWeeks = diffWholeWeeks;
  14547. exports.disableCursor = disableCursor;
  14548. exports.distributeHeight = distributeHeight;
  14549. exports.elementClosest = elementClosest;
  14550. exports.elementMatches = elementMatches;
  14551. exports.enableCursor = enableCursor;
  14552. exports.eventTupleToStore = eventTupleToStore;
  14553. exports.filterEventStoreDefs = filterEventStoreDefs;
  14554. exports.filterHash = filterHash;
  14555. exports.findChildren = findChildren;
  14556. exports.findElements = findElements;
  14557. exports.flexibleCompare = flexibleCompare;
  14558. exports.forceClassName = forceClassName;
  14559. exports.formatDate = formatDate;
  14560. exports.formatIsoTimeString = formatIsoTimeString;
  14561. exports.formatRange = formatRange;
  14562. exports.getAllDayHtml = getAllDayHtml;
  14563. exports.getClippingParents = getClippingParents;
  14564. exports.getDayClasses = getDayClasses;
  14565. exports.getElSeg = getElSeg;
  14566. exports.getRectCenter = getRectCenter;
  14567. exports.getRelevantEvents = getRelevantEvents;
  14568. exports.globalDefaults = globalDefaults;
  14569. exports.greatestDurationDenominator = greatestDurationDenominator;
  14570. exports.hasBgRendering = hasBgRendering;
  14571. exports.htmlEscape = htmlEscape;
  14572. exports.htmlToElement = htmlToElement;
  14573. exports.insertAfterElement = insertAfterElement;
  14574. exports.interactionSettingsStore = interactionSettingsStore;
  14575. exports.interactionSettingsToStore = interactionSettingsToStore;
  14576. exports.intersectRanges = intersectRanges;
  14577. exports.intersectRects = intersectRects;
  14578. exports.isArraysEqual = isArraysEqual;
  14579. exports.isDateSpansEqual = isDateSpansEqual;
  14580. exports.isInt = isInt;
  14581. exports.isInteractionValid = isInteractionValid;
  14582. exports.isMultiDayRange = isMultiDayRange;
  14583. exports.isPropsEqual = isPropsEqual;
  14584. exports.isPropsValid = isPropsValid;
  14585. exports.isSingleDay = isSingleDay;
  14586. exports.isValidDate = isValidDate;
  14587. exports.listenBySelector = listenBySelector;
  14588. exports.mapHash = mapHash;
  14589. exports.matchCellWidths = matchCellWidths;
  14590. exports.memoize = memoize;
  14591. exports.memoizeOutput = memoizeOutput;
  14592. exports.memoizeRendering = memoizeRendering;
  14593. exports.mergeEventStores = mergeEventStores;
  14594. exports.multiplyDuration = multiplyDuration;
  14595. exports.padStart = padStart;
  14596. exports.parseBusinessHours = parseBusinessHours;
  14597. exports.parseDragMeta = parseDragMeta;
  14598. exports.parseEventDef = parseEventDef;
  14599. exports.parseFieldSpecs = parseFieldSpecs;
  14600. exports.parseMarker = parse;
  14601. exports.pointInsideRect = pointInsideRect;
  14602. exports.prependToElement = prependToElement;
  14603. exports.preventContextMenu = preventContextMenu;
  14604. exports.preventDefault = preventDefault;
  14605. exports.preventSelection = preventSelection;
  14606. exports.processScopedUiProps = processScopedUiProps;
  14607. exports.rangeContainsMarker = rangeContainsMarker;
  14608. exports.rangeContainsRange = rangeContainsRange;
  14609. exports.rangesEqual = rangesEqual;
  14610. exports.rangesIntersect = rangesIntersect;
  14611. exports.refineProps = refineProps;
  14612. exports.removeElement = removeElement;
  14613. exports.removeExact = removeExact;
  14614. exports.renderDateCell = renderDateCell;
  14615. exports.requestJson = requestJson;
  14616. exports.sliceEventStore = sliceEventStore;
  14617. exports.startOfDay = startOfDay;
  14618. exports.subtractInnerElHeight = subtractInnerElHeight;
  14619. exports.translateRect = translateRect;
  14620. exports.uncompensateScroll = uncompensateScroll;
  14621. exports.undistributeHeight = undistributeHeight;
  14622. exports.unpromisify = unpromisify;
  14623. exports.version = version;
  14624. exports.whenTransitionDone = whenTransitionDone;
  14625. exports.wholeDivideDurations = wholeDivideDurations;
  14626. Object.defineProperty(exports, '__esModule', { value: true });
  14627. }));
  14628. /*!
  14629. FullCalendar Day Grid Plugin v4.4.0
  14630. Docs & License: https://fullcalendar.io/
  14631. (c) 2019 Adam Shaw
  14632. */
  14633. (function (global, factory) {
  14634. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fullcalendar/core')) :
  14635. typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core'], factory) :
  14636. (global = global || self, factory(global.FullCalendarDayGrid = {}, global.FullCalendar));
  14637. }(this, function (exports, core) { 'use strict';
  14638. /*! *****************************************************************************
  14639. Copyright (c) Microsoft Corporation. All rights reserved.
  14640. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  14641. this file except in compliance with the License. You may obtain a copy of the
  14642. License at http://www.apache.org/licenses/LICENSE-2.0
  14643. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14644. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  14645. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  14646. MERCHANTABLITY OR NON-INFRINGEMENT.
  14647. See the Apache Version 2.0 License for specific language governing permissions
  14648. and limitations under the License.
  14649. ***************************************************************************** */
  14650. /* global Reflect, Promise */
  14651. var extendStatics = function(d, b) {
  14652. extendStatics = Object.setPrototypeOf ||
  14653. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14654. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14655. return extendStatics(d, b);
  14656. };
  14657. function __extends(d, b) {
  14658. extendStatics(d, b);
  14659. function __() { this.constructor = d; }
  14660. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14661. }
  14662. var __assign = function() {
  14663. __assign = Object.assign || function __assign(t) {
  14664. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14665. s = arguments[i];
  14666. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14667. }
  14668. return t;
  14669. };
  14670. return __assign.apply(this, arguments);
  14671. };
  14672. var DayGridDateProfileGenerator = /** @class */ (function (_super) {
  14673. __extends(DayGridDateProfileGenerator, _super);
  14674. function DayGridDateProfileGenerator() {
  14675. return _super !== null && _super.apply(this, arguments) || this;
  14676. }
  14677. // Computes the date range that will be rendered.
  14678. DayGridDateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) {
  14679. var dateEnv = this.dateEnv;
  14680. var renderRange = _super.prototype.buildRenderRange.call(this, currentRange, currentRangeUnit, isRangeAllDay);
  14681. var start = renderRange.start;
  14682. var end = renderRange.end;
  14683. var endOfWeek;
  14684. // year and month views should be aligned with weeks. this is already done for week
  14685. if (/^(year|month)$/.test(currentRangeUnit)) {
  14686. start = dateEnv.startOfWeek(start);
  14687. // make end-of-week if not already
  14688. endOfWeek = dateEnv.startOfWeek(end);
  14689. if (endOfWeek.valueOf() !== end.valueOf()) {
  14690. end = core.addWeeks(endOfWeek, 1);
  14691. }
  14692. }
  14693. // ensure 6 weeks
  14694. if (this.options.monthMode &&
  14695. this.options.fixedWeekCount) {
  14696. var rowCnt = Math.ceil(// could be partial weeks due to hiddenDays
  14697. core.diffWeeks(start, end));
  14698. end = core.addWeeks(end, 6 - rowCnt);
  14699. }
  14700. return { start: start, end: end };
  14701. };
  14702. return DayGridDateProfileGenerator;
  14703. }(core.DateProfileGenerator));
  14704. /* A rectangular panel that is absolutely positioned over other content
  14705. ------------------------------------------------------------------------------------------------------------------------
  14706. Options:
  14707. - className (string)
  14708. - content (HTML string, element, or element array)
  14709. - parentEl
  14710. - top
  14711. - left
  14712. - right (the x coord of where the right edge should be. not a "CSS" right)
  14713. - autoHide (boolean)
  14714. - show (callback)
  14715. - hide (callback)
  14716. */
  14717. var Popover = /** @class */ (function () {
  14718. function Popover(options) {
  14719. var _this = this;
  14720. this.isHidden = true;
  14721. this.margin = 10; // the space required between the popover and the edges of the scroll container
  14722. // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
  14723. this.documentMousedown = function (ev) {
  14724. // only hide the popover if the click happened outside the popover
  14725. if (_this.el && !_this.el.contains(ev.target)) {
  14726. _this.hide();
  14727. }
  14728. };
  14729. this.options = options;
  14730. }
  14731. // Shows the popover on the specified position. Renders it if not already
  14732. Popover.prototype.show = function () {
  14733. if (this.isHidden) {
  14734. if (!this.el) {
  14735. this.render();
  14736. }
  14737. this.el.style.display = '';
  14738. this.position();
  14739. this.isHidden = false;
  14740. this.trigger('show');
  14741. }
  14742. };
  14743. // Hides the popover, through CSS, but does not remove it from the DOM
  14744. Popover.prototype.hide = function () {
  14745. if (!this.isHidden) {
  14746. this.el.style.display = 'none';
  14747. this.isHidden = true;
  14748. this.trigger('hide');
  14749. }
  14750. };
  14751. // Creates `this.el` and renders content inside of it
  14752. Popover.prototype.render = function () {
  14753. var _this = this;
  14754. var options = this.options;
  14755. var el = this.el = core.createElement('div', {
  14756. className: 'fc-popover ' + (options.className || ''),
  14757. style: {
  14758. top: '0',
  14759. left: '0'
  14760. }
  14761. });
  14762. if (typeof options.content === 'function') {
  14763. options.content(el);
  14764. }
  14765. options.parentEl.appendChild(el);
  14766. // when a click happens on anything inside with a 'fc-close' className, hide the popover
  14767. core.listenBySelector(el, 'click', '.fc-close', function (ev) {
  14768. _this.hide();
  14769. });
  14770. if (options.autoHide) {
  14771. document.addEventListener('mousedown', this.documentMousedown);
  14772. }
  14773. };
  14774. // Hides and unregisters any handlers
  14775. Popover.prototype.destroy = function () {
  14776. this.hide();
  14777. if (this.el) {
  14778. core.removeElement(this.el);
  14779. this.el = null;
  14780. }
  14781. document.removeEventListener('mousedown', this.documentMousedown);
  14782. };
  14783. // Positions the popover optimally, using the top/left/right options
  14784. Popover.prototype.position = function () {
  14785. var options = this.options;
  14786. var el = this.el;
  14787. var elDims = el.getBoundingClientRect(); // only used for width,height
  14788. var origin = core.computeRect(el.offsetParent);
  14789. var clippingRect = core.computeClippingRect(options.parentEl);
  14790. var top; // the "position" (not "offset") values for the popover
  14791. var left; //
  14792. // compute top and left
  14793. top = options.top || 0;
  14794. if (options.left !== undefined) {
  14795. left = options.left;
  14796. }
  14797. else if (options.right !== undefined) {
  14798. left = options.right - elDims.width; // derive the left value from the right value
  14799. }
  14800. else {
  14801. left = 0;
  14802. }
  14803. // constrain to the view port. if constrained by two edges, give precedence to top/left
  14804. top = Math.min(top, clippingRect.bottom - elDims.height - this.margin);
  14805. top = Math.max(top, clippingRect.top + this.margin);
  14806. left = Math.min(left, clippingRect.right - elDims.width - this.margin);
  14807. left = Math.max(left, clippingRect.left + this.margin);
  14808. core.applyStyle(el, {
  14809. top: top - origin.top,
  14810. left: left - origin.left
  14811. });
  14812. };
  14813. // Triggers a callback. Calls a function in the option hash of the same name.
  14814. // Arguments beyond the first `name` are forwarded on.
  14815. // TODO: better code reuse for this. Repeat code
  14816. // can kill this???
  14817. Popover.prototype.trigger = function (name) {
  14818. if (this.options[name]) {
  14819. this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
  14820. }
  14821. };
  14822. return Popover;
  14823. }());
  14824. /* Event-rendering methods for the DayGrid class
  14825. ----------------------------------------------------------------------------------------------------------------------*/
  14826. // "Simple" is bad a name. has nothing to do with SimpleDayGrid
  14827. var SimpleDayGridEventRenderer = /** @class */ (function (_super) {
  14828. __extends(SimpleDayGridEventRenderer, _super);
  14829. function SimpleDayGridEventRenderer() {
  14830. return _super !== null && _super.apply(this, arguments) || this;
  14831. }
  14832. // Builds the HTML to be used for the default element for an individual segment
  14833. SimpleDayGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) {
  14834. var context = this.context;
  14835. var eventRange = seg.eventRange;
  14836. var eventDef = eventRange.def;
  14837. var eventUi = eventRange.ui;
  14838. var allDay = eventDef.allDay;
  14839. var isDraggable = core.computeEventDraggable(context, eventDef, eventUi);
  14840. var isResizableFromStart = allDay && seg.isStart && core.computeEventStartResizable(context, eventDef, eventUi);
  14841. var isResizableFromEnd = allDay && seg.isEnd && core.computeEventEndResizable(context, eventDef, eventUi);
  14842. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo);
  14843. var skinCss = core.cssToStr(this.getSkinCss(eventUi));
  14844. var timeHtml = '';
  14845. var timeText;
  14846. var titleHtml;
  14847. classes.unshift('fc-day-grid-event', 'fc-h-event');
  14848. // Only display a timed events time if it is the starting segment
  14849. if (seg.isStart) {
  14850. timeText = this.getTimeText(eventRange);
  14851. if (timeText) {
  14852. timeHtml = '<span class="fc-time">' + core.htmlEscape(timeText) + '</span>';
  14853. }
  14854. }
  14855. titleHtml =
  14856. '<span class="fc-title">' +
  14857. (core.htmlEscape(eventDef.title || '') || '&nbsp;') + // we always want one line of height
  14858. '</span>';
  14859. return '<a class="' + classes.join(' ') + '"' +
  14860. (eventDef.url ?
  14861. ' href="' + core.htmlEscape(eventDef.url) + '"' :
  14862. '') +
  14863. (skinCss ?
  14864. ' style="' + skinCss + '"' :
  14865. '') +
  14866. '>' +
  14867. '<div class="fc-content">' +
  14868. (context.options.dir === 'rtl' ?
  14869. titleHtml + ' ' + timeHtml : // put a natural space in between
  14870. timeHtml + ' ' + titleHtml //
  14871. ) +
  14872. '</div>' +
  14873. (isResizableFromStart ?
  14874. '<div class="fc-resizer fc-start-resizer"></div>' :
  14875. '') +
  14876. (isResizableFromEnd ?
  14877. '<div class="fc-resizer fc-end-resizer"></div>' :
  14878. '') +
  14879. '</a>';
  14880. };
  14881. // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined
  14882. SimpleDayGridEventRenderer.prototype.computeEventTimeFormat = function () {
  14883. return {
  14884. hour: 'numeric',
  14885. minute: '2-digit',
  14886. omitZeroMinute: true,
  14887. meridiem: 'narrow'
  14888. };
  14889. };
  14890. SimpleDayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  14891. return false; // TODO: somehow consider the originating DayGrid's column count
  14892. };
  14893. return SimpleDayGridEventRenderer;
  14894. }(core.FgEventRenderer));
  14895. /* Event-rendering methods for the DayGrid class
  14896. ----------------------------------------------------------------------------------------------------------------------*/
  14897. var DayGridEventRenderer = /** @class */ (function (_super) {
  14898. __extends(DayGridEventRenderer, _super);
  14899. function DayGridEventRenderer(dayGrid) {
  14900. var _this = _super.call(this) || this;
  14901. _this.dayGrid = dayGrid;
  14902. return _this;
  14903. }
  14904. // Renders the given foreground event segments onto the grid
  14905. DayGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
  14906. var rowStructs = this.rowStructs = this.renderSegRows(segs);
  14907. // append to each row's content skeleton
  14908. this.dayGrid.rowEls.forEach(function (rowNode, i) {
  14909. rowNode.querySelector('.fc-content-skeleton > table').appendChild(rowStructs[i].tbodyEl);
  14910. });
  14911. // removes the "more.." events popover
  14912. if (!mirrorInfo) {
  14913. this.dayGrid.removeSegPopover();
  14914. }
  14915. };
  14916. // Unrenders all currently rendered foreground event segments
  14917. DayGridEventRenderer.prototype.detachSegs = function () {
  14918. var rowStructs = this.rowStructs || [];
  14919. var rowStruct;
  14920. while ((rowStruct = rowStructs.pop())) {
  14921. core.removeElement(rowStruct.tbodyEl);
  14922. }
  14923. this.rowStructs = null;
  14924. };
  14925. // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton.
  14926. // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).
  14927. // PRECONDITION: each segment shoud already have a rendered and assigned `.el`
  14928. DayGridEventRenderer.prototype.renderSegRows = function (segs) {
  14929. var rowStructs = [];
  14930. var segRows;
  14931. var row;
  14932. segRows = this.groupSegRows(segs); // group into nested arrays
  14933. // iterate each row of segment groupings
  14934. for (row = 0; row < segRows.length; row++) {
  14935. rowStructs.push(this.renderSegRow(row, segRows[row]));
  14936. }
  14937. return rowStructs;
  14938. };
  14939. // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains
  14940. // the segments. Returns object with a bunch of internal data about how the render was calculated.
  14941. // NOTE: modifies rowSegs
  14942. DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) {
  14943. var isRtl = this.context.isRtl;
  14944. var dayGrid = this.dayGrid;
  14945. var colCnt = dayGrid.colCnt;
  14946. var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
  14947. var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
  14948. var tbody = document.createElement('tbody');
  14949. var segMatrix = []; // lookup for which segments are rendered into which level+col cells
  14950. var cellMatrix = []; // lookup for all <td> elements of the level+col matrix
  14951. var loneCellMatrix = []; // lookup for <td> elements that only take up a single column
  14952. var i;
  14953. var levelSegs;
  14954. var col;
  14955. var tr;
  14956. var j;
  14957. var seg;
  14958. var td;
  14959. // populates empty cells from the current column (`col`) to `endCol`
  14960. function emptyCellsUntil(endCol) {
  14961. while (col < endCol) {
  14962. // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell
  14963. td = (loneCellMatrix[i - 1] || [])[col];
  14964. if (td) {
  14965. td.rowSpan = (td.rowSpan || 1) + 1;
  14966. }
  14967. else {
  14968. td = document.createElement('td');
  14969. tr.appendChild(td);
  14970. }
  14971. cellMatrix[i][col] = td;
  14972. loneCellMatrix[i][col] = td;
  14973. col++;
  14974. }
  14975. }
  14976. for (i = 0; i < levelCnt; i++) { // iterate through all levels
  14977. levelSegs = segLevels[i];
  14978. col = 0;
  14979. tr = document.createElement('tr');
  14980. segMatrix.push([]);
  14981. cellMatrix.push([]);
  14982. loneCellMatrix.push([]);
  14983. // levelCnt might be 1 even though there are no actual levels. protect against this.
  14984. // this single empty row is useful for styling.
  14985. if (levelSegs) {
  14986. for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level
  14987. seg = levelSegs[j];
  14988. var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
  14989. var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
  14990. emptyCellsUntil(leftCol);
  14991. // create a container that occupies or more columns. append the event element.
  14992. td = core.createElement('td', { className: 'fc-event-container' }, seg.el);
  14993. if (leftCol !== rightCol) {
  14994. td.colSpan = rightCol - leftCol + 1;
  14995. }
  14996. else { // a single-column segment
  14997. loneCellMatrix[i][col] = td;
  14998. }
  14999. while (col <= rightCol) {
  15000. cellMatrix[i][col] = td;
  15001. segMatrix[i][col] = seg;
  15002. col++;
  15003. }
  15004. tr.appendChild(td);
  15005. }
  15006. }
  15007. emptyCellsUntil(colCnt); // finish off the row
  15008. var introHtml = dayGrid.renderProps.renderIntroHtml();
  15009. if (introHtml) {
  15010. if (isRtl) {
  15011. core.appendToElement(tr, introHtml);
  15012. }
  15013. else {
  15014. core.prependToElement(tr, introHtml);
  15015. }
  15016. }
  15017. tbody.appendChild(tr);
  15018. }
  15019. return {
  15020. row: row,
  15021. tbodyEl: tbody,
  15022. cellMatrix: cellMatrix,
  15023. segMatrix: segMatrix,
  15024. segLevels: segLevels,
  15025. segs: rowSegs
  15026. };
  15027. };
  15028. // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.
  15029. // NOTE: modifies segs
  15030. DayGridEventRenderer.prototype.buildSegLevels = function (segs) {
  15031. var isRtl = this.context.isRtl;
  15032. var colCnt = this.dayGrid.colCnt;
  15033. var levels = [];
  15034. var i;
  15035. var seg;
  15036. var j;
  15037. // Give preference to elements with certain criteria, so they have
  15038. // a chance to be closer to the top.
  15039. segs = this.sortEventSegs(segs);
  15040. for (i = 0; i < segs.length; i++) {
  15041. seg = segs[i];
  15042. // loop through levels, starting with the topmost, until the segment doesn't collide with other segments
  15043. for (j = 0; j < levels.length; j++) {
  15044. if (!isDaySegCollision(seg, levels[j])) {
  15045. break;
  15046. }
  15047. }
  15048. // `j` now holds the desired subrow index
  15049. seg.level = j;
  15050. seg.leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; // for sorting only
  15051. seg.rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol // for sorting only
  15052. ;
  15053. (levels[j] || (levels[j] = [])).push(seg);
  15054. }
  15055. // order segments left-to-right. very important if calendar is RTL
  15056. for (j = 0; j < levels.length; j++) {
  15057. levels[j].sort(compareDaySegCols);
  15058. }
  15059. return levels;
  15060. };
  15061. // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row
  15062. DayGridEventRenderer.prototype.groupSegRows = function (segs) {
  15063. var segRows = [];
  15064. var i;
  15065. for (i = 0; i < this.dayGrid.rowCnt; i++) {
  15066. segRows.push([]);
  15067. }
  15068. for (i = 0; i < segs.length; i++) {
  15069. segRows[segs[i].row].push(segs[i]);
  15070. }
  15071. return segRows;
  15072. };
  15073. // Computes a default `displayEventEnd` value if one is not expliclty defined
  15074. DayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  15075. return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day
  15076. };
  15077. return DayGridEventRenderer;
  15078. }(SimpleDayGridEventRenderer));
  15079. // Computes whether two segments' columns collide. They are assumed to be in the same row.
  15080. function isDaySegCollision(seg, otherSegs) {
  15081. var i;
  15082. var otherSeg;
  15083. for (i = 0; i < otherSegs.length; i++) {
  15084. otherSeg = otherSegs[i];
  15085. if (otherSeg.firstCol <= seg.lastCol &&
  15086. otherSeg.lastCol >= seg.firstCol) {
  15087. return true;
  15088. }
  15089. }
  15090. return false;
  15091. }
  15092. // A cmp function for determining the leftmost event
  15093. function compareDaySegCols(a, b) {
  15094. return a.leftCol - b.leftCol;
  15095. }
  15096. var DayGridMirrorRenderer = /** @class */ (function (_super) {
  15097. __extends(DayGridMirrorRenderer, _super);
  15098. function DayGridMirrorRenderer() {
  15099. return _super !== null && _super.apply(this, arguments) || this;
  15100. }
  15101. DayGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
  15102. var sourceSeg = mirrorInfo.sourceSeg;
  15103. var rowStructs = this.rowStructs = this.renderSegRows(segs);
  15104. // inject each new event skeleton into each associated row
  15105. this.dayGrid.rowEls.forEach(function (rowNode, row) {
  15106. var skeletonEl = core.htmlToElement('<div class="fc-mirror-skeleton"><table></table></div>'); // will be absolutely positioned
  15107. var skeletonTopEl;
  15108. var skeletonTop;
  15109. // If there is an original segment, match the top position. Otherwise, put it at the row's top level
  15110. if (sourceSeg && sourceSeg.row === row) {
  15111. skeletonTopEl = sourceSeg.el;
  15112. }
  15113. else {
  15114. skeletonTopEl = rowNode.querySelector('.fc-content-skeleton tbody');
  15115. if (!skeletonTopEl) { // when no events
  15116. skeletonTopEl = rowNode.querySelector('.fc-content-skeleton table');
  15117. }
  15118. }
  15119. skeletonTop = skeletonTopEl.getBoundingClientRect().top -
  15120. rowNode.getBoundingClientRect().top; // the offsetParent origin
  15121. skeletonEl.style.top = skeletonTop + 'px';
  15122. skeletonEl.querySelector('table').appendChild(rowStructs[row].tbodyEl);
  15123. rowNode.appendChild(skeletonEl);
  15124. });
  15125. };
  15126. return DayGridMirrorRenderer;
  15127. }(DayGridEventRenderer));
  15128. var EMPTY_CELL_HTML = '<td style="pointer-events:none"></td>';
  15129. var DayGridFillRenderer = /** @class */ (function (_super) {
  15130. __extends(DayGridFillRenderer, _super);
  15131. function DayGridFillRenderer(dayGrid) {
  15132. var _this = _super.call(this) || this;
  15133. _this.fillSegTag = 'td'; // override the default tag name
  15134. _this.dayGrid = dayGrid;
  15135. return _this;
  15136. }
  15137. DayGridFillRenderer.prototype.renderSegs = function (type, context, segs) {
  15138. // don't render timed background events
  15139. if (type === 'bgEvent') {
  15140. segs = segs.filter(function (seg) {
  15141. return seg.eventRange.def.allDay;
  15142. });
  15143. }
  15144. _super.prototype.renderSegs.call(this, type, context, segs);
  15145. };
  15146. DayGridFillRenderer.prototype.attachSegs = function (type, segs) {
  15147. var els = [];
  15148. var i;
  15149. var seg;
  15150. var skeletonEl;
  15151. for (i = 0; i < segs.length; i++) {
  15152. seg = segs[i];
  15153. skeletonEl = this.renderFillRow(type, seg);
  15154. this.dayGrid.rowEls[seg.row].appendChild(skeletonEl);
  15155. els.push(skeletonEl);
  15156. }
  15157. return els;
  15158. };
  15159. // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.
  15160. DayGridFillRenderer.prototype.renderFillRow = function (type, seg) {
  15161. var dayGrid = this.dayGrid;
  15162. var isRtl = this.context.isRtl;
  15163. var colCnt = dayGrid.colCnt;
  15164. var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
  15165. var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
  15166. var startCol = leftCol;
  15167. var endCol = rightCol + 1;
  15168. var className;
  15169. var skeletonEl;
  15170. var trEl;
  15171. if (type === 'businessHours') {
  15172. className = 'bgevent';
  15173. }
  15174. else {
  15175. className = type.toLowerCase();
  15176. }
  15177. skeletonEl = core.htmlToElement('<div class="fc-' + className + '-skeleton">' +
  15178. '<table><tr></tr></table>' +
  15179. '</div>');
  15180. trEl = skeletonEl.getElementsByTagName('tr')[0];
  15181. if (startCol > 0) {
  15182. core.appendToElement(trEl,
  15183. // will create (startCol + 1) td's
  15184. new Array(startCol + 1).join(EMPTY_CELL_HTML));
  15185. }
  15186. seg.el.colSpan = endCol - startCol;
  15187. trEl.appendChild(seg.el);
  15188. if (endCol < colCnt) {
  15189. core.appendToElement(trEl,
  15190. // will create (colCnt - endCol) td's
  15191. new Array(colCnt - endCol + 1).join(EMPTY_CELL_HTML));
  15192. }
  15193. var introHtml = dayGrid.renderProps.renderIntroHtml();
  15194. if (introHtml) {
  15195. if (isRtl) {
  15196. core.appendToElement(trEl, introHtml);
  15197. }
  15198. else {
  15199. core.prependToElement(trEl, introHtml);
  15200. }
  15201. }
  15202. return skeletonEl;
  15203. };
  15204. return DayGridFillRenderer;
  15205. }(core.FillRenderer));
  15206. var DayTile = /** @class */ (function (_super) {
  15207. __extends(DayTile, _super);
  15208. function DayTile(el) {
  15209. var _this = _super.call(this, el) || this;
  15210. var eventRenderer = _this.eventRenderer = new DayTileEventRenderer(_this);
  15211. var renderFrame = _this.renderFrame = core.memoizeRendering(_this._renderFrame);
  15212. _this.renderFgEvents = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderFrame]);
  15213. _this.renderEventSelection = core.memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
  15214. _this.renderEventDrag = core.memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);
  15215. _this.renderEventResize = core.memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);
  15216. return _this;
  15217. }
  15218. DayTile.prototype.firstContext = function (context) {
  15219. context.calendar.registerInteractiveComponent(this, {
  15220. el: this.el,
  15221. useEventCenter: false
  15222. });
  15223. };
  15224. DayTile.prototype.render = function (props, context) {
  15225. this.renderFrame(props.date);
  15226. this.renderFgEvents(context, props.fgSegs);
  15227. this.renderEventSelection(props.eventSelection);
  15228. this.renderEventDrag(props.eventDragInstances);
  15229. this.renderEventResize(props.eventResizeInstances);
  15230. };
  15231. DayTile.prototype.destroy = function () {
  15232. _super.prototype.destroy.call(this);
  15233. this.renderFrame.unrender(); // should unrender everything else
  15234. this.context.calendar.unregisterInteractiveComponent(this);
  15235. };
  15236. DayTile.prototype._renderFrame = function (date) {
  15237. var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;
  15238. var title = dateEnv.format(date, core.createFormatter(options.dayPopoverFormat) // TODO: cache
  15239. );
  15240. this.el.innerHTML =
  15241. '<div class="fc-header ' + theme.getClass('popoverHeader') + '">' +
  15242. '<span class="fc-title">' +
  15243. core.htmlEscape(title) +
  15244. '</span>' +
  15245. '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' +
  15246. '</div>' +
  15247. '<div class="fc-body ' + theme.getClass('popoverContent') + '">' +
  15248. '<div class="fc-event-container"></div>' +
  15249. '</div>';
  15250. this.segContainerEl = this.el.querySelector('.fc-event-container');
  15251. };
  15252. DayTile.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) {
  15253. var date = this.props.date; // HACK
  15254. if (positionLeft < elWidth && positionTop < elHeight) {
  15255. return {
  15256. component: this,
  15257. dateSpan: {
  15258. allDay: true,
  15259. range: { start: date, end: core.addDays(date, 1) }
  15260. },
  15261. dayEl: this.el,
  15262. rect: {
  15263. left: 0,
  15264. top: 0,
  15265. right: elWidth,
  15266. bottom: elHeight
  15267. },
  15268. layer: 1
  15269. };
  15270. }
  15271. };
  15272. return DayTile;
  15273. }(core.DateComponent));
  15274. var DayTileEventRenderer = /** @class */ (function (_super) {
  15275. __extends(DayTileEventRenderer, _super);
  15276. function DayTileEventRenderer(dayTile) {
  15277. var _this = _super.call(this) || this;
  15278. _this.dayTile = dayTile;
  15279. return _this;
  15280. }
  15281. DayTileEventRenderer.prototype.attachSegs = function (segs) {
  15282. for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
  15283. var seg = segs_1[_i];
  15284. this.dayTile.segContainerEl.appendChild(seg.el);
  15285. }
  15286. };
  15287. DayTileEventRenderer.prototype.detachSegs = function (segs) {
  15288. for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
  15289. var seg = segs_2[_i];
  15290. core.removeElement(seg.el);
  15291. }
  15292. };
  15293. return DayTileEventRenderer;
  15294. }(SimpleDayGridEventRenderer));
  15295. var DayBgRow = /** @class */ (function () {
  15296. function DayBgRow(context) {
  15297. this.context = context;
  15298. }
  15299. DayBgRow.prototype.renderHtml = function (props) {
  15300. var parts = [];
  15301. if (props.renderIntroHtml) {
  15302. parts.push(props.renderIntroHtml());
  15303. }
  15304. for (var _i = 0, _a = props.cells; _i < _a.length; _i++) {
  15305. var cell = _a[_i];
  15306. parts.push(renderCellHtml(cell.date, props.dateProfile, this.context, cell.htmlAttrs));
  15307. }
  15308. if (!props.cells.length) {
  15309. parts.push('<td class="fc-day ' + this.context.theme.getClass('widgetContent') + '"></td>');
  15310. }
  15311. if (this.context.options.dir === 'rtl') {
  15312. parts.reverse();
  15313. }
  15314. return '<tr>' + parts.join('') + '</tr>';
  15315. };
  15316. return DayBgRow;
  15317. }());
  15318. function renderCellHtml(date, dateProfile, context, otherAttrs) {
  15319. var dateEnv = context.dateEnv, theme = context.theme;
  15320. var isDateValid = core.rangeContainsMarker(dateProfile.activeRange, date); // TODO: called too frequently. cache somehow.
  15321. var classes = core.getDayClasses(date, dateProfile, context);
  15322. classes.unshift('fc-day', theme.getClass('widgetContent'));
  15323. return '<td class="' + classes.join(' ') + '"' +
  15324. (isDateValid ?
  15325. ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' :
  15326. '') +
  15327. (otherAttrs ?
  15328. ' ' + otherAttrs :
  15329. '') +
  15330. '></td>';
  15331. }
  15332. var DAY_NUM_FORMAT = core.createFormatter({ day: 'numeric' });
  15333. var WEEK_NUM_FORMAT = core.createFormatter({ week: 'numeric' });
  15334. var DayGrid = /** @class */ (function (_super) {
  15335. __extends(DayGrid, _super);
  15336. function DayGrid(el, renderProps) {
  15337. var _this = _super.call(this, el) || this;
  15338. _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid
  15339. _this.isCellSizesDirty = false;
  15340. _this.renderProps = renderProps;
  15341. var eventRenderer = _this.eventRenderer = new DayGridEventRenderer(_this);
  15342. var fillRenderer = _this.fillRenderer = new DayGridFillRenderer(_this);
  15343. _this.mirrorRenderer = new DayGridMirrorRenderer(_this);
  15344. var renderCells = _this.renderCells = core.memoizeRendering(_this._renderCells, _this._unrenderCells);
  15345. _this.renderBusinessHours = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderCells]);
  15346. _this.renderDateSelection = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'highlight'), fillRenderer.unrender.bind(fillRenderer, 'highlight'), [renderCells]);
  15347. _this.renderBgEvents = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderCells]);
  15348. _this.renderFgEvents = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderCells]);
  15349. _this.renderEventSelection = core.memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
  15350. _this.renderEventDrag = core.memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderCells]);
  15351. _this.renderEventResize = core.memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderCells]);
  15352. return _this;
  15353. }
  15354. DayGrid.prototype.render = function (props, context) {
  15355. var cells = props.cells;
  15356. this.rowCnt = cells.length;
  15357. this.colCnt = cells[0].length;
  15358. this.renderCells(cells, props.isRigid);
  15359. this.renderBusinessHours(context, props.businessHourSegs);
  15360. this.renderDateSelection(context, props.dateSelectionSegs);
  15361. this.renderBgEvents(context, props.bgEventSegs);
  15362. this.renderFgEvents(context, props.fgEventSegs);
  15363. this.renderEventSelection(props.eventSelection);
  15364. this.renderEventDrag(props.eventDrag);
  15365. this.renderEventResize(props.eventResize);
  15366. if (this.segPopoverTile) {
  15367. this.updateSegPopoverTile();
  15368. }
  15369. };
  15370. DayGrid.prototype.destroy = function () {
  15371. _super.prototype.destroy.call(this);
  15372. this.renderCells.unrender(); // will unrender everything else
  15373. };
  15374. DayGrid.prototype.getCellRange = function (row, col) {
  15375. var start = this.props.cells[row][col].date;
  15376. var end = core.addDays(start, 1);
  15377. return { start: start, end: end };
  15378. };
  15379. DayGrid.prototype.updateSegPopoverTile = function (date, segs) {
  15380. var ownProps = this.props;
  15381. this.segPopoverTile.receiveProps({
  15382. date: date || this.segPopoverTile.props.date,
  15383. fgSegs: segs || this.segPopoverTile.props.fgSegs,
  15384. eventSelection: ownProps.eventSelection,
  15385. eventDragInstances: ownProps.eventDrag ? ownProps.eventDrag.affectedInstances : null,
  15386. eventResizeInstances: ownProps.eventResize ? ownProps.eventResize.affectedInstances : null
  15387. }, this.context);
  15388. };
  15389. /* Date Rendering
  15390. ------------------------------------------------------------------------------------------------------------------*/
  15391. DayGrid.prototype._renderCells = function (cells, isRigid) {
  15392. var _a = this.context, calendar = _a.calendar, view = _a.view, isRtl = _a.isRtl, dateEnv = _a.dateEnv;
  15393. var _b = this, rowCnt = _b.rowCnt, colCnt = _b.colCnt;
  15394. var html = '';
  15395. var row;
  15396. var col;
  15397. for (row = 0; row < rowCnt; row++) {
  15398. html += this.renderDayRowHtml(row, isRigid);
  15399. }
  15400. this.el.innerHTML = html;
  15401. this.rowEls = core.findElements(this.el, '.fc-row');
  15402. this.cellEls = core.findElements(this.el, '.fc-day, .fc-disabled-day');
  15403. if (isRtl) {
  15404. this.cellEls.reverse();
  15405. }
  15406. this.rowPositions = new core.PositionCache(this.el, this.rowEls, false, true // vertical
  15407. );
  15408. this.colPositions = new core.PositionCache(this.el, this.cellEls.slice(0, colCnt), // only the first row
  15409. true, false // horizontal
  15410. );
  15411. // trigger dayRender with each cell's element
  15412. for (row = 0; row < rowCnt; row++) {
  15413. for (col = 0; col < colCnt; col++) {
  15414. calendar.publiclyTrigger('dayRender', [
  15415. {
  15416. date: dateEnv.toDate(cells[row][col].date),
  15417. el: this.getCellEl(row, col),
  15418. view: view
  15419. }
  15420. ]);
  15421. }
  15422. }
  15423. this.isCellSizesDirty = true;
  15424. };
  15425. DayGrid.prototype._unrenderCells = function () {
  15426. this.removeSegPopover();
  15427. };
  15428. // Generates the HTML for a single row, which is a div that wraps a table.
  15429. // `row` is the row number.
  15430. DayGrid.prototype.renderDayRowHtml = function (row, isRigid) {
  15431. var theme = this.context.theme;
  15432. var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')];
  15433. if (isRigid) {
  15434. classes.push('fc-rigid');
  15435. }
  15436. var bgRow = new DayBgRow(this.context);
  15437. return '' +
  15438. '<div class="' + classes.join(' ') + '">' +
  15439. '<div class="fc-bg">' +
  15440. '<table class="' + theme.getClass('tableGrid') + '">' +
  15441. bgRow.renderHtml({
  15442. cells: this.props.cells[row],
  15443. dateProfile: this.props.dateProfile,
  15444. renderIntroHtml: this.renderProps.renderBgIntroHtml
  15445. }) +
  15446. '</table>' +
  15447. '</div>' +
  15448. '<div class="fc-content-skeleton">' +
  15449. '<table>' +
  15450. (this.getIsNumbersVisible() ?
  15451. '<thead>' +
  15452. this.renderNumberTrHtml(row) +
  15453. '</thead>' :
  15454. '') +
  15455. '</table>' +
  15456. '</div>' +
  15457. '</div>';
  15458. };
  15459. DayGrid.prototype.getIsNumbersVisible = function () {
  15460. return this.getIsDayNumbersVisible() ||
  15461. this.renderProps.cellWeekNumbersVisible ||
  15462. this.renderProps.colWeekNumbersVisible;
  15463. };
  15464. DayGrid.prototype.getIsDayNumbersVisible = function () {
  15465. return this.rowCnt > 1;
  15466. };
  15467. /* Grid Number Rendering
  15468. ------------------------------------------------------------------------------------------------------------------*/
  15469. DayGrid.prototype.renderNumberTrHtml = function (row) {
  15470. var isRtl = this.context.isRtl;
  15471. var intro = this.renderProps.renderNumberIntroHtml(row, this);
  15472. return '' +
  15473. '<tr>' +
  15474. (isRtl ? '' : intro) +
  15475. this.renderNumberCellsHtml(row) +
  15476. (isRtl ? intro : '') +
  15477. '</tr>';
  15478. };
  15479. DayGrid.prototype.renderNumberCellsHtml = function (row) {
  15480. var htmls = [];
  15481. var col;
  15482. var date;
  15483. for (col = 0; col < this.colCnt; col++) {
  15484. date = this.props.cells[row][col].date;
  15485. htmls.push(this.renderNumberCellHtml(date));
  15486. }
  15487. if (this.context.isRtl) {
  15488. htmls.reverse();
  15489. }
  15490. return htmls.join('');
  15491. };
  15492. // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
  15493. // The number row will only exist if either day numbers or week numbers are turned on.
  15494. DayGrid.prototype.renderNumberCellHtml = function (date) {
  15495. var _a = this.context, dateEnv = _a.dateEnv, options = _a.options;
  15496. var html = '';
  15497. var isDateValid = core.rangeContainsMarker(this.props.dateProfile.activeRange, date); // TODO: called too frequently. cache somehow.
  15498. var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid;
  15499. var classes;
  15500. var weekCalcFirstDow;
  15501. if (!isDayNumberVisible && !this.renderProps.cellWeekNumbersVisible) {
  15502. // no numbers in day cell (week number must be along the side)
  15503. return '<td></td>'; // will create an empty space above events :(
  15504. }
  15505. classes = core.getDayClasses(date, this.props.dateProfile, this.context);
  15506. classes.unshift('fc-day-top');
  15507. if (this.renderProps.cellWeekNumbersVisible) {
  15508. weekCalcFirstDow = dateEnv.weekDow;
  15509. }
  15510. html += '<td class="' + classes.join(' ') + '"' +
  15511. (isDateValid ?
  15512. ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' :
  15513. '') +
  15514. '>';
  15515. if (this.renderProps.cellWeekNumbersVisible && (date.getUTCDay() === weekCalcFirstDow)) {
  15516. html += core.buildGotoAnchorHtml(options, dateEnv, { date: date, type: 'week' }, { 'class': 'fc-week-number' }, dateEnv.format(date, WEEK_NUM_FORMAT) // inner HTML
  15517. );
  15518. }
  15519. if (isDayNumberVisible) {
  15520. html += core.buildGotoAnchorHtml(options, dateEnv, date, { 'class': 'fc-day-number' }, dateEnv.format(date, DAY_NUM_FORMAT) // inner HTML
  15521. );
  15522. }
  15523. html += '</td>';
  15524. return html;
  15525. };
  15526. /* Sizing
  15527. ------------------------------------------------------------------------------------------------------------------*/
  15528. DayGrid.prototype.updateSize = function (isResize) {
  15529. var calendar = this.context.calendar;
  15530. var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer;
  15531. if (isResize ||
  15532. this.isCellSizesDirty ||
  15533. calendar.isEventsUpdated // hack
  15534. ) {
  15535. this.buildPositionCaches();
  15536. this.isCellSizesDirty = false;
  15537. }
  15538. fillRenderer.computeSizes(isResize);
  15539. eventRenderer.computeSizes(isResize);
  15540. mirrorRenderer.computeSizes(isResize);
  15541. fillRenderer.assignSizes(isResize);
  15542. eventRenderer.assignSizes(isResize);
  15543. mirrorRenderer.assignSizes(isResize);
  15544. };
  15545. DayGrid.prototype.buildPositionCaches = function () {
  15546. this.buildColPositions();
  15547. this.buildRowPositions();
  15548. };
  15549. DayGrid.prototype.buildColPositions = function () {
  15550. this.colPositions.build();
  15551. };
  15552. DayGrid.prototype.buildRowPositions = function () {
  15553. this.rowPositions.build();
  15554. this.rowPositions.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack
  15555. };
  15556. /* Hit System
  15557. ------------------------------------------------------------------------------------------------------------------*/
  15558. DayGrid.prototype.positionToHit = function (leftPosition, topPosition) {
  15559. var _a = this, colPositions = _a.colPositions, rowPositions = _a.rowPositions;
  15560. var col = colPositions.leftToIndex(leftPosition);
  15561. var row = rowPositions.topToIndex(topPosition);
  15562. if (row != null && col != null) {
  15563. return {
  15564. row: row,
  15565. col: col,
  15566. dateSpan: {
  15567. range: this.getCellRange(row, col),
  15568. allDay: true
  15569. },
  15570. dayEl: this.getCellEl(row, col),
  15571. relativeRect: {
  15572. left: colPositions.lefts[col],
  15573. right: colPositions.rights[col],
  15574. top: rowPositions.tops[row],
  15575. bottom: rowPositions.bottoms[row]
  15576. }
  15577. };
  15578. }
  15579. };
  15580. /* Cell System
  15581. ------------------------------------------------------------------------------------------------------------------*/
  15582. // FYI: the first column is the leftmost column, regardless of date
  15583. DayGrid.prototype.getCellEl = function (row, col) {
  15584. return this.cellEls[row * this.colCnt + col];
  15585. };
  15586. /* Event Drag Visualization
  15587. ------------------------------------------------------------------------------------------------------------------*/
  15588. DayGrid.prototype._renderEventDrag = function (state) {
  15589. if (state) {
  15590. this.eventRenderer.hideByHash(state.affectedInstances);
  15591. this.fillRenderer.renderSegs('highlight', this.context, state.segs);
  15592. }
  15593. };
  15594. DayGrid.prototype._unrenderEventDrag = function (state) {
  15595. if (state) {
  15596. this.eventRenderer.showByHash(state.affectedInstances);
  15597. this.fillRenderer.unrender('highlight', this.context);
  15598. }
  15599. };
  15600. /* Event Resize Visualization
  15601. ------------------------------------------------------------------------------------------------------------------*/
  15602. DayGrid.prototype._renderEventResize = function (state) {
  15603. if (state) {
  15604. this.eventRenderer.hideByHash(state.affectedInstances);
  15605. this.fillRenderer.renderSegs('highlight', this.context, state.segs);
  15606. this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
  15607. }
  15608. };
  15609. DayGrid.prototype._unrenderEventResize = function (state) {
  15610. if (state) {
  15611. this.eventRenderer.showByHash(state.affectedInstances);
  15612. this.fillRenderer.unrender('highlight', this.context);
  15613. this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
  15614. }
  15615. };
  15616. /* More+ Link Popover
  15617. ------------------------------------------------------------------------------------------------------------------*/
  15618. DayGrid.prototype.removeSegPopover = function () {
  15619. if (this.segPopover) {
  15620. this.segPopover.hide(); // in handler, will call segPopover's removeElement
  15621. }
  15622. };
  15623. // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid.
  15624. // `levelLimit` can be false (don't limit), a number, or true (should be computed).
  15625. DayGrid.prototype.limitRows = function (levelLimit) {
  15626. var rowStructs = this.eventRenderer.rowStructs || [];
  15627. var row; // row #
  15628. var rowLevelLimit;
  15629. for (row = 0; row < rowStructs.length; row++) {
  15630. this.unlimitRow(row);
  15631. if (!levelLimit) {
  15632. rowLevelLimit = false;
  15633. }
  15634. else if (typeof levelLimit === 'number') {
  15635. rowLevelLimit = levelLimit;
  15636. }
  15637. else {
  15638. rowLevelLimit = this.computeRowLevelLimit(row);
  15639. }
  15640. if (rowLevelLimit !== false) {
  15641. this.limitRow(row, rowLevelLimit);
  15642. }
  15643. }
  15644. };
  15645. // Computes the number of levels a row will accomodate without going outside its bounds.
  15646. // Assumes the row is "rigid" (maintains a constant height regardless of what is inside).
  15647. // `row` is the row number.
  15648. DayGrid.prototype.computeRowLevelLimit = function (row) {
  15649. var rowEl = this.rowEls[row]; // the containing "fake" row div
  15650. var rowBottom = rowEl.getBoundingClientRect().bottom; // relative to viewport!
  15651. var trEls = core.findChildren(this.eventRenderer.rowStructs[row].tbodyEl);
  15652. var i;
  15653. var trEl;
  15654. // Reveal one level <tr> at a time and stop when we find one out of bounds
  15655. for (i = 0; i < trEls.length; i++) {
  15656. trEl = trEls[i];
  15657. trEl.classList.remove('fc-limited'); // reset to original state (reveal)
  15658. if (trEl.getBoundingClientRect().bottom > rowBottom) {
  15659. return i;
  15660. }
  15661. }
  15662. return false; // should not limit at all
  15663. };
  15664. // Limits the given grid row to the maximum number of levels and injects "more" links if necessary.
  15665. // `row` is the row number.
  15666. // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.
  15667. DayGrid.prototype.limitRow = function (row, levelLimit) {
  15668. var _this = this;
  15669. var colCnt = this.colCnt;
  15670. var isRtl = this.context.isRtl;
  15671. var rowStruct = this.eventRenderer.rowStructs[row];
  15672. var moreNodes = []; // array of "more" <a> links and <td> DOM nodes
  15673. var col = 0; // col #, left-to-right (not chronologically)
  15674. var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right
  15675. var cellMatrix; // a matrix (by level, then column) of all <td> elements in the row
  15676. var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes
  15677. var i;
  15678. var seg;
  15679. var segsBelow; // array of segment objects below `seg` in the current `col`
  15680. var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies
  15681. var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)
  15682. var td;
  15683. var rowSpan;
  15684. var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell
  15685. var j;
  15686. var moreTd;
  15687. var moreWrap;
  15688. var moreLink;
  15689. // Iterates through empty level cells and places "more" links inside if need be
  15690. var emptyCellsUntil = function (endCol) {
  15691. while (col < endCol) {
  15692. segsBelow = _this.getCellSegs(row, col, levelLimit);
  15693. if (segsBelow.length) {
  15694. td = cellMatrix[levelLimit - 1][col];
  15695. moreLink = _this.renderMoreLink(row, col, segsBelow);
  15696. moreWrap = core.createElement('div', null, moreLink);
  15697. td.appendChild(moreWrap);
  15698. moreNodes.push(moreWrap);
  15699. }
  15700. col++;
  15701. }
  15702. };
  15703. if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit?
  15704. levelSegs = rowStruct.segLevels[levelLimit - 1];
  15705. cellMatrix = rowStruct.cellMatrix;
  15706. limitedNodes = core.findChildren(rowStruct.tbodyEl).slice(levelLimit); // get level <tr> elements past the limit
  15707. limitedNodes.forEach(function (node) {
  15708. node.classList.add('fc-limited'); // hide elements and get a simple DOM-nodes array
  15709. });
  15710. // iterate though segments in the last allowable level
  15711. for (i = 0; i < levelSegs.length; i++) {
  15712. seg = levelSegs[i];
  15713. var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;
  15714. var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;
  15715. emptyCellsUntil(leftCol); // process empty cells before the segment
  15716. // determine *all* segments below `seg` that occupy the same columns
  15717. colSegsBelow = [];
  15718. totalSegsBelow = 0;
  15719. while (col <= rightCol) {
  15720. segsBelow = this.getCellSegs(row, col, levelLimit);
  15721. colSegsBelow.push(segsBelow);
  15722. totalSegsBelow += segsBelow.length;
  15723. col++;
  15724. }
  15725. if (totalSegsBelow) { // do we need to replace this segment with one or many "more" links?
  15726. td = cellMatrix[levelLimit - 1][leftCol]; // the segment's parent cell
  15727. rowSpan = td.rowSpan || 1;
  15728. segMoreNodes = [];
  15729. // make a replacement <td> for each column the segment occupies. will be one for each colspan
  15730. for (j = 0; j < colSegsBelow.length; j++) {
  15731. moreTd = core.createElement('td', { className: 'fc-more-cell', rowSpan: rowSpan });
  15732. segsBelow = colSegsBelow[j];
  15733. moreLink = this.renderMoreLink(row, leftCol + j, [seg].concat(segsBelow) // count seg as hidden too
  15734. );
  15735. moreWrap = core.createElement('div', null, moreLink);
  15736. moreTd.appendChild(moreWrap);
  15737. segMoreNodes.push(moreTd);
  15738. moreNodes.push(moreTd);
  15739. }
  15740. td.classList.add('fc-limited');
  15741. core.insertAfterElement(td, segMoreNodes);
  15742. limitedNodes.push(td);
  15743. }
  15744. }
  15745. emptyCellsUntil(this.colCnt); // finish off the level
  15746. rowStruct.moreEls = moreNodes; // for easy undoing later
  15747. rowStruct.limitedEls = limitedNodes; // for easy undoing later
  15748. }
  15749. };
  15750. // Reveals all levels and removes all "more"-related elements for a grid's row.
  15751. // `row` is a row number.
  15752. DayGrid.prototype.unlimitRow = function (row) {
  15753. var rowStruct = this.eventRenderer.rowStructs[row];
  15754. if (rowStruct.moreEls) {
  15755. rowStruct.moreEls.forEach(core.removeElement);
  15756. rowStruct.moreEls = null;
  15757. }
  15758. if (rowStruct.limitedEls) {
  15759. rowStruct.limitedEls.forEach(function (limitedEl) {
  15760. limitedEl.classList.remove('fc-limited');
  15761. });
  15762. rowStruct.limitedEls = null;
  15763. }
  15764. };
  15765. // Renders an <a> element that represents hidden event element for a cell.
  15766. // Responsible for attaching click handler as well.
  15767. DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) {
  15768. var _this = this;
  15769. var _a = this.context, calendar = _a.calendar, view = _a.view, dateEnv = _a.dateEnv, options = _a.options, isRtl = _a.isRtl;
  15770. var a = core.createElement('a', { className: 'fc-more' });
  15771. a.innerText = this.getMoreLinkText(hiddenSegs.length);
  15772. a.addEventListener('click', function (ev) {
  15773. var clickOption = options.eventLimitClick;
  15774. var _col = isRtl ? _this.colCnt - col - 1 : col; // HACK: props.cells has different dir system?
  15775. var date = _this.props.cells[row][_col].date;
  15776. var moreEl = ev.currentTarget;
  15777. var dayEl = _this.getCellEl(row, col);
  15778. var allSegs = _this.getCellSegs(row, col);
  15779. // rescope the segments to be within the cell's date
  15780. var reslicedAllSegs = _this.resliceDaySegs(allSegs, date);
  15781. var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date);
  15782. if (typeof clickOption === 'function') {
  15783. // the returned value can be an atomic option
  15784. clickOption = calendar.publiclyTrigger('eventLimitClick', [
  15785. {
  15786. date: dateEnv.toDate(date),
  15787. allDay: true,
  15788. dayEl: dayEl,
  15789. moreEl: moreEl,
  15790. segs: reslicedAllSegs,
  15791. hiddenSegs: reslicedHiddenSegs,
  15792. jsEvent: ev,
  15793. view: view
  15794. }
  15795. ]);
  15796. }
  15797. if (clickOption === 'popover') {
  15798. _this.showSegPopover(row, col, moreEl, reslicedAllSegs);
  15799. }
  15800. else if (typeof clickOption === 'string') { // a view name
  15801. calendar.zoomTo(date, clickOption);
  15802. }
  15803. });
  15804. return a;
  15805. };
  15806. // Reveals the popover that displays all events within a cell
  15807. DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) {
  15808. var _this = this;
  15809. var _a = this.context, calendar = _a.calendar, view = _a.view, theme = _a.theme, isRtl = _a.isRtl;
  15810. var _col = isRtl ? this.colCnt - col - 1 : col; // HACK: props.cells has different dir system?
  15811. var moreWrap = moreLink.parentNode; // the <div> wrapper around the <a>
  15812. var topEl; // the element we want to match the top coordinate of
  15813. var options;
  15814. if (this.rowCnt === 1) {
  15815. topEl = view.el; // will cause the popover to cover any sort of header
  15816. }
  15817. else {
  15818. topEl = this.rowEls[row]; // will align with top of row
  15819. }
  15820. options = {
  15821. className: 'fc-more-popover ' + theme.getClass('popover'),
  15822. parentEl: view.el,
  15823. top: core.computeRect(topEl).top,
  15824. autoHide: true,
  15825. content: function (el) {
  15826. _this.segPopoverTile = new DayTile(el);
  15827. _this.updateSegPopoverTile(_this.props.cells[row][_col].date, segs);
  15828. },
  15829. hide: function () {
  15830. _this.segPopoverTile.destroy();
  15831. _this.segPopoverTile = null;
  15832. _this.segPopover.destroy();
  15833. _this.segPopover = null;
  15834. }
  15835. };
  15836. // Determine horizontal coordinate.
  15837. // We use the moreWrap instead of the <td> to avoid border confusion.
  15838. if (isRtl) {
  15839. options.right = core.computeRect(moreWrap).right + 1; // +1 to be over cell border
  15840. }
  15841. else {
  15842. options.left = core.computeRect(moreWrap).left - 1; // -1 to be over cell border
  15843. }
  15844. this.segPopover = new Popover(options);
  15845. this.segPopover.show();
  15846. calendar.releaseAfterSizingTriggers(); // hack for eventPositioned
  15847. };
  15848. // Given the events within an array of segment objects, reslice them to be in a single day
  15849. DayGrid.prototype.resliceDaySegs = function (segs, dayDate) {
  15850. var dayStart = dayDate;
  15851. var dayEnd = core.addDays(dayStart, 1);
  15852. var dayRange = { start: dayStart, end: dayEnd };
  15853. var newSegs = [];
  15854. for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
  15855. var seg = segs_1[_i];
  15856. var eventRange = seg.eventRange;
  15857. var origRange = eventRange.range;
  15858. var slicedRange = core.intersectRanges(origRange, dayRange);
  15859. if (slicedRange) {
  15860. newSegs.push(__assign({}, seg, { eventRange: {
  15861. def: eventRange.def,
  15862. ui: __assign({}, eventRange.ui, { durationEditable: false }),
  15863. instance: eventRange.instance,
  15864. range: slicedRange
  15865. }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() }));
  15866. }
  15867. }
  15868. return newSegs;
  15869. };
  15870. // Generates the text that should be inside a "more" link, given the number of events it represents
  15871. DayGrid.prototype.getMoreLinkText = function (num) {
  15872. var opt = this.context.options.eventLimitText;
  15873. if (typeof opt === 'function') {
  15874. return opt(num);
  15875. }
  15876. else {
  15877. return '+' + num + ' ' + opt;
  15878. }
  15879. };
  15880. // Returns segments within a given cell.
  15881. // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.
  15882. DayGrid.prototype.getCellSegs = function (row, col, startLevel) {
  15883. var segMatrix = this.eventRenderer.rowStructs[row].segMatrix;
  15884. var level = startLevel || 0;
  15885. var segs = [];
  15886. var seg;
  15887. while (level < segMatrix.length) {
  15888. seg = segMatrix[level][col];
  15889. if (seg) {
  15890. segs.push(seg);
  15891. }
  15892. level++;
  15893. }
  15894. return segs;
  15895. };
  15896. return DayGrid;
  15897. }(core.DateComponent));
  15898. var WEEK_NUM_FORMAT$1 = core.createFormatter({ week: 'numeric' });
  15899. /* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells.
  15900. ----------------------------------------------------------------------------------------------------------------------*/
  15901. // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
  15902. // It is responsible for managing width/height.
  15903. var AbstractDayGridView = /** @class */ (function (_super) {
  15904. __extends(AbstractDayGridView, _super);
  15905. function AbstractDayGridView() {
  15906. var _this = _super !== null && _super.apply(this, arguments) || this;
  15907. _this.processOptions = core.memoize(_this._processOptions);
  15908. _this.renderSkeleton = core.memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
  15909. /* Header Rendering
  15910. ------------------------------------------------------------------------------------------------------------------*/
  15911. // Generates the HTML that will go before the day-of week header cells
  15912. _this.renderHeadIntroHtml = function () {
  15913. var _a = _this.context, theme = _a.theme, options = _a.options;
  15914. if (_this.colWeekNumbersVisible) {
  15915. return '' +
  15916. '<th class="fc-week-number ' + theme.getClass('widgetHeader') + '" ' + _this.weekNumberStyleAttr() + '>' +
  15917. '<span>' + // needed for matchCellWidths
  15918. core.htmlEscape(options.weekLabel) +
  15919. '</span>' +
  15920. '</th>';
  15921. }
  15922. return '';
  15923. };
  15924. /* Day Grid Rendering
  15925. ------------------------------------------------------------------------------------------------------------------*/
  15926. // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
  15927. _this.renderDayGridNumberIntroHtml = function (row, dayGrid) {
  15928. var _a = _this.context, options = _a.options, dateEnv = _a.dateEnv;
  15929. var weekStart = dayGrid.props.cells[row][0].date;
  15930. if (_this.colWeekNumbersVisible) {
  15931. return '' +
  15932. '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '>' +
  15933. core.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
  15934. options, dateEnv, { date: weekStart, type: 'week', forceOff: dayGrid.colCnt === 1 }, dateEnv.format(weekStart, WEEK_NUM_FORMAT$1) // inner HTML
  15935. ) +
  15936. '</td>';
  15937. }
  15938. return '';
  15939. };
  15940. // Generates the HTML that goes before the day bg cells for each day-row
  15941. _this.renderDayGridBgIntroHtml = function () {
  15942. var theme = _this.context.theme;
  15943. if (_this.colWeekNumbersVisible) {
  15944. return '<td class="fc-week-number ' + theme.getClass('widgetContent') + '" ' + _this.weekNumberStyleAttr() + '></td>';
  15945. }
  15946. return '';
  15947. };
  15948. // Generates the HTML that goes before every other type of row generated by DayGrid.
  15949. // Affects mirror-skeleton and highlight-skeleton rows.
  15950. _this.renderDayGridIntroHtml = function () {
  15951. if (_this.colWeekNumbersVisible) {
  15952. return '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '></td>';
  15953. }
  15954. return '';
  15955. };
  15956. return _this;
  15957. }
  15958. AbstractDayGridView.prototype._processOptions = function (options) {
  15959. if (options.weekNumbers) {
  15960. if (options.weekNumbersWithinDays) {
  15961. this.cellWeekNumbersVisible = true;
  15962. this.colWeekNumbersVisible = false;
  15963. }
  15964. else {
  15965. this.cellWeekNumbersVisible = false;
  15966. this.colWeekNumbersVisible = true;
  15967. }
  15968. }
  15969. else {
  15970. this.colWeekNumbersVisible = false;
  15971. this.cellWeekNumbersVisible = false;
  15972. }
  15973. };
  15974. AbstractDayGridView.prototype.render = function (props, context) {
  15975. _super.prototype.render.call(this, props, context);
  15976. this.processOptions(context.options);
  15977. this.renderSkeleton(context);
  15978. };
  15979. AbstractDayGridView.prototype.destroy = function () {
  15980. _super.prototype.destroy.call(this);
  15981. this.renderSkeleton.unrender();
  15982. };
  15983. AbstractDayGridView.prototype._renderSkeleton = function (context) {
  15984. this.el.classList.add('fc-dayGrid-view');
  15985. this.el.innerHTML = this.renderSkeletonHtml();
  15986. this.scroller = new core.ScrollComponent('hidden', // overflow x
  15987. 'auto' // overflow y
  15988. );
  15989. var dayGridContainerEl = this.scroller.el;
  15990. this.el.querySelector('.fc-body > tr > td').appendChild(dayGridContainerEl);
  15991. dayGridContainerEl.classList.add('fc-day-grid-container');
  15992. var dayGridEl = core.createElement('div', { className: 'fc-day-grid' });
  15993. dayGridContainerEl.appendChild(dayGridEl);
  15994. this.dayGrid = new DayGrid(dayGridEl, {
  15995. renderNumberIntroHtml: this.renderDayGridNumberIntroHtml,
  15996. renderBgIntroHtml: this.renderDayGridBgIntroHtml,
  15997. renderIntroHtml: this.renderDayGridIntroHtml,
  15998. colWeekNumbersVisible: this.colWeekNumbersVisible,
  15999. cellWeekNumbersVisible: this.cellWeekNumbersVisible
  16000. });
  16001. };
  16002. AbstractDayGridView.prototype._unrenderSkeleton = function () {
  16003. this.el.classList.remove('fc-dayGrid-view');
  16004. this.dayGrid.destroy();
  16005. this.scroller.destroy();
  16006. };
  16007. // Builds the HTML skeleton for the view.
  16008. // The day-grid component will render inside of a container defined by this HTML.
  16009. AbstractDayGridView.prototype.renderSkeletonHtml = function () {
  16010. var _a = this.context, theme = _a.theme, options = _a.options;
  16011. return '' +
  16012. '<table class="' + theme.getClass('tableGrid') + '">' +
  16013. (options.columnHeader ?
  16014. '<thead class="fc-head">' +
  16015. '<tr>' +
  16016. '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
  16017. '</tr>' +
  16018. '</thead>' :
  16019. '') +
  16020. '<tbody class="fc-body">' +
  16021. '<tr>' +
  16022. '<td class="' + theme.getClass('widgetContent') + '"></td>' +
  16023. '</tr>' +
  16024. '</tbody>' +
  16025. '</table>';
  16026. };
  16027. // Generates an HTML attribute string for setting the width of the week number column, if it is known
  16028. AbstractDayGridView.prototype.weekNumberStyleAttr = function () {
  16029. if (this.weekNumberWidth != null) {
  16030. return 'style="width:' + this.weekNumberWidth + 'px"';
  16031. }
  16032. return '';
  16033. };
  16034. // Determines whether each row should have a constant height
  16035. AbstractDayGridView.prototype.hasRigidRows = function () {
  16036. var eventLimit = this.context.options.eventLimit;
  16037. return eventLimit && typeof eventLimit !== 'number';
  16038. };
  16039. /* Dimensions
  16040. ------------------------------------------------------------------------------------------------------------------*/
  16041. AbstractDayGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) {
  16042. _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first
  16043. this.dayGrid.updateSize(isResize);
  16044. };
  16045. // Refreshes the horizontal dimensions of the view
  16046. AbstractDayGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {
  16047. var dayGrid = this.dayGrid;
  16048. var eventLimit = this.context.options.eventLimit;
  16049. var headRowEl = this.header ? this.header.el : null; // HACK
  16050. var scrollerHeight;
  16051. var scrollbarWidths;
  16052. // hack to give the view some height prior to dayGrid's columns being rendered
  16053. // TODO: separate setting height from scroller VS dayGrid.
  16054. if (!dayGrid.rowEls) {
  16055. if (!isAuto) {
  16056. scrollerHeight = this.computeScrollerHeight(viewHeight);
  16057. this.scroller.setHeight(scrollerHeight);
  16058. }
  16059. return;
  16060. }
  16061. if (this.colWeekNumbersVisible) {
  16062. // Make sure all week number cells running down the side have the same width.
  16063. this.weekNumberWidth = core.matchCellWidths(core.findElements(this.el, '.fc-week-number'));
  16064. }
  16065. // reset all heights to be natural
  16066. this.scroller.clear();
  16067. if (headRowEl) {
  16068. core.uncompensateScroll(headRowEl);
  16069. }
  16070. dayGrid.removeSegPopover(); // kill the "more" popover if displayed
  16071. // is the event limit a constant level number?
  16072. if (eventLimit && typeof eventLimit === 'number') {
  16073. dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
  16074. }
  16075. // distribute the height to the rows
  16076. // (viewHeight is a "recommended" value if isAuto)
  16077. scrollerHeight = this.computeScrollerHeight(viewHeight);
  16078. this.setGridHeight(scrollerHeight, isAuto);
  16079. // is the event limit dynamically calculated?
  16080. if (eventLimit && typeof eventLimit !== 'number') {
  16081. dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
  16082. }
  16083. if (!isAuto) { // should we force dimensions of the scroll container?
  16084. this.scroller.setHeight(scrollerHeight);
  16085. scrollbarWidths = this.scroller.getScrollbarWidths();
  16086. if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
  16087. if (headRowEl) {
  16088. core.compensateScroll(headRowEl, scrollbarWidths);
  16089. }
  16090. // doing the scrollbar compensation might have created text overflow which created more height. redo
  16091. scrollerHeight = this.computeScrollerHeight(viewHeight);
  16092. this.scroller.setHeight(scrollerHeight);
  16093. }
  16094. // guarantees the same scrollbar widths
  16095. this.scroller.lockOverflow(scrollbarWidths);
  16096. }
  16097. };
  16098. // given a desired total height of the view, returns what the height of the scroller should be
  16099. AbstractDayGridView.prototype.computeScrollerHeight = function (viewHeight) {
  16100. return viewHeight -
  16101. core.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  16102. };
  16103. // Sets the height of just the DayGrid component in this view
  16104. AbstractDayGridView.prototype.setGridHeight = function (height, isAuto) {
  16105. if (this.context.options.monthMode) {
  16106. // if auto, make the height of each row the height that it would be if there were 6 weeks
  16107. if (isAuto) {
  16108. height *= this.dayGrid.rowCnt / 6;
  16109. }
  16110. core.distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows
  16111. }
  16112. else {
  16113. if (isAuto) {
  16114. core.undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
  16115. }
  16116. else {
  16117. core.distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
  16118. }
  16119. }
  16120. };
  16121. /* Scroll
  16122. ------------------------------------------------------------------------------------------------------------------*/
  16123. AbstractDayGridView.prototype.computeDateScroll = function (duration) {
  16124. return { top: 0 };
  16125. };
  16126. AbstractDayGridView.prototype.queryDateScroll = function () {
  16127. return { top: this.scroller.getScrollTop() };
  16128. };
  16129. AbstractDayGridView.prototype.applyDateScroll = function (scroll) {
  16130. if (scroll.top !== undefined) {
  16131. this.scroller.setScrollTop(scroll.top);
  16132. }
  16133. };
  16134. return AbstractDayGridView;
  16135. }(core.View));
  16136. AbstractDayGridView.prototype.dateProfileGeneratorClass = DayGridDateProfileGenerator;
  16137. var SimpleDayGrid = /** @class */ (function (_super) {
  16138. __extends(SimpleDayGrid, _super);
  16139. function SimpleDayGrid(dayGrid) {
  16140. var _this = _super.call(this, dayGrid.el) || this;
  16141. _this.slicer = new DayGridSlicer();
  16142. _this.dayGrid = dayGrid;
  16143. return _this;
  16144. }
  16145. SimpleDayGrid.prototype.firstContext = function (context) {
  16146. context.calendar.registerInteractiveComponent(this, { el: this.dayGrid.el });
  16147. };
  16148. SimpleDayGrid.prototype.destroy = function () {
  16149. _super.prototype.destroy.call(this);
  16150. this.context.calendar.unregisterInteractiveComponent(this);
  16151. };
  16152. SimpleDayGrid.prototype.render = function (props, context) {
  16153. var dayGrid = this.dayGrid;
  16154. var dateProfile = props.dateProfile, dayTable = props.dayTable;
  16155. dayGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, props.nextDayThreshold, context.calendar, dayGrid, dayTable), { dateProfile: dateProfile, cells: dayTable.cells, isRigid: props.isRigid }), context);
  16156. };
  16157. SimpleDayGrid.prototype.buildPositionCaches = function () {
  16158. this.dayGrid.buildPositionCaches();
  16159. };
  16160. SimpleDayGrid.prototype.queryHit = function (positionLeft, positionTop) {
  16161. var rawHit = this.dayGrid.positionToHit(positionLeft, positionTop);
  16162. if (rawHit) {
  16163. return {
  16164. component: this.dayGrid,
  16165. dateSpan: rawHit.dateSpan,
  16166. dayEl: rawHit.dayEl,
  16167. rect: {
  16168. left: rawHit.relativeRect.left,
  16169. right: rawHit.relativeRect.right,
  16170. top: rawHit.relativeRect.top,
  16171. bottom: rawHit.relativeRect.bottom
  16172. },
  16173. layer: 0
  16174. };
  16175. }
  16176. };
  16177. return SimpleDayGrid;
  16178. }(core.DateComponent));
  16179. var DayGridSlicer = /** @class */ (function (_super) {
  16180. __extends(DayGridSlicer, _super);
  16181. function DayGridSlicer() {
  16182. return _super !== null && _super.apply(this, arguments) || this;
  16183. }
  16184. DayGridSlicer.prototype.sliceRange = function (dateRange, dayTable) {
  16185. return dayTable.sliceRange(dateRange);
  16186. };
  16187. return DayGridSlicer;
  16188. }(core.Slicer));
  16189. var DayGridView = /** @class */ (function (_super) {
  16190. __extends(DayGridView, _super);
  16191. function DayGridView() {
  16192. var _this = _super !== null && _super.apply(this, arguments) || this;
  16193. _this.buildDayTable = core.memoize(buildDayTable);
  16194. return _this;
  16195. }
  16196. DayGridView.prototype.render = function (props, context) {
  16197. _super.prototype.render.call(this, props, context); // will call _renderSkeleton/_unrenderSkeleton
  16198. var dateProfile = this.props.dateProfile;
  16199. var dayTable = this.dayTable =
  16200. this.buildDayTable(dateProfile, props.dateProfileGenerator);
  16201. if (this.header) {
  16202. this.header.receiveProps({
  16203. dateProfile: dateProfile,
  16204. dates: dayTable.headerDates,
  16205. datesRepDistinctDays: dayTable.rowCnt === 1,
  16206. renderIntroHtml: this.renderHeadIntroHtml
  16207. }, context);
  16208. }
  16209. this.simpleDayGrid.receiveProps({
  16210. dateProfile: dateProfile,
  16211. dayTable: dayTable,
  16212. businessHours: props.businessHours,
  16213. dateSelection: props.dateSelection,
  16214. eventStore: props.eventStore,
  16215. eventUiBases: props.eventUiBases,
  16216. eventSelection: props.eventSelection,
  16217. eventDrag: props.eventDrag,
  16218. eventResize: props.eventResize,
  16219. isRigid: this.hasRigidRows(),
  16220. nextDayThreshold: this.context.nextDayThreshold
  16221. }, context);
  16222. };
  16223. DayGridView.prototype._renderSkeleton = function (context) {
  16224. _super.prototype._renderSkeleton.call(this, context);
  16225. if (context.options.columnHeader) {
  16226. this.header = new core.DayHeader(this.el.querySelector('.fc-head-container'));
  16227. }
  16228. this.simpleDayGrid = new SimpleDayGrid(this.dayGrid);
  16229. };
  16230. DayGridView.prototype._unrenderSkeleton = function () {
  16231. _super.prototype._unrenderSkeleton.call(this);
  16232. if (this.header) {
  16233. this.header.destroy();
  16234. }
  16235. this.simpleDayGrid.destroy();
  16236. };
  16237. return DayGridView;
  16238. }(AbstractDayGridView));
  16239. function buildDayTable(dateProfile, dateProfileGenerator) {
  16240. var daySeries = new core.DaySeries(dateProfile.renderRange, dateProfileGenerator);
  16241. return new core.DayTable(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit));
  16242. }
  16243. var main = core.createPlugin({
  16244. defaultView: 'dayGridMonth',
  16245. views: {
  16246. dayGrid: DayGridView,
  16247. dayGridDay: {
  16248. type: 'dayGrid',
  16249. duration: { days: 1 }
  16250. },
  16251. dayGridWeek: {
  16252. type: 'dayGrid',
  16253. duration: { weeks: 1 }
  16254. },
  16255. dayGridMonth: {
  16256. type: 'dayGrid',
  16257. duration: { months: 1 },
  16258. monthMode: true,
  16259. fixedWeekCount: true
  16260. }
  16261. }
  16262. });
  16263. exports.AbstractDayGridView = AbstractDayGridView;
  16264. exports.DayBgRow = DayBgRow;
  16265. exports.DayGrid = DayGrid;
  16266. exports.DayGridSlicer = DayGridSlicer;
  16267. exports.DayGridView = DayGridView;
  16268. exports.SimpleDayGrid = SimpleDayGrid;
  16269. exports.buildBasicDayTable = buildDayTable;
  16270. exports.default = main;
  16271. Object.defineProperty(exports, '__esModule', { value: true });
  16272. }));
  16273. /*!
  16274. FullCalendar Google Calendar Plugin v4.4.0
  16275. Docs & License: https://fullcalendar.io/
  16276. (c) 2019 Adam Shaw
  16277. */
  16278. (function (global, factory) {
  16279. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fullcalendar/core')) :
  16280. typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core'], factory) :
  16281. (global = global || self, factory(global.FullCalendarGoogleCalendar = {}, global.FullCalendar));
  16282. }(this, function (exports, core) { 'use strict';
  16283. /*! *****************************************************************************
  16284. Copyright (c) Microsoft Corporation. All rights reserved.
  16285. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  16286. this file except in compliance with the License. You may obtain a copy of the
  16287. License at http://www.apache.org/licenses/LICENSE-2.0
  16288. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16289. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  16290. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  16291. MERCHANTABLITY OR NON-INFRINGEMENT.
  16292. See the Apache Version 2.0 License for specific language governing permissions
  16293. and limitations under the License.
  16294. ***************************************************************************** */
  16295. var __assign = function() {
  16296. __assign = Object.assign || function __assign(t) {
  16297. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16298. s = arguments[i];
  16299. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16300. }
  16301. return t;
  16302. };
  16303. return __assign.apply(this, arguments);
  16304. };
  16305. // TODO: expose somehow
  16306. var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
  16307. var STANDARD_PROPS = {
  16308. url: String,
  16309. googleCalendarApiKey: String,
  16310. googleCalendarId: String,
  16311. googleCalendarApiBase: String,
  16312. data: null
  16313. };
  16314. var eventSourceDef = {
  16315. parseMeta: function (raw) {
  16316. if (typeof raw === 'string') {
  16317. raw = { url: raw };
  16318. }
  16319. if (typeof raw === 'object') {
  16320. var standardProps = core.refineProps(raw, STANDARD_PROPS);
  16321. if (!standardProps.googleCalendarId && standardProps.url) {
  16322. standardProps.googleCalendarId = parseGoogleCalendarId(standardProps.url);
  16323. }
  16324. delete standardProps.url;
  16325. if (standardProps.googleCalendarId) {
  16326. return standardProps;
  16327. }
  16328. }
  16329. return null;
  16330. },
  16331. fetch: function (arg, onSuccess, onFailure) {
  16332. var calendar = arg.calendar;
  16333. var meta = arg.eventSource.meta;
  16334. var apiKey = meta.googleCalendarApiKey || calendar.opt('googleCalendarApiKey');
  16335. if (!apiKey) {
  16336. onFailure({
  16337. message: 'Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/'
  16338. });
  16339. }
  16340. else {
  16341. var url = buildUrl(meta);
  16342. var requestParams_1 = buildRequestParams(arg.range, apiKey, meta.data, calendar.dateEnv);
  16343. core.requestJson('GET', url, requestParams_1, function (body, xhr) {
  16344. if (body.error) {
  16345. onFailure({
  16346. message: 'Google Calendar API: ' + body.error.message,
  16347. errors: body.error.errors,
  16348. xhr: xhr
  16349. });
  16350. }
  16351. else {
  16352. onSuccess({
  16353. rawEvents: gcalItemsToRawEventDefs(body.items, requestParams_1.timeZone),
  16354. xhr: xhr
  16355. });
  16356. }
  16357. }, function (message, xhr) {
  16358. onFailure({ message: message, xhr: xhr });
  16359. });
  16360. }
  16361. }
  16362. };
  16363. function parseGoogleCalendarId(url) {
  16364. var match;
  16365. // detect if the ID was specified as a single string.
  16366. // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars.
  16367. if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) {
  16368. return url;
  16369. }
  16370. else if ((match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) ||
  16371. (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))) {
  16372. return decodeURIComponent(match[1]);
  16373. }
  16374. }
  16375. function buildUrl(meta) {
  16376. var apiBase = meta.googleCalendarApiBase;
  16377. if (!apiBase) {
  16378. apiBase = API_BASE;
  16379. }
  16380. return apiBase + '/' + encodeURIComponent(meta.googleCalendarId) + '/events';
  16381. }
  16382. function buildRequestParams(range, apiKey, extraParams, dateEnv) {
  16383. var params;
  16384. var startStr;
  16385. var endStr;
  16386. if (dateEnv.canComputeOffset) {
  16387. // strings will naturally have offsets, which GCal needs
  16388. startStr = dateEnv.formatIso(range.start);
  16389. endStr = dateEnv.formatIso(range.end);
  16390. }
  16391. else {
  16392. // when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day
  16393. // from the UTC day-start to guarantee we're getting all the events
  16394. // (start/end will be UTC-coerced dates, so toISOString is okay)
  16395. startStr = core.addDays(range.start, -1).toISOString();
  16396. endStr = core.addDays(range.end, 1).toISOString();
  16397. }
  16398. params = __assign({}, (extraParams || {}), { key: apiKey, timeMin: startStr, timeMax: endStr, singleEvents: true, maxResults: 9999 });
  16399. if (dateEnv.timeZone !== 'local') {
  16400. params.timeZone = dateEnv.timeZone;
  16401. }
  16402. return params;
  16403. }
  16404. function gcalItemsToRawEventDefs(items, gcalTimezone) {
  16405. return items.map(function (item) {
  16406. return gcalItemToRawEventDef(item, gcalTimezone);
  16407. });
  16408. }
  16409. function gcalItemToRawEventDef(item, gcalTimezone) {
  16410. var url = item.htmlLink || null;
  16411. // make the URLs for each event show times in the correct timezone
  16412. if (url && gcalTimezone) {
  16413. url = injectQsComponent(url, 'ctz=' + gcalTimezone);
  16414. }
  16415. return {
  16416. id: item.id,
  16417. title: item.summary,
  16418. start: item.start.dateTime || item.start.date,
  16419. end: item.end.dateTime || item.end.date,
  16420. url: url,
  16421. location: item.location,
  16422. description: item.description
  16423. };
  16424. }
  16425. // Injects a string like "arg=value" into the querystring of a URL
  16426. // TODO: move to a general util file?
  16427. function injectQsComponent(url, component) {
  16428. // inject it after the querystring but before the fragment
  16429. return url.replace(/(\?.*?)?(#|$)/, function (whole, qs, hash) {
  16430. return (qs ? qs + '&' : '?') + component + hash;
  16431. });
  16432. }
  16433. var main = core.createPlugin({
  16434. eventSourceDefs: [eventSourceDef]
  16435. });
  16436. exports.default = main;
  16437. Object.defineProperty(exports, '__esModule', { value: true });
  16438. }));
  16439. /* Modernizr 2.8.3 (Custom Build) | MIT & BSD
  16440. * Build: http://modernizr.com/download/#-cssanimations-csstransforms-csstransforms3d-csstransitions-inlinesvg-svg-shiv-cssclasses-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes-load
  16441. */
  16442. ;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=["&#173;",'<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))};
  16443. /*!
  16444. * jQuery Validation Plugin v1.13.1
  16445. *
  16446. * http://jqueryvalidation.org/
  16447. *
  16448. * Copyright (c) 2014 Jörn Zaefferer
  16449. * Released under the MIT license
  16450. */
  16451. (function( factory ) {
  16452. if ( typeof define === "function" && define.amd ) {
  16453. define( ["jquery"], factory );
  16454. } else {
  16455. factory( jQuery );
  16456. }
  16457. }(function( $ ) {
  16458. $.extend($.fn, {
  16459. // http://jqueryvalidation.org/validate/
  16460. validate: function( options ) {
  16461. // if nothing is selected, return nothing; can't chain anyway
  16462. if ( !this.length ) {
  16463. if ( options && options.debug && window.console ) {
  16464. console.warn( "Nothing selected, can't validate, returning nothing." );
  16465. }
  16466. return;
  16467. }
  16468. // check if a validator for this form was already created
  16469. var validator = $.data( this[ 0 ], "validator" );
  16470. if ( validator ) {
  16471. return validator;
  16472. }
  16473. // Add novalidate tag if HTML5.
  16474. this.attr( "novalidate", "novalidate" );
  16475. validator = new $.validator( options, this[ 0 ] );
  16476. $.data( this[ 0 ], "validator", validator );
  16477. if ( validator.settings.onsubmit ) {
  16478. this.validateDelegate( ":submit", "click", function( event ) {
  16479. if ( validator.settings.submitHandler ) {
  16480. validator.submitButton = event.target;
  16481. }
  16482. // allow suppressing validation by adding a cancel class to the submit button
  16483. if ( $( event.target ).hasClass( "cancel" ) ) {
  16484. validator.cancelSubmit = true;
  16485. }
  16486. // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
  16487. if ( $( event.target ).attr( "formnovalidate" ) !== undefined ) {
  16488. validator.cancelSubmit = true;
  16489. }
  16490. });
  16491. // validate the form on submit
  16492. this.submit( function( event ) {
  16493. if ( validator.settings.debug ) {
  16494. // prevent form submit to be able to see console output
  16495. event.preventDefault();
  16496. }
  16497. function handle() {
  16498. var hidden, result;
  16499. if ( validator.settings.submitHandler ) {
  16500. if ( validator.submitButton ) {
  16501. // insert a hidden input as a replacement for the missing submit button
  16502. hidden = $( "<input type='hidden'/>" )
  16503. .attr( "name", validator.submitButton.name )
  16504. .val( $( validator.submitButton ).val() )
  16505. .appendTo( validator.currentForm );
  16506. }
  16507. result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
  16508. if ( validator.submitButton ) {
  16509. // and clean up afterwards; thanks to no-block-scope, hidden can be referenced
  16510. hidden.remove();
  16511. }
  16512. if ( result !== undefined ) {
  16513. return result;
  16514. }
  16515. return false;
  16516. }
  16517. return true;
  16518. }
  16519. // prevent submit for invalid forms or custom submit handlers
  16520. if ( validator.cancelSubmit ) {
  16521. validator.cancelSubmit = false;
  16522. return handle();
  16523. }
  16524. if ( validator.form() ) {
  16525. if ( validator.pendingRequest ) {
  16526. validator.formSubmitted = true;
  16527. return false;
  16528. }
  16529. return handle();
  16530. } else {
  16531. validator.focusInvalid();
  16532. return false;
  16533. }
  16534. });
  16535. }
  16536. return validator;
  16537. },
  16538. // http://jqueryvalidation.org/valid/
  16539. valid: function() {
  16540. var valid, validator;
  16541. if ( $( this[ 0 ] ).is( "form" ) ) {
  16542. valid = this.validate().form();
  16543. } else {
  16544. valid = true;
  16545. validator = $( this[ 0 ].form ).validate();
  16546. this.each( function() {
  16547. valid = validator.element( this ) && valid;
  16548. });
  16549. }
  16550. return valid;
  16551. },
  16552. // attributes: space separated list of attributes to retrieve and remove
  16553. removeAttrs: function( attributes ) {
  16554. var result = {},
  16555. $element = this;
  16556. $.each( attributes.split( /\s/ ), function( index, value ) {
  16557. result[ value ] = $element.attr( value );
  16558. $element.removeAttr( value );
  16559. });
  16560. return result;
  16561. },
  16562. // http://jqueryvalidation.org/rules/
  16563. rules: function( command, argument ) {
  16564. var element = this[ 0 ],
  16565. settings, staticRules, existingRules, data, param, filtered;
  16566. if ( command ) {
  16567. settings = $.data( element.form, "validator" ).settings;
  16568. staticRules = settings.rules;
  16569. existingRules = $.validator.staticRules( element );
  16570. switch ( command ) {
  16571. case "add":
  16572. $.extend( existingRules, $.validator.normalizeRule( argument ) );
  16573. // remove messages from rules, but allow them to be set separately
  16574. delete existingRules.messages;
  16575. staticRules[ element.name ] = existingRules;
  16576. if ( argument.messages ) {
  16577. settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
  16578. }
  16579. break;
  16580. case "remove":
  16581. if ( !argument ) {
  16582. delete staticRules[ element.name ];
  16583. return existingRules;
  16584. }
  16585. filtered = {};
  16586. $.each( argument.split( /\s/ ), function( index, method ) {
  16587. filtered[ method ] = existingRules[ method ];
  16588. delete existingRules[ method ];
  16589. if ( method === "required" ) {
  16590. $( element ).removeAttr( "aria-required" );
  16591. }
  16592. });
  16593. return filtered;
  16594. }
  16595. }
  16596. data = $.validator.normalizeRules(
  16597. $.extend(
  16598. {},
  16599. $.validator.classRules( element ),
  16600. $.validator.attributeRules( element ),
  16601. $.validator.dataRules( element ),
  16602. $.validator.staticRules( element )
  16603. ), element );
  16604. // make sure required is at front
  16605. if ( data.required ) {
  16606. param = data.required;
  16607. delete data.required;
  16608. data = $.extend( { required: param }, data );
  16609. $( element ).attr( "aria-required", "true" );
  16610. }
  16611. // make sure remote is at back
  16612. if ( data.remote ) {
  16613. param = data.remote;
  16614. delete data.remote;
  16615. data = $.extend( data, { remote: param });
  16616. }
  16617. return data;
  16618. }
  16619. });
  16620. // Custom selectors
  16621. $.extend( $.expr[ ":" ], {
  16622. // http://jqueryvalidation.org/blank-selector/
  16623. blank: function( a ) {
  16624. return !$.trim( "" + $( a ).val() );
  16625. },
  16626. // http://jqueryvalidation.org/filled-selector/
  16627. filled: function( a ) {
  16628. return !!$.trim( "" + $( a ).val() );
  16629. },
  16630. // http://jqueryvalidation.org/unchecked-selector/
  16631. unchecked: function( a ) {
  16632. return !$( a ).prop( "checked" );
  16633. }
  16634. });
  16635. // constructor for validator
  16636. $.validator = function( options, form ) {
  16637. this.settings = $.extend( true, {}, $.validator.defaults, options );
  16638. this.currentForm = form;
  16639. this.init();
  16640. };
  16641. // http://jqueryvalidation.org/jQuery.validator.format/
  16642. $.validator.format = function( source, params ) {
  16643. if ( arguments.length === 1 ) {
  16644. return function() {
  16645. var args = $.makeArray( arguments );
  16646. args.unshift( source );
  16647. return $.validator.format.apply( this, args );
  16648. };
  16649. }
  16650. if ( arguments.length > 2 && params.constructor !== Array ) {
  16651. params = $.makeArray( arguments ).slice( 1 );
  16652. }
  16653. if ( params.constructor !== Array ) {
  16654. params = [ params ];
  16655. }
  16656. $.each( params, function( i, n ) {
  16657. source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
  16658. return n;
  16659. });
  16660. });
  16661. return source;
  16662. };
  16663. $.extend( $.validator, {
  16664. defaults: {
  16665. messages: {},
  16666. groups: {},
  16667. rules: {},
  16668. errorClass: "error",
  16669. validClass: "valid",
  16670. errorElement: "label",
  16671. focusCleanup: false,
  16672. focusInvalid: true,
  16673. errorContainer: $( [] ),
  16674. errorLabelContainer: $( [] ),
  16675. onsubmit: true,
  16676. ignore: ":hidden",
  16677. ignoreTitle: false,
  16678. onfocusin: function( element ) {
  16679. this.lastActive = element;
  16680. // Hide error label and remove error class on focus if enabled
  16681. if ( this.settings.focusCleanup ) {
  16682. if ( this.settings.unhighlight ) {
  16683. this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
  16684. }
  16685. this.hideThese( this.errorsFor( element ) );
  16686. }
  16687. },
  16688. onfocusout: function( element ) {
  16689. if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
  16690. this.element( element );
  16691. }
  16692. },
  16693. onkeyup: function( element, event ) {
  16694. if ( event.which === 9 && this.elementValue( element ) === "" ) {
  16695. return;
  16696. } else if ( element.name in this.submitted || element === this.lastElement ) {
  16697. this.element( element );
  16698. }
  16699. },
  16700. onclick: function( element ) {
  16701. // click on selects, radiobuttons and checkboxes
  16702. if ( element.name in this.submitted ) {
  16703. this.element( element );
  16704. // or option elements, check parent select in that case
  16705. } else if ( element.parentNode.name in this.submitted ) {
  16706. this.element( element.parentNode );
  16707. }
  16708. },
  16709. highlight: function( element, errorClass, validClass ) {
  16710. if ( element.type === "radio" ) {
  16711. this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
  16712. } else {
  16713. $( element ).addClass( errorClass ).removeClass( validClass );
  16714. }
  16715. },
  16716. unhighlight: function( element, errorClass, validClass ) {
  16717. if ( element.type === "radio" ) {
  16718. this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
  16719. } else {
  16720. $( element ).removeClass( errorClass ).addClass( validClass );
  16721. }
  16722. }
  16723. },
  16724. // http://jqueryvalidation.org/jQuery.validator.setDefaults/
  16725. setDefaults: function( settings ) {
  16726. $.extend( $.validator.defaults, settings );
  16727. },
  16728. messages: {
  16729. required: "This field is required.",
  16730. remote: "Please fix this field.",
  16731. email: "Please enter a valid email address.",
  16732. url: "Please enter a valid URL.",
  16733. date: "Please enter a valid date.",
  16734. dateISO: "Please enter a valid date ( ISO ).",
  16735. number: "Please enter a valid number.",
  16736. digits: "Please enter only digits.",
  16737. creditcard: "Please enter a valid credit card number.",
  16738. equalTo: "Please enter the same value again.",
  16739. maxlength: $.validator.format( "Please enter no more than {0} characters." ),
  16740. minlength: $.validator.format( "Please enter at least {0} characters." ),
  16741. rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
  16742. range: $.validator.format( "Please enter a value between {0} and {1}." ),
  16743. max: $.validator.format( "Please enter a value less than or equal to {0}." ),
  16744. min: $.validator.format( "Please enter a value greater than or equal to {0}." )
  16745. },
  16746. autoCreateRanges: false,
  16747. prototype: {
  16748. init: function() {
  16749. this.labelContainer = $( this.settings.errorLabelContainer );
  16750. this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
  16751. this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
  16752. this.submitted = {};
  16753. this.valueCache = {};
  16754. this.pendingRequest = 0;
  16755. this.pending = {};
  16756. this.invalid = {};
  16757. this.reset();
  16758. var groups = ( this.groups = {} ),
  16759. rules;
  16760. $.each( this.settings.groups, function( key, value ) {
  16761. if ( typeof value === "string" ) {
  16762. value = value.split( /\s/ );
  16763. }
  16764. $.each( value, function( index, name ) {
  16765. groups[ name ] = key;
  16766. });
  16767. });
  16768. rules = this.settings.rules;
  16769. $.each( rules, function( key, value ) {
  16770. rules[ key ] = $.validator.normalizeRule( value );
  16771. });
  16772. function delegate( event ) {
  16773. var validator = $.data( this[ 0 ].form, "validator" ),
  16774. eventType = "on" + event.type.replace( /^validate/, "" ),
  16775. settings = validator.settings;
  16776. if ( settings[ eventType ] && !this.is( settings.ignore ) ) {
  16777. settings[ eventType ].call( validator, this[ 0 ], event );
  16778. }
  16779. }
  16780. $( this.currentForm )
  16781. .validateDelegate( ":text, [type='password'], [type='file'], select, textarea, " +
  16782. "[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
  16783. "[type='email'], [type='datetime'], [type='date'], [type='month'], " +
  16784. "[type='week'], [type='time'], [type='datetime-local'], " +
  16785. "[type='range'], [type='color'], [type='radio'], [type='checkbox']",
  16786. "focusin focusout keyup", delegate)
  16787. // Support: Chrome, oldIE
  16788. // "select" is provided as event.target when clicking a option
  16789. .validateDelegate("select, option, [type='radio'], [type='checkbox']", "click", delegate);
  16790. if ( this.settings.invalidHandler ) {
  16791. $( this.currentForm ).bind( "invalid-form.validate", this.settings.invalidHandler );
  16792. }
  16793. // Add aria-required to any Static/Data/Class required fields before first validation
  16794. // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html
  16795. $( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" );
  16796. },
  16797. // http://jqueryvalidation.org/Validator.form/
  16798. form: function() {
  16799. this.checkForm();
  16800. $.extend( this.submitted, this.errorMap );
  16801. this.invalid = $.extend({}, this.errorMap );
  16802. if ( !this.valid() ) {
  16803. $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
  16804. }
  16805. this.showErrors();
  16806. return this.valid();
  16807. },
  16808. checkForm: function() {
  16809. this.prepareForm();
  16810. for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
  16811. this.check( elements[ i ] );
  16812. }
  16813. return this.valid();
  16814. },
  16815. // http://jqueryvalidation.org/Validator.element/
  16816. element: function( element ) {
  16817. var cleanElement = this.clean( element ),
  16818. checkElement = this.validationTargetFor( cleanElement ),
  16819. result = true;
  16820. this.lastElement = checkElement;
  16821. if ( checkElement === undefined ) {
  16822. delete this.invalid[ cleanElement.name ];
  16823. } else {
  16824. this.prepareElement( checkElement );
  16825. this.currentElements = $( checkElement );
  16826. result = this.check( checkElement ) !== false;
  16827. if ( result ) {
  16828. delete this.invalid[ checkElement.name ];
  16829. } else {
  16830. this.invalid[ checkElement.name ] = true;
  16831. }
  16832. }
  16833. // Add aria-invalid status for screen readers
  16834. $( element ).attr( "aria-invalid", !result );
  16835. if ( !this.numberOfInvalids() ) {
  16836. // Hide error containers on last error
  16837. this.toHide = this.toHide.add( this.containers );
  16838. }
  16839. this.showErrors();
  16840. return result;
  16841. },
  16842. // http://jqueryvalidation.org/Validator.showErrors/
  16843. showErrors: function( errors ) {
  16844. if ( errors ) {
  16845. // add items to error list and map
  16846. $.extend( this.errorMap, errors );
  16847. this.errorList = [];
  16848. for ( var name in errors ) {
  16849. this.errorList.push({
  16850. message: errors[ name ],
  16851. element: this.findByName( name )[ 0 ]
  16852. });
  16853. }
  16854. // remove items from success list
  16855. this.successList = $.grep( this.successList, function( element ) {
  16856. return !( element.name in errors );
  16857. });
  16858. }
  16859. if ( this.settings.showErrors ) {
  16860. this.settings.showErrors.call( this, this.errorMap, this.errorList );
  16861. } else {
  16862. this.defaultShowErrors();
  16863. }
  16864. },
  16865. // http://jqueryvalidation.org/Validator.resetForm/
  16866. resetForm: function() {
  16867. if ( $.fn.resetForm ) {
  16868. $( this.currentForm ).resetForm();
  16869. }
  16870. this.submitted = {};
  16871. this.lastElement = null;
  16872. this.prepareForm();
  16873. this.hideErrors();
  16874. this.elements()
  16875. .removeClass( this.settings.errorClass )
  16876. .removeData( "previousValue" )
  16877. .removeAttr( "aria-invalid" );
  16878. },
  16879. numberOfInvalids: function() {
  16880. return this.objectLength( this.invalid );
  16881. },
  16882. objectLength: function( obj ) {
  16883. /* jshint unused: false */
  16884. var count = 0,
  16885. i;
  16886. for ( i in obj ) {
  16887. count++;
  16888. }
  16889. return count;
  16890. },
  16891. hideErrors: function() {
  16892. this.hideThese( this.toHide );
  16893. },
  16894. hideThese: function( errors ) {
  16895. errors.not( this.containers ).text( "" );
  16896. this.addWrapper( errors ).hide();
  16897. },
  16898. valid: function() {
  16899. return this.size() === 0;
  16900. },
  16901. size: function() {
  16902. return this.errorList.length;
  16903. },
  16904. focusInvalid: function() {
  16905. if ( this.settings.focusInvalid ) {
  16906. try {
  16907. $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [])
  16908. .filter( ":visible" )
  16909. .focus()
  16910. // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
  16911. .trigger( "focusin" );
  16912. } catch ( e ) {
  16913. // ignore IE throwing errors when focusing hidden elements
  16914. }
  16915. }
  16916. },
  16917. findLastActive: function() {
  16918. var lastActive = this.lastActive;
  16919. return lastActive && $.grep( this.errorList, function( n ) {
  16920. return n.element.name === lastActive.name;
  16921. }).length === 1 && lastActive;
  16922. },
  16923. elements: function() {
  16924. var validator = this,
  16925. rulesCache = {};
  16926. // select all valid inputs inside the form (no submit or reset buttons)
  16927. return $( this.currentForm )
  16928. .find( "input, select, textarea" )
  16929. .not( ":submit, :reset, :image, [disabled], [readonly]" )
  16930. .not( this.settings.ignore )
  16931. .filter( function() {
  16932. if ( !this.name && validator.settings.debug && window.console ) {
  16933. console.error( "%o has no name assigned", this );
  16934. }
  16935. // select only the first element for each name, and only those with rules specified
  16936. if ( this.name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
  16937. return false;
  16938. }
  16939. rulesCache[ this.name ] = true;
  16940. return true;
  16941. });
  16942. },
  16943. clean: function( selector ) {
  16944. return $( selector )[ 0 ];
  16945. },
  16946. errors: function() {
  16947. var errorClass = this.settings.errorClass.split( " " ).join( "." );
  16948. return $( this.settings.errorElement + "." + errorClass, this.errorContext );
  16949. },
  16950. reset: function() {
  16951. this.successList = [];
  16952. this.errorList = [];
  16953. this.errorMap = {};
  16954. this.toShow = $( [] );
  16955. this.toHide = $( [] );
  16956. this.currentElements = $( [] );
  16957. },
  16958. prepareForm: function() {
  16959. this.reset();
  16960. this.toHide = this.errors().add( this.containers );
  16961. },
  16962. prepareElement: function( element ) {
  16963. this.reset();
  16964. this.toHide = this.errorsFor( element );
  16965. },
  16966. elementValue: function( element ) {
  16967. var val,
  16968. $element = $( element ),
  16969. type = element.type;
  16970. if ( type === "radio" || type === "checkbox" ) {
  16971. return $( "input[name='" + element.name + "']:checked" ).val();
  16972. } else if ( type === "number" && typeof element.validity !== "undefined" ) {
  16973. return element.validity.badInput ? false : $element.val();
  16974. }
  16975. val = $element.val();
  16976. if ( typeof val === "string" ) {
  16977. return val.replace(/\r/g, "" );
  16978. }
  16979. return val;
  16980. },
  16981. check: function( element ) {
  16982. element = this.validationTargetFor( this.clean( element ) );
  16983. var rules = $( element ).rules(),
  16984. rulesCount = $.map( rules, function( n, i ) {
  16985. return i;
  16986. }).length,
  16987. dependencyMismatch = false,
  16988. val = this.elementValue( element ),
  16989. result, method, rule;
  16990. for ( method in rules ) {
  16991. rule = { method: method, parameters: rules[ method ] };
  16992. try {
  16993. result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
  16994. // if a method indicates that the field is optional and therefore valid,
  16995. // don't mark it as valid when there are no other rules
  16996. if ( result === "dependency-mismatch" && rulesCount === 1 ) {
  16997. dependencyMismatch = true;
  16998. continue;
  16999. }
  17000. dependencyMismatch = false;
  17001. if ( result === "pending" ) {
  17002. this.toHide = this.toHide.not( this.errorsFor( element ) );
  17003. return;
  17004. }
  17005. if ( !result ) {
  17006. this.formatAndAdd( element, rule );
  17007. return false;
  17008. }
  17009. } catch ( e ) {
  17010. if ( this.settings.debug && window.console ) {
  17011. console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
  17012. }
  17013. throw e;
  17014. }
  17015. }
  17016. if ( dependencyMismatch ) {
  17017. return;
  17018. }
  17019. if ( this.objectLength( rules ) ) {
  17020. this.successList.push( element );
  17021. }
  17022. return true;
  17023. },
  17024. // return the custom message for the given element and validation method
  17025. // specified in the element's HTML5 data attribute
  17026. // return the generic message if present and no method specific message is present
  17027. customDataMessage: function( element, method ) {
  17028. return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
  17029. method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
  17030. },
  17031. // return the custom message for the given element name and validation method
  17032. customMessage: function( name, method ) {
  17033. var m = this.settings.messages[ name ];
  17034. return m && ( m.constructor === String ? m : m[ method ]);
  17035. },
  17036. // return the first defined argument, allowing empty strings
  17037. findDefined: function() {
  17038. for ( var i = 0; i < arguments.length; i++) {
  17039. if ( arguments[ i ] !== undefined ) {
  17040. return arguments[ i ];
  17041. }
  17042. }
  17043. return undefined;
  17044. },
  17045. defaultMessage: function( element, method ) {
  17046. return this.findDefined(
  17047. this.customMessage( element.name, method ),
  17048. this.customDataMessage( element, method ),
  17049. // title is never undefined, so handle empty string as undefined
  17050. !this.settings.ignoreTitle && element.title || undefined,
  17051. $.validator.messages[ method ],
  17052. "<strong>Warning: No message defined for " + element.name + "</strong>"
  17053. );
  17054. },
  17055. formatAndAdd: function( element, rule ) {
  17056. var message = this.defaultMessage( element, rule.method ),
  17057. theregex = /\$?\{(\d+)\}/g;
  17058. if ( typeof message === "function" ) {
  17059. message = message.call( this, rule.parameters, element );
  17060. } else if ( theregex.test( message ) ) {
  17061. message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
  17062. }
  17063. this.errorList.push({
  17064. message: message,
  17065. element: element,
  17066. method: rule.method
  17067. });
  17068. this.errorMap[ element.name ] = message;
  17069. this.submitted[ element.name ] = message;
  17070. },
  17071. addWrapper: function( toToggle ) {
  17072. if ( this.settings.wrapper ) {
  17073. toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
  17074. }
  17075. return toToggle;
  17076. },
  17077. defaultShowErrors: function() {
  17078. var i, elements, error;
  17079. for ( i = 0; this.errorList[ i ]; i++ ) {
  17080. error = this.errorList[ i ];
  17081. if ( this.settings.highlight ) {
  17082. this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
  17083. }
  17084. this.showLabel( error.element, error.message );
  17085. }
  17086. if ( this.errorList.length ) {
  17087. this.toShow = this.toShow.add( this.containers );
  17088. }
  17089. if ( this.settings.success ) {
  17090. for ( i = 0; this.successList[ i ]; i++ ) {
  17091. this.showLabel( this.successList[ i ] );
  17092. }
  17093. }
  17094. if ( this.settings.unhighlight ) {
  17095. for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
  17096. this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
  17097. }
  17098. }
  17099. this.toHide = this.toHide.not( this.toShow );
  17100. this.hideErrors();
  17101. this.addWrapper( this.toShow ).show();
  17102. },
  17103. validElements: function() {
  17104. return this.currentElements.not( this.invalidElements() );
  17105. },
  17106. invalidElements: function() {
  17107. return $( this.errorList ).map(function() {
  17108. return this.element;
  17109. });
  17110. },
  17111. showLabel: function( element, message ) {
  17112. var place, group, errorID,
  17113. error = this.errorsFor( element ),
  17114. elementID = this.idOrName( element ),
  17115. describedBy = $( element ).attr( "aria-describedby" );
  17116. if ( error.length ) {
  17117. // refresh error/success class
  17118. error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
  17119. // replace message on existing label
  17120. error.html( message );
  17121. } else {
  17122. // create error element
  17123. error = $( "<" + this.settings.errorElement + ">" )
  17124. .attr( "id", elementID + "-error" )
  17125. .addClass( this.settings.errorClass )
  17126. .html( message || "" );
  17127. // Maintain reference to the element to be placed into the DOM
  17128. place = error;
  17129. if ( this.settings.wrapper ) {
  17130. // make sure the element is visible, even in IE
  17131. // actually showing the wrapped element is handled elsewhere
  17132. place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
  17133. }
  17134. if ( this.labelContainer.length ) {
  17135. this.labelContainer.append( place );
  17136. } else if ( this.settings.errorPlacement ) {
  17137. this.settings.errorPlacement( place, $( element ) );
  17138. } else {
  17139. place.insertAfter( element );
  17140. }
  17141. // Link error back to the element
  17142. if ( error.is( "label" ) ) {
  17143. // If the error is a label, then associate using 'for'
  17144. error.attr( "for", elementID );
  17145. } else if ( error.parents( "label[for='" + elementID + "']" ).length === 0 ) {
  17146. // If the element is not a child of an associated label, then it's necessary
  17147. // to explicitly apply aria-describedby
  17148. errorID = error.attr( "id" ).replace( /(:|\.|\[|\])/g, "\\$1");
  17149. // Respect existing non-error aria-describedby
  17150. if ( !describedBy ) {
  17151. describedBy = errorID;
  17152. } else if ( !describedBy.match( new RegExp( "\\b" + errorID + "\\b" ) ) ) {
  17153. // Add to end of list if not already present
  17154. describedBy += " " + errorID;
  17155. }
  17156. $( element ).attr( "aria-describedby", describedBy );
  17157. // If this element is grouped, then assign to all elements in the same group
  17158. group = this.groups[ element.name ];
  17159. if ( group ) {
  17160. $.each( this.groups, function( name, testgroup ) {
  17161. if ( testgroup === group ) {
  17162. $( "[name='" + name + "']", this.currentForm )
  17163. .attr( "aria-describedby", error.attr( "id" ) );
  17164. }
  17165. });
  17166. }
  17167. }
  17168. }
  17169. if ( !message && this.settings.success ) {
  17170. error.text( "" );
  17171. if ( typeof this.settings.success === "string" ) {
  17172. error.addClass( this.settings.success );
  17173. } else {
  17174. this.settings.success( error, element );
  17175. }
  17176. }
  17177. this.toShow = this.toShow.add( error );
  17178. },
  17179. errorsFor: function( element ) {
  17180. var name = this.idOrName( element ),
  17181. describer = $( element ).attr( "aria-describedby" ),
  17182. selector = "label[for='" + name + "'], label[for='" + name + "'] *";
  17183. // aria-describedby should directly reference the error element
  17184. if ( describer ) {
  17185. selector = selector + ", #" + describer.replace( /\s+/g, ", #" );
  17186. }
  17187. return this
  17188. .errors()
  17189. .filter( selector );
  17190. },
  17191. idOrName: function( element ) {
  17192. return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
  17193. },
  17194. validationTargetFor: function( element ) {
  17195. // If radio/checkbox, validate first element in group instead
  17196. if ( this.checkable( element ) ) {
  17197. element = this.findByName( element.name );
  17198. }
  17199. // Always apply ignore filter
  17200. return $( element ).not( this.settings.ignore )[ 0 ];
  17201. },
  17202. checkable: function( element ) {
  17203. return ( /radio|checkbox/i ).test( element.type );
  17204. },
  17205. findByName: function( name ) {
  17206. return $( this.currentForm ).find( "[name='" + name + "']" );
  17207. },
  17208. getLength: function( value, element ) {
  17209. switch ( element.nodeName.toLowerCase() ) {
  17210. case "select":
  17211. return $( "option:selected", element ).length;
  17212. case "input":
  17213. if ( this.checkable( element ) ) {
  17214. return this.findByName( element.name ).filter( ":checked" ).length;
  17215. }
  17216. }
  17217. return value.length;
  17218. },
  17219. depend: function( param, element ) {
  17220. return this.dependTypes[typeof param] ? this.dependTypes[typeof param]( param, element ) : true;
  17221. },
  17222. dependTypes: {
  17223. "boolean": function( param ) {
  17224. return param;
  17225. },
  17226. "string": function( param, element ) {
  17227. return !!$( param, element.form ).length;
  17228. },
  17229. "function": function( param, element ) {
  17230. return param( element );
  17231. }
  17232. },
  17233. optional: function( element ) {
  17234. var val = this.elementValue( element );
  17235. return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
  17236. },
  17237. startRequest: function( element ) {
  17238. if ( !this.pending[ element.name ] ) {
  17239. this.pendingRequest++;
  17240. this.pending[ element.name ] = true;
  17241. }
  17242. },
  17243. stopRequest: function( element, valid ) {
  17244. this.pendingRequest--;
  17245. // sometimes synchronization fails, make sure pendingRequest is never < 0
  17246. if ( this.pendingRequest < 0 ) {
  17247. this.pendingRequest = 0;
  17248. }
  17249. delete this.pending[ element.name ];
  17250. if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
  17251. $( this.currentForm ).submit();
  17252. this.formSubmitted = false;
  17253. } else if (!valid && this.pendingRequest === 0 && this.formSubmitted ) {
  17254. $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
  17255. this.formSubmitted = false;
  17256. }
  17257. },
  17258. previousValue: function( element ) {
  17259. return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
  17260. old: null,
  17261. valid: true,
  17262. message: this.defaultMessage( element, "remote" )
  17263. });
  17264. }
  17265. },
  17266. classRuleSettings: {
  17267. required: { required: true },
  17268. email: { email: true },
  17269. url: { url: true },
  17270. date: { date: true },
  17271. dateISO: { dateISO: true },
  17272. number: { number: true },
  17273. digits: { digits: true },
  17274. creditcard: { creditcard: true }
  17275. },
  17276. addClassRules: function( className, rules ) {
  17277. if ( className.constructor === String ) {
  17278. this.classRuleSettings[ className ] = rules;
  17279. } else {
  17280. $.extend( this.classRuleSettings, className );
  17281. }
  17282. },
  17283. classRules: function( element ) {
  17284. var rules = {},
  17285. classes = $( element ).attr( "class" );
  17286. if ( classes ) {
  17287. $.each( classes.split( " " ), function() {
  17288. if ( this in $.validator.classRuleSettings ) {
  17289. $.extend( rules, $.validator.classRuleSettings[ this ]);
  17290. }
  17291. });
  17292. }
  17293. return rules;
  17294. },
  17295. attributeRules: function( element ) {
  17296. var rules = {},
  17297. $element = $( element ),
  17298. type = element.getAttribute( "type" ),
  17299. method, value;
  17300. for ( method in $.validator.methods ) {
  17301. // support for <input required> in both html5 and older browsers
  17302. if ( method === "required" ) {
  17303. value = element.getAttribute( method );
  17304. // Some browsers return an empty string for the required attribute
  17305. // and non-HTML5 browsers might have required="" markup
  17306. if ( value === "" ) {
  17307. value = true;
  17308. }
  17309. // force non-HTML5 browsers to return bool
  17310. value = !!value;
  17311. } else {
  17312. value = $element.attr( method );
  17313. }
  17314. // convert the value to a number for number inputs, and for text for backwards compability
  17315. // allows type="date" and others to be compared as strings
  17316. if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
  17317. value = Number( value );
  17318. }
  17319. if ( value || value === 0 ) {
  17320. rules[ method ] = value;
  17321. } else if ( type === method && type !== "range" ) {
  17322. // exception: the jquery validate 'range' method
  17323. // does not test for the html5 'range' type
  17324. rules[ method ] = true;
  17325. }
  17326. }
  17327. // maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
  17328. if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
  17329. delete rules.maxlength;
  17330. }
  17331. return rules;
  17332. },
  17333. dataRules: function( element ) {
  17334. var method, value,
  17335. rules = {}, $element = $( element );
  17336. for ( method in $.validator.methods ) {
  17337. value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
  17338. if ( value !== undefined ) {
  17339. rules[ method ] = value;
  17340. }
  17341. }
  17342. return rules;
  17343. },
  17344. staticRules: function( element ) {
  17345. var rules = {},
  17346. validator = $.data( element.form, "validator" );
  17347. if ( validator.settings.rules ) {
  17348. rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
  17349. }
  17350. return rules;
  17351. },
  17352. normalizeRules: function( rules, element ) {
  17353. // handle dependency check
  17354. $.each( rules, function( prop, val ) {
  17355. // ignore rule when param is explicitly false, eg. required:false
  17356. if ( val === false ) {
  17357. delete rules[ prop ];
  17358. return;
  17359. }
  17360. if ( val.param || val.depends ) {
  17361. var keepRule = true;
  17362. switch ( typeof val.depends ) {
  17363. case "string":
  17364. keepRule = !!$( val.depends, element.form ).length;
  17365. break;
  17366. case "function":
  17367. keepRule = val.depends.call( element, element );
  17368. break;
  17369. }
  17370. if ( keepRule ) {
  17371. rules[ prop ] = val.param !== undefined ? val.param : true;
  17372. } else {
  17373. delete rules[ prop ];
  17374. }
  17375. }
  17376. });
  17377. // evaluate parameters
  17378. $.each( rules, function( rule, parameter ) {
  17379. rules[ rule ] = $.isFunction( parameter ) ? parameter( element ) : parameter;
  17380. });
  17381. // clean number parameters
  17382. $.each([ "minlength", "maxlength" ], function() {
  17383. if ( rules[ this ] ) {
  17384. rules[ this ] = Number( rules[ this ] );
  17385. }
  17386. });
  17387. $.each([ "rangelength", "range" ], function() {
  17388. var parts;
  17389. if ( rules[ this ] ) {
  17390. if ( $.isArray( rules[ this ] ) ) {
  17391. rules[ this ] = [ Number( rules[ this ][ 0 ]), Number( rules[ this ][ 1 ] ) ];
  17392. } else if ( typeof rules[ this ] === "string" ) {
  17393. parts = rules[ this ].replace(/[\[\]]/g, "" ).split( /[\s,]+/ );
  17394. rules[ this ] = [ Number( parts[ 0 ]), Number( parts[ 1 ] ) ];
  17395. }
  17396. }
  17397. });
  17398. if ( $.validator.autoCreateRanges ) {
  17399. // auto-create ranges
  17400. if ( rules.min != null && rules.max != null ) {
  17401. rules.range = [ rules.min, rules.max ];
  17402. delete rules.min;
  17403. delete rules.max;
  17404. }
  17405. if ( rules.minlength != null && rules.maxlength != null ) {
  17406. rules.rangelength = [ rules.minlength, rules.maxlength ];
  17407. delete rules.minlength;
  17408. delete rules.maxlength;
  17409. }
  17410. }
  17411. return rules;
  17412. },
  17413. // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
  17414. normalizeRule: function( data ) {
  17415. if ( typeof data === "string" ) {
  17416. var transformed = {};
  17417. $.each( data.split( /\s/ ), function() {
  17418. transformed[ this ] = true;
  17419. });
  17420. data = transformed;
  17421. }
  17422. return data;
  17423. },
  17424. // http://jqueryvalidation.org/jQuery.validator.addMethod/
  17425. addMethod: function( name, method, message ) {
  17426. $.validator.methods[ name ] = method;
  17427. $.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
  17428. if ( method.length < 3 ) {
  17429. $.validator.addClassRules( name, $.validator.normalizeRule( name ) );
  17430. }
  17431. },
  17432. methods: {
  17433. // http://jqueryvalidation.org/required-method/
  17434. required: function( value, element, param ) {
  17435. // check if dependency is met
  17436. if ( !this.depend( param, element ) ) {
  17437. return "dependency-mismatch";
  17438. }
  17439. if ( element.nodeName.toLowerCase() === "select" ) {
  17440. // could be an array for select-multiple or a string, both are fine this way
  17441. var val = $( element ).val();
  17442. return val && val.length > 0;
  17443. }
  17444. if ( this.checkable( element ) ) {
  17445. return this.getLength( value, element ) > 0;
  17446. }
  17447. return $.trim( value ).length > 0;
  17448. },
  17449. // http://jqueryvalidation.org/email-method/
  17450. email: function( value, element ) {
  17451. // From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
  17452. // Retrieved 2014-01-14
  17453. // If you have a problem with this implementation, report a bug against the above spec
  17454. // Or use custom methods to implement your own email validation
  17455. 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 );
  17456. },
  17457. // http://jqueryvalidation.org/url-method/
  17458. url: function( value, element ) {
  17459. // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
  17460. 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 );
  17461. },
  17462. // http://jqueryvalidation.org/date-method/
  17463. date: function( value, element ) {
  17464. return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
  17465. },
  17466. // http://jqueryvalidation.org/dateISO-method/
  17467. dateISO: function( value, element ) {
  17468. return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
  17469. },
  17470. // http://jqueryvalidation.org/number-method/
  17471. number: function( value, element ) {
  17472. return this.optional( element ) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
  17473. },
  17474. // http://jqueryvalidation.org/digits-method/
  17475. digits: function( value, element ) {
  17476. return this.optional( element ) || /^\d+$/.test( value );
  17477. },
  17478. // http://jqueryvalidation.org/creditcard-method/
  17479. // based on http://en.wikipedia.org/wiki/Luhn/
  17480. creditcard: function( value, element ) {
  17481. if ( this.optional( element ) ) {
  17482. return "dependency-mismatch";
  17483. }
  17484. // accept only spaces, digits and dashes
  17485. if ( /[^0-9 \-]+/.test( value ) ) {
  17486. return false;
  17487. }
  17488. var nCheck = 0,
  17489. nDigit = 0,
  17490. bEven = false,
  17491. n, cDigit;
  17492. value = value.replace( /\D/g, "" );
  17493. // Basing min and max length on
  17494. // http://developer.ean.com/general_info/Valid_Credit_Card_Types
  17495. if ( value.length < 13 || value.length > 19 ) {
  17496. return false;
  17497. }
  17498. for ( n = value.length - 1; n >= 0; n--) {
  17499. cDigit = value.charAt( n );
  17500. nDigit = parseInt( cDigit, 10 );
  17501. if ( bEven ) {
  17502. if ( ( nDigit *= 2 ) > 9 ) {
  17503. nDigit -= 9;
  17504. }
  17505. }
  17506. nCheck += nDigit;
  17507. bEven = !bEven;
  17508. }
  17509. return ( nCheck % 10 ) === 0;
  17510. },
  17511. // http://jqueryvalidation.org/minlength-method/
  17512. minlength: function( value, element, param ) {
  17513. var length = $.isArray( value ) ? value.length : this.getLength( value, element );
  17514. return this.optional( element ) || length >= param;
  17515. },
  17516. // http://jqueryvalidation.org/maxlength-method/
  17517. maxlength: function( value, element, param ) {
  17518. var length = $.isArray( value ) ? value.length : this.getLength( value, element );
  17519. return this.optional( element ) || length <= param;
  17520. },
  17521. // http://jqueryvalidation.org/rangelength-method/
  17522. rangelength: function( value, element, param ) {
  17523. var length = $.isArray( value ) ? value.length : this.getLength( value, element );
  17524. return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
  17525. },
  17526. // http://jqueryvalidation.org/min-method/
  17527. min: function( value, element, param ) {
  17528. return this.optional( element ) || value >= param;
  17529. },
  17530. // http://jqueryvalidation.org/max-method/
  17531. max: function( value, element, param ) {
  17532. return this.optional( element ) || value <= param;
  17533. },
  17534. // http://jqueryvalidation.org/range-method/
  17535. range: function( value, element, param ) {
  17536. return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
  17537. },
  17538. // http://jqueryvalidation.org/equalTo-method/
  17539. equalTo: function( value, element, param ) {
  17540. // bind to the blur event of the target in order to revalidate whenever the target field is updated
  17541. // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
  17542. var target = $( param );
  17543. if ( this.settings.onfocusout ) {
  17544. target.unbind( ".validate-equalTo" ).bind( "blur.validate-equalTo", function() {
  17545. $( element ).valid();
  17546. });
  17547. }
  17548. return value === target.val();
  17549. },
  17550. // http://jqueryvalidation.org/remote-method/
  17551. remote: function( value, element, param ) {
  17552. if ( this.optional( element ) ) {
  17553. return "dependency-mismatch";
  17554. }
  17555. var previous = this.previousValue( element ),
  17556. validator, data;
  17557. if (!this.settings.messages[ element.name ] ) {
  17558. this.settings.messages[ element.name ] = {};
  17559. }
  17560. previous.originalMessage = this.settings.messages[ element.name ].remote;
  17561. this.settings.messages[ element.name ].remote = previous.message;
  17562. param = typeof param === "string" && { url: param } || param;
  17563. if ( previous.old === value ) {
  17564. return previous.valid;
  17565. }
  17566. previous.old = value;
  17567. validator = this;
  17568. this.startRequest( element );
  17569. data = {};
  17570. data[ element.name ] = value;
  17571. $.ajax( $.extend( true, {
  17572. url: param,
  17573. mode: "abort",
  17574. port: "validate" + element.name,
  17575. dataType: "json",
  17576. data: data,
  17577. context: validator.currentForm,
  17578. success: function( response ) {
  17579. var valid = response === true || response === "true",
  17580. errors, message, submitted;
  17581. validator.settings.messages[ element.name ].remote = previous.originalMessage;
  17582. if ( valid ) {
  17583. submitted = validator.formSubmitted;
  17584. validator.prepareElement( element );
  17585. validator.formSubmitted = submitted;
  17586. validator.successList.push( element );
  17587. delete validator.invalid[ element.name ];
  17588. validator.showErrors();
  17589. } else {
  17590. errors = {};
  17591. message = response || validator.defaultMessage( element, "remote" );
  17592. errors[ element.name ] = previous.message = $.isFunction( message ) ? message( value ) : message;
  17593. validator.invalid[ element.name ] = true;
  17594. validator.showErrors( errors );
  17595. }
  17596. previous.valid = valid;
  17597. validator.stopRequest( element, valid );
  17598. }
  17599. }, param ) );
  17600. return "pending";
  17601. }
  17602. }
  17603. });
  17604. $.format = function deprecated() {
  17605. throw "$.format has been deprecated. Please use $.validator.format instead.";
  17606. };
  17607. // ajax mode: abort
  17608. // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
  17609. // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
  17610. var pendingRequests = {},
  17611. ajax;
  17612. // Use a prefilter if available (1.5+)
  17613. if ( $.ajaxPrefilter ) {
  17614. $.ajaxPrefilter(function( settings, _, xhr ) {
  17615. var port = settings.port;
  17616. if ( settings.mode === "abort" ) {
  17617. if ( pendingRequests[port] ) {
  17618. pendingRequests[port].abort();
  17619. }
  17620. pendingRequests[port] = xhr;
  17621. }
  17622. });
  17623. } else {
  17624. // Proxy ajax
  17625. ajax = $.ajax;
  17626. $.ajax = function( settings ) {
  17627. var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
  17628. port = ( "port" in settings ? settings : $.ajaxSettings ).port;
  17629. if ( mode === "abort" ) {
  17630. if ( pendingRequests[port] ) {
  17631. pendingRequests[port].abort();
  17632. }
  17633. pendingRequests[port] = ajax.apply(this, arguments);
  17634. return pendingRequests[port];
  17635. }
  17636. return ajax.apply(this, arguments);
  17637. };
  17638. }
  17639. // provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
  17640. // handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
  17641. $.extend($.fn, {
  17642. validateDelegate: function( delegate, type, handler ) {
  17643. return this.bind(type, function( event ) {
  17644. var target = $(event.target);
  17645. if ( target.is(delegate) ) {
  17646. return handler.apply(target, arguments);
  17647. }
  17648. });
  17649. }
  17650. });
  17651. }));
  17652. // ========================== ALL SCRIPTS TOC =============================== //
  17653. // ========== https://github.com/tuupola/jquery_lazyload ==================== //
  17654. // ====== https://github.com/ixisio/bootstrap-touch-carousel ================ //
  17655. // ============ https://github.com/Formstone/Wallpaper ====================== //
  17656. // ========== https://github.com/ccampbell/rainbow ========================== //
  17657. // ============ https://github.com/morr/jquery.appear ======================= //
  17658. // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
  17659. // ============ https://github.com/mattboldt/typed.js/ ====================== //
  17660. // ============ https://github.com/balupton/jquery-scrollto ================= //
  17661. // ==============https://github.com/matthieua/WOW =========================== //
  17662. // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
  17663. // ============ https://github.com/carhartl/jquery-cookie =================== //
  17664. // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
  17665. // ============= https://github.com/kirbysayshi/ghembedder ================= //
  17666. // ============== https://github.com/js-cookie/js-cookie ==================== //
  17667. // --------------------- Lazy Load 1.9.7 ---------------------------------- //
  17668. // ========== https://github.com/tuupola/jquery_lazyload =================== //
  17669. // ------------------------------------------------------------------------- //
  17670. !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);
  17671. // ------------- Touch Carousel Hammer.js ---------------------------------- //
  17672. // ====== https://github.com/ixisio/bootstrap-touch-carousel =============== //
  17673. // ------------------------------------------------------------------------- //
  17674. +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)}();
  17675. // ------------- JQUERY Wallpaper------------------------------------------- //
  17676. // ============ https://github.com/Formstone/Wallpaper ===================== //
  17677. // ------------------------------------------------------------------------- //
  17678. !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);
  17679. // ------------- Rainbow Syntax Highligher ---------------------------------- //
  17680. // ========== https://github.com/ccampbell/rainbow ========================== //
  17681. // -------------------------------------------------------------------------- //
  17682. /* 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 */
  17683. 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>=
  17684. 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=
  17685. 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)&&
  17686. 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,
  17687. "&lt;").replace(/>/g,"&gt;").replace(/&(?![\w\#]+;)/g,"&amp;"),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"),
  17688. 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)}}}();
  17689. (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},
  17690. {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:/&gt;|&lt;/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},
  17691. {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}],
  17692. !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},
  17693. {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}|~|!|\*|\/|%|(?:&lt;){1,2}|(?:&gt;){1,3}|instanceof|(?:&amp;){1,2}|\^|\|{1,2}|\?|:|(?:=|!|\+|-|\*|\/|%|\^|\||(?:&lt;){1,2}|(?:&gt;){1,3})?=)/g}],
  17694. !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},
  17695. {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",
  17696. 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:/(\/|\/=|&amp;=|&amp;&amp;|&amp;|\|=|\|\|\||\-=|\-\-|\-|\+=|\+\+|\+|&lt;=|&lt;&lt;|&lt;|&lt;&lt;=|&lt;&gt;=|&lt;&gt;|&gt;|&gt;&gt;&gt;=|&gt;&gt;=|&gt;=|&gt;&gt;|&gt;&gt;&gt;|!=|!&lt;&gt;=|!&lt;&gt;|!&lt;=|!&lt;|!&gt;=|!&gt;|!|[|]|\$|==|=|\*=|\*|%=|%|\^\^=|\^=|\^\^|\^|~=|~|@|=&gt;|\:)/gm}],
  17697. !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},
  17698. {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},
  17699. {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},
  17700. 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:/\=|<\-|&lt;-/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:/&lt;-|<-|-|==|&lt;=|<=|&gt;>|>=|<|>|&amp;&amp;|&&|&amp;|&|!=|\|\|?|\*|\+|\^|\/|%%|%\/%|\=|%in%|%\*%|%o%|%x%|\$|:|~|\[{1,2}|\]{1,2}/g},
  17701. {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:/&lt;\?=?(?!xml)(php)?([\s\S]*?)(\?&gt;)/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:/(&lt;\/?)(style.*?)(&gt;)/g},2:{language:"css"},3:"support.tag.style",4:"entity.tag.style",5:"support.tag.style"},pattern:/(&lt;style.*?&gt;)([\s\S]*?)(&lt;\/)(style)(&gt;)/gm},
  17702. {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:/(&lt;\/?)(script.*?)(&gt;)/g},2:{language:"javascript"},3:"support.tag.script",4:"entity.tag.script",5:"support.tag.script"},pattern:/(&lt;script(?! src).*?&gt;)([\s\S]*?)(&lt;\/)(script)(&gt;)/gm},{name:"comment.html",pattern:/&lt;\!--[\S\s]*?--&gt;/g},
  17703. {matches:{1:"support.tag.open",2:"support.tag.close"},pattern:/(&lt;)|(\/?\??&gt;)/g},{name:"support.tag",matches:{1:"support.tag",2:"support.tag.special",3:"support.tag-name"},pattern:/(&lt;\??)(\/|\!?)(\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"},
  17704. pattern:/\s(\w+)(?=\s|&gt;)(?![\s\S]*&lt;)/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},
  17705. {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},
  17706. {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",
  17707. 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,}\((.*?)((-|=)&gt;)/gi},{matches:{1:{name:"function.argument.coffee",pattern:/([\@\w]+)/g},2:"keyword.function"},pattern:/\s\((.*?)\)\s{0,}((-|=)&gt;)/gi},{matches:{1:"entity.name.function",2:"keyword.operator",3:"keyword.function"},pattern:/(\w+)\s{0,}(=|:)\s{0,}((-|=)&gt;)/gi},{matches:{1:"storage.class",
  17708. 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},
  17709. {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},
  17710. {name:"entity.name.binary",pattern:/(&lt;|&gt;|&amp;|[=~\|\\\/!@*\-_+])+/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},
  17711. {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",
  17712. 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:/(\+\+|\+=|\+|--|-=|-|&lt;&lt;=|&lt;&lt;|&lt;=|=&gt;|&gt;&gt;=|&gt;&gt;|&gt;=|!=|!|~|\^|\|\||&amp;&amp;|&amp;=|&amp;|\?\?|::|:|\*=|\*|\/=|%=|\|=|==|=)/g},{name:"preprocessor",pattern:/(\#if|\#else|\#elif|\#endif|\#define|\#undef|\#warning|\#error|\#line|\#region|\#endregion|\#pragma)[\s\S]*?$/gm}],
  17713. !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},
  17714. {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:/&lt;|&gt;|&amp;/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}],
  17715. !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"},
  17716. 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:/(&lt;\?(php)?|\?&gt;)/g},{matches:{1:"keyword.namespace",2:{name:"support.namespace",
  17717. 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},
  17718. {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](?=(\(|\[|\{|&lt;|.)(.*?)(?:'|\)|\]|\}|&gt;|\1))(?:\(\2\)|\[\2\]|\{\2\}|\&lt;\2&gt;|\1\2\1)/g},
  17719. {matches:{1:"string",2:"string",3:"string"},pattern:/(&lt;&lt;)(\w+).*?$([\s\S]*?^\2)/gm},{matches:{1:"string",2:"string",3:"string"},pattern:/(&lt;&lt;\-)(\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(?=(\(|\[|\{|&lt;|.)(.*?)('|\)|\]|\}|&gt;|\1))(?:\(\2\)|\[\2\]|\{\2\}|\&lt;\2&gt;|\1\2\1)([a-z]*)/g},
  17720. {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+&lt;\s+((?:(?:::)?[A-Z]\w*)+))?/g},
  17721. {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},
  17722. {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|=|&lt;&lt;|&lt;&lt;=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|&lt;&lt;|&lt;=&gt;|&lt;(?!&lt;|=)|&gt;(?!&lt;|=|&gt;)|&lt;=|&gt;=|===|==|=~|!=|!~|%|&amp;|\*\*|\*|\+|\-|\/|\||~|&gt;&gt;/g},
  17723. {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:/&amp;/g},{name:"direct-descendant",pattern:/&gt;/g},{name:"entity.name.class",
  17724. 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);
  17725. // ------------- JQUERY APPEAR ---------------------------------------------- //
  17726. // ============ https://github.com/morr/jquery.appear ====================== //
  17727. // -------------------------------------------------------------------------- //
  17728. (function($) {
  17729. var selectors = [];
  17730. var check_binded = false;
  17731. var check_lock = false;
  17732. var defaults = {
  17733. interval: 250,
  17734. force_process: false
  17735. }
  17736. var $window = $(window);
  17737. var $prior_appeared;
  17738. function process() {
  17739. check_lock = false;
  17740. for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
  17741. var $appeared = $(selectors[index]).filter(function() {
  17742. return $(this).is(':appeared');
  17743. });
  17744. $appeared.trigger('appear', [$appeared]);
  17745. if ($prior_appeared) {
  17746. var $disappeared = $prior_appeared.not($appeared);
  17747. $disappeared.trigger('disappear', [$disappeared]);
  17748. }
  17749. $prior_appeared = $appeared;
  17750. }
  17751. }
  17752. // "appeared" custom filter
  17753. $.expr[':']['appeared'] = function(element) {
  17754. var $element = $(element);
  17755. if (!$element.is(':visible')) {
  17756. return false;
  17757. }
  17758. var window_left = $window.scrollLeft();
  17759. var window_top = $window.scrollTop();
  17760. var offset = $element.offset();
  17761. var left = offset.left;
  17762. var top = offset.top;
  17763. if (top + $element.height() >= window_top &&
  17764. top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
  17765. left + $element.width() >= window_left &&
  17766. left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
  17767. return true;
  17768. } else {
  17769. return false;
  17770. }
  17771. }
  17772. $.fn.extend({
  17773. // watching for element's appearance in browser viewport
  17774. appear: function(options) {
  17775. var opts = $.extend({}, defaults, options || {});
  17776. var selector = this.selector || this;
  17777. if (!check_binded) {
  17778. var on_check = function() {
  17779. if (check_lock) {
  17780. return;
  17781. }
  17782. check_lock = true;
  17783. setTimeout(process, opts.interval);
  17784. };
  17785. $(window).scroll(on_check).resize(on_check);
  17786. check_binded = true;
  17787. }
  17788. if (opts.force_process) {
  17789. setTimeout(process, opts.interval);
  17790. }
  17791. selectors.push(selector);
  17792. return $(selector);
  17793. }
  17794. });
  17795. $.extend({
  17796. // force elements's appearance check
  17797. force_appear: function() {
  17798. if (check_binded) {
  17799. process();
  17800. return true;
  17801. };
  17802. return false;
  17803. }
  17804. });
  17805. })(jQuery);
  17806. // ------------- DRAW FILL SVG ---------------------------------------------- //
  17807. // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
  17808. // -------------------------------------------------------------------------- //
  17809. (function( window ){
  17810. 'use strict';
  17811. /**
  17812. * Cross browser transition end events
  17813. *
  17814. * Use modernizr to detect cross browser transition end events. Make sure
  17815. * to include Modernizr in your doc and have "Modernizr.prefixed()" checked
  17816. * off in the extensibility section.
  17817. */
  17818. var transEndEventNames = {
  17819. "WebkitTransition" : "webkitTransitionEnd",
  17820. "MozTransition" : "transitionend",
  17821. "OTransition" : "oTransitionEnd",
  17822. "msTransition" : "MSTransitionEnd",
  17823. "transition" : "transitionend"
  17824. },
  17825. transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
  17826. /**
  17827. * Extend obj function
  17828. *
  17829. */
  17830. function extend( a, b ) {
  17831. for( var key in b ) {
  17832. if( b.hasOwnProperty( key ) ) {
  17833. a[key] = b[key];
  17834. }
  17835. }
  17836. return a;
  17837. }
  17838. /**
  17839. * DrawFillSVG constructor
  17840. *
  17841. */
  17842. function DrawFillSVG( options ) {
  17843. this.options = extend( {}, this.options );
  17844. extend( this.options, options );
  17845. this._init();
  17846. }
  17847. /**
  17848. * DrawFillSVG options
  17849. *
  17850. * Available options:
  17851. * elementId - the ID of the element to draw
  17852. */
  17853. DrawFillSVG.prototype.options = {
  17854. elementId : "svg"
  17855. }
  17856. /**
  17857. * DrawFillSVG _init
  17858. *
  17859. * Initialise DrawFillSVG
  17860. */
  17861. DrawFillSVG.prototype._init = function() {
  17862. this.svg = document.getElementById(this.options.elementId);
  17863. this.paths = this.svg.querySelectorAll("path");
  17864. this._initAnimation();
  17865. }
  17866. /**
  17867. * DrawFillSVG _initAnimation()
  17868. *
  17869. * Reset some style properties on our paths, add some transitions, set the
  17870. * stroke-dasharray to the length of the path, and the stroke-dashoffset to
  17871. * the length of the path pushing it out of view initially. Then, set the
  17872. * stroke-dashoffset to 0, animating the strokes in a drawing manner. Then,
  17873. * run the path filler sequence.
  17874. */
  17875. DrawFillSVG.prototype._initAnimation = function() {
  17876. for ( var i = 0; i < this.paths.length; i++ ) {
  17877. var path = this.paths[i];
  17878. var length = path.getTotalLength();
  17879. // reset opacities
  17880. path.style.fillOpacity = 0;
  17881. path.style.strokeOpacity = 1;
  17882. // reset transitions
  17883. path.style.transition = path.style.WebkitTransition = "none";
  17884. // reset stroke dash array and stroke dash offset
  17885. path.style.strokeDasharray = length + " " + length;
  17886. path.style.strokeDashoffset = length;
  17887. path.getBoundingClientRect();
  17888. // apply new transitions
  17889. path.style.transition = path.style.WebkitTransition = "stroke-dashoffset 2s ease-in-out";
  17890. // go baby go
  17891. path.style.strokeDashoffset = 0;
  17892. // fill the path
  17893. this._fillPath( path );
  17894. }
  17895. }
  17896. /**
  17897. * DrawFillSVG _fillPath()
  17898. *
  17899. * Resets the transition props, then fills the path and fades out the stroke
  17900. * by updating the styles.
  17901. */
  17902. DrawFillSVG.prototype._fillPath = function( path ) {
  17903. path.addEventListener( transEndEventName, function() {
  17904. // reset transitions
  17905. path.style.transition = path.style.WebkitTransition = "none";
  17906. path.style.transition = path.style.WebkitTransition = "fill-opacity 1s ease-in-out, stroke-opacity 1s ease-in-out";
  17907. // edit props
  17908. path.style.fillOpacity = 1;
  17909. path.style.strokeOpacity = 0;
  17910. } );
  17911. }
  17912. /**
  17913. * DrawFillSVG replay
  17914. *
  17915. * A public function that allows you to replay the animation if you want. For
  17916. * example, click a button, and replay the animation.
  17917. */
  17918. DrawFillSVG.prototype.replay = function() {
  17919. this._initAnimation();
  17920. }
  17921. /**
  17922. * Add to global namespace
  17923. */
  17924. window.DrawFillSVG = DrawFillSVG;
  17925. })( window );
  17926. // ------------- JQUERY TYPED.JS -------------------------------------------- //
  17927. // ============ https://github.com/mattboldt/typed.js/ ====================== //
  17928. // -------------------------------------------------------------------------- //
  17929. !function($){
  17930. "use strict";
  17931. var Typed = function(el, options){
  17932. // chosen element to manipulate text
  17933. this.el = $(el);
  17934. // options
  17935. this.options = $.extend({}, $.fn.typed.defaults, options);
  17936. // text content of element
  17937. this.baseText = this.el.text() || this.el.attr('placeholder') || '';
  17938. // typing speed
  17939. this.typeSpeed = this.options.typeSpeed;
  17940. // add a delay before typing starts
  17941. this.startDelay = this.options.startDelay;
  17942. // backspacing speed
  17943. this.backSpeed = this.options.backSpeed;
  17944. // amount of time to wait before backspacing
  17945. this.backDelay = this.options.backDelay;
  17946. // input strings of text
  17947. this.strings = this.options.strings;
  17948. // character number position of current string
  17949. this.strPos = 0;
  17950. // current array position
  17951. this.arrayPos = 0;
  17952. // number to stop backspacing on.
  17953. // default 0, can change depending on how many chars
  17954. // you want to remove at the time
  17955. this.stopNum = 0;
  17956. // Looping logic
  17957. this.loop = this.options.loop;
  17958. this.loopCount = this.options.loopCount;
  17959. this.curLoop = 0;
  17960. // for stopping
  17961. this.stop = false;
  17962. // show cursor
  17963. this.showCursor = this.isInput ? false : this.options.showCursor;
  17964. // custom cursor
  17965. this.cursorChar = this.options.cursorChar;
  17966. // attribute to type
  17967. this.isInput = this.el.is('input');
  17968. this.attr = this.options.attr || (this.isInput ? 'placeholder' : null);
  17969. // All systems go!
  17970. this.build();
  17971. };
  17972. Typed.prototype = {
  17973. constructor: Typed
  17974. , init: function(){
  17975. // begin the loop w/ first current string (global self.string)
  17976. // current string will be passed as an argument each time after this
  17977. var self = this;
  17978. self.timeout = setTimeout(function() {
  17979. // Start typing
  17980. self.typewrite(self.strings[self.arrayPos], self.strPos);
  17981. }, self.startDelay);
  17982. }
  17983. , build: function(){
  17984. // Insert cursor
  17985. if (this.showCursor === true){
  17986. this.cursor = $("<span class=\"typed-cursor\">" + this.cursorChar + "</span>");
  17987. this.el.after(this.cursor);
  17988. }
  17989. this.init();
  17990. }
  17991. // pass current string state to each function, types 1 char per call
  17992. , typewrite: function(curString, curStrPos){
  17993. // exit when stopped
  17994. if(this.stop === true)
  17995. return;
  17996. // varying values for setTimeout during typing
  17997. // can't be global since number changes each time loop is executed
  17998. var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed;
  17999. var self = this;
  18000. // ------------- optional ------------- //
  18001. // backpaces a certain string faster
  18002. // ------------------------------------ //
  18003. // if (self.arrayPos == 1){
  18004. // self.backDelay = 50;
  18005. // }
  18006. // else{ self.backDelay = 500; }
  18007. // contain typing function in a timeout humanize'd delay
  18008. self.timeout = setTimeout(function() {
  18009. // check for an escape character before a pause value
  18010. // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^
  18011. // single ^ are removed from string
  18012. var charPause = 0;
  18013. var substr = curString.substr(curStrPos);
  18014. if (substr.charAt(0) === '^') {
  18015. var skip = 1; // skip atleast 1
  18016. if(/^\^\d+/.test(substr)) {
  18017. substr = /\d+/.exec(substr)[0];
  18018. skip += substr.length;
  18019. charPause = parseInt(substr);
  18020. }
  18021. // strip out the escape character and pause value so they're not printed
  18022. curString = curString.substring(0,curStrPos)+curString.substring(curStrPos+skip);
  18023. }
  18024. // timeout for any pause after a character
  18025. self.timeout = setTimeout(function() {
  18026. if(curStrPos === curString.length) {
  18027. // fires callback function
  18028. self.options.onStringTyped(self.arrayPos);
  18029. // is this the final string
  18030. if(self.arrayPos === self.strings.length-1) {
  18031. // animation that occurs on the last typed string
  18032. self.options.callback();
  18033. self.curLoop++;
  18034. // quit if we wont loop back
  18035. if(self.loop === false || self.curLoop === self.loopCount)
  18036. return;
  18037. }
  18038. self.timeout = setTimeout(function(){
  18039. self.backspace(curString, curStrPos);
  18040. }, self.backDelay);
  18041. } else {
  18042. /* call before functions if applicable */
  18043. if(curStrPos === 0)
  18044. self.options.preStringTyped(self.arrayPos);
  18045. // start typing each new char into existing string
  18046. // curString: arg, self.baseText: original text inside element
  18047. var nextString = self.baseText + curString.substr(0, curStrPos+1);
  18048. if (self.attr) {
  18049. self.el.attr(self.attr, nextString);
  18050. } else {
  18051. self.el.text(nextString);
  18052. }
  18053. // add characters one by one
  18054. curStrPos++;
  18055. // loop the function
  18056. self.typewrite(curString, curStrPos);
  18057. }
  18058. // end of character pause
  18059. }, charPause);
  18060. // humanized value for typing
  18061. }, humanize);
  18062. }
  18063. , backspace: function(curString, curStrPos){
  18064. // exit when stopped
  18065. if (this.stop === true) {
  18066. return;
  18067. }
  18068. // varying values for setTimeout during typing
  18069. // can't be global since number changes each time loop is executed
  18070. var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed;
  18071. var self = this;
  18072. self.timeout = setTimeout(function() {
  18073. // ----- this part is optional ----- //
  18074. // check string array position
  18075. // on the first string, only delete one word
  18076. // the stopNum actually represents the amount of chars to
  18077. // ------------- CUSTOM OPTIONS --------------------------------------------- //
  18078. // ========================================================================== //
  18079. // -------------------------------------------------------------------------- //
  18080. if (self.arrayPos == 1) {
  18081. self.stopNum = 17;
  18082. self.backDelay = 500;
  18083. }
  18084. else if (self.arrayPos == 2) {
  18085. self.stopNum = 54;
  18086. }
  18087. else{self.stopNum = 0;}
  18088. // ----- continue important stuff ----- //
  18089. // replace text with base text + typed characters
  18090. var nextString = self.baseText + curString.substr(0, curStrPos);
  18091. if (self.attr) {
  18092. self.el.attr(self.attr, nextString);
  18093. } else {
  18094. self.el.text(nextString);
  18095. }
  18096. // if the number (id of character in current string) is
  18097. // less than the stop number, keep going
  18098. if (curStrPos > self.stopNum){
  18099. // subtract characters one by one
  18100. curStrPos--;
  18101. // loop the function
  18102. self.backspace(curString, curStrPos);
  18103. }
  18104. // if the stop number has been reached, increase
  18105. // array position to next string
  18106. else if (curStrPos <= self.stopNum) {
  18107. self.arrayPos++;
  18108. if(self.arrayPos === self.strings.length) {
  18109. self.arrayPos = 0;
  18110. self.init();
  18111. } else
  18112. self.typewrite(self.strings[self.arrayPos], curStrPos);
  18113. }
  18114. // humanized value for typing
  18115. }, humanize);
  18116. }
  18117. // Start & Stop currently not working
  18118. // , stop: function() {
  18119. // var self = this;
  18120. // self.stop = true;
  18121. // clearInterval(self.timeout);
  18122. // }
  18123. // , start: function() {
  18124. // var self = this;
  18125. // if(self.stop === false)
  18126. // return;
  18127. // this.stop = false;
  18128. // this.init();
  18129. // }
  18130. // Reset and rebuild the element
  18131. , reset: function(){
  18132. var self = this;
  18133. clearInterval(self.timeout);
  18134. var id = this.el.attr('id');
  18135. this.el.after('<span id="' + id + '"/>')
  18136. this.el.remove();
  18137. this.cursor.remove();
  18138. // Send the callback
  18139. self.options.resetCallback();
  18140. }
  18141. };
  18142. $.fn.typed = function (option) {
  18143. return this.each(function () {
  18144. var $this = $(this)
  18145. , data = $this.data('typed')
  18146. , options = typeof option == 'object' && option;
  18147. if (!data) $this.data('typed', (data = new Typed(this, options)));
  18148. if (typeof option == 'string') data[option]();
  18149. });
  18150. };
  18151. $.fn.typed.defaults = {
  18152. strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"],
  18153. // typing speed
  18154. typeSpeed: 0,
  18155. // time before typing starts
  18156. startDelay: 0,
  18157. // backspacing speed
  18158. backSpeed: 0,
  18159. // time before backspacing
  18160. backDelay: 500,
  18161. // loop
  18162. loop: false,
  18163. // false = infinite
  18164. loopCount: false,
  18165. // show cursor
  18166. showCursor: true,
  18167. // character for cursor
  18168. cursorChar: "|",
  18169. // attribute to type (null == text)
  18170. attr: null,
  18171. // call when done callback function
  18172. callback: function() {},
  18173. // starting callback function before each string
  18174. preStringTyped: function() {},
  18175. //callback for every typed string
  18176. onStringTyped: function() {},
  18177. // callback for reset
  18178. resetCallback: function() {}
  18179. };
  18180. }(window.jQuery);
  18181. // ------------- JQUERY SCROLLTO--------------------------------------------- //
  18182. // ============ https://github.com/balupton/jquery-scrollto ================= //
  18183. // -------------------------------------------------------------------------- //
  18184. /*global define:false require:false */
  18185. (function (name, context, definition) {
  18186. if (typeof module != 'undefined' && module.exports) module.exports = definition();
  18187. else if (typeof define == 'function' && define.amd) define(definition);
  18188. else context[name] = definition();
  18189. })('jquery-scrollto', this, function(){
  18190. // Prepare
  18191. var jQuery, $, ScrollTo;
  18192. jQuery = $ = window.jQuery || require('jquery');
  18193. // Fix scrolling animations on html/body on safari
  18194. $.propHooks.scrollTop = $.propHooks.scrollLeft = {
  18195. get: function(elem,prop) {
  18196. var result = null;
  18197. if ( elem.tagName === 'HTML' || elem.tagName === 'BODY' ) {
  18198. if ( prop === 'scrollLeft' ) {
  18199. result = window.scrollX;
  18200. } else if ( prop === 'scrollTop' ) {
  18201. result = window.scrollY;
  18202. }
  18203. }
  18204. if ( result == null ) {
  18205. result = elem[prop];
  18206. }
  18207. return result;
  18208. }
  18209. };
  18210. $.Tween.propHooks.scrollTop = $.Tween.propHooks.scrollLeft = {
  18211. get: function(tween) {
  18212. return $.propHooks.scrollTop.get(tween.elem, tween.prop);
  18213. },
  18214. set: function(tween) {
  18215. // Our safari fix
  18216. if ( tween.elem.tagName === 'HTML' || tween.elem.tagName === 'BODY' ) {
  18217. // Defaults
  18218. tween.options.bodyScrollLeft = (tween.options.bodyScrollLeft || window.scrollX);
  18219. tween.options.bodyScrollTop = (tween.options.bodyScrollTop || window.scrollY);
  18220. // Apply
  18221. if ( tween.prop === 'scrollLeft' ) {
  18222. tween.options.bodyScrollLeft = Math.round(tween.now);
  18223. }
  18224. else if ( tween.prop === 'scrollTop' ) {
  18225. tween.options.bodyScrollTop = Math.round(tween.now);
  18226. }
  18227. // Apply
  18228. window.scrollTo(tween.options.bodyScrollLeft, tween.options.bodyScrollTop);
  18229. }
  18230. // jQuery's IE8 Fix
  18231. else if ( tween.elem.nodeType && tween.elem.parentNode ) {
  18232. tween.elem[ tween.prop ] = tween.now;
  18233. }
  18234. }
  18235. };
  18236. // jQuery ScrollTo
  18237. ScrollTo = {
  18238. // Configuration
  18239. config: {
  18240. duration: 400,
  18241. easing: 'swing',
  18242. callback: undefined,
  18243. durationMode: 'each',
  18244. offsetTop: 0,
  18245. offsetLeft: 0
  18246. },
  18247. // Set Configuration
  18248. configure: function(options){
  18249. // Apply Options to Config
  18250. $.extend(ScrollTo.config, options||{});
  18251. // Chain
  18252. return this;
  18253. },
  18254. // Perform the Scroll Animation for the Collections
  18255. // We use $inline here, so we can determine the actual offset start for each overflow:scroll item
  18256. // Each collection is for each overflow:scroll item
  18257. scroll: function(collections, config){
  18258. // Prepare
  18259. var collection, $container, container, $target, $inline, position, containerTagName,
  18260. containerScrollTop, containerScrollLeft,
  18261. containerScrollTopEnd, containerScrollLeftEnd,
  18262. startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted,
  18263. startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted,
  18264. scrollOptions,
  18265. callback;
  18266. // Determine the Scroll
  18267. collection = collections.pop();
  18268. $container = collection.$container;
  18269. $target = collection.$target;
  18270. containerTagName = $container.prop('tagName');
  18271. // Prepare the Inline Element of the Container
  18272. $inline = $('<span/>').css({
  18273. 'position': 'absolute',
  18274. 'top': '0px',
  18275. 'left': '0px'
  18276. });
  18277. position = $container.css('position');
  18278. // Insert the Inline Element of the Container
  18279. $container.css({position:'relative'});
  18280. $inline.appendTo($container);
  18281. // Determine the top offset
  18282. startOffsetTop = $inline.offset().top;
  18283. targetOffsetTop = $target.offset().top;
  18284. targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10);
  18285. // Determine the left offset
  18286. startOffsetLeft = $inline.offset().left;
  18287. targetOffsetLeft = $target.offset().left;
  18288. targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10);
  18289. // Determine current scroll positions
  18290. containerScrollTop = $container.prop('scrollTop');
  18291. containerScrollLeft = $container.prop('scrollLeft');
  18292. // Reset the Inline Element of the Container
  18293. $inline.remove();
  18294. $container.css({position:position});
  18295. // Prepare the scroll options
  18296. scrollOptions = {};
  18297. // Prepare the callback
  18298. callback = function(event){
  18299. // Check
  18300. if ( collections.length === 0 ) {
  18301. // Callback
  18302. if ( typeof config.callback === 'function' ) {
  18303. config.callback();
  18304. }
  18305. }
  18306. else {
  18307. // Recurse
  18308. ScrollTo.scroll(collections,config);
  18309. }
  18310. // Return true
  18311. return true;
  18312. };
  18313. // Handle if we only want to scroll if we are outside the viewport
  18314. if ( config.onlyIfOutside ) {
  18315. // Determine current scroll positions
  18316. containerScrollTopEnd = containerScrollTop + $container.height();
  18317. containerScrollLeftEnd = containerScrollLeft + $container.width();
  18318. // Check if we are in the range of the visible area of the container
  18319. if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) {
  18320. targetOffsetTopAdjusted = containerScrollTop;
  18321. }
  18322. if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) {
  18323. targetOffsetLeftAdjusted = containerScrollLeft;
  18324. }
  18325. }
  18326. // Determine the scroll options
  18327. if ( targetOffsetTopAdjusted !== containerScrollTop ) {
  18328. scrollOptions.scrollTop = targetOffsetTopAdjusted;
  18329. }
  18330. if ( targetOffsetLeftAdjusted !== containerScrollLeft ) {
  18331. scrollOptions.scrollLeft = targetOffsetLeftAdjusted;
  18332. }
  18333. // Check to see if the scroll is necessary
  18334. if ( $container.prop('scrollHeight') === $container.width() ) {
  18335. delete scrollOptions.scrollTop;
  18336. }
  18337. if ( $container.prop('scrollWidth') === $container.width() ) {
  18338. delete scrollOptions.scrollLeft;
  18339. }
  18340. // Perform the scroll
  18341. if ( scrollOptions.scrollTop != null || scrollOptions.scrollLeft != null ) {
  18342. $container.animate(scrollOptions, {
  18343. duration: config.duration,
  18344. easing: config.easing,
  18345. complete: callback
  18346. });
  18347. }
  18348. else {
  18349. callback();
  18350. }
  18351. // Return true
  18352. return true;
  18353. },
  18354. // ScrollTo the Element using the Options
  18355. fn: function(options){
  18356. // Prepare
  18357. var collections, config, $container, container;
  18358. collections = [];
  18359. // Prepare
  18360. var $target = $(this);
  18361. if ( $target.length === 0 ) {
  18362. // Chain
  18363. return this;
  18364. }
  18365. // Handle Options
  18366. config = $.extend({},ScrollTo.config,options);
  18367. // Fetch
  18368. $container = $target.parent();
  18369. container = $container.get(0);
  18370. // Cycle through the containers
  18371. while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) {
  18372. // Check Container for scroll differences
  18373. var containerScrollTop, containerScrollLeft;
  18374. containerScrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight;
  18375. containerScrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth;
  18376. if ( containerScrollTop || containerScrollLeft ) {
  18377. // Push the Collection
  18378. collections.push({
  18379. '$container': $container,
  18380. '$target': $target
  18381. });
  18382. // Update the Target
  18383. $target = $container;
  18384. }
  18385. // Update the Container
  18386. $container = $container.parent();
  18387. container = $container.get(0);
  18388. }
  18389. // Add the final collection
  18390. collections.push({
  18391. '$container': $('html'),
  18392. // document.body doesn't work in firefox, html works for all
  18393. // internet explorer starts at the beggining
  18394. '$target': $target
  18395. });
  18396. // Adjust the Config
  18397. if ( config.durationMode === 'all' ) {
  18398. config.duration /= collections.length;
  18399. }
  18400. // Handle
  18401. ScrollTo.scroll(collections,config);
  18402. // Chain
  18403. return this;
  18404. }
  18405. };
  18406. // Apply our extensions to jQuery
  18407. $.ScrollTo = $.ScrollTo || ScrollTo;
  18408. $.fn.ScrollTo = $.fn.ScrollTo || ScrollTo.fn;
  18409. // Export
  18410. return ScrollTo;
  18411. });
  18412. // ------------- WOW ANIMATE ------------------------------------------------ //
  18413. // ==============https://github.com/matthieua/WOW =========================== //
  18414. // -------------------------------------------------------------------------- //
  18415. (function() {
  18416. var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
  18417. __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  18418. __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; };
  18419. Util = (function() {
  18420. function Util() {}
  18421. Util.prototype.extend = function(custom, defaults) {
  18422. var key, value;
  18423. for (key in defaults) {
  18424. value = defaults[key];
  18425. if (custom[key] == null) {
  18426. custom[key] = value;
  18427. }
  18428. }
  18429. return custom;
  18430. };
  18431. Util.prototype.isMobile = function(agent) {
  18432. return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
  18433. };
  18434. Util.prototype.addEvent = function(elem, event, fn) {
  18435. if (elem.addEventListener != null) {
  18436. return elem.addEventListener(event, fn, false);
  18437. } else if (elem.attachEvent != null) {
  18438. return elem.attachEvent("on" + event, fn);
  18439. } else {
  18440. return elem[event] = fn;
  18441. }
  18442. };
  18443. Util.prototype.removeEvent = function(elem, event, fn) {
  18444. if (elem.removeEventListener != null) {
  18445. return elem.removeEventListener(event, fn, false);
  18446. } else if (elem.detachEvent != null) {
  18447. return elem.detachEvent("on" + event, fn);
  18448. } else {
  18449. return delete elem[event];
  18450. }
  18451. };
  18452. Util.prototype.innerHeight = function() {
  18453. if ('innerHeight' in window) {
  18454. return window.innerHeight;
  18455. } else {
  18456. return document.documentElement.clientHeight;
  18457. }
  18458. };
  18459. return Util;
  18460. })();
  18461. WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
  18462. function WeakMap() {
  18463. this.keys = [];
  18464. this.values = [];
  18465. }
  18466. WeakMap.prototype.get = function(key) {
  18467. var i, item, _i, _len, _ref;
  18468. _ref = this.keys;
  18469. for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
  18470. item = _ref[i];
  18471. if (item === key) {
  18472. return this.values[i];
  18473. }
  18474. }
  18475. };
  18476. WeakMap.prototype.set = function(key, value) {
  18477. var i, item, _i, _len, _ref;
  18478. _ref = this.keys;
  18479. for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
  18480. item = _ref[i];
  18481. if (item === key) {
  18482. this.values[i] = value;
  18483. return;
  18484. }
  18485. }
  18486. this.keys.push(key);
  18487. return this.values.push(value);
  18488. };
  18489. return WeakMap;
  18490. })());
  18491. MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
  18492. function MutationObserver() {
  18493. if (typeof console !== "undefined" && console !== null) {
  18494. console.warn('MutationObserver is not supported by your browser.');
  18495. }
  18496. if (typeof console !== "undefined" && console !== null) {
  18497. console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
  18498. }
  18499. }
  18500. MutationObserver.notSupported = true;
  18501. MutationObserver.prototype.observe = function() {};
  18502. return MutationObserver;
  18503. })());
  18504. getComputedStyle = this.getComputedStyle || function(el, pseudo) {
  18505. this.getPropertyValue = function(prop) {
  18506. var _ref;
  18507. if (prop === 'float') {
  18508. prop = 'styleFloat';
  18509. }
  18510. if (getComputedStyleRX.test(prop)) {
  18511. prop.replace(getComputedStyleRX, function(_, char) {
  18512. return char.toUpperCase();
  18513. });
  18514. }
  18515. return ((_ref = el.currentStyle) != null ? _ref[prop] : void 0) || null;
  18516. };
  18517. return this;
  18518. };
  18519. getComputedStyleRX = /(\-([a-z]){1})/g;
  18520. this.WOW = (function() {
  18521. WOW.prototype.defaults = {
  18522. boxClass: 'wow',
  18523. animateClass: 'animated',
  18524. offset: 0,
  18525. mobile: true,
  18526. live: true
  18527. };
  18528. function WOW(options) {
  18529. if (options == null) {
  18530. options = {};
  18531. }
  18532. this.scrollCallback = __bind(this.scrollCallback, this);
  18533. this.scrollHandler = __bind(this.scrollHandler, this);
  18534. this.start = __bind(this.start, this);
  18535. this.scrolled = true;
  18536. this.config = this.util().extend(options, this.defaults);
  18537. this.animationNameCache = new WeakMap();
  18538. }
  18539. WOW.prototype.init = function() {
  18540. var _ref;
  18541. this.element = window.document.documentElement;
  18542. if ((_ref = document.readyState) === "interactive" || _ref === "complete") {
  18543. this.start();
  18544. } else {
  18545. this.util().addEvent(document, 'DOMContentLoaded', this.start);
  18546. }
  18547. return this.finished = [];
  18548. };
  18549. WOW.prototype.start = function() {
  18550. var box, _i, _len, _ref;
  18551. this.stopped = false;
  18552. this.boxes = (function() {
  18553. var _i, _len, _ref, _results;
  18554. _ref = this.element.querySelectorAll("." + this.config.boxClass);
  18555. _results = [];
  18556. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18557. box = _ref[_i];
  18558. _results.push(box);
  18559. }
  18560. return _results;
  18561. }).call(this);
  18562. this.all = (function() {
  18563. var _i, _len, _ref, _results;
  18564. _ref = this.boxes;
  18565. _results = [];
  18566. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18567. box = _ref[_i];
  18568. _results.push(box);
  18569. }
  18570. return _results;
  18571. }).call(this);
  18572. if (this.boxes.length) {
  18573. if (this.disabled()) {
  18574. this.resetStyle();
  18575. } else {
  18576. _ref = this.boxes;
  18577. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18578. box = _ref[_i];
  18579. this.applyStyle(box, true);
  18580. }
  18581. this.util().addEvent(window, 'scroll', this.scrollHandler);
  18582. this.util().addEvent(window, 'resize', this.scrollHandler);
  18583. this.interval = setInterval(this.scrollCallback, 50);
  18584. }
  18585. }
  18586. if (this.config.live) {
  18587. return new MutationObserver((function(_this) {
  18588. return function(records) {
  18589. var node, record, _j, _len1, _results;
  18590. _results = [];
  18591. for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
  18592. record = records[_j];
  18593. _results.push((function() {
  18594. var _k, _len2, _ref1, _results1;
  18595. _ref1 = record.addedNodes || [];
  18596. _results1 = [];
  18597. for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
  18598. node = _ref1[_k];
  18599. _results1.push(this.doSync(node));
  18600. }
  18601. return _results1;
  18602. }).call(_this));
  18603. }
  18604. return _results;
  18605. };
  18606. })(this)).observe(document.body, {
  18607. childList: true,
  18608. subtree: true
  18609. });
  18610. }
  18611. };
  18612. WOW.prototype.stop = function() {
  18613. this.stopped = true;
  18614. this.util().removeEvent(window, 'scroll', this.scrollHandler);
  18615. this.util().removeEvent(window, 'resize', this.scrollHandler);
  18616. if (this.interval != null) {
  18617. return clearInterval(this.interval);
  18618. }
  18619. };
  18620. WOW.prototype.sync = function(element) {
  18621. if (MutationObserver.notSupported) {
  18622. return this.doSync(this.element);
  18623. }
  18624. };
  18625. WOW.prototype.doSync = function(element) {
  18626. var box, _i, _len, _ref, _results;
  18627. if (element == null) {
  18628. element = this.element;
  18629. }
  18630. if (element.nodeType !== 1) {
  18631. return;
  18632. }
  18633. element = element.parentNode || element;
  18634. _ref = element.querySelectorAll("." + this.config.boxClass);
  18635. _results = [];
  18636. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18637. box = _ref[_i];
  18638. if (__indexOf.call(this.all, box) < 0) {
  18639. this.boxes.push(box);
  18640. this.all.push(box);
  18641. if (this.stopped || this.disabled()) {
  18642. this.resetStyle();
  18643. } else {
  18644. this.applyStyle(box, true);
  18645. }
  18646. _results.push(this.scrolled = true);
  18647. } else {
  18648. _results.push(void 0);
  18649. }
  18650. }
  18651. return _results;
  18652. };
  18653. WOW.prototype.show = function(box) {
  18654. this.applyStyle(box);
  18655. return box.className = "" + box.className + " " + this.config.animateClass;
  18656. };
  18657. WOW.prototype.applyStyle = function(box, hidden) {
  18658. var delay, duration, iteration;
  18659. duration = box.getAttribute('data-wow-duration');
  18660. delay = box.getAttribute('data-wow-delay');
  18661. iteration = box.getAttribute('data-wow-iteration');
  18662. return this.animate((function(_this) {
  18663. return function() {
  18664. return _this.customStyle(box, hidden, duration, delay, iteration);
  18665. };
  18666. })(this));
  18667. };
  18668. WOW.prototype.animate = (function() {
  18669. if ('requestAnimationFrame' in window) {
  18670. return function(callback) {
  18671. return window.requestAnimationFrame(callback);
  18672. };
  18673. } else {
  18674. return function(callback) {
  18675. return callback();
  18676. };
  18677. }
  18678. })();
  18679. WOW.prototype.resetStyle = function() {
  18680. var box, _i, _len, _ref, _results;
  18681. _ref = this.boxes;
  18682. _results = [];
  18683. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18684. box = _ref[_i];
  18685. _results.push(box.style.visibility = 'visible');
  18686. }
  18687. return _results;
  18688. };
  18689. WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
  18690. if (hidden) {
  18691. this.cacheAnimationName(box);
  18692. }
  18693. box.style.visibility = hidden ? 'hidden' : 'visible';
  18694. if (duration) {
  18695. this.vendorSet(box.style, {
  18696. animationDuration: duration
  18697. });
  18698. }
  18699. if (delay) {
  18700. this.vendorSet(box.style, {
  18701. animationDelay: delay
  18702. });
  18703. }
  18704. if (iteration) {
  18705. this.vendorSet(box.style, {
  18706. animationIterationCount: iteration
  18707. });
  18708. }
  18709. this.vendorSet(box.style, {
  18710. animationName: hidden ? 'none' : this.cachedAnimationName(box)
  18711. });
  18712. return box;
  18713. };
  18714. WOW.prototype.vendors = ["moz", "webkit"];
  18715. WOW.prototype.vendorSet = function(elem, properties) {
  18716. var name, value, vendor, _results;
  18717. _results = [];
  18718. for (name in properties) {
  18719. value = properties[name];
  18720. elem["" + name] = value;
  18721. _results.push((function() {
  18722. var _i, _len, _ref, _results1;
  18723. _ref = this.vendors;
  18724. _results1 = [];
  18725. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18726. vendor = _ref[_i];
  18727. _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
  18728. }
  18729. return _results1;
  18730. }).call(this));
  18731. }
  18732. return _results;
  18733. };
  18734. WOW.prototype.vendorCSS = function(elem, property) {
  18735. var result, style, vendor, _i, _len, _ref;
  18736. style = getComputedStyle(elem);
  18737. result = style.getPropertyCSSValue(property);
  18738. _ref = this.vendors;
  18739. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18740. vendor = _ref[_i];
  18741. result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
  18742. }
  18743. return result;
  18744. };
  18745. WOW.prototype.animationName = function(box) {
  18746. var animationName;
  18747. try {
  18748. animationName = this.vendorCSS(box, 'animation-name').cssText;
  18749. } catch (_error) {
  18750. animationName = getComputedStyle(box).getPropertyValue('animation-name');
  18751. }
  18752. if (animationName === 'none') {
  18753. return '';
  18754. } else {
  18755. return animationName;
  18756. }
  18757. };
  18758. WOW.prototype.cacheAnimationName = function(box) {
  18759. return this.animationNameCache.set(box, this.animationName(box));
  18760. };
  18761. WOW.prototype.cachedAnimationName = function(box) {
  18762. return this.animationNameCache.get(box);
  18763. };
  18764. WOW.prototype.scrollHandler = function() {
  18765. return this.scrolled = true;
  18766. };
  18767. WOW.prototype.scrollCallback = function() {
  18768. var box;
  18769. if (this.scrolled) {
  18770. this.scrolled = false;
  18771. this.boxes = (function() {
  18772. var _i, _len, _ref, _results;
  18773. _ref = this.boxes;
  18774. _results = [];
  18775. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  18776. box = _ref[_i];
  18777. if (!(box)) {
  18778. continue;
  18779. }
  18780. if (this.isVisible(box)) {
  18781. this.show(box);
  18782. continue;
  18783. }
  18784. _results.push(box);
  18785. }
  18786. return _results;
  18787. }).call(this);
  18788. if (!(this.boxes.length || this.config.live)) {
  18789. return this.stop();
  18790. }
  18791. }
  18792. };
  18793. WOW.prototype.offsetTop = function(element) {
  18794. var top;
  18795. while (element.offsetTop === void 0) {
  18796. element = element.parentNode;
  18797. }
  18798. top = element.offsetTop;
  18799. while (element = element.offsetParent) {
  18800. top += element.offsetTop;
  18801. }
  18802. return top;
  18803. };
  18804. WOW.prototype.isVisible = function(box) {
  18805. var bottom, offset, top, viewBottom, viewTop;
  18806. offset = box.getAttribute('data-wow-offset') || this.config.offset;
  18807. viewTop = window.pageYOffset;
  18808. viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
  18809. top = this.offsetTop(box);
  18810. bottom = top + box.clientHeight;
  18811. return top <= viewBottom && bottom >= viewTop;
  18812. };
  18813. WOW.prototype.util = function() {
  18814. return this._util != null ? this._util : this._util = new Util();
  18815. };
  18816. WOW.prototype.disabled = function() {
  18817. return !this.config.mobile && this.util().isMobile(navigator.userAgent);
  18818. };
  18819. return WOW;
  18820. })();
  18821. }).call(this);
  18822. // ------------- JQUERY SMOOTHSTATE ----------------------------------------- //
  18823. // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
  18824. // -------------------------------------------------------------------------- //
  18825. ;(function ( $, window, document, undefined ) {
  18826. "use strict";
  18827. var
  18828. /** Used later to scroll page to the top */
  18829. $body = $("html, body"),
  18830. /** Used in development mode to console out useful warnings */
  18831. consl = (window.console || false),
  18832. /** Plugin default options */
  18833. defaults = {
  18834. /** jquery element string to specify which anchors smoothstate should bind to */
  18835. anchors : "a",
  18836. /** If set to true, smoothState will prefetch a link's contents on hover */
  18837. prefetch : false,
  18838. /** A selecor that deinfes with links should be ignored by smoothState */
  18839. blacklist : ".no-smoothstate, [target]",
  18840. /** If set to true, smoothState will log useful debug information instead of aborting */
  18841. development : false,
  18842. /** The number of pages smoothState will try to store in memory and not request again */
  18843. pageCacheSize : 0,
  18844. /** A function that can be used to alter urls before they are used to request content */
  18845. alterRequestUrl : function (url) {
  18846. return url;
  18847. },
  18848. /** Run when a link has been activated */
  18849. onStart : {
  18850. duration: 0,
  18851. render: function (url, $container) {
  18852. $body.scrollTop(0);
  18853. }
  18854. },
  18855. /** Run if the page request is still pending and onStart has finished animating */
  18856. onProgress : {
  18857. duration: 0,
  18858. render: function (url, $container) {
  18859. $body.css("cursor", "wait");
  18860. $body.find("a").css("cursor", "wait");
  18861. }
  18862. },
  18863. /** Run when requested content is ready to be injected into the page */
  18864. onEnd : {
  18865. duration: 0,
  18866. render: function (url, $container, $content) {
  18867. $body.css("cursor", "auto");
  18868. $body.find("a").css("cursor", "auto");
  18869. $container.html($content);
  18870. }
  18871. },
  18872. /** Run when content has been injected and all animations are complete */
  18873. callback : function(url, $container, $content) {
  18874. }
  18875. },
  18876. /** Utility functions that are decoupled from SmoothState */
  18877. utility = {
  18878. /**
  18879. * Checks to see if the url is external
  18880. * @param {string} url - url being evaluated
  18881. * @see http://stackoverflow.com/questions/6238351/fastest-way-to-detect-external-urls
  18882. *
  18883. */
  18884. isExternal: function (url) {
  18885. var match = url.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);
  18886. if (typeof match[1] === "string" && match[1].length > 0 && match[1].toLowerCase() !== window.location.protocol) {
  18887. return true;
  18888. }
  18889. if (typeof match[2] === "string" && match[2].length > 0 && match[2].replace(new RegExp(":(" + {"http:": 80, "https:": 443}[window.location.protocol] + ")?$"), "") !== window.location.host) {
  18890. return true;
  18891. }
  18892. return false;
  18893. },
  18894. /**
  18895. * Checks to see if the url is an internal hash
  18896. * @param {string} url - url being evaluated
  18897. *
  18898. */
  18899. isHash: function (url) {
  18900. var hasPathname = (url.indexOf(window.location.pathname) > 0) ? true : false,
  18901. hasHash = (url.indexOf("#") > 0) ? true : false;
  18902. return (hasPathname && hasHash) ? true : false;
  18903. },
  18904. /**
  18905. * Checks to see if we should be loading this URL
  18906. * @param {string} url - url being evaluated
  18907. * @param {string} blacklist - jquery selector
  18908. *
  18909. */
  18910. shouldLoad: function ($anchor, blacklist) {
  18911. var url = $anchor.prop("href");
  18912. // URL will only be loaded if it"s not an external link, hash, or blacklisted
  18913. return (!utility.isExternal(url) && !utility.isHash(url) && !$anchor.is(blacklist));
  18914. },
  18915. /**
  18916. * Prevents jQuery from stripping elements from $(html)
  18917. * @param {string} url - url being evaluated
  18918. * @author Ben Alman http://benalman.com/
  18919. * @see https://gist.github.com/cowboy/742952
  18920. *
  18921. */
  18922. htmlDoc: function (html) {
  18923. var parent,
  18924. elems = $(),
  18925. matchTag = /<(\/?)(html|head|body|title|base|meta)(\s+[^>]*)?>/ig,
  18926. prefix = "ss" + Math.round(Math.random() * 100000),
  18927. htmlParsed = html.replace(matchTag, function(tag, slash, name, attrs) {
  18928. var obj = {};
  18929. if (!slash) {
  18930. elems = elems.add("<" + name + "/>");
  18931. if (attrs) {
  18932. $.each($("<div" + attrs + "/>")[0].attributes, function(i, attr) {
  18933. obj[attr.name] = attr.value;
  18934. });
  18935. }
  18936. elems.eq(-1).attr(obj);
  18937. }
  18938. return "<" + slash + "div" + (slash ? "" : " id='" + prefix + (elems.length - 1) + "'") + ">";
  18939. });
  18940. // If no placeholder elements were necessary, just return normal
  18941. // jQuery-parsed HTML.
  18942. if (!elems.length) {
  18943. return $(html);
  18944. }
  18945. // Create parent node if it hasn"t been created yet.
  18946. if (!parent) {
  18947. parent = $("<div/>");
  18948. }
  18949. // Create the parent node and append the parsed, place-held HTML.
  18950. parent.html(htmlParsed);
  18951. // Replace each placeholder element with its intended element.
  18952. $.each(elems, function(i) {
  18953. var elem = parent.find("#" + prefix + i).before(elems[i]);
  18954. elems.eq(i).html(elem.contents());
  18955. elem.remove();
  18956. });
  18957. return parent.children().unwrap();
  18958. },
  18959. /**
  18960. * Resets an object if it has too many properties
  18961. *
  18962. * This is used to clear the "cache" object that stores
  18963. * all of the html. This would prevent the client from
  18964. * running out of memory and allow the user to hit the
  18965. * server for a fresh copy of the content.
  18966. *
  18967. * @param {object} obj
  18968. * @param {number} cap
  18969. *
  18970. */
  18971. clearIfOverCapacity: function (obj, cap) {
  18972. // Polyfill Object.keys if it doesn"t exist
  18973. if (!Object.keys) {
  18974. Object.keys = function (obj) {
  18975. var keys = [],
  18976. k;
  18977. for (k in obj) {
  18978. if (Object.prototype.hasOwnProperty.call(obj, k)) {
  18979. keys.push(k);
  18980. }
  18981. }
  18982. return keys;
  18983. };
  18984. }
  18985. if (Object.keys(obj).length > cap) {
  18986. obj = {};
  18987. }
  18988. return obj;
  18989. },
  18990. /**
  18991. * Finds the inner content of an element, by an ID, from a jQuery object
  18992. * @param {string} id
  18993. * @param {object} $html
  18994. *
  18995. */
  18996. getContentById: function (id, $html) {
  18997. $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
  18998. var $insideElem = $html.find(id),
  18999. updatedContainer = ($insideElem.length) ? $.trim($insideElem.html()) : $html.filter(id).html(),
  19000. newContent = (updatedContainer.length) ? $(updatedContainer) : null;
  19001. return newContent;
  19002. },
  19003. /**
  19004. * Stores html content as jquery object in given object
  19005. * @param {object} object - object contents will be stored into
  19006. * @param {string} url - url to be used as the prop
  19007. * @param {jquery} html - contents to store
  19008. *
  19009. */
  19010. storePageIn: function (object, url, $html) {
  19011. $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
  19012. object[url] = { // Content is indexed by the url
  19013. status: "loaded",
  19014. title: $html.find("title").text(), // Stores the title of the page
  19015. html: $html // Stores the contents of the page
  19016. };
  19017. return object;
  19018. },
  19019. /**
  19020. * Triggers an "allanimationend" event when all animations are complete
  19021. * @param {object} $element - jQuery object that should trigger event
  19022. * @param {string} resetOn - which other events to trigger allanimationend on
  19023. *
  19024. */
  19025. triggerAllAnimationEndEvent: function ($element, resetOn) {
  19026. resetOn = " " + resetOn || "";
  19027. var animationCount = 0,
  19028. animationstart = "animationstart webkitAnimationStart oanimationstart MSAnimationStart",
  19029. animationend = "animationend webkitAnimationEnd oanimationend MSAnimationEnd",
  19030. eventname = "allanimationend",
  19031. onAnimationStart = function (e) {
  19032. if ($(e.delegateTarget).is($element)) {
  19033. e.stopPropagation();
  19034. animationCount ++;
  19035. }
  19036. },
  19037. onAnimationEnd = function (e) {
  19038. if ($(e.delegateTarget).is($element)) {
  19039. e.stopPropagation();
  19040. animationCount --;
  19041. if(animationCount === 0) {
  19042. $element.trigger(eventname);
  19043. }
  19044. }
  19045. };
  19046. $element.on(animationstart, onAnimationStart);
  19047. $element.on(animationend, onAnimationEnd);
  19048. $element.on("allanimationend" + resetOn, function(){
  19049. animationCount = 0;
  19050. utility.redraw($element);
  19051. });
  19052. },
  19053. /** Forces browser to redraw elements */
  19054. redraw: function ($element) {
  19055. $element.height(0);
  19056. setTimeout(function(){$element.height("auto");}, 0);
  19057. }
  19058. },
  19059. /** Handles the popstate event, like when the user hits "back" */
  19060. onPopState = function ( e ) {
  19061. if(e.state !== null) {
  19062. var url = window.location.href,
  19063. $page = $("#" + e.state.id),
  19064. page = $page.data("smoothState");
  19065. if(page.href !== url && !utility.isHash(url)) {
  19066. page.load(url, true);
  19067. }
  19068. }
  19069. },
  19070. /** Constructor function */
  19071. SmoothState = function ( element, options ) {
  19072. var
  19073. /** Container element smoothState is run on */
  19074. $container = $(element),
  19075. /** Variable that stores pages after they are requested */
  19076. cache = {},
  19077. /** Url of the content that is currently displayed */
  19078. currentHref = window.location.href,
  19079. /**
  19080. * Loads the contents of a url into our container
  19081. *
  19082. * @param {string} url
  19083. * @param {bool} isPopped - used to determine if whe should
  19084. * add a new item into the history object
  19085. *
  19086. */
  19087. load = function (url, isPopped) {
  19088. /** Makes this an optional variable by setting a default */
  19089. isPopped = isPopped || false;
  19090. var
  19091. /** Used to check if the onProgress function has been run */
  19092. hasRunCallback = false,
  19093. callbBackEnded = false,
  19094. /** List of responses for the states of the page request */
  19095. responses = {
  19096. /** Page is ready, update the content */
  19097. loaded: function() {
  19098. var eventName = hasRunCallback ? "ss.onProgressEnd" : "ss.onStartEnd";
  19099. if(!callbBackEnded || !hasRunCallback) {
  19100. $container.one(eventName, function(){
  19101. updateContent(url);
  19102. });
  19103. } else if(callbBackEnded) {
  19104. updateContent(url);
  19105. }
  19106. if(!isPopped) {
  19107. window.history.pushState({ id: $container.prop("id") }, cache[url].title, url);
  19108. }
  19109. },
  19110. /** Loading, wait 10 ms and check again */
  19111. fetching: function() {
  19112. if(!hasRunCallback) {
  19113. hasRunCallback = true;
  19114. // Run the onProgress callback and set trigger
  19115. $container.one("ss.onStartEnd", function(){
  19116. options.onProgress.render(url, $container, null);
  19117. setTimeout(function(){
  19118. $container.trigger("ss.onProgressEnd");
  19119. callbBackEnded = true;
  19120. }, options.onStart.duration);
  19121. });
  19122. }
  19123. setTimeout(function () {
  19124. // Might of been canceled, better check!
  19125. if(cache.hasOwnProperty(url)){
  19126. responses[cache[url].status]();
  19127. }
  19128. }, 10);
  19129. },
  19130. /** Error, abort and redirect */
  19131. error: function(){
  19132. window.location = url;
  19133. }
  19134. };
  19135. if (!cache.hasOwnProperty(url)) {
  19136. fetch(url);
  19137. }
  19138. // Run the onStart callback and set trigger
  19139. options.onStart.render(url, $container, null);
  19140. setTimeout(function(){
  19141. $container.trigger("ss.onStartEnd");
  19142. }, options.onStart.duration);
  19143. // Start checking for the status of content
  19144. responses[cache[url].status]();
  19145. },
  19146. /** Updates the contents from cache[url] */
  19147. updateContent = function (url) {
  19148. // If the content has been requested and is done:
  19149. var containerId = "#" + $container.prop("id"),
  19150. $content = cache[url] ? utility.getContentById(containerId, cache[url].html) : null;
  19151. if($content) {
  19152. document.title = cache[url].title;
  19153. $container.data("smoothState").href = url;
  19154. // Call the onEnd callback and set trigger
  19155. options.onEnd.render(url, $container, $content);
  19156. $container.one("ss.onEndEnd", function(){
  19157. options.callback(url, $container, $content);
  19158. });
  19159. setTimeout(function(){
  19160. $container.trigger("ss.onEndEnd");
  19161. }, options.onEnd.duration);
  19162. } else if (!$content && options.development && consl) {
  19163. // Throw warning to help debug in development mode
  19164. consl.warn("No element with an id of " + containerId + " in response from " + url + " in " + cache);
  19165. } else {
  19166. // No content availble to update with, aborting...
  19167. window.location = url;
  19168. }
  19169. },
  19170. /**
  19171. * Fetches the contents of a url and stores it in the "cache" varible
  19172. * @param {string} url
  19173. *
  19174. */
  19175. fetch = function (url) {
  19176. // Don"t fetch we have the content already
  19177. if(cache.hasOwnProperty(url)) {
  19178. return;
  19179. }
  19180. cache = utility.clearIfOverCapacity(cache, options.pageCacheSize);
  19181. cache[url] = { status: "fetching" };
  19182. var requestUrl = options.alterRequestUrl(url) || url,
  19183. request = $.ajax(requestUrl);
  19184. // Store contents in cache variable if successful
  19185. request.success(function (html) {
  19186. // Clear cache varible if it"s getting too big
  19187. utility.storePageIn(cache, url, html);
  19188. $container.data("smoothState").cache = cache;
  19189. });
  19190. // Mark as error
  19191. request.error(function () {
  19192. cache[url].status = "error";
  19193. });
  19194. },
  19195. /**
  19196. * Binds to the hover event of a link, used for prefetching content
  19197. *
  19198. * @param {object} event
  19199. *
  19200. */
  19201. hoverAnchor = function (event) {
  19202. var $anchor = $(event.currentTarget),
  19203. url = $anchor.prop("href");
  19204. if (utility.shouldLoad($anchor, options.blacklist)) {
  19205. event.stopPropagation();
  19206. fetch(url);
  19207. }
  19208. },
  19209. /**
  19210. * Binds to the click event of a link, used to show the content
  19211. *
  19212. * @param {object} event
  19213. *
  19214. */
  19215. clickAnchor = function (event) {
  19216. var $anchor = $(event.currentTarget),
  19217. url = $anchor.prop("href");
  19218. // Ctrl (or Cmd) + click must open a new tab
  19219. if (!event.metaKey && !event.ctrlKey && utility.shouldLoad($anchor, options.blacklist)) {
  19220. // stopPropagation so that event doesn"t fire on parent containers.
  19221. event.stopPropagation();
  19222. event.preventDefault();
  19223. load(url);
  19224. }
  19225. },
  19226. /**
  19227. * Binds all events and inits functionality
  19228. *
  19229. * @param {object} event
  19230. *
  19231. */
  19232. bindEventHandlers = function ($element) {
  19233. //@todo: Handle form submissions
  19234. $element.on("click", options.anchors, clickAnchor);
  19235. if (options.prefetch) {
  19236. $element.on("mouseover touchstart", options.anchors, hoverAnchor);
  19237. }
  19238. },
  19239. /** Used to restart css animations with a class */
  19240. toggleAnimationClass = function (classname) {
  19241. var classes = $container.addClass(classname).prop("class");
  19242. $container.removeClass(classes);
  19243. setTimeout(function(){
  19244. $container.addClass(classes);
  19245. },0);
  19246. $container.one("ss.onStartEnd ss.onProgressEnd ss.onEndEnd", function(){
  19247. $container.removeClass(classname);
  19248. });
  19249. };
  19250. /** Override defaults with options passed in */
  19251. options = $.extend(defaults, options);
  19252. /** Sets a default state */
  19253. if(window.history.state === null) {
  19254. window.history.replaceState({ id: $container.prop("id") }, document.title, currentHref);
  19255. }
  19256. /** Stores the current page in cache variable */
  19257. utility.storePageIn(cache, currentHref, document.documentElement.outerHTML);
  19258. /** Bind all of the event handlers on the container, not anchors */
  19259. utility.triggerAllAnimationEndEvent($container, "ss.onStartEnd ss.onProgressEnd ss.onEndEnd");
  19260. /** Bind all of the event handlers on the container, not anchors */
  19261. bindEventHandlers($container);
  19262. /** Public methods */
  19263. return {
  19264. href: currentHref,
  19265. cache: cache,
  19266. load: load,
  19267. fetch: fetch,
  19268. toggleAnimationClass: toggleAnimationClass
  19269. };
  19270. },
  19271. /** Returns elements with SmoothState attached to it */
  19272. declareSmoothState = function ( options ) {
  19273. return this.each(function () {
  19274. // Checks to make sure the smoothState element has an id and isn"t already bound
  19275. if(this.id && !$.data(this, "smoothState")) {
  19276. // Makes public methods available via $("element").data("smoothState");
  19277. $.data(this, "smoothState", new SmoothState(this, options));
  19278. } else if (!this.id && consl) {
  19279. // Throw warning if in development mode
  19280. consl.warn("Every smoothState container needs an id but the following one does not have one:", this);
  19281. }
  19282. });
  19283. };
  19284. /** Sets the popstate function */
  19285. window.onpopstate = onPopState;
  19286. /** Makes utility functions public for unit tests */
  19287. $.smoothStateUtility = utility;
  19288. /** Defines the smoothState plugin */
  19289. $.fn.smoothState = declareSmoothState;
  19290. })(jQuery, window, document);
  19291. // ------------- jQuery Cookie Plugin v1.4.1 -------------------------------- //
  19292. // ============ https://github.com/carhartl/jquery-cookie =================== //
  19293. // -------------------------------------------------------------------------- //
  19294. (function (factory) {
  19295. if (typeof define === 'function' && define.amd) {
  19296. // AMD
  19297. define(['jquery'], factory);
  19298. } else if (typeof exports === 'object') {
  19299. // CommonJS
  19300. factory(require('jquery'));
  19301. } else {
  19302. // Browser globals
  19303. factory(jQuery);
  19304. }
  19305. }(function ($) {
  19306. var pluses = /\+/g;
  19307. function encode(s) {
  19308. return config.raw ? s : encodeURIComponent(s);
  19309. }
  19310. function decode(s) {
  19311. return config.raw ? s : decodeURIComponent(s);
  19312. }
  19313. function stringifyCookieValue(value) {
  19314. return encode(config.json ? JSON.stringify(value) : String(value));
  19315. }
  19316. function parseCookieValue(s) {
  19317. if (s.indexOf('"') === 0) {
  19318. // This is a quoted cookie as according to RFC2068, unescape...
  19319. s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  19320. }
  19321. try {
  19322. // Replace server-side written pluses with spaces.
  19323. // If we can't decode the cookie, ignore it, it's unusable.
  19324. // If we can't parse the cookie, ignore it, it's unusable.
  19325. s = decodeURIComponent(s.replace(pluses, ' '));
  19326. return config.json ? JSON.parse(s) : s;
  19327. } catch(e) {}
  19328. }
  19329. function read(s, converter) {
  19330. var value = config.raw ? s : parseCookieValue(s);
  19331. return $.isFunction(converter) ? converter(value) : value;
  19332. }
  19333. var config = $.cookie = function (key, value, options) {
  19334. // Write
  19335. if (arguments.length > 1 && !$.isFunction(value)) {
  19336. options = $.extend({}, config.defaults, options);
  19337. if (typeof options.expires === 'number') {
  19338. var days = options.expires, t = options.expires = new Date();
  19339. t.setTime(+t + days * 864e+5);
  19340. }
  19341. return (document.cookie = [
  19342. encode(key), '=', stringifyCookieValue(value),
  19343. options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
  19344. options.path ? '; path=' + options.path : '',
  19345. options.domain ? '; domain=' + options.domain : '',
  19346. options.secure ? '; secure' : ''
  19347. ].join(''));
  19348. }
  19349. // Read
  19350. var result = key ? undefined : {};
  19351. // To prevent the for loop in the first place assign an empty array
  19352. // in case there are no cookies at all. Also prevents odd result when
  19353. // calling $.cookie().
  19354. var cookies = document.cookie ? document.cookie.split('; ') : [];
  19355. for (var i = 0, l = cookies.length; i < l; i++) {
  19356. var parts = cookies[i].split('=');
  19357. var name = decode(parts.shift());
  19358. var cookie = parts.join('=');
  19359. if (key && key === name) {
  19360. // If second argument (value) is a function it's a converter...
  19361. result = read(cookie, value);
  19362. break;
  19363. }
  19364. // Prevent storing a cookie that we couldn't decode.
  19365. if (!key && (cookie = read(cookie)) !== undefined) {
  19366. result[name] = cookie;
  19367. }
  19368. }
  19369. return result;
  19370. };
  19371. config.defaults = {};
  19372. $.removeCookie = function (key, options) {
  19373. if ($.cookie(key) === undefined) {
  19374. return false;
  19375. }
  19376. // Must not alter options, thus extending a fresh object...
  19377. $.cookie(key, '', $.extend({}, options, { expires: -1 }));
  19378. return !$.cookie(key);
  19379. };
  19380. }));
  19381. // ----------------- jQuery Waypoints v2.0.5 -------------------------------- //
  19382. // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
  19383. // -------------------------------------------------------------------------- //
  19384. (function() {
  19385. 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; },
  19386. __slice = [].slice;
  19387. (function(root, factory) {
  19388. if (typeof define === 'function' && define.amd) {
  19389. return define('waypoints', ['jquery'], function($) {
  19390. return factory($, root);
  19391. });
  19392. } else {
  19393. return factory(root.jQuery, root);
  19394. }
  19395. })(window, function($, window) {
  19396. var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
  19397. $w = $(window);
  19398. isTouch = __indexOf.call(window, 'ontouchstart') >= 0;
  19399. allWaypoints = {
  19400. horizontal: {},
  19401. vertical: {}
  19402. };
  19403. contextCounter = 1;
  19404. contexts = {};
  19405. contextKey = 'waypoints-context-id';
  19406. resizeEvent = 'resize.waypoints';
  19407. scrollEvent = 'scroll.waypoints';
  19408. waypointCounter = 1;
  19409. waypointKey = 'waypoints-waypoint-ids';
  19410. wp = 'waypoint';
  19411. wps = 'waypoints';
  19412. Context = (function() {
  19413. function Context($element) {
  19414. var _this = this;
  19415. this.$element = $element;
  19416. this.element = $element[0];
  19417. this.didResize = false;
  19418. this.didScroll = false;
  19419. this.id = 'context' + contextCounter++;
  19420. this.oldScroll = {
  19421. x: $element.scrollLeft(),
  19422. y: $element.scrollTop()
  19423. };
  19424. this.waypoints = {
  19425. horizontal: {},
  19426. vertical: {}
  19427. };
  19428. this.element[contextKey] = this.id;
  19429. contexts[this.id] = this;
  19430. $element.bind(scrollEvent, function() {
  19431. var scrollHandler;
  19432. if (!(_this.didScroll || isTouch)) {
  19433. _this.didScroll = true;
  19434. scrollHandler = function() {
  19435. _this.doScroll();
  19436. return _this.didScroll = false;
  19437. };
  19438. return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
  19439. }
  19440. });
  19441. $element.bind(resizeEvent, function() {
  19442. var resizeHandler;
  19443. if (!_this.didResize) {
  19444. _this.didResize = true;
  19445. resizeHandler = function() {
  19446. $[wps]('refresh');
  19447. return _this.didResize = false;
  19448. };
  19449. return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
  19450. }
  19451. });
  19452. }
  19453. Context.prototype.doScroll = function() {
  19454. var axes,
  19455. _this = this;
  19456. axes = {
  19457. horizontal: {
  19458. newScroll: this.$element.scrollLeft(),
  19459. oldScroll: this.oldScroll.x,
  19460. forward: 'right',
  19461. backward: 'left'
  19462. },
  19463. vertical: {
  19464. newScroll: this.$element.scrollTop(),
  19465. oldScroll: this.oldScroll.y,
  19466. forward: 'down',
  19467. backward: 'up'
  19468. }
  19469. };
  19470. if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) {
  19471. $[wps]('refresh');
  19472. }
  19473. $.each(axes, function(aKey, axis) {
  19474. var direction, isForward, triggered;
  19475. triggered = [];
  19476. isForward = axis.newScroll > axis.oldScroll;
  19477. direction = isForward ? axis.forward : axis.backward;
  19478. $.each(_this.waypoints[aKey], function(wKey, waypoint) {
  19479. var _ref, _ref1;
  19480. if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) {
  19481. return triggered.push(waypoint);
  19482. } else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) {
  19483. return triggered.push(waypoint);
  19484. }
  19485. });
  19486. triggered.sort(function(a, b) {
  19487. return a.offset - b.offset;
  19488. });
  19489. if (!isForward) {
  19490. triggered.reverse();
  19491. }
  19492. return $.each(triggered, function(i, waypoint) {
  19493. if (waypoint.options.continuous || i === triggered.length - 1) {
  19494. return waypoint.trigger([direction]);
  19495. }
  19496. });
  19497. });
  19498. return this.oldScroll = {
  19499. x: axes.horizontal.newScroll,
  19500. y: axes.vertical.newScroll
  19501. };
  19502. };
  19503. Context.prototype.refresh = function() {
  19504. var axes, cOffset, isWin,
  19505. _this = this;
  19506. isWin = $.isWindow(this.element);
  19507. cOffset = this.$element.offset();
  19508. this.doScroll();
  19509. axes = {
  19510. horizontal: {
  19511. contextOffset: isWin ? 0 : cOffset.left,
  19512. contextScroll: isWin ? 0 : this.oldScroll.x,
  19513. contextDimension: this.$element.width(),
  19514. oldScroll: this.oldScroll.x,
  19515. forward: 'right',
  19516. backward: 'left',
  19517. offsetProp: 'left'
  19518. },
  19519. vertical: {
  19520. contextOffset: isWin ? 0 : cOffset.top,
  19521. contextScroll: isWin ? 0 : this.oldScroll.y,
  19522. contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(),
  19523. oldScroll: this.oldScroll.y,
  19524. forward: 'down',
  19525. backward: 'up',
  19526. offsetProp: 'top'
  19527. }
  19528. };
  19529. return $.each(axes, function(aKey, axis) {
  19530. return $.each(_this.waypoints[aKey], function(i, waypoint) {
  19531. var adjustment, elementOffset, oldOffset, _ref, _ref1;
  19532. adjustment = waypoint.options.offset;
  19533. oldOffset = waypoint.offset;
  19534. elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp];
  19535. if ($.isFunction(adjustment)) {
  19536. adjustment = adjustment.apply(waypoint.element);
  19537. } else if (typeof adjustment === 'string') {
  19538. adjustment = parseFloat(adjustment);
  19539. if (waypoint.options.offset.indexOf('%') > -1) {
  19540. adjustment = Math.ceil(axis.contextDimension * adjustment / 100);
  19541. }
  19542. }
  19543. waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
  19544. if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) {
  19545. return;
  19546. }
  19547. if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) {
  19548. return waypoint.trigger([axis.backward]);
  19549. } else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) {
  19550. return waypoint.trigger([axis.forward]);
  19551. } else if (oldOffset === null && axis.oldScroll >= waypoint.offset) {
  19552. return waypoint.trigger([axis.forward]);
  19553. }
  19554. });
  19555. });
  19556. };
  19557. Context.prototype.checkEmpty = function() {
  19558. if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) {
  19559. this.$element.unbind([resizeEvent, scrollEvent].join(' '));
  19560. return delete contexts[this.id];
  19561. }
  19562. };
  19563. return Context;
  19564. })();
  19565. Waypoint = (function() {
  19566. function Waypoint($element, context, options) {
  19567. var idList, _ref;
  19568. if (options.offset === 'bottom-in-view') {
  19569. options.offset = function() {
  19570. var contextHeight;
  19571. contextHeight = $[wps]('viewportHeight');
  19572. if (!$.isWindow(context.element)) {
  19573. contextHeight = context.$element.height();
  19574. }
  19575. return contextHeight - $(this).outerHeight();
  19576. };
  19577. }
  19578. this.$element = $element;
  19579. this.element = $element[0];
  19580. this.axis = options.horizontal ? 'horizontal' : 'vertical';
  19581. this.callback = options.handler;
  19582. this.context = context;
  19583. this.enabled = options.enabled;
  19584. this.id = 'waypoints' + waypointCounter++;
  19585. this.offset = null;
  19586. this.options = options;
  19587. context.waypoints[this.axis][this.id] = this;
  19588. allWaypoints[this.axis][this.id] = this;
  19589. idList = (_ref = this.element[waypointKey]) != null ? _ref : [];
  19590. idList.push(this.id);
  19591. this.element[waypointKey] = idList;
  19592. }
  19593. Waypoint.prototype.trigger = function(args) {
  19594. if (!this.enabled) {
  19595. return;
  19596. }
  19597. if (this.callback != null) {
  19598. this.callback.apply(this.element, args);
  19599. }
  19600. if (this.options.triggerOnce) {
  19601. return this.destroy();
  19602. }
  19603. };
  19604. Waypoint.prototype.disable = function() {
  19605. return this.enabled = false;
  19606. };
  19607. Waypoint.prototype.enable = function() {
  19608. this.context.refresh();
  19609. return this.enabled = true;
  19610. };
  19611. Waypoint.prototype.destroy = function() {
  19612. delete allWaypoints[this.axis][this.id];
  19613. delete this.context.waypoints[this.axis][this.id];
  19614. return this.context.checkEmpty();
  19615. };
  19616. Waypoint.getWaypointsByElement = function(element) {
  19617. var all, ids;
  19618. ids = element[waypointKey];
  19619. if (!ids) {
  19620. return [];
  19621. }
  19622. all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
  19623. return $.map(ids, function(id) {
  19624. return all[id];
  19625. });
  19626. };
  19627. return Waypoint;
  19628. })();
  19629. methods = {
  19630. init: function(f, options) {
  19631. var _ref;
  19632. options = $.extend({}, $.fn[wp].defaults, options);
  19633. if ((_ref = options.handler) == null) {
  19634. options.handler = f;
  19635. }
  19636. this.each(function() {
  19637. var $this, context, contextElement, _ref1;
  19638. $this = $(this);
  19639. contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context;
  19640. if (!$.isWindow(contextElement)) {
  19641. contextElement = $this.closest(contextElement);
  19642. }
  19643. contextElement = $(contextElement);
  19644. context = contexts[contextElement[0][contextKey]];
  19645. if (!context) {
  19646. context = new Context(contextElement);
  19647. }
  19648. return new Waypoint($this, context, options);
  19649. });
  19650. $[wps]('refresh');
  19651. return this;
  19652. },
  19653. disable: function() {
  19654. return methods._invoke.call(this, 'disable');
  19655. },
  19656. enable: function() {
  19657. return methods._invoke.call(this, 'enable');
  19658. },
  19659. destroy: function() {
  19660. return methods._invoke.call(this, 'destroy');
  19661. },
  19662. prev: function(axis, selector) {
  19663. return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
  19664. if (index > 0) {
  19665. return stack.push(waypoints[index - 1]);
  19666. }
  19667. });
  19668. },
  19669. next: function(axis, selector) {
  19670. return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
  19671. if (index < waypoints.length - 1) {
  19672. return stack.push(waypoints[index + 1]);
  19673. }
  19674. });
  19675. },
  19676. _traverse: function(axis, selector, push) {
  19677. var stack, waypoints;
  19678. if (axis == null) {
  19679. axis = 'vertical';
  19680. }
  19681. if (selector == null) {
  19682. selector = window;
  19683. }
  19684. waypoints = jQMethods.aggregate(selector);
  19685. stack = [];
  19686. this.each(function() {
  19687. var index;
  19688. index = $.inArray(this, waypoints[axis]);
  19689. return push(stack, index, waypoints[axis]);
  19690. });
  19691. return this.pushStack(stack);
  19692. },
  19693. _invoke: function(method) {
  19694. this.each(function() {
  19695. var waypoints;
  19696. waypoints = Waypoint.getWaypointsByElement(this);
  19697. return $.each(waypoints, function(i, waypoint) {
  19698. waypoint[method]();
  19699. return true;
  19700. });
  19701. });
  19702. return this;
  19703. }
  19704. };
  19705. $.fn[wp] = function() {
  19706. var args, method;
  19707. method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  19708. if (methods[method]) {
  19709. return methods[method].apply(this, args);
  19710. } else if ($.isFunction(method)) {
  19711. return methods.init.apply(this, arguments);
  19712. } else if ($.isPlainObject(method)) {
  19713. return methods.init.apply(this, [null, method]);
  19714. } else if (!method) {
  19715. return $.error("jQuery Waypoints needs a callback function or handler option.");
  19716. } else {
  19717. return $.error("The " + method + " method does not exist in jQuery Waypoints.");
  19718. }
  19719. };
  19720. $.fn[wp].defaults = {
  19721. context: window,
  19722. continuous: true,
  19723. enabled: true,
  19724. horizontal: false,
  19725. offset: 0,
  19726. triggerOnce: false
  19727. };
  19728. jQMethods = {
  19729. refresh: function() {
  19730. return $.each(contexts, function(i, context) {
  19731. return context.refresh();
  19732. });
  19733. },
  19734. viewportHeight: function() {
  19735. var _ref;
  19736. return (_ref = window.innerHeight) != null ? _ref : $w.height();
  19737. },
  19738. aggregate: function(contextSelector) {
  19739. var collection, waypoints, _ref;
  19740. collection = allWaypoints;
  19741. if (contextSelector) {
  19742. collection = (_ref = contexts[$(contextSelector)[0][contextKey]]) != null ? _ref.waypoints : void 0;
  19743. }
  19744. if (!collection) {
  19745. return [];
  19746. }
  19747. waypoints = {
  19748. horizontal: [],
  19749. vertical: []
  19750. };
  19751. $.each(waypoints, function(axis, arr) {
  19752. $.each(collection[axis], function(key, waypoint) {
  19753. return arr.push(waypoint);
  19754. });
  19755. arr.sort(function(a, b) {
  19756. return a.offset - b.offset;
  19757. });
  19758. waypoints[axis] = $.map(arr, function(waypoint) {
  19759. return waypoint.element;
  19760. });
  19761. return waypoints[axis] = $.unique(waypoints[axis]);
  19762. });
  19763. return waypoints;
  19764. },
  19765. above: function(contextSelector) {
  19766. if (contextSelector == null) {
  19767. contextSelector = window;
  19768. }
  19769. return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
  19770. return waypoint.offset <= context.oldScroll.y;
  19771. });
  19772. },
  19773. below: function(contextSelector) {
  19774. if (contextSelector == null) {
  19775. contextSelector = window;
  19776. }
  19777. return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
  19778. return waypoint.offset > context.oldScroll.y;
  19779. });
  19780. },
  19781. left: function(contextSelector) {
  19782. if (contextSelector == null) {
  19783. contextSelector = window;
  19784. }
  19785. return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
  19786. return waypoint.offset <= context.oldScroll.x;
  19787. });
  19788. },
  19789. right: function(contextSelector) {
  19790. if (contextSelector == null) {
  19791. contextSelector = window;
  19792. }
  19793. return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
  19794. return waypoint.offset > context.oldScroll.x;
  19795. });
  19796. },
  19797. enable: function() {
  19798. return jQMethods._invoke('enable');
  19799. },
  19800. disable: function() {
  19801. return jQMethods._invoke('disable');
  19802. },
  19803. destroy: function() {
  19804. return jQMethods._invoke('destroy');
  19805. },
  19806. extendFn: function(methodName, f) {
  19807. return methods[methodName] = f;
  19808. },
  19809. _invoke: function(method) {
  19810. var waypoints;
  19811. waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
  19812. return $.each(waypoints, function(key, waypoint) {
  19813. waypoint[method]();
  19814. return true;
  19815. });
  19816. },
  19817. _filter: function(selector, axis, test) {
  19818. var context, waypoints;
  19819. context = contexts[$(selector)[0][contextKey]];
  19820. if (!context) {
  19821. return [];
  19822. }
  19823. waypoints = [];
  19824. $.each(context.waypoints[axis], function(i, waypoint) {
  19825. if (test(context, waypoint)) {
  19826. return waypoints.push(waypoint);
  19827. }
  19828. });
  19829. waypoints.sort(function(a, b) {
  19830. return a.offset - b.offset;
  19831. });
  19832. return $.map(waypoints, function(waypoint) {
  19833. return waypoint.element;
  19834. });
  19835. }
  19836. };
  19837. $[wps] = function() {
  19838. var args, method;
  19839. method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  19840. if (jQMethods[method]) {
  19841. return jQMethods[method].apply(null, args);
  19842. } else {
  19843. return jQMethods.aggregate.call(null, method);
  19844. }
  19845. };
  19846. $[wps].settings = {
  19847. resizeThrottle: 100,
  19848. scrollThrottle: 30
  19849. };
  19850. return $w.on('load.waypoints', function() {
  19851. return $[wps]('refresh');
  19852. });
  19853. });
  19854. }).call(this);
  19855. // ----------------- jQuery Github Embedder ----------------------------- //
  19856. // =========== https://github.com/kirbysayshi/ghembedder =============== //
  19857. // ---------------------------------------------------------------------- //
  19858. !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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};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)});
  19859. ghembedder.autoload();
  19860. ;jQuery(document).ready(function($){
  19861. var i = 0;
  19862. var box_title_png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAXCAMAAAAx3e/WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJERkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJFMEM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkREQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRFQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+dka2KgAAAEVQTFRFxMTEyMjI0tLSvb29vr6+zc3Ny8vLxcXFz8/P6enp3t7ex8fH0dHR1NTUw8PDwMDAzs7OvLy8wcHBu7u7v7+/zMzM////budQFwAAABd0Uk5T/////////////////////////////wDmQOZeAAAAcklEQVR42tSQSQ7DMAwD6chOukWs5eX/Ty2coo0T9wOdEzEgdRBuzNmnDofgja52JDyz5TCqUp0O6kfrb4bzSXkRiTviEZZ6JKLMJ5VQ2v8iGbtbfEwXmjFMG0VwdQo10hQNxYqtLMv9O6xvpZ/QeAkwAKjwHiJLaJc3AAAAAElFTkSuQmCC';
  19863. 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==';
  19864. $('.github-widget').each(function(){
  19865. if(i == 0) $('head').append(
  19866. '<style type="text/css">'
  19867. +'.github-box *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}'
  19868. +'.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}'
  19869. +'.github-box a{color:#4183c4;border:0;text-decoration:none}'
  19870. +'.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);}'
  19871. +'.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;}'
  19872. +'.github-box .github-box-title h3 .repo{font-weight:bold}'
  19873. +'.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}'
  19874. +'.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}'
  19875. +'.github-box .github-box-title .github-stats .watchers{border-right:1px solid #ddd}'
  19876. +'.github-box .github-box-title .github-stats .forks{background-position:-4px -21px;padding-left:15px}'
  19877. +'.github-box .github-box-content{padding:10px;font-weight:300}'
  19878. +'.github-box .github-box-content p{margin:0}'
  19879. +'.github-box .github-box-content .link{font-weight:bold}'
  19880. +'.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;}'
  19881. +'.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}'
  19882. +'.github-box .github-box-download .updated strong{font-weight:bold;color:#000}'
  19883. +'.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);}'
  19884. +'.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);}'
  19885. +'@media (max-width: 767px) {'
  19886. +'.github-box .github-box-title{height:auto;min-height:60px}'
  19887. +'.github-box .github-box-title h3 .repo{display:block}'
  19888. +'.github-box .github-box-title .github-stats a{display:block;clear:right;float:right;}'
  19889. +'.github-box .github-box-download{height:auto;min-height:46px;}'
  19890. +'.github-box .github-box-download .download{top:32px;}'
  19891. +'}'
  19892. +'</style>'
  19893. );
  19894. i++;
  19895. var $container = $(this), $widget,
  19896. repo = $container.data('repo'),
  19897. vendorName = repo.split('/')[0],
  19898. repoName = repo.split('/')[1],
  19899. vendorUrl = "http://github.com/" + vendorName,
  19900. repoUrl = "http://github.com/" + vendorName + '/' + repoName;
  19901. $widget = $(
  19902. '<div class="github-box repo">'
  19903. +'<div class="github-box-title">'
  19904. +'<h3>'
  19905. +'<a class="owner" href="' + vendorUrl + '" title="' + vendorUrl + '">' + vendorName + '</a>'
  19906. +'/'
  19907. +'<a class="repo" href="' + repoUrl + '" title="' + repoUrl + '">' + repoName + '</a>'
  19908. +'</h3>'
  19909. +'<div class="github-stats">'
  19910. +'<a class="watchers" href="' + repoUrl + '/watchers" title="See watchers">?</a>'
  19911. +'<a class="forks" href="' + repoUrl + '/network/members" title="See forkers">?</a>'
  19912. +'</div>'
  19913. +'</div>'
  19914. +'<div class="github-box-content">'
  19915. +'<p class="description"><span></span> &mdash; <a href="' + repoUrl + '#readme">Read More</a></p>'
  19916. +'<p class="link"></p>'
  19917. +'</div>'
  19918. +'<div class="github-box-download">'
  19919. +'<div class="updated"></div>'
  19920. +'<a class="download" href="' + repoUrl + '/zipball/master" title="Get an archive of this repository">Download as zip</a>'
  19921. +'</div>'
  19922. +'</div>'
  19923. );
  19924. $widget.appendTo($container);
  19925. $.ajax({
  19926. url: 'https://api.github.com/repos/' + repo,
  19927. dataType: 'jsonp',
  19928. success: function(results) {
  19929. var repo = results.data, date, pushed_at = 'unknown';
  19930. if (repo.pushed_at) {
  19931. date = new Date(repo.pushed_at);
  19932. pushed_at = (date.getMonth() + 1) + '-' + date.getDate() + '-' + date.getFullYear();
  19933. }
  19934. $widget.find('.watchers').text(repo.watchers);
  19935. $widget.find('.forks').text(repo.forks);
  19936. $widget.find('.description span').text(repo.description);
  19937. $widget.find('.updated').html('Latest commit to the <strong>' + repo.default_branch + '</strong> branch on ' + pushed_at);
  19938. // Don't show "null" if the repo has no homepage URL.
  19939. if(repo.homepage != null) $widget.find('.link').append($('<a />').attr('href', repo.homepage).text(repo.homepage));
  19940. }
  19941. });
  19942. });
  19943. });
  19944. // ----------------- JavaScript Cookie v2.2.0 ----------------------------- //
  19945. // =========== https://github.com/js-cookie/js-cookie =============== //
  19946. // ---------------------------------------------------------------------- //
  19947. ;(function (factory) {
  19948. var registeredInModuleLoader;
  19949. if (typeof define === 'function' && define.amd) {
  19950. define(factory);
  19951. registeredInModuleLoader = true;
  19952. }
  19953. if (typeof exports === 'object') {
  19954. module.exports = factory();
  19955. registeredInModuleLoader = true;
  19956. }
  19957. if (!registeredInModuleLoader) {
  19958. var OldCookies = window.Cookies;
  19959. var api = window.Cookies = factory();
  19960. api.noConflict = function () {
  19961. window.Cookies = OldCookies;
  19962. return api;
  19963. };
  19964. }
  19965. }(function () {
  19966. function extend () {
  19967. var i = 0;
  19968. var result = {};
  19969. for (; i < arguments.length; i++) {
  19970. var attributes = arguments[ i ];
  19971. for (var key in attributes) {
  19972. result[key] = attributes[key];
  19973. }
  19974. }
  19975. return result;
  19976. }
  19977. function decode (s) {
  19978. return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
  19979. }
  19980. function init (converter) {
  19981. function api() {}
  19982. function set (key, value, attributes) {
  19983. if (typeof document === 'undefined') {
  19984. return;
  19985. }
  19986. attributes = extend({
  19987. path: '/'
  19988. }, api.defaults, attributes);
  19989. if (typeof attributes.expires === 'number') {
  19990. attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
  19991. }
  19992. // We're using "expires" because "max-age" is not supported by IE
  19993. attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
  19994. try {
  19995. var result = JSON.stringify(value);
  19996. if (/^[\{\[]/.test(result)) {
  19997. value = result;
  19998. }
  19999. } catch (e) {}
  20000. value = converter.write ?
  20001. converter.write(value, key) :
  20002. encodeURIComponent(String(value))
  20003. .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
  20004. key = encodeURIComponent(String(key))
  20005. .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
  20006. .replace(/[\(\)]/g, escape);
  20007. var stringifiedAttributes = '';
  20008. for (var attributeName in attributes) {
  20009. if (!attributes[attributeName]) {
  20010. continue;
  20011. }
  20012. stringifiedAttributes += '; ' + attributeName;
  20013. if (attributes[attributeName] === true) {
  20014. continue;
  20015. }
  20016. // Considers RFC 6265 section 5.2:
  20017. // ...
  20018. // 3. If the remaining unparsed-attributes contains a %x3B (";")
  20019. // character:
  20020. // Consume the characters of the unparsed-attributes up to,
  20021. // not including, the first %x3B (";") character.
  20022. // ...
  20023. stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
  20024. }
  20025. return (document.cookie = key + '=' + value + stringifiedAttributes);
  20026. }
  20027. function get (key, json) {
  20028. if (typeof document === 'undefined') {
  20029. return;
  20030. }
  20031. var jar = {};
  20032. // To prevent the for loop in the first place assign an empty array
  20033. // in case there are no cookies at all.
  20034. var cookies = document.cookie ? document.cookie.split('; ') : [];
  20035. var i = 0;
  20036. for (; i < cookies.length; i++) {
  20037. var parts = cookies[i].split('=');
  20038. var cookie = parts.slice(1).join('=');
  20039. if (!json && cookie.charAt(0) === '"') {
  20040. cookie = cookie.slice(1, -1);
  20041. }
  20042. try {
  20043. var name = decode(parts[0]);
  20044. cookie = (converter.read || converter)(cookie, name) ||
  20045. decode(cookie);
  20046. if (json) {
  20047. try {
  20048. cookie = JSON.parse(cookie);
  20049. } catch (e) {}
  20050. }
  20051. jar[name] = cookie;
  20052. if (key === name) {
  20053. break;
  20054. }
  20055. } catch (e) {}
  20056. }
  20057. return key ? jar[key] : jar;
  20058. }
  20059. api.set = set;
  20060. api.get = function (key) {
  20061. return get(key, false /* read as raw */);
  20062. };
  20063. api.getJSON = function (key) {
  20064. return get(key, true /* read as json */);
  20065. };
  20066. api.remove = function (key, attributes) {
  20067. set(key, '', extend(attributes, {
  20068. expires: -1
  20069. }));
  20070. };
  20071. api.defaults = {};
  20072. api.withConverter = init;
  20073. return api;
  20074. }
  20075. return init(function () {});
  20076. }));