rails_admin-de8ddf07b5b5bf68081f73513820639ac44f8ecea92b85a745bda1930721d3ff.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574
  1. /*!
  2. * jQuery JavaScript Library v1.12.4
  3. * http://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * http://sizzlejs.com/
  7. *
  8. * Copyright jQuery Foundation and other contributors
  9. * Released under the MIT license
  10. * http://jquery.org/license
  11. *
  12. * Date: 2016-05-20T17:17Z
  13. */
  14. (function( global, factory ) {
  15. if ( typeof module === "object" && typeof module.exports === "object" ) {
  16. // For CommonJS and CommonJS-like environments where a proper `window`
  17. // is present, execute the factory and get jQuery.
  18. // For environments that do not have a `window` with a `document`
  19. // (such as Node.js), expose a factory as module.exports.
  20. // This accentuates the need for the creation of a real `window`.
  21. // e.g. var jQuery = require("jquery")(window);
  22. // See ticket #14549 for more info.
  23. module.exports = global.document ?
  24. factory( global, true ) :
  25. function( w ) {
  26. if ( !w.document ) {
  27. throw new Error( "jQuery requires a window with a document" );
  28. }
  29. return factory( w );
  30. };
  31. } else {
  32. factory( global );
  33. }
  34. // Pass this if window is not defined yet
  35. }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  36. // Support: Firefox 18+
  37. // Can't be in strict mode, several libs including ASP.NET trace
  38. // the stack via arguments.caller.callee and Firefox dies if
  39. // you try to trace through "use strict" call chains. (#13335)
  40. //"use strict";
  41. var deletedIds = [];
  42. var document = window.document;
  43. var slice = deletedIds.slice;
  44. var concat = deletedIds.concat;
  45. var push = deletedIds.push;
  46. var indexOf = deletedIds.indexOf;
  47. var class2type = {};
  48. var toString = class2type.toString;
  49. var hasOwn = class2type.hasOwnProperty;
  50. var support = {};
  51. var
  52. version = "1.12.4",
  53. // Define a local copy of jQuery
  54. jQuery = function( selector, context ) {
  55. // The jQuery object is actually just the init constructor 'enhanced'
  56. // Need init if jQuery is called (just allow error to be thrown if not included)
  57. return new jQuery.fn.init( selector, context );
  58. },
  59. // Support: Android<4.1, IE<9
  60. // Make sure we trim BOM and NBSP
  61. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  62. // Matches dashed string for camelizing
  63. rmsPrefix = /^-ms-/,
  64. rdashAlpha = /-([\da-z])/gi,
  65. // Used by jQuery.camelCase as callback to replace()
  66. fcamelCase = function( all, letter ) {
  67. return letter.toUpperCase();
  68. };
  69. jQuery.fn = jQuery.prototype = {
  70. // The current version of jQuery being used
  71. jquery: version,
  72. constructor: jQuery,
  73. // Start with an empty selector
  74. selector: "",
  75. // The default length of a jQuery object is 0
  76. length: 0,
  77. toArray: function() {
  78. return slice.call( this );
  79. },
  80. // Get the Nth element in the matched element set OR
  81. // Get the whole matched element set as a clean array
  82. get: function( num ) {
  83. return num != null ?
  84. // Return just the one element from the set
  85. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  86. // Return all the elements in a clean array
  87. slice.call( this );
  88. },
  89. // Take an array of elements and push it onto the stack
  90. // (returning the new matched element set)
  91. pushStack: function( elems ) {
  92. // Build a new jQuery matched element set
  93. var ret = jQuery.merge( this.constructor(), elems );
  94. // Add the old object onto the stack (as a reference)
  95. ret.prevObject = this;
  96. ret.context = this.context;
  97. // Return the newly-formed element set
  98. return ret;
  99. },
  100. // Execute a callback for every element in the matched set.
  101. each: function( callback ) {
  102. return jQuery.each( this, callback );
  103. },
  104. map: function( callback ) {
  105. return this.pushStack( jQuery.map( this, function( elem, i ) {
  106. return callback.call( elem, i, elem );
  107. } ) );
  108. },
  109. slice: function() {
  110. return this.pushStack( slice.apply( this, arguments ) );
  111. },
  112. first: function() {
  113. return this.eq( 0 );
  114. },
  115. last: function() {
  116. return this.eq( -1 );
  117. },
  118. eq: function( i ) {
  119. var len = this.length,
  120. j = +i + ( i < 0 ? len : 0 );
  121. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  122. },
  123. end: function() {
  124. return this.prevObject || this.constructor();
  125. },
  126. // For internal use only.
  127. // Behaves like an Array's method, not like a jQuery method.
  128. push: push,
  129. sort: deletedIds.sort,
  130. splice: deletedIds.splice
  131. };
  132. jQuery.extend = jQuery.fn.extend = function() {
  133. var src, copyIsArray, copy, name, options, clone,
  134. target = arguments[ 0 ] || {},
  135. i = 1,
  136. length = arguments.length,
  137. deep = false;
  138. // Handle a deep copy situation
  139. if ( typeof target === "boolean" ) {
  140. deep = target;
  141. // skip the boolean and the target
  142. target = arguments[ i ] || {};
  143. i++;
  144. }
  145. // Handle case when target is a string or something (possible in deep copy)
  146. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  147. target = {};
  148. }
  149. // extend jQuery itself if only one argument is passed
  150. if ( i === length ) {
  151. target = this;
  152. i--;
  153. }
  154. for ( ; i < length; i++ ) {
  155. // Only deal with non-null/undefined values
  156. if ( ( options = arguments[ i ] ) != null ) {
  157. // Extend the base object
  158. for ( name in options ) {
  159. src = target[ name ];
  160. copy = options[ name ];
  161. // Prevent never-ending loop
  162. if ( target === copy ) {
  163. continue;
  164. }
  165. // Recurse if we're merging plain objects or arrays
  166. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  167. ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
  168. if ( copyIsArray ) {
  169. copyIsArray = false;
  170. clone = src && jQuery.isArray( src ) ? src : [];
  171. } else {
  172. clone = src && jQuery.isPlainObject( src ) ? src : {};
  173. }
  174. // Never move original objects, clone them
  175. target[ name ] = jQuery.extend( deep, clone, copy );
  176. // Don't bring in undefined values
  177. } else if ( copy !== undefined ) {
  178. target[ name ] = copy;
  179. }
  180. }
  181. }
  182. }
  183. // Return the modified object
  184. return target;
  185. };
  186. jQuery.extend( {
  187. // Unique for each copy of jQuery on the page
  188. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  189. // Assume jQuery is ready without the ready module
  190. isReady: true,
  191. error: function( msg ) {
  192. throw new Error( msg );
  193. },
  194. noop: function() {},
  195. // See test/unit/core.js for details concerning isFunction.
  196. // Since version 1.3, DOM methods and functions like alert
  197. // aren't supported. They return false on IE (#2968).
  198. isFunction: function( obj ) {
  199. return jQuery.type( obj ) === "function";
  200. },
  201. isArray: Array.isArray || function( obj ) {
  202. return jQuery.type( obj ) === "array";
  203. },
  204. isWindow: function( obj ) {
  205. /* jshint eqeqeq: false */
  206. return obj != null && obj == obj.window;
  207. },
  208. isNumeric: function( obj ) {
  209. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  210. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  211. // subtraction forces infinities to NaN
  212. // adding 1 corrects loss of precision from parseFloat (#15100)
  213. var realStringObj = obj && obj.toString();
  214. return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
  215. },
  216. isEmptyObject: function( obj ) {
  217. var name;
  218. for ( name in obj ) {
  219. return false;
  220. }
  221. return true;
  222. },
  223. isPlainObject: function( obj ) {
  224. var key;
  225. // Must be an Object.
  226. // Because of IE, we also have to check the presence of the constructor property.
  227. // Make sure that DOM nodes and window objects don't pass through, as well
  228. if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  229. return false;
  230. }
  231. try {
  232. // Not own constructor property must be Object
  233. if ( obj.constructor &&
  234. !hasOwn.call( obj, "constructor" ) &&
  235. !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
  236. return false;
  237. }
  238. } catch ( e ) {
  239. // IE8,9 Will throw exceptions on certain host objects #9897
  240. return false;
  241. }
  242. // Support: IE<9
  243. // Handle iteration over inherited properties before own properties.
  244. if ( !support.ownFirst ) {
  245. for ( key in obj ) {
  246. return hasOwn.call( obj, key );
  247. }
  248. }
  249. // Own properties are enumerated firstly, so to speed up,
  250. // if last one is own, then all properties are own.
  251. for ( key in obj ) {}
  252. return key === undefined || hasOwn.call( obj, key );
  253. },
  254. type: function( obj ) {
  255. if ( obj == null ) {
  256. return obj + "";
  257. }
  258. return typeof obj === "object" || typeof obj === "function" ?
  259. class2type[ toString.call( obj ) ] || "object" :
  260. typeof obj;
  261. },
  262. // Workarounds based on findings by Jim Driscoll
  263. // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
  264. globalEval: function( data ) {
  265. if ( data && jQuery.trim( data ) ) {
  266. // We use execScript on Internet Explorer
  267. // We use an anonymous function so that context is window
  268. // rather than jQuery in Firefox
  269. ( window.execScript || function( data ) {
  270. window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
  271. } )( data );
  272. }
  273. },
  274. // Convert dashed to camelCase; used by the css and data modules
  275. // Microsoft forgot to hump their vendor prefix (#9572)
  276. camelCase: function( string ) {
  277. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  278. },
  279. nodeName: function( elem, name ) {
  280. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  281. },
  282. each: function( obj, callback ) {
  283. var length, i = 0;
  284. if ( isArrayLike( obj ) ) {
  285. length = obj.length;
  286. for ( ; i < length; i++ ) {
  287. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  288. break;
  289. }
  290. }
  291. } else {
  292. for ( i in obj ) {
  293. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  294. break;
  295. }
  296. }
  297. }
  298. return obj;
  299. },
  300. // Support: Android<4.1, IE<9
  301. trim: function( text ) {
  302. return text == null ?
  303. "" :
  304. ( text + "" ).replace( rtrim, "" );
  305. },
  306. // results is for internal usage only
  307. makeArray: function( arr, results ) {
  308. var ret = results || [];
  309. if ( arr != null ) {
  310. if ( isArrayLike( Object( arr ) ) ) {
  311. jQuery.merge( ret,
  312. typeof arr === "string" ?
  313. [ arr ] : arr
  314. );
  315. } else {
  316. push.call( ret, arr );
  317. }
  318. }
  319. return ret;
  320. },
  321. inArray: function( elem, arr, i ) {
  322. var len;
  323. if ( arr ) {
  324. if ( indexOf ) {
  325. return indexOf.call( arr, elem, i );
  326. }
  327. len = arr.length;
  328. i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
  329. for ( ; i < len; i++ ) {
  330. // Skip accessing in sparse arrays
  331. if ( i in arr && arr[ i ] === elem ) {
  332. return i;
  333. }
  334. }
  335. }
  336. return -1;
  337. },
  338. merge: function( first, second ) {
  339. var len = +second.length,
  340. j = 0,
  341. i = first.length;
  342. while ( j < len ) {
  343. first[ i++ ] = second[ j++ ];
  344. }
  345. // Support: IE<9
  346. // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
  347. if ( len !== len ) {
  348. while ( second[ j ] !== undefined ) {
  349. first[ i++ ] = second[ j++ ];
  350. }
  351. }
  352. first.length = i;
  353. return first;
  354. },
  355. grep: function( elems, callback, invert ) {
  356. var callbackInverse,
  357. matches = [],
  358. i = 0,
  359. length = elems.length,
  360. callbackExpect = !invert;
  361. // Go through the array, only saving the items
  362. // that pass the validator function
  363. for ( ; i < length; i++ ) {
  364. callbackInverse = !callback( elems[ i ], i );
  365. if ( callbackInverse !== callbackExpect ) {
  366. matches.push( elems[ i ] );
  367. }
  368. }
  369. return matches;
  370. },
  371. // arg is for internal usage only
  372. map: function( elems, callback, arg ) {
  373. var length, value,
  374. i = 0,
  375. ret = [];
  376. // Go through the array, translating each of the items to their new values
  377. if ( isArrayLike( elems ) ) {
  378. length = elems.length;
  379. for ( ; i < length; i++ ) {
  380. value = callback( elems[ i ], i, arg );
  381. if ( value != null ) {
  382. ret.push( value );
  383. }
  384. }
  385. // Go through every key on the object,
  386. } else {
  387. for ( i in elems ) {
  388. value = callback( elems[ i ], i, arg );
  389. if ( value != null ) {
  390. ret.push( value );
  391. }
  392. }
  393. }
  394. // Flatten any nested arrays
  395. return concat.apply( [], ret );
  396. },
  397. // A global GUID counter for objects
  398. guid: 1,
  399. // Bind a function to a context, optionally partially applying any
  400. // arguments.
  401. proxy: function( fn, context ) {
  402. var args, proxy, tmp;
  403. if ( typeof context === "string" ) {
  404. tmp = fn[ context ];
  405. context = fn;
  406. fn = tmp;
  407. }
  408. // Quick check to determine if target is callable, in the spec
  409. // this throws a TypeError, but we will just return undefined.
  410. if ( !jQuery.isFunction( fn ) ) {
  411. return undefined;
  412. }
  413. // Simulated bind
  414. args = slice.call( arguments, 2 );
  415. proxy = function() {
  416. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  417. };
  418. // Set the guid of unique handler to the same of original handler, so it can be removed
  419. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  420. return proxy;
  421. },
  422. now: function() {
  423. return +( new Date() );
  424. },
  425. // jQuery.support is not used in Core but other projects attach their
  426. // properties to it so it needs to exist.
  427. support: support
  428. } );
  429. // JSHint would error on this code due to the Symbol not being defined in ES5.
  430. // Defining this global in .jshintrc would create a danger of using the global
  431. // unguarded in another place, it seems safer to just disable JSHint for these
  432. // three lines.
  433. /* jshint ignore: start */
  434. if ( typeof Symbol === "function" ) {
  435. jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
  436. }
  437. /* jshint ignore: end */
  438. // Populate the class2type map
  439. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  440. function( i, name ) {
  441. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  442. } );
  443. function isArrayLike( obj ) {
  444. // Support: iOS 8.2 (not reproducible in simulator)
  445. // `in` check used to prevent JIT error (gh-2145)
  446. // hasOwn isn't used here due to false negatives
  447. // regarding Nodelist length in IE
  448. var length = !!obj && "length" in obj && obj.length,
  449. type = jQuery.type( obj );
  450. if ( type === "function" || jQuery.isWindow( obj ) ) {
  451. return false;
  452. }
  453. return type === "array" || length === 0 ||
  454. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  455. }
  456. var Sizzle =
  457. /*!
  458. * Sizzle CSS Selector Engine v2.2.1
  459. * http://sizzlejs.com/
  460. *
  461. * Copyright jQuery Foundation and other contributors
  462. * Released under the MIT license
  463. * http://jquery.org/license
  464. *
  465. * Date: 2015-10-17
  466. */
  467. (function( window ) {
  468. var i,
  469. support,
  470. Expr,
  471. getText,
  472. isXML,
  473. tokenize,
  474. compile,
  475. select,
  476. outermostContext,
  477. sortInput,
  478. hasDuplicate,
  479. // Local document vars
  480. setDocument,
  481. document,
  482. docElem,
  483. documentIsHTML,
  484. rbuggyQSA,
  485. rbuggyMatches,
  486. matches,
  487. contains,
  488. // Instance-specific data
  489. expando = "sizzle" + 1 * new Date(),
  490. preferredDoc = window.document,
  491. dirruns = 0,
  492. done = 0,
  493. classCache = createCache(),
  494. tokenCache = createCache(),
  495. compilerCache = createCache(),
  496. sortOrder = function( a, b ) {
  497. if ( a === b ) {
  498. hasDuplicate = true;
  499. }
  500. return 0;
  501. },
  502. // General-purpose constants
  503. MAX_NEGATIVE = 1 << 31,
  504. // Instance methods
  505. hasOwn = ({}).hasOwnProperty,
  506. arr = [],
  507. pop = arr.pop,
  508. push_native = arr.push,
  509. push = arr.push,
  510. slice = arr.slice,
  511. // Use a stripped-down indexOf as it's faster than native
  512. // http://jsperf.com/thor-indexof-vs-for/5
  513. indexOf = function( list, elem ) {
  514. var i = 0,
  515. len = list.length;
  516. for ( ; i < len; i++ ) {
  517. if ( list[i] === elem ) {
  518. return i;
  519. }
  520. }
  521. return -1;
  522. },
  523. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  524. // Regular expressions
  525. // http://www.w3.org/TR/css3-selectors/#whitespace
  526. whitespace = "[\\x20\\t\\r\\n\\f]",
  527. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  528. identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  529. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  530. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  531. // Operator (capture 2)
  532. "*([*^$|!~]?=)" + whitespace +
  533. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  534. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  535. "*\\]",
  536. pseudos = ":(" + identifier + ")(?:\\((" +
  537. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  538. // 1. quoted (capture 3; capture 4 or capture 5)
  539. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  540. // 2. simple (capture 6)
  541. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  542. // 3. anything else (capture 2)
  543. ".*" +
  544. ")\\)|)",
  545. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  546. rwhitespace = new RegExp( whitespace + "+", "g" ),
  547. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  548. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  549. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  550. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  551. rpseudo = new RegExp( pseudos ),
  552. ridentifier = new RegExp( "^" + identifier + "$" ),
  553. matchExpr = {
  554. "ID": new RegExp( "^#(" + identifier + ")" ),
  555. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  556. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  557. "ATTR": new RegExp( "^" + attributes ),
  558. "PSEUDO": new RegExp( "^" + pseudos ),
  559. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  560. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  561. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  562. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  563. // For use in libraries implementing .is()
  564. // We use this for POS matching in `select`
  565. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  566. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  567. },
  568. rinputs = /^(?:input|select|textarea|button)$/i,
  569. rheader = /^h\d$/i,
  570. rnative = /^[^{]+\{\s*\[native \w/,
  571. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  572. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  573. rsibling = /[+~]/,
  574. rescape = /'|\\/g,
  575. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  576. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  577. funescape = function( _, escaped, escapedWhitespace ) {
  578. var high = "0x" + escaped - 0x10000;
  579. // NaN means non-codepoint
  580. // Support: Firefox<24
  581. // Workaround erroneous numeric interpretation of +"0x"
  582. return high !== high || escapedWhitespace ?
  583. escaped :
  584. high < 0 ?
  585. // BMP codepoint
  586. String.fromCharCode( high + 0x10000 ) :
  587. // Supplemental Plane codepoint (surrogate pair)
  588. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  589. },
  590. // Used for iframes
  591. // See setDocument()
  592. // Removing the function wrapper causes a "Permission Denied"
  593. // error in IE
  594. unloadHandler = function() {
  595. setDocument();
  596. };
  597. // Optimize for push.apply( _, NodeList )
  598. try {
  599. push.apply(
  600. (arr = slice.call( preferredDoc.childNodes )),
  601. preferredDoc.childNodes
  602. );
  603. // Support: Android<4.0
  604. // Detect silently failing push.apply
  605. arr[ preferredDoc.childNodes.length ].nodeType;
  606. } catch ( e ) {
  607. push = { apply: arr.length ?
  608. // Leverage slice if possible
  609. function( target, els ) {
  610. push_native.apply( target, slice.call(els) );
  611. } :
  612. // Support: IE<9
  613. // Otherwise append directly
  614. function( target, els ) {
  615. var j = target.length,
  616. i = 0;
  617. // Can't trust NodeList.length
  618. while ( (target[j++] = els[i++]) ) {}
  619. target.length = j - 1;
  620. }
  621. };
  622. }
  623. function Sizzle( selector, context, results, seed ) {
  624. var m, i, elem, nid, nidselect, match, groups, newSelector,
  625. newContext = context && context.ownerDocument,
  626. // nodeType defaults to 9, since context defaults to document
  627. nodeType = context ? context.nodeType : 9;
  628. results = results || [];
  629. // Return early from calls with invalid selector or context
  630. if ( typeof selector !== "string" || !selector ||
  631. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  632. return results;
  633. }
  634. // Try to shortcut find operations (as opposed to filters) in HTML documents
  635. if ( !seed ) {
  636. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  637. setDocument( context );
  638. }
  639. context = context || document;
  640. if ( documentIsHTML ) {
  641. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  642. // (excepting DocumentFragment context, where the methods don't exist)
  643. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  644. // ID selector
  645. if ( (m = match[1]) ) {
  646. // Document context
  647. if ( nodeType === 9 ) {
  648. if ( (elem = context.getElementById( m )) ) {
  649. // Support: IE, Opera, Webkit
  650. // TODO: identify versions
  651. // getElementById can match elements by name instead of ID
  652. if ( elem.id === m ) {
  653. results.push( elem );
  654. return results;
  655. }
  656. } else {
  657. return results;
  658. }
  659. // Element context
  660. } else {
  661. // Support: IE, Opera, Webkit
  662. // TODO: identify versions
  663. // getElementById can match elements by name instead of ID
  664. if ( newContext && (elem = newContext.getElementById( m )) &&
  665. contains( context, elem ) &&
  666. elem.id === m ) {
  667. results.push( elem );
  668. return results;
  669. }
  670. }
  671. // Type selector
  672. } else if ( match[2] ) {
  673. push.apply( results, context.getElementsByTagName( selector ) );
  674. return results;
  675. // Class selector
  676. } else if ( (m = match[3]) && support.getElementsByClassName &&
  677. context.getElementsByClassName ) {
  678. push.apply( results, context.getElementsByClassName( m ) );
  679. return results;
  680. }
  681. }
  682. // Take advantage of querySelectorAll
  683. if ( support.qsa &&
  684. !compilerCache[ selector + " " ] &&
  685. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  686. if ( nodeType !== 1 ) {
  687. newContext = context;
  688. newSelector = selector;
  689. // qSA looks outside Element context, which is not what we want
  690. // Thanks to Andrew Dupont for this workaround technique
  691. // Support: IE <=8
  692. // Exclude object elements
  693. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  694. // Capture the context ID, setting it first if necessary
  695. if ( (nid = context.getAttribute( "id" )) ) {
  696. nid = nid.replace( rescape, "\\$&" );
  697. } else {
  698. context.setAttribute( "id", (nid = expando) );
  699. }
  700. // Prefix every selector in the list
  701. groups = tokenize( selector );
  702. i = groups.length;
  703. nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
  704. while ( i-- ) {
  705. groups[i] = nidselect + " " + toSelector( groups[i] );
  706. }
  707. newSelector = groups.join( "," );
  708. // Expand context for sibling selectors
  709. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  710. context;
  711. }
  712. if ( newSelector ) {
  713. try {
  714. push.apply( results,
  715. newContext.querySelectorAll( newSelector )
  716. );
  717. return results;
  718. } catch ( qsaError ) {
  719. } finally {
  720. if ( nid === expando ) {
  721. context.removeAttribute( "id" );
  722. }
  723. }
  724. }
  725. }
  726. }
  727. }
  728. // All others
  729. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  730. }
  731. /**
  732. * Create key-value caches of limited size
  733. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  734. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  735. * deleting the oldest entry
  736. */
  737. function createCache() {
  738. var keys = [];
  739. function cache( key, value ) {
  740. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  741. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  742. // Only keep the most recent entries
  743. delete cache[ keys.shift() ];
  744. }
  745. return (cache[ key + " " ] = value);
  746. }
  747. return cache;
  748. }
  749. /**
  750. * Mark a function for special use by Sizzle
  751. * @param {Function} fn The function to mark
  752. */
  753. function markFunction( fn ) {
  754. fn[ expando ] = true;
  755. return fn;
  756. }
  757. /**
  758. * Support testing using an element
  759. * @param {Function} fn Passed the created div and expects a boolean result
  760. */
  761. function assert( fn ) {
  762. var div = document.createElement("div");
  763. try {
  764. return !!fn( div );
  765. } catch (e) {
  766. return false;
  767. } finally {
  768. // Remove from its parent by default
  769. if ( div.parentNode ) {
  770. div.parentNode.removeChild( div );
  771. }
  772. // release memory in IE
  773. div = null;
  774. }
  775. }
  776. /**
  777. * Adds the same handler for all of the specified attrs
  778. * @param {String} attrs Pipe-separated list of attributes
  779. * @param {Function} handler The method that will be applied
  780. */
  781. function addHandle( attrs, handler ) {
  782. var arr = attrs.split("|"),
  783. i = arr.length;
  784. while ( i-- ) {
  785. Expr.attrHandle[ arr[i] ] = handler;
  786. }
  787. }
  788. /**
  789. * Checks document order of two siblings
  790. * @param {Element} a
  791. * @param {Element} b
  792. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  793. */
  794. function siblingCheck( a, b ) {
  795. var cur = b && a,
  796. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  797. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  798. ( ~a.sourceIndex || MAX_NEGATIVE );
  799. // Use IE sourceIndex if available on both nodes
  800. if ( diff ) {
  801. return diff;
  802. }
  803. // Check if b follows a
  804. if ( cur ) {
  805. while ( (cur = cur.nextSibling) ) {
  806. if ( cur === b ) {
  807. return -1;
  808. }
  809. }
  810. }
  811. return a ? 1 : -1;
  812. }
  813. /**
  814. * Returns a function to use in pseudos for input types
  815. * @param {String} type
  816. */
  817. function createInputPseudo( type ) {
  818. return function( elem ) {
  819. var name = elem.nodeName.toLowerCase();
  820. return name === "input" && elem.type === type;
  821. };
  822. }
  823. /**
  824. * Returns a function to use in pseudos for buttons
  825. * @param {String} type
  826. */
  827. function createButtonPseudo( type ) {
  828. return function( elem ) {
  829. var name = elem.nodeName.toLowerCase();
  830. return (name === "input" || name === "button") && elem.type === type;
  831. };
  832. }
  833. /**
  834. * Returns a function to use in pseudos for positionals
  835. * @param {Function} fn
  836. */
  837. function createPositionalPseudo( fn ) {
  838. return markFunction(function( argument ) {
  839. argument = +argument;
  840. return markFunction(function( seed, matches ) {
  841. var j,
  842. matchIndexes = fn( [], seed.length, argument ),
  843. i = matchIndexes.length;
  844. // Match elements found at the specified indexes
  845. while ( i-- ) {
  846. if ( seed[ (j = matchIndexes[i]) ] ) {
  847. seed[j] = !(matches[j] = seed[j]);
  848. }
  849. }
  850. });
  851. });
  852. }
  853. /**
  854. * Checks a node for validity as a Sizzle context
  855. * @param {Element|Object=} context
  856. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  857. */
  858. function testContext( context ) {
  859. return context && typeof context.getElementsByTagName !== "undefined" && context;
  860. }
  861. // Expose support vars for convenience
  862. support = Sizzle.support = {};
  863. /**
  864. * Detects XML nodes
  865. * @param {Element|Object} elem An element or a document
  866. * @returns {Boolean} True iff elem is a non-HTML XML node
  867. */
  868. isXML = Sizzle.isXML = function( elem ) {
  869. // documentElement is verified for cases where it doesn't yet exist
  870. // (such as loading iframes in IE - #4833)
  871. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  872. return documentElement ? documentElement.nodeName !== "HTML" : false;
  873. };
  874. /**
  875. * Sets document-related variables once based on the current document
  876. * @param {Element|Object} [doc] An element or document object to use to set the document
  877. * @returns {Object} Returns the current document
  878. */
  879. setDocument = Sizzle.setDocument = function( node ) {
  880. var hasCompare, parent,
  881. doc = node ? node.ownerDocument || node : preferredDoc;
  882. // Return early if doc is invalid or already selected
  883. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  884. return document;
  885. }
  886. // Update global variables
  887. document = doc;
  888. docElem = document.documentElement;
  889. documentIsHTML = !isXML( document );
  890. // Support: IE 9-11, Edge
  891. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  892. if ( (parent = document.defaultView) && parent.top !== parent ) {
  893. // Support: IE 11
  894. if ( parent.addEventListener ) {
  895. parent.addEventListener( "unload", unloadHandler, false );
  896. // Support: IE 9 - 10 only
  897. } else if ( parent.attachEvent ) {
  898. parent.attachEvent( "onunload", unloadHandler );
  899. }
  900. }
  901. /* Attributes
  902. ---------------------------------------------------------------------- */
  903. // Support: IE<8
  904. // Verify that getAttribute really returns attributes and not properties
  905. // (excepting IE8 booleans)
  906. support.attributes = assert(function( div ) {
  907. div.className = "i";
  908. return !div.getAttribute("className");
  909. });
  910. /* getElement(s)By*
  911. ---------------------------------------------------------------------- */
  912. // Check if getElementsByTagName("*") returns only elements
  913. support.getElementsByTagName = assert(function( div ) {
  914. div.appendChild( document.createComment("") );
  915. return !div.getElementsByTagName("*").length;
  916. });
  917. // Support: IE<9
  918. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  919. // Support: IE<10
  920. // Check if getElementById returns elements by name
  921. // The broken getElementById methods don't pick up programatically-set names,
  922. // so use a roundabout getElementsByName test
  923. support.getById = assert(function( div ) {
  924. docElem.appendChild( div ).id = expando;
  925. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  926. });
  927. // ID find and filter
  928. if ( support.getById ) {
  929. Expr.find["ID"] = function( id, context ) {
  930. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  931. var m = context.getElementById( id );
  932. return m ? [ m ] : [];
  933. }
  934. };
  935. Expr.filter["ID"] = function( id ) {
  936. var attrId = id.replace( runescape, funescape );
  937. return function( elem ) {
  938. return elem.getAttribute("id") === attrId;
  939. };
  940. };
  941. } else {
  942. // Support: IE6/7
  943. // getElementById is not reliable as a find shortcut
  944. delete Expr.find["ID"];
  945. Expr.filter["ID"] = function( id ) {
  946. var attrId = id.replace( runescape, funescape );
  947. return function( elem ) {
  948. var node = typeof elem.getAttributeNode !== "undefined" &&
  949. elem.getAttributeNode("id");
  950. return node && node.value === attrId;
  951. };
  952. };
  953. }
  954. // Tag
  955. Expr.find["TAG"] = support.getElementsByTagName ?
  956. function( tag, context ) {
  957. if ( typeof context.getElementsByTagName !== "undefined" ) {
  958. return context.getElementsByTagName( tag );
  959. // DocumentFragment nodes don't have gEBTN
  960. } else if ( support.qsa ) {
  961. return context.querySelectorAll( tag );
  962. }
  963. } :
  964. function( tag, context ) {
  965. var elem,
  966. tmp = [],
  967. i = 0,
  968. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  969. results = context.getElementsByTagName( tag );
  970. // Filter out possible comments
  971. if ( tag === "*" ) {
  972. while ( (elem = results[i++]) ) {
  973. if ( elem.nodeType === 1 ) {
  974. tmp.push( elem );
  975. }
  976. }
  977. return tmp;
  978. }
  979. return results;
  980. };
  981. // Class
  982. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  983. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  984. return context.getElementsByClassName( className );
  985. }
  986. };
  987. /* QSA/matchesSelector
  988. ---------------------------------------------------------------------- */
  989. // QSA and matchesSelector support
  990. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  991. rbuggyMatches = [];
  992. // qSa(:focus) reports false when true (Chrome 21)
  993. // We allow this because of a bug in IE8/9 that throws an error
  994. // whenever `document.activeElement` is accessed on an iframe
  995. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  996. // See http://bugs.jquery.com/ticket/13378
  997. rbuggyQSA = [];
  998. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  999. // Build QSA regex
  1000. // Regex strategy adopted from Diego Perini
  1001. assert(function( div ) {
  1002. // Select is set to empty string on purpose
  1003. // This is to test IE's treatment of not explicitly
  1004. // setting a boolean content attribute,
  1005. // since its presence should be enough
  1006. // http://bugs.jquery.com/ticket/12359
  1007. docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
  1008. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1009. "<option selected=''></option></select>";
  1010. // Support: IE8, Opera 11-12.16
  1011. // Nothing should be selected when empty strings follow ^= or $= or *=
  1012. // The test attribute must be unknown in Opera but "safe" for WinRT
  1013. // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1014. if ( div.querySelectorAll("[msallowcapture^='']").length ) {
  1015. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1016. }
  1017. // Support: IE8
  1018. // Boolean attributes and "value" are not treated correctly
  1019. if ( !div.querySelectorAll("[selected]").length ) {
  1020. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1021. }
  1022. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1023. if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1024. rbuggyQSA.push("~=");
  1025. }
  1026. // Webkit/Opera - :checked should return selected option elements
  1027. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1028. // IE8 throws error here and will not see later tests
  1029. if ( !div.querySelectorAll(":checked").length ) {
  1030. rbuggyQSA.push(":checked");
  1031. }
  1032. // Support: Safari 8+, iOS 8+
  1033. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1034. // In-page `selector#id sibing-combinator selector` fails
  1035. if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1036. rbuggyQSA.push(".#.+[+~]");
  1037. }
  1038. });
  1039. assert(function( div ) {
  1040. // Support: Windows 8 Native Apps
  1041. // The type and name attributes are restricted during .innerHTML assignment
  1042. var input = document.createElement("input");
  1043. input.setAttribute( "type", "hidden" );
  1044. div.appendChild( input ).setAttribute( "name", "D" );
  1045. // Support: IE8
  1046. // Enforce case-sensitivity of name attribute
  1047. if ( div.querySelectorAll("[name=d]").length ) {
  1048. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1049. }
  1050. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1051. // IE8 throws error here and will not see later tests
  1052. if ( !div.querySelectorAll(":enabled").length ) {
  1053. rbuggyQSA.push( ":enabled", ":disabled" );
  1054. }
  1055. // Opera 10-11 does not throw on post-comma invalid pseudos
  1056. div.querySelectorAll("*,:x");
  1057. rbuggyQSA.push(",.*:");
  1058. });
  1059. }
  1060. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1061. docElem.webkitMatchesSelector ||
  1062. docElem.mozMatchesSelector ||
  1063. docElem.oMatchesSelector ||
  1064. docElem.msMatchesSelector) )) ) {
  1065. assert(function( div ) {
  1066. // Check to see if it's possible to do matchesSelector
  1067. // on a disconnected node (IE 9)
  1068. support.disconnectedMatch = matches.call( div, "div" );
  1069. // This should fail with an exception
  1070. // Gecko does not error, returns false instead
  1071. matches.call( div, "[s!='']:x" );
  1072. rbuggyMatches.push( "!=", pseudos );
  1073. });
  1074. }
  1075. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1076. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1077. /* Contains
  1078. ---------------------------------------------------------------------- */
  1079. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1080. // Element contains another
  1081. // Purposefully self-exclusive
  1082. // As in, an element does not contain itself
  1083. contains = hasCompare || rnative.test( docElem.contains ) ?
  1084. function( a, b ) {
  1085. var adown = a.nodeType === 9 ? a.documentElement : a,
  1086. bup = b && b.parentNode;
  1087. return a === bup || !!( bup && bup.nodeType === 1 && (
  1088. adown.contains ?
  1089. adown.contains( bup ) :
  1090. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1091. ));
  1092. } :
  1093. function( a, b ) {
  1094. if ( b ) {
  1095. while ( (b = b.parentNode) ) {
  1096. if ( b === a ) {
  1097. return true;
  1098. }
  1099. }
  1100. }
  1101. return false;
  1102. };
  1103. /* Sorting
  1104. ---------------------------------------------------------------------- */
  1105. // Document order sorting
  1106. sortOrder = hasCompare ?
  1107. function( a, b ) {
  1108. // Flag for duplicate removal
  1109. if ( a === b ) {
  1110. hasDuplicate = true;
  1111. return 0;
  1112. }
  1113. // Sort on method existence if only one input has compareDocumentPosition
  1114. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1115. if ( compare ) {
  1116. return compare;
  1117. }
  1118. // Calculate position if both inputs belong to the same document
  1119. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1120. a.compareDocumentPosition( b ) :
  1121. // Otherwise we know they are disconnected
  1122. 1;
  1123. // Disconnected nodes
  1124. if ( compare & 1 ||
  1125. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1126. // Choose the first element that is related to our preferred document
  1127. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1128. return -1;
  1129. }
  1130. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1131. return 1;
  1132. }
  1133. // Maintain original order
  1134. return sortInput ?
  1135. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1136. 0;
  1137. }
  1138. return compare & 4 ? -1 : 1;
  1139. } :
  1140. function( a, b ) {
  1141. // Exit early if the nodes are identical
  1142. if ( a === b ) {
  1143. hasDuplicate = true;
  1144. return 0;
  1145. }
  1146. var cur,
  1147. i = 0,
  1148. aup = a.parentNode,
  1149. bup = b.parentNode,
  1150. ap = [ a ],
  1151. bp = [ b ];
  1152. // Parentless nodes are either documents or disconnected
  1153. if ( !aup || !bup ) {
  1154. return a === document ? -1 :
  1155. b === document ? 1 :
  1156. aup ? -1 :
  1157. bup ? 1 :
  1158. sortInput ?
  1159. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1160. 0;
  1161. // If the nodes are siblings, we can do a quick check
  1162. } else if ( aup === bup ) {
  1163. return siblingCheck( a, b );
  1164. }
  1165. // Otherwise we need full lists of their ancestors for comparison
  1166. cur = a;
  1167. while ( (cur = cur.parentNode) ) {
  1168. ap.unshift( cur );
  1169. }
  1170. cur = b;
  1171. while ( (cur = cur.parentNode) ) {
  1172. bp.unshift( cur );
  1173. }
  1174. // Walk down the tree looking for a discrepancy
  1175. while ( ap[i] === bp[i] ) {
  1176. i++;
  1177. }
  1178. return i ?
  1179. // Do a sibling check if the nodes have a common ancestor
  1180. siblingCheck( ap[i], bp[i] ) :
  1181. // Otherwise nodes in our document sort first
  1182. ap[i] === preferredDoc ? -1 :
  1183. bp[i] === preferredDoc ? 1 :
  1184. 0;
  1185. };
  1186. return document;
  1187. };
  1188. Sizzle.matches = function( expr, elements ) {
  1189. return Sizzle( expr, null, null, elements );
  1190. };
  1191. Sizzle.matchesSelector = function( elem, expr ) {
  1192. // Set document vars if needed
  1193. if ( ( elem.ownerDocument || elem ) !== document ) {
  1194. setDocument( elem );
  1195. }
  1196. // Make sure that attribute selectors are quoted
  1197. expr = expr.replace( rattributeQuotes, "='$1']" );
  1198. if ( support.matchesSelector && documentIsHTML &&
  1199. !compilerCache[ expr + " " ] &&
  1200. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1201. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1202. try {
  1203. var ret = matches.call( elem, expr );
  1204. // IE 9's matchesSelector returns false on disconnected nodes
  1205. if ( ret || support.disconnectedMatch ||
  1206. // As well, disconnected nodes are said to be in a document
  1207. // fragment in IE 9
  1208. elem.document && elem.document.nodeType !== 11 ) {
  1209. return ret;
  1210. }
  1211. } catch (e) {}
  1212. }
  1213. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1214. };
  1215. Sizzle.contains = function( context, elem ) {
  1216. // Set document vars if needed
  1217. if ( ( context.ownerDocument || context ) !== document ) {
  1218. setDocument( context );
  1219. }
  1220. return contains( context, elem );
  1221. };
  1222. Sizzle.attr = function( elem, name ) {
  1223. // Set document vars if needed
  1224. if ( ( elem.ownerDocument || elem ) !== document ) {
  1225. setDocument( elem );
  1226. }
  1227. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1228. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1229. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1230. fn( elem, name, !documentIsHTML ) :
  1231. undefined;
  1232. return val !== undefined ?
  1233. val :
  1234. support.attributes || !documentIsHTML ?
  1235. elem.getAttribute( name ) :
  1236. (val = elem.getAttributeNode(name)) && val.specified ?
  1237. val.value :
  1238. null;
  1239. };
  1240. Sizzle.error = function( msg ) {
  1241. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1242. };
  1243. /**
  1244. * Document sorting and removing duplicates
  1245. * @param {ArrayLike} results
  1246. */
  1247. Sizzle.uniqueSort = function( results ) {
  1248. var elem,
  1249. duplicates = [],
  1250. j = 0,
  1251. i = 0;
  1252. // Unless we *know* we can detect duplicates, assume their presence
  1253. hasDuplicate = !support.detectDuplicates;
  1254. sortInput = !support.sortStable && results.slice( 0 );
  1255. results.sort( sortOrder );
  1256. if ( hasDuplicate ) {
  1257. while ( (elem = results[i++]) ) {
  1258. if ( elem === results[ i ] ) {
  1259. j = duplicates.push( i );
  1260. }
  1261. }
  1262. while ( j-- ) {
  1263. results.splice( duplicates[ j ], 1 );
  1264. }
  1265. }
  1266. // Clear input after sorting to release objects
  1267. // See https://github.com/jquery/sizzle/pull/225
  1268. sortInput = null;
  1269. return results;
  1270. };
  1271. /**
  1272. * Utility function for retrieving the text value of an array of DOM nodes
  1273. * @param {Array|Element} elem
  1274. */
  1275. getText = Sizzle.getText = function( elem ) {
  1276. var node,
  1277. ret = "",
  1278. i = 0,
  1279. nodeType = elem.nodeType;
  1280. if ( !nodeType ) {
  1281. // If no nodeType, this is expected to be an array
  1282. while ( (node = elem[i++]) ) {
  1283. // Do not traverse comment nodes
  1284. ret += getText( node );
  1285. }
  1286. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1287. // Use textContent for elements
  1288. // innerText usage removed for consistency of new lines (jQuery #11153)
  1289. if ( typeof elem.textContent === "string" ) {
  1290. return elem.textContent;
  1291. } else {
  1292. // Traverse its children
  1293. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1294. ret += getText( elem );
  1295. }
  1296. }
  1297. } else if ( nodeType === 3 || nodeType === 4 ) {
  1298. return elem.nodeValue;
  1299. }
  1300. // Do not include comment or processing instruction nodes
  1301. return ret;
  1302. };
  1303. Expr = Sizzle.selectors = {
  1304. // Can be adjusted by the user
  1305. cacheLength: 50,
  1306. createPseudo: markFunction,
  1307. match: matchExpr,
  1308. attrHandle: {},
  1309. find: {},
  1310. relative: {
  1311. ">": { dir: "parentNode", first: true },
  1312. " ": { dir: "parentNode" },
  1313. "+": { dir: "previousSibling", first: true },
  1314. "~": { dir: "previousSibling" }
  1315. },
  1316. preFilter: {
  1317. "ATTR": function( match ) {
  1318. match[1] = match[1].replace( runescape, funescape );
  1319. // Move the given value to match[3] whether quoted or unquoted
  1320. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1321. if ( match[2] === "~=" ) {
  1322. match[3] = " " + match[3] + " ";
  1323. }
  1324. return match.slice( 0, 4 );
  1325. },
  1326. "CHILD": function( match ) {
  1327. /* matches from matchExpr["CHILD"]
  1328. 1 type (only|nth|...)
  1329. 2 what (child|of-type)
  1330. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1331. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1332. 5 sign of xn-component
  1333. 6 x of xn-component
  1334. 7 sign of y-component
  1335. 8 y of y-component
  1336. */
  1337. match[1] = match[1].toLowerCase();
  1338. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1339. // nth-* requires argument
  1340. if ( !match[3] ) {
  1341. Sizzle.error( match[0] );
  1342. }
  1343. // numeric x and y parameters for Expr.filter.CHILD
  1344. // remember that false/true cast respectively to 0/1
  1345. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1346. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1347. // other types prohibit arguments
  1348. } else if ( match[3] ) {
  1349. Sizzle.error( match[0] );
  1350. }
  1351. return match;
  1352. },
  1353. "PSEUDO": function( match ) {
  1354. var excess,
  1355. unquoted = !match[6] && match[2];
  1356. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1357. return null;
  1358. }
  1359. // Accept quoted arguments as-is
  1360. if ( match[3] ) {
  1361. match[2] = match[4] || match[5] || "";
  1362. // Strip excess characters from unquoted arguments
  1363. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1364. // Get excess from tokenize (recursively)
  1365. (excess = tokenize( unquoted, true )) &&
  1366. // advance to the next closing parenthesis
  1367. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1368. // excess is a negative index
  1369. match[0] = match[0].slice( 0, excess );
  1370. match[2] = unquoted.slice( 0, excess );
  1371. }
  1372. // Return only captures needed by the pseudo filter method (type and argument)
  1373. return match.slice( 0, 3 );
  1374. }
  1375. },
  1376. filter: {
  1377. "TAG": function( nodeNameSelector ) {
  1378. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1379. return nodeNameSelector === "*" ?
  1380. function() { return true; } :
  1381. function( elem ) {
  1382. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1383. };
  1384. },
  1385. "CLASS": function( className ) {
  1386. var pattern = classCache[ className + " " ];
  1387. return pattern ||
  1388. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1389. classCache( className, function( elem ) {
  1390. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1391. });
  1392. },
  1393. "ATTR": function( name, operator, check ) {
  1394. return function( elem ) {
  1395. var result = Sizzle.attr( elem, name );
  1396. if ( result == null ) {
  1397. return operator === "!=";
  1398. }
  1399. if ( !operator ) {
  1400. return true;
  1401. }
  1402. result += "";
  1403. return operator === "=" ? result === check :
  1404. operator === "!=" ? result !== check :
  1405. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1406. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1407. operator === "$=" ? check && result.slice( -check.length ) === check :
  1408. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1409. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1410. false;
  1411. };
  1412. },
  1413. "CHILD": function( type, what, argument, first, last ) {
  1414. var simple = type.slice( 0, 3 ) !== "nth",
  1415. forward = type.slice( -4 ) !== "last",
  1416. ofType = what === "of-type";
  1417. return first === 1 && last === 0 ?
  1418. // Shortcut for :nth-*(n)
  1419. function( elem ) {
  1420. return !!elem.parentNode;
  1421. } :
  1422. function( elem, context, xml ) {
  1423. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1424. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1425. parent = elem.parentNode,
  1426. name = ofType && elem.nodeName.toLowerCase(),
  1427. useCache = !xml && !ofType,
  1428. diff = false;
  1429. if ( parent ) {
  1430. // :(first|last|only)-(child|of-type)
  1431. if ( simple ) {
  1432. while ( dir ) {
  1433. node = elem;
  1434. while ( (node = node[ dir ]) ) {
  1435. if ( ofType ?
  1436. node.nodeName.toLowerCase() === name :
  1437. node.nodeType === 1 ) {
  1438. return false;
  1439. }
  1440. }
  1441. // Reverse direction for :only-* (if we haven't yet done so)
  1442. start = dir = type === "only" && !start && "nextSibling";
  1443. }
  1444. return true;
  1445. }
  1446. start = [ forward ? parent.firstChild : parent.lastChild ];
  1447. // non-xml :nth-child(...) stores cache data on `parent`
  1448. if ( forward && useCache ) {
  1449. // Seek `elem` from a previously-cached index
  1450. // ...in a gzip-friendly way
  1451. node = parent;
  1452. outerCache = node[ expando ] || (node[ expando ] = {});
  1453. // Support: IE <9 only
  1454. // Defend against cloned attroperties (jQuery gh-1709)
  1455. uniqueCache = outerCache[ node.uniqueID ] ||
  1456. (outerCache[ node.uniqueID ] = {});
  1457. cache = uniqueCache[ type ] || [];
  1458. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1459. diff = nodeIndex && cache[ 2 ];
  1460. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1461. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1462. // Fallback to seeking `elem` from the start
  1463. (diff = nodeIndex = 0) || start.pop()) ) {
  1464. // When found, cache indexes on `parent` and break
  1465. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1466. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1467. break;
  1468. }
  1469. }
  1470. } else {
  1471. // Use previously-cached element index if available
  1472. if ( useCache ) {
  1473. // ...in a gzip-friendly way
  1474. node = elem;
  1475. outerCache = node[ expando ] || (node[ expando ] = {});
  1476. // Support: IE <9 only
  1477. // Defend against cloned attroperties (jQuery gh-1709)
  1478. uniqueCache = outerCache[ node.uniqueID ] ||
  1479. (outerCache[ node.uniqueID ] = {});
  1480. cache = uniqueCache[ type ] || [];
  1481. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1482. diff = nodeIndex;
  1483. }
  1484. // xml :nth-child(...)
  1485. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1486. if ( diff === false ) {
  1487. // Use the same loop as above to seek `elem` from the start
  1488. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1489. (diff = nodeIndex = 0) || start.pop()) ) {
  1490. if ( ( ofType ?
  1491. node.nodeName.toLowerCase() === name :
  1492. node.nodeType === 1 ) &&
  1493. ++diff ) {
  1494. // Cache the index of each encountered element
  1495. if ( useCache ) {
  1496. outerCache = node[ expando ] || (node[ expando ] = {});
  1497. // Support: IE <9 only
  1498. // Defend against cloned attroperties (jQuery gh-1709)
  1499. uniqueCache = outerCache[ node.uniqueID ] ||
  1500. (outerCache[ node.uniqueID ] = {});
  1501. uniqueCache[ type ] = [ dirruns, diff ];
  1502. }
  1503. if ( node === elem ) {
  1504. break;
  1505. }
  1506. }
  1507. }
  1508. }
  1509. }
  1510. // Incorporate the offset, then check against cycle size
  1511. diff -= last;
  1512. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1513. }
  1514. };
  1515. },
  1516. "PSEUDO": function( pseudo, argument ) {
  1517. // pseudo-class names are case-insensitive
  1518. // http://www.w3.org/TR/selectors/#pseudo-classes
  1519. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1520. // Remember that setFilters inherits from pseudos
  1521. var args,
  1522. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1523. Sizzle.error( "unsupported pseudo: " + pseudo );
  1524. // The user may use createPseudo to indicate that
  1525. // arguments are needed to create the filter function
  1526. // just as Sizzle does
  1527. if ( fn[ expando ] ) {
  1528. return fn( argument );
  1529. }
  1530. // But maintain support for old signatures
  1531. if ( fn.length > 1 ) {
  1532. args = [ pseudo, pseudo, "", argument ];
  1533. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1534. markFunction(function( seed, matches ) {
  1535. var idx,
  1536. matched = fn( seed, argument ),
  1537. i = matched.length;
  1538. while ( i-- ) {
  1539. idx = indexOf( seed, matched[i] );
  1540. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1541. }
  1542. }) :
  1543. function( elem ) {
  1544. return fn( elem, 0, args );
  1545. };
  1546. }
  1547. return fn;
  1548. }
  1549. },
  1550. pseudos: {
  1551. // Potentially complex pseudos
  1552. "not": markFunction(function( selector ) {
  1553. // Trim the selector passed to compile
  1554. // to avoid treating leading and trailing
  1555. // spaces as combinators
  1556. var input = [],
  1557. results = [],
  1558. matcher = compile( selector.replace( rtrim, "$1" ) );
  1559. return matcher[ expando ] ?
  1560. markFunction(function( seed, matches, context, xml ) {
  1561. var elem,
  1562. unmatched = matcher( seed, null, xml, [] ),
  1563. i = seed.length;
  1564. // Match elements unmatched by `matcher`
  1565. while ( i-- ) {
  1566. if ( (elem = unmatched[i]) ) {
  1567. seed[i] = !(matches[i] = elem);
  1568. }
  1569. }
  1570. }) :
  1571. function( elem, context, xml ) {
  1572. input[0] = elem;
  1573. matcher( input, null, xml, results );
  1574. // Don't keep the element (issue #299)
  1575. input[0] = null;
  1576. return !results.pop();
  1577. };
  1578. }),
  1579. "has": markFunction(function( selector ) {
  1580. return function( elem ) {
  1581. return Sizzle( selector, elem ).length > 0;
  1582. };
  1583. }),
  1584. "contains": markFunction(function( text ) {
  1585. text = text.replace( runescape, funescape );
  1586. return function( elem ) {
  1587. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1588. };
  1589. }),
  1590. // "Whether an element is represented by a :lang() selector
  1591. // is based solely on the element's language value
  1592. // being equal to the identifier C,
  1593. // or beginning with the identifier C immediately followed by "-".
  1594. // The matching of C against the element's language value is performed case-insensitively.
  1595. // The identifier C does not have to be a valid language name."
  1596. // http://www.w3.org/TR/selectors/#lang-pseudo
  1597. "lang": markFunction( function( lang ) {
  1598. // lang value must be a valid identifier
  1599. if ( !ridentifier.test(lang || "") ) {
  1600. Sizzle.error( "unsupported lang: " + lang );
  1601. }
  1602. lang = lang.replace( runescape, funescape ).toLowerCase();
  1603. return function( elem ) {
  1604. var elemLang;
  1605. do {
  1606. if ( (elemLang = documentIsHTML ?
  1607. elem.lang :
  1608. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1609. elemLang = elemLang.toLowerCase();
  1610. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1611. }
  1612. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1613. return false;
  1614. };
  1615. }),
  1616. // Miscellaneous
  1617. "target": function( elem ) {
  1618. var hash = window.location && window.location.hash;
  1619. return hash && hash.slice( 1 ) === elem.id;
  1620. },
  1621. "root": function( elem ) {
  1622. return elem === docElem;
  1623. },
  1624. "focus": function( elem ) {
  1625. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1626. },
  1627. // Boolean properties
  1628. "enabled": function( elem ) {
  1629. return elem.disabled === false;
  1630. },
  1631. "disabled": function( elem ) {
  1632. return elem.disabled === true;
  1633. },
  1634. "checked": function( elem ) {
  1635. // In CSS3, :checked should return both checked and selected elements
  1636. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1637. var nodeName = elem.nodeName.toLowerCase();
  1638. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1639. },
  1640. "selected": function( elem ) {
  1641. // Accessing this property makes selected-by-default
  1642. // options in Safari work properly
  1643. if ( elem.parentNode ) {
  1644. elem.parentNode.selectedIndex;
  1645. }
  1646. return elem.selected === true;
  1647. },
  1648. // Contents
  1649. "empty": function( elem ) {
  1650. // http://www.w3.org/TR/selectors/#empty-pseudo
  1651. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1652. // but not by others (comment: 8; processing instruction: 7; etc.)
  1653. // nodeType < 6 works because attributes (2) do not appear as children
  1654. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1655. if ( elem.nodeType < 6 ) {
  1656. return false;
  1657. }
  1658. }
  1659. return true;
  1660. },
  1661. "parent": function( elem ) {
  1662. return !Expr.pseudos["empty"]( elem );
  1663. },
  1664. // Element/input types
  1665. "header": function( elem ) {
  1666. return rheader.test( elem.nodeName );
  1667. },
  1668. "input": function( elem ) {
  1669. return rinputs.test( elem.nodeName );
  1670. },
  1671. "button": function( elem ) {
  1672. var name = elem.nodeName.toLowerCase();
  1673. return name === "input" && elem.type === "button" || name === "button";
  1674. },
  1675. "text": function( elem ) {
  1676. var attr;
  1677. return elem.nodeName.toLowerCase() === "input" &&
  1678. elem.type === "text" &&
  1679. // Support: IE<8
  1680. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1681. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1682. },
  1683. // Position-in-collection
  1684. "first": createPositionalPseudo(function() {
  1685. return [ 0 ];
  1686. }),
  1687. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1688. return [ length - 1 ];
  1689. }),
  1690. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1691. return [ argument < 0 ? argument + length : argument ];
  1692. }),
  1693. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1694. var i = 0;
  1695. for ( ; i < length; i += 2 ) {
  1696. matchIndexes.push( i );
  1697. }
  1698. return matchIndexes;
  1699. }),
  1700. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1701. var i = 1;
  1702. for ( ; i < length; i += 2 ) {
  1703. matchIndexes.push( i );
  1704. }
  1705. return matchIndexes;
  1706. }),
  1707. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1708. var i = argument < 0 ? argument + length : argument;
  1709. for ( ; --i >= 0; ) {
  1710. matchIndexes.push( i );
  1711. }
  1712. return matchIndexes;
  1713. }),
  1714. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1715. var i = argument < 0 ? argument + length : argument;
  1716. for ( ; ++i < length; ) {
  1717. matchIndexes.push( i );
  1718. }
  1719. return matchIndexes;
  1720. })
  1721. }
  1722. };
  1723. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1724. // Add button/input type pseudos
  1725. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1726. Expr.pseudos[ i ] = createInputPseudo( i );
  1727. }
  1728. for ( i in { submit: true, reset: true } ) {
  1729. Expr.pseudos[ i ] = createButtonPseudo( i );
  1730. }
  1731. // Easy API for creating new setFilters
  1732. function setFilters() {}
  1733. setFilters.prototype = Expr.filters = Expr.pseudos;
  1734. Expr.setFilters = new setFilters();
  1735. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1736. var matched, match, tokens, type,
  1737. soFar, groups, preFilters,
  1738. cached = tokenCache[ selector + " " ];
  1739. if ( cached ) {
  1740. return parseOnly ? 0 : cached.slice( 0 );
  1741. }
  1742. soFar = selector;
  1743. groups = [];
  1744. preFilters = Expr.preFilter;
  1745. while ( soFar ) {
  1746. // Comma and first run
  1747. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1748. if ( match ) {
  1749. // Don't consume trailing commas as valid
  1750. soFar = soFar.slice( match[0].length ) || soFar;
  1751. }
  1752. groups.push( (tokens = []) );
  1753. }
  1754. matched = false;
  1755. // Combinators
  1756. if ( (match = rcombinators.exec( soFar )) ) {
  1757. matched = match.shift();
  1758. tokens.push({
  1759. value: matched,
  1760. // Cast descendant combinators to space
  1761. type: match[0].replace( rtrim, " " )
  1762. });
  1763. soFar = soFar.slice( matched.length );
  1764. }
  1765. // Filters
  1766. for ( type in Expr.filter ) {
  1767. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1768. (match = preFilters[ type ]( match ))) ) {
  1769. matched = match.shift();
  1770. tokens.push({
  1771. value: matched,
  1772. type: type,
  1773. matches: match
  1774. });
  1775. soFar = soFar.slice( matched.length );
  1776. }
  1777. }
  1778. if ( !matched ) {
  1779. break;
  1780. }
  1781. }
  1782. // Return the length of the invalid excess
  1783. // if we're just parsing
  1784. // Otherwise, throw an error or return tokens
  1785. return parseOnly ?
  1786. soFar.length :
  1787. soFar ?
  1788. Sizzle.error( selector ) :
  1789. // Cache the tokens
  1790. tokenCache( selector, groups ).slice( 0 );
  1791. };
  1792. function toSelector( tokens ) {
  1793. var i = 0,
  1794. len = tokens.length,
  1795. selector = "";
  1796. for ( ; i < len; i++ ) {
  1797. selector += tokens[i].value;
  1798. }
  1799. return selector;
  1800. }
  1801. function addCombinator( matcher, combinator, base ) {
  1802. var dir = combinator.dir,
  1803. checkNonElements = base && dir === "parentNode",
  1804. doneName = done++;
  1805. return combinator.first ?
  1806. // Check against closest ancestor/preceding element
  1807. function( elem, context, xml ) {
  1808. while ( (elem = elem[ dir ]) ) {
  1809. if ( elem.nodeType === 1 || checkNonElements ) {
  1810. return matcher( elem, context, xml );
  1811. }
  1812. }
  1813. } :
  1814. // Check against all ancestor/preceding elements
  1815. function( elem, context, xml ) {
  1816. var oldCache, uniqueCache, outerCache,
  1817. newCache = [ dirruns, doneName ];
  1818. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1819. if ( xml ) {
  1820. while ( (elem = elem[ dir ]) ) {
  1821. if ( elem.nodeType === 1 || checkNonElements ) {
  1822. if ( matcher( elem, context, xml ) ) {
  1823. return true;
  1824. }
  1825. }
  1826. }
  1827. } else {
  1828. while ( (elem = elem[ dir ]) ) {
  1829. if ( elem.nodeType === 1 || checkNonElements ) {
  1830. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1831. // Support: IE <9 only
  1832. // Defend against cloned attroperties (jQuery gh-1709)
  1833. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1834. if ( (oldCache = uniqueCache[ dir ]) &&
  1835. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1836. // Assign to newCache so results back-propagate to previous elements
  1837. return (newCache[ 2 ] = oldCache[ 2 ]);
  1838. } else {
  1839. // Reuse newcache so results back-propagate to previous elements
  1840. uniqueCache[ dir ] = newCache;
  1841. // A match means we're done; a fail means we have to keep checking
  1842. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1843. return true;
  1844. }
  1845. }
  1846. }
  1847. }
  1848. }
  1849. };
  1850. }
  1851. function elementMatcher( matchers ) {
  1852. return matchers.length > 1 ?
  1853. function( elem, context, xml ) {
  1854. var i = matchers.length;
  1855. while ( i-- ) {
  1856. if ( !matchers[i]( elem, context, xml ) ) {
  1857. return false;
  1858. }
  1859. }
  1860. return true;
  1861. } :
  1862. matchers[0];
  1863. }
  1864. function multipleContexts( selector, contexts, results ) {
  1865. var i = 0,
  1866. len = contexts.length;
  1867. for ( ; i < len; i++ ) {
  1868. Sizzle( selector, contexts[i], results );
  1869. }
  1870. return results;
  1871. }
  1872. function condense( unmatched, map, filter, context, xml ) {
  1873. var elem,
  1874. newUnmatched = [],
  1875. i = 0,
  1876. len = unmatched.length,
  1877. mapped = map != null;
  1878. for ( ; i < len; i++ ) {
  1879. if ( (elem = unmatched[i]) ) {
  1880. if ( !filter || filter( elem, context, xml ) ) {
  1881. newUnmatched.push( elem );
  1882. if ( mapped ) {
  1883. map.push( i );
  1884. }
  1885. }
  1886. }
  1887. }
  1888. return newUnmatched;
  1889. }
  1890. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1891. if ( postFilter && !postFilter[ expando ] ) {
  1892. postFilter = setMatcher( postFilter );
  1893. }
  1894. if ( postFinder && !postFinder[ expando ] ) {
  1895. postFinder = setMatcher( postFinder, postSelector );
  1896. }
  1897. return markFunction(function( seed, results, context, xml ) {
  1898. var temp, i, elem,
  1899. preMap = [],
  1900. postMap = [],
  1901. preexisting = results.length,
  1902. // Get initial elements from seed or context
  1903. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1904. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1905. matcherIn = preFilter && ( seed || !selector ) ?
  1906. condense( elems, preMap, preFilter, context, xml ) :
  1907. elems,
  1908. matcherOut = matcher ?
  1909. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1910. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1911. // ...intermediate processing is necessary
  1912. [] :
  1913. // ...otherwise use results directly
  1914. results :
  1915. matcherIn;
  1916. // Find primary matches
  1917. if ( matcher ) {
  1918. matcher( matcherIn, matcherOut, context, xml );
  1919. }
  1920. // Apply postFilter
  1921. if ( postFilter ) {
  1922. temp = condense( matcherOut, postMap );
  1923. postFilter( temp, [], context, xml );
  1924. // Un-match failing elements by moving them back to matcherIn
  1925. i = temp.length;
  1926. while ( i-- ) {
  1927. if ( (elem = temp[i]) ) {
  1928. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1929. }
  1930. }
  1931. }
  1932. if ( seed ) {
  1933. if ( postFinder || preFilter ) {
  1934. if ( postFinder ) {
  1935. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1936. temp = [];
  1937. i = matcherOut.length;
  1938. while ( i-- ) {
  1939. if ( (elem = matcherOut[i]) ) {
  1940. // Restore matcherIn since elem is not yet a final match
  1941. temp.push( (matcherIn[i] = elem) );
  1942. }
  1943. }
  1944. postFinder( null, (matcherOut = []), temp, xml );
  1945. }
  1946. // Move matched elements from seed to results to keep them synchronized
  1947. i = matcherOut.length;
  1948. while ( i-- ) {
  1949. if ( (elem = matcherOut[i]) &&
  1950. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1951. seed[temp] = !(results[temp] = elem);
  1952. }
  1953. }
  1954. }
  1955. // Add elements to results, through postFinder if defined
  1956. } else {
  1957. matcherOut = condense(
  1958. matcherOut === results ?
  1959. matcherOut.splice( preexisting, matcherOut.length ) :
  1960. matcherOut
  1961. );
  1962. if ( postFinder ) {
  1963. postFinder( null, results, matcherOut, xml );
  1964. } else {
  1965. push.apply( results, matcherOut );
  1966. }
  1967. }
  1968. });
  1969. }
  1970. function matcherFromTokens( tokens ) {
  1971. var checkContext, matcher, j,
  1972. len = tokens.length,
  1973. leadingRelative = Expr.relative[ tokens[0].type ],
  1974. implicitRelative = leadingRelative || Expr.relative[" "],
  1975. i = leadingRelative ? 1 : 0,
  1976. // The foundational matcher ensures that elements are reachable from top-level context(s)
  1977. matchContext = addCombinator( function( elem ) {
  1978. return elem === checkContext;
  1979. }, implicitRelative, true ),
  1980. matchAnyContext = addCombinator( function( elem ) {
  1981. return indexOf( checkContext, elem ) > -1;
  1982. }, implicitRelative, true ),
  1983. matchers = [ function( elem, context, xml ) {
  1984. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  1985. (checkContext = context).nodeType ?
  1986. matchContext( elem, context, xml ) :
  1987. matchAnyContext( elem, context, xml ) );
  1988. // Avoid hanging onto element (issue #299)
  1989. checkContext = null;
  1990. return ret;
  1991. } ];
  1992. for ( ; i < len; i++ ) {
  1993. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  1994. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  1995. } else {
  1996. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  1997. // Return special upon seeing a positional matcher
  1998. if ( matcher[ expando ] ) {
  1999. // Find the next relative operator (if any) for proper handling
  2000. j = ++i;
  2001. for ( ; j < len; j++ ) {
  2002. if ( Expr.relative[ tokens[j].type ] ) {
  2003. break;
  2004. }
  2005. }
  2006. return setMatcher(
  2007. i > 1 && elementMatcher( matchers ),
  2008. i > 1 && toSelector(
  2009. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2010. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2011. ).replace( rtrim, "$1" ),
  2012. matcher,
  2013. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2014. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2015. j < len && toSelector( tokens )
  2016. );
  2017. }
  2018. matchers.push( matcher );
  2019. }
  2020. }
  2021. return elementMatcher( matchers );
  2022. }
  2023. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2024. var bySet = setMatchers.length > 0,
  2025. byElement = elementMatchers.length > 0,
  2026. superMatcher = function( seed, context, xml, results, outermost ) {
  2027. var elem, j, matcher,
  2028. matchedCount = 0,
  2029. i = "0",
  2030. unmatched = seed && [],
  2031. setMatched = [],
  2032. contextBackup = outermostContext,
  2033. // We must always have either seed elements or outermost context
  2034. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2035. // Use integer dirruns iff this is the outermost matcher
  2036. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2037. len = elems.length;
  2038. if ( outermost ) {
  2039. outermostContext = context === document || context || outermost;
  2040. }
  2041. // Add elements passing elementMatchers directly to results
  2042. // Support: IE<9, Safari
  2043. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2044. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2045. if ( byElement && elem ) {
  2046. j = 0;
  2047. if ( !context && elem.ownerDocument !== document ) {
  2048. setDocument( elem );
  2049. xml = !documentIsHTML;
  2050. }
  2051. while ( (matcher = elementMatchers[j++]) ) {
  2052. if ( matcher( elem, context || document, xml) ) {
  2053. results.push( elem );
  2054. break;
  2055. }
  2056. }
  2057. if ( outermost ) {
  2058. dirruns = dirrunsUnique;
  2059. }
  2060. }
  2061. // Track unmatched elements for set filters
  2062. if ( bySet ) {
  2063. // They will have gone through all possible matchers
  2064. if ( (elem = !matcher && elem) ) {
  2065. matchedCount--;
  2066. }
  2067. // Lengthen the array for every element, matched or not
  2068. if ( seed ) {
  2069. unmatched.push( elem );
  2070. }
  2071. }
  2072. }
  2073. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2074. // makes the latter nonnegative.
  2075. matchedCount += i;
  2076. // Apply set filters to unmatched elements
  2077. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2078. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2079. // no element matchers and no seed.
  2080. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2081. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2082. // numerically zero.
  2083. if ( bySet && i !== matchedCount ) {
  2084. j = 0;
  2085. while ( (matcher = setMatchers[j++]) ) {
  2086. matcher( unmatched, setMatched, context, xml );
  2087. }
  2088. if ( seed ) {
  2089. // Reintegrate element matches to eliminate the need for sorting
  2090. if ( matchedCount > 0 ) {
  2091. while ( i-- ) {
  2092. if ( !(unmatched[i] || setMatched[i]) ) {
  2093. setMatched[i] = pop.call( results );
  2094. }
  2095. }
  2096. }
  2097. // Discard index placeholder values to get only actual matches
  2098. setMatched = condense( setMatched );
  2099. }
  2100. // Add matches to results
  2101. push.apply( results, setMatched );
  2102. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2103. if ( outermost && !seed && setMatched.length > 0 &&
  2104. ( matchedCount + setMatchers.length ) > 1 ) {
  2105. Sizzle.uniqueSort( results );
  2106. }
  2107. }
  2108. // Override manipulation of globals by nested matchers
  2109. if ( outermost ) {
  2110. dirruns = dirrunsUnique;
  2111. outermostContext = contextBackup;
  2112. }
  2113. return unmatched;
  2114. };
  2115. return bySet ?
  2116. markFunction( superMatcher ) :
  2117. superMatcher;
  2118. }
  2119. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2120. var i,
  2121. setMatchers = [],
  2122. elementMatchers = [],
  2123. cached = compilerCache[ selector + " " ];
  2124. if ( !cached ) {
  2125. // Generate a function of recursive functions that can be used to check each element
  2126. if ( !match ) {
  2127. match = tokenize( selector );
  2128. }
  2129. i = match.length;
  2130. while ( i-- ) {
  2131. cached = matcherFromTokens( match[i] );
  2132. if ( cached[ expando ] ) {
  2133. setMatchers.push( cached );
  2134. } else {
  2135. elementMatchers.push( cached );
  2136. }
  2137. }
  2138. // Cache the compiled function
  2139. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2140. // Save selector and tokenization
  2141. cached.selector = selector;
  2142. }
  2143. return cached;
  2144. };
  2145. /**
  2146. * A low-level selection function that works with Sizzle's compiled
  2147. * selector functions
  2148. * @param {String|Function} selector A selector or a pre-compiled
  2149. * selector function built with Sizzle.compile
  2150. * @param {Element} context
  2151. * @param {Array} [results]
  2152. * @param {Array} [seed] A set of elements to match against
  2153. */
  2154. select = Sizzle.select = function( selector, context, results, seed ) {
  2155. var i, tokens, token, type, find,
  2156. compiled = typeof selector === "function" && selector,
  2157. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2158. results = results || [];
  2159. // Try to minimize operations if there is only one selector in the list and no seed
  2160. // (the latter of which guarantees us context)
  2161. if ( match.length === 1 ) {
  2162. // Reduce context if the leading compound selector is an ID
  2163. tokens = match[0] = match[0].slice( 0 );
  2164. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2165. support.getById && context.nodeType === 9 && documentIsHTML &&
  2166. Expr.relative[ tokens[1].type ] ) {
  2167. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2168. if ( !context ) {
  2169. return results;
  2170. // Precompiled matchers will still verify ancestry, so step up a level
  2171. } else if ( compiled ) {
  2172. context = context.parentNode;
  2173. }
  2174. selector = selector.slice( tokens.shift().value.length );
  2175. }
  2176. // Fetch a seed set for right-to-left matching
  2177. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2178. while ( i-- ) {
  2179. token = tokens[i];
  2180. // Abort if we hit a combinator
  2181. if ( Expr.relative[ (type = token.type) ] ) {
  2182. break;
  2183. }
  2184. if ( (find = Expr.find[ type ]) ) {
  2185. // Search, expanding context for leading sibling combinators
  2186. if ( (seed = find(
  2187. token.matches[0].replace( runescape, funescape ),
  2188. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2189. )) ) {
  2190. // If seed is empty or no tokens remain, we can return early
  2191. tokens.splice( i, 1 );
  2192. selector = seed.length && toSelector( tokens );
  2193. if ( !selector ) {
  2194. push.apply( results, seed );
  2195. return results;
  2196. }
  2197. break;
  2198. }
  2199. }
  2200. }
  2201. }
  2202. // Compile and execute a filtering function if one is not provided
  2203. // Provide `match` to avoid retokenization if we modified the selector above
  2204. ( compiled || compile( selector, match ) )(
  2205. seed,
  2206. context,
  2207. !documentIsHTML,
  2208. results,
  2209. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2210. );
  2211. return results;
  2212. };
  2213. // One-time assignments
  2214. // Sort stability
  2215. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2216. // Support: Chrome 14-35+
  2217. // Always assume duplicates if they aren't passed to the comparison function
  2218. support.detectDuplicates = !!hasDuplicate;
  2219. // Initialize against the default document
  2220. setDocument();
  2221. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2222. // Detached nodes confoundingly follow *each other*
  2223. support.sortDetached = assert(function( div1 ) {
  2224. // Should return 1, but returns 4 (following)
  2225. return div1.compareDocumentPosition( document.createElement("div") ) & 1;
  2226. });
  2227. // Support: IE<8
  2228. // Prevent attribute/property "interpolation"
  2229. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2230. if ( !assert(function( div ) {
  2231. div.innerHTML = "<a href='#'></a>";
  2232. return div.firstChild.getAttribute("href") === "#" ;
  2233. }) ) {
  2234. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2235. if ( !isXML ) {
  2236. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2237. }
  2238. });
  2239. }
  2240. // Support: IE<9
  2241. // Use defaultValue in place of getAttribute("value")
  2242. if ( !support.attributes || !assert(function( div ) {
  2243. div.innerHTML = "<input/>";
  2244. div.firstChild.setAttribute( "value", "" );
  2245. return div.firstChild.getAttribute( "value" ) === "";
  2246. }) ) {
  2247. addHandle( "value", function( elem, name, isXML ) {
  2248. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2249. return elem.defaultValue;
  2250. }
  2251. });
  2252. }
  2253. // Support: IE<9
  2254. // Use getAttributeNode to fetch booleans when getAttribute lies
  2255. if ( !assert(function( div ) {
  2256. return div.getAttribute("disabled") == null;
  2257. }) ) {
  2258. addHandle( booleans, function( elem, name, isXML ) {
  2259. var val;
  2260. if ( !isXML ) {
  2261. return elem[ name ] === true ? name.toLowerCase() :
  2262. (val = elem.getAttributeNode( name )) && val.specified ?
  2263. val.value :
  2264. null;
  2265. }
  2266. });
  2267. }
  2268. return Sizzle;
  2269. })( window );
  2270. jQuery.find = Sizzle;
  2271. jQuery.expr = Sizzle.selectors;
  2272. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2273. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2274. jQuery.text = Sizzle.getText;
  2275. jQuery.isXMLDoc = Sizzle.isXML;
  2276. jQuery.contains = Sizzle.contains;
  2277. var dir = function( elem, dir, until ) {
  2278. var matched = [],
  2279. truncate = until !== undefined;
  2280. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2281. if ( elem.nodeType === 1 ) {
  2282. if ( truncate && jQuery( elem ).is( until ) ) {
  2283. break;
  2284. }
  2285. matched.push( elem );
  2286. }
  2287. }
  2288. return matched;
  2289. };
  2290. var siblings = function( n, elem ) {
  2291. var matched = [];
  2292. for ( ; n; n = n.nextSibling ) {
  2293. if ( n.nodeType === 1 && n !== elem ) {
  2294. matched.push( n );
  2295. }
  2296. }
  2297. return matched;
  2298. };
  2299. var rneedsContext = jQuery.expr.match.needsContext;
  2300. var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
  2301. var risSimple = /^.[^:#\[\.,]*$/;
  2302. // Implement the identical functionality for filter and not
  2303. function winnow( elements, qualifier, not ) {
  2304. if ( jQuery.isFunction( qualifier ) ) {
  2305. return jQuery.grep( elements, function( elem, i ) {
  2306. /* jshint -W018 */
  2307. return !!qualifier.call( elem, i, elem ) !== not;
  2308. } );
  2309. }
  2310. if ( qualifier.nodeType ) {
  2311. return jQuery.grep( elements, function( elem ) {
  2312. return ( elem === qualifier ) !== not;
  2313. } );
  2314. }
  2315. if ( typeof qualifier === "string" ) {
  2316. if ( risSimple.test( qualifier ) ) {
  2317. return jQuery.filter( qualifier, elements, not );
  2318. }
  2319. qualifier = jQuery.filter( qualifier, elements );
  2320. }
  2321. return jQuery.grep( elements, function( elem ) {
  2322. return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
  2323. } );
  2324. }
  2325. jQuery.filter = function( expr, elems, not ) {
  2326. var elem = elems[ 0 ];
  2327. if ( not ) {
  2328. expr = ":not(" + expr + ")";
  2329. }
  2330. return elems.length === 1 && elem.nodeType === 1 ?
  2331. jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
  2332. jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2333. return elem.nodeType === 1;
  2334. } ) );
  2335. };
  2336. jQuery.fn.extend( {
  2337. find: function( selector ) {
  2338. var i,
  2339. ret = [],
  2340. self = this,
  2341. len = self.length;
  2342. if ( typeof selector !== "string" ) {
  2343. return this.pushStack( jQuery( selector ).filter( function() {
  2344. for ( i = 0; i < len; i++ ) {
  2345. if ( jQuery.contains( self[ i ], this ) ) {
  2346. return true;
  2347. }
  2348. }
  2349. } ) );
  2350. }
  2351. for ( i = 0; i < len; i++ ) {
  2352. jQuery.find( selector, self[ i ], ret );
  2353. }
  2354. // Needed because $( selector, context ) becomes $( context ).find( selector )
  2355. ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
  2356. ret.selector = this.selector ? this.selector + " " + selector : selector;
  2357. return ret;
  2358. },
  2359. filter: function( selector ) {
  2360. return this.pushStack( winnow( this, selector || [], false ) );
  2361. },
  2362. not: function( selector ) {
  2363. return this.pushStack( winnow( this, selector || [], true ) );
  2364. },
  2365. is: function( selector ) {
  2366. return !!winnow(
  2367. this,
  2368. // If this is a positional/relative selector, check membership in the returned set
  2369. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2370. typeof selector === "string" && rneedsContext.test( selector ) ?
  2371. jQuery( selector ) :
  2372. selector || [],
  2373. false
  2374. ).length;
  2375. }
  2376. } );
  2377. // Initialize a jQuery object
  2378. // A central reference to the root jQuery(document)
  2379. var rootjQuery,
  2380. // A simple way to check for HTML strings
  2381. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2382. // Strict HTML recognition (#11290: must start with <)
  2383. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  2384. init = jQuery.fn.init = function( selector, context, root ) {
  2385. var match, elem;
  2386. // HANDLE: $(""), $(null), $(undefined), $(false)
  2387. if ( !selector ) {
  2388. return this;
  2389. }
  2390. // init accepts an alternate rootjQuery
  2391. // so migrate can support jQuery.sub (gh-2101)
  2392. root = root || rootjQuery;
  2393. // Handle HTML strings
  2394. if ( typeof selector === "string" ) {
  2395. if ( selector.charAt( 0 ) === "<" &&
  2396. selector.charAt( selector.length - 1 ) === ">" &&
  2397. selector.length >= 3 ) {
  2398. // Assume that strings that start and end with <> are HTML and skip the regex check
  2399. match = [ null, selector, null ];
  2400. } else {
  2401. match = rquickExpr.exec( selector );
  2402. }
  2403. // Match html or make sure no context is specified for #id
  2404. if ( match && ( match[ 1 ] || !context ) ) {
  2405. // HANDLE: $(html) -> $(array)
  2406. if ( match[ 1 ] ) {
  2407. context = context instanceof jQuery ? context[ 0 ] : context;
  2408. // scripts is true for back-compat
  2409. // Intentionally let the error be thrown if parseHTML is not present
  2410. jQuery.merge( this, jQuery.parseHTML(
  2411. match[ 1 ],
  2412. context && context.nodeType ? context.ownerDocument || context : document,
  2413. true
  2414. ) );
  2415. // HANDLE: $(html, props)
  2416. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2417. for ( match in context ) {
  2418. // Properties of context are called as methods if possible
  2419. if ( jQuery.isFunction( this[ match ] ) ) {
  2420. this[ match ]( context[ match ] );
  2421. // ...and otherwise set as attributes
  2422. } else {
  2423. this.attr( match, context[ match ] );
  2424. }
  2425. }
  2426. }
  2427. return this;
  2428. // HANDLE: $(#id)
  2429. } else {
  2430. elem = document.getElementById( match[ 2 ] );
  2431. // Check parentNode to catch when Blackberry 4.6 returns
  2432. // nodes that are no longer in the document #6963
  2433. if ( elem && elem.parentNode ) {
  2434. // Handle the case where IE and Opera return items
  2435. // by name instead of ID
  2436. if ( elem.id !== match[ 2 ] ) {
  2437. return rootjQuery.find( selector );
  2438. }
  2439. // Otherwise, we inject the element directly into the jQuery object
  2440. this.length = 1;
  2441. this[ 0 ] = elem;
  2442. }
  2443. this.context = document;
  2444. this.selector = selector;
  2445. return this;
  2446. }
  2447. // HANDLE: $(expr, $(...))
  2448. } else if ( !context || context.jquery ) {
  2449. return ( context || root ).find( selector );
  2450. // HANDLE: $(expr, context)
  2451. // (which is just equivalent to: $(context).find(expr)
  2452. } else {
  2453. return this.constructor( context ).find( selector );
  2454. }
  2455. // HANDLE: $(DOMElement)
  2456. } else if ( selector.nodeType ) {
  2457. this.context = this[ 0 ] = selector;
  2458. this.length = 1;
  2459. return this;
  2460. // HANDLE: $(function)
  2461. // Shortcut for document ready
  2462. } else if ( jQuery.isFunction( selector ) ) {
  2463. return typeof root.ready !== "undefined" ?
  2464. root.ready( selector ) :
  2465. // Execute immediately if ready is not present
  2466. selector( jQuery );
  2467. }
  2468. if ( selector.selector !== undefined ) {
  2469. this.selector = selector.selector;
  2470. this.context = selector.context;
  2471. }
  2472. return jQuery.makeArray( selector, this );
  2473. };
  2474. // Give the init function the jQuery prototype for later instantiation
  2475. init.prototype = jQuery.fn;
  2476. // Initialize central reference
  2477. rootjQuery = jQuery( document );
  2478. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2479. // methods guaranteed to produce a unique set when starting from a unique set
  2480. guaranteedUnique = {
  2481. children: true,
  2482. contents: true,
  2483. next: true,
  2484. prev: true
  2485. };
  2486. jQuery.fn.extend( {
  2487. has: function( target ) {
  2488. var i,
  2489. targets = jQuery( target, this ),
  2490. len = targets.length;
  2491. return this.filter( function() {
  2492. for ( i = 0; i < len; i++ ) {
  2493. if ( jQuery.contains( this, targets[ i ] ) ) {
  2494. return true;
  2495. }
  2496. }
  2497. } );
  2498. },
  2499. closest: function( selectors, context ) {
  2500. var cur,
  2501. i = 0,
  2502. l = this.length,
  2503. matched = [],
  2504. pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
  2505. jQuery( selectors, context || this.context ) :
  2506. 0;
  2507. for ( ; i < l; i++ ) {
  2508. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2509. // Always skip document fragments
  2510. if ( cur.nodeType < 11 && ( pos ?
  2511. pos.index( cur ) > -1 :
  2512. // Don't pass non-elements to Sizzle
  2513. cur.nodeType === 1 &&
  2514. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2515. matched.push( cur );
  2516. break;
  2517. }
  2518. }
  2519. }
  2520. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2521. },
  2522. // Determine the position of an element within
  2523. // the matched set of elements
  2524. index: function( elem ) {
  2525. // No argument, return index in parent
  2526. if ( !elem ) {
  2527. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2528. }
  2529. // index in selector
  2530. if ( typeof elem === "string" ) {
  2531. return jQuery.inArray( this[ 0 ], jQuery( elem ) );
  2532. }
  2533. // Locate the position of the desired element
  2534. return jQuery.inArray(
  2535. // If it receives a jQuery object, the first element is used
  2536. elem.jquery ? elem[ 0 ] : elem, this );
  2537. },
  2538. add: function( selector, context ) {
  2539. return this.pushStack(
  2540. jQuery.uniqueSort(
  2541. jQuery.merge( this.get(), jQuery( selector, context ) )
  2542. )
  2543. );
  2544. },
  2545. addBack: function( selector ) {
  2546. return this.add( selector == null ?
  2547. this.prevObject : this.prevObject.filter( selector )
  2548. );
  2549. }
  2550. } );
  2551. function sibling( cur, dir ) {
  2552. do {
  2553. cur = cur[ dir ];
  2554. } while ( cur && cur.nodeType !== 1 );
  2555. return cur;
  2556. }
  2557. jQuery.each( {
  2558. parent: function( elem ) {
  2559. var parent = elem.parentNode;
  2560. return parent && parent.nodeType !== 11 ? parent : null;
  2561. },
  2562. parents: function( elem ) {
  2563. return dir( elem, "parentNode" );
  2564. },
  2565. parentsUntil: function( elem, i, until ) {
  2566. return dir( elem, "parentNode", until );
  2567. },
  2568. next: function( elem ) {
  2569. return sibling( elem, "nextSibling" );
  2570. },
  2571. prev: function( elem ) {
  2572. return sibling( elem, "previousSibling" );
  2573. },
  2574. nextAll: function( elem ) {
  2575. return dir( elem, "nextSibling" );
  2576. },
  2577. prevAll: function( elem ) {
  2578. return dir( elem, "previousSibling" );
  2579. },
  2580. nextUntil: function( elem, i, until ) {
  2581. return dir( elem, "nextSibling", until );
  2582. },
  2583. prevUntil: function( elem, i, until ) {
  2584. return dir( elem, "previousSibling", until );
  2585. },
  2586. siblings: function( elem ) {
  2587. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2588. },
  2589. children: function( elem ) {
  2590. return siblings( elem.firstChild );
  2591. },
  2592. contents: function( elem ) {
  2593. return jQuery.nodeName( elem, "iframe" ) ?
  2594. elem.contentDocument || elem.contentWindow.document :
  2595. jQuery.merge( [], elem.childNodes );
  2596. }
  2597. }, function( name, fn ) {
  2598. jQuery.fn[ name ] = function( until, selector ) {
  2599. var ret = jQuery.map( this, fn, until );
  2600. if ( name.slice( -5 ) !== "Until" ) {
  2601. selector = until;
  2602. }
  2603. if ( selector && typeof selector === "string" ) {
  2604. ret = jQuery.filter( selector, ret );
  2605. }
  2606. if ( this.length > 1 ) {
  2607. // Remove duplicates
  2608. if ( !guaranteedUnique[ name ] ) {
  2609. ret = jQuery.uniqueSort( ret );
  2610. }
  2611. // Reverse order for parents* and prev-derivatives
  2612. if ( rparentsprev.test( name ) ) {
  2613. ret = ret.reverse();
  2614. }
  2615. }
  2616. return this.pushStack( ret );
  2617. };
  2618. } );
  2619. var rnotwhite = ( /\S+/g );
  2620. // Convert String-formatted options into Object-formatted ones
  2621. function createOptions( options ) {
  2622. var object = {};
  2623. jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
  2624. object[ flag ] = true;
  2625. } );
  2626. return object;
  2627. }
  2628. /*
  2629. * Create a callback list using the following parameters:
  2630. *
  2631. * options: an optional list of space-separated options that will change how
  2632. * the callback list behaves or a more traditional option object
  2633. *
  2634. * By default a callback list will act like an event callback list and can be
  2635. * "fired" multiple times.
  2636. *
  2637. * Possible options:
  2638. *
  2639. * once: will ensure the callback list can only be fired once (like a Deferred)
  2640. *
  2641. * memory: will keep track of previous values and will call any callback added
  2642. * after the list has been fired right away with the latest "memorized"
  2643. * values (like a Deferred)
  2644. *
  2645. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2646. *
  2647. * stopOnFalse: interrupt callings when a callback returns false
  2648. *
  2649. */
  2650. jQuery.Callbacks = function( options ) {
  2651. // Convert options from String-formatted to Object-formatted if needed
  2652. // (we check in cache first)
  2653. options = typeof options === "string" ?
  2654. createOptions( options ) :
  2655. jQuery.extend( {}, options );
  2656. var // Flag to know if list is currently firing
  2657. firing,
  2658. // Last fire value for non-forgettable lists
  2659. memory,
  2660. // Flag to know if list was already fired
  2661. fired,
  2662. // Flag to prevent firing
  2663. locked,
  2664. // Actual callback list
  2665. list = [],
  2666. // Queue of execution data for repeatable lists
  2667. queue = [],
  2668. // Index of currently firing callback (modified by add/remove as needed)
  2669. firingIndex = -1,
  2670. // Fire callbacks
  2671. fire = function() {
  2672. // Enforce single-firing
  2673. locked = options.once;
  2674. // Execute callbacks for all pending executions,
  2675. // respecting firingIndex overrides and runtime changes
  2676. fired = firing = true;
  2677. for ( ; queue.length; firingIndex = -1 ) {
  2678. memory = queue.shift();
  2679. while ( ++firingIndex < list.length ) {
  2680. // Run callback and check for early termination
  2681. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2682. options.stopOnFalse ) {
  2683. // Jump to end and forget the data so .add doesn't re-fire
  2684. firingIndex = list.length;
  2685. memory = false;
  2686. }
  2687. }
  2688. }
  2689. // Forget the data if we're done with it
  2690. if ( !options.memory ) {
  2691. memory = false;
  2692. }
  2693. firing = false;
  2694. // Clean up if we're done firing for good
  2695. if ( locked ) {
  2696. // Keep an empty list if we have data for future add calls
  2697. if ( memory ) {
  2698. list = [];
  2699. // Otherwise, this object is spent
  2700. } else {
  2701. list = "";
  2702. }
  2703. }
  2704. },
  2705. // Actual Callbacks object
  2706. self = {
  2707. // Add a callback or a collection of callbacks to the list
  2708. add: function() {
  2709. if ( list ) {
  2710. // If we have memory from a past run, we should fire after adding
  2711. if ( memory && !firing ) {
  2712. firingIndex = list.length - 1;
  2713. queue.push( memory );
  2714. }
  2715. ( function add( args ) {
  2716. jQuery.each( args, function( _, arg ) {
  2717. if ( jQuery.isFunction( arg ) ) {
  2718. if ( !options.unique || !self.has( arg ) ) {
  2719. list.push( arg );
  2720. }
  2721. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  2722. // Inspect recursively
  2723. add( arg );
  2724. }
  2725. } );
  2726. } )( arguments );
  2727. if ( memory && !firing ) {
  2728. fire();
  2729. }
  2730. }
  2731. return this;
  2732. },
  2733. // Remove a callback from the list
  2734. remove: function() {
  2735. jQuery.each( arguments, function( _, arg ) {
  2736. var index;
  2737. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2738. list.splice( index, 1 );
  2739. // Handle firing indexes
  2740. if ( index <= firingIndex ) {
  2741. firingIndex--;
  2742. }
  2743. }
  2744. } );
  2745. return this;
  2746. },
  2747. // Check if a given callback is in the list.
  2748. // If no argument is given, return whether or not list has callbacks attached.
  2749. has: function( fn ) {
  2750. return fn ?
  2751. jQuery.inArray( fn, list ) > -1 :
  2752. list.length > 0;
  2753. },
  2754. // Remove all callbacks from the list
  2755. empty: function() {
  2756. if ( list ) {
  2757. list = [];
  2758. }
  2759. return this;
  2760. },
  2761. // Disable .fire and .add
  2762. // Abort any current/pending executions
  2763. // Clear all callbacks and values
  2764. disable: function() {
  2765. locked = queue = [];
  2766. list = memory = "";
  2767. return this;
  2768. },
  2769. disabled: function() {
  2770. return !list;
  2771. },
  2772. // Disable .fire
  2773. // Also disable .add unless we have memory (since it would have no effect)
  2774. // Abort any pending executions
  2775. lock: function() {
  2776. locked = true;
  2777. if ( !memory ) {
  2778. self.disable();
  2779. }
  2780. return this;
  2781. },
  2782. locked: function() {
  2783. return !!locked;
  2784. },
  2785. // Call all callbacks with the given context and arguments
  2786. fireWith: function( context, args ) {
  2787. if ( !locked ) {
  2788. args = args || [];
  2789. args = [ context, args.slice ? args.slice() : args ];
  2790. queue.push( args );
  2791. if ( !firing ) {
  2792. fire();
  2793. }
  2794. }
  2795. return this;
  2796. },
  2797. // Call all the callbacks with the given arguments
  2798. fire: function() {
  2799. self.fireWith( this, arguments );
  2800. return this;
  2801. },
  2802. // To know if the callbacks have already been called at least once
  2803. fired: function() {
  2804. return !!fired;
  2805. }
  2806. };
  2807. return self;
  2808. };
  2809. jQuery.extend( {
  2810. Deferred: function( func ) {
  2811. var tuples = [
  2812. // action, add listener, listener list, final state
  2813. [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
  2814. [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
  2815. [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
  2816. ],
  2817. state = "pending",
  2818. promise = {
  2819. state: function() {
  2820. return state;
  2821. },
  2822. always: function() {
  2823. deferred.done( arguments ).fail( arguments );
  2824. return this;
  2825. },
  2826. then: function( /* fnDone, fnFail, fnProgress */ ) {
  2827. var fns = arguments;
  2828. return jQuery.Deferred( function( newDefer ) {
  2829. jQuery.each( tuples, function( i, tuple ) {
  2830. var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
  2831. // deferred[ done | fail | progress ] for forwarding actions to newDefer
  2832. deferred[ tuple[ 1 ] ]( function() {
  2833. var returned = fn && fn.apply( this, arguments );
  2834. if ( returned && jQuery.isFunction( returned.promise ) ) {
  2835. returned.promise()
  2836. .progress( newDefer.notify )
  2837. .done( newDefer.resolve )
  2838. .fail( newDefer.reject );
  2839. } else {
  2840. newDefer[ tuple[ 0 ] + "With" ](
  2841. this === promise ? newDefer.promise() : this,
  2842. fn ? [ returned ] : arguments
  2843. );
  2844. }
  2845. } );
  2846. } );
  2847. fns = null;
  2848. } ).promise();
  2849. },
  2850. // Get a promise for this deferred
  2851. // If obj is provided, the promise aspect is added to the object
  2852. promise: function( obj ) {
  2853. return obj != null ? jQuery.extend( obj, promise ) : promise;
  2854. }
  2855. },
  2856. deferred = {};
  2857. // Keep pipe for back-compat
  2858. promise.pipe = promise.then;
  2859. // Add list-specific methods
  2860. jQuery.each( tuples, function( i, tuple ) {
  2861. var list = tuple[ 2 ],
  2862. stateString = tuple[ 3 ];
  2863. // promise[ done | fail | progress ] = list.add
  2864. promise[ tuple[ 1 ] ] = list.add;
  2865. // Handle state
  2866. if ( stateString ) {
  2867. list.add( function() {
  2868. // state = [ resolved | rejected ]
  2869. state = stateString;
  2870. // [ reject_list | resolve_list ].disable; progress_list.lock
  2871. }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
  2872. }
  2873. // deferred[ resolve | reject | notify ]
  2874. deferred[ tuple[ 0 ] ] = function() {
  2875. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
  2876. return this;
  2877. };
  2878. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  2879. } );
  2880. // Make the deferred a promise
  2881. promise.promise( deferred );
  2882. // Call given func if any
  2883. if ( func ) {
  2884. func.call( deferred, deferred );
  2885. }
  2886. // All done!
  2887. return deferred;
  2888. },
  2889. // Deferred helper
  2890. when: function( subordinate /* , ..., subordinateN */ ) {
  2891. var i = 0,
  2892. resolveValues = slice.call( arguments ),
  2893. length = resolveValues.length,
  2894. // the count of uncompleted subordinates
  2895. remaining = length !== 1 ||
  2896. ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
  2897. // the master Deferred.
  2898. // If resolveValues consist of only a single Deferred, just use that.
  2899. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  2900. // Update function for both resolve and progress values
  2901. updateFunc = function( i, contexts, values ) {
  2902. return function( value ) {
  2903. contexts[ i ] = this;
  2904. values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  2905. if ( values === progressValues ) {
  2906. deferred.notifyWith( contexts, values );
  2907. } else if ( !( --remaining ) ) {
  2908. deferred.resolveWith( contexts, values );
  2909. }
  2910. };
  2911. },
  2912. progressValues, progressContexts, resolveContexts;
  2913. // add listeners to Deferred subordinates; treat others as resolved
  2914. if ( length > 1 ) {
  2915. progressValues = new Array( length );
  2916. progressContexts = new Array( length );
  2917. resolveContexts = new Array( length );
  2918. for ( ; i < length; i++ ) {
  2919. if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
  2920. resolveValues[ i ].promise()
  2921. .progress( updateFunc( i, progressContexts, progressValues ) )
  2922. .done( updateFunc( i, resolveContexts, resolveValues ) )
  2923. .fail( deferred.reject );
  2924. } else {
  2925. --remaining;
  2926. }
  2927. }
  2928. }
  2929. // if we're not waiting on anything, resolve the master
  2930. if ( !remaining ) {
  2931. deferred.resolveWith( resolveContexts, resolveValues );
  2932. }
  2933. return deferred.promise();
  2934. }
  2935. } );
  2936. // The deferred used on DOM ready
  2937. var readyList;
  2938. jQuery.fn.ready = function( fn ) {
  2939. // Add the callback
  2940. jQuery.ready.promise().done( fn );
  2941. return this;
  2942. };
  2943. jQuery.extend( {
  2944. // Is the DOM ready to be used? Set to true once it occurs.
  2945. isReady: false,
  2946. // A counter to track how many items to wait for before
  2947. // the ready event fires. See #6781
  2948. readyWait: 1,
  2949. // Hold (or release) the ready event
  2950. holdReady: function( hold ) {
  2951. if ( hold ) {
  2952. jQuery.readyWait++;
  2953. } else {
  2954. jQuery.ready( true );
  2955. }
  2956. },
  2957. // Handle when the DOM is ready
  2958. ready: function( wait ) {
  2959. // Abort if there are pending holds or we're already ready
  2960. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  2961. return;
  2962. }
  2963. // Remember that the DOM is ready
  2964. jQuery.isReady = true;
  2965. // If a normal DOM Ready event fired, decrement, and wait if need be
  2966. if ( wait !== true && --jQuery.readyWait > 0 ) {
  2967. return;
  2968. }
  2969. // If there are functions bound, to execute
  2970. readyList.resolveWith( document, [ jQuery ] );
  2971. // Trigger any bound ready events
  2972. if ( jQuery.fn.triggerHandler ) {
  2973. jQuery( document ).triggerHandler( "ready" );
  2974. jQuery( document ).off( "ready" );
  2975. }
  2976. }
  2977. } );
  2978. /**
  2979. * Clean-up method for dom ready events
  2980. */
  2981. function detach() {
  2982. if ( document.addEventListener ) {
  2983. document.removeEventListener( "DOMContentLoaded", completed );
  2984. window.removeEventListener( "load", completed );
  2985. } else {
  2986. document.detachEvent( "onreadystatechange", completed );
  2987. window.detachEvent( "onload", completed );
  2988. }
  2989. }
  2990. /**
  2991. * The ready event handler and self cleanup method
  2992. */
  2993. function completed() {
  2994. // readyState === "complete" is good enough for us to call the dom ready in oldIE
  2995. if ( document.addEventListener ||
  2996. window.event.type === "load" ||
  2997. document.readyState === "complete" ) {
  2998. detach();
  2999. jQuery.ready();
  3000. }
  3001. }
  3002. jQuery.ready.promise = function( obj ) {
  3003. if ( !readyList ) {
  3004. readyList = jQuery.Deferred();
  3005. // Catch cases where $(document).ready() is called
  3006. // after the browser event has already occurred.
  3007. // Support: IE6-10
  3008. // Older IE sometimes signals "interactive" too soon
  3009. if ( document.readyState === "complete" ||
  3010. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3011. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3012. window.setTimeout( jQuery.ready );
  3013. // Standards-based browsers support DOMContentLoaded
  3014. } else if ( document.addEventListener ) {
  3015. // Use the handy event callback
  3016. document.addEventListener( "DOMContentLoaded", completed );
  3017. // A fallback to window.onload, that will always work
  3018. window.addEventListener( "load", completed );
  3019. // If IE event model is used
  3020. } else {
  3021. // Ensure firing before onload, maybe late but safe also for iframes
  3022. document.attachEvent( "onreadystatechange", completed );
  3023. // A fallback to window.onload, that will always work
  3024. window.attachEvent( "onload", completed );
  3025. // If IE and not a frame
  3026. // continually check to see if the document is ready
  3027. var top = false;
  3028. try {
  3029. top = window.frameElement == null && document.documentElement;
  3030. } catch ( e ) {}
  3031. if ( top && top.doScroll ) {
  3032. ( function doScrollCheck() {
  3033. if ( !jQuery.isReady ) {
  3034. try {
  3035. // Use the trick by Diego Perini
  3036. // http://javascript.nwbox.com/IEContentLoaded/
  3037. top.doScroll( "left" );
  3038. } catch ( e ) {
  3039. return window.setTimeout( doScrollCheck, 50 );
  3040. }
  3041. // detach all dom ready events
  3042. detach();
  3043. // and execute any waiting functions
  3044. jQuery.ready();
  3045. }
  3046. } )();
  3047. }
  3048. }
  3049. }
  3050. return readyList.promise( obj );
  3051. };
  3052. // Kick off the DOM ready check even if the user does not
  3053. jQuery.ready.promise();
  3054. // Support: IE<9
  3055. // Iteration over object's inherited properties before its own
  3056. var i;
  3057. for ( i in jQuery( support ) ) {
  3058. break;
  3059. }
  3060. support.ownFirst = i === "0";
  3061. // Note: most support tests are defined in their respective modules.
  3062. // false until the test is run
  3063. support.inlineBlockNeedsLayout = false;
  3064. // Execute ASAP in case we need to set body.style.zoom
  3065. jQuery( function() {
  3066. // Minified: var a,b,c,d
  3067. var val, div, body, container;
  3068. body = document.getElementsByTagName( "body" )[ 0 ];
  3069. if ( !body || !body.style ) {
  3070. // Return for frameset docs that don't have a body
  3071. return;
  3072. }
  3073. // Setup
  3074. div = document.createElement( "div" );
  3075. container = document.createElement( "div" );
  3076. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  3077. body.appendChild( container ).appendChild( div );
  3078. if ( typeof div.style.zoom !== "undefined" ) {
  3079. // Support: IE<8
  3080. // Check if natively block-level elements act like inline-block
  3081. // elements when setting their display to 'inline' and giving
  3082. // them layout
  3083. div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
  3084. support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
  3085. if ( val ) {
  3086. // Prevent IE 6 from affecting layout for positioned elements #11048
  3087. // Prevent IE from shrinking the body in IE 7 mode #12869
  3088. // Support: IE<8
  3089. body.style.zoom = 1;
  3090. }
  3091. }
  3092. body.removeChild( container );
  3093. } );
  3094. ( function() {
  3095. var div = document.createElement( "div" );
  3096. // Support: IE<9
  3097. support.deleteExpando = true;
  3098. try {
  3099. delete div.test;
  3100. } catch ( e ) {
  3101. support.deleteExpando = false;
  3102. }
  3103. // Null elements to avoid leaks in IE.
  3104. div = null;
  3105. } )();
  3106. var acceptData = function( elem ) {
  3107. var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
  3108. nodeType = +elem.nodeType || 1;
  3109. // Do not set data on non-element DOM nodes because it will not be cleared (#8335).
  3110. return nodeType !== 1 && nodeType !== 9 ?
  3111. false :
  3112. // Nodes accept data unless otherwise specified; rejection can be conditional
  3113. !noData || noData !== true && elem.getAttribute( "classid" ) === noData;
  3114. };
  3115. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3116. rmultiDash = /([A-Z])/g;
  3117. function dataAttr( elem, key, data ) {
  3118. // If nothing was found internally, try to fetch any
  3119. // data from the HTML5 data-* attribute
  3120. if ( data === undefined && elem.nodeType === 1 ) {
  3121. var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
  3122. data = elem.getAttribute( name );
  3123. if ( typeof data === "string" ) {
  3124. try {
  3125. data = data === "true" ? true :
  3126. data === "false" ? false :
  3127. data === "null" ? null :
  3128. // Only convert to a number if it doesn't change the string
  3129. +data + "" === data ? +data :
  3130. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  3131. data;
  3132. } catch ( e ) {}
  3133. // Make sure we set the data so it isn't changed later
  3134. jQuery.data( elem, key, data );
  3135. } else {
  3136. data = undefined;
  3137. }
  3138. }
  3139. return data;
  3140. }
  3141. // checks a cache object for emptiness
  3142. function isEmptyDataObject( obj ) {
  3143. var name;
  3144. for ( name in obj ) {
  3145. // if the public data object is empty, the private is still empty
  3146. if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
  3147. continue;
  3148. }
  3149. if ( name !== "toJSON" ) {
  3150. return false;
  3151. }
  3152. }
  3153. return true;
  3154. }
  3155. function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
  3156. if ( !acceptData( elem ) ) {
  3157. return;
  3158. }
  3159. var ret, thisCache,
  3160. internalKey = jQuery.expando,
  3161. // We have to handle DOM nodes and JS objects differently because IE6-7
  3162. // can't GC object references properly across the DOM-JS boundary
  3163. isNode = elem.nodeType,
  3164. // Only DOM nodes need the global jQuery cache; JS object data is
  3165. // attached directly to the object so GC can occur automatically
  3166. cache = isNode ? jQuery.cache : elem,
  3167. // Only defining an ID for JS objects if its cache already exists allows
  3168. // the code to shortcut on the same path as a DOM node with no cache
  3169. id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
  3170. // Avoid doing any more work than we need to when trying to get data on an
  3171. // object that has no data at all
  3172. if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
  3173. data === undefined && typeof name === "string" ) {
  3174. return;
  3175. }
  3176. if ( !id ) {
  3177. // Only DOM nodes need a new unique ID for each element since their data
  3178. // ends up in the global cache
  3179. if ( isNode ) {
  3180. id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
  3181. } else {
  3182. id = internalKey;
  3183. }
  3184. }
  3185. if ( !cache[ id ] ) {
  3186. // Avoid exposing jQuery metadata on plain JS objects when the object
  3187. // is serialized using JSON.stringify
  3188. cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
  3189. }
  3190. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  3191. // shallow copied over onto the existing cache
  3192. if ( typeof name === "object" || typeof name === "function" ) {
  3193. if ( pvt ) {
  3194. cache[ id ] = jQuery.extend( cache[ id ], name );
  3195. } else {
  3196. cache[ id ].data = jQuery.extend( cache[ id ].data, name );
  3197. }
  3198. }
  3199. thisCache = cache[ id ];
  3200. // jQuery data() is stored in a separate object inside the object's internal data
  3201. // cache in order to avoid key collisions between internal data and user-defined
  3202. // data.
  3203. if ( !pvt ) {
  3204. if ( !thisCache.data ) {
  3205. thisCache.data = {};
  3206. }
  3207. thisCache = thisCache.data;
  3208. }
  3209. if ( data !== undefined ) {
  3210. thisCache[ jQuery.camelCase( name ) ] = data;
  3211. }
  3212. // Check for both converted-to-camel and non-converted data property names
  3213. // If a data property was specified
  3214. if ( typeof name === "string" ) {
  3215. // First Try to find as-is property data
  3216. ret = thisCache[ name ];
  3217. // Test for null|undefined property data
  3218. if ( ret == null ) {
  3219. // Try to find the camelCased property
  3220. ret = thisCache[ jQuery.camelCase( name ) ];
  3221. }
  3222. } else {
  3223. ret = thisCache;
  3224. }
  3225. return ret;
  3226. }
  3227. function internalRemoveData( elem, name, pvt ) {
  3228. if ( !acceptData( elem ) ) {
  3229. return;
  3230. }
  3231. var thisCache, i,
  3232. isNode = elem.nodeType,
  3233. // See jQuery.data for more information
  3234. cache = isNode ? jQuery.cache : elem,
  3235. id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
  3236. // If there is already no cache entry for this object, there is no
  3237. // purpose in continuing
  3238. if ( !cache[ id ] ) {
  3239. return;
  3240. }
  3241. if ( name ) {
  3242. thisCache = pvt ? cache[ id ] : cache[ id ].data;
  3243. if ( thisCache ) {
  3244. // Support array or space separated string names for data keys
  3245. if ( !jQuery.isArray( name ) ) {
  3246. // try the string as a key before any manipulation
  3247. if ( name in thisCache ) {
  3248. name = [ name ];
  3249. } else {
  3250. // split the camel cased version by spaces unless a key with the spaces exists
  3251. name = jQuery.camelCase( name );
  3252. if ( name in thisCache ) {
  3253. name = [ name ];
  3254. } else {
  3255. name = name.split( " " );
  3256. }
  3257. }
  3258. } else {
  3259. // If "name" is an array of keys...
  3260. // When data is initially created, via ("key", "val") signature,
  3261. // keys will be converted to camelCase.
  3262. // Since there is no way to tell _how_ a key was added, remove
  3263. // both plain key and camelCase key. #12786
  3264. // This will only penalize the array argument path.
  3265. name = name.concat( jQuery.map( name, jQuery.camelCase ) );
  3266. }
  3267. i = name.length;
  3268. while ( i-- ) {
  3269. delete thisCache[ name[ i ] ];
  3270. }
  3271. // If there is no data left in the cache, we want to continue
  3272. // and let the cache object itself get destroyed
  3273. if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) {
  3274. return;
  3275. }
  3276. }
  3277. }
  3278. // See jQuery.data for more information
  3279. if ( !pvt ) {
  3280. delete cache[ id ].data;
  3281. // Don't destroy the parent cache unless the internal data object
  3282. // had been the only thing left in it
  3283. if ( !isEmptyDataObject( cache[ id ] ) ) {
  3284. return;
  3285. }
  3286. }
  3287. // Destroy the cache
  3288. if ( isNode ) {
  3289. jQuery.cleanData( [ elem ], true );
  3290. // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
  3291. /* jshint eqeqeq: false */
  3292. } else if ( support.deleteExpando || cache != cache.window ) {
  3293. /* jshint eqeqeq: true */
  3294. delete cache[ id ];
  3295. // When all else fails, undefined
  3296. } else {
  3297. cache[ id ] = undefined;
  3298. }
  3299. }
  3300. jQuery.extend( {
  3301. cache: {},
  3302. // The following elements (space-suffixed to avoid Object.prototype collisions)
  3303. // throw uncatchable exceptions if you attempt to set expando properties
  3304. noData: {
  3305. "applet ": true,
  3306. "embed ": true,
  3307. // ...but Flash objects (which have this classid) *can* handle expandos
  3308. "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  3309. },
  3310. hasData: function( elem ) {
  3311. elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ];
  3312. return !!elem && !isEmptyDataObject( elem );
  3313. },
  3314. data: function( elem, name, data ) {
  3315. return internalData( elem, name, data );
  3316. },
  3317. removeData: function( elem, name ) {
  3318. return internalRemoveData( elem, name );
  3319. },
  3320. // For internal use only.
  3321. _data: function( elem, name, data ) {
  3322. return internalData( elem, name, data, true );
  3323. },
  3324. _removeData: function( elem, name ) {
  3325. return internalRemoveData( elem, name, true );
  3326. }
  3327. } );
  3328. jQuery.fn.extend( {
  3329. data: function( key, value ) {
  3330. var i, name, data,
  3331. elem = this[ 0 ],
  3332. attrs = elem && elem.attributes;
  3333. // Special expections of .data basically thwart jQuery.access,
  3334. // so implement the relevant behavior ourselves
  3335. // Gets all values
  3336. if ( key === undefined ) {
  3337. if ( this.length ) {
  3338. data = jQuery.data( elem );
  3339. if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
  3340. i = attrs.length;
  3341. while ( i-- ) {
  3342. // Support: IE11+
  3343. // The attrs elements can be null (#14894)
  3344. if ( attrs[ i ] ) {
  3345. name = attrs[ i ].name;
  3346. if ( name.indexOf( "data-" ) === 0 ) {
  3347. name = jQuery.camelCase( name.slice( 5 ) );
  3348. dataAttr( elem, name, data[ name ] );
  3349. }
  3350. }
  3351. }
  3352. jQuery._data( elem, "parsedAttrs", true );
  3353. }
  3354. }
  3355. return data;
  3356. }
  3357. // Sets multiple values
  3358. if ( typeof key === "object" ) {
  3359. return this.each( function() {
  3360. jQuery.data( this, key );
  3361. } );
  3362. }
  3363. return arguments.length > 1 ?
  3364. // Sets one value
  3365. this.each( function() {
  3366. jQuery.data( this, key, value );
  3367. } ) :
  3368. // Gets one value
  3369. // Try to fetch any internally stored data first
  3370. elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
  3371. },
  3372. removeData: function( key ) {
  3373. return this.each( function() {
  3374. jQuery.removeData( this, key );
  3375. } );
  3376. }
  3377. } );
  3378. jQuery.extend( {
  3379. queue: function( elem, type, data ) {
  3380. var queue;
  3381. if ( elem ) {
  3382. type = ( type || "fx" ) + "queue";
  3383. queue = jQuery._data( elem, type );
  3384. // Speed up dequeue by getting out quickly if this is just a lookup
  3385. if ( data ) {
  3386. if ( !queue || jQuery.isArray( data ) ) {
  3387. queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
  3388. } else {
  3389. queue.push( data );
  3390. }
  3391. }
  3392. return queue || [];
  3393. }
  3394. },
  3395. dequeue: function( elem, type ) {
  3396. type = type || "fx";
  3397. var queue = jQuery.queue( elem, type ),
  3398. startLength = queue.length,
  3399. fn = queue.shift(),
  3400. hooks = jQuery._queueHooks( elem, type ),
  3401. next = function() {
  3402. jQuery.dequeue( elem, type );
  3403. };
  3404. // If the fx queue is dequeued, always remove the progress sentinel
  3405. if ( fn === "inprogress" ) {
  3406. fn = queue.shift();
  3407. startLength--;
  3408. }
  3409. if ( fn ) {
  3410. // Add a progress sentinel to prevent the fx queue from being
  3411. // automatically dequeued
  3412. if ( type === "fx" ) {
  3413. queue.unshift( "inprogress" );
  3414. }
  3415. // clear up the last queue stop function
  3416. delete hooks.stop;
  3417. fn.call( elem, next, hooks );
  3418. }
  3419. if ( !startLength && hooks ) {
  3420. hooks.empty.fire();
  3421. }
  3422. },
  3423. // not intended for public consumption - generates a queueHooks object,
  3424. // or returns the current one
  3425. _queueHooks: function( elem, type ) {
  3426. var key = type + "queueHooks";
  3427. return jQuery._data( elem, key ) || jQuery._data( elem, key, {
  3428. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3429. jQuery._removeData( elem, type + "queue" );
  3430. jQuery._removeData( elem, key );
  3431. } )
  3432. } );
  3433. }
  3434. } );
  3435. jQuery.fn.extend( {
  3436. queue: function( type, data ) {
  3437. var setter = 2;
  3438. if ( typeof type !== "string" ) {
  3439. data = type;
  3440. type = "fx";
  3441. setter--;
  3442. }
  3443. if ( arguments.length < setter ) {
  3444. return jQuery.queue( this[ 0 ], type );
  3445. }
  3446. return data === undefined ?
  3447. this :
  3448. this.each( function() {
  3449. var queue = jQuery.queue( this, type, data );
  3450. // ensure a hooks for this queue
  3451. jQuery._queueHooks( this, type );
  3452. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3453. jQuery.dequeue( this, type );
  3454. }
  3455. } );
  3456. },
  3457. dequeue: function( type ) {
  3458. return this.each( function() {
  3459. jQuery.dequeue( this, type );
  3460. } );
  3461. },
  3462. clearQueue: function( type ) {
  3463. return this.queue( type || "fx", [] );
  3464. },
  3465. // Get a promise resolved when queues of a certain type
  3466. // are emptied (fx is the type by default)
  3467. promise: function( type, obj ) {
  3468. var tmp,
  3469. count = 1,
  3470. defer = jQuery.Deferred(),
  3471. elements = this,
  3472. i = this.length,
  3473. resolve = function() {
  3474. if ( !( --count ) ) {
  3475. defer.resolveWith( elements, [ elements ] );
  3476. }
  3477. };
  3478. if ( typeof type !== "string" ) {
  3479. obj = type;
  3480. type = undefined;
  3481. }
  3482. type = type || "fx";
  3483. while ( i-- ) {
  3484. tmp = jQuery._data( elements[ i ], type + "queueHooks" );
  3485. if ( tmp && tmp.empty ) {
  3486. count++;
  3487. tmp.empty.add( resolve );
  3488. }
  3489. }
  3490. resolve();
  3491. return defer.promise( obj );
  3492. }
  3493. } );
  3494. ( function() {
  3495. var shrinkWrapBlocksVal;
  3496. support.shrinkWrapBlocks = function() {
  3497. if ( shrinkWrapBlocksVal != null ) {
  3498. return shrinkWrapBlocksVal;
  3499. }
  3500. // Will be changed later if needed.
  3501. shrinkWrapBlocksVal = false;
  3502. // Minified: var b,c,d
  3503. var div, body, container;
  3504. body = document.getElementsByTagName( "body" )[ 0 ];
  3505. if ( !body || !body.style ) {
  3506. // Test fired too early or in an unsupported environment, exit.
  3507. return;
  3508. }
  3509. // Setup
  3510. div = document.createElement( "div" );
  3511. container = document.createElement( "div" );
  3512. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  3513. body.appendChild( container ).appendChild( div );
  3514. // Support: IE6
  3515. // Check if elements with layout shrink-wrap their children
  3516. if ( typeof div.style.zoom !== "undefined" ) {
  3517. // Reset CSS: box-sizing; display; margin; border
  3518. div.style.cssText =
  3519. // Support: Firefox<29, Android 2.3
  3520. // Vendor-prefix box-sizing
  3521. "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  3522. "box-sizing:content-box;display:block;margin:0;border:0;" +
  3523. "padding:1px;width:1px;zoom:1";
  3524. div.appendChild( document.createElement( "div" ) ).style.width = "5px";
  3525. shrinkWrapBlocksVal = div.offsetWidth !== 3;
  3526. }
  3527. body.removeChild( container );
  3528. return shrinkWrapBlocksVal;
  3529. };
  3530. } )();
  3531. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3532. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3533. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3534. var isHidden = function( elem, el ) {
  3535. // isHidden might be called from jQuery#filter function;
  3536. // in that case, element will be second argument
  3537. elem = el || elem;
  3538. return jQuery.css( elem, "display" ) === "none" ||
  3539. !jQuery.contains( elem.ownerDocument, elem );
  3540. };
  3541. function adjustCSS( elem, prop, valueParts, tween ) {
  3542. var adjusted,
  3543. scale = 1,
  3544. maxIterations = 20,
  3545. currentValue = tween ?
  3546. function() { return tween.cur(); } :
  3547. function() { return jQuery.css( elem, prop, "" ); },
  3548. initial = currentValue(),
  3549. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3550. // Starting value computation is required for potential unit mismatches
  3551. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3552. rcssNum.exec( jQuery.css( elem, prop ) );
  3553. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3554. // Trust units reported by jQuery.css
  3555. unit = unit || initialInUnit[ 3 ];
  3556. // Make sure we update the tween properties later on
  3557. valueParts = valueParts || [];
  3558. // Iteratively approximate from a nonzero starting point
  3559. initialInUnit = +initial || 1;
  3560. do {
  3561. // If previous iteration zeroed out, double until we get *something*.
  3562. // Use string for doubling so we don't accidentally see scale as unchanged below
  3563. scale = scale || ".5";
  3564. // Adjust and apply
  3565. initialInUnit = initialInUnit / scale;
  3566. jQuery.style( elem, prop, initialInUnit + unit );
  3567. // Update scale, tolerating zero or NaN from tween.cur()
  3568. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  3569. } while (
  3570. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  3571. );
  3572. }
  3573. if ( valueParts ) {
  3574. initialInUnit = +initialInUnit || +initial || 0;
  3575. // Apply relative offset (+=/-=) if specified
  3576. adjusted = valueParts[ 1 ] ?
  3577. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3578. +valueParts[ 2 ];
  3579. if ( tween ) {
  3580. tween.unit = unit;
  3581. tween.start = initialInUnit;
  3582. tween.end = adjusted;
  3583. }
  3584. }
  3585. return adjusted;
  3586. }
  3587. // Multifunctional method to get and set values of a collection
  3588. // The value/s can optionally be executed if it's a function
  3589. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3590. var i = 0,
  3591. length = elems.length,
  3592. bulk = key == null;
  3593. // Sets many values
  3594. if ( jQuery.type( key ) === "object" ) {
  3595. chainable = true;
  3596. for ( i in key ) {
  3597. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3598. }
  3599. // Sets one value
  3600. } else if ( value !== undefined ) {
  3601. chainable = true;
  3602. if ( !jQuery.isFunction( value ) ) {
  3603. raw = true;
  3604. }
  3605. if ( bulk ) {
  3606. // Bulk operations run against the entire set
  3607. if ( raw ) {
  3608. fn.call( elems, value );
  3609. fn = null;
  3610. // ...except when executing function values
  3611. } else {
  3612. bulk = fn;
  3613. fn = function( elem, key, value ) {
  3614. return bulk.call( jQuery( elem ), value );
  3615. };
  3616. }
  3617. }
  3618. if ( fn ) {
  3619. for ( ; i < length; i++ ) {
  3620. fn(
  3621. elems[ i ],
  3622. key,
  3623. raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3624. );
  3625. }
  3626. }
  3627. }
  3628. return chainable ?
  3629. elems :
  3630. // Gets
  3631. bulk ?
  3632. fn.call( elems ) :
  3633. length ? fn( elems[ 0 ], key ) : emptyGet;
  3634. };
  3635. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3636. var rtagName = ( /<([\w:-]+)/ );
  3637. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  3638. var rleadingWhitespace = ( /^\s+/ );
  3639. var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
  3640. "details|dialog|figcaption|figure|footer|header|hgroup|main|" +
  3641. "mark|meter|nav|output|picture|progress|section|summary|template|time|video";
  3642. function createSafeFragment( document ) {
  3643. var list = nodeNames.split( "|" ),
  3644. safeFrag = document.createDocumentFragment();
  3645. if ( safeFrag.createElement ) {
  3646. while ( list.length ) {
  3647. safeFrag.createElement(
  3648. list.pop()
  3649. );
  3650. }
  3651. }
  3652. return safeFrag;
  3653. }
  3654. ( function() {
  3655. var div = document.createElement( "div" ),
  3656. fragment = document.createDocumentFragment(),
  3657. input = document.createElement( "input" );
  3658. // Setup
  3659. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  3660. // IE strips leading whitespace when .innerHTML is used
  3661. support.leadingWhitespace = div.firstChild.nodeType === 3;
  3662. // Make sure that tbody elements aren't automatically inserted
  3663. // IE will insert them into empty tables
  3664. support.tbody = !div.getElementsByTagName( "tbody" ).length;
  3665. // Make sure that link elements get serialized correctly by innerHTML
  3666. // This requires a wrapper element in IE
  3667. support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
  3668. // Makes sure cloning an html5 element does not cause problems
  3669. // Where outerHTML is undefined, this still works
  3670. support.html5Clone =
  3671. document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
  3672. // Check if a disconnected checkbox will retain its checked
  3673. // value of true after appended to the DOM (IE6/7)
  3674. input.type = "checkbox";
  3675. input.checked = true;
  3676. fragment.appendChild( input );
  3677. support.appendChecked = input.checked;
  3678. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3679. // Support: IE6-IE11+
  3680. div.innerHTML = "<textarea>x</textarea>";
  3681. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3682. // #11217 - WebKit loses check when the name is after the checked attribute
  3683. fragment.appendChild( div );
  3684. // Support: Windows Web Apps (WWA)
  3685. // `name` and `type` must use .setAttribute for WWA (#14901)
  3686. input = document.createElement( "input" );
  3687. input.setAttribute( "type", "radio" );
  3688. input.setAttribute( "checked", "checked" );
  3689. input.setAttribute( "name", "t" );
  3690. div.appendChild( input );
  3691. // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
  3692. // old WebKit doesn't clone checked state correctly in fragments
  3693. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3694. // Support: IE<9
  3695. // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
  3696. support.noCloneEvent = !!div.addEventListener;
  3697. // Support: IE<9
  3698. // Since attributes and properties are the same in IE,
  3699. // cleanData must set properties to undefined rather than use removeAttribute
  3700. div[ jQuery.expando ] = 1;
  3701. support.attributes = !div.getAttribute( jQuery.expando );
  3702. } )();
  3703. // We have to close these tags to support XHTML (#13200)
  3704. var wrapMap = {
  3705. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3706. legend: [ 1, "<fieldset>", "</fieldset>" ],
  3707. area: [ 1, "<map>", "</map>" ],
  3708. // Support: IE8
  3709. param: [ 1, "<object>", "</object>" ],
  3710. thead: [ 1, "<table>", "</table>" ],
  3711. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3712. col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
  3713. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3714. // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
  3715. // unless wrapped in a div with non-breaking characters in front of it.
  3716. _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
  3717. };
  3718. // Support: IE8-IE9
  3719. wrapMap.optgroup = wrapMap.option;
  3720. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3721. wrapMap.th = wrapMap.td;
  3722. function getAll( context, tag ) {
  3723. var elems, elem,
  3724. i = 0,
  3725. found = typeof context.getElementsByTagName !== "undefined" ?
  3726. context.getElementsByTagName( tag || "*" ) :
  3727. typeof context.querySelectorAll !== "undefined" ?
  3728. context.querySelectorAll( tag || "*" ) :
  3729. undefined;
  3730. if ( !found ) {
  3731. for ( found = [], elems = context.childNodes || context;
  3732. ( elem = elems[ i ] ) != null;
  3733. i++
  3734. ) {
  3735. if ( !tag || jQuery.nodeName( elem, tag ) ) {
  3736. found.push( elem );
  3737. } else {
  3738. jQuery.merge( found, getAll( elem, tag ) );
  3739. }
  3740. }
  3741. }
  3742. return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
  3743. jQuery.merge( [ context ], found ) :
  3744. found;
  3745. }
  3746. // Mark scripts as having already been evaluated
  3747. function setGlobalEval( elems, refElements ) {
  3748. var elem,
  3749. i = 0;
  3750. for ( ; ( elem = elems[ i ] ) != null; i++ ) {
  3751. jQuery._data(
  3752. elem,
  3753. "globalEval",
  3754. !refElements || jQuery._data( refElements[ i ], "globalEval" )
  3755. );
  3756. }
  3757. }
  3758. var rhtml = /<|&#?\w+;/,
  3759. rtbody = /<tbody/i;
  3760. function fixDefaultChecked( elem ) {
  3761. if ( rcheckableType.test( elem.type ) ) {
  3762. elem.defaultChecked = elem.checked;
  3763. }
  3764. }
  3765. function buildFragment( elems, context, scripts, selection, ignored ) {
  3766. var j, elem, contains,
  3767. tmp, tag, tbody, wrap,
  3768. l = elems.length,
  3769. // Ensure a safe fragment
  3770. safe = createSafeFragment( context ),
  3771. nodes = [],
  3772. i = 0;
  3773. for ( ; i < l; i++ ) {
  3774. elem = elems[ i ];
  3775. if ( elem || elem === 0 ) {
  3776. // Add nodes directly
  3777. if ( jQuery.type( elem ) === "object" ) {
  3778. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  3779. // Convert non-html into a text node
  3780. } else if ( !rhtml.test( elem ) ) {
  3781. nodes.push( context.createTextNode( elem ) );
  3782. // Convert html into DOM nodes
  3783. } else {
  3784. tmp = tmp || safe.appendChild( context.createElement( "div" ) );
  3785. // Deserialize a standard representation
  3786. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  3787. wrap = wrapMap[ tag ] || wrapMap._default;
  3788. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  3789. // Descend through wrappers to the right content
  3790. j = wrap[ 0 ];
  3791. while ( j-- ) {
  3792. tmp = tmp.lastChild;
  3793. }
  3794. // Manually add leading whitespace removed by IE
  3795. if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
  3796. nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
  3797. }
  3798. // Remove IE's autoinserted <tbody> from table fragments
  3799. if ( !support.tbody ) {
  3800. // String was a <table>, *may* have spurious <tbody>
  3801. elem = tag === "table" && !rtbody.test( elem ) ?
  3802. tmp.firstChild :
  3803. // String was a bare <thead> or <tfoot>
  3804. wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
  3805. tmp :
  3806. 0;
  3807. j = elem && elem.childNodes.length;
  3808. while ( j-- ) {
  3809. if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
  3810. !tbody.childNodes.length ) {
  3811. elem.removeChild( tbody );
  3812. }
  3813. }
  3814. }
  3815. jQuery.merge( nodes, tmp.childNodes );
  3816. // Fix #12392 for WebKit and IE > 9
  3817. tmp.textContent = "";
  3818. // Fix #12392 for oldIE
  3819. while ( tmp.firstChild ) {
  3820. tmp.removeChild( tmp.firstChild );
  3821. }
  3822. // Remember the top-level container for proper cleanup
  3823. tmp = safe.lastChild;
  3824. }
  3825. }
  3826. }
  3827. // Fix #11356: Clear elements from fragment
  3828. if ( tmp ) {
  3829. safe.removeChild( tmp );
  3830. }
  3831. // Reset defaultChecked for any radios and checkboxes
  3832. // about to be appended to the DOM in IE 6/7 (#8060)
  3833. if ( !support.appendChecked ) {
  3834. jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
  3835. }
  3836. i = 0;
  3837. while ( ( elem = nodes[ i++ ] ) ) {
  3838. // Skip elements already in the context collection (trac-4087)
  3839. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  3840. if ( ignored ) {
  3841. ignored.push( elem );
  3842. }
  3843. continue;
  3844. }
  3845. contains = jQuery.contains( elem.ownerDocument, elem );
  3846. // Append to fragment
  3847. tmp = getAll( safe.appendChild( elem ), "script" );
  3848. // Preserve script evaluation history
  3849. if ( contains ) {
  3850. setGlobalEval( tmp );
  3851. }
  3852. // Capture executables
  3853. if ( scripts ) {
  3854. j = 0;
  3855. while ( ( elem = tmp[ j++ ] ) ) {
  3856. if ( rscriptType.test( elem.type || "" ) ) {
  3857. scripts.push( elem );
  3858. }
  3859. }
  3860. }
  3861. }
  3862. tmp = null;
  3863. return safe;
  3864. }
  3865. ( function() {
  3866. var i, eventName,
  3867. div = document.createElement( "div" );
  3868. // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)
  3869. for ( i in { submit: true, change: true, focusin: true } ) {
  3870. eventName = "on" + i;
  3871. if ( !( support[ i ] = eventName in window ) ) {
  3872. // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
  3873. div.setAttribute( eventName, "t" );
  3874. support[ i ] = div.attributes[ eventName ].expando === false;
  3875. }
  3876. }
  3877. // Null elements to avoid leaks in IE.
  3878. div = null;
  3879. } )();
  3880. var rformElems = /^(?:input|select|textarea)$/i,
  3881. rkeyEvent = /^key/,
  3882. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3883. rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  3884. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3885. function returnTrue() {
  3886. return true;
  3887. }
  3888. function returnFalse() {
  3889. return false;
  3890. }
  3891. // Support: IE9
  3892. // See #13393 for more info
  3893. function safeActiveElement() {
  3894. try {
  3895. return document.activeElement;
  3896. } catch ( err ) { }
  3897. }
  3898. function on( elem, types, selector, data, fn, one ) {
  3899. var origFn, type;
  3900. // Types can be a map of types/handlers
  3901. if ( typeof types === "object" ) {
  3902. // ( types-Object, selector, data )
  3903. if ( typeof selector !== "string" ) {
  3904. // ( types-Object, data )
  3905. data = data || selector;
  3906. selector = undefined;
  3907. }
  3908. for ( type in types ) {
  3909. on( elem, type, selector, data, types[ type ], one );
  3910. }
  3911. return elem;
  3912. }
  3913. if ( data == null && fn == null ) {
  3914. // ( types, fn )
  3915. fn = selector;
  3916. data = selector = undefined;
  3917. } else if ( fn == null ) {
  3918. if ( typeof selector === "string" ) {
  3919. // ( types, selector, fn )
  3920. fn = data;
  3921. data = undefined;
  3922. } else {
  3923. // ( types, data, fn )
  3924. fn = data;
  3925. data = selector;
  3926. selector = undefined;
  3927. }
  3928. }
  3929. if ( fn === false ) {
  3930. fn = returnFalse;
  3931. } else if ( !fn ) {
  3932. return elem;
  3933. }
  3934. if ( one === 1 ) {
  3935. origFn = fn;
  3936. fn = function( event ) {
  3937. // Can use an empty set, since event contains the info
  3938. jQuery().off( event );
  3939. return origFn.apply( this, arguments );
  3940. };
  3941. // Use same guid so caller can remove using origFn
  3942. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  3943. }
  3944. return elem.each( function() {
  3945. jQuery.event.add( this, types, fn, data, selector );
  3946. } );
  3947. }
  3948. /*
  3949. * Helper functions for managing events -- not part of the public interface.
  3950. * Props to Dean Edwards' addEvent library for many of the ideas.
  3951. */
  3952. jQuery.event = {
  3953. global: {},
  3954. add: function( elem, types, handler, data, selector ) {
  3955. var tmp, events, t, handleObjIn,
  3956. special, eventHandle, handleObj,
  3957. handlers, type, namespaces, origType,
  3958. elemData = jQuery._data( elem );
  3959. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  3960. if ( !elemData ) {
  3961. return;
  3962. }
  3963. // Caller can pass in an object of custom data in lieu of the handler
  3964. if ( handler.handler ) {
  3965. handleObjIn = handler;
  3966. handler = handleObjIn.handler;
  3967. selector = handleObjIn.selector;
  3968. }
  3969. // Make sure that the handler has a unique ID, used to find/remove it later
  3970. if ( !handler.guid ) {
  3971. handler.guid = jQuery.guid++;
  3972. }
  3973. // Init the element's event structure and main handler, if this is the first
  3974. if ( !( events = elemData.events ) ) {
  3975. events = elemData.events = {};
  3976. }
  3977. if ( !( eventHandle = elemData.handle ) ) {
  3978. eventHandle = elemData.handle = function( e ) {
  3979. // Discard the second event of a jQuery.event.trigger() and
  3980. // when an event is called after a page has unloaded
  3981. return typeof jQuery !== "undefined" &&
  3982. ( !e || jQuery.event.triggered !== e.type ) ?
  3983. jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
  3984. undefined;
  3985. };
  3986. // Add elem as a property of the handle fn to prevent a memory leak
  3987. // with IE non-native events
  3988. eventHandle.elem = elem;
  3989. }
  3990. // Handle multiple events separated by a space
  3991. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  3992. t = types.length;
  3993. while ( t-- ) {
  3994. tmp = rtypenamespace.exec( types[ t ] ) || [];
  3995. type = origType = tmp[ 1 ];
  3996. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  3997. // There *must* be a type, no attaching namespace-only handlers
  3998. if ( !type ) {
  3999. continue;
  4000. }
  4001. // If event changes its type, use the special event handlers for the changed type
  4002. special = jQuery.event.special[ type ] || {};
  4003. // If selector defined, determine special event api type, otherwise given type
  4004. type = ( selector ? special.delegateType : special.bindType ) || type;
  4005. // Update special based on newly reset type
  4006. special = jQuery.event.special[ type ] || {};
  4007. // handleObj is passed to all event handlers
  4008. handleObj = jQuery.extend( {
  4009. type: type,
  4010. origType: origType,
  4011. data: data,
  4012. handler: handler,
  4013. guid: handler.guid,
  4014. selector: selector,
  4015. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4016. namespace: namespaces.join( "." )
  4017. }, handleObjIn );
  4018. // Init the event handler queue if we're the first
  4019. if ( !( handlers = events[ type ] ) ) {
  4020. handlers = events[ type ] = [];
  4021. handlers.delegateCount = 0;
  4022. // Only use addEventListener/attachEvent if the special events handler returns false
  4023. if ( !special.setup ||
  4024. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4025. // Bind the global event handler to the element
  4026. if ( elem.addEventListener ) {
  4027. elem.addEventListener( type, eventHandle, false );
  4028. } else if ( elem.attachEvent ) {
  4029. elem.attachEvent( "on" + type, eventHandle );
  4030. }
  4031. }
  4032. }
  4033. if ( special.add ) {
  4034. special.add.call( elem, handleObj );
  4035. if ( !handleObj.handler.guid ) {
  4036. handleObj.handler.guid = handler.guid;
  4037. }
  4038. }
  4039. // Add to the element's handler list, delegates in front
  4040. if ( selector ) {
  4041. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4042. } else {
  4043. handlers.push( handleObj );
  4044. }
  4045. // Keep track of which events have ever been used, for event optimization
  4046. jQuery.event.global[ type ] = true;
  4047. }
  4048. // Nullify elem to prevent memory leaks in IE
  4049. elem = null;
  4050. },
  4051. // Detach an event or set of events from an element
  4052. remove: function( elem, types, handler, selector, mappedTypes ) {
  4053. var j, handleObj, tmp,
  4054. origCount, t, events,
  4055. special, handlers, type,
  4056. namespaces, origType,
  4057. elemData = jQuery.hasData( elem ) && jQuery._data( elem );
  4058. if ( !elemData || !( events = elemData.events ) ) {
  4059. return;
  4060. }
  4061. // Once for each type.namespace in types; type may be omitted
  4062. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  4063. t = types.length;
  4064. while ( t-- ) {
  4065. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4066. type = origType = tmp[ 1 ];
  4067. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4068. // Unbind all events (on this namespace, if provided) for the element
  4069. if ( !type ) {
  4070. for ( type in events ) {
  4071. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4072. }
  4073. continue;
  4074. }
  4075. special = jQuery.event.special[ type ] || {};
  4076. type = ( selector ? special.delegateType : special.bindType ) || type;
  4077. handlers = events[ type ] || [];
  4078. tmp = tmp[ 2 ] &&
  4079. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4080. // Remove matching events
  4081. origCount = j = handlers.length;
  4082. while ( j-- ) {
  4083. handleObj = handlers[ j ];
  4084. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4085. ( !handler || handler.guid === handleObj.guid ) &&
  4086. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4087. ( !selector || selector === handleObj.selector ||
  4088. selector === "**" && handleObj.selector ) ) {
  4089. handlers.splice( j, 1 );
  4090. if ( handleObj.selector ) {
  4091. handlers.delegateCount--;
  4092. }
  4093. if ( special.remove ) {
  4094. special.remove.call( elem, handleObj );
  4095. }
  4096. }
  4097. }
  4098. // Remove generic event handler if we removed something and no more handlers exist
  4099. // (avoids potential for endless recursion during removal of special event handlers)
  4100. if ( origCount && !handlers.length ) {
  4101. if ( !special.teardown ||
  4102. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4103. jQuery.removeEvent( elem, type, elemData.handle );
  4104. }
  4105. delete events[ type ];
  4106. }
  4107. }
  4108. // Remove the expando if it's no longer used
  4109. if ( jQuery.isEmptyObject( events ) ) {
  4110. delete elemData.handle;
  4111. // removeData also checks for emptiness and clears the expando if empty
  4112. // so use it instead of delete
  4113. jQuery._removeData( elem, "events" );
  4114. }
  4115. },
  4116. trigger: function( event, data, elem, onlyHandlers ) {
  4117. var handle, ontype, cur,
  4118. bubbleType, special, tmp, i,
  4119. eventPath = [ elem || document ],
  4120. type = hasOwn.call( event, "type" ) ? event.type : event,
  4121. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  4122. cur = tmp = elem = elem || document;
  4123. // Don't do events on text and comment nodes
  4124. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  4125. return;
  4126. }
  4127. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  4128. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  4129. return;
  4130. }
  4131. if ( type.indexOf( "." ) > -1 ) {
  4132. // Namespaced trigger; create a regexp to match event type in handle()
  4133. namespaces = type.split( "." );
  4134. type = namespaces.shift();
  4135. namespaces.sort();
  4136. }
  4137. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  4138. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  4139. event = event[ jQuery.expando ] ?
  4140. event :
  4141. new jQuery.Event( type, typeof event === "object" && event );
  4142. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  4143. event.isTrigger = onlyHandlers ? 2 : 3;
  4144. event.namespace = namespaces.join( "." );
  4145. event.rnamespace = event.namespace ?
  4146. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  4147. null;
  4148. // Clean up the event in case it is being reused
  4149. event.result = undefined;
  4150. if ( !event.target ) {
  4151. event.target = elem;
  4152. }
  4153. // Clone any incoming data and prepend the event, creating the handler arg list
  4154. data = data == null ?
  4155. [ event ] :
  4156. jQuery.makeArray( data, [ event ] );
  4157. // Allow special events to draw outside the lines
  4158. special = jQuery.event.special[ type ] || {};
  4159. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  4160. return;
  4161. }
  4162. // Determine event propagation path in advance, per W3C events spec (#9951)
  4163. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  4164. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  4165. bubbleType = special.delegateType || type;
  4166. if ( !rfocusMorph.test( bubbleType + type ) ) {
  4167. cur = cur.parentNode;
  4168. }
  4169. for ( ; cur; cur = cur.parentNode ) {
  4170. eventPath.push( cur );
  4171. tmp = cur;
  4172. }
  4173. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  4174. if ( tmp === ( elem.ownerDocument || document ) ) {
  4175. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  4176. }
  4177. }
  4178. // Fire handlers on the event path
  4179. i = 0;
  4180. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  4181. event.type = i > 1 ?
  4182. bubbleType :
  4183. special.bindType || type;
  4184. // jQuery handler
  4185. handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
  4186. jQuery._data( cur, "handle" );
  4187. if ( handle ) {
  4188. handle.apply( cur, data );
  4189. }
  4190. // Native handler
  4191. handle = ontype && cur[ ontype ];
  4192. if ( handle && handle.apply && acceptData( cur ) ) {
  4193. event.result = handle.apply( cur, data );
  4194. if ( event.result === false ) {
  4195. event.preventDefault();
  4196. }
  4197. }
  4198. }
  4199. event.type = type;
  4200. // If nobody prevented the default action, do it now
  4201. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  4202. if (
  4203. ( !special._default ||
  4204. special._default.apply( eventPath.pop(), data ) === false
  4205. ) && acceptData( elem )
  4206. ) {
  4207. // Call a native DOM method on the target with the same name name as the event.
  4208. // Can't use an .isFunction() check here because IE6/7 fails that test.
  4209. // Don't do default actions on window, that's where global variables be (#6170)
  4210. if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
  4211. // Don't re-trigger an onFOO event when we call its FOO() method
  4212. tmp = elem[ ontype ];
  4213. if ( tmp ) {
  4214. elem[ ontype ] = null;
  4215. }
  4216. // Prevent re-triggering of the same event, since we already bubbled it above
  4217. jQuery.event.triggered = type;
  4218. try {
  4219. elem[ type ]();
  4220. } catch ( e ) {
  4221. // IE<9 dies on focus/blur to hidden element (#1486,#12518)
  4222. // only reproducible on winXP IE8 native, not IE9 in IE8 mode
  4223. }
  4224. jQuery.event.triggered = undefined;
  4225. if ( tmp ) {
  4226. elem[ ontype ] = tmp;
  4227. }
  4228. }
  4229. }
  4230. }
  4231. return event.result;
  4232. },
  4233. dispatch: function( event ) {
  4234. // Make a writable jQuery.Event from the native event object
  4235. event = jQuery.event.fix( event );
  4236. var i, j, ret, matched, handleObj,
  4237. handlerQueue = [],
  4238. args = slice.call( arguments ),
  4239. handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
  4240. special = jQuery.event.special[ event.type ] || {};
  4241. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4242. args[ 0 ] = event;
  4243. event.delegateTarget = this;
  4244. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4245. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4246. return;
  4247. }
  4248. // Determine handlers
  4249. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4250. // Run delegates first; they may want to stop propagation beneath us
  4251. i = 0;
  4252. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4253. event.currentTarget = matched.elem;
  4254. j = 0;
  4255. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4256. !event.isImmediatePropagationStopped() ) {
  4257. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4258. // a subset or equal to those in the bound event (both can have no namespace).
  4259. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4260. event.handleObj = handleObj;
  4261. event.data = handleObj.data;
  4262. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4263. handleObj.handler ).apply( matched.elem, args );
  4264. if ( ret !== undefined ) {
  4265. if ( ( event.result = ret ) === false ) {
  4266. event.preventDefault();
  4267. event.stopPropagation();
  4268. }
  4269. }
  4270. }
  4271. }
  4272. }
  4273. // Call the postDispatch hook for the mapped type
  4274. if ( special.postDispatch ) {
  4275. special.postDispatch.call( this, event );
  4276. }
  4277. return event.result;
  4278. },
  4279. handlers: function( event, handlers ) {
  4280. var i, matches, sel, handleObj,
  4281. handlerQueue = [],
  4282. delegateCount = handlers.delegateCount,
  4283. cur = event.target;
  4284. // Support (at least): Chrome, IE9
  4285. // Find delegate handlers
  4286. // Black-hole SVG <use> instance trees (#13180)
  4287. //
  4288. // Support: Firefox<=42+
  4289. // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
  4290. if ( delegateCount && cur.nodeType &&
  4291. ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
  4292. /* jshint eqeqeq: false */
  4293. for ( ; cur != this; cur = cur.parentNode || this ) {
  4294. /* jshint eqeqeq: true */
  4295. // Don't check non-elements (#13208)
  4296. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4297. if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
  4298. matches = [];
  4299. for ( i = 0; i < delegateCount; i++ ) {
  4300. handleObj = handlers[ i ];
  4301. // Don't conflict with Object.prototype properties (#13203)
  4302. sel = handleObj.selector + " ";
  4303. if ( matches[ sel ] === undefined ) {
  4304. matches[ sel ] = handleObj.needsContext ?
  4305. jQuery( sel, this ).index( cur ) > -1 :
  4306. jQuery.find( sel, this, null, [ cur ] ).length;
  4307. }
  4308. if ( matches[ sel ] ) {
  4309. matches.push( handleObj );
  4310. }
  4311. }
  4312. if ( matches.length ) {
  4313. handlerQueue.push( { elem: cur, handlers: matches } );
  4314. }
  4315. }
  4316. }
  4317. }
  4318. // Add the remaining (directly-bound) handlers
  4319. if ( delegateCount < handlers.length ) {
  4320. handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
  4321. }
  4322. return handlerQueue;
  4323. },
  4324. fix: function( event ) {
  4325. if ( event[ jQuery.expando ] ) {
  4326. return event;
  4327. }
  4328. // Create a writable copy of the event object and normalize some properties
  4329. var i, prop, copy,
  4330. type = event.type,
  4331. originalEvent = event,
  4332. fixHook = this.fixHooks[ type ];
  4333. if ( !fixHook ) {
  4334. this.fixHooks[ type ] = fixHook =
  4335. rmouseEvent.test( type ) ? this.mouseHooks :
  4336. rkeyEvent.test( type ) ? this.keyHooks :
  4337. {};
  4338. }
  4339. copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
  4340. event = new jQuery.Event( originalEvent );
  4341. i = copy.length;
  4342. while ( i-- ) {
  4343. prop = copy[ i ];
  4344. event[ prop ] = originalEvent[ prop ];
  4345. }
  4346. // Support: IE<9
  4347. // Fix target property (#1925)
  4348. if ( !event.target ) {
  4349. event.target = originalEvent.srcElement || document;
  4350. }
  4351. // Support: Safari 6-8+
  4352. // Target should not be a text node (#504, #13143)
  4353. if ( event.target.nodeType === 3 ) {
  4354. event.target = event.target.parentNode;
  4355. }
  4356. // Support: IE<9
  4357. // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
  4358. event.metaKey = !!event.metaKey;
  4359. return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
  4360. },
  4361. // Includes some event props shared by KeyEvent and MouseEvent
  4362. props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
  4363. "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
  4364. fixHooks: {},
  4365. keyHooks: {
  4366. props: "char charCode key keyCode".split( " " ),
  4367. filter: function( event, original ) {
  4368. // Add which for key events
  4369. if ( event.which == null ) {
  4370. event.which = original.charCode != null ? original.charCode : original.keyCode;
  4371. }
  4372. return event;
  4373. }
  4374. },
  4375. mouseHooks: {
  4376. props: ( "button buttons clientX clientY fromElement offsetX offsetY " +
  4377. "pageX pageY screenX screenY toElement" ).split( " " ),
  4378. filter: function( event, original ) {
  4379. var body, eventDoc, doc,
  4380. button = original.button,
  4381. fromElement = original.fromElement;
  4382. // Calculate pageX/Y if missing and clientX/Y available
  4383. if ( event.pageX == null && original.clientX != null ) {
  4384. eventDoc = event.target.ownerDocument || document;
  4385. doc = eventDoc.documentElement;
  4386. body = eventDoc.body;
  4387. event.pageX = original.clientX +
  4388. ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
  4389. ( doc && doc.clientLeft || body && body.clientLeft || 0 );
  4390. event.pageY = original.clientY +
  4391. ( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
  4392. ( doc && doc.clientTop || body && body.clientTop || 0 );
  4393. }
  4394. // Add relatedTarget, if necessary
  4395. if ( !event.relatedTarget && fromElement ) {
  4396. event.relatedTarget = fromElement === event.target ?
  4397. original.toElement :
  4398. fromElement;
  4399. }
  4400. // Add which for click: 1 === left; 2 === middle; 3 === right
  4401. // Note: button is not normalized, so don't use it
  4402. if ( !event.which && button !== undefined ) {
  4403. event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
  4404. }
  4405. return event;
  4406. }
  4407. },
  4408. special: {
  4409. load: {
  4410. // Prevent triggered image.load events from bubbling to window.load
  4411. noBubble: true
  4412. },
  4413. focus: {
  4414. // Fire native event if possible so blur/focus sequence is correct
  4415. trigger: function() {
  4416. if ( this !== safeActiveElement() && this.focus ) {
  4417. try {
  4418. this.focus();
  4419. return false;
  4420. } catch ( e ) {
  4421. // Support: IE<9
  4422. // If we error on focus to hidden element (#1486, #12518),
  4423. // let .trigger() run the handlers
  4424. }
  4425. }
  4426. },
  4427. delegateType: "focusin"
  4428. },
  4429. blur: {
  4430. trigger: function() {
  4431. if ( this === safeActiveElement() && this.blur ) {
  4432. this.blur();
  4433. return false;
  4434. }
  4435. },
  4436. delegateType: "focusout"
  4437. },
  4438. click: {
  4439. // For checkbox, fire native event so checked state will be right
  4440. trigger: function() {
  4441. if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
  4442. this.click();
  4443. return false;
  4444. }
  4445. },
  4446. // For cross-browser consistency, don't fire native .click() on links
  4447. _default: function( event ) {
  4448. return jQuery.nodeName( event.target, "a" );
  4449. }
  4450. },
  4451. beforeunload: {
  4452. postDispatch: function( event ) {
  4453. // Support: Firefox 20+
  4454. // Firefox doesn't alert if the returnValue field is not set.
  4455. if ( event.result !== undefined && event.originalEvent ) {
  4456. event.originalEvent.returnValue = event.result;
  4457. }
  4458. }
  4459. }
  4460. },
  4461. // Piggyback on a donor event to simulate a different one
  4462. simulate: function( type, elem, event ) {
  4463. var e = jQuery.extend(
  4464. new jQuery.Event(),
  4465. event,
  4466. {
  4467. type: type,
  4468. isSimulated: true
  4469. // Previously, `originalEvent: {}` was set here, so stopPropagation call
  4470. // would not be triggered on donor event, since in our own
  4471. // jQuery.event.stopPropagation function we had a check for existence of
  4472. // originalEvent.stopPropagation method, so, consequently it would be a noop.
  4473. //
  4474. // Guard for simulated events was moved to jQuery.event.stopPropagation function
  4475. // since `originalEvent` should point to the original event for the
  4476. // constancy with other events and for more focused logic
  4477. }
  4478. );
  4479. jQuery.event.trigger( e, null, elem );
  4480. if ( e.isDefaultPrevented() ) {
  4481. event.preventDefault();
  4482. }
  4483. }
  4484. };
  4485. jQuery.removeEvent = document.removeEventListener ?
  4486. function( elem, type, handle ) {
  4487. // This "if" is needed for plain objects
  4488. if ( elem.removeEventListener ) {
  4489. elem.removeEventListener( type, handle );
  4490. }
  4491. } :
  4492. function( elem, type, handle ) {
  4493. var name = "on" + type;
  4494. if ( elem.detachEvent ) {
  4495. // #8545, #7054, preventing memory leaks for custom events in IE6-8
  4496. // detachEvent needed property on element, by name of that event,
  4497. // to properly expose it to GC
  4498. if ( typeof elem[ name ] === "undefined" ) {
  4499. elem[ name ] = null;
  4500. }
  4501. elem.detachEvent( name, handle );
  4502. }
  4503. };
  4504. jQuery.Event = function( src, props ) {
  4505. // Allow instantiation without the 'new' keyword
  4506. if ( !( this instanceof jQuery.Event ) ) {
  4507. return new jQuery.Event( src, props );
  4508. }
  4509. // Event object
  4510. if ( src && src.type ) {
  4511. this.originalEvent = src;
  4512. this.type = src.type;
  4513. // Events bubbling up the document may have been marked as prevented
  4514. // by a handler lower down the tree; reflect the correct value.
  4515. this.isDefaultPrevented = src.defaultPrevented ||
  4516. src.defaultPrevented === undefined &&
  4517. // Support: IE < 9, Android < 4.0
  4518. src.returnValue === false ?
  4519. returnTrue :
  4520. returnFalse;
  4521. // Event type
  4522. } else {
  4523. this.type = src;
  4524. }
  4525. // Put explicitly provided properties onto the event object
  4526. if ( props ) {
  4527. jQuery.extend( this, props );
  4528. }
  4529. // Create a timestamp if incoming event doesn't have one
  4530. this.timeStamp = src && src.timeStamp || jQuery.now();
  4531. // Mark it as fixed
  4532. this[ jQuery.expando ] = true;
  4533. };
  4534. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4535. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4536. jQuery.Event.prototype = {
  4537. constructor: jQuery.Event,
  4538. isDefaultPrevented: returnFalse,
  4539. isPropagationStopped: returnFalse,
  4540. isImmediatePropagationStopped: returnFalse,
  4541. preventDefault: function() {
  4542. var e = this.originalEvent;
  4543. this.isDefaultPrevented = returnTrue;
  4544. if ( !e ) {
  4545. return;
  4546. }
  4547. // If preventDefault exists, run it on the original event
  4548. if ( e.preventDefault ) {
  4549. e.preventDefault();
  4550. // Support: IE
  4551. // Otherwise set the returnValue property of the original event to false
  4552. } else {
  4553. e.returnValue = false;
  4554. }
  4555. },
  4556. stopPropagation: function() {
  4557. var e = this.originalEvent;
  4558. this.isPropagationStopped = returnTrue;
  4559. if ( !e || this.isSimulated ) {
  4560. return;
  4561. }
  4562. // If stopPropagation exists, run it on the original event
  4563. if ( e.stopPropagation ) {
  4564. e.stopPropagation();
  4565. }
  4566. // Support: IE
  4567. // Set the cancelBubble property of the original event to true
  4568. e.cancelBubble = true;
  4569. },
  4570. stopImmediatePropagation: function() {
  4571. var e = this.originalEvent;
  4572. this.isImmediatePropagationStopped = returnTrue;
  4573. if ( e && e.stopImmediatePropagation ) {
  4574. e.stopImmediatePropagation();
  4575. }
  4576. this.stopPropagation();
  4577. }
  4578. };
  4579. // Create mouseenter/leave events using mouseover/out and event-time checks
  4580. // so that event delegation works in jQuery.
  4581. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4582. //
  4583. // Support: Safari 7 only
  4584. // Safari sends mouseenter too often; see:
  4585. // https://code.google.com/p/chromium/issues/detail?id=470258
  4586. // for the description of the bug (it existed in older Chrome versions as well).
  4587. jQuery.each( {
  4588. mouseenter: "mouseover",
  4589. mouseleave: "mouseout",
  4590. pointerenter: "pointerover",
  4591. pointerleave: "pointerout"
  4592. }, function( orig, fix ) {
  4593. jQuery.event.special[ orig ] = {
  4594. delegateType: fix,
  4595. bindType: fix,
  4596. handle: function( event ) {
  4597. var ret,
  4598. target = this,
  4599. related = event.relatedTarget,
  4600. handleObj = event.handleObj;
  4601. // For mouseenter/leave call the handler if related is outside the target.
  4602. // NB: No relatedTarget if the mouse left/entered the browser window
  4603. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4604. event.type = handleObj.origType;
  4605. ret = handleObj.handler.apply( this, arguments );
  4606. event.type = fix;
  4607. }
  4608. return ret;
  4609. }
  4610. };
  4611. } );
  4612. // IE submit delegation
  4613. if ( !support.submit ) {
  4614. jQuery.event.special.submit = {
  4615. setup: function() {
  4616. // Only need this for delegated form submit events
  4617. if ( jQuery.nodeName( this, "form" ) ) {
  4618. return false;
  4619. }
  4620. // Lazy-add a submit handler when a descendant form may potentially be submitted
  4621. jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
  4622. // Node name check avoids a VML-related crash in IE (#9807)
  4623. var elem = e.target,
  4624. form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?
  4625. // Support: IE <=8
  4626. // We use jQuery.prop instead of elem.form
  4627. // to allow fixing the IE8 delegated submit issue (gh-2332)
  4628. // by 3rd party polyfills/workarounds.
  4629. jQuery.prop( elem, "form" ) :
  4630. undefined;
  4631. if ( form && !jQuery._data( form, "submit" ) ) {
  4632. jQuery.event.add( form, "submit._submit", function( event ) {
  4633. event._submitBubble = true;
  4634. } );
  4635. jQuery._data( form, "submit", true );
  4636. }
  4637. } );
  4638. // return undefined since we don't need an event listener
  4639. },
  4640. postDispatch: function( event ) {
  4641. // If form was submitted by the user, bubble the event up the tree
  4642. if ( event._submitBubble ) {
  4643. delete event._submitBubble;
  4644. if ( this.parentNode && !event.isTrigger ) {
  4645. jQuery.event.simulate( "submit", this.parentNode, event );
  4646. }
  4647. }
  4648. },
  4649. teardown: function() {
  4650. // Only need this for delegated form submit events
  4651. if ( jQuery.nodeName( this, "form" ) ) {
  4652. return false;
  4653. }
  4654. // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
  4655. jQuery.event.remove( this, "._submit" );
  4656. }
  4657. };
  4658. }
  4659. // IE change delegation and checkbox/radio fix
  4660. if ( !support.change ) {
  4661. jQuery.event.special.change = {
  4662. setup: function() {
  4663. if ( rformElems.test( this.nodeName ) ) {
  4664. // IE doesn't fire change on a check/radio until blur; trigger it on click
  4665. // after a propertychange. Eat the blur-change in special.change.handle.
  4666. // This still fires onchange a second time for check/radio after blur.
  4667. if ( this.type === "checkbox" || this.type === "radio" ) {
  4668. jQuery.event.add( this, "propertychange._change", function( event ) {
  4669. if ( event.originalEvent.propertyName === "checked" ) {
  4670. this._justChanged = true;
  4671. }
  4672. } );
  4673. jQuery.event.add( this, "click._change", function( event ) {
  4674. if ( this._justChanged && !event.isTrigger ) {
  4675. this._justChanged = false;
  4676. }
  4677. // Allow triggered, simulated change events (#11500)
  4678. jQuery.event.simulate( "change", this, event );
  4679. } );
  4680. }
  4681. return false;
  4682. }
  4683. // Delegated event; lazy-add a change handler on descendant inputs
  4684. jQuery.event.add( this, "beforeactivate._change", function( e ) {
  4685. var elem = e.target;
  4686. if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
  4687. jQuery.event.add( elem, "change._change", function( event ) {
  4688. if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
  4689. jQuery.event.simulate( "change", this.parentNode, event );
  4690. }
  4691. } );
  4692. jQuery._data( elem, "change", true );
  4693. }
  4694. } );
  4695. },
  4696. handle: function( event ) {
  4697. var elem = event.target;
  4698. // Swallow native change events from checkbox/radio, we already triggered them above
  4699. if ( this !== elem || event.isSimulated || event.isTrigger ||
  4700. ( elem.type !== "radio" && elem.type !== "checkbox" ) ) {
  4701. return event.handleObj.handler.apply( this, arguments );
  4702. }
  4703. },
  4704. teardown: function() {
  4705. jQuery.event.remove( this, "._change" );
  4706. return !rformElems.test( this.nodeName );
  4707. }
  4708. };
  4709. }
  4710. // Support: Firefox
  4711. // Firefox doesn't have focus(in | out) events
  4712. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  4713. //
  4714. // Support: Chrome, Safari
  4715. // focus(in | out) events fire after focus & blur events,
  4716. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  4717. // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
  4718. if ( !support.focusin ) {
  4719. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  4720. // Attach a single capturing handler on the document while someone wants focusin/focusout
  4721. var handler = function( event ) {
  4722. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  4723. };
  4724. jQuery.event.special[ fix ] = {
  4725. setup: function() {
  4726. var doc = this.ownerDocument || this,
  4727. attaches = jQuery._data( doc, fix );
  4728. if ( !attaches ) {
  4729. doc.addEventListener( orig, handler, true );
  4730. }
  4731. jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
  4732. },
  4733. teardown: function() {
  4734. var doc = this.ownerDocument || this,
  4735. attaches = jQuery._data( doc, fix ) - 1;
  4736. if ( !attaches ) {
  4737. doc.removeEventListener( orig, handler, true );
  4738. jQuery._removeData( doc, fix );
  4739. } else {
  4740. jQuery._data( doc, fix, attaches );
  4741. }
  4742. }
  4743. };
  4744. } );
  4745. }
  4746. jQuery.fn.extend( {
  4747. on: function( types, selector, data, fn ) {
  4748. return on( this, types, selector, data, fn );
  4749. },
  4750. one: function( types, selector, data, fn ) {
  4751. return on( this, types, selector, data, fn, 1 );
  4752. },
  4753. off: function( types, selector, fn ) {
  4754. var handleObj, type;
  4755. if ( types && types.preventDefault && types.handleObj ) {
  4756. // ( event ) dispatched jQuery.Event
  4757. handleObj = types.handleObj;
  4758. jQuery( types.delegateTarget ).off(
  4759. handleObj.namespace ?
  4760. handleObj.origType + "." + handleObj.namespace :
  4761. handleObj.origType,
  4762. handleObj.selector,
  4763. handleObj.handler
  4764. );
  4765. return this;
  4766. }
  4767. if ( typeof types === "object" ) {
  4768. // ( types-object [, selector] )
  4769. for ( type in types ) {
  4770. this.off( type, selector, types[ type ] );
  4771. }
  4772. return this;
  4773. }
  4774. if ( selector === false || typeof selector === "function" ) {
  4775. // ( types [, fn] )
  4776. fn = selector;
  4777. selector = undefined;
  4778. }
  4779. if ( fn === false ) {
  4780. fn = returnFalse;
  4781. }
  4782. return this.each( function() {
  4783. jQuery.event.remove( this, types, fn, selector );
  4784. } );
  4785. },
  4786. trigger: function( type, data ) {
  4787. return this.each( function() {
  4788. jQuery.event.trigger( type, data, this );
  4789. } );
  4790. },
  4791. triggerHandler: function( type, data ) {
  4792. var elem = this[ 0 ];
  4793. if ( elem ) {
  4794. return jQuery.event.trigger( type, data, elem, true );
  4795. }
  4796. }
  4797. } );
  4798. var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
  4799. rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
  4800. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
  4801. // Support: IE 10-11, Edge 10240+
  4802. // In IE/Edge using regex groups here causes severe slowdowns.
  4803. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4804. rnoInnerhtml = /<script|<style|<link/i,
  4805. // checked="checked" or checked
  4806. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4807. rscriptTypeMasked = /^true\/(.*)/,
  4808. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
  4809. safeFragment = createSafeFragment( document ),
  4810. fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) );
  4811. // Support: IE<8
  4812. // Manipulating tables requires a tbody
  4813. function manipulationTarget( elem, content ) {
  4814. return jQuery.nodeName( elem, "table" ) &&
  4815. jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
  4816. elem.getElementsByTagName( "tbody" )[ 0 ] ||
  4817. elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
  4818. elem;
  4819. }
  4820. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4821. function disableScript( elem ) {
  4822. elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type;
  4823. return elem;
  4824. }
  4825. function restoreScript( elem ) {
  4826. var match = rscriptTypeMasked.exec( elem.type );
  4827. if ( match ) {
  4828. elem.type = match[ 1 ];
  4829. } else {
  4830. elem.removeAttribute( "type" );
  4831. }
  4832. return elem;
  4833. }
  4834. function cloneCopyEvent( src, dest ) {
  4835. if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
  4836. return;
  4837. }
  4838. var type, i, l,
  4839. oldData = jQuery._data( src ),
  4840. curData = jQuery._data( dest, oldData ),
  4841. events = oldData.events;
  4842. if ( events ) {
  4843. delete curData.handle;
  4844. curData.events = {};
  4845. for ( type in events ) {
  4846. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4847. jQuery.event.add( dest, type, events[ type ][ i ] );
  4848. }
  4849. }
  4850. }
  4851. // make the cloned public data object a copy from the original
  4852. if ( curData.data ) {
  4853. curData.data = jQuery.extend( {}, curData.data );
  4854. }
  4855. }
  4856. function fixCloneNodeIssues( src, dest ) {
  4857. var nodeName, e, data;
  4858. // We do not need to do anything for non-Elements
  4859. if ( dest.nodeType !== 1 ) {
  4860. return;
  4861. }
  4862. nodeName = dest.nodeName.toLowerCase();
  4863. // IE6-8 copies events bound via attachEvent when using cloneNode.
  4864. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
  4865. data = jQuery._data( dest );
  4866. for ( e in data.events ) {
  4867. jQuery.removeEvent( dest, e, data.handle );
  4868. }
  4869. // Event data gets referenced instead of copied if the expando gets copied too
  4870. dest.removeAttribute( jQuery.expando );
  4871. }
  4872. // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
  4873. if ( nodeName === "script" && dest.text !== src.text ) {
  4874. disableScript( dest ).text = src.text;
  4875. restoreScript( dest );
  4876. // IE6-10 improperly clones children of object elements using classid.
  4877. // IE10 throws NoModificationAllowedError if parent is null, #12132.
  4878. } else if ( nodeName === "object" ) {
  4879. if ( dest.parentNode ) {
  4880. dest.outerHTML = src.outerHTML;
  4881. }
  4882. // This path appears unavoidable for IE9. When cloning an object
  4883. // element in IE9, the outerHTML strategy above is not sufficient.
  4884. // If the src has innerHTML and the destination does not,
  4885. // copy the src.innerHTML into the dest.innerHTML. #10324
  4886. if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
  4887. dest.innerHTML = src.innerHTML;
  4888. }
  4889. } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4890. // IE6-8 fails to persist the checked state of a cloned checkbox
  4891. // or radio button. Worse, IE6-7 fail to give the cloned element
  4892. // a checked appearance if the defaultChecked value isn't also set
  4893. dest.defaultChecked = dest.checked = src.checked;
  4894. // IE6-7 get confused and end up setting the value of a cloned
  4895. // checkbox/radio button to an empty string instead of "on"
  4896. if ( dest.value !== src.value ) {
  4897. dest.value = src.value;
  4898. }
  4899. // IE6-8 fails to return the selected option to the default selected
  4900. // state when cloning options
  4901. } else if ( nodeName === "option" ) {
  4902. dest.defaultSelected = dest.selected = src.defaultSelected;
  4903. // IE6-8 fails to set the defaultValue to the correct value when
  4904. // cloning other types of input fields
  4905. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4906. dest.defaultValue = src.defaultValue;
  4907. }
  4908. }
  4909. function domManip( collection, args, callback, ignored ) {
  4910. // Flatten any nested arrays
  4911. args = concat.apply( [], args );
  4912. var first, node, hasScripts,
  4913. scripts, doc, fragment,
  4914. i = 0,
  4915. l = collection.length,
  4916. iNoClone = l - 1,
  4917. value = args[ 0 ],
  4918. isFunction = jQuery.isFunction( value );
  4919. // We can't cloneNode fragments that contain checked, in WebKit
  4920. if ( isFunction ||
  4921. ( l > 1 && typeof value === "string" &&
  4922. !support.checkClone && rchecked.test( value ) ) ) {
  4923. return collection.each( function( index ) {
  4924. var self = collection.eq( index );
  4925. if ( isFunction ) {
  4926. args[ 0 ] = value.call( this, index, self.html() );
  4927. }
  4928. domManip( self, args, callback, ignored );
  4929. } );
  4930. }
  4931. if ( l ) {
  4932. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4933. first = fragment.firstChild;
  4934. if ( fragment.childNodes.length === 1 ) {
  4935. fragment = first;
  4936. }
  4937. // Require either new content or an interest in ignored elements to invoke the callback
  4938. if ( first || ignored ) {
  4939. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4940. hasScripts = scripts.length;
  4941. // Use the original fragment for the last item
  4942. // instead of the first because it can end up
  4943. // being emptied incorrectly in certain situations (#8070).
  4944. for ( ; i < l; i++ ) {
  4945. node = fragment;
  4946. if ( i !== iNoClone ) {
  4947. node = jQuery.clone( node, true, true );
  4948. // Keep references to cloned scripts for later restoration
  4949. if ( hasScripts ) {
  4950. // Support: Android<4.1, PhantomJS<2
  4951. // push.apply(_, arraylike) throws on ancient WebKit
  4952. jQuery.merge( scripts, getAll( node, "script" ) );
  4953. }
  4954. }
  4955. callback.call( collection[ i ], node, i );
  4956. }
  4957. if ( hasScripts ) {
  4958. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4959. // Reenable scripts
  4960. jQuery.map( scripts, restoreScript );
  4961. // Evaluate executable scripts on first document insertion
  4962. for ( i = 0; i < hasScripts; i++ ) {
  4963. node = scripts[ i ];
  4964. if ( rscriptType.test( node.type || "" ) &&
  4965. !jQuery._data( node, "globalEval" ) &&
  4966. jQuery.contains( doc, node ) ) {
  4967. if ( node.src ) {
  4968. // Optional AJAX dependency, but won't run scripts if not present
  4969. if ( jQuery._evalUrl ) {
  4970. jQuery._evalUrl( node.src );
  4971. }
  4972. } else {
  4973. jQuery.globalEval(
  4974. ( node.text || node.textContent || node.innerHTML || "" )
  4975. .replace( rcleanScript, "" )
  4976. );
  4977. }
  4978. }
  4979. }
  4980. }
  4981. // Fix #11809: Avoid leaking memory
  4982. fragment = first = null;
  4983. }
  4984. }
  4985. return collection;
  4986. }
  4987. function remove( elem, selector, keepData ) {
  4988. var node,
  4989. elems = selector ? jQuery.filter( selector, elem ) : elem,
  4990. i = 0;
  4991. for ( ; ( node = elems[ i ] ) != null; i++ ) {
  4992. if ( !keepData && node.nodeType === 1 ) {
  4993. jQuery.cleanData( getAll( node ) );
  4994. }
  4995. if ( node.parentNode ) {
  4996. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  4997. setGlobalEval( getAll( node, "script" ) );
  4998. }
  4999. node.parentNode.removeChild( node );
  5000. }
  5001. }
  5002. return elem;
  5003. }
  5004. jQuery.extend( {
  5005. htmlPrefilter: function( html ) {
  5006. return html.replace( rxhtmlTag, "<$1></$2>" );
  5007. },
  5008. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  5009. var destElements, node, clone, i, srcElements,
  5010. inPage = jQuery.contains( elem.ownerDocument, elem );
  5011. if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
  5012. !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
  5013. clone = elem.cloneNode( true );
  5014. // IE<=8 does not properly clone detached, unknown element nodes
  5015. } else {
  5016. fragmentDiv.innerHTML = elem.outerHTML;
  5017. fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
  5018. }
  5019. if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
  5020. ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
  5021. // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
  5022. destElements = getAll( clone );
  5023. srcElements = getAll( elem );
  5024. // Fix all IE cloning issues
  5025. for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {
  5026. // Ensure that the destination node is not null; Fixes #9587
  5027. if ( destElements[ i ] ) {
  5028. fixCloneNodeIssues( node, destElements[ i ] );
  5029. }
  5030. }
  5031. }
  5032. // Copy the events from the original to the clone
  5033. if ( dataAndEvents ) {
  5034. if ( deepDataAndEvents ) {
  5035. srcElements = srcElements || getAll( elem );
  5036. destElements = destElements || getAll( clone );
  5037. for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
  5038. cloneCopyEvent( node, destElements[ i ] );
  5039. }
  5040. } else {
  5041. cloneCopyEvent( elem, clone );
  5042. }
  5043. }
  5044. // Preserve script evaluation history
  5045. destElements = getAll( clone, "script" );
  5046. if ( destElements.length > 0 ) {
  5047. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5048. }
  5049. destElements = srcElements = node = null;
  5050. // Return the cloned set
  5051. return clone;
  5052. },
  5053. cleanData: function( elems, /* internal */ forceAcceptData ) {
  5054. var elem, type, id, data,
  5055. i = 0,
  5056. internalKey = jQuery.expando,
  5057. cache = jQuery.cache,
  5058. attributes = support.attributes,
  5059. special = jQuery.event.special;
  5060. for ( ; ( elem = elems[ i ] ) != null; i++ ) {
  5061. if ( forceAcceptData || acceptData( elem ) ) {
  5062. id = elem[ internalKey ];
  5063. data = id && cache[ id ];
  5064. if ( data ) {
  5065. if ( data.events ) {
  5066. for ( type in data.events ) {
  5067. if ( special[ type ] ) {
  5068. jQuery.event.remove( elem, type );
  5069. // This is a shortcut to avoid jQuery.event.remove's overhead
  5070. } else {
  5071. jQuery.removeEvent( elem, type, data.handle );
  5072. }
  5073. }
  5074. }
  5075. // Remove cache only if it was not already removed by jQuery.event.remove
  5076. if ( cache[ id ] ) {
  5077. delete cache[ id ];
  5078. // Support: IE<9
  5079. // IE does not allow us to delete expando properties from nodes
  5080. // IE creates expando attributes along with the property
  5081. // IE does not have a removeAttribute function on Document nodes
  5082. if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
  5083. elem.removeAttribute( internalKey );
  5084. // Webkit & Blink performance suffers when deleting properties
  5085. // from DOM nodes, so set to undefined instead
  5086. // https://code.google.com/p/chromium/issues/detail?id=378607
  5087. } else {
  5088. elem[ internalKey ] = undefined;
  5089. }
  5090. deletedIds.push( id );
  5091. }
  5092. }
  5093. }
  5094. }
  5095. }
  5096. } );
  5097. jQuery.fn.extend( {
  5098. // Keep domManip exposed until 3.0 (gh-2225)
  5099. domManip: domManip,
  5100. detach: function( selector ) {
  5101. return remove( this, selector, true );
  5102. },
  5103. remove: function( selector ) {
  5104. return remove( this, selector );
  5105. },
  5106. text: function( value ) {
  5107. return access( this, function( value ) {
  5108. return value === undefined ?
  5109. jQuery.text( this ) :
  5110. this.empty().append(
  5111. ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value )
  5112. );
  5113. }, null, value, arguments.length );
  5114. },
  5115. append: function() {
  5116. return domManip( this, arguments, function( elem ) {
  5117. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5118. var target = manipulationTarget( this, elem );
  5119. target.appendChild( elem );
  5120. }
  5121. } );
  5122. },
  5123. prepend: function() {
  5124. return domManip( this, arguments, function( elem ) {
  5125. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5126. var target = manipulationTarget( this, elem );
  5127. target.insertBefore( elem, target.firstChild );
  5128. }
  5129. } );
  5130. },
  5131. before: function() {
  5132. return domManip( this, arguments, function( elem ) {
  5133. if ( this.parentNode ) {
  5134. this.parentNode.insertBefore( elem, this );
  5135. }
  5136. } );
  5137. },
  5138. after: function() {
  5139. return domManip( this, arguments, function( elem ) {
  5140. if ( this.parentNode ) {
  5141. this.parentNode.insertBefore( elem, this.nextSibling );
  5142. }
  5143. } );
  5144. },
  5145. empty: function() {
  5146. var elem,
  5147. i = 0;
  5148. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5149. // Remove element nodes and prevent memory leaks
  5150. if ( elem.nodeType === 1 ) {
  5151. jQuery.cleanData( getAll( elem, false ) );
  5152. }
  5153. // Remove any remaining nodes
  5154. while ( elem.firstChild ) {
  5155. elem.removeChild( elem.firstChild );
  5156. }
  5157. // If this is a select, ensure that it displays empty (#12336)
  5158. // Support: IE<9
  5159. if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
  5160. elem.options.length = 0;
  5161. }
  5162. }
  5163. return this;
  5164. },
  5165. clone: function( dataAndEvents, deepDataAndEvents ) {
  5166. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5167. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5168. return this.map( function() {
  5169. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5170. } );
  5171. },
  5172. html: function( value ) {
  5173. return access( this, function( value ) {
  5174. var elem = this[ 0 ] || {},
  5175. i = 0,
  5176. l = this.length;
  5177. if ( value === undefined ) {
  5178. return elem.nodeType === 1 ?
  5179. elem.innerHTML.replace( rinlinejQuery, "" ) :
  5180. undefined;
  5181. }
  5182. // See if we can take a shortcut and just use innerHTML
  5183. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5184. ( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
  5185. ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
  5186. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5187. value = jQuery.htmlPrefilter( value );
  5188. try {
  5189. for ( ; i < l; i++ ) {
  5190. // Remove element nodes and prevent memory leaks
  5191. elem = this[ i ] || {};
  5192. if ( elem.nodeType === 1 ) {
  5193. jQuery.cleanData( getAll( elem, false ) );
  5194. elem.innerHTML = value;
  5195. }
  5196. }
  5197. elem = 0;
  5198. // If using innerHTML throws an exception, use the fallback method
  5199. } catch ( e ) {}
  5200. }
  5201. if ( elem ) {
  5202. this.empty().append( value );
  5203. }
  5204. }, null, value, arguments.length );
  5205. },
  5206. replaceWith: function() {
  5207. var ignored = [];
  5208. // Make the changes, replacing each non-ignored context element with the new content
  5209. return domManip( this, arguments, function( elem ) {
  5210. var parent = this.parentNode;
  5211. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5212. jQuery.cleanData( getAll( this ) );
  5213. if ( parent ) {
  5214. parent.replaceChild( elem, this );
  5215. }
  5216. }
  5217. // Force callback invocation
  5218. }, ignored );
  5219. }
  5220. } );
  5221. jQuery.each( {
  5222. appendTo: "append",
  5223. prependTo: "prepend",
  5224. insertBefore: "before",
  5225. insertAfter: "after",
  5226. replaceAll: "replaceWith"
  5227. }, function( name, original ) {
  5228. jQuery.fn[ name ] = function( selector ) {
  5229. var elems,
  5230. i = 0,
  5231. ret = [],
  5232. insert = jQuery( selector ),
  5233. last = insert.length - 1;
  5234. for ( ; i <= last; i++ ) {
  5235. elems = i === last ? this : this.clone( true );
  5236. jQuery( insert[ i ] )[ original ]( elems );
  5237. // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
  5238. push.apply( ret, elems.get() );
  5239. }
  5240. return this.pushStack( ret );
  5241. };
  5242. } );
  5243. var iframe,
  5244. elemdisplay = {
  5245. // Support: Firefox
  5246. // We have to pre-define these values for FF (#10227)
  5247. HTML: "block",
  5248. BODY: "block"
  5249. };
  5250. /**
  5251. * Retrieve the actual display of a element
  5252. * @param {String} name nodeName of the element
  5253. * @param {Object} doc Document object
  5254. */
  5255. // Called only from within defaultDisplay
  5256. function actualDisplay( name, doc ) {
  5257. var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
  5258. display = jQuery.css( elem[ 0 ], "display" );
  5259. // We don't have any data stored on the element,
  5260. // so use "detach" method as fast way to get rid of the element
  5261. elem.detach();
  5262. return display;
  5263. }
  5264. /**
  5265. * Try to determine the default display value of an element
  5266. * @param {String} nodeName
  5267. */
  5268. function defaultDisplay( nodeName ) {
  5269. var doc = document,
  5270. display = elemdisplay[ nodeName ];
  5271. if ( !display ) {
  5272. display = actualDisplay( nodeName, doc );
  5273. // If the simple way fails, read from inside an iframe
  5274. if ( display === "none" || !display ) {
  5275. // Use the already-created iframe if possible
  5276. iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
  5277. .appendTo( doc.documentElement );
  5278. // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  5279. doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
  5280. // Support: IE
  5281. doc.write();
  5282. doc.close();
  5283. display = actualDisplay( nodeName, doc );
  5284. iframe.detach();
  5285. }
  5286. // Store the correct default display
  5287. elemdisplay[ nodeName ] = display;
  5288. }
  5289. return display;
  5290. }
  5291. var rmargin = ( /^margin/ );
  5292. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5293. var swap = function( elem, options, callback, args ) {
  5294. var ret, name,
  5295. old = {};
  5296. // Remember the old values, and insert the new ones
  5297. for ( name in options ) {
  5298. old[ name ] = elem.style[ name ];
  5299. elem.style[ name ] = options[ name ];
  5300. }
  5301. ret = callback.apply( elem, args || [] );
  5302. // Revert the old values
  5303. for ( name in options ) {
  5304. elem.style[ name ] = old[ name ];
  5305. }
  5306. return ret;
  5307. };
  5308. var documentElement = document.documentElement;
  5309. ( function() {
  5310. var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
  5311. reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
  5312. container = document.createElement( "div" ),
  5313. div = document.createElement( "div" );
  5314. // Finish early in limited (non-browser) environments
  5315. if ( !div.style ) {
  5316. return;
  5317. }
  5318. div.style.cssText = "float:left;opacity:.5";
  5319. // Support: IE<9
  5320. // Make sure that element opacity exists (as opposed to filter)
  5321. support.opacity = div.style.opacity === "0.5";
  5322. // Verify style float existence
  5323. // (IE uses styleFloat instead of cssFloat)
  5324. support.cssFloat = !!div.style.cssFloat;
  5325. div.style.backgroundClip = "content-box";
  5326. div.cloneNode( true ).style.backgroundClip = "";
  5327. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5328. container = document.createElement( "div" );
  5329. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  5330. "padding:0;margin-top:1px;position:absolute";
  5331. div.innerHTML = "";
  5332. container.appendChild( div );
  5333. // Support: Firefox<29, Android 2.3
  5334. // Vendor-prefix box-sizing
  5335. support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
  5336. div.style.WebkitBoxSizing === "";
  5337. jQuery.extend( support, {
  5338. reliableHiddenOffsets: function() {
  5339. if ( pixelPositionVal == null ) {
  5340. computeStyleTests();
  5341. }
  5342. return reliableHiddenOffsetsVal;
  5343. },
  5344. boxSizingReliable: function() {
  5345. // We're checking for pixelPositionVal here instead of boxSizingReliableVal
  5346. // since that compresses better and they're computed together anyway.
  5347. if ( pixelPositionVal == null ) {
  5348. computeStyleTests();
  5349. }
  5350. return boxSizingReliableVal;
  5351. },
  5352. pixelMarginRight: function() {
  5353. // Support: Android 4.0-4.3
  5354. if ( pixelPositionVal == null ) {
  5355. computeStyleTests();
  5356. }
  5357. return pixelMarginRightVal;
  5358. },
  5359. pixelPosition: function() {
  5360. if ( pixelPositionVal == null ) {
  5361. computeStyleTests();
  5362. }
  5363. return pixelPositionVal;
  5364. },
  5365. reliableMarginRight: function() {
  5366. // Support: Android 2.3
  5367. if ( pixelPositionVal == null ) {
  5368. computeStyleTests();
  5369. }
  5370. return reliableMarginRightVal;
  5371. },
  5372. reliableMarginLeft: function() {
  5373. // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
  5374. if ( pixelPositionVal == null ) {
  5375. computeStyleTests();
  5376. }
  5377. return reliableMarginLeftVal;
  5378. }
  5379. } );
  5380. function computeStyleTests() {
  5381. var contents, divStyle,
  5382. documentElement = document.documentElement;
  5383. // Setup
  5384. documentElement.appendChild( container );
  5385. div.style.cssText =
  5386. // Support: Android 2.3
  5387. // Vendor-prefix box-sizing
  5388. "-webkit-box-sizing:border-box;box-sizing:border-box;" +
  5389. "position:relative;display:block;" +
  5390. "margin:auto;border:1px;padding:1px;" +
  5391. "top:1%;width:50%";
  5392. // Support: IE<9
  5393. // Assume reasonable values in the absence of getComputedStyle
  5394. pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false;
  5395. pixelMarginRightVal = reliableMarginRightVal = true;
  5396. // Check for getComputedStyle so that this code is not run in IE<9.
  5397. if ( window.getComputedStyle ) {
  5398. divStyle = window.getComputedStyle( div );
  5399. pixelPositionVal = ( divStyle || {} ).top !== "1%";
  5400. reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px";
  5401. boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px";
  5402. // Support: Android 4.0 - 4.3 only
  5403. // Some styles come back with percentage values, even though they shouldn't
  5404. div.style.marginRight = "50%";
  5405. pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";
  5406. // Support: Android 2.3 only
  5407. // Div with explicit width and no margin-right incorrectly
  5408. // gets computed margin-right based on width of container (#3333)
  5409. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  5410. contents = div.appendChild( document.createElement( "div" ) );
  5411. // Reset CSS: box-sizing; display; margin; border; padding
  5412. contents.style.cssText = div.style.cssText =
  5413. // Support: Android 2.3
  5414. // Vendor-prefix box-sizing
  5415. "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  5416. "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
  5417. contents.style.marginRight = contents.style.width = "0";
  5418. div.style.width = "1px";
  5419. reliableMarginRightVal =
  5420. !parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );
  5421. div.removeChild( contents );
  5422. }
  5423. // Support: IE6-8
  5424. // First check that getClientRects works as expected
  5425. // Check if table cells still have offsetWidth/Height when they are set
  5426. // to display:none and there are still other visible table cells in a
  5427. // table row; if so, offsetWidth/Height are not reliable for use when
  5428. // determining if an element has been hidden directly using
  5429. // display:none (it is still safe to use offsets if a parent element is
  5430. // hidden; don safety goggles and see bug #4512 for more information).
  5431. div.style.display = "none";
  5432. reliableHiddenOffsetsVal = div.getClientRects().length === 0;
  5433. if ( reliableHiddenOffsetsVal ) {
  5434. div.style.display = "";
  5435. div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
  5436. div.childNodes[ 0 ].style.borderCollapse = "separate";
  5437. contents = div.getElementsByTagName( "td" );
  5438. contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
  5439. reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
  5440. if ( reliableHiddenOffsetsVal ) {
  5441. contents[ 0 ].style.display = "";
  5442. contents[ 1 ].style.display = "none";
  5443. reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
  5444. }
  5445. }
  5446. // Teardown
  5447. documentElement.removeChild( container );
  5448. }
  5449. } )();
  5450. var getStyles, curCSS,
  5451. rposition = /^(top|right|bottom|left)$/;
  5452. if ( window.getComputedStyle ) {
  5453. getStyles = function( elem ) {
  5454. // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
  5455. // IE throws on elements created in popups
  5456. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5457. var view = elem.ownerDocument.defaultView;
  5458. if ( !view || !view.opener ) {
  5459. view = window;
  5460. }
  5461. return view.getComputedStyle( elem );
  5462. };
  5463. curCSS = function( elem, name, computed ) {
  5464. var width, minWidth, maxWidth, ret,
  5465. style = elem.style;
  5466. computed = computed || getStyles( elem );
  5467. // getPropertyValue is only needed for .css('filter') in IE9, see #12537
  5468. ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
  5469. // Support: Opera 12.1x only
  5470. // Fall back to style even without computed
  5471. // computed is undefined for elems on document fragments
  5472. if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5473. ret = jQuery.style( elem, name );
  5474. }
  5475. if ( computed ) {
  5476. // A tribute to the "awesome hack by Dean Edwards"
  5477. // Chrome < 17 and Safari 5.0 uses "computed value"
  5478. // instead of "used value" for margin-right
  5479. // Safari 5.1.7 (at least) returns percentage for a larger set of values,
  5480. // but width seems to be reliably pixels
  5481. // this is against the CSSOM draft spec:
  5482. // http://dev.w3.org/csswg/cssom/#resolved-values
  5483. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  5484. // Remember the original values
  5485. width = style.width;
  5486. minWidth = style.minWidth;
  5487. maxWidth = style.maxWidth;
  5488. // Put in the new values to get a computed value out
  5489. style.minWidth = style.maxWidth = style.width = ret;
  5490. ret = computed.width;
  5491. // Revert the changed values
  5492. style.width = width;
  5493. style.minWidth = minWidth;
  5494. style.maxWidth = maxWidth;
  5495. }
  5496. }
  5497. // Support: IE
  5498. // IE returns zIndex value as an integer.
  5499. return ret === undefined ?
  5500. ret :
  5501. ret + "";
  5502. };
  5503. } else if ( documentElement.currentStyle ) {
  5504. getStyles = function( elem ) {
  5505. return elem.currentStyle;
  5506. };
  5507. curCSS = function( elem, name, computed ) {
  5508. var left, rs, rsLeft, ret,
  5509. style = elem.style;
  5510. computed = computed || getStyles( elem );
  5511. ret = computed ? computed[ name ] : undefined;
  5512. // Avoid setting ret to empty string here
  5513. // so we don't default to auto
  5514. if ( ret == null && style && style[ name ] ) {
  5515. ret = style[ name ];
  5516. }
  5517. // From the awesome hack by Dean Edwards
  5518. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  5519. // If we're not dealing with a regular pixel number
  5520. // but a number that has a weird ending, we need to convert it to pixels
  5521. // but not position css attributes, as those are
  5522. // proportional to the parent element instead
  5523. // and we can't measure the parent instead because it
  5524. // might trigger a "stacking dolls" problem
  5525. if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
  5526. // Remember the original values
  5527. left = style.left;
  5528. rs = elem.runtimeStyle;
  5529. rsLeft = rs && rs.left;
  5530. // Put in the new values to get a computed value out
  5531. if ( rsLeft ) {
  5532. rs.left = elem.currentStyle.left;
  5533. }
  5534. style.left = name === "fontSize" ? "1em" : ret;
  5535. ret = style.pixelLeft + "px";
  5536. // Revert the changed values
  5537. style.left = left;
  5538. if ( rsLeft ) {
  5539. rs.left = rsLeft;
  5540. }
  5541. }
  5542. // Support: IE
  5543. // IE returns zIndex value as an integer.
  5544. return ret === undefined ?
  5545. ret :
  5546. ret + "" || "auto";
  5547. };
  5548. }
  5549. function addGetHookIf( conditionFn, hookFn ) {
  5550. // Define the hook, we'll check on the first run if it's really needed.
  5551. return {
  5552. get: function() {
  5553. if ( conditionFn() ) {
  5554. // Hook not needed (or it's not possible to use it due
  5555. // to missing dependency), remove it.
  5556. delete this.get;
  5557. return;
  5558. }
  5559. // Hook needed; redefine it so that the support test is not executed again.
  5560. return ( this.get = hookFn ).apply( this, arguments );
  5561. }
  5562. };
  5563. }
  5564. var
  5565. ralpha = /alpha\([^)]*\)/i,
  5566. ropacity = /opacity\s*=\s*([^)]*)/i,
  5567. // swappable if display is none or starts with table except
  5568. // "table", "table-cell", or "table-caption"
  5569. // see here for display values:
  5570. // https://developer.mozilla.org/en-US/docs/CSS/display
  5571. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5572. rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
  5573. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5574. cssNormalTransform = {
  5575. letterSpacing: "0",
  5576. fontWeight: "400"
  5577. },
  5578. cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
  5579. emptyStyle = document.createElement( "div" ).style;
  5580. // return a css property mapped to a potentially vendor prefixed property
  5581. function vendorPropName( name ) {
  5582. // shortcut for names that are not vendor prefixed
  5583. if ( name in emptyStyle ) {
  5584. return name;
  5585. }
  5586. // check for vendor prefixed names
  5587. var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
  5588. i = cssPrefixes.length;
  5589. while ( i-- ) {
  5590. name = cssPrefixes[ i ] + capName;
  5591. if ( name in emptyStyle ) {
  5592. return name;
  5593. }
  5594. }
  5595. }
  5596. function showHide( elements, show ) {
  5597. var display, elem, hidden,
  5598. values = [],
  5599. index = 0,
  5600. length = elements.length;
  5601. for ( ; index < length; index++ ) {
  5602. elem = elements[ index ];
  5603. if ( !elem.style ) {
  5604. continue;
  5605. }
  5606. values[ index ] = jQuery._data( elem, "olddisplay" );
  5607. display = elem.style.display;
  5608. if ( show ) {
  5609. // Reset the inline display of this element to learn if it is
  5610. // being hidden by cascaded rules or not
  5611. if ( !values[ index ] && display === "none" ) {
  5612. elem.style.display = "";
  5613. }
  5614. // Set elements which have been overridden with display: none
  5615. // in a stylesheet to whatever the default browser style is
  5616. // for such an element
  5617. if ( elem.style.display === "" && isHidden( elem ) ) {
  5618. values[ index ] =
  5619. jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
  5620. }
  5621. } else {
  5622. hidden = isHidden( elem );
  5623. if ( display && display !== "none" || !hidden ) {
  5624. jQuery._data(
  5625. elem,
  5626. "olddisplay",
  5627. hidden ? display : jQuery.css( elem, "display" )
  5628. );
  5629. }
  5630. }
  5631. }
  5632. // Set the display of most of the elements in a second loop
  5633. // to avoid the constant reflow
  5634. for ( index = 0; index < length; index++ ) {
  5635. elem = elements[ index ];
  5636. if ( !elem.style ) {
  5637. continue;
  5638. }
  5639. if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
  5640. elem.style.display = show ? values[ index ] || "" : "none";
  5641. }
  5642. }
  5643. return elements;
  5644. }
  5645. function setPositiveNumber( elem, value, subtract ) {
  5646. var matches = rnumsplit.exec( value );
  5647. return matches ?
  5648. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5649. Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
  5650. value;
  5651. }
  5652. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  5653. var i = extra === ( isBorderBox ? "border" : "content" ) ?
  5654. // If we already have the right measurement, avoid augmentation
  5655. 4 :
  5656. // Otherwise initialize for horizontal or vertical properties
  5657. name === "width" ? 1 : 0,
  5658. val = 0;
  5659. for ( ; i < 4; i += 2 ) {
  5660. // both box models exclude margin, so add it if we want it
  5661. if ( extra === "margin" ) {
  5662. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  5663. }
  5664. if ( isBorderBox ) {
  5665. // border-box includes padding, so remove it if we want content
  5666. if ( extra === "content" ) {
  5667. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5668. }
  5669. // at this point, extra isn't border nor margin, so remove border
  5670. if ( extra !== "margin" ) {
  5671. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5672. }
  5673. } else {
  5674. // at this point, extra isn't content, so add padding
  5675. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5676. // at this point, extra isn't content nor padding, so add border
  5677. if ( extra !== "padding" ) {
  5678. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5679. }
  5680. }
  5681. }
  5682. return val;
  5683. }
  5684. function getWidthOrHeight( elem, name, extra ) {
  5685. // Start with offset property, which is equivalent to the border-box value
  5686. var valueIsBorderBox = true,
  5687. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  5688. styles = getStyles( elem ),
  5689. isBorderBox = support.boxSizing &&
  5690. jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5691. // some non-html elements return undefined for offsetWidth, so check for null/undefined
  5692. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  5693. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  5694. if ( val <= 0 || val == null ) {
  5695. // Fall back to computed then uncomputed css if necessary
  5696. val = curCSS( elem, name, styles );
  5697. if ( val < 0 || val == null ) {
  5698. val = elem.style[ name ];
  5699. }
  5700. // Computed unit is not pixels. Stop here and return.
  5701. if ( rnumnonpx.test( val ) ) {
  5702. return val;
  5703. }
  5704. // we need the check for style in case a browser which returns unreliable values
  5705. // for getComputedStyle silently falls back to the reliable elem.style
  5706. valueIsBorderBox = isBorderBox &&
  5707. ( support.boxSizingReliable() || val === elem.style[ name ] );
  5708. // Normalize "", auto, and prepare for extra
  5709. val = parseFloat( val ) || 0;
  5710. }
  5711. // use the active box-sizing model to add/subtract irrelevant styles
  5712. return ( val +
  5713. augmentWidthOrHeight(
  5714. elem,
  5715. name,
  5716. extra || ( isBorderBox ? "border" : "content" ),
  5717. valueIsBorderBox,
  5718. styles
  5719. )
  5720. ) + "px";
  5721. }
  5722. jQuery.extend( {
  5723. // Add in style property hooks for overriding the default
  5724. // behavior of getting and setting a style property
  5725. cssHooks: {
  5726. opacity: {
  5727. get: function( elem, computed ) {
  5728. if ( computed ) {
  5729. // We should always get a number back from opacity
  5730. var ret = curCSS( elem, "opacity" );
  5731. return ret === "" ? "1" : ret;
  5732. }
  5733. }
  5734. }
  5735. },
  5736. // Don't automatically add "px" to these possibly-unitless properties
  5737. cssNumber: {
  5738. "animationIterationCount": true,
  5739. "columnCount": true,
  5740. "fillOpacity": true,
  5741. "flexGrow": true,
  5742. "flexShrink": true,
  5743. "fontWeight": true,
  5744. "lineHeight": true,
  5745. "opacity": true,
  5746. "order": true,
  5747. "orphans": true,
  5748. "widows": true,
  5749. "zIndex": true,
  5750. "zoom": true
  5751. },
  5752. // Add in properties whose names you wish to fix before
  5753. // setting or getting the value
  5754. cssProps: {
  5755. // normalize float css property
  5756. "float": support.cssFloat ? "cssFloat" : "styleFloat"
  5757. },
  5758. // Get and set the style property on a DOM Node
  5759. style: function( elem, name, value, extra ) {
  5760. // Don't set styles on text and comment nodes
  5761. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5762. return;
  5763. }
  5764. // Make sure that we're working with the right name
  5765. var ret, type, hooks,
  5766. origName = jQuery.camelCase( name ),
  5767. style = elem.style;
  5768. name = jQuery.cssProps[ origName ] ||
  5769. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  5770. // gets hook for the prefixed version
  5771. // followed by the unprefixed version
  5772. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5773. // Check if we're setting a value
  5774. if ( value !== undefined ) {
  5775. type = typeof value;
  5776. // Convert "+=" or "-=" to relative numbers (#7345)
  5777. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5778. value = adjustCSS( elem, name, ret );
  5779. // Fixes bug #9237
  5780. type = "number";
  5781. }
  5782. // Make sure that null and NaN values aren't set. See: #7116
  5783. if ( value == null || value !== value ) {
  5784. return;
  5785. }
  5786. // If a number was passed in, add the unit (except for certain CSS properties)
  5787. if ( type === "number" ) {
  5788. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5789. }
  5790. // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
  5791. // but it would mean to define eight
  5792. // (for every problematic property) identical functions
  5793. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5794. style[ name ] = "inherit";
  5795. }
  5796. // If a hook was provided, use that value, otherwise just set the specified value
  5797. if ( !hooks || !( "set" in hooks ) ||
  5798. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5799. // Support: IE
  5800. // Swallow errors from 'invalid' CSS values (#5509)
  5801. try {
  5802. style[ name ] = value;
  5803. } catch ( e ) {}
  5804. }
  5805. } else {
  5806. // If a hook was provided get the non-computed value from there
  5807. if ( hooks && "get" in hooks &&
  5808. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5809. return ret;
  5810. }
  5811. // Otherwise just get the value from the style object
  5812. return style[ name ];
  5813. }
  5814. },
  5815. css: function( elem, name, extra, styles ) {
  5816. var num, val, hooks,
  5817. origName = jQuery.camelCase( name );
  5818. // Make sure that we're working with the right name
  5819. name = jQuery.cssProps[ origName ] ||
  5820. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  5821. // gets hook for the prefixed version
  5822. // followed by the unprefixed version
  5823. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5824. // If a hook was provided get the computed value from there
  5825. if ( hooks && "get" in hooks ) {
  5826. val = hooks.get( elem, true, extra );
  5827. }
  5828. // Otherwise, if a way to get the computed value exists, use that
  5829. if ( val === undefined ) {
  5830. val = curCSS( elem, name, styles );
  5831. }
  5832. //convert "normal" to computed value
  5833. if ( val === "normal" && name in cssNormalTransform ) {
  5834. val = cssNormalTransform[ name ];
  5835. }
  5836. // Return, converting to number if forced or a qualifier was provided and val looks numeric
  5837. if ( extra === "" || extra ) {
  5838. num = parseFloat( val );
  5839. return extra === true || isFinite( num ) ? num || 0 : val;
  5840. }
  5841. return val;
  5842. }
  5843. } );
  5844. jQuery.each( [ "height", "width" ], function( i, name ) {
  5845. jQuery.cssHooks[ name ] = {
  5846. get: function( elem, computed, extra ) {
  5847. if ( computed ) {
  5848. // certain elements can have dimension info if we invisibly show them
  5849. // however, it must have a current display style that would benefit from this
  5850. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5851. elem.offsetWidth === 0 ?
  5852. swap( elem, cssShow, function() {
  5853. return getWidthOrHeight( elem, name, extra );
  5854. } ) :
  5855. getWidthOrHeight( elem, name, extra );
  5856. }
  5857. },
  5858. set: function( elem, value, extra ) {
  5859. var styles = extra && getStyles( elem );
  5860. return setPositiveNumber( elem, value, extra ?
  5861. augmentWidthOrHeight(
  5862. elem,
  5863. name,
  5864. extra,
  5865. support.boxSizing &&
  5866. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5867. styles
  5868. ) : 0
  5869. );
  5870. }
  5871. };
  5872. } );
  5873. if ( !support.opacity ) {
  5874. jQuery.cssHooks.opacity = {
  5875. get: function( elem, computed ) {
  5876. // IE uses filters for opacity
  5877. return ropacity.test( ( computed && elem.currentStyle ?
  5878. elem.currentStyle.filter :
  5879. elem.style.filter ) || "" ) ?
  5880. ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
  5881. computed ? "1" : "";
  5882. },
  5883. set: function( elem, value ) {
  5884. var style = elem.style,
  5885. currentStyle = elem.currentStyle,
  5886. opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
  5887. filter = currentStyle && currentStyle.filter || style.filter || "";
  5888. // IE has trouble with opacity if it does not have layout
  5889. // Force it by setting the zoom level
  5890. style.zoom = 1;
  5891. // if setting opacity to 1, and no other filters exist -
  5892. // attempt to remove filter attribute #6652
  5893. // if value === "", then remove inline opacity #12685
  5894. if ( ( value >= 1 || value === "" ) &&
  5895. jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
  5896. style.removeAttribute ) {
  5897. // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
  5898. // if "filter:" is present at all, clearType is disabled, we want to avoid this
  5899. // style.removeAttribute is IE Only, but so apparently is this code path...
  5900. style.removeAttribute( "filter" );
  5901. // if there is no filter style applied in a css rule
  5902. // or unset inline opacity, we are done
  5903. if ( value === "" || currentStyle && !currentStyle.filter ) {
  5904. return;
  5905. }
  5906. }
  5907. // otherwise, set new filter values
  5908. style.filter = ralpha.test( filter ) ?
  5909. filter.replace( ralpha, opacity ) :
  5910. filter + " " + opacity;
  5911. }
  5912. };
  5913. }
  5914. jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
  5915. function( elem, computed ) {
  5916. if ( computed ) {
  5917. return swap( elem, { "display": "inline-block" },
  5918. curCSS, [ elem, "marginRight" ] );
  5919. }
  5920. }
  5921. );
  5922. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5923. function( elem, computed ) {
  5924. if ( computed ) {
  5925. return (
  5926. parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5927. // Support: IE<=11+
  5928. // Running getBoundingClientRect on a disconnected node in IE throws an error
  5929. // Support: IE8 only
  5930. // getClientRects() errors on disconnected elems
  5931. ( jQuery.contains( elem.ownerDocument, elem ) ?
  5932. elem.getBoundingClientRect().left -
  5933. swap( elem, { marginLeft: 0 }, function() {
  5934. return elem.getBoundingClientRect().left;
  5935. } ) :
  5936. 0
  5937. )
  5938. ) + "px";
  5939. }
  5940. }
  5941. );
  5942. // These hooks are used by animate to expand properties
  5943. jQuery.each( {
  5944. margin: "",
  5945. padding: "",
  5946. border: "Width"
  5947. }, function( prefix, suffix ) {
  5948. jQuery.cssHooks[ prefix + suffix ] = {
  5949. expand: function( value ) {
  5950. var i = 0,
  5951. expanded = {},
  5952. // assumes a single number if not a string
  5953. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5954. for ( ; i < 4; i++ ) {
  5955. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5956. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5957. }
  5958. return expanded;
  5959. }
  5960. };
  5961. if ( !rmargin.test( prefix ) ) {
  5962. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5963. }
  5964. } );
  5965. jQuery.fn.extend( {
  5966. css: function( name, value ) {
  5967. return access( this, function( elem, name, value ) {
  5968. var styles, len,
  5969. map = {},
  5970. i = 0;
  5971. if ( jQuery.isArray( name ) ) {
  5972. styles = getStyles( elem );
  5973. len = name.length;
  5974. for ( ; i < len; i++ ) {
  5975. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5976. }
  5977. return map;
  5978. }
  5979. return value !== undefined ?
  5980. jQuery.style( elem, name, value ) :
  5981. jQuery.css( elem, name );
  5982. }, name, value, arguments.length > 1 );
  5983. },
  5984. show: function() {
  5985. return showHide( this, true );
  5986. },
  5987. hide: function() {
  5988. return showHide( this );
  5989. },
  5990. toggle: function( state ) {
  5991. if ( typeof state === "boolean" ) {
  5992. return state ? this.show() : this.hide();
  5993. }
  5994. return this.each( function() {
  5995. if ( isHidden( this ) ) {
  5996. jQuery( this ).show();
  5997. } else {
  5998. jQuery( this ).hide();
  5999. }
  6000. } );
  6001. }
  6002. } );
  6003. function Tween( elem, options, prop, end, easing ) {
  6004. return new Tween.prototype.init( elem, options, prop, end, easing );
  6005. }
  6006. jQuery.Tween = Tween;
  6007. Tween.prototype = {
  6008. constructor: Tween,
  6009. init: function( elem, options, prop, end, easing, unit ) {
  6010. this.elem = elem;
  6011. this.prop = prop;
  6012. this.easing = easing || jQuery.easing._default;
  6013. this.options = options;
  6014. this.start = this.now = this.cur();
  6015. this.end = end;
  6016. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  6017. },
  6018. cur: function() {
  6019. var hooks = Tween.propHooks[ this.prop ];
  6020. return hooks && hooks.get ?
  6021. hooks.get( this ) :
  6022. Tween.propHooks._default.get( this );
  6023. },
  6024. run: function( percent ) {
  6025. var eased,
  6026. hooks = Tween.propHooks[ this.prop ];
  6027. if ( this.options.duration ) {
  6028. this.pos = eased = jQuery.easing[ this.easing ](
  6029. percent, this.options.duration * percent, 0, 1, this.options.duration
  6030. );
  6031. } else {
  6032. this.pos = eased = percent;
  6033. }
  6034. this.now = ( this.end - this.start ) * eased + this.start;
  6035. if ( this.options.step ) {
  6036. this.options.step.call( this.elem, this.now, this );
  6037. }
  6038. if ( hooks && hooks.set ) {
  6039. hooks.set( this );
  6040. } else {
  6041. Tween.propHooks._default.set( this );
  6042. }
  6043. return this;
  6044. }
  6045. };
  6046. Tween.prototype.init.prototype = Tween.prototype;
  6047. Tween.propHooks = {
  6048. _default: {
  6049. get: function( tween ) {
  6050. var result;
  6051. // Use a property on the element directly when it is not a DOM element,
  6052. // or when there is no matching style property that exists.
  6053. if ( tween.elem.nodeType !== 1 ||
  6054. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  6055. return tween.elem[ tween.prop ];
  6056. }
  6057. // passing an empty string as a 3rd parameter to .css will automatically
  6058. // attempt a parseFloat and fallback to a string if the parse fails
  6059. // so, simple values such as "10px" are parsed to Float.
  6060. // complex values such as "rotate(1rad)" are returned as is.
  6061. result = jQuery.css( tween.elem, tween.prop, "" );
  6062. // Empty strings, null, undefined and "auto" are converted to 0.
  6063. return !result || result === "auto" ? 0 : result;
  6064. },
  6065. set: function( tween ) {
  6066. // use step hook for back compat - use cssHook if its there - use .style if its
  6067. // available and use plain properties where available
  6068. if ( jQuery.fx.step[ tween.prop ] ) {
  6069. jQuery.fx.step[ tween.prop ]( tween );
  6070. } else if ( tween.elem.nodeType === 1 &&
  6071. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  6072. jQuery.cssHooks[ tween.prop ] ) ) {
  6073. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  6074. } else {
  6075. tween.elem[ tween.prop ] = tween.now;
  6076. }
  6077. }
  6078. }
  6079. };
  6080. // Support: IE <=9
  6081. // Panic based approach to setting things on disconnected nodes
  6082. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  6083. set: function( tween ) {
  6084. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  6085. tween.elem[ tween.prop ] = tween.now;
  6086. }
  6087. }
  6088. };
  6089. jQuery.easing = {
  6090. linear: function( p ) {
  6091. return p;
  6092. },
  6093. swing: function( p ) {
  6094. return 0.5 - Math.cos( p * Math.PI ) / 2;
  6095. },
  6096. _default: "swing"
  6097. };
  6098. jQuery.fx = Tween.prototype.init;
  6099. // Back Compat <1.8 extension point
  6100. jQuery.fx.step = {};
  6101. var
  6102. fxNow, timerId,
  6103. rfxtypes = /^(?:toggle|show|hide)$/,
  6104. rrun = /queueHooks$/;
  6105. // Animations created synchronously will run synchronously
  6106. function createFxNow() {
  6107. window.setTimeout( function() {
  6108. fxNow = undefined;
  6109. } );
  6110. return ( fxNow = jQuery.now() );
  6111. }
  6112. // Generate parameters to create a standard animation
  6113. function genFx( type, includeWidth ) {
  6114. var which,
  6115. attrs = { height: type },
  6116. i = 0;
  6117. // if we include width, step value is 1 to do all cssExpand values,
  6118. // if we don't include width, step value is 2 to skip over Left and Right
  6119. includeWidth = includeWidth ? 1 : 0;
  6120. for ( ; i < 4 ; i += 2 - includeWidth ) {
  6121. which = cssExpand[ i ];
  6122. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  6123. }
  6124. if ( includeWidth ) {
  6125. attrs.opacity = attrs.width = type;
  6126. }
  6127. return attrs;
  6128. }
  6129. function createTween( value, prop, animation ) {
  6130. var tween,
  6131. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  6132. index = 0,
  6133. length = collection.length;
  6134. for ( ; index < length; index++ ) {
  6135. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  6136. // we're done with this property
  6137. return tween;
  6138. }
  6139. }
  6140. }
  6141. function defaultPrefilter( elem, props, opts ) {
  6142. /* jshint validthis: true */
  6143. var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
  6144. anim = this,
  6145. orig = {},
  6146. style = elem.style,
  6147. hidden = elem.nodeType && isHidden( elem ),
  6148. dataShow = jQuery._data( elem, "fxshow" );
  6149. // handle queue: false promises
  6150. if ( !opts.queue ) {
  6151. hooks = jQuery._queueHooks( elem, "fx" );
  6152. if ( hooks.unqueued == null ) {
  6153. hooks.unqueued = 0;
  6154. oldfire = hooks.empty.fire;
  6155. hooks.empty.fire = function() {
  6156. if ( !hooks.unqueued ) {
  6157. oldfire();
  6158. }
  6159. };
  6160. }
  6161. hooks.unqueued++;
  6162. anim.always( function() {
  6163. // doing this makes sure that the complete handler will be called
  6164. // before this completes
  6165. anim.always( function() {
  6166. hooks.unqueued--;
  6167. if ( !jQuery.queue( elem, "fx" ).length ) {
  6168. hooks.empty.fire();
  6169. }
  6170. } );
  6171. } );
  6172. }
  6173. // height/width overflow pass
  6174. if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
  6175. // Make sure that nothing sneaks out
  6176. // Record all 3 overflow attributes because IE does not
  6177. // change the overflow attribute when overflowX and
  6178. // overflowY are set to the same value
  6179. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  6180. // Set display property to inline-block for height/width
  6181. // animations on inline elements that are having width/height animated
  6182. display = jQuery.css( elem, "display" );
  6183. // Test default display if display is currently "none"
  6184. checkDisplay = display === "none" ?
  6185. jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
  6186. if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
  6187. // inline-level elements accept inline-block;
  6188. // block-level elements need to be inline with layout
  6189. if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
  6190. style.display = "inline-block";
  6191. } else {
  6192. style.zoom = 1;
  6193. }
  6194. }
  6195. }
  6196. if ( opts.overflow ) {
  6197. style.overflow = "hidden";
  6198. if ( !support.shrinkWrapBlocks() ) {
  6199. anim.always( function() {
  6200. style.overflow = opts.overflow[ 0 ];
  6201. style.overflowX = opts.overflow[ 1 ];
  6202. style.overflowY = opts.overflow[ 2 ];
  6203. } );
  6204. }
  6205. }
  6206. // show/hide pass
  6207. for ( prop in props ) {
  6208. value = props[ prop ];
  6209. if ( rfxtypes.exec( value ) ) {
  6210. delete props[ prop ];
  6211. toggle = toggle || value === "toggle";
  6212. if ( value === ( hidden ? "hide" : "show" ) ) {
  6213. // If there is dataShow left over from a stopped hide or show
  6214. // and we are going to proceed with show, we should pretend to be hidden
  6215. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  6216. hidden = true;
  6217. } else {
  6218. continue;
  6219. }
  6220. }
  6221. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  6222. // Any non-fx value stops us from restoring the original display value
  6223. } else {
  6224. display = undefined;
  6225. }
  6226. }
  6227. if ( !jQuery.isEmptyObject( orig ) ) {
  6228. if ( dataShow ) {
  6229. if ( "hidden" in dataShow ) {
  6230. hidden = dataShow.hidden;
  6231. }
  6232. } else {
  6233. dataShow = jQuery._data( elem, "fxshow", {} );
  6234. }
  6235. // store state if its toggle - enables .stop().toggle() to "reverse"
  6236. if ( toggle ) {
  6237. dataShow.hidden = !hidden;
  6238. }
  6239. if ( hidden ) {
  6240. jQuery( elem ).show();
  6241. } else {
  6242. anim.done( function() {
  6243. jQuery( elem ).hide();
  6244. } );
  6245. }
  6246. anim.done( function() {
  6247. var prop;
  6248. jQuery._removeData( elem, "fxshow" );
  6249. for ( prop in orig ) {
  6250. jQuery.style( elem, prop, orig[ prop ] );
  6251. }
  6252. } );
  6253. for ( prop in orig ) {
  6254. tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  6255. if ( !( prop in dataShow ) ) {
  6256. dataShow[ prop ] = tween.start;
  6257. if ( hidden ) {
  6258. tween.end = tween.start;
  6259. tween.start = prop === "width" || prop === "height" ? 1 : 0;
  6260. }
  6261. }
  6262. }
  6263. // If this is a noop like .hide().hide(), restore an overwritten display value
  6264. } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
  6265. style.display = display;
  6266. }
  6267. }
  6268. function propFilter( props, specialEasing ) {
  6269. var index, name, easing, value, hooks;
  6270. // camelCase, specialEasing and expand cssHook pass
  6271. for ( index in props ) {
  6272. name = jQuery.camelCase( index );
  6273. easing = specialEasing[ name ];
  6274. value = props[ index ];
  6275. if ( jQuery.isArray( value ) ) {
  6276. easing = value[ 1 ];
  6277. value = props[ index ] = value[ 0 ];
  6278. }
  6279. if ( index !== name ) {
  6280. props[ name ] = value;
  6281. delete props[ index ];
  6282. }
  6283. hooks = jQuery.cssHooks[ name ];
  6284. if ( hooks && "expand" in hooks ) {
  6285. value = hooks.expand( value );
  6286. delete props[ name ];
  6287. // not quite $.extend, this wont overwrite keys already present.
  6288. // also - reusing 'index' from above because we have the correct "name"
  6289. for ( index in value ) {
  6290. if ( !( index in props ) ) {
  6291. props[ index ] = value[ index ];
  6292. specialEasing[ index ] = easing;
  6293. }
  6294. }
  6295. } else {
  6296. specialEasing[ name ] = easing;
  6297. }
  6298. }
  6299. }
  6300. function Animation( elem, properties, options ) {
  6301. var result,
  6302. stopped,
  6303. index = 0,
  6304. length = Animation.prefilters.length,
  6305. deferred = jQuery.Deferred().always( function() {
  6306. // don't match elem in the :animated selector
  6307. delete tick.elem;
  6308. } ),
  6309. tick = function() {
  6310. if ( stopped ) {
  6311. return false;
  6312. }
  6313. var currentTime = fxNow || createFxNow(),
  6314. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  6315. // Support: Android 2.3
  6316. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  6317. temp = remaining / animation.duration || 0,
  6318. percent = 1 - temp,
  6319. index = 0,
  6320. length = animation.tweens.length;
  6321. for ( ; index < length ; index++ ) {
  6322. animation.tweens[ index ].run( percent );
  6323. }
  6324. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  6325. if ( percent < 1 && length ) {
  6326. return remaining;
  6327. } else {
  6328. deferred.resolveWith( elem, [ animation ] );
  6329. return false;
  6330. }
  6331. },
  6332. animation = deferred.promise( {
  6333. elem: elem,
  6334. props: jQuery.extend( {}, properties ),
  6335. opts: jQuery.extend( true, {
  6336. specialEasing: {},
  6337. easing: jQuery.easing._default
  6338. }, options ),
  6339. originalProperties: properties,
  6340. originalOptions: options,
  6341. startTime: fxNow || createFxNow(),
  6342. duration: options.duration,
  6343. tweens: [],
  6344. createTween: function( prop, end ) {
  6345. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  6346. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  6347. animation.tweens.push( tween );
  6348. return tween;
  6349. },
  6350. stop: function( gotoEnd ) {
  6351. var index = 0,
  6352. // if we are going to the end, we want to run all the tweens
  6353. // otherwise we skip this part
  6354. length = gotoEnd ? animation.tweens.length : 0;
  6355. if ( stopped ) {
  6356. return this;
  6357. }
  6358. stopped = true;
  6359. for ( ; index < length ; index++ ) {
  6360. animation.tweens[ index ].run( 1 );
  6361. }
  6362. // resolve when we played the last frame
  6363. // otherwise, reject
  6364. if ( gotoEnd ) {
  6365. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6366. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  6367. } else {
  6368. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  6369. }
  6370. return this;
  6371. }
  6372. } ),
  6373. props = animation.props;
  6374. propFilter( props, animation.opts.specialEasing );
  6375. for ( ; index < length ; index++ ) {
  6376. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  6377. if ( result ) {
  6378. if ( jQuery.isFunction( result.stop ) ) {
  6379. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  6380. jQuery.proxy( result.stop, result );
  6381. }
  6382. return result;
  6383. }
  6384. }
  6385. jQuery.map( props, createTween, animation );
  6386. if ( jQuery.isFunction( animation.opts.start ) ) {
  6387. animation.opts.start.call( elem, animation );
  6388. }
  6389. jQuery.fx.timer(
  6390. jQuery.extend( tick, {
  6391. elem: elem,
  6392. anim: animation,
  6393. queue: animation.opts.queue
  6394. } )
  6395. );
  6396. // attach callbacks from options
  6397. return animation.progress( animation.opts.progress )
  6398. .done( animation.opts.done, animation.opts.complete )
  6399. .fail( animation.opts.fail )
  6400. .always( animation.opts.always );
  6401. }
  6402. jQuery.Animation = jQuery.extend( Animation, {
  6403. tweeners: {
  6404. "*": [ function( prop, value ) {
  6405. var tween = this.createTween( prop, value );
  6406. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  6407. return tween;
  6408. } ]
  6409. },
  6410. tweener: function( props, callback ) {
  6411. if ( jQuery.isFunction( props ) ) {
  6412. callback = props;
  6413. props = [ "*" ];
  6414. } else {
  6415. props = props.match( rnotwhite );
  6416. }
  6417. var prop,
  6418. index = 0,
  6419. length = props.length;
  6420. for ( ; index < length ; index++ ) {
  6421. prop = props[ index ];
  6422. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  6423. Animation.tweeners[ prop ].unshift( callback );
  6424. }
  6425. },
  6426. prefilters: [ defaultPrefilter ],
  6427. prefilter: function( callback, prepend ) {
  6428. if ( prepend ) {
  6429. Animation.prefilters.unshift( callback );
  6430. } else {
  6431. Animation.prefilters.push( callback );
  6432. }
  6433. }
  6434. } );
  6435. jQuery.speed = function( speed, easing, fn ) {
  6436. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  6437. complete: fn || !fn && easing ||
  6438. jQuery.isFunction( speed ) && speed,
  6439. duration: speed,
  6440. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  6441. };
  6442. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  6443. opt.duration in jQuery.fx.speeds ?
  6444. jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
  6445. // normalize opt.queue - true/undefined/null -> "fx"
  6446. if ( opt.queue == null || opt.queue === true ) {
  6447. opt.queue = "fx";
  6448. }
  6449. // Queueing
  6450. opt.old = opt.complete;
  6451. opt.complete = function() {
  6452. if ( jQuery.isFunction( opt.old ) ) {
  6453. opt.old.call( this );
  6454. }
  6455. if ( opt.queue ) {
  6456. jQuery.dequeue( this, opt.queue );
  6457. }
  6458. };
  6459. return opt;
  6460. };
  6461. jQuery.fn.extend( {
  6462. fadeTo: function( speed, to, easing, callback ) {
  6463. // show any hidden elements after setting opacity to 0
  6464. return this.filter( isHidden ).css( "opacity", 0 ).show()
  6465. // animate to the value specified
  6466. .end().animate( { opacity: to }, speed, easing, callback );
  6467. },
  6468. animate: function( prop, speed, easing, callback ) {
  6469. var empty = jQuery.isEmptyObject( prop ),
  6470. optall = jQuery.speed( speed, easing, callback ),
  6471. doAnimation = function() {
  6472. // Operate on a copy of prop so per-property easing won't be lost
  6473. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  6474. // Empty animations, or finishing resolves immediately
  6475. if ( empty || jQuery._data( this, "finish" ) ) {
  6476. anim.stop( true );
  6477. }
  6478. };
  6479. doAnimation.finish = doAnimation;
  6480. return empty || optall.queue === false ?
  6481. this.each( doAnimation ) :
  6482. this.queue( optall.queue, doAnimation );
  6483. },
  6484. stop: function( type, clearQueue, gotoEnd ) {
  6485. var stopQueue = function( hooks ) {
  6486. var stop = hooks.stop;
  6487. delete hooks.stop;
  6488. stop( gotoEnd );
  6489. };
  6490. if ( typeof type !== "string" ) {
  6491. gotoEnd = clearQueue;
  6492. clearQueue = type;
  6493. type = undefined;
  6494. }
  6495. if ( clearQueue && type !== false ) {
  6496. this.queue( type || "fx", [] );
  6497. }
  6498. return this.each( function() {
  6499. var dequeue = true,
  6500. index = type != null && type + "queueHooks",
  6501. timers = jQuery.timers,
  6502. data = jQuery._data( this );
  6503. if ( index ) {
  6504. if ( data[ index ] && data[ index ].stop ) {
  6505. stopQueue( data[ index ] );
  6506. }
  6507. } else {
  6508. for ( index in data ) {
  6509. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6510. stopQueue( data[ index ] );
  6511. }
  6512. }
  6513. }
  6514. for ( index = timers.length; index--; ) {
  6515. if ( timers[ index ].elem === this &&
  6516. ( type == null || timers[ index ].queue === type ) ) {
  6517. timers[ index ].anim.stop( gotoEnd );
  6518. dequeue = false;
  6519. timers.splice( index, 1 );
  6520. }
  6521. }
  6522. // start the next in the queue if the last step wasn't forced
  6523. // timers currently will call their complete callbacks, which will dequeue
  6524. // but only if they were gotoEnd
  6525. if ( dequeue || !gotoEnd ) {
  6526. jQuery.dequeue( this, type );
  6527. }
  6528. } );
  6529. },
  6530. finish: function( type ) {
  6531. if ( type !== false ) {
  6532. type = type || "fx";
  6533. }
  6534. return this.each( function() {
  6535. var index,
  6536. data = jQuery._data( this ),
  6537. queue = data[ type + "queue" ],
  6538. hooks = data[ type + "queueHooks" ],
  6539. timers = jQuery.timers,
  6540. length = queue ? queue.length : 0;
  6541. // enable finishing flag on private data
  6542. data.finish = true;
  6543. // empty the queue first
  6544. jQuery.queue( this, type, [] );
  6545. if ( hooks && hooks.stop ) {
  6546. hooks.stop.call( this, true );
  6547. }
  6548. // look for any active animations, and finish them
  6549. for ( index = timers.length; index--; ) {
  6550. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6551. timers[ index ].anim.stop( true );
  6552. timers.splice( index, 1 );
  6553. }
  6554. }
  6555. // look for any animations in the old queue and finish them
  6556. for ( index = 0; index < length; index++ ) {
  6557. if ( queue[ index ] && queue[ index ].finish ) {
  6558. queue[ index ].finish.call( this );
  6559. }
  6560. }
  6561. // turn off finishing flag
  6562. delete data.finish;
  6563. } );
  6564. }
  6565. } );
  6566. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6567. var cssFn = jQuery.fn[ name ];
  6568. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6569. return speed == null || typeof speed === "boolean" ?
  6570. cssFn.apply( this, arguments ) :
  6571. this.animate( genFx( name, true ), speed, easing, callback );
  6572. };
  6573. } );
  6574. // Generate shortcuts for custom animations
  6575. jQuery.each( {
  6576. slideDown: genFx( "show" ),
  6577. slideUp: genFx( "hide" ),
  6578. slideToggle: genFx( "toggle" ),
  6579. fadeIn: { opacity: "show" },
  6580. fadeOut: { opacity: "hide" },
  6581. fadeToggle: { opacity: "toggle" }
  6582. }, function( name, props ) {
  6583. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6584. return this.animate( props, speed, easing, callback );
  6585. };
  6586. } );
  6587. jQuery.timers = [];
  6588. jQuery.fx.tick = function() {
  6589. var timer,
  6590. timers = jQuery.timers,
  6591. i = 0;
  6592. fxNow = jQuery.now();
  6593. for ( ; i < timers.length; i++ ) {
  6594. timer = timers[ i ];
  6595. // Checks the timer has not already been removed
  6596. if ( !timer() && timers[ i ] === timer ) {
  6597. timers.splice( i--, 1 );
  6598. }
  6599. }
  6600. if ( !timers.length ) {
  6601. jQuery.fx.stop();
  6602. }
  6603. fxNow = undefined;
  6604. };
  6605. jQuery.fx.timer = function( timer ) {
  6606. jQuery.timers.push( timer );
  6607. if ( timer() ) {
  6608. jQuery.fx.start();
  6609. } else {
  6610. jQuery.timers.pop();
  6611. }
  6612. };
  6613. jQuery.fx.interval = 13;
  6614. jQuery.fx.start = function() {
  6615. if ( !timerId ) {
  6616. timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
  6617. }
  6618. };
  6619. jQuery.fx.stop = function() {
  6620. window.clearInterval( timerId );
  6621. timerId = null;
  6622. };
  6623. jQuery.fx.speeds = {
  6624. slow: 600,
  6625. fast: 200,
  6626. // Default speed
  6627. _default: 400
  6628. };
  6629. // Based off of the plugin by Clint Helfers, with permission.
  6630. // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6631. jQuery.fn.delay = function( time, type ) {
  6632. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6633. type = type || "fx";
  6634. return this.queue( type, function( next, hooks ) {
  6635. var timeout = window.setTimeout( next, time );
  6636. hooks.stop = function() {
  6637. window.clearTimeout( timeout );
  6638. };
  6639. } );
  6640. };
  6641. ( function() {
  6642. var a,
  6643. input = document.createElement( "input" ),
  6644. div = document.createElement( "div" ),
  6645. select = document.createElement( "select" ),
  6646. opt = select.appendChild( document.createElement( "option" ) );
  6647. // Setup
  6648. div = document.createElement( "div" );
  6649. div.setAttribute( "className", "t" );
  6650. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  6651. a = div.getElementsByTagName( "a" )[ 0 ];
  6652. // Support: Windows Web Apps (WWA)
  6653. // `type` must use .setAttribute for WWA (#14901)
  6654. input.setAttribute( "type", "checkbox" );
  6655. div.appendChild( input );
  6656. a = div.getElementsByTagName( "a" )[ 0 ];
  6657. // First batch of tests.
  6658. a.style.cssText = "top:1px";
  6659. // Test setAttribute on camelCase class.
  6660. // If it works, we need attrFixes when doing get/setAttribute (ie6/7)
  6661. support.getSetAttribute = div.className !== "t";
  6662. // Get the style information from getAttribute
  6663. // (IE uses .cssText instead)
  6664. support.style = /top/.test( a.getAttribute( "style" ) );
  6665. // Make sure that URLs aren't manipulated
  6666. // (IE normalizes it by default)
  6667. support.hrefNormalized = a.getAttribute( "href" ) === "/a";
  6668. // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
  6669. support.checkOn = !!input.value;
  6670. // Make sure that a selected-by-default option has a working selected property.
  6671. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  6672. support.optSelected = opt.selected;
  6673. // Tests for enctype support on a form (#6743)
  6674. support.enctype = !!document.createElement( "form" ).enctype;
  6675. // Make sure that the options inside disabled selects aren't marked as disabled
  6676. // (WebKit marks them as disabled)
  6677. select.disabled = true;
  6678. support.optDisabled = !opt.disabled;
  6679. // Support: IE8 only
  6680. // Check if we can trust getAttribute("value")
  6681. input = document.createElement( "input" );
  6682. input.setAttribute( "value", "" );
  6683. support.input = input.getAttribute( "value" ) === "";
  6684. // Check if an input maintains its value after becoming a radio
  6685. input.value = "t";
  6686. input.setAttribute( "type", "radio" );
  6687. support.radioValue = input.value === "t";
  6688. } )();
  6689. var rreturn = /\r/g,
  6690. rspaces = /[\x20\t\r\n\f]+/g;
  6691. jQuery.fn.extend( {
  6692. val: function( value ) {
  6693. var hooks, ret, isFunction,
  6694. elem = this[ 0 ];
  6695. if ( !arguments.length ) {
  6696. if ( elem ) {
  6697. hooks = jQuery.valHooks[ elem.type ] ||
  6698. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6699. if (
  6700. hooks &&
  6701. "get" in hooks &&
  6702. ( ret = hooks.get( elem, "value" ) ) !== undefined
  6703. ) {
  6704. return ret;
  6705. }
  6706. ret = elem.value;
  6707. return typeof ret === "string" ?
  6708. // handle most common string cases
  6709. ret.replace( rreturn, "" ) :
  6710. // handle cases where value is null/undef or number
  6711. ret == null ? "" : ret;
  6712. }
  6713. return;
  6714. }
  6715. isFunction = jQuery.isFunction( value );
  6716. return this.each( function( i ) {
  6717. var val;
  6718. if ( this.nodeType !== 1 ) {
  6719. return;
  6720. }
  6721. if ( isFunction ) {
  6722. val = value.call( this, i, jQuery( this ).val() );
  6723. } else {
  6724. val = value;
  6725. }
  6726. // Treat null/undefined as ""; convert numbers to string
  6727. if ( val == null ) {
  6728. val = "";
  6729. } else if ( typeof val === "number" ) {
  6730. val += "";
  6731. } else if ( jQuery.isArray( val ) ) {
  6732. val = jQuery.map( val, function( value ) {
  6733. return value == null ? "" : value + "";
  6734. } );
  6735. }
  6736. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6737. // If set returns undefined, fall back to normal setting
  6738. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  6739. this.value = val;
  6740. }
  6741. } );
  6742. }
  6743. } );
  6744. jQuery.extend( {
  6745. valHooks: {
  6746. option: {
  6747. get: function( elem ) {
  6748. var val = jQuery.find.attr( elem, "value" );
  6749. return val != null ?
  6750. val :
  6751. // Support: IE10-11+
  6752. // option.text throws exceptions (#14686, #14858)
  6753. // Strip and collapse whitespace
  6754. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  6755. jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
  6756. }
  6757. },
  6758. select: {
  6759. get: function( elem ) {
  6760. var value, option,
  6761. options = elem.options,
  6762. index = elem.selectedIndex,
  6763. one = elem.type === "select-one" || index < 0,
  6764. values = one ? null : [],
  6765. max = one ? index + 1 : options.length,
  6766. i = index < 0 ?
  6767. max :
  6768. one ? index : 0;
  6769. // Loop through all the selected options
  6770. for ( ; i < max; i++ ) {
  6771. option = options[ i ];
  6772. // oldIE doesn't update selected after form reset (#2551)
  6773. if ( ( option.selected || i === index ) &&
  6774. // Don't return options that are disabled or in a disabled optgroup
  6775. ( support.optDisabled ?
  6776. !option.disabled :
  6777. option.getAttribute( "disabled" ) === null ) &&
  6778. ( !option.parentNode.disabled ||
  6779. !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
  6780. // Get the specific value for the option
  6781. value = jQuery( option ).val();
  6782. // We don't need an array for one selects
  6783. if ( one ) {
  6784. return value;
  6785. }
  6786. // Multi-Selects return an array
  6787. values.push( value );
  6788. }
  6789. }
  6790. return values;
  6791. },
  6792. set: function( elem, value ) {
  6793. var optionSet, option,
  6794. options = elem.options,
  6795. values = jQuery.makeArray( value ),
  6796. i = options.length;
  6797. while ( i-- ) {
  6798. option = options[ i ];
  6799. if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {
  6800. // Support: IE6
  6801. // When new option element is added to select box we need to
  6802. // force reflow of newly added node in order to workaround delay
  6803. // of initialization properties
  6804. try {
  6805. option.selected = optionSet = true;
  6806. } catch ( _ ) {
  6807. // Will be executed only in IE6
  6808. option.scrollHeight;
  6809. }
  6810. } else {
  6811. option.selected = false;
  6812. }
  6813. }
  6814. // Force browsers to behave consistently when non-matching value is set
  6815. if ( !optionSet ) {
  6816. elem.selectedIndex = -1;
  6817. }
  6818. return options;
  6819. }
  6820. }
  6821. }
  6822. } );
  6823. // Radios and checkboxes getter/setter
  6824. jQuery.each( [ "radio", "checkbox" ], function() {
  6825. jQuery.valHooks[ this ] = {
  6826. set: function( elem, value ) {
  6827. if ( jQuery.isArray( value ) ) {
  6828. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  6829. }
  6830. }
  6831. };
  6832. if ( !support.checkOn ) {
  6833. jQuery.valHooks[ this ].get = function( elem ) {
  6834. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  6835. };
  6836. }
  6837. } );
  6838. var nodeHook, boolHook,
  6839. attrHandle = jQuery.expr.attrHandle,
  6840. ruseDefault = /^(?:checked|selected)$/i,
  6841. getSetAttribute = support.getSetAttribute,
  6842. getSetInput = support.input;
  6843. jQuery.fn.extend( {
  6844. attr: function( name, value ) {
  6845. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6846. },
  6847. removeAttr: function( name ) {
  6848. return this.each( function() {
  6849. jQuery.removeAttr( this, name );
  6850. } );
  6851. }
  6852. } );
  6853. jQuery.extend( {
  6854. attr: function( elem, name, value ) {
  6855. var ret, hooks,
  6856. nType = elem.nodeType;
  6857. // Don't get/set attributes on text, comment and attribute nodes
  6858. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6859. return;
  6860. }
  6861. // Fallback to prop when attributes are not supported
  6862. if ( typeof elem.getAttribute === "undefined" ) {
  6863. return jQuery.prop( elem, name, value );
  6864. }
  6865. // All attributes are lowercase
  6866. // Grab necessary hook if one is defined
  6867. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6868. name = name.toLowerCase();
  6869. hooks = jQuery.attrHooks[ name ] ||
  6870. ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
  6871. }
  6872. if ( value !== undefined ) {
  6873. if ( value === null ) {
  6874. jQuery.removeAttr( elem, name );
  6875. return;
  6876. }
  6877. if ( hooks && "set" in hooks &&
  6878. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6879. return ret;
  6880. }
  6881. elem.setAttribute( name, value + "" );
  6882. return value;
  6883. }
  6884. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6885. return ret;
  6886. }
  6887. ret = jQuery.find.attr( elem, name );
  6888. // Non-existent attributes return null, we normalize to undefined
  6889. return ret == null ? undefined : ret;
  6890. },
  6891. attrHooks: {
  6892. type: {
  6893. set: function( elem, value ) {
  6894. if ( !support.radioValue && value === "radio" &&
  6895. jQuery.nodeName( elem, "input" ) ) {
  6896. // Setting the type on a radio button after the value resets the value in IE8-9
  6897. // Reset value to default in case type is set after value during creation
  6898. var val = elem.value;
  6899. elem.setAttribute( "type", value );
  6900. if ( val ) {
  6901. elem.value = val;
  6902. }
  6903. return value;
  6904. }
  6905. }
  6906. }
  6907. },
  6908. removeAttr: function( elem, value ) {
  6909. var name, propName,
  6910. i = 0,
  6911. attrNames = value && value.match( rnotwhite );
  6912. if ( attrNames && elem.nodeType === 1 ) {
  6913. while ( ( name = attrNames[ i++ ] ) ) {
  6914. propName = jQuery.propFix[ name ] || name;
  6915. // Boolean attributes get special treatment (#10870)
  6916. if ( jQuery.expr.match.bool.test( name ) ) {
  6917. // Set corresponding property to false
  6918. if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  6919. elem[ propName ] = false;
  6920. // Support: IE<9
  6921. // Also clear defaultChecked/defaultSelected (if appropriate)
  6922. } else {
  6923. elem[ jQuery.camelCase( "default-" + name ) ] =
  6924. elem[ propName ] = false;
  6925. }
  6926. // See #9699 for explanation of this approach (setting first, then removal)
  6927. } else {
  6928. jQuery.attr( elem, name, "" );
  6929. }
  6930. elem.removeAttribute( getSetAttribute ? name : propName );
  6931. }
  6932. }
  6933. }
  6934. } );
  6935. // Hooks for boolean attributes
  6936. boolHook = {
  6937. set: function( elem, value, name ) {
  6938. if ( value === false ) {
  6939. // Remove boolean attributes when set to false
  6940. jQuery.removeAttr( elem, name );
  6941. } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  6942. // IE<8 needs the *property* name
  6943. elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
  6944. } else {
  6945. // Support: IE<9
  6946. // Use defaultChecked and defaultSelected for oldIE
  6947. elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
  6948. }
  6949. return name;
  6950. }
  6951. };
  6952. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6953. var getter = attrHandle[ name ] || jQuery.find.attr;
  6954. if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  6955. attrHandle[ name ] = function( elem, name, isXML ) {
  6956. var ret, handle;
  6957. if ( !isXML ) {
  6958. // Avoid an infinite loop by temporarily removing this function from the getter
  6959. handle = attrHandle[ name ];
  6960. attrHandle[ name ] = ret;
  6961. ret = getter( elem, name, isXML ) != null ?
  6962. name.toLowerCase() :
  6963. null;
  6964. attrHandle[ name ] = handle;
  6965. }
  6966. return ret;
  6967. };
  6968. } else {
  6969. attrHandle[ name ] = function( elem, name, isXML ) {
  6970. if ( !isXML ) {
  6971. return elem[ jQuery.camelCase( "default-" + name ) ] ?
  6972. name.toLowerCase() :
  6973. null;
  6974. }
  6975. };
  6976. }
  6977. } );
  6978. // fix oldIE attroperties
  6979. if ( !getSetInput || !getSetAttribute ) {
  6980. jQuery.attrHooks.value = {
  6981. set: function( elem, value, name ) {
  6982. if ( jQuery.nodeName( elem, "input" ) ) {
  6983. // Does not return so that setAttribute is also used
  6984. elem.defaultValue = value;
  6985. } else {
  6986. // Use nodeHook if defined (#1954); otherwise setAttribute is fine
  6987. return nodeHook && nodeHook.set( elem, value, name );
  6988. }
  6989. }
  6990. };
  6991. }
  6992. // IE6/7 do not support getting/setting some attributes with get/setAttribute
  6993. if ( !getSetAttribute ) {
  6994. // Use this for any attribute in IE6/7
  6995. // This fixes almost every IE6/7 issue
  6996. nodeHook = {
  6997. set: function( elem, value, name ) {
  6998. // Set the existing or create a new attribute node
  6999. var ret = elem.getAttributeNode( name );
  7000. if ( !ret ) {
  7001. elem.setAttributeNode(
  7002. ( ret = elem.ownerDocument.createAttribute( name ) )
  7003. );
  7004. }
  7005. ret.value = value += "";
  7006. // Break association with cloned elements by also using setAttribute (#9646)
  7007. if ( name === "value" || value === elem.getAttribute( name ) ) {
  7008. return value;
  7009. }
  7010. }
  7011. };
  7012. // Some attributes are constructed with empty-string values when not defined
  7013. attrHandle.id = attrHandle.name = attrHandle.coords =
  7014. function( elem, name, isXML ) {
  7015. var ret;
  7016. if ( !isXML ) {
  7017. return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
  7018. ret.value :
  7019. null;
  7020. }
  7021. };
  7022. // Fixing value retrieval on a button requires this module
  7023. jQuery.valHooks.button = {
  7024. get: function( elem, name ) {
  7025. var ret = elem.getAttributeNode( name );
  7026. if ( ret && ret.specified ) {
  7027. return ret.value;
  7028. }
  7029. },
  7030. set: nodeHook.set
  7031. };
  7032. // Set contenteditable to false on removals(#10429)
  7033. // Setting to empty string throws an error as an invalid value
  7034. jQuery.attrHooks.contenteditable = {
  7035. set: function( elem, value, name ) {
  7036. nodeHook.set( elem, value === "" ? false : value, name );
  7037. }
  7038. };
  7039. // Set width and height to auto instead of 0 on empty string( Bug #8150 )
  7040. // This is for removals
  7041. jQuery.each( [ "width", "height" ], function( i, name ) {
  7042. jQuery.attrHooks[ name ] = {
  7043. set: function( elem, value ) {
  7044. if ( value === "" ) {
  7045. elem.setAttribute( name, "auto" );
  7046. return value;
  7047. }
  7048. }
  7049. };
  7050. } );
  7051. }
  7052. if ( !support.style ) {
  7053. jQuery.attrHooks.style = {
  7054. get: function( elem ) {
  7055. // Return undefined in the case of empty string
  7056. // Note: IE uppercases css property names, but if we were to .toLowerCase()
  7057. // .cssText, that would destroy case sensitivity in URL's, like in "background"
  7058. return elem.style.cssText || undefined;
  7059. },
  7060. set: function( elem, value ) {
  7061. return ( elem.style.cssText = value + "" );
  7062. }
  7063. };
  7064. }
  7065. var rfocusable = /^(?:input|select|textarea|button|object)$/i,
  7066. rclickable = /^(?:a|area)$/i;
  7067. jQuery.fn.extend( {
  7068. prop: function( name, value ) {
  7069. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  7070. },
  7071. removeProp: function( name ) {
  7072. name = jQuery.propFix[ name ] || name;
  7073. return this.each( function() {
  7074. // try/catch handles cases where IE balks (such as removing a property on window)
  7075. try {
  7076. this[ name ] = undefined;
  7077. delete this[ name ];
  7078. } catch ( e ) {}
  7079. } );
  7080. }
  7081. } );
  7082. jQuery.extend( {
  7083. prop: function( elem, name, value ) {
  7084. var ret, hooks,
  7085. nType = elem.nodeType;
  7086. // Don't get/set properties on text, comment and attribute nodes
  7087. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7088. return;
  7089. }
  7090. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7091. // Fix name and attach hooks
  7092. name = jQuery.propFix[ name ] || name;
  7093. hooks = jQuery.propHooks[ name ];
  7094. }
  7095. if ( value !== undefined ) {
  7096. if ( hooks && "set" in hooks &&
  7097. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7098. return ret;
  7099. }
  7100. return ( elem[ name ] = value );
  7101. }
  7102. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7103. return ret;
  7104. }
  7105. return elem[ name ];
  7106. },
  7107. propHooks: {
  7108. tabIndex: {
  7109. get: function( elem ) {
  7110. // elem.tabIndex doesn't always return the
  7111. // correct value when it hasn't been explicitly set
  7112. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  7113. // Use proper attribute retrieval(#12072)
  7114. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7115. return tabindex ?
  7116. parseInt( tabindex, 10 ) :
  7117. rfocusable.test( elem.nodeName ) ||
  7118. rclickable.test( elem.nodeName ) && elem.href ?
  7119. 0 :
  7120. -1;
  7121. }
  7122. }
  7123. },
  7124. propFix: {
  7125. "for": "htmlFor",
  7126. "class": "className"
  7127. }
  7128. } );
  7129. // Some attributes require a special call on IE
  7130. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7131. if ( !support.hrefNormalized ) {
  7132. // href/src property should get the full normalized URL (#10299/#12915)
  7133. jQuery.each( [ "href", "src" ], function( i, name ) {
  7134. jQuery.propHooks[ name ] = {
  7135. get: function( elem ) {
  7136. return elem.getAttribute( name, 4 );
  7137. }
  7138. };
  7139. } );
  7140. }
  7141. // Support: Safari, IE9+
  7142. // Accessing the selectedIndex property
  7143. // forces the browser to respect setting selected
  7144. // on the option
  7145. // The getter ensures a default option is selected
  7146. // when in an optgroup
  7147. if ( !support.optSelected ) {
  7148. jQuery.propHooks.selected = {
  7149. get: function( elem ) {
  7150. var parent = elem.parentNode;
  7151. if ( parent ) {
  7152. parent.selectedIndex;
  7153. // Make sure that it also works with optgroups, see #5701
  7154. if ( parent.parentNode ) {
  7155. parent.parentNode.selectedIndex;
  7156. }
  7157. }
  7158. return null;
  7159. },
  7160. set: function( elem ) {
  7161. var parent = elem.parentNode;
  7162. if ( parent ) {
  7163. parent.selectedIndex;
  7164. if ( parent.parentNode ) {
  7165. parent.parentNode.selectedIndex;
  7166. }
  7167. }
  7168. }
  7169. };
  7170. }
  7171. jQuery.each( [
  7172. "tabIndex",
  7173. "readOnly",
  7174. "maxLength",
  7175. "cellSpacing",
  7176. "cellPadding",
  7177. "rowSpan",
  7178. "colSpan",
  7179. "useMap",
  7180. "frameBorder",
  7181. "contentEditable"
  7182. ], function() {
  7183. jQuery.propFix[ this.toLowerCase() ] = this;
  7184. } );
  7185. // IE6/7 call enctype encoding
  7186. if ( !support.enctype ) {
  7187. jQuery.propFix.enctype = "encoding";
  7188. }
  7189. var rclass = /[\t\r\n\f]/g;
  7190. function getClass( elem ) {
  7191. return jQuery.attr( elem, "class" ) || "";
  7192. }
  7193. jQuery.fn.extend( {
  7194. addClass: function( value ) {
  7195. var classes, elem, cur, curValue, clazz, j, finalValue,
  7196. i = 0;
  7197. if ( jQuery.isFunction( value ) ) {
  7198. return this.each( function( j ) {
  7199. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7200. } );
  7201. }
  7202. if ( typeof value === "string" && value ) {
  7203. classes = value.match( rnotwhite ) || [];
  7204. while ( ( elem = this[ i++ ] ) ) {
  7205. curValue = getClass( elem );
  7206. cur = elem.nodeType === 1 &&
  7207. ( " " + curValue + " " ).replace( rclass, " " );
  7208. if ( cur ) {
  7209. j = 0;
  7210. while ( ( clazz = classes[ j++ ] ) ) {
  7211. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  7212. cur += clazz + " ";
  7213. }
  7214. }
  7215. // only assign if different to avoid unneeded rendering.
  7216. finalValue = jQuery.trim( cur );
  7217. if ( curValue !== finalValue ) {
  7218. jQuery.attr( elem, "class", finalValue );
  7219. }
  7220. }
  7221. }
  7222. }
  7223. return this;
  7224. },
  7225. removeClass: function( value ) {
  7226. var classes, elem, cur, curValue, clazz, j, finalValue,
  7227. i = 0;
  7228. if ( jQuery.isFunction( value ) ) {
  7229. return this.each( function( j ) {
  7230. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7231. } );
  7232. }
  7233. if ( !arguments.length ) {
  7234. return this.attr( "class", "" );
  7235. }
  7236. if ( typeof value === "string" && value ) {
  7237. classes = value.match( rnotwhite ) || [];
  7238. while ( ( elem = this[ i++ ] ) ) {
  7239. curValue = getClass( elem );
  7240. // This expression is here for better compressibility (see addClass)
  7241. cur = elem.nodeType === 1 &&
  7242. ( " " + curValue + " " ).replace( rclass, " " );
  7243. if ( cur ) {
  7244. j = 0;
  7245. while ( ( clazz = classes[ j++ ] ) ) {
  7246. // Remove *all* instances
  7247. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  7248. cur = cur.replace( " " + clazz + " ", " " );
  7249. }
  7250. }
  7251. // Only assign if different to avoid unneeded rendering.
  7252. finalValue = jQuery.trim( cur );
  7253. if ( curValue !== finalValue ) {
  7254. jQuery.attr( elem, "class", finalValue );
  7255. }
  7256. }
  7257. }
  7258. }
  7259. return this;
  7260. },
  7261. toggleClass: function( value, stateVal ) {
  7262. var type = typeof value;
  7263. if ( typeof stateVal === "boolean" && type === "string" ) {
  7264. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7265. }
  7266. if ( jQuery.isFunction( value ) ) {
  7267. return this.each( function( i ) {
  7268. jQuery( this ).toggleClass(
  7269. value.call( this, i, getClass( this ), stateVal ),
  7270. stateVal
  7271. );
  7272. } );
  7273. }
  7274. return this.each( function() {
  7275. var className, i, self, classNames;
  7276. if ( type === "string" ) {
  7277. // Toggle individual class names
  7278. i = 0;
  7279. self = jQuery( this );
  7280. classNames = value.match( rnotwhite ) || [];
  7281. while ( ( className = classNames[ i++ ] ) ) {
  7282. // Check each className given, space separated list
  7283. if ( self.hasClass( className ) ) {
  7284. self.removeClass( className );
  7285. } else {
  7286. self.addClass( className );
  7287. }
  7288. }
  7289. // Toggle whole class name
  7290. } else if ( value === undefined || type === "boolean" ) {
  7291. className = getClass( this );
  7292. if ( className ) {
  7293. // store className if set
  7294. jQuery._data( this, "__className__", className );
  7295. }
  7296. // If the element has a class name or if we're passed "false",
  7297. // then remove the whole classname (if there was one, the above saved it).
  7298. // Otherwise bring back whatever was previously saved (if anything),
  7299. // falling back to the empty string if nothing was stored.
  7300. jQuery.attr( this, "class",
  7301. className || value === false ?
  7302. "" :
  7303. jQuery._data( this, "__className__" ) || ""
  7304. );
  7305. }
  7306. } );
  7307. },
  7308. hasClass: function( selector ) {
  7309. var className, elem,
  7310. i = 0;
  7311. className = " " + selector + " ";
  7312. while ( ( elem = this[ i++ ] ) ) {
  7313. if ( elem.nodeType === 1 &&
  7314. ( " " + getClass( elem ) + " " ).replace( rclass, " " )
  7315. .indexOf( className ) > -1
  7316. ) {
  7317. return true;
  7318. }
  7319. }
  7320. return false;
  7321. }
  7322. } );
  7323. // Return jQuery for attributes-only inclusion
  7324. jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
  7325. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  7326. "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
  7327. function( i, name ) {
  7328. // Handle event binding
  7329. jQuery.fn[ name ] = function( data, fn ) {
  7330. return arguments.length > 0 ?
  7331. this.on( name, null, data, fn ) :
  7332. this.trigger( name );
  7333. };
  7334. } );
  7335. jQuery.fn.extend( {
  7336. hover: function( fnOver, fnOut ) {
  7337. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  7338. }
  7339. } );
  7340. var location = window.location;
  7341. var nonce = jQuery.now();
  7342. var rquery = ( /\?/ );
  7343. var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
  7344. jQuery.parseJSON = function( data ) {
  7345. // Attempt to parse using the native JSON parser first
  7346. if ( window.JSON && window.JSON.parse ) {
  7347. // Support: Android 2.3
  7348. // Workaround failure to string-cast null input
  7349. return window.JSON.parse( data + "" );
  7350. }
  7351. var requireNonComma,
  7352. depth = null,
  7353. str = jQuery.trim( data + "" );
  7354. // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
  7355. // after removing valid tokens
  7356. return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
  7357. // Force termination if we see a misplaced comma
  7358. if ( requireNonComma && comma ) {
  7359. depth = 0;
  7360. }
  7361. // Perform no more replacements after returning to outermost depth
  7362. if ( depth === 0 ) {
  7363. return token;
  7364. }
  7365. // Commas must not follow "[", "{", or ","
  7366. requireNonComma = open || comma;
  7367. // Determine new depth
  7368. // array/object open ("[" or "{"): depth += true - false (increment)
  7369. // array/object close ("]" or "}"): depth += false - true (decrement)
  7370. // other cases ("," or primitive): depth += true - true (numeric cast)
  7371. depth += !close - !open;
  7372. // Remove this token
  7373. return "";
  7374. } ) ) ?
  7375. ( Function( "return " + str ) )() :
  7376. jQuery.error( "Invalid JSON: " + data );
  7377. };
  7378. // Cross-browser xml parsing
  7379. jQuery.parseXML = function( data ) {
  7380. var xml, tmp;
  7381. if ( !data || typeof data !== "string" ) {
  7382. return null;
  7383. }
  7384. try {
  7385. if ( window.DOMParser ) { // Standard
  7386. tmp = new window.DOMParser();
  7387. xml = tmp.parseFromString( data, "text/xml" );
  7388. } else { // IE
  7389. xml = new window.ActiveXObject( "Microsoft.XMLDOM" );
  7390. xml.async = "false";
  7391. xml.loadXML( data );
  7392. }
  7393. } catch ( e ) {
  7394. xml = undefined;
  7395. }
  7396. if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
  7397. jQuery.error( "Invalid XML: " + data );
  7398. }
  7399. return xml;
  7400. };
  7401. var
  7402. rhash = /#.*$/,
  7403. rts = /([?&])_=[^&]*/,
  7404. // IE leaves an \r character at EOL
  7405. rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
  7406. // #7653, #8125, #8152: local protocol detection
  7407. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  7408. rnoContent = /^(?:GET|HEAD)$/,
  7409. rprotocol = /^\/\//,
  7410. rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
  7411. /* Prefilters
  7412. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  7413. * 2) These are called:
  7414. * - BEFORE asking for a transport
  7415. * - AFTER param serialization (s.data is a string if s.processData is true)
  7416. * 3) key is the dataType
  7417. * 4) the catchall symbol "*" can be used
  7418. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  7419. */
  7420. prefilters = {},
  7421. /* Transports bindings
  7422. * 1) key is the dataType
  7423. * 2) the catchall symbol "*" can be used
  7424. * 3) selection will start with transport dataType and THEN go to "*" if needed
  7425. */
  7426. transports = {},
  7427. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  7428. allTypes = "*/".concat( "*" ),
  7429. // Document location
  7430. ajaxLocation = location.href,
  7431. // Segment location into parts
  7432. ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
  7433. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  7434. function addToPrefiltersOrTransports( structure ) {
  7435. // dataTypeExpression is optional and defaults to "*"
  7436. return function( dataTypeExpression, func ) {
  7437. if ( typeof dataTypeExpression !== "string" ) {
  7438. func = dataTypeExpression;
  7439. dataTypeExpression = "*";
  7440. }
  7441. var dataType,
  7442. i = 0,
  7443. dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
  7444. if ( jQuery.isFunction( func ) ) {
  7445. // For each dataType in the dataTypeExpression
  7446. while ( ( dataType = dataTypes[ i++ ] ) ) {
  7447. // Prepend if requested
  7448. if ( dataType.charAt( 0 ) === "+" ) {
  7449. dataType = dataType.slice( 1 ) || "*";
  7450. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7451. // Otherwise append
  7452. } else {
  7453. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7454. }
  7455. }
  7456. }
  7457. };
  7458. }
  7459. // Base inspection function for prefilters and transports
  7460. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7461. var inspected = {},
  7462. seekingTransport = ( structure === transports );
  7463. function inspect( dataType ) {
  7464. var selected;
  7465. inspected[ dataType ] = true;
  7466. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7467. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7468. if ( typeof dataTypeOrTransport === "string" &&
  7469. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7470. options.dataTypes.unshift( dataTypeOrTransport );
  7471. inspect( dataTypeOrTransport );
  7472. return false;
  7473. } else if ( seekingTransport ) {
  7474. return !( selected = dataTypeOrTransport );
  7475. }
  7476. } );
  7477. return selected;
  7478. }
  7479. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7480. }
  7481. // A special extend for ajax options
  7482. // that takes "flat" options (not to be deep extended)
  7483. // Fixes #9887
  7484. function ajaxExtend( target, src ) {
  7485. var deep, key,
  7486. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7487. for ( key in src ) {
  7488. if ( src[ key ] !== undefined ) {
  7489. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7490. }
  7491. }
  7492. if ( deep ) {
  7493. jQuery.extend( true, target, deep );
  7494. }
  7495. return target;
  7496. }
  7497. /* Handles responses to an ajax request:
  7498. * - finds the right dataType (mediates between content-type and expected dataType)
  7499. * - returns the corresponding response
  7500. */
  7501. function ajaxHandleResponses( s, jqXHR, responses ) {
  7502. var firstDataType, ct, finalDataType, type,
  7503. contents = s.contents,
  7504. dataTypes = s.dataTypes;
  7505. // Remove auto dataType and get content-type in the process
  7506. while ( dataTypes[ 0 ] === "*" ) {
  7507. dataTypes.shift();
  7508. if ( ct === undefined ) {
  7509. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7510. }
  7511. }
  7512. // Check if we're dealing with a known content-type
  7513. if ( ct ) {
  7514. for ( type in contents ) {
  7515. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7516. dataTypes.unshift( type );
  7517. break;
  7518. }
  7519. }
  7520. }
  7521. // Check to see if we have a response for the expected dataType
  7522. if ( dataTypes[ 0 ] in responses ) {
  7523. finalDataType = dataTypes[ 0 ];
  7524. } else {
  7525. // Try convertible dataTypes
  7526. for ( type in responses ) {
  7527. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7528. finalDataType = type;
  7529. break;
  7530. }
  7531. if ( !firstDataType ) {
  7532. firstDataType = type;
  7533. }
  7534. }
  7535. // Or just use first one
  7536. finalDataType = finalDataType || firstDataType;
  7537. }
  7538. // If we found a dataType
  7539. // We add the dataType to the list if needed
  7540. // and return the corresponding response
  7541. if ( finalDataType ) {
  7542. if ( finalDataType !== dataTypes[ 0 ] ) {
  7543. dataTypes.unshift( finalDataType );
  7544. }
  7545. return responses[ finalDataType ];
  7546. }
  7547. }
  7548. /* Chain conversions given the request and the original response
  7549. * Also sets the responseXXX fields on the jqXHR instance
  7550. */
  7551. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7552. var conv2, current, conv, tmp, prev,
  7553. converters = {},
  7554. // Work with a copy of dataTypes in case we need to modify it for conversion
  7555. dataTypes = s.dataTypes.slice();
  7556. // Create converters map with lowercased keys
  7557. if ( dataTypes[ 1 ] ) {
  7558. for ( conv in s.converters ) {
  7559. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7560. }
  7561. }
  7562. current = dataTypes.shift();
  7563. // Convert to each sequential dataType
  7564. while ( current ) {
  7565. if ( s.responseFields[ current ] ) {
  7566. jqXHR[ s.responseFields[ current ] ] = response;
  7567. }
  7568. // Apply the dataFilter if provided
  7569. if ( !prev && isSuccess && s.dataFilter ) {
  7570. response = s.dataFilter( response, s.dataType );
  7571. }
  7572. prev = current;
  7573. current = dataTypes.shift();
  7574. if ( current ) {
  7575. // There's only work to do if current dataType is non-auto
  7576. if ( current === "*" ) {
  7577. current = prev;
  7578. // Convert response if prev dataType is non-auto and differs from current
  7579. } else if ( prev !== "*" && prev !== current ) {
  7580. // Seek a direct converter
  7581. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7582. // If none found, seek a pair
  7583. if ( !conv ) {
  7584. for ( conv2 in converters ) {
  7585. // If conv2 outputs current
  7586. tmp = conv2.split( " " );
  7587. if ( tmp[ 1 ] === current ) {
  7588. // If prev can be converted to accepted input
  7589. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7590. converters[ "* " + tmp[ 0 ] ];
  7591. if ( conv ) {
  7592. // Condense equivalence converters
  7593. if ( conv === true ) {
  7594. conv = converters[ conv2 ];
  7595. // Otherwise, insert the intermediate dataType
  7596. } else if ( converters[ conv2 ] !== true ) {
  7597. current = tmp[ 0 ];
  7598. dataTypes.unshift( tmp[ 1 ] );
  7599. }
  7600. break;
  7601. }
  7602. }
  7603. }
  7604. }
  7605. // Apply converter (if not an equivalence)
  7606. if ( conv !== true ) {
  7607. // Unless errors are allowed to bubble, catch and return them
  7608. if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation
  7609. response = conv( response );
  7610. } else {
  7611. try {
  7612. response = conv( response );
  7613. } catch ( e ) {
  7614. return {
  7615. state: "parsererror",
  7616. error: conv ? e : "No conversion from " + prev + " to " + current
  7617. };
  7618. }
  7619. }
  7620. }
  7621. }
  7622. }
  7623. }
  7624. return { state: "success", data: response };
  7625. }
  7626. jQuery.extend( {
  7627. // Counter for holding the number of active queries
  7628. active: 0,
  7629. // Last-Modified header cache for next request
  7630. lastModified: {},
  7631. etag: {},
  7632. ajaxSettings: {
  7633. url: ajaxLocation,
  7634. type: "GET",
  7635. isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
  7636. global: true,
  7637. processData: true,
  7638. async: true,
  7639. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7640. /*
  7641. timeout: 0,
  7642. data: null,
  7643. dataType: null,
  7644. username: null,
  7645. password: null,
  7646. cache: null,
  7647. throws: false,
  7648. traditional: false,
  7649. headers: {},
  7650. */
  7651. accepts: {
  7652. "*": allTypes,
  7653. text: "text/plain",
  7654. html: "text/html",
  7655. xml: "application/xml, text/xml",
  7656. json: "application/json, text/javascript"
  7657. },
  7658. contents: {
  7659. xml: /\bxml\b/,
  7660. html: /\bhtml/,
  7661. json: /\bjson\b/
  7662. },
  7663. responseFields: {
  7664. xml: "responseXML",
  7665. text: "responseText",
  7666. json: "responseJSON"
  7667. },
  7668. // Data converters
  7669. // Keys separate source (or catchall "*") and destination types with a single space
  7670. converters: {
  7671. // Convert anything to text
  7672. "* text": String,
  7673. // Text to html (true = no transformation)
  7674. "text html": true,
  7675. // Evaluate text as a json expression
  7676. "text json": jQuery.parseJSON,
  7677. // Parse text as xml
  7678. "text xml": jQuery.parseXML
  7679. },
  7680. // For options that shouldn't be deep extended:
  7681. // you can add your own custom options here if
  7682. // and when you create one that shouldn't be
  7683. // deep extended (see ajaxExtend)
  7684. flatOptions: {
  7685. url: true,
  7686. context: true
  7687. }
  7688. },
  7689. // Creates a full fledged settings object into target
  7690. // with both ajaxSettings and settings fields.
  7691. // If target is omitted, writes into ajaxSettings.
  7692. ajaxSetup: function( target, settings ) {
  7693. return settings ?
  7694. // Building a settings object
  7695. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7696. // Extending ajaxSettings
  7697. ajaxExtend( jQuery.ajaxSettings, target );
  7698. },
  7699. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7700. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7701. // Main method
  7702. ajax: function( url, options ) {
  7703. // If url is an object, simulate pre-1.5 signature
  7704. if ( typeof url === "object" ) {
  7705. options = url;
  7706. url = undefined;
  7707. }
  7708. // Force options to be an object
  7709. options = options || {};
  7710. var
  7711. // Cross-domain detection vars
  7712. parts,
  7713. // Loop variable
  7714. i,
  7715. // URL without anti-cache param
  7716. cacheURL,
  7717. // Response headers as string
  7718. responseHeadersString,
  7719. // timeout handle
  7720. timeoutTimer,
  7721. // To know if global events are to be dispatched
  7722. fireGlobals,
  7723. transport,
  7724. // Response headers
  7725. responseHeaders,
  7726. // Create the final options object
  7727. s = jQuery.ajaxSetup( {}, options ),
  7728. // Callbacks context
  7729. callbackContext = s.context || s,
  7730. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7731. globalEventContext = s.context &&
  7732. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7733. jQuery( callbackContext ) :
  7734. jQuery.event,
  7735. // Deferreds
  7736. deferred = jQuery.Deferred(),
  7737. completeDeferred = jQuery.Callbacks( "once memory" ),
  7738. // Status-dependent callbacks
  7739. statusCode = s.statusCode || {},
  7740. // Headers (they are sent all at once)
  7741. requestHeaders = {},
  7742. requestHeadersNames = {},
  7743. // The jqXHR state
  7744. state = 0,
  7745. // Default abort message
  7746. strAbort = "canceled",
  7747. // Fake xhr
  7748. jqXHR = {
  7749. readyState: 0,
  7750. // Builds headers hashtable if needed
  7751. getResponseHeader: function( key ) {
  7752. var match;
  7753. if ( state === 2 ) {
  7754. if ( !responseHeaders ) {
  7755. responseHeaders = {};
  7756. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  7757. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  7758. }
  7759. }
  7760. match = responseHeaders[ key.toLowerCase() ];
  7761. }
  7762. return match == null ? null : match;
  7763. },
  7764. // Raw string
  7765. getAllResponseHeaders: function() {
  7766. return state === 2 ? responseHeadersString : null;
  7767. },
  7768. // Caches the header
  7769. setRequestHeader: function( name, value ) {
  7770. var lname = name.toLowerCase();
  7771. if ( !state ) {
  7772. name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
  7773. requestHeaders[ name ] = value;
  7774. }
  7775. return this;
  7776. },
  7777. // Overrides response content-type header
  7778. overrideMimeType: function( type ) {
  7779. if ( !state ) {
  7780. s.mimeType = type;
  7781. }
  7782. return this;
  7783. },
  7784. // Status-dependent callbacks
  7785. statusCode: function( map ) {
  7786. var code;
  7787. if ( map ) {
  7788. if ( state < 2 ) {
  7789. for ( code in map ) {
  7790. // Lazy-add the new callback in a way that preserves old ones
  7791. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7792. }
  7793. } else {
  7794. // Execute the appropriate callbacks
  7795. jqXHR.always( map[ jqXHR.status ] );
  7796. }
  7797. }
  7798. return this;
  7799. },
  7800. // Cancel the request
  7801. abort: function( statusText ) {
  7802. var finalText = statusText || strAbort;
  7803. if ( transport ) {
  7804. transport.abort( finalText );
  7805. }
  7806. done( 0, finalText );
  7807. return this;
  7808. }
  7809. };
  7810. // Attach deferreds
  7811. deferred.promise( jqXHR ).complete = completeDeferred.add;
  7812. jqXHR.success = jqXHR.done;
  7813. jqXHR.error = jqXHR.fail;
  7814. // Remove hash character (#7531: and string promotion)
  7815. // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
  7816. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7817. // We also use the url parameter if available
  7818. s.url = ( ( url || s.url || ajaxLocation ) + "" )
  7819. .replace( rhash, "" )
  7820. .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
  7821. // Alias method option to type as per ticket #12004
  7822. s.type = options.method || options.type || s.method || s.type;
  7823. // Extract dataTypes list
  7824. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
  7825. // A cross-domain request is in order when we have a protocol:host:port mismatch
  7826. if ( s.crossDomain == null ) {
  7827. parts = rurl.exec( s.url.toLowerCase() );
  7828. s.crossDomain = !!( parts &&
  7829. ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
  7830. ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
  7831. ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
  7832. );
  7833. }
  7834. // Convert data if not already a string
  7835. if ( s.data && s.processData && typeof s.data !== "string" ) {
  7836. s.data = jQuery.param( s.data, s.traditional );
  7837. }
  7838. // Apply prefilters
  7839. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  7840. // If request was aborted inside a prefilter, stop there
  7841. if ( state === 2 ) {
  7842. return jqXHR;
  7843. }
  7844. // We can fire global events as of now if asked to
  7845. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  7846. fireGlobals = jQuery.event && s.global;
  7847. // Watch for a new set of requests
  7848. if ( fireGlobals && jQuery.active++ === 0 ) {
  7849. jQuery.event.trigger( "ajaxStart" );
  7850. }
  7851. // Uppercase the type
  7852. s.type = s.type.toUpperCase();
  7853. // Determine if request has content
  7854. s.hasContent = !rnoContent.test( s.type );
  7855. // Save the URL in case we're toying with the If-Modified-Since
  7856. // and/or If-None-Match header later on
  7857. cacheURL = s.url;
  7858. // More options handling for requests with no content
  7859. if ( !s.hasContent ) {
  7860. // If data is available, append data to url
  7861. if ( s.data ) {
  7862. cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
  7863. // #9682: remove data so that it's not used in an eventual retry
  7864. delete s.data;
  7865. }
  7866. // Add anti-cache in url if needed
  7867. if ( s.cache === false ) {
  7868. s.url = rts.test( cacheURL ) ?
  7869. // If there is already a '_' parameter, set its value
  7870. cacheURL.replace( rts, "$1_=" + nonce++ ) :
  7871. // Otherwise add one to the end
  7872. cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
  7873. }
  7874. }
  7875. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7876. if ( s.ifModified ) {
  7877. if ( jQuery.lastModified[ cacheURL ] ) {
  7878. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  7879. }
  7880. if ( jQuery.etag[ cacheURL ] ) {
  7881. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  7882. }
  7883. }
  7884. // Set the correct header, if data is being sent
  7885. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  7886. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  7887. }
  7888. // Set the Accepts header for the server, depending on the dataType
  7889. jqXHR.setRequestHeader(
  7890. "Accept",
  7891. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  7892. s.accepts[ s.dataTypes[ 0 ] ] +
  7893. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  7894. s.accepts[ "*" ]
  7895. );
  7896. // Check for headers option
  7897. for ( i in s.headers ) {
  7898. jqXHR.setRequestHeader( i, s.headers[ i ] );
  7899. }
  7900. // Allow custom headers/mimetypes and early abort
  7901. if ( s.beforeSend &&
  7902. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
  7903. // Abort if not done already and return
  7904. return jqXHR.abort();
  7905. }
  7906. // aborting is no longer a cancellation
  7907. strAbort = "abort";
  7908. // Install callbacks on deferreds
  7909. for ( i in { success: 1, error: 1, complete: 1 } ) {
  7910. jqXHR[ i ]( s[ i ] );
  7911. }
  7912. // Get transport
  7913. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  7914. // If no transport, we auto-abort
  7915. if ( !transport ) {
  7916. done( -1, "No Transport" );
  7917. } else {
  7918. jqXHR.readyState = 1;
  7919. // Send global event
  7920. if ( fireGlobals ) {
  7921. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  7922. }
  7923. // If request was aborted inside ajaxSend, stop there
  7924. if ( state === 2 ) {
  7925. return jqXHR;
  7926. }
  7927. // Timeout
  7928. if ( s.async && s.timeout > 0 ) {
  7929. timeoutTimer = window.setTimeout( function() {
  7930. jqXHR.abort( "timeout" );
  7931. }, s.timeout );
  7932. }
  7933. try {
  7934. state = 1;
  7935. transport.send( requestHeaders, done );
  7936. } catch ( e ) {
  7937. // Propagate exception as error if not done
  7938. if ( state < 2 ) {
  7939. done( -1, e );
  7940. // Simply rethrow otherwise
  7941. } else {
  7942. throw e;
  7943. }
  7944. }
  7945. }
  7946. // Callback for when everything is done
  7947. function done( status, nativeStatusText, responses, headers ) {
  7948. var isSuccess, success, error, response, modified,
  7949. statusText = nativeStatusText;
  7950. // Called once
  7951. if ( state === 2 ) {
  7952. return;
  7953. }
  7954. // State is "done" now
  7955. state = 2;
  7956. // Clear timeout if it exists
  7957. if ( timeoutTimer ) {
  7958. window.clearTimeout( timeoutTimer );
  7959. }
  7960. // Dereference transport for early garbage collection
  7961. // (no matter how long the jqXHR object will be used)
  7962. transport = undefined;
  7963. // Cache response headers
  7964. responseHeadersString = headers || "";
  7965. // Set readyState
  7966. jqXHR.readyState = status > 0 ? 4 : 0;
  7967. // Determine if successful
  7968. isSuccess = status >= 200 && status < 300 || status === 304;
  7969. // Get response data
  7970. if ( responses ) {
  7971. response = ajaxHandleResponses( s, jqXHR, responses );
  7972. }
  7973. // Convert no matter what (that way responseXXX fields are always set)
  7974. response = ajaxConvert( s, response, jqXHR, isSuccess );
  7975. // If successful, handle type chaining
  7976. if ( isSuccess ) {
  7977. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7978. if ( s.ifModified ) {
  7979. modified = jqXHR.getResponseHeader( "Last-Modified" );
  7980. if ( modified ) {
  7981. jQuery.lastModified[ cacheURL ] = modified;
  7982. }
  7983. modified = jqXHR.getResponseHeader( "etag" );
  7984. if ( modified ) {
  7985. jQuery.etag[ cacheURL ] = modified;
  7986. }
  7987. }
  7988. // if no content
  7989. if ( status === 204 || s.type === "HEAD" ) {
  7990. statusText = "nocontent";
  7991. // if not modified
  7992. } else if ( status === 304 ) {
  7993. statusText = "notmodified";
  7994. // If we have data, let's convert it
  7995. } else {
  7996. statusText = response.state;
  7997. success = response.data;
  7998. error = response.error;
  7999. isSuccess = !error;
  8000. }
  8001. } else {
  8002. // We extract error from statusText
  8003. // then normalize statusText and status for non-aborts
  8004. error = statusText;
  8005. if ( status || !statusText ) {
  8006. statusText = "error";
  8007. if ( status < 0 ) {
  8008. status = 0;
  8009. }
  8010. }
  8011. }
  8012. // Set data for the fake xhr object
  8013. jqXHR.status = status;
  8014. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  8015. // Success/Error
  8016. if ( isSuccess ) {
  8017. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  8018. } else {
  8019. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  8020. }
  8021. // Status-dependent callbacks
  8022. jqXHR.statusCode( statusCode );
  8023. statusCode = undefined;
  8024. if ( fireGlobals ) {
  8025. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  8026. [ jqXHR, s, isSuccess ? success : error ] );
  8027. }
  8028. // Complete
  8029. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  8030. if ( fireGlobals ) {
  8031. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  8032. // Handle the global AJAX counter
  8033. if ( !( --jQuery.active ) ) {
  8034. jQuery.event.trigger( "ajaxStop" );
  8035. }
  8036. }
  8037. }
  8038. return jqXHR;
  8039. },
  8040. getJSON: function( url, data, callback ) {
  8041. return jQuery.get( url, data, callback, "json" );
  8042. },
  8043. getScript: function( url, callback ) {
  8044. return jQuery.get( url, undefined, callback, "script" );
  8045. }
  8046. } );
  8047. jQuery.each( [ "get", "post" ], function( i, method ) {
  8048. jQuery[ method ] = function( url, data, callback, type ) {
  8049. // shift arguments if data argument was omitted
  8050. if ( jQuery.isFunction( data ) ) {
  8051. type = type || callback;
  8052. callback = data;
  8053. data = undefined;
  8054. }
  8055. // The url can be an options object (which then must have .url)
  8056. return jQuery.ajax( jQuery.extend( {
  8057. url: url,
  8058. type: method,
  8059. dataType: type,
  8060. data: data,
  8061. success: callback
  8062. }, jQuery.isPlainObject( url ) && url ) );
  8063. };
  8064. } );
  8065. jQuery._evalUrl = function( url ) {
  8066. return jQuery.ajax( {
  8067. url: url,
  8068. // Make this explicit, since user can override this through ajaxSetup (#11264)
  8069. type: "GET",
  8070. dataType: "script",
  8071. cache: true,
  8072. async: false,
  8073. global: false,
  8074. "throws": true
  8075. } );
  8076. };
  8077. jQuery.fn.extend( {
  8078. wrapAll: function( html ) {
  8079. if ( jQuery.isFunction( html ) ) {
  8080. return this.each( function( i ) {
  8081. jQuery( this ).wrapAll( html.call( this, i ) );
  8082. } );
  8083. }
  8084. if ( this[ 0 ] ) {
  8085. // The elements to wrap the target around
  8086. var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8087. if ( this[ 0 ].parentNode ) {
  8088. wrap.insertBefore( this[ 0 ] );
  8089. }
  8090. wrap.map( function() {
  8091. var elem = this;
  8092. while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
  8093. elem = elem.firstChild;
  8094. }
  8095. return elem;
  8096. } ).append( this );
  8097. }
  8098. return this;
  8099. },
  8100. wrapInner: function( html ) {
  8101. if ( jQuery.isFunction( html ) ) {
  8102. return this.each( function( i ) {
  8103. jQuery( this ).wrapInner( html.call( this, i ) );
  8104. } );
  8105. }
  8106. return this.each( function() {
  8107. var self = jQuery( this ),
  8108. contents = self.contents();
  8109. if ( contents.length ) {
  8110. contents.wrapAll( html );
  8111. } else {
  8112. self.append( html );
  8113. }
  8114. } );
  8115. },
  8116. wrap: function( html ) {
  8117. var isFunction = jQuery.isFunction( html );
  8118. return this.each( function( i ) {
  8119. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  8120. } );
  8121. },
  8122. unwrap: function() {
  8123. return this.parent().each( function() {
  8124. if ( !jQuery.nodeName( this, "body" ) ) {
  8125. jQuery( this ).replaceWith( this.childNodes );
  8126. }
  8127. } ).end();
  8128. }
  8129. } );
  8130. function getDisplay( elem ) {
  8131. return elem.style && elem.style.display || jQuery.css( elem, "display" );
  8132. }
  8133. function filterHidden( elem ) {
  8134. // Disconnected elements are considered hidden
  8135. if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) {
  8136. return true;
  8137. }
  8138. while ( elem && elem.nodeType === 1 ) {
  8139. if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
  8140. return true;
  8141. }
  8142. elem = elem.parentNode;
  8143. }
  8144. return false;
  8145. }
  8146. jQuery.expr.filters.hidden = function( elem ) {
  8147. // Support: Opera <= 12.12
  8148. // Opera reports offsetWidths and offsetHeights less than zero on some elements
  8149. return support.reliableHiddenOffsets() ?
  8150. ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
  8151. !elem.getClientRects().length ) :
  8152. filterHidden( elem );
  8153. };
  8154. jQuery.expr.filters.visible = function( elem ) {
  8155. return !jQuery.expr.filters.hidden( elem );
  8156. };
  8157. var r20 = /%20/g,
  8158. rbracket = /\[\]$/,
  8159. rCRLF = /\r?\n/g,
  8160. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  8161. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  8162. function buildParams( prefix, obj, traditional, add ) {
  8163. var name;
  8164. if ( jQuery.isArray( obj ) ) {
  8165. // Serialize array item.
  8166. jQuery.each( obj, function( i, v ) {
  8167. if ( traditional || rbracket.test( prefix ) ) {
  8168. // Treat each array item as a scalar.
  8169. add( prefix, v );
  8170. } else {
  8171. // Item is non-scalar (array or object), encode its numeric index.
  8172. buildParams(
  8173. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  8174. v,
  8175. traditional,
  8176. add
  8177. );
  8178. }
  8179. } );
  8180. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  8181. // Serialize object item.
  8182. for ( name in obj ) {
  8183. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  8184. }
  8185. } else {
  8186. // Serialize scalar item.
  8187. add( prefix, obj );
  8188. }
  8189. }
  8190. // Serialize an array of form elements or a set of
  8191. // key/values into a query string
  8192. jQuery.param = function( a, traditional ) {
  8193. var prefix,
  8194. s = [],
  8195. add = function( key, value ) {
  8196. // If value is a function, invoke it and return its value
  8197. value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
  8198. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  8199. };
  8200. // Set traditional to true for jQuery <= 1.3.2 behavior.
  8201. if ( traditional === undefined ) {
  8202. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
  8203. }
  8204. // If an array was passed in, assume that it is an array of form elements.
  8205. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  8206. // Serialize the form elements
  8207. jQuery.each( a, function() {
  8208. add( this.name, this.value );
  8209. } );
  8210. } else {
  8211. // If traditional, encode the "old" way (the way 1.3.2 or older
  8212. // did it), otherwise encode params recursively.
  8213. for ( prefix in a ) {
  8214. buildParams( prefix, a[ prefix ], traditional, add );
  8215. }
  8216. }
  8217. // Return the resulting serialization
  8218. return s.join( "&" ).replace( r20, "+" );
  8219. };
  8220. jQuery.fn.extend( {
  8221. serialize: function() {
  8222. return jQuery.param( this.serializeArray() );
  8223. },
  8224. serializeArray: function() {
  8225. return this.map( function() {
  8226. // Can add propHook for "elements" to filter or add form elements
  8227. var elements = jQuery.prop( this, "elements" );
  8228. return elements ? jQuery.makeArray( elements ) : this;
  8229. } )
  8230. .filter( function() {
  8231. var type = this.type;
  8232. // Use .is(":disabled") so that fieldset[disabled] works
  8233. return this.name && !jQuery( this ).is( ":disabled" ) &&
  8234. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  8235. ( this.checked || !rcheckableType.test( type ) );
  8236. } )
  8237. .map( function( i, elem ) {
  8238. var val = jQuery( this ).val();
  8239. return val == null ?
  8240. null :
  8241. jQuery.isArray( val ) ?
  8242. jQuery.map( val, function( val ) {
  8243. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8244. } ) :
  8245. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8246. } ).get();
  8247. }
  8248. } );
  8249. // Create the request object
  8250. // (This is still attached to ajaxSettings for backward compatibility)
  8251. jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
  8252. // Support: IE6-IE8
  8253. function() {
  8254. // XHR cannot access local files, always use ActiveX for that case
  8255. if ( this.isLocal ) {
  8256. return createActiveXHR();
  8257. }
  8258. // Support: IE 9-11
  8259. // IE seems to error on cross-domain PATCH requests when ActiveX XHR
  8260. // is used. In IE 9+ always use the native XHR.
  8261. // Note: this condition won't catch Edge as it doesn't define
  8262. // document.documentMode but it also doesn't support ActiveX so it won't
  8263. // reach this code.
  8264. if ( document.documentMode > 8 ) {
  8265. return createStandardXHR();
  8266. }
  8267. // Support: IE<9
  8268. // oldIE XHR does not support non-RFC2616 methods (#13240)
  8269. // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
  8270. // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
  8271. // Although this check for six methods instead of eight
  8272. // since IE also does not support "trace" and "connect"
  8273. return /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
  8274. createStandardXHR() || createActiveXHR();
  8275. } :
  8276. // For all other browsers, use the standard XMLHttpRequest object
  8277. createStandardXHR;
  8278. var xhrId = 0,
  8279. xhrCallbacks = {},
  8280. xhrSupported = jQuery.ajaxSettings.xhr();
  8281. // Support: IE<10
  8282. // Open requests must be manually aborted on unload (#5280)
  8283. // See https://support.microsoft.com/kb/2856746 for more info
  8284. if ( window.attachEvent ) {
  8285. window.attachEvent( "onunload", function() {
  8286. for ( var key in xhrCallbacks ) {
  8287. xhrCallbacks[ key ]( undefined, true );
  8288. }
  8289. } );
  8290. }
  8291. // Determine support properties
  8292. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  8293. xhrSupported = support.ajax = !!xhrSupported;
  8294. // Create transport if the browser can provide an xhr
  8295. if ( xhrSupported ) {
  8296. jQuery.ajaxTransport( function( options ) {
  8297. // Cross domain only allowed if supported through XMLHttpRequest
  8298. if ( !options.crossDomain || support.cors ) {
  8299. var callback;
  8300. return {
  8301. send: function( headers, complete ) {
  8302. var i,
  8303. xhr = options.xhr(),
  8304. id = ++xhrId;
  8305. // Open the socket
  8306. xhr.open(
  8307. options.type,
  8308. options.url,
  8309. options.async,
  8310. options.username,
  8311. options.password
  8312. );
  8313. // Apply custom fields if provided
  8314. if ( options.xhrFields ) {
  8315. for ( i in options.xhrFields ) {
  8316. xhr[ i ] = options.xhrFields[ i ];
  8317. }
  8318. }
  8319. // Override mime type if needed
  8320. if ( options.mimeType && xhr.overrideMimeType ) {
  8321. xhr.overrideMimeType( options.mimeType );
  8322. }
  8323. // X-Requested-With header
  8324. // For cross-domain requests, seeing as conditions for a preflight are
  8325. // akin to a jigsaw puzzle, we simply never set it to be sure.
  8326. // (it can always be set on a per-request basis or even using ajaxSetup)
  8327. // For same-domain requests, won't change header if already provided.
  8328. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  8329. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  8330. }
  8331. // Set headers
  8332. for ( i in headers ) {
  8333. // Support: IE<9
  8334. // IE's ActiveXObject throws a 'Type Mismatch' exception when setting
  8335. // request header to a null-value.
  8336. //
  8337. // To keep consistent with other XHR implementations, cast the value
  8338. // to string and ignore `undefined`.
  8339. if ( headers[ i ] !== undefined ) {
  8340. xhr.setRequestHeader( i, headers[ i ] + "" );
  8341. }
  8342. }
  8343. // Do send the request
  8344. // This may raise an exception which is actually
  8345. // handled in jQuery.ajax (so no try/catch here)
  8346. xhr.send( ( options.hasContent && options.data ) || null );
  8347. // Listener
  8348. callback = function( _, isAbort ) {
  8349. var status, statusText, responses;
  8350. // Was never called and is aborted or complete
  8351. if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
  8352. // Clean up
  8353. delete xhrCallbacks[ id ];
  8354. callback = undefined;
  8355. xhr.onreadystatechange = jQuery.noop;
  8356. // Abort manually if needed
  8357. if ( isAbort ) {
  8358. if ( xhr.readyState !== 4 ) {
  8359. xhr.abort();
  8360. }
  8361. } else {
  8362. responses = {};
  8363. status = xhr.status;
  8364. // Support: IE<10
  8365. // Accessing binary-data responseText throws an exception
  8366. // (#11426)
  8367. if ( typeof xhr.responseText === "string" ) {
  8368. responses.text = xhr.responseText;
  8369. }
  8370. // Firefox throws an exception when accessing
  8371. // statusText for faulty cross-domain requests
  8372. try {
  8373. statusText = xhr.statusText;
  8374. } catch ( e ) {
  8375. // We normalize with Webkit giving an empty statusText
  8376. statusText = "";
  8377. }
  8378. // Filter status for non standard behaviors
  8379. // If the request is local and we have data: assume a success
  8380. // (success with no data won't get notified, that's the best we
  8381. // can do given current implementations)
  8382. if ( !status && options.isLocal && !options.crossDomain ) {
  8383. status = responses.text ? 200 : 404;
  8384. // IE - #1450: sometimes returns 1223 when it should be 204
  8385. } else if ( status === 1223 ) {
  8386. status = 204;
  8387. }
  8388. }
  8389. }
  8390. // Call complete if needed
  8391. if ( responses ) {
  8392. complete( status, statusText, responses, xhr.getAllResponseHeaders() );
  8393. }
  8394. };
  8395. // Do send the request
  8396. // `xhr.send` may raise an exception, but it will be
  8397. // handled in jQuery.ajax (so no try/catch here)
  8398. if ( !options.async ) {
  8399. // If we're in sync mode we fire the callback
  8400. callback();
  8401. } else if ( xhr.readyState === 4 ) {
  8402. // (IE6 & IE7) if it's in cache and has been
  8403. // retrieved directly we need to fire the callback
  8404. window.setTimeout( callback );
  8405. } else {
  8406. // Register the callback, but delay it in case `xhr.send` throws
  8407. // Add to the list of active xhr callbacks
  8408. xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
  8409. }
  8410. },
  8411. abort: function() {
  8412. if ( callback ) {
  8413. callback( undefined, true );
  8414. }
  8415. }
  8416. };
  8417. }
  8418. } );
  8419. }
  8420. // Functions to create xhrs
  8421. function createStandardXHR() {
  8422. try {
  8423. return new window.XMLHttpRequest();
  8424. } catch ( e ) {}
  8425. }
  8426. function createActiveXHR() {
  8427. try {
  8428. return new window.ActiveXObject( "Microsoft.XMLHTTP" );
  8429. } catch ( e ) {}
  8430. }
  8431. // Install script dataType
  8432. jQuery.ajaxSetup( {
  8433. accepts: {
  8434. script: "text/javascript, application/javascript, " +
  8435. "application/ecmascript, application/x-ecmascript"
  8436. },
  8437. contents: {
  8438. script: /\b(?:java|ecma)script\b/
  8439. },
  8440. converters: {
  8441. "text script": function( text ) {
  8442. jQuery.globalEval( text );
  8443. return text;
  8444. }
  8445. }
  8446. } );
  8447. // Handle cache's special case and global
  8448. jQuery.ajaxPrefilter( "script", function( s ) {
  8449. if ( s.cache === undefined ) {
  8450. s.cache = false;
  8451. }
  8452. if ( s.crossDomain ) {
  8453. s.type = "GET";
  8454. s.global = false;
  8455. }
  8456. } );
  8457. // Bind script tag hack transport
  8458. jQuery.ajaxTransport( "script", function( s ) {
  8459. // This transport only deals with cross domain requests
  8460. if ( s.crossDomain ) {
  8461. var script,
  8462. head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
  8463. return {
  8464. send: function( _, callback ) {
  8465. script = document.createElement( "script" );
  8466. script.async = true;
  8467. if ( s.scriptCharset ) {
  8468. script.charset = s.scriptCharset;
  8469. }
  8470. script.src = s.url;
  8471. // Attach handlers for all browsers
  8472. script.onload = script.onreadystatechange = function( _, isAbort ) {
  8473. if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
  8474. // Handle memory leak in IE
  8475. script.onload = script.onreadystatechange = null;
  8476. // Remove the script
  8477. if ( script.parentNode ) {
  8478. script.parentNode.removeChild( script );
  8479. }
  8480. // Dereference the script
  8481. script = null;
  8482. // Callback if not abort
  8483. if ( !isAbort ) {
  8484. callback( 200, "success" );
  8485. }
  8486. }
  8487. };
  8488. // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
  8489. // Use native DOM manipulation to avoid our domManip AJAX trickery
  8490. head.insertBefore( script, head.firstChild );
  8491. },
  8492. abort: function() {
  8493. if ( script ) {
  8494. script.onload( undefined, true );
  8495. }
  8496. }
  8497. };
  8498. }
  8499. } );
  8500. var oldCallbacks = [],
  8501. rjsonp = /(=)\?(?=&|$)|\?\?/;
  8502. // Default jsonp settings
  8503. jQuery.ajaxSetup( {
  8504. jsonp: "callback",
  8505. jsonpCallback: function() {
  8506. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  8507. this[ callback ] = true;
  8508. return callback;
  8509. }
  8510. } );
  8511. // Detect, normalize options and install callbacks for jsonp requests
  8512. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  8513. var callbackName, overwritten, responseContainer,
  8514. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  8515. "url" :
  8516. typeof s.data === "string" &&
  8517. ( s.contentType || "" )
  8518. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  8519. rjsonp.test( s.data ) && "data"
  8520. );
  8521. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  8522. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  8523. // Get callback name, remembering preexisting value associated with it
  8524. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  8525. s.jsonpCallback() :
  8526. s.jsonpCallback;
  8527. // Insert callback into url or form data
  8528. if ( jsonProp ) {
  8529. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  8530. } else if ( s.jsonp !== false ) {
  8531. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  8532. }
  8533. // Use data converter to retrieve json after script execution
  8534. s.converters[ "script json" ] = function() {
  8535. if ( !responseContainer ) {
  8536. jQuery.error( callbackName + " was not called" );
  8537. }
  8538. return responseContainer[ 0 ];
  8539. };
  8540. // force json dataType
  8541. s.dataTypes[ 0 ] = "json";
  8542. // Install callback
  8543. overwritten = window[ callbackName ];
  8544. window[ callbackName ] = function() {
  8545. responseContainer = arguments;
  8546. };
  8547. // Clean-up function (fires after converters)
  8548. jqXHR.always( function() {
  8549. // If previous value didn't exist - remove it
  8550. if ( overwritten === undefined ) {
  8551. jQuery( window ).removeProp( callbackName );
  8552. // Otherwise restore preexisting value
  8553. } else {
  8554. window[ callbackName ] = overwritten;
  8555. }
  8556. // Save back as free
  8557. if ( s[ callbackName ] ) {
  8558. // make sure that re-using the options doesn't screw things around
  8559. s.jsonpCallback = originalSettings.jsonpCallback;
  8560. // save the callback name for future use
  8561. oldCallbacks.push( callbackName );
  8562. }
  8563. // Call if it was a function and we have a response
  8564. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  8565. overwritten( responseContainer[ 0 ] );
  8566. }
  8567. responseContainer = overwritten = undefined;
  8568. } );
  8569. // Delegate to script
  8570. return "script";
  8571. }
  8572. } );
  8573. // data: string of html
  8574. // context (optional): If specified, the fragment will be created in this context,
  8575. // defaults to document
  8576. // keepScripts (optional): If true, will include scripts passed in the html string
  8577. jQuery.parseHTML = function( data, context, keepScripts ) {
  8578. if ( !data || typeof data !== "string" ) {
  8579. return null;
  8580. }
  8581. if ( typeof context === "boolean" ) {
  8582. keepScripts = context;
  8583. context = false;
  8584. }
  8585. context = context || document;
  8586. var parsed = rsingleTag.exec( data ),
  8587. scripts = !keepScripts && [];
  8588. // Single tag
  8589. if ( parsed ) {
  8590. return [ context.createElement( parsed[ 1 ] ) ];
  8591. }
  8592. parsed = buildFragment( [ data ], context, scripts );
  8593. if ( scripts && scripts.length ) {
  8594. jQuery( scripts ).remove();
  8595. }
  8596. return jQuery.merge( [], parsed.childNodes );
  8597. };
  8598. // Keep a copy of the old load method
  8599. var _load = jQuery.fn.load;
  8600. /**
  8601. * Load a url into a page
  8602. */
  8603. jQuery.fn.load = function( url, params, callback ) {
  8604. if ( typeof url !== "string" && _load ) {
  8605. return _load.apply( this, arguments );
  8606. }
  8607. var selector, type, response,
  8608. self = this,
  8609. off = url.indexOf( " " );
  8610. if ( off > -1 ) {
  8611. selector = jQuery.trim( url.slice( off, url.length ) );
  8612. url = url.slice( 0, off );
  8613. }
  8614. // If it's a function
  8615. if ( jQuery.isFunction( params ) ) {
  8616. // We assume that it's the callback
  8617. callback = params;
  8618. params = undefined;
  8619. // Otherwise, build a param string
  8620. } else if ( params && typeof params === "object" ) {
  8621. type = "POST";
  8622. }
  8623. // If we have elements to modify, make the request
  8624. if ( self.length > 0 ) {
  8625. jQuery.ajax( {
  8626. url: url,
  8627. // If "type" variable is undefined, then "GET" method will be used.
  8628. // Make value of this field explicit since
  8629. // user can override it through ajaxSetup method
  8630. type: type || "GET",
  8631. dataType: "html",
  8632. data: params
  8633. } ).done( function( responseText ) {
  8634. // Save response for use in complete callback
  8635. response = arguments;
  8636. self.html( selector ?
  8637. // If a selector was specified, locate the right elements in a dummy div
  8638. // Exclude scripts to avoid IE 'Permission Denied' errors
  8639. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8640. // Otherwise use the full result
  8641. responseText );
  8642. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8643. // but they are ignored because response was set above.
  8644. // If it fails, this function gets "jqXHR", "status", "error"
  8645. } ).always( callback && function( jqXHR, status ) {
  8646. self.each( function() {
  8647. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8648. } );
  8649. } );
  8650. }
  8651. return this;
  8652. };
  8653. // Attach a bunch of functions for handling common AJAX events
  8654. jQuery.each( [
  8655. "ajaxStart",
  8656. "ajaxStop",
  8657. "ajaxComplete",
  8658. "ajaxError",
  8659. "ajaxSuccess",
  8660. "ajaxSend"
  8661. ], function( i, type ) {
  8662. jQuery.fn[ type ] = function( fn ) {
  8663. return this.on( type, fn );
  8664. };
  8665. } );
  8666. jQuery.expr.filters.animated = function( elem ) {
  8667. return jQuery.grep( jQuery.timers, function( fn ) {
  8668. return elem === fn.elem;
  8669. } ).length;
  8670. };
  8671. /**
  8672. * Gets a window from an element
  8673. */
  8674. function getWindow( elem ) {
  8675. return jQuery.isWindow( elem ) ?
  8676. elem :
  8677. elem.nodeType === 9 ?
  8678. elem.defaultView || elem.parentWindow :
  8679. false;
  8680. }
  8681. jQuery.offset = {
  8682. setOffset: function( elem, options, i ) {
  8683. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8684. position = jQuery.css( elem, "position" ),
  8685. curElem = jQuery( elem ),
  8686. props = {};
  8687. // set position first, in-case top/left are set even on static elem
  8688. if ( position === "static" ) {
  8689. elem.style.position = "relative";
  8690. }
  8691. curOffset = curElem.offset();
  8692. curCSSTop = jQuery.css( elem, "top" );
  8693. curCSSLeft = jQuery.css( elem, "left" );
  8694. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8695. jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1;
  8696. // need to be able to calculate position if either top or left
  8697. // is auto and position is either absolute or fixed
  8698. if ( calculatePosition ) {
  8699. curPosition = curElem.position();
  8700. curTop = curPosition.top;
  8701. curLeft = curPosition.left;
  8702. } else {
  8703. curTop = parseFloat( curCSSTop ) || 0;
  8704. curLeft = parseFloat( curCSSLeft ) || 0;
  8705. }
  8706. if ( jQuery.isFunction( options ) ) {
  8707. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8708. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8709. }
  8710. if ( options.top != null ) {
  8711. props.top = ( options.top - curOffset.top ) + curTop;
  8712. }
  8713. if ( options.left != null ) {
  8714. props.left = ( options.left - curOffset.left ) + curLeft;
  8715. }
  8716. if ( "using" in options ) {
  8717. options.using.call( elem, props );
  8718. } else {
  8719. curElem.css( props );
  8720. }
  8721. }
  8722. };
  8723. jQuery.fn.extend( {
  8724. offset: function( options ) {
  8725. if ( arguments.length ) {
  8726. return options === undefined ?
  8727. this :
  8728. this.each( function( i ) {
  8729. jQuery.offset.setOffset( this, options, i );
  8730. } );
  8731. }
  8732. var docElem, win,
  8733. box = { top: 0, left: 0 },
  8734. elem = this[ 0 ],
  8735. doc = elem && elem.ownerDocument;
  8736. if ( !doc ) {
  8737. return;
  8738. }
  8739. docElem = doc.documentElement;
  8740. // Make sure it's not a disconnected DOM node
  8741. if ( !jQuery.contains( docElem, elem ) ) {
  8742. return box;
  8743. }
  8744. // If we don't have gBCR, just use 0,0 rather than error
  8745. // BlackBerry 5, iOS 3 (original iPhone)
  8746. if ( typeof elem.getBoundingClientRect !== "undefined" ) {
  8747. box = elem.getBoundingClientRect();
  8748. }
  8749. win = getWindow( doc );
  8750. return {
  8751. top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
  8752. left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
  8753. };
  8754. },
  8755. position: function() {
  8756. if ( !this[ 0 ] ) {
  8757. return;
  8758. }
  8759. var offsetParent, offset,
  8760. parentOffset = { top: 0, left: 0 },
  8761. elem = this[ 0 ];
  8762. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  8763. // because it is its only offset parent
  8764. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8765. // we assume that getBoundingClientRect is available when computed position is fixed
  8766. offset = elem.getBoundingClientRect();
  8767. } else {
  8768. // Get *real* offsetParent
  8769. offsetParent = this.offsetParent();
  8770. // Get correct offsets
  8771. offset = this.offset();
  8772. if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
  8773. parentOffset = offsetParent.offset();
  8774. }
  8775. // Add offsetParent borders
  8776. parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
  8777. parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
  8778. }
  8779. // Subtract parent offsets and element margins
  8780. // note: when an element has margin: auto the offsetLeft and marginLeft
  8781. // are the same in Safari causing offset.left to incorrectly be 0
  8782. return {
  8783. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8784. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8785. };
  8786. },
  8787. offsetParent: function() {
  8788. return this.map( function() {
  8789. var offsetParent = this.offsetParent;
  8790. while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
  8791. jQuery.css( offsetParent, "position" ) === "static" ) ) {
  8792. offsetParent = offsetParent.offsetParent;
  8793. }
  8794. return offsetParent || documentElement;
  8795. } );
  8796. }
  8797. } );
  8798. // Create scrollLeft and scrollTop methods
  8799. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8800. var top = /Y/.test( prop );
  8801. jQuery.fn[ method ] = function( val ) {
  8802. return access( this, function( elem, method, val ) {
  8803. var win = getWindow( elem );
  8804. if ( val === undefined ) {
  8805. return win ? ( prop in win ) ? win[ prop ] :
  8806. win.document.documentElement[ method ] :
  8807. elem[ method ];
  8808. }
  8809. if ( win ) {
  8810. win.scrollTo(
  8811. !top ? val : jQuery( win ).scrollLeft(),
  8812. top ? val : jQuery( win ).scrollTop()
  8813. );
  8814. } else {
  8815. elem[ method ] = val;
  8816. }
  8817. }, method, val, arguments.length, null );
  8818. };
  8819. } );
  8820. // Support: Safari<7-8+, Chrome<37-44+
  8821. // Add the top/left cssHooks using jQuery.fn.position
  8822. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8823. // getComputedStyle returns percent when specified for top/left/bottom/right
  8824. // rather than make the css module depend on the offset module, we just check for it here
  8825. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8826. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8827. function( elem, computed ) {
  8828. if ( computed ) {
  8829. computed = curCSS( elem, prop );
  8830. // if curCSS returns percentage, fallback to offset
  8831. return rnumnonpx.test( computed ) ?
  8832. jQuery( elem ).position()[ prop ] + "px" :
  8833. computed;
  8834. }
  8835. }
  8836. );
  8837. } );
  8838. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8839. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8840. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8841. function( defaultExtra, funcName ) {
  8842. // margin is only for outerHeight, outerWidth
  8843. jQuery.fn[ funcName ] = function( margin, value ) {
  8844. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8845. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8846. return access( this, function( elem, type, value ) {
  8847. var doc;
  8848. if ( jQuery.isWindow( elem ) ) {
  8849. // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
  8850. // isn't a whole lot we can do. See pull request at this URL for discussion:
  8851. // https://github.com/jquery/jquery/pull/764
  8852. return elem.document.documentElement[ "client" + name ];
  8853. }
  8854. // Get document width or height
  8855. if ( elem.nodeType === 9 ) {
  8856. doc = elem.documentElement;
  8857. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8858. // whichever is greatest
  8859. // unfortunately, this causes bug #3838 in IE6/8 only,
  8860. // but there is currently no good, small way to fix it.
  8861. return Math.max(
  8862. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8863. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8864. doc[ "client" + name ]
  8865. );
  8866. }
  8867. return value === undefined ?
  8868. // Get width or height on the element, requesting but not forcing parseFloat
  8869. jQuery.css( elem, type, extra ) :
  8870. // Set width or height on the element
  8871. jQuery.style( elem, type, value, extra );
  8872. }, type, chainable ? margin : undefined, chainable, null );
  8873. };
  8874. } );
  8875. } );
  8876. jQuery.fn.extend( {
  8877. bind: function( types, data, fn ) {
  8878. return this.on( types, null, data, fn );
  8879. },
  8880. unbind: function( types, fn ) {
  8881. return this.off( types, null, fn );
  8882. },
  8883. delegate: function( selector, types, data, fn ) {
  8884. return this.on( types, selector, data, fn );
  8885. },
  8886. undelegate: function( selector, types, fn ) {
  8887. // ( namespace ) or ( selector, types [, fn] )
  8888. return arguments.length === 1 ?
  8889. this.off( selector, "**" ) :
  8890. this.off( types, selector || "**", fn );
  8891. }
  8892. } );
  8893. // The number of elements contained in the matched element set
  8894. jQuery.fn.size = function() {
  8895. return this.length;
  8896. };
  8897. jQuery.fn.andSelf = jQuery.fn.addBack;
  8898. // Register as a named AMD module, since jQuery can be concatenated with other
  8899. // files that may use define, but not via a proper concatenation script that
  8900. // understands anonymous AMD modules. A named AMD is safest and most robust
  8901. // way to register. Lowercase jquery is used because AMD module names are
  8902. // derived from file names, and jQuery is normally delivered in a lowercase
  8903. // file name. Do this after creating the global so that if an AMD module wants
  8904. // to call noConflict to hide this version of jQuery, it will work.
  8905. // Note that for maximum portability, libraries that are not jQuery should
  8906. // declare themselves as anonymous modules, and avoid setting a global if an
  8907. // AMD loader is present. jQuery is a special case. For more information, see
  8908. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8909. if ( typeof define === "function" && define.amd ) {
  8910. define( "jquery", [], function() {
  8911. return jQuery;
  8912. } );
  8913. }
  8914. var
  8915. // Map over jQuery in case of overwrite
  8916. _jQuery = window.jQuery,
  8917. // Map over the $ in case of overwrite
  8918. _$ = window.$;
  8919. jQuery.noConflict = function( deep ) {
  8920. if ( window.$ === jQuery ) {
  8921. window.$ = _$;
  8922. }
  8923. if ( deep && window.jQuery === jQuery ) {
  8924. window.jQuery = _jQuery;
  8925. }
  8926. return jQuery;
  8927. };
  8928. // Expose jQuery and $ identifiers, even in
  8929. // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8930. // and CommonJS for browser emulators (#13566)
  8931. if ( !noGlobal ) {
  8932. window.jQuery = window.$ = jQuery;
  8933. }
  8934. return jQuery;
  8935. }));
  8936. (function($, undefined) {
  8937. /**
  8938. * Unobtrusive scripting adapter for jQuery
  8939. * https://github.com/rails/jquery-ujs
  8940. *
  8941. * Requires jQuery 1.8.0 or later.
  8942. *
  8943. * Released under the MIT license
  8944. *
  8945. */
  8946. // Cut down on the number of issues from people inadvertently including jquery_ujs twice
  8947. // by detecting and raising an error when it happens.
  8948. 'use strict';
  8949. if ( $.rails !== undefined ) {
  8950. $.error('jquery-ujs has already been loaded!');
  8951. }
  8952. // Shorthand to make it a little easier to call public rails functions from within rails.js
  8953. var rails;
  8954. var $document = $(document);
  8955. $.rails = rails = {
  8956. // Link elements bound by jquery-ujs
  8957. linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
  8958. // Button elements bound by jquery-ujs
  8959. buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)',
  8960. // Select elements bound by jquery-ujs
  8961. inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
  8962. // Form elements bound by jquery-ujs
  8963. formSubmitSelector: 'form',
  8964. // Form input elements bound by jquery-ujs
  8965. formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
  8966. // Form input elements disabled during form submission
  8967. disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
  8968. // Form input elements re-enabled after form submission
  8969. enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
  8970. // Form required input elements
  8971. requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])',
  8972. // Form file input elements
  8973. fileInputSelector: 'input[name][type=file]:not([disabled])',
  8974. // Link onClick disable selector with possible reenable after remote submission
  8975. linkDisableSelector: 'a[data-disable-with], a[data-disable]',
  8976. // Button onClick disable selector with possible reenable after remote submission
  8977. buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]',
  8978. // Up-to-date Cross-Site Request Forgery token
  8979. csrfToken: function() {
  8980. return $('meta[name=csrf-token]').attr('content');
  8981. },
  8982. // URL param that must contain the CSRF token
  8983. csrfParam: function() {
  8984. return $('meta[name=csrf-param]').attr('content');
  8985. },
  8986. // Make sure that every Ajax request sends the CSRF token
  8987. CSRFProtection: function(xhr) {
  8988. var token = rails.csrfToken();
  8989. if (token) xhr.setRequestHeader('X-CSRF-Token', token);
  8990. },
  8991. // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones)
  8992. refreshCSRFTokens: function(){
  8993. $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken());
  8994. },
  8995. // Triggers an event on an element and returns false if the event result is false
  8996. fire: function(obj, name, data) {
  8997. var event = $.Event(name);
  8998. obj.trigger(event, data);
  8999. return event.result !== false;
  9000. },
  9001. // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
  9002. confirm: function(message) {
  9003. return confirm(message);
  9004. },
  9005. // Default ajax function, may be overridden with custom function in $.rails.ajax
  9006. ajax: function(options) {
  9007. return $.ajax(options);
  9008. },
  9009. // Default way to get an element's href. May be overridden at $.rails.href.
  9010. href: function(element) {
  9011. return element[0].href;
  9012. },
  9013. // Checks "data-remote" if true to handle the request through a XHR request.
  9014. isRemote: function(element) {
  9015. return element.data('remote') !== undefined && element.data('remote') !== false;
  9016. },
  9017. // Submits "remote" forms and links with ajax
  9018. handleRemote: function(element) {
  9019. var method, url, data, withCredentials, dataType, options;
  9020. if (rails.fire(element, 'ajax:before')) {
  9021. withCredentials = element.data('with-credentials') || null;
  9022. dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
  9023. if (element.is('form')) {
  9024. method = element.data('ujs:submit-button-formmethod') || element.attr('method');
  9025. url = element.data('ujs:submit-button-formaction') || element.attr('action');
  9026. data = $(element[0]).serializeArray();
  9027. // memoized value from clicked submit button
  9028. var button = element.data('ujs:submit-button');
  9029. if (button) {
  9030. data.push(button);
  9031. element.data('ujs:submit-button', null);
  9032. }
  9033. element.data('ujs:submit-button-formmethod', null);
  9034. element.data('ujs:submit-button-formaction', null);
  9035. } else if (element.is(rails.inputChangeSelector)) {
  9036. method = element.data('method');
  9037. url = element.data('url');
  9038. data = element.serialize();
  9039. if (element.data('params')) data = data + '&' + element.data('params');
  9040. } else if (element.is(rails.buttonClickSelector)) {
  9041. method = element.data('method') || 'get';
  9042. url = element.data('url');
  9043. data = element.serialize();
  9044. if (element.data('params')) data = data + '&' + element.data('params');
  9045. } else {
  9046. method = element.data('method');
  9047. url = rails.href(element);
  9048. data = element.data('params') || null;
  9049. }
  9050. options = {
  9051. type: method || 'GET', data: data, dataType: dataType,
  9052. // stopping the "ajax:beforeSend" event will cancel the ajax request
  9053. beforeSend: function(xhr, settings) {
  9054. if (settings.dataType === undefined) {
  9055. xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
  9056. }
  9057. if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
  9058. element.trigger('ajax:send', xhr);
  9059. } else {
  9060. return false;
  9061. }
  9062. },
  9063. success: function(data, status, xhr) {
  9064. element.trigger('ajax:success', [data, status, xhr]);
  9065. },
  9066. complete: function(xhr, status) {
  9067. element.trigger('ajax:complete', [xhr, status]);
  9068. },
  9069. error: function(xhr, status, error) {
  9070. element.trigger('ajax:error', [xhr, status, error]);
  9071. },
  9072. crossDomain: rails.isCrossDomain(url)
  9073. };
  9074. // There is no withCredentials for IE6-8 when
  9075. // "Enable native XMLHTTP support" is disabled
  9076. if (withCredentials) {
  9077. options.xhrFields = {
  9078. withCredentials: withCredentials
  9079. };
  9080. }
  9081. // Only pass url to `ajax` options if not blank
  9082. if (url) { options.url = url; }
  9083. return rails.ajax(options);
  9084. } else {
  9085. return false;
  9086. }
  9087. },
  9088. // Determines if the request is a cross domain request.
  9089. isCrossDomain: function(url) {
  9090. var originAnchor = document.createElement('a');
  9091. originAnchor.href = location.href;
  9092. var urlAnchor = document.createElement('a');
  9093. try {
  9094. urlAnchor.href = url;
  9095. // This is a workaround to a IE bug.
  9096. urlAnchor.href = urlAnchor.href;
  9097. // If URL protocol is false or is a string containing a single colon
  9098. // *and* host are false, assume it is not a cross-domain request
  9099. // (should only be the case for IE7 and IE compatibility mode).
  9100. // Otherwise, evaluate protocol and host of the URL against the origin
  9101. // protocol and host.
  9102. return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) ||
  9103. (originAnchor.protocol + '//' + originAnchor.host ===
  9104. urlAnchor.protocol + '//' + urlAnchor.host));
  9105. } catch (e) {
  9106. // If there is an error parsing the URL, assume it is crossDomain.
  9107. return true;
  9108. }
  9109. },
  9110. // Handles "data-method" on links such as:
  9111. // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
  9112. handleMethod: function(link) {
  9113. var href = rails.href(link),
  9114. method = link.data('method'),
  9115. target = link.attr('target'),
  9116. csrfToken = rails.csrfToken(),
  9117. csrfParam = rails.csrfParam(),
  9118. form = $('<form method="post" action="' + href + '"></form>'),
  9119. metadataInput = '<input name="_method" value="' + method + '" type="hidden" />';
  9120. if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {
  9121. metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />';
  9122. }
  9123. if (target) { form.attr('target', target); }
  9124. form.hide().append(metadataInput).appendTo('body');
  9125. form.submit();
  9126. },
  9127. // Helper function that returns form elements that match the specified CSS selector
  9128. // If form is actually a "form" element this will return associated elements outside the from that have
  9129. // the html form attribute set
  9130. formElements: function(form, selector) {
  9131. return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector);
  9132. },
  9133. /* Disables form elements:
  9134. - Caches element value in 'ujs:enable-with' data store
  9135. - Replaces element text with value of 'data-disable-with' attribute
  9136. - Sets disabled property to true
  9137. */
  9138. disableFormElements: function(form) {
  9139. rails.formElements(form, rails.disableSelector).each(function() {
  9140. rails.disableFormElement($(this));
  9141. });
  9142. },
  9143. disableFormElement: function(element) {
  9144. var method, replacement;
  9145. method = element.is('button') ? 'html' : 'val';
  9146. replacement = element.data('disable-with');
  9147. if (replacement !== undefined) {
  9148. element.data('ujs:enable-with', element[method]());
  9149. element[method](replacement);
  9150. }
  9151. element.prop('disabled', true);
  9152. element.data('ujs:disabled', true);
  9153. },
  9154. /* Re-enables disabled form elements:
  9155. - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
  9156. - Sets disabled property to false
  9157. */
  9158. enableFormElements: function(form) {
  9159. rails.formElements(form, rails.enableSelector).each(function() {
  9160. rails.enableFormElement($(this));
  9161. });
  9162. },
  9163. enableFormElement: function(element) {
  9164. var method = element.is('button') ? 'html' : 'val';
  9165. if (element.data('ujs:enable-with') !== undefined) {
  9166. element[method](element.data('ujs:enable-with'));
  9167. element.removeData('ujs:enable-with'); // clean up cache
  9168. }
  9169. element.prop('disabled', false);
  9170. element.removeData('ujs:disabled');
  9171. },
  9172. /* For 'data-confirm' attribute:
  9173. - Fires `confirm` event
  9174. - Shows the confirmation dialog
  9175. - Fires the `confirm:complete` event
  9176. Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
  9177. Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
  9178. Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
  9179. return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
  9180. */
  9181. allowAction: function(element) {
  9182. var message = element.data('confirm'),
  9183. answer = false, callback;
  9184. if (!message) { return true; }
  9185. if (rails.fire(element, 'confirm')) {
  9186. try {
  9187. answer = rails.confirm(message);
  9188. } catch (e) {
  9189. (console.error || console.log).call(console, e.stack || e);
  9190. }
  9191. callback = rails.fire(element, 'confirm:complete', [answer]);
  9192. }
  9193. return answer && callback;
  9194. },
  9195. // Helper function which checks for blank inputs in a form that match the specified CSS selector
  9196. blankInputs: function(form, specifiedSelector, nonBlank) {
  9197. var foundInputs = $(),
  9198. input,
  9199. valueToCheck,
  9200. radiosForNameWithNoneSelected,
  9201. radioName,
  9202. selector = specifiedSelector || 'input,textarea',
  9203. requiredInputs = form.find(selector),
  9204. checkedRadioButtonNames = {};
  9205. requiredInputs.each(function() {
  9206. input = $(this);
  9207. if (input.is('input[type=radio]')) {
  9208. // Don't count unchecked required radio as blank if other radio with same name is checked,
  9209. // regardless of whether same-name radio input has required attribute or not. The spec
  9210. // states https://www.w3.org/TR/html5/forms.html#the-required-attribute
  9211. radioName = input.attr('name');
  9212. // Skip if we've already seen the radio with this name.
  9213. if (!checkedRadioButtonNames[radioName]) {
  9214. // If none checked
  9215. if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) {
  9216. radiosForNameWithNoneSelected = form.find(
  9217. 'input[type=radio][name="' + radioName + '"]');
  9218. foundInputs = foundInputs.add(radiosForNameWithNoneSelected);
  9219. }
  9220. // We only need to check each name once.
  9221. checkedRadioButtonNames[radioName] = radioName;
  9222. }
  9223. } else {
  9224. valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val();
  9225. if (valueToCheck === nonBlank) {
  9226. foundInputs = foundInputs.add(input);
  9227. }
  9228. }
  9229. });
  9230. return foundInputs.length ? foundInputs : false;
  9231. },
  9232. // Helper function which checks for non-blank inputs in a form that match the specified CSS selector
  9233. nonBlankInputs: function(form, specifiedSelector) {
  9234. return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
  9235. },
  9236. // Helper function, needed to provide consistent behavior in IE
  9237. stopEverything: function(e) {
  9238. $(e.target).trigger('ujs:everythingStopped');
  9239. e.stopImmediatePropagation();
  9240. return false;
  9241. },
  9242. // Replace element's html with the 'data-disable-with' after storing original html
  9243. // and prevent clicking on it
  9244. disableElement: function(element) {
  9245. var replacement = element.data('disable-with');
  9246. if (replacement !== undefined) {
  9247. element.data('ujs:enable-with', element.html()); // store enabled state
  9248. element.html(replacement);
  9249. }
  9250. element.bind('click.railsDisable', function(e) { // prevent further clicking
  9251. return rails.stopEverything(e);
  9252. });
  9253. element.data('ujs:disabled', true);
  9254. },
  9255. // Restore element to its original state which was disabled by 'disableElement' above
  9256. enableElement: function(element) {
  9257. if (element.data('ujs:enable-with') !== undefined) {
  9258. element.html(element.data('ujs:enable-with')); // set to old enabled state
  9259. element.removeData('ujs:enable-with'); // clean up cache
  9260. }
  9261. element.unbind('click.railsDisable'); // enable element
  9262. element.removeData('ujs:disabled');
  9263. }
  9264. };
  9265. if (rails.fire($document, 'rails:attachBindings')) {
  9266. $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
  9267. // This event works the same as the load event, except that it fires every
  9268. // time the page is loaded.
  9269. //
  9270. // See https://github.com/rails/jquery-ujs/issues/357
  9271. // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching
  9272. $(window).on('pageshow.rails', function () {
  9273. $($.rails.enableSelector).each(function () {
  9274. var element = $(this);
  9275. if (element.data('ujs:disabled')) {
  9276. $.rails.enableFormElement(element);
  9277. }
  9278. });
  9279. $($.rails.linkDisableSelector).each(function () {
  9280. var element = $(this);
  9281. if (element.data('ujs:disabled')) {
  9282. $.rails.enableElement(element);
  9283. }
  9284. });
  9285. });
  9286. $document.on('ajax:complete', rails.linkDisableSelector, function() {
  9287. rails.enableElement($(this));
  9288. });
  9289. $document.on('ajax:complete', rails.buttonDisableSelector, function() {
  9290. rails.enableFormElement($(this));
  9291. });
  9292. $document.on('click.rails', rails.linkClickSelector, function(e) {
  9293. var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey;
  9294. if (!rails.allowAction(link)) return rails.stopEverything(e);
  9295. if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link);
  9296. if (rails.isRemote(link)) {
  9297. if (metaClick && (!method || method === 'GET') && !data) { return true; }
  9298. var handleRemote = rails.handleRemote(link);
  9299. // Response from rails.handleRemote() will either be false or a deferred object promise.
  9300. if (handleRemote === false) {
  9301. rails.enableElement(link);
  9302. } else {
  9303. handleRemote.fail( function() { rails.enableElement(link); } );
  9304. }
  9305. return false;
  9306. } else if (method) {
  9307. rails.handleMethod(link);
  9308. return false;
  9309. }
  9310. });
  9311. $document.on('click.rails', rails.buttonClickSelector, function(e) {
  9312. var button = $(this);
  9313. if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e);
  9314. if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button);
  9315. var handleRemote = rails.handleRemote(button);
  9316. // Response from rails.handleRemote() will either be false or a deferred object promise.
  9317. if (handleRemote === false) {
  9318. rails.enableFormElement(button);
  9319. } else {
  9320. handleRemote.fail( function() { rails.enableFormElement(button); } );
  9321. }
  9322. return false;
  9323. });
  9324. $document.on('change.rails', rails.inputChangeSelector, function(e) {
  9325. var link = $(this);
  9326. if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e);
  9327. rails.handleRemote(link);
  9328. return false;
  9329. });
  9330. $document.on('submit.rails', rails.formSubmitSelector, function(e) {
  9331. var form = $(this),
  9332. remote = rails.isRemote(form),
  9333. blankRequiredInputs,
  9334. nonBlankFileInputs;
  9335. if (!rails.allowAction(form)) return rails.stopEverything(e);
  9336. // Skip other logic when required values are missing or file upload is present
  9337. if (form.attr('novalidate') === undefined) {
  9338. if (form.data('ujs:formnovalidate-button') === undefined) {
  9339. blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false);
  9340. if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
  9341. return rails.stopEverything(e);
  9342. }
  9343. } else {
  9344. // Clear the formnovalidate in case the next button click is not on a formnovalidate button
  9345. // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain
  9346. form.data('ujs:formnovalidate-button', undefined);
  9347. }
  9348. }
  9349. if (remote) {
  9350. nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
  9351. if (nonBlankFileInputs) {
  9352. // Slight timeout so that the submit button gets properly serialized
  9353. // (make it easy for event handler to serialize form without disabled values)
  9354. setTimeout(function(){ rails.disableFormElements(form); }, 13);
  9355. var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
  9356. // Re-enable form elements if event bindings return false (canceling normal form submission)
  9357. if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); }
  9358. return aborted;
  9359. }
  9360. rails.handleRemote(form);
  9361. return false;
  9362. } else {
  9363. // Slight timeout so that the submit button gets properly serialized
  9364. setTimeout(function(){ rails.disableFormElements(form); }, 13);
  9365. }
  9366. });
  9367. $document.on('click.rails', rails.formInputClickSelector, function(event) {
  9368. var button = $(this);
  9369. if (!rails.allowAction(button)) return rails.stopEverything(event);
  9370. // Register the pressed submit button
  9371. var name = button.attr('name'),
  9372. data = name ? {name:name, value:button.val()} : null;
  9373. var form = button.closest('form');
  9374. if (form.length === 0) {
  9375. form = $('#' + button.attr('form'));
  9376. }
  9377. form.data('ujs:submit-button', data);
  9378. // Save attributes from button
  9379. form.data('ujs:formnovalidate-button', button.attr('formnovalidate'));
  9380. form.data('ujs:submit-button-formaction', button.attr('formaction'));
  9381. form.data('ujs:submit-button-formmethod', button.attr('formmethod'));
  9382. });
  9383. $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) {
  9384. if (this === event.target) rails.disableFormElements($(this));
  9385. });
  9386. $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) {
  9387. if (this === event.target) rails.enableFormElements($(this));
  9388. });
  9389. $(function(){
  9390. rails.refreshCSRFTokens();
  9391. });
  9392. }
  9393. })( jQuery );
  9394. // This [jQuery](http://jquery.com/) plugin implements an `<iframe>`
  9395. // [transport](http://api.jquery.com/extending-ajax/#Transports) so that
  9396. // `$.ajax()` calls support the uploading of files using standard HTML file
  9397. // input fields. This is done by switching the exchange from `XMLHttpRequest`
  9398. // to a hidden `iframe` element containing a form that is submitted.
  9399. // The [source for the plugin](http://github.com/cmlenz/jquery-iframe-transport)
  9400. // is available on [Github](http://github.com/) and dual licensed under the MIT
  9401. // or GPL Version 2 licenses.
  9402. // ## Usage
  9403. // To use this plugin, you simply add an `iframe` option with the value `true`
  9404. // to the Ajax settings an `$.ajax()` call, and specify the file fields to
  9405. // include in the submssion using the `files` option, which can be a selector,
  9406. // jQuery object, or a list of DOM elements containing one or more
  9407. // `<input type="file">` elements:
  9408. // $("#myform").submit(function() {
  9409. // $.ajax(this.action, {
  9410. // files: $(":file", this),
  9411. // iframe: true
  9412. // }).complete(function(data) {
  9413. // console.log(data);
  9414. // });
  9415. // });
  9416. // The plugin will construct hidden `<iframe>` and `<form>` elements, add the
  9417. // file field(s) to that form, submit the form, and process the response.
  9418. // If you want to include other form fields in the form submission, include
  9419. // them in the `data` option, and set the `processData` option to `false`:
  9420. // $("#myform").submit(function() {
  9421. // $.ajax(this.action, {
  9422. // data: $(":text", this).serializeArray(),
  9423. // files: $(":file", this),
  9424. // iframe: true,
  9425. // processData: false
  9426. // }).complete(function(data) {
  9427. // console.log(data);
  9428. // });
  9429. // });
  9430. // ### Response Data Types
  9431. // As the transport does not have access to the HTTP headers of the server
  9432. // response, it is not as simple to make use of the automatic content type
  9433. // detection provided by jQuery as with regular XHR. If you can't set the
  9434. // expected response data type (for example because it may vary depending on
  9435. // the outcome of processing by the server), you will need to employ a
  9436. // workaround on the server side: Send back an HTML document containing just a
  9437. // `<textarea>` element with a `data-type` attribute that specifies the MIME
  9438. // type, and put the actual payload in the textarea:
  9439. // <textarea data-type="application/json">
  9440. // {"ok": true, "message": "Thanks so much"}
  9441. // </textarea>
  9442. // The iframe transport plugin will detect this and pass the value of the
  9443. // `data-type` attribute on to jQuery as if it was the "Content-Type" response
  9444. // header, thereby enabling the same kind of conversions that jQuery applies
  9445. // to regular responses. For the example above you should get a Javascript
  9446. // object as the `data` parameter of the `complete` callback, with the
  9447. // properties `ok: true` and `message: "Thanks so much"`.
  9448. // ### Handling Server Errors
  9449. // Another problem with using an `iframe` for file uploads is that it is
  9450. // impossible for the javascript code to determine the HTTP status code of the
  9451. // servers response. Effectively, all of the calls you make will look like they
  9452. // are getting successful responses, and thus invoke the `done()` or
  9453. // `complete()` callbacks. You can only determine communicate problems using
  9454. // the content of the response payload. For example, consider using a JSON
  9455. // response such as the following to indicate a problem with an uploaded file:
  9456. // <textarea data-type="application/json">
  9457. // {"ok": false, "message": "Please only upload reasonably sized files."}
  9458. // </textarea>
  9459. // ### Compatibility
  9460. // This plugin has primarily been tested on Safari 5 (or later), Firefox 4 (or
  9461. // later), and Internet Explorer (all the way back to version 6). While I
  9462. // haven't found any issues with it so far, I'm fairly sure it still doesn't
  9463. // work around all the quirks in all different browsers. But the code is still
  9464. // pretty simple overall, so you should be able to fix it and contribute a
  9465. // patch :)
  9466. // ## Annotated Source
  9467. (function($, undefined) {
  9468. "use strict";
  9469. // Register a prefilter that checks whether the `iframe` option is set, and
  9470. // switches to the "iframe" data type if it is `true`.
  9471. $.ajaxPrefilter(function(options, origOptions, jqXHR) {
  9472. if (options.iframe) {
  9473. return "iframe";
  9474. }
  9475. });
  9476. // Register a transport for the "iframe" data type. It will only activate
  9477. // when the "files" option has been set to a non-empty list of enabled file
  9478. // inputs.
  9479. $.ajaxTransport("iframe", function(options, origOptions, jqXHR) {
  9480. var form = null,
  9481. iframe = null,
  9482. name = "iframe-" + $.now(),
  9483. files = $(options.files).filter(":file:enabled"),
  9484. markers = null,
  9485. accepts;
  9486. // This function gets called after a successful submission or an abortion
  9487. // and should revert all changes made to the page to enable the
  9488. // submission via this transport.
  9489. function cleanUp() {
  9490. markers.each(function(i){
  9491. $(this).replaceWith(files[i]);
  9492. markers.splice(i, 1);
  9493. });
  9494. form.remove();
  9495. iframe.bind("load", function() { iframe.remove(); });
  9496. iframe.attr("src", "about:blank");
  9497. }
  9498. // Remove "iframe" from the data types list so that further processing is
  9499. // based on the content type returned by the server, without attempting an
  9500. // (unsupported) conversion from "iframe" to the actual type.
  9501. options.dataTypes.shift();
  9502. if (files.length) {
  9503. form = $("<form enctype='multipart/form-data' method='post'></form>").
  9504. hide().attr({action: options.url, target: name});
  9505. // If there is any additional data specified via the `data` option,
  9506. // we add it as hidden fields to the form. This (currently) requires
  9507. // the `processData` option to be set to false so that the data doesn't
  9508. // get serialized to a string.
  9509. if (typeof(options.data) === "string" && options.data.length > 0) {
  9510. $.error("data must not be serialized");
  9511. }
  9512. $.each(options.data || {}, function(name, value) {
  9513. if ($.isPlainObject(value)) {
  9514. name = value.name;
  9515. value = value.value;
  9516. }
  9517. $("<input type='hidden' />").attr({name: name, value: value}).
  9518. appendTo(form);
  9519. });
  9520. // Add a hidden `X-Requested-With` field with the value `IFrame` to the
  9521. // field, to help server-side code to determine that the upload happened
  9522. // through this transport.
  9523. $("<input type='hidden' value='IFrame' name='X-Requested-With' />").
  9524. appendTo(form);
  9525. // Borrowed straight from the JQuery source
  9526. // Provides a way of specifying the accepted data type similar to HTTP_ACCEPTS
  9527. accepts = options.dataTypes[ 0 ] && options.accepts[ options.dataTypes[0] ] ?
  9528. options.accepts[ options.dataTypes[0] ] + ( options.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
  9529. options.accepts[ "*" ]
  9530. $("<input type='hidden' name='X-Http-Accept'>")
  9531. .attr("value", accepts).appendTo(form);
  9532. // Move the file fields into the hidden form, but first remember their
  9533. // original locations in the document by replacing them with disabled
  9534. // clones. This should also avoid introducing unwanted changes to the
  9535. // page layout during submission.
  9536. markers = files.after(function(idx) {
  9537. return $(this).clone().prop("disabled", true);
  9538. }).next();
  9539. files.appendTo(form);
  9540. return {
  9541. // The `send` function is called by jQuery when the request should be
  9542. // sent.
  9543. send: function(headers, completeCallback) {
  9544. iframe = $("<iframe src='about:blank' name='" + name +
  9545. "' id='" + name + "' style='display:none'></iframe>");
  9546. // The first load event gets fired after the iframe has been injected
  9547. // into the DOM, and is used to prepare the actual submission.
  9548. iframe.bind("load", function() {
  9549. // The second load event gets fired when the response to the form
  9550. // submission is received. The implementation detects whether the
  9551. // actual payload is embedded in a `<textarea>` element, and
  9552. // prepares the required conversions to be made in that case.
  9553. iframe.unbind("load").bind("load", function() {
  9554. var doc = this.contentWindow ? this.contentWindow.document :
  9555. (this.contentDocument ? this.contentDocument : this.document),
  9556. root = doc.documentElement ? doc.documentElement : doc.body,
  9557. textarea = root.getElementsByTagName("textarea")[0],
  9558. type = textarea && textarea.getAttribute("data-type") || null,
  9559. status = textarea && textarea.getAttribute("data-status") || 200,
  9560. statusText = textarea && textarea.getAttribute("data-statusText") || "OK",
  9561. content = {
  9562. html: root.innerHTML,
  9563. text: type ?
  9564. textarea.value :
  9565. root ? (root.textContent || root.innerText) : null
  9566. };
  9567. cleanUp();
  9568. if (!jqXHR.responseText) {
  9569. jqXHR.responseText = content.text;
  9570. }
  9571. completeCallback(status, statusText, content, type ?
  9572. ("Content-Type: " + type) :
  9573. null);
  9574. });
  9575. // Now that the load handler has been set up, submit the form.
  9576. form[0].submit();
  9577. });
  9578. // After everything has been set up correctly, the form and iframe
  9579. // get injected into the DOM so that the submission can be
  9580. // initiated.
  9581. $("body").append(form, iframe);
  9582. },
  9583. // The `abort` function is called by jQuery when the request should be
  9584. // aborted.
  9585. abort: function() {
  9586. if (iframe !== null) {
  9587. iframe.unbind("load").attr("src", "javascript:false;");
  9588. cleanUp();
  9589. }
  9590. }
  9591. };
  9592. }
  9593. });
  9594. })(jQuery);
  9595. (function($) {
  9596. var remotipart;
  9597. $.remotipart = remotipart = {
  9598. setup: function(form) {
  9599. // Preserve form.data('ujs:submit-button') before it gets nulled by $.ajax.handleRemote
  9600. var button = form.data('ujs:submit-button'),
  9601. csrfParam = $('meta[name="csrf-param"]').attr('content'),
  9602. csrfToken = $('meta[name="csrf-token"]').attr('content'),
  9603. csrfInput = form.find('input[name="' + csrfParam + '"]').length;
  9604. form
  9605. // Allow setup part of $.rails.handleRemote to setup remote settings before canceling default remote handler
  9606. // This is required in order to change the remote settings using the form details
  9607. .one('ajax:beforeSend.remotipart', function(e, xhr, settings){
  9608. // Delete the beforeSend bindings, since we're about to re-submit via ajaxSubmit with the beforeSubmit
  9609. // hook that was just setup and triggered via the default `$.rails.handleRemote`
  9610. // delete settings.beforeSend;
  9611. delete settings.beforeSend;
  9612. settings.iframe = true;
  9613. settings.files = $($.rails.fileInputSelector, form);
  9614. settings.data = form.serializeArray();
  9615. // Insert the name/value of the clicked submit button, if any
  9616. if (button)
  9617. settings.data.push(button);
  9618. // jQuery 1.9 serializeArray() contains input:file entries
  9619. // so exclude them from settings.data, otherwise files will not be sent
  9620. settings.files.each(function(i, file){
  9621. for (var j = settings.data.length - 1; j >= 0; j--)
  9622. if (settings.data[j].name == file.name)
  9623. settings.data.splice(j, 1);
  9624. })
  9625. settings.processData = false;
  9626. // Modify some settings to integrate JS request with rails helpers and middleware
  9627. if (settings.dataType === undefined) { settings.dataType = 'script *'; }
  9628. settings.data.push({name: 'remotipart_submitted', value: true});
  9629. if (csrfToken && csrfParam && !csrfInput) {
  9630. settings.data.push({name: csrfParam, value: csrfToken});
  9631. }
  9632. // Allow remotipartSubmit to be cancelled if needed
  9633. if ($.rails.fire(form, 'ajax:remotipartSubmit', [xhr, settings])) {
  9634. // Second verse, same as the first
  9635. $.rails.ajax(settings).complete(function(data){
  9636. $.rails.fire(form, 'ajax:remotipartComplete', [data]);
  9637. });
  9638. setTimeout(function(){ $.rails.disableFormElements(form); }, 20);
  9639. }
  9640. //Run cleanup
  9641. remotipart.teardown(form);
  9642. // Cancel the jQuery UJS request
  9643. return false;
  9644. })
  9645. // Keep track that we just set this particular form with Remotipart bindings
  9646. // Note: The `true` value will get over-written with the `settings.dataType` from the `ajax:beforeSend` handler
  9647. .data('remotipartSubmitted', true);
  9648. },
  9649. teardown: function(form) {
  9650. form
  9651. .unbind('ajax:beforeSend.remotipart')
  9652. .removeData('remotipartSubmitted')
  9653. }
  9654. };
  9655. $(document).on('ajax:aborted:file', 'form', function(){
  9656. var form = $(this);
  9657. remotipart.setup(form);
  9658. // Manually call jquery-ujs remote call so that it can setup form and settings as usual,
  9659. // and trigger the `ajax:beforeSend` callback to which remotipart binds functionality.
  9660. $.rails.handleRemote(form);
  9661. return false;
  9662. });
  9663. })(jQuery);
  9664. /*!
  9665. * jQuery UI Effects 1.11.4
  9666. * http://jqueryui.com
  9667. *
  9668. * Copyright jQuery Foundation and other contributors
  9669. * Released under the MIT license.
  9670. * http://jquery.org/license
  9671. *
  9672. * http://api.jqueryui.com/category/effects-core/
  9673. */
  9674. (function( factory ) {
  9675. if ( typeof define === "function" && define.amd ) {
  9676. // AMD. Register as an anonymous module.
  9677. define( [ "jquery" ], factory );
  9678. } else {
  9679. // Browser globals
  9680. factory( jQuery );
  9681. }
  9682. }(function( $ ) {
  9683. var dataSpace = "ui-effects-",
  9684. // Create a local jQuery because jQuery Color relies on it and the
  9685. // global may not exist with AMD and a custom build (#10199)
  9686. jQuery = $;
  9687. $.effects = {
  9688. effect: {}
  9689. };
  9690. /*!
  9691. * jQuery Color Animations v2.1.2
  9692. * https://github.com/jquery/jquery-color
  9693. *
  9694. * Copyright 2014 jQuery Foundation and other contributors
  9695. * Released under the MIT license.
  9696. * http://jquery.org/license
  9697. *
  9698. * Date: Wed Jan 16 08:47:09 2013 -0600
  9699. */
  9700. (function( jQuery, undefined ) {
  9701. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  9702. // plusequals test for += 100 -= 100
  9703. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  9704. // a set of RE's that can match strings and generate color tuples.
  9705. stringParsers = [ {
  9706. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  9707. parse: function( execResult ) {
  9708. return [
  9709. execResult[ 1 ],
  9710. execResult[ 2 ],
  9711. execResult[ 3 ],
  9712. execResult[ 4 ]
  9713. ];
  9714. }
  9715. }, {
  9716. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  9717. parse: function( execResult ) {
  9718. return [
  9719. execResult[ 1 ] * 2.55,
  9720. execResult[ 2 ] * 2.55,
  9721. execResult[ 3 ] * 2.55,
  9722. execResult[ 4 ]
  9723. ];
  9724. }
  9725. }, {
  9726. // this regex ignores A-F because it's compared against an already lowercased string
  9727. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  9728. parse: function( execResult ) {
  9729. return [
  9730. parseInt( execResult[ 1 ], 16 ),
  9731. parseInt( execResult[ 2 ], 16 ),
  9732. parseInt( execResult[ 3 ], 16 )
  9733. ];
  9734. }
  9735. }, {
  9736. // this regex ignores A-F because it's compared against an already lowercased string
  9737. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  9738. parse: function( execResult ) {
  9739. return [
  9740. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  9741. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  9742. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  9743. ];
  9744. }
  9745. }, {
  9746. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  9747. space: "hsla",
  9748. parse: function( execResult ) {
  9749. return [
  9750. execResult[ 1 ],
  9751. execResult[ 2 ] / 100,
  9752. execResult[ 3 ] / 100,
  9753. execResult[ 4 ]
  9754. ];
  9755. }
  9756. } ],
  9757. // jQuery.Color( )
  9758. color = jQuery.Color = function( color, green, blue, alpha ) {
  9759. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  9760. },
  9761. spaces = {
  9762. rgba: {
  9763. props: {
  9764. red: {
  9765. idx: 0,
  9766. type: "byte"
  9767. },
  9768. green: {
  9769. idx: 1,
  9770. type: "byte"
  9771. },
  9772. blue: {
  9773. idx: 2,
  9774. type: "byte"
  9775. }
  9776. }
  9777. },
  9778. hsla: {
  9779. props: {
  9780. hue: {
  9781. idx: 0,
  9782. type: "degrees"
  9783. },
  9784. saturation: {
  9785. idx: 1,
  9786. type: "percent"
  9787. },
  9788. lightness: {
  9789. idx: 2,
  9790. type: "percent"
  9791. }
  9792. }
  9793. }
  9794. },
  9795. propTypes = {
  9796. "byte": {
  9797. floor: true,
  9798. max: 255
  9799. },
  9800. "percent": {
  9801. max: 1
  9802. },
  9803. "degrees": {
  9804. mod: 360,
  9805. floor: true
  9806. }
  9807. },
  9808. support = color.support = {},
  9809. // element for support tests
  9810. supportElem = jQuery( "<p>" )[ 0 ],
  9811. // colors = jQuery.Color.names
  9812. colors,
  9813. // local aliases of functions called often
  9814. each = jQuery.each;
  9815. // determine rgba support immediately
  9816. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  9817. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  9818. // define cache name and alpha properties
  9819. // for rgba and hsla spaces
  9820. each( spaces, function( spaceName, space ) {
  9821. space.cache = "_" + spaceName;
  9822. space.props.alpha = {
  9823. idx: 3,
  9824. type: "percent",
  9825. def: 1
  9826. };
  9827. });
  9828. function clamp( value, prop, allowEmpty ) {
  9829. var type = propTypes[ prop.type ] || {};
  9830. if ( value == null ) {
  9831. return (allowEmpty || !prop.def) ? null : prop.def;
  9832. }
  9833. // ~~ is an short way of doing floor for positive numbers
  9834. value = type.floor ? ~~value : parseFloat( value );
  9835. // IE will pass in empty strings as value for alpha,
  9836. // which will hit this case
  9837. if ( isNaN( value ) ) {
  9838. return prop.def;
  9839. }
  9840. if ( type.mod ) {
  9841. // we add mod before modding to make sure that negatives values
  9842. // get converted properly: -10 -> 350
  9843. return (value + type.mod) % type.mod;
  9844. }
  9845. // for now all property types without mod have min and max
  9846. return 0 > value ? 0 : type.max < value ? type.max : value;
  9847. }
  9848. function stringParse( string ) {
  9849. var inst = color(),
  9850. rgba = inst._rgba = [];
  9851. string = string.toLowerCase();
  9852. each( stringParsers, function( i, parser ) {
  9853. var parsed,
  9854. match = parser.re.exec( string ),
  9855. values = match && parser.parse( match ),
  9856. spaceName = parser.space || "rgba";
  9857. if ( values ) {
  9858. parsed = inst[ spaceName ]( values );
  9859. // if this was an rgba parse the assignment might happen twice
  9860. // oh well....
  9861. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  9862. rgba = inst._rgba = parsed._rgba;
  9863. // exit each( stringParsers ) here because we matched
  9864. return false;
  9865. }
  9866. });
  9867. // Found a stringParser that handled it
  9868. if ( rgba.length ) {
  9869. // if this came from a parsed string, force "transparent" when alpha is 0
  9870. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  9871. if ( rgba.join() === "0,0,0,0" ) {
  9872. jQuery.extend( rgba, colors.transparent );
  9873. }
  9874. return inst;
  9875. }
  9876. // named colors
  9877. return colors[ string ];
  9878. }
  9879. color.fn = jQuery.extend( color.prototype, {
  9880. parse: function( red, green, blue, alpha ) {
  9881. if ( red === undefined ) {
  9882. this._rgba = [ null, null, null, null ];
  9883. return this;
  9884. }
  9885. if ( red.jquery || red.nodeType ) {
  9886. red = jQuery( red ).css( green );
  9887. green = undefined;
  9888. }
  9889. var inst = this,
  9890. type = jQuery.type( red ),
  9891. rgba = this._rgba = [];
  9892. // more than 1 argument specified - assume ( red, green, blue, alpha )
  9893. if ( green !== undefined ) {
  9894. red = [ red, green, blue, alpha ];
  9895. type = "array";
  9896. }
  9897. if ( type === "string" ) {
  9898. return this.parse( stringParse( red ) || colors._default );
  9899. }
  9900. if ( type === "array" ) {
  9901. each( spaces.rgba.props, function( key, prop ) {
  9902. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  9903. });
  9904. return this;
  9905. }
  9906. if ( type === "object" ) {
  9907. if ( red instanceof color ) {
  9908. each( spaces, function( spaceName, space ) {
  9909. if ( red[ space.cache ] ) {
  9910. inst[ space.cache ] = red[ space.cache ].slice();
  9911. }
  9912. });
  9913. } else {
  9914. each( spaces, function( spaceName, space ) {
  9915. var cache = space.cache;
  9916. each( space.props, function( key, prop ) {
  9917. // if the cache doesn't exist, and we know how to convert
  9918. if ( !inst[ cache ] && space.to ) {
  9919. // if the value was null, we don't need to copy it
  9920. // if the key was alpha, we don't need to copy it either
  9921. if ( key === "alpha" || red[ key ] == null ) {
  9922. return;
  9923. }
  9924. inst[ cache ] = space.to( inst._rgba );
  9925. }
  9926. // this is the only case where we allow nulls for ALL properties.
  9927. // call clamp with alwaysAllowEmpty
  9928. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  9929. });
  9930. // everything defined but alpha?
  9931. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  9932. // use the default of 1
  9933. inst[ cache ][ 3 ] = 1;
  9934. if ( space.from ) {
  9935. inst._rgba = space.from( inst[ cache ] );
  9936. }
  9937. }
  9938. });
  9939. }
  9940. return this;
  9941. }
  9942. },
  9943. is: function( compare ) {
  9944. var is = color( compare ),
  9945. same = true,
  9946. inst = this;
  9947. each( spaces, function( _, space ) {
  9948. var localCache,
  9949. isCache = is[ space.cache ];
  9950. if (isCache) {
  9951. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  9952. each( space.props, function( _, prop ) {
  9953. if ( isCache[ prop.idx ] != null ) {
  9954. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  9955. return same;
  9956. }
  9957. });
  9958. }
  9959. return same;
  9960. });
  9961. return same;
  9962. },
  9963. _space: function() {
  9964. var used = [],
  9965. inst = this;
  9966. each( spaces, function( spaceName, space ) {
  9967. if ( inst[ space.cache ] ) {
  9968. used.push( spaceName );
  9969. }
  9970. });
  9971. return used.pop();
  9972. },
  9973. transition: function( other, distance ) {
  9974. var end = color( other ),
  9975. spaceName = end._space(),
  9976. space = spaces[ spaceName ],
  9977. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  9978. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  9979. result = start.slice();
  9980. end = end[ space.cache ];
  9981. each( space.props, function( key, prop ) {
  9982. var index = prop.idx,
  9983. startValue = start[ index ],
  9984. endValue = end[ index ],
  9985. type = propTypes[ prop.type ] || {};
  9986. // if null, don't override start value
  9987. if ( endValue === null ) {
  9988. return;
  9989. }
  9990. // if null - use end
  9991. if ( startValue === null ) {
  9992. result[ index ] = endValue;
  9993. } else {
  9994. if ( type.mod ) {
  9995. if ( endValue - startValue > type.mod / 2 ) {
  9996. startValue += type.mod;
  9997. } else if ( startValue - endValue > type.mod / 2 ) {
  9998. startValue -= type.mod;
  9999. }
  10000. }
  10001. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  10002. }
  10003. });
  10004. return this[ spaceName ]( result );
  10005. },
  10006. blend: function( opaque ) {
  10007. // if we are already opaque - return ourself
  10008. if ( this._rgba[ 3 ] === 1 ) {
  10009. return this;
  10010. }
  10011. var rgb = this._rgba.slice(),
  10012. a = rgb.pop(),
  10013. blend = color( opaque )._rgba;
  10014. return color( jQuery.map( rgb, function( v, i ) {
  10015. return ( 1 - a ) * blend[ i ] + a * v;
  10016. }));
  10017. },
  10018. toRgbaString: function() {
  10019. var prefix = "rgba(",
  10020. rgba = jQuery.map( this._rgba, function( v, i ) {
  10021. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  10022. });
  10023. if ( rgba[ 3 ] === 1 ) {
  10024. rgba.pop();
  10025. prefix = "rgb(";
  10026. }
  10027. return prefix + rgba.join() + ")";
  10028. },
  10029. toHslaString: function() {
  10030. var prefix = "hsla(",
  10031. hsla = jQuery.map( this.hsla(), function( v, i ) {
  10032. if ( v == null ) {
  10033. v = i > 2 ? 1 : 0;
  10034. }
  10035. // catch 1 and 2
  10036. if ( i && i < 3 ) {
  10037. v = Math.round( v * 100 ) + "%";
  10038. }
  10039. return v;
  10040. });
  10041. if ( hsla[ 3 ] === 1 ) {
  10042. hsla.pop();
  10043. prefix = "hsl(";
  10044. }
  10045. return prefix + hsla.join() + ")";
  10046. },
  10047. toHexString: function( includeAlpha ) {
  10048. var rgba = this._rgba.slice(),
  10049. alpha = rgba.pop();
  10050. if ( includeAlpha ) {
  10051. rgba.push( ~~( alpha * 255 ) );
  10052. }
  10053. return "#" + jQuery.map( rgba, function( v ) {
  10054. // default to 0 when nulls exist
  10055. v = ( v || 0 ).toString( 16 );
  10056. return v.length === 1 ? "0" + v : v;
  10057. }).join("");
  10058. },
  10059. toString: function() {
  10060. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  10061. }
  10062. });
  10063. color.fn.parse.prototype = color.fn;
  10064. // hsla conversions adapted from:
  10065. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  10066. function hue2rgb( p, q, h ) {
  10067. h = ( h + 1 ) % 1;
  10068. if ( h * 6 < 1 ) {
  10069. return p + ( q - p ) * h * 6;
  10070. }
  10071. if ( h * 2 < 1) {
  10072. return q;
  10073. }
  10074. if ( h * 3 < 2 ) {
  10075. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  10076. }
  10077. return p;
  10078. }
  10079. spaces.hsla.to = function( rgba ) {
  10080. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  10081. return [ null, null, null, rgba[ 3 ] ];
  10082. }
  10083. var r = rgba[ 0 ] / 255,
  10084. g = rgba[ 1 ] / 255,
  10085. b = rgba[ 2 ] / 255,
  10086. a = rgba[ 3 ],
  10087. max = Math.max( r, g, b ),
  10088. min = Math.min( r, g, b ),
  10089. diff = max - min,
  10090. add = max + min,
  10091. l = add * 0.5,
  10092. h, s;
  10093. if ( min === max ) {
  10094. h = 0;
  10095. } else if ( r === max ) {
  10096. h = ( 60 * ( g - b ) / diff ) + 360;
  10097. } else if ( g === max ) {
  10098. h = ( 60 * ( b - r ) / diff ) + 120;
  10099. } else {
  10100. h = ( 60 * ( r - g ) / diff ) + 240;
  10101. }
  10102. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  10103. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  10104. if ( diff === 0 ) {
  10105. s = 0;
  10106. } else if ( l <= 0.5 ) {
  10107. s = diff / add;
  10108. } else {
  10109. s = diff / ( 2 - add );
  10110. }
  10111. return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  10112. };
  10113. spaces.hsla.from = function( hsla ) {
  10114. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  10115. return [ null, null, null, hsla[ 3 ] ];
  10116. }
  10117. var h = hsla[ 0 ] / 360,
  10118. s = hsla[ 1 ],
  10119. l = hsla[ 2 ],
  10120. a = hsla[ 3 ],
  10121. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  10122. p = 2 * l - q;
  10123. return [
  10124. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  10125. Math.round( hue2rgb( p, q, h ) * 255 ),
  10126. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  10127. a
  10128. ];
  10129. };
  10130. each( spaces, function( spaceName, space ) {
  10131. var props = space.props,
  10132. cache = space.cache,
  10133. to = space.to,
  10134. from = space.from;
  10135. // makes rgba() and hsla()
  10136. color.fn[ spaceName ] = function( value ) {
  10137. // generate a cache for this space if it doesn't exist
  10138. if ( to && !this[ cache ] ) {
  10139. this[ cache ] = to( this._rgba );
  10140. }
  10141. if ( value === undefined ) {
  10142. return this[ cache ].slice();
  10143. }
  10144. var ret,
  10145. type = jQuery.type( value ),
  10146. arr = ( type === "array" || type === "object" ) ? value : arguments,
  10147. local = this[ cache ].slice();
  10148. each( props, function( key, prop ) {
  10149. var val = arr[ type === "object" ? key : prop.idx ];
  10150. if ( val == null ) {
  10151. val = local[ prop.idx ];
  10152. }
  10153. local[ prop.idx ] = clamp( val, prop );
  10154. });
  10155. if ( from ) {
  10156. ret = color( from( local ) );
  10157. ret[ cache ] = local;
  10158. return ret;
  10159. } else {
  10160. return color( local );
  10161. }
  10162. };
  10163. // makes red() green() blue() alpha() hue() saturation() lightness()
  10164. each( props, function( key, prop ) {
  10165. // alpha is included in more than one space
  10166. if ( color.fn[ key ] ) {
  10167. return;
  10168. }
  10169. color.fn[ key ] = function( value ) {
  10170. var vtype = jQuery.type( value ),
  10171. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  10172. local = this[ fn ](),
  10173. cur = local[ prop.idx ],
  10174. match;
  10175. if ( vtype === "undefined" ) {
  10176. return cur;
  10177. }
  10178. if ( vtype === "function" ) {
  10179. value = value.call( this, cur );
  10180. vtype = jQuery.type( value );
  10181. }
  10182. if ( value == null && prop.empty ) {
  10183. return this;
  10184. }
  10185. if ( vtype === "string" ) {
  10186. match = rplusequals.exec( value );
  10187. if ( match ) {
  10188. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  10189. }
  10190. }
  10191. local[ prop.idx ] = value;
  10192. return this[ fn ]( local );
  10193. };
  10194. });
  10195. });
  10196. // add cssHook and .fx.step function for each named hook.
  10197. // accept a space separated string of properties
  10198. color.hook = function( hook ) {
  10199. var hooks = hook.split( " " );
  10200. each( hooks, function( i, hook ) {
  10201. jQuery.cssHooks[ hook ] = {
  10202. set: function( elem, value ) {
  10203. var parsed, curElem,
  10204. backgroundColor = "";
  10205. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  10206. value = color( parsed || value );
  10207. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  10208. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  10209. while (
  10210. (backgroundColor === "" || backgroundColor === "transparent") &&
  10211. curElem && curElem.style
  10212. ) {
  10213. try {
  10214. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  10215. curElem = curElem.parentNode;
  10216. } catch ( e ) {
  10217. }
  10218. }
  10219. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  10220. backgroundColor :
  10221. "_default" );
  10222. }
  10223. value = value.toRgbaString();
  10224. }
  10225. try {
  10226. elem.style[ hook ] = value;
  10227. } catch ( e ) {
  10228. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  10229. }
  10230. }
  10231. };
  10232. jQuery.fx.step[ hook ] = function( fx ) {
  10233. if ( !fx.colorInit ) {
  10234. fx.start = color( fx.elem, hook );
  10235. fx.end = color( fx.end );
  10236. fx.colorInit = true;
  10237. }
  10238. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  10239. };
  10240. });
  10241. };
  10242. color.hook( stepHooks );
  10243. jQuery.cssHooks.borderColor = {
  10244. expand: function( value ) {
  10245. var expanded = {};
  10246. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  10247. expanded[ "border" + part + "Color" ] = value;
  10248. });
  10249. return expanded;
  10250. }
  10251. };
  10252. // Basic color names only.
  10253. // Usage of any of the other color names requires adding yourself or including
  10254. // jquery.color.svg-names.js.
  10255. colors = jQuery.Color.names = {
  10256. // 4.1. Basic color keywords
  10257. aqua: "#00ffff",
  10258. black: "#000000",
  10259. blue: "#0000ff",
  10260. fuchsia: "#ff00ff",
  10261. gray: "#808080",
  10262. green: "#008000",
  10263. lime: "#00ff00",
  10264. maroon: "#800000",
  10265. navy: "#000080",
  10266. olive: "#808000",
  10267. purple: "#800080",
  10268. red: "#ff0000",
  10269. silver: "#c0c0c0",
  10270. teal: "#008080",
  10271. white: "#ffffff",
  10272. yellow: "#ffff00",
  10273. // 4.2.3. "transparent" color keyword
  10274. transparent: [ null, null, null, 0 ],
  10275. _default: "#ffffff"
  10276. };
  10277. })( jQuery );
  10278. /******************************************************************************/
  10279. /****************************** CLASS ANIMATIONS ******************************/
  10280. /******************************************************************************/
  10281. (function() {
  10282. var classAnimationActions = [ "add", "remove", "toggle" ],
  10283. shorthandStyles = {
  10284. border: 1,
  10285. borderBottom: 1,
  10286. borderColor: 1,
  10287. borderLeft: 1,
  10288. borderRight: 1,
  10289. borderTop: 1,
  10290. borderWidth: 1,
  10291. margin: 1,
  10292. padding: 1
  10293. };
  10294. $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
  10295. $.fx.step[ prop ] = function( fx ) {
  10296. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  10297. jQuery.style( fx.elem, prop, fx.end );
  10298. fx.setAttr = true;
  10299. }
  10300. };
  10301. });
  10302. function getElementStyles( elem ) {
  10303. var key, len,
  10304. style = elem.ownerDocument.defaultView ?
  10305. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  10306. elem.currentStyle,
  10307. styles = {};
  10308. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  10309. len = style.length;
  10310. while ( len-- ) {
  10311. key = style[ len ];
  10312. if ( typeof style[ key ] === "string" ) {
  10313. styles[ $.camelCase( key ) ] = style[ key ];
  10314. }
  10315. }
  10316. // support: Opera, IE <9
  10317. } else {
  10318. for ( key in style ) {
  10319. if ( typeof style[ key ] === "string" ) {
  10320. styles[ key ] = style[ key ];
  10321. }
  10322. }
  10323. }
  10324. return styles;
  10325. }
  10326. function styleDifference( oldStyle, newStyle ) {
  10327. var diff = {},
  10328. name, value;
  10329. for ( name in newStyle ) {
  10330. value = newStyle[ name ];
  10331. if ( oldStyle[ name ] !== value ) {
  10332. if ( !shorthandStyles[ name ] ) {
  10333. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  10334. diff[ name ] = value;
  10335. }
  10336. }
  10337. }
  10338. }
  10339. return diff;
  10340. }
  10341. // support: jQuery <1.8
  10342. if ( !$.fn.addBack ) {
  10343. $.fn.addBack = function( selector ) {
  10344. return this.add( selector == null ?
  10345. this.prevObject : this.prevObject.filter( selector )
  10346. );
  10347. };
  10348. }
  10349. $.effects.animateClass = function( value, duration, easing, callback ) {
  10350. var o = $.speed( duration, easing, callback );
  10351. return this.queue( function() {
  10352. var animated = $( this ),
  10353. baseClass = animated.attr( "class" ) || "",
  10354. applyClassChange,
  10355. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  10356. // map the animated objects to store the original styles.
  10357. allAnimations = allAnimations.map(function() {
  10358. var el = $( this );
  10359. return {
  10360. el: el,
  10361. start: getElementStyles( this )
  10362. };
  10363. });
  10364. // apply class change
  10365. applyClassChange = function() {
  10366. $.each( classAnimationActions, function(i, action) {
  10367. if ( value[ action ] ) {
  10368. animated[ action + "Class" ]( value[ action ] );
  10369. }
  10370. });
  10371. };
  10372. applyClassChange();
  10373. // map all animated objects again - calculate new styles and diff
  10374. allAnimations = allAnimations.map(function() {
  10375. this.end = getElementStyles( this.el[ 0 ] );
  10376. this.diff = styleDifference( this.start, this.end );
  10377. return this;
  10378. });
  10379. // apply original class
  10380. animated.attr( "class", baseClass );
  10381. // map all animated objects again - this time collecting a promise
  10382. allAnimations = allAnimations.map(function() {
  10383. var styleInfo = this,
  10384. dfd = $.Deferred(),
  10385. opts = $.extend({}, o, {
  10386. queue: false,
  10387. complete: function() {
  10388. dfd.resolve( styleInfo );
  10389. }
  10390. });
  10391. this.el.animate( this.diff, opts );
  10392. return dfd.promise();
  10393. });
  10394. // once all animations have completed:
  10395. $.when.apply( $, allAnimations.get() ).done(function() {
  10396. // set the final class
  10397. applyClassChange();
  10398. // for each animated element,
  10399. // clear all css properties that were animated
  10400. $.each( arguments, function() {
  10401. var el = this.el;
  10402. $.each( this.diff, function(key) {
  10403. el.css( key, "" );
  10404. });
  10405. });
  10406. // this is guarnteed to be there if you use jQuery.speed()
  10407. // it also handles dequeuing the next anim...
  10408. o.complete.call( animated[ 0 ] );
  10409. });
  10410. });
  10411. };
  10412. $.fn.extend({
  10413. addClass: (function( orig ) {
  10414. return function( classNames, speed, easing, callback ) {
  10415. return speed ?
  10416. $.effects.animateClass.call( this,
  10417. { add: classNames }, speed, easing, callback ) :
  10418. orig.apply( this, arguments );
  10419. };
  10420. })( $.fn.addClass ),
  10421. removeClass: (function( orig ) {
  10422. return function( classNames, speed, easing, callback ) {
  10423. return arguments.length > 1 ?
  10424. $.effects.animateClass.call( this,
  10425. { remove: classNames }, speed, easing, callback ) :
  10426. orig.apply( this, arguments );
  10427. };
  10428. })( $.fn.removeClass ),
  10429. toggleClass: (function( orig ) {
  10430. return function( classNames, force, speed, easing, callback ) {
  10431. if ( typeof force === "boolean" || force === undefined ) {
  10432. if ( !speed ) {
  10433. // without speed parameter
  10434. return orig.apply( this, arguments );
  10435. } else {
  10436. return $.effects.animateClass.call( this,
  10437. (force ? { add: classNames } : { remove: classNames }),
  10438. speed, easing, callback );
  10439. }
  10440. } else {
  10441. // without force parameter
  10442. return $.effects.animateClass.call( this,
  10443. { toggle: classNames }, force, speed, easing );
  10444. }
  10445. };
  10446. })( $.fn.toggleClass ),
  10447. switchClass: function( remove, add, speed, easing, callback) {
  10448. return $.effects.animateClass.call( this, {
  10449. add: add,
  10450. remove: remove
  10451. }, speed, easing, callback );
  10452. }
  10453. });
  10454. })();
  10455. /******************************************************************************/
  10456. /*********************************** EFFECTS **********************************/
  10457. /******************************************************************************/
  10458. (function() {
  10459. $.extend( $.effects, {
  10460. version: "1.11.4",
  10461. // Saves a set of properties in a data storage
  10462. save: function( element, set ) {
  10463. for ( var i = 0; i < set.length; i++ ) {
  10464. if ( set[ i ] !== null ) {
  10465. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  10466. }
  10467. }
  10468. },
  10469. // Restores a set of previously saved properties from a data storage
  10470. restore: function( element, set ) {
  10471. var val, i;
  10472. for ( i = 0; i < set.length; i++ ) {
  10473. if ( set[ i ] !== null ) {
  10474. val = element.data( dataSpace + set[ i ] );
  10475. // support: jQuery 1.6.2
  10476. // http://bugs.jquery.com/ticket/9917
  10477. // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
  10478. // We can't differentiate between "" and 0 here, so we just assume
  10479. // empty string since it's likely to be a more common value...
  10480. if ( val === undefined ) {
  10481. val = "";
  10482. }
  10483. element.css( set[ i ], val );
  10484. }
  10485. }
  10486. },
  10487. setMode: function( el, mode ) {
  10488. if (mode === "toggle") {
  10489. mode = el.is( ":hidden" ) ? "show" : "hide";
  10490. }
  10491. return mode;
  10492. },
  10493. // Translates a [top,left] array into a baseline value
  10494. // this should be a little more flexible in the future to handle a string & hash
  10495. getBaseline: function( origin, original ) {
  10496. var y, x;
  10497. switch ( origin[ 0 ] ) {
  10498. case "top": y = 0; break;
  10499. case "middle": y = 0.5; break;
  10500. case "bottom": y = 1; break;
  10501. default: y = origin[ 0 ] / original.height;
  10502. }
  10503. switch ( origin[ 1 ] ) {
  10504. case "left": x = 0; break;
  10505. case "center": x = 0.5; break;
  10506. case "right": x = 1; break;
  10507. default: x = origin[ 1 ] / original.width;
  10508. }
  10509. return {
  10510. x: x,
  10511. y: y
  10512. };
  10513. },
  10514. // Wraps the element around a wrapper that copies position properties
  10515. createWrapper: function( element ) {
  10516. // if the element is already wrapped, return it
  10517. if ( element.parent().is( ".ui-effects-wrapper" )) {
  10518. return element.parent();
  10519. }
  10520. // wrap the element
  10521. var props = {
  10522. width: element.outerWidth(true),
  10523. height: element.outerHeight(true),
  10524. "float": element.css( "float" )
  10525. },
  10526. wrapper = $( "<div></div>" )
  10527. .addClass( "ui-effects-wrapper" )
  10528. .css({
  10529. fontSize: "100%",
  10530. background: "transparent",
  10531. border: "none",
  10532. margin: 0,
  10533. padding: 0
  10534. }),
  10535. // Store the size in case width/height are defined in % - Fixes #5245
  10536. size = {
  10537. width: element.width(),
  10538. height: element.height()
  10539. },
  10540. active = document.activeElement;
  10541. // support: Firefox
  10542. // Firefox incorrectly exposes anonymous content
  10543. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  10544. try {
  10545. active.id;
  10546. } catch ( e ) {
  10547. active = document.body;
  10548. }
  10549. element.wrap( wrapper );
  10550. // Fixes #7595 - Elements lose focus when wrapped.
  10551. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  10552. $( active ).focus();
  10553. }
  10554. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
  10555. // transfer positioning properties to the wrapper
  10556. if ( element.css( "position" ) === "static" ) {
  10557. wrapper.css({ position: "relative" });
  10558. element.css({ position: "relative" });
  10559. } else {
  10560. $.extend( props, {
  10561. position: element.css( "position" ),
  10562. zIndex: element.css( "z-index" )
  10563. });
  10564. $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
  10565. props[ pos ] = element.css( pos );
  10566. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  10567. props[ pos ] = "auto";
  10568. }
  10569. });
  10570. element.css({
  10571. position: "relative",
  10572. top: 0,
  10573. left: 0,
  10574. right: "auto",
  10575. bottom: "auto"
  10576. });
  10577. }
  10578. element.css(size);
  10579. return wrapper.css( props ).show();
  10580. },
  10581. removeWrapper: function( element ) {
  10582. var active = document.activeElement;
  10583. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  10584. element.parent().replaceWith( element );
  10585. // Fixes #7595 - Elements lose focus when wrapped.
  10586. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  10587. $( active ).focus();
  10588. }
  10589. }
  10590. return element;
  10591. },
  10592. setTransition: function( element, list, factor, value ) {
  10593. value = value || {};
  10594. $.each( list, function( i, x ) {
  10595. var unit = element.cssUnit( x );
  10596. if ( unit[ 0 ] > 0 ) {
  10597. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  10598. }
  10599. });
  10600. return value;
  10601. }
  10602. });
  10603. // return an effect options object for the given parameters:
  10604. function _normalizeArguments( effect, options, speed, callback ) {
  10605. // allow passing all options as the first parameter
  10606. if ( $.isPlainObject( effect ) ) {
  10607. options = effect;
  10608. effect = effect.effect;
  10609. }
  10610. // convert to an object
  10611. effect = { effect: effect };
  10612. // catch (effect, null, ...)
  10613. if ( options == null ) {
  10614. options = {};
  10615. }
  10616. // catch (effect, callback)
  10617. if ( $.isFunction( options ) ) {
  10618. callback = options;
  10619. speed = null;
  10620. options = {};
  10621. }
  10622. // catch (effect, speed, ?)
  10623. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  10624. callback = speed;
  10625. speed = options;
  10626. options = {};
  10627. }
  10628. // catch (effect, options, callback)
  10629. if ( $.isFunction( speed ) ) {
  10630. callback = speed;
  10631. speed = null;
  10632. }
  10633. // add options to effect
  10634. if ( options ) {
  10635. $.extend( effect, options );
  10636. }
  10637. speed = speed || options.duration;
  10638. effect.duration = $.fx.off ? 0 :
  10639. typeof speed === "number" ? speed :
  10640. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  10641. $.fx.speeds._default;
  10642. effect.complete = callback || options.complete;
  10643. return effect;
  10644. }
  10645. function standardAnimationOption( option ) {
  10646. // Valid standard speeds (nothing, number, named speed)
  10647. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  10648. return true;
  10649. }
  10650. // Invalid strings - treat as "normal" speed
  10651. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  10652. return true;
  10653. }
  10654. // Complete callback
  10655. if ( $.isFunction( option ) ) {
  10656. return true;
  10657. }
  10658. // Options hash (but not naming an effect)
  10659. if ( typeof option === "object" && !option.effect ) {
  10660. return true;
  10661. }
  10662. // Didn't match any standard API
  10663. return false;
  10664. }
  10665. $.fn.extend({
  10666. effect: function( /* effect, options, speed, callback */ ) {
  10667. var args = _normalizeArguments.apply( this, arguments ),
  10668. mode = args.mode,
  10669. queue = args.queue,
  10670. effectMethod = $.effects.effect[ args.effect ];
  10671. if ( $.fx.off || !effectMethod ) {
  10672. // delegate to the original method (e.g., .show()) if possible
  10673. if ( mode ) {
  10674. return this[ mode ]( args.duration, args.complete );
  10675. } else {
  10676. return this.each( function() {
  10677. if ( args.complete ) {
  10678. args.complete.call( this );
  10679. }
  10680. });
  10681. }
  10682. }
  10683. function run( next ) {
  10684. var elem = $( this ),
  10685. complete = args.complete,
  10686. mode = args.mode;
  10687. function done() {
  10688. if ( $.isFunction( complete ) ) {
  10689. complete.call( elem[0] );
  10690. }
  10691. if ( $.isFunction( next ) ) {
  10692. next();
  10693. }
  10694. }
  10695. // If the element already has the correct final state, delegate to
  10696. // the core methods so the internal tracking of "olddisplay" works.
  10697. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  10698. elem[ mode ]();
  10699. done();
  10700. } else {
  10701. effectMethod.call( elem[0], args, done );
  10702. }
  10703. }
  10704. return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
  10705. },
  10706. show: (function( orig ) {
  10707. return function( option ) {
  10708. if ( standardAnimationOption( option ) ) {
  10709. return orig.apply( this, arguments );
  10710. } else {
  10711. var args = _normalizeArguments.apply( this, arguments );
  10712. args.mode = "show";
  10713. return this.effect.call( this, args );
  10714. }
  10715. };
  10716. })( $.fn.show ),
  10717. hide: (function( orig ) {
  10718. return function( option ) {
  10719. if ( standardAnimationOption( option ) ) {
  10720. return orig.apply( this, arguments );
  10721. } else {
  10722. var args = _normalizeArguments.apply( this, arguments );
  10723. args.mode = "hide";
  10724. return this.effect.call( this, args );
  10725. }
  10726. };
  10727. })( $.fn.hide ),
  10728. toggle: (function( orig ) {
  10729. return function( option ) {
  10730. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  10731. return orig.apply( this, arguments );
  10732. } else {
  10733. var args = _normalizeArguments.apply( this, arguments );
  10734. args.mode = "toggle";
  10735. return this.effect.call( this, args );
  10736. }
  10737. };
  10738. })( $.fn.toggle ),
  10739. // helper functions
  10740. cssUnit: function(key) {
  10741. var style = this.css( key ),
  10742. val = [];
  10743. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  10744. if ( style.indexOf( unit ) > 0 ) {
  10745. val = [ parseFloat( style ), unit ];
  10746. }
  10747. });
  10748. return val;
  10749. }
  10750. });
  10751. })();
  10752. /******************************************************************************/
  10753. /*********************************** EASING ***********************************/
  10754. /******************************************************************************/
  10755. (function() {
  10756. // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  10757. var baseEasings = {};
  10758. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  10759. baseEasings[ name ] = function( p ) {
  10760. return Math.pow( p, i + 2 );
  10761. };
  10762. });
  10763. $.extend( baseEasings, {
  10764. Sine: function( p ) {
  10765. return 1 - Math.cos( p * Math.PI / 2 );
  10766. },
  10767. Circ: function( p ) {
  10768. return 1 - Math.sqrt( 1 - p * p );
  10769. },
  10770. Elastic: function( p ) {
  10771. return p === 0 || p === 1 ? p :
  10772. -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
  10773. },
  10774. Back: function( p ) {
  10775. return p * p * ( 3 * p - 2 );
  10776. },
  10777. Bounce: function( p ) {
  10778. var pow2,
  10779. bounce = 4;
  10780. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  10781. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  10782. }
  10783. });
  10784. $.each( baseEasings, function( name, easeIn ) {
  10785. $.easing[ "easeIn" + name ] = easeIn;
  10786. $.easing[ "easeOut" + name ] = function( p ) {
  10787. return 1 - easeIn( 1 - p );
  10788. };
  10789. $.easing[ "easeInOut" + name ] = function( p ) {
  10790. return p < 0.5 ?
  10791. easeIn( p * 2 ) / 2 :
  10792. 1 - easeIn( p * -2 + 2 ) / 2;
  10793. };
  10794. });
  10795. })();
  10796. return $.effects;
  10797. }));
  10798. /*!
  10799. * jQuery UI Core 1.11.4
  10800. * http://jqueryui.com
  10801. *
  10802. * Copyright jQuery Foundation and other contributors
  10803. * Released under the MIT license.
  10804. * http://jquery.org/license
  10805. *
  10806. * http://api.jqueryui.com/category/ui-core/
  10807. */
  10808. (function( factory ) {
  10809. if ( typeof define === "function" && define.amd ) {
  10810. // AMD. Register as an anonymous module.
  10811. define( [ "jquery" ], factory );
  10812. } else {
  10813. // Browser globals
  10814. factory( jQuery );
  10815. }
  10816. }(function( $ ) {
  10817. // $.ui might exist from components with no dependencies, e.g., $.ui.position
  10818. $.ui = $.ui || {};
  10819. $.extend( $.ui, {
  10820. version: "1.11.4",
  10821. keyCode: {
  10822. BACKSPACE: 8,
  10823. COMMA: 188,
  10824. DELETE: 46,
  10825. DOWN: 40,
  10826. END: 35,
  10827. ENTER: 13,
  10828. ESCAPE: 27,
  10829. HOME: 36,
  10830. LEFT: 37,
  10831. PAGE_DOWN: 34,
  10832. PAGE_UP: 33,
  10833. PERIOD: 190,
  10834. RIGHT: 39,
  10835. SPACE: 32,
  10836. TAB: 9,
  10837. UP: 38
  10838. }
  10839. });
  10840. // plugins
  10841. $.fn.extend({
  10842. scrollParent: function( includeHidden ) {
  10843. var position = this.css( "position" ),
  10844. excludeStaticParent = position === "absolute",
  10845. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  10846. scrollParent = this.parents().filter( function() {
  10847. var parent = $( this );
  10848. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  10849. return false;
  10850. }
  10851. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
  10852. }).eq( 0 );
  10853. return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
  10854. },
  10855. uniqueId: (function() {
  10856. var uuid = 0;
  10857. return function() {
  10858. return this.each(function() {
  10859. if ( !this.id ) {
  10860. this.id = "ui-id-" + ( ++uuid );
  10861. }
  10862. });
  10863. };
  10864. })(),
  10865. removeUniqueId: function() {
  10866. return this.each(function() {
  10867. if ( /^ui-id-\d+$/.test( this.id ) ) {
  10868. $( this ).removeAttr( "id" );
  10869. }
  10870. });
  10871. }
  10872. });
  10873. // selectors
  10874. function focusable( element, isTabIndexNotNaN ) {
  10875. var map, mapName, img,
  10876. nodeName = element.nodeName.toLowerCase();
  10877. if ( "area" === nodeName ) {
  10878. map = element.parentNode;
  10879. mapName = map.name;
  10880. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  10881. return false;
  10882. }
  10883. img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
  10884. return !!img && visible( img );
  10885. }
  10886. return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
  10887. !element.disabled :
  10888. "a" === nodeName ?
  10889. element.href || isTabIndexNotNaN :
  10890. isTabIndexNotNaN) &&
  10891. // the element and all of its ancestors must be visible
  10892. visible( element );
  10893. }
  10894. function visible( element ) {
  10895. return $.expr.filters.visible( element ) &&
  10896. !$( element ).parents().addBack().filter(function() {
  10897. return $.css( this, "visibility" ) === "hidden";
  10898. }).length;
  10899. }
  10900. $.extend( $.expr[ ":" ], {
  10901. data: $.expr.createPseudo ?
  10902. $.expr.createPseudo(function( dataName ) {
  10903. return function( elem ) {
  10904. return !!$.data( elem, dataName );
  10905. };
  10906. }) :
  10907. // support: jQuery <1.8
  10908. function( elem, i, match ) {
  10909. return !!$.data( elem, match[ 3 ] );
  10910. },
  10911. focusable: function( element ) {
  10912. return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
  10913. },
  10914. tabbable: function( element ) {
  10915. var tabIndex = $.attr( element, "tabindex" ),
  10916. isTabIndexNaN = isNaN( tabIndex );
  10917. return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
  10918. }
  10919. });
  10920. // support: jQuery <1.8
  10921. if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
  10922. $.each( [ "Width", "Height" ], function( i, name ) {
  10923. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  10924. type = name.toLowerCase(),
  10925. orig = {
  10926. innerWidth: $.fn.innerWidth,
  10927. innerHeight: $.fn.innerHeight,
  10928. outerWidth: $.fn.outerWidth,
  10929. outerHeight: $.fn.outerHeight
  10930. };
  10931. function reduce( elem, size, border, margin ) {
  10932. $.each( side, function() {
  10933. size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
  10934. if ( border ) {
  10935. size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
  10936. }
  10937. if ( margin ) {
  10938. size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
  10939. }
  10940. });
  10941. return size;
  10942. }
  10943. $.fn[ "inner" + name ] = function( size ) {
  10944. if ( size === undefined ) {
  10945. return orig[ "inner" + name ].call( this );
  10946. }
  10947. return this.each(function() {
  10948. $( this ).css( type, reduce( this, size ) + "px" );
  10949. });
  10950. };
  10951. $.fn[ "outer" + name] = function( size, margin ) {
  10952. if ( typeof size !== "number" ) {
  10953. return orig[ "outer" + name ].call( this, size );
  10954. }
  10955. return this.each(function() {
  10956. $( this).css( type, reduce( this, size, true, margin ) + "px" );
  10957. });
  10958. };
  10959. });
  10960. }
  10961. // support: jQuery <1.8
  10962. if ( !$.fn.addBack ) {
  10963. $.fn.addBack = function( selector ) {
  10964. return this.add( selector == null ?
  10965. this.prevObject : this.prevObject.filter( selector )
  10966. );
  10967. };
  10968. }
  10969. // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
  10970. if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
  10971. $.fn.removeData = (function( removeData ) {
  10972. return function( key ) {
  10973. if ( arguments.length ) {
  10974. return removeData.call( this, $.camelCase( key ) );
  10975. } else {
  10976. return removeData.call( this );
  10977. }
  10978. };
  10979. })( $.fn.removeData );
  10980. }
  10981. // deprecated
  10982. $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  10983. $.fn.extend({
  10984. focus: (function( orig ) {
  10985. return function( delay, fn ) {
  10986. return typeof delay === "number" ?
  10987. this.each(function() {
  10988. var elem = this;
  10989. setTimeout(function() {
  10990. $( elem ).focus();
  10991. if ( fn ) {
  10992. fn.call( elem );
  10993. }
  10994. }, delay );
  10995. }) :
  10996. orig.apply( this, arguments );
  10997. };
  10998. })( $.fn.focus ),
  10999. disableSelection: (function() {
  11000. var eventType = "onselectstart" in document.createElement( "div" ) ?
  11001. "selectstart" :
  11002. "mousedown";
  11003. return function() {
  11004. return this.bind( eventType + ".ui-disableSelection", function( event ) {
  11005. event.preventDefault();
  11006. });
  11007. };
  11008. })(),
  11009. enableSelection: function() {
  11010. return this.unbind( ".ui-disableSelection" );
  11011. },
  11012. zIndex: function( zIndex ) {
  11013. if ( zIndex !== undefined ) {
  11014. return this.css( "zIndex", zIndex );
  11015. }
  11016. if ( this.length ) {
  11017. var elem = $( this[ 0 ] ), position, value;
  11018. while ( elem.length && elem[ 0 ] !== document ) {
  11019. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  11020. // This makes behavior of this function consistent across browsers
  11021. // WebKit always returns auto if the element is positioned
  11022. position = elem.css( "position" );
  11023. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  11024. // IE returns 0 when zIndex is not specified
  11025. // other browsers return a string
  11026. // we ignore the case of nested elements with an explicit value of 0
  11027. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  11028. value = parseInt( elem.css( "zIndex" ), 10 );
  11029. if ( !isNaN( value ) && value !== 0 ) {
  11030. return value;
  11031. }
  11032. }
  11033. elem = elem.parent();
  11034. }
  11035. }
  11036. return 0;
  11037. }
  11038. });
  11039. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  11040. $.ui.plugin = {
  11041. add: function( module, option, set ) {
  11042. var i,
  11043. proto = $.ui[ module ].prototype;
  11044. for ( i in set ) {
  11045. proto.plugins[ i ] = proto.plugins[ i ] || [];
  11046. proto.plugins[ i ].push( [ option, set[ i ] ] );
  11047. }
  11048. },
  11049. call: function( instance, name, args, allowDisconnected ) {
  11050. var i,
  11051. set = instance.plugins[ name ];
  11052. if ( !set ) {
  11053. return;
  11054. }
  11055. if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  11056. return;
  11057. }
  11058. for ( i = 0; i < set.length; i++ ) {
  11059. if ( instance.options[ set[ i ][ 0 ] ] ) {
  11060. set[ i ][ 1 ].apply( instance.element, args );
  11061. }
  11062. }
  11063. }
  11064. };
  11065. }));
  11066. /*!
  11067. * jQuery UI Widget 1.11.4
  11068. * http://jqueryui.com
  11069. *
  11070. * Copyright jQuery Foundation and other contributors
  11071. * Released under the MIT license.
  11072. * http://jquery.org/license
  11073. *
  11074. * http://api.jqueryui.com/jQuery.widget/
  11075. */
  11076. (function( factory ) {
  11077. if ( typeof define === "function" && define.amd ) {
  11078. // AMD. Register as an anonymous module.
  11079. define( [ "jquery" ], factory );
  11080. } else {
  11081. // Browser globals
  11082. factory( jQuery );
  11083. }
  11084. }(function( $ ) {
  11085. var widget_uuid = 0,
  11086. widget_slice = Array.prototype.slice;
  11087. $.cleanData = (function( orig ) {
  11088. return function( elems ) {
  11089. var events, elem, i;
  11090. for ( i = 0; (elem = elems[i]) != null; i++ ) {
  11091. try {
  11092. // Only trigger remove when necessary to save time
  11093. events = $._data( elem, "events" );
  11094. if ( events && events.remove ) {
  11095. $( elem ).triggerHandler( "remove" );
  11096. }
  11097. // http://bugs.jquery.com/ticket/8235
  11098. } catch ( e ) {}
  11099. }
  11100. orig( elems );
  11101. };
  11102. })( $.cleanData );
  11103. $.widget = function( name, base, prototype ) {
  11104. var fullName, existingConstructor, constructor, basePrototype,
  11105. // proxiedPrototype allows the provided prototype to remain unmodified
  11106. // so that it can be used as a mixin for multiple widgets (#8876)
  11107. proxiedPrototype = {},
  11108. namespace = name.split( "." )[ 0 ];
  11109. name = name.split( "." )[ 1 ];
  11110. fullName = namespace + "-" + name;
  11111. if ( !prototype ) {
  11112. prototype = base;
  11113. base = $.Widget;
  11114. }
  11115. // create selector for plugin
  11116. $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
  11117. return !!$.data( elem, fullName );
  11118. };
  11119. $[ namespace ] = $[ namespace ] || {};
  11120. existingConstructor = $[ namespace ][ name ];
  11121. constructor = $[ namespace ][ name ] = function( options, element ) {
  11122. // allow instantiation without "new" keyword
  11123. if ( !this._createWidget ) {
  11124. return new constructor( options, element );
  11125. }
  11126. // allow instantiation without initializing for simple inheritance
  11127. // must use "new" keyword (the code above always passes args)
  11128. if ( arguments.length ) {
  11129. this._createWidget( options, element );
  11130. }
  11131. };
  11132. // extend with the existing constructor to carry over any static properties
  11133. $.extend( constructor, existingConstructor, {
  11134. version: prototype.version,
  11135. // copy the object used to create the prototype in case we need to
  11136. // redefine the widget later
  11137. _proto: $.extend( {}, prototype ),
  11138. // track widgets that inherit from this widget in case this widget is
  11139. // redefined after a widget inherits from it
  11140. _childConstructors: []
  11141. });
  11142. basePrototype = new base();
  11143. // we need to make the options hash a property directly on the new instance
  11144. // otherwise we'll modify the options hash on the prototype that we're
  11145. // inheriting from
  11146. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  11147. $.each( prototype, function( prop, value ) {
  11148. if ( !$.isFunction( value ) ) {
  11149. proxiedPrototype[ prop ] = value;
  11150. return;
  11151. }
  11152. proxiedPrototype[ prop ] = (function() {
  11153. var _super = function() {
  11154. return base.prototype[ prop ].apply( this, arguments );
  11155. },
  11156. _superApply = function( args ) {
  11157. return base.prototype[ prop ].apply( this, args );
  11158. };
  11159. return function() {
  11160. var __super = this._super,
  11161. __superApply = this._superApply,
  11162. returnValue;
  11163. this._super = _super;
  11164. this._superApply = _superApply;
  11165. returnValue = value.apply( this, arguments );
  11166. this._super = __super;
  11167. this._superApply = __superApply;
  11168. return returnValue;
  11169. };
  11170. })();
  11171. });
  11172. constructor.prototype = $.widget.extend( basePrototype, {
  11173. // TODO: remove support for widgetEventPrefix
  11174. // always use the name + a colon as the prefix, e.g., draggable:start
  11175. // don't prefix for widgets that aren't DOM-based
  11176. widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
  11177. }, proxiedPrototype, {
  11178. constructor: constructor,
  11179. namespace: namespace,
  11180. widgetName: name,
  11181. widgetFullName: fullName
  11182. });
  11183. // If this widget is being redefined then we need to find all widgets that
  11184. // are inheriting from it and redefine all of them so that they inherit from
  11185. // the new version of this widget. We're essentially trying to replace one
  11186. // level in the prototype chain.
  11187. if ( existingConstructor ) {
  11188. $.each( existingConstructor._childConstructors, function( i, child ) {
  11189. var childPrototype = child.prototype;
  11190. // redefine the child widget using the same prototype that was
  11191. // originally used, but inherit from the new version of the base
  11192. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
  11193. });
  11194. // remove the list of existing child constructors from the old constructor
  11195. // so the old child constructors can be garbage collected
  11196. delete existingConstructor._childConstructors;
  11197. } else {
  11198. base._childConstructors.push( constructor );
  11199. }
  11200. $.widget.bridge( name, constructor );
  11201. return constructor;
  11202. };
  11203. $.widget.extend = function( target ) {
  11204. var input = widget_slice.call( arguments, 1 ),
  11205. inputIndex = 0,
  11206. inputLength = input.length,
  11207. key,
  11208. value;
  11209. for ( ; inputIndex < inputLength; inputIndex++ ) {
  11210. for ( key in input[ inputIndex ] ) {
  11211. value = input[ inputIndex ][ key ];
  11212. if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
  11213. // Clone objects
  11214. if ( $.isPlainObject( value ) ) {
  11215. target[ key ] = $.isPlainObject( target[ key ] ) ?
  11216. $.widget.extend( {}, target[ key ], value ) :
  11217. // Don't extend strings, arrays, etc. with objects
  11218. $.widget.extend( {}, value );
  11219. // Copy everything else by reference
  11220. } else {
  11221. target[ key ] = value;
  11222. }
  11223. }
  11224. }
  11225. }
  11226. return target;
  11227. };
  11228. $.widget.bridge = function( name, object ) {
  11229. var fullName = object.prototype.widgetFullName || name;
  11230. $.fn[ name ] = function( options ) {
  11231. var isMethodCall = typeof options === "string",
  11232. args = widget_slice.call( arguments, 1 ),
  11233. returnValue = this;
  11234. if ( isMethodCall ) {
  11235. this.each(function() {
  11236. var methodValue,
  11237. instance = $.data( this, fullName );
  11238. if ( options === "instance" ) {
  11239. returnValue = instance;
  11240. return false;
  11241. }
  11242. if ( !instance ) {
  11243. return $.error( "cannot call methods on " + name + " prior to initialization; " +
  11244. "attempted to call method '" + options + "'" );
  11245. }
  11246. if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
  11247. return $.error( "no such method '" + options + "' for " + name + " widget instance" );
  11248. }
  11249. methodValue = instance[ options ].apply( instance, args );
  11250. if ( methodValue !== instance && methodValue !== undefined ) {
  11251. returnValue = methodValue && methodValue.jquery ?
  11252. returnValue.pushStack( methodValue.get() ) :
  11253. methodValue;
  11254. return false;
  11255. }
  11256. });
  11257. } else {
  11258. // Allow multiple hashes to be passed on init
  11259. if ( args.length ) {
  11260. options = $.widget.extend.apply( null, [ options ].concat(args) );
  11261. }
  11262. this.each(function() {
  11263. var instance = $.data( this, fullName );
  11264. if ( instance ) {
  11265. instance.option( options || {} );
  11266. if ( instance._init ) {
  11267. instance._init();
  11268. }
  11269. } else {
  11270. $.data( this, fullName, new object( options, this ) );
  11271. }
  11272. });
  11273. }
  11274. return returnValue;
  11275. };
  11276. };
  11277. $.Widget = function( /* options, element */ ) {};
  11278. $.Widget._childConstructors = [];
  11279. $.Widget.prototype = {
  11280. widgetName: "widget",
  11281. widgetEventPrefix: "",
  11282. defaultElement: "<div>",
  11283. options: {
  11284. disabled: false,
  11285. // callbacks
  11286. create: null
  11287. },
  11288. _createWidget: function( options, element ) {
  11289. element = $( element || this.defaultElement || this )[ 0 ];
  11290. this.element = $( element );
  11291. this.uuid = widget_uuid++;
  11292. this.eventNamespace = "." + this.widgetName + this.uuid;
  11293. this.bindings = $();
  11294. this.hoverable = $();
  11295. this.focusable = $();
  11296. if ( element !== this ) {
  11297. $.data( element, this.widgetFullName, this );
  11298. this._on( true, this.element, {
  11299. remove: function( event ) {
  11300. if ( event.target === element ) {
  11301. this.destroy();
  11302. }
  11303. }
  11304. });
  11305. this.document = $( element.style ?
  11306. // element within the document
  11307. element.ownerDocument :
  11308. // element is window or document
  11309. element.document || element );
  11310. this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
  11311. }
  11312. this.options = $.widget.extend( {},
  11313. this.options,
  11314. this._getCreateOptions(),
  11315. options );
  11316. this._create();
  11317. this._trigger( "create", null, this._getCreateEventData() );
  11318. this._init();
  11319. },
  11320. _getCreateOptions: $.noop,
  11321. _getCreateEventData: $.noop,
  11322. _create: $.noop,
  11323. _init: $.noop,
  11324. destroy: function() {
  11325. this._destroy();
  11326. // we can probably remove the unbind calls in 2.0
  11327. // all event bindings should go through this._on()
  11328. this.element
  11329. .unbind( this.eventNamespace )
  11330. .removeData( this.widgetFullName )
  11331. // support: jquery <1.6.3
  11332. // http://bugs.jquery.com/ticket/9413
  11333. .removeData( $.camelCase( this.widgetFullName ) );
  11334. this.widget()
  11335. .unbind( this.eventNamespace )
  11336. .removeAttr( "aria-disabled" )
  11337. .removeClass(
  11338. this.widgetFullName + "-disabled " +
  11339. "ui-state-disabled" );
  11340. // clean up events and states
  11341. this.bindings.unbind( this.eventNamespace );
  11342. this.hoverable.removeClass( "ui-state-hover" );
  11343. this.focusable.removeClass( "ui-state-focus" );
  11344. },
  11345. _destroy: $.noop,
  11346. widget: function() {
  11347. return this.element;
  11348. },
  11349. option: function( key, value ) {
  11350. var options = key,
  11351. parts,
  11352. curOption,
  11353. i;
  11354. if ( arguments.length === 0 ) {
  11355. // don't return a reference to the internal hash
  11356. return $.widget.extend( {}, this.options );
  11357. }
  11358. if ( typeof key === "string" ) {
  11359. // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  11360. options = {};
  11361. parts = key.split( "." );
  11362. key = parts.shift();
  11363. if ( parts.length ) {
  11364. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  11365. for ( i = 0; i < parts.length - 1; i++ ) {
  11366. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  11367. curOption = curOption[ parts[ i ] ];
  11368. }
  11369. key = parts.pop();
  11370. if ( arguments.length === 1 ) {
  11371. return curOption[ key ] === undefined ? null : curOption[ key ];
  11372. }
  11373. curOption[ key ] = value;
  11374. } else {
  11375. if ( arguments.length === 1 ) {
  11376. return this.options[ key ] === undefined ? null : this.options[ key ];
  11377. }
  11378. options[ key ] = value;
  11379. }
  11380. }
  11381. this._setOptions( options );
  11382. return this;
  11383. },
  11384. _setOptions: function( options ) {
  11385. var key;
  11386. for ( key in options ) {
  11387. this._setOption( key, options[ key ] );
  11388. }
  11389. return this;
  11390. },
  11391. _setOption: function( key, value ) {
  11392. this.options[ key ] = value;
  11393. if ( key === "disabled" ) {
  11394. this.widget()
  11395. .toggleClass( this.widgetFullName + "-disabled", !!value );
  11396. // If the widget is becoming disabled, then nothing is interactive
  11397. if ( value ) {
  11398. this.hoverable.removeClass( "ui-state-hover" );
  11399. this.focusable.removeClass( "ui-state-focus" );
  11400. }
  11401. }
  11402. return this;
  11403. },
  11404. enable: function() {
  11405. return this._setOptions({ disabled: false });
  11406. },
  11407. disable: function() {
  11408. return this._setOptions({ disabled: true });
  11409. },
  11410. _on: function( suppressDisabledCheck, element, handlers ) {
  11411. var delegateElement,
  11412. instance = this;
  11413. // no suppressDisabledCheck flag, shuffle arguments
  11414. if ( typeof suppressDisabledCheck !== "boolean" ) {
  11415. handlers = element;
  11416. element = suppressDisabledCheck;
  11417. suppressDisabledCheck = false;
  11418. }
  11419. // no element argument, shuffle and use this.element
  11420. if ( !handlers ) {
  11421. handlers = element;
  11422. element = this.element;
  11423. delegateElement = this.widget();
  11424. } else {
  11425. element = delegateElement = $( element );
  11426. this.bindings = this.bindings.add( element );
  11427. }
  11428. $.each( handlers, function( event, handler ) {
  11429. function handlerProxy() {
  11430. // allow widgets to customize the disabled handling
  11431. // - disabled as an array instead of boolean
  11432. // - disabled class as method for disabling individual parts
  11433. if ( !suppressDisabledCheck &&
  11434. ( instance.options.disabled === true ||
  11435. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  11436. return;
  11437. }
  11438. return ( typeof handler === "string" ? instance[ handler ] : handler )
  11439. .apply( instance, arguments );
  11440. }
  11441. // copy the guid so direct unbinding works
  11442. if ( typeof handler !== "string" ) {
  11443. handlerProxy.guid = handler.guid =
  11444. handler.guid || handlerProxy.guid || $.guid++;
  11445. }
  11446. var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
  11447. eventName = match[1] + instance.eventNamespace,
  11448. selector = match[2];
  11449. if ( selector ) {
  11450. delegateElement.delegate( selector, eventName, handlerProxy );
  11451. } else {
  11452. element.bind( eventName, handlerProxy );
  11453. }
  11454. });
  11455. },
  11456. _off: function( element, eventName ) {
  11457. eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
  11458. this.eventNamespace;
  11459. element.unbind( eventName ).undelegate( eventName );
  11460. // Clear the stack to avoid memory leaks (#10056)
  11461. this.bindings = $( this.bindings.not( element ).get() );
  11462. this.focusable = $( this.focusable.not( element ).get() );
  11463. this.hoverable = $( this.hoverable.not( element ).get() );
  11464. },
  11465. _delay: function( handler, delay ) {
  11466. function handlerProxy() {
  11467. return ( typeof handler === "string" ? instance[ handler ] : handler )
  11468. .apply( instance, arguments );
  11469. }
  11470. var instance = this;
  11471. return setTimeout( handlerProxy, delay || 0 );
  11472. },
  11473. _hoverable: function( element ) {
  11474. this.hoverable = this.hoverable.add( element );
  11475. this._on( element, {
  11476. mouseenter: function( event ) {
  11477. $( event.currentTarget ).addClass( "ui-state-hover" );
  11478. },
  11479. mouseleave: function( event ) {
  11480. $( event.currentTarget ).removeClass( "ui-state-hover" );
  11481. }
  11482. });
  11483. },
  11484. _focusable: function( element ) {
  11485. this.focusable = this.focusable.add( element );
  11486. this._on( element, {
  11487. focusin: function( event ) {
  11488. $( event.currentTarget ).addClass( "ui-state-focus" );
  11489. },
  11490. focusout: function( event ) {
  11491. $( event.currentTarget ).removeClass( "ui-state-focus" );
  11492. }
  11493. });
  11494. },
  11495. _trigger: function( type, event, data ) {
  11496. var prop, orig,
  11497. callback = this.options[ type ];
  11498. data = data || {};
  11499. event = $.Event( event );
  11500. event.type = ( type === this.widgetEventPrefix ?
  11501. type :
  11502. this.widgetEventPrefix + type ).toLowerCase();
  11503. // the original event may come from any element
  11504. // so we need to reset the target on the new event
  11505. event.target = this.element[ 0 ];
  11506. // copy original event properties over to the new event
  11507. orig = event.originalEvent;
  11508. if ( orig ) {
  11509. for ( prop in orig ) {
  11510. if ( !( prop in event ) ) {
  11511. event[ prop ] = orig[ prop ];
  11512. }
  11513. }
  11514. }
  11515. this.element.trigger( event, data );
  11516. return !( $.isFunction( callback ) &&
  11517. callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
  11518. event.isDefaultPrevented() );
  11519. }
  11520. };
  11521. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  11522. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  11523. if ( typeof options === "string" ) {
  11524. options = { effect: options };
  11525. }
  11526. var hasOptions,
  11527. effectName = !options ?
  11528. method :
  11529. options === true || typeof options === "number" ?
  11530. defaultEffect :
  11531. options.effect || defaultEffect;
  11532. options = options || {};
  11533. if ( typeof options === "number" ) {
  11534. options = { duration: options };
  11535. }
  11536. hasOptions = !$.isEmptyObject( options );
  11537. options.complete = callback;
  11538. if ( options.delay ) {
  11539. element.delay( options.delay );
  11540. }
  11541. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  11542. element[ method ]( options );
  11543. } else if ( effectName !== method && element[ effectName ] ) {
  11544. element[ effectName ]( options.duration, options.easing, callback );
  11545. } else {
  11546. element.queue(function( next ) {
  11547. $( this )[ method ]();
  11548. if ( callback ) {
  11549. callback.call( element[ 0 ] );
  11550. }
  11551. next();
  11552. });
  11553. }
  11554. };
  11555. });
  11556. return $.widget;
  11557. }));
  11558. /*!
  11559. * jQuery UI Mouse 1.11.4
  11560. * http://jqueryui.com
  11561. *
  11562. * Copyright jQuery Foundation and other contributors
  11563. * Released under the MIT license.
  11564. * http://jquery.org/license
  11565. *
  11566. * http://api.jqueryui.com/mouse/
  11567. */
  11568. (function( factory ) {
  11569. if ( typeof define === "function" && define.amd ) {
  11570. // AMD. Register as an anonymous module.
  11571. define([
  11572. "jquery",
  11573. "./widget"
  11574. ], factory );
  11575. } else {
  11576. // Browser globals
  11577. factory( jQuery );
  11578. }
  11579. }(function( $ ) {
  11580. var mouseHandled = false;
  11581. $( document ).mouseup( function() {
  11582. mouseHandled = false;
  11583. });
  11584. return $.widget("ui.mouse", {
  11585. version: "1.11.4",
  11586. options: {
  11587. cancel: "input,textarea,button,select,option",
  11588. distance: 1,
  11589. delay: 0
  11590. },
  11591. _mouseInit: function() {
  11592. var that = this;
  11593. this.element
  11594. .bind("mousedown." + this.widgetName, function(event) {
  11595. return that._mouseDown(event);
  11596. })
  11597. .bind("click." + this.widgetName, function(event) {
  11598. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  11599. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  11600. event.stopImmediatePropagation();
  11601. return false;
  11602. }
  11603. });
  11604. this.started = false;
  11605. },
  11606. // TODO: make sure destroying one instance of mouse doesn't mess with
  11607. // other instances of mouse
  11608. _mouseDestroy: function() {
  11609. this.element.unbind("." + this.widgetName);
  11610. if ( this._mouseMoveDelegate ) {
  11611. this.document
  11612. .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
  11613. .unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
  11614. }
  11615. },
  11616. _mouseDown: function(event) {
  11617. // don't let more than one widget handle mouseStart
  11618. if ( mouseHandled ) {
  11619. return;
  11620. }
  11621. this._mouseMoved = false;
  11622. // we may have missed mouseup (out of window)
  11623. (this._mouseStarted && this._mouseUp(event));
  11624. this._mouseDownEvent = event;
  11625. var that = this,
  11626. btnIsLeft = (event.which === 1),
  11627. // event.target.nodeName works around a bug in IE 8 with
  11628. // disabled inputs (#7620)
  11629. elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
  11630. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  11631. return true;
  11632. }
  11633. this.mouseDelayMet = !this.options.delay;
  11634. if (!this.mouseDelayMet) {
  11635. this._mouseDelayTimer = setTimeout(function() {
  11636. that.mouseDelayMet = true;
  11637. }, this.options.delay);
  11638. }
  11639. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  11640. this._mouseStarted = (this._mouseStart(event) !== false);
  11641. if (!this._mouseStarted) {
  11642. event.preventDefault();
  11643. return true;
  11644. }
  11645. }
  11646. // Click event may never have fired (Gecko & Opera)
  11647. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  11648. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  11649. }
  11650. // these delegates are required to keep context
  11651. this._mouseMoveDelegate = function(event) {
  11652. return that._mouseMove(event);
  11653. };
  11654. this._mouseUpDelegate = function(event) {
  11655. return that._mouseUp(event);
  11656. };
  11657. this.document
  11658. .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  11659. .bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  11660. event.preventDefault();
  11661. mouseHandled = true;
  11662. return true;
  11663. },
  11664. _mouseMove: function(event) {
  11665. // Only check for mouseups outside the document if you've moved inside the document
  11666. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  11667. // fire a mousemove event if content is placed under the cursor. See #7778
  11668. // Support: IE <9
  11669. if ( this._mouseMoved ) {
  11670. // IE mouseup check - mouseup happened when mouse was out of window
  11671. if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
  11672. return this._mouseUp(event);
  11673. // Iframe mouseup check - mouseup occurred in another document
  11674. } else if ( !event.which ) {
  11675. return this._mouseUp( event );
  11676. }
  11677. }
  11678. if ( event.which || event.button ) {
  11679. this._mouseMoved = true;
  11680. }
  11681. if (this._mouseStarted) {
  11682. this._mouseDrag(event);
  11683. return event.preventDefault();
  11684. }
  11685. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  11686. this._mouseStarted =
  11687. (this._mouseStart(this._mouseDownEvent, event) !== false);
  11688. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  11689. }
  11690. return !this._mouseStarted;
  11691. },
  11692. _mouseUp: function(event) {
  11693. this.document
  11694. .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  11695. .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  11696. if (this._mouseStarted) {
  11697. this._mouseStarted = false;
  11698. if (event.target === this._mouseDownEvent.target) {
  11699. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  11700. }
  11701. this._mouseStop(event);
  11702. }
  11703. mouseHandled = false;
  11704. return false;
  11705. },
  11706. _mouseDistanceMet: function(event) {
  11707. return (Math.max(
  11708. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  11709. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  11710. ) >= this.options.distance
  11711. );
  11712. },
  11713. _mouseDelayMet: function(/* event */) {
  11714. return this.mouseDelayMet;
  11715. },
  11716. // These are placeholder methods, to be overriden by extending plugin
  11717. _mouseStart: function(/* event */) {},
  11718. _mouseDrag: function(/* event */) {},
  11719. _mouseStop: function(/* event */) {},
  11720. _mouseCapture: function(/* event */) { return true; }
  11721. });
  11722. }));
  11723. /*!
  11724. * jQuery UI Sortable 1.11.4
  11725. * http://jqueryui.com
  11726. *
  11727. * Copyright jQuery Foundation and other contributors
  11728. * Released under the MIT license.
  11729. * http://jquery.org/license
  11730. *
  11731. * http://api.jqueryui.com/sortable/
  11732. */
  11733. (function( factory ) {
  11734. if ( typeof define === "function" && define.amd ) {
  11735. // AMD. Register as an anonymous module.
  11736. define([
  11737. "jquery",
  11738. "./core",
  11739. "./mouse",
  11740. "./widget"
  11741. ], factory );
  11742. } else {
  11743. // Browser globals
  11744. factory( jQuery );
  11745. }
  11746. }(function( $ ) {
  11747. return $.widget("ui.sortable", $.ui.mouse, {
  11748. version: "1.11.4",
  11749. widgetEventPrefix: "sort",
  11750. ready: false,
  11751. options: {
  11752. appendTo: "parent",
  11753. axis: false,
  11754. connectWith: false,
  11755. containment: false,
  11756. cursor: "auto",
  11757. cursorAt: false,
  11758. dropOnEmpty: true,
  11759. forcePlaceholderSize: false,
  11760. forceHelperSize: false,
  11761. grid: false,
  11762. handle: false,
  11763. helper: "original",
  11764. items: "> *",
  11765. opacity: false,
  11766. placeholder: false,
  11767. revert: false,
  11768. scroll: true,
  11769. scrollSensitivity: 20,
  11770. scrollSpeed: 20,
  11771. scope: "default",
  11772. tolerance: "intersect",
  11773. zIndex: 1000,
  11774. // callbacks
  11775. activate: null,
  11776. beforeStop: null,
  11777. change: null,
  11778. deactivate: null,
  11779. out: null,
  11780. over: null,
  11781. receive: null,
  11782. remove: null,
  11783. sort: null,
  11784. start: null,
  11785. stop: null,
  11786. update: null
  11787. },
  11788. _isOverAxis: function( x, reference, size ) {
  11789. return ( x >= reference ) && ( x < ( reference + size ) );
  11790. },
  11791. _isFloating: function( item ) {
  11792. return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
  11793. },
  11794. _create: function() {
  11795. this.containerCache = {};
  11796. this.element.addClass("ui-sortable");
  11797. //Get the items
  11798. this.refresh();
  11799. //Let's determine the parent's offset
  11800. this.offset = this.element.offset();
  11801. //Initialize mouse events for interaction
  11802. this._mouseInit();
  11803. this._setHandleClassName();
  11804. //We're ready to go
  11805. this.ready = true;
  11806. },
  11807. _setOption: function( key, value ) {
  11808. this._super( key, value );
  11809. if ( key === "handle" ) {
  11810. this._setHandleClassName();
  11811. }
  11812. },
  11813. _setHandleClassName: function() {
  11814. this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
  11815. $.each( this.items, function() {
  11816. ( this.instance.options.handle ?
  11817. this.item.find( this.instance.options.handle ) : this.item )
  11818. .addClass( "ui-sortable-handle" );
  11819. });
  11820. },
  11821. _destroy: function() {
  11822. this.element
  11823. .removeClass( "ui-sortable ui-sortable-disabled" )
  11824. .find( ".ui-sortable-handle" )
  11825. .removeClass( "ui-sortable-handle" );
  11826. this._mouseDestroy();
  11827. for ( var i = this.items.length - 1; i >= 0; i-- ) {
  11828. this.items[i].item.removeData(this.widgetName + "-item");
  11829. }
  11830. return this;
  11831. },
  11832. _mouseCapture: function(event, overrideHandle) {
  11833. var currentItem = null,
  11834. validHandle = false,
  11835. that = this;
  11836. if (this.reverting) {
  11837. return false;
  11838. }
  11839. if(this.options.disabled || this.options.type === "static") {
  11840. return false;
  11841. }
  11842. //We have to refresh the items data once first
  11843. this._refreshItems(event);
  11844. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  11845. $(event.target).parents().each(function() {
  11846. if($.data(this, that.widgetName + "-item") === that) {
  11847. currentItem = $(this);
  11848. return false;
  11849. }
  11850. });
  11851. if($.data(event.target, that.widgetName + "-item") === that) {
  11852. currentItem = $(event.target);
  11853. }
  11854. if(!currentItem) {
  11855. return false;
  11856. }
  11857. if(this.options.handle && !overrideHandle) {
  11858. $(this.options.handle, currentItem).find("*").addBack().each(function() {
  11859. if(this === event.target) {
  11860. validHandle = true;
  11861. }
  11862. });
  11863. if(!validHandle) {
  11864. return false;
  11865. }
  11866. }
  11867. this.currentItem = currentItem;
  11868. this._removeCurrentsFromItems();
  11869. return true;
  11870. },
  11871. _mouseStart: function(event, overrideHandle, noActivation) {
  11872. var i, body,
  11873. o = this.options;
  11874. this.currentContainer = this;
  11875. //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  11876. this.refreshPositions();
  11877. //Create and append the visible helper
  11878. this.helper = this._createHelper(event);
  11879. //Cache the helper size
  11880. this._cacheHelperProportions();
  11881. /*
  11882. * - Position generation -
  11883. * This block generates everything position related - it's the core of draggables.
  11884. */
  11885. //Cache the margins of the original element
  11886. this._cacheMargins();
  11887. //Get the next scrolling parent
  11888. this.scrollParent = this.helper.scrollParent();
  11889. //The element's absolute position on the page minus margins
  11890. this.offset = this.currentItem.offset();
  11891. this.offset = {
  11892. top: this.offset.top - this.margins.top,
  11893. left: this.offset.left - this.margins.left
  11894. };
  11895. $.extend(this.offset, {
  11896. click: { //Where the click happened, relative to the element
  11897. left: event.pageX - this.offset.left,
  11898. top: event.pageY - this.offset.top
  11899. },
  11900. parent: this._getParentOffset(),
  11901. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  11902. });
  11903. // Only after we got the offset, we can change the helper's position to absolute
  11904. // TODO: Still need to figure out a way to make relative sorting possible
  11905. this.helper.css("position", "absolute");
  11906. this.cssPosition = this.helper.css("position");
  11907. //Generate the original position
  11908. this.originalPosition = this._generatePosition(event);
  11909. this.originalPageX = event.pageX;
  11910. this.originalPageY = event.pageY;
  11911. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  11912. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  11913. //Cache the former DOM position
  11914. this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  11915. //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
  11916. if(this.helper[0] !== this.currentItem[0]) {
  11917. this.currentItem.hide();
  11918. }
  11919. //Create the placeholder
  11920. this._createPlaceholder();
  11921. //Set a containment if given in the options
  11922. if(o.containment) {
  11923. this._setContainment();
  11924. }
  11925. if( o.cursor && o.cursor !== "auto" ) { // cursor option
  11926. body = this.document.find( "body" );
  11927. // support: IE
  11928. this.storedCursor = body.css( "cursor" );
  11929. body.css( "cursor", o.cursor );
  11930. this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
  11931. }
  11932. if(o.opacity) { // opacity option
  11933. if (this.helper.css("opacity")) {
  11934. this._storedOpacity = this.helper.css("opacity");
  11935. }
  11936. this.helper.css("opacity", o.opacity);
  11937. }
  11938. if(o.zIndex) { // zIndex option
  11939. if (this.helper.css("zIndex")) {
  11940. this._storedZIndex = this.helper.css("zIndex");
  11941. }
  11942. this.helper.css("zIndex", o.zIndex);
  11943. }
  11944. //Prepare scrolling
  11945. if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  11946. this.overflowOffset = this.scrollParent.offset();
  11947. }
  11948. //Call callbacks
  11949. this._trigger("start", event, this._uiHash());
  11950. //Recache the helper size
  11951. if(!this._preserveHelperProportions) {
  11952. this._cacheHelperProportions();
  11953. }
  11954. //Post "activate" events to possible containers
  11955. if( !noActivation ) {
  11956. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  11957. this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  11958. }
  11959. }
  11960. //Prepare possible droppables
  11961. if($.ui.ddmanager) {
  11962. $.ui.ddmanager.current = this;
  11963. }
  11964. if ($.ui.ddmanager && !o.dropBehaviour) {
  11965. $.ui.ddmanager.prepareOffsets(this, event);
  11966. }
  11967. this.dragging = true;
  11968. this.helper.addClass("ui-sortable-helper");
  11969. this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  11970. return true;
  11971. },
  11972. _mouseDrag: function(event) {
  11973. var i, item, itemElement, intersection,
  11974. o = this.options,
  11975. scrolled = false;
  11976. //Compute the helpers position
  11977. this.position = this._generatePosition(event);
  11978. this.positionAbs = this._convertPositionTo("absolute");
  11979. if (!this.lastPositionAbs) {
  11980. this.lastPositionAbs = this.positionAbs;
  11981. }
  11982. //Do scrolling
  11983. if(this.options.scroll) {
  11984. if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  11985. if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
  11986. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  11987. } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
  11988. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  11989. }
  11990. if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
  11991. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  11992. } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
  11993. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  11994. }
  11995. } else {
  11996. if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
  11997. scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
  11998. } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
  11999. scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
  12000. }
  12001. if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
  12002. scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
  12003. } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
  12004. scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
  12005. }
  12006. }
  12007. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  12008. $.ui.ddmanager.prepareOffsets(this, event);
  12009. }
  12010. }
  12011. //Regenerate the absolute position used for position checks
  12012. this.positionAbs = this._convertPositionTo("absolute");
  12013. //Set the helper position
  12014. if(!this.options.axis || this.options.axis !== "y") {
  12015. this.helper[0].style.left = this.position.left+"px";
  12016. }
  12017. if(!this.options.axis || this.options.axis !== "x") {
  12018. this.helper[0].style.top = this.position.top+"px";
  12019. }
  12020. //Rearrange
  12021. for (i = this.items.length - 1; i >= 0; i--) {
  12022. //Cache variables and intersection, continue if no intersection
  12023. item = this.items[i];
  12024. itemElement = item.item[0];
  12025. intersection = this._intersectsWithPointer(item);
  12026. if (!intersection) {
  12027. continue;
  12028. }
  12029. // Only put the placeholder inside the current Container, skip all
  12030. // items from other containers. This works because when moving
  12031. // an item from one container to another the
  12032. // currentContainer is switched before the placeholder is moved.
  12033. //
  12034. // Without this, moving items in "sub-sortables" can cause
  12035. // the placeholder to jitter between the outer and inner container.
  12036. if (item.instance !== this.currentContainer) {
  12037. continue;
  12038. }
  12039. // cannot intersect with itself
  12040. // no useless actions that have been done before
  12041. // no action if the item moved is the parent of the item checked
  12042. if (itemElement !== this.currentItem[0] &&
  12043. this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
  12044. !$.contains(this.placeholder[0], itemElement) &&
  12045. (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
  12046. ) {
  12047. this.direction = intersection === 1 ? "down" : "up";
  12048. if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
  12049. this._rearrange(event, item);
  12050. } else {
  12051. break;
  12052. }
  12053. this._trigger("change", event, this._uiHash());
  12054. break;
  12055. }
  12056. }
  12057. //Post events to containers
  12058. this._contactContainers(event);
  12059. //Interconnect with droppables
  12060. if($.ui.ddmanager) {
  12061. $.ui.ddmanager.drag(this, event);
  12062. }
  12063. //Call callbacks
  12064. this._trigger("sort", event, this._uiHash());
  12065. this.lastPositionAbs = this.positionAbs;
  12066. return false;
  12067. },
  12068. _mouseStop: function(event, noPropagation) {
  12069. if(!event) {
  12070. return;
  12071. }
  12072. //If we are using droppables, inform the manager about the drop
  12073. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  12074. $.ui.ddmanager.drop(this, event);
  12075. }
  12076. if(this.options.revert) {
  12077. var that = this,
  12078. cur = this.placeholder.offset(),
  12079. axis = this.options.axis,
  12080. animation = {};
  12081. if ( !axis || axis === "x" ) {
  12082. animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
  12083. }
  12084. if ( !axis || axis === "y" ) {
  12085. animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
  12086. }
  12087. this.reverting = true;
  12088. $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
  12089. that._clear(event);
  12090. });
  12091. } else {
  12092. this._clear(event, noPropagation);
  12093. }
  12094. return false;
  12095. },
  12096. cancel: function() {
  12097. if(this.dragging) {
  12098. this._mouseUp({ target: null });
  12099. if(this.options.helper === "original") {
  12100. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  12101. } else {
  12102. this.currentItem.show();
  12103. }
  12104. //Post deactivating events to containers
  12105. for (var i = this.containers.length - 1; i >= 0; i--){
  12106. this.containers[i]._trigger("deactivate", null, this._uiHash(this));
  12107. if(this.containers[i].containerCache.over) {
  12108. this.containers[i]._trigger("out", null, this._uiHash(this));
  12109. this.containers[i].containerCache.over = 0;
  12110. }
  12111. }
  12112. }
  12113. if (this.placeholder) {
  12114. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  12115. if(this.placeholder[0].parentNode) {
  12116. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  12117. }
  12118. if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
  12119. this.helper.remove();
  12120. }
  12121. $.extend(this, {
  12122. helper: null,
  12123. dragging: false,
  12124. reverting: false,
  12125. _noFinalSort: null
  12126. });
  12127. if(this.domPosition.prev) {
  12128. $(this.domPosition.prev).after(this.currentItem);
  12129. } else {
  12130. $(this.domPosition.parent).prepend(this.currentItem);
  12131. }
  12132. }
  12133. return this;
  12134. },
  12135. serialize: function(o) {
  12136. var items = this._getItemsAsjQuery(o && o.connected),
  12137. str = [];
  12138. o = o || {};
  12139. $(items).each(function() {
  12140. var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
  12141. if (res) {
  12142. str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
  12143. }
  12144. });
  12145. if(!str.length && o.key) {
  12146. str.push(o.key + "=");
  12147. }
  12148. return str.join("&");
  12149. },
  12150. toArray: function(o) {
  12151. var items = this._getItemsAsjQuery(o && o.connected),
  12152. ret = [];
  12153. o = o || {};
  12154. items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
  12155. return ret;
  12156. },
  12157. /* Be careful with the following core functions */
  12158. _intersectsWith: function(item) {
  12159. var x1 = this.positionAbs.left,
  12160. x2 = x1 + this.helperProportions.width,
  12161. y1 = this.positionAbs.top,
  12162. y2 = y1 + this.helperProportions.height,
  12163. l = item.left,
  12164. r = l + item.width,
  12165. t = item.top,
  12166. b = t + item.height,
  12167. dyClick = this.offset.click.top,
  12168. dxClick = this.offset.click.left,
  12169. isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
  12170. isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
  12171. isOverElement = isOverElementHeight && isOverElementWidth;
  12172. if ( this.options.tolerance === "pointer" ||
  12173. this.options.forcePointerForContainers ||
  12174. (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
  12175. ) {
  12176. return isOverElement;
  12177. } else {
  12178. return (l < x1 + (this.helperProportions.width / 2) && // Right Half
  12179. x2 - (this.helperProportions.width / 2) < r && // Left Half
  12180. t < y1 + (this.helperProportions.height / 2) && // Bottom Half
  12181. y2 - (this.helperProportions.height / 2) < b ); // Top Half
  12182. }
  12183. },
  12184. _intersectsWithPointer: function(item) {
  12185. var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  12186. isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  12187. isOverElement = isOverElementHeight && isOverElementWidth,
  12188. verticalDirection = this._getDragVerticalDirection(),
  12189. horizontalDirection = this._getDragHorizontalDirection();
  12190. if (!isOverElement) {
  12191. return false;
  12192. }
  12193. return this.floating ?
  12194. ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
  12195. : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
  12196. },
  12197. _intersectsWithSides: function(item) {
  12198. var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  12199. isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  12200. verticalDirection = this._getDragVerticalDirection(),
  12201. horizontalDirection = this._getDragHorizontalDirection();
  12202. if (this.floating && horizontalDirection) {
  12203. return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
  12204. } else {
  12205. return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
  12206. }
  12207. },
  12208. _getDragVerticalDirection: function() {
  12209. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  12210. return delta !== 0 && (delta > 0 ? "down" : "up");
  12211. },
  12212. _getDragHorizontalDirection: function() {
  12213. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  12214. return delta !== 0 && (delta > 0 ? "right" : "left");
  12215. },
  12216. refresh: function(event) {
  12217. this._refreshItems(event);
  12218. this._setHandleClassName();
  12219. this.refreshPositions();
  12220. return this;
  12221. },
  12222. _connectWith: function() {
  12223. var options = this.options;
  12224. return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
  12225. },
  12226. _getItemsAsjQuery: function(connected) {
  12227. var i, j, cur, inst,
  12228. items = [],
  12229. queries = [],
  12230. connectWith = this._connectWith();
  12231. if(connectWith && connected) {
  12232. for (i = connectWith.length - 1; i >= 0; i--){
  12233. cur = $(connectWith[i], this.document[0]);
  12234. for ( j = cur.length - 1; j >= 0; j--){
  12235. inst = $.data(cur[j], this.widgetFullName);
  12236. if(inst && inst !== this && !inst.options.disabled) {
  12237. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
  12238. }
  12239. }
  12240. }
  12241. }
  12242. queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
  12243. function addItems() {
  12244. items.push( this );
  12245. }
  12246. for (i = queries.length - 1; i >= 0; i--){
  12247. queries[i][0].each( addItems );
  12248. }
  12249. return $(items);
  12250. },
  12251. _removeCurrentsFromItems: function() {
  12252. var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
  12253. this.items = $.grep(this.items, function (item) {
  12254. for (var j=0; j < list.length; j++) {
  12255. if(list[j] === item.item[0]) {
  12256. return false;
  12257. }
  12258. }
  12259. return true;
  12260. });
  12261. },
  12262. _refreshItems: function(event) {
  12263. this.items = [];
  12264. this.containers = [this];
  12265. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  12266. items = this.items,
  12267. queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
  12268. connectWith = this._connectWith();
  12269. if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
  12270. for (i = connectWith.length - 1; i >= 0; i--){
  12271. cur = $(connectWith[i], this.document[0]);
  12272. for (j = cur.length - 1; j >= 0; j--){
  12273. inst = $.data(cur[j], this.widgetFullName);
  12274. if(inst && inst !== this && !inst.options.disabled) {
  12275. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  12276. this.containers.push(inst);
  12277. }
  12278. }
  12279. }
  12280. }
  12281. for (i = queries.length - 1; i >= 0; i--) {
  12282. targetData = queries[i][1];
  12283. _queries = queries[i][0];
  12284. for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  12285. item = $(_queries[j]);
  12286. item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
  12287. items.push({
  12288. item: item,
  12289. instance: targetData,
  12290. width: 0, height: 0,
  12291. left: 0, top: 0
  12292. });
  12293. }
  12294. }
  12295. },
  12296. refreshPositions: function(fast) {
  12297. // Determine whether items are being displayed horizontally
  12298. this.floating = this.items.length ?
  12299. this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  12300. false;
  12301. //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  12302. if(this.offsetParent && this.helper) {
  12303. this.offset.parent = this._getParentOffset();
  12304. }
  12305. var i, item, t, p;
  12306. for (i = this.items.length - 1; i >= 0; i--){
  12307. item = this.items[i];
  12308. //We ignore calculating positions of all connected containers when we're not over them
  12309. if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
  12310. continue;
  12311. }
  12312. t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  12313. if (!fast) {
  12314. item.width = t.outerWidth();
  12315. item.height = t.outerHeight();
  12316. }
  12317. p = t.offset();
  12318. item.left = p.left;
  12319. item.top = p.top;
  12320. }
  12321. if(this.options.custom && this.options.custom.refreshContainers) {
  12322. this.options.custom.refreshContainers.call(this);
  12323. } else {
  12324. for (i = this.containers.length - 1; i >= 0; i--){
  12325. p = this.containers[i].element.offset();
  12326. this.containers[i].containerCache.left = p.left;
  12327. this.containers[i].containerCache.top = p.top;
  12328. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  12329. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  12330. }
  12331. }
  12332. return this;
  12333. },
  12334. _createPlaceholder: function(that) {
  12335. that = that || this;
  12336. var className,
  12337. o = that.options;
  12338. if(!o.placeholder || o.placeholder.constructor === String) {
  12339. className = o.placeholder;
  12340. o.placeholder = {
  12341. element: function() {
  12342. var nodeName = that.currentItem[0].nodeName.toLowerCase(),
  12343. element = $( "<" + nodeName + ">", that.document[0] )
  12344. .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
  12345. .removeClass("ui-sortable-helper");
  12346. if ( nodeName === "tbody" ) {
  12347. that._createTrPlaceholder(
  12348. that.currentItem.find( "tr" ).eq( 0 ),
  12349. $( "<tr>", that.document[ 0 ] ).appendTo( element )
  12350. );
  12351. } else if ( nodeName === "tr" ) {
  12352. that._createTrPlaceholder( that.currentItem, element );
  12353. } else if ( nodeName === "img" ) {
  12354. element.attr( "src", that.currentItem.attr( "src" ) );
  12355. }
  12356. if ( !className ) {
  12357. element.css( "visibility", "hidden" );
  12358. }
  12359. return element;
  12360. },
  12361. update: function(container, p) {
  12362. // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  12363. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  12364. if(className && !o.forcePlaceholderSize) {
  12365. return;
  12366. }
  12367. //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
  12368. if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
  12369. if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
  12370. }
  12371. };
  12372. }
  12373. //Create the placeholder
  12374. that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
  12375. //Append it after the actual current item
  12376. that.currentItem.after(that.placeholder);
  12377. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  12378. o.placeholder.update(that, that.placeholder);
  12379. },
  12380. _createTrPlaceholder: function( sourceTr, targetTr ) {
  12381. var that = this;
  12382. sourceTr.children().each(function() {
  12383. $( "<td>&#160;</td>", that.document[ 0 ] )
  12384. .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  12385. .appendTo( targetTr );
  12386. });
  12387. },
  12388. _contactContainers: function(event) {
  12389. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
  12390. innermostContainer = null,
  12391. innermostIndex = null;
  12392. // get innermost container that intersects with item
  12393. for (i = this.containers.length - 1; i >= 0; i--) {
  12394. // never consider a container that's located within the item itself
  12395. if($.contains(this.currentItem[0], this.containers[i].element[0])) {
  12396. continue;
  12397. }
  12398. if(this._intersectsWith(this.containers[i].containerCache)) {
  12399. // if we've already found a container and it's more "inner" than this, then continue
  12400. if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
  12401. continue;
  12402. }
  12403. innermostContainer = this.containers[i];
  12404. innermostIndex = i;
  12405. } else {
  12406. // container doesn't intersect. trigger "out" event if necessary
  12407. if(this.containers[i].containerCache.over) {
  12408. this.containers[i]._trigger("out", event, this._uiHash(this));
  12409. this.containers[i].containerCache.over = 0;
  12410. }
  12411. }
  12412. }
  12413. // if no intersecting containers found, return
  12414. if(!innermostContainer) {
  12415. return;
  12416. }
  12417. // move the item into the container if it's not there already
  12418. if(this.containers.length === 1) {
  12419. if (!this.containers[innermostIndex].containerCache.over) {
  12420. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  12421. this.containers[innermostIndex].containerCache.over = 1;
  12422. }
  12423. } else {
  12424. //When entering a new container, we will find the item with the least distance and append our item near it
  12425. dist = 10000;
  12426. itemWithLeastDistance = null;
  12427. floating = innermostContainer.floating || this._isFloating(this.currentItem);
  12428. posProperty = floating ? "left" : "top";
  12429. sizeProperty = floating ? "width" : "height";
  12430. axis = floating ? "clientX" : "clientY";
  12431. for (j = this.items.length - 1; j >= 0; j--) {
  12432. if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
  12433. continue;
  12434. }
  12435. if(this.items[j].item[0] === this.currentItem[0]) {
  12436. continue;
  12437. }
  12438. cur = this.items[j].item.offset()[posProperty];
  12439. nearBottom = false;
  12440. if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  12441. nearBottom = true;
  12442. }
  12443. if ( Math.abs( event[ axis ] - cur ) < dist ) {
  12444. dist = Math.abs( event[ axis ] - cur );
  12445. itemWithLeastDistance = this.items[ j ];
  12446. this.direction = nearBottom ? "up": "down";
  12447. }
  12448. }
  12449. //Check if dropOnEmpty is enabled
  12450. if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
  12451. return;
  12452. }
  12453. if(this.currentContainer === this.containers[innermostIndex]) {
  12454. if ( !this.currentContainer.containerCache.over ) {
  12455. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  12456. this.currentContainer.containerCache.over = 1;
  12457. }
  12458. return;
  12459. }
  12460. itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  12461. this._trigger("change", event, this._uiHash());
  12462. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  12463. this.currentContainer = this.containers[innermostIndex];
  12464. //Update the placeholder
  12465. this.options.placeholder.update(this.currentContainer, this.placeholder);
  12466. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  12467. this.containers[innermostIndex].containerCache.over = 1;
  12468. }
  12469. },
  12470. _createHelper: function(event) {
  12471. var o = this.options,
  12472. helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
  12473. //Add the helper to the DOM if that didn't happen already
  12474. if(!helper.parents("body").length) {
  12475. $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  12476. }
  12477. if(helper[0] === this.currentItem[0]) {
  12478. this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
  12479. }
  12480. if(!helper[0].style.width || o.forceHelperSize) {
  12481. helper.width(this.currentItem.width());
  12482. }
  12483. if(!helper[0].style.height || o.forceHelperSize) {
  12484. helper.height(this.currentItem.height());
  12485. }
  12486. return helper;
  12487. },
  12488. _adjustOffsetFromHelper: function(obj) {
  12489. if (typeof obj === "string") {
  12490. obj = obj.split(" ");
  12491. }
  12492. if ($.isArray(obj)) {
  12493. obj = {left: +obj[0], top: +obj[1] || 0};
  12494. }
  12495. if ("left" in obj) {
  12496. this.offset.click.left = obj.left + this.margins.left;
  12497. }
  12498. if ("right" in obj) {
  12499. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  12500. }
  12501. if ("top" in obj) {
  12502. this.offset.click.top = obj.top + this.margins.top;
  12503. }
  12504. if ("bottom" in obj) {
  12505. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  12506. }
  12507. },
  12508. _getParentOffset: function() {
  12509. //Get the offsetParent and cache its position
  12510. this.offsetParent = this.helper.offsetParent();
  12511. var po = this.offsetParent.offset();
  12512. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  12513. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  12514. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  12515. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  12516. if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  12517. po.left += this.scrollParent.scrollLeft();
  12518. po.top += this.scrollParent.scrollTop();
  12519. }
  12520. // This needs to be actually done for all browsers, since pageX/pageY includes this information
  12521. // with an ugly IE fix
  12522. if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
  12523. po = { top: 0, left: 0 };
  12524. }
  12525. return {
  12526. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  12527. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  12528. };
  12529. },
  12530. _getRelativeOffset: function() {
  12531. if(this.cssPosition === "relative") {
  12532. var p = this.currentItem.position();
  12533. return {
  12534. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  12535. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  12536. };
  12537. } else {
  12538. return { top: 0, left: 0 };
  12539. }
  12540. },
  12541. _cacheMargins: function() {
  12542. this.margins = {
  12543. left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  12544. top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  12545. };
  12546. },
  12547. _cacheHelperProportions: function() {
  12548. this.helperProportions = {
  12549. width: this.helper.outerWidth(),
  12550. height: this.helper.outerHeight()
  12551. };
  12552. },
  12553. _setContainment: function() {
  12554. var ce, co, over,
  12555. o = this.options;
  12556. if(o.containment === "parent") {
  12557. o.containment = this.helper[0].parentNode;
  12558. }
  12559. if(o.containment === "document" || o.containment === "window") {
  12560. this.containment = [
  12561. 0 - this.offset.relative.left - this.offset.parent.left,
  12562. 0 - this.offset.relative.top - this.offset.parent.top,
  12563. o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
  12564. (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  12565. ];
  12566. }
  12567. if(!(/^(document|window|parent)$/).test(o.containment)) {
  12568. ce = $(o.containment)[0];
  12569. co = $(o.containment).offset();
  12570. over = ($(ce).css("overflow") !== "hidden");
  12571. this.containment = [
  12572. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  12573. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  12574. co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
  12575. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
  12576. ];
  12577. }
  12578. },
  12579. _convertPositionTo: function(d, pos) {
  12580. if(!pos) {
  12581. pos = this.position;
  12582. }
  12583. var mod = d === "absolute" ? 1 : -1,
  12584. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
  12585. scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  12586. return {
  12587. top: (
  12588. pos.top + // The absolute mouse position
  12589. this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  12590. this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
  12591. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  12592. ),
  12593. left: (
  12594. pos.left + // The absolute mouse position
  12595. this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  12596. this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
  12597. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  12598. )
  12599. };
  12600. },
  12601. _generatePosition: function(event) {
  12602. var top, left,
  12603. o = this.options,
  12604. pageX = event.pageX,
  12605. pageY = event.pageY,
  12606. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  12607. // This is another very weird special case that only happens for relative elements:
  12608. // 1. If the css position is relative
  12609. // 2. and the scroll parent is the document or similar to the offset parent
  12610. // we have to refresh the relative offset during the scroll so there are no jumps
  12611. if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
  12612. this.offset.relative = this._getRelativeOffset();
  12613. }
  12614. /*
  12615. * - Position constraining -
  12616. * Constrain the position to a mix of grid, containment.
  12617. */
  12618. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  12619. if(this.containment) {
  12620. if(event.pageX - this.offset.click.left < this.containment[0]) {
  12621. pageX = this.containment[0] + this.offset.click.left;
  12622. }
  12623. if(event.pageY - this.offset.click.top < this.containment[1]) {
  12624. pageY = this.containment[1] + this.offset.click.top;
  12625. }
  12626. if(event.pageX - this.offset.click.left > this.containment[2]) {
  12627. pageX = this.containment[2] + this.offset.click.left;
  12628. }
  12629. if(event.pageY - this.offset.click.top > this.containment[3]) {
  12630. pageY = this.containment[3] + this.offset.click.top;
  12631. }
  12632. }
  12633. if(o.grid) {
  12634. top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  12635. pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  12636. left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  12637. pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  12638. }
  12639. }
  12640. return {
  12641. top: (
  12642. pageY - // The absolute mouse position
  12643. this.offset.click.top - // Click offset (relative to the element)
  12644. this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
  12645. this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
  12646. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  12647. ),
  12648. left: (
  12649. pageX - // The absolute mouse position
  12650. this.offset.click.left - // Click offset (relative to the element)
  12651. this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
  12652. this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
  12653. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  12654. )
  12655. };
  12656. },
  12657. _rearrange: function(event, i, a, hardRefresh) {
  12658. a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
  12659. //Various things done here to improve the performance:
  12660. // 1. we create a setTimeout, that calls refreshPositions
  12661. // 2. on the instance, we have a counter variable, that get's higher after every append
  12662. // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  12663. // 4. this lets only the last addition to the timeout stack through
  12664. this.counter = this.counter ? ++this.counter : 1;
  12665. var counter = this.counter;
  12666. this._delay(function() {
  12667. if(counter === this.counter) {
  12668. this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  12669. }
  12670. });
  12671. },
  12672. _clear: function(event, noPropagation) {
  12673. this.reverting = false;
  12674. // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  12675. // everything else normalized again
  12676. var i,
  12677. delayedTriggers = [];
  12678. // We first have to update the dom position of the actual currentItem
  12679. // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  12680. if(!this._noFinalSort && this.currentItem.parent().length) {
  12681. this.placeholder.before(this.currentItem);
  12682. }
  12683. this._noFinalSort = null;
  12684. if(this.helper[0] === this.currentItem[0]) {
  12685. for(i in this._storedCSS) {
  12686. if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
  12687. this._storedCSS[i] = "";
  12688. }
  12689. }
  12690. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  12691. } else {
  12692. this.currentItem.show();
  12693. }
  12694. if(this.fromOutside && !noPropagation) {
  12695. delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  12696. }
  12697. if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
  12698. delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
  12699. }
  12700. // Check if the items Container has Changed and trigger appropriate
  12701. // events.
  12702. if (this !== this.currentContainer) {
  12703. if(!noPropagation) {
  12704. delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  12705. delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
  12706. delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
  12707. }
  12708. }
  12709. //Post events to containers
  12710. function delayEvent( type, instance, container ) {
  12711. return function( event ) {
  12712. container._trigger( type, event, instance._uiHash( instance ) );
  12713. };
  12714. }
  12715. for (i = this.containers.length - 1; i >= 0; i--){
  12716. if (!noPropagation) {
  12717. delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  12718. }
  12719. if(this.containers[i].containerCache.over) {
  12720. delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  12721. this.containers[i].containerCache.over = 0;
  12722. }
  12723. }
  12724. //Do what was originally in plugins
  12725. if ( this.storedCursor ) {
  12726. this.document.find( "body" ).css( "cursor", this.storedCursor );
  12727. this.storedStylesheet.remove();
  12728. }
  12729. if(this._storedOpacity) {
  12730. this.helper.css("opacity", this._storedOpacity);
  12731. }
  12732. if(this._storedZIndex) {
  12733. this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
  12734. }
  12735. this.dragging = false;
  12736. if(!noPropagation) {
  12737. this._trigger("beforeStop", event, this._uiHash());
  12738. }
  12739. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  12740. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  12741. if ( !this.cancelHelperRemoval ) {
  12742. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  12743. this.helper.remove();
  12744. }
  12745. this.helper = null;
  12746. }
  12747. if(!noPropagation) {
  12748. for (i=0; i < delayedTriggers.length; i++) {
  12749. delayedTriggers[i].call(this, event);
  12750. } //Trigger all delayed events
  12751. this._trigger("stop", event, this._uiHash());
  12752. }
  12753. this.fromOutside = false;
  12754. return !this.cancelHelperRemoval;
  12755. },
  12756. _trigger: function() {
  12757. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  12758. this.cancel();
  12759. }
  12760. },
  12761. _uiHash: function(_inst) {
  12762. var inst = _inst || this;
  12763. return {
  12764. helper: inst.helper,
  12765. placeholder: inst.placeholder || $([]),
  12766. position: inst.position,
  12767. originalPosition: inst.originalPosition,
  12768. offset: inst.positionAbs,
  12769. item: inst.currentItem,
  12770. sender: _inst ? _inst.element : null
  12771. };
  12772. }
  12773. });
  12774. }));
  12775. /*!
  12776. * jQuery UI Position 1.11.4
  12777. * http://jqueryui.com
  12778. *
  12779. * Copyright jQuery Foundation and other contributors
  12780. * Released under the MIT license.
  12781. * http://jquery.org/license
  12782. *
  12783. * http://api.jqueryui.com/position/
  12784. */
  12785. (function( factory ) {
  12786. if ( typeof define === "function" && define.amd ) {
  12787. // AMD. Register as an anonymous module.
  12788. define( [ "jquery" ], factory );
  12789. } else {
  12790. // Browser globals
  12791. factory( jQuery );
  12792. }
  12793. }(function( $ ) {
  12794. (function() {
  12795. $.ui = $.ui || {};
  12796. var cachedScrollbarWidth, supportsOffsetFractions,
  12797. max = Math.max,
  12798. abs = Math.abs,
  12799. round = Math.round,
  12800. rhorizontal = /left|center|right/,
  12801. rvertical = /top|center|bottom/,
  12802. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  12803. rposition = /^\w+/,
  12804. rpercent = /%$/,
  12805. _position = $.fn.position;
  12806. function getOffsets( offsets, width, height ) {
  12807. return [
  12808. parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  12809. parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  12810. ];
  12811. }
  12812. function parseCss( element, property ) {
  12813. return parseInt( $.css( element, property ), 10 ) || 0;
  12814. }
  12815. function getDimensions( elem ) {
  12816. var raw = elem[0];
  12817. if ( raw.nodeType === 9 ) {
  12818. return {
  12819. width: elem.width(),
  12820. height: elem.height(),
  12821. offset: { top: 0, left: 0 }
  12822. };
  12823. }
  12824. if ( $.isWindow( raw ) ) {
  12825. return {
  12826. width: elem.width(),
  12827. height: elem.height(),
  12828. offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  12829. };
  12830. }
  12831. if ( raw.preventDefault ) {
  12832. return {
  12833. width: 0,
  12834. height: 0,
  12835. offset: { top: raw.pageY, left: raw.pageX }
  12836. };
  12837. }
  12838. return {
  12839. width: elem.outerWidth(),
  12840. height: elem.outerHeight(),
  12841. offset: elem.offset()
  12842. };
  12843. }
  12844. $.position = {
  12845. scrollbarWidth: function() {
  12846. if ( cachedScrollbarWidth !== undefined ) {
  12847. return cachedScrollbarWidth;
  12848. }
  12849. var w1, w2,
  12850. div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
  12851. innerDiv = div.children()[0];
  12852. $( "body" ).append( div );
  12853. w1 = innerDiv.offsetWidth;
  12854. div.css( "overflow", "scroll" );
  12855. w2 = innerDiv.offsetWidth;
  12856. if ( w1 === w2 ) {
  12857. w2 = div[0].clientWidth;
  12858. }
  12859. div.remove();
  12860. return (cachedScrollbarWidth = w1 - w2);
  12861. },
  12862. getScrollInfo: function( within ) {
  12863. var overflowX = within.isWindow || within.isDocument ? "" :
  12864. within.element.css( "overflow-x" ),
  12865. overflowY = within.isWindow || within.isDocument ? "" :
  12866. within.element.css( "overflow-y" ),
  12867. hasOverflowX = overflowX === "scroll" ||
  12868. ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
  12869. hasOverflowY = overflowY === "scroll" ||
  12870. ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
  12871. return {
  12872. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  12873. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  12874. };
  12875. },
  12876. getWithinInfo: function( element ) {
  12877. var withinElement = $( element || window ),
  12878. isWindow = $.isWindow( withinElement[0] ),
  12879. isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
  12880. return {
  12881. element: withinElement,
  12882. isWindow: isWindow,
  12883. isDocument: isDocument,
  12884. offset: withinElement.offset() || { left: 0, top: 0 },
  12885. scrollLeft: withinElement.scrollLeft(),
  12886. scrollTop: withinElement.scrollTop(),
  12887. // support: jQuery 1.6.x
  12888. // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
  12889. width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
  12890. height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
  12891. };
  12892. }
  12893. };
  12894. $.fn.position = function( options ) {
  12895. if ( !options || !options.of ) {
  12896. return _position.apply( this, arguments );
  12897. }
  12898. // make a copy, we don't want to modify arguments
  12899. options = $.extend( {}, options );
  12900. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  12901. target = $( options.of ),
  12902. within = $.position.getWithinInfo( options.within ),
  12903. scrollInfo = $.position.getScrollInfo( within ),
  12904. collision = ( options.collision || "flip" ).split( " " ),
  12905. offsets = {};
  12906. dimensions = getDimensions( target );
  12907. if ( target[0].preventDefault ) {
  12908. // force left top to allow flipping
  12909. options.at = "left top";
  12910. }
  12911. targetWidth = dimensions.width;
  12912. targetHeight = dimensions.height;
  12913. targetOffset = dimensions.offset;
  12914. // clone to reuse original targetOffset later
  12915. basePosition = $.extend( {}, targetOffset );
  12916. // force my and at to have valid horizontal and vertical positions
  12917. // if a value is missing or invalid, it will be converted to center
  12918. $.each( [ "my", "at" ], function() {
  12919. var pos = ( options[ this ] || "" ).split( " " ),
  12920. horizontalOffset,
  12921. verticalOffset;
  12922. if ( pos.length === 1) {
  12923. pos = rhorizontal.test( pos[ 0 ] ) ?
  12924. pos.concat( [ "center" ] ) :
  12925. rvertical.test( pos[ 0 ] ) ?
  12926. [ "center" ].concat( pos ) :
  12927. [ "center", "center" ];
  12928. }
  12929. pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  12930. pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  12931. // calculate offsets
  12932. horizontalOffset = roffset.exec( pos[ 0 ] );
  12933. verticalOffset = roffset.exec( pos[ 1 ] );
  12934. offsets[ this ] = [
  12935. horizontalOffset ? horizontalOffset[ 0 ] : 0,
  12936. verticalOffset ? verticalOffset[ 0 ] : 0
  12937. ];
  12938. // reduce to just the positions without the offsets
  12939. options[ this ] = [
  12940. rposition.exec( pos[ 0 ] )[ 0 ],
  12941. rposition.exec( pos[ 1 ] )[ 0 ]
  12942. ];
  12943. });
  12944. // normalize collision option
  12945. if ( collision.length === 1 ) {
  12946. collision[ 1 ] = collision[ 0 ];
  12947. }
  12948. if ( options.at[ 0 ] === "right" ) {
  12949. basePosition.left += targetWidth;
  12950. } else if ( options.at[ 0 ] === "center" ) {
  12951. basePosition.left += targetWidth / 2;
  12952. }
  12953. if ( options.at[ 1 ] === "bottom" ) {
  12954. basePosition.top += targetHeight;
  12955. } else if ( options.at[ 1 ] === "center" ) {
  12956. basePosition.top += targetHeight / 2;
  12957. }
  12958. atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  12959. basePosition.left += atOffset[ 0 ];
  12960. basePosition.top += atOffset[ 1 ];
  12961. return this.each(function() {
  12962. var collisionPosition, using,
  12963. elem = $( this ),
  12964. elemWidth = elem.outerWidth(),
  12965. elemHeight = elem.outerHeight(),
  12966. marginLeft = parseCss( this, "marginLeft" ),
  12967. marginTop = parseCss( this, "marginTop" ),
  12968. collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
  12969. collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
  12970. position = $.extend( {}, basePosition ),
  12971. myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  12972. if ( options.my[ 0 ] === "right" ) {
  12973. position.left -= elemWidth;
  12974. } else if ( options.my[ 0 ] === "center" ) {
  12975. position.left -= elemWidth / 2;
  12976. }
  12977. if ( options.my[ 1 ] === "bottom" ) {
  12978. position.top -= elemHeight;
  12979. } else if ( options.my[ 1 ] === "center" ) {
  12980. position.top -= elemHeight / 2;
  12981. }
  12982. position.left += myOffset[ 0 ];
  12983. position.top += myOffset[ 1 ];
  12984. // if the browser doesn't support fractions, then round for consistent results
  12985. if ( !supportsOffsetFractions ) {
  12986. position.left = round( position.left );
  12987. position.top = round( position.top );
  12988. }
  12989. collisionPosition = {
  12990. marginLeft: marginLeft,
  12991. marginTop: marginTop
  12992. };
  12993. $.each( [ "left", "top" ], function( i, dir ) {
  12994. if ( $.ui.position[ collision[ i ] ] ) {
  12995. $.ui.position[ collision[ i ] ][ dir ]( position, {
  12996. targetWidth: targetWidth,
  12997. targetHeight: targetHeight,
  12998. elemWidth: elemWidth,
  12999. elemHeight: elemHeight,
  13000. collisionPosition: collisionPosition,
  13001. collisionWidth: collisionWidth,
  13002. collisionHeight: collisionHeight,
  13003. offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  13004. my: options.my,
  13005. at: options.at,
  13006. within: within,
  13007. elem: elem
  13008. });
  13009. }
  13010. });
  13011. if ( options.using ) {
  13012. // adds feedback as second argument to using callback, if present
  13013. using = function( props ) {
  13014. var left = targetOffset.left - position.left,
  13015. right = left + targetWidth - elemWidth,
  13016. top = targetOffset.top - position.top,
  13017. bottom = top + targetHeight - elemHeight,
  13018. feedback = {
  13019. target: {
  13020. element: target,
  13021. left: targetOffset.left,
  13022. top: targetOffset.top,
  13023. width: targetWidth,
  13024. height: targetHeight
  13025. },
  13026. element: {
  13027. element: elem,
  13028. left: position.left,
  13029. top: position.top,
  13030. width: elemWidth,
  13031. height: elemHeight
  13032. },
  13033. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  13034. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  13035. };
  13036. if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  13037. feedback.horizontal = "center";
  13038. }
  13039. if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  13040. feedback.vertical = "middle";
  13041. }
  13042. if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  13043. feedback.important = "horizontal";
  13044. } else {
  13045. feedback.important = "vertical";
  13046. }
  13047. options.using.call( this, props, feedback );
  13048. };
  13049. }
  13050. elem.offset( $.extend( position, { using: using } ) );
  13051. });
  13052. };
  13053. $.ui.position = {
  13054. fit: {
  13055. left: function( position, data ) {
  13056. var within = data.within,
  13057. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  13058. outerWidth = within.width,
  13059. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  13060. overLeft = withinOffset - collisionPosLeft,
  13061. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  13062. newOverRight;
  13063. // element is wider than within
  13064. if ( data.collisionWidth > outerWidth ) {
  13065. // element is initially over the left side of within
  13066. if ( overLeft > 0 && overRight <= 0 ) {
  13067. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
  13068. position.left += overLeft - newOverRight;
  13069. // element is initially over right side of within
  13070. } else if ( overRight > 0 && overLeft <= 0 ) {
  13071. position.left = withinOffset;
  13072. // element is initially over both left and right sides of within
  13073. } else {
  13074. if ( overLeft > overRight ) {
  13075. position.left = withinOffset + outerWidth - data.collisionWidth;
  13076. } else {
  13077. position.left = withinOffset;
  13078. }
  13079. }
  13080. // too far left -> align with left edge
  13081. } else if ( overLeft > 0 ) {
  13082. position.left += overLeft;
  13083. // too far right -> align with right edge
  13084. } else if ( overRight > 0 ) {
  13085. position.left -= overRight;
  13086. // adjust based on position and margin
  13087. } else {
  13088. position.left = max( position.left - collisionPosLeft, position.left );
  13089. }
  13090. },
  13091. top: function( position, data ) {
  13092. var within = data.within,
  13093. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  13094. outerHeight = data.within.height,
  13095. collisionPosTop = position.top - data.collisionPosition.marginTop,
  13096. overTop = withinOffset - collisionPosTop,
  13097. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  13098. newOverBottom;
  13099. // element is taller than within
  13100. if ( data.collisionHeight > outerHeight ) {
  13101. // element is initially over the top of within
  13102. if ( overTop > 0 && overBottom <= 0 ) {
  13103. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
  13104. position.top += overTop - newOverBottom;
  13105. // element is initially over bottom of within
  13106. } else if ( overBottom > 0 && overTop <= 0 ) {
  13107. position.top = withinOffset;
  13108. // element is initially over both top and bottom of within
  13109. } else {
  13110. if ( overTop > overBottom ) {
  13111. position.top = withinOffset + outerHeight - data.collisionHeight;
  13112. } else {
  13113. position.top = withinOffset;
  13114. }
  13115. }
  13116. // too far up -> align with top
  13117. } else if ( overTop > 0 ) {
  13118. position.top += overTop;
  13119. // too far down -> align with bottom edge
  13120. } else if ( overBottom > 0 ) {
  13121. position.top -= overBottom;
  13122. // adjust based on position and margin
  13123. } else {
  13124. position.top = max( position.top - collisionPosTop, position.top );
  13125. }
  13126. }
  13127. },
  13128. flip: {
  13129. left: function( position, data ) {
  13130. var within = data.within,
  13131. withinOffset = within.offset.left + within.scrollLeft,
  13132. outerWidth = within.width,
  13133. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  13134. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  13135. overLeft = collisionPosLeft - offsetLeft,
  13136. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  13137. myOffset = data.my[ 0 ] === "left" ?
  13138. -data.elemWidth :
  13139. data.my[ 0 ] === "right" ?
  13140. data.elemWidth :
  13141. 0,
  13142. atOffset = data.at[ 0 ] === "left" ?
  13143. data.targetWidth :
  13144. data.at[ 0 ] === "right" ?
  13145. -data.targetWidth :
  13146. 0,
  13147. offset = -2 * data.offset[ 0 ],
  13148. newOverRight,
  13149. newOverLeft;
  13150. if ( overLeft < 0 ) {
  13151. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
  13152. if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  13153. position.left += myOffset + atOffset + offset;
  13154. }
  13155. } else if ( overRight > 0 ) {
  13156. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
  13157. if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  13158. position.left += myOffset + atOffset + offset;
  13159. }
  13160. }
  13161. },
  13162. top: function( position, data ) {
  13163. var within = data.within,
  13164. withinOffset = within.offset.top + within.scrollTop,
  13165. outerHeight = within.height,
  13166. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  13167. collisionPosTop = position.top - data.collisionPosition.marginTop,
  13168. overTop = collisionPosTop - offsetTop,
  13169. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  13170. top = data.my[ 1 ] === "top",
  13171. myOffset = top ?
  13172. -data.elemHeight :
  13173. data.my[ 1 ] === "bottom" ?
  13174. data.elemHeight :
  13175. 0,
  13176. atOffset = data.at[ 1 ] === "top" ?
  13177. data.targetHeight :
  13178. data.at[ 1 ] === "bottom" ?
  13179. -data.targetHeight :
  13180. 0,
  13181. offset = -2 * data.offset[ 1 ],
  13182. newOverTop,
  13183. newOverBottom;
  13184. if ( overTop < 0 ) {
  13185. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
  13186. if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  13187. position.top += myOffset + atOffset + offset;
  13188. }
  13189. } else if ( overBottom > 0 ) {
  13190. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
  13191. if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  13192. position.top += myOffset + atOffset + offset;
  13193. }
  13194. }
  13195. }
  13196. },
  13197. flipfit: {
  13198. left: function() {
  13199. $.ui.position.flip.left.apply( this, arguments );
  13200. $.ui.position.fit.left.apply( this, arguments );
  13201. },
  13202. top: function() {
  13203. $.ui.position.flip.top.apply( this, arguments );
  13204. $.ui.position.fit.top.apply( this, arguments );
  13205. }
  13206. }
  13207. };
  13208. // fraction support test
  13209. (function() {
  13210. var testElement, testElementParent, testElementStyle, offsetLeft, i,
  13211. body = document.getElementsByTagName( "body" )[ 0 ],
  13212. div = document.createElement( "div" );
  13213. //Create a "fake body" for testing based on method used in jQuery.support
  13214. testElement = document.createElement( body ? "div" : "body" );
  13215. testElementStyle = {
  13216. visibility: "hidden",
  13217. width: 0,
  13218. height: 0,
  13219. border: 0,
  13220. margin: 0,
  13221. background: "none"
  13222. };
  13223. if ( body ) {
  13224. $.extend( testElementStyle, {
  13225. position: "absolute",
  13226. left: "-1000px",
  13227. top: "-1000px"
  13228. });
  13229. }
  13230. for ( i in testElementStyle ) {
  13231. testElement.style[ i ] = testElementStyle[ i ];
  13232. }
  13233. testElement.appendChild( div );
  13234. testElementParent = body || document.documentElement;
  13235. testElementParent.insertBefore( testElement, testElementParent.firstChild );
  13236. div.style.cssText = "position: absolute; left: 10.7432222px;";
  13237. offsetLeft = $( div ).offset().left;
  13238. supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
  13239. testElement.innerHTML = "";
  13240. testElementParent.removeChild( testElement );
  13241. })();
  13242. })();
  13243. return $.ui.position;
  13244. }));
  13245. /*!
  13246. * jQuery UI Menu 1.11.4
  13247. * http://jqueryui.com
  13248. *
  13249. * Copyright jQuery Foundation and other contributors
  13250. * Released under the MIT license.
  13251. * http://jquery.org/license
  13252. *
  13253. * http://api.jqueryui.com/menu/
  13254. */
  13255. (function( factory ) {
  13256. if ( typeof define === "function" && define.amd ) {
  13257. // AMD. Register as an anonymous module.
  13258. define([
  13259. "jquery",
  13260. "./core",
  13261. "./widget",
  13262. "./position"
  13263. ], factory );
  13264. } else {
  13265. // Browser globals
  13266. factory( jQuery );
  13267. }
  13268. }(function( $ ) {
  13269. return $.widget( "ui.menu", {
  13270. version: "1.11.4",
  13271. defaultElement: "<ul>",
  13272. delay: 300,
  13273. options: {
  13274. icons: {
  13275. submenu: "ui-icon-carat-1-e"
  13276. },
  13277. items: "> *",
  13278. menus: "ul",
  13279. position: {
  13280. my: "left-1 top",
  13281. at: "right top"
  13282. },
  13283. role: "menu",
  13284. // callbacks
  13285. blur: null,
  13286. focus: null,
  13287. select: null
  13288. },
  13289. _create: function() {
  13290. this.activeMenu = this.element;
  13291. // Flag used to prevent firing of the click handler
  13292. // as the event bubbles up through nested menus
  13293. this.mouseHandled = false;
  13294. this.element
  13295. .uniqueId()
  13296. .addClass( "ui-menu ui-widget ui-widget-content" )
  13297. .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
  13298. .attr({
  13299. role: this.options.role,
  13300. tabIndex: 0
  13301. });
  13302. if ( this.options.disabled ) {
  13303. this.element
  13304. .addClass( "ui-state-disabled" )
  13305. .attr( "aria-disabled", "true" );
  13306. }
  13307. this._on({
  13308. // Prevent focus from sticking to links inside menu after clicking
  13309. // them (focus should always stay on UL during navigation).
  13310. "mousedown .ui-menu-item": function( event ) {
  13311. event.preventDefault();
  13312. },
  13313. "click .ui-menu-item": function( event ) {
  13314. var target = $( event.target );
  13315. if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
  13316. this.select( event );
  13317. // Only set the mouseHandled flag if the event will bubble, see #9469.
  13318. if ( !event.isPropagationStopped() ) {
  13319. this.mouseHandled = true;
  13320. }
  13321. // Open submenu on click
  13322. if ( target.has( ".ui-menu" ).length ) {
  13323. this.expand( event );
  13324. } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
  13325. // Redirect focus to the menu
  13326. this.element.trigger( "focus", [ true ] );
  13327. // If the active item is on the top level, let it stay active.
  13328. // Otherwise, blur the active item since it is no longer visible.
  13329. if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
  13330. clearTimeout( this.timer );
  13331. }
  13332. }
  13333. }
  13334. },
  13335. "mouseenter .ui-menu-item": function( event ) {
  13336. // Ignore mouse events while typeahead is active, see #10458.
  13337. // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  13338. // is over an item in the menu
  13339. if ( this.previousFilter ) {
  13340. return;
  13341. }
  13342. var target = $( event.currentTarget );
  13343. // Remove ui-state-active class from siblings of the newly focused menu item
  13344. // to avoid a jump caused by adjacent elements both having a class with a border
  13345. target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
  13346. this.focus( event, target );
  13347. },
  13348. mouseleave: "collapseAll",
  13349. "mouseleave .ui-menu": "collapseAll",
  13350. focus: function( event, keepActiveItem ) {
  13351. // If there's already an active item, keep it active
  13352. // If not, activate the first item
  13353. var item = this.active || this.element.find( this.options.items ).eq( 0 );
  13354. if ( !keepActiveItem ) {
  13355. this.focus( event, item );
  13356. }
  13357. },
  13358. blur: function( event ) {
  13359. this._delay(function() {
  13360. if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
  13361. this.collapseAll( event );
  13362. }
  13363. });
  13364. },
  13365. keydown: "_keydown"
  13366. });
  13367. this.refresh();
  13368. // Clicks outside of a menu collapse any open menus
  13369. this._on( this.document, {
  13370. click: function( event ) {
  13371. if ( this._closeOnDocumentClick( event ) ) {
  13372. this.collapseAll( event );
  13373. }
  13374. // Reset the mouseHandled flag
  13375. this.mouseHandled = false;
  13376. }
  13377. });
  13378. },
  13379. _destroy: function() {
  13380. // Destroy (sub)menus
  13381. this.element
  13382. .removeAttr( "aria-activedescendant" )
  13383. .find( ".ui-menu" ).addBack()
  13384. .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
  13385. .removeAttr( "role" )
  13386. .removeAttr( "tabIndex" )
  13387. .removeAttr( "aria-labelledby" )
  13388. .removeAttr( "aria-expanded" )
  13389. .removeAttr( "aria-hidden" )
  13390. .removeAttr( "aria-disabled" )
  13391. .removeUniqueId()
  13392. .show();
  13393. // Destroy menu items
  13394. this.element.find( ".ui-menu-item" )
  13395. .removeClass( "ui-menu-item" )
  13396. .removeAttr( "role" )
  13397. .removeAttr( "aria-disabled" )
  13398. .removeUniqueId()
  13399. .removeClass( "ui-state-hover" )
  13400. .removeAttr( "tabIndex" )
  13401. .removeAttr( "role" )
  13402. .removeAttr( "aria-haspopup" )
  13403. .children().each( function() {
  13404. var elem = $( this );
  13405. if ( elem.data( "ui-menu-submenu-carat" ) ) {
  13406. elem.remove();
  13407. }
  13408. });
  13409. // Destroy menu dividers
  13410. this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
  13411. },
  13412. _keydown: function( event ) {
  13413. var match, prev, character, skip,
  13414. preventDefault = true;
  13415. switch ( event.keyCode ) {
  13416. case $.ui.keyCode.PAGE_UP:
  13417. this.previousPage( event );
  13418. break;
  13419. case $.ui.keyCode.PAGE_DOWN:
  13420. this.nextPage( event );
  13421. break;
  13422. case $.ui.keyCode.HOME:
  13423. this._move( "first", "first", event );
  13424. break;
  13425. case $.ui.keyCode.END:
  13426. this._move( "last", "last", event );
  13427. break;
  13428. case $.ui.keyCode.UP:
  13429. this.previous( event );
  13430. break;
  13431. case $.ui.keyCode.DOWN:
  13432. this.next( event );
  13433. break;
  13434. case $.ui.keyCode.LEFT:
  13435. this.collapse( event );
  13436. break;
  13437. case $.ui.keyCode.RIGHT:
  13438. if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  13439. this.expand( event );
  13440. }
  13441. break;
  13442. case $.ui.keyCode.ENTER:
  13443. case $.ui.keyCode.SPACE:
  13444. this._activate( event );
  13445. break;
  13446. case $.ui.keyCode.ESCAPE:
  13447. this.collapse( event );
  13448. break;
  13449. default:
  13450. preventDefault = false;
  13451. prev = this.previousFilter || "";
  13452. character = String.fromCharCode( event.keyCode );
  13453. skip = false;
  13454. clearTimeout( this.filterTimer );
  13455. if ( character === prev ) {
  13456. skip = true;
  13457. } else {
  13458. character = prev + character;
  13459. }
  13460. match = this._filterMenuItems( character );
  13461. match = skip && match.index( this.active.next() ) !== -1 ?
  13462. this.active.nextAll( ".ui-menu-item" ) :
  13463. match;
  13464. // If no matches on the current filter, reset to the last character pressed
  13465. // to move down the menu to the first item that starts with that character
  13466. if ( !match.length ) {
  13467. character = String.fromCharCode( event.keyCode );
  13468. match = this._filterMenuItems( character );
  13469. }
  13470. if ( match.length ) {
  13471. this.focus( event, match );
  13472. this.previousFilter = character;
  13473. this.filterTimer = this._delay(function() {
  13474. delete this.previousFilter;
  13475. }, 1000 );
  13476. } else {
  13477. delete this.previousFilter;
  13478. }
  13479. }
  13480. if ( preventDefault ) {
  13481. event.preventDefault();
  13482. }
  13483. },
  13484. _activate: function( event ) {
  13485. if ( !this.active.is( ".ui-state-disabled" ) ) {
  13486. if ( this.active.is( "[aria-haspopup='true']" ) ) {
  13487. this.expand( event );
  13488. } else {
  13489. this.select( event );
  13490. }
  13491. }
  13492. },
  13493. refresh: function() {
  13494. var menus, items,
  13495. that = this,
  13496. icon = this.options.icons.submenu,
  13497. submenus = this.element.find( this.options.menus );
  13498. this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
  13499. // Initialize nested menus
  13500. submenus.filter( ":not(.ui-menu)" )
  13501. .addClass( "ui-menu ui-widget ui-widget-content ui-front" )
  13502. .hide()
  13503. .attr({
  13504. role: this.options.role,
  13505. "aria-hidden": "true",
  13506. "aria-expanded": "false"
  13507. })
  13508. .each(function() {
  13509. var menu = $( this ),
  13510. item = menu.parent(),
  13511. submenuCarat = $( "<span>" )
  13512. .addClass( "ui-menu-icon ui-icon " + icon )
  13513. .data( "ui-menu-submenu-carat", true );
  13514. item
  13515. .attr( "aria-haspopup", "true" )
  13516. .prepend( submenuCarat );
  13517. menu.attr( "aria-labelledby", item.attr( "id" ) );
  13518. });
  13519. menus = submenus.add( this.element );
  13520. items = menus.find( this.options.items );
  13521. // Initialize menu-items containing spaces and/or dashes only as dividers
  13522. items.not( ".ui-menu-item" ).each(function() {
  13523. var item = $( this );
  13524. if ( that._isDivider( item ) ) {
  13525. item.addClass( "ui-widget-content ui-menu-divider" );
  13526. }
  13527. });
  13528. // Don't refresh list items that are already adapted
  13529. items.not( ".ui-menu-item, .ui-menu-divider" )
  13530. .addClass( "ui-menu-item" )
  13531. .uniqueId()
  13532. .attr({
  13533. tabIndex: -1,
  13534. role: this._itemRole()
  13535. });
  13536. // Add aria-disabled attribute to any disabled menu item
  13537. items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
  13538. // If the active item has been removed, blur the menu
  13539. if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  13540. this.blur();
  13541. }
  13542. },
  13543. _itemRole: function() {
  13544. return {
  13545. menu: "menuitem",
  13546. listbox: "option"
  13547. }[ this.options.role ];
  13548. },
  13549. _setOption: function( key, value ) {
  13550. if ( key === "icons" ) {
  13551. this.element.find( ".ui-menu-icon" )
  13552. .removeClass( this.options.icons.submenu )
  13553. .addClass( value.submenu );
  13554. }
  13555. if ( key === "disabled" ) {
  13556. this.element
  13557. .toggleClass( "ui-state-disabled", !!value )
  13558. .attr( "aria-disabled", value );
  13559. }
  13560. this._super( key, value );
  13561. },
  13562. focus: function( event, item ) {
  13563. var nested, focused;
  13564. this.blur( event, event && event.type === "focus" );
  13565. this._scrollIntoView( item );
  13566. this.active = item.first();
  13567. focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
  13568. // Only update aria-activedescendant if there's a role
  13569. // otherwise we assume focus is managed elsewhere
  13570. if ( this.options.role ) {
  13571. this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
  13572. }
  13573. // Highlight active parent menu item, if any
  13574. this.active
  13575. .parent()
  13576. .closest( ".ui-menu-item" )
  13577. .addClass( "ui-state-active" );
  13578. if ( event && event.type === "keydown" ) {
  13579. this._close();
  13580. } else {
  13581. this.timer = this._delay(function() {
  13582. this._close();
  13583. }, this.delay );
  13584. }
  13585. nested = item.children( ".ui-menu" );
  13586. if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
  13587. this._startOpening(nested);
  13588. }
  13589. this.activeMenu = item.parent();
  13590. this._trigger( "focus", event, { item: item } );
  13591. },
  13592. _scrollIntoView: function( item ) {
  13593. var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  13594. if ( this._hasScroll() ) {
  13595. borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
  13596. paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
  13597. offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  13598. scroll = this.activeMenu.scrollTop();
  13599. elementHeight = this.activeMenu.height();
  13600. itemHeight = item.outerHeight();
  13601. if ( offset < 0 ) {
  13602. this.activeMenu.scrollTop( scroll + offset );
  13603. } else if ( offset + itemHeight > elementHeight ) {
  13604. this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  13605. }
  13606. }
  13607. },
  13608. blur: function( event, fromFocus ) {
  13609. if ( !fromFocus ) {
  13610. clearTimeout( this.timer );
  13611. }
  13612. if ( !this.active ) {
  13613. return;
  13614. }
  13615. this.active.removeClass( "ui-state-focus" );
  13616. this.active = null;
  13617. this._trigger( "blur", event, { item: this.active } );
  13618. },
  13619. _startOpening: function( submenu ) {
  13620. clearTimeout( this.timer );
  13621. // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  13622. // shift in the submenu position when mousing over the carat icon
  13623. if ( submenu.attr( "aria-hidden" ) !== "true" ) {
  13624. return;
  13625. }
  13626. this.timer = this._delay(function() {
  13627. this._close();
  13628. this._open( submenu );
  13629. }, this.delay );
  13630. },
  13631. _open: function( submenu ) {
  13632. var position = $.extend({
  13633. of: this.active
  13634. }, this.options.position );
  13635. clearTimeout( this.timer );
  13636. this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
  13637. .hide()
  13638. .attr( "aria-hidden", "true" );
  13639. submenu
  13640. .show()
  13641. .removeAttr( "aria-hidden" )
  13642. .attr( "aria-expanded", "true" )
  13643. .position( position );
  13644. },
  13645. collapseAll: function( event, all ) {
  13646. clearTimeout( this.timer );
  13647. this.timer = this._delay(function() {
  13648. // If we were passed an event, look for the submenu that contains the event
  13649. var currentMenu = all ? this.element :
  13650. $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
  13651. // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
  13652. if ( !currentMenu.length ) {
  13653. currentMenu = this.element;
  13654. }
  13655. this._close( currentMenu );
  13656. this.blur( event );
  13657. this.activeMenu = currentMenu;
  13658. }, this.delay );
  13659. },
  13660. // With no arguments, closes the currently active menu - if nothing is active
  13661. // it closes all menus. If passed an argument, it will search for menus BELOW
  13662. _close: function( startMenu ) {
  13663. if ( !startMenu ) {
  13664. startMenu = this.active ? this.active.parent() : this.element;
  13665. }
  13666. startMenu
  13667. .find( ".ui-menu" )
  13668. .hide()
  13669. .attr( "aria-hidden", "true" )
  13670. .attr( "aria-expanded", "false" )
  13671. .end()
  13672. .find( ".ui-state-active" ).not( ".ui-state-focus" )
  13673. .removeClass( "ui-state-active" );
  13674. },
  13675. _closeOnDocumentClick: function( event ) {
  13676. return !$( event.target ).closest( ".ui-menu" ).length;
  13677. },
  13678. _isDivider: function( item ) {
  13679. // Match hyphen, em dash, en dash
  13680. return !/[^\-\u2014\u2013\s]/.test( item.text() );
  13681. },
  13682. collapse: function( event ) {
  13683. var newItem = this.active &&
  13684. this.active.parent().closest( ".ui-menu-item", this.element );
  13685. if ( newItem && newItem.length ) {
  13686. this._close();
  13687. this.focus( event, newItem );
  13688. }
  13689. },
  13690. expand: function( event ) {
  13691. var newItem = this.active &&
  13692. this.active
  13693. .children( ".ui-menu " )
  13694. .find( this.options.items )
  13695. .first();
  13696. if ( newItem && newItem.length ) {
  13697. this._open( newItem.parent() );
  13698. // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  13699. this._delay(function() {
  13700. this.focus( event, newItem );
  13701. });
  13702. }
  13703. },
  13704. next: function( event ) {
  13705. this._move( "next", "first", event );
  13706. },
  13707. previous: function( event ) {
  13708. this._move( "prev", "last", event );
  13709. },
  13710. isFirstItem: function() {
  13711. return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
  13712. },
  13713. isLastItem: function() {
  13714. return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
  13715. },
  13716. _move: function( direction, filter, event ) {
  13717. var next;
  13718. if ( this.active ) {
  13719. if ( direction === "first" || direction === "last" ) {
  13720. next = this.active
  13721. [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
  13722. .eq( -1 );
  13723. } else {
  13724. next = this.active
  13725. [ direction + "All" ]( ".ui-menu-item" )
  13726. .eq( 0 );
  13727. }
  13728. }
  13729. if ( !next || !next.length || !this.active ) {
  13730. next = this.activeMenu.find( this.options.items )[ filter ]();
  13731. }
  13732. this.focus( event, next );
  13733. },
  13734. nextPage: function( event ) {
  13735. var item, base, height;
  13736. if ( !this.active ) {
  13737. this.next( event );
  13738. return;
  13739. }
  13740. if ( this.isLastItem() ) {
  13741. return;
  13742. }
  13743. if ( this._hasScroll() ) {
  13744. base = this.active.offset().top;
  13745. height = this.element.height();
  13746. this.active.nextAll( ".ui-menu-item" ).each(function() {
  13747. item = $( this );
  13748. return item.offset().top - base - height < 0;
  13749. });
  13750. this.focus( event, item );
  13751. } else {
  13752. this.focus( event, this.activeMenu.find( this.options.items )
  13753. [ !this.active ? "first" : "last" ]() );
  13754. }
  13755. },
  13756. previousPage: function( event ) {
  13757. var item, base, height;
  13758. if ( !this.active ) {
  13759. this.next( event );
  13760. return;
  13761. }
  13762. if ( this.isFirstItem() ) {
  13763. return;
  13764. }
  13765. if ( this._hasScroll() ) {
  13766. base = this.active.offset().top;
  13767. height = this.element.height();
  13768. this.active.prevAll( ".ui-menu-item" ).each(function() {
  13769. item = $( this );
  13770. return item.offset().top - base + height > 0;
  13771. });
  13772. this.focus( event, item );
  13773. } else {
  13774. this.focus( event, this.activeMenu.find( this.options.items ).first() );
  13775. }
  13776. },
  13777. _hasScroll: function() {
  13778. return this.element.outerHeight() < this.element.prop( "scrollHeight" );
  13779. },
  13780. select: function( event ) {
  13781. // TODO: It should never be possible to not have an active item at this
  13782. // point, but the tests don't trigger mouseenter before click.
  13783. this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
  13784. var ui = { item: this.active };
  13785. if ( !this.active.has( ".ui-menu" ).length ) {
  13786. this.collapseAll( event, true );
  13787. }
  13788. this._trigger( "select", event, ui );
  13789. },
  13790. _filterMenuItems: function(character) {
  13791. var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
  13792. regex = new RegExp( "^" + escapedCharacter, "i" );
  13793. return this.activeMenu
  13794. .find( this.options.items )
  13795. // Only match on items, not dividers or other content (#10571)
  13796. .filter( ".ui-menu-item" )
  13797. .filter(function() {
  13798. return regex.test( $.trim( $( this ).text() ) );
  13799. });
  13800. }
  13801. });
  13802. }));
  13803. /*!
  13804. * jQuery UI Autocomplete 1.11.4
  13805. * http://jqueryui.com
  13806. *
  13807. * Copyright jQuery Foundation and other contributors
  13808. * Released under the MIT license.
  13809. * http://jquery.org/license
  13810. *
  13811. * http://api.jqueryui.com/autocomplete/
  13812. */
  13813. (function( factory ) {
  13814. if ( typeof define === "function" && define.amd ) {
  13815. // AMD. Register as an anonymous module.
  13816. define([
  13817. "jquery",
  13818. "./core",
  13819. "./widget",
  13820. "./position",
  13821. "./menu"
  13822. ], factory );
  13823. } else {
  13824. // Browser globals
  13825. factory( jQuery );
  13826. }
  13827. }(function( $ ) {
  13828. $.widget( "ui.autocomplete", {
  13829. version: "1.11.4",
  13830. defaultElement: "<input>",
  13831. options: {
  13832. appendTo: null,
  13833. autoFocus: false,
  13834. delay: 300,
  13835. minLength: 1,
  13836. position: {
  13837. my: "left top",
  13838. at: "left bottom",
  13839. collision: "none"
  13840. },
  13841. source: null,
  13842. // callbacks
  13843. change: null,
  13844. close: null,
  13845. focus: null,
  13846. open: null,
  13847. response: null,
  13848. search: null,
  13849. select: null
  13850. },
  13851. requestIndex: 0,
  13852. pending: 0,
  13853. _create: function() {
  13854. // Some browsers only repeat keydown events, not keypress events,
  13855. // so we use the suppressKeyPress flag to determine if we've already
  13856. // handled the keydown event. #7269
  13857. // Unfortunately the code for & in keypress is the same as the up arrow,
  13858. // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  13859. // events when we know the keydown event was used to modify the
  13860. // search term. #7799
  13861. var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  13862. nodeName = this.element[ 0 ].nodeName.toLowerCase(),
  13863. isTextarea = nodeName === "textarea",
  13864. isInput = nodeName === "input";
  13865. this.isMultiLine =
  13866. // Textareas are always multi-line
  13867. isTextarea ? true :
  13868. // Inputs are always single-line, even if inside a contentEditable element
  13869. // IE also treats inputs as contentEditable
  13870. isInput ? false :
  13871. // All other element types are determined by whether or not they're contentEditable
  13872. this.element.prop( "isContentEditable" );
  13873. this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
  13874. this.isNewMenu = true;
  13875. this.element
  13876. .addClass( "ui-autocomplete-input" )
  13877. .attr( "autocomplete", "off" );
  13878. this._on( this.element, {
  13879. keydown: function( event ) {
  13880. if ( this.element.prop( "readOnly" ) ) {
  13881. suppressKeyPress = true;
  13882. suppressInput = true;
  13883. suppressKeyPressRepeat = true;
  13884. return;
  13885. }
  13886. suppressKeyPress = false;
  13887. suppressInput = false;
  13888. suppressKeyPressRepeat = false;
  13889. var keyCode = $.ui.keyCode;
  13890. switch ( event.keyCode ) {
  13891. case keyCode.PAGE_UP:
  13892. suppressKeyPress = true;
  13893. this._move( "previousPage", event );
  13894. break;
  13895. case keyCode.PAGE_DOWN:
  13896. suppressKeyPress = true;
  13897. this._move( "nextPage", event );
  13898. break;
  13899. case keyCode.UP:
  13900. suppressKeyPress = true;
  13901. this._keyEvent( "previous", event );
  13902. break;
  13903. case keyCode.DOWN:
  13904. suppressKeyPress = true;
  13905. this._keyEvent( "next", event );
  13906. break;
  13907. case keyCode.ENTER:
  13908. // when menu is open and has focus
  13909. if ( this.menu.active ) {
  13910. // #6055 - Opera still allows the keypress to occur
  13911. // which causes forms to submit
  13912. suppressKeyPress = true;
  13913. event.preventDefault();
  13914. this.menu.select( event );
  13915. }
  13916. break;
  13917. case keyCode.TAB:
  13918. if ( this.menu.active ) {
  13919. this.menu.select( event );
  13920. }
  13921. break;
  13922. case keyCode.ESCAPE:
  13923. if ( this.menu.element.is( ":visible" ) ) {
  13924. if ( !this.isMultiLine ) {
  13925. this._value( this.term );
  13926. }
  13927. this.close( event );
  13928. // Different browsers have different default behavior for escape
  13929. // Single press can mean undo or clear
  13930. // Double press in IE means clear the whole form
  13931. event.preventDefault();
  13932. }
  13933. break;
  13934. default:
  13935. suppressKeyPressRepeat = true;
  13936. // search timeout should be triggered before the input value is changed
  13937. this._searchTimeout( event );
  13938. break;
  13939. }
  13940. },
  13941. keypress: function( event ) {
  13942. if ( suppressKeyPress ) {
  13943. suppressKeyPress = false;
  13944. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  13945. event.preventDefault();
  13946. }
  13947. return;
  13948. }
  13949. if ( suppressKeyPressRepeat ) {
  13950. return;
  13951. }
  13952. // replicate some key handlers to allow them to repeat in Firefox and Opera
  13953. var keyCode = $.ui.keyCode;
  13954. switch ( event.keyCode ) {
  13955. case keyCode.PAGE_UP:
  13956. this._move( "previousPage", event );
  13957. break;
  13958. case keyCode.PAGE_DOWN:
  13959. this._move( "nextPage", event );
  13960. break;
  13961. case keyCode.UP:
  13962. this._keyEvent( "previous", event );
  13963. break;
  13964. case keyCode.DOWN:
  13965. this._keyEvent( "next", event );
  13966. break;
  13967. }
  13968. },
  13969. input: function( event ) {
  13970. if ( suppressInput ) {
  13971. suppressInput = false;
  13972. event.preventDefault();
  13973. return;
  13974. }
  13975. this._searchTimeout( event );
  13976. },
  13977. focus: function() {
  13978. this.selectedItem = null;
  13979. this.previous = this._value();
  13980. },
  13981. blur: function( event ) {
  13982. if ( this.cancelBlur ) {
  13983. delete this.cancelBlur;
  13984. return;
  13985. }
  13986. clearTimeout( this.searching );
  13987. this.close( event );
  13988. this._change( event );
  13989. }
  13990. });
  13991. this._initSource();
  13992. this.menu = $( "<ul>" )
  13993. .addClass( "ui-autocomplete ui-front" )
  13994. .appendTo( this._appendTo() )
  13995. .menu({
  13996. // disable ARIA support, the live region takes care of that
  13997. role: null
  13998. })
  13999. .hide()
  14000. .menu( "instance" );
  14001. this._on( this.menu.element, {
  14002. mousedown: function( event ) {
  14003. // prevent moving focus out of the text field
  14004. event.preventDefault();
  14005. // IE doesn't prevent moving focus even with event.preventDefault()
  14006. // so we set a flag to know when we should ignore the blur event
  14007. this.cancelBlur = true;
  14008. this._delay(function() {
  14009. delete this.cancelBlur;
  14010. });
  14011. // clicking on the scrollbar causes focus to shift to the body
  14012. // but we can't detect a mouseup or a click immediately afterward
  14013. // so we have to track the next mousedown and close the menu if
  14014. // the user clicks somewhere outside of the autocomplete
  14015. var menuElement = this.menu.element[ 0 ];
  14016. if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
  14017. this._delay(function() {
  14018. var that = this;
  14019. this.document.one( "mousedown", function( event ) {
  14020. if ( event.target !== that.element[ 0 ] &&
  14021. event.target !== menuElement &&
  14022. !$.contains( menuElement, event.target ) ) {
  14023. that.close();
  14024. }
  14025. });
  14026. });
  14027. }
  14028. },
  14029. menufocus: function( event, ui ) {
  14030. var label, item;
  14031. // support: Firefox
  14032. // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  14033. if ( this.isNewMenu ) {
  14034. this.isNewMenu = false;
  14035. if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  14036. this.menu.blur();
  14037. this.document.one( "mousemove", function() {
  14038. $( event.target ).trigger( event.originalEvent );
  14039. });
  14040. return;
  14041. }
  14042. }
  14043. item = ui.item.data( "ui-autocomplete-item" );
  14044. if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  14045. // use value to match what will end up in the input, if it was a key event
  14046. if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  14047. this._value( item.value );
  14048. }
  14049. }
  14050. // Announce the value in the liveRegion
  14051. label = ui.item.attr( "aria-label" ) || item.value;
  14052. if ( label && $.trim( label ).length ) {
  14053. this.liveRegion.children().hide();
  14054. $( "<div>" ).text( label ).appendTo( this.liveRegion );
  14055. }
  14056. },
  14057. menuselect: function( event, ui ) {
  14058. var item = ui.item.data( "ui-autocomplete-item" ),
  14059. previous = this.previous;
  14060. // only trigger when focus was lost (click on menu)
  14061. if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
  14062. this.element.focus();
  14063. this.previous = previous;
  14064. // #6109 - IE triggers two focus events and the second
  14065. // is asynchronous, so we need to reset the previous
  14066. // term synchronously and asynchronously :-(
  14067. this._delay(function() {
  14068. this.previous = previous;
  14069. this.selectedItem = item;
  14070. });
  14071. }
  14072. if ( false !== this._trigger( "select", event, { item: item } ) ) {
  14073. this._value( item.value );
  14074. }
  14075. // reset the term after the select event
  14076. // this allows custom select handling to work properly
  14077. this.term = this._value();
  14078. this.close( event );
  14079. this.selectedItem = item;
  14080. }
  14081. });
  14082. this.liveRegion = $( "<span>", {
  14083. role: "status",
  14084. "aria-live": "assertive",
  14085. "aria-relevant": "additions"
  14086. })
  14087. .addClass( "ui-helper-hidden-accessible" )
  14088. .appendTo( this.document[ 0 ].body );
  14089. // turning off autocomplete prevents the browser from remembering the
  14090. // value when navigating through history, so we re-enable autocomplete
  14091. // if the page is unloaded before the widget is destroyed. #7790
  14092. this._on( this.window, {
  14093. beforeunload: function() {
  14094. this.element.removeAttr( "autocomplete" );
  14095. }
  14096. });
  14097. },
  14098. _destroy: function() {
  14099. clearTimeout( this.searching );
  14100. this.element
  14101. .removeClass( "ui-autocomplete-input" )
  14102. .removeAttr( "autocomplete" );
  14103. this.menu.element.remove();
  14104. this.liveRegion.remove();
  14105. },
  14106. _setOption: function( key, value ) {
  14107. this._super( key, value );
  14108. if ( key === "source" ) {
  14109. this._initSource();
  14110. }
  14111. if ( key === "appendTo" ) {
  14112. this.menu.element.appendTo( this._appendTo() );
  14113. }
  14114. if ( key === "disabled" && value && this.xhr ) {
  14115. this.xhr.abort();
  14116. }
  14117. },
  14118. _appendTo: function() {
  14119. var element = this.options.appendTo;
  14120. if ( element ) {
  14121. element = element.jquery || element.nodeType ?
  14122. $( element ) :
  14123. this.document.find( element ).eq( 0 );
  14124. }
  14125. if ( !element || !element[ 0 ] ) {
  14126. element = this.element.closest( ".ui-front" );
  14127. }
  14128. if ( !element.length ) {
  14129. element = this.document[ 0 ].body;
  14130. }
  14131. return element;
  14132. },
  14133. _initSource: function() {
  14134. var array, url,
  14135. that = this;
  14136. if ( $.isArray( this.options.source ) ) {
  14137. array = this.options.source;
  14138. this.source = function( request, response ) {
  14139. response( $.ui.autocomplete.filter( array, request.term ) );
  14140. };
  14141. } else if ( typeof this.options.source === "string" ) {
  14142. url = this.options.source;
  14143. this.source = function( request, response ) {
  14144. if ( that.xhr ) {
  14145. that.xhr.abort();
  14146. }
  14147. that.xhr = $.ajax({
  14148. url: url,
  14149. data: request,
  14150. dataType: "json",
  14151. success: function( data ) {
  14152. response( data );
  14153. },
  14154. error: function() {
  14155. response([]);
  14156. }
  14157. });
  14158. };
  14159. } else {
  14160. this.source = this.options.source;
  14161. }
  14162. },
  14163. _searchTimeout: function( event ) {
  14164. clearTimeout( this.searching );
  14165. this.searching = this._delay(function() {
  14166. // Search if the value has changed, or if the user retypes the same value (see #7434)
  14167. var equalValues = this.term === this._value(),
  14168. menuVisible = this.menu.element.is( ":visible" ),
  14169. modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  14170. if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
  14171. this.selectedItem = null;
  14172. this.search( null, event );
  14173. }
  14174. }, this.options.delay );
  14175. },
  14176. search: function( value, event ) {
  14177. value = value != null ? value : this._value();
  14178. // always save the actual value, not the one passed as an argument
  14179. this.term = this._value();
  14180. if ( value.length < this.options.minLength ) {
  14181. return this.close( event );
  14182. }
  14183. if ( this._trigger( "search", event ) === false ) {
  14184. return;
  14185. }
  14186. return this._search( value );
  14187. },
  14188. _search: function( value ) {
  14189. this.pending++;
  14190. this.element.addClass( "ui-autocomplete-loading" );
  14191. this.cancelSearch = false;
  14192. this.source( { term: value }, this._response() );
  14193. },
  14194. _response: function() {
  14195. var index = ++this.requestIndex;
  14196. return $.proxy(function( content ) {
  14197. if ( index === this.requestIndex ) {
  14198. this.__response( content );
  14199. }
  14200. this.pending--;
  14201. if ( !this.pending ) {
  14202. this.element.removeClass( "ui-autocomplete-loading" );
  14203. }
  14204. }, this );
  14205. },
  14206. __response: function( content ) {
  14207. if ( content ) {
  14208. content = this._normalize( content );
  14209. }
  14210. this._trigger( "response", null, { content: content } );
  14211. if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
  14212. this._suggest( content );
  14213. this._trigger( "open" );
  14214. } else {
  14215. // use ._close() instead of .close() so we don't cancel future searches
  14216. this._close();
  14217. }
  14218. },
  14219. close: function( event ) {
  14220. this.cancelSearch = true;
  14221. this._close( event );
  14222. },
  14223. _close: function( event ) {
  14224. if ( this.menu.element.is( ":visible" ) ) {
  14225. this.menu.element.hide();
  14226. this.menu.blur();
  14227. this.isNewMenu = true;
  14228. this._trigger( "close", event );
  14229. }
  14230. },
  14231. _change: function( event ) {
  14232. if ( this.previous !== this._value() ) {
  14233. this._trigger( "change", event, { item: this.selectedItem } );
  14234. }
  14235. },
  14236. _normalize: function( items ) {
  14237. // assume all items have the right format when the first item is complete
  14238. if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
  14239. return items;
  14240. }
  14241. return $.map( items, function( item ) {
  14242. if ( typeof item === "string" ) {
  14243. return {
  14244. label: item,
  14245. value: item
  14246. };
  14247. }
  14248. return $.extend( {}, item, {
  14249. label: item.label || item.value,
  14250. value: item.value || item.label
  14251. });
  14252. });
  14253. },
  14254. _suggest: function( items ) {
  14255. var ul = this.menu.element.empty();
  14256. this._renderMenu( ul, items );
  14257. this.isNewMenu = true;
  14258. this.menu.refresh();
  14259. // size and position menu
  14260. ul.show();
  14261. this._resizeMenu();
  14262. ul.position( $.extend({
  14263. of: this.element
  14264. }, this.options.position ) );
  14265. if ( this.options.autoFocus ) {
  14266. this.menu.next();
  14267. }
  14268. },
  14269. _resizeMenu: function() {
  14270. var ul = this.menu.element;
  14271. ul.outerWidth( Math.max(
  14272. // Firefox wraps long text (possibly a rounding bug)
  14273. // so we add 1px to avoid the wrapping (#7513)
  14274. ul.width( "" ).outerWidth() + 1,
  14275. this.element.outerWidth()
  14276. ) );
  14277. },
  14278. _renderMenu: function( ul, items ) {
  14279. var that = this;
  14280. $.each( items, function( index, item ) {
  14281. that._renderItemData( ul, item );
  14282. });
  14283. },
  14284. _renderItemData: function( ul, item ) {
  14285. return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  14286. },
  14287. _renderItem: function( ul, item ) {
  14288. return $( "<li>" ).text( item.label ).appendTo( ul );
  14289. },
  14290. _move: function( direction, event ) {
  14291. if ( !this.menu.element.is( ":visible" ) ) {
  14292. this.search( null, event );
  14293. return;
  14294. }
  14295. if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  14296. this.menu.isLastItem() && /^next/.test( direction ) ) {
  14297. if ( !this.isMultiLine ) {
  14298. this._value( this.term );
  14299. }
  14300. this.menu.blur();
  14301. return;
  14302. }
  14303. this.menu[ direction ]( event );
  14304. },
  14305. widget: function() {
  14306. return this.menu.element;
  14307. },
  14308. _value: function() {
  14309. return this.valueMethod.apply( this.element, arguments );
  14310. },
  14311. _keyEvent: function( keyEvent, event ) {
  14312. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  14313. this._move( keyEvent, event );
  14314. // prevents moving cursor to beginning/end of the text field in some browsers
  14315. event.preventDefault();
  14316. }
  14317. }
  14318. });
  14319. $.extend( $.ui.autocomplete, {
  14320. escapeRegex: function( value ) {
  14321. return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
  14322. },
  14323. filter: function( array, term ) {
  14324. var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
  14325. return $.grep( array, function( value ) {
  14326. return matcher.test( value.label || value.value || value );
  14327. });
  14328. }
  14329. });
  14330. // live region extension, adding a `messages` option
  14331. // NOTE: This is an experimental API. We are still investigating
  14332. // a full solution for string manipulation and internationalization.
  14333. $.widget( "ui.autocomplete", $.ui.autocomplete, {
  14334. options: {
  14335. messages: {
  14336. noResults: "No search results.",
  14337. results: function( amount ) {
  14338. return amount + ( amount > 1 ? " results are" : " result is" ) +
  14339. " available, use up and down arrow keys to navigate.";
  14340. }
  14341. }
  14342. },
  14343. __response: function( content ) {
  14344. var message;
  14345. this._superApply( arguments );
  14346. if ( this.options.disabled || this.cancelSearch ) {
  14347. return;
  14348. }
  14349. if ( content && content.length ) {
  14350. message = this.options.messages.results( content.length );
  14351. } else {
  14352. message = this.options.messages.noResults;
  14353. }
  14354. this.liveRegion.children().hide();
  14355. $( "<div>" ).text( message ).appendTo( this.liveRegion );
  14356. }
  14357. });
  14358. return $.ui.autocomplete;
  14359. }));
  14360. (function (global, factory) {
  14361. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  14362. typeof define === 'function' && define.amd ? define(factory) :
  14363. global.moment = factory()
  14364. }(this, function () { 'use strict';
  14365. var hookCallback;
  14366. function utils_hooks__hooks () {
  14367. return hookCallback.apply(null, arguments);
  14368. }
  14369. // This is done to register the method called with moment()
  14370. // without creating circular dependencies.
  14371. function setHookCallback (callback) {
  14372. hookCallback = callback;
  14373. }
  14374. function isArray(input) {
  14375. return Object.prototype.toString.call(input) === '[object Array]';
  14376. }
  14377. function isDate(input) {
  14378. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  14379. }
  14380. function map(arr, fn) {
  14381. var res = [], i;
  14382. for (i = 0; i < arr.length; ++i) {
  14383. res.push(fn(arr[i], i));
  14384. }
  14385. return res;
  14386. }
  14387. function hasOwnProp(a, b) {
  14388. return Object.prototype.hasOwnProperty.call(a, b);
  14389. }
  14390. function extend(a, b) {
  14391. for (var i in b) {
  14392. if (hasOwnProp(b, i)) {
  14393. a[i] = b[i];
  14394. }
  14395. }
  14396. if (hasOwnProp(b, 'toString')) {
  14397. a.toString = b.toString;
  14398. }
  14399. if (hasOwnProp(b, 'valueOf')) {
  14400. a.valueOf = b.valueOf;
  14401. }
  14402. return a;
  14403. }
  14404. function create_utc__createUTC (input, format, locale, strict) {
  14405. return createLocalOrUTC(input, format, locale, strict, true).utc();
  14406. }
  14407. function defaultParsingFlags() {
  14408. // We need to deep clone this object.
  14409. return {
  14410. empty : false,
  14411. unusedTokens : [],
  14412. unusedInput : [],
  14413. overflow : -2,
  14414. charsLeftOver : 0,
  14415. nullInput : false,
  14416. invalidMonth : null,
  14417. invalidFormat : false,
  14418. userInvalidated : false,
  14419. iso : false
  14420. };
  14421. }
  14422. function getParsingFlags(m) {
  14423. if (m._pf == null) {
  14424. m._pf = defaultParsingFlags();
  14425. }
  14426. return m._pf;
  14427. }
  14428. function valid__isValid(m) {
  14429. if (m._isValid == null) {
  14430. var flags = getParsingFlags(m);
  14431. m._isValid = !isNaN(m._d.getTime()) &&
  14432. flags.overflow < 0 &&
  14433. !flags.empty &&
  14434. !flags.invalidMonth &&
  14435. !flags.invalidWeekday &&
  14436. !flags.nullInput &&
  14437. !flags.invalidFormat &&
  14438. !flags.userInvalidated;
  14439. if (m._strict) {
  14440. m._isValid = m._isValid &&
  14441. flags.charsLeftOver === 0 &&
  14442. flags.unusedTokens.length === 0 &&
  14443. flags.bigHour === undefined;
  14444. }
  14445. }
  14446. return m._isValid;
  14447. }
  14448. function valid__createInvalid (flags) {
  14449. var m = create_utc__createUTC(NaN);
  14450. if (flags != null) {
  14451. extend(getParsingFlags(m), flags);
  14452. }
  14453. else {
  14454. getParsingFlags(m).userInvalidated = true;
  14455. }
  14456. return m;
  14457. }
  14458. var momentProperties = utils_hooks__hooks.momentProperties = [];
  14459. function copyConfig(to, from) {
  14460. var i, prop, val;
  14461. if (typeof from._isAMomentObject !== 'undefined') {
  14462. to._isAMomentObject = from._isAMomentObject;
  14463. }
  14464. if (typeof from._i !== 'undefined') {
  14465. to._i = from._i;
  14466. }
  14467. if (typeof from._f !== 'undefined') {
  14468. to._f = from._f;
  14469. }
  14470. if (typeof from._l !== 'undefined') {
  14471. to._l = from._l;
  14472. }
  14473. if (typeof from._strict !== 'undefined') {
  14474. to._strict = from._strict;
  14475. }
  14476. if (typeof from._tzm !== 'undefined') {
  14477. to._tzm = from._tzm;
  14478. }
  14479. if (typeof from._isUTC !== 'undefined') {
  14480. to._isUTC = from._isUTC;
  14481. }
  14482. if (typeof from._offset !== 'undefined') {
  14483. to._offset = from._offset;
  14484. }
  14485. if (typeof from._pf !== 'undefined') {
  14486. to._pf = getParsingFlags(from);
  14487. }
  14488. if (typeof from._locale !== 'undefined') {
  14489. to._locale = from._locale;
  14490. }
  14491. if (momentProperties.length > 0) {
  14492. for (i in momentProperties) {
  14493. prop = momentProperties[i];
  14494. val = from[prop];
  14495. if (typeof val !== 'undefined') {
  14496. to[prop] = val;
  14497. }
  14498. }
  14499. }
  14500. return to;
  14501. }
  14502. var updateInProgress = false;
  14503. // Moment prototype object
  14504. function Moment(config) {
  14505. copyConfig(this, config);
  14506. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  14507. // Prevent infinite loop in case updateOffset creates new moment
  14508. // objects.
  14509. if (updateInProgress === false) {
  14510. updateInProgress = true;
  14511. utils_hooks__hooks.updateOffset(this);
  14512. updateInProgress = false;
  14513. }
  14514. }
  14515. function isMoment (obj) {
  14516. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  14517. }
  14518. function absFloor (number) {
  14519. if (number < 0) {
  14520. return Math.ceil(number);
  14521. } else {
  14522. return Math.floor(number);
  14523. }
  14524. }
  14525. function toInt(argumentForCoercion) {
  14526. var coercedNumber = +argumentForCoercion,
  14527. value = 0;
  14528. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  14529. value = absFloor(coercedNumber);
  14530. }
  14531. return value;
  14532. }
  14533. function compareArrays(array1, array2, dontConvert) {
  14534. var len = Math.min(array1.length, array2.length),
  14535. lengthDiff = Math.abs(array1.length - array2.length),
  14536. diffs = 0,
  14537. i;
  14538. for (i = 0; i < len; i++) {
  14539. if ((dontConvert && array1[i] !== array2[i]) ||
  14540. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  14541. diffs++;
  14542. }
  14543. }
  14544. return diffs + lengthDiff;
  14545. }
  14546. function Locale() {
  14547. }
  14548. var locales = {};
  14549. var globalLocale;
  14550. function normalizeLocale(key) {
  14551. return key ? key.toLowerCase().replace('_', '-') : key;
  14552. }
  14553. // pick the locale from the array
  14554. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  14555. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  14556. function chooseLocale(names) {
  14557. var i = 0, j, next, locale, split;
  14558. while (i < names.length) {
  14559. split = normalizeLocale(names[i]).split('-');
  14560. j = split.length;
  14561. next = normalizeLocale(names[i + 1]);
  14562. next = next ? next.split('-') : null;
  14563. while (j > 0) {
  14564. locale = loadLocale(split.slice(0, j).join('-'));
  14565. if (locale) {
  14566. return locale;
  14567. }
  14568. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  14569. //the next array item is better than a shallower substring of this one
  14570. break;
  14571. }
  14572. j--;
  14573. }
  14574. i++;
  14575. }
  14576. return null;
  14577. }
  14578. function loadLocale(name) {
  14579. var oldLocale = null;
  14580. // TODO: Find a better way to register and load all the locales in Node
  14581. if (!locales[name] && typeof module !== 'undefined' &&
  14582. module && module.exports) {
  14583. try {
  14584. oldLocale = globalLocale._abbr;
  14585. require('./locale/' + name);
  14586. // because defineLocale currently also sets the global locale, we
  14587. // want to undo that for lazy loaded locales
  14588. locale_locales__getSetGlobalLocale(oldLocale);
  14589. } catch (e) { }
  14590. }
  14591. return locales[name];
  14592. }
  14593. // This function will load locale and then set the global locale. If
  14594. // no arguments are passed in, it will simply return the current global
  14595. // locale key.
  14596. function locale_locales__getSetGlobalLocale (key, values) {
  14597. var data;
  14598. if (key) {
  14599. if (typeof values === 'undefined') {
  14600. data = locale_locales__getLocale(key);
  14601. }
  14602. else {
  14603. data = defineLocale(key, values);
  14604. }
  14605. if (data) {
  14606. // moment.duration._locale = moment._locale = data;
  14607. globalLocale = data;
  14608. }
  14609. }
  14610. return globalLocale._abbr;
  14611. }
  14612. function defineLocale (name, values) {
  14613. if (values !== null) {
  14614. values.abbr = name;
  14615. locales[name] = locales[name] || new Locale();
  14616. locales[name].set(values);
  14617. // backwards compat for now: also set the locale
  14618. locale_locales__getSetGlobalLocale(name);
  14619. return locales[name];
  14620. } else {
  14621. // useful for testing
  14622. delete locales[name];
  14623. return null;
  14624. }
  14625. }
  14626. // returns locale data
  14627. function locale_locales__getLocale (key) {
  14628. var locale;
  14629. if (key && key._locale && key._locale._abbr) {
  14630. key = key._locale._abbr;
  14631. }
  14632. if (!key) {
  14633. return globalLocale;
  14634. }
  14635. if (!isArray(key)) {
  14636. //short-circuit everything else
  14637. locale = loadLocale(key);
  14638. if (locale) {
  14639. return locale;
  14640. }
  14641. key = [key];
  14642. }
  14643. return chooseLocale(key);
  14644. }
  14645. var aliases = {};
  14646. function addUnitAlias (unit, shorthand) {
  14647. var lowerCase = unit.toLowerCase();
  14648. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  14649. }
  14650. function normalizeUnits(units) {
  14651. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  14652. }
  14653. function normalizeObjectUnits(inputObject) {
  14654. var normalizedInput = {},
  14655. normalizedProp,
  14656. prop;
  14657. for (prop in inputObject) {
  14658. if (hasOwnProp(inputObject, prop)) {
  14659. normalizedProp = normalizeUnits(prop);
  14660. if (normalizedProp) {
  14661. normalizedInput[normalizedProp] = inputObject[prop];
  14662. }
  14663. }
  14664. }
  14665. return normalizedInput;
  14666. }
  14667. function makeGetSet (unit, keepTime) {
  14668. return function (value) {
  14669. if (value != null) {
  14670. get_set__set(this, unit, value);
  14671. utils_hooks__hooks.updateOffset(this, keepTime);
  14672. return this;
  14673. } else {
  14674. return get_set__get(this, unit);
  14675. }
  14676. };
  14677. }
  14678. function get_set__get (mom, unit) {
  14679. return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
  14680. }
  14681. function get_set__set (mom, unit, value) {
  14682. return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  14683. }
  14684. // MOMENTS
  14685. function getSet (units, value) {
  14686. var unit;
  14687. if (typeof units === 'object') {
  14688. for (unit in units) {
  14689. this.set(unit, units[unit]);
  14690. }
  14691. } else {
  14692. units = normalizeUnits(units);
  14693. if (typeof this[units] === 'function') {
  14694. return this[units](value);
  14695. }
  14696. }
  14697. return this;
  14698. }
  14699. function zeroFill(number, targetLength, forceSign) {
  14700. var absNumber = '' + Math.abs(number),
  14701. zerosToFill = targetLength - absNumber.length,
  14702. sign = number >= 0;
  14703. return (sign ? (forceSign ? '+' : '') : '-') +
  14704. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  14705. }
  14706. var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
  14707. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  14708. var formatFunctions = {};
  14709. var formatTokenFunctions = {};
  14710. // token: 'M'
  14711. // padded: ['MM', 2]
  14712. // ordinal: 'Mo'
  14713. // callback: function () { this.month() + 1 }
  14714. function addFormatToken (token, padded, ordinal, callback) {
  14715. var func = callback;
  14716. if (typeof callback === 'string') {
  14717. func = function () {
  14718. return this[callback]();
  14719. };
  14720. }
  14721. if (token) {
  14722. formatTokenFunctions[token] = func;
  14723. }
  14724. if (padded) {
  14725. formatTokenFunctions[padded[0]] = function () {
  14726. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  14727. };
  14728. }
  14729. if (ordinal) {
  14730. formatTokenFunctions[ordinal] = function () {
  14731. return this.localeData().ordinal(func.apply(this, arguments), token);
  14732. };
  14733. }
  14734. }
  14735. function removeFormattingTokens(input) {
  14736. if (input.match(/\[[\s\S]/)) {
  14737. return input.replace(/^\[|\]$/g, '');
  14738. }
  14739. return input.replace(/\\/g, '');
  14740. }
  14741. function makeFormatFunction(format) {
  14742. var array = format.match(formattingTokens), i, length;
  14743. for (i = 0, length = array.length; i < length; i++) {
  14744. if (formatTokenFunctions[array[i]]) {
  14745. array[i] = formatTokenFunctions[array[i]];
  14746. } else {
  14747. array[i] = removeFormattingTokens(array[i]);
  14748. }
  14749. }
  14750. return function (mom) {
  14751. var output = '';
  14752. for (i = 0; i < length; i++) {
  14753. output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
  14754. }
  14755. return output;
  14756. };
  14757. }
  14758. // format date using native date object
  14759. function formatMoment(m, format) {
  14760. if (!m.isValid()) {
  14761. return m.localeData().invalidDate();
  14762. }
  14763. format = expandFormat(format, m.localeData());
  14764. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  14765. return formatFunctions[format](m);
  14766. }
  14767. function expandFormat(format, locale) {
  14768. var i = 5;
  14769. function replaceLongDateFormatTokens(input) {
  14770. return locale.longDateFormat(input) || input;
  14771. }
  14772. localFormattingTokens.lastIndex = 0;
  14773. while (i >= 0 && localFormattingTokens.test(format)) {
  14774. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  14775. localFormattingTokens.lastIndex = 0;
  14776. i -= 1;
  14777. }
  14778. return format;
  14779. }
  14780. var match1 = /\d/; // 0 - 9
  14781. var match2 = /\d\d/; // 00 - 99
  14782. var match3 = /\d{3}/; // 000 - 999
  14783. var match4 = /\d{4}/; // 0000 - 9999
  14784. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  14785. var match1to2 = /\d\d?/; // 0 - 99
  14786. var match1to3 = /\d{1,3}/; // 0 - 999
  14787. var match1to4 = /\d{1,4}/; // 0 - 9999
  14788. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  14789. var matchUnsigned = /\d+/; // 0 - inf
  14790. var matchSigned = /[+-]?\d+/; // -inf - inf
  14791. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  14792. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  14793. // any word (or two) characters or numbers including two/three word month in arabic.
  14794. var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
  14795. var regexes = {};
  14796. function isFunction (sth) {
  14797. // https://github.com/moment/moment/issues/2325
  14798. return typeof sth === 'function' &&
  14799. Object.prototype.toString.call(sth) === '[object Function]';
  14800. }
  14801. function addRegexToken (token, regex, strictRegex) {
  14802. regexes[token] = isFunction(regex) ? regex : function (isStrict) {
  14803. return (isStrict && strictRegex) ? strictRegex : regex;
  14804. };
  14805. }
  14806. function getParseRegexForToken (token, config) {
  14807. if (!hasOwnProp(regexes, token)) {
  14808. return new RegExp(unescapeFormat(token));
  14809. }
  14810. return regexes[token](config._strict, config._locale);
  14811. }
  14812. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  14813. function unescapeFormat(s) {
  14814. return s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  14815. return p1 || p2 || p3 || p4;
  14816. }).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  14817. }
  14818. var tokens = {};
  14819. function addParseToken (token, callback) {
  14820. var i, func = callback;
  14821. if (typeof token === 'string') {
  14822. token = [token];
  14823. }
  14824. if (typeof callback === 'number') {
  14825. func = function (input, array) {
  14826. array[callback] = toInt(input);
  14827. };
  14828. }
  14829. for (i = 0; i < token.length; i++) {
  14830. tokens[token[i]] = func;
  14831. }
  14832. }
  14833. function addWeekParseToken (token, callback) {
  14834. addParseToken(token, function (input, array, config, token) {
  14835. config._w = config._w || {};
  14836. callback(input, config._w, config, token);
  14837. });
  14838. }
  14839. function addTimeToArrayFromToken(token, input, config) {
  14840. if (input != null && hasOwnProp(tokens, token)) {
  14841. tokens[token](input, config._a, config, token);
  14842. }
  14843. }
  14844. var YEAR = 0;
  14845. var MONTH = 1;
  14846. var DATE = 2;
  14847. var HOUR = 3;
  14848. var MINUTE = 4;
  14849. var SECOND = 5;
  14850. var MILLISECOND = 6;
  14851. function daysInMonth(year, month) {
  14852. return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
  14853. }
  14854. // FORMATTING
  14855. addFormatToken('M', ['MM', 2], 'Mo', function () {
  14856. return this.month() + 1;
  14857. });
  14858. addFormatToken('MMM', 0, 0, function (format) {
  14859. return this.localeData().monthsShort(this, format);
  14860. });
  14861. addFormatToken('MMMM', 0, 0, function (format) {
  14862. return this.localeData().months(this, format);
  14863. });
  14864. // ALIASES
  14865. addUnitAlias('month', 'M');
  14866. // PARSING
  14867. addRegexToken('M', match1to2);
  14868. addRegexToken('MM', match1to2, match2);
  14869. addRegexToken('MMM', matchWord);
  14870. addRegexToken('MMMM', matchWord);
  14871. addParseToken(['M', 'MM'], function (input, array) {
  14872. array[MONTH] = toInt(input) - 1;
  14873. });
  14874. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  14875. var month = config._locale.monthsParse(input, token, config._strict);
  14876. // if we didn't find a month name, mark the date as invalid.
  14877. if (month != null) {
  14878. array[MONTH] = month;
  14879. } else {
  14880. getParsingFlags(config).invalidMonth = input;
  14881. }
  14882. });
  14883. // LOCALES
  14884. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  14885. function localeMonths (m) {
  14886. return this._months[m.month()];
  14887. }
  14888. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  14889. function localeMonthsShort (m) {
  14890. return this._monthsShort[m.month()];
  14891. }
  14892. function localeMonthsParse (monthName, format, strict) {
  14893. var i, mom, regex;
  14894. if (!this._monthsParse) {
  14895. this._monthsParse = [];
  14896. this._longMonthsParse = [];
  14897. this._shortMonthsParse = [];
  14898. }
  14899. for (i = 0; i < 12; i++) {
  14900. // make the regex if we don't have it already
  14901. mom = create_utc__createUTC([2000, i]);
  14902. if (strict && !this._longMonthsParse[i]) {
  14903. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  14904. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  14905. }
  14906. if (!strict && !this._monthsParse[i]) {
  14907. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  14908. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  14909. }
  14910. // test the regex
  14911. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  14912. return i;
  14913. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  14914. return i;
  14915. } else if (!strict && this._monthsParse[i].test(monthName)) {
  14916. return i;
  14917. }
  14918. }
  14919. }
  14920. // MOMENTS
  14921. function setMonth (mom, value) {
  14922. var dayOfMonth;
  14923. // TODO: Move this out of here!
  14924. if (typeof value === 'string') {
  14925. value = mom.localeData().monthsParse(value);
  14926. // TODO: Another silent failure?
  14927. if (typeof value !== 'number') {
  14928. return mom;
  14929. }
  14930. }
  14931. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  14932. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  14933. return mom;
  14934. }
  14935. function getSetMonth (value) {
  14936. if (value != null) {
  14937. setMonth(this, value);
  14938. utils_hooks__hooks.updateOffset(this, true);
  14939. return this;
  14940. } else {
  14941. return get_set__get(this, 'Month');
  14942. }
  14943. }
  14944. function getDaysInMonth () {
  14945. return daysInMonth(this.year(), this.month());
  14946. }
  14947. function checkOverflow (m) {
  14948. var overflow;
  14949. var a = m._a;
  14950. if (a && getParsingFlags(m).overflow === -2) {
  14951. overflow =
  14952. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  14953. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  14954. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  14955. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  14956. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  14957. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  14958. -1;
  14959. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  14960. overflow = DATE;
  14961. }
  14962. getParsingFlags(m).overflow = overflow;
  14963. }
  14964. return m;
  14965. }
  14966. function warn(msg) {
  14967. if (utils_hooks__hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
  14968. console.warn('Deprecation warning: ' + msg);
  14969. }
  14970. }
  14971. function deprecate(msg, fn) {
  14972. var firstTime = true;
  14973. return extend(function () {
  14974. if (firstTime) {
  14975. warn(msg + '\n' + (new Error()).stack);
  14976. firstTime = false;
  14977. }
  14978. return fn.apply(this, arguments);
  14979. }, fn);
  14980. }
  14981. var deprecations = {};
  14982. function deprecateSimple(name, msg) {
  14983. if (!deprecations[name]) {
  14984. warn(msg);
  14985. deprecations[name] = true;
  14986. }
  14987. }
  14988. utils_hooks__hooks.suppressDeprecationWarnings = false;
  14989. var from_string__isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
  14990. var isoDates = [
  14991. ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
  14992. ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
  14993. ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
  14994. ['GGGG-[W]WW', /\d{4}-W\d{2}/],
  14995. ['YYYY-DDD', /\d{4}-\d{3}/]
  14996. ];
  14997. // iso time formats and regexes
  14998. var isoTimes = [
  14999. ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
  15000. ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
  15001. ['HH:mm', /(T| )\d\d:\d\d/],
  15002. ['HH', /(T| )\d\d/]
  15003. ];
  15004. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  15005. // date from iso format
  15006. function configFromISO(config) {
  15007. var i, l,
  15008. string = config._i,
  15009. match = from_string__isoRegex.exec(string);
  15010. if (match) {
  15011. getParsingFlags(config).iso = true;
  15012. for (i = 0, l = isoDates.length; i < l; i++) {
  15013. if (isoDates[i][1].exec(string)) {
  15014. config._f = isoDates[i][0];
  15015. break;
  15016. }
  15017. }
  15018. for (i = 0, l = isoTimes.length; i < l; i++) {
  15019. if (isoTimes[i][1].exec(string)) {
  15020. // match[6] should be 'T' or space
  15021. config._f += (match[6] || ' ') + isoTimes[i][0];
  15022. break;
  15023. }
  15024. }
  15025. if (string.match(matchOffset)) {
  15026. config._f += 'Z';
  15027. }
  15028. configFromStringAndFormat(config);
  15029. } else {
  15030. config._isValid = false;
  15031. }
  15032. }
  15033. // date from iso format or fallback
  15034. function configFromString(config) {
  15035. var matched = aspNetJsonRegex.exec(config._i);
  15036. if (matched !== null) {
  15037. config._d = new Date(+matched[1]);
  15038. return;
  15039. }
  15040. configFromISO(config);
  15041. if (config._isValid === false) {
  15042. delete config._isValid;
  15043. utils_hooks__hooks.createFromInputFallback(config);
  15044. }
  15045. }
  15046. utils_hooks__hooks.createFromInputFallback = deprecate(
  15047. 'moment construction falls back to js Date. This is ' +
  15048. 'discouraged and will be removed in upcoming major ' +
  15049. 'release. Please refer to ' +
  15050. 'https://github.com/moment/moment/issues/1407 for more info.',
  15051. function (config) {
  15052. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  15053. }
  15054. );
  15055. function createDate (y, m, d, h, M, s, ms) {
  15056. //can't just apply() to create a date:
  15057. //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
  15058. var date = new Date(y, m, d, h, M, s, ms);
  15059. //the date constructor doesn't accept years < 1970
  15060. if (y < 1970) {
  15061. date.setFullYear(y);
  15062. }
  15063. return date;
  15064. }
  15065. function createUTCDate (y) {
  15066. var date = new Date(Date.UTC.apply(null, arguments));
  15067. if (y < 1970) {
  15068. date.setUTCFullYear(y);
  15069. }
  15070. return date;
  15071. }
  15072. addFormatToken(0, ['YY', 2], 0, function () {
  15073. return this.year() % 100;
  15074. });
  15075. addFormatToken(0, ['YYYY', 4], 0, 'year');
  15076. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  15077. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  15078. // ALIASES
  15079. addUnitAlias('year', 'y');
  15080. // PARSING
  15081. addRegexToken('Y', matchSigned);
  15082. addRegexToken('YY', match1to2, match2);
  15083. addRegexToken('YYYY', match1to4, match4);
  15084. addRegexToken('YYYYY', match1to6, match6);
  15085. addRegexToken('YYYYYY', match1to6, match6);
  15086. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  15087. addParseToken('YYYY', function (input, array) {
  15088. array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
  15089. });
  15090. addParseToken('YY', function (input, array) {
  15091. array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
  15092. });
  15093. // HELPERS
  15094. function daysInYear(year) {
  15095. return isLeapYear(year) ? 366 : 365;
  15096. }
  15097. function isLeapYear(year) {
  15098. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  15099. }
  15100. // HOOKS
  15101. utils_hooks__hooks.parseTwoDigitYear = function (input) {
  15102. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  15103. };
  15104. // MOMENTS
  15105. var getSetYear = makeGetSet('FullYear', false);
  15106. function getIsLeapYear () {
  15107. return isLeapYear(this.year());
  15108. }
  15109. addFormatToken('w', ['ww', 2], 'wo', 'week');
  15110. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  15111. // ALIASES
  15112. addUnitAlias('week', 'w');
  15113. addUnitAlias('isoWeek', 'W');
  15114. // PARSING
  15115. addRegexToken('w', match1to2);
  15116. addRegexToken('ww', match1to2, match2);
  15117. addRegexToken('W', match1to2);
  15118. addRegexToken('WW', match1to2, match2);
  15119. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  15120. week[token.substr(0, 1)] = toInt(input);
  15121. });
  15122. // HELPERS
  15123. // firstDayOfWeek 0 = sun, 6 = sat
  15124. // the day of the week that starts the week
  15125. // (usually sunday or monday)
  15126. // firstDayOfWeekOfYear 0 = sun, 6 = sat
  15127. // the first week is the week that contains the first
  15128. // of this day of the week
  15129. // (eg. ISO weeks use thursday (4))
  15130. function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
  15131. var end = firstDayOfWeekOfYear - firstDayOfWeek,
  15132. daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
  15133. adjustedMoment;
  15134. if (daysToDayOfWeek > end) {
  15135. daysToDayOfWeek -= 7;
  15136. }
  15137. if (daysToDayOfWeek < end - 7) {
  15138. daysToDayOfWeek += 7;
  15139. }
  15140. adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');
  15141. return {
  15142. week: Math.ceil(adjustedMoment.dayOfYear() / 7),
  15143. year: adjustedMoment.year()
  15144. };
  15145. }
  15146. // LOCALES
  15147. function localeWeek (mom) {
  15148. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  15149. }
  15150. var defaultLocaleWeek = {
  15151. dow : 0, // Sunday is the first day of the week.
  15152. doy : 6 // The week that contains Jan 1st is the first week of the year.
  15153. };
  15154. function localeFirstDayOfWeek () {
  15155. return this._week.dow;
  15156. }
  15157. function localeFirstDayOfYear () {
  15158. return this._week.doy;
  15159. }
  15160. // MOMENTS
  15161. function getSetWeek (input) {
  15162. var week = this.localeData().week(this);
  15163. return input == null ? week : this.add((input - week) * 7, 'd');
  15164. }
  15165. function getSetISOWeek (input) {
  15166. var week = weekOfYear(this, 1, 4).week;
  15167. return input == null ? week : this.add((input - week) * 7, 'd');
  15168. }
  15169. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  15170. // ALIASES
  15171. addUnitAlias('dayOfYear', 'DDD');
  15172. // PARSING
  15173. addRegexToken('DDD', match1to3);
  15174. addRegexToken('DDDD', match3);
  15175. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  15176. config._dayOfYear = toInt(input);
  15177. });
  15178. // HELPERS
  15179. //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  15180. function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
  15181. var week1Jan = 6 + firstDayOfWeek - firstDayOfWeekOfYear, janX = createUTCDate(year, 0, 1 + week1Jan), d = janX.getUTCDay(), dayOfYear;
  15182. if (d < firstDayOfWeek) {
  15183. d += 7;
  15184. }
  15185. weekday = weekday != null ? 1 * weekday : firstDayOfWeek;
  15186. dayOfYear = 1 + week1Jan + 7 * (week - 1) - d + weekday;
  15187. return {
  15188. year: dayOfYear > 0 ? year : year - 1,
  15189. dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
  15190. };
  15191. }
  15192. // MOMENTS
  15193. function getSetDayOfYear (input) {
  15194. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  15195. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  15196. }
  15197. // Pick the first defined of two or three arguments.
  15198. function defaults(a, b, c) {
  15199. if (a != null) {
  15200. return a;
  15201. }
  15202. if (b != null) {
  15203. return b;
  15204. }
  15205. return c;
  15206. }
  15207. function currentDateArray(config) {
  15208. var now = new Date();
  15209. if (config._useUTC) {
  15210. return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
  15211. }
  15212. return [now.getFullYear(), now.getMonth(), now.getDate()];
  15213. }
  15214. // convert an array to a date.
  15215. // the array should mirror the parameters below
  15216. // note: all values past the year are optional and will default to the lowest possible value.
  15217. // [year, month, day , hour, minute, second, millisecond]
  15218. function configFromArray (config) {
  15219. var i, date, input = [], currentDate, yearToUse;
  15220. if (config._d) {
  15221. return;
  15222. }
  15223. currentDate = currentDateArray(config);
  15224. //compute day of the year from weeks and weekdays
  15225. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  15226. dayOfYearFromWeekInfo(config);
  15227. }
  15228. //if the day of the year is set, figure out what it is
  15229. if (config._dayOfYear) {
  15230. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  15231. if (config._dayOfYear > daysInYear(yearToUse)) {
  15232. getParsingFlags(config)._overflowDayOfYear = true;
  15233. }
  15234. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  15235. config._a[MONTH] = date.getUTCMonth();
  15236. config._a[DATE] = date.getUTCDate();
  15237. }
  15238. // Default to current date.
  15239. // * if no year, month, day of month are given, default to today
  15240. // * if day of month is given, default month and year
  15241. // * if month is given, default only year
  15242. // * if year is given, don't default anything
  15243. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  15244. config._a[i] = input[i] = currentDate[i];
  15245. }
  15246. // Zero out whatever was not defaulted, including time
  15247. for (; i < 7; i++) {
  15248. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  15249. }
  15250. // Check for 24:00:00.000
  15251. if (config._a[HOUR] === 24 &&
  15252. config._a[MINUTE] === 0 &&
  15253. config._a[SECOND] === 0 &&
  15254. config._a[MILLISECOND] === 0) {
  15255. config._nextDay = true;
  15256. config._a[HOUR] = 0;
  15257. }
  15258. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  15259. // Apply timezone offset from input. The actual utcOffset can be changed
  15260. // with parseZone.
  15261. if (config._tzm != null) {
  15262. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  15263. }
  15264. if (config._nextDay) {
  15265. config._a[HOUR] = 24;
  15266. }
  15267. }
  15268. function dayOfYearFromWeekInfo(config) {
  15269. var w, weekYear, week, weekday, dow, doy, temp;
  15270. w = config._w;
  15271. if (w.GG != null || w.W != null || w.E != null) {
  15272. dow = 1;
  15273. doy = 4;
  15274. // TODO: We need to take the current isoWeekYear, but that depends on
  15275. // how we interpret now (local, utc, fixed offset). So create
  15276. // a now version of current config (take local/utc/offset flags, and
  15277. // create now).
  15278. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
  15279. week = defaults(w.W, 1);
  15280. weekday = defaults(w.E, 1);
  15281. } else {
  15282. dow = config._locale._week.dow;
  15283. doy = config._locale._week.doy;
  15284. weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
  15285. week = defaults(w.w, 1);
  15286. if (w.d != null) {
  15287. // weekday -- low day numbers are considered next week
  15288. weekday = w.d;
  15289. if (weekday < dow) {
  15290. ++week;
  15291. }
  15292. } else if (w.e != null) {
  15293. // local weekday -- counting starts from begining of week
  15294. weekday = w.e + dow;
  15295. } else {
  15296. // default to begining of week
  15297. weekday = dow;
  15298. }
  15299. }
  15300. temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
  15301. config._a[YEAR] = temp.year;
  15302. config._dayOfYear = temp.dayOfYear;
  15303. }
  15304. utils_hooks__hooks.ISO_8601 = function () {};
  15305. // date from string and format string
  15306. function configFromStringAndFormat(config) {
  15307. // TODO: Move this to another part of the creation flow to prevent circular deps
  15308. if (config._f === utils_hooks__hooks.ISO_8601) {
  15309. configFromISO(config);
  15310. return;
  15311. }
  15312. config._a = [];
  15313. getParsingFlags(config).empty = true;
  15314. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  15315. var string = '' + config._i,
  15316. i, parsedInput, tokens, token, skipped,
  15317. stringLength = string.length,
  15318. totalParsedInputLength = 0;
  15319. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  15320. for (i = 0; i < tokens.length; i++) {
  15321. token = tokens[i];
  15322. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  15323. if (parsedInput) {
  15324. skipped = string.substr(0, string.indexOf(parsedInput));
  15325. if (skipped.length > 0) {
  15326. getParsingFlags(config).unusedInput.push(skipped);
  15327. }
  15328. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  15329. totalParsedInputLength += parsedInput.length;
  15330. }
  15331. // don't parse if it's not a known token
  15332. if (formatTokenFunctions[token]) {
  15333. if (parsedInput) {
  15334. getParsingFlags(config).empty = false;
  15335. }
  15336. else {
  15337. getParsingFlags(config).unusedTokens.push(token);
  15338. }
  15339. addTimeToArrayFromToken(token, parsedInput, config);
  15340. }
  15341. else if (config._strict && !parsedInput) {
  15342. getParsingFlags(config).unusedTokens.push(token);
  15343. }
  15344. }
  15345. // add remaining unparsed input length to the string
  15346. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  15347. if (string.length > 0) {
  15348. getParsingFlags(config).unusedInput.push(string);
  15349. }
  15350. // clear _12h flag if hour is <= 12
  15351. if (getParsingFlags(config).bigHour === true &&
  15352. config._a[HOUR] <= 12 &&
  15353. config._a[HOUR] > 0) {
  15354. getParsingFlags(config).bigHour = undefined;
  15355. }
  15356. // handle meridiem
  15357. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  15358. configFromArray(config);
  15359. checkOverflow(config);
  15360. }
  15361. function meridiemFixWrap (locale, hour, meridiem) {
  15362. var isPm;
  15363. if (meridiem == null) {
  15364. // nothing to do
  15365. return hour;
  15366. }
  15367. if (locale.meridiemHour != null) {
  15368. return locale.meridiemHour(hour, meridiem);
  15369. } else if (locale.isPM != null) {
  15370. // Fallback
  15371. isPm = locale.isPM(meridiem);
  15372. if (isPm && hour < 12) {
  15373. hour += 12;
  15374. }
  15375. if (!isPm && hour === 12) {
  15376. hour = 0;
  15377. }
  15378. return hour;
  15379. } else {
  15380. // this is not supposed to happen
  15381. return hour;
  15382. }
  15383. }
  15384. function configFromStringAndArray(config) {
  15385. var tempConfig,
  15386. bestMoment,
  15387. scoreToBeat,
  15388. i,
  15389. currentScore;
  15390. if (config._f.length === 0) {
  15391. getParsingFlags(config).invalidFormat = true;
  15392. config._d = new Date(NaN);
  15393. return;
  15394. }
  15395. for (i = 0; i < config._f.length; i++) {
  15396. currentScore = 0;
  15397. tempConfig = copyConfig({}, config);
  15398. if (config._useUTC != null) {
  15399. tempConfig._useUTC = config._useUTC;
  15400. }
  15401. tempConfig._f = config._f[i];
  15402. configFromStringAndFormat(tempConfig);
  15403. if (!valid__isValid(tempConfig)) {
  15404. continue;
  15405. }
  15406. // if there is any input that was not parsed add a penalty for that format
  15407. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  15408. //or tokens
  15409. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  15410. getParsingFlags(tempConfig).score = currentScore;
  15411. if (scoreToBeat == null || currentScore < scoreToBeat) {
  15412. scoreToBeat = currentScore;
  15413. bestMoment = tempConfig;
  15414. }
  15415. }
  15416. extend(config, bestMoment || tempConfig);
  15417. }
  15418. function configFromObject(config) {
  15419. if (config._d) {
  15420. return;
  15421. }
  15422. var i = normalizeObjectUnits(config._i);
  15423. config._a = [i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond];
  15424. configFromArray(config);
  15425. }
  15426. function createFromConfig (config) {
  15427. var res = new Moment(checkOverflow(prepareConfig(config)));
  15428. if (res._nextDay) {
  15429. // Adding is smart enough around DST
  15430. res.add(1, 'd');
  15431. res._nextDay = undefined;
  15432. }
  15433. return res;
  15434. }
  15435. function prepareConfig (config) {
  15436. var input = config._i,
  15437. format = config._f;
  15438. config._locale = config._locale || locale_locales__getLocale(config._l);
  15439. if (input === null || (format === undefined && input === '')) {
  15440. return valid__createInvalid({nullInput: true});
  15441. }
  15442. if (typeof input === 'string') {
  15443. config._i = input = config._locale.preparse(input);
  15444. }
  15445. if (isMoment(input)) {
  15446. return new Moment(checkOverflow(input));
  15447. } else if (isArray(format)) {
  15448. configFromStringAndArray(config);
  15449. } else if (format) {
  15450. configFromStringAndFormat(config);
  15451. } else if (isDate(input)) {
  15452. config._d = input;
  15453. } else {
  15454. configFromInput(config);
  15455. }
  15456. return config;
  15457. }
  15458. function configFromInput(config) {
  15459. var input = config._i;
  15460. if (input === undefined) {
  15461. config._d = new Date();
  15462. } else if (isDate(input)) {
  15463. config._d = new Date(+input);
  15464. } else if (typeof input === 'string') {
  15465. configFromString(config);
  15466. } else if (isArray(input)) {
  15467. config._a = map(input.slice(0), function (obj) {
  15468. return parseInt(obj, 10);
  15469. });
  15470. configFromArray(config);
  15471. } else if (typeof(input) === 'object') {
  15472. configFromObject(config);
  15473. } else if (typeof(input) === 'number') {
  15474. // from milliseconds
  15475. config._d = new Date(input);
  15476. } else {
  15477. utils_hooks__hooks.createFromInputFallback(config);
  15478. }
  15479. }
  15480. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  15481. var c = {};
  15482. if (typeof(locale) === 'boolean') {
  15483. strict = locale;
  15484. locale = undefined;
  15485. }
  15486. // object construction must be done this way.
  15487. // https://github.com/moment/moment/issues/1423
  15488. c._isAMomentObject = true;
  15489. c._useUTC = c._isUTC = isUTC;
  15490. c._l = locale;
  15491. c._i = input;
  15492. c._f = format;
  15493. c._strict = strict;
  15494. return createFromConfig(c);
  15495. }
  15496. function local__createLocal (input, format, locale, strict) {
  15497. return createLocalOrUTC(input, format, locale, strict, false);
  15498. }
  15499. var prototypeMin = deprecate(
  15500. 'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
  15501. function () {
  15502. var other = local__createLocal.apply(null, arguments);
  15503. return other < this ? this : other;
  15504. }
  15505. );
  15506. var prototypeMax = deprecate(
  15507. 'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
  15508. function () {
  15509. var other = local__createLocal.apply(null, arguments);
  15510. return other > this ? this : other;
  15511. }
  15512. );
  15513. // Pick a moment m from moments so that m[fn](other) is true for all
  15514. // other. This relies on the function fn to be transitive.
  15515. //
  15516. // moments should either be an array of moment objects or an array, whose
  15517. // first element is an array of moment objects.
  15518. function pickBy(fn, moments) {
  15519. var res, i;
  15520. if (moments.length === 1 && isArray(moments[0])) {
  15521. moments = moments[0];
  15522. }
  15523. if (!moments.length) {
  15524. return local__createLocal();
  15525. }
  15526. res = moments[0];
  15527. for (i = 1; i < moments.length; ++i) {
  15528. if (!moments[i].isValid() || moments[i][fn](res)) {
  15529. res = moments[i];
  15530. }
  15531. }
  15532. return res;
  15533. }
  15534. // TODO: Use [].sort instead?
  15535. function min () {
  15536. var args = [].slice.call(arguments, 0);
  15537. return pickBy('isBefore', args);
  15538. }
  15539. function max () {
  15540. var args = [].slice.call(arguments, 0);
  15541. return pickBy('isAfter', args);
  15542. }
  15543. function Duration (duration) {
  15544. var normalizedInput = normalizeObjectUnits(duration),
  15545. years = normalizedInput.year || 0,
  15546. quarters = normalizedInput.quarter || 0,
  15547. months = normalizedInput.month || 0,
  15548. weeks = normalizedInput.week || 0,
  15549. days = normalizedInput.day || 0,
  15550. hours = normalizedInput.hour || 0,
  15551. minutes = normalizedInput.minute || 0,
  15552. seconds = normalizedInput.second || 0,
  15553. milliseconds = normalizedInput.millisecond || 0;
  15554. // representation for dateAddRemove
  15555. this._milliseconds = +milliseconds +
  15556. seconds * 1e3 + // 1000
  15557. minutes * 6e4 + // 1000 * 60
  15558. hours * 36e5; // 1000 * 60 * 60
  15559. // Because of dateAddRemove treats 24 hours as different from a
  15560. // day when working around DST, we need to store them separately
  15561. this._days = +days +
  15562. weeks * 7;
  15563. // It is impossible translate months into days without knowing
  15564. // which months you are are talking about, so we have to store
  15565. // it separately.
  15566. this._months = +months +
  15567. quarters * 3 +
  15568. years * 12;
  15569. this._data = {};
  15570. this._locale = locale_locales__getLocale();
  15571. this._bubble();
  15572. }
  15573. function isDuration (obj) {
  15574. return obj instanceof Duration;
  15575. }
  15576. function offset (token, separator) {
  15577. addFormatToken(token, 0, 0, function () {
  15578. var offset = this.utcOffset();
  15579. var sign = '+';
  15580. if (offset < 0) {
  15581. offset = -offset;
  15582. sign = '-';
  15583. }
  15584. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  15585. });
  15586. }
  15587. offset('Z', ':');
  15588. offset('ZZ', '');
  15589. // PARSING
  15590. addRegexToken('Z', matchOffset);
  15591. addRegexToken('ZZ', matchOffset);
  15592. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  15593. config._useUTC = true;
  15594. config._tzm = offsetFromString(input);
  15595. });
  15596. // HELPERS
  15597. // timezone chunker
  15598. // '+10:00' > ['10', '00']
  15599. // '-1530' > ['-15', '30']
  15600. var chunkOffset = /([\+\-]|\d\d)/gi;
  15601. function offsetFromString(string) {
  15602. var matches = ((string || '').match(matchOffset) || []);
  15603. var chunk = matches[matches.length - 1] || [];
  15604. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  15605. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  15606. return parts[0] === '+' ? minutes : -minutes;
  15607. }
  15608. // Return a moment from input, that is local/utc/zone equivalent to model.
  15609. function cloneWithOffset(input, model) {
  15610. var res, diff;
  15611. if (model._isUTC) {
  15612. res = model.clone();
  15613. diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);
  15614. // Use low-level api, because this fn is low-level api.
  15615. res._d.setTime(+res._d + diff);
  15616. utils_hooks__hooks.updateOffset(res, false);
  15617. return res;
  15618. } else {
  15619. return local__createLocal(input).local();
  15620. }
  15621. }
  15622. function getDateOffset (m) {
  15623. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  15624. // https://github.com/moment/moment/pull/1871
  15625. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  15626. }
  15627. // HOOKS
  15628. // This function will be called whenever a moment is mutated.
  15629. // It is intended to keep the offset in sync with the timezone.
  15630. utils_hooks__hooks.updateOffset = function () {};
  15631. // MOMENTS
  15632. // keepLocalTime = true means only change the timezone, without
  15633. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  15634. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  15635. // +0200, so we adjust the time as needed, to be valid.
  15636. //
  15637. // Keeping the time actually adds/subtracts (one hour)
  15638. // from the actual represented time. That is why we call updateOffset
  15639. // a second time. In case it wants us to change the offset again
  15640. // _changeInProgress == true case, then we have to adjust, because
  15641. // there is no such time in the given timezone.
  15642. function getSetOffset (input, keepLocalTime) {
  15643. var offset = this._offset || 0,
  15644. localAdjust;
  15645. if (input != null) {
  15646. if (typeof input === 'string') {
  15647. input = offsetFromString(input);
  15648. }
  15649. if (Math.abs(input) < 16) {
  15650. input = input * 60;
  15651. }
  15652. if (!this._isUTC && keepLocalTime) {
  15653. localAdjust = getDateOffset(this);
  15654. }
  15655. this._offset = input;
  15656. this._isUTC = true;
  15657. if (localAdjust != null) {
  15658. this.add(localAdjust, 'm');
  15659. }
  15660. if (offset !== input) {
  15661. if (!keepLocalTime || this._changeInProgress) {
  15662. add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
  15663. } else if (!this._changeInProgress) {
  15664. this._changeInProgress = true;
  15665. utils_hooks__hooks.updateOffset(this, true);
  15666. this._changeInProgress = null;
  15667. }
  15668. }
  15669. return this;
  15670. } else {
  15671. return this._isUTC ? offset : getDateOffset(this);
  15672. }
  15673. }
  15674. function getSetZone (input, keepLocalTime) {
  15675. if (input != null) {
  15676. if (typeof input !== 'string') {
  15677. input = -input;
  15678. }
  15679. this.utcOffset(input, keepLocalTime);
  15680. return this;
  15681. } else {
  15682. return -this.utcOffset();
  15683. }
  15684. }
  15685. function setOffsetToUTC (keepLocalTime) {
  15686. return this.utcOffset(0, keepLocalTime);
  15687. }
  15688. function setOffsetToLocal (keepLocalTime) {
  15689. if (this._isUTC) {
  15690. this.utcOffset(0, keepLocalTime);
  15691. this._isUTC = false;
  15692. if (keepLocalTime) {
  15693. this.subtract(getDateOffset(this), 'm');
  15694. }
  15695. }
  15696. return this;
  15697. }
  15698. function setOffsetToParsedOffset () {
  15699. if (this._tzm) {
  15700. this.utcOffset(this._tzm);
  15701. } else if (typeof this._i === 'string') {
  15702. this.utcOffset(offsetFromString(this._i));
  15703. }
  15704. return this;
  15705. }
  15706. function hasAlignedHourOffset (input) {
  15707. input = input ? local__createLocal(input).utcOffset() : 0;
  15708. return (this.utcOffset() - input) % 60 === 0;
  15709. }
  15710. function isDaylightSavingTime () {
  15711. return (
  15712. this.utcOffset() > this.clone().month(0).utcOffset() ||
  15713. this.utcOffset() > this.clone().month(5).utcOffset()
  15714. );
  15715. }
  15716. function isDaylightSavingTimeShifted () {
  15717. if (typeof this._isDSTShifted !== 'undefined') {
  15718. return this._isDSTShifted;
  15719. }
  15720. var c = {};
  15721. copyConfig(c, this);
  15722. c = prepareConfig(c);
  15723. if (c._a) {
  15724. var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
  15725. this._isDSTShifted = this.isValid() &&
  15726. compareArrays(c._a, other.toArray()) > 0;
  15727. } else {
  15728. this._isDSTShifted = false;
  15729. }
  15730. return this._isDSTShifted;
  15731. }
  15732. function isLocal () {
  15733. return !this._isUTC;
  15734. }
  15735. function isUtcOffset () {
  15736. return this._isUTC;
  15737. }
  15738. function isUtc () {
  15739. return this._isUTC && this._offset === 0;
  15740. }
  15741. var aspNetRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;
  15742. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  15743. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  15744. var create__isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
  15745. function create__createDuration (input, key) {
  15746. var duration = input,
  15747. // matching against regexp is expensive, do it on demand
  15748. match = null,
  15749. sign,
  15750. ret,
  15751. diffRes;
  15752. if (isDuration(input)) {
  15753. duration = {
  15754. ms : input._milliseconds,
  15755. d : input._days,
  15756. M : input._months
  15757. };
  15758. } else if (typeof input === 'number') {
  15759. duration = {};
  15760. if (key) {
  15761. duration[key] = input;
  15762. } else {
  15763. duration.milliseconds = input;
  15764. }
  15765. } else if (!!(match = aspNetRegex.exec(input))) {
  15766. sign = (match[1] === '-') ? -1 : 1;
  15767. duration = {
  15768. y : 0,
  15769. d : toInt(match[DATE]) * sign,
  15770. h : toInt(match[HOUR]) * sign,
  15771. m : toInt(match[MINUTE]) * sign,
  15772. s : toInt(match[SECOND]) * sign,
  15773. ms : toInt(match[MILLISECOND]) * sign
  15774. };
  15775. } else if (!!(match = create__isoRegex.exec(input))) {
  15776. sign = (match[1] === '-') ? -1 : 1;
  15777. duration = {
  15778. y : parseIso(match[2], sign),
  15779. M : parseIso(match[3], sign),
  15780. d : parseIso(match[4], sign),
  15781. h : parseIso(match[5], sign),
  15782. m : parseIso(match[6], sign),
  15783. s : parseIso(match[7], sign),
  15784. w : parseIso(match[8], sign)
  15785. };
  15786. } else if (duration == null) {// checks for null or undefined
  15787. duration = {};
  15788. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  15789. diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
  15790. duration = {};
  15791. duration.ms = diffRes.milliseconds;
  15792. duration.M = diffRes.months;
  15793. }
  15794. ret = new Duration(duration);
  15795. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  15796. ret._locale = input._locale;
  15797. }
  15798. return ret;
  15799. }
  15800. create__createDuration.fn = Duration.prototype;
  15801. function parseIso (inp, sign) {
  15802. // We'd normally use ~~inp for this, but unfortunately it also
  15803. // converts floats to ints.
  15804. // inp may be undefined, so careful calling replace on it.
  15805. var res = inp && parseFloat(inp.replace(',', '.'));
  15806. // apply sign while we're at it
  15807. return (isNaN(res) ? 0 : res) * sign;
  15808. }
  15809. function positiveMomentsDifference(base, other) {
  15810. var res = {milliseconds: 0, months: 0};
  15811. res.months = other.month() - base.month() +
  15812. (other.year() - base.year()) * 12;
  15813. if (base.clone().add(res.months, 'M').isAfter(other)) {
  15814. --res.months;
  15815. }
  15816. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  15817. return res;
  15818. }
  15819. function momentsDifference(base, other) {
  15820. var res;
  15821. other = cloneWithOffset(other, base);
  15822. if (base.isBefore(other)) {
  15823. res = positiveMomentsDifference(base, other);
  15824. } else {
  15825. res = positiveMomentsDifference(other, base);
  15826. res.milliseconds = -res.milliseconds;
  15827. res.months = -res.months;
  15828. }
  15829. return res;
  15830. }
  15831. function createAdder(direction, name) {
  15832. return function (val, period) {
  15833. var dur, tmp;
  15834. //invert the arguments, but complain about it
  15835. if (period !== null && !isNaN(+period)) {
  15836. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
  15837. tmp = val; val = period; period = tmp;
  15838. }
  15839. val = typeof val === 'string' ? +val : val;
  15840. dur = create__createDuration(val, period);
  15841. add_subtract__addSubtract(this, dur, direction);
  15842. return this;
  15843. };
  15844. }
  15845. function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
  15846. var milliseconds = duration._milliseconds,
  15847. days = duration._days,
  15848. months = duration._months;
  15849. updateOffset = updateOffset == null ? true : updateOffset;
  15850. if (milliseconds) {
  15851. mom._d.setTime(+mom._d + milliseconds * isAdding);
  15852. }
  15853. if (days) {
  15854. get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
  15855. }
  15856. if (months) {
  15857. setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
  15858. }
  15859. if (updateOffset) {
  15860. utils_hooks__hooks.updateOffset(mom, days || months);
  15861. }
  15862. }
  15863. var add_subtract__add = createAdder(1, 'add');
  15864. var add_subtract__subtract = createAdder(-1, 'subtract');
  15865. function moment_calendar__calendar (time, formats) {
  15866. // We want to compare the start of today, vs this.
  15867. // Getting start-of-today depends on whether we're local/utc/offset or not.
  15868. var now = time || local__createLocal(),
  15869. sod = cloneWithOffset(now, this).startOf('day'),
  15870. diff = this.diff(sod, 'days', true),
  15871. format = diff < -6 ? 'sameElse' :
  15872. diff < -1 ? 'lastWeek' :
  15873. diff < 0 ? 'lastDay' :
  15874. diff < 1 ? 'sameDay' :
  15875. diff < 2 ? 'nextDay' :
  15876. diff < 7 ? 'nextWeek' : 'sameElse';
  15877. return this.format(formats && formats[format] || this.localeData().calendar(format, this, local__createLocal(now)));
  15878. }
  15879. function clone () {
  15880. return new Moment(this);
  15881. }
  15882. function isAfter (input, units) {
  15883. var inputMs;
  15884. units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
  15885. if (units === 'millisecond') {
  15886. input = isMoment(input) ? input : local__createLocal(input);
  15887. return +this > +input;
  15888. } else {
  15889. inputMs = isMoment(input) ? +input : +local__createLocal(input);
  15890. return inputMs < +this.clone().startOf(units);
  15891. }
  15892. }
  15893. function isBefore (input, units) {
  15894. var inputMs;
  15895. units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
  15896. if (units === 'millisecond') {
  15897. input = isMoment(input) ? input : local__createLocal(input);
  15898. return +this < +input;
  15899. } else {
  15900. inputMs = isMoment(input) ? +input : +local__createLocal(input);
  15901. return +this.clone().endOf(units) < inputMs;
  15902. }
  15903. }
  15904. function isBetween (from, to, units) {
  15905. return this.isAfter(from, units) && this.isBefore(to, units);
  15906. }
  15907. function isSame (input, units) {
  15908. var inputMs;
  15909. units = normalizeUnits(units || 'millisecond');
  15910. if (units === 'millisecond') {
  15911. input = isMoment(input) ? input : local__createLocal(input);
  15912. return +this === +input;
  15913. } else {
  15914. inputMs = +local__createLocal(input);
  15915. return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
  15916. }
  15917. }
  15918. function diff (input, units, asFloat) {
  15919. var that = cloneWithOffset(input, this),
  15920. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
  15921. delta, output;
  15922. units = normalizeUnits(units);
  15923. if (units === 'year' || units === 'month' || units === 'quarter') {
  15924. output = monthDiff(this, that);
  15925. if (units === 'quarter') {
  15926. output = output / 3;
  15927. } else if (units === 'year') {
  15928. output = output / 12;
  15929. }
  15930. } else {
  15931. delta = this - that;
  15932. output = units === 'second' ? delta / 1e3 : // 1000
  15933. units === 'minute' ? delta / 6e4 : // 1000 * 60
  15934. units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
  15935. units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
  15936. units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
  15937. delta;
  15938. }
  15939. return asFloat ? output : absFloor(output);
  15940. }
  15941. function monthDiff (a, b) {
  15942. // difference in months
  15943. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  15944. // b is in (anchor - 1 month, anchor + 1 month)
  15945. anchor = a.clone().add(wholeMonthDiff, 'months'),
  15946. anchor2, adjust;
  15947. if (b - anchor < 0) {
  15948. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  15949. // linear across the month
  15950. adjust = (b - anchor) / (anchor - anchor2);
  15951. } else {
  15952. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  15953. // linear across the month
  15954. adjust = (b - anchor) / (anchor2 - anchor);
  15955. }
  15956. return -(wholeMonthDiff + adjust);
  15957. }
  15958. utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  15959. function toString () {
  15960. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  15961. }
  15962. function moment_format__toISOString () {
  15963. var m = this.clone().utc();
  15964. if (0 < m.year() && m.year() <= 9999) {
  15965. if ('function' === typeof Date.prototype.toISOString) {
  15966. // native implementation is ~50x faster, use it when we can
  15967. return this.toDate().toISOString();
  15968. } else {
  15969. return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  15970. }
  15971. } else {
  15972. return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  15973. }
  15974. }
  15975. function moment_format__format (inputString) {
  15976. var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
  15977. return this.localeData().postformat(output);
  15978. }
  15979. function from (time, withoutSuffix) {
  15980. if (!this.isValid()) {
  15981. return this.localeData().invalidDate();
  15982. }
  15983. return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  15984. }
  15985. function fromNow (withoutSuffix) {
  15986. return this.from(local__createLocal(), withoutSuffix);
  15987. }
  15988. function to (time, withoutSuffix) {
  15989. if (!this.isValid()) {
  15990. return this.localeData().invalidDate();
  15991. }
  15992. return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  15993. }
  15994. function toNow (withoutSuffix) {
  15995. return this.to(local__createLocal(), withoutSuffix);
  15996. }
  15997. function locale (key) {
  15998. var newLocaleData;
  15999. if (key === undefined) {
  16000. return this._locale._abbr;
  16001. } else {
  16002. newLocaleData = locale_locales__getLocale(key);
  16003. if (newLocaleData != null) {
  16004. this._locale = newLocaleData;
  16005. }
  16006. return this;
  16007. }
  16008. }
  16009. var lang = deprecate(
  16010. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  16011. function (key) {
  16012. if (key === undefined) {
  16013. return this.localeData();
  16014. } else {
  16015. return this.locale(key);
  16016. }
  16017. }
  16018. );
  16019. function localeData () {
  16020. return this._locale;
  16021. }
  16022. function startOf (units) {
  16023. units = normalizeUnits(units);
  16024. // the following switch intentionally omits break keywords
  16025. // to utilize falling through the cases.
  16026. switch (units) {
  16027. case 'year':
  16028. this.month(0);
  16029. /* falls through */
  16030. case 'quarter':
  16031. case 'month':
  16032. this.date(1);
  16033. /* falls through */
  16034. case 'week':
  16035. case 'isoWeek':
  16036. case 'day':
  16037. this.hours(0);
  16038. /* falls through */
  16039. case 'hour':
  16040. this.minutes(0);
  16041. /* falls through */
  16042. case 'minute':
  16043. this.seconds(0);
  16044. /* falls through */
  16045. case 'second':
  16046. this.milliseconds(0);
  16047. }
  16048. // weeks are a special case
  16049. if (units === 'week') {
  16050. this.weekday(0);
  16051. }
  16052. if (units === 'isoWeek') {
  16053. this.isoWeekday(1);
  16054. }
  16055. // quarters are also special
  16056. if (units === 'quarter') {
  16057. this.month(Math.floor(this.month() / 3) * 3);
  16058. }
  16059. return this;
  16060. }
  16061. function endOf (units) {
  16062. units = normalizeUnits(units);
  16063. if (units === undefined || units === 'millisecond') {
  16064. return this;
  16065. }
  16066. return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
  16067. }
  16068. function to_type__valueOf () {
  16069. return +this._d - ((this._offset || 0) * 60000);
  16070. }
  16071. function unix () {
  16072. return Math.floor(+this / 1000);
  16073. }
  16074. function toDate () {
  16075. return this._offset ? new Date(+this) : this._d;
  16076. }
  16077. function toArray () {
  16078. var m = this;
  16079. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  16080. }
  16081. function toObject () {
  16082. var m = this;
  16083. return {
  16084. years: m.year(),
  16085. months: m.month(),
  16086. date: m.date(),
  16087. hours: m.hours(),
  16088. minutes: m.minutes(),
  16089. seconds: m.seconds(),
  16090. milliseconds: m.milliseconds()
  16091. };
  16092. }
  16093. function moment_valid__isValid () {
  16094. return valid__isValid(this);
  16095. }
  16096. function parsingFlags () {
  16097. return extend({}, getParsingFlags(this));
  16098. }
  16099. function invalidAt () {
  16100. return getParsingFlags(this).overflow;
  16101. }
  16102. addFormatToken(0, ['gg', 2], 0, function () {
  16103. return this.weekYear() % 100;
  16104. });
  16105. addFormatToken(0, ['GG', 2], 0, function () {
  16106. return this.isoWeekYear() % 100;
  16107. });
  16108. function addWeekYearFormatToken (token, getter) {
  16109. addFormatToken(0, [token, token.length], 0, getter);
  16110. }
  16111. addWeekYearFormatToken('gggg', 'weekYear');
  16112. addWeekYearFormatToken('ggggg', 'weekYear');
  16113. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  16114. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  16115. // ALIASES
  16116. addUnitAlias('weekYear', 'gg');
  16117. addUnitAlias('isoWeekYear', 'GG');
  16118. // PARSING
  16119. addRegexToken('G', matchSigned);
  16120. addRegexToken('g', matchSigned);
  16121. addRegexToken('GG', match1to2, match2);
  16122. addRegexToken('gg', match1to2, match2);
  16123. addRegexToken('GGGG', match1to4, match4);
  16124. addRegexToken('gggg', match1to4, match4);
  16125. addRegexToken('GGGGG', match1to6, match6);
  16126. addRegexToken('ggggg', match1to6, match6);
  16127. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  16128. week[token.substr(0, 2)] = toInt(input);
  16129. });
  16130. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  16131. week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
  16132. });
  16133. // HELPERS
  16134. function weeksInYear(year, dow, doy) {
  16135. return weekOfYear(local__createLocal([year, 11, 31 + dow - doy]), dow, doy).week;
  16136. }
  16137. // MOMENTS
  16138. function getSetWeekYear (input) {
  16139. var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
  16140. return input == null ? year : this.add((input - year), 'y');
  16141. }
  16142. function getSetISOWeekYear (input) {
  16143. var year = weekOfYear(this, 1, 4).year;
  16144. return input == null ? year : this.add((input - year), 'y');
  16145. }
  16146. function getISOWeeksInYear () {
  16147. return weeksInYear(this.year(), 1, 4);
  16148. }
  16149. function getWeeksInYear () {
  16150. var weekInfo = this.localeData()._week;
  16151. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  16152. }
  16153. addFormatToken('Q', 0, 0, 'quarter');
  16154. // ALIASES
  16155. addUnitAlias('quarter', 'Q');
  16156. // PARSING
  16157. addRegexToken('Q', match1);
  16158. addParseToken('Q', function (input, array) {
  16159. array[MONTH] = (toInt(input) - 1) * 3;
  16160. });
  16161. // MOMENTS
  16162. function getSetQuarter (input) {
  16163. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  16164. }
  16165. addFormatToken('D', ['DD', 2], 'Do', 'date');
  16166. // ALIASES
  16167. addUnitAlias('date', 'D');
  16168. // PARSING
  16169. addRegexToken('D', match1to2);
  16170. addRegexToken('DD', match1to2, match2);
  16171. addRegexToken('Do', function (isStrict, locale) {
  16172. return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
  16173. });
  16174. addParseToken(['D', 'DD'], DATE);
  16175. addParseToken('Do', function (input, array) {
  16176. array[DATE] = toInt(input.match(match1to2)[0], 10);
  16177. });
  16178. // MOMENTS
  16179. var getSetDayOfMonth = makeGetSet('Date', true);
  16180. addFormatToken('d', 0, 'do', 'day');
  16181. addFormatToken('dd', 0, 0, function (format) {
  16182. return this.localeData().weekdaysMin(this, format);
  16183. });
  16184. addFormatToken('ddd', 0, 0, function (format) {
  16185. return this.localeData().weekdaysShort(this, format);
  16186. });
  16187. addFormatToken('dddd', 0, 0, function (format) {
  16188. return this.localeData().weekdays(this, format);
  16189. });
  16190. addFormatToken('e', 0, 0, 'weekday');
  16191. addFormatToken('E', 0, 0, 'isoWeekday');
  16192. // ALIASES
  16193. addUnitAlias('day', 'd');
  16194. addUnitAlias('weekday', 'e');
  16195. addUnitAlias('isoWeekday', 'E');
  16196. // PARSING
  16197. addRegexToken('d', match1to2);
  16198. addRegexToken('e', match1to2);
  16199. addRegexToken('E', match1to2);
  16200. addRegexToken('dd', matchWord);
  16201. addRegexToken('ddd', matchWord);
  16202. addRegexToken('dddd', matchWord);
  16203. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config) {
  16204. var weekday = config._locale.weekdaysParse(input);
  16205. // if we didn't get a weekday name, mark the date as invalid
  16206. if (weekday != null) {
  16207. week.d = weekday;
  16208. } else {
  16209. getParsingFlags(config).invalidWeekday = input;
  16210. }
  16211. });
  16212. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  16213. week[token] = toInt(input);
  16214. });
  16215. // HELPERS
  16216. function parseWeekday(input, locale) {
  16217. if (typeof input !== 'string') {
  16218. return input;
  16219. }
  16220. if (!isNaN(input)) {
  16221. return parseInt(input, 10);
  16222. }
  16223. input = locale.weekdaysParse(input);
  16224. if (typeof input === 'number') {
  16225. return input;
  16226. }
  16227. return null;
  16228. }
  16229. // LOCALES
  16230. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  16231. function localeWeekdays (m) {
  16232. return this._weekdays[m.day()];
  16233. }
  16234. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  16235. function localeWeekdaysShort (m) {
  16236. return this._weekdaysShort[m.day()];
  16237. }
  16238. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  16239. function localeWeekdaysMin (m) {
  16240. return this._weekdaysMin[m.day()];
  16241. }
  16242. function localeWeekdaysParse (weekdayName) {
  16243. var i, mom, regex;
  16244. this._weekdaysParse = this._weekdaysParse || [];
  16245. for (i = 0; i < 7; i++) {
  16246. // make the regex if we don't have it already
  16247. if (!this._weekdaysParse[i]) {
  16248. mom = local__createLocal([2000, 1]).day(i);
  16249. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  16250. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  16251. }
  16252. // test the regex
  16253. if (this._weekdaysParse[i].test(weekdayName)) {
  16254. return i;
  16255. }
  16256. }
  16257. }
  16258. // MOMENTS
  16259. function getSetDayOfWeek (input) {
  16260. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  16261. if (input != null) {
  16262. input = parseWeekday(input, this.localeData());
  16263. return this.add(input - day, 'd');
  16264. } else {
  16265. return day;
  16266. }
  16267. }
  16268. function getSetLocaleDayOfWeek (input) {
  16269. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  16270. return input == null ? weekday : this.add(input - weekday, 'd');
  16271. }
  16272. function getSetISODayOfWeek (input) {
  16273. // behaves the same as moment#day except
  16274. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  16275. // as a setter, sunday should belong to the previous week.
  16276. return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
  16277. }
  16278. addFormatToken('H', ['HH', 2], 0, 'hour');
  16279. addFormatToken('h', ['hh', 2], 0, function () {
  16280. return this.hours() % 12 || 12;
  16281. });
  16282. function meridiem (token, lowercase) {
  16283. addFormatToken(token, 0, 0, function () {
  16284. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  16285. });
  16286. }
  16287. meridiem('a', true);
  16288. meridiem('A', false);
  16289. // ALIASES
  16290. addUnitAlias('hour', 'h');
  16291. // PARSING
  16292. function matchMeridiem (isStrict, locale) {
  16293. return locale._meridiemParse;
  16294. }
  16295. addRegexToken('a', matchMeridiem);
  16296. addRegexToken('A', matchMeridiem);
  16297. addRegexToken('H', match1to2);
  16298. addRegexToken('h', match1to2);
  16299. addRegexToken('HH', match1to2, match2);
  16300. addRegexToken('hh', match1to2, match2);
  16301. addParseToken(['H', 'HH'], HOUR);
  16302. addParseToken(['a', 'A'], function (input, array, config) {
  16303. config._isPm = config._locale.isPM(input);
  16304. config._meridiem = input;
  16305. });
  16306. addParseToken(['h', 'hh'], function (input, array, config) {
  16307. array[HOUR] = toInt(input);
  16308. getParsingFlags(config).bigHour = true;
  16309. });
  16310. // LOCALES
  16311. function localeIsPM (input) {
  16312. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  16313. // Using charAt should be more compatible.
  16314. return ((input + '').toLowerCase().charAt(0) === 'p');
  16315. }
  16316. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  16317. function localeMeridiem (hours, minutes, isLower) {
  16318. if (hours > 11) {
  16319. return isLower ? 'pm' : 'PM';
  16320. } else {
  16321. return isLower ? 'am' : 'AM';
  16322. }
  16323. }
  16324. // MOMENTS
  16325. // Setting the hour should keep the time, because the user explicitly
  16326. // specified which hour he wants. So trying to maintain the same hour (in
  16327. // a new timezone) makes sense. Adding/subtracting hours does not follow
  16328. // this rule.
  16329. var getSetHour = makeGetSet('Hours', true);
  16330. addFormatToken('m', ['mm', 2], 0, 'minute');
  16331. // ALIASES
  16332. addUnitAlias('minute', 'm');
  16333. // PARSING
  16334. addRegexToken('m', match1to2);
  16335. addRegexToken('mm', match1to2, match2);
  16336. addParseToken(['m', 'mm'], MINUTE);
  16337. // MOMENTS
  16338. var getSetMinute = makeGetSet('Minutes', false);
  16339. addFormatToken('s', ['ss', 2], 0, 'second');
  16340. // ALIASES
  16341. addUnitAlias('second', 's');
  16342. // PARSING
  16343. addRegexToken('s', match1to2);
  16344. addRegexToken('ss', match1to2, match2);
  16345. addParseToken(['s', 'ss'], SECOND);
  16346. // MOMENTS
  16347. var getSetSecond = makeGetSet('Seconds', false);
  16348. addFormatToken('S', 0, 0, function () {
  16349. return ~~(this.millisecond() / 100);
  16350. });
  16351. addFormatToken(0, ['SS', 2], 0, function () {
  16352. return ~~(this.millisecond() / 10);
  16353. });
  16354. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  16355. addFormatToken(0, ['SSSS', 4], 0, function () {
  16356. return this.millisecond() * 10;
  16357. });
  16358. addFormatToken(0, ['SSSSS', 5], 0, function () {
  16359. return this.millisecond() * 100;
  16360. });
  16361. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  16362. return this.millisecond() * 1000;
  16363. });
  16364. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  16365. return this.millisecond() * 10000;
  16366. });
  16367. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  16368. return this.millisecond() * 100000;
  16369. });
  16370. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  16371. return this.millisecond() * 1000000;
  16372. });
  16373. // ALIASES
  16374. addUnitAlias('millisecond', 'ms');
  16375. // PARSING
  16376. addRegexToken('S', match1to3, match1);
  16377. addRegexToken('SS', match1to3, match2);
  16378. addRegexToken('SSS', match1to3, match3);
  16379. var token;
  16380. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  16381. addRegexToken(token, matchUnsigned);
  16382. }
  16383. function parseMs(input, array) {
  16384. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  16385. }
  16386. for (token = 'S'; token.length <= 9; token += 'S') {
  16387. addParseToken(token, parseMs);
  16388. }
  16389. // MOMENTS
  16390. var getSetMillisecond = makeGetSet('Milliseconds', false);
  16391. addFormatToken('z', 0, 0, 'zoneAbbr');
  16392. addFormatToken('zz', 0, 0, 'zoneName');
  16393. // MOMENTS
  16394. function getZoneAbbr () {
  16395. return this._isUTC ? 'UTC' : '';
  16396. }
  16397. function getZoneName () {
  16398. return this._isUTC ? 'Coordinated Universal Time' : '';
  16399. }
  16400. var momentPrototype__proto = Moment.prototype;
  16401. momentPrototype__proto.add = add_subtract__add;
  16402. momentPrototype__proto.calendar = moment_calendar__calendar;
  16403. momentPrototype__proto.clone = clone;
  16404. momentPrototype__proto.diff = diff;
  16405. momentPrototype__proto.endOf = endOf;
  16406. momentPrototype__proto.format = moment_format__format;
  16407. momentPrototype__proto.from = from;
  16408. momentPrototype__proto.fromNow = fromNow;
  16409. momentPrototype__proto.to = to;
  16410. momentPrototype__proto.toNow = toNow;
  16411. momentPrototype__proto.get = getSet;
  16412. momentPrototype__proto.invalidAt = invalidAt;
  16413. momentPrototype__proto.isAfter = isAfter;
  16414. momentPrototype__proto.isBefore = isBefore;
  16415. momentPrototype__proto.isBetween = isBetween;
  16416. momentPrototype__proto.isSame = isSame;
  16417. momentPrototype__proto.isValid = moment_valid__isValid;
  16418. momentPrototype__proto.lang = lang;
  16419. momentPrototype__proto.locale = locale;
  16420. momentPrototype__proto.localeData = localeData;
  16421. momentPrototype__proto.max = prototypeMax;
  16422. momentPrototype__proto.min = prototypeMin;
  16423. momentPrototype__proto.parsingFlags = parsingFlags;
  16424. momentPrototype__proto.set = getSet;
  16425. momentPrototype__proto.startOf = startOf;
  16426. momentPrototype__proto.subtract = add_subtract__subtract;
  16427. momentPrototype__proto.toArray = toArray;
  16428. momentPrototype__proto.toObject = toObject;
  16429. momentPrototype__proto.toDate = toDate;
  16430. momentPrototype__proto.toISOString = moment_format__toISOString;
  16431. momentPrototype__proto.toJSON = moment_format__toISOString;
  16432. momentPrototype__proto.toString = toString;
  16433. momentPrototype__proto.unix = unix;
  16434. momentPrototype__proto.valueOf = to_type__valueOf;
  16435. // Year
  16436. momentPrototype__proto.year = getSetYear;
  16437. momentPrototype__proto.isLeapYear = getIsLeapYear;
  16438. // Week Year
  16439. momentPrototype__proto.weekYear = getSetWeekYear;
  16440. momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
  16441. // Quarter
  16442. momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
  16443. // Month
  16444. momentPrototype__proto.month = getSetMonth;
  16445. momentPrototype__proto.daysInMonth = getDaysInMonth;
  16446. // Week
  16447. momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
  16448. momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
  16449. momentPrototype__proto.weeksInYear = getWeeksInYear;
  16450. momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
  16451. // Day
  16452. momentPrototype__proto.date = getSetDayOfMonth;
  16453. momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
  16454. momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
  16455. momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
  16456. momentPrototype__proto.dayOfYear = getSetDayOfYear;
  16457. // Hour
  16458. momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
  16459. // Minute
  16460. momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
  16461. // Second
  16462. momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
  16463. // Millisecond
  16464. momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
  16465. // Offset
  16466. momentPrototype__proto.utcOffset = getSetOffset;
  16467. momentPrototype__proto.utc = setOffsetToUTC;
  16468. momentPrototype__proto.local = setOffsetToLocal;
  16469. momentPrototype__proto.parseZone = setOffsetToParsedOffset;
  16470. momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
  16471. momentPrototype__proto.isDST = isDaylightSavingTime;
  16472. momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted;
  16473. momentPrototype__proto.isLocal = isLocal;
  16474. momentPrototype__proto.isUtcOffset = isUtcOffset;
  16475. momentPrototype__proto.isUtc = isUtc;
  16476. momentPrototype__proto.isUTC = isUtc;
  16477. // Timezone
  16478. momentPrototype__proto.zoneAbbr = getZoneAbbr;
  16479. momentPrototype__proto.zoneName = getZoneName;
  16480. // Deprecations
  16481. momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  16482. momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  16483. momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  16484. momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
  16485. var momentPrototype = momentPrototype__proto;
  16486. function moment_moment__createUnix (input) {
  16487. return local__createLocal(input * 1000);
  16488. }
  16489. function moment_moment__createInZone () {
  16490. return local__createLocal.apply(null, arguments).parseZone();
  16491. }
  16492. var defaultCalendar = {
  16493. sameDay : '[Today at] LT',
  16494. nextDay : '[Tomorrow at] LT',
  16495. nextWeek : 'dddd [at] LT',
  16496. lastDay : '[Yesterday at] LT',
  16497. lastWeek : '[Last] dddd [at] LT',
  16498. sameElse : 'L'
  16499. };
  16500. function locale_calendar__calendar (key, mom, now) {
  16501. var output = this._calendar[key];
  16502. return typeof output === 'function' ? output.call(mom, now) : output;
  16503. }
  16504. var defaultLongDateFormat = {
  16505. LTS : 'h:mm:ss A',
  16506. LT : 'h:mm A',
  16507. L : 'MM/DD/YYYY',
  16508. LL : 'MMMM D, YYYY',
  16509. LLL : 'MMMM D, YYYY h:mm A',
  16510. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  16511. };
  16512. function longDateFormat (key) {
  16513. var format = this._longDateFormat[key],
  16514. formatUpper = this._longDateFormat[key.toUpperCase()];
  16515. if (format || !formatUpper) {
  16516. return format;
  16517. }
  16518. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  16519. return val.slice(1);
  16520. });
  16521. return this._longDateFormat[key];
  16522. }
  16523. var defaultInvalidDate = 'Invalid date';
  16524. function invalidDate () {
  16525. return this._invalidDate;
  16526. }
  16527. var defaultOrdinal = '%d';
  16528. var defaultOrdinalParse = /\d{1,2}/;
  16529. function ordinal (number) {
  16530. return this._ordinal.replace('%d', number);
  16531. }
  16532. function preParsePostFormat (string) {
  16533. return string;
  16534. }
  16535. var defaultRelativeTime = {
  16536. future : 'in %s',
  16537. past : '%s ago',
  16538. s : 'a few seconds',
  16539. m : 'a minute',
  16540. mm : '%d minutes',
  16541. h : 'an hour',
  16542. hh : '%d hours',
  16543. d : 'a day',
  16544. dd : '%d days',
  16545. M : 'a month',
  16546. MM : '%d months',
  16547. y : 'a year',
  16548. yy : '%d years'
  16549. };
  16550. function relative__relativeTime (number, withoutSuffix, string, isFuture) {
  16551. var output = this._relativeTime[string];
  16552. return (typeof output === 'function') ?
  16553. output(number, withoutSuffix, string, isFuture) :
  16554. output.replace(/%d/i, number);
  16555. }
  16556. function pastFuture (diff, output) {
  16557. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  16558. return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
  16559. }
  16560. function locale_set__set (config) {
  16561. var prop, i;
  16562. for (i in config) {
  16563. prop = config[i];
  16564. if (typeof prop === 'function') {
  16565. this[i] = prop;
  16566. } else {
  16567. this['_' + i] = prop;
  16568. }
  16569. }
  16570. // Lenient ordinal parsing accepts just a number in addition to
  16571. // number + (possibly) stuff coming from _ordinalParseLenient.
  16572. this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
  16573. }
  16574. var prototype__proto = Locale.prototype;
  16575. prototype__proto._calendar = defaultCalendar;
  16576. prototype__proto.calendar = locale_calendar__calendar;
  16577. prototype__proto._longDateFormat = defaultLongDateFormat;
  16578. prototype__proto.longDateFormat = longDateFormat;
  16579. prototype__proto._invalidDate = defaultInvalidDate;
  16580. prototype__proto.invalidDate = invalidDate;
  16581. prototype__proto._ordinal = defaultOrdinal;
  16582. prototype__proto.ordinal = ordinal;
  16583. prototype__proto._ordinalParse = defaultOrdinalParse;
  16584. prototype__proto.preparse = preParsePostFormat;
  16585. prototype__proto.postformat = preParsePostFormat;
  16586. prototype__proto._relativeTime = defaultRelativeTime;
  16587. prototype__proto.relativeTime = relative__relativeTime;
  16588. prototype__proto.pastFuture = pastFuture;
  16589. prototype__proto.set = locale_set__set;
  16590. // Month
  16591. prototype__proto.months = localeMonths;
  16592. prototype__proto._months = defaultLocaleMonths;
  16593. prototype__proto.monthsShort = localeMonthsShort;
  16594. prototype__proto._monthsShort = defaultLocaleMonthsShort;
  16595. prototype__proto.monthsParse = localeMonthsParse;
  16596. // Week
  16597. prototype__proto.week = localeWeek;
  16598. prototype__proto._week = defaultLocaleWeek;
  16599. prototype__proto.firstDayOfYear = localeFirstDayOfYear;
  16600. prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
  16601. // Day of Week
  16602. prototype__proto.weekdays = localeWeekdays;
  16603. prototype__proto._weekdays = defaultLocaleWeekdays;
  16604. prototype__proto.weekdaysMin = localeWeekdaysMin;
  16605. prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin;
  16606. prototype__proto.weekdaysShort = localeWeekdaysShort;
  16607. prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
  16608. prototype__proto.weekdaysParse = localeWeekdaysParse;
  16609. // Hours
  16610. prototype__proto.isPM = localeIsPM;
  16611. prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
  16612. prototype__proto.meridiem = localeMeridiem;
  16613. function lists__get (format, index, field, setter) {
  16614. var locale = locale_locales__getLocale();
  16615. var utc = create_utc__createUTC().set(setter, index);
  16616. return locale[field](utc, format);
  16617. }
  16618. function list (format, index, field, count, setter) {
  16619. if (typeof format === 'number') {
  16620. index = format;
  16621. format = undefined;
  16622. }
  16623. format = format || '';
  16624. if (index != null) {
  16625. return lists__get(format, index, field, setter);
  16626. }
  16627. var i;
  16628. var out = [];
  16629. for (i = 0; i < count; i++) {
  16630. out[i] = lists__get(format, i, field, setter);
  16631. }
  16632. return out;
  16633. }
  16634. function lists__listMonths (format, index) {
  16635. return list(format, index, 'months', 12, 'month');
  16636. }
  16637. function lists__listMonthsShort (format, index) {
  16638. return list(format, index, 'monthsShort', 12, 'month');
  16639. }
  16640. function lists__listWeekdays (format, index) {
  16641. return list(format, index, 'weekdays', 7, 'day');
  16642. }
  16643. function lists__listWeekdaysShort (format, index) {
  16644. return list(format, index, 'weekdaysShort', 7, 'day');
  16645. }
  16646. function lists__listWeekdaysMin (format, index) {
  16647. return list(format, index, 'weekdaysMin', 7, 'day');
  16648. }
  16649. locale_locales__getSetGlobalLocale('en', {
  16650. ordinalParse: /\d{1,2}(th|st|nd|rd)/,
  16651. ordinal : function (number) {
  16652. var b = number % 10,
  16653. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  16654. (b === 1) ? 'st' :
  16655. (b === 2) ? 'nd' :
  16656. (b === 3) ? 'rd' : 'th';
  16657. return number + output;
  16658. }
  16659. });
  16660. // Side effect imports
  16661. utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
  16662. utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
  16663. var mathAbs = Math.abs;
  16664. function duration_abs__abs () {
  16665. var data = this._data;
  16666. this._milliseconds = mathAbs(this._milliseconds);
  16667. this._days = mathAbs(this._days);
  16668. this._months = mathAbs(this._months);
  16669. data.milliseconds = mathAbs(data.milliseconds);
  16670. data.seconds = mathAbs(data.seconds);
  16671. data.minutes = mathAbs(data.minutes);
  16672. data.hours = mathAbs(data.hours);
  16673. data.months = mathAbs(data.months);
  16674. data.years = mathAbs(data.years);
  16675. return this;
  16676. }
  16677. function duration_add_subtract__addSubtract (duration, input, value, direction) {
  16678. var other = create__createDuration(input, value);
  16679. duration._milliseconds += direction * other._milliseconds;
  16680. duration._days += direction * other._days;
  16681. duration._months += direction * other._months;
  16682. return duration._bubble();
  16683. }
  16684. // supports only 2.0-style add(1, 's') or add(duration)
  16685. function duration_add_subtract__add (input, value) {
  16686. return duration_add_subtract__addSubtract(this, input, value, 1);
  16687. }
  16688. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  16689. function duration_add_subtract__subtract (input, value) {
  16690. return duration_add_subtract__addSubtract(this, input, value, -1);
  16691. }
  16692. function absCeil (number) {
  16693. if (number < 0) {
  16694. return Math.floor(number);
  16695. } else {
  16696. return Math.ceil(number);
  16697. }
  16698. }
  16699. function bubble () {
  16700. var milliseconds = this._milliseconds;
  16701. var days = this._days;
  16702. var months = this._months;
  16703. var data = this._data;
  16704. var seconds, minutes, hours, years, monthsFromDays;
  16705. // if we have a mix of positive and negative values, bubble down first
  16706. // check: https://github.com/moment/moment/issues/2166
  16707. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  16708. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  16709. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  16710. days = 0;
  16711. months = 0;
  16712. }
  16713. // The following code bubbles up values, see the tests for
  16714. // examples of what that means.
  16715. data.milliseconds = milliseconds % 1000;
  16716. seconds = absFloor(milliseconds / 1000);
  16717. data.seconds = seconds % 60;
  16718. minutes = absFloor(seconds / 60);
  16719. data.minutes = minutes % 60;
  16720. hours = absFloor(minutes / 60);
  16721. data.hours = hours % 24;
  16722. days += absFloor(hours / 24);
  16723. // convert days to months
  16724. monthsFromDays = absFloor(daysToMonths(days));
  16725. months += monthsFromDays;
  16726. days -= absCeil(monthsToDays(monthsFromDays));
  16727. // 12 months -> 1 year
  16728. years = absFloor(months / 12);
  16729. months %= 12;
  16730. data.days = days;
  16731. data.months = months;
  16732. data.years = years;
  16733. return this;
  16734. }
  16735. function daysToMonths (days) {
  16736. // 400 years have 146097 days (taking into account leap year rules)
  16737. // 400 years have 12 months === 4800
  16738. return days * 4800 / 146097;
  16739. }
  16740. function monthsToDays (months) {
  16741. // the reverse of daysToMonths
  16742. return months * 146097 / 4800;
  16743. }
  16744. function as (units) {
  16745. var days;
  16746. var months;
  16747. var milliseconds = this._milliseconds;
  16748. units = normalizeUnits(units);
  16749. if (units === 'month' || units === 'year') {
  16750. days = this._days + milliseconds / 864e5;
  16751. months = this._months + daysToMonths(days);
  16752. return units === 'month' ? months : months / 12;
  16753. } else {
  16754. // handle milliseconds separately because of floating point math errors (issue #1867)
  16755. days = this._days + Math.round(monthsToDays(this._months));
  16756. switch (units) {
  16757. case 'week' : return days / 7 + milliseconds / 6048e5;
  16758. case 'day' : return days + milliseconds / 864e5;
  16759. case 'hour' : return days * 24 + milliseconds / 36e5;
  16760. case 'minute' : return days * 1440 + milliseconds / 6e4;
  16761. case 'second' : return days * 86400 + milliseconds / 1000;
  16762. // Math.floor prevents floating point math errors here
  16763. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  16764. default: throw new Error('Unknown unit ' + units);
  16765. }
  16766. }
  16767. }
  16768. // TODO: Use this.as('ms')?
  16769. function duration_as__valueOf () {
  16770. return (
  16771. this._milliseconds +
  16772. this._days * 864e5 +
  16773. (this._months % 12) * 2592e6 +
  16774. toInt(this._months / 12) * 31536e6
  16775. );
  16776. }
  16777. function makeAs (alias) {
  16778. return function () {
  16779. return this.as(alias);
  16780. };
  16781. }
  16782. var asMilliseconds = makeAs('ms');
  16783. var asSeconds = makeAs('s');
  16784. var asMinutes = makeAs('m');
  16785. var asHours = makeAs('h');
  16786. var asDays = makeAs('d');
  16787. var asWeeks = makeAs('w');
  16788. var asMonths = makeAs('M');
  16789. var asYears = makeAs('y');
  16790. function duration_get__get (units) {
  16791. units = normalizeUnits(units);
  16792. return this[units + 's']();
  16793. }
  16794. function makeGetter(name) {
  16795. return function () {
  16796. return this._data[name];
  16797. };
  16798. }
  16799. var milliseconds = makeGetter('milliseconds');
  16800. var seconds = makeGetter('seconds');
  16801. var minutes = makeGetter('minutes');
  16802. var hours = makeGetter('hours');
  16803. var days = makeGetter('days');
  16804. var duration_get__months = makeGetter('months');
  16805. var years = makeGetter('years');
  16806. function weeks () {
  16807. return absFloor(this.days() / 7);
  16808. }
  16809. var round = Math.round;
  16810. var thresholds = {
  16811. s: 45, // seconds to minute
  16812. m: 45, // minutes to hour
  16813. h: 22, // hours to day
  16814. d: 26, // days to month
  16815. M: 11 // months to year
  16816. };
  16817. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  16818. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  16819. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  16820. }
  16821. function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
  16822. var duration = create__createDuration(posNegDuration).abs();
  16823. var seconds = round(duration.as('s'));
  16824. var minutes = round(duration.as('m'));
  16825. var hours = round(duration.as('h'));
  16826. var days = round(duration.as('d'));
  16827. var months = round(duration.as('M'));
  16828. var years = round(duration.as('y'));
  16829. var a = seconds < thresholds.s && ['s', seconds] ||
  16830. minutes === 1 && ['m'] ||
  16831. minutes < thresholds.m && ['mm', minutes] ||
  16832. hours === 1 && ['h'] ||
  16833. hours < thresholds.h && ['hh', hours] ||
  16834. days === 1 && ['d'] ||
  16835. days < thresholds.d && ['dd', days] ||
  16836. months === 1 && ['M'] ||
  16837. months < thresholds.M && ['MM', months] ||
  16838. years === 1 && ['y'] || ['yy', years];
  16839. a[2] = withoutSuffix;
  16840. a[3] = +posNegDuration > 0;
  16841. a[4] = locale;
  16842. return substituteTimeAgo.apply(null, a);
  16843. }
  16844. // This function allows you to set a threshold for relative time strings
  16845. function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
  16846. if (thresholds[threshold] === undefined) {
  16847. return false;
  16848. }
  16849. if (limit === undefined) {
  16850. return thresholds[threshold];
  16851. }
  16852. thresholds[threshold] = limit;
  16853. return true;
  16854. }
  16855. function humanize (withSuffix) {
  16856. var locale = this.localeData();
  16857. var output = duration_humanize__relativeTime(this, !withSuffix, locale);
  16858. if (withSuffix) {
  16859. output = locale.pastFuture(+this, output);
  16860. }
  16861. return locale.postformat(output);
  16862. }
  16863. var iso_string__abs = Math.abs;
  16864. function iso_string__toISOString() {
  16865. // for ISO strings we do not use the normal bubbling rules:
  16866. // * milliseconds bubble up until they become hours
  16867. // * days do not bubble at all
  16868. // * months bubble up until they become years
  16869. // This is because there is no context-free conversion between hours and days
  16870. // (think of clock changes)
  16871. // and also not between days and months (28-31 days per month)
  16872. var seconds = iso_string__abs(this._milliseconds) / 1000;
  16873. var days = iso_string__abs(this._days);
  16874. var months = iso_string__abs(this._months);
  16875. var minutes, hours, years;
  16876. // 3600 seconds -> 60 minutes -> 1 hour
  16877. minutes = absFloor(seconds / 60);
  16878. hours = absFloor(minutes / 60);
  16879. seconds %= 60;
  16880. minutes %= 60;
  16881. // 12 months -> 1 year
  16882. years = absFloor(months / 12);
  16883. months %= 12;
  16884. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  16885. var Y = years;
  16886. var M = months;
  16887. var D = days;
  16888. var h = hours;
  16889. var m = minutes;
  16890. var s = seconds;
  16891. var total = this.asSeconds();
  16892. if (!total) {
  16893. // this is the same as C#'s (Noda) and python (isodate)...
  16894. // but not other JS (goog.date)
  16895. return 'P0D';
  16896. }
  16897. return (total < 0 ? '-' : '') +
  16898. 'P' +
  16899. (Y ? Y + 'Y' : '') +
  16900. (M ? M + 'M' : '') +
  16901. (D ? D + 'D' : '') +
  16902. ((h || m || s) ? 'T' : '') +
  16903. (h ? h + 'H' : '') +
  16904. (m ? m + 'M' : '') +
  16905. (s ? s + 'S' : '');
  16906. }
  16907. var duration_prototype__proto = Duration.prototype;
  16908. duration_prototype__proto.abs = duration_abs__abs;
  16909. duration_prototype__proto.add = duration_add_subtract__add;
  16910. duration_prototype__proto.subtract = duration_add_subtract__subtract;
  16911. duration_prototype__proto.as = as;
  16912. duration_prototype__proto.asMilliseconds = asMilliseconds;
  16913. duration_prototype__proto.asSeconds = asSeconds;
  16914. duration_prototype__proto.asMinutes = asMinutes;
  16915. duration_prototype__proto.asHours = asHours;
  16916. duration_prototype__proto.asDays = asDays;
  16917. duration_prototype__proto.asWeeks = asWeeks;
  16918. duration_prototype__proto.asMonths = asMonths;
  16919. duration_prototype__proto.asYears = asYears;
  16920. duration_prototype__proto.valueOf = duration_as__valueOf;
  16921. duration_prototype__proto._bubble = bubble;
  16922. duration_prototype__proto.get = duration_get__get;
  16923. duration_prototype__proto.milliseconds = milliseconds;
  16924. duration_prototype__proto.seconds = seconds;
  16925. duration_prototype__proto.minutes = minutes;
  16926. duration_prototype__proto.hours = hours;
  16927. duration_prototype__proto.days = days;
  16928. duration_prototype__proto.weeks = weeks;
  16929. duration_prototype__proto.months = duration_get__months;
  16930. duration_prototype__proto.years = years;
  16931. duration_prototype__proto.humanize = humanize;
  16932. duration_prototype__proto.toISOString = iso_string__toISOString;
  16933. duration_prototype__proto.toString = iso_string__toISOString;
  16934. duration_prototype__proto.toJSON = iso_string__toISOString;
  16935. duration_prototype__proto.locale = locale;
  16936. duration_prototype__proto.localeData = localeData;
  16937. // Deprecations
  16938. duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
  16939. duration_prototype__proto.lang = lang;
  16940. // Side effect imports
  16941. addFormatToken('X', 0, 0, 'unix');
  16942. addFormatToken('x', 0, 0, 'valueOf');
  16943. // PARSING
  16944. addRegexToken('x', matchSigned);
  16945. addRegexToken('X', matchTimestamp);
  16946. addParseToken('X', function (input, array, config) {
  16947. config._d = new Date(parseFloat(input, 10) * 1000);
  16948. });
  16949. addParseToken('x', function (input, array, config) {
  16950. config._d = new Date(toInt(input));
  16951. });
  16952. // Side effect imports
  16953. ;
  16954. //! moment.js
  16955. //! version : 2.10.6
  16956. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  16957. //! license : MIT
  16958. //! momentjs.com
  16959. utils_hooks__hooks.version = '2.10.6';
  16960. setHookCallback(local__createLocal);
  16961. utils_hooks__hooks.fn = momentPrototype;
  16962. utils_hooks__hooks.min = min;
  16963. utils_hooks__hooks.max = max;
  16964. utils_hooks__hooks.utc = create_utc__createUTC;
  16965. utils_hooks__hooks.unix = moment_moment__createUnix;
  16966. utils_hooks__hooks.months = lists__listMonths;
  16967. utils_hooks__hooks.isDate = isDate;
  16968. utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
  16969. utils_hooks__hooks.invalid = valid__createInvalid;
  16970. utils_hooks__hooks.duration = create__createDuration;
  16971. utils_hooks__hooks.isMoment = isMoment;
  16972. utils_hooks__hooks.weekdays = lists__listWeekdays;
  16973. utils_hooks__hooks.parseZone = moment_moment__createInZone;
  16974. utils_hooks__hooks.localeData = locale_locales__getLocale;
  16975. utils_hooks__hooks.isDuration = isDuration;
  16976. utils_hooks__hooks.monthsShort = lists__listMonthsShort;
  16977. utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
  16978. utils_hooks__hooks.defineLocale = defineLocale;
  16979. utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
  16980. utils_hooks__hooks.normalizeUnits = normalizeUnits;
  16981. utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
  16982. var _moment__default = utils_hooks__hooks;
  16983. //! moment.js locale configuration
  16984. //! locale : afrikaans (af)
  16985. //! author : Werner Mollentze : https://github.com/wernerm
  16986. var af = _moment__default.defineLocale('af', {
  16987. months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
  16988. monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'),
  16989. weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'),
  16990. weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'),
  16991. weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'),
  16992. meridiemParse: /vm|nm/i,
  16993. isPM : function (input) {
  16994. return /^nm$/i.test(input);
  16995. },
  16996. meridiem : function (hours, minutes, isLower) {
  16997. if (hours < 12) {
  16998. return isLower ? 'vm' : 'VM';
  16999. } else {
  17000. return isLower ? 'nm' : 'NM';
  17001. }
  17002. },
  17003. longDateFormat : {
  17004. LT : 'HH:mm',
  17005. LTS : 'HH:mm:ss',
  17006. L : 'DD/MM/YYYY',
  17007. LL : 'D MMMM YYYY',
  17008. LLL : 'D MMMM YYYY HH:mm',
  17009. LLLL : 'dddd, D MMMM YYYY HH:mm'
  17010. },
  17011. calendar : {
  17012. sameDay : '[Vandag om] LT',
  17013. nextDay : '[Môre om] LT',
  17014. nextWeek : 'dddd [om] LT',
  17015. lastDay : '[Gister om] LT',
  17016. lastWeek : '[Laas] dddd [om] LT',
  17017. sameElse : 'L'
  17018. },
  17019. relativeTime : {
  17020. future : 'oor %s',
  17021. past : '%s gelede',
  17022. s : '\'n paar sekondes',
  17023. m : '\'n minuut',
  17024. mm : '%d minute',
  17025. h : '\'n uur',
  17026. hh : '%d ure',
  17027. d : '\'n dag',
  17028. dd : '%d dae',
  17029. M : '\'n maand',
  17030. MM : '%d maande',
  17031. y : '\'n jaar',
  17032. yy : '%d jaar'
  17033. },
  17034. ordinalParse: /\d{1,2}(ste|de)/,
  17035. ordinal : function (number) {
  17036. return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter
  17037. },
  17038. week : {
  17039. dow : 1, // Maandag is die eerste dag van die week.
  17040. doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar.
  17041. }
  17042. });
  17043. //! moment.js locale configuration
  17044. //! locale : Moroccan Arabic (ar-ma)
  17045. //! author : ElFadili Yassine : https://github.com/ElFadiliY
  17046. //! author : Abdel Said : https://github.com/abdelsaid
  17047. var ar_ma = _moment__default.defineLocale('ar-ma', {
  17048. months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
  17049. monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
  17050. weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  17051. weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
  17052. weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  17053. longDateFormat : {
  17054. LT : 'HH:mm',
  17055. LTS : 'HH:mm:ss',
  17056. L : 'DD/MM/YYYY',
  17057. LL : 'D MMMM YYYY',
  17058. LLL : 'D MMMM YYYY HH:mm',
  17059. LLLL : 'dddd D MMMM YYYY HH:mm'
  17060. },
  17061. calendar : {
  17062. sameDay: '[اليوم على الساعة] LT',
  17063. nextDay: '[غدا على الساعة] LT',
  17064. nextWeek: 'dddd [على الساعة] LT',
  17065. lastDay: '[أمس على الساعة] LT',
  17066. lastWeek: 'dddd [على الساعة] LT',
  17067. sameElse: 'L'
  17068. },
  17069. relativeTime : {
  17070. future : 'في %s',
  17071. past : 'منذ %s',
  17072. s : 'ثوان',
  17073. m : 'دقيقة',
  17074. mm : '%d دقائق',
  17075. h : 'ساعة',
  17076. hh : '%d ساعات',
  17077. d : 'يوم',
  17078. dd : '%d أيام',
  17079. M : 'شهر',
  17080. MM : '%d أشهر',
  17081. y : 'سنة',
  17082. yy : '%d سنوات'
  17083. },
  17084. week : {
  17085. dow : 6, // Saturday is the first day of the week.
  17086. doy : 12 // The week that contains Jan 1st is the first week of the year.
  17087. }
  17088. });
  17089. //! moment.js locale configuration
  17090. //! locale : Arabic Saudi Arabia (ar-sa)
  17091. //! author : Suhail Alkowaileet : https://github.com/xsoh
  17092. var ar_sa__symbolMap = {
  17093. '1': '١',
  17094. '2': '٢',
  17095. '3': '٣',
  17096. '4': '٤',
  17097. '5': '٥',
  17098. '6': '٦',
  17099. '7': '٧',
  17100. '8': '٨',
  17101. '9': '٩',
  17102. '0': '٠'
  17103. }, ar_sa__numberMap = {
  17104. '١': '1',
  17105. '٢': '2',
  17106. '٣': '3',
  17107. '٤': '4',
  17108. '٥': '5',
  17109. '٦': '6',
  17110. '٧': '7',
  17111. '٨': '8',
  17112. '٩': '9',
  17113. '٠': '0'
  17114. };
  17115. var ar_sa = _moment__default.defineLocale('ar-sa', {
  17116. months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
  17117. monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
  17118. weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  17119. weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  17120. weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  17121. longDateFormat : {
  17122. LT : 'HH:mm',
  17123. LTS : 'HH:mm:ss',
  17124. L : 'DD/MM/YYYY',
  17125. LL : 'D MMMM YYYY',
  17126. LLL : 'D MMMM YYYY HH:mm',
  17127. LLLL : 'dddd D MMMM YYYY HH:mm'
  17128. },
  17129. meridiemParse: /ص|م/,
  17130. isPM : function (input) {
  17131. return 'م' === input;
  17132. },
  17133. meridiem : function (hour, minute, isLower) {
  17134. if (hour < 12) {
  17135. return 'ص';
  17136. } else {
  17137. return 'م';
  17138. }
  17139. },
  17140. calendar : {
  17141. sameDay: '[اليوم على الساعة] LT',
  17142. nextDay: '[غدا على الساعة] LT',
  17143. nextWeek: 'dddd [على الساعة] LT',
  17144. lastDay: '[أمس على الساعة] LT',
  17145. lastWeek: 'dddd [على الساعة] LT',
  17146. sameElse: 'L'
  17147. },
  17148. relativeTime : {
  17149. future : 'في %s',
  17150. past : 'منذ %s',
  17151. s : 'ثوان',
  17152. m : 'دقيقة',
  17153. mm : '%d دقائق',
  17154. h : 'ساعة',
  17155. hh : '%d ساعات',
  17156. d : 'يوم',
  17157. dd : '%d أيام',
  17158. M : 'شهر',
  17159. MM : '%d أشهر',
  17160. y : 'سنة',
  17161. yy : '%d سنوات'
  17162. },
  17163. preparse: function (string) {
  17164. return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
  17165. return ar_sa__numberMap[match];
  17166. }).replace(/،/g, ',');
  17167. },
  17168. postformat: function (string) {
  17169. return string.replace(/\d/g, function (match) {
  17170. return ar_sa__symbolMap[match];
  17171. }).replace(/,/g, '،');
  17172. },
  17173. week : {
  17174. dow : 6, // Saturday is the first day of the week.
  17175. doy : 12 // The week that contains Jan 1st is the first week of the year.
  17176. }
  17177. });
  17178. //! moment.js locale configuration
  17179. //! locale : Tunisian Arabic (ar-tn)
  17180. var ar_tn = _moment__default.defineLocale('ar-tn', {
  17181. months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
  17182. monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
  17183. weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  17184. weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  17185. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  17186. longDateFormat: {
  17187. LT: 'HH:mm',
  17188. LTS: 'HH:mm:ss',
  17189. L: 'DD/MM/YYYY',
  17190. LL: 'D MMMM YYYY',
  17191. LLL: 'D MMMM YYYY HH:mm',
  17192. LLLL: 'dddd D MMMM YYYY HH:mm'
  17193. },
  17194. calendar: {
  17195. sameDay: '[اليوم على الساعة] LT',
  17196. nextDay: '[غدا على الساعة] LT',
  17197. nextWeek: 'dddd [على الساعة] LT',
  17198. lastDay: '[أمس على الساعة] LT',
  17199. lastWeek: 'dddd [على الساعة] LT',
  17200. sameElse: 'L'
  17201. },
  17202. relativeTime: {
  17203. future: 'في %s',
  17204. past: 'منذ %s',
  17205. s: 'ثوان',
  17206. m: 'دقيقة',
  17207. mm: '%d دقائق',
  17208. h: 'ساعة',
  17209. hh: '%d ساعات',
  17210. d: 'يوم',
  17211. dd: '%d أيام',
  17212. M: 'شهر',
  17213. MM: '%d أشهر',
  17214. y: 'سنة',
  17215. yy: '%d سنوات'
  17216. },
  17217. week: {
  17218. dow: 1, // Monday is the first day of the week.
  17219. doy: 4 // The week that contains Jan 4th is the first week of the year.
  17220. }
  17221. });
  17222. //! moment.js locale configuration
  17223. //! Locale: Arabic (ar)
  17224. //! Author: Abdel Said: https://github.com/abdelsaid
  17225. //! Changes in months, weekdays: Ahmed Elkhatib
  17226. //! Native plural forms: forabi https://github.com/forabi
  17227. var ar__symbolMap = {
  17228. '1': '١',
  17229. '2': '٢',
  17230. '3': '٣',
  17231. '4': '٤',
  17232. '5': '٥',
  17233. '6': '٦',
  17234. '7': '٧',
  17235. '8': '٨',
  17236. '9': '٩',
  17237. '0': '٠'
  17238. }, ar__numberMap = {
  17239. '١': '1',
  17240. '٢': '2',
  17241. '٣': '3',
  17242. '٤': '4',
  17243. '٥': '5',
  17244. '٦': '6',
  17245. '٧': '7',
  17246. '٨': '8',
  17247. '٩': '9',
  17248. '٠': '0'
  17249. }, pluralForm = function (n) {
  17250. return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
  17251. }, plurals = {
  17252. s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'],
  17253. m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'],
  17254. h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'],
  17255. d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'],
  17256. M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'],
  17257. y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام']
  17258. }, pluralize = function (u) {
  17259. return function (number, withoutSuffix, string, isFuture) {
  17260. var f = pluralForm(number),
  17261. str = plurals[u][pluralForm(number)];
  17262. if (f === 2) {
  17263. str = str[withoutSuffix ? 0 : 1];
  17264. }
  17265. return str.replace(/%d/i, number);
  17266. };
  17267. }, ar__months = [
  17268. 'كانون الثاني يناير',
  17269. 'شباط فبراير',
  17270. 'آذار مارس',
  17271. 'نيسان أبريل',
  17272. 'أيار مايو',
  17273. 'حزيران يونيو',
  17274. 'تموز يوليو',
  17275. 'آب أغسطس',
  17276. 'أيلول سبتمبر',
  17277. 'تشرين الأول أكتوبر',
  17278. 'تشرين الثاني نوفمبر',
  17279. 'كانون الأول ديسمبر'
  17280. ];
  17281. var ar = _moment__default.defineLocale('ar', {
  17282. months : ar__months,
  17283. monthsShort : ar__months,
  17284. weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  17285. weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  17286. weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  17287. longDateFormat : {
  17288. LT : 'HH:mm',
  17289. LTS : 'HH:mm:ss',
  17290. L : 'D/\u200FM/\u200FYYYY',
  17291. LL : 'D MMMM YYYY',
  17292. LLL : 'D MMMM YYYY HH:mm',
  17293. LLLL : 'dddd D MMMM YYYY HH:mm'
  17294. },
  17295. meridiemParse: /ص|م/,
  17296. isPM : function (input) {
  17297. return 'م' === input;
  17298. },
  17299. meridiem : function (hour, minute, isLower) {
  17300. if (hour < 12) {
  17301. return 'ص';
  17302. } else {
  17303. return 'م';
  17304. }
  17305. },
  17306. calendar : {
  17307. sameDay: '[اليوم عند الساعة] LT',
  17308. nextDay: '[غدًا عند الساعة] LT',
  17309. nextWeek: 'dddd [عند الساعة] LT',
  17310. lastDay: '[أمس عند الساعة] LT',
  17311. lastWeek: 'dddd [عند الساعة] LT',
  17312. sameElse: 'L'
  17313. },
  17314. relativeTime : {
  17315. future : 'بعد %s',
  17316. past : 'منذ %s',
  17317. s : pluralize('s'),
  17318. m : pluralize('m'),
  17319. mm : pluralize('m'),
  17320. h : pluralize('h'),
  17321. hh : pluralize('h'),
  17322. d : pluralize('d'),
  17323. dd : pluralize('d'),
  17324. M : pluralize('M'),
  17325. MM : pluralize('M'),
  17326. y : pluralize('y'),
  17327. yy : pluralize('y')
  17328. },
  17329. preparse: function (string) {
  17330. return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
  17331. return ar__numberMap[match];
  17332. }).replace(/،/g, ',');
  17333. },
  17334. postformat: function (string) {
  17335. return string.replace(/\d/g, function (match) {
  17336. return ar__symbolMap[match];
  17337. }).replace(/,/g, '،');
  17338. },
  17339. week : {
  17340. dow : 6, // Saturday is the first day of the week.
  17341. doy : 12 // The week that contains Jan 1st is the first week of the year.
  17342. }
  17343. });
  17344. //! moment.js locale configuration
  17345. //! locale : azerbaijani (az)
  17346. //! author : topchiyev : https://github.com/topchiyev
  17347. var az__suffixes = {
  17348. 1: '-inci',
  17349. 5: '-inci',
  17350. 8: '-inci',
  17351. 70: '-inci',
  17352. 80: '-inci',
  17353. 2: '-nci',
  17354. 7: '-nci',
  17355. 20: '-nci',
  17356. 50: '-nci',
  17357. 3: '-üncü',
  17358. 4: '-üncü',
  17359. 100: '-üncü',
  17360. 6: '-ncı',
  17361. 9: '-uncu',
  17362. 10: '-uncu',
  17363. 30: '-uncu',
  17364. 60: '-ıncı',
  17365. 90: '-ıncı'
  17366. };
  17367. var az = _moment__default.defineLocale('az', {
  17368. months : 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split('_'),
  17369. monthsShort : 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'),
  17370. weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'),
  17371. weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'),
  17372. weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'),
  17373. longDateFormat : {
  17374. LT : 'HH:mm',
  17375. LTS : 'HH:mm:ss',
  17376. L : 'DD.MM.YYYY',
  17377. LL : 'D MMMM YYYY',
  17378. LLL : 'D MMMM YYYY HH:mm',
  17379. LLLL : 'dddd, D MMMM YYYY HH:mm'
  17380. },
  17381. calendar : {
  17382. sameDay : '[bugün saat] LT',
  17383. nextDay : '[sabah saat] LT',
  17384. nextWeek : '[gələn həftə] dddd [saat] LT',
  17385. lastDay : '[dünən] LT',
  17386. lastWeek : '[keçən həftə] dddd [saat] LT',
  17387. sameElse : 'L'
  17388. },
  17389. relativeTime : {
  17390. future : '%s sonra',
  17391. past : '%s əvvəl',
  17392. s : 'birneçə saniyyə',
  17393. m : 'bir dəqiqə',
  17394. mm : '%d dəqiqə',
  17395. h : 'bir saat',
  17396. hh : '%d saat',
  17397. d : 'bir gün',
  17398. dd : '%d gün',
  17399. M : 'bir ay',
  17400. MM : '%d ay',
  17401. y : 'bir il',
  17402. yy : '%d il'
  17403. },
  17404. meridiemParse: /gecə|səhər|gündüz|axşam/,
  17405. isPM : function (input) {
  17406. return /^(gündüz|axşam)$/.test(input);
  17407. },
  17408. meridiem : function (hour, minute, isLower) {
  17409. if (hour < 4) {
  17410. return 'gecə';
  17411. } else if (hour < 12) {
  17412. return 'səhər';
  17413. } else if (hour < 17) {
  17414. return 'gündüz';
  17415. } else {
  17416. return 'axşam';
  17417. }
  17418. },
  17419. ordinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,
  17420. ordinal : function (number) {
  17421. if (number === 0) { // special case for zero
  17422. return number + '-ıncı';
  17423. }
  17424. var a = number % 10,
  17425. b = number % 100 - a,
  17426. c = number >= 100 ? 100 : null;
  17427. return number + (az__suffixes[a] || az__suffixes[b] || az__suffixes[c]);
  17428. },
  17429. week : {
  17430. dow : 1, // Monday is the first day of the week.
  17431. doy : 7 // The week that contains Jan 1st is the first week of the year.
  17432. }
  17433. });
  17434. //! moment.js locale configuration
  17435. //! locale : belarusian (be)
  17436. //! author : Dmitry Demidov : https://github.com/demidov91
  17437. //! author: Praleska: http://praleska.pro/
  17438. //! Author : Menelion Elensúle : https://github.com/Oire
  17439. function be__plural(word, num) {
  17440. var forms = word.split('_');
  17441. return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
  17442. }
  17443. function be__relativeTimeWithPlural(number, withoutSuffix, key) {
  17444. var format = {
  17445. 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін',
  17446. 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін',
  17447. 'dd': 'дзень_дні_дзён',
  17448. 'MM': 'месяц_месяцы_месяцаў',
  17449. 'yy': 'год_гады_гадоў'
  17450. };
  17451. if (key === 'm') {
  17452. return withoutSuffix ? 'хвіліна' : 'хвіліну';
  17453. }
  17454. else if (key === 'h') {
  17455. return withoutSuffix ? 'гадзіна' : 'гадзіну';
  17456. }
  17457. else {
  17458. return number + ' ' + be__plural(format[key], +number);
  17459. }
  17460. }
  17461. function be__monthsCaseReplace(m, format) {
  17462. var months = {
  17463. 'nominative': 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_'),
  17464. 'accusative': 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_')
  17465. },
  17466. nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
  17467. 'accusative' :
  17468. 'nominative';
  17469. return months[nounCase][m.month()];
  17470. }
  17471. function be__weekdaysCaseReplace(m, format) {
  17472. var weekdays = {
  17473. 'nominative': 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'),
  17474. 'accusative': 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_')
  17475. },
  17476. nounCase = (/\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/).test(format) ?
  17477. 'accusative' :
  17478. 'nominative';
  17479. return weekdays[nounCase][m.day()];
  17480. }
  17481. var be = _moment__default.defineLocale('be', {
  17482. months : be__monthsCaseReplace,
  17483. monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'),
  17484. weekdays : be__weekdaysCaseReplace,
  17485. weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
  17486. weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
  17487. longDateFormat : {
  17488. LT : 'HH:mm',
  17489. LTS : 'HH:mm:ss',
  17490. L : 'DD.MM.YYYY',
  17491. LL : 'D MMMM YYYY г.',
  17492. LLL : 'D MMMM YYYY г., HH:mm',
  17493. LLLL : 'dddd, D MMMM YYYY г., HH:mm'
  17494. },
  17495. calendar : {
  17496. sameDay: '[Сёння ў] LT',
  17497. nextDay: '[Заўтра ў] LT',
  17498. lastDay: '[Учора ў] LT',
  17499. nextWeek: function () {
  17500. return '[У] dddd [ў] LT';
  17501. },
  17502. lastWeek: function () {
  17503. switch (this.day()) {
  17504. case 0:
  17505. case 3:
  17506. case 5:
  17507. case 6:
  17508. return '[У мінулую] dddd [ў] LT';
  17509. case 1:
  17510. case 2:
  17511. case 4:
  17512. return '[У мінулы] dddd [ў] LT';
  17513. }
  17514. },
  17515. sameElse: 'L'
  17516. },
  17517. relativeTime : {
  17518. future : 'праз %s',
  17519. past : '%s таму',
  17520. s : 'некалькі секунд',
  17521. m : be__relativeTimeWithPlural,
  17522. mm : be__relativeTimeWithPlural,
  17523. h : be__relativeTimeWithPlural,
  17524. hh : be__relativeTimeWithPlural,
  17525. d : 'дзень',
  17526. dd : be__relativeTimeWithPlural,
  17527. M : 'месяц',
  17528. MM : be__relativeTimeWithPlural,
  17529. y : 'год',
  17530. yy : be__relativeTimeWithPlural
  17531. },
  17532. meridiemParse: /ночы|раніцы|дня|вечара/,
  17533. isPM : function (input) {
  17534. return /^(дня|вечара)$/.test(input);
  17535. },
  17536. meridiem : function (hour, minute, isLower) {
  17537. if (hour < 4) {
  17538. return 'ночы';
  17539. } else if (hour < 12) {
  17540. return 'раніцы';
  17541. } else if (hour < 17) {
  17542. return 'дня';
  17543. } else {
  17544. return 'вечара';
  17545. }
  17546. },
  17547. ordinalParse: /\d{1,2}-(і|ы|га)/,
  17548. ordinal: function (number, period) {
  17549. switch (period) {
  17550. case 'M':
  17551. case 'd':
  17552. case 'DDD':
  17553. case 'w':
  17554. case 'W':
  17555. return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы';
  17556. case 'D':
  17557. return number + '-га';
  17558. default:
  17559. return number;
  17560. }
  17561. },
  17562. week : {
  17563. dow : 1, // Monday is the first day of the week.
  17564. doy : 7 // The week that contains Jan 1st is the first week of the year.
  17565. }
  17566. });
  17567. //! moment.js locale configuration
  17568. //! locale : bulgarian (bg)
  17569. //! author : Krasen Borisov : https://github.com/kraz
  17570. var bg = _moment__default.defineLocale('bg', {
  17571. months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'),
  17572. monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'),
  17573. weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'),
  17574. weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'),
  17575. weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  17576. longDateFormat : {
  17577. LT : 'H:mm',
  17578. LTS : 'H:mm:ss',
  17579. L : 'D.MM.YYYY',
  17580. LL : 'D MMMM YYYY',
  17581. LLL : 'D MMMM YYYY H:mm',
  17582. LLLL : 'dddd, D MMMM YYYY H:mm'
  17583. },
  17584. calendar : {
  17585. sameDay : '[Днес в] LT',
  17586. nextDay : '[Утре в] LT',
  17587. nextWeek : 'dddd [в] LT',
  17588. lastDay : '[Вчера в] LT',
  17589. lastWeek : function () {
  17590. switch (this.day()) {
  17591. case 0:
  17592. case 3:
  17593. case 6:
  17594. return '[В изминалата] dddd [в] LT';
  17595. case 1:
  17596. case 2:
  17597. case 4:
  17598. case 5:
  17599. return '[В изминалия] dddd [в] LT';
  17600. }
  17601. },
  17602. sameElse : 'L'
  17603. },
  17604. relativeTime : {
  17605. future : 'след %s',
  17606. past : 'преди %s',
  17607. s : 'няколко секунди',
  17608. m : 'минута',
  17609. mm : '%d минути',
  17610. h : 'час',
  17611. hh : '%d часа',
  17612. d : 'ден',
  17613. dd : '%d дни',
  17614. M : 'месец',
  17615. MM : '%d месеца',
  17616. y : 'година',
  17617. yy : '%d години'
  17618. },
  17619. ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
  17620. ordinal : function (number) {
  17621. var lastDigit = number % 10,
  17622. last2Digits = number % 100;
  17623. if (number === 0) {
  17624. return number + '-ев';
  17625. } else if (last2Digits === 0) {
  17626. return number + '-ен';
  17627. } else if (last2Digits > 10 && last2Digits < 20) {
  17628. return number + '-ти';
  17629. } else if (lastDigit === 1) {
  17630. return number + '-ви';
  17631. } else if (lastDigit === 2) {
  17632. return number + '-ри';
  17633. } else if (lastDigit === 7 || lastDigit === 8) {
  17634. return number + '-ми';
  17635. } else {
  17636. return number + '-ти';
  17637. }
  17638. },
  17639. week : {
  17640. dow : 1, // Monday is the first day of the week.
  17641. doy : 7 // The week that contains Jan 1st is the first week of the year.
  17642. }
  17643. });
  17644. //! moment.js locale configuration
  17645. //! locale : Bengali (bn)
  17646. //! author : Kaushik Gandhi : https://github.com/kaushikgandhi
  17647. var bn__symbolMap = {
  17648. '1': '১',
  17649. '2': '২',
  17650. '3': '৩',
  17651. '4': '৪',
  17652. '5': '৫',
  17653. '6': '৬',
  17654. '7': '৭',
  17655. '8': '৮',
  17656. '9': '৯',
  17657. '0': '০'
  17658. },
  17659. bn__numberMap = {
  17660. '১': '1',
  17661. '২': '2',
  17662. '৩': '3',
  17663. '৪': '4',
  17664. '৫': '5',
  17665. '৬': '6',
  17666. '৭': '7',
  17667. '৮': '8',
  17668. '৯': '9',
  17669. '০': '0'
  17670. };
  17671. var bn = _moment__default.defineLocale('bn', {
  17672. months : 'জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'),
  17673. monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্'.split('_'),
  17674. weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রুবার_শনিবার'.split('_'),
  17675. weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্রু_শনি'.split('_'),
  17676. weekdaysMin : 'রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি'.split('_'),
  17677. longDateFormat : {
  17678. LT : 'A h:mm সময়',
  17679. LTS : 'A h:mm:ss সময়',
  17680. L : 'DD/MM/YYYY',
  17681. LL : 'D MMMM YYYY',
  17682. LLL : 'D MMMM YYYY, A h:mm সময়',
  17683. LLLL : 'dddd, D MMMM YYYY, A h:mm সময়'
  17684. },
  17685. calendar : {
  17686. sameDay : '[আজ] LT',
  17687. nextDay : '[আগামীকাল] LT',
  17688. nextWeek : 'dddd, LT',
  17689. lastDay : '[গতকাল] LT',
  17690. lastWeek : '[গত] dddd, LT',
  17691. sameElse : 'L'
  17692. },
  17693. relativeTime : {
  17694. future : '%s পরে',
  17695. past : '%s আগে',
  17696. s : 'কএক সেকেন্ড',
  17697. m : 'এক মিনিট',
  17698. mm : '%d মিনিট',
  17699. h : 'এক ঘন্টা',
  17700. hh : '%d ঘন্টা',
  17701. d : 'এক দিন',
  17702. dd : '%d দিন',
  17703. M : 'এক মাস',
  17704. MM : '%d মাস',
  17705. y : 'এক বছর',
  17706. yy : '%d বছর'
  17707. },
  17708. preparse: function (string) {
  17709. return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
  17710. return bn__numberMap[match];
  17711. });
  17712. },
  17713. postformat: function (string) {
  17714. return string.replace(/\d/g, function (match) {
  17715. return bn__symbolMap[match];
  17716. });
  17717. },
  17718. meridiemParse: /রাত|সকাল|দুপুর|বিকেল|রাত/,
  17719. isPM: function (input) {
  17720. return /^(দুপুর|বিকেল|রাত)$/.test(input);
  17721. },
  17722. //Bengali is a vast language its spoken
  17723. //in different forms in various parts of the world.
  17724. //I have just generalized with most common one used
  17725. meridiem : function (hour, minute, isLower) {
  17726. if (hour < 4) {
  17727. return 'রাত';
  17728. } else if (hour < 10) {
  17729. return 'সকাল';
  17730. } else if (hour < 17) {
  17731. return 'দুপুর';
  17732. } else if (hour < 20) {
  17733. return 'বিকেল';
  17734. } else {
  17735. return 'রাত';
  17736. }
  17737. },
  17738. week : {
  17739. dow : 0, // Sunday is the first day of the week.
  17740. doy : 6 // The week that contains Jan 1st is the first week of the year.
  17741. }
  17742. });
  17743. //! moment.js locale configuration
  17744. //! locale : tibetan (bo)
  17745. //! author : Thupten N. Chakrishar : https://github.com/vajradog
  17746. var bo__symbolMap = {
  17747. '1': '༡',
  17748. '2': '༢',
  17749. '3': '༣',
  17750. '4': '༤',
  17751. '5': '༥',
  17752. '6': '༦',
  17753. '7': '༧',
  17754. '8': '༨',
  17755. '9': '༩',
  17756. '0': '༠'
  17757. },
  17758. bo__numberMap = {
  17759. '༡': '1',
  17760. '༢': '2',
  17761. '༣': '3',
  17762. '༤': '4',
  17763. '༥': '5',
  17764. '༦': '6',
  17765. '༧': '7',
  17766. '༨': '8',
  17767. '༩': '9',
  17768. '༠': '0'
  17769. };
  17770. var bo = _moment__default.defineLocale('bo', {
  17771. months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'),
  17772. monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'),
  17773. weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'),
  17774. weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'),
  17775. weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'),
  17776. longDateFormat : {
  17777. LT : 'A h:mm',
  17778. LTS : 'A h:mm:ss',
  17779. L : 'DD/MM/YYYY',
  17780. LL : 'D MMMM YYYY',
  17781. LLL : 'D MMMM YYYY, A h:mm',
  17782. LLLL : 'dddd, D MMMM YYYY, A h:mm'
  17783. },
  17784. calendar : {
  17785. sameDay : '[དི་རིང] LT',
  17786. nextDay : '[སང་ཉིན] LT',
  17787. nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT',
  17788. lastDay : '[ཁ་སང] LT',
  17789. lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT',
  17790. sameElse : 'L'
  17791. },
  17792. relativeTime : {
  17793. future : '%s ལ་',
  17794. past : '%s སྔན་ལ',
  17795. s : 'ལམ་སང',
  17796. m : 'སྐར་མ་གཅིག',
  17797. mm : '%d སྐར་མ',
  17798. h : 'ཆུ་ཚོད་གཅིག',
  17799. hh : '%d ཆུ་ཚོད',
  17800. d : 'ཉིན་གཅིག',
  17801. dd : '%d ཉིན་',
  17802. M : 'ཟླ་བ་གཅིག',
  17803. MM : '%d ཟླ་བ',
  17804. y : 'ལོ་གཅིག',
  17805. yy : '%d ལོ'
  17806. },
  17807. preparse: function (string) {
  17808. return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) {
  17809. return bo__numberMap[match];
  17810. });
  17811. },
  17812. postformat: function (string) {
  17813. return string.replace(/\d/g, function (match) {
  17814. return bo__symbolMap[match];
  17815. });
  17816. },
  17817. meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
  17818. isPM: function (input) {
  17819. return /^(ཉིན་གུང|དགོང་དག|མཚན་མོ)$/.test(input);
  17820. },
  17821. meridiem : function (hour, minute, isLower) {
  17822. if (hour < 4) {
  17823. return 'མཚན་མོ';
  17824. } else if (hour < 10) {
  17825. return 'ཞོགས་ཀས';
  17826. } else if (hour < 17) {
  17827. return 'ཉིན་གུང';
  17828. } else if (hour < 20) {
  17829. return 'དགོང་དག';
  17830. } else {
  17831. return 'མཚན་མོ';
  17832. }
  17833. },
  17834. week : {
  17835. dow : 0, // Sunday is the first day of the week.
  17836. doy : 6 // The week that contains Jan 1st is the first week of the year.
  17837. }
  17838. });
  17839. //! moment.js locale configuration
  17840. //! locale : breton (br)
  17841. //! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou
  17842. function relativeTimeWithMutation(number, withoutSuffix, key) {
  17843. var format = {
  17844. 'mm': 'munutenn',
  17845. 'MM': 'miz',
  17846. 'dd': 'devezh'
  17847. };
  17848. return number + ' ' + mutation(format[key], number);
  17849. }
  17850. function specialMutationForYears(number) {
  17851. switch (lastNumber(number)) {
  17852. case 1:
  17853. case 3:
  17854. case 4:
  17855. case 5:
  17856. case 9:
  17857. return number + ' bloaz';
  17858. default:
  17859. return number + ' vloaz';
  17860. }
  17861. }
  17862. function lastNumber(number) {
  17863. if (number > 9) {
  17864. return lastNumber(number % 10);
  17865. }
  17866. return number;
  17867. }
  17868. function mutation(text, number) {
  17869. if (number === 2) {
  17870. return softMutation(text);
  17871. }
  17872. return text;
  17873. }
  17874. function softMutation(text) {
  17875. var mutationTable = {
  17876. 'm': 'v',
  17877. 'b': 'v',
  17878. 'd': 'z'
  17879. };
  17880. if (mutationTable[text.charAt(0)] === undefined) {
  17881. return text;
  17882. }
  17883. return mutationTable[text.charAt(0)] + text.substring(1);
  17884. }
  17885. var br = _moment__default.defineLocale('br', {
  17886. months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'),
  17887. monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
  17888. weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'),
  17889. weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
  17890. weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
  17891. longDateFormat : {
  17892. LT : 'h[e]mm A',
  17893. LTS : 'h[e]mm:ss A',
  17894. L : 'DD/MM/YYYY',
  17895. LL : 'D [a viz] MMMM YYYY',
  17896. LLL : 'D [a viz] MMMM YYYY h[e]mm A',
  17897. LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A'
  17898. },
  17899. calendar : {
  17900. sameDay : '[Hiziv da] LT',
  17901. nextDay : '[Warc\'hoazh da] LT',
  17902. nextWeek : 'dddd [da] LT',
  17903. lastDay : '[Dec\'h da] LT',
  17904. lastWeek : 'dddd [paset da] LT',
  17905. sameElse : 'L'
  17906. },
  17907. relativeTime : {
  17908. future : 'a-benn %s',
  17909. past : '%s \'zo',
  17910. s : 'un nebeud segondennoù',
  17911. m : 'ur vunutenn',
  17912. mm : relativeTimeWithMutation,
  17913. h : 'un eur',
  17914. hh : '%d eur',
  17915. d : 'un devezh',
  17916. dd : relativeTimeWithMutation,
  17917. M : 'ur miz',
  17918. MM : relativeTimeWithMutation,
  17919. y : 'ur bloaz',
  17920. yy : specialMutationForYears
  17921. },
  17922. ordinalParse: /\d{1,2}(añ|vet)/,
  17923. ordinal : function (number) {
  17924. var output = (number === 1) ? 'añ' : 'vet';
  17925. return number + output;
  17926. },
  17927. week : {
  17928. dow : 1, // Monday is the first day of the week.
  17929. doy : 4 // The week that contains Jan 4th is the first week of the year.
  17930. }
  17931. });
  17932. //! moment.js locale configuration
  17933. //! locale : bosnian (bs)
  17934. //! author : Nedim Cholich : https://github.com/frontyard
  17935. //! based on (hr) translation by Bojan Marković
  17936. function bs__translate(number, withoutSuffix, key) {
  17937. var result = number + ' ';
  17938. switch (key) {
  17939. case 'm':
  17940. return withoutSuffix ? 'jedna minuta' : 'jedne minute';
  17941. case 'mm':
  17942. if (number === 1) {
  17943. result += 'minuta';
  17944. } else if (number === 2 || number === 3 || number === 4) {
  17945. result += 'minute';
  17946. } else {
  17947. result += 'minuta';
  17948. }
  17949. return result;
  17950. case 'h':
  17951. return withoutSuffix ? 'jedan sat' : 'jednog sata';
  17952. case 'hh':
  17953. if (number === 1) {
  17954. result += 'sat';
  17955. } else if (number === 2 || number === 3 || number === 4) {
  17956. result += 'sata';
  17957. } else {
  17958. result += 'sati';
  17959. }
  17960. return result;
  17961. case 'dd':
  17962. if (number === 1) {
  17963. result += 'dan';
  17964. } else {
  17965. result += 'dana';
  17966. }
  17967. return result;
  17968. case 'MM':
  17969. if (number === 1) {
  17970. result += 'mjesec';
  17971. } else if (number === 2 || number === 3 || number === 4) {
  17972. result += 'mjeseca';
  17973. } else {
  17974. result += 'mjeseci';
  17975. }
  17976. return result;
  17977. case 'yy':
  17978. if (number === 1) {
  17979. result += 'godina';
  17980. } else if (number === 2 || number === 3 || number === 4) {
  17981. result += 'godine';
  17982. } else {
  17983. result += 'godina';
  17984. }
  17985. return result;
  17986. }
  17987. }
  17988. var bs = _moment__default.defineLocale('bs', {
  17989. months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'),
  17990. monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'),
  17991. weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
  17992. weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  17993. weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'),
  17994. longDateFormat : {
  17995. LT : 'H:mm',
  17996. LTS : 'H:mm:ss',
  17997. L : 'DD. MM. YYYY',
  17998. LL : 'D. MMMM YYYY',
  17999. LLL : 'D. MMMM YYYY H:mm',
  18000. LLLL : 'dddd, D. MMMM YYYY H:mm'
  18001. },
  18002. calendar : {
  18003. sameDay : '[danas u] LT',
  18004. nextDay : '[sutra u] LT',
  18005. nextWeek : function () {
  18006. switch (this.day()) {
  18007. case 0:
  18008. return '[u] [nedjelju] [u] LT';
  18009. case 3:
  18010. return '[u] [srijedu] [u] LT';
  18011. case 6:
  18012. return '[u] [subotu] [u] LT';
  18013. case 1:
  18014. case 2:
  18015. case 4:
  18016. case 5:
  18017. return '[u] dddd [u] LT';
  18018. }
  18019. },
  18020. lastDay : '[jučer u] LT',
  18021. lastWeek : function () {
  18022. switch (this.day()) {
  18023. case 0:
  18024. case 3:
  18025. return '[prošlu] dddd [u] LT';
  18026. case 6:
  18027. return '[prošle] [subote] [u] LT';
  18028. case 1:
  18029. case 2:
  18030. case 4:
  18031. case 5:
  18032. return '[prošli] dddd [u] LT';
  18033. }
  18034. },
  18035. sameElse : 'L'
  18036. },
  18037. relativeTime : {
  18038. future : 'za %s',
  18039. past : 'prije %s',
  18040. s : 'par sekundi',
  18041. m : bs__translate,
  18042. mm : bs__translate,
  18043. h : bs__translate,
  18044. hh : bs__translate,
  18045. d : 'dan',
  18046. dd : bs__translate,
  18047. M : 'mjesec',
  18048. MM : bs__translate,
  18049. y : 'godinu',
  18050. yy : bs__translate
  18051. },
  18052. ordinalParse: /\d{1,2}\./,
  18053. ordinal : '%d.',
  18054. week : {
  18055. dow : 1, // Monday is the first day of the week.
  18056. doy : 7 // The week that contains Jan 1st is the first week of the year.
  18057. }
  18058. });
  18059. //! moment.js locale configuration
  18060. //! locale : catalan (ca)
  18061. //! author : Juan G. Hurtado : https://github.com/juanghurtado
  18062. var ca = _moment__default.defineLocale('ca', {
  18063. months : 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'),
  18064. monthsShort : 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'.split('_'),
  18065. weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'),
  18066. weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'),
  18067. weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'),
  18068. longDateFormat : {
  18069. LT : 'H:mm',
  18070. LTS : 'LT:ss',
  18071. L : 'DD/MM/YYYY',
  18072. LL : 'D MMMM YYYY',
  18073. LLL : 'D MMMM YYYY H:mm',
  18074. LLLL : 'dddd D MMMM YYYY H:mm'
  18075. },
  18076. calendar : {
  18077. sameDay : function () {
  18078. return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
  18079. },
  18080. nextDay : function () {
  18081. return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
  18082. },
  18083. nextWeek : function () {
  18084. return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
  18085. },
  18086. lastDay : function () {
  18087. return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
  18088. },
  18089. lastWeek : function () {
  18090. return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
  18091. },
  18092. sameElse : 'L'
  18093. },
  18094. relativeTime : {
  18095. future : 'en %s',
  18096. past : 'fa %s',
  18097. s : 'uns segons',
  18098. m : 'un minut',
  18099. mm : '%d minuts',
  18100. h : 'una hora',
  18101. hh : '%d hores',
  18102. d : 'un dia',
  18103. dd : '%d dies',
  18104. M : 'un mes',
  18105. MM : '%d mesos',
  18106. y : 'un any',
  18107. yy : '%d anys'
  18108. },
  18109. ordinalParse: /\d{1,2}(r|n|t|è|a)/,
  18110. ordinal : function (number, period) {
  18111. var output = (number === 1) ? 'r' :
  18112. (number === 2) ? 'n' :
  18113. (number === 3) ? 'r' :
  18114. (number === 4) ? 't' : 'è';
  18115. if (period === 'w' || period === 'W') {
  18116. output = 'a';
  18117. }
  18118. return number + output;
  18119. },
  18120. week : {
  18121. dow : 1, // Monday is the first day of the week.
  18122. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18123. }
  18124. });
  18125. //! moment.js locale configuration
  18126. //! locale : czech (cs)
  18127. //! author : petrbela : https://github.com/petrbela
  18128. var cs__months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
  18129. cs__monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_');
  18130. function cs__plural(n) {
  18131. return (n > 1) && (n < 5) && (~~(n / 10) !== 1);
  18132. }
  18133. function cs__translate(number, withoutSuffix, key, isFuture) {
  18134. var result = number + ' ';
  18135. switch (key) {
  18136. case 's': // a few seconds / in a few seconds / a few seconds ago
  18137. return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami';
  18138. case 'm': // a minute / in a minute / a minute ago
  18139. return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou');
  18140. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  18141. if (withoutSuffix || isFuture) {
  18142. return result + (cs__plural(number) ? 'minuty' : 'minut');
  18143. } else {
  18144. return result + 'minutami';
  18145. }
  18146. break;
  18147. case 'h': // an hour / in an hour / an hour ago
  18148. return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
  18149. case 'hh': // 9 hours / in 9 hours / 9 hours ago
  18150. if (withoutSuffix || isFuture) {
  18151. return result + (cs__plural(number) ? 'hodiny' : 'hodin');
  18152. } else {
  18153. return result + 'hodinami';
  18154. }
  18155. break;
  18156. case 'd': // a day / in a day / a day ago
  18157. return (withoutSuffix || isFuture) ? 'den' : 'dnem';
  18158. case 'dd': // 9 days / in 9 days / 9 days ago
  18159. if (withoutSuffix || isFuture) {
  18160. return result + (cs__plural(number) ? 'dny' : 'dní');
  18161. } else {
  18162. return result + 'dny';
  18163. }
  18164. break;
  18165. case 'M': // a month / in a month / a month ago
  18166. return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem';
  18167. case 'MM': // 9 months / in 9 months / 9 months ago
  18168. if (withoutSuffix || isFuture) {
  18169. return result + (cs__plural(number) ? 'měsíce' : 'měsíců');
  18170. } else {
  18171. return result + 'měsíci';
  18172. }
  18173. break;
  18174. case 'y': // a year / in a year / a year ago
  18175. return (withoutSuffix || isFuture) ? 'rok' : 'rokem';
  18176. case 'yy': // 9 years / in 9 years / 9 years ago
  18177. if (withoutSuffix || isFuture) {
  18178. return result + (cs__plural(number) ? 'roky' : 'let');
  18179. } else {
  18180. return result + 'lety';
  18181. }
  18182. break;
  18183. }
  18184. }
  18185. var cs = _moment__default.defineLocale('cs', {
  18186. months : cs__months,
  18187. monthsShort : cs__monthsShort,
  18188. monthsParse : (function (months, monthsShort) {
  18189. var i, _monthsParse = [];
  18190. for (i = 0; i < 12; i++) {
  18191. // use custom parser to solve problem with July (červenec)
  18192. _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
  18193. }
  18194. return _monthsParse;
  18195. }(cs__months, cs__monthsShort)),
  18196. weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
  18197. weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'),
  18198. weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'),
  18199. longDateFormat : {
  18200. LT: 'H:mm',
  18201. LTS : 'H:mm:ss',
  18202. L : 'DD.MM.YYYY',
  18203. LL : 'D. MMMM YYYY',
  18204. LLL : 'D. MMMM YYYY H:mm',
  18205. LLLL : 'dddd D. MMMM YYYY H:mm'
  18206. },
  18207. calendar : {
  18208. sameDay: '[dnes v] LT',
  18209. nextDay: '[zítra v] LT',
  18210. nextWeek: function () {
  18211. switch (this.day()) {
  18212. case 0:
  18213. return '[v neděli v] LT';
  18214. case 1:
  18215. case 2:
  18216. return '[v] dddd [v] LT';
  18217. case 3:
  18218. return '[ve středu v] LT';
  18219. case 4:
  18220. return '[ve čtvrtek v] LT';
  18221. case 5:
  18222. return '[v pátek v] LT';
  18223. case 6:
  18224. return '[v sobotu v] LT';
  18225. }
  18226. },
  18227. lastDay: '[včera v] LT',
  18228. lastWeek: function () {
  18229. switch (this.day()) {
  18230. case 0:
  18231. return '[minulou neděli v] LT';
  18232. case 1:
  18233. case 2:
  18234. return '[minulé] dddd [v] LT';
  18235. case 3:
  18236. return '[minulou středu v] LT';
  18237. case 4:
  18238. case 5:
  18239. return '[minulý] dddd [v] LT';
  18240. case 6:
  18241. return '[minulou sobotu v] LT';
  18242. }
  18243. },
  18244. sameElse: 'L'
  18245. },
  18246. relativeTime : {
  18247. future : 'za %s',
  18248. past : 'před %s',
  18249. s : cs__translate,
  18250. m : cs__translate,
  18251. mm : cs__translate,
  18252. h : cs__translate,
  18253. hh : cs__translate,
  18254. d : cs__translate,
  18255. dd : cs__translate,
  18256. M : cs__translate,
  18257. MM : cs__translate,
  18258. y : cs__translate,
  18259. yy : cs__translate
  18260. },
  18261. ordinalParse : /\d{1,2}\./,
  18262. ordinal : '%d.',
  18263. week : {
  18264. dow : 1, // Monday is the first day of the week.
  18265. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18266. }
  18267. });
  18268. //! moment.js locale configuration
  18269. //! locale : chuvash (cv)
  18270. //! author : Anatoly Mironov : https://github.com/mirontoli
  18271. var cv = _moment__default.defineLocale('cv', {
  18272. months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'),
  18273. monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'),
  18274. weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'),
  18275. weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'),
  18276. weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'),
  18277. longDateFormat : {
  18278. LT : 'HH:mm',
  18279. LTS : 'HH:mm:ss',
  18280. L : 'DD-MM-YYYY',
  18281. LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]',
  18282. LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
  18283. LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm'
  18284. },
  18285. calendar : {
  18286. sameDay: '[Паян] LT [сехетре]',
  18287. nextDay: '[Ыран] LT [сехетре]',
  18288. lastDay: '[Ӗнер] LT [сехетре]',
  18289. nextWeek: '[Ҫитес] dddd LT [сехетре]',
  18290. lastWeek: '[Иртнӗ] dddd LT [сехетре]',
  18291. sameElse: 'L'
  18292. },
  18293. relativeTime : {
  18294. future : function (output) {
  18295. var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран';
  18296. return output + affix;
  18297. },
  18298. past : '%s каялла',
  18299. s : 'пӗр-ик ҫеккунт',
  18300. m : 'пӗр минут',
  18301. mm : '%d минут',
  18302. h : 'пӗр сехет',
  18303. hh : '%d сехет',
  18304. d : 'пӗр кун',
  18305. dd : '%d кун',
  18306. M : 'пӗр уйӑх',
  18307. MM : '%d уйӑх',
  18308. y : 'пӗр ҫул',
  18309. yy : '%d ҫул'
  18310. },
  18311. ordinalParse: /\d{1,2}-мӗш/,
  18312. ordinal : '%d-мӗш',
  18313. week : {
  18314. dow : 1, // Monday is the first day of the week.
  18315. doy : 7 // The week that contains Jan 1st is the first week of the year.
  18316. }
  18317. });
  18318. //! moment.js locale configuration
  18319. //! locale : Welsh (cy)
  18320. //! author : Robert Allen
  18321. var cy = _moment__default.defineLocale('cy', {
  18322. months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'),
  18323. monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'),
  18324. weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'),
  18325. weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'),
  18326. weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'),
  18327. // time formats are the same as en-gb
  18328. longDateFormat: {
  18329. LT: 'HH:mm',
  18330. LTS : 'HH:mm:ss',
  18331. L: 'DD/MM/YYYY',
  18332. LL: 'D MMMM YYYY',
  18333. LLL: 'D MMMM YYYY HH:mm',
  18334. LLLL: 'dddd, D MMMM YYYY HH:mm'
  18335. },
  18336. calendar: {
  18337. sameDay: '[Heddiw am] LT',
  18338. nextDay: '[Yfory am] LT',
  18339. nextWeek: 'dddd [am] LT',
  18340. lastDay: '[Ddoe am] LT',
  18341. lastWeek: 'dddd [diwethaf am] LT',
  18342. sameElse: 'L'
  18343. },
  18344. relativeTime: {
  18345. future: 'mewn %s',
  18346. past: '%s yn ôl',
  18347. s: 'ychydig eiliadau',
  18348. m: 'munud',
  18349. mm: '%d munud',
  18350. h: 'awr',
  18351. hh: '%d awr',
  18352. d: 'diwrnod',
  18353. dd: '%d diwrnod',
  18354. M: 'mis',
  18355. MM: '%d mis',
  18356. y: 'blwyddyn',
  18357. yy: '%d flynedd'
  18358. },
  18359. ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,
  18360. // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh
  18361. ordinal: function (number) {
  18362. var b = number,
  18363. output = '',
  18364. lookup = [
  18365. '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
  18366. 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
  18367. ];
  18368. if (b > 20) {
  18369. if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) {
  18370. output = 'fed'; // not 30ain, 70ain or 90ain
  18371. } else {
  18372. output = 'ain';
  18373. }
  18374. } else if (b > 0) {
  18375. output = lookup[b];
  18376. }
  18377. return number + output;
  18378. },
  18379. week : {
  18380. dow : 1, // Monday is the first day of the week.
  18381. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18382. }
  18383. });
  18384. //! moment.js locale configuration
  18385. //! locale : danish (da)
  18386. //! author : Ulrik Nielsen : https://github.com/mrbase
  18387. var da = _moment__default.defineLocale('da', {
  18388. months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'),
  18389. monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
  18390. weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
  18391. weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'),
  18392. weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'),
  18393. longDateFormat : {
  18394. LT : 'HH:mm',
  18395. LTS : 'HH:mm:ss',
  18396. L : 'DD/MM/YYYY',
  18397. LL : 'D. MMMM YYYY',
  18398. LLL : 'D. MMMM YYYY HH:mm',
  18399. LLLL : 'dddd [d.] D. MMMM YYYY HH:mm'
  18400. },
  18401. calendar : {
  18402. sameDay : '[I dag kl.] LT',
  18403. nextDay : '[I morgen kl.] LT',
  18404. nextWeek : 'dddd [kl.] LT',
  18405. lastDay : '[I går kl.] LT',
  18406. lastWeek : '[sidste] dddd [kl] LT',
  18407. sameElse : 'L'
  18408. },
  18409. relativeTime : {
  18410. future : 'om %s',
  18411. past : '%s siden',
  18412. s : 'få sekunder',
  18413. m : 'et minut',
  18414. mm : '%d minutter',
  18415. h : 'en time',
  18416. hh : '%d timer',
  18417. d : 'en dag',
  18418. dd : '%d dage',
  18419. M : 'en måned',
  18420. MM : '%d måneder',
  18421. y : 'et år',
  18422. yy : '%d år'
  18423. },
  18424. ordinalParse: /\d{1,2}\./,
  18425. ordinal : '%d.',
  18426. week : {
  18427. dow : 1, // Monday is the first day of the week.
  18428. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18429. }
  18430. });
  18431. //! moment.js locale configuration
  18432. //! locale : austrian german (de-at)
  18433. //! author : lluchs : https://github.com/lluchs
  18434. //! author: Menelion Elensúle: https://github.com/Oire
  18435. //! author : Martin Groller : https://github.com/MadMG
  18436. function de_at__processRelativeTime(number, withoutSuffix, key, isFuture) {
  18437. var format = {
  18438. 'm': ['eine Minute', 'einer Minute'],
  18439. 'h': ['eine Stunde', 'einer Stunde'],
  18440. 'd': ['ein Tag', 'einem Tag'],
  18441. 'dd': [number + ' Tage', number + ' Tagen'],
  18442. 'M': ['ein Monat', 'einem Monat'],
  18443. 'MM': [number + ' Monate', number + ' Monaten'],
  18444. 'y': ['ein Jahr', 'einem Jahr'],
  18445. 'yy': [number + ' Jahre', number + ' Jahren']
  18446. };
  18447. return withoutSuffix ? format[key][0] : format[key][1];
  18448. }
  18449. var de_at = _moment__default.defineLocale('de-at', {
  18450. months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
  18451. monthsShort : 'Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
  18452. weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
  18453. weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
  18454. weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
  18455. longDateFormat : {
  18456. LT: 'HH:mm',
  18457. LTS: 'HH:mm:ss',
  18458. L : 'DD.MM.YYYY',
  18459. LL : 'D. MMMM YYYY',
  18460. LLL : 'D. MMMM YYYY HH:mm',
  18461. LLLL : 'dddd, D. MMMM YYYY HH:mm'
  18462. },
  18463. calendar : {
  18464. sameDay: '[Heute um] LT [Uhr]',
  18465. sameElse: 'L',
  18466. nextDay: '[Morgen um] LT [Uhr]',
  18467. nextWeek: 'dddd [um] LT [Uhr]',
  18468. lastDay: '[Gestern um] LT [Uhr]',
  18469. lastWeek: '[letzten] dddd [um] LT [Uhr]'
  18470. },
  18471. relativeTime : {
  18472. future : 'in %s',
  18473. past : 'vor %s',
  18474. s : 'ein paar Sekunden',
  18475. m : de_at__processRelativeTime,
  18476. mm : '%d Minuten',
  18477. h : de_at__processRelativeTime,
  18478. hh : '%d Stunden',
  18479. d : de_at__processRelativeTime,
  18480. dd : de_at__processRelativeTime,
  18481. M : de_at__processRelativeTime,
  18482. MM : de_at__processRelativeTime,
  18483. y : de_at__processRelativeTime,
  18484. yy : de_at__processRelativeTime
  18485. },
  18486. ordinalParse: /\d{1,2}\./,
  18487. ordinal : '%d.',
  18488. week : {
  18489. dow : 1, // Monday is the first day of the week.
  18490. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18491. }
  18492. });
  18493. //! moment.js locale configuration
  18494. //! locale : german (de)
  18495. //! author : lluchs : https://github.com/lluchs
  18496. //! author: Menelion Elensúle: https://github.com/Oire
  18497. function de__processRelativeTime(number, withoutSuffix, key, isFuture) {
  18498. var format = {
  18499. 'm': ['eine Minute', 'einer Minute'],
  18500. 'h': ['eine Stunde', 'einer Stunde'],
  18501. 'd': ['ein Tag', 'einem Tag'],
  18502. 'dd': [number + ' Tage', number + ' Tagen'],
  18503. 'M': ['ein Monat', 'einem Monat'],
  18504. 'MM': [number + ' Monate', number + ' Monaten'],
  18505. 'y': ['ein Jahr', 'einem Jahr'],
  18506. 'yy': [number + ' Jahre', number + ' Jahren']
  18507. };
  18508. return withoutSuffix ? format[key][0] : format[key][1];
  18509. }
  18510. var de = _moment__default.defineLocale('de', {
  18511. months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
  18512. monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
  18513. weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
  18514. weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
  18515. weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
  18516. longDateFormat : {
  18517. LT: 'HH:mm',
  18518. LTS: 'HH:mm:ss',
  18519. L : 'DD.MM.YYYY',
  18520. LL : 'D. MMMM YYYY',
  18521. LLL : 'D. MMMM YYYY HH:mm',
  18522. LLLL : 'dddd, D. MMMM YYYY HH:mm'
  18523. },
  18524. calendar : {
  18525. sameDay: '[Heute um] LT [Uhr]',
  18526. sameElse: 'L',
  18527. nextDay: '[Morgen um] LT [Uhr]',
  18528. nextWeek: 'dddd [um] LT [Uhr]',
  18529. lastDay: '[Gestern um] LT [Uhr]',
  18530. lastWeek: '[letzten] dddd [um] LT [Uhr]'
  18531. },
  18532. relativeTime : {
  18533. future : 'in %s',
  18534. past : 'vor %s',
  18535. s : 'ein paar Sekunden',
  18536. m : de__processRelativeTime,
  18537. mm : '%d Minuten',
  18538. h : de__processRelativeTime,
  18539. hh : '%d Stunden',
  18540. d : de__processRelativeTime,
  18541. dd : de__processRelativeTime,
  18542. M : de__processRelativeTime,
  18543. MM : de__processRelativeTime,
  18544. y : de__processRelativeTime,
  18545. yy : de__processRelativeTime
  18546. },
  18547. ordinalParse: /\d{1,2}\./,
  18548. ordinal : '%d.',
  18549. week : {
  18550. dow : 1, // Monday is the first day of the week.
  18551. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18552. }
  18553. });
  18554. //! moment.js locale configuration
  18555. //! locale : modern greek (el)
  18556. //! author : Aggelos Karalias : https://github.com/mehiel
  18557. var el = _moment__default.defineLocale('el', {
  18558. monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'),
  18559. monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'),
  18560. months : function (momentToFormat, format) {
  18561. if (/D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM'
  18562. return this._monthsGenitiveEl[momentToFormat.month()];
  18563. } else {
  18564. return this._monthsNominativeEl[momentToFormat.month()];
  18565. }
  18566. },
  18567. monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'),
  18568. weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'),
  18569. weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'),
  18570. weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'),
  18571. meridiem : function (hours, minutes, isLower) {
  18572. if (hours > 11) {
  18573. return isLower ? 'μμ' : 'ΜΜ';
  18574. } else {
  18575. return isLower ? 'πμ' : 'ΠΜ';
  18576. }
  18577. },
  18578. isPM : function (input) {
  18579. return ((input + '').toLowerCase()[0] === 'μ');
  18580. },
  18581. meridiemParse : /[ΠΜ]\.?Μ?\.?/i,
  18582. longDateFormat : {
  18583. LT : 'h:mm A',
  18584. LTS : 'h:mm:ss A',
  18585. L : 'DD/MM/YYYY',
  18586. LL : 'D MMMM YYYY',
  18587. LLL : 'D MMMM YYYY h:mm A',
  18588. LLLL : 'dddd, D MMMM YYYY h:mm A'
  18589. },
  18590. calendarEl : {
  18591. sameDay : '[Σήμερα {}] LT',
  18592. nextDay : '[Αύριο {}] LT',
  18593. nextWeek : 'dddd [{}] LT',
  18594. lastDay : '[Χθες {}] LT',
  18595. lastWeek : function () {
  18596. switch (this.day()) {
  18597. case 6:
  18598. return '[το προηγούμενο] dddd [{}] LT';
  18599. default:
  18600. return '[την προηγούμενη] dddd [{}] LT';
  18601. }
  18602. },
  18603. sameElse : 'L'
  18604. },
  18605. calendar : function (key, mom) {
  18606. var output = this._calendarEl[key],
  18607. hours = mom && mom.hours();
  18608. if (typeof output === 'function') {
  18609. output = output.apply(mom);
  18610. }
  18611. return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις'));
  18612. },
  18613. relativeTime : {
  18614. future : 'σε %s',
  18615. past : '%s πριν',
  18616. s : 'λίγα δευτερόλεπτα',
  18617. m : 'ένα λεπτό',
  18618. mm : '%d λεπτά',
  18619. h : 'μία ώρα',
  18620. hh : '%d ώρες',
  18621. d : 'μία μέρα',
  18622. dd : '%d μέρες',
  18623. M : 'ένας μήνας',
  18624. MM : '%d μήνες',
  18625. y : 'ένας χρόνος',
  18626. yy : '%d χρόνια'
  18627. },
  18628. ordinalParse: /\d{1,2}η/,
  18629. ordinal: '%dη',
  18630. week : {
  18631. dow : 1, // Monday is the first day of the week.
  18632. doy : 4 // The week that contains Jan 4st is the first week of the year.
  18633. }
  18634. });
  18635. //! moment.js locale configuration
  18636. //! locale : australian english (en-au)
  18637. var en_au = _moment__default.defineLocale('en-au', {
  18638. months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
  18639. monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  18640. weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
  18641. weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  18642. weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  18643. longDateFormat : {
  18644. LT : 'h:mm A',
  18645. LTS : 'h:mm:ss A',
  18646. L : 'DD/MM/YYYY',
  18647. LL : 'D MMMM YYYY',
  18648. LLL : 'D MMMM YYYY h:mm A',
  18649. LLLL : 'dddd, D MMMM YYYY h:mm A'
  18650. },
  18651. calendar : {
  18652. sameDay : '[Today at] LT',
  18653. nextDay : '[Tomorrow at] LT',
  18654. nextWeek : 'dddd [at] LT',
  18655. lastDay : '[Yesterday at] LT',
  18656. lastWeek : '[Last] dddd [at] LT',
  18657. sameElse : 'L'
  18658. },
  18659. relativeTime : {
  18660. future : 'in %s',
  18661. past : '%s ago',
  18662. s : 'a few seconds',
  18663. m : 'a minute',
  18664. mm : '%d minutes',
  18665. h : 'an hour',
  18666. hh : '%d hours',
  18667. d : 'a day',
  18668. dd : '%d days',
  18669. M : 'a month',
  18670. MM : '%d months',
  18671. y : 'a year',
  18672. yy : '%d years'
  18673. },
  18674. ordinalParse: /\d{1,2}(st|nd|rd|th)/,
  18675. ordinal : function (number) {
  18676. var b = number % 10,
  18677. output = (~~(number % 100 / 10) === 1) ? 'th' :
  18678. (b === 1) ? 'st' :
  18679. (b === 2) ? 'nd' :
  18680. (b === 3) ? 'rd' : 'th';
  18681. return number + output;
  18682. },
  18683. week : {
  18684. dow : 1, // Monday is the first day of the week.
  18685. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18686. }
  18687. });
  18688. //! moment.js locale configuration
  18689. //! locale : canadian english (en-ca)
  18690. //! author : Jonathan Abourbih : https://github.com/jonbca
  18691. var en_ca = _moment__default.defineLocale('en-ca', {
  18692. months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
  18693. monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  18694. weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
  18695. weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  18696. weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  18697. longDateFormat : {
  18698. LT : 'h:mm A',
  18699. LTS : 'h:mm:ss A',
  18700. L : 'YYYY-MM-DD',
  18701. LL : 'D MMMM, YYYY',
  18702. LLL : 'D MMMM, YYYY h:mm A',
  18703. LLLL : 'dddd, D MMMM, YYYY h:mm A'
  18704. },
  18705. calendar : {
  18706. sameDay : '[Today at] LT',
  18707. nextDay : '[Tomorrow at] LT',
  18708. nextWeek : 'dddd [at] LT',
  18709. lastDay : '[Yesterday at] LT',
  18710. lastWeek : '[Last] dddd [at] LT',
  18711. sameElse : 'L'
  18712. },
  18713. relativeTime : {
  18714. future : 'in %s',
  18715. past : '%s ago',
  18716. s : 'a few seconds',
  18717. m : 'a minute',
  18718. mm : '%d minutes',
  18719. h : 'an hour',
  18720. hh : '%d hours',
  18721. d : 'a day',
  18722. dd : '%d days',
  18723. M : 'a month',
  18724. MM : '%d months',
  18725. y : 'a year',
  18726. yy : '%d years'
  18727. },
  18728. ordinalParse: /\d{1,2}(st|nd|rd|th)/,
  18729. ordinal : function (number) {
  18730. var b = number % 10,
  18731. output = (~~(number % 100 / 10) === 1) ? 'th' :
  18732. (b === 1) ? 'st' :
  18733. (b === 2) ? 'nd' :
  18734. (b === 3) ? 'rd' : 'th';
  18735. return number + output;
  18736. }
  18737. });
  18738. //! moment.js locale configuration
  18739. //! locale : great britain english (en-gb)
  18740. //! author : Chris Gedrim : https://github.com/chrisgedrim
  18741. var en_gb = _moment__default.defineLocale('en-gb', {
  18742. months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
  18743. monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  18744. weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
  18745. weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  18746. weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  18747. longDateFormat : {
  18748. LT : 'HH:mm',
  18749. LTS : 'HH:mm:ss',
  18750. L : 'DD/MM/YYYY',
  18751. LL : 'D MMMM YYYY',
  18752. LLL : 'D MMMM YYYY HH:mm',
  18753. LLLL : 'dddd, D MMMM YYYY HH:mm'
  18754. },
  18755. calendar : {
  18756. sameDay : '[Today at] LT',
  18757. nextDay : '[Tomorrow at] LT',
  18758. nextWeek : 'dddd [at] LT',
  18759. lastDay : '[Yesterday at] LT',
  18760. lastWeek : '[Last] dddd [at] LT',
  18761. sameElse : 'L'
  18762. },
  18763. relativeTime : {
  18764. future : 'in %s',
  18765. past : '%s ago',
  18766. s : 'a few seconds',
  18767. m : 'a minute',
  18768. mm : '%d minutes',
  18769. h : 'an hour',
  18770. hh : '%d hours',
  18771. d : 'a day',
  18772. dd : '%d days',
  18773. M : 'a month',
  18774. MM : '%d months',
  18775. y : 'a year',
  18776. yy : '%d years'
  18777. },
  18778. ordinalParse: /\d{1,2}(st|nd|rd|th)/,
  18779. ordinal : function (number) {
  18780. var b = number % 10,
  18781. output = (~~(number % 100 / 10) === 1) ? 'th' :
  18782. (b === 1) ? 'st' :
  18783. (b === 2) ? 'nd' :
  18784. (b === 3) ? 'rd' : 'th';
  18785. return number + output;
  18786. },
  18787. week : {
  18788. dow : 1, // Monday is the first day of the week.
  18789. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18790. }
  18791. });
  18792. //! moment.js locale configuration
  18793. //! locale : esperanto (eo)
  18794. //! author : Colin Dean : https://github.com/colindean
  18795. //! komento: Mi estas malcerta se mi korekte traktis akuzativojn en tiu traduko.
  18796. //! Se ne, bonvolu korekti kaj avizi min por ke mi povas lerni!
  18797. var eo = _moment__default.defineLocale('eo', {
  18798. months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'),
  18799. monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'),
  18800. weekdays : 'Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato'.split('_'),
  18801. weekdaysShort : 'Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab'.split('_'),
  18802. weekdaysMin : 'Di_Lu_Ma_Me_Ĵa_Ve_Sa'.split('_'),
  18803. longDateFormat : {
  18804. LT : 'HH:mm',
  18805. LTS : 'HH:mm:ss',
  18806. L : 'YYYY-MM-DD',
  18807. LL : 'D[-an de] MMMM, YYYY',
  18808. LLL : 'D[-an de] MMMM, YYYY HH:mm',
  18809. LLLL : 'dddd, [la] D[-an de] MMMM, YYYY HH:mm'
  18810. },
  18811. meridiemParse: /[ap]\.t\.m/i,
  18812. isPM: function (input) {
  18813. return input.charAt(0).toLowerCase() === 'p';
  18814. },
  18815. meridiem : function (hours, minutes, isLower) {
  18816. if (hours > 11) {
  18817. return isLower ? 'p.t.m.' : 'P.T.M.';
  18818. } else {
  18819. return isLower ? 'a.t.m.' : 'A.T.M.';
  18820. }
  18821. },
  18822. calendar : {
  18823. sameDay : '[Hodiaŭ je] LT',
  18824. nextDay : '[Morgaŭ je] LT',
  18825. nextWeek : 'dddd [je] LT',
  18826. lastDay : '[Hieraŭ je] LT',
  18827. lastWeek : '[pasinta] dddd [je] LT',
  18828. sameElse : 'L'
  18829. },
  18830. relativeTime : {
  18831. future : 'je %s',
  18832. past : 'antaŭ %s',
  18833. s : 'sekundoj',
  18834. m : 'minuto',
  18835. mm : '%d minutoj',
  18836. h : 'horo',
  18837. hh : '%d horoj',
  18838. d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo
  18839. dd : '%d tagoj',
  18840. M : 'monato',
  18841. MM : '%d monatoj',
  18842. y : 'jaro',
  18843. yy : '%d jaroj'
  18844. },
  18845. ordinalParse: /\d{1,2}a/,
  18846. ordinal : '%da',
  18847. week : {
  18848. dow : 1, // Monday is the first day of the week.
  18849. doy : 7 // The week that contains Jan 1st is the first week of the year.
  18850. }
  18851. });
  18852. //! moment.js locale configuration
  18853. //! locale : spanish (es)
  18854. //! author : Julio Napurí : https://github.com/julionc
  18855. var monthsShortDot = 'Ene._Feb._Mar._Abr._May._Jun._Jul._Ago._Sep._Oct._Nov._Dic.'.split('_'),
  18856. es__monthsShort = 'Ene_Feb_Mar_Abr_May_Jun_Jul_Ago_Sep_Oct_Nov_Dic'.split('_');
  18857. var es = _moment__default.defineLocale('es', {
  18858. months : 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre'.split('_'),
  18859. monthsShort : function (m, format) {
  18860. if (/-MMM-/.test(format)) {
  18861. return es__monthsShort[m.month()];
  18862. } else {
  18863. return monthsShortDot[m.month()];
  18864. }
  18865. },
  18866. weekdays : 'Domingo_Lunes_Martes_Miércoles_Jueves_Viernes_Sábado'.split('_'),
  18867. weekdaysShort : 'Dom._Lun._Mar._Mié._Jue._Vie._Sáb.'.split('_'),
  18868. weekdaysMin : 'Do_Lu_Ma_Mi_Ju_Vi_Sá'.split('_'),
  18869. longDateFormat : {
  18870. LT : 'H:mm',
  18871. LTS : 'H:mm:ss',
  18872. L : 'DD/MM/YYYY',
  18873. LL : 'D [de] MMMM [de] YYYY',
  18874. LLL : 'D [de] MMMM [de] YYYY H:mm',
  18875. LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm'
  18876. },
  18877. calendar : {
  18878. sameDay : function () {
  18879. return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  18880. },
  18881. nextDay : function () {
  18882. return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  18883. },
  18884. nextWeek : function () {
  18885. return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  18886. },
  18887. lastDay : function () {
  18888. return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  18889. },
  18890. lastWeek : function () {
  18891. return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  18892. },
  18893. sameElse : 'L'
  18894. },
  18895. relativeTime : {
  18896. future : 'en %s',
  18897. past : 'hace %s',
  18898. s : 'unos segundos',
  18899. m : 'un minuto',
  18900. mm : '%d minutos',
  18901. h : 'una hora',
  18902. hh : '%d horas',
  18903. d : 'un día',
  18904. dd : '%d días',
  18905. M : 'un mes',
  18906. MM : '%d meses',
  18907. y : 'un año',
  18908. yy : '%d años'
  18909. },
  18910. ordinalParse : /\d{1,2}º/,
  18911. ordinal : '%dº',
  18912. week : {
  18913. dow : 1, // Monday is the first day of the week.
  18914. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18915. }
  18916. });
  18917. //! moment.js locale configuration
  18918. //! locale : estonian (et)
  18919. //! author : Henry Kehlmann : https://github.com/madhenry
  18920. //! improvements : Illimar Tambek : https://github.com/ragulka
  18921. function et__processRelativeTime(number, withoutSuffix, key, isFuture) {
  18922. var format = {
  18923. 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'],
  18924. 'm' : ['ühe minuti', 'üks minut'],
  18925. 'mm': [number + ' minuti', number + ' minutit'],
  18926. 'h' : ['ühe tunni', 'tund aega', 'üks tund'],
  18927. 'hh': [number + ' tunni', number + ' tundi'],
  18928. 'd' : ['ühe päeva', 'üks päev'],
  18929. 'M' : ['kuu aja', 'kuu aega', 'üks kuu'],
  18930. 'MM': [number + ' kuu', number + ' kuud'],
  18931. 'y' : ['ühe aasta', 'aasta', 'üks aasta'],
  18932. 'yy': [number + ' aasta', number + ' aastat']
  18933. };
  18934. if (withoutSuffix) {
  18935. return format[key][2] ? format[key][2] : format[key][1];
  18936. }
  18937. return isFuture ? format[key][0] : format[key][1];
  18938. }
  18939. var et = _moment__default.defineLocale('et', {
  18940. months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'),
  18941. monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'),
  18942. weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'),
  18943. weekdaysShort : 'P_E_T_K_N_R_L'.split('_'),
  18944. weekdaysMin : 'P_E_T_K_N_R_L'.split('_'),
  18945. longDateFormat : {
  18946. LT : 'H:mm',
  18947. LTS : 'H:mm:ss',
  18948. L : 'DD.MM.YYYY',
  18949. LL : 'D. MMMM YYYY',
  18950. LLL : 'D. MMMM YYYY H:mm',
  18951. LLLL : 'dddd, D. MMMM YYYY H:mm'
  18952. },
  18953. calendar : {
  18954. sameDay : '[Täna,] LT',
  18955. nextDay : '[Homme,] LT',
  18956. nextWeek : '[Järgmine] dddd LT',
  18957. lastDay : '[Eile,] LT',
  18958. lastWeek : '[Eelmine] dddd LT',
  18959. sameElse : 'L'
  18960. },
  18961. relativeTime : {
  18962. future : '%s pärast',
  18963. past : '%s tagasi',
  18964. s : et__processRelativeTime,
  18965. m : et__processRelativeTime,
  18966. mm : et__processRelativeTime,
  18967. h : et__processRelativeTime,
  18968. hh : et__processRelativeTime,
  18969. d : et__processRelativeTime,
  18970. dd : '%d päeva',
  18971. M : et__processRelativeTime,
  18972. MM : et__processRelativeTime,
  18973. y : et__processRelativeTime,
  18974. yy : et__processRelativeTime
  18975. },
  18976. ordinalParse: /\d{1,2}\./,
  18977. ordinal : '%d.',
  18978. week : {
  18979. dow : 1, // Monday is the first day of the week.
  18980. doy : 4 // The week that contains Jan 4th is the first week of the year.
  18981. }
  18982. });
  18983. //! moment.js locale configuration
  18984. //! locale : euskara (eu)
  18985. //! author : Eneko Illarramendi : https://github.com/eillarra
  18986. var eu = _moment__default.defineLocale('eu', {
  18987. months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'),
  18988. monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'),
  18989. weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'),
  18990. weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'),
  18991. weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'),
  18992. longDateFormat : {
  18993. LT : 'HH:mm',
  18994. LTS : 'HH:mm:ss',
  18995. L : 'YYYY-MM-DD',
  18996. LL : 'YYYY[ko] MMMM[ren] D[a]',
  18997. LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm',
  18998. LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm',
  18999. l : 'YYYY-M-D',
  19000. ll : 'YYYY[ko] MMM D[a]',
  19001. lll : 'YYYY[ko] MMM D[a] HH:mm',
  19002. llll : 'ddd, YYYY[ko] MMM D[a] HH:mm'
  19003. },
  19004. calendar : {
  19005. sameDay : '[gaur] LT[etan]',
  19006. nextDay : '[bihar] LT[etan]',
  19007. nextWeek : 'dddd LT[etan]',
  19008. lastDay : '[atzo] LT[etan]',
  19009. lastWeek : '[aurreko] dddd LT[etan]',
  19010. sameElse : 'L'
  19011. },
  19012. relativeTime : {
  19013. future : '%s barru',
  19014. past : 'duela %s',
  19015. s : 'segundo batzuk',
  19016. m : 'minutu bat',
  19017. mm : '%d minutu',
  19018. h : 'ordu bat',
  19019. hh : '%d ordu',
  19020. d : 'egun bat',
  19021. dd : '%d egun',
  19022. M : 'hilabete bat',
  19023. MM : '%d hilabete',
  19024. y : 'urte bat',
  19025. yy : '%d urte'
  19026. },
  19027. ordinalParse: /\d{1,2}\./,
  19028. ordinal : '%d.',
  19029. week : {
  19030. dow : 1, // Monday is the first day of the week.
  19031. doy : 7 // The week that contains Jan 1st is the first week of the year.
  19032. }
  19033. });
  19034. //! moment.js locale configuration
  19035. //! locale : Persian (fa)
  19036. //! author : Ebrahim Byagowi : https://github.com/ebraminio
  19037. var fa__symbolMap = {
  19038. '1': '۱',
  19039. '2': '۲',
  19040. '3': '۳',
  19041. '4': '۴',
  19042. '5': '۵',
  19043. '6': '۶',
  19044. '7': '۷',
  19045. '8': '۸',
  19046. '9': '۹',
  19047. '0': '۰'
  19048. }, fa__numberMap = {
  19049. '۱': '1',
  19050. '۲': '2',
  19051. '۳': '3',
  19052. '۴': '4',
  19053. '۵': '5',
  19054. '۶': '6',
  19055. '۷': '7',
  19056. '۸': '8',
  19057. '۹': '9',
  19058. '۰': '0'
  19059. };
  19060. var fa = _moment__default.defineLocale('fa', {
  19061. months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'),
  19062. monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'),
  19063. weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
  19064. weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
  19065. weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'),
  19066. longDateFormat : {
  19067. LT : 'HH:mm',
  19068. LTS : 'HH:mm:ss',
  19069. L : 'DD/MM/YYYY',
  19070. LL : 'D MMMM YYYY',
  19071. LLL : 'D MMMM YYYY HH:mm',
  19072. LLLL : 'dddd, D MMMM YYYY HH:mm'
  19073. },
  19074. meridiemParse: /قبل از ظهر|بعد از ظهر/,
  19075. isPM: function (input) {
  19076. return /بعد از ظهر/.test(input);
  19077. },
  19078. meridiem : function (hour, minute, isLower) {
  19079. if (hour < 12) {
  19080. return 'قبل از ظهر';
  19081. } else {
  19082. return 'بعد از ظهر';
  19083. }
  19084. },
  19085. calendar : {
  19086. sameDay : '[امروز ساعت] LT',
  19087. nextDay : '[فردا ساعت] LT',
  19088. nextWeek : 'dddd [ساعت] LT',
  19089. lastDay : '[دیروز ساعت] LT',
  19090. lastWeek : 'dddd [پیش] [ساعت] LT',
  19091. sameElse : 'L'
  19092. },
  19093. relativeTime : {
  19094. future : 'در %s',
  19095. past : '%s پیش',
  19096. s : 'چندین ثانیه',
  19097. m : 'یک دقیقه',
  19098. mm : '%d دقیقه',
  19099. h : 'یک ساعت',
  19100. hh : '%d ساعت',
  19101. d : 'یک روز',
  19102. dd : '%d روز',
  19103. M : 'یک ماه',
  19104. MM : '%d ماه',
  19105. y : 'یک سال',
  19106. yy : '%d سال'
  19107. },
  19108. preparse: function (string) {
  19109. return string.replace(/[۰-۹]/g, function (match) {
  19110. return fa__numberMap[match];
  19111. }).replace(/،/g, ',');
  19112. },
  19113. postformat: function (string) {
  19114. return string.replace(/\d/g, function (match) {
  19115. return fa__symbolMap[match];
  19116. }).replace(/,/g, '،');
  19117. },
  19118. ordinalParse: /\d{1,2}م/,
  19119. ordinal : '%dم',
  19120. week : {
  19121. dow : 6, // Saturday is the first day of the week.
  19122. doy : 12 // The week that contains Jan 1st is the first week of the year.
  19123. }
  19124. });
  19125. //! moment.js locale configuration
  19126. //! locale : finnish (fi)
  19127. //! author : Tarmo Aidantausta : https://github.com/bleadof
  19128. var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '),
  19129. numbersFuture = [
  19130. 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden',
  19131. numbersPast[7], numbersPast[8], numbersPast[9]
  19132. ];
  19133. function fi__translate(number, withoutSuffix, key, isFuture) {
  19134. var result = '';
  19135. switch (key) {
  19136. case 's':
  19137. return isFuture ? 'muutaman sekunnin' : 'muutama sekunti';
  19138. case 'm':
  19139. return isFuture ? 'minuutin' : 'minuutti';
  19140. case 'mm':
  19141. result = isFuture ? 'minuutin' : 'minuuttia';
  19142. break;
  19143. case 'h':
  19144. return isFuture ? 'tunnin' : 'tunti';
  19145. case 'hh':
  19146. result = isFuture ? 'tunnin' : 'tuntia';
  19147. break;
  19148. case 'd':
  19149. return isFuture ? 'päivän' : 'päivä';
  19150. case 'dd':
  19151. result = isFuture ? 'päivän' : 'päivää';
  19152. break;
  19153. case 'M':
  19154. return isFuture ? 'kuukauden' : 'kuukausi';
  19155. case 'MM':
  19156. result = isFuture ? 'kuukauden' : 'kuukautta';
  19157. break;
  19158. case 'y':
  19159. return isFuture ? 'vuoden' : 'vuosi';
  19160. case 'yy':
  19161. result = isFuture ? 'vuoden' : 'vuotta';
  19162. break;
  19163. }
  19164. result = verbalNumber(number, isFuture) + ' ' + result;
  19165. return result;
  19166. }
  19167. function verbalNumber(number, isFuture) {
  19168. return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number;
  19169. }
  19170. var fi = _moment__default.defineLocale('fi', {
  19171. months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'),
  19172. monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'),
  19173. weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'),
  19174. weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'),
  19175. weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'),
  19176. longDateFormat : {
  19177. LT : 'HH.mm',
  19178. LTS : 'HH.mm.ss',
  19179. L : 'DD.MM.YYYY',
  19180. LL : 'Do MMMM[ta] YYYY',
  19181. LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm',
  19182. LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm',
  19183. l : 'D.M.YYYY',
  19184. ll : 'Do MMM YYYY',
  19185. lll : 'Do MMM YYYY, [klo] HH.mm',
  19186. llll : 'ddd, Do MMM YYYY, [klo] HH.mm'
  19187. },
  19188. calendar : {
  19189. sameDay : '[tänään] [klo] LT',
  19190. nextDay : '[huomenna] [klo] LT',
  19191. nextWeek : 'dddd [klo] LT',
  19192. lastDay : '[eilen] [klo] LT',
  19193. lastWeek : '[viime] dddd[na] [klo] LT',
  19194. sameElse : 'L'
  19195. },
  19196. relativeTime : {
  19197. future : '%s päästä',
  19198. past : '%s sitten',
  19199. s : fi__translate,
  19200. m : fi__translate,
  19201. mm : fi__translate,
  19202. h : fi__translate,
  19203. hh : fi__translate,
  19204. d : fi__translate,
  19205. dd : fi__translate,
  19206. M : fi__translate,
  19207. MM : fi__translate,
  19208. y : fi__translate,
  19209. yy : fi__translate
  19210. },
  19211. ordinalParse: /\d{1,2}\./,
  19212. ordinal : '%d.',
  19213. week : {
  19214. dow : 1, // Monday is the first day of the week.
  19215. doy : 4 // The week that contains Jan 4th is the first week of the year.
  19216. }
  19217. });
  19218. //! moment.js locale configuration
  19219. //! locale : faroese (fo)
  19220. //! author : Ragnar Johannesen : https://github.com/ragnar123
  19221. var fo = _moment__default.defineLocale('fo', {
  19222. months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
  19223. monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
  19224. weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'),
  19225. weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'),
  19226. weekdaysMin : 'su_má_tý_mi_hó_fr_le'.split('_'),
  19227. longDateFormat : {
  19228. LT : 'HH:mm',
  19229. LTS : 'HH:mm:ss',
  19230. L : 'DD/MM/YYYY',
  19231. LL : 'D MMMM YYYY',
  19232. LLL : 'D MMMM YYYY HH:mm',
  19233. LLLL : 'dddd D. MMMM, YYYY HH:mm'
  19234. },
  19235. calendar : {
  19236. sameDay : '[Í dag kl.] LT',
  19237. nextDay : '[Í morgin kl.] LT',
  19238. nextWeek : 'dddd [kl.] LT',
  19239. lastDay : '[Í gjár kl.] LT',
  19240. lastWeek : '[síðstu] dddd [kl] LT',
  19241. sameElse : 'L'
  19242. },
  19243. relativeTime : {
  19244. future : 'um %s',
  19245. past : '%s síðani',
  19246. s : 'fá sekund',
  19247. m : 'ein minutt',
  19248. mm : '%d minuttir',
  19249. h : 'ein tími',
  19250. hh : '%d tímar',
  19251. d : 'ein dagur',
  19252. dd : '%d dagar',
  19253. M : 'ein mánaði',
  19254. MM : '%d mánaðir',
  19255. y : 'eitt ár',
  19256. yy : '%d ár'
  19257. },
  19258. ordinalParse: /\d{1,2}\./,
  19259. ordinal : '%d.',
  19260. week : {
  19261. dow : 1, // Monday is the first day of the week.
  19262. doy : 4 // The week that contains Jan 4th is the first week of the year.
  19263. }
  19264. });
  19265. //! moment.js locale configuration
  19266. //! locale : canadian french (fr-ca)
  19267. //! author : Jonathan Abourbih : https://github.com/jonbca
  19268. var fr_ca = _moment__default.defineLocale('fr-ca', {
  19269. months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
  19270. monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
  19271. weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
  19272. weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
  19273. weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
  19274. longDateFormat : {
  19275. LT : 'HH:mm',
  19276. LTS : 'HH:mm:ss',
  19277. L : 'YYYY-MM-DD',
  19278. LL : 'D MMMM YYYY',
  19279. LLL : 'D MMMM YYYY HH:mm',
  19280. LLLL : 'dddd D MMMM YYYY HH:mm'
  19281. },
  19282. calendar : {
  19283. sameDay: '[Aujourd\'hui à] LT',
  19284. nextDay: '[Demain à] LT',
  19285. nextWeek: 'dddd [à] LT',
  19286. lastDay: '[Hier à] LT',
  19287. lastWeek: 'dddd [dernier à] LT',
  19288. sameElse: 'L'
  19289. },
  19290. relativeTime : {
  19291. future : 'dans %s',
  19292. past : 'il y a %s',
  19293. s : 'quelques secondes',
  19294. m : 'une minute',
  19295. mm : '%d minutes',
  19296. h : 'une heure',
  19297. hh : '%d heures',
  19298. d : 'un jour',
  19299. dd : '%d jours',
  19300. M : 'un mois',
  19301. MM : '%d mois',
  19302. y : 'un an',
  19303. yy : '%d ans'
  19304. },
  19305. ordinalParse: /\d{1,2}(er|e)/,
  19306. ordinal : function (number) {
  19307. return number + (number === 1 ? 'er' : 'e');
  19308. }
  19309. });
  19310. //! moment.js locale configuration
  19311. //! locale : french (fr)
  19312. //! author : John Fischer : https://github.com/jfroffice
  19313. var fr = _moment__default.defineLocale('fr', {
  19314. months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
  19315. monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
  19316. weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
  19317. weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
  19318. weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
  19319. longDateFormat : {
  19320. LT : 'HH:mm',
  19321. LTS : 'HH:mm:ss',
  19322. L : 'DD/MM/YYYY',
  19323. LL : 'D MMMM YYYY',
  19324. LLL : 'D MMMM YYYY HH:mm',
  19325. LLLL : 'dddd D MMMM YYYY HH:mm'
  19326. },
  19327. calendar : {
  19328. sameDay: '[Aujourd\'hui à] LT',
  19329. nextDay: '[Demain à] LT',
  19330. nextWeek: 'dddd [à] LT',
  19331. lastDay: '[Hier à] LT',
  19332. lastWeek: 'dddd [dernier à] LT',
  19333. sameElse: 'L'
  19334. },
  19335. relativeTime : {
  19336. future : 'dans %s',
  19337. past : 'il y a %s',
  19338. s : 'quelques secondes',
  19339. m : 'une minute',
  19340. mm : '%d minutes',
  19341. h : 'une heure',
  19342. hh : '%d heures',
  19343. d : 'un jour',
  19344. dd : '%d jours',
  19345. M : 'un mois',
  19346. MM : '%d mois',
  19347. y : 'un an',
  19348. yy : '%d ans'
  19349. },
  19350. ordinalParse: /\d{1,2}(er|)/,
  19351. ordinal : function (number) {
  19352. return number + (number === 1 ? 'er' : '');
  19353. },
  19354. week : {
  19355. dow : 1, // Monday is the first day of the week.
  19356. doy : 4 // The week that contains Jan 4th is the first week of the year.
  19357. }
  19358. });
  19359. //! moment.js locale configuration
  19360. //! locale : frisian (fy)
  19361. //! author : Robin van der Vliet : https://github.com/robin0van0der0v
  19362. var fy__monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'),
  19363. fy__monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_');
  19364. var fy = _moment__default.defineLocale('fy', {
  19365. months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'),
  19366. monthsShort : function (m, format) {
  19367. if (/-MMM-/.test(format)) {
  19368. return fy__monthsShortWithoutDots[m.month()];
  19369. } else {
  19370. return fy__monthsShortWithDots[m.month()];
  19371. }
  19372. },
  19373. weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'),
  19374. weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'),
  19375. weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'),
  19376. longDateFormat : {
  19377. LT : 'HH:mm',
  19378. LTS : 'HH:mm:ss',
  19379. L : 'DD-MM-YYYY',
  19380. LL : 'D MMMM YYYY',
  19381. LLL : 'D MMMM YYYY HH:mm',
  19382. LLLL : 'dddd D MMMM YYYY HH:mm'
  19383. },
  19384. calendar : {
  19385. sameDay: '[hjoed om] LT',
  19386. nextDay: '[moarn om] LT',
  19387. nextWeek: 'dddd [om] LT',
  19388. lastDay: '[juster om] LT',
  19389. lastWeek: '[ôfrûne] dddd [om] LT',
  19390. sameElse: 'L'
  19391. },
  19392. relativeTime : {
  19393. future : 'oer %s',
  19394. past : '%s lyn',
  19395. s : 'in pear sekonden',
  19396. m : 'ien minút',
  19397. mm : '%d minuten',
  19398. h : 'ien oere',
  19399. hh : '%d oeren',
  19400. d : 'ien dei',
  19401. dd : '%d dagen',
  19402. M : 'ien moanne',
  19403. MM : '%d moannen',
  19404. y : 'ien jier',
  19405. yy : '%d jierren'
  19406. },
  19407. ordinalParse: /\d{1,2}(ste|de)/,
  19408. ordinal : function (number) {
  19409. return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de');
  19410. },
  19411. week : {
  19412. dow : 1, // Monday is the first day of the week.
  19413. doy : 4 // The week that contains Jan 4th is the first week of the year.
  19414. }
  19415. });
  19416. //! moment.js locale configuration
  19417. //! locale : galician (gl)
  19418. //! author : Juan G. Hurtado : https://github.com/juanghurtado
  19419. var gl = _moment__default.defineLocale('gl', {
  19420. months : 'Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro'.split('_'),
  19421. monthsShort : 'Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.'.split('_'),
  19422. weekdays : 'Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado'.split('_'),
  19423. weekdaysShort : 'Dom._Lun._Mar._Mér._Xov._Ven._Sáb.'.split('_'),
  19424. weekdaysMin : 'Do_Lu_Ma_Mé_Xo_Ve_Sá'.split('_'),
  19425. longDateFormat : {
  19426. LT : 'H:mm',
  19427. LTS : 'H:mm:ss',
  19428. L : 'DD/MM/YYYY',
  19429. LL : 'D MMMM YYYY',
  19430. LLL : 'D MMMM YYYY H:mm',
  19431. LLLL : 'dddd D MMMM YYYY H:mm'
  19432. },
  19433. calendar : {
  19434. sameDay : function () {
  19435. return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT';
  19436. },
  19437. nextDay : function () {
  19438. return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT';
  19439. },
  19440. nextWeek : function () {
  19441. return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT';
  19442. },
  19443. lastDay : function () {
  19444. return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT';
  19445. },
  19446. lastWeek : function () {
  19447. return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT';
  19448. },
  19449. sameElse : 'L'
  19450. },
  19451. relativeTime : {
  19452. future : function (str) {
  19453. if (str === 'uns segundos') {
  19454. return 'nuns segundos';
  19455. }
  19456. return 'en ' + str;
  19457. },
  19458. past : 'hai %s',
  19459. s : 'uns segundos',
  19460. m : 'un minuto',
  19461. mm : '%d minutos',
  19462. h : 'unha hora',
  19463. hh : '%d horas',
  19464. d : 'un día',
  19465. dd : '%d días',
  19466. M : 'un mes',
  19467. MM : '%d meses',
  19468. y : 'un ano',
  19469. yy : '%d anos'
  19470. },
  19471. ordinalParse : /\d{1,2}º/,
  19472. ordinal : '%dº',
  19473. week : {
  19474. dow : 1, // Monday is the first day of the week.
  19475. doy : 7 // The week that contains Jan 1st is the first week of the year.
  19476. }
  19477. });
  19478. //! moment.js locale configuration
  19479. //! locale : Hebrew (he)
  19480. //! author : Tomer Cohen : https://github.com/tomer
  19481. //! author : Moshe Simantov : https://github.com/DevelopmentIL
  19482. //! author : Tal Ater : https://github.com/TalAter
  19483. var he = _moment__default.defineLocale('he', {
  19484. months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'),
  19485. monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'),
  19486. weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'),
  19487. weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'),
  19488. weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.split('_'),
  19489. longDateFormat : {
  19490. LT : 'HH:mm',
  19491. LTS : 'HH:mm:ss',
  19492. L : 'DD/MM/YYYY',
  19493. LL : 'D [ב]MMMM YYYY',
  19494. LLL : 'D [ב]MMMM YYYY HH:mm',
  19495. LLLL : 'dddd, D [ב]MMMM YYYY HH:mm',
  19496. l : 'D/M/YYYY',
  19497. ll : 'D MMM YYYY',
  19498. lll : 'D MMM YYYY HH:mm',
  19499. llll : 'ddd, D MMM YYYY HH:mm'
  19500. },
  19501. calendar : {
  19502. sameDay : '[היום ב־]LT',
  19503. nextDay : '[מחר ב־]LT',
  19504. nextWeek : 'dddd [בשעה] LT',
  19505. lastDay : '[אתמול ב־]LT',
  19506. lastWeek : '[ביום] dddd [האחרון בשעה] LT',
  19507. sameElse : 'L'
  19508. },
  19509. relativeTime : {
  19510. future : 'בעוד %s',
  19511. past : 'לפני %s',
  19512. s : 'מספר שניות',
  19513. m : 'דקה',
  19514. mm : '%d דקות',
  19515. h : 'שעה',
  19516. hh : function (number) {
  19517. if (number === 2) {
  19518. return 'שעתיים';
  19519. }
  19520. return number + ' שעות';
  19521. },
  19522. d : 'יום',
  19523. dd : function (number) {
  19524. if (number === 2) {
  19525. return 'יומיים';
  19526. }
  19527. return number + ' ימים';
  19528. },
  19529. M : 'חודש',
  19530. MM : function (number) {
  19531. if (number === 2) {
  19532. return 'חודשיים';
  19533. }
  19534. return number + ' חודשים';
  19535. },
  19536. y : 'שנה',
  19537. yy : function (number) {
  19538. if (number === 2) {
  19539. return 'שנתיים';
  19540. } else if (number % 10 === 0 && number !== 10) {
  19541. return number + ' שנה';
  19542. }
  19543. return number + ' שנים';
  19544. }
  19545. }
  19546. });
  19547. //! moment.js locale configuration
  19548. //! locale : hindi (hi)
  19549. //! author : Mayank Singhal : https://github.com/mayanksinghal
  19550. var hi__symbolMap = {
  19551. '1': '१',
  19552. '2': '२',
  19553. '3': '३',
  19554. '4': '४',
  19555. '5': '५',
  19556. '6': '६',
  19557. '7': '७',
  19558. '8': '८',
  19559. '9': '९',
  19560. '0': '०'
  19561. },
  19562. hi__numberMap = {
  19563. '१': '1',
  19564. '२': '2',
  19565. '३': '3',
  19566. '४': '4',
  19567. '५': '5',
  19568. '६': '6',
  19569. '७': '7',
  19570. '८': '8',
  19571. '९': '9',
  19572. '०': '0'
  19573. };
  19574. var hi = _moment__default.defineLocale('hi', {
  19575. months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'),
  19576. monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'),
  19577. weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
  19578. weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'),
  19579. weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),
  19580. longDateFormat : {
  19581. LT : 'A h:mm बजे',
  19582. LTS : 'A h:mm:ss बजे',
  19583. L : 'DD/MM/YYYY',
  19584. LL : 'D MMMM YYYY',
  19585. LLL : 'D MMMM YYYY, A h:mm बजे',
  19586. LLLL : 'dddd, D MMMM YYYY, A h:mm बजे'
  19587. },
  19588. calendar : {
  19589. sameDay : '[आज] LT',
  19590. nextDay : '[कल] LT',
  19591. nextWeek : 'dddd, LT',
  19592. lastDay : '[कल] LT',
  19593. lastWeek : '[पिछले] dddd, LT',
  19594. sameElse : 'L'
  19595. },
  19596. relativeTime : {
  19597. future : '%s में',
  19598. past : '%s पहले',
  19599. s : 'कुछ ही क्षण',
  19600. m : 'एक मिनट',
  19601. mm : '%d मिनट',
  19602. h : 'एक घंटा',
  19603. hh : '%d घंटे',
  19604. d : 'एक दिन',
  19605. dd : '%d दिन',
  19606. M : 'एक महीने',
  19607. MM : '%d महीने',
  19608. y : 'एक वर्ष',
  19609. yy : '%d वर्ष'
  19610. },
  19611. preparse: function (string) {
  19612. return string.replace(/[१२३४५६७८९०]/g, function (match) {
  19613. return hi__numberMap[match];
  19614. });
  19615. },
  19616. postformat: function (string) {
  19617. return string.replace(/\d/g, function (match) {
  19618. return hi__symbolMap[match];
  19619. });
  19620. },
  19621. // Hindi notation for meridiems are quite fuzzy in practice. While there exists
  19622. // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
  19623. meridiemParse: /रात|सुबह|दोपहर|शाम/,
  19624. meridiemHour : function (hour, meridiem) {
  19625. if (hour === 12) {
  19626. hour = 0;
  19627. }
  19628. if (meridiem === 'रात') {
  19629. return hour < 4 ? hour : hour + 12;
  19630. } else if (meridiem === 'सुबह') {
  19631. return hour;
  19632. } else if (meridiem === 'दोपहर') {
  19633. return hour >= 10 ? hour : hour + 12;
  19634. } else if (meridiem === 'शाम') {
  19635. return hour + 12;
  19636. }
  19637. },
  19638. meridiem : function (hour, minute, isLower) {
  19639. if (hour < 4) {
  19640. return 'रात';
  19641. } else if (hour < 10) {
  19642. return 'सुबह';
  19643. } else if (hour < 17) {
  19644. return 'दोपहर';
  19645. } else if (hour < 20) {
  19646. return 'शाम';
  19647. } else {
  19648. return 'रात';
  19649. }
  19650. },
  19651. week : {
  19652. dow : 0, // Sunday is the first day of the week.
  19653. doy : 6 // The week that contains Jan 1st is the first week of the year.
  19654. }
  19655. });
  19656. //! moment.js locale configuration
  19657. //! locale : hrvatski (hr)
  19658. //! author : Bojan Marković : https://github.com/bmarkovic
  19659. function hr__translate(number, withoutSuffix, key) {
  19660. var result = number + ' ';
  19661. switch (key) {
  19662. case 'm':
  19663. return withoutSuffix ? 'jedna minuta' : 'jedne minute';
  19664. case 'mm':
  19665. if (number === 1) {
  19666. result += 'minuta';
  19667. } else if (number === 2 || number === 3 || number === 4) {
  19668. result += 'minute';
  19669. } else {
  19670. result += 'minuta';
  19671. }
  19672. return result;
  19673. case 'h':
  19674. return withoutSuffix ? 'jedan sat' : 'jednog sata';
  19675. case 'hh':
  19676. if (number === 1) {
  19677. result += 'sat';
  19678. } else if (number === 2 || number === 3 || number === 4) {
  19679. result += 'sata';
  19680. } else {
  19681. result += 'sati';
  19682. }
  19683. return result;
  19684. case 'dd':
  19685. if (number === 1) {
  19686. result += 'dan';
  19687. } else {
  19688. result += 'dana';
  19689. }
  19690. return result;
  19691. case 'MM':
  19692. if (number === 1) {
  19693. result += 'mjesec';
  19694. } else if (number === 2 || number === 3 || number === 4) {
  19695. result += 'mjeseca';
  19696. } else {
  19697. result += 'mjeseci';
  19698. }
  19699. return result;
  19700. case 'yy':
  19701. if (number === 1) {
  19702. result += 'godina';
  19703. } else if (number === 2 || number === 3 || number === 4) {
  19704. result += 'godine';
  19705. } else {
  19706. result += 'godina';
  19707. }
  19708. return result;
  19709. }
  19710. }
  19711. var hr = _moment__default.defineLocale('hr', {
  19712. months : 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_'),
  19713. monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'),
  19714. weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
  19715. weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  19716. weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'),
  19717. longDateFormat : {
  19718. LT : 'H:mm',
  19719. LTS : 'H:mm:ss',
  19720. L : 'DD. MM. YYYY',
  19721. LL : 'D. MMMM YYYY',
  19722. LLL : 'D. MMMM YYYY H:mm',
  19723. LLLL : 'dddd, D. MMMM YYYY H:mm'
  19724. },
  19725. calendar : {
  19726. sameDay : '[danas u] LT',
  19727. nextDay : '[sutra u] LT',
  19728. nextWeek : function () {
  19729. switch (this.day()) {
  19730. case 0:
  19731. return '[u] [nedjelju] [u] LT';
  19732. case 3:
  19733. return '[u] [srijedu] [u] LT';
  19734. case 6:
  19735. return '[u] [subotu] [u] LT';
  19736. case 1:
  19737. case 2:
  19738. case 4:
  19739. case 5:
  19740. return '[u] dddd [u] LT';
  19741. }
  19742. },
  19743. lastDay : '[jučer u] LT',
  19744. lastWeek : function () {
  19745. switch (this.day()) {
  19746. case 0:
  19747. case 3:
  19748. return '[prošlu] dddd [u] LT';
  19749. case 6:
  19750. return '[prošle] [subote] [u] LT';
  19751. case 1:
  19752. case 2:
  19753. case 4:
  19754. case 5:
  19755. return '[prošli] dddd [u] LT';
  19756. }
  19757. },
  19758. sameElse : 'L'
  19759. },
  19760. relativeTime : {
  19761. future : 'za %s',
  19762. past : 'prije %s',
  19763. s : 'par sekundi',
  19764. m : hr__translate,
  19765. mm : hr__translate,
  19766. h : hr__translate,
  19767. hh : hr__translate,
  19768. d : 'dan',
  19769. dd : hr__translate,
  19770. M : 'mjesec',
  19771. MM : hr__translate,
  19772. y : 'godinu',
  19773. yy : hr__translate
  19774. },
  19775. ordinalParse: /\d{1,2}\./,
  19776. ordinal : '%d.',
  19777. week : {
  19778. dow : 1, // Monday is the first day of the week.
  19779. doy : 7 // The week that contains Jan 1st is the first week of the year.
  19780. }
  19781. });
  19782. //! moment.js locale configuration
  19783. //! locale : hungarian (hu)
  19784. //! author : Adam Brunner : https://github.com/adambrunner
  19785. var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
  19786. function hu__translate(number, withoutSuffix, key, isFuture) {
  19787. var num = number,
  19788. suffix;
  19789. switch (key) {
  19790. case 's':
  19791. return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce';
  19792. case 'm':
  19793. return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce');
  19794. case 'mm':
  19795. return num + (isFuture || withoutSuffix ? ' perc' : ' perce');
  19796. case 'h':
  19797. return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája');
  19798. case 'hh':
  19799. return num + (isFuture || withoutSuffix ? ' óra' : ' órája');
  19800. case 'd':
  19801. return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja');
  19802. case 'dd':
  19803. return num + (isFuture || withoutSuffix ? ' nap' : ' napja');
  19804. case 'M':
  19805. return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
  19806. case 'MM':
  19807. return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
  19808. case 'y':
  19809. return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve');
  19810. case 'yy':
  19811. return num + (isFuture || withoutSuffix ? ' év' : ' éve');
  19812. }
  19813. return '';
  19814. }
  19815. function week(isFuture) {
  19816. return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]';
  19817. }
  19818. var hu = _moment__default.defineLocale('hu', {
  19819. months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'),
  19820. monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'),
  19821. weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'),
  19822. weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'),
  19823. weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'),
  19824. longDateFormat : {
  19825. LT : 'H:mm',
  19826. LTS : 'H:mm:ss',
  19827. L : 'YYYY.MM.DD.',
  19828. LL : 'YYYY. MMMM D.',
  19829. LLL : 'YYYY. MMMM D. H:mm',
  19830. LLLL : 'YYYY. MMMM D., dddd H:mm'
  19831. },
  19832. meridiemParse: /de|du/i,
  19833. isPM: function (input) {
  19834. return input.charAt(1).toLowerCase() === 'u';
  19835. },
  19836. meridiem : function (hours, minutes, isLower) {
  19837. if (hours < 12) {
  19838. return isLower === true ? 'de' : 'DE';
  19839. } else {
  19840. return isLower === true ? 'du' : 'DU';
  19841. }
  19842. },
  19843. calendar : {
  19844. sameDay : '[ma] LT[-kor]',
  19845. nextDay : '[holnap] LT[-kor]',
  19846. nextWeek : function () {
  19847. return week.call(this, true);
  19848. },
  19849. lastDay : '[tegnap] LT[-kor]',
  19850. lastWeek : function () {
  19851. return week.call(this, false);
  19852. },
  19853. sameElse : 'L'
  19854. },
  19855. relativeTime : {
  19856. future : '%s múlva',
  19857. past : '%s',
  19858. s : hu__translate,
  19859. m : hu__translate,
  19860. mm : hu__translate,
  19861. h : hu__translate,
  19862. hh : hu__translate,
  19863. d : hu__translate,
  19864. dd : hu__translate,
  19865. M : hu__translate,
  19866. MM : hu__translate,
  19867. y : hu__translate,
  19868. yy : hu__translate
  19869. },
  19870. ordinalParse: /\d{1,2}\./,
  19871. ordinal : '%d.',
  19872. week : {
  19873. dow : 1, // Monday is the first day of the week.
  19874. doy : 7 // The week that contains Jan 1st is the first week of the year.
  19875. }
  19876. });
  19877. //! moment.js locale configuration
  19878. //! locale : Armenian (hy-am)
  19879. //! author : Armendarabyan : https://github.com/armendarabyan
  19880. function hy_am__monthsCaseReplace(m, format) {
  19881. var months = {
  19882. 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'),
  19883. 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_')
  19884. },
  19885. nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
  19886. 'accusative' :
  19887. 'nominative';
  19888. return months[nounCase][m.month()];
  19889. }
  19890. function hy_am__monthsShortCaseReplace(m, format) {
  19891. var monthsShort = 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_');
  19892. return monthsShort[m.month()];
  19893. }
  19894. function hy_am__weekdaysCaseReplace(m, format) {
  19895. var weekdays = 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_');
  19896. return weekdays[m.day()];
  19897. }
  19898. var hy_am = _moment__default.defineLocale('hy-am', {
  19899. months : hy_am__monthsCaseReplace,
  19900. monthsShort : hy_am__monthsShortCaseReplace,
  19901. weekdays : hy_am__weekdaysCaseReplace,
  19902. weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
  19903. weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
  19904. longDateFormat : {
  19905. LT : 'HH:mm',
  19906. LTS : 'HH:mm:ss',
  19907. L : 'DD.MM.YYYY',
  19908. LL : 'D MMMM YYYY թ.',
  19909. LLL : 'D MMMM YYYY թ., HH:mm',
  19910. LLLL : 'dddd, D MMMM YYYY թ., HH:mm'
  19911. },
  19912. calendar : {
  19913. sameDay: '[այսօր] LT',
  19914. nextDay: '[վաղը] LT',
  19915. lastDay: '[երեկ] LT',
  19916. nextWeek: function () {
  19917. return 'dddd [օրը ժամը] LT';
  19918. },
  19919. lastWeek: function () {
  19920. return '[անցած] dddd [օրը ժամը] LT';
  19921. },
  19922. sameElse: 'L'
  19923. },
  19924. relativeTime : {
  19925. future : '%s հետո',
  19926. past : '%s առաջ',
  19927. s : 'մի քանի վայրկյան',
  19928. m : 'րոպե',
  19929. mm : '%d րոպե',
  19930. h : 'ժամ',
  19931. hh : '%d ժամ',
  19932. d : 'օր',
  19933. dd : '%d օր',
  19934. M : 'ամիս',
  19935. MM : '%d ամիս',
  19936. y : 'տարի',
  19937. yy : '%d տարի'
  19938. },
  19939. meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,
  19940. isPM: function (input) {
  19941. return /^(ցերեկվա|երեկոյան)$/.test(input);
  19942. },
  19943. meridiem : function (hour) {
  19944. if (hour < 4) {
  19945. return 'գիշերվա';
  19946. } else if (hour < 12) {
  19947. return 'առավոտվա';
  19948. } else if (hour < 17) {
  19949. return 'ցերեկվա';
  19950. } else {
  19951. return 'երեկոյան';
  19952. }
  19953. },
  19954. ordinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/,
  19955. ordinal: function (number, period) {
  19956. switch (period) {
  19957. case 'DDD':
  19958. case 'w':
  19959. case 'W':
  19960. case 'DDDo':
  19961. if (number === 1) {
  19962. return number + '-ին';
  19963. }
  19964. return number + '-րդ';
  19965. default:
  19966. return number;
  19967. }
  19968. },
  19969. week : {
  19970. dow : 1, // Monday is the first day of the week.
  19971. doy : 7 // The week that contains Jan 1st is the first week of the year.
  19972. }
  19973. });
  19974. //! moment.js locale configuration
  19975. //! locale : Bahasa Indonesia (id)
  19976. //! author : Mohammad Satrio Utomo : https://github.com/tyok
  19977. //! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan
  19978. var id = _moment__default.defineLocale('id', {
  19979. months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'),
  19980. monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'),
  19981. weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'),
  19982. weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'),
  19983. weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'),
  19984. longDateFormat : {
  19985. LT : 'HH.mm',
  19986. LTS : 'HH.mm.ss',
  19987. L : 'DD/MM/YYYY',
  19988. LL : 'D MMMM YYYY',
  19989. LLL : 'D MMMM YYYY [pukul] HH.mm',
  19990. LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
  19991. },
  19992. meridiemParse: /pagi|siang|sore|malam/,
  19993. meridiemHour : function (hour, meridiem) {
  19994. if (hour === 12) {
  19995. hour = 0;
  19996. }
  19997. if (meridiem === 'pagi') {
  19998. return hour;
  19999. } else if (meridiem === 'siang') {
  20000. return hour >= 11 ? hour : hour + 12;
  20001. } else if (meridiem === 'sore' || meridiem === 'malam') {
  20002. return hour + 12;
  20003. }
  20004. },
  20005. meridiem : function (hours, minutes, isLower) {
  20006. if (hours < 11) {
  20007. return 'pagi';
  20008. } else if (hours < 15) {
  20009. return 'siang';
  20010. } else if (hours < 19) {
  20011. return 'sore';
  20012. } else {
  20013. return 'malam';
  20014. }
  20015. },
  20016. calendar : {
  20017. sameDay : '[Hari ini pukul] LT',
  20018. nextDay : '[Besok pukul] LT',
  20019. nextWeek : 'dddd [pukul] LT',
  20020. lastDay : '[Kemarin pukul] LT',
  20021. lastWeek : 'dddd [lalu pukul] LT',
  20022. sameElse : 'L'
  20023. },
  20024. relativeTime : {
  20025. future : 'dalam %s',
  20026. past : '%s yang lalu',
  20027. s : 'beberapa detik',
  20028. m : 'semenit',
  20029. mm : '%d menit',
  20030. h : 'sejam',
  20031. hh : '%d jam',
  20032. d : 'sehari',
  20033. dd : '%d hari',
  20034. M : 'sebulan',
  20035. MM : '%d bulan',
  20036. y : 'setahun',
  20037. yy : '%d tahun'
  20038. },
  20039. week : {
  20040. dow : 1, // Monday is the first day of the week.
  20041. doy : 7 // The week that contains Jan 1st is the first week of the year.
  20042. }
  20043. });
  20044. //! moment.js locale configuration
  20045. //! locale : icelandic (is)
  20046. //! author : Hinrik Örn Sigurðsson : https://github.com/hinrik
  20047. function is__plural(n) {
  20048. if (n % 100 === 11) {
  20049. return true;
  20050. } else if (n % 10 === 1) {
  20051. return false;
  20052. }
  20053. return true;
  20054. }
  20055. function is__translate(number, withoutSuffix, key, isFuture) {
  20056. var result = number + ' ';
  20057. switch (key) {
  20058. case 's':
  20059. return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum';
  20060. case 'm':
  20061. return withoutSuffix ? 'mínúta' : 'mínútu';
  20062. case 'mm':
  20063. if (is__plural(number)) {
  20064. return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum');
  20065. } else if (withoutSuffix) {
  20066. return result + 'mínúta';
  20067. }
  20068. return result + 'mínútu';
  20069. case 'hh':
  20070. if (is__plural(number)) {
  20071. return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum');
  20072. }
  20073. return result + 'klukkustund';
  20074. case 'd':
  20075. if (withoutSuffix) {
  20076. return 'dagur';
  20077. }
  20078. return isFuture ? 'dag' : 'degi';
  20079. case 'dd':
  20080. if (is__plural(number)) {
  20081. if (withoutSuffix) {
  20082. return result + 'dagar';
  20083. }
  20084. return result + (isFuture ? 'daga' : 'dögum');
  20085. } else if (withoutSuffix) {
  20086. return result + 'dagur';
  20087. }
  20088. return result + (isFuture ? 'dag' : 'degi');
  20089. case 'M':
  20090. if (withoutSuffix) {
  20091. return 'mánuður';
  20092. }
  20093. return isFuture ? 'mánuð' : 'mánuði';
  20094. case 'MM':
  20095. if (is__plural(number)) {
  20096. if (withoutSuffix) {
  20097. return result + 'mánuðir';
  20098. }
  20099. return result + (isFuture ? 'mánuði' : 'mánuðum');
  20100. } else if (withoutSuffix) {
  20101. return result + 'mánuður';
  20102. }
  20103. return result + (isFuture ? 'mánuð' : 'mánuði');
  20104. case 'y':
  20105. return withoutSuffix || isFuture ? 'ár' : 'ári';
  20106. case 'yy':
  20107. if (is__plural(number)) {
  20108. return result + (withoutSuffix || isFuture ? 'ár' : 'árum');
  20109. }
  20110. return result + (withoutSuffix || isFuture ? 'ár' : 'ári');
  20111. }
  20112. }
  20113. var is = _moment__default.defineLocale('is', {
  20114. months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'),
  20115. monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
  20116. weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'),
  20117. weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
  20118. weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
  20119. longDateFormat : {
  20120. LT : 'H:mm',
  20121. LTS : 'H:mm:ss',
  20122. L : 'DD/MM/YYYY',
  20123. LL : 'D. MMMM YYYY',
  20124. LLL : 'D. MMMM YYYY [kl.] H:mm',
  20125. LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm'
  20126. },
  20127. calendar : {
  20128. sameDay : '[í dag kl.] LT',
  20129. nextDay : '[á morgun kl.] LT',
  20130. nextWeek : 'dddd [kl.] LT',
  20131. lastDay : '[í gær kl.] LT',
  20132. lastWeek : '[síðasta] dddd [kl.] LT',
  20133. sameElse : 'L'
  20134. },
  20135. relativeTime : {
  20136. future : 'eftir %s',
  20137. past : 'fyrir %s síðan',
  20138. s : is__translate,
  20139. m : is__translate,
  20140. mm : is__translate,
  20141. h : 'klukkustund',
  20142. hh : is__translate,
  20143. d : is__translate,
  20144. dd : is__translate,
  20145. M : is__translate,
  20146. MM : is__translate,
  20147. y : is__translate,
  20148. yy : is__translate
  20149. },
  20150. ordinalParse: /\d{1,2}\./,
  20151. ordinal : '%d.',
  20152. week : {
  20153. dow : 1, // Monday is the first day of the week.
  20154. doy : 4 // The week that contains Jan 4th is the first week of the year.
  20155. }
  20156. });
  20157. //! moment.js locale configuration
  20158. //! locale : italian (it)
  20159. //! author : Lorenzo : https://github.com/aliem
  20160. //! author: Mattia Larentis: https://github.com/nostalgiaz
  20161. var it = _moment__default.defineLocale('it', {
  20162. months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'),
  20163. monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
  20164. weekdays : 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'),
  20165. weekdaysShort : 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'),
  20166. weekdaysMin : 'D_L_Ma_Me_G_V_S'.split('_'),
  20167. longDateFormat : {
  20168. LT : 'HH:mm',
  20169. LTS : 'HH:mm:ss',
  20170. L : 'DD/MM/YYYY',
  20171. LL : 'D MMMM YYYY',
  20172. LLL : 'D MMMM YYYY HH:mm',
  20173. LLLL : 'dddd, D MMMM YYYY HH:mm'
  20174. },
  20175. calendar : {
  20176. sameDay: '[Oggi alle] LT',
  20177. nextDay: '[Domani alle] LT',
  20178. nextWeek: 'dddd [alle] LT',
  20179. lastDay: '[Ieri alle] LT',
  20180. lastWeek: function () {
  20181. switch (this.day()) {
  20182. case 0:
  20183. return '[la scorsa] dddd [alle] LT';
  20184. default:
  20185. return '[lo scorso] dddd [alle] LT';
  20186. }
  20187. },
  20188. sameElse: 'L'
  20189. },
  20190. relativeTime : {
  20191. future : function (s) {
  20192. return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s;
  20193. },
  20194. past : '%s fa',
  20195. s : 'alcuni secondi',
  20196. m : 'un minuto',
  20197. mm : '%d minuti',
  20198. h : 'un\'ora',
  20199. hh : '%d ore',
  20200. d : 'un giorno',
  20201. dd : '%d giorni',
  20202. M : 'un mese',
  20203. MM : '%d mesi',
  20204. y : 'un anno',
  20205. yy : '%d anni'
  20206. },
  20207. ordinalParse : /\d{1,2}º/,
  20208. ordinal: '%dº',
  20209. week : {
  20210. dow : 1, // Monday is the first day of the week.
  20211. doy : 4 // The week that contains Jan 4th is the first week of the year.
  20212. }
  20213. });
  20214. //! moment.js locale configuration
  20215. //! locale : japanese (ja)
  20216. //! author : LI Long : https://github.com/baryon
  20217. var ja = _moment__default.defineLocale('ja', {
  20218. months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  20219. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  20220. weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'),
  20221. weekdaysShort : '日_月_火_水_木_金_土'.split('_'),
  20222. weekdaysMin : '日_月_火_水_木_金_土'.split('_'),
  20223. longDateFormat : {
  20224. LT : 'Ah時m分',
  20225. LTS : 'Ah時m分s秒',
  20226. L : 'YYYY/MM/DD',
  20227. LL : 'YYYY年M月D日',
  20228. LLL : 'YYYY年M月D日Ah時m分',
  20229. LLLL : 'YYYY年M月D日Ah時m分 dddd'
  20230. },
  20231. meridiemParse: /午前|午後/i,
  20232. isPM : function (input) {
  20233. return input === '午後';
  20234. },
  20235. meridiem : function (hour, minute, isLower) {
  20236. if (hour < 12) {
  20237. return '午前';
  20238. } else {
  20239. return '午後';
  20240. }
  20241. },
  20242. calendar : {
  20243. sameDay : '[今日] LT',
  20244. nextDay : '[明日] LT',
  20245. nextWeek : '[来週]dddd LT',
  20246. lastDay : '[昨日] LT',
  20247. lastWeek : '[前週]dddd LT',
  20248. sameElse : 'L'
  20249. },
  20250. relativeTime : {
  20251. future : '%s後',
  20252. past : '%s前',
  20253. s : '数秒',
  20254. m : '1分',
  20255. mm : '%d分',
  20256. h : '1時間',
  20257. hh : '%d時間',
  20258. d : '1日',
  20259. dd : '%d日',
  20260. M : '1ヶ月',
  20261. MM : '%dヶ月',
  20262. y : '1年',
  20263. yy : '%d年'
  20264. }
  20265. });
  20266. //! moment.js locale configuration
  20267. //! locale : Boso Jowo (jv)
  20268. //! author : Rony Lantip : https://github.com/lantip
  20269. //! reference: http://jv.wikipedia.org/wiki/Basa_Jawa
  20270. var jv = _moment__default.defineLocale('jv', {
  20271. months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'),
  20272. monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'),
  20273. weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'),
  20274. weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'),
  20275. weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'),
  20276. longDateFormat : {
  20277. LT : 'HH.mm',
  20278. LTS : 'HH.mm.ss',
  20279. L : 'DD/MM/YYYY',
  20280. LL : 'D MMMM YYYY',
  20281. LLL : 'D MMMM YYYY [pukul] HH.mm',
  20282. LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
  20283. },
  20284. meridiemParse: /enjing|siyang|sonten|ndalu/,
  20285. meridiemHour : function (hour, meridiem) {
  20286. if (hour === 12) {
  20287. hour = 0;
  20288. }
  20289. if (meridiem === 'enjing') {
  20290. return hour;
  20291. } else if (meridiem === 'siyang') {
  20292. return hour >= 11 ? hour : hour + 12;
  20293. } else if (meridiem === 'sonten' || meridiem === 'ndalu') {
  20294. return hour + 12;
  20295. }
  20296. },
  20297. meridiem : function (hours, minutes, isLower) {
  20298. if (hours < 11) {
  20299. return 'enjing';
  20300. } else if (hours < 15) {
  20301. return 'siyang';
  20302. } else if (hours < 19) {
  20303. return 'sonten';
  20304. } else {
  20305. return 'ndalu';
  20306. }
  20307. },
  20308. calendar : {
  20309. sameDay : '[Dinten puniko pukul] LT',
  20310. nextDay : '[Mbenjang pukul] LT',
  20311. nextWeek : 'dddd [pukul] LT',
  20312. lastDay : '[Kala wingi pukul] LT',
  20313. lastWeek : 'dddd [kepengker pukul] LT',
  20314. sameElse : 'L'
  20315. },
  20316. relativeTime : {
  20317. future : 'wonten ing %s',
  20318. past : '%s ingkang kepengker',
  20319. s : 'sawetawis detik',
  20320. m : 'setunggal menit',
  20321. mm : '%d menit',
  20322. h : 'setunggal jam',
  20323. hh : '%d jam',
  20324. d : 'sedinten',
  20325. dd : '%d dinten',
  20326. M : 'sewulan',
  20327. MM : '%d wulan',
  20328. y : 'setaun',
  20329. yy : '%d taun'
  20330. },
  20331. week : {
  20332. dow : 1, // Monday is the first day of the week.
  20333. doy : 7 // The week that contains Jan 1st is the first week of the year.
  20334. }
  20335. });
  20336. //! moment.js locale configuration
  20337. //! locale : Georgian (ka)
  20338. //! author : Irakli Janiashvili : https://github.com/irakli-janiashvili
  20339. function ka__monthsCaseReplace(m, format) {
  20340. var months = {
  20341. 'nominative': 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'),
  20342. 'accusative': 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_')
  20343. },
  20344. nounCase = (/D[oD] *MMMM?/).test(format) ?
  20345. 'accusative' :
  20346. 'nominative';
  20347. return months[nounCase][m.month()];
  20348. }
  20349. function ka__weekdaysCaseReplace(m, format) {
  20350. var weekdays = {
  20351. 'nominative': 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'),
  20352. 'accusative': 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_')
  20353. },
  20354. nounCase = (/(წინა|შემდეგ)/).test(format) ?
  20355. 'accusative' :
  20356. 'nominative';
  20357. return weekdays[nounCase][m.day()];
  20358. }
  20359. var ka = _moment__default.defineLocale('ka', {
  20360. months : ka__monthsCaseReplace,
  20361. monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),
  20362. weekdays : ka__weekdaysCaseReplace,
  20363. weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),
  20364. weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),
  20365. longDateFormat : {
  20366. LT : 'h:mm A',
  20367. LTS : 'h:mm:ss A',
  20368. L : 'DD/MM/YYYY',
  20369. LL : 'D MMMM YYYY',
  20370. LLL : 'D MMMM YYYY h:mm A',
  20371. LLLL : 'dddd, D MMMM YYYY h:mm A'
  20372. },
  20373. calendar : {
  20374. sameDay : '[დღეს] LT[-ზე]',
  20375. nextDay : '[ხვალ] LT[-ზე]',
  20376. lastDay : '[გუშინ] LT[-ზე]',
  20377. nextWeek : '[შემდეგ] dddd LT[-ზე]',
  20378. lastWeek : '[წინა] dddd LT-ზე',
  20379. sameElse : 'L'
  20380. },
  20381. relativeTime : {
  20382. future : function (s) {
  20383. return (/(წამი|წუთი|საათი|წელი)/).test(s) ?
  20384. s.replace(/ი$/, 'ში') :
  20385. s + 'ში';
  20386. },
  20387. past : function (s) {
  20388. if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) {
  20389. return s.replace(/(ი|ე)$/, 'ის წინ');
  20390. }
  20391. if ((/წელი/).test(s)) {
  20392. return s.replace(/წელი$/, 'წლის წინ');
  20393. }
  20394. },
  20395. s : 'რამდენიმე წამი',
  20396. m : 'წუთი',
  20397. mm : '%d წუთი',
  20398. h : 'საათი',
  20399. hh : '%d საათი',
  20400. d : 'დღე',
  20401. dd : '%d დღე',
  20402. M : 'თვე',
  20403. MM : '%d თვე',
  20404. y : 'წელი',
  20405. yy : '%d წელი'
  20406. },
  20407. ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,
  20408. ordinal : function (number) {
  20409. if (number === 0) {
  20410. return number;
  20411. }
  20412. if (number === 1) {
  20413. return number + '-ლი';
  20414. }
  20415. if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) {
  20416. return 'მე-' + number;
  20417. }
  20418. return number + '-ე';
  20419. },
  20420. week : {
  20421. dow : 1,
  20422. doy : 7
  20423. }
  20424. });
  20425. //! moment.js locale configuration
  20426. //! locale : khmer (km)
  20427. //! author : Kruy Vanna : https://github.com/kruyvanna
  20428. var km = _moment__default.defineLocale('km', {
  20429. months: 'មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'),
  20430. monthsShort: 'មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'),
  20431. weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
  20432. weekdaysShort: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
  20433. weekdaysMin: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
  20434. longDateFormat: {
  20435. LT: 'HH:mm',
  20436. LTS : 'HH:mm:ss',
  20437. L: 'DD/MM/YYYY',
  20438. LL: 'D MMMM YYYY',
  20439. LLL: 'D MMMM YYYY HH:mm',
  20440. LLLL: 'dddd, D MMMM YYYY HH:mm'
  20441. },
  20442. calendar: {
  20443. sameDay: '[ថ្ងៃនៈ ម៉ោង] LT',
  20444. nextDay: '[ស្អែក ម៉ោង] LT',
  20445. nextWeek: 'dddd [ម៉ោង] LT',
  20446. lastDay: '[ម្សិលមិញ ម៉ោង] LT',
  20447. lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
  20448. sameElse: 'L'
  20449. },
  20450. relativeTime: {
  20451. future: '%sទៀត',
  20452. past: '%sមុន',
  20453. s: 'ប៉ុន្មានវិនាទី',
  20454. m: 'មួយនាទី',
  20455. mm: '%d នាទី',
  20456. h: 'មួយម៉ោង',
  20457. hh: '%d ម៉ោង',
  20458. d: 'មួយថ្ងៃ',
  20459. dd: '%d ថ្ងៃ',
  20460. M: 'មួយខែ',
  20461. MM: '%d ខែ',
  20462. y: 'មួយឆ្នាំ',
  20463. yy: '%d ឆ្នាំ'
  20464. },
  20465. week: {
  20466. dow: 1, // Monday is the first day of the week.
  20467. doy: 4 // The week that contains Jan 4th is the first week of the year.
  20468. }
  20469. });
  20470. //! moment.js locale configuration
  20471. //! locale : korean (ko)
  20472. //!
  20473. //! authors
  20474. //!
  20475. //! - Kyungwook, Park : https://github.com/kyungw00k
  20476. //! - Jeeeyul Lee <jeeeyul@gmail.com>
  20477. var ko = _moment__default.defineLocale('ko', {
  20478. months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
  20479. monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
  20480. weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'),
  20481. weekdaysShort : '일_월_화_수_목_금_토'.split('_'),
  20482. weekdaysMin : '일_월_화_수_목_금_토'.split('_'),
  20483. longDateFormat : {
  20484. LT : 'A h시 m분',
  20485. LTS : 'A h시 m분 s초',
  20486. L : 'YYYY.MM.DD',
  20487. LL : 'YYYY년 MMMM D일',
  20488. LLL : 'YYYY년 MMMM D일 A h시 m분',
  20489. LLLL : 'YYYY년 MMMM D일 dddd A h시 m분'
  20490. },
  20491. calendar : {
  20492. sameDay : '오늘 LT',
  20493. nextDay : '내일 LT',
  20494. nextWeek : 'dddd LT',
  20495. lastDay : '어제 LT',
  20496. lastWeek : '지난주 dddd LT',
  20497. sameElse : 'L'
  20498. },
  20499. relativeTime : {
  20500. future : '%s 후',
  20501. past : '%s 전',
  20502. s : '몇초',
  20503. ss : '%d초',
  20504. m : '일분',
  20505. mm : '%d분',
  20506. h : '한시간',
  20507. hh : '%d시간',
  20508. d : '하루',
  20509. dd : '%d일',
  20510. M : '한달',
  20511. MM : '%d달',
  20512. y : '일년',
  20513. yy : '%d년'
  20514. },
  20515. ordinalParse : /\d{1,2}일/,
  20516. ordinal : '%d일',
  20517. meridiemParse : /오전|오후/,
  20518. isPM : function (token) {
  20519. return token === '오후';
  20520. },
  20521. meridiem : function (hour, minute, isUpper) {
  20522. return hour < 12 ? '오전' : '오후';
  20523. }
  20524. });
  20525. //! moment.js locale configuration
  20526. //! locale : Luxembourgish (lb)
  20527. //! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz
  20528. function lb__processRelativeTime(number, withoutSuffix, key, isFuture) {
  20529. var format = {
  20530. 'm': ['eng Minutt', 'enger Minutt'],
  20531. 'h': ['eng Stonn', 'enger Stonn'],
  20532. 'd': ['een Dag', 'engem Dag'],
  20533. 'M': ['ee Mount', 'engem Mount'],
  20534. 'y': ['ee Joer', 'engem Joer']
  20535. };
  20536. return withoutSuffix ? format[key][0] : format[key][1];
  20537. }
  20538. function processFutureTime(string) {
  20539. var number = string.substr(0, string.indexOf(' '));
  20540. if (eifelerRegelAppliesToNumber(number)) {
  20541. return 'a ' + string;
  20542. }
  20543. return 'an ' + string;
  20544. }
  20545. function processPastTime(string) {
  20546. var number = string.substr(0, string.indexOf(' '));
  20547. if (eifelerRegelAppliesToNumber(number)) {
  20548. return 'viru ' + string;
  20549. }
  20550. return 'virun ' + string;
  20551. }
  20552. /**
  20553. * Returns true if the word before the given number loses the '-n' ending.
  20554. * e.g. 'an 10 Deeg' but 'a 5 Deeg'
  20555. *
  20556. * @param number {integer}
  20557. * @returns {boolean}
  20558. */
  20559. function eifelerRegelAppliesToNumber(number) {
  20560. number = parseInt(number, 10);
  20561. if (isNaN(number)) {
  20562. return false;
  20563. }
  20564. if (number < 0) {
  20565. // Negative Number --> always true
  20566. return true;
  20567. } else if (number < 10) {
  20568. // Only 1 digit
  20569. if (4 <= number && number <= 7) {
  20570. return true;
  20571. }
  20572. return false;
  20573. } else if (number < 100) {
  20574. // 2 digits
  20575. var lastDigit = number % 10, firstDigit = number / 10;
  20576. if (lastDigit === 0) {
  20577. return eifelerRegelAppliesToNumber(firstDigit);
  20578. }
  20579. return eifelerRegelAppliesToNumber(lastDigit);
  20580. } else if (number < 10000) {
  20581. // 3 or 4 digits --> recursively check first digit
  20582. while (number >= 10) {
  20583. number = number / 10;
  20584. }
  20585. return eifelerRegelAppliesToNumber(number);
  20586. } else {
  20587. // Anything larger than 4 digits: recursively check first n-3 digits
  20588. number = number / 1000;
  20589. return eifelerRegelAppliesToNumber(number);
  20590. }
  20591. }
  20592. var lb = _moment__default.defineLocale('lb', {
  20593. months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
  20594. monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
  20595. weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'),
  20596. weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
  20597. weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
  20598. longDateFormat: {
  20599. LT: 'H:mm [Auer]',
  20600. LTS: 'H:mm:ss [Auer]',
  20601. L: 'DD.MM.YYYY',
  20602. LL: 'D. MMMM YYYY',
  20603. LLL: 'D. MMMM YYYY H:mm [Auer]',
  20604. LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]'
  20605. },
  20606. calendar: {
  20607. sameDay: '[Haut um] LT',
  20608. sameElse: 'L',
  20609. nextDay: '[Muer um] LT',
  20610. nextWeek: 'dddd [um] LT',
  20611. lastDay: '[Gëschter um] LT',
  20612. lastWeek: function () {
  20613. // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
  20614. switch (this.day()) {
  20615. case 2:
  20616. case 4:
  20617. return '[Leschten] dddd [um] LT';
  20618. default:
  20619. return '[Leschte] dddd [um] LT';
  20620. }
  20621. }
  20622. },
  20623. relativeTime : {
  20624. future : processFutureTime,
  20625. past : processPastTime,
  20626. s : 'e puer Sekonnen',
  20627. m : lb__processRelativeTime,
  20628. mm : '%d Minutten',
  20629. h : lb__processRelativeTime,
  20630. hh : '%d Stonnen',
  20631. d : lb__processRelativeTime,
  20632. dd : '%d Deeg',
  20633. M : lb__processRelativeTime,
  20634. MM : '%d Méint',
  20635. y : lb__processRelativeTime,
  20636. yy : '%d Joer'
  20637. },
  20638. ordinalParse: /\d{1,2}\./,
  20639. ordinal: '%d.',
  20640. week: {
  20641. dow: 1, // Monday is the first day of the week.
  20642. doy: 4 // The week that contains Jan 4th is the first week of the year.
  20643. }
  20644. });
  20645. //! moment.js locale configuration
  20646. //! locale : Lithuanian (lt)
  20647. //! author : Mindaugas Mozūras : https://github.com/mmozuras
  20648. var lt__units = {
  20649. 'm' : 'minutė_minutės_minutę',
  20650. 'mm': 'minutės_minučių_minutes',
  20651. 'h' : 'valanda_valandos_valandą',
  20652. 'hh': 'valandos_valandų_valandas',
  20653. 'd' : 'diena_dienos_dieną',
  20654. 'dd': 'dienos_dienų_dienas',
  20655. 'M' : 'mėnuo_mėnesio_mėnesį',
  20656. 'MM': 'mėnesiai_mėnesių_mėnesius',
  20657. 'y' : 'metai_metų_metus',
  20658. 'yy': 'metai_metų_metus'
  20659. },
  20660. weekDays = 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_');
  20661. function translateSeconds(number, withoutSuffix, key, isFuture) {
  20662. if (withoutSuffix) {
  20663. return 'kelios sekundės';
  20664. } else {
  20665. return isFuture ? 'kelių sekundžių' : 'kelias sekundes';
  20666. }
  20667. }
  20668. function lt__monthsCaseReplace(m, format) {
  20669. var months = {
  20670. 'nominative': 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'),
  20671. 'accusative': 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_')
  20672. },
  20673. nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
  20674. 'accusative' :
  20675. 'nominative';
  20676. return months[nounCase][m.month()];
  20677. }
  20678. function translateSingular(number, withoutSuffix, key, isFuture) {
  20679. return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]);
  20680. }
  20681. function special(number) {
  20682. return number % 10 === 0 || (number > 10 && number < 20);
  20683. }
  20684. function forms(key) {
  20685. return lt__units[key].split('_');
  20686. }
  20687. function lt__translate(number, withoutSuffix, key, isFuture) {
  20688. var result = number + ' ';
  20689. if (number === 1) {
  20690. return result + translateSingular(number, withoutSuffix, key[0], isFuture);
  20691. } else if (withoutSuffix) {
  20692. return result + (special(number) ? forms(key)[1] : forms(key)[0]);
  20693. } else {
  20694. if (isFuture) {
  20695. return result + forms(key)[1];
  20696. } else {
  20697. return result + (special(number) ? forms(key)[1] : forms(key)[2]);
  20698. }
  20699. }
  20700. }
  20701. function relativeWeekDay(moment, format) {
  20702. var nominative = format.indexOf('dddd HH:mm') === -1,
  20703. weekDay = weekDays[moment.day()];
  20704. return nominative ? weekDay : weekDay.substring(0, weekDay.length - 2) + 'į';
  20705. }
  20706. var lt = _moment__default.defineLocale('lt', {
  20707. months : lt__monthsCaseReplace,
  20708. monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),
  20709. weekdays : relativeWeekDay,
  20710. weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'),
  20711. weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'),
  20712. longDateFormat : {
  20713. LT : 'HH:mm',
  20714. LTS : 'HH:mm:ss',
  20715. L : 'YYYY-MM-DD',
  20716. LL : 'YYYY [m.] MMMM D [d.]',
  20717. LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
  20718. LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',
  20719. l : 'YYYY-MM-DD',
  20720. ll : 'YYYY [m.] MMMM D [d.]',
  20721. lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
  20722. llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]'
  20723. },
  20724. calendar : {
  20725. sameDay : '[Šiandien] LT',
  20726. nextDay : '[Rytoj] LT',
  20727. nextWeek : 'dddd LT',
  20728. lastDay : '[Vakar] LT',
  20729. lastWeek : '[Praėjusį] dddd LT',
  20730. sameElse : 'L'
  20731. },
  20732. relativeTime : {
  20733. future : 'po %s',
  20734. past : 'prieš %s',
  20735. s : translateSeconds,
  20736. m : translateSingular,
  20737. mm : lt__translate,
  20738. h : translateSingular,
  20739. hh : lt__translate,
  20740. d : translateSingular,
  20741. dd : lt__translate,
  20742. M : translateSingular,
  20743. MM : lt__translate,
  20744. y : translateSingular,
  20745. yy : lt__translate
  20746. },
  20747. ordinalParse: /\d{1,2}-oji/,
  20748. ordinal : function (number) {
  20749. return number + '-oji';
  20750. },
  20751. week : {
  20752. dow : 1, // Monday is the first day of the week.
  20753. doy : 4 // The week that contains Jan 4th is the first week of the year.
  20754. }
  20755. });
  20756. //! moment.js locale configuration
  20757. //! locale : latvian (lv)
  20758. //! author : Kristaps Karlsons : https://github.com/skakri
  20759. //! author : Jānis Elmeris : https://github.com/JanisE
  20760. var lv__units = {
  20761. 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'),
  20762. 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'),
  20763. 'h': 'stundas_stundām_stunda_stundas'.split('_'),
  20764. 'hh': 'stundas_stundām_stunda_stundas'.split('_'),
  20765. 'd': 'dienas_dienām_diena_dienas'.split('_'),
  20766. 'dd': 'dienas_dienām_diena_dienas'.split('_'),
  20767. 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
  20768. 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
  20769. 'y': 'gada_gadiem_gads_gadi'.split('_'),
  20770. 'yy': 'gada_gadiem_gads_gadi'.split('_')
  20771. };
  20772. /**
  20773. * @param withoutSuffix boolean true = a length of time; false = before/after a period of time.
  20774. */
  20775. function lv__format(forms, number, withoutSuffix) {
  20776. if (withoutSuffix) {
  20777. // E.g. "21 minūte", "3 minūtes".
  20778. return number % 10 === 1 && number !== 11 ? forms[2] : forms[3];
  20779. } else {
  20780. // E.g. "21 minūtes" as in "pēc 21 minūtes".
  20781. // E.g. "3 minūtēm" as in "pēc 3 minūtēm".
  20782. return number % 10 === 1 && number !== 11 ? forms[0] : forms[1];
  20783. }
  20784. }
  20785. function lv__relativeTimeWithPlural(number, withoutSuffix, key) {
  20786. return number + ' ' + lv__format(lv__units[key], number, withoutSuffix);
  20787. }
  20788. function relativeTimeWithSingular(number, withoutSuffix, key) {
  20789. return lv__format(lv__units[key], number, withoutSuffix);
  20790. }
  20791. function relativeSeconds(number, withoutSuffix) {
  20792. return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm';
  20793. }
  20794. var lv = _moment__default.defineLocale('lv', {
  20795. months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'),
  20796. monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'),
  20797. weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'),
  20798. weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'),
  20799. weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'),
  20800. longDateFormat : {
  20801. LT : 'HH:mm',
  20802. LTS : 'HH:mm:ss',
  20803. L : 'DD.MM.YYYY.',
  20804. LL : 'YYYY. [gada] D. MMMM',
  20805. LLL : 'YYYY. [gada] D. MMMM, HH:mm',
  20806. LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm'
  20807. },
  20808. calendar : {
  20809. sameDay : '[Šodien pulksten] LT',
  20810. nextDay : '[Rīt pulksten] LT',
  20811. nextWeek : 'dddd [pulksten] LT',
  20812. lastDay : '[Vakar pulksten] LT',
  20813. lastWeek : '[Pagājušā] dddd [pulksten] LT',
  20814. sameElse : 'L'
  20815. },
  20816. relativeTime : {
  20817. future : 'pēc %s',
  20818. past : 'pirms %s',
  20819. s : relativeSeconds,
  20820. m : relativeTimeWithSingular,
  20821. mm : lv__relativeTimeWithPlural,
  20822. h : relativeTimeWithSingular,
  20823. hh : lv__relativeTimeWithPlural,
  20824. d : relativeTimeWithSingular,
  20825. dd : lv__relativeTimeWithPlural,
  20826. M : relativeTimeWithSingular,
  20827. MM : lv__relativeTimeWithPlural,
  20828. y : relativeTimeWithSingular,
  20829. yy : lv__relativeTimeWithPlural
  20830. },
  20831. ordinalParse: /\d{1,2}\./,
  20832. ordinal : '%d.',
  20833. week : {
  20834. dow : 1, // Monday is the first day of the week.
  20835. doy : 4 // The week that contains Jan 4th is the first week of the year.
  20836. }
  20837. });
  20838. //! moment.js locale configuration
  20839. //! locale : Montenegrin (me)
  20840. //! author : Miodrag Nikač <miodrag@restartit.me> : https://github.com/miodragnikac
  20841. var me__translator = {
  20842. words: { //Different grammatical cases
  20843. m: ['jedan minut', 'jednog minuta'],
  20844. mm: ['minut', 'minuta', 'minuta'],
  20845. h: ['jedan sat', 'jednog sata'],
  20846. hh: ['sat', 'sata', 'sati'],
  20847. dd: ['dan', 'dana', 'dana'],
  20848. MM: ['mjesec', 'mjeseca', 'mjeseci'],
  20849. yy: ['godina', 'godine', 'godina']
  20850. },
  20851. correctGrammaticalCase: function (number, wordKey) {
  20852. return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
  20853. },
  20854. translate: function (number, withoutSuffix, key) {
  20855. var wordKey = me__translator.words[key];
  20856. if (key.length === 1) {
  20857. return withoutSuffix ? wordKey[0] : wordKey[1];
  20858. } else {
  20859. return number + ' ' + me__translator.correctGrammaticalCase(number, wordKey);
  20860. }
  20861. }
  20862. };
  20863. var me = _moment__default.defineLocale('me', {
  20864. months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
  20865. monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
  20866. weekdays: ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'],
  20867. weekdaysShort: ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'],
  20868. weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
  20869. longDateFormat: {
  20870. LT: 'H:mm',
  20871. LTS : 'H:mm:ss',
  20872. L: 'DD. MM. YYYY',
  20873. LL: 'D. MMMM YYYY',
  20874. LLL: 'D. MMMM YYYY H:mm',
  20875. LLLL: 'dddd, D. MMMM YYYY H:mm'
  20876. },
  20877. calendar: {
  20878. sameDay: '[danas u] LT',
  20879. nextDay: '[sjutra u] LT',
  20880. nextWeek: function () {
  20881. switch (this.day()) {
  20882. case 0:
  20883. return '[u] [nedjelju] [u] LT';
  20884. case 3:
  20885. return '[u] [srijedu] [u] LT';
  20886. case 6:
  20887. return '[u] [subotu] [u] LT';
  20888. case 1:
  20889. case 2:
  20890. case 4:
  20891. case 5:
  20892. return '[u] dddd [u] LT';
  20893. }
  20894. },
  20895. lastDay : '[juče u] LT',
  20896. lastWeek : function () {
  20897. var lastWeekDays = [
  20898. '[prošle] [nedjelje] [u] LT',
  20899. '[prošlog] [ponedjeljka] [u] LT',
  20900. '[prošlog] [utorka] [u] LT',
  20901. '[prošle] [srijede] [u] LT',
  20902. '[prošlog] [četvrtka] [u] LT',
  20903. '[prošlog] [petka] [u] LT',
  20904. '[prošle] [subote] [u] LT'
  20905. ];
  20906. return lastWeekDays[this.day()];
  20907. },
  20908. sameElse : 'L'
  20909. },
  20910. relativeTime : {
  20911. future : 'za %s',
  20912. past : 'prije %s',
  20913. s : 'nekoliko sekundi',
  20914. m : me__translator.translate,
  20915. mm : me__translator.translate,
  20916. h : me__translator.translate,
  20917. hh : me__translator.translate,
  20918. d : 'dan',
  20919. dd : me__translator.translate,
  20920. M : 'mjesec',
  20921. MM : me__translator.translate,
  20922. y : 'godinu',
  20923. yy : me__translator.translate
  20924. },
  20925. ordinalParse: /\d{1,2}\./,
  20926. ordinal : '%d.',
  20927. week : {
  20928. dow : 1, // Monday is the first day of the week.
  20929. doy : 7 // The week that contains Jan 1st is the first week of the year.
  20930. }
  20931. });
  20932. //! moment.js locale configuration
  20933. //! locale : macedonian (mk)
  20934. //! author : Borislav Mickov : https://github.com/B0k0
  20935. var mk = _moment__default.defineLocale('mk', {
  20936. months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'),
  20937. monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'),
  20938. weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'),
  20939. weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'),
  20940. weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.split('_'),
  20941. longDateFormat : {
  20942. LT : 'H:mm',
  20943. LTS : 'H:mm:ss',
  20944. L : 'D.MM.YYYY',
  20945. LL : 'D MMMM YYYY',
  20946. LLL : 'D MMMM YYYY H:mm',
  20947. LLLL : 'dddd, D MMMM YYYY H:mm'
  20948. },
  20949. calendar : {
  20950. sameDay : '[Денес во] LT',
  20951. nextDay : '[Утре во] LT',
  20952. nextWeek : 'dddd [во] LT',
  20953. lastDay : '[Вчера во] LT',
  20954. lastWeek : function () {
  20955. switch (this.day()) {
  20956. case 0:
  20957. case 3:
  20958. case 6:
  20959. return '[Во изминатата] dddd [во] LT';
  20960. case 1:
  20961. case 2:
  20962. case 4:
  20963. case 5:
  20964. return '[Во изминатиот] dddd [во] LT';
  20965. }
  20966. },
  20967. sameElse : 'L'
  20968. },
  20969. relativeTime : {
  20970. future : 'после %s',
  20971. past : 'пред %s',
  20972. s : 'неколку секунди',
  20973. m : 'минута',
  20974. mm : '%d минути',
  20975. h : 'час',
  20976. hh : '%d часа',
  20977. d : 'ден',
  20978. dd : '%d дена',
  20979. M : 'месец',
  20980. MM : '%d месеци',
  20981. y : 'година',
  20982. yy : '%d години'
  20983. },
  20984. ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
  20985. ordinal : function (number) {
  20986. var lastDigit = number % 10,
  20987. last2Digits = number % 100;
  20988. if (number === 0) {
  20989. return number + '-ев';
  20990. } else if (last2Digits === 0) {
  20991. return number + '-ен';
  20992. } else if (last2Digits > 10 && last2Digits < 20) {
  20993. return number + '-ти';
  20994. } else if (lastDigit === 1) {
  20995. return number + '-ви';
  20996. } else if (lastDigit === 2) {
  20997. return number + '-ри';
  20998. } else if (lastDigit === 7 || lastDigit === 8) {
  20999. return number + '-ми';
  21000. } else {
  21001. return number + '-ти';
  21002. }
  21003. },
  21004. week : {
  21005. dow : 1, // Monday is the first day of the week.
  21006. doy : 7 // The week that contains Jan 1st is the first week of the year.
  21007. }
  21008. });
  21009. //! moment.js locale configuration
  21010. //! locale : malayalam (ml)
  21011. //! author : Floyd Pink : https://github.com/floydpink
  21012. var ml = _moment__default.defineLocale('ml', {
  21013. months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'),
  21014. monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'),
  21015. weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'),
  21016. weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'),
  21017. weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'),
  21018. longDateFormat : {
  21019. LT : 'A h:mm -നു',
  21020. LTS : 'A h:mm:ss -നു',
  21021. L : 'DD/MM/YYYY',
  21022. LL : 'D MMMM YYYY',
  21023. LLL : 'D MMMM YYYY, A h:mm -നു',
  21024. LLLL : 'dddd, D MMMM YYYY, A h:mm -നു'
  21025. },
  21026. calendar : {
  21027. sameDay : '[ഇന്ന്] LT',
  21028. nextDay : '[നാളെ] LT',
  21029. nextWeek : 'dddd, LT',
  21030. lastDay : '[ഇന്നലെ] LT',
  21031. lastWeek : '[കഴിഞ്ഞ] dddd, LT',
  21032. sameElse : 'L'
  21033. },
  21034. relativeTime : {
  21035. future : '%s കഴിഞ്ഞ്',
  21036. past : '%s മുൻപ്',
  21037. s : 'അൽപ നിമിഷങ്ങൾ',
  21038. m : 'ഒരു മിനിറ്റ്',
  21039. mm : '%d മിനിറ്റ്',
  21040. h : 'ഒരു മണിക്കൂർ',
  21041. hh : '%d മണിക്കൂർ',
  21042. d : 'ഒരു ദിവസം',
  21043. dd : '%d ദിവസം',
  21044. M : 'ഒരു മാസം',
  21045. MM : '%d മാസം',
  21046. y : 'ഒരു വർഷം',
  21047. yy : '%d വർഷം'
  21048. },
  21049. meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,
  21050. isPM : function (input) {
  21051. return /^(ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി)$/.test(input);
  21052. },
  21053. meridiem : function (hour, minute, isLower) {
  21054. if (hour < 4) {
  21055. return 'രാത്രി';
  21056. } else if (hour < 12) {
  21057. return 'രാവിലെ';
  21058. } else if (hour < 17) {
  21059. return 'ഉച്ച കഴിഞ്ഞ്';
  21060. } else if (hour < 20) {
  21061. return 'വൈകുന്നേരം';
  21062. } else {
  21063. return 'രാത്രി';
  21064. }
  21065. }
  21066. });
  21067. //! moment.js locale configuration
  21068. //! locale : Marathi (mr)
  21069. //! author : Harshad Kale : https://github.com/kalehv
  21070. var mr__symbolMap = {
  21071. '1': '१',
  21072. '2': '२',
  21073. '3': '३',
  21074. '4': '४',
  21075. '5': '५',
  21076. '6': '६',
  21077. '7': '७',
  21078. '8': '८',
  21079. '9': '९',
  21080. '0': '०'
  21081. },
  21082. mr__numberMap = {
  21083. '१': '1',
  21084. '२': '2',
  21085. '३': '3',
  21086. '४': '4',
  21087. '५': '5',
  21088. '६': '6',
  21089. '७': '7',
  21090. '८': '8',
  21091. '९': '9',
  21092. '०': '0'
  21093. };
  21094. var mr = _moment__default.defineLocale('mr', {
  21095. months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'),
  21096. monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'),
  21097. weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
  21098. weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'),
  21099. weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),
  21100. longDateFormat : {
  21101. LT : 'A h:mm वाजता',
  21102. LTS : 'A h:mm:ss वाजता',
  21103. L : 'DD/MM/YYYY',
  21104. LL : 'D MMMM YYYY',
  21105. LLL : 'D MMMM YYYY, A h:mm वाजता',
  21106. LLLL : 'dddd, D MMMM YYYY, A h:mm वाजता'
  21107. },
  21108. calendar : {
  21109. sameDay : '[आज] LT',
  21110. nextDay : '[उद्या] LT',
  21111. nextWeek : 'dddd, LT',
  21112. lastDay : '[काल] LT',
  21113. lastWeek: '[मागील] dddd, LT',
  21114. sameElse : 'L'
  21115. },
  21116. relativeTime : {
  21117. future : '%s नंतर',
  21118. past : '%s पूर्वी',
  21119. s : 'सेकंद',
  21120. m: 'एक मिनिट',
  21121. mm: '%d मिनिटे',
  21122. h : 'एक तास',
  21123. hh : '%d तास',
  21124. d : 'एक दिवस',
  21125. dd : '%d दिवस',
  21126. M : 'एक महिना',
  21127. MM : '%d महिने',
  21128. y : 'एक वर्ष',
  21129. yy : '%d वर्षे'
  21130. },
  21131. preparse: function (string) {
  21132. return string.replace(/[१२३४५६७८९०]/g, function (match) {
  21133. return mr__numberMap[match];
  21134. });
  21135. },
  21136. postformat: function (string) {
  21137. return string.replace(/\d/g, function (match) {
  21138. return mr__symbolMap[match];
  21139. });
  21140. },
  21141. meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/,
  21142. meridiemHour : function (hour, meridiem) {
  21143. if (hour === 12) {
  21144. hour = 0;
  21145. }
  21146. if (meridiem === 'रात्री') {
  21147. return hour < 4 ? hour : hour + 12;
  21148. } else if (meridiem === 'सकाळी') {
  21149. return hour;
  21150. } else if (meridiem === 'दुपारी') {
  21151. return hour >= 10 ? hour : hour + 12;
  21152. } else if (meridiem === 'सायंकाळी') {
  21153. return hour + 12;
  21154. }
  21155. },
  21156. meridiem: function (hour, minute, isLower) {
  21157. if (hour < 4) {
  21158. return 'रात्री';
  21159. } else if (hour < 10) {
  21160. return 'सकाळी';
  21161. } else if (hour < 17) {
  21162. return 'दुपारी';
  21163. } else if (hour < 20) {
  21164. return 'सायंकाळी';
  21165. } else {
  21166. return 'रात्री';
  21167. }
  21168. },
  21169. week : {
  21170. dow : 0, // Sunday is the first day of the week.
  21171. doy : 6 // The week that contains Jan 1st is the first week of the year.
  21172. }
  21173. });
  21174. //! moment.js locale configuration
  21175. //! locale : Bahasa Malaysia (ms-MY)
  21176. //! author : Weldan Jamili : https://github.com/weldan
  21177. var ms_my = _moment__default.defineLocale('ms-my', {
  21178. months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'),
  21179. monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
  21180. weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
  21181. weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
  21182. weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
  21183. longDateFormat : {
  21184. LT : 'HH.mm',
  21185. LTS : 'HH.mm.ss',
  21186. L : 'DD/MM/YYYY',
  21187. LL : 'D MMMM YYYY',
  21188. LLL : 'D MMMM YYYY [pukul] HH.mm',
  21189. LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
  21190. },
  21191. meridiemParse: /pagi|tengahari|petang|malam/,
  21192. meridiemHour: function (hour, meridiem) {
  21193. if (hour === 12) {
  21194. hour = 0;
  21195. }
  21196. if (meridiem === 'pagi') {
  21197. return hour;
  21198. } else if (meridiem === 'tengahari') {
  21199. return hour >= 11 ? hour : hour + 12;
  21200. } else if (meridiem === 'petang' || meridiem === 'malam') {
  21201. return hour + 12;
  21202. }
  21203. },
  21204. meridiem : function (hours, minutes, isLower) {
  21205. if (hours < 11) {
  21206. return 'pagi';
  21207. } else if (hours < 15) {
  21208. return 'tengahari';
  21209. } else if (hours < 19) {
  21210. return 'petang';
  21211. } else {
  21212. return 'malam';
  21213. }
  21214. },
  21215. calendar : {
  21216. sameDay : '[Hari ini pukul] LT',
  21217. nextDay : '[Esok pukul] LT',
  21218. nextWeek : 'dddd [pukul] LT',
  21219. lastDay : '[Kelmarin pukul] LT',
  21220. lastWeek : 'dddd [lepas pukul] LT',
  21221. sameElse : 'L'
  21222. },
  21223. relativeTime : {
  21224. future : 'dalam %s',
  21225. past : '%s yang lepas',
  21226. s : 'beberapa saat',
  21227. m : 'seminit',
  21228. mm : '%d minit',
  21229. h : 'sejam',
  21230. hh : '%d jam',
  21231. d : 'sehari',
  21232. dd : '%d hari',
  21233. M : 'sebulan',
  21234. MM : '%d bulan',
  21235. y : 'setahun',
  21236. yy : '%d tahun'
  21237. },
  21238. week : {
  21239. dow : 1, // Monday is the first day of the week.
  21240. doy : 7 // The week that contains Jan 1st is the first week of the year.
  21241. }
  21242. });
  21243. //! moment.js locale configuration
  21244. //! locale : Bahasa Malaysia (ms-MY)
  21245. //! author : Weldan Jamili : https://github.com/weldan
  21246. var locale_ms = _moment__default.defineLocale('ms', {
  21247. months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'),
  21248. monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
  21249. weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
  21250. weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
  21251. weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
  21252. longDateFormat : {
  21253. LT : 'HH.mm',
  21254. LTS : 'HH.mm.ss',
  21255. L : 'DD/MM/YYYY',
  21256. LL : 'D MMMM YYYY',
  21257. LLL : 'D MMMM YYYY [pukul] HH.mm',
  21258. LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
  21259. },
  21260. meridiemParse: /pagi|tengahari|petang|malam/,
  21261. meridiemHour: function (hour, meridiem) {
  21262. if (hour === 12) {
  21263. hour = 0;
  21264. }
  21265. if (meridiem === 'pagi') {
  21266. return hour;
  21267. } else if (meridiem === 'tengahari') {
  21268. return hour >= 11 ? hour : hour + 12;
  21269. } else if (meridiem === 'petang' || meridiem === 'malam') {
  21270. return hour + 12;
  21271. }
  21272. },
  21273. meridiem : function (hours, minutes, isLower) {
  21274. if (hours < 11) {
  21275. return 'pagi';
  21276. } else if (hours < 15) {
  21277. return 'tengahari';
  21278. } else if (hours < 19) {
  21279. return 'petang';
  21280. } else {
  21281. return 'malam';
  21282. }
  21283. },
  21284. calendar : {
  21285. sameDay : '[Hari ini pukul] LT',
  21286. nextDay : '[Esok pukul] LT',
  21287. nextWeek : 'dddd [pukul] LT',
  21288. lastDay : '[Kelmarin pukul] LT',
  21289. lastWeek : 'dddd [lepas pukul] LT',
  21290. sameElse : 'L'
  21291. },
  21292. relativeTime : {
  21293. future : 'dalam %s',
  21294. past : '%s yang lepas',
  21295. s : 'beberapa saat',
  21296. m : 'seminit',
  21297. mm : '%d minit',
  21298. h : 'sejam',
  21299. hh : '%d jam',
  21300. d : 'sehari',
  21301. dd : '%d hari',
  21302. M : 'sebulan',
  21303. MM : '%d bulan',
  21304. y : 'setahun',
  21305. yy : '%d tahun'
  21306. },
  21307. week : {
  21308. dow : 1, // Monday is the first day of the week.
  21309. doy : 7 // The week that contains Jan 1st is the first week of the year.
  21310. }
  21311. });
  21312. //! moment.js locale configuration
  21313. //! locale : Burmese (my)
  21314. //! author : Squar team, mysquar.com
  21315. var my__symbolMap = {
  21316. '1': '၁',
  21317. '2': '၂',
  21318. '3': '၃',
  21319. '4': '၄',
  21320. '5': '၅',
  21321. '6': '၆',
  21322. '7': '၇',
  21323. '8': '၈',
  21324. '9': '၉',
  21325. '0': '၀'
  21326. }, my__numberMap = {
  21327. '၁': '1',
  21328. '၂': '2',
  21329. '၃': '3',
  21330. '၄': '4',
  21331. '၅': '5',
  21332. '၆': '6',
  21333. '၇': '7',
  21334. '၈': '8',
  21335. '၉': '9',
  21336. '၀': '0'
  21337. };
  21338. var my = _moment__default.defineLocale('my', {
  21339. months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'),
  21340. monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'),
  21341. weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'),
  21342. weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
  21343. weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
  21344. longDateFormat: {
  21345. LT: 'HH:mm',
  21346. LTS: 'HH:mm:ss',
  21347. L: 'DD/MM/YYYY',
  21348. LL: 'D MMMM YYYY',
  21349. LLL: 'D MMMM YYYY HH:mm',
  21350. LLLL: 'dddd D MMMM YYYY HH:mm'
  21351. },
  21352. calendar: {
  21353. sameDay: '[ယနေ.] LT [မှာ]',
  21354. nextDay: '[မနက်ဖြန်] LT [မှာ]',
  21355. nextWeek: 'dddd LT [မှာ]',
  21356. lastDay: '[မနေ.က] LT [မှာ]',
  21357. lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]',
  21358. sameElse: 'L'
  21359. },
  21360. relativeTime: {
  21361. future: 'လာမည့် %s မှာ',
  21362. past: 'လွန်ခဲ့သော %s က',
  21363. s: 'စက္ကန်.အနည်းငယ်',
  21364. m: 'တစ်မိနစ်',
  21365. mm: '%d မိနစ်',
  21366. h: 'တစ်နာရီ',
  21367. hh: '%d နာရီ',
  21368. d: 'တစ်ရက်',
  21369. dd: '%d ရက်',
  21370. M: 'တစ်လ',
  21371. MM: '%d လ',
  21372. y: 'တစ်နှစ်',
  21373. yy: '%d နှစ်'
  21374. },
  21375. preparse: function (string) {
  21376. return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) {
  21377. return my__numberMap[match];
  21378. });
  21379. },
  21380. postformat: function (string) {
  21381. return string.replace(/\d/g, function (match) {
  21382. return my__symbolMap[match];
  21383. });
  21384. },
  21385. week: {
  21386. dow: 1, // Monday is the first day of the week.
  21387. doy: 4 // The week that contains Jan 1st is the first week of the year.
  21388. }
  21389. });
  21390. //! moment.js locale configuration
  21391. //! locale : norwegian bokmål (nb)
  21392. //! authors : Espen Hovlandsdal : https://github.com/rexxars
  21393. //! Sigurd Gartmann : https://github.com/sigurdga
  21394. var nb = _moment__default.defineLocale('nb', {
  21395. months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
  21396. monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
  21397. weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
  21398. weekdaysShort : 'søn_man_tirs_ons_tors_fre_lør'.split('_'),
  21399. weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'),
  21400. longDateFormat : {
  21401. LT : 'H.mm',
  21402. LTS : 'H.mm.ss',
  21403. L : 'DD.MM.YYYY',
  21404. LL : 'D. MMMM YYYY',
  21405. LLL : 'D. MMMM YYYY [kl.] H.mm',
  21406. LLLL : 'dddd D. MMMM YYYY [kl.] H.mm'
  21407. },
  21408. calendar : {
  21409. sameDay: '[i dag kl.] LT',
  21410. nextDay: '[i morgen kl.] LT',
  21411. nextWeek: 'dddd [kl.] LT',
  21412. lastDay: '[i går kl.] LT',
  21413. lastWeek: '[forrige] dddd [kl.] LT',
  21414. sameElse: 'L'
  21415. },
  21416. relativeTime : {
  21417. future : 'om %s',
  21418. past : 'for %s siden',
  21419. s : 'noen sekunder',
  21420. m : 'ett minutt',
  21421. mm : '%d minutter',
  21422. h : 'en time',
  21423. hh : '%d timer',
  21424. d : 'en dag',
  21425. dd : '%d dager',
  21426. M : 'en måned',
  21427. MM : '%d måneder',
  21428. y : 'ett år',
  21429. yy : '%d år'
  21430. },
  21431. ordinalParse: /\d{1,2}\./,
  21432. ordinal : '%d.',
  21433. week : {
  21434. dow : 1, // Monday is the first day of the week.
  21435. doy : 4 // The week that contains Jan 4th is the first week of the year.
  21436. }
  21437. });
  21438. //! moment.js locale configuration
  21439. //! locale : nepali/nepalese
  21440. //! author : suvash : https://github.com/suvash
  21441. var ne__symbolMap = {
  21442. '1': '१',
  21443. '2': '२',
  21444. '3': '३',
  21445. '4': '४',
  21446. '5': '५',
  21447. '6': '६',
  21448. '7': '७',
  21449. '8': '८',
  21450. '9': '९',
  21451. '0': '०'
  21452. },
  21453. ne__numberMap = {
  21454. '१': '1',
  21455. '२': '2',
  21456. '३': '3',
  21457. '४': '4',
  21458. '५': '5',
  21459. '६': '6',
  21460. '७': '7',
  21461. '८': '8',
  21462. '९': '9',
  21463. '०': '0'
  21464. };
  21465. var ne = _moment__default.defineLocale('ne', {
  21466. months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'),
  21467. monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'),
  21468. weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'),
  21469. weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'),
  21470. weekdaysMin : 'आइ._सो._मङ्_बु._बि._शु._श.'.split('_'),
  21471. longDateFormat : {
  21472. LT : 'Aको h:mm बजे',
  21473. LTS : 'Aको h:mm:ss बजे',
  21474. L : 'DD/MM/YYYY',
  21475. LL : 'D MMMM YYYY',
  21476. LLL : 'D MMMM YYYY, Aको h:mm बजे',
  21477. LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे'
  21478. },
  21479. preparse: function (string) {
  21480. return string.replace(/[१२३४५६७८९०]/g, function (match) {
  21481. return ne__numberMap[match];
  21482. });
  21483. },
  21484. postformat: function (string) {
  21485. return string.replace(/\d/g, function (match) {
  21486. return ne__symbolMap[match];
  21487. });
  21488. },
  21489. meridiemParse: /राती|बिहान|दिउँसो|बेलुका|साँझ|राती/,
  21490. meridiemHour : function (hour, meridiem) {
  21491. if (hour === 12) {
  21492. hour = 0;
  21493. }
  21494. if (meridiem === 'राती') {
  21495. return hour < 3 ? hour : hour + 12;
  21496. } else if (meridiem === 'बिहान') {
  21497. return hour;
  21498. } else if (meridiem === 'दिउँसो') {
  21499. return hour >= 10 ? hour : hour + 12;
  21500. } else if (meridiem === 'बेलुका' || meridiem === 'साँझ') {
  21501. return hour + 12;
  21502. }
  21503. },
  21504. meridiem : function (hour, minute, isLower) {
  21505. if (hour < 3) {
  21506. return 'राती';
  21507. } else if (hour < 10) {
  21508. return 'बिहान';
  21509. } else if (hour < 15) {
  21510. return 'दिउँसो';
  21511. } else if (hour < 18) {
  21512. return 'बेलुका';
  21513. } else if (hour < 20) {
  21514. return 'साँझ';
  21515. } else {
  21516. return 'राती';
  21517. }
  21518. },
  21519. calendar : {
  21520. sameDay : '[आज] LT',
  21521. nextDay : '[भोली] LT',
  21522. nextWeek : '[आउँदो] dddd[,] LT',
  21523. lastDay : '[हिजो] LT',
  21524. lastWeek : '[गएको] dddd[,] LT',
  21525. sameElse : 'L'
  21526. },
  21527. relativeTime : {
  21528. future : '%sमा',
  21529. past : '%s अगाडी',
  21530. s : 'केही समय',
  21531. m : 'एक मिनेट',
  21532. mm : '%d मिनेट',
  21533. h : 'एक घण्टा',
  21534. hh : '%d घण्टा',
  21535. d : 'एक दिन',
  21536. dd : '%d दिन',
  21537. M : 'एक महिना',
  21538. MM : '%d महिना',
  21539. y : 'एक बर्ष',
  21540. yy : '%d बर्ष'
  21541. },
  21542. week : {
  21543. dow : 1, // Monday is the first day of the week.
  21544. doy : 7 // The week that contains Jan 1st is the first week of the year.
  21545. }
  21546. });
  21547. //! moment.js locale configuration
  21548. //! locale : dutch (nl)
  21549. //! author : Joris Röling : https://github.com/jjupiter
  21550. var nl__monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
  21551. nl__monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_');
  21552. var nl = _moment__default.defineLocale('nl', {
  21553. months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
  21554. monthsShort : function (m, format) {
  21555. if (/-MMM-/.test(format)) {
  21556. return nl__monthsShortWithoutDots[m.month()];
  21557. } else {
  21558. return nl__monthsShortWithDots[m.month()];
  21559. }
  21560. },
  21561. weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
  21562. weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'),
  21563. weekdaysMin : 'Zo_Ma_Di_Wo_Do_Vr_Za'.split('_'),
  21564. longDateFormat : {
  21565. LT : 'HH:mm',
  21566. LTS : 'HH:mm:ss',
  21567. L : 'DD-MM-YYYY',
  21568. LL : 'D MMMM YYYY',
  21569. LLL : 'D MMMM YYYY HH:mm',
  21570. LLLL : 'dddd D MMMM YYYY HH:mm'
  21571. },
  21572. calendar : {
  21573. sameDay: '[vandaag om] LT',
  21574. nextDay: '[morgen om] LT',
  21575. nextWeek: 'dddd [om] LT',
  21576. lastDay: '[gisteren om] LT',
  21577. lastWeek: '[afgelopen] dddd [om] LT',
  21578. sameElse: 'L'
  21579. },
  21580. relativeTime : {
  21581. future : 'over %s',
  21582. past : '%s geleden',
  21583. s : 'een paar seconden',
  21584. m : 'één minuut',
  21585. mm : '%d minuten',
  21586. h : 'één uur',
  21587. hh : '%d uur',
  21588. d : 'één dag',
  21589. dd : '%d dagen',
  21590. M : 'één maand',
  21591. MM : '%d maanden',
  21592. y : 'één jaar',
  21593. yy : '%d jaar'
  21594. },
  21595. ordinalParse: /\d{1,2}(ste|de)/,
  21596. ordinal : function (number) {
  21597. return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de');
  21598. },
  21599. week : {
  21600. dow : 1, // Monday is the first day of the week.
  21601. doy : 4 // The week that contains Jan 4th is the first week of the year.
  21602. }
  21603. });
  21604. //! moment.js locale configuration
  21605. //! locale : norwegian nynorsk (nn)
  21606. //! author : https://github.com/mechuwind
  21607. var nn = _moment__default.defineLocale('nn', {
  21608. months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
  21609. monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
  21610. weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'),
  21611. weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'),
  21612. weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'),
  21613. longDateFormat : {
  21614. LT : 'HH:mm',
  21615. LTS : 'HH:mm:ss',
  21616. L : 'DD.MM.YYYY',
  21617. LL : 'D MMMM YYYY',
  21618. LLL : 'D MMMM YYYY HH:mm',
  21619. LLLL : 'dddd D MMMM YYYY HH:mm'
  21620. },
  21621. calendar : {
  21622. sameDay: '[I dag klokka] LT',
  21623. nextDay: '[I morgon klokka] LT',
  21624. nextWeek: 'dddd [klokka] LT',
  21625. lastDay: '[I går klokka] LT',
  21626. lastWeek: '[Føregåande] dddd [klokka] LT',
  21627. sameElse: 'L'
  21628. },
  21629. relativeTime : {
  21630. future : 'om %s',
  21631. past : 'for %s sidan',
  21632. s : 'nokre sekund',
  21633. m : 'eit minutt',
  21634. mm : '%d minutt',
  21635. h : 'ein time',
  21636. hh : '%d timar',
  21637. d : 'ein dag',
  21638. dd : '%d dagar',
  21639. M : 'ein månad',
  21640. MM : '%d månader',
  21641. y : 'eit år',
  21642. yy : '%d år'
  21643. },
  21644. ordinalParse: /\d{1,2}\./,
  21645. ordinal : '%d.',
  21646. week : {
  21647. dow : 1, // Monday is the first day of the week.
  21648. doy : 4 // The week that contains Jan 4th is the first week of the year.
  21649. }
  21650. });
  21651. //! moment.js locale configuration
  21652. //! locale : polish (pl)
  21653. //! author : Rafal Hirsz : https://github.com/evoL
  21654. var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'),
  21655. monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_');
  21656. function pl__plural(n) {
  21657. return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1);
  21658. }
  21659. function pl__translate(number, withoutSuffix, key) {
  21660. var result = number + ' ';
  21661. switch (key) {
  21662. case 'm':
  21663. return withoutSuffix ? 'minuta' : 'minutę';
  21664. case 'mm':
  21665. return result + (pl__plural(number) ? 'minuty' : 'minut');
  21666. case 'h':
  21667. return withoutSuffix ? 'godzina' : 'godzinę';
  21668. case 'hh':
  21669. return result + (pl__plural(number) ? 'godziny' : 'godzin');
  21670. case 'MM':
  21671. return result + (pl__plural(number) ? 'miesiące' : 'miesięcy');
  21672. case 'yy':
  21673. return result + (pl__plural(number) ? 'lata' : 'lat');
  21674. }
  21675. }
  21676. var pl = _moment__default.defineLocale('pl', {
  21677. months : function (momentToFormat, format) {
  21678. if (format === '') {
  21679. // Hack: if format empty we know this is used to generate
  21680. // RegExp by moment. Give then back both valid forms of months
  21681. // in RegExp ready format.
  21682. return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')';
  21683. } else if (/D MMMM/.test(format)) {
  21684. return monthsSubjective[momentToFormat.month()];
  21685. } else {
  21686. return monthsNominative[momentToFormat.month()];
  21687. }
  21688. },
  21689. monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'),
  21690. weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'),
  21691. weekdaysShort : 'nie_pon_wt_śr_czw_pt_sb'.split('_'),
  21692. weekdaysMin : 'N_Pn_Wt_Śr_Cz_Pt_So'.split('_'),
  21693. longDateFormat : {
  21694. LT : 'HH:mm',
  21695. LTS : 'HH:mm:ss',
  21696. L : 'DD.MM.YYYY',
  21697. LL : 'D MMMM YYYY',
  21698. LLL : 'D MMMM YYYY HH:mm',
  21699. LLLL : 'dddd, D MMMM YYYY HH:mm'
  21700. },
  21701. calendar : {
  21702. sameDay: '[Dziś o] LT',
  21703. nextDay: '[Jutro o] LT',
  21704. nextWeek: '[W] dddd [o] LT',
  21705. lastDay: '[Wczoraj o] LT',
  21706. lastWeek: function () {
  21707. switch (this.day()) {
  21708. case 0:
  21709. return '[W zeszłą niedzielę o] LT';
  21710. case 3:
  21711. return '[W zeszłą środę o] LT';
  21712. case 6:
  21713. return '[W zeszłą sobotę o] LT';
  21714. default:
  21715. return '[W zeszły] dddd [o] LT';
  21716. }
  21717. },
  21718. sameElse: 'L'
  21719. },
  21720. relativeTime : {
  21721. future : 'za %s',
  21722. past : '%s temu',
  21723. s : 'kilka sekund',
  21724. m : pl__translate,
  21725. mm : pl__translate,
  21726. h : pl__translate,
  21727. hh : pl__translate,
  21728. d : '1 dzień',
  21729. dd : '%d dni',
  21730. M : 'miesiąc',
  21731. MM : pl__translate,
  21732. y : 'rok',
  21733. yy : pl__translate
  21734. },
  21735. ordinalParse: /\d{1,2}\./,
  21736. ordinal : '%d.',
  21737. week : {
  21738. dow : 1, // Monday is the first day of the week.
  21739. doy : 4 // The week that contains Jan 4th is the first week of the year.
  21740. }
  21741. });
  21742. //! moment.js locale configuration
  21743. //! locale : brazilian portuguese (pt-br)
  21744. //! author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira
  21745. var pt_br = _moment__default.defineLocale('pt-br', {
  21746. months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'),
  21747. monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
  21748. weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'),
  21749. weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
  21750. weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'),
  21751. longDateFormat : {
  21752. LT : 'HH:mm',
  21753. LTS : 'HH:mm:ss',
  21754. L : 'DD/MM/YYYY',
  21755. LL : 'D [de] MMMM [de] YYYY',
  21756. LLL : 'D [de] MMMM [de] YYYY [às] HH:mm',
  21757. LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm'
  21758. },
  21759. calendar : {
  21760. sameDay: '[Hoje às] LT',
  21761. nextDay: '[Amanhã às] LT',
  21762. nextWeek: 'dddd [às] LT',
  21763. lastDay: '[Ontem às] LT',
  21764. lastWeek: function () {
  21765. return (this.day() === 0 || this.day() === 6) ?
  21766. '[Último] dddd [às] LT' : // Saturday + Sunday
  21767. '[Última] dddd [às] LT'; // Monday - Friday
  21768. },
  21769. sameElse: 'L'
  21770. },
  21771. relativeTime : {
  21772. future : 'em %s',
  21773. past : '%s atrás',
  21774. s : 'poucos segundos',
  21775. m : 'um minuto',
  21776. mm : '%d minutos',
  21777. h : 'uma hora',
  21778. hh : '%d horas',
  21779. d : 'um dia',
  21780. dd : '%d dias',
  21781. M : 'um mês',
  21782. MM : '%d meses',
  21783. y : 'um ano',
  21784. yy : '%d anos'
  21785. },
  21786. ordinalParse: /\d{1,2}º/,
  21787. ordinal : '%dº'
  21788. });
  21789. //! moment.js locale configuration
  21790. //! locale : portuguese (pt)
  21791. //! author : Jefferson : https://github.com/jalex79
  21792. var pt = _moment__default.defineLocale('pt', {
  21793. months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'),
  21794. monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
  21795. weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'),
  21796. weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
  21797. weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'),
  21798. longDateFormat : {
  21799. LT : 'HH:mm',
  21800. LTS : 'HH:mm:ss',
  21801. L : 'DD/MM/YYYY',
  21802. LL : 'D [de] MMMM [de] YYYY',
  21803. LLL : 'D [de] MMMM [de] YYYY HH:mm',
  21804. LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm'
  21805. },
  21806. calendar : {
  21807. sameDay: '[Hoje às] LT',
  21808. nextDay: '[Amanhã às] LT',
  21809. nextWeek: 'dddd [às] LT',
  21810. lastDay: '[Ontem às] LT',
  21811. lastWeek: function () {
  21812. return (this.day() === 0 || this.day() === 6) ?
  21813. '[Último] dddd [às] LT' : // Saturday + Sunday
  21814. '[Última] dddd [às] LT'; // Monday - Friday
  21815. },
  21816. sameElse: 'L'
  21817. },
  21818. relativeTime : {
  21819. future : 'em %s',
  21820. past : 'há %s',
  21821. s : 'segundos',
  21822. m : 'um minuto',
  21823. mm : '%d minutos',
  21824. h : 'uma hora',
  21825. hh : '%d horas',
  21826. d : 'um dia',
  21827. dd : '%d dias',
  21828. M : 'um mês',
  21829. MM : '%d meses',
  21830. y : 'um ano',
  21831. yy : '%d anos'
  21832. },
  21833. ordinalParse: /\d{1,2}º/,
  21834. ordinal : '%dº',
  21835. week : {
  21836. dow : 1, // Monday is the first day of the week.
  21837. doy : 4 // The week that contains Jan 4th is the first week of the year.
  21838. }
  21839. });
  21840. //! moment.js locale configuration
  21841. //! locale : romanian (ro)
  21842. //! author : Vlad Gurdiga : https://github.com/gurdiga
  21843. //! author : Valentin Agachi : https://github.com/avaly
  21844. function ro__relativeTimeWithPlural(number, withoutSuffix, key) {
  21845. var format = {
  21846. 'mm': 'minute',
  21847. 'hh': 'ore',
  21848. 'dd': 'zile',
  21849. 'MM': 'luni',
  21850. 'yy': 'ani'
  21851. },
  21852. separator = ' ';
  21853. if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) {
  21854. separator = ' de ';
  21855. }
  21856. return number + separator + format[key];
  21857. }
  21858. var ro = _moment__default.defineLocale('ro', {
  21859. months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'),
  21860. monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'),
  21861. weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'),
  21862. weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'),
  21863. weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'),
  21864. longDateFormat : {
  21865. LT : 'H:mm',
  21866. LTS : 'H:mm:ss',
  21867. L : 'DD.MM.YYYY',
  21868. LL : 'D MMMM YYYY',
  21869. LLL : 'D MMMM YYYY H:mm',
  21870. LLLL : 'dddd, D MMMM YYYY H:mm'
  21871. },
  21872. calendar : {
  21873. sameDay: '[azi la] LT',
  21874. nextDay: '[mâine la] LT',
  21875. nextWeek: 'dddd [la] LT',
  21876. lastDay: '[ieri la] LT',
  21877. lastWeek: '[fosta] dddd [la] LT',
  21878. sameElse: 'L'
  21879. },
  21880. relativeTime : {
  21881. future : 'peste %s',
  21882. past : '%s în urmă',
  21883. s : 'câteva secunde',
  21884. m : 'un minut',
  21885. mm : ro__relativeTimeWithPlural,
  21886. h : 'o oră',
  21887. hh : ro__relativeTimeWithPlural,
  21888. d : 'o zi',
  21889. dd : ro__relativeTimeWithPlural,
  21890. M : 'o lună',
  21891. MM : ro__relativeTimeWithPlural,
  21892. y : 'un an',
  21893. yy : ro__relativeTimeWithPlural
  21894. },
  21895. week : {
  21896. dow : 1, // Monday is the first day of the week.
  21897. doy : 7 // The week that contains Jan 1st is the first week of the year.
  21898. }
  21899. });
  21900. //! moment.js locale configuration
  21901. //! locale : russian (ru)
  21902. //! author : Viktorminator : https://github.com/Viktorminator
  21903. //! Author : Menelion Elensúle : https://github.com/Oire
  21904. function ru__plural(word, num) {
  21905. var forms = word.split('_');
  21906. return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
  21907. }
  21908. function ru__relativeTimeWithPlural(number, withoutSuffix, key) {
  21909. var format = {
  21910. 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
  21911. 'hh': 'час_часа_часов',
  21912. 'dd': 'день_дня_дней',
  21913. 'MM': 'месяц_месяца_месяцев',
  21914. 'yy': 'год_года_лет'
  21915. };
  21916. if (key === 'm') {
  21917. return withoutSuffix ? 'минута' : 'минуту';
  21918. }
  21919. else {
  21920. return number + ' ' + ru__plural(format[key], +number);
  21921. }
  21922. }
  21923. function ru__monthsCaseReplace(m, format) {
  21924. var months = {
  21925. 'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
  21926. 'accusative': 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_')
  21927. },
  21928. nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
  21929. 'accusative' :
  21930. 'nominative';
  21931. return months[nounCase][m.month()];
  21932. }
  21933. function ru__monthsShortCaseReplace(m, format) {
  21934. var monthsShort = {
  21935. 'nominative': 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
  21936. 'accusative': 'янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек'.split('_')
  21937. },
  21938. nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
  21939. 'accusative' :
  21940. 'nominative';
  21941. return monthsShort[nounCase][m.month()];
  21942. }
  21943. function ru__weekdaysCaseReplace(m, format) {
  21944. var weekdays = {
  21945. 'nominative': 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'),
  21946. 'accusative': 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_')
  21947. },
  21948. nounCase = (/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/).test(format) ?
  21949. 'accusative' :
  21950. 'nominative';
  21951. return weekdays[nounCase][m.day()];
  21952. }
  21953. var ru = _moment__default.defineLocale('ru', {
  21954. months : ru__monthsCaseReplace,
  21955. monthsShort : ru__monthsShortCaseReplace,
  21956. weekdays : ru__weekdaysCaseReplace,
  21957. weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
  21958. weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
  21959. monthsParse : [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i],
  21960. longDateFormat : {
  21961. LT : 'HH:mm',
  21962. LTS : 'HH:mm:ss',
  21963. L : 'DD.MM.YYYY',
  21964. LL : 'D MMMM YYYY г.',
  21965. LLL : 'D MMMM YYYY г., HH:mm',
  21966. LLLL : 'dddd, D MMMM YYYY г., HH:mm'
  21967. },
  21968. calendar : {
  21969. sameDay: '[Сегодня в] LT',
  21970. nextDay: '[Завтра в] LT',
  21971. lastDay: '[Вчера в] LT',
  21972. nextWeek: function () {
  21973. return this.day() === 2 ? '[Во] dddd [в] LT' : '[В] dddd [в] LT';
  21974. },
  21975. lastWeek: function (now) {
  21976. if (now.week() !== this.week()) {
  21977. switch (this.day()) {
  21978. case 0:
  21979. return '[В прошлое] dddd [в] LT';
  21980. case 1:
  21981. case 2:
  21982. case 4:
  21983. return '[В прошлый] dddd [в] LT';
  21984. case 3:
  21985. case 5:
  21986. case 6:
  21987. return '[В прошлую] dddd [в] LT';
  21988. }
  21989. } else {
  21990. if (this.day() === 2) {
  21991. return '[Во] dddd [в] LT';
  21992. } else {
  21993. return '[В] dddd [в] LT';
  21994. }
  21995. }
  21996. },
  21997. sameElse: 'L'
  21998. },
  21999. relativeTime : {
  22000. future : 'через %s',
  22001. past : '%s назад',
  22002. s : 'несколько секунд',
  22003. m : ru__relativeTimeWithPlural,
  22004. mm : ru__relativeTimeWithPlural,
  22005. h : 'час',
  22006. hh : ru__relativeTimeWithPlural,
  22007. d : 'день',
  22008. dd : ru__relativeTimeWithPlural,
  22009. M : 'месяц',
  22010. MM : ru__relativeTimeWithPlural,
  22011. y : 'год',
  22012. yy : ru__relativeTimeWithPlural
  22013. },
  22014. meridiemParse: /ночи|утра|дня|вечера/i,
  22015. isPM : function (input) {
  22016. return /^(дня|вечера)$/.test(input);
  22017. },
  22018. meridiem : function (hour, minute, isLower) {
  22019. if (hour < 4) {
  22020. return 'ночи';
  22021. } else if (hour < 12) {
  22022. return 'утра';
  22023. } else if (hour < 17) {
  22024. return 'дня';
  22025. } else {
  22026. return 'вечера';
  22027. }
  22028. },
  22029. ordinalParse: /\d{1,2}-(й|го|я)/,
  22030. ordinal: function (number, period) {
  22031. switch (period) {
  22032. case 'M':
  22033. case 'd':
  22034. case 'DDD':
  22035. return number + '-й';
  22036. case 'D':
  22037. return number + '-го';
  22038. case 'w':
  22039. case 'W':
  22040. return number + '-я';
  22041. default:
  22042. return number;
  22043. }
  22044. },
  22045. week : {
  22046. dow : 1, // Monday is the first day of the week.
  22047. doy : 7 // The week that contains Jan 1st is the first week of the year.
  22048. }
  22049. });
  22050. //! moment.js locale configuration
  22051. //! locale : Sinhalese (si)
  22052. //! author : Sampath Sitinamaluwa : https://github.com/sampathsris
  22053. var si = _moment__default.defineLocale('si', {
  22054. months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'),
  22055. monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'),
  22056. weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'),
  22057. weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'),
  22058. weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'),
  22059. longDateFormat : {
  22060. LT : 'a h:mm',
  22061. LTS : 'a h:mm:ss',
  22062. L : 'YYYY/MM/DD',
  22063. LL : 'YYYY MMMM D',
  22064. LLL : 'YYYY MMMM D, a h:mm',
  22065. LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss'
  22066. },
  22067. calendar : {
  22068. sameDay : '[අද] LT[ට]',
  22069. nextDay : '[හෙට] LT[ට]',
  22070. nextWeek : 'dddd LT[ට]',
  22071. lastDay : '[ඊයේ] LT[ට]',
  22072. lastWeek : '[පසුගිය] dddd LT[ට]',
  22073. sameElse : 'L'
  22074. },
  22075. relativeTime : {
  22076. future : '%sකින්',
  22077. past : '%sකට පෙර',
  22078. s : 'තත්පර කිහිපය',
  22079. m : 'මිනිත්තුව',
  22080. mm : 'මිනිත්තු %d',
  22081. h : 'පැය',
  22082. hh : 'පැය %d',
  22083. d : 'දිනය',
  22084. dd : 'දින %d',
  22085. M : 'මාසය',
  22086. MM : 'මාස %d',
  22087. y : 'වසර',
  22088. yy : 'වසර %d'
  22089. },
  22090. ordinalParse: /\d{1,2} වැනි/,
  22091. ordinal : function (number) {
  22092. return number + ' වැනි';
  22093. },
  22094. meridiem : function (hours, minutes, isLower) {
  22095. if (hours > 11) {
  22096. return isLower ? 'ප.ව.' : 'පස් වරු';
  22097. } else {
  22098. return isLower ? 'පෙ.ව.' : 'පෙර වරු';
  22099. }
  22100. }
  22101. });
  22102. //! moment.js locale configuration
  22103. //! locale : slovak (sk)
  22104. //! author : Martin Minka : https://github.com/k2s
  22105. //! based on work of petrbela : https://github.com/petrbela
  22106. var sk__months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
  22107. sk__monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
  22108. function sk__plural(n) {
  22109. return (n > 1) && (n < 5);
  22110. }
  22111. function sk__translate(number, withoutSuffix, key, isFuture) {
  22112. var result = number + ' ';
  22113. switch (key) {
  22114. case 's': // a few seconds / in a few seconds / a few seconds ago
  22115. return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami';
  22116. case 'm': // a minute / in a minute / a minute ago
  22117. return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou');
  22118. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  22119. if (withoutSuffix || isFuture) {
  22120. return result + (sk__plural(number) ? 'minúty' : 'minút');
  22121. } else {
  22122. return result + 'minútami';
  22123. }
  22124. break;
  22125. case 'h': // an hour / in an hour / an hour ago
  22126. return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
  22127. case 'hh': // 9 hours / in 9 hours / 9 hours ago
  22128. if (withoutSuffix || isFuture) {
  22129. return result + (sk__plural(number) ? 'hodiny' : 'hodín');
  22130. } else {
  22131. return result + 'hodinami';
  22132. }
  22133. break;
  22134. case 'd': // a day / in a day / a day ago
  22135. return (withoutSuffix || isFuture) ? 'deň' : 'dňom';
  22136. case 'dd': // 9 days / in 9 days / 9 days ago
  22137. if (withoutSuffix || isFuture) {
  22138. return result + (sk__plural(number) ? 'dni' : 'dní');
  22139. } else {
  22140. return result + 'dňami';
  22141. }
  22142. break;
  22143. case 'M': // a month / in a month / a month ago
  22144. return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom';
  22145. case 'MM': // 9 months / in 9 months / 9 months ago
  22146. if (withoutSuffix || isFuture) {
  22147. return result + (sk__plural(number) ? 'mesiace' : 'mesiacov');
  22148. } else {
  22149. return result + 'mesiacmi';
  22150. }
  22151. break;
  22152. case 'y': // a year / in a year / a year ago
  22153. return (withoutSuffix || isFuture) ? 'rok' : 'rokom';
  22154. case 'yy': // 9 years / in 9 years / 9 years ago
  22155. if (withoutSuffix || isFuture) {
  22156. return result + (sk__plural(number) ? 'roky' : 'rokov');
  22157. } else {
  22158. return result + 'rokmi';
  22159. }
  22160. break;
  22161. }
  22162. }
  22163. var sk = _moment__default.defineLocale('sk', {
  22164. months : sk__months,
  22165. monthsShort : sk__monthsShort,
  22166. monthsParse : (function (months, monthsShort) {
  22167. var i, _monthsParse = [];
  22168. for (i = 0; i < 12; i++) {
  22169. // use custom parser to solve problem with July (červenec)
  22170. _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
  22171. }
  22172. return _monthsParse;
  22173. }(sk__months, sk__monthsShort)),
  22174. weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
  22175. weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'),
  22176. weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'),
  22177. longDateFormat : {
  22178. LT: 'H:mm',
  22179. LTS : 'H:mm:ss',
  22180. L : 'DD.MM.YYYY',
  22181. LL : 'D. MMMM YYYY',
  22182. LLL : 'D. MMMM YYYY H:mm',
  22183. LLLL : 'dddd D. MMMM YYYY H:mm'
  22184. },
  22185. calendar : {
  22186. sameDay: '[dnes o] LT',
  22187. nextDay: '[zajtra o] LT',
  22188. nextWeek: function () {
  22189. switch (this.day()) {
  22190. case 0:
  22191. return '[v nedeľu o] LT';
  22192. case 1:
  22193. case 2:
  22194. return '[v] dddd [o] LT';
  22195. case 3:
  22196. return '[v stredu o] LT';
  22197. case 4:
  22198. return '[vo štvrtok o] LT';
  22199. case 5:
  22200. return '[v piatok o] LT';
  22201. case 6:
  22202. return '[v sobotu o] LT';
  22203. }
  22204. },
  22205. lastDay: '[včera o] LT',
  22206. lastWeek: function () {
  22207. switch (this.day()) {
  22208. case 0:
  22209. return '[minulú nedeľu o] LT';
  22210. case 1:
  22211. case 2:
  22212. return '[minulý] dddd [o] LT';
  22213. case 3:
  22214. return '[minulú stredu o] LT';
  22215. case 4:
  22216. case 5:
  22217. return '[minulý] dddd [o] LT';
  22218. case 6:
  22219. return '[minulú sobotu o] LT';
  22220. }
  22221. },
  22222. sameElse: 'L'
  22223. },
  22224. relativeTime : {
  22225. future : 'za %s',
  22226. past : 'pred %s',
  22227. s : sk__translate,
  22228. m : sk__translate,
  22229. mm : sk__translate,
  22230. h : sk__translate,
  22231. hh : sk__translate,
  22232. d : sk__translate,
  22233. dd : sk__translate,
  22234. M : sk__translate,
  22235. MM : sk__translate,
  22236. y : sk__translate,
  22237. yy : sk__translate
  22238. },
  22239. ordinalParse: /\d{1,2}\./,
  22240. ordinal : '%d.',
  22241. week : {
  22242. dow : 1, // Monday is the first day of the week.
  22243. doy : 4 // The week that contains Jan 4th is the first week of the year.
  22244. }
  22245. });
  22246. //! moment.js locale configuration
  22247. //! locale : slovenian (sl)
  22248. //! author : Robert Sedovšek : https://github.com/sedovsek
  22249. function sl__processRelativeTime(number, withoutSuffix, key, isFuture) {
  22250. var result = number + ' ';
  22251. switch (key) {
  22252. case 's':
  22253. return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
  22254. case 'm':
  22255. return withoutSuffix ? 'ena minuta' : 'eno minuto';
  22256. case 'mm':
  22257. if (number === 1) {
  22258. result += withoutSuffix ? 'minuta' : 'minuto';
  22259. } else if (number === 2) {
  22260. result += withoutSuffix || isFuture ? 'minuti' : 'minutama';
  22261. } else if (number < 5) {
  22262. result += withoutSuffix || isFuture ? 'minute' : 'minutami';
  22263. } else {
  22264. result += withoutSuffix || isFuture ? 'minut' : 'minutami';
  22265. }
  22266. return result;
  22267. case 'h':
  22268. return withoutSuffix ? 'ena ura' : 'eno uro';
  22269. case 'hh':
  22270. if (number === 1) {
  22271. result += withoutSuffix ? 'ura' : 'uro';
  22272. } else if (number === 2) {
  22273. result += withoutSuffix || isFuture ? 'uri' : 'urama';
  22274. } else if (number < 5) {
  22275. result += withoutSuffix || isFuture ? 'ure' : 'urami';
  22276. } else {
  22277. result += withoutSuffix || isFuture ? 'ur' : 'urami';
  22278. }
  22279. return result;
  22280. case 'd':
  22281. return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
  22282. case 'dd':
  22283. if (number === 1) {
  22284. result += withoutSuffix || isFuture ? 'dan' : 'dnem';
  22285. } else if (number === 2) {
  22286. result += withoutSuffix || isFuture ? 'dni' : 'dnevoma';
  22287. } else {
  22288. result += withoutSuffix || isFuture ? 'dni' : 'dnevi';
  22289. }
  22290. return result;
  22291. case 'M':
  22292. return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
  22293. case 'MM':
  22294. if (number === 1) {
  22295. result += withoutSuffix || isFuture ? 'mesec' : 'mesecem';
  22296. } else if (number === 2) {
  22297. result += withoutSuffix || isFuture ? 'meseca' : 'mesecema';
  22298. } else if (number < 5) {
  22299. result += withoutSuffix || isFuture ? 'mesece' : 'meseci';
  22300. } else {
  22301. result += withoutSuffix || isFuture ? 'mesecev' : 'meseci';
  22302. }
  22303. return result;
  22304. case 'y':
  22305. return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
  22306. case 'yy':
  22307. if (number === 1) {
  22308. result += withoutSuffix || isFuture ? 'leto' : 'letom';
  22309. } else if (number === 2) {
  22310. result += withoutSuffix || isFuture ? 'leti' : 'letoma';
  22311. } else if (number < 5) {
  22312. result += withoutSuffix || isFuture ? 'leta' : 'leti';
  22313. } else {
  22314. result += withoutSuffix || isFuture ? 'let' : 'leti';
  22315. }
  22316. return result;
  22317. }
  22318. }
  22319. var sl = _moment__default.defineLocale('sl', {
  22320. months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'),
  22321. monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'),
  22322. weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
  22323. weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
  22324. weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'),
  22325. longDateFormat : {
  22326. LT : 'H:mm',
  22327. LTS : 'H:mm:ss',
  22328. L : 'DD. MM. YYYY',
  22329. LL : 'D. MMMM YYYY',
  22330. LLL : 'D. MMMM YYYY H:mm',
  22331. LLLL : 'dddd, D. MMMM YYYY H:mm'
  22332. },
  22333. calendar : {
  22334. sameDay : '[danes ob] LT',
  22335. nextDay : '[jutri ob] LT',
  22336. nextWeek : function () {
  22337. switch (this.day()) {
  22338. case 0:
  22339. return '[v] [nedeljo] [ob] LT';
  22340. case 3:
  22341. return '[v] [sredo] [ob] LT';
  22342. case 6:
  22343. return '[v] [soboto] [ob] LT';
  22344. case 1:
  22345. case 2:
  22346. case 4:
  22347. case 5:
  22348. return '[v] dddd [ob] LT';
  22349. }
  22350. },
  22351. lastDay : '[včeraj ob] LT',
  22352. lastWeek : function () {
  22353. switch (this.day()) {
  22354. case 0:
  22355. return '[prejšnjo] [nedeljo] [ob] LT';
  22356. case 3:
  22357. return '[prejšnjo] [sredo] [ob] LT';
  22358. case 6:
  22359. return '[prejšnjo] [soboto] [ob] LT';
  22360. case 1:
  22361. case 2:
  22362. case 4:
  22363. case 5:
  22364. return '[prejšnji] dddd [ob] LT';
  22365. }
  22366. },
  22367. sameElse : 'L'
  22368. },
  22369. relativeTime : {
  22370. future : 'čez %s',
  22371. past : 'pred %s',
  22372. s : sl__processRelativeTime,
  22373. m : sl__processRelativeTime,
  22374. mm : sl__processRelativeTime,
  22375. h : sl__processRelativeTime,
  22376. hh : sl__processRelativeTime,
  22377. d : sl__processRelativeTime,
  22378. dd : sl__processRelativeTime,
  22379. M : sl__processRelativeTime,
  22380. MM : sl__processRelativeTime,
  22381. y : sl__processRelativeTime,
  22382. yy : sl__processRelativeTime
  22383. },
  22384. ordinalParse: /\d{1,2}\./,
  22385. ordinal : '%d.',
  22386. week : {
  22387. dow : 1, // Monday is the first day of the week.
  22388. doy : 7 // The week that contains Jan 1st is the first week of the year.
  22389. }
  22390. });
  22391. //! moment.js locale configuration
  22392. //! locale : Albanian (sq)
  22393. //! author : Flakërim Ismani : https://github.com/flakerimi
  22394. //! author: Menelion Elensúle: https://github.com/Oire (tests)
  22395. //! author : Oerd Cukalla : https://github.com/oerd (fixes)
  22396. var sq = _moment__default.defineLocale('sq', {
  22397. months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'),
  22398. monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'),
  22399. weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'),
  22400. weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'),
  22401. weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'),
  22402. meridiemParse: /PD|MD/,
  22403. isPM: function (input) {
  22404. return input.charAt(0) === 'M';
  22405. },
  22406. meridiem : function (hours, minutes, isLower) {
  22407. return hours < 12 ? 'PD' : 'MD';
  22408. },
  22409. longDateFormat : {
  22410. LT : 'HH:mm',
  22411. LTS : 'HH:mm:ss',
  22412. L : 'DD/MM/YYYY',
  22413. LL : 'D MMMM YYYY',
  22414. LLL : 'D MMMM YYYY HH:mm',
  22415. LLLL : 'dddd, D MMMM YYYY HH:mm'
  22416. },
  22417. calendar : {
  22418. sameDay : '[Sot në] LT',
  22419. nextDay : '[Nesër në] LT',
  22420. nextWeek : 'dddd [në] LT',
  22421. lastDay : '[Dje në] LT',
  22422. lastWeek : 'dddd [e kaluar në] LT',
  22423. sameElse : 'L'
  22424. },
  22425. relativeTime : {
  22426. future : 'në %s',
  22427. past : '%s më parë',
  22428. s : 'disa sekonda',
  22429. m : 'një minutë',
  22430. mm : '%d minuta',
  22431. h : 'një orë',
  22432. hh : '%d orë',
  22433. d : 'një ditë',
  22434. dd : '%d ditë',
  22435. M : 'një muaj',
  22436. MM : '%d muaj',
  22437. y : 'një vit',
  22438. yy : '%d vite'
  22439. },
  22440. ordinalParse: /\d{1,2}\./,
  22441. ordinal : '%d.',
  22442. week : {
  22443. dow : 1, // Monday is the first day of the week.
  22444. doy : 4 // The week that contains Jan 4th is the first week of the year.
  22445. }
  22446. });
  22447. //! moment.js locale configuration
  22448. //! locale : Serbian-cyrillic (sr-cyrl)
  22449. //! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
  22450. var sr_cyrl__translator = {
  22451. words: { //Different grammatical cases
  22452. m: ['један минут', 'једне минуте'],
  22453. mm: ['минут', 'минуте', 'минута'],
  22454. h: ['један сат', 'једног сата'],
  22455. hh: ['сат', 'сата', 'сати'],
  22456. dd: ['дан', 'дана', 'дана'],
  22457. MM: ['месец', 'месеца', 'месеци'],
  22458. yy: ['година', 'године', 'година']
  22459. },
  22460. correctGrammaticalCase: function (number, wordKey) {
  22461. return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
  22462. },
  22463. translate: function (number, withoutSuffix, key) {
  22464. var wordKey = sr_cyrl__translator.words[key];
  22465. if (key.length === 1) {
  22466. return withoutSuffix ? wordKey[0] : wordKey[1];
  22467. } else {
  22468. return number + ' ' + sr_cyrl__translator.correctGrammaticalCase(number, wordKey);
  22469. }
  22470. }
  22471. };
  22472. var sr_cyrl = _moment__default.defineLocale('sr-cyrl', {
  22473. months: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'],
  22474. monthsShort: ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'],
  22475. weekdays: ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'],
  22476. weekdaysShort: ['нед.', 'пон.', 'уто.', 'сре.', 'чет.', 'пет.', 'суб.'],
  22477. weekdaysMin: ['не', 'по', 'ут', 'ср', 'че', 'пе', 'су'],
  22478. longDateFormat: {
  22479. LT: 'H:mm',
  22480. LTS : 'H:mm:ss',
  22481. L: 'DD. MM. YYYY',
  22482. LL: 'D. MMMM YYYY',
  22483. LLL: 'D. MMMM YYYY H:mm',
  22484. LLLL: 'dddd, D. MMMM YYYY H:mm'
  22485. },
  22486. calendar: {
  22487. sameDay: '[данас у] LT',
  22488. nextDay: '[сутра у] LT',
  22489. nextWeek: function () {
  22490. switch (this.day()) {
  22491. case 0:
  22492. return '[у] [недељу] [у] LT';
  22493. case 3:
  22494. return '[у] [среду] [у] LT';
  22495. case 6:
  22496. return '[у] [суботу] [у] LT';
  22497. case 1:
  22498. case 2:
  22499. case 4:
  22500. case 5:
  22501. return '[у] dddd [у] LT';
  22502. }
  22503. },
  22504. lastDay : '[јуче у] LT',
  22505. lastWeek : function () {
  22506. var lastWeekDays = [
  22507. '[прошле] [недеље] [у] LT',
  22508. '[прошлог] [понедељка] [у] LT',
  22509. '[прошлог] [уторка] [у] LT',
  22510. '[прошле] [среде] [у] LT',
  22511. '[прошлог] [четвртка] [у] LT',
  22512. '[прошлог] [петка] [у] LT',
  22513. '[прошле] [суботе] [у] LT'
  22514. ];
  22515. return lastWeekDays[this.day()];
  22516. },
  22517. sameElse : 'L'
  22518. },
  22519. relativeTime : {
  22520. future : 'за %s',
  22521. past : 'пре %s',
  22522. s : 'неколико секунди',
  22523. m : sr_cyrl__translator.translate,
  22524. mm : sr_cyrl__translator.translate,
  22525. h : sr_cyrl__translator.translate,
  22526. hh : sr_cyrl__translator.translate,
  22527. d : 'дан',
  22528. dd : sr_cyrl__translator.translate,
  22529. M : 'месец',
  22530. MM : sr_cyrl__translator.translate,
  22531. y : 'годину',
  22532. yy : sr_cyrl__translator.translate
  22533. },
  22534. ordinalParse: /\d{1,2}\./,
  22535. ordinal : '%d.',
  22536. week : {
  22537. dow : 1, // Monday is the first day of the week.
  22538. doy : 7 // The week that contains Jan 1st is the first week of the year.
  22539. }
  22540. });
  22541. //! moment.js locale configuration
  22542. //! locale : Serbian-latin (sr)
  22543. //! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
  22544. var sr__translator = {
  22545. words: { //Different grammatical cases
  22546. m: ['jedan minut', 'jedne minute'],
  22547. mm: ['minut', 'minute', 'minuta'],
  22548. h: ['jedan sat', 'jednog sata'],
  22549. hh: ['sat', 'sata', 'sati'],
  22550. dd: ['dan', 'dana', 'dana'],
  22551. MM: ['mesec', 'meseca', 'meseci'],
  22552. yy: ['godina', 'godine', 'godina']
  22553. },
  22554. correctGrammaticalCase: function (number, wordKey) {
  22555. return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
  22556. },
  22557. translate: function (number, withoutSuffix, key) {
  22558. var wordKey = sr__translator.words[key];
  22559. if (key.length === 1) {
  22560. return withoutSuffix ? wordKey[0] : wordKey[1];
  22561. } else {
  22562. return number + ' ' + sr__translator.correctGrammaticalCase(number, wordKey);
  22563. }
  22564. }
  22565. };
  22566. var sr = _moment__default.defineLocale('sr', {
  22567. months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
  22568. monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
  22569. weekdays: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
  22570. weekdaysShort: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
  22571. weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
  22572. longDateFormat: {
  22573. LT: 'H:mm',
  22574. LTS : 'H:mm:ss',
  22575. L: 'DD. MM. YYYY',
  22576. LL: 'D. MMMM YYYY',
  22577. LLL: 'D. MMMM YYYY H:mm',
  22578. LLLL: 'dddd, D. MMMM YYYY H:mm'
  22579. },
  22580. calendar: {
  22581. sameDay: '[danas u] LT',
  22582. nextDay: '[sutra u] LT',
  22583. nextWeek: function () {
  22584. switch (this.day()) {
  22585. case 0:
  22586. return '[u] [nedelju] [u] LT';
  22587. case 3:
  22588. return '[u] [sredu] [u] LT';
  22589. case 6:
  22590. return '[u] [subotu] [u] LT';
  22591. case 1:
  22592. case 2:
  22593. case 4:
  22594. case 5:
  22595. return '[u] dddd [u] LT';
  22596. }
  22597. },
  22598. lastDay : '[juče u] LT',
  22599. lastWeek : function () {
  22600. var lastWeekDays = [
  22601. '[prošle] [nedelje] [u] LT',
  22602. '[prošlog] [ponedeljka] [u] LT',
  22603. '[prošlog] [utorka] [u] LT',
  22604. '[prošle] [srede] [u] LT',
  22605. '[prošlog] [četvrtka] [u] LT',
  22606. '[prošlog] [petka] [u] LT',
  22607. '[prošle] [subote] [u] LT'
  22608. ];
  22609. return lastWeekDays[this.day()];
  22610. },
  22611. sameElse : 'L'
  22612. },
  22613. relativeTime : {
  22614. future : 'za %s',
  22615. past : 'pre %s',
  22616. s : 'nekoliko sekundi',
  22617. m : sr__translator.translate,
  22618. mm : sr__translator.translate,
  22619. h : sr__translator.translate,
  22620. hh : sr__translator.translate,
  22621. d : 'dan',
  22622. dd : sr__translator.translate,
  22623. M : 'mesec',
  22624. MM : sr__translator.translate,
  22625. y : 'godinu',
  22626. yy : sr__translator.translate
  22627. },
  22628. ordinalParse: /\d{1,2}\./,
  22629. ordinal : '%d.',
  22630. week : {
  22631. dow : 1, // Monday is the first day of the week.
  22632. doy : 7 // The week that contains Jan 1st is the first week of the year.
  22633. }
  22634. });
  22635. //! moment.js locale configuration
  22636. //! locale : swedish (sv)
  22637. //! author : Jens Alm : https://github.com/ulmus
  22638. var sv = _moment__default.defineLocale('sv', {
  22639. months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'),
  22640. monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
  22641. weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'),
  22642. weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'),
  22643. weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'),
  22644. longDateFormat : {
  22645. LT : 'HH:mm',
  22646. LTS : 'HH:mm:ss',
  22647. L : 'YYYY-MM-DD',
  22648. LL : 'D MMMM YYYY',
  22649. LLL : 'D MMMM YYYY HH:mm',
  22650. LLLL : 'dddd D MMMM YYYY HH:mm'
  22651. },
  22652. calendar : {
  22653. sameDay: '[Idag] LT',
  22654. nextDay: '[Imorgon] LT',
  22655. lastDay: '[Igår] LT',
  22656. nextWeek: '[På] dddd LT',
  22657. lastWeek: '[I] dddd[s] LT',
  22658. sameElse: 'L'
  22659. },
  22660. relativeTime : {
  22661. future : 'om %s',
  22662. past : 'för %s sedan',
  22663. s : 'några sekunder',
  22664. m : 'en minut',
  22665. mm : '%d minuter',
  22666. h : 'en timme',
  22667. hh : '%d timmar',
  22668. d : 'en dag',
  22669. dd : '%d dagar',
  22670. M : 'en månad',
  22671. MM : '%d månader',
  22672. y : 'ett år',
  22673. yy : '%d år'
  22674. },
  22675. ordinalParse: /\d{1,2}(e|a)/,
  22676. ordinal : function (number) {
  22677. var b = number % 10,
  22678. output = (~~(number % 100 / 10) === 1) ? 'e' :
  22679. (b === 1) ? 'a' :
  22680. (b === 2) ? 'a' :
  22681. (b === 3) ? 'e' : 'e';
  22682. return number + output;
  22683. },
  22684. week : {
  22685. dow : 1, // Monday is the first day of the week.
  22686. doy : 4 // The week that contains Jan 4th is the first week of the year.
  22687. }
  22688. });
  22689. //! moment.js locale configuration
  22690. //! locale : tamil (ta)
  22691. //! author : Arjunkumar Krishnamoorthy : https://github.com/tk120404
  22692. var ta = _moment__default.defineLocale('ta', {
  22693. months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
  22694. monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
  22695. weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'),
  22696. weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'),
  22697. weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'),
  22698. longDateFormat : {
  22699. LT : 'HH:mm',
  22700. LTS : 'HH:mm:ss',
  22701. L : 'DD/MM/YYYY',
  22702. LL : 'D MMMM YYYY',
  22703. LLL : 'D MMMM YYYY, HH:mm',
  22704. LLLL : 'dddd, D MMMM YYYY, HH:mm'
  22705. },
  22706. calendar : {
  22707. sameDay : '[இன்று] LT',
  22708. nextDay : '[நாளை] LT',
  22709. nextWeek : 'dddd, LT',
  22710. lastDay : '[நேற்று] LT',
  22711. lastWeek : '[கடந்த வாரம்] dddd, LT',
  22712. sameElse : 'L'
  22713. },
  22714. relativeTime : {
  22715. future : '%s இல்',
  22716. past : '%s முன்',
  22717. s : 'ஒரு சில விநாடிகள்',
  22718. m : 'ஒரு நிமிடம்',
  22719. mm : '%d நிமிடங்கள்',
  22720. h : 'ஒரு மணி நேரம்',
  22721. hh : '%d மணி நேரம்',
  22722. d : 'ஒரு நாள்',
  22723. dd : '%d நாட்கள்',
  22724. M : 'ஒரு மாதம்',
  22725. MM : '%d மாதங்கள்',
  22726. y : 'ஒரு வருடம்',
  22727. yy : '%d ஆண்டுகள்'
  22728. },
  22729. ordinalParse: /\d{1,2}வது/,
  22730. ordinal : function (number) {
  22731. return number + 'வது';
  22732. },
  22733. // refer http://ta.wikipedia.org/s/1er1
  22734. meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,
  22735. meridiem : function (hour, minute, isLower) {
  22736. if (hour < 2) {
  22737. return ' யாமம்';
  22738. } else if (hour < 6) {
  22739. return ' வைகறை'; // வைகறை
  22740. } else if (hour < 10) {
  22741. return ' காலை'; // காலை
  22742. } else if (hour < 14) {
  22743. return ' நண்பகல்'; // நண்பகல்
  22744. } else if (hour < 18) {
  22745. return ' எற்பாடு'; // எற்பாடு
  22746. } else if (hour < 22) {
  22747. return ' மாலை'; // மாலை
  22748. } else {
  22749. return ' யாமம்';
  22750. }
  22751. },
  22752. meridiemHour : function (hour, meridiem) {
  22753. if (hour === 12) {
  22754. hour = 0;
  22755. }
  22756. if (meridiem === 'யாமம்') {
  22757. return hour < 2 ? hour : hour + 12;
  22758. } else if (meridiem === 'வைகறை' || meridiem === 'காலை') {
  22759. return hour;
  22760. } else if (meridiem === 'நண்பகல்') {
  22761. return hour >= 10 ? hour : hour + 12;
  22762. } else {
  22763. return hour + 12;
  22764. }
  22765. },
  22766. week : {
  22767. dow : 0, // Sunday is the first day of the week.
  22768. doy : 6 // The week that contains Jan 1st is the first week of the year.
  22769. }
  22770. });
  22771. //! moment.js locale configuration
  22772. //! locale : thai (th)
  22773. //! author : Kridsada Thanabulpong : https://github.com/sirn
  22774. var th = _moment__default.defineLocale('th', {
  22775. months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'),
  22776. monthsShort : 'มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา'.split('_'),
  22777. weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'),
  22778. weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference
  22779. weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'),
  22780. longDateFormat : {
  22781. LT : 'H นาฬิกา m นาที',
  22782. LTS : 'H นาฬิกา m นาที s วินาที',
  22783. L : 'YYYY/MM/DD',
  22784. LL : 'D MMMM YYYY',
  22785. LLL : 'D MMMM YYYY เวลา H นาฬิกา m นาที',
  22786. LLLL : 'วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที'
  22787. },
  22788. meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/,
  22789. isPM: function (input) {
  22790. return input === 'หลังเที่ยง';
  22791. },
  22792. meridiem : function (hour, minute, isLower) {
  22793. if (hour < 12) {
  22794. return 'ก่อนเที่ยง';
  22795. } else {
  22796. return 'หลังเที่ยง';
  22797. }
  22798. },
  22799. calendar : {
  22800. sameDay : '[วันนี้ เวลา] LT',
  22801. nextDay : '[พรุ่งนี้ เวลา] LT',
  22802. nextWeek : 'dddd[หน้า เวลา] LT',
  22803. lastDay : '[เมื่อวานนี้ เวลา] LT',
  22804. lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT',
  22805. sameElse : 'L'
  22806. },
  22807. relativeTime : {
  22808. future : 'อีก %s',
  22809. past : '%sที่แล้ว',
  22810. s : 'ไม่กี่วินาที',
  22811. m : '1 นาที',
  22812. mm : '%d นาที',
  22813. h : '1 ชั่วโมง',
  22814. hh : '%d ชั่วโมง',
  22815. d : '1 วัน',
  22816. dd : '%d วัน',
  22817. M : '1 เดือน',
  22818. MM : '%d เดือน',
  22819. y : '1 ปี',
  22820. yy : '%d ปี'
  22821. }
  22822. });
  22823. //! moment.js locale configuration
  22824. //! locale : Tagalog/Filipino (tl-ph)
  22825. //! author : Dan Hagman
  22826. var tl_ph = _moment__default.defineLocale('tl-ph', {
  22827. months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'),
  22828. monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'),
  22829. weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'),
  22830. weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'),
  22831. weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'),
  22832. longDateFormat : {
  22833. LT : 'HH:mm',
  22834. LTS : 'HH:mm:ss',
  22835. L : 'MM/D/YYYY',
  22836. LL : 'MMMM D, YYYY',
  22837. LLL : 'MMMM D, YYYY HH:mm',
  22838. LLLL : 'dddd, MMMM DD, YYYY HH:mm'
  22839. },
  22840. calendar : {
  22841. sameDay: '[Ngayon sa] LT',
  22842. nextDay: '[Bukas sa] LT',
  22843. nextWeek: 'dddd [sa] LT',
  22844. lastDay: '[Kahapon sa] LT',
  22845. lastWeek: 'dddd [huling linggo] LT',
  22846. sameElse: 'L'
  22847. },
  22848. relativeTime : {
  22849. future : 'sa loob ng %s',
  22850. past : '%s ang nakalipas',
  22851. s : 'ilang segundo',
  22852. m : 'isang minuto',
  22853. mm : '%d minuto',
  22854. h : 'isang oras',
  22855. hh : '%d oras',
  22856. d : 'isang araw',
  22857. dd : '%d araw',
  22858. M : 'isang buwan',
  22859. MM : '%d buwan',
  22860. y : 'isang taon',
  22861. yy : '%d taon'
  22862. },
  22863. ordinalParse: /\d{1,2}/,
  22864. ordinal : function (number) {
  22865. return number;
  22866. },
  22867. week : {
  22868. dow : 1, // Monday is the first day of the week.
  22869. doy : 4 // The week that contains Jan 4th is the first week of the year.
  22870. }
  22871. });
  22872. //! moment.js locale configuration
  22873. //! locale : turkish (tr)
  22874. //! authors : Erhan Gundogan : https://github.com/erhangundogan,
  22875. //! Burak Yiğit Kaya: https://github.com/BYK
  22876. var tr__suffixes = {
  22877. 1: '\'inci',
  22878. 5: '\'inci',
  22879. 8: '\'inci',
  22880. 70: '\'inci',
  22881. 80: '\'inci',
  22882. 2: '\'nci',
  22883. 7: '\'nci',
  22884. 20: '\'nci',
  22885. 50: '\'nci',
  22886. 3: '\'üncü',
  22887. 4: '\'üncü',
  22888. 100: '\'üncü',
  22889. 6: '\'ncı',
  22890. 9: '\'uncu',
  22891. 10: '\'uncu',
  22892. 30: '\'uncu',
  22893. 60: '\'ıncı',
  22894. 90: '\'ıncı'
  22895. };
  22896. var tr = _moment__default.defineLocale('tr', {
  22897. months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'),
  22898. monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'),
  22899. weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'),
  22900. weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'),
  22901. weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'),
  22902. longDateFormat : {
  22903. LT : 'HH:mm',
  22904. LTS : 'HH:mm:ss',
  22905. L : 'DD.MM.YYYY',
  22906. LL : 'D MMMM YYYY',
  22907. LLL : 'D MMMM YYYY HH:mm',
  22908. LLLL : 'dddd, D MMMM YYYY HH:mm'
  22909. },
  22910. calendar : {
  22911. sameDay : '[bugün saat] LT',
  22912. nextDay : '[yarın saat] LT',
  22913. nextWeek : '[haftaya] dddd [saat] LT',
  22914. lastDay : '[dün] LT',
  22915. lastWeek : '[geçen hafta] dddd [saat] LT',
  22916. sameElse : 'L'
  22917. },
  22918. relativeTime : {
  22919. future : '%s sonra',
  22920. past : '%s önce',
  22921. s : 'birkaç saniye',
  22922. m : 'bir dakika',
  22923. mm : '%d dakika',
  22924. h : 'bir saat',
  22925. hh : '%d saat',
  22926. d : 'bir gün',
  22927. dd : '%d gün',
  22928. M : 'bir ay',
  22929. MM : '%d ay',
  22930. y : 'bir yıl',
  22931. yy : '%d yıl'
  22932. },
  22933. ordinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,
  22934. ordinal : function (number) {
  22935. if (number === 0) { // special case for zero
  22936. return number + '\'ıncı';
  22937. }
  22938. var a = number % 10,
  22939. b = number % 100 - a,
  22940. c = number >= 100 ? 100 : null;
  22941. return number + (tr__suffixes[a] || tr__suffixes[b] || tr__suffixes[c]);
  22942. },
  22943. week : {
  22944. dow : 1, // Monday is the first day of the week.
  22945. doy : 7 // The week that contains Jan 1st is the first week of the year.
  22946. }
  22947. });
  22948. //! moment.js locale configuration
  22949. //! locale : talossan (tzl)
  22950. //! author : Robin van der Vliet : https://github.com/robin0van0der0v with the help of Iustì Canun
  22951. var tzl = _moment__default.defineLocale('tzl', {
  22952. months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'),
  22953. monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'),
  22954. weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'),
  22955. weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'),
  22956. weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'),
  22957. longDateFormat : {
  22958. LT : 'HH.mm',
  22959. LTS : 'LT.ss',
  22960. L : 'DD.MM.YYYY',
  22961. LL : 'D. MMMM [dallas] YYYY',
  22962. LLL : 'D. MMMM [dallas] YYYY LT',
  22963. LLLL : 'dddd, [li] D. MMMM [dallas] YYYY LT'
  22964. },
  22965. meridiem : function (hours, minutes, isLower) {
  22966. if (hours > 11) {
  22967. return isLower ? 'd\'o' : 'D\'O';
  22968. } else {
  22969. return isLower ? 'd\'a' : 'D\'A';
  22970. }
  22971. },
  22972. calendar : {
  22973. sameDay : '[oxhi à] LT',
  22974. nextDay : '[demà à] LT',
  22975. nextWeek : 'dddd [à] LT',
  22976. lastDay : '[ieiri à] LT',
  22977. lastWeek : '[sür el] dddd [lasteu à] LT',
  22978. sameElse : 'L'
  22979. },
  22980. relativeTime : {
  22981. future : 'osprei %s',
  22982. past : 'ja%s',
  22983. s : tzl__processRelativeTime,
  22984. m : tzl__processRelativeTime,
  22985. mm : tzl__processRelativeTime,
  22986. h : tzl__processRelativeTime,
  22987. hh : tzl__processRelativeTime,
  22988. d : tzl__processRelativeTime,
  22989. dd : tzl__processRelativeTime,
  22990. M : tzl__processRelativeTime,
  22991. MM : tzl__processRelativeTime,
  22992. y : tzl__processRelativeTime,
  22993. yy : tzl__processRelativeTime
  22994. },
  22995. ordinalParse: /\d{1,2}\./,
  22996. ordinal : '%d.',
  22997. week : {
  22998. dow : 1, // Monday is the first day of the week.
  22999. doy : 4 // The week that contains Jan 4th is the first week of the year.
  23000. }
  23001. });
  23002. function tzl__processRelativeTime(number, withoutSuffix, key, isFuture) {
  23003. var format = {
  23004. 's': ['viensas secunds', '\'iensas secunds'],
  23005. 'm': ['\'n míut', '\'iens míut'],
  23006. 'mm': [number + ' míuts', ' ' + number + ' míuts'],
  23007. 'h': ['\'n þora', '\'iensa þora'],
  23008. 'hh': [number + ' þoras', ' ' + number + ' þoras'],
  23009. 'd': ['\'n ziua', '\'iensa ziua'],
  23010. 'dd': [number + ' ziuas', ' ' + number + ' ziuas'],
  23011. 'M': ['\'n mes', '\'iens mes'],
  23012. 'MM': [number + ' mesen', ' ' + number + ' mesen'],
  23013. 'y': ['\'n ar', '\'iens ar'],
  23014. 'yy': [number + ' ars', ' ' + number + ' ars']
  23015. };
  23016. return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1].trim());
  23017. }
  23018. //! moment.js locale configuration
  23019. //! locale : Morocco Central Atlas Tamaziɣt in Latin (tzm-latn)
  23020. //! author : Abdel Said : https://github.com/abdelsaid
  23021. var tzm_latn = _moment__default.defineLocale('tzm-latn', {
  23022. months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'),
  23023. monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'),
  23024. weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
  23025. weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
  23026. weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
  23027. longDateFormat : {
  23028. LT : 'HH:mm',
  23029. LTS : 'HH:mm:ss',
  23030. L : 'DD/MM/YYYY',
  23031. LL : 'D MMMM YYYY',
  23032. LLL : 'D MMMM YYYY HH:mm',
  23033. LLLL : 'dddd D MMMM YYYY HH:mm'
  23034. },
  23035. calendar : {
  23036. sameDay: '[asdkh g] LT',
  23037. nextDay: '[aska g] LT',
  23038. nextWeek: 'dddd [g] LT',
  23039. lastDay: '[assant g] LT',
  23040. lastWeek: 'dddd [g] LT',
  23041. sameElse: 'L'
  23042. },
  23043. relativeTime : {
  23044. future : 'dadkh s yan %s',
  23045. past : 'yan %s',
  23046. s : 'imik',
  23047. m : 'minuḍ',
  23048. mm : '%d minuḍ',
  23049. h : 'saɛa',
  23050. hh : '%d tassaɛin',
  23051. d : 'ass',
  23052. dd : '%d ossan',
  23053. M : 'ayowr',
  23054. MM : '%d iyyirn',
  23055. y : 'asgas',
  23056. yy : '%d isgasn'
  23057. },
  23058. week : {
  23059. dow : 6, // Saturday is the first day of the week.
  23060. doy : 12 // The week that contains Jan 1st is the first week of the year.
  23061. }
  23062. });
  23063. //! moment.js locale configuration
  23064. //! locale : Morocco Central Atlas Tamaziɣt (tzm)
  23065. //! author : Abdel Said : https://github.com/abdelsaid
  23066. var tzm = _moment__default.defineLocale('tzm', {
  23067. months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'),
  23068. monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'),
  23069. weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
  23070. weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
  23071. weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
  23072. longDateFormat : {
  23073. LT : 'HH:mm',
  23074. LTS: 'HH:mm:ss',
  23075. L : 'DD/MM/YYYY',
  23076. LL : 'D MMMM YYYY',
  23077. LLL : 'D MMMM YYYY HH:mm',
  23078. LLLL : 'dddd D MMMM YYYY HH:mm'
  23079. },
  23080. calendar : {
  23081. sameDay: '[ⴰⵙⴷⵅ ⴴ] LT',
  23082. nextDay: '[ⴰⵙⴽⴰ ⴴ] LT',
  23083. nextWeek: 'dddd [ⴴ] LT',
  23084. lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT',
  23085. lastWeek: 'dddd [ⴴ] LT',
  23086. sameElse: 'L'
  23087. },
  23088. relativeTime : {
  23089. future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s',
  23090. past : 'ⵢⴰⵏ %s',
  23091. s : 'ⵉⵎⵉⴽ',
  23092. m : 'ⵎⵉⵏⵓⴺ',
  23093. mm : '%d ⵎⵉⵏⵓⴺ',
  23094. h : 'ⵙⴰⵄⴰ',
  23095. hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ',
  23096. d : 'ⴰⵙⵙ',
  23097. dd : '%d oⵙⵙⴰⵏ',
  23098. M : 'ⴰⵢoⵓⵔ',
  23099. MM : '%d ⵉⵢⵢⵉⵔⵏ',
  23100. y : 'ⴰⵙⴳⴰⵙ',
  23101. yy : '%d ⵉⵙⴳⴰⵙⵏ'
  23102. },
  23103. week : {
  23104. dow : 6, // Saturday is the first day of the week.
  23105. doy : 12 // The week that contains Jan 1st is the first week of the year.
  23106. }
  23107. });
  23108. //! moment.js locale configuration
  23109. //! locale : ukrainian (uk)
  23110. //! author : zemlanin : https://github.com/zemlanin
  23111. //! Author : Menelion Elensúle : https://github.com/Oire
  23112. function uk__plural(word, num) {
  23113. var forms = word.split('_');
  23114. return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
  23115. }
  23116. function uk__relativeTimeWithPlural(number, withoutSuffix, key) {
  23117. var format = {
  23118. 'mm': 'хвилина_хвилини_хвилин',
  23119. 'hh': 'година_години_годин',
  23120. 'dd': 'день_дні_днів',
  23121. 'MM': 'місяць_місяці_місяців',
  23122. 'yy': 'рік_роки_років'
  23123. };
  23124. if (key === 'm') {
  23125. return withoutSuffix ? 'хвилина' : 'хвилину';
  23126. }
  23127. else if (key === 'h') {
  23128. return withoutSuffix ? 'година' : 'годину';
  23129. }
  23130. else {
  23131. return number + ' ' + uk__plural(format[key], +number);
  23132. }
  23133. }
  23134. function uk__monthsCaseReplace(m, format) {
  23135. var months = {
  23136. 'nominative': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_'),
  23137. 'accusative': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_')
  23138. },
  23139. nounCase = (/D[oD]? *MMMM?/).test(format) ?
  23140. 'accusative' :
  23141. 'nominative';
  23142. return months[nounCase][m.month()];
  23143. }
  23144. function uk__weekdaysCaseReplace(m, format) {
  23145. var weekdays = {
  23146. 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'),
  23147. 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'),
  23148. 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_')
  23149. },
  23150. nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ?
  23151. 'accusative' :
  23152. ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ?
  23153. 'genitive' :
  23154. 'nominative');
  23155. return weekdays[nounCase][m.day()];
  23156. }
  23157. function processHoursFunction(str) {
  23158. return function () {
  23159. return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT';
  23160. };
  23161. }
  23162. var uk = _moment__default.defineLocale('uk', {
  23163. months : uk__monthsCaseReplace,
  23164. monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'),
  23165. weekdays : uk__weekdaysCaseReplace,
  23166. weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  23167. weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  23168. longDateFormat : {
  23169. LT : 'HH:mm',
  23170. LTS : 'HH:mm:ss',
  23171. L : 'DD.MM.YYYY',
  23172. LL : 'D MMMM YYYY р.',
  23173. LLL : 'D MMMM YYYY р., HH:mm',
  23174. LLLL : 'dddd, D MMMM YYYY р., HH:mm'
  23175. },
  23176. calendar : {
  23177. sameDay: processHoursFunction('[Сьогодні '),
  23178. nextDay: processHoursFunction('[Завтра '),
  23179. lastDay: processHoursFunction('[Вчора '),
  23180. nextWeek: processHoursFunction('[У] dddd ['),
  23181. lastWeek: function () {
  23182. switch (this.day()) {
  23183. case 0:
  23184. case 3:
  23185. case 5:
  23186. case 6:
  23187. return processHoursFunction('[Минулої] dddd [').call(this);
  23188. case 1:
  23189. case 2:
  23190. case 4:
  23191. return processHoursFunction('[Минулого] dddd [').call(this);
  23192. }
  23193. },
  23194. sameElse: 'L'
  23195. },
  23196. relativeTime : {
  23197. future : 'за %s',
  23198. past : '%s тому',
  23199. s : 'декілька секунд',
  23200. m : uk__relativeTimeWithPlural,
  23201. mm : uk__relativeTimeWithPlural,
  23202. h : 'годину',
  23203. hh : uk__relativeTimeWithPlural,
  23204. d : 'день',
  23205. dd : uk__relativeTimeWithPlural,
  23206. M : 'місяць',
  23207. MM : uk__relativeTimeWithPlural,
  23208. y : 'рік',
  23209. yy : uk__relativeTimeWithPlural
  23210. },
  23211. // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
  23212. meridiemParse: /ночі|ранку|дня|вечора/,
  23213. isPM: function (input) {
  23214. return /^(дня|вечора)$/.test(input);
  23215. },
  23216. meridiem : function (hour, minute, isLower) {
  23217. if (hour < 4) {
  23218. return 'ночі';
  23219. } else if (hour < 12) {
  23220. return 'ранку';
  23221. } else if (hour < 17) {
  23222. return 'дня';
  23223. } else {
  23224. return 'вечора';
  23225. }
  23226. },
  23227. ordinalParse: /\d{1,2}-(й|го)/,
  23228. ordinal: function (number, period) {
  23229. switch (period) {
  23230. case 'M':
  23231. case 'd':
  23232. case 'DDD':
  23233. case 'w':
  23234. case 'W':
  23235. return number + '-й';
  23236. case 'D':
  23237. return number + '-го';
  23238. default:
  23239. return number;
  23240. }
  23241. },
  23242. week : {
  23243. dow : 1, // Monday is the first day of the week.
  23244. doy : 7 // The week that contains Jan 1st is the first week of the year.
  23245. }
  23246. });
  23247. //! moment.js locale configuration
  23248. //! locale : uzbek (uz)
  23249. //! author : Sardor Muminov : https://github.com/muminoff
  23250. var uz = _moment__default.defineLocale('uz', {
  23251. months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
  23252. monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
  23253. weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'),
  23254. weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'),
  23255. weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'),
  23256. longDateFormat : {
  23257. LT : 'HH:mm',
  23258. LTS : 'HH:mm:ss',
  23259. L : 'DD/MM/YYYY',
  23260. LL : 'D MMMM YYYY',
  23261. LLL : 'D MMMM YYYY HH:mm',
  23262. LLLL : 'D MMMM YYYY, dddd HH:mm'
  23263. },
  23264. calendar : {
  23265. sameDay : '[Бугун соат] LT [да]',
  23266. nextDay : '[Эртага] LT [да]',
  23267. nextWeek : 'dddd [куни соат] LT [да]',
  23268. lastDay : '[Кеча соат] LT [да]',
  23269. lastWeek : '[Утган] dddd [куни соат] LT [да]',
  23270. sameElse : 'L'
  23271. },
  23272. relativeTime : {
  23273. future : 'Якин %s ичида',
  23274. past : 'Бир неча %s олдин',
  23275. s : 'фурсат',
  23276. m : 'бир дакика',
  23277. mm : '%d дакика',
  23278. h : 'бир соат',
  23279. hh : '%d соат',
  23280. d : 'бир кун',
  23281. dd : '%d кун',
  23282. M : 'бир ой',
  23283. MM : '%d ой',
  23284. y : 'бир йил',
  23285. yy : '%d йил'
  23286. },
  23287. week : {
  23288. dow : 1, // Monday is the first day of the week.
  23289. doy : 7 // The week that contains Jan 4th is the first week of the year.
  23290. }
  23291. });
  23292. //! moment.js locale configuration
  23293. //! locale : vietnamese (vi)
  23294. //! author : Bang Nguyen : https://github.com/bangnk
  23295. var vi = _moment__default.defineLocale('vi', {
  23296. months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'),
  23297. monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'),
  23298. weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'),
  23299. weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
  23300. weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
  23301. longDateFormat : {
  23302. LT : 'HH:mm',
  23303. LTS : 'HH:mm:ss',
  23304. L : 'DD/MM/YYYY',
  23305. LL : 'D MMMM [năm] YYYY',
  23306. LLL : 'D MMMM [năm] YYYY HH:mm',
  23307. LLLL : 'dddd, D MMMM [năm] YYYY HH:mm',
  23308. l : 'DD/M/YYYY',
  23309. ll : 'D MMM YYYY',
  23310. lll : 'D MMM YYYY HH:mm',
  23311. llll : 'ddd, D MMM YYYY HH:mm'
  23312. },
  23313. calendar : {
  23314. sameDay: '[Hôm nay lúc] LT',
  23315. nextDay: '[Ngày mai lúc] LT',
  23316. nextWeek: 'dddd [tuần tới lúc] LT',
  23317. lastDay: '[Hôm qua lúc] LT',
  23318. lastWeek: 'dddd [tuần rồi lúc] LT',
  23319. sameElse: 'L'
  23320. },
  23321. relativeTime : {
  23322. future : '%s tới',
  23323. past : '%s trước',
  23324. s : 'vài giây',
  23325. m : 'một phút',
  23326. mm : '%d phút',
  23327. h : 'một giờ',
  23328. hh : '%d giờ',
  23329. d : 'một ngày',
  23330. dd : '%d ngày',
  23331. M : 'một tháng',
  23332. MM : '%d tháng',
  23333. y : 'một năm',
  23334. yy : '%d năm'
  23335. },
  23336. ordinalParse: /\d{1,2}/,
  23337. ordinal : function (number) {
  23338. return number;
  23339. },
  23340. week : {
  23341. dow : 1, // Monday is the first day of the week.
  23342. doy : 4 // The week that contains Jan 4th is the first week of the year.
  23343. }
  23344. });
  23345. //! moment.js locale configuration
  23346. //! locale : chinese (zh-cn)
  23347. //! author : suupic : https://github.com/suupic
  23348. //! author : Zeno Zeng : https://github.com/zenozeng
  23349. var zh_cn = _moment__default.defineLocale('zh-cn', {
  23350. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  23351. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  23352. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  23353. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  23354. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  23355. longDateFormat : {
  23356. LT : 'Ah点mm分',
  23357. LTS : 'Ah点m分s秒',
  23358. L : 'YYYY-MM-DD',
  23359. LL : 'YYYY年MMMD日',
  23360. LLL : 'YYYY年MMMD日Ah点mm分',
  23361. LLLL : 'YYYY年MMMD日ddddAh点mm分',
  23362. l : 'YYYY-MM-DD',
  23363. ll : 'YYYY年MMMD日',
  23364. lll : 'YYYY年MMMD日Ah点mm分',
  23365. llll : 'YYYY年MMMD日ddddAh点mm分'
  23366. },
  23367. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  23368. meridiemHour: function (hour, meridiem) {
  23369. if (hour === 12) {
  23370. hour = 0;
  23371. }
  23372. if (meridiem === '凌晨' || meridiem === '早上' ||
  23373. meridiem === '上午') {
  23374. return hour;
  23375. } else if (meridiem === '下午' || meridiem === '晚上') {
  23376. return hour + 12;
  23377. } else {
  23378. // '中午'
  23379. return hour >= 11 ? hour : hour + 12;
  23380. }
  23381. },
  23382. meridiem : function (hour, minute, isLower) {
  23383. var hm = hour * 100 + minute;
  23384. if (hm < 600) {
  23385. return '凌晨';
  23386. } else if (hm < 900) {
  23387. return '早上';
  23388. } else if (hm < 1130) {
  23389. return '上午';
  23390. } else if (hm < 1230) {
  23391. return '中午';
  23392. } else if (hm < 1800) {
  23393. return '下午';
  23394. } else {
  23395. return '晚上';
  23396. }
  23397. },
  23398. calendar : {
  23399. sameDay : function () {
  23400. return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
  23401. },
  23402. nextDay : function () {
  23403. return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
  23404. },
  23405. lastDay : function () {
  23406. return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
  23407. },
  23408. nextWeek : function () {
  23409. var startOfWeek, prefix;
  23410. startOfWeek = _moment__default().startOf('week');
  23411. prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
  23412. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  23413. },
  23414. lastWeek : function () {
  23415. var startOfWeek, prefix;
  23416. startOfWeek = _moment__default().startOf('week');
  23417. prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
  23418. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  23419. },
  23420. sameElse : 'LL'
  23421. },
  23422. ordinalParse: /\d{1,2}(日|月|周)/,
  23423. ordinal : function (number, period) {
  23424. switch (period) {
  23425. case 'd':
  23426. case 'D':
  23427. case 'DDD':
  23428. return number + '日';
  23429. case 'M':
  23430. return number + '月';
  23431. case 'w':
  23432. case 'W':
  23433. return number + '周';
  23434. default:
  23435. return number;
  23436. }
  23437. },
  23438. relativeTime : {
  23439. future : '%s内',
  23440. past : '%s前',
  23441. s : '几秒',
  23442. m : '1 分钟',
  23443. mm : '%d 分钟',
  23444. h : '1 小时',
  23445. hh : '%d 小时',
  23446. d : '1 天',
  23447. dd : '%d 天',
  23448. M : '1 个月',
  23449. MM : '%d 个月',
  23450. y : '1 年',
  23451. yy : '%d 年'
  23452. },
  23453. week : {
  23454. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  23455. dow : 1, // Monday is the first day of the week.
  23456. doy : 4 // The week that contains Jan 4th is the first week of the year.
  23457. }
  23458. });
  23459. //! moment.js locale configuration
  23460. //! locale : traditional chinese (zh-tw)
  23461. //! author : Ben : https://github.com/ben-lin
  23462. var zh_tw = _moment__default.defineLocale('zh-tw', {
  23463. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  23464. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  23465. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  23466. weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'),
  23467. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  23468. longDateFormat : {
  23469. LT : 'Ah點mm分',
  23470. LTS : 'Ah點m分s秒',
  23471. L : 'YYYY年MMMD日',
  23472. LL : 'YYYY年MMMD日',
  23473. LLL : 'YYYY年MMMD日Ah點mm分',
  23474. LLLL : 'YYYY年MMMD日ddddAh點mm分',
  23475. l : 'YYYY年MMMD日',
  23476. ll : 'YYYY年MMMD日',
  23477. lll : 'YYYY年MMMD日Ah點mm分',
  23478. llll : 'YYYY年MMMD日ddddAh點mm分'
  23479. },
  23480. meridiemParse: /早上|上午|中午|下午|晚上/,
  23481. meridiemHour : function (hour, meridiem) {
  23482. if (hour === 12) {
  23483. hour = 0;
  23484. }
  23485. if (meridiem === '早上' || meridiem === '上午') {
  23486. return hour;
  23487. } else if (meridiem === '中午') {
  23488. return hour >= 11 ? hour : hour + 12;
  23489. } else if (meridiem === '下午' || meridiem === '晚上') {
  23490. return hour + 12;
  23491. }
  23492. },
  23493. meridiem : function (hour, minute, isLower) {
  23494. var hm = hour * 100 + minute;
  23495. if (hm < 900) {
  23496. return '早上';
  23497. } else if (hm < 1130) {
  23498. return '上午';
  23499. } else if (hm < 1230) {
  23500. return '中午';
  23501. } else if (hm < 1800) {
  23502. return '下午';
  23503. } else {
  23504. return '晚上';
  23505. }
  23506. },
  23507. calendar : {
  23508. sameDay : '[今天]LT',
  23509. nextDay : '[明天]LT',
  23510. nextWeek : '[下]ddddLT',
  23511. lastDay : '[昨天]LT',
  23512. lastWeek : '[上]ddddLT',
  23513. sameElse : 'L'
  23514. },
  23515. ordinalParse: /\d{1,2}(日|月|週)/,
  23516. ordinal : function (number, period) {
  23517. switch (period) {
  23518. case 'd' :
  23519. case 'D' :
  23520. case 'DDD' :
  23521. return number + '日';
  23522. case 'M' :
  23523. return number + '月';
  23524. case 'w' :
  23525. case 'W' :
  23526. return number + '週';
  23527. default :
  23528. return number;
  23529. }
  23530. },
  23531. relativeTime : {
  23532. future : '%s內',
  23533. past : '%s前',
  23534. s : '幾秒',
  23535. m : '一分鐘',
  23536. mm : '%d分鐘',
  23537. h : '一小時',
  23538. hh : '%d小時',
  23539. d : '一天',
  23540. dd : '%d天',
  23541. M : '一個月',
  23542. MM : '%d個月',
  23543. y : '一年',
  23544. yy : '%d年'
  23545. }
  23546. });
  23547. var moment_with_locales = _moment__default;
  23548. moment_with_locales.locale('en');
  23549. return moment_with_locales;
  23550. }));
  23551. /*! version : 4.14.30
  23552. =========================================================
  23553. bootstrap-datetimejs
  23554. https://github.com/Eonasdan/bootstrap-datetimepicker
  23555. Copyright (c) 2015 Jonathan Peterson
  23556. =========================================================
  23557. */
  23558. /*
  23559. The MIT License (MIT)
  23560. Copyright (c) 2015 Jonathan Peterson
  23561. Permission is hereby granted, free of charge, to any person obtaining a copy
  23562. of this software and associated documentation files (the "Software"), to deal
  23563. in the Software without restriction, including without limitation the rights
  23564. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  23565. copies of the Software, and to permit persons to whom the Software is
  23566. furnished to do so, subject to the following conditions:
  23567. The above copyright notice and this permission notice shall be included in
  23568. all copies or substantial portions of the Software.
  23569. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23570. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23571. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  23572. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23573. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23574. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23575. THE SOFTWARE.
  23576. */
  23577. /*global define:false */
  23578. /*global exports:false */
  23579. /*global require:false */
  23580. /*global jQuery:false */
  23581. /*global moment:false */
  23582. (function (factory) {
  23583. 'use strict';
  23584. if (typeof define === 'function' && define.amd) {
  23585. // AMD is used - Register as an anonymous module.
  23586. define(['jquery', 'moment'], factory);
  23587. } else if (typeof exports === 'object') {
  23588. factory(require('jquery'), require('moment'));
  23589. } else {
  23590. // Neither AMD nor CommonJS used. Use global variables.
  23591. if (typeof jQuery === 'undefined') {
  23592. throw 'bootstrap-datetimepicker requires jQuery to be loaded first';
  23593. }
  23594. if (typeof moment === 'undefined') {
  23595. throw 'bootstrap-datetimepicker requires Moment.js to be loaded first';
  23596. }
  23597. factory(jQuery, moment);
  23598. }
  23599. }(function ($, moment) {
  23600. 'use strict';
  23601. if (!moment) {
  23602. throw new Error('bootstrap-datetimepicker requires Moment.js to be loaded first');
  23603. }
  23604. var dateTimePicker = function (element, options) {
  23605. var picker = {},
  23606. date = moment().startOf('d'),
  23607. viewDate = date.clone(),
  23608. unset = true,
  23609. input,
  23610. component = false,
  23611. widget = false,
  23612. use24Hours,
  23613. minViewModeNumber = 0,
  23614. actualFormat,
  23615. parseFormats,
  23616. currentViewMode,
  23617. datePickerModes = [
  23618. {
  23619. clsName: 'days',
  23620. navFnc: 'M',
  23621. navStep: 1
  23622. },
  23623. {
  23624. clsName: 'months',
  23625. navFnc: 'y',
  23626. navStep: 1
  23627. },
  23628. {
  23629. clsName: 'years',
  23630. navFnc: 'y',
  23631. navStep: 10
  23632. },
  23633. {
  23634. clsName: 'decades',
  23635. navFnc: 'y',
  23636. navStep: 100
  23637. }
  23638. ],
  23639. viewModes = ['days', 'months', 'years', 'decades'],
  23640. verticalModes = ['top', 'bottom', 'auto'],
  23641. horizontalModes = ['left', 'right', 'auto'],
  23642. toolbarPlacements = ['default', 'top', 'bottom'],
  23643. keyMap = {
  23644. 'up': 38,
  23645. 38: 'up',
  23646. 'down': 40,
  23647. 40: 'down',
  23648. 'left': 37,
  23649. 37: 'left',
  23650. 'right': 39,
  23651. 39: 'right',
  23652. 'tab': 9,
  23653. 9: 'tab',
  23654. 'escape': 27,
  23655. 27: 'escape',
  23656. 'enter': 13,
  23657. 13: 'enter',
  23658. 'pageUp': 33,
  23659. 33: 'pageUp',
  23660. 'pageDown': 34,
  23661. 34: 'pageDown',
  23662. 'shift': 16,
  23663. 16: 'shift',
  23664. 'control': 17,
  23665. 17: 'control',
  23666. 'space': 32,
  23667. 32: 'space',
  23668. 't': 84,
  23669. 84: 't',
  23670. 'delete': 46,
  23671. 46: 'delete'
  23672. },
  23673. keyState = {},
  23674. /********************************************************************************
  23675. *
  23676. * Private functions
  23677. *
  23678. ********************************************************************************/
  23679. isEnabled = function (granularity) {
  23680. if (typeof granularity !== 'string' || granularity.length > 1) {
  23681. throw new TypeError('isEnabled expects a single character string parameter');
  23682. }
  23683. switch (granularity) {
  23684. case 'y':
  23685. return actualFormat.indexOf('Y') !== -1;
  23686. case 'M':
  23687. return actualFormat.indexOf('M') !== -1;
  23688. case 'd':
  23689. return actualFormat.toLowerCase().indexOf('d') !== -1;
  23690. case 'h':
  23691. case 'H':
  23692. return actualFormat.toLowerCase().indexOf('h') !== -1;
  23693. case 'm':
  23694. return actualFormat.indexOf('m') !== -1;
  23695. case 's':
  23696. return actualFormat.indexOf('s') !== -1;
  23697. default:
  23698. return false;
  23699. }
  23700. },
  23701. hasTime = function () {
  23702. return (isEnabled('h') || isEnabled('m') || isEnabled('s'));
  23703. },
  23704. hasDate = function () {
  23705. return (isEnabled('y') || isEnabled('M') || isEnabled('d'));
  23706. },
  23707. getDatePickerTemplate = function () {
  23708. var headTemplate = $('<thead>')
  23709. .append($('<tr>')
  23710. .append($('<th>').addClass('prev').attr('data-action', 'previous')
  23711. .append($('<span>').addClass(options.icons.previous))
  23712. )
  23713. .append($('<th>').addClass('picker-switch').attr('data-action', 'pickerSwitch').attr('colspan', (options.calendarWeeks ? '6' : '5')))
  23714. .append($('<th>').addClass('next').attr('data-action', 'next')
  23715. .append($('<span>').addClass(options.icons.next))
  23716. )
  23717. ),
  23718. contTemplate = $('<tbody>')
  23719. .append($('<tr>')
  23720. .append($('<td>').attr('colspan', (options.calendarWeeks ? '8' : '7')))
  23721. );
  23722. return [
  23723. $('<div>').addClass('datepicker-days')
  23724. .append($('<table>').addClass('table-condensed')
  23725. .append(headTemplate)
  23726. .append($('<tbody>'))
  23727. ),
  23728. $('<div>').addClass('datepicker-months')
  23729. .append($('<table>').addClass('table-condensed')
  23730. .append(headTemplate.clone())
  23731. .append(contTemplate.clone())
  23732. ),
  23733. $('<div>').addClass('datepicker-years')
  23734. .append($('<table>').addClass('table-condensed')
  23735. .append(headTemplate.clone())
  23736. .append(contTemplate.clone())
  23737. ),
  23738. $('<div>').addClass('datepicker-decades')
  23739. .append($('<table>').addClass('table-condensed')
  23740. .append(headTemplate.clone())
  23741. .append(contTemplate.clone())
  23742. )
  23743. ];
  23744. },
  23745. getTimePickerMainTemplate = function () {
  23746. var topRow = $('<tr>'),
  23747. middleRow = $('<tr>'),
  23748. bottomRow = $('<tr>');
  23749. if (isEnabled('h')) {
  23750. topRow.append($('<td>')
  23751. .append($('<a>').attr({href: '#', tabindex: '-1', 'title':'Increment Hour'}).addClass('btn').attr('data-action', 'incrementHours')
  23752. .append($('<span>').addClass(options.icons.up))));
  23753. middleRow.append($('<td>')
  23754. .append($('<span>').addClass('timepicker-hour').attr({'data-time-component':'hours', 'title':'Pick Hour'}).attr('data-action', 'showHours')));
  23755. bottomRow.append($('<td>')
  23756. .append($('<a>').attr({href: '#', tabindex: '-1', 'title':'Decrement Hour'}).addClass('btn').attr('data-action', 'decrementHours')
  23757. .append($('<span>').addClass(options.icons.down))));
  23758. }
  23759. if (isEnabled('m')) {
  23760. if (isEnabled('h')) {
  23761. topRow.append($('<td>').addClass('separator'));
  23762. middleRow.append($('<td>').addClass('separator').html(':'));
  23763. bottomRow.append($('<td>').addClass('separator'));
  23764. }
  23765. topRow.append($('<td>')
  23766. .append($('<a>').attr({href: '#', tabindex: '-1', 'title':'Increment Minute'}).addClass('btn').attr('data-action', 'incrementMinutes')
  23767. .append($('<span>').addClass(options.icons.up))));
  23768. middleRow.append($('<td>')
  23769. .append($('<span>').addClass('timepicker-minute').attr({'data-time-component': 'minutes', 'title':'Pick Minute'}).attr('data-action', 'showMinutes')));
  23770. bottomRow.append($('<td>')
  23771. .append($('<a>').attr({href: '#', tabindex: '-1', 'title':'Decrement Minute'}).addClass('btn').attr('data-action', 'decrementMinutes')
  23772. .append($('<span>').addClass(options.icons.down))));
  23773. }
  23774. if (isEnabled('s')) {
  23775. if (isEnabled('m')) {
  23776. topRow.append($('<td>').addClass('separator'));
  23777. middleRow.append($('<td>').addClass('separator').html(':'));
  23778. bottomRow.append($('<td>').addClass('separator'));
  23779. }
  23780. topRow.append($('<td>')
  23781. .append($('<a>').attr({href: '#', tabindex: '-1', 'title':'Increment Second'}).addClass('btn').attr('data-action', 'incrementSeconds')
  23782. .append($('<span>').addClass(options.icons.up))));
  23783. middleRow.append($('<td>')
  23784. .append($('<span>').addClass('timepicker-second').attr({'data-time-component': 'seconds', 'title':'Pick Second'}).attr('data-action', 'showSeconds')));
  23785. bottomRow.append($('<td>')
  23786. .append($('<a>').attr({href: '#', tabindex: '-1', 'title':'Decrement Second'}).addClass('btn').attr('data-action', 'decrementSeconds')
  23787. .append($('<span>').addClass(options.icons.down))));
  23788. }
  23789. if (!use24Hours) {
  23790. topRow.append($('<td>').addClass('separator'));
  23791. middleRow.append($('<td>')
  23792. .append($('<button>').addClass('btn btn-primary').attr({'data-action': 'togglePeriod', tabindex: '-1', 'title':'Toggle Period'})));
  23793. bottomRow.append($('<td>').addClass('separator'));
  23794. }
  23795. return $('<div>').addClass('timepicker-picker')
  23796. .append($('<table>').addClass('table-condensed')
  23797. .append([topRow, middleRow, bottomRow]));
  23798. },
  23799. getTimePickerTemplate = function () {
  23800. var hoursView = $('<div>').addClass('timepicker-hours')
  23801. .append($('<table>').addClass('table-condensed')),
  23802. minutesView = $('<div>').addClass('timepicker-minutes')
  23803. .append($('<table>').addClass('table-condensed')),
  23804. secondsView = $('<div>').addClass('timepicker-seconds')
  23805. .append($('<table>').addClass('table-condensed')),
  23806. ret = [getTimePickerMainTemplate()];
  23807. if (isEnabled('h')) {
  23808. ret.push(hoursView);
  23809. }
  23810. if (isEnabled('m')) {
  23811. ret.push(minutesView);
  23812. }
  23813. if (isEnabled('s')) {
  23814. ret.push(secondsView);
  23815. }
  23816. return ret;
  23817. },
  23818. getToolbar = function () {
  23819. var row = [];
  23820. if (options.showTodayButton) {
  23821. row.push($('<td>').append($('<a>').attr({'data-action':'today', 'title':'Go to today'}).append($('<span>').addClass(options.icons.today))));
  23822. }
  23823. if (!options.sideBySide && hasDate() && hasTime()) {
  23824. row.push($('<td>').append($('<a>').attr({'data-action':'togglePicker', 'title':'Select Time'}).append($('<span>').addClass(options.icons.time))));
  23825. }
  23826. if (options.showClear) {
  23827. row.push($('<td>').append($('<a>').attr({'data-action':'clear', 'title':'Clear selection'}).append($('<span>').addClass(options.icons.clear))));
  23828. }
  23829. if (options.showClose) {
  23830. row.push($('<td>').append($('<a>').attr({'data-action':'close', 'title':'Close the picker'}).append($('<span>').addClass(options.icons.close))));
  23831. }
  23832. return $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row)));
  23833. },
  23834. getTemplate = function () {
  23835. var template = $('<div>').addClass('bootstrap-datetimepicker-widget dropdown-menu'),
  23836. dateView = $('<div>').addClass('datepicker').append(getDatePickerTemplate()),
  23837. timeView = $('<div>').addClass('timepicker').append(getTimePickerTemplate()),
  23838. content = $('<ul>').addClass('list-unstyled'),
  23839. toolbar = $('<li>').addClass('picker-switch' + (options.collapse ? ' accordion-toggle' : '')).append(getToolbar());
  23840. if (options.inline) {
  23841. template.removeClass('dropdown-menu');
  23842. }
  23843. if (use24Hours) {
  23844. template.addClass('usetwentyfour');
  23845. }
  23846. if (isEnabled('s') && !use24Hours) {
  23847. template.addClass('wider');
  23848. }
  23849. if (options.sideBySide && hasDate() && hasTime()) {
  23850. template.addClass('timepicker-sbs');
  23851. template.append(
  23852. $('<div>').addClass('row')
  23853. .append(dateView.addClass('col-sm-6'))
  23854. .append(timeView.addClass('col-sm-6'))
  23855. );
  23856. template.append(toolbar);
  23857. return template;
  23858. }
  23859. if (options.toolbarPlacement === 'top') {
  23860. content.append(toolbar);
  23861. }
  23862. if (hasDate()) {
  23863. content.append($('<li>').addClass((options.collapse && hasTime() ? 'collapse in' : '')).append(dateView));
  23864. }
  23865. if (options.toolbarPlacement === 'default') {
  23866. content.append(toolbar);
  23867. }
  23868. if (hasTime()) {
  23869. content.append($('<li>').addClass((options.collapse && hasDate() ? 'collapse' : '')).append(timeView));
  23870. }
  23871. if (options.toolbarPlacement === 'bottom') {
  23872. content.append(toolbar);
  23873. }
  23874. return template.append(content);
  23875. },
  23876. dataToOptions = function () {
  23877. var eData,
  23878. dataOptions = {};
  23879. if (element.is('input') || options.inline) {
  23880. eData = element.data();
  23881. } else {
  23882. eData = element.find('input').data();
  23883. }
  23884. if (eData.dateOptions && eData.dateOptions instanceof Object) {
  23885. dataOptions = $.extend(true, dataOptions, eData.dateOptions);
  23886. }
  23887. $.each(options, function (key) {
  23888. var attributeName = 'date' + key.charAt(0).toUpperCase() + key.slice(1);
  23889. if (eData[attributeName] !== undefined) {
  23890. dataOptions[key] = eData[attributeName];
  23891. }
  23892. });
  23893. return dataOptions;
  23894. },
  23895. place = function () {
  23896. var position = (component || element).position(),
  23897. offset = (component || element).offset(),
  23898. vertical = options.widgetPositioning.vertical,
  23899. horizontal = options.widgetPositioning.horizontal,
  23900. parent;
  23901. if (options.widgetParent) {
  23902. parent = options.widgetParent.append(widget);
  23903. } else if (element.is('input')) {
  23904. parent = element.after(widget).parent();
  23905. } else if (options.inline) {
  23906. parent = element.append(widget);
  23907. return;
  23908. } else {
  23909. parent = element;
  23910. element.children().first().after(widget);
  23911. }
  23912. // Top and bottom logic
  23913. if (vertical === 'auto') {
  23914. if (offset.top + widget.height() * 1.5 >= $(window).height() + $(window).scrollTop() &&
  23915. widget.height() + element.outerHeight() < offset.top) {
  23916. vertical = 'top';
  23917. } else {
  23918. vertical = 'bottom';
  23919. }
  23920. }
  23921. // Left and right logic
  23922. if (horizontal === 'auto') {
  23923. if (parent.width() < offset.left + widget.outerWidth() / 2 &&
  23924. offset.left + widget.outerWidth() > $(window).width()) {
  23925. horizontal = 'right';
  23926. } else {
  23927. horizontal = 'left';
  23928. }
  23929. }
  23930. if (vertical === 'top') {
  23931. widget.addClass('top').removeClass('bottom');
  23932. } else {
  23933. widget.addClass('bottom').removeClass('top');
  23934. }
  23935. if (horizontal === 'right') {
  23936. widget.addClass('pull-right');
  23937. } else {
  23938. widget.removeClass('pull-right');
  23939. }
  23940. // find the first parent element that has a relative css positioning
  23941. if (parent.css('position') !== 'relative') {
  23942. parent = parent.parents().filter(function () {
  23943. return $(this).css('position') === 'relative';
  23944. }).first();
  23945. }
  23946. if (parent.length === 0) {
  23947. throw new Error('datetimepicker component should be placed within a relative positioned container');
  23948. }
  23949. widget.css({
  23950. top: vertical === 'top' ? 'auto' : position.top + element.outerHeight(),
  23951. bottom: vertical === 'top' ? position.top + element.outerHeight() : 'auto',
  23952. left: horizontal === 'left' ? (parent === element ? 0 : position.left) : 'auto',
  23953. right: horizontal === 'left' ? 'auto' : parent.outerWidth() - element.outerWidth() - (parent === element ? 0 : position.left)
  23954. });
  23955. },
  23956. notifyEvent = function (e) {
  23957. if (e.type === 'dp.change' && ((e.date && e.date.isSame(e.oldDate)) || (!e.date && !e.oldDate))) {
  23958. return;
  23959. }
  23960. element.trigger(e);
  23961. },
  23962. viewUpdate = function (e) {
  23963. if (e === 'y') {
  23964. e = 'YYYY';
  23965. }
  23966. notifyEvent({
  23967. type: 'dp.update',
  23968. change: e,
  23969. viewDate: viewDate.clone()
  23970. });
  23971. },
  23972. showMode = function (dir) {
  23973. if (!widget) {
  23974. return;
  23975. }
  23976. if (dir) {
  23977. currentViewMode = Math.max(minViewModeNumber, Math.min(3, currentViewMode + dir));
  23978. }
  23979. widget.find('.datepicker > div').hide().filter('.datepicker-' + datePickerModes[currentViewMode].clsName).show();
  23980. },
  23981. fillDow = function () {
  23982. var row = $('<tr>'),
  23983. currentDate = viewDate.clone().startOf('w').startOf('d');
  23984. if (options.calendarWeeks === true) {
  23985. row.append($('<th>').addClass('cw').text('#'));
  23986. }
  23987. while (currentDate.isBefore(viewDate.clone().endOf('w'))) {
  23988. row.append($('<th>').addClass('dow').text(currentDate.format('dd')));
  23989. currentDate.add(1, 'd');
  23990. }
  23991. widget.find('.datepicker-days thead').append(row);
  23992. },
  23993. isInDisabledDates = function (testDate) {
  23994. return options.disabledDates[testDate.format('YYYY-MM-DD')] === true;
  23995. },
  23996. isInEnabledDates = function (testDate) {
  23997. return options.enabledDates[testDate.format('YYYY-MM-DD')] === true;
  23998. },
  23999. isInDisabledHours = function (testDate) {
  24000. return options.disabledHours[testDate.format('H')] === true;
  24001. },
  24002. isInEnabledHours = function (testDate) {
  24003. return options.enabledHours[testDate.format('H')] === true;
  24004. },
  24005. isValid = function (targetMoment, granularity) {
  24006. if (!targetMoment.isValid()) {
  24007. return false;
  24008. }
  24009. if (options.disabledDates && granularity === 'd' && isInDisabledDates(targetMoment)) {
  24010. return false;
  24011. }
  24012. if (options.enabledDates && granularity === 'd' && !isInEnabledDates(targetMoment)) {
  24013. return false;
  24014. }
  24015. if (options.minDate && targetMoment.isBefore(options.minDate, granularity)) {
  24016. return false;
  24017. }
  24018. if (options.maxDate && targetMoment.isAfter(options.maxDate, granularity)) {
  24019. return false;
  24020. }
  24021. if (options.daysOfWeekDisabled && granularity === 'd' && options.daysOfWeekDisabled.indexOf(targetMoment.day()) !== -1) {
  24022. return false;
  24023. }
  24024. if (options.disabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && isInDisabledHours(targetMoment)) {
  24025. return false;
  24026. }
  24027. if (options.enabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && !isInEnabledHours(targetMoment)) {
  24028. return false;
  24029. }
  24030. if (options.disabledTimeIntervals && (granularity === 'h' || granularity === 'm' || granularity === 's')) {
  24031. var found = false;
  24032. $.each(options.disabledTimeIntervals, function () {
  24033. if (targetMoment.isBetween(this[0], this[1])) {
  24034. found = true;
  24035. return false;
  24036. }
  24037. });
  24038. if (found) {
  24039. return false;
  24040. }
  24041. }
  24042. return true;
  24043. },
  24044. fillMonths = function () {
  24045. var spans = [],
  24046. monthsShort = viewDate.clone().startOf('y').startOf('d');
  24047. while (monthsShort.isSame(viewDate, 'y')) {
  24048. spans.push($('<span>').attr('data-action', 'selectMonth').addClass('month').text(monthsShort.format('MMM')));
  24049. monthsShort.add(1, 'M');
  24050. }
  24051. widget.find('.datepicker-months td').empty().append(spans);
  24052. },
  24053. updateMonths = function () {
  24054. var monthsView = widget.find('.datepicker-months'),
  24055. monthsViewHeader = monthsView.find('th'),
  24056. months = monthsView.find('tbody').find('span');
  24057. monthsViewHeader.eq(0).find('span').attr('title', 'Previous Year');
  24058. monthsViewHeader.eq(1).attr('title', 'Select Year');
  24059. monthsViewHeader.eq(2).find('span').attr('title', 'Next Year');
  24060. monthsView.find('.disabled').removeClass('disabled');
  24061. if (!isValid(viewDate.clone().subtract(1, 'y'), 'y')) {
  24062. monthsViewHeader.eq(0).addClass('disabled');
  24063. }
  24064. monthsViewHeader.eq(1).text(viewDate.year());
  24065. if (!isValid(viewDate.clone().add(1, 'y'), 'y')) {
  24066. monthsViewHeader.eq(2).addClass('disabled');
  24067. }
  24068. months.removeClass('active');
  24069. if (date.isSame(viewDate, 'y') && !unset) {
  24070. months.eq(date.month()).addClass('active');
  24071. }
  24072. months.each(function (index) {
  24073. if (!isValid(viewDate.clone().month(index), 'M')) {
  24074. $(this).addClass('disabled');
  24075. }
  24076. });
  24077. },
  24078. updateYears = function () {
  24079. var yearsView = widget.find('.datepicker-years'),
  24080. yearsViewHeader = yearsView.find('th'),
  24081. startYear = viewDate.clone().subtract(5, 'y'),
  24082. endYear = viewDate.clone().add(6, 'y'),
  24083. html = '';
  24084. yearsViewHeader.eq(0).find('span').attr('title', 'Previous Decade');
  24085. yearsViewHeader.eq(1).attr('title', 'Select Decade');
  24086. yearsViewHeader.eq(2).find('span').attr('title', 'Next Decade');
  24087. yearsView.find('.disabled').removeClass('disabled');
  24088. if (options.minDate && options.minDate.isAfter(startYear, 'y')) {
  24089. yearsViewHeader.eq(0).addClass('disabled');
  24090. }
  24091. yearsViewHeader.eq(1).text(startYear.year() + '-' + endYear.year());
  24092. if (options.maxDate && options.maxDate.isBefore(endYear, 'y')) {
  24093. yearsViewHeader.eq(2).addClass('disabled');
  24094. }
  24095. while (!startYear.isAfter(endYear, 'y')) {
  24096. html += '<span data-action="selectYear" class="year' + (startYear.isSame(date, 'y') && !unset ? ' active' : '') + (!isValid(startYear, 'y') ? ' disabled' : '') + '">' + startYear.year() + '</span>';
  24097. startYear.add(1, 'y');
  24098. }
  24099. yearsView.find('td').html(html);
  24100. },
  24101. updateDecades = function () {
  24102. var decadesView = widget.find('.datepicker-decades'),
  24103. decadesViewHeader = decadesView.find('th'),
  24104. startDecade = viewDate.isBefore(moment({y: 1999})) ? moment({y: 1899}) : moment({y: 1999}),
  24105. endDecade = startDecade.clone().add(100, 'y'),
  24106. html = '';
  24107. decadesViewHeader.eq(0).find('span').attr('title', 'Previous Century');
  24108. decadesViewHeader.eq(2).find('span').attr('title', 'Next Century');
  24109. decadesView.find('.disabled').removeClass('disabled');
  24110. if (startDecade.isSame(moment({y: 1900})) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) {
  24111. decadesViewHeader.eq(0).addClass('disabled');
  24112. }
  24113. decadesViewHeader.eq(1).text(startDecade.year() + '-' + endDecade.year());
  24114. if (startDecade.isSame(moment({y: 2000})) || (options.maxDate && options.maxDate.isBefore(endDecade, 'y'))) {
  24115. decadesViewHeader.eq(2).addClass('disabled');
  24116. }
  24117. while (!startDecade.isAfter(endDecade, 'y')) {
  24118. html += '<span data-action="selectDecade" class="decade' + (startDecade.isSame(date, 'y') ? ' active' : '') +
  24119. (!isValid(startDecade, 'y') ? ' disabled' : '') + '" data-selection="' + (startDecade.year() + 6) + '">' + (startDecade.year() + 1) + ' - ' + (startDecade.year() + 12) + '</span>';
  24120. startDecade.add(12, 'y');
  24121. }
  24122. html += '<span></span><span></span><span></span>'; //push the dangling block over, at least this way it's even
  24123. decadesView.find('td').html(html);
  24124. },
  24125. fillDate = function () {
  24126. var daysView = widget.find('.datepicker-days'),
  24127. daysViewHeader = daysView.find('th'),
  24128. currentDate,
  24129. html = [],
  24130. row,
  24131. clsName,
  24132. i;
  24133. if (!hasDate()) {
  24134. return;
  24135. }
  24136. daysViewHeader.eq(0).find('span').attr('title', 'Previous Month');
  24137. daysViewHeader.eq(1).attr('title', 'Select Month');
  24138. daysViewHeader.eq(2).find('span').attr('title', 'Next Month');
  24139. daysView.find('.disabled').removeClass('disabled');
  24140. daysViewHeader.eq(1).text(viewDate.format(options.dayViewHeaderFormat));
  24141. if (!isValid(viewDate.clone().subtract(1, 'M'), 'M')) {
  24142. daysViewHeader.eq(0).addClass('disabled');
  24143. }
  24144. if (!isValid(viewDate.clone().add(1, 'M'), 'M')) {
  24145. daysViewHeader.eq(2).addClass('disabled');
  24146. }
  24147. currentDate = viewDate.clone().startOf('M').startOf('w').startOf('d');
  24148. for (i = 0; i < 42; i++) { //always display 42 days (should show 6 weeks)
  24149. if (currentDate.weekday() === 0) {
  24150. row = $('<tr>');
  24151. if (options.calendarWeeks) {
  24152. row.append('<td class="cw">' + currentDate.week() + '</td>');
  24153. }
  24154. html.push(row);
  24155. }
  24156. clsName = '';
  24157. if (currentDate.isBefore(viewDate, 'M')) {
  24158. clsName += ' old';
  24159. }
  24160. if (currentDate.isAfter(viewDate, 'M')) {
  24161. clsName += ' new';
  24162. }
  24163. if (currentDate.isSame(date, 'd') && !unset) {
  24164. clsName += ' active';
  24165. }
  24166. if (!isValid(currentDate, 'd')) {
  24167. clsName += ' disabled';
  24168. }
  24169. if (currentDate.isSame(moment(), 'd')) {
  24170. clsName += ' today';
  24171. }
  24172. if (currentDate.day() === 0 || currentDate.day() === 6) {
  24173. clsName += ' weekend';
  24174. }
  24175. row.append('<td data-action="selectDay" data-day="' + currentDate.format('L') + '" class="day' + clsName + '">' + currentDate.date() + '</td>');
  24176. currentDate.add(1, 'd');
  24177. }
  24178. daysView.find('tbody').empty().append(html);
  24179. updateMonths();
  24180. updateYears();
  24181. updateDecades();
  24182. },
  24183. fillHours = function () {
  24184. var table = widget.find('.timepicker-hours table'),
  24185. currentHour = viewDate.clone().startOf('d'),
  24186. html = [],
  24187. row = $('<tr>');
  24188. if (viewDate.hour() > 11 && !use24Hours) {
  24189. currentHour.hour(12);
  24190. }
  24191. while (currentHour.isSame(viewDate, 'd') && (use24Hours || (viewDate.hour() < 12 && currentHour.hour() < 12) || viewDate.hour() > 11)) {
  24192. if (currentHour.hour() % 4 === 0) {
  24193. row = $('<tr>');
  24194. html.push(row);
  24195. }
  24196. row.append('<td data-action="selectHour" class="hour' + (!isValid(currentHour, 'h') ? ' disabled' : '') + '">' + currentHour.format(use24Hours ? 'HH' : 'hh') + '</td>');
  24197. currentHour.add(1, 'h');
  24198. }
  24199. table.empty().append(html);
  24200. },
  24201. fillMinutes = function () {
  24202. var table = widget.find('.timepicker-minutes table'),
  24203. currentMinute = viewDate.clone().startOf('h'),
  24204. html = [],
  24205. row = $('<tr>'),
  24206. step = options.stepping === 1 ? 5 : options.stepping;
  24207. while (viewDate.isSame(currentMinute, 'h')) {
  24208. if (currentMinute.minute() % (step * 4) === 0) {
  24209. row = $('<tr>');
  24210. html.push(row);
  24211. }
  24212. row.append('<td data-action="selectMinute" class="minute' + (!isValid(currentMinute, 'm') ? ' disabled' : '') + '">' + currentMinute.format('mm') + '</td>');
  24213. currentMinute.add(step, 'm');
  24214. }
  24215. table.empty().append(html);
  24216. },
  24217. fillSeconds = function () {
  24218. var table = widget.find('.timepicker-seconds table'),
  24219. currentSecond = viewDate.clone().startOf('m'),
  24220. html = [],
  24221. row = $('<tr>');
  24222. while (viewDate.isSame(currentSecond, 'm')) {
  24223. if (currentSecond.second() % 20 === 0) {
  24224. row = $('<tr>');
  24225. html.push(row);
  24226. }
  24227. row.append('<td data-action="selectSecond" class="second' + (!isValid(currentSecond, 's') ? ' disabled' : '') + '">' + currentSecond.format('ss') + '</td>');
  24228. currentSecond.add(5, 's');
  24229. }
  24230. table.empty().append(html);
  24231. },
  24232. fillTime = function () {
  24233. var toggle, newDate, timeComponents = widget.find('.timepicker span[data-time-component]');
  24234. if (!use24Hours) {
  24235. toggle = widget.find('.timepicker [data-action=togglePeriod]');
  24236. newDate = date.clone().add((date.hours() >= 12) ? -12 : 12, 'h');
  24237. toggle.text(date.format('A'));
  24238. if (isValid(newDate, 'h')) {
  24239. toggle.removeClass('disabled');
  24240. } else {
  24241. toggle.addClass('disabled');
  24242. }
  24243. }
  24244. timeComponents.filter('[data-time-component=hours]').text(date.format(use24Hours ? 'HH' : 'hh'));
  24245. timeComponents.filter('[data-time-component=minutes]').text(date.format('mm'));
  24246. timeComponents.filter('[data-time-component=seconds]').text(date.format('ss'));
  24247. fillHours();
  24248. fillMinutes();
  24249. fillSeconds();
  24250. },
  24251. update = function () {
  24252. if (!widget) {
  24253. return;
  24254. }
  24255. fillDate();
  24256. fillTime();
  24257. },
  24258. setValue = function (targetMoment) {
  24259. var oldDate = unset ? null : date;
  24260. // case of calling setValue(null or false)
  24261. if (!targetMoment) {
  24262. unset = true;
  24263. input.val('');
  24264. element.data('date', '');
  24265. notifyEvent({
  24266. type: 'dp.change',
  24267. date: false,
  24268. oldDate: oldDate
  24269. });
  24270. update();
  24271. return;
  24272. }
  24273. targetMoment = targetMoment.clone().locale(options.locale);
  24274. if (options.stepping !== 1) {
  24275. targetMoment.minutes((Math.round(targetMoment.minutes() / options.stepping) * options.stepping) % 60).seconds(0);
  24276. }
  24277. if (isValid(targetMoment)) {
  24278. date = targetMoment;
  24279. viewDate = date.clone();
  24280. input.val(date.format(actualFormat));
  24281. element.data('date', date.format(actualFormat));
  24282. unset = false;
  24283. update();
  24284. notifyEvent({
  24285. type: 'dp.change',
  24286. date: date.clone(),
  24287. oldDate: oldDate
  24288. });
  24289. } else {
  24290. if (!options.keepInvalid) {
  24291. input.val(unset ? '' : date.format(actualFormat));
  24292. }
  24293. notifyEvent({
  24294. type: 'dp.error',
  24295. date: targetMoment
  24296. });
  24297. }
  24298. },
  24299. hide = function () {
  24300. ///<summary>Hides the widget. Possibly will emit dp.hide</summary>
  24301. var transitioning = false;
  24302. if (!widget) {
  24303. return picker;
  24304. }
  24305. // Ignore event if in the middle of a picker transition
  24306. widget.find('.collapse').each(function () {
  24307. var collapseData = $(this).data('collapse');
  24308. if (collapseData && collapseData.transitioning) {
  24309. transitioning = true;
  24310. return false;
  24311. }
  24312. return true;
  24313. });
  24314. if (transitioning) {
  24315. return picker;
  24316. }
  24317. if (component && component.hasClass('btn')) {
  24318. component.toggleClass('active');
  24319. }
  24320. widget.hide();
  24321. $(window).off('resize', place);
  24322. widget.off('click', '[data-action]');
  24323. widget.off('mousedown', false);
  24324. widget.remove();
  24325. widget = false;
  24326. notifyEvent({
  24327. type: 'dp.hide',
  24328. date: date.clone()
  24329. });
  24330. return picker;
  24331. },
  24332. clear = function () {
  24333. setValue(null);
  24334. },
  24335. /********************************************************************************
  24336. *
  24337. * Widget UI interaction functions
  24338. *
  24339. ********************************************************************************/
  24340. actions = {
  24341. next: function () {
  24342. var navFnc = datePickerModes[currentViewMode].navFnc;
  24343. viewDate.add(datePickerModes[currentViewMode].navStep, navFnc);
  24344. fillDate();
  24345. viewUpdate(navFnc);
  24346. },
  24347. previous: function () {
  24348. var navFnc = datePickerModes[currentViewMode].navFnc;
  24349. viewDate.subtract(datePickerModes[currentViewMode].navStep, navFnc);
  24350. fillDate();
  24351. viewUpdate(navFnc);
  24352. },
  24353. pickerSwitch: function () {
  24354. showMode(1);
  24355. },
  24356. selectMonth: function (e) {
  24357. var month = $(e.target).closest('tbody').find('span').index($(e.target));
  24358. viewDate.month(month);
  24359. if (currentViewMode === minViewModeNumber) {
  24360. setValue(date.clone().year(viewDate.year()).month(viewDate.month()));
  24361. if (!options.inline) {
  24362. hide();
  24363. }
  24364. } else {
  24365. showMode(-1);
  24366. fillDate();
  24367. }
  24368. viewUpdate('M');
  24369. },
  24370. selectYear: function (e) {
  24371. var year = parseInt($(e.target).text(), 10) || 0;
  24372. viewDate.year(year);
  24373. if (currentViewMode === minViewModeNumber) {
  24374. setValue(date.clone().year(viewDate.year()));
  24375. if (!options.inline) {
  24376. hide();
  24377. }
  24378. } else {
  24379. showMode(-1);
  24380. fillDate();
  24381. }
  24382. viewUpdate('YYYY');
  24383. },
  24384. selectDecade: function (e) {
  24385. var year = parseInt($(e.target).data('selection'), 10) || 0;
  24386. viewDate.year(year);
  24387. if (currentViewMode === minViewModeNumber) {
  24388. setValue(date.clone().year(viewDate.year()));
  24389. if (!options.inline) {
  24390. hide();
  24391. }
  24392. } else {
  24393. showMode(-1);
  24394. fillDate();
  24395. }
  24396. viewUpdate('YYYY');
  24397. },
  24398. selectDay: function (e) {
  24399. var day = viewDate.clone();
  24400. if ($(e.target).is('.old')) {
  24401. day.subtract(1, 'M');
  24402. }
  24403. if ($(e.target).is('.new')) {
  24404. day.add(1, 'M');
  24405. }
  24406. setValue(day.date(parseInt($(e.target).text(), 10)));
  24407. if (!hasTime() && !options.keepOpen && !options.inline) {
  24408. hide();
  24409. }
  24410. },
  24411. incrementHours: function () {
  24412. var newDate = date.clone().add(1, 'h');
  24413. if (isValid(newDate, 'h')) {
  24414. setValue(newDate);
  24415. }
  24416. },
  24417. incrementMinutes: function () {
  24418. var newDate = date.clone().add(options.stepping, 'm');
  24419. if (isValid(newDate, 'm')) {
  24420. setValue(newDate);
  24421. }
  24422. },
  24423. incrementSeconds: function () {
  24424. var newDate = date.clone().add(1, 's');
  24425. if (isValid(newDate, 's')) {
  24426. setValue(newDate);
  24427. }
  24428. },
  24429. decrementHours: function () {
  24430. var newDate = date.clone().subtract(1, 'h');
  24431. if (isValid(newDate, 'h')) {
  24432. setValue(newDate);
  24433. }
  24434. },
  24435. decrementMinutes: function () {
  24436. var newDate = date.clone().subtract(options.stepping, 'm');
  24437. if (isValid(newDate, 'm')) {
  24438. setValue(newDate);
  24439. }
  24440. },
  24441. decrementSeconds: function () {
  24442. var newDate = date.clone().subtract(1, 's');
  24443. if (isValid(newDate, 's')) {
  24444. setValue(newDate);
  24445. }
  24446. },
  24447. togglePeriod: function () {
  24448. setValue(date.clone().add((date.hours() >= 12) ? -12 : 12, 'h'));
  24449. },
  24450. togglePicker: function (e) {
  24451. var $this = $(e.target),
  24452. $parent = $this.closest('ul'),
  24453. expanded = $parent.find('.in'),
  24454. closed = $parent.find('.collapse:not(.in)'),
  24455. collapseData;
  24456. if (expanded && expanded.length) {
  24457. collapseData = expanded.data('collapse');
  24458. if (collapseData && collapseData.transitioning) {
  24459. return;
  24460. }
  24461. if (expanded.collapse) { // if collapse plugin is available through bootstrap.js then use it
  24462. expanded.collapse('hide');
  24463. closed.collapse('show');
  24464. } else { // otherwise just toggle in class on the two views
  24465. expanded.removeClass('in');
  24466. closed.addClass('in');
  24467. }
  24468. if ($this.is('span')) {
  24469. $this.toggleClass(options.icons.time + ' ' + options.icons.date);
  24470. } else {
  24471. $this.find('span').toggleClass(options.icons.time + ' ' + options.icons.date);
  24472. }
  24473. // NOTE: uncomment if toggled state will be restored in show()
  24474. //if (component) {
  24475. // component.find('span').toggleClass(options.icons.time + ' ' + options.icons.date);
  24476. //}
  24477. }
  24478. },
  24479. showPicker: function () {
  24480. widget.find('.timepicker > div:not(.timepicker-picker)').hide();
  24481. widget.find('.timepicker .timepicker-picker').show();
  24482. },
  24483. showHours: function () {
  24484. widget.find('.timepicker .timepicker-picker').hide();
  24485. widget.find('.timepicker .timepicker-hours').show();
  24486. },
  24487. showMinutes: function () {
  24488. widget.find('.timepicker .timepicker-picker').hide();
  24489. widget.find('.timepicker .timepicker-minutes').show();
  24490. },
  24491. showSeconds: function () {
  24492. widget.find('.timepicker .timepicker-picker').hide();
  24493. widget.find('.timepicker .timepicker-seconds').show();
  24494. },
  24495. selectHour: function (e) {
  24496. var hour = parseInt($(e.target).text(), 10);
  24497. if (!use24Hours) {
  24498. if (date.hours() >= 12) {
  24499. if (hour !== 12) {
  24500. hour += 12;
  24501. }
  24502. } else {
  24503. if (hour === 12) {
  24504. hour = 0;
  24505. }
  24506. }
  24507. }
  24508. setValue(date.clone().hours(hour));
  24509. actions.showPicker.call(picker);
  24510. },
  24511. selectMinute: function (e) {
  24512. setValue(date.clone().minutes(parseInt($(e.target).text(), 10)));
  24513. actions.showPicker.call(picker);
  24514. },
  24515. selectSecond: function (e) {
  24516. setValue(date.clone().seconds(parseInt($(e.target).text(), 10)));
  24517. actions.showPicker.call(picker);
  24518. },
  24519. clear: clear,
  24520. today: function () {
  24521. if (isValid(moment(), 'd')) {
  24522. setValue(moment());
  24523. }
  24524. },
  24525. close: hide
  24526. },
  24527. doAction = function (e) {
  24528. if ($(e.currentTarget).is('.disabled')) {
  24529. return false;
  24530. }
  24531. actions[$(e.currentTarget).data('action')].apply(picker, arguments);
  24532. return false;
  24533. },
  24534. show = function () {
  24535. ///<summary>Shows the widget. Possibly will emit dp.show and dp.change</summary>
  24536. var currentMoment,
  24537. useCurrentGranularity = {
  24538. 'year': function (m) {
  24539. return m.month(0).date(1).hours(0).seconds(0).minutes(0);
  24540. },
  24541. 'month': function (m) {
  24542. return m.date(1).hours(0).seconds(0).minutes(0);
  24543. },
  24544. 'day': function (m) {
  24545. return m.hours(0).seconds(0).minutes(0);
  24546. },
  24547. 'hour': function (m) {
  24548. return m.seconds(0).minutes(0);
  24549. },
  24550. 'minute': function (m) {
  24551. return m.seconds(0);
  24552. }
  24553. };
  24554. if (input.prop('disabled') || (!options.ignoreReadonly && input.prop('readonly')) || widget) {
  24555. return picker;
  24556. }
  24557. if (input.val() !== undefined && input.val().trim().length !== 0) {
  24558. setValue(parseInputDate(input.val().trim()));
  24559. } else if (options.useCurrent && unset && ((input.is('input') && input.val().trim().length === 0) || options.inline)) {
  24560. currentMoment = moment();
  24561. if (typeof options.useCurrent === 'string') {
  24562. currentMoment = useCurrentGranularity[options.useCurrent](currentMoment);
  24563. }
  24564. setValue(currentMoment);
  24565. }
  24566. widget = getTemplate();
  24567. fillDow();
  24568. fillMonths();
  24569. widget.find('.timepicker-hours').hide();
  24570. widget.find('.timepicker-minutes').hide();
  24571. widget.find('.timepicker-seconds').hide();
  24572. update();
  24573. showMode();
  24574. $(window).on('resize', place);
  24575. widget.on('click', '[data-action]', doAction); // this handles clicks on the widget
  24576. widget.on('mousedown', false);
  24577. if (component && component.hasClass('btn')) {
  24578. component.toggleClass('active');
  24579. }
  24580. widget.show();
  24581. place();
  24582. if (options.focusOnShow && !input.is(':focus')) {
  24583. input.focus();
  24584. }
  24585. notifyEvent({
  24586. type: 'dp.show'
  24587. });
  24588. return picker;
  24589. },
  24590. toggle = function () {
  24591. /// <summary>Shows or hides the widget</summary>
  24592. return (widget ? hide() : show());
  24593. },
  24594. parseInputDate = function (inputDate) {
  24595. if (options.parseInputDate === undefined) {
  24596. if (moment.isMoment(inputDate) || inputDate instanceof Date) {
  24597. inputDate = moment(inputDate);
  24598. } else {
  24599. inputDate = moment(inputDate, parseFormats, options.useStrict);
  24600. }
  24601. } else {
  24602. inputDate = options.parseInputDate(inputDate);
  24603. }
  24604. inputDate.locale(options.locale);
  24605. return inputDate;
  24606. },
  24607. keydown = function (e) {
  24608. var handler = null,
  24609. index,
  24610. index2,
  24611. pressedKeys = [],
  24612. pressedModifiers = {},
  24613. currentKey = e.which,
  24614. keyBindKeys,
  24615. allModifiersPressed,
  24616. pressed = 'p';
  24617. keyState[currentKey] = pressed;
  24618. for (index in keyState) {
  24619. if (keyState.hasOwnProperty(index) && keyState[index] === pressed) {
  24620. pressedKeys.push(index);
  24621. if (parseInt(index, 10) !== currentKey) {
  24622. pressedModifiers[index] = true;
  24623. }
  24624. }
  24625. }
  24626. for (index in options.keyBinds) {
  24627. if (options.keyBinds.hasOwnProperty(index) && typeof (options.keyBinds[index]) === 'function') {
  24628. keyBindKeys = index.split(' ');
  24629. if (keyBindKeys.length === pressedKeys.length && keyMap[currentKey] === keyBindKeys[keyBindKeys.length - 1]) {
  24630. allModifiersPressed = true;
  24631. for (index2 = keyBindKeys.length - 2; index2 >= 0; index2--) {
  24632. if (!(keyMap[keyBindKeys[index2]] in pressedModifiers)) {
  24633. allModifiersPressed = false;
  24634. break;
  24635. }
  24636. }
  24637. if (allModifiersPressed) {
  24638. handler = options.keyBinds[index];
  24639. break;
  24640. }
  24641. }
  24642. }
  24643. }
  24644. if (handler) {
  24645. handler.call(picker, widget);
  24646. e.stopPropagation();
  24647. e.preventDefault();
  24648. }
  24649. },
  24650. keyup = function (e) {
  24651. keyState[e.which] = 'r';
  24652. e.stopPropagation();
  24653. e.preventDefault();
  24654. },
  24655. change = function (e) {
  24656. var val = $(e.target).val().trim(),
  24657. parsedDate = val ? parseInputDate(val) : null;
  24658. setValue(parsedDate);
  24659. e.stopImmediatePropagation();
  24660. return false;
  24661. },
  24662. attachDatePickerElementEvents = function () {
  24663. input.on({
  24664. 'change': change,
  24665. 'blur': options.debug ? '' : hide,
  24666. 'keydown': keydown,
  24667. 'keyup': keyup,
  24668. 'focus': options.allowInputToggle ? show : ''
  24669. });
  24670. if (element.is('input')) {
  24671. input.on({
  24672. 'focus': show
  24673. });
  24674. } else if (component) {
  24675. component.on('click', toggle);
  24676. component.on('mousedown', false);
  24677. }
  24678. },
  24679. detachDatePickerElementEvents = function () {
  24680. input.off({
  24681. 'change': change,
  24682. 'blur': hide,
  24683. 'keydown': keydown,
  24684. 'keyup': keyup,
  24685. 'focus': options.allowInputToggle ? hide : ''
  24686. });
  24687. if (element.is('input')) {
  24688. input.off({
  24689. 'focus': show
  24690. });
  24691. } else if (component) {
  24692. component.off('click', toggle);
  24693. component.off('mousedown', false);
  24694. }
  24695. },
  24696. indexGivenDates = function (givenDatesArray) {
  24697. // Store given enabledDates and disabledDates as keys.
  24698. // This way we can check their existence in O(1) time instead of looping through whole array.
  24699. // (for example: options.enabledDates['2014-02-27'] === true)
  24700. var givenDatesIndexed = {};
  24701. $.each(givenDatesArray, function () {
  24702. var dDate = parseInputDate(this);
  24703. if (dDate.isValid()) {
  24704. givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true;
  24705. }
  24706. });
  24707. return (Object.keys(givenDatesIndexed).length) ? givenDatesIndexed : false;
  24708. },
  24709. indexGivenHours = function (givenHoursArray) {
  24710. // Store given enabledHours and disabledHours as keys.
  24711. // This way we can check their existence in O(1) time instead of looping through whole array.
  24712. // (for example: options.enabledHours['2014-02-27'] === true)
  24713. var givenHoursIndexed = {};
  24714. $.each(givenHoursArray, function () {
  24715. givenHoursIndexed[this] = true;
  24716. });
  24717. return (Object.keys(givenHoursIndexed).length) ? givenHoursIndexed : false;
  24718. },
  24719. initFormatting = function () {
  24720. var format = options.format || 'L LT';
  24721. actualFormat = format.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
  24722. var newinput = date.localeData().longDateFormat(formatInput) || formatInput;
  24723. return newinput.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput2) { //temp fix for #740
  24724. return date.localeData().longDateFormat(formatInput2) || formatInput2;
  24725. });
  24726. });
  24727. parseFormats = options.extraFormats ? options.extraFormats.slice() : [];
  24728. if (parseFormats.indexOf(format) < 0 && parseFormats.indexOf(actualFormat) < 0) {
  24729. parseFormats.push(actualFormat);
  24730. }
  24731. use24Hours = (actualFormat.toLowerCase().indexOf('a') < 1 && actualFormat.replace(/\[.*?\]/g, '').indexOf('h') < 1);
  24732. if (isEnabled('y')) {
  24733. minViewModeNumber = 2;
  24734. }
  24735. if (isEnabled('M')) {
  24736. minViewModeNumber = 1;
  24737. }
  24738. if (isEnabled('d')) {
  24739. minViewModeNumber = 0;
  24740. }
  24741. currentViewMode = Math.max(minViewModeNumber, currentViewMode);
  24742. if (!unset) {
  24743. setValue(date);
  24744. }
  24745. };
  24746. /********************************************************************************
  24747. *
  24748. * Public API functions
  24749. * =====================
  24750. *
  24751. * Important: Do not expose direct references to private objects or the options
  24752. * object to the outer world. Always return a clone when returning values or make
  24753. * a clone when setting a private variable.
  24754. *
  24755. ********************************************************************************/
  24756. picker.destroy = function () {
  24757. ///<summary>Destroys the widget and removes all attached event listeners</summary>
  24758. hide();
  24759. detachDatePickerElementEvents();
  24760. element.removeData('DateTimePicker');
  24761. element.removeData('date');
  24762. };
  24763. picker.toggle = toggle;
  24764. picker.show = show;
  24765. picker.hide = hide;
  24766. picker.disable = function () {
  24767. ///<summary>Disables the input element, the component is attached to, by adding a disabled="true" attribute to it.
  24768. ///If the widget was visible before that call it is hidden. Possibly emits dp.hide</summary>
  24769. hide();
  24770. if (component && component.hasClass('btn')) {
  24771. component.addClass('disabled');
  24772. }
  24773. input.prop('disabled', true);
  24774. return picker;
  24775. };
  24776. picker.enable = function () {
  24777. ///<summary>Enables the input element, the component is attached to, by removing disabled attribute from it.</summary>
  24778. if (component && component.hasClass('btn')) {
  24779. component.removeClass('disabled');
  24780. }
  24781. input.prop('disabled', false);
  24782. return picker;
  24783. };
  24784. picker.ignoreReadonly = function (ignoreReadonly) {
  24785. if (arguments.length === 0) {
  24786. return options.ignoreReadonly;
  24787. }
  24788. if (typeof ignoreReadonly !== 'boolean') {
  24789. throw new TypeError('ignoreReadonly () expects a boolean parameter');
  24790. }
  24791. options.ignoreReadonly = ignoreReadonly;
  24792. return picker;
  24793. };
  24794. picker.options = function (newOptions) {
  24795. if (arguments.length === 0) {
  24796. return $.extend(true, {}, options);
  24797. }
  24798. if (!(newOptions instanceof Object)) {
  24799. throw new TypeError('options() options parameter should be an object');
  24800. }
  24801. $.extend(true, options, newOptions);
  24802. $.each(options, function (key, value) {
  24803. if (picker[key] !== undefined) {
  24804. picker[key](value);
  24805. } else {
  24806. throw new TypeError('option ' + key + ' is not recognized!');
  24807. }
  24808. });
  24809. return picker;
  24810. };
  24811. picker.date = function (newDate) {
  24812. ///<signature helpKeyword="$.fn.datetimepicker.date">
  24813. ///<summary>Returns the component's model current date, a moment object or null if not set.</summary>
  24814. ///<returns type="Moment">date.clone()</returns>
  24815. ///</signature>
  24816. ///<signature>
  24817. ///<summary>Sets the components model current moment to it. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.</summary>
  24818. ///<param name="newDate" locid="$.fn.datetimepicker.date_p:newDate">Takes string, Date, moment, null parameter.</param>
  24819. ///</signature>
  24820. if (arguments.length === 0) {
  24821. if (unset) {
  24822. return null;
  24823. }
  24824. return date.clone();
  24825. }
  24826. if (newDate !== null && typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
  24827. throw new TypeError('date() parameter must be one of [null, string, moment or Date]');
  24828. }
  24829. setValue(newDate === null ? null : parseInputDate(newDate));
  24830. return picker;
  24831. };
  24832. picker.format = function (newFormat) {
  24833. ///<summary>test su</summary>
  24834. ///<param name="newFormat">info about para</param>
  24835. ///<returns type="string|boolean">returns foo</returns>
  24836. if (arguments.length === 0) {
  24837. return options.format;
  24838. }
  24839. if ((typeof newFormat !== 'string') && ((typeof newFormat !== 'boolean') || (newFormat !== false))) {
  24840. throw new TypeError('format() expects a sting or boolean:false parameter ' + newFormat);
  24841. }
  24842. options.format = newFormat;
  24843. if (actualFormat) {
  24844. initFormatting(); // reinit formatting
  24845. }
  24846. return picker;
  24847. };
  24848. picker.dayViewHeaderFormat = function (newFormat) {
  24849. if (arguments.length === 0) {
  24850. return options.dayViewHeaderFormat;
  24851. }
  24852. if (typeof newFormat !== 'string') {
  24853. throw new TypeError('dayViewHeaderFormat() expects a string parameter');
  24854. }
  24855. options.dayViewHeaderFormat = newFormat;
  24856. return picker;
  24857. };
  24858. picker.extraFormats = function (formats) {
  24859. if (arguments.length === 0) {
  24860. return options.extraFormats;
  24861. }
  24862. if (formats !== false && !(formats instanceof Array)) {
  24863. throw new TypeError('extraFormats() expects an array or false parameter');
  24864. }
  24865. options.extraFormats = formats;
  24866. if (parseFormats) {
  24867. initFormatting(); // reinit formatting
  24868. }
  24869. return picker;
  24870. };
  24871. picker.disabledDates = function (dates) {
  24872. ///<signature helpKeyword="$.fn.datetimepicker.disabledDates">
  24873. ///<summary>Returns an array with the currently set disabled dates on the component.</summary>
  24874. ///<returns type="array">options.disabledDates</returns>
  24875. ///</signature>
  24876. ///<signature>
  24877. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
  24878. ///options.enabledDates if such exist.</summary>
  24879. ///<param name="dates" locid="$.fn.datetimepicker.disabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
  24880. ///</signature>
  24881. if (arguments.length === 0) {
  24882. return (options.disabledDates ? $.extend({}, options.disabledDates) : options.disabledDates);
  24883. }
  24884. if (!dates) {
  24885. options.disabledDates = false;
  24886. update();
  24887. return picker;
  24888. }
  24889. if (!(dates instanceof Array)) {
  24890. throw new TypeError('disabledDates() expects an array parameter');
  24891. }
  24892. options.disabledDates = indexGivenDates(dates);
  24893. options.enabledDates = false;
  24894. update();
  24895. return picker;
  24896. };
  24897. picker.enabledDates = function (dates) {
  24898. ///<signature helpKeyword="$.fn.datetimepicker.enabledDates">
  24899. ///<summary>Returns an array with the currently set enabled dates on the component.</summary>
  24900. ///<returns type="array">options.enabledDates</returns>
  24901. ///</signature>
  24902. ///<signature>
  24903. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledDates if such exist.</summary>
  24904. ///<param name="dates" locid="$.fn.datetimepicker.enabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
  24905. ///</signature>
  24906. if (arguments.length === 0) {
  24907. return (options.enabledDates ? $.extend({}, options.enabledDates) : options.enabledDates);
  24908. }
  24909. if (!dates) {
  24910. options.enabledDates = false;
  24911. update();
  24912. return picker;
  24913. }
  24914. if (!(dates instanceof Array)) {
  24915. throw new TypeError('enabledDates() expects an array parameter');
  24916. }
  24917. options.enabledDates = indexGivenDates(dates);
  24918. options.disabledDates = false;
  24919. update();
  24920. return picker;
  24921. };
  24922. picker.daysOfWeekDisabled = function (daysOfWeekDisabled) {
  24923. if (arguments.length === 0) {
  24924. return options.daysOfWeekDisabled.splice(0);
  24925. }
  24926. if ((typeof daysOfWeekDisabled === 'boolean') && !daysOfWeekDisabled) {
  24927. options.daysOfWeekDisabled = false;
  24928. update();
  24929. return picker;
  24930. }
  24931. if (!(daysOfWeekDisabled instanceof Array)) {
  24932. throw new TypeError('daysOfWeekDisabled() expects an array parameter');
  24933. }
  24934. options.daysOfWeekDisabled = daysOfWeekDisabled.reduce(function (previousValue, currentValue) {
  24935. currentValue = parseInt(currentValue, 10);
  24936. if (currentValue > 6 || currentValue < 0 || isNaN(currentValue)) {
  24937. return previousValue;
  24938. }
  24939. if (previousValue.indexOf(currentValue) === -1) {
  24940. previousValue.push(currentValue);
  24941. }
  24942. return previousValue;
  24943. }, []).sort();
  24944. if (options.useCurrent && !options.keepInvalid) {
  24945. var tries = 0;
  24946. while (!isValid(date, 'd')) {
  24947. date.add(1, 'd');
  24948. if (tries === 7) {
  24949. throw 'Tried 7 times to find a valid date';
  24950. }
  24951. tries++;
  24952. }
  24953. setValue(date);
  24954. }
  24955. update();
  24956. return picker;
  24957. };
  24958. picker.maxDate = function (maxDate) {
  24959. if (arguments.length === 0) {
  24960. return options.maxDate ? options.maxDate.clone() : options.maxDate;
  24961. }
  24962. if ((typeof maxDate === 'boolean') && maxDate === false) {
  24963. options.maxDate = false;
  24964. update();
  24965. return picker;
  24966. }
  24967. if (typeof maxDate === 'string') {
  24968. if (maxDate === 'now' || maxDate === 'moment') {
  24969. maxDate = moment();
  24970. }
  24971. }
  24972. var parsedDate = parseInputDate(maxDate);
  24973. if (!parsedDate.isValid()) {
  24974. throw new TypeError('maxDate() Could not parse date parameter: ' + maxDate);
  24975. }
  24976. if (options.minDate && parsedDate.isBefore(options.minDate)) {
  24977. throw new TypeError('maxDate() date parameter is before options.minDate: ' + parsedDate.format(actualFormat));
  24978. }
  24979. options.maxDate = parsedDate;
  24980. if (options.useCurrent && !options.keepInvalid && date.isAfter(maxDate)) {
  24981. setValue(options.maxDate);
  24982. }
  24983. if (viewDate.isAfter(parsedDate)) {
  24984. viewDate = parsedDate.clone();
  24985. }
  24986. update();
  24987. return picker;
  24988. };
  24989. picker.minDate = function (minDate) {
  24990. if (arguments.length === 0) {
  24991. return options.minDate ? options.minDate.clone() : options.minDate;
  24992. }
  24993. if ((typeof minDate === 'boolean') && minDate === false) {
  24994. options.minDate = false;
  24995. update();
  24996. return picker;
  24997. }
  24998. if (typeof minDate === 'string') {
  24999. if (minDate === 'now' || minDate === 'moment') {
  25000. minDate = moment();
  25001. }
  25002. }
  25003. var parsedDate = parseInputDate(minDate);
  25004. if (!parsedDate.isValid()) {
  25005. throw new TypeError('minDate() Could not parse date parameter: ' + minDate);
  25006. }
  25007. if (options.maxDate && parsedDate.isAfter(options.maxDate)) {
  25008. throw new TypeError('minDate() date parameter is after options.maxDate: ' + parsedDate.format(actualFormat));
  25009. }
  25010. options.minDate = parsedDate;
  25011. if (options.useCurrent && !options.keepInvalid && date.isBefore(minDate)) {
  25012. setValue(options.minDate);
  25013. }
  25014. if (viewDate.isBefore(parsedDate)) {
  25015. viewDate = parsedDate.clone();
  25016. }
  25017. update();
  25018. return picker;
  25019. };
  25020. picker.defaultDate = function (defaultDate) {
  25021. ///<signature helpKeyword="$.fn.datetimepicker.defaultDate">
  25022. ///<summary>Returns a moment with the options.defaultDate option configuration or false if not set</summary>
  25023. ///<returns type="Moment">date.clone()</returns>
  25024. ///</signature>
  25025. ///<signature>
  25026. ///<summary>Will set the picker's inital date. If a boolean:false value is passed the options.defaultDate parameter is cleared.</summary>
  25027. ///<param name="defaultDate" locid="$.fn.datetimepicker.defaultDate_p:defaultDate">Takes a string, Date, moment, boolean:false</param>
  25028. ///</signature>
  25029. if (arguments.length === 0) {
  25030. return options.defaultDate ? options.defaultDate.clone() : options.defaultDate;
  25031. }
  25032. if (!defaultDate) {
  25033. options.defaultDate = false;
  25034. return picker;
  25035. }
  25036. if (typeof defaultDate === 'string') {
  25037. if (defaultDate === 'now' || defaultDate === 'moment') {
  25038. defaultDate = moment();
  25039. }
  25040. }
  25041. var parsedDate = parseInputDate(defaultDate);
  25042. if (!parsedDate.isValid()) {
  25043. throw new TypeError('defaultDate() Could not parse date parameter: ' + defaultDate);
  25044. }
  25045. if (!isValid(parsedDate)) {
  25046. throw new TypeError('defaultDate() date passed is invalid according to component setup validations');
  25047. }
  25048. options.defaultDate = parsedDate;
  25049. if (options.defaultDate && options.inline || (input.val().trim() === '' && input.attr('placeholder') === undefined)) {
  25050. setValue(options.defaultDate);
  25051. }
  25052. return picker;
  25053. };
  25054. picker.locale = function (locale) {
  25055. if (arguments.length === 0) {
  25056. return options.locale;
  25057. }
  25058. if (!moment.localeData(locale)) {
  25059. throw new TypeError('locale() locale ' + locale + ' is not loaded from moment locales!');
  25060. }
  25061. options.locale = locale;
  25062. date.locale(options.locale);
  25063. viewDate.locale(options.locale);
  25064. if (actualFormat) {
  25065. initFormatting(); // reinit formatting
  25066. }
  25067. if (widget) {
  25068. hide();
  25069. show();
  25070. }
  25071. return picker;
  25072. };
  25073. picker.stepping = function (stepping) {
  25074. if (arguments.length === 0) {
  25075. return options.stepping;
  25076. }
  25077. stepping = parseInt(stepping, 10);
  25078. if (isNaN(stepping) || stepping < 1) {
  25079. stepping = 1;
  25080. }
  25081. options.stepping = stepping;
  25082. return picker;
  25083. };
  25084. picker.useCurrent = function (useCurrent) {
  25085. var useCurrentOptions = ['year', 'month', 'day', 'hour', 'minute'];
  25086. if (arguments.length === 0) {
  25087. return options.useCurrent;
  25088. }
  25089. if ((typeof useCurrent !== 'boolean') && (typeof useCurrent !== 'string')) {
  25090. throw new TypeError('useCurrent() expects a boolean or string parameter');
  25091. }
  25092. if (typeof useCurrent === 'string' && useCurrentOptions.indexOf(useCurrent.toLowerCase()) === -1) {
  25093. throw new TypeError('useCurrent() expects a string parameter of ' + useCurrentOptions.join(', '));
  25094. }
  25095. options.useCurrent = useCurrent;
  25096. return picker;
  25097. };
  25098. picker.collapse = function (collapse) {
  25099. if (arguments.length === 0) {
  25100. return options.collapse;
  25101. }
  25102. if (typeof collapse !== 'boolean') {
  25103. throw new TypeError('collapse() expects a boolean parameter');
  25104. }
  25105. if (options.collapse === collapse) {
  25106. return picker;
  25107. }
  25108. options.collapse = collapse;
  25109. if (widget) {
  25110. hide();
  25111. show();
  25112. }
  25113. return picker;
  25114. };
  25115. picker.icons = function (icons) {
  25116. if (arguments.length === 0) {
  25117. return $.extend({}, options.icons);
  25118. }
  25119. if (!(icons instanceof Object)) {
  25120. throw new TypeError('icons() expects parameter to be an Object');
  25121. }
  25122. $.extend(options.icons, icons);
  25123. if (widget) {
  25124. hide();
  25125. show();
  25126. }
  25127. return picker;
  25128. };
  25129. picker.useStrict = function (useStrict) {
  25130. if (arguments.length === 0) {
  25131. return options.useStrict;
  25132. }
  25133. if (typeof useStrict !== 'boolean') {
  25134. throw new TypeError('useStrict() expects a boolean parameter');
  25135. }
  25136. options.useStrict = useStrict;
  25137. return picker;
  25138. };
  25139. picker.sideBySide = function (sideBySide) {
  25140. if (arguments.length === 0) {
  25141. return options.sideBySide;
  25142. }
  25143. if (typeof sideBySide !== 'boolean') {
  25144. throw new TypeError('sideBySide() expects a boolean parameter');
  25145. }
  25146. options.sideBySide = sideBySide;
  25147. if (widget) {
  25148. hide();
  25149. show();
  25150. }
  25151. return picker;
  25152. };
  25153. picker.viewMode = function (viewMode) {
  25154. if (arguments.length === 0) {
  25155. return options.viewMode;
  25156. }
  25157. if (typeof viewMode !== 'string') {
  25158. throw new TypeError('viewMode() expects a string parameter');
  25159. }
  25160. if (viewModes.indexOf(viewMode) === -1) {
  25161. throw new TypeError('viewMode() parameter must be one of (' + viewModes.join(', ') + ') value');
  25162. }
  25163. options.viewMode = viewMode;
  25164. currentViewMode = Math.max(viewModes.indexOf(viewMode), minViewModeNumber);
  25165. showMode();
  25166. return picker;
  25167. };
  25168. picker.toolbarPlacement = function (toolbarPlacement) {
  25169. if (arguments.length === 0) {
  25170. return options.toolbarPlacement;
  25171. }
  25172. if (typeof toolbarPlacement !== 'string') {
  25173. throw new TypeError('toolbarPlacement() expects a string parameter');
  25174. }
  25175. if (toolbarPlacements.indexOf(toolbarPlacement) === -1) {
  25176. throw new TypeError('toolbarPlacement() parameter must be one of (' + toolbarPlacements.join(', ') + ') value');
  25177. }
  25178. options.toolbarPlacement = toolbarPlacement;
  25179. if (widget) {
  25180. hide();
  25181. show();
  25182. }
  25183. return picker;
  25184. };
  25185. picker.widgetPositioning = function (widgetPositioning) {
  25186. if (arguments.length === 0) {
  25187. return $.extend({}, options.widgetPositioning);
  25188. }
  25189. if (({}).toString.call(widgetPositioning) !== '[object Object]') {
  25190. throw new TypeError('widgetPositioning() expects an object variable');
  25191. }
  25192. if (widgetPositioning.horizontal) {
  25193. if (typeof widgetPositioning.horizontal !== 'string') {
  25194. throw new TypeError('widgetPositioning() horizontal variable must be a string');
  25195. }
  25196. widgetPositioning.horizontal = widgetPositioning.horizontal.toLowerCase();
  25197. if (horizontalModes.indexOf(widgetPositioning.horizontal) === -1) {
  25198. throw new TypeError('widgetPositioning() expects horizontal parameter to be one of (' + horizontalModes.join(', ') + ')');
  25199. }
  25200. options.widgetPositioning.horizontal = widgetPositioning.horizontal;
  25201. }
  25202. if (widgetPositioning.vertical) {
  25203. if (typeof widgetPositioning.vertical !== 'string') {
  25204. throw new TypeError('widgetPositioning() vertical variable must be a string');
  25205. }
  25206. widgetPositioning.vertical = widgetPositioning.vertical.toLowerCase();
  25207. if (verticalModes.indexOf(widgetPositioning.vertical) === -1) {
  25208. throw new TypeError('widgetPositioning() expects vertical parameter to be one of (' + verticalModes.join(', ') + ')');
  25209. }
  25210. options.widgetPositioning.vertical = widgetPositioning.vertical;
  25211. }
  25212. update();
  25213. return picker;
  25214. };
  25215. picker.calendarWeeks = function (calendarWeeks) {
  25216. if (arguments.length === 0) {
  25217. return options.calendarWeeks;
  25218. }
  25219. if (typeof calendarWeeks !== 'boolean') {
  25220. throw new TypeError('calendarWeeks() expects parameter to be a boolean value');
  25221. }
  25222. options.calendarWeeks = calendarWeeks;
  25223. update();
  25224. return picker;
  25225. };
  25226. picker.showTodayButton = function (showTodayButton) {
  25227. if (arguments.length === 0) {
  25228. return options.showTodayButton;
  25229. }
  25230. if (typeof showTodayButton !== 'boolean') {
  25231. throw new TypeError('showTodayButton() expects a boolean parameter');
  25232. }
  25233. options.showTodayButton = showTodayButton;
  25234. if (widget) {
  25235. hide();
  25236. show();
  25237. }
  25238. return picker;
  25239. };
  25240. picker.showClear = function (showClear) {
  25241. if (arguments.length === 0) {
  25242. return options.showClear;
  25243. }
  25244. if (typeof showClear !== 'boolean') {
  25245. throw new TypeError('showClear() expects a boolean parameter');
  25246. }
  25247. options.showClear = showClear;
  25248. if (widget) {
  25249. hide();
  25250. show();
  25251. }
  25252. return picker;
  25253. };
  25254. picker.widgetParent = function (widgetParent) {
  25255. if (arguments.length === 0) {
  25256. return options.widgetParent;
  25257. }
  25258. if (typeof widgetParent === 'string') {
  25259. widgetParent = $(widgetParent);
  25260. }
  25261. if (widgetParent !== null && (typeof widgetParent !== 'string' && !(widgetParent instanceof $))) {
  25262. throw new TypeError('widgetParent() expects a string or a jQuery object parameter');
  25263. }
  25264. options.widgetParent = widgetParent;
  25265. if (widget) {
  25266. hide();
  25267. show();
  25268. }
  25269. return picker;
  25270. };
  25271. picker.keepOpen = function (keepOpen) {
  25272. if (arguments.length === 0) {
  25273. return options.keepOpen;
  25274. }
  25275. if (typeof keepOpen !== 'boolean') {
  25276. throw new TypeError('keepOpen() expects a boolean parameter');
  25277. }
  25278. options.keepOpen = keepOpen;
  25279. return picker;
  25280. };
  25281. picker.focusOnShow = function (focusOnShow) {
  25282. if (arguments.length === 0) {
  25283. return options.focusOnShow;
  25284. }
  25285. if (typeof focusOnShow !== 'boolean') {
  25286. throw new TypeError('focusOnShow() expects a boolean parameter');
  25287. }
  25288. options.focusOnShow = focusOnShow;
  25289. return picker;
  25290. };
  25291. picker.inline = function (inline) {
  25292. if (arguments.length === 0) {
  25293. return options.inline;
  25294. }
  25295. if (typeof inline !== 'boolean') {
  25296. throw new TypeError('inline() expects a boolean parameter');
  25297. }
  25298. options.inline = inline;
  25299. return picker;
  25300. };
  25301. picker.clear = function () {
  25302. clear();
  25303. return picker;
  25304. };
  25305. picker.keyBinds = function (keyBinds) {
  25306. options.keyBinds = keyBinds;
  25307. return picker;
  25308. };
  25309. picker.debug = function (debug) {
  25310. if (typeof debug !== 'boolean') {
  25311. throw new TypeError('debug() expects a boolean parameter');
  25312. }
  25313. options.debug = debug;
  25314. return picker;
  25315. };
  25316. picker.allowInputToggle = function (allowInputToggle) {
  25317. if (arguments.length === 0) {
  25318. return options.allowInputToggle;
  25319. }
  25320. if (typeof allowInputToggle !== 'boolean') {
  25321. throw new TypeError('allowInputToggle() expects a boolean parameter');
  25322. }
  25323. options.allowInputToggle = allowInputToggle;
  25324. return picker;
  25325. };
  25326. picker.showClose = function (showClose) {
  25327. if (arguments.length === 0) {
  25328. return options.showClose;
  25329. }
  25330. if (typeof showClose !== 'boolean') {
  25331. throw new TypeError('showClose() expects a boolean parameter');
  25332. }
  25333. options.showClose = showClose;
  25334. return picker;
  25335. };
  25336. picker.keepInvalid = function (keepInvalid) {
  25337. if (arguments.length === 0) {
  25338. return options.keepInvalid;
  25339. }
  25340. if (typeof keepInvalid !== 'boolean') {
  25341. throw new TypeError('keepInvalid() expects a boolean parameter');
  25342. }
  25343. options.keepInvalid = keepInvalid;
  25344. return picker;
  25345. };
  25346. picker.datepickerInput = function (datepickerInput) {
  25347. if (arguments.length === 0) {
  25348. return options.datepickerInput;
  25349. }
  25350. if (typeof datepickerInput !== 'string') {
  25351. throw new TypeError('datepickerInput() expects a string parameter');
  25352. }
  25353. options.datepickerInput = datepickerInput;
  25354. return picker;
  25355. };
  25356. picker.parseInputDate = function (parseInputDate) {
  25357. if (arguments.length === 0) {
  25358. return options.parseInputDate;
  25359. }
  25360. if (typeof parseInputDate !== 'function') {
  25361. throw new TypeError('parseInputDate() sholud be as function');
  25362. }
  25363. options.parseInputDate = parseInputDate;
  25364. return picker;
  25365. };
  25366. picker.disabledTimeIntervals = function (disabledTimeIntervals) {
  25367. ///<signature helpKeyword="$.fn.datetimepicker.disabledTimeIntervals">
  25368. ///<summary>Returns an array with the currently set disabled dates on the component.</summary>
  25369. ///<returns type="array">options.disabledTimeIntervals</returns>
  25370. ///</signature>
  25371. ///<signature>
  25372. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
  25373. ///options.enabledDates if such exist.</summary>
  25374. ///<param name="dates" locid="$.fn.datetimepicker.disabledTimeIntervals_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
  25375. ///</signature>
  25376. if (arguments.length === 0) {
  25377. return (options.disabledTimeIntervals ? $.extend({}, options.disabledTimeIntervals) : options.disabledTimeIntervals);
  25378. }
  25379. if (!disabledTimeIntervals) {
  25380. options.disabledTimeIntervals = false;
  25381. update();
  25382. return picker;
  25383. }
  25384. if (!(disabledTimeIntervals instanceof Array)) {
  25385. throw new TypeError('disabledTimeIntervals() expects an array parameter');
  25386. }
  25387. options.disabledTimeIntervals = disabledTimeIntervals;
  25388. update();
  25389. return picker;
  25390. };
  25391. picker.disabledHours = function (hours) {
  25392. ///<signature helpKeyword="$.fn.datetimepicker.disabledHours">
  25393. ///<summary>Returns an array with the currently set disabled hours on the component.</summary>
  25394. ///<returns type="array">options.disabledHours</returns>
  25395. ///</signature>
  25396. ///<signature>
  25397. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
  25398. ///options.enabledHours if such exist.</summary>
  25399. ///<param name="hours" locid="$.fn.datetimepicker.disabledHours_p:hours">Takes an [ int ] of values and disallows the user to select only from those hours.</param>
  25400. ///</signature>
  25401. if (arguments.length === 0) {
  25402. return (options.disabledHours ? $.extend({}, options.disabledHours) : options.disabledHours);
  25403. }
  25404. if (!hours) {
  25405. options.disabledHours = false;
  25406. update();
  25407. return picker;
  25408. }
  25409. if (!(hours instanceof Array)) {
  25410. throw new TypeError('disabledHours() expects an array parameter');
  25411. }
  25412. options.disabledHours = indexGivenHours(hours);
  25413. options.enabledHours = false;
  25414. if (options.useCurrent && !options.keepInvalid) {
  25415. var tries = 0;
  25416. while (!isValid(date, 'h')) {
  25417. date.add(1, 'h');
  25418. if (tries === 24) {
  25419. throw 'Tried 24 times to find a valid date';
  25420. }
  25421. tries++;
  25422. }
  25423. setValue(date);
  25424. }
  25425. update();
  25426. return picker;
  25427. };
  25428. picker.enabledHours = function (hours) {
  25429. ///<signature helpKeyword="$.fn.datetimepicker.enabledHours">
  25430. ///<summary>Returns an array with the currently set enabled hours on the component.</summary>
  25431. ///<returns type="array">options.enabledHours</returns>
  25432. ///</signature>
  25433. ///<signature>
  25434. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledHours if such exist.</summary>
  25435. ///<param name="hours" locid="$.fn.datetimepicker.enabledHours_p:hours">Takes an [ int ] of values and allows the user to select only from those hours.</param>
  25436. ///</signature>
  25437. if (arguments.length === 0) {
  25438. return (options.enabledHours ? $.extend({}, options.enabledHours) : options.enabledHours);
  25439. }
  25440. if (!hours) {
  25441. options.enabledHours = false;
  25442. update();
  25443. return picker;
  25444. }
  25445. if (!(hours instanceof Array)) {
  25446. throw new TypeError('enabledHours() expects an array parameter');
  25447. }
  25448. options.enabledHours = indexGivenHours(hours);
  25449. options.disabledHours = false;
  25450. if (options.useCurrent && !options.keepInvalid) {
  25451. var tries = 0;
  25452. while (!isValid(date, 'h')) {
  25453. date.add(1, 'h');
  25454. if (tries === 24) {
  25455. throw 'Tried 24 times to find a valid date';
  25456. }
  25457. tries++;
  25458. }
  25459. setValue(date);
  25460. }
  25461. update();
  25462. return picker;
  25463. };
  25464. picker.viewDate = function (newDate) {
  25465. ///<signature helpKeyword="$.fn.datetimepicker.viewDate">
  25466. ///<summary>Returns the component's model current viewDate, a moment object or null if not set.</summary>
  25467. ///<returns type="Moment">viewDate.clone()</returns>
  25468. ///</signature>
  25469. ///<signature>
  25470. ///<summary>Sets the components model current moment to it. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.</summary>
  25471. ///<param name="newDate" locid="$.fn.datetimepicker.date_p:newDate">Takes string, viewDate, moment, null parameter.</param>
  25472. ///</signature>
  25473. if (arguments.length === 0) {
  25474. return viewDate.clone();
  25475. }
  25476. if (!newDate) {
  25477. viewDate = date.clone();
  25478. return picker;
  25479. }
  25480. if (typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
  25481. throw new TypeError('viewDate() parameter must be one of [string, moment or Date]');
  25482. }
  25483. viewDate = parseInputDate(newDate);
  25484. viewUpdate();
  25485. return picker;
  25486. };
  25487. // initializing element and component attributes
  25488. if (element.is('input')) {
  25489. input = element;
  25490. } else {
  25491. input = element.find(options.datepickerInput);
  25492. if (input.size() === 0) {
  25493. input = element.find('input');
  25494. } else if (!input.is('input')) {
  25495. throw new Error('CSS class "' + options.datepickerInput + '" cannot be applied to non input element');
  25496. }
  25497. }
  25498. if (element.hasClass('input-group')) {
  25499. // in case there is more then one 'input-group-addon' Issue #48
  25500. if (element.find('.datepickerbutton').size() === 0) {
  25501. component = element.find('[class^="input-group-"]');
  25502. } else {
  25503. component = element.find('.datepickerbutton');
  25504. }
  25505. }
  25506. if (!options.inline && !input.is('input')) {
  25507. throw new Error('Could not initialize DateTimePicker without an input element');
  25508. }
  25509. $.extend(true, options, dataToOptions());
  25510. picker.options(options);
  25511. initFormatting();
  25512. attachDatePickerElementEvents();
  25513. if (input.prop('disabled')) {
  25514. picker.disable();
  25515. }
  25516. if (input.is('input') && input.val().trim().length !== 0) {
  25517. setValue(parseInputDate(input.val().trim()));
  25518. }
  25519. else if (options.defaultDate && input.attr('placeholder') === undefined) {
  25520. setValue(options.defaultDate);
  25521. }
  25522. if (options.inline) {
  25523. show();
  25524. }
  25525. return picker;
  25526. };
  25527. /********************************************************************************
  25528. *
  25529. * jQuery plugin constructor and defaults object
  25530. *
  25531. ********************************************************************************/
  25532. $.fn.datetimepicker = function (options) {
  25533. return this.each(function () {
  25534. var $this = $(this);
  25535. if (!$this.data('DateTimePicker')) {
  25536. // create a private copy of the defaults object
  25537. options = $.extend(true, {}, $.fn.datetimepicker.defaults, options);
  25538. $this.data('DateTimePicker', dateTimePicker($this, options));
  25539. }
  25540. });
  25541. };
  25542. $.fn.datetimepicker.defaults = {
  25543. format: false,
  25544. dayViewHeaderFormat: 'MMMM YYYY',
  25545. extraFormats: false,
  25546. stepping: 1,
  25547. minDate: false,
  25548. maxDate: false,
  25549. useCurrent: true,
  25550. collapse: true,
  25551. locale: moment.locale(),
  25552. defaultDate: false,
  25553. disabledDates: false,
  25554. enabledDates: false,
  25555. icons: {
  25556. time: 'glyphicon glyphicon-time',
  25557. date: 'glyphicon glyphicon-calendar',
  25558. up: 'glyphicon glyphicon-chevron-up',
  25559. down: 'glyphicon glyphicon-chevron-down',
  25560. previous: 'glyphicon glyphicon-chevron-left',
  25561. next: 'glyphicon glyphicon-chevron-right',
  25562. today: 'glyphicon glyphicon-screenshot',
  25563. clear: 'glyphicon glyphicon-trash',
  25564. close: 'glyphicon glyphicon-remove'
  25565. },
  25566. useStrict: false,
  25567. sideBySide: false,
  25568. daysOfWeekDisabled: false,
  25569. calendarWeeks: false,
  25570. viewMode: 'days',
  25571. toolbarPlacement: 'default',
  25572. showTodayButton: false,
  25573. showClear: false,
  25574. showClose: false,
  25575. widgetPositioning: {
  25576. horizontal: 'auto',
  25577. vertical: 'auto'
  25578. },
  25579. widgetParent: null,
  25580. ignoreReadonly: false,
  25581. keepOpen: false,
  25582. focusOnShow: true,
  25583. inline: false,
  25584. keepInvalid: false,
  25585. datepickerInput: '.datepickerinput',
  25586. keyBinds: {
  25587. up: function (widget) {
  25588. if (!widget) {
  25589. return;
  25590. }
  25591. var d = this.date() || moment();
  25592. if (widget.find('.datepicker').is(':visible')) {
  25593. this.date(d.clone().subtract(7, 'd'));
  25594. } else {
  25595. this.date(d.clone().add(1, 'm'));
  25596. }
  25597. },
  25598. down: function (widget) {
  25599. if (!widget) {
  25600. this.show();
  25601. return;
  25602. }
  25603. var d = this.date() || moment();
  25604. if (widget.find('.datepicker').is(':visible')) {
  25605. this.date(d.clone().add(7, 'd'));
  25606. } else {
  25607. this.date(d.clone().subtract(1, 'm'));
  25608. }
  25609. },
  25610. 'control up': function (widget) {
  25611. if (!widget) {
  25612. return;
  25613. }
  25614. var d = this.date() || moment();
  25615. if (widget.find('.datepicker').is(':visible')) {
  25616. this.date(d.clone().subtract(1, 'y'));
  25617. } else {
  25618. this.date(d.clone().add(1, 'h'));
  25619. }
  25620. },
  25621. 'control down': function (widget) {
  25622. if (!widget) {
  25623. return;
  25624. }
  25625. var d = this.date() || moment();
  25626. if (widget.find('.datepicker').is(':visible')) {
  25627. this.date(d.clone().add(1, 'y'));
  25628. } else {
  25629. this.date(d.clone().subtract(1, 'h'));
  25630. }
  25631. },
  25632. left: function (widget) {
  25633. if (!widget) {
  25634. return;
  25635. }
  25636. var d = this.date() || moment();
  25637. if (widget.find('.datepicker').is(':visible')) {
  25638. this.date(d.clone().subtract(1, 'd'));
  25639. }
  25640. },
  25641. right: function (widget) {
  25642. if (!widget) {
  25643. return;
  25644. }
  25645. var d = this.date() || moment();
  25646. if (widget.find('.datepicker').is(':visible')) {
  25647. this.date(d.clone().add(1, 'd'));
  25648. }
  25649. },
  25650. pageUp: function (widget) {
  25651. if (!widget) {
  25652. return;
  25653. }
  25654. var d = this.date() || moment();
  25655. if (widget.find('.datepicker').is(':visible')) {
  25656. this.date(d.clone().subtract(1, 'M'));
  25657. }
  25658. },
  25659. pageDown: function (widget) {
  25660. if (!widget) {
  25661. return;
  25662. }
  25663. var d = this.date() || moment();
  25664. if (widget.find('.datepicker').is(':visible')) {
  25665. this.date(d.clone().add(1, 'M'));
  25666. }
  25667. },
  25668. enter: function () {
  25669. this.hide();
  25670. },
  25671. escape: function () {
  25672. this.hide();
  25673. },
  25674. //tab: function (widget) { //this break the flow of the form. disabling for now
  25675. // var toggle = widget.find('.picker-switch a[data-action="togglePicker"]');
  25676. // if(toggle.length > 0) toggle.click();
  25677. //},
  25678. 'control space': function (widget) {
  25679. if (widget.find('.timepicker').is(':visible')) {
  25680. widget.find('.btn[data-action="togglePeriod"]').click();
  25681. }
  25682. },
  25683. t: function () {
  25684. this.date(moment());
  25685. },
  25686. 'delete': function () {
  25687. this.clear();
  25688. }
  25689. },
  25690. debug: false,
  25691. allowInputToggle: false,
  25692. disabledTimeIntervals: false,
  25693. disabledHours: false,
  25694. enabledHours: false,
  25695. viewDate: false
  25696. };
  25697. }));
  25698. /**
  25699. *
  25700. * Color picker
  25701. * Author: Stefan Petre www.eyecon.ro
  25702. *
  25703. * Dual licensed under the MIT and GPL licenses
  25704. *
  25705. */
  25706. (function ($) {
  25707. var ColorPicker = function () {
  25708. var
  25709. ids = {},
  25710. inAction,
  25711. charMin = 65,
  25712. visible,
  25713. tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
  25714. defaults = {
  25715. eventName: 'click',
  25716. onShow: function () {},
  25717. onBeforeShow: function(){},
  25718. onHide: function () {},
  25719. onChange: function () {},
  25720. onSubmit: function () {},
  25721. color: 'ff0000',
  25722. livePreview: true,
  25723. flat: false
  25724. },
  25725. fillRGBFields = function (hsb, cal) {
  25726. var rgb = HSBToRGB(hsb);
  25727. $(cal).data('colorpicker').fields
  25728. .eq(1).val(rgb.r).end()
  25729. .eq(2).val(rgb.g).end()
  25730. .eq(3).val(rgb.b).end();
  25731. },
  25732. fillHSBFields = function (hsb, cal) {
  25733. $(cal).data('colorpicker').fields
  25734. .eq(4).val(hsb.h).end()
  25735. .eq(5).val(hsb.s).end()
  25736. .eq(6).val(hsb.b).end();
  25737. },
  25738. fillHexFields = function (hsb, cal) {
  25739. $(cal).data('colorpicker').fields
  25740. .eq(0).val(HSBToHex(hsb)).end();
  25741. },
  25742. setSelector = function (hsb, cal) {
  25743. $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
  25744. $(cal).data('colorpicker').selectorIndic.css({
  25745. left: parseInt(150 * hsb.s/100, 10),
  25746. top: parseInt(150 * (100-hsb.b)/100, 10)
  25747. });
  25748. },
  25749. setHue = function (hsb, cal) {
  25750. $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
  25751. },
  25752. setCurrentColor = function (hsb, cal) {
  25753. $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
  25754. },
  25755. setNewColor = function (hsb, cal) {
  25756. $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
  25757. },
  25758. keyDown = function (ev) {
  25759. var pressedKey = ev.charCode || ev.keyCode || -1;
  25760. if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
  25761. return false;
  25762. }
  25763. var cal = $(this).parent().parent();
  25764. if (cal.data('colorpicker').livePreview === true) {
  25765. change.apply(this);
  25766. }
  25767. },
  25768. change = function (ev) {
  25769. var cal = $(this).parent().parent(), col;
  25770. if (this.parentNode.className.indexOf('_hex') > 0) {
  25771. cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
  25772. } else if (this.parentNode.className.indexOf('_hsb') > 0) {
  25773. cal.data('colorpicker').color = col = fixHSB({
  25774. h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
  25775. s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
  25776. b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
  25777. });
  25778. } else {
  25779. cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
  25780. r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
  25781. g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
  25782. b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
  25783. }));
  25784. }
  25785. if (ev) {
  25786. fillRGBFields(col, cal.get(0));
  25787. fillHexFields(col, cal.get(0));
  25788. fillHSBFields(col, cal.get(0));
  25789. }
  25790. setSelector(col, cal.get(0));
  25791. setHue(col, cal.get(0));
  25792. setNewColor(col, cal.get(0));
  25793. cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
  25794. },
  25795. blur = function (ev) {
  25796. var cal = $(this).parent().parent();
  25797. cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
  25798. },
  25799. focus = function () {
  25800. charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
  25801. $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
  25802. $(this).parent().addClass('colorpicker_focus');
  25803. },
  25804. downIncrement = function (ev) {
  25805. var field = $(this).parent().find('input').focus();
  25806. var current = {
  25807. el: $(this).parent().addClass('colorpicker_slider'),
  25808. max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
  25809. y: ev.pageY,
  25810. field: field,
  25811. val: parseInt(field.val(), 10),
  25812. preview: $(this).parent().parent().data('colorpicker').livePreview
  25813. };
  25814. $(document).bind('mouseup', current, upIncrement);
  25815. $(document).bind('mousemove', current, moveIncrement);
  25816. },
  25817. moveIncrement = function (ev) {
  25818. ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
  25819. if (ev.data.preview) {
  25820. change.apply(ev.data.field.get(0), [true]);
  25821. }
  25822. return false;
  25823. },
  25824. upIncrement = function (ev) {
  25825. change.apply(ev.data.field.get(0), [true]);
  25826. ev.data.el.removeClass('colorpicker_slider').find('input').focus();
  25827. $(document).unbind('mouseup', upIncrement);
  25828. $(document).unbind('mousemove', moveIncrement);
  25829. return false;
  25830. },
  25831. downHue = function (ev) {
  25832. var current = {
  25833. cal: $(this).parent(),
  25834. y: $(this).offset().top
  25835. };
  25836. current.preview = current.cal.data('colorpicker').livePreview;
  25837. $(document).bind('mouseup', current, upHue);
  25838. $(document).bind('mousemove', current, moveHue);
  25839. },
  25840. moveHue = function (ev) {
  25841. change.apply(
  25842. ev.data.cal.data('colorpicker')
  25843. .fields
  25844. .eq(4)
  25845. .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
  25846. .get(0),
  25847. [ev.data.preview]
  25848. );
  25849. return false;
  25850. },
  25851. upHue = function (ev) {
  25852. fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
  25853. fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
  25854. $(document).unbind('mouseup', upHue);
  25855. $(document).unbind('mousemove', moveHue);
  25856. return false;
  25857. },
  25858. downSelector = function (ev) {
  25859. var current = {
  25860. cal: $(this).parent(),
  25861. pos: $(this).offset()
  25862. };
  25863. current.preview = current.cal.data('colorpicker').livePreview;
  25864. $(document).bind('mouseup', current, upSelector);
  25865. $(document).bind('mousemove', current, moveSelector);
  25866. },
  25867. moveSelector = function (ev) {
  25868. change.apply(
  25869. ev.data.cal.data('colorpicker')
  25870. .fields
  25871. .eq(6)
  25872. .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
  25873. .end()
  25874. .eq(5)
  25875. .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
  25876. .get(0),
  25877. [ev.data.preview]
  25878. );
  25879. return false;
  25880. },
  25881. upSelector = function (ev) {
  25882. fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
  25883. fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
  25884. $(document).unbind('mouseup', upSelector);
  25885. $(document).unbind('mousemove', moveSelector);
  25886. return false;
  25887. },
  25888. enterSubmit = function (ev) {
  25889. $(this).addClass('colorpicker_focus');
  25890. },
  25891. leaveSubmit = function (ev) {
  25892. $(this).removeClass('colorpicker_focus');
  25893. },
  25894. clickSubmit = function (ev) {
  25895. var cal = $(this).parent();
  25896. var col = cal.data('colorpicker').color;
  25897. cal.data('colorpicker').origColor = col;
  25898. setCurrentColor(col, cal.get(0));
  25899. cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
  25900. },
  25901. show = function (ev) {
  25902. var cal = $('#' + $(this).data('colorpickerId'));
  25903. cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
  25904. var pos = $(this).offset();
  25905. var viewPort = getViewport();
  25906. var top = pos.top + this.offsetHeight;
  25907. var left = pos.left;
  25908. if (top + 176 > viewPort.t + viewPort.h) {
  25909. top -= this.offsetHeight + 176;
  25910. }
  25911. if (left + 356 > viewPort.l + viewPort.w) {
  25912. left -= 356;
  25913. }
  25914. cal.css({left: left + 'px', top: top + 'px'});
  25915. if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
  25916. cal.show();
  25917. }
  25918. $(document).bind('mousedown', {cal: cal}, hide);
  25919. return false;
  25920. },
  25921. hide = function (ev) {
  25922. if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
  25923. if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
  25924. ev.data.cal.hide();
  25925. }
  25926. $(document).unbind('mousedown', hide);
  25927. }
  25928. },
  25929. isChildOf = function(parentEl, el, container) {
  25930. if (parentEl == el) {
  25931. return true;
  25932. }
  25933. if (parentEl.contains) {
  25934. return parentEl.contains(el);
  25935. }
  25936. if ( parentEl.compareDocumentPosition ) {
  25937. return !!(parentEl.compareDocumentPosition(el) & 16);
  25938. }
  25939. var prEl = el.parentNode;
  25940. while(prEl && prEl != container) {
  25941. if (prEl == parentEl)
  25942. return true;
  25943. prEl = prEl.parentNode;
  25944. }
  25945. return false;
  25946. },
  25947. getViewport = function () {
  25948. var m = document.compatMode == 'CSS1Compat';
  25949. return {
  25950. l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
  25951. t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
  25952. w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
  25953. h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
  25954. };
  25955. },
  25956. fixHSB = function (hsb) {
  25957. return {
  25958. h: Math.min(360, Math.max(0, hsb.h)),
  25959. s: Math.min(100, Math.max(0, hsb.s)),
  25960. b: Math.min(100, Math.max(0, hsb.b))
  25961. };
  25962. },
  25963. fixRGB = function (rgb) {
  25964. return {
  25965. r: Math.min(255, Math.max(0, rgb.r)),
  25966. g: Math.min(255, Math.max(0, rgb.g)),
  25967. b: Math.min(255, Math.max(0, rgb.b))
  25968. };
  25969. },
  25970. fixHex = function (hex) {
  25971. var len = 6 - hex.length;
  25972. if (len > 0) {
  25973. var o = [];
  25974. for (var i=0; i<len; i++) {
  25975. o.push('0');
  25976. }
  25977. o.push(hex);
  25978. hex = o.join('');
  25979. }
  25980. return hex;
  25981. },
  25982. HexToRGB = function (hex) {
  25983. var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
  25984. return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
  25985. },
  25986. HexToHSB = function (hex) {
  25987. return RGBToHSB(HexToRGB(hex));
  25988. },
  25989. RGBToHSB = function (rgb) {
  25990. var hsb = {
  25991. h: 0,
  25992. s: 0,
  25993. b: 0
  25994. };
  25995. var min = Math.min(rgb.r, rgb.g, rgb.b);
  25996. var max = Math.max(rgb.r, rgb.g, rgb.b);
  25997. var delta = max - min;
  25998. hsb.b = max;
  25999. if (max != 0) {
  26000. }
  26001. hsb.s = max != 0 ? 255 * delta / max : 0;
  26002. if (hsb.s != 0) {
  26003. if (rgb.r == max) {
  26004. hsb.h = (rgb.g - rgb.b) / delta;
  26005. } else if (rgb.g == max) {
  26006. hsb.h = 2 + (rgb.b - rgb.r) / delta;
  26007. } else {
  26008. hsb.h = 4 + (rgb.r - rgb.g) / delta;
  26009. }
  26010. } else {
  26011. hsb.h = -1;
  26012. }
  26013. hsb.h *= 60;
  26014. if (hsb.h < 0) {
  26015. hsb.h += 360;
  26016. }
  26017. hsb.s *= 100/255;
  26018. hsb.b *= 100/255;
  26019. return hsb;
  26020. },
  26021. HSBToRGB = function (hsb) {
  26022. var rgb = {};
  26023. var h = Math.round(hsb.h);
  26024. var s = Math.round(hsb.s*255/100);
  26025. var v = Math.round(hsb.b*255/100);
  26026. if(s == 0) {
  26027. rgb.r = rgb.g = rgb.b = v;
  26028. } else {
  26029. var t1 = v;
  26030. var t2 = (255-s)*v/255;
  26031. var t3 = (t1-t2)*(h%60)/60;
  26032. if(h==360) h = 0;
  26033. if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
  26034. else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
  26035. else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
  26036. else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
  26037. else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
  26038. else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
  26039. else {rgb.r=0; rgb.g=0; rgb.b=0}
  26040. }
  26041. return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
  26042. },
  26043. RGBToHex = function (rgb) {
  26044. var hex = [
  26045. rgb.r.toString(16),
  26046. rgb.g.toString(16),
  26047. rgb.b.toString(16)
  26048. ];
  26049. $.each(hex, function (nr, val) {
  26050. if (val.length == 1) {
  26051. hex[nr] = '0' + val;
  26052. }
  26053. });
  26054. return hex.join('');
  26055. },
  26056. HSBToHex = function (hsb) {
  26057. return RGBToHex(HSBToRGB(hsb));
  26058. },
  26059. restoreOriginal = function () {
  26060. var cal = $(this).parent();
  26061. var col = cal.data('colorpicker').origColor;
  26062. cal.data('colorpicker').color = col;
  26063. fillRGBFields(col, cal.get(0));
  26064. fillHexFields(col, cal.get(0));
  26065. fillHSBFields(col, cal.get(0));
  26066. setSelector(col, cal.get(0));
  26067. setHue(col, cal.get(0));
  26068. setNewColor(col, cal.get(0));
  26069. };
  26070. return {
  26071. init: function (opt) {
  26072. opt = $.extend({}, defaults, opt||{});
  26073. if (typeof opt.color == 'string') {
  26074. opt.color = HexToHSB(opt.color);
  26075. } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
  26076. opt.color = RGBToHSB(opt.color);
  26077. } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
  26078. opt.color = fixHSB(opt.color);
  26079. } else {
  26080. return this;
  26081. }
  26082. return this.each(function () {
  26083. if (!$(this).data('colorpickerId')) {
  26084. var options = $.extend({}, opt);
  26085. options.origColor = opt.color;
  26086. var id = 'collorpicker_' + parseInt(Math.random() * 1000);
  26087. $(this).data('colorpickerId', id);
  26088. var cal = $(tpl).attr('id', id);
  26089. if (options.flat) {
  26090. cal.appendTo(this).show();
  26091. } else {
  26092. cal.appendTo(document.body);
  26093. }
  26094. options.fields = cal
  26095. .find('input')
  26096. .bind('keyup', keyDown)
  26097. .bind('change', change)
  26098. .bind('blur', blur)
  26099. .bind('focus', focus);
  26100. cal
  26101. .find('span').bind('mousedown', downIncrement).end()
  26102. .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
  26103. options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
  26104. options.selectorIndic = options.selector.find('div div');
  26105. options.el = this;
  26106. options.hue = cal.find('div.colorpicker_hue div');
  26107. cal.find('div.colorpicker_hue').bind('mousedown', downHue);
  26108. options.newColor = cal.find('div.colorpicker_new_color');
  26109. options.currentColor = cal.find('div.colorpicker_current_color');
  26110. cal.data('colorpicker', options);
  26111. cal.find('div.colorpicker_submit')
  26112. .bind('mouseenter', enterSubmit)
  26113. .bind('mouseleave', leaveSubmit)
  26114. .bind('click', clickSubmit);
  26115. fillRGBFields(options.color, cal.get(0));
  26116. fillHSBFields(options.color, cal.get(0));
  26117. fillHexFields(options.color, cal.get(0));
  26118. setHue(options.color, cal.get(0));
  26119. setSelector(options.color, cal.get(0));
  26120. setCurrentColor(options.color, cal.get(0));
  26121. setNewColor(options.color, cal.get(0));
  26122. if (options.flat) {
  26123. cal.css({
  26124. position: 'relative',
  26125. display: 'block'
  26126. });
  26127. } else {
  26128. $(this).bind(options.eventName, show);
  26129. }
  26130. }
  26131. });
  26132. },
  26133. showPicker: function() {
  26134. return this.each( function () {
  26135. if ($(this).data('colorpickerId')) {
  26136. show.apply(this);
  26137. }
  26138. });
  26139. },
  26140. hidePicker: function() {
  26141. return this.each( function () {
  26142. if ($(this).data('colorpickerId')) {
  26143. $('#' + $(this).data('colorpickerId')).hide();
  26144. }
  26145. });
  26146. },
  26147. setColor: function(col) {
  26148. if (typeof col == 'string') {
  26149. col = HexToHSB(col);
  26150. } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
  26151. col = RGBToHSB(col);
  26152. } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
  26153. col = fixHSB(col);
  26154. } else {
  26155. return this;
  26156. }
  26157. return this.each(function(){
  26158. if ($(this).data('colorpickerId')) {
  26159. var cal = $('#' + $(this).data('colorpickerId'));
  26160. cal.data('colorpicker').color = col;
  26161. cal.data('colorpicker').origColor = col;
  26162. fillRGBFields(col, cal.get(0));
  26163. fillHSBFields(col, cal.get(0));
  26164. fillHexFields(col, cal.get(0));
  26165. setHue(col, cal.get(0));
  26166. setSelector(col, cal.get(0));
  26167. setCurrentColor(col, cal.get(0));
  26168. setNewColor(col, cal.get(0));
  26169. }
  26170. });
  26171. }
  26172. };
  26173. }();
  26174. $.fn.extend({
  26175. ColorPicker: ColorPicker.init,
  26176. ColorPickerHide: ColorPicker.hidePicker,
  26177. ColorPickerShow: ColorPicker.showPicker,
  26178. ColorPickerSetColor: ColorPicker.setColor
  26179. });
  26180. })(jQuery)
  26181. ;
  26182. (function($) {
  26183. var filters;
  26184. $.filters = filters = {
  26185. append: function(options) {
  26186. options = options || {};
  26187. var field_label = options['label'];
  26188. var field_name = options['name'];
  26189. var field_type = options['type'];
  26190. var field_value = options['value'];
  26191. var field_operator = options['operator'];
  26192. var select_options = options['select_options'];
  26193. var index = options['index'];
  26194. var value_name = 'f[' + field_name + '][' + index + '][v]';
  26195. var operator_name = 'f[' + field_name + '][' + index + '][o]';
  26196. var control = null;
  26197. var additional_control = null;
  26198. switch(field_type) {
  26199. case 'boolean':
  26200. var control = '<select class="input-sm form-control" name="' + value_name + '">' +
  26201. '<option value="_discard">...</option>' +
  26202. '<option value="true"' + (field_value == "true" ? 'selected="selected"' : '') + '>' + RailsAdmin.I18n.t("true") + '</option>' +
  26203. '<option value="false"' + (field_value == "false" ? 'selected="selected"' : '') + '>' + RailsAdmin.I18n.t("false") + '</option>' +
  26204. '<option disabled="disabled">---------</option>' +
  26205. '<option ' + (field_value == "_present" ? 'selected="selected"' : '') + ' value="_present">' + RailsAdmin.I18n.t("is_present") + '</option>' +
  26206. '<option ' + (field_value == "_blank" ? 'selected="selected"' : '') + ' value="_blank" >' + RailsAdmin.I18n.t("is_blank") + '</option>' +
  26207. '</select>';
  26208. break;
  26209. case 'date':
  26210. additional_control =
  26211. '<input size="20" class="date additional-fieldset default input-sm form-control" style="display:' + ((!field_operator || field_operator == "default") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[0] || '') + '" /> ' +
  26212. '<input size="20" placeholder="-∞" class="date additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[1] || '') + '" /> ' +
  26213. '<input size="20" placeholder="∞" class="date additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[2] || '') + '" />';
  26214. case 'datetime':
  26215. case 'timestamp':
  26216. control = control || '<select class="switch-additionnal-fieldsets input-sm form-control" name="' + operator_name + '">' +
  26217. '<option ' + (field_operator == "default" ? 'selected="selected"' : '') + ' data-additional-fieldset="default" value="default">' + RailsAdmin.I18n.t("date") + '</option>' +
  26218. '<option ' + (field_operator == "between" ? 'selected="selected"' : '') + ' data-additional-fieldset="between" value="between">' + RailsAdmin.I18n.t("between_and_") + '</option>' +
  26219. '<option ' + (field_operator == "today" ? 'selected="selected"' : '') + ' value="today">' + RailsAdmin.I18n.t("today") + '</option>' +
  26220. '<option ' + (field_operator == "yesterday" ? 'selected="selected"' : '') + ' value="yesterday">' + RailsAdmin.I18n.t("yesterday") + '</option>' +
  26221. '<option ' + (field_operator == "this_week" ? 'selected="selected"' : '') + ' value="this_week">' + RailsAdmin.I18n.t("this_week") + '</option>' +
  26222. '<option ' + (field_operator == "last_week" ? 'selected="selected"' : '') + ' value="last_week">' + RailsAdmin.I18n.t("last_week") + '</option>' +
  26223. '<option disabled="disabled">---------</option>' +
  26224. '<option ' + (field_operator == "_not_null" ? 'selected="selected"' : '') + ' value="_not_null">' + RailsAdmin.I18n.t("is_present") + '</option>' +
  26225. '<option ' + (field_operator == "_null" ? 'selected="selected"' : '') + ' value="_null" >' + RailsAdmin.I18n.t("is_blank") + '</option>' +
  26226. '</select>'
  26227. additional_control = additional_control ||
  26228. '<input size="25" class="datetime additional-fieldset default input-sm form-control" style="display:' + ((!field_operator || field_operator == "default") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[0] || '') + '" /> ' +
  26229. '<input size="25" placeholder="-∞" class="datetime additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[1] || '') + '" /> ' +
  26230. '<input size="25" placeholder="∞" class="datetime additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[2] || '') + '" />';
  26231. break;
  26232. case 'enum':
  26233. var multiple_values = ((field_value instanceof Array) ? true : false)
  26234. control = '<select style="display:' + (multiple_values ? 'none' : 'inline-block') + '" ' + (multiple_values ? '' : 'name="' + value_name + '"') + ' data-name="' + value_name + '" class="select-single input-sm form-control">' +
  26235. '<option value="_discard">...</option>' +
  26236. '<option ' + (field_value == "_present" ? 'selected="selected"' : '') + ' value="_present">' + RailsAdmin.I18n.t("is_present") + '</option>' +
  26237. '<option ' + (field_value == "_blank" ? 'selected="selected"' : '') + ' value="_blank">' + RailsAdmin.I18n.t("is_blank") + '</option>' +
  26238. '<option disabled="disabled">---------</option>' +
  26239. select_options +
  26240. '</select>' +
  26241. '<select multiple="multiple" style="display:' + (multiple_values ? 'inline-block' : 'none') + '" ' + (multiple_values ? 'name="' + value_name + '[]"' : '') + ' data-name="' + value_name + '[]" class="select-multiple input-sm form-control">' +
  26242. select_options +
  26243. '</select> ' +
  26244. '<a href="#" class="switch-select"><i class="icon-' + (multiple_values ? 'minus' : 'plus') + '"></i></a>';
  26245. break;
  26246. case 'string':
  26247. case 'text':
  26248. case 'belongs_to_association':
  26249. control = '<select class="switch-additionnal-fieldsets input-sm form-control" value="' + field_operator + '" name="' + operator_name + '">' +
  26250. '<option data-additional-fieldset="additional-fieldset"' + (field_operator == "like" ? 'selected="selected"' : '') + ' value="like">' + RailsAdmin.I18n.t("contains") + '</option>' +
  26251. '<option data-additional-fieldset="additional-fieldset"' + (field_operator == "is" ? 'selected="selected"' : '') + ' value="is">' + RailsAdmin.I18n.t("is_exactly") + '</option>' +
  26252. '<option data-additional-fieldset="additional-fieldset"' + (field_operator == "starts_with" ? 'selected="selected"' : '') + ' value="starts_with">' + RailsAdmin.I18n.t("starts_with") + '</option>' +
  26253. '<option data-additional-fieldset="additional-fieldset"' + (field_operator == "ends_with" ? 'selected="selected"' : '') + ' value="ends_with">' + RailsAdmin.I18n.t("ends_with") + '</option>' +
  26254. '<option disabled="disabled">---------</option>' +
  26255. '<option ' + (field_operator == "_not_null" ? 'selected="selected"' : '') + ' value="_not_null">' + RailsAdmin.I18n.t("is_present") + '</option>' +
  26256. '<option ' + (field_operator == "_null" ? 'selected="selected"' : '') + ' value="_null">' + RailsAdmin.I18n.t("is_blank") + '</option>' +
  26257. '</select>'
  26258. additional_control = '<input class="additional-fieldset input-sm form-control" style="display:' + (field_operator == "_blank" || field_operator == "_present" ? 'none' : 'inline-block') + ';" type="text" name="' + value_name + '" value="' + field_value + '" /> ';
  26259. break;
  26260. case 'integer':
  26261. case 'decimal':
  26262. case 'float':
  26263. control = '<select class="switch-additionnal-fieldsets input-sm form-control" name="' + operator_name + '">' +
  26264. '<option ' + (field_operator == "default" ? 'selected="selected"' : '') + ' data-additional-fieldset="default" value="default">' + RailsAdmin.I18n.t("number") + '</option>' +
  26265. '<option ' + (field_operator == "between" ? 'selected="selected"' : '') + ' data-additional-fieldset="between" value="between">' + RailsAdmin.I18n.t("between_and_") + '</option>' +
  26266. '<option disabled="disabled">---------</option>' +
  26267. '<option ' + (field_operator == "_not_null" ? 'selected="selected"' : '') + ' value="_not_null">' + RailsAdmin.I18n.t("is_present") +'</option>' +
  26268. '<option ' + (field_operator == "_null" ? 'selected="selected"' : '') + ' value="_null" >' + RailsAdmin.I18n.t("is_blank") + '</option>' +
  26269. '</select>'
  26270. additional_control =
  26271. '<input class="additional-fieldset default input-sm form-control" style="display:' + ((!field_operator || field_operator == "default") ? 'inline-block' : 'none') + ';" type="' + field_type + '" name="' + value_name + '[]" value="' + (field_value[0] || '') + '" /> ' +
  26272. '<input placeholder="-∞" class="additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="' + field_type + '" name="' + value_name + '[]" value="' + (field_value[1] || '') + '" /> ' +
  26273. '<input placeholder="∞" class="additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="' + field_type + '" name="' + value_name + '[]" value="' + (field_value[2] || '') + '" />';
  26274. break;
  26275. default:
  26276. control = '<input type="text" class="input-sm form-control" name="' + value_name + '" value="' + field_value + '"/> ';
  26277. break;
  26278. }
  26279. var $content = $('<p>')
  26280. .addClass('filter form-search')
  26281. .append('<span class="label label-info form-label"><a href="#delete" class="delete"><i class="fa fa-trash-o fa-fw icon-white"></i>' + field_label + '</a></span>')
  26282. .append('&nbsp;' + control + '&nbsp;' + (additional_control || ''));
  26283. $('#filters_box').append($content);
  26284. $content.find('.date, .datetime').datetimepicker({
  26285. locale: RailsAdmin.I18n.locale,
  26286. showTodayButton: true,
  26287. format: options['datetimepicker_format']
  26288. });
  26289. $("hr.filters_box:hidden").show('slow');
  26290. }
  26291. }
  26292. $(document).on('click', "#filters a", function(e) {
  26293. e.preventDefault();
  26294. $.filters.append({
  26295. label: $(this).data('field-label'),
  26296. name: $(this).data('field-name'),
  26297. type: $(this).data('field-type'),
  26298. value: $(this).data('field-value'),
  26299. operator: $(this).data('field-operator'),
  26300. select_options: $(this).data('field-options'),
  26301. index: $.now().toString().slice(6,11),
  26302. datetimepicker_format: $(this).data('field-datetimepicker-format')
  26303. });
  26304. });
  26305. $(document).on('click', "#filters_box .delete", function(e) {
  26306. e.preventDefault();
  26307. form = $(this).parents('form');
  26308. $(this).parents('.filter').remove();
  26309. !$("#filters_box").children().length && $("hr.filters_box:visible").hide('slow');
  26310. });
  26311. $(document).on('click', "#filters_box .switch-select", function(e) {
  26312. e.preventDefault();
  26313. var selected_select = $(this).siblings('select:visible');
  26314. var not_selected_select = $(this).siblings('select:hidden');
  26315. not_selected_select.attr('name', not_selected_select.data('name')).show('slow');
  26316. selected_select.attr('name', null).hide('slow');
  26317. $(this).find('i').toggleClass("icon-plus icon-minus")
  26318. });
  26319. $(document).on('change', "#filters_box .switch-additionnal-fieldsets", function(e) {
  26320. var selected_option = $(this).find('option:selected');
  26321. if(klass = $(selected_option).data('additional-fieldset')) {
  26322. $(this).siblings('.additional-fieldset:not(.' + klass + ')').hide('slow');
  26323. $(this).siblings('.' + klass).show('slow');
  26324. } else {
  26325. $(this).siblings('.additional-fieldset').hide('slow');
  26326. }
  26327. });
  26328. })( jQuery );
  26329. /*
  26330. * RailsAdmin filtering multiselect @VERSION
  26331. *
  26332. * License
  26333. *
  26334. * http://www.railsadmin.org
  26335. *
  26336. * Depends:
  26337. * jquery.ui.core.js
  26338. * jquery.ui.widget.js
  26339. */
  26340. (function($) {
  26341. $.widget("ra.filteringMultiselect", {
  26342. _cache: {},
  26343. options: {
  26344. createQuery: function(query) {
  26345. return { query: query };
  26346. },
  26347. sortable: false,
  26348. removable: true,
  26349. regional: {
  26350. up: "Up",
  26351. down: "Down",
  26352. add: "Add",
  26353. chooseAll: "Choose all",
  26354. chosen: "Chosen records",
  26355. clearAll: "Clear all",
  26356. remove: "Remove"
  26357. },
  26358. searchDelay: 400,
  26359. remote_source: null,
  26360. xhr: false
  26361. },
  26362. _create: function() {
  26363. this._cache = {};
  26364. this._build();
  26365. this._buildCache();
  26366. this._bindEvents();
  26367. },
  26368. _build: function() {
  26369. var i;
  26370. this.wrapper = $('<div class="ra-multiselect">');
  26371. this.wrapper.insertAfter(this.element);
  26372. this.header = $('<div class="ra-multiselect-header ui-helper-clearfix">');
  26373. this.filter = $('<input type="search" placeholder="' + this.options.regional.search + '" class="form-control ra-multiselect-search"/>');
  26374. this.header.append(this.filter);
  26375. this.wrapper.append(this.header);
  26376. this.columns = {
  26377. left: $('<div class="ra-multiselect-column ra-multiselect-left">'),
  26378. center: $('<div class="ra-multiselect-column ra-multiselect-center">'),
  26379. right: $('<div class="ra-multiselect-column ra-multiselect-right">')
  26380. };
  26381. for (i in this.columns) {
  26382. if (this.columns.hasOwnProperty(i)) {
  26383. this.wrapper.append(this.columns[i]);
  26384. }
  26385. }
  26386. this.collection = $('<select multiple="multiple"></select>');
  26387. this.collection.addClass("form-control ra-multiselect-collection");
  26388. this.addAll = $('<a href="#" class="ra-multiselect-item-add-all"><span class="ui-icon ui-icon-circle-triangle-e"></span>' + this.options.regional.chooseAll + '</a>');
  26389. this.columns.left.html(this.collection)
  26390. .append(this.addAll);
  26391. this.collection.wrap('<div class="wrapper"/>');
  26392. this.add = $('<a href="#" class="ui-icon ui-icon-circle-triangle-e ra-multiselect-item-add">' + this.options.regional.add + '</a>');
  26393. this.columns.center.append(this.add);
  26394. if (this.options.removable) {
  26395. this.remove = $('<a href="#" class="ui-icon ui-icon-circle-triangle-w ra-multiselect-item-remove">' + this.options.regional.remove + '</a>');
  26396. this.columns.center.append(this.remove);
  26397. }
  26398. if (this.options.sortable) {
  26399. this.up = $('<a href="#" class="ui-icon ui-icon-circle-triangle-n ra-multiselect-item-up">' + this.options.regional.up + '</a>');
  26400. this.down = $('<a href="#" class="ui-icon ui-icon-circle-triangle-s ra-multiselect-item-down">' + this.options.regional.down + '</a>');
  26401. this.columns.center.append(this.up).append(this.down);
  26402. }
  26403. this.selection = $('<select class="form-control ra-multiselect-selection" multiple="multiple"></select>');
  26404. this.columns.right.append(this.selection);
  26405. if (this.options.removable) {
  26406. this.removeAll = $('<a href="#" class="ra-multiselect-item-remove-all"><span class="ui-icon ui-icon-circle-triangle-w"></span>' + this.options.regional.clearAll + '</a>');
  26407. this.columns.right.append(this.removeAll);
  26408. }
  26409. this.selection.wrap('<div class="wrapper"/>');
  26410. this.element.css({display: "none"});
  26411. this.tooManyObjectsPlaceholder = $('<option disabled="disabled" />').text(RailsAdmin.I18n.t("too_many_objects"));
  26412. this.noObjectsPlaceholder = $('<option disabled="disabled" />').text(RailsAdmin.I18n.t("no_objects"))
  26413. if(this.options.xhr){
  26414. this.collection.append(this.tooManyObjectsPlaceholder);
  26415. }
  26416. },
  26417. _bindEvents: function() {
  26418. var widget = this;
  26419. /* Add all to selection */
  26420. this.addAll.click(function(e){
  26421. widget._select($('option', widget.collection));
  26422. e.preventDefault();
  26423. widget.selection.trigger('change');
  26424. });
  26425. /* Add to selection */
  26426. this.add.click(function(e){
  26427. widget._select($(':selected', widget.collection));
  26428. e.preventDefault();
  26429. widget.selection.trigger('change');
  26430. });
  26431. if (this.options.removable) {
  26432. /* Remove all from selection */
  26433. this.removeAll.click(function(e){
  26434. widget._deSelect($('option', widget.selection));
  26435. e.preventDefault();
  26436. widget.selection.trigger('change');
  26437. });
  26438. /* Remove from selection */
  26439. this.remove.click(function(e){
  26440. widget._deSelect($(':selected', widget.selection));
  26441. e.preventDefault();
  26442. widget.selection.trigger('change');
  26443. });
  26444. }
  26445. var timeout = null;
  26446. if(this.options.sortable) {
  26447. /* Move selection up */
  26448. this.up.click(function(e){
  26449. widget._move('up', $(':selected', widget.selection));
  26450. e.preventDefault();
  26451. });
  26452. /* Move selection down */
  26453. this.down.click(function(e){
  26454. widget._move('down', $(':selected', widget.selection));
  26455. e.preventDefault();
  26456. });
  26457. }
  26458. /* Typing to the filter */
  26459. this.filter.bind('keyup click', function(e){
  26460. if (timeout) { clearTimeout(timeout); }
  26461. timeout = setTimeout(function() {
  26462. widget._queryFilter(widget.filter.val());
  26463. }, widget.options.searchDelay
  26464. );
  26465. });
  26466. },
  26467. _queryFilter: function(val) {
  26468. var widget = this;
  26469. widget._query(val, function(matches) {
  26470. var filtered = [];
  26471. var i;
  26472. for (i = 0; i < matches.length; i++) {
  26473. if (!widget.selected(matches[i].id)) {
  26474. filtered.push(i);
  26475. }
  26476. }
  26477. if (filtered.length > 0) {
  26478. widget.collection[0].innerHTML = '';
  26479. var filteredContainer = [];
  26480. for (i = 0; i < filtered.length; i++) {
  26481. var newOptions = '<option value="'+matches[filtered[i]].id+'" title="'+matches[filtered[i]].label+'">'+matches[filtered[i]].label+'</option>';
  26482. filteredContainer.push(newOptions);
  26483. }
  26484. widget.collection[0].innerHTML = filteredContainer.join("");
  26485. } else {
  26486. widget.collection[0].innerHTML = widget.noObjectsPlaceholder;
  26487. }
  26488. });
  26489. },
  26490. /*
  26491. * Cache key is stored in the format `o_<option value>` to avoid JS
  26492. * engine coercing string keys to int keys, and thereby preserving
  26493. * the insertion order. The value for each key is in turn an object
  26494. * that stores the option tag's HTML text and the value. Example:
  26495. * cache = {
  26496. * 'o_271': { id: 271, value: 'CartItem #271'},
  26497. * 'o_270': { id: 270, value: 'CartItem #270'}
  26498. * }
  26499. */
  26500. _buildCache: function(options) {
  26501. var widget = this;
  26502. this.element.find("option").each(function(i, option) {
  26503. if (option.selected) {
  26504. widget._cache['o_' + option.value] = {id: option.value, value: option.innerHTML};
  26505. $(option).clone().appendTo(widget.selection).attr("selected", false).attr("title", $(option).text());
  26506. } else {
  26507. widget._cache['o_' + option.value] = {id: option.value, value: option.innerHTML};
  26508. $(option).clone().appendTo(widget.collection).attr("selected", false).attr("title", $(option).text());
  26509. }
  26510. });
  26511. },
  26512. _deSelect: function(options) {
  26513. var widget = this;
  26514. options.each(function(i, option) {
  26515. widget.element.find('option[value="' + option.value + '"]').removeAttr("selected");
  26516. });
  26517. $(options).appendTo(this.collection).attr('selected', false);
  26518. },
  26519. _query: function(query, success) {
  26520. var i, matches = [];
  26521. if (query === "") {
  26522. if (!this.options.xhr) {
  26523. for (i in this._cache) {
  26524. if (this._cache.hasOwnProperty(i)) {
  26525. option = this._cache[i];
  26526. matches.push({id: option.id, label: option.value});
  26527. }
  26528. }
  26529. success.apply(this, [matches]);
  26530. } else {
  26531. this.collection.html(this.tooManyObjectsPlaceholder);
  26532. }
  26533. } else {
  26534. if (this.options.xhr) {
  26535. $.ajax({
  26536. beforeSend: function(xhr) {
  26537. xhr.setRequestHeader("Accept", "application/json");
  26538. },
  26539. url: this.options.remote_source,
  26540. data: this.options.createQuery(query),
  26541. success: success
  26542. });
  26543. } else {
  26544. query = new RegExp(query + '.*', 'i');
  26545. for (i in this._cache) {
  26546. if (this._cache.hasOwnProperty(i) && query.test(this._cache[i]['value'])) {
  26547. option = this._cache[i];
  26548. matches.push({id: option.id, label: option.value});
  26549. }
  26550. }
  26551. success.apply(this, [matches]);
  26552. }
  26553. }
  26554. },
  26555. _select: function(options) {
  26556. var widget = this;
  26557. options.each(function(i, option) {
  26558. var el = widget.element.find('option[value="' + option.value + '"]');
  26559. if (el.length) {
  26560. el.attr("selected", "selected");
  26561. } else {
  26562. widget.element.append($('<option></option>').attr('value', option.value).attr('selected', "selected"));
  26563. }
  26564. });
  26565. $(options).appendTo(this.selection).attr('selected', false);
  26566. },
  26567. _move: function(direction, options) {
  26568. var widget = this;
  26569. if(direction == 'up') {
  26570. options.each(function(i, option) {
  26571. var prev = $(option).prev();
  26572. if (prev.length > 0) {
  26573. var el = widget.element.find('option[value="' + option.value + '"]');
  26574. var el_prev = widget.element.find('option[value="' + prev[0].value + '"]');
  26575. el_prev.before(el);
  26576. prev.before($(option));
  26577. }
  26578. });
  26579. } else {
  26580. $.fn.reverse = [].reverse; // needed to lower last items first
  26581. options.reverse().each(function(i, option) {
  26582. var next = $(option).next();
  26583. if (next.length > 0) {
  26584. var el = widget.element.find('option[value="' + option.value + '"]');
  26585. var el_next = widget.element.find('option[value="' + next[0].value + '"]');
  26586. el_next.after(el);
  26587. next.after($(option));
  26588. }
  26589. });
  26590. }
  26591. },
  26592. selected: function(value) {
  26593. if (this.selection[0].querySelectorAll('option[value="' + value + '"]')[0]) {
  26594. return true;
  26595. }
  26596. },
  26597. destroy: function() {
  26598. this.wrapper.remove();
  26599. this.element.css({display: "inline"});
  26600. $.Widget.prototype.destroy.apply(this, arguments);
  26601. }
  26602. });
  26603. })(jQuery);
  26604. /*
  26605. * RailsAdmin filtering select @VERSION
  26606. *
  26607. * Based on the combobox example from jQuery UI documentation
  26608. * http://jqueryui.com/demos/autocomplete/#combobox
  26609. *
  26610. * License
  26611. *
  26612. * http://www.railsadmin.org
  26613. *
  26614. * Depends:
  26615. * jquery.ui.core.js
  26616. * jquery.ui.widget.js
  26617. * jquery.ui.autocomplete.js
  26618. */
  26619. (function($) {
  26620. 'use strict';
  26621. $.widget('ra.filteringSelect', {
  26622. options: {
  26623. createQuery: function(query) {
  26624. return { query: query };
  26625. },
  26626. minLength: 0,
  26627. searchDelay: 200,
  26628. remote_source: null,
  26629. source: null,
  26630. xhr: false
  26631. },
  26632. button: null,
  26633. input: null,
  26634. select: null,
  26635. _create: function() {
  26636. var filtering_select = this.element.siblings(
  26637. '[data-input-for="' + this.element.attr('id') + '"]'
  26638. );
  26639. // When using the browser back and forward buttons, it is possible that
  26640. // the autocomplete field will be cached which causes duplicate fields
  26641. // to be generated.
  26642. if (filtering_select.size() > 0) {
  26643. this.input = filtering_select.children('input');
  26644. this.button = filtering_select.children('.input-group-btn');
  26645. } else {
  26646. this.element.hide();
  26647. filtering_select = this._inputGroup(this.element.attr('id'));
  26648. this.input = this._inputField();
  26649. this.button = this._buttonField();
  26650. }
  26651. this._setOptionsSource();
  26652. this._initAutocomplete();
  26653. this._initKeyEvent();
  26654. this._overloadRenderItem();
  26655. this._autocompleteDropdownEvent(this.button);
  26656. return filtering_select.append(this.input)
  26657. .append(this.button)
  26658. .insertAfter(this.element);
  26659. },
  26660. _getResultSet: function(request, data, xhr) {
  26661. var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i');
  26662. var spannedContent = function(content) {
  26663. return $('<span>').text(content).html();
  26664. };
  26665. var highlighter = function(label, word) {
  26666. if(word.length) {
  26667. return $.map(
  26668. label.split(word),
  26669. function(el) {
  26670. return spannedContent(el);
  26671. })
  26672. .join($('<strong>')
  26673. .text(word)[0]
  26674. .outerHTML
  26675. );
  26676. } else {
  26677. return spannedContent(label);
  26678. }
  26679. };
  26680. return $.map(
  26681. data,
  26682. function(el) {
  26683. var id = el.id || el.value;
  26684. var value = el.label || el.id;
  26685. // match regexp only for local requests, remote ones are already
  26686. // filtered, and label may not contain filtered term.
  26687. if (id && (xhr || matcher.test(el.label))) {
  26688. return {
  26689. html: highlighter(value, request.term),
  26690. value: value,
  26691. id: id
  26692. };
  26693. }
  26694. });
  26695. },
  26696. _getSourceFunction: function(source) {
  26697. var self = this;
  26698. var requestIndex = 0;
  26699. if ($.isArray(source)) {
  26700. return function(request, response) {
  26701. response(self._getResultSet(request, source, false));
  26702. };
  26703. } else if (typeof source === 'string') {
  26704. return function(request, response) {
  26705. if (this.xhr) {
  26706. this.xhr.abort();
  26707. }
  26708. this.xhr = $.ajax({
  26709. url: source,
  26710. data: self.options.createQuery(request.term),
  26711. dataType: 'json',
  26712. autocompleteRequest: ++requestIndex,
  26713. success: function(data, status) {
  26714. if (this.autocompleteRequest === requestIndex) {
  26715. response(self._getResultSet(request, data, true));
  26716. }
  26717. },
  26718. error: function() {
  26719. if (this.autocompleteRequest === requestIndex) {
  26720. response([]);
  26721. }
  26722. }
  26723. });
  26724. };
  26725. } else {
  26726. return source;
  26727. }
  26728. },
  26729. _setOptionsSource: function() {
  26730. if (this.options.xhr) {
  26731. this.options.source = this.options.remote_source;
  26732. } else {
  26733. this.options.source = this.element.children('option').map(function() {
  26734. return { label: $(this).text(), value: this.value };
  26735. }).toArray();
  26736. }
  26737. },
  26738. _buttonField: function() {
  26739. return $(
  26740. '<span class="input-group-btn">' +
  26741. '<label class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="Show All Items" role="button">' +
  26742. '<span class="caret"></span>' +
  26743. '<span class="ui-button-text">&nbsp;</span>' +
  26744. '</label>' +
  26745. '</span>'
  26746. );
  26747. },
  26748. _autocompleteDropdownEvent: function(element) {
  26749. var self = this;
  26750. return element.click(function() {
  26751. // close if already visible
  26752. if (self.input.autocomplete('widget').is(':visible')) {
  26753. self.input.autocomplete('close');
  26754. return;
  26755. }
  26756. // pass empty string as value to search for, displaying all results
  26757. self.input.autocomplete('search', '');
  26758. self.input.focus();
  26759. });
  26760. },
  26761. _inputField: function() {
  26762. var input;
  26763. var selected = this.element.children(':selected');
  26764. var value = selected.val() ? selected.text() : '';
  26765. input = $('<input type="text">')
  26766. .val(value)
  26767. .addClass('form-control ra-filtering-select-input')
  26768. .attr('style', this.element.attr('style'))
  26769. .show();
  26770. if (this.element.attr('placeholder')) {
  26771. input.attr('placeholder', this.element.attr('placeholder'));
  26772. }
  26773. return input;
  26774. },
  26775. _inputGroup: function(inputFor) {
  26776. return $('<div>')
  26777. .addClass('input-group filtering-select col-sm-2')
  26778. .attr('data-input-for', inputFor)
  26779. .css('float', 'left');
  26780. },
  26781. _initAutocomplete: function() {
  26782. var self = this;
  26783. return this.input.autocomplete({
  26784. delay: this.options.searchDelay,
  26785. minLength: this.options.minLength,
  26786. source: this._getSourceFunction(this.options.source),
  26787. select: function(event, ui) {
  26788. var option = $('<option>')
  26789. .attr('value', ui.item.id)
  26790. .attr('selected', 'selected')
  26791. .text(ui.item.value);
  26792. self.element.html(option)
  26793. .trigger('change', ui.item.id);
  26794. self._trigger('selected', event, {
  26795. item: option
  26796. });
  26797. $(self.element.parents('.controls')[0])
  26798. .find('.update')
  26799. .removeClass('disabled');
  26800. },
  26801. change: function(event, ui) {
  26802. if (ui.item) {
  26803. return;
  26804. }
  26805. var matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex($(this).val()) + '$', 'i');
  26806. var valid = false;
  26807. self.element.children('option')
  26808. .each(function() {
  26809. if ($(this).text().match(matcher)) {
  26810. valid = true;
  26811. return false;
  26812. }
  26813. });
  26814. if (valid || $(this).val() !== '') {
  26815. return;
  26816. }
  26817. // remove invalid value, as it didn't match anything
  26818. $(this).val(null);
  26819. self.element.html($('<option value="" selected="selected"></option>'));
  26820. self.input.data('ui-autocomplete').term = '';
  26821. $(self.element.parents('.controls')[0])
  26822. .find('.update')
  26823. .addClass('disabled');
  26824. return false;
  26825. }
  26826. });
  26827. },
  26828. _initKeyEvent: function() {
  26829. var self = this;
  26830. return this.input.keyup(function() {
  26831. if ($(this).val().length) {
  26832. return;
  26833. }
  26834. /* Clear select options and trigger change if selected item is deleted */
  26835. return self.element
  26836. .html($('<option value="" selected="selected"></option>'))
  26837. .trigger('change');
  26838. });
  26839. },
  26840. _overloadRenderItem: function() {
  26841. this.input.data('ui-autocomplete')._renderItem = function(ul, item) {
  26842. return $('<li></li>')
  26843. .data('ui-autocomplete-item', item)
  26844. .append($('<a></a>')
  26845. .html(item.html || item.id))
  26846. .appendTo(ul);
  26847. };
  26848. },
  26849. destroy: function() {
  26850. this.input.remove();
  26851. this.button.remove();
  26852. this.element.show();
  26853. $.Widget.prototype.destroy.call(this);
  26854. }
  26855. });
  26856. })(jQuery);
  26857. /*
  26858. * RailsAdmin remote form @VERSION
  26859. *
  26860. * License
  26861. *
  26862. * http://www.railsadmin.org
  26863. *
  26864. * Depends:
  26865. * jquery.ui.core.js
  26866. * jquery.ui.widget.js
  26867. * jquery.ui.dialog.js
  26868. */
  26869. (function($) {
  26870. $.widget("ra.remoteForm", {
  26871. _create: function() {
  26872. var widget = this
  26873. var dom_widget = widget.element;
  26874. var edit_url = dom_widget.find('select').first().data('options') && dom_widget.find('select').first().data('options')['edit-url'];
  26875. if(typeof(edit_url) != 'undefined' && edit_url.length) {
  26876. dom_widget.on('dblclick', '.ra-multiselect option:not(:disabled)', function(e){
  26877. widget._bindModalOpening(e, edit_url.replace('__ID__', this.value))
  26878. });
  26879. }
  26880. dom_widget.find('.create').unbind().bind("click", function(e){
  26881. widget._bindModalOpening(e, $(this).data('link'))
  26882. });
  26883. dom_widget.find('.update').unbind().bind("click", function(e){
  26884. if(value = dom_widget.find('select').val()) {
  26885. widget._bindModalOpening(e, $(this).data('link').replace('__ID__', value))
  26886. } else {
  26887. e.preventDefault();
  26888. }
  26889. });
  26890. },
  26891. _bindModalOpening: function(e, url) {
  26892. e.preventDefault();
  26893. widget = this;
  26894. if($("#modal").length)
  26895. return false;
  26896. var dialog = this._getModal();
  26897. setTimeout(function(){ // fix race condition with modal insertion in the dom (Chrome => Team/add a new fan => #modal not found when it should have). Somehow .on('show') is too early, tried it too.
  26898. $.ajax({
  26899. url: url,
  26900. beforeSend: function(xhr) {
  26901. xhr.setRequestHeader("Accept", "text/javascript");
  26902. },
  26903. success: function(data, status, xhr) {
  26904. dialog.find('.modal-body').html(data);
  26905. widget._bindFormEvents();
  26906. },
  26907. error: function(xhr, status, error) {
  26908. dialog.find('.modal-body').html(xhr.responseText);
  26909. },
  26910. dataType: 'text'
  26911. });
  26912. },200);
  26913. },
  26914. _bindFormEvents: function() {
  26915. var widget = this,
  26916. dialog = this._getModal(),
  26917. form = dialog.find("form"),
  26918. saveButtonText = dialog.find(":submit[name=_save]").html(),
  26919. cancelButtonText = dialog.find(":submit[name=_continue]").html();
  26920. dialog.find('.form-actions').remove();
  26921. form.attr("data-remote", true);
  26922. dialog.find('.modal-header-title').text(form.data('title'));
  26923. dialog.find('.cancel-action').unbind().click(function(){
  26924. dialog.modal('hide');
  26925. return false;
  26926. }).html(cancelButtonText);
  26927. dialog.find('.save-action').unbind().click(function(){
  26928. form.submit();
  26929. return false;
  26930. }).html(saveButtonText);
  26931. $(document).trigger('rails_admin.dom_ready', [form])
  26932. form.bind("ajax:complete", function(xhr, data, status) {
  26933. if (status == 'error') {
  26934. dialog.find('.modal-body').html(data.responseText);
  26935. widget._bindFormEvents();
  26936. } else {
  26937. var json = $.parseJSON(data.responseText);
  26938. var option = '<option value="' + json.id + '" selected>' + json.label + '</option>';
  26939. var select = widget.element.find('select').filter(":hidden");
  26940. if(widget.element.find('.filtering-select').length) { // select input
  26941. var input = widget.element.find('.filtering-select').children('.ra-filtering-select-input');
  26942. input.val(json.label);
  26943. if (!select.find('option[value=' + json.id + ']').length) { // not a replace
  26944. select.html(option).val(json.id);
  26945. widget.element.find('.update').removeClass('disabled');
  26946. }
  26947. } else { // multi-select input
  26948. var input = widget.element.find('.ra-filtering-select-input');
  26949. var multiselect = widget.element.find('.ra-multiselect');
  26950. if (multiselect.find('option[value=' + json.id + ']').length) { // replace
  26951. select.find('option[value=' + json.id + ']').text(json.label);
  26952. multiselect.find('option[value= ' + json.id + ']').text(json.label);
  26953. } else { // add
  26954. select.append(option);
  26955. multiselect.find('select.ra-multiselect-selection').append(option);
  26956. }
  26957. }
  26958. widget._trigger("success");
  26959. dialog.modal("hide");
  26960. }
  26961. });
  26962. },
  26963. _getModal: function() {
  26964. var widget = this;
  26965. if (!widget.dialog) {
  26966. widget.dialog = $('<div id="modal" class="modal fade">\
  26967. <div class="modal-dialog">\
  26968. <div class="modal-content">\
  26969. <div class="modal-header">\
  26970. <a href="#" class="close" data-dismiss="modal">&times;</a>\
  26971. <h3 class="modal-header-title">...</h3>\
  26972. </div>\
  26973. <div class="modal-body">\
  26974. ...\
  26975. </div>\
  26976. <div class="modal-footer">\
  26977. <a href="#" class="btn cancel-action">...</a>\
  26978. <a href="#" class="btn btn-primary save-action">...</a>\
  26979. </div>\
  26980. </div>\
  26981. </div>\
  26982. </div>')
  26983. .modal({
  26984. keyboard: true,
  26985. backdrop: true,
  26986. show: true
  26987. })
  26988. .on('hidden.bs.modal', function(){
  26989. widget.dialog.remove(); // We don't want to reuse closed modals
  26990. widget.dialog = null;
  26991. });
  26992. }
  26993. return this.dialog;
  26994. }
  26995. });
  26996. })(jQuery);
  26997. // jquery.pjax.js
  26998. // copyright chris wanstrath
  26999. // https://github.com/defunkt/jquery-pjax
  27000. (function($){
  27001. // When called on a container with a selector, fetches the href with
  27002. // ajax into the container or with the data-pjax attribute on the link
  27003. // itself.
  27004. //
  27005. // Tries to make sure the back button and ctrl+click work the way
  27006. // you'd expect.
  27007. //
  27008. // Exported as $.fn.pjax
  27009. //
  27010. // Accepts a jQuery ajax options object that may include these
  27011. // pjax specific options:
  27012. //
  27013. //
  27014. // container - Where to stick the response body. Usually a String selector.
  27015. // $(container).html(xhr.responseBody)
  27016. // (default: current jquery context)
  27017. // push - Whether to pushState the URL. Defaults to true (of course).
  27018. // replace - Want to use replaceState instead? That's cool.
  27019. //
  27020. // For convenience the second parameter can be either the container or
  27021. // the options object.
  27022. //
  27023. // Returns the jQuery object
  27024. function fnPjax(selector, container, options) {
  27025. var context = this
  27026. return this.on('click.pjax', selector, function(event) {
  27027. var opts = $.extend({}, optionsFor(container, options))
  27028. if (!opts.container)
  27029. opts.container = $(this).attr('data-pjax') || context
  27030. handleClick(event, opts)
  27031. })
  27032. }
  27033. // Public: pjax on click handler
  27034. //
  27035. // Exported as $.pjax.click.
  27036. //
  27037. // event - "click" jQuery.Event
  27038. // options - pjax options
  27039. //
  27040. // Examples
  27041. //
  27042. // $(document).on('click', 'a', $.pjax.click)
  27043. // // is the same as
  27044. // $(document).pjax('a')
  27045. //
  27046. // $(document).on('click', 'a', function(event) {
  27047. // var container = $(this).closest('[data-pjax-container]')
  27048. // $.pjax.click(event, container)
  27049. // })
  27050. //
  27051. // Returns nothing.
  27052. function handleClick(event, container, options) {
  27053. options = optionsFor(container, options)
  27054. var link = event.currentTarget
  27055. if (link.tagName.toUpperCase() !== 'A')
  27056. throw "$.fn.pjax or $.pjax.click requires an anchor element"
  27057. // Middle click, cmd click, and ctrl click should open
  27058. // links in a new tab as normal.
  27059. if ( event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey )
  27060. return
  27061. // Ignore cross origin links
  27062. if ( location.protocol !== link.protocol || location.host !== link.host )
  27063. return
  27064. // Ignore anchors on the same page
  27065. if (link.hash && link.href.replace(link.hash, '') ===
  27066. location.href.replace(location.hash, ''))
  27067. return
  27068. // Ignore empty anchor "foo.html#"
  27069. if (link.href === location.href + '#')
  27070. return
  27071. var defaults = {
  27072. url: link.href,
  27073. container: $(link).attr('data-pjax'),
  27074. target: link,
  27075. fragment: null
  27076. }
  27077. pjax($.extend({}, defaults, options))
  27078. event.preventDefault()
  27079. }
  27080. // Public: pjax on form submit handler
  27081. //
  27082. // Exported as $.pjax.submit
  27083. //
  27084. // event - "click" jQuery.Event
  27085. // options - pjax options
  27086. //
  27087. // Examples
  27088. //
  27089. // $(document).on('submit', 'form', function(event) {
  27090. // var container = $(this).closest('[data-pjax-container]')
  27091. // $.pjax.submit(event, container)
  27092. // })
  27093. //
  27094. // Returns nothing.
  27095. function handleSubmit(event, container, options) {
  27096. options = optionsFor(container, options)
  27097. var form = event.currentTarget
  27098. if (form.tagName.toUpperCase() !== 'FORM')
  27099. throw "$.pjax.submit requires a form element"
  27100. var defaults = {
  27101. type: form.method,
  27102. url: form.action,
  27103. data: $(form).serializeArray(),
  27104. container: $(form).attr('data-pjax'),
  27105. target: form,
  27106. fragment: null
  27107. }
  27108. pjax($.extend({}, defaults, options))
  27109. event.preventDefault()
  27110. }
  27111. // Loads a URL with ajax, puts the response body inside a container,
  27112. // then pushState()'s the loaded URL.
  27113. //
  27114. // Works just like $.ajax in that it accepts a jQuery ajax
  27115. // settings object (with keys like url, type, data, etc).
  27116. //
  27117. // Accepts these extra keys:
  27118. //
  27119. // container - Where to stick the response body.
  27120. // $(container).html(xhr.responseBody)
  27121. // push - Whether to pushState the URL. Defaults to true (of course).
  27122. // replace - Want to use replaceState instead? That's cool.
  27123. //
  27124. // Use it just like $.ajax:
  27125. //
  27126. // var xhr = $.pjax({ url: this.href, container: '#main' })
  27127. // console.log( xhr.readyState )
  27128. //
  27129. // Returns whatever $.ajax returns.
  27130. function pjax(options) {
  27131. options = $.extend(true, {}, $.ajaxSettings, pjax.defaults, options)
  27132. if ($.isFunction(options.url)) {
  27133. options.url = options.url()
  27134. }
  27135. var target = options.target
  27136. var hash = parseURL(options.url).hash
  27137. var context = options.context = findContainerFor(options.container)
  27138. // We want the browser to maintain two separate internal caches: one
  27139. // for pjax'd partial page loads and one for normal page loads.
  27140. // Without adding this secret parameter, some browsers will often
  27141. // confuse the two.
  27142. if (!options.data) options.data = {}
  27143. options.data._pjax = context.selector
  27144. function fire(type, args) {
  27145. var event = $.Event(type, { relatedTarget: target })
  27146. context.trigger(event, args)
  27147. return !event.isDefaultPrevented()
  27148. }
  27149. var timeoutTimer
  27150. options.beforeSend = function(xhr, settings) {
  27151. // No timeout for non-GET requests
  27152. // Its not safe to request the resource again with a fallback method.
  27153. if (settings.type !== 'GET') {
  27154. settings.timeout = 0
  27155. }
  27156. xhr.setRequestHeader('X-PJAX', 'true')
  27157. xhr.setRequestHeader('X-PJAX-Container', context.selector)
  27158. var result
  27159. if (!fire('pjax:beforeSend', [xhr, settings]))
  27160. return false
  27161. if (settings.timeout > 0) {
  27162. timeoutTimer = setTimeout(function() {
  27163. if (fire('pjax:timeout', [xhr, options]))
  27164. xhr.abort('timeout')
  27165. }, settings.timeout)
  27166. // Clear timeout setting so jquerys internal timeout isn't invoked
  27167. settings.timeout = 0
  27168. }
  27169. options.requestUrl = parseURL(settings.url).href
  27170. }
  27171. options.complete = function(xhr, textStatus) {
  27172. if (timeoutTimer)
  27173. clearTimeout(timeoutTimer)
  27174. fire('pjax:complete', [xhr, textStatus, options])
  27175. fire('pjax:end', [xhr, options])
  27176. }
  27177. options.error = function(xhr, textStatus, errorThrown) {
  27178. var container = extractContainer("", xhr, options)
  27179. var allowed = fire('pjax:error', [xhr, textStatus, errorThrown, options])
  27180. if (options.type == 'GET' && textStatus !== 'abort' && allowed) {
  27181. locationReplace(container.url)
  27182. }
  27183. }
  27184. options.success = function(data, status, xhr) {
  27185. var container = extractContainer(data, xhr, options)
  27186. if (!container.contents) {
  27187. locationReplace(container.url)
  27188. return
  27189. }
  27190. pjax.state = {
  27191. id: options.id || uniqueId(),
  27192. url: container.url,
  27193. title: container.title,
  27194. container: context.selector,
  27195. fragment: options.fragment,
  27196. timeout: options.timeout
  27197. }
  27198. if (options.push || options.replace) {
  27199. window.history.replaceState(pjax.state, container.title, container.url)
  27200. }
  27201. if (container.title) document.title = container.title
  27202. context.html(container.contents)
  27203. // Scroll to top by default
  27204. if (typeof options.scrollTo === 'number')
  27205. $(window).scrollTop(options.scrollTo)
  27206. // Google Analytics support
  27207. if ( (options.replace || options.push) && window._gaq )
  27208. _gaq.push(['_trackPageview'])
  27209. // If the URL has a hash in it, make sure the browser
  27210. // knows to navigate to the hash.
  27211. if ( hash !== '' ) {
  27212. // Avoid using simple hash set here. Will add another history
  27213. // entry. Replace the url with replaceState and scroll to target
  27214. // by hand.
  27215. //
  27216. // window.location.hash = hash
  27217. var url = parseURL(container.url)
  27218. url.hash = hash
  27219. pjax.state.url = url.href
  27220. window.history.replaceState(pjax.state, container.title, url.href)
  27221. var target = $(url.hash)
  27222. if (target.length) $(window).scrollTop(target.offset().top)
  27223. }
  27224. fire('pjax:success', [data, status, xhr, options])
  27225. }
  27226. // Initialize pjax.state for the initial page load. Assume we're
  27227. // using the container and options of the link we're loading for the
  27228. // back button to the initial page. This ensures good back button
  27229. // behavior.
  27230. if (!pjax.state) {
  27231. pjax.state = {
  27232. id: uniqueId(),
  27233. url: window.location.href,
  27234. title: document.title,
  27235. container: context.selector,
  27236. fragment: options.fragment,
  27237. timeout: options.timeout
  27238. }
  27239. window.history.replaceState(pjax.state, document.title)
  27240. }
  27241. // Cancel the current request if we're already pjaxing
  27242. var xhr = pjax.xhr
  27243. if ( xhr && xhr.readyState < 4) {
  27244. xhr.onreadystatechange = $.noop
  27245. xhr.abort()
  27246. }
  27247. pjax.options = options
  27248. var xhr = pjax.xhr = $.ajax(options)
  27249. if (xhr.readyState > 0) {
  27250. if (options.push && !options.replace) {
  27251. // Cache current container element before replacing it
  27252. cachePush(pjax.state.id, context.clone().contents())
  27253. window.history.pushState(null, "", stripPjaxParam(options.requestUrl))
  27254. }
  27255. fire('pjax:start', [xhr, options])
  27256. fire('pjax:send', [xhr, options])
  27257. }
  27258. return pjax.xhr
  27259. }
  27260. // Public: Reload current page with pjax.
  27261. //
  27262. // Returns whatever $.pjax returns.
  27263. function pjaxReload(container, options) {
  27264. var defaults = {
  27265. url: window.location.href,
  27266. push: false,
  27267. replace: true,
  27268. scrollTo: false
  27269. }
  27270. return pjax($.extend(defaults, optionsFor(container, options)))
  27271. }
  27272. // Internal: Hard replace current state with url.
  27273. //
  27274. // Work for around WebKit
  27275. // https://bugs.webkit.org/show_bug.cgi?id=93506
  27276. //
  27277. // Returns nothing.
  27278. function locationReplace(url) {
  27279. window.history.replaceState(null, "", "#")
  27280. window.location.replace(url)
  27281. }
  27282. // popstate handler takes care of the back and forward buttons
  27283. //
  27284. // You probably shouldn't use pjax on pages with other pushState
  27285. // stuff yet.
  27286. function onPjaxPopstate(event) {
  27287. var state = event.state
  27288. if (state && state.container) {
  27289. var container = $(state.container)
  27290. if (container.length) {
  27291. var contents = cacheMapping[state.id]
  27292. if (pjax.state) {
  27293. // Since state ids always increase, we can deduce the history
  27294. // direction from the previous state.
  27295. var direction = pjax.state.id < state.id ? 'forward' : 'back'
  27296. // Cache current container before replacement and inform the
  27297. // cache which direction the history shifted.
  27298. cachePop(direction, pjax.state.id, container.clone().contents())
  27299. } else {
  27300. // Page was reloaded but we have an existing history entry.
  27301. // Set it to our initial state.
  27302. pjax.state = state;
  27303. return;
  27304. }
  27305. var popstateEvent = $.Event('pjax:popstate', {
  27306. state: state,
  27307. direction: direction
  27308. })
  27309. container.trigger(popstateEvent)
  27310. var options = {
  27311. id: state.id,
  27312. url: state.url,
  27313. container: container,
  27314. push: false,
  27315. fragment: state.fragment,
  27316. timeout: state.timeout,
  27317. scrollTo: false
  27318. }
  27319. if (contents) {
  27320. container.trigger('pjax:start', [null, options])
  27321. if (state.title) document.title = state.title
  27322. container.html(contents)
  27323. pjax.state = state
  27324. container.trigger('pjax:end', [null, options])
  27325. } else {
  27326. pjax(options)
  27327. }
  27328. // Force reflow/relayout before the browser tries to restore the
  27329. // scroll position.
  27330. container[0].offsetHeight
  27331. } else {
  27332. locationReplace(location.href)
  27333. }
  27334. }
  27335. }
  27336. // Fallback version of main pjax function for browsers that don't
  27337. // support pushState.
  27338. //
  27339. // Returns nothing since it retriggers a hard form submission.
  27340. function fallbackPjax(options) {
  27341. var url = $.isFunction(options.url) ? options.url() : options.url,
  27342. method = options.type ? options.type.toUpperCase() : 'GET'
  27343. var form = $('<form>', {
  27344. method: method === 'GET' ? 'GET' : 'POST',
  27345. action: url,
  27346. style: 'display:none'
  27347. })
  27348. if (method !== 'GET' && method !== 'POST') {
  27349. form.append($('<input>', {
  27350. type: 'hidden',
  27351. name: '_method',
  27352. value: method.toLowerCase()
  27353. }))
  27354. }
  27355. var data = options.data
  27356. if (typeof data === 'string') {
  27357. $.each(data.split('&'), function(index, value) {
  27358. var pair = value.split('=')
  27359. form.append($('<input>', {type: 'hidden', name: pair[0], value: pair[1]}))
  27360. })
  27361. } else if (typeof data === 'object') {
  27362. for (key in data)
  27363. form.append($('<input>', {type: 'hidden', name: key, value: data[key]}))
  27364. }
  27365. $(document.body).append(form)
  27366. form.submit()
  27367. }
  27368. // Internal: Generate unique id for state object.
  27369. //
  27370. // Use a timestamp instead of a counter since ids should still be
  27371. // unique across page loads.
  27372. //
  27373. // Returns Number.
  27374. function uniqueId() {
  27375. return (new Date).getTime()
  27376. }
  27377. // Internal: Strips _pjax param from url
  27378. //
  27379. // url - String
  27380. //
  27381. // Returns String.
  27382. function stripPjaxParam(url) {
  27383. return url
  27384. .replace(/\?_pjax=[^&]+&?/, '?')
  27385. .replace(/_pjax=[^&]+&?/, '')
  27386. .replace(/[\?&]$/, '')
  27387. }
  27388. // Internal: Parse URL components and returns a Locationish object.
  27389. //
  27390. // url - String URL
  27391. //
  27392. // Returns HTMLAnchorElement that acts like Location.
  27393. function parseURL(url) {
  27394. var a = document.createElement('a')
  27395. a.href = url
  27396. return a
  27397. }
  27398. // Internal: Build options Object for arguments.
  27399. //
  27400. // For convenience the first parameter can be either the container or
  27401. // the options object.
  27402. //
  27403. // Examples
  27404. //
  27405. // optionsFor('#container')
  27406. // // => {container: '#container'}
  27407. //
  27408. // optionsFor('#container', {push: true})
  27409. // // => {container: '#container', push: true}
  27410. //
  27411. // optionsFor({container: '#container', push: true})
  27412. // // => {container: '#container', push: true}
  27413. //
  27414. // Returns options Object.
  27415. function optionsFor(container, options) {
  27416. // Both container and options
  27417. if ( container && options )
  27418. options.container = container
  27419. // First argument is options Object
  27420. else if ( $.isPlainObject(container) )
  27421. options = container
  27422. // Only container
  27423. else
  27424. options = {container: container}
  27425. // Find and validate container
  27426. if (options.container)
  27427. options.container = findContainerFor(options.container)
  27428. return options
  27429. }
  27430. // Internal: Find container element for a variety of inputs.
  27431. //
  27432. // Because we can't persist elements using the history API, we must be
  27433. // able to find a String selector that will consistently find the Element.
  27434. //
  27435. // container - A selector String, jQuery object, or DOM Element.
  27436. //
  27437. // Returns a jQuery object whose context is `document` and has a selector.
  27438. function findContainerFor(container) {
  27439. container = $(container)
  27440. if ( !container.length ) {
  27441. throw "no pjax container for " + container.selector
  27442. } else if ( container.selector !== '' && container.context === document ) {
  27443. return container
  27444. } else if ( container.attr('id') ) {
  27445. return $('#' + container.attr('id'))
  27446. } else {
  27447. throw "cant get selector for pjax container!"
  27448. }
  27449. }
  27450. // Internal: Filter and find all elements matching the selector.
  27451. //
  27452. // Where $.fn.find only matches descendants, findAll will test all the
  27453. // top level elements in the jQuery object as well.
  27454. //
  27455. // elems - jQuery object of Elements
  27456. // selector - String selector to match
  27457. //
  27458. // Returns a jQuery object.
  27459. function findAll(elems, selector) {
  27460. return elems.filter(selector).add(elems.find(selector));
  27461. }
  27462. // Internal: Extracts container and metadata from response.
  27463. //
  27464. // 1. Extracts X-PJAX-URL header if set
  27465. // 2. Extracts inline <title> tags
  27466. // 3. Builds response Element and extracts fragment if set
  27467. //
  27468. // data - String response data
  27469. // xhr - XHR response
  27470. // options - pjax options Object
  27471. //
  27472. // Returns an Object with url, title, and contents keys.
  27473. function extractContainer(data, xhr, options) {
  27474. var obj = {}
  27475. // Prefer X-PJAX-URL header if it was set, otherwise fallback to
  27476. // using the original requested url.
  27477. obj.url = stripPjaxParam(xhr.getResponseHeader('X-PJAX-URL') || options.requestUrl)
  27478. // Attempt to parse response html into elements
  27479. if (/<html/i.test(data)) {
  27480. var $head = $(data.match(/<head[^>]*>([\s\S.]*)<\/head>/i)[0])
  27481. var $body = $(data.match(/<body[^>]*>([\s\S.]*)<\/body>/i)[0])
  27482. } else {
  27483. var $head = $body = $(data)
  27484. }
  27485. // If response data is empty, return fast
  27486. if ($body.length === 0)
  27487. return obj
  27488. // If there's a <title> tag in the header, use it as
  27489. // the page's title.
  27490. obj.title = findAll($head, 'title').last().text()
  27491. if (options.fragment) {
  27492. // If they specified a fragment, look for it in the response
  27493. // and pull it out.
  27494. if (options.fragment === 'body') {
  27495. var $fragment = $body
  27496. } else {
  27497. var $fragment = findAll($body, options.fragment).first()
  27498. }
  27499. if ($fragment.length) {
  27500. obj.contents = $fragment.contents()
  27501. // If there's no title, look for data-title and title attributes
  27502. // on the fragment
  27503. if (!obj.title)
  27504. obj.title = $fragment.attr('title') || $fragment.data('title')
  27505. }
  27506. } else if (!/<html/i.test(data)) {
  27507. obj.contents = $body
  27508. }
  27509. // Clean up any <title> tags
  27510. if (obj.contents) {
  27511. // Remove any parent title elements
  27512. obj.contents = obj.contents.not('title')
  27513. // Then scrub any titles from their descendents
  27514. obj.contents.find('title').remove()
  27515. }
  27516. // Trim any whitespace off the title
  27517. if (obj.title) obj.title = $.trim(obj.title)
  27518. return obj
  27519. }
  27520. // Internal: History DOM caching class.
  27521. var cacheMapping = {}
  27522. var cacheForwardStack = []
  27523. var cacheBackStack = []
  27524. // Push previous state id and container contents into the history
  27525. // cache. Should be called in conjunction with `pushState` to save the
  27526. // previous container contents.
  27527. //
  27528. // id - State ID Number
  27529. // value - DOM Element to cache
  27530. //
  27531. // Returns nothing.
  27532. function cachePush(id, value) {
  27533. cacheMapping[id] = value
  27534. cacheBackStack.push(id)
  27535. // Remove all entires in forward history stack after pushing
  27536. // a new page.
  27537. while (cacheForwardStack.length)
  27538. delete cacheMapping[cacheForwardStack.shift()]
  27539. // Trim back history stack to max cache length.
  27540. while (cacheBackStack.length > pjax.defaults.maxCacheLength)
  27541. delete cacheMapping[cacheBackStack.shift()]
  27542. }
  27543. // Shifts cache from directional history cache. Should be
  27544. // called on `popstate` with the previous state id and container
  27545. // contents.
  27546. //
  27547. // direction - "forward" or "back" String
  27548. // id - State ID Number
  27549. // value - DOM Element to cache
  27550. //
  27551. // Returns nothing.
  27552. function cachePop(direction, id, value) {
  27553. var pushStack, popStack
  27554. cacheMapping[id] = value
  27555. if (direction === 'forward') {
  27556. pushStack = cacheBackStack
  27557. popStack = cacheForwardStack
  27558. } else {
  27559. pushStack = cacheForwardStack
  27560. popStack = cacheBackStack
  27561. }
  27562. pushStack.push(id)
  27563. if (id = popStack.pop())
  27564. delete cacheMapping[id]
  27565. }
  27566. // Install pjax functions on $.pjax to enable pushState behavior.
  27567. //
  27568. // Does nothing if already enabled.
  27569. //
  27570. // Examples
  27571. //
  27572. // $.pjax.enable()
  27573. //
  27574. // Returns nothing.
  27575. function enable() {
  27576. $.fn.pjax = fnPjax
  27577. $.pjax = pjax
  27578. $.pjax.enable = $.noop
  27579. $.pjax.disable = disable
  27580. $.pjax.click = handleClick
  27581. $.pjax.submit = handleSubmit
  27582. $.pjax.reload = pjaxReload
  27583. $.pjax.defaults = {
  27584. timeout: 650,
  27585. push: true,
  27586. replace: false,
  27587. type: 'GET',
  27588. dataType: 'html',
  27589. scrollTo: 0,
  27590. maxCacheLength: 20
  27591. }
  27592. $(window).bind('popstate.pjax', onPjaxPopstate)
  27593. }
  27594. // Disable pushState behavior.
  27595. //
  27596. // This is the case when a browser doesn't support pushState. It is
  27597. // sometimes useful to disable pushState for debugging on a modern
  27598. // browser.
  27599. //
  27600. // Examples
  27601. //
  27602. // $.pjax.disable()
  27603. //
  27604. // Returns nothing.
  27605. function disable() {
  27606. $.fn.pjax = function() { return this }
  27607. $.pjax = fallbackPjax
  27608. $.pjax.enable = enable
  27609. $.pjax.disable = $.noop
  27610. $.pjax.click = $.noop
  27611. $.pjax.submit = $.noop
  27612. $.pjax.reload = function() { window.location.reload() }
  27613. $(window).unbind('popstate.pjax', onPjaxPopstate)
  27614. }
  27615. // Add the state property to jQuery's event object so we can use it in
  27616. // $(window).bind('popstate')
  27617. if ( $.inArray('state', $.event.props) < 0 )
  27618. $.event.props.push('state')
  27619. // Is pjax supported by this browser?
  27620. $.support.pjax =
  27621. window.history && window.history.pushState && window.history.replaceState &&
  27622. // pushState isn't reliable on iOS until 5.
  27623. !navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/)
  27624. $.support.pjax ? enable() : disable()
  27625. })(jQuery);
  27626. (function($) {
  27627. window.NestedFormEvents = function() {
  27628. this.addFields = $.proxy(this.addFields, this);
  27629. this.removeFields = $.proxy(this.removeFields, this);
  27630. };
  27631. NestedFormEvents.prototype = {
  27632. addFields: function(e) {
  27633. // Setup
  27634. var link = e.currentTarget;
  27635. var assoc = $(link).data('association'); // Name of child
  27636. var blueprint = $('#' + $(link).data('blueprint-id'));
  27637. var content = blueprint.data('blueprint'); // Fields template
  27638. // Make the context correct by replacing <parents> with the generated ID
  27639. // of each of the parent objects
  27640. var context = ($(link).closest('.fields').closestChild('input, textarea, select').eq(0).attr('name') || '').replace(new RegExp('\[[a-z_]+\]$'), '');
  27641. // context will be something like this for a brand new form:
  27642. // project[tasks_attributes][1255929127459][assignments_attributes][1255929128105]
  27643. // or for an edit form:
  27644. // project[tasks_attributes][0][assignments_attributes][1]
  27645. if (context) {
  27646. var parentNames = context.match(/[a-z_]+_attributes(?=\]\[(new_)?\d+\])/g) || [];
  27647. var parentIds = context.match(/[0-9]+/g) || [];
  27648. for(var i = 0; i < parentNames.length; i++) {
  27649. if(parentIds[i]) {
  27650. content = content.replace(
  27651. new RegExp('(_' + parentNames[i] + ')_.+?_', 'g'),
  27652. '$1_' + parentIds[i] + '_');
  27653. content = content.replace(
  27654. new RegExp('(\\[' + parentNames[i] + '\\])\\[.+?\\]', 'g'),
  27655. '$1[' + parentIds[i] + ']');
  27656. }
  27657. }
  27658. }
  27659. // Make a unique ID for the new child
  27660. var regexp = new RegExp('new_' + assoc, 'g');
  27661. var new_id = this.newId();
  27662. content = $.trim(content.replace(regexp, new_id));
  27663. var field = this.insertFields(content, assoc, link);
  27664. // bubble up event upto document (through form)
  27665. field
  27666. .trigger({ type: 'nested:fieldAdded', field: field })
  27667. .trigger({ type: 'nested:fieldAdded:' + assoc, field: field });
  27668. return false;
  27669. },
  27670. newId: function() {
  27671. return new Date().getTime();
  27672. },
  27673. insertFields: function(content, assoc, link) {
  27674. var target = $(link).data('target');
  27675. if (target) {
  27676. return $(content).appendTo($(target));
  27677. } else {
  27678. return $(content).insertBefore(link);
  27679. }
  27680. },
  27681. removeFields: function(e) {
  27682. var $link = $(e.currentTarget),
  27683. assoc = $link.data('association'); // Name of child to be removed
  27684. var hiddenField = $link.prev('input[type=hidden]');
  27685. hiddenField.val('1');
  27686. var field = $link.closest('.fields');
  27687. field.hide();
  27688. field
  27689. .trigger({ type: 'nested:fieldRemoved', field: field })
  27690. .trigger({ type: 'nested:fieldRemoved:' + assoc, field: field });
  27691. return false;
  27692. }
  27693. };
  27694. window.nestedFormEvents = new NestedFormEvents();
  27695. $(document)
  27696. .delegate('form a.add_nested_fields', 'click', nestedFormEvents.addFields)
  27697. .delegate('form a.remove_nested_fields', 'click', nestedFormEvents.removeFields);
  27698. })(jQuery);
  27699. // http://plugins.jquery.com/project/closestChild
  27700. /*
  27701. * Copyright 2011, Tobias Lindig
  27702. *
  27703. * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  27704. * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  27705. *
  27706. */
  27707. (function($) {
  27708. $.fn.closestChild = function(selector) {
  27709. // breadth first search for the first matched node
  27710. if (selector && selector != '') {
  27711. var queue = [];
  27712. queue.push(this);
  27713. while(queue.length > 0) {
  27714. var node = queue.shift();
  27715. var children = node.children();
  27716. for(var i = 0; i < children.length; ++i) {
  27717. var child = $(children[i]);
  27718. if (child.is(selector)) {
  27719. return child; //well, we found one
  27720. }
  27721. queue.push(child);
  27722. }
  27723. }
  27724. }
  27725. return $();//nothing found
  27726. };
  27727. })(jQuery);
  27728. (function() {
  27729. var $;
  27730. $ = jQuery;
  27731. $(document).ready(function() {
  27732. return window.nestedFormEvents.insertFields = function(content, assoc, link) {
  27733. var tab_content;
  27734. tab_content = $(link).closest(".controls").siblings(".tab-content");
  27735. tab_content.append(content);
  27736. return tab_content.children().last();
  27737. };
  27738. });
  27739. $(document).on('nested:fieldAdded', 'form', function(content) {
  27740. var controls, field, nav, new_tab, one_to_one, parent_group, toggler;
  27741. field = content.field.addClass('tab-pane').attr('id', 'unique-id-' + (new Date().getTime()));
  27742. new_tab = $('<li><a data-toggle="tab" href="#' + field.attr('id') + '">' + field.children('.object-infos').data('object-label') + '</a></li>');
  27743. parent_group = field.closest('.control-group');
  27744. controls = parent_group.children('.controls');
  27745. one_to_one = controls.data('nestedone') !== void 0;
  27746. nav = controls.children('.nav');
  27747. content = parent_group.children('.tab-content');
  27748. toggler = controls.find('.toggler');
  27749. nav.append(new_tab);
  27750. $(window.document).trigger('rails_admin.dom_ready', [field, parent_group]);
  27751. new_tab.children('a').tab('show');
  27752. if (!one_to_one) {
  27753. nav.select(':hidden').show('slow');
  27754. }
  27755. content.select(':hidden').show('slow');
  27756. toggler.addClass('active').removeClass('disabled').children('i').addClass('icon-chevron-down').removeClass('icon-chevron-right');
  27757. if (one_to_one) {
  27758. return controls.find('.add_nested_fields').removeClass('add_nested_fields').html(field.children('.object-infos').data('object-label'));
  27759. }
  27760. });
  27761. $(document).on('nested:fieldRemoved', 'form', function(content) {
  27762. var add_button, controls, current_li, field, nav, one_to_one, parent_group, toggler;
  27763. field = content.field;
  27764. nav = field.closest(".control-group").children('.controls').children('.nav');
  27765. current_li = nav.children('li').has('a[href="#' + field.attr('id') + '"]');
  27766. parent_group = field.closest(".control-group");
  27767. controls = parent_group.children('.controls');
  27768. one_to_one = controls.data('nestedone') !== void 0;
  27769. toggler = controls.find('.toggler');
  27770. (current_li.next().length ? current_li.next() : current_li.prev()).children('a:first').tab('show');
  27771. current_li.remove();
  27772. if (nav.children().length === 0) {
  27773. nav.select(':visible').hide('slow');
  27774. toggler.removeClass('active').addClass('disabled').children('i').removeClass('icon-chevron-down').addClass('icon-chevron-right');
  27775. }
  27776. if (one_to_one) {
  27777. add_button = toggler.next();
  27778. add_button.addClass('add_nested_fields').html(add_button.data('add-label'));
  27779. }
  27780. return field.find('[required]').each(function() {
  27781. return $(this).removeAttr('required');
  27782. });
  27783. });
  27784. }).call(this);
  27785. (function() {
  27786. var Locale;
  27787. this.RailsAdmin || (this.RailsAdmin = {});
  27788. this.RailsAdmin.I18n = Locale = (function() {
  27789. function Locale() {}
  27790. Locale.init = function(locale, translations) {
  27791. this.locale = locale;
  27792. this.translations = translations;
  27793. return moment.locale(this.locale);
  27794. };
  27795. Locale.t = function(key) {
  27796. var humanize;
  27797. humanize = key.charAt(0).toUpperCase() + key.replace(/_/g, " ").slice(1);
  27798. return this.translations[key] || humanize;
  27799. };
  27800. return Locale;
  27801. })();
  27802. }).call(this);
  27803. /* ========================================================================
  27804. * Bootstrap: transition.js v3.2.0
  27805. * http://getbootstrap.com/javascript/#transitions
  27806. * ========================================================================
  27807. * Copyright 2011-2014 Twitter, Inc.
  27808. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27809. * ======================================================================== */
  27810. +function ($) {
  27811. 'use strict';
  27812. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  27813. // ============================================================
  27814. function transitionEnd() {
  27815. var el = document.createElement('bootstrap')
  27816. var transEndEventNames = {
  27817. WebkitTransition : 'webkitTransitionEnd',
  27818. MozTransition : 'transitionend',
  27819. OTransition : 'oTransitionEnd otransitionend',
  27820. transition : 'transitionend'
  27821. }
  27822. for (var name in transEndEventNames) {
  27823. if (el.style[name] !== undefined) {
  27824. return { end: transEndEventNames[name] }
  27825. }
  27826. }
  27827. return false // explicit for ie8 ( ._.)
  27828. }
  27829. // http://blog.alexmaccaw.com/css-transitions
  27830. $.fn.emulateTransitionEnd = function (duration) {
  27831. var called = false
  27832. var $el = this
  27833. $(this).one('bsTransitionEnd', function () { called = true })
  27834. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  27835. setTimeout(callback, duration)
  27836. return this
  27837. }
  27838. $(function () {
  27839. $.support.transition = transitionEnd()
  27840. if (!$.support.transition) return
  27841. $.event.special.bsTransitionEnd = {
  27842. bindType: $.support.transition.end,
  27843. delegateType: $.support.transition.end,
  27844. handle: function (e) {
  27845. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  27846. }
  27847. }
  27848. })
  27849. }(jQuery);
  27850. /* ========================================================================
  27851. * Bootstrap: affix.js v3.2.0
  27852. * http://getbootstrap.com/javascript/#affix
  27853. * ========================================================================
  27854. * Copyright 2011-2014 Twitter, Inc.
  27855. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27856. * ======================================================================== */
  27857. +function ($) {
  27858. 'use strict';
  27859. // AFFIX CLASS DEFINITION
  27860. // ======================
  27861. var Affix = function (element, options) {
  27862. this.options = $.extend({}, Affix.DEFAULTS, options)
  27863. this.$target = $(this.options.target)
  27864. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  27865. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  27866. this.$element = $(element)
  27867. this.affixed =
  27868. this.unpin =
  27869. this.pinnedOffset = null
  27870. this.checkPosition()
  27871. }
  27872. Affix.VERSION = '3.2.0'
  27873. Affix.RESET = 'affix affix-top affix-bottom'
  27874. Affix.DEFAULTS = {
  27875. offset: 0,
  27876. target: window
  27877. }
  27878. Affix.prototype.getPinnedOffset = function () {
  27879. if (this.pinnedOffset) return this.pinnedOffset
  27880. this.$element.removeClass(Affix.RESET).addClass('affix')
  27881. var scrollTop = this.$target.scrollTop()
  27882. var position = this.$element.offset()
  27883. return (this.pinnedOffset = position.top - scrollTop)
  27884. }
  27885. Affix.prototype.checkPositionWithEventLoop = function () {
  27886. setTimeout($.proxy(this.checkPosition, this), 1)
  27887. }
  27888. Affix.prototype.checkPosition = function () {
  27889. if (!this.$element.is(':visible')) return
  27890. var scrollHeight = $(document).height()
  27891. var scrollTop = this.$target.scrollTop()
  27892. var position = this.$element.offset()
  27893. var offset = this.options.offset
  27894. var offsetTop = offset.top
  27895. var offsetBottom = offset.bottom
  27896. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  27897. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  27898. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  27899. var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
  27900. offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
  27901. offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
  27902. if (this.affixed === affix) return
  27903. if (this.unpin != null) this.$element.css('top', '')
  27904. var affixType = 'affix' + (affix ? '-' + affix : '')
  27905. var e = $.Event(affixType + '.bs.affix')
  27906. this.$element.trigger(e)
  27907. if (e.isDefaultPrevented()) return
  27908. this.affixed = affix
  27909. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  27910. this.$element
  27911. .removeClass(Affix.RESET)
  27912. .addClass(affixType)
  27913. .trigger($.Event(affixType.replace('affix', 'affixed')))
  27914. if (affix == 'bottom') {
  27915. this.$element.offset({
  27916. top: scrollHeight - this.$element.height() - offsetBottom
  27917. })
  27918. }
  27919. }
  27920. // AFFIX PLUGIN DEFINITION
  27921. // =======================
  27922. function Plugin(option) {
  27923. return this.each(function () {
  27924. var $this = $(this)
  27925. var data = $this.data('bs.affix')
  27926. var options = typeof option == 'object' && option
  27927. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  27928. if (typeof option == 'string') data[option]()
  27929. })
  27930. }
  27931. var old = $.fn.affix
  27932. $.fn.affix = Plugin
  27933. $.fn.affix.Constructor = Affix
  27934. // AFFIX NO CONFLICT
  27935. // =================
  27936. $.fn.affix.noConflict = function () {
  27937. $.fn.affix = old
  27938. return this
  27939. }
  27940. // AFFIX DATA-API
  27941. // ==============
  27942. $(window).on('load', function () {
  27943. $('[data-spy="affix"]').each(function () {
  27944. var $spy = $(this)
  27945. var data = $spy.data()
  27946. data.offset = data.offset || {}
  27947. if (data.offsetBottom) data.offset.bottom = data.offsetBottom
  27948. if (data.offsetTop) data.offset.top = data.offsetTop
  27949. Plugin.call($spy, data)
  27950. })
  27951. })
  27952. }(jQuery);
  27953. /* ========================================================================
  27954. * Bootstrap: alert.js v3.2.0
  27955. * http://getbootstrap.com/javascript/#alerts
  27956. * ========================================================================
  27957. * Copyright 2011-2014 Twitter, Inc.
  27958. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27959. * ======================================================================== */
  27960. +function ($) {
  27961. 'use strict';
  27962. // ALERT CLASS DEFINITION
  27963. // ======================
  27964. var dismiss = '[data-dismiss="alert"]'
  27965. var Alert = function (el) {
  27966. $(el).on('click', dismiss, this.close)
  27967. }
  27968. Alert.VERSION = '3.2.0'
  27969. Alert.prototype.close = function (e) {
  27970. var $this = $(this)
  27971. var selector = $this.attr('data-target')
  27972. if (!selector) {
  27973. selector = $this.attr('href')
  27974. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  27975. }
  27976. var $parent = $(selector)
  27977. if (e) e.preventDefault()
  27978. if (!$parent.length) {
  27979. $parent = $this.hasClass('alert') ? $this : $this.parent()
  27980. }
  27981. $parent.trigger(e = $.Event('close.bs.alert'))
  27982. if (e.isDefaultPrevented()) return
  27983. $parent.removeClass('in')
  27984. function removeElement() {
  27985. // detach from parent, fire event then clean up data
  27986. $parent.detach().trigger('closed.bs.alert').remove()
  27987. }
  27988. $.support.transition && $parent.hasClass('fade') ?
  27989. $parent
  27990. .one('bsTransitionEnd', removeElement)
  27991. .emulateTransitionEnd(150) :
  27992. removeElement()
  27993. }
  27994. // ALERT PLUGIN DEFINITION
  27995. // =======================
  27996. function Plugin(option) {
  27997. return this.each(function () {
  27998. var $this = $(this)
  27999. var data = $this.data('bs.alert')
  28000. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  28001. if (typeof option == 'string') data[option].call($this)
  28002. })
  28003. }
  28004. var old = $.fn.alert
  28005. $.fn.alert = Plugin
  28006. $.fn.alert.Constructor = Alert
  28007. // ALERT NO CONFLICT
  28008. // =================
  28009. $.fn.alert.noConflict = function () {
  28010. $.fn.alert = old
  28011. return this
  28012. }
  28013. // ALERT DATA-API
  28014. // ==============
  28015. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  28016. }(jQuery);
  28017. /* ========================================================================
  28018. * Bootstrap: button.js v3.2.0
  28019. * http://getbootstrap.com/javascript/#buttons
  28020. * ========================================================================
  28021. * Copyright 2011-2014 Twitter, Inc.
  28022. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28023. * ======================================================================== */
  28024. +function ($) {
  28025. 'use strict';
  28026. // BUTTON PUBLIC CLASS DEFINITION
  28027. // ==============================
  28028. var Button = function (element, options) {
  28029. this.$element = $(element)
  28030. this.options = $.extend({}, Button.DEFAULTS, options)
  28031. this.isLoading = false
  28032. }
  28033. Button.VERSION = '3.2.0'
  28034. Button.DEFAULTS = {
  28035. loadingText: 'loading...'
  28036. }
  28037. Button.prototype.setState = function (state) {
  28038. var d = 'disabled'
  28039. var $el = this.$element
  28040. var val = $el.is('input') ? 'val' : 'html'
  28041. var data = $el.data()
  28042. state = state + 'Text'
  28043. if (data.resetText == null) $el.data('resetText', $el[val]())
  28044. $el[val](data[state] == null ? this.options[state] : data[state])
  28045. // push to event loop to allow forms to submit
  28046. setTimeout($.proxy(function () {
  28047. if (state == 'loadingText') {
  28048. this.isLoading = true
  28049. $el.addClass(d).attr(d, d)
  28050. } else if (this.isLoading) {
  28051. this.isLoading = false
  28052. $el.removeClass(d).removeAttr(d)
  28053. }
  28054. }, this), 0)
  28055. }
  28056. Button.prototype.toggle = function () {
  28057. var changed = true
  28058. var $parent = this.$element.closest('[data-toggle="buttons"]')
  28059. if ($parent.length) {
  28060. var $input = this.$element.find('input')
  28061. if ($input.prop('type') == 'radio') {
  28062. if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
  28063. else $parent.find('.active').removeClass('active')
  28064. }
  28065. if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
  28066. }
  28067. if (changed) this.$element.toggleClass('active')
  28068. }
  28069. // BUTTON PLUGIN DEFINITION
  28070. // ========================
  28071. function Plugin(option) {
  28072. return this.each(function () {
  28073. var $this = $(this)
  28074. var data = $this.data('bs.button')
  28075. var options = typeof option == 'object' && option
  28076. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  28077. if (option == 'toggle') data.toggle()
  28078. else if (option) data.setState(option)
  28079. })
  28080. }
  28081. var old = $.fn.button
  28082. $.fn.button = Plugin
  28083. $.fn.button.Constructor = Button
  28084. // BUTTON NO CONFLICT
  28085. // ==================
  28086. $.fn.button.noConflict = function () {
  28087. $.fn.button = old
  28088. return this
  28089. }
  28090. // BUTTON DATA-API
  28091. // ===============
  28092. $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  28093. var $btn = $(e.target)
  28094. if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
  28095. Plugin.call($btn, 'toggle')
  28096. e.preventDefault()
  28097. })
  28098. }(jQuery);
  28099. /* ========================================================================
  28100. * Bootstrap: carousel.js v3.2.0
  28101. * http://getbootstrap.com/javascript/#carousel
  28102. * ========================================================================
  28103. * Copyright 2011-2014 Twitter, Inc.
  28104. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28105. * ======================================================================== */
  28106. +function ($) {
  28107. 'use strict';
  28108. // CAROUSEL CLASS DEFINITION
  28109. // =========================
  28110. var Carousel = function (element, options) {
  28111. this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
  28112. this.$indicators = this.$element.find('.carousel-indicators')
  28113. this.options = options
  28114. this.paused =
  28115. this.sliding =
  28116. this.interval =
  28117. this.$active =
  28118. this.$items = null
  28119. this.options.pause == 'hover' && this.$element
  28120. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  28121. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  28122. }
  28123. Carousel.VERSION = '3.2.0'
  28124. Carousel.DEFAULTS = {
  28125. interval: 5000,
  28126. pause: 'hover',
  28127. wrap: true
  28128. }
  28129. Carousel.prototype.keydown = function (e) {
  28130. switch (e.which) {
  28131. case 37: this.prev(); break
  28132. case 39: this.next(); break
  28133. default: return
  28134. }
  28135. e.preventDefault()
  28136. }
  28137. Carousel.prototype.cycle = function (e) {
  28138. e || (this.paused = false)
  28139. this.interval && clearInterval(this.interval)
  28140. this.options.interval
  28141. && !this.paused
  28142. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  28143. return this
  28144. }
  28145. Carousel.prototype.getItemIndex = function (item) {
  28146. this.$items = item.parent().children('.item')
  28147. return this.$items.index(item || this.$active)
  28148. }
  28149. Carousel.prototype.to = function (pos) {
  28150. var that = this
  28151. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  28152. if (pos > (this.$items.length - 1) || pos < 0) return
  28153. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  28154. if (activeIndex == pos) return this.pause().cycle()
  28155. return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
  28156. }
  28157. Carousel.prototype.pause = function (e) {
  28158. e || (this.paused = true)
  28159. if (this.$element.find('.next, .prev').length && $.support.transition) {
  28160. this.$element.trigger($.support.transition.end)
  28161. this.cycle(true)
  28162. }
  28163. this.interval = clearInterval(this.interval)
  28164. return this
  28165. }
  28166. Carousel.prototype.next = function () {
  28167. if (this.sliding) return
  28168. return this.slide('next')
  28169. }
  28170. Carousel.prototype.prev = function () {
  28171. if (this.sliding) return
  28172. return this.slide('prev')
  28173. }
  28174. Carousel.prototype.slide = function (type, next) {
  28175. var $active = this.$element.find('.item.active')
  28176. var $next = next || $active[type]()
  28177. var isCycling = this.interval
  28178. var direction = type == 'next' ? 'left' : 'right'
  28179. var fallback = type == 'next' ? 'first' : 'last'
  28180. var that = this
  28181. if (!$next.length) {
  28182. if (!this.options.wrap) return
  28183. $next = this.$element.find('.item')[fallback]()
  28184. }
  28185. if ($next.hasClass('active')) return (this.sliding = false)
  28186. var relatedTarget = $next[0]
  28187. var slideEvent = $.Event('slide.bs.carousel', {
  28188. relatedTarget: relatedTarget,
  28189. direction: direction
  28190. })
  28191. this.$element.trigger(slideEvent)
  28192. if (slideEvent.isDefaultPrevented()) return
  28193. this.sliding = true
  28194. isCycling && this.pause()
  28195. if (this.$indicators.length) {
  28196. this.$indicators.find('.active').removeClass('active')
  28197. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  28198. $nextIndicator && $nextIndicator.addClass('active')
  28199. }
  28200. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  28201. if ($.support.transition && this.$element.hasClass('slide')) {
  28202. $next.addClass(type)
  28203. $next[0].offsetWidth // force reflow
  28204. $active.addClass(direction)
  28205. $next.addClass(direction)
  28206. $active
  28207. .one('bsTransitionEnd', function () {
  28208. $next.removeClass([type, direction].join(' ')).addClass('active')
  28209. $active.removeClass(['active', direction].join(' '))
  28210. that.sliding = false
  28211. setTimeout(function () {
  28212. that.$element.trigger(slidEvent)
  28213. }, 0)
  28214. })
  28215. .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
  28216. } else {
  28217. $active.removeClass('active')
  28218. $next.addClass('active')
  28219. this.sliding = false
  28220. this.$element.trigger(slidEvent)
  28221. }
  28222. isCycling && this.cycle()
  28223. return this
  28224. }
  28225. // CAROUSEL PLUGIN DEFINITION
  28226. // ==========================
  28227. function Plugin(option) {
  28228. return this.each(function () {
  28229. var $this = $(this)
  28230. var data = $this.data('bs.carousel')
  28231. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  28232. var action = typeof option == 'string' ? option : options.slide
  28233. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  28234. if (typeof option == 'number') data.to(option)
  28235. else if (action) data[action]()
  28236. else if (options.interval) data.pause().cycle()
  28237. })
  28238. }
  28239. var old = $.fn.carousel
  28240. $.fn.carousel = Plugin
  28241. $.fn.carousel.Constructor = Carousel
  28242. // CAROUSEL NO CONFLICT
  28243. // ====================
  28244. $.fn.carousel.noConflict = function () {
  28245. $.fn.carousel = old
  28246. return this
  28247. }
  28248. // CAROUSEL DATA-API
  28249. // =================
  28250. $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
  28251. var href
  28252. var $this = $(this)
  28253. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  28254. if (!$target.hasClass('carousel')) return
  28255. var options = $.extend({}, $target.data(), $this.data())
  28256. var slideIndex = $this.attr('data-slide-to')
  28257. if (slideIndex) options.interval = false
  28258. Plugin.call($target, options)
  28259. if (slideIndex) {
  28260. $target.data('bs.carousel').to(slideIndex)
  28261. }
  28262. e.preventDefault()
  28263. })
  28264. $(window).on('load', function () {
  28265. $('[data-ride="carousel"]').each(function () {
  28266. var $carousel = $(this)
  28267. Plugin.call($carousel, $carousel.data())
  28268. })
  28269. })
  28270. }(jQuery);
  28271. /* ========================================================================
  28272. * Bootstrap: collapse.js v3.2.0
  28273. * http://getbootstrap.com/javascript/#collapse
  28274. * ========================================================================
  28275. * Copyright 2011-2014 Twitter, Inc.
  28276. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28277. * ======================================================================== */
  28278. +function ($) {
  28279. 'use strict';
  28280. // COLLAPSE PUBLIC CLASS DEFINITION
  28281. // ================================
  28282. var Collapse = function (element, options) {
  28283. this.$element = $(element)
  28284. this.options = $.extend({}, Collapse.DEFAULTS, options)
  28285. this.transitioning = null
  28286. if (this.options.parent) this.$parent = $(this.options.parent)
  28287. if (this.options.toggle) this.toggle()
  28288. }
  28289. Collapse.VERSION = '3.2.0'
  28290. Collapse.DEFAULTS = {
  28291. toggle: true
  28292. }
  28293. Collapse.prototype.dimension = function () {
  28294. var hasWidth = this.$element.hasClass('width')
  28295. return hasWidth ? 'width' : 'height'
  28296. }
  28297. Collapse.prototype.show = function () {
  28298. if (this.transitioning || this.$element.hasClass('in')) return
  28299. var startEvent = $.Event('show.bs.collapse')
  28300. this.$element.trigger(startEvent)
  28301. if (startEvent.isDefaultPrevented()) return
  28302. var actives = this.$parent && this.$parent.find('> .panel > .in')
  28303. if (actives && actives.length) {
  28304. var hasData = actives.data('bs.collapse')
  28305. if (hasData && hasData.transitioning) return
  28306. Plugin.call(actives, 'hide')
  28307. hasData || actives.data('bs.collapse', null)
  28308. }
  28309. var dimension = this.dimension()
  28310. this.$element
  28311. .removeClass('collapse')
  28312. .addClass('collapsing')[dimension](0)
  28313. this.transitioning = 1
  28314. var complete = function () {
  28315. this.$element
  28316. .removeClass('collapsing')
  28317. .addClass('collapse in')[dimension]('')
  28318. this.transitioning = 0
  28319. this.$element
  28320. .trigger('shown.bs.collapse')
  28321. }
  28322. if (!$.support.transition) return complete.call(this)
  28323. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  28324. this.$element
  28325. .one('bsTransitionEnd', $.proxy(complete, this))
  28326. .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
  28327. }
  28328. Collapse.prototype.hide = function () {
  28329. if (this.transitioning || !this.$element.hasClass('in')) return
  28330. var startEvent = $.Event('hide.bs.collapse')
  28331. this.$element.trigger(startEvent)
  28332. if (startEvent.isDefaultPrevented()) return
  28333. var dimension = this.dimension()
  28334. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  28335. this.$element
  28336. .addClass('collapsing')
  28337. .removeClass('collapse')
  28338. .removeClass('in')
  28339. this.transitioning = 1
  28340. var complete = function () {
  28341. this.transitioning = 0
  28342. this.$element
  28343. .trigger('hidden.bs.collapse')
  28344. .removeClass('collapsing')
  28345. .addClass('collapse')
  28346. }
  28347. if (!$.support.transition) return complete.call(this)
  28348. this.$element
  28349. [dimension](0)
  28350. .one('bsTransitionEnd', $.proxy(complete, this))
  28351. .emulateTransitionEnd(350)
  28352. }
  28353. Collapse.prototype.toggle = function () {
  28354. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  28355. }
  28356. // COLLAPSE PLUGIN DEFINITION
  28357. // ==========================
  28358. function Plugin(option) {
  28359. return this.each(function () {
  28360. var $this = $(this)
  28361. var data = $this.data('bs.collapse')
  28362. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  28363. if (!data && options.toggle && option == 'show') option = !option
  28364. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  28365. if (typeof option == 'string') data[option]()
  28366. })
  28367. }
  28368. var old = $.fn.collapse
  28369. $.fn.collapse = Plugin
  28370. $.fn.collapse.Constructor = Collapse
  28371. // COLLAPSE NO CONFLICT
  28372. // ====================
  28373. $.fn.collapse.noConflict = function () {
  28374. $.fn.collapse = old
  28375. return this
  28376. }
  28377. // COLLAPSE DATA-API
  28378. // =================
  28379. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  28380. var href
  28381. var $this = $(this)
  28382. var target = $this.attr('data-target')
  28383. || e.preventDefault()
  28384. || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  28385. var $target = $(target)
  28386. var data = $target.data('bs.collapse')
  28387. var option = data ? 'toggle' : $this.data()
  28388. var parent = $this.attr('data-parent')
  28389. var $parent = parent && $(parent)
  28390. if (!data || !data.transitioning) {
  28391. if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
  28392. $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
  28393. }
  28394. Plugin.call($target, option)
  28395. })
  28396. }(jQuery);
  28397. /* ========================================================================
  28398. * Bootstrap: dropdown.js v3.2.0
  28399. * http://getbootstrap.com/javascript/#dropdowns
  28400. * ========================================================================
  28401. * Copyright 2011-2014 Twitter, Inc.
  28402. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28403. * ======================================================================== */
  28404. +function ($) {
  28405. 'use strict';
  28406. // DROPDOWN CLASS DEFINITION
  28407. // =========================
  28408. var backdrop = '.dropdown-backdrop'
  28409. var toggle = '[data-toggle="dropdown"]'
  28410. var Dropdown = function (element) {
  28411. $(element).on('click.bs.dropdown', this.toggle)
  28412. }
  28413. Dropdown.VERSION = '3.2.0'
  28414. Dropdown.prototype.toggle = function (e) {
  28415. var $this = $(this)
  28416. if ($this.is('.disabled, :disabled')) return
  28417. var $parent = getParent($this)
  28418. var isActive = $parent.hasClass('open')
  28419. clearMenus()
  28420. if (!isActive) {
  28421. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  28422. // if mobile we use a backdrop because click events don't delegate
  28423. $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
  28424. }
  28425. var relatedTarget = { relatedTarget: this }
  28426. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  28427. if (e.isDefaultPrevented()) return
  28428. $this.trigger('focus')
  28429. $parent
  28430. .toggleClass('open')
  28431. .trigger('shown.bs.dropdown', relatedTarget)
  28432. }
  28433. return false
  28434. }
  28435. Dropdown.prototype.keydown = function (e) {
  28436. if (!/(38|40|27)/.test(e.keyCode)) return
  28437. var $this = $(this)
  28438. e.preventDefault()
  28439. e.stopPropagation()
  28440. if ($this.is('.disabled, :disabled')) return
  28441. var $parent = getParent($this)
  28442. var isActive = $parent.hasClass('open')
  28443. if (!isActive || (isActive && e.keyCode == 27)) {
  28444. if (e.which == 27) $parent.find(toggle).trigger('focus')
  28445. return $this.trigger('click')
  28446. }
  28447. var desc = ' li:not(.divider):visible a'
  28448. var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
  28449. if (!$items.length) return
  28450. var index = $items.index($items.filter(':focus'))
  28451. if (e.keyCode == 38 && index > 0) index-- // up
  28452. if (e.keyCode == 40 && index < $items.length - 1) index++ // down
  28453. if (!~index) index = 0
  28454. $items.eq(index).trigger('focus')
  28455. }
  28456. function clearMenus(e) {
  28457. if (e && e.which === 3) return
  28458. $(backdrop).remove()
  28459. $(toggle).each(function () {
  28460. var $parent = getParent($(this))
  28461. var relatedTarget = { relatedTarget: this }
  28462. if (!$parent.hasClass('open')) return
  28463. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  28464. if (e.isDefaultPrevented()) return
  28465. $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
  28466. })
  28467. }
  28468. function getParent($this) {
  28469. var selector = $this.attr('data-target')
  28470. if (!selector) {
  28471. selector = $this.attr('href')
  28472. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  28473. }
  28474. var $parent = selector && $(selector)
  28475. return $parent && $parent.length ? $parent : $this.parent()
  28476. }
  28477. // DROPDOWN PLUGIN DEFINITION
  28478. // ==========================
  28479. function Plugin(option) {
  28480. return this.each(function () {
  28481. var $this = $(this)
  28482. var data = $this.data('bs.dropdown')
  28483. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  28484. if (typeof option == 'string') data[option].call($this)
  28485. })
  28486. }
  28487. var old = $.fn.dropdown
  28488. $.fn.dropdown = Plugin
  28489. $.fn.dropdown.Constructor = Dropdown
  28490. // DROPDOWN NO CONFLICT
  28491. // ====================
  28492. $.fn.dropdown.noConflict = function () {
  28493. $.fn.dropdown = old
  28494. return this
  28495. }
  28496. // APPLY TO STANDARD DROPDOWN ELEMENTS
  28497. // ===================================
  28498. $(document)
  28499. .on('click.bs.dropdown.data-api', clearMenus)
  28500. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  28501. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  28502. .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
  28503. }(jQuery);
  28504. /* ========================================================================
  28505. * Bootstrap: modal.js v3.2.0
  28506. * http://getbootstrap.com/javascript/#modals
  28507. * ========================================================================
  28508. * Copyright 2011-2014 Twitter, Inc.
  28509. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28510. * ======================================================================== */
  28511. +function ($) {
  28512. 'use strict';
  28513. // MODAL CLASS DEFINITION
  28514. // ======================
  28515. var Modal = function (element, options) {
  28516. this.options = options
  28517. this.$body = $(document.body)
  28518. this.$element = $(element)
  28519. this.$backdrop =
  28520. this.isShown = null
  28521. this.scrollbarWidth = 0
  28522. if (this.options.remote) {
  28523. this.$element
  28524. .find('.modal-content')
  28525. .load(this.options.remote, $.proxy(function () {
  28526. this.$element.trigger('loaded.bs.modal')
  28527. }, this))
  28528. }
  28529. }
  28530. Modal.VERSION = '3.2.0'
  28531. Modal.DEFAULTS = {
  28532. backdrop: true,
  28533. keyboard: true,
  28534. show: true
  28535. }
  28536. Modal.prototype.toggle = function (_relatedTarget) {
  28537. return this.isShown ? this.hide() : this.show(_relatedTarget)
  28538. }
  28539. Modal.prototype.show = function (_relatedTarget) {
  28540. var that = this
  28541. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  28542. this.$element.trigger(e)
  28543. if (this.isShown || e.isDefaultPrevented()) return
  28544. this.isShown = true
  28545. this.checkScrollbar()
  28546. this.$body.addClass('modal-open')
  28547. this.setScrollbar()
  28548. this.escape()
  28549. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  28550. this.backdrop(function () {
  28551. var transition = $.support.transition && that.$element.hasClass('fade')
  28552. if (!that.$element.parent().length) {
  28553. that.$element.appendTo(that.$body) // don't move modals dom position
  28554. }
  28555. that.$element
  28556. .show()
  28557. .scrollTop(0)
  28558. if (transition) {
  28559. that.$element[0].offsetWidth // force reflow
  28560. }
  28561. that.$element
  28562. .addClass('in')
  28563. .attr('aria-hidden', false)
  28564. that.enforceFocus()
  28565. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  28566. transition ?
  28567. that.$element.find('.modal-dialog') // wait for modal to slide in
  28568. .one('bsTransitionEnd', function () {
  28569. that.$element.trigger('focus').trigger(e)
  28570. })
  28571. .emulateTransitionEnd(300) :
  28572. that.$element.trigger('focus').trigger(e)
  28573. })
  28574. }
  28575. Modal.prototype.hide = function (e) {
  28576. if (e) e.preventDefault()
  28577. e = $.Event('hide.bs.modal')
  28578. this.$element.trigger(e)
  28579. if (!this.isShown || e.isDefaultPrevented()) return
  28580. this.isShown = false
  28581. this.$body.removeClass('modal-open')
  28582. this.resetScrollbar()
  28583. this.escape()
  28584. $(document).off('focusin.bs.modal')
  28585. this.$element
  28586. .removeClass('in')
  28587. .attr('aria-hidden', true)
  28588. .off('click.dismiss.bs.modal')
  28589. $.support.transition && this.$element.hasClass('fade') ?
  28590. this.$element
  28591. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  28592. .emulateTransitionEnd(300) :
  28593. this.hideModal()
  28594. }
  28595. Modal.prototype.enforceFocus = function () {
  28596. $(document)
  28597. .off('focusin.bs.modal') // guard against infinite focus loop
  28598. .on('focusin.bs.modal', $.proxy(function (e) {
  28599. if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
  28600. this.$element.trigger('focus')
  28601. }
  28602. }, this))
  28603. }
  28604. Modal.prototype.escape = function () {
  28605. if (this.isShown && this.options.keyboard) {
  28606. this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
  28607. e.which == 27 && this.hide()
  28608. }, this))
  28609. } else if (!this.isShown) {
  28610. this.$element.off('keyup.dismiss.bs.modal')
  28611. }
  28612. }
  28613. Modal.prototype.hideModal = function () {
  28614. var that = this
  28615. this.$element.hide()
  28616. this.backdrop(function () {
  28617. that.$element.trigger('hidden.bs.modal')
  28618. })
  28619. }
  28620. Modal.prototype.removeBackdrop = function () {
  28621. this.$backdrop && this.$backdrop.remove()
  28622. this.$backdrop = null
  28623. }
  28624. Modal.prototype.backdrop = function (callback) {
  28625. var that = this
  28626. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  28627. if (this.isShown && this.options.backdrop) {
  28628. var doAnimate = $.support.transition && animate
  28629. this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
  28630. .appendTo(this.$body)
  28631. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  28632. if (e.target !== e.currentTarget) return
  28633. this.options.backdrop == 'static'
  28634. ? this.$element[0].focus.call(this.$element[0])
  28635. : this.hide.call(this)
  28636. }, this))
  28637. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  28638. this.$backdrop.addClass('in')
  28639. if (!callback) return
  28640. doAnimate ?
  28641. this.$backdrop
  28642. .one('bsTransitionEnd', callback)
  28643. .emulateTransitionEnd(150) :
  28644. callback()
  28645. } else if (!this.isShown && this.$backdrop) {
  28646. this.$backdrop.removeClass('in')
  28647. var callbackRemove = function () {
  28648. that.removeBackdrop()
  28649. callback && callback()
  28650. }
  28651. $.support.transition && this.$element.hasClass('fade') ?
  28652. this.$backdrop
  28653. .one('bsTransitionEnd', callbackRemove)
  28654. .emulateTransitionEnd(150) :
  28655. callbackRemove()
  28656. } else if (callback) {
  28657. callback()
  28658. }
  28659. }
  28660. Modal.prototype.checkScrollbar = function () {
  28661. if (document.body.clientWidth >= window.innerWidth) return
  28662. this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
  28663. }
  28664. Modal.prototype.setScrollbar = function () {
  28665. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  28666. if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  28667. }
  28668. Modal.prototype.resetScrollbar = function () {
  28669. this.$body.css('padding-right', '')
  28670. }
  28671. Modal.prototype.measureScrollbar = function () { // thx walsh
  28672. var scrollDiv = document.createElement('div')
  28673. scrollDiv.className = 'modal-scrollbar-measure'
  28674. this.$body.append(scrollDiv)
  28675. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  28676. this.$body[0].removeChild(scrollDiv)
  28677. return scrollbarWidth
  28678. }
  28679. // MODAL PLUGIN DEFINITION
  28680. // =======================
  28681. function Plugin(option, _relatedTarget) {
  28682. return this.each(function () {
  28683. var $this = $(this)
  28684. var data = $this.data('bs.modal')
  28685. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  28686. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  28687. if (typeof option == 'string') data[option](_relatedTarget)
  28688. else if (options.show) data.show(_relatedTarget)
  28689. })
  28690. }
  28691. var old = $.fn.modal
  28692. $.fn.modal = Plugin
  28693. $.fn.modal.Constructor = Modal
  28694. // MODAL NO CONFLICT
  28695. // =================
  28696. $.fn.modal.noConflict = function () {
  28697. $.fn.modal = old
  28698. return this
  28699. }
  28700. // MODAL DATA-API
  28701. // ==============
  28702. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  28703. var $this = $(this)
  28704. var href = $this.attr('href')
  28705. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
  28706. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  28707. if ($this.is('a')) e.preventDefault()
  28708. $target.one('show.bs.modal', function (showEvent) {
  28709. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  28710. $target.one('hidden.bs.modal', function () {
  28711. $this.is(':visible') && $this.trigger('focus')
  28712. })
  28713. })
  28714. Plugin.call($target, option, this)
  28715. })
  28716. }(jQuery);
  28717. /* ========================================================================
  28718. * Bootstrap: scrollspy.js v3.2.0
  28719. * http://getbootstrap.com/javascript/#scrollspy
  28720. * ========================================================================
  28721. * Copyright 2011-2014 Twitter, Inc.
  28722. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28723. * ======================================================================== */
  28724. +function ($) {
  28725. 'use strict';
  28726. // SCROLLSPY CLASS DEFINITION
  28727. // ==========================
  28728. function ScrollSpy(element, options) {
  28729. var process = $.proxy(this.process, this)
  28730. this.$body = $('body')
  28731. this.$scrollElement = $(element).is('body') ? $(window) : $(element)
  28732. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  28733. this.selector = (this.options.target || '') + ' .nav li > a'
  28734. this.offsets = []
  28735. this.targets = []
  28736. this.activeTarget = null
  28737. this.scrollHeight = 0
  28738. this.$scrollElement.on('scroll.bs.scrollspy', process)
  28739. this.refresh()
  28740. this.process()
  28741. }
  28742. ScrollSpy.VERSION = '3.2.0'
  28743. ScrollSpy.DEFAULTS = {
  28744. offset: 10
  28745. }
  28746. ScrollSpy.prototype.getScrollHeight = function () {
  28747. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  28748. }
  28749. ScrollSpy.prototype.refresh = function () {
  28750. var offsetMethod = 'offset'
  28751. var offsetBase = 0
  28752. if (!$.isWindow(this.$scrollElement[0])) {
  28753. offsetMethod = 'position'
  28754. offsetBase = this.$scrollElement.scrollTop()
  28755. }
  28756. this.offsets = []
  28757. this.targets = []
  28758. this.scrollHeight = this.getScrollHeight()
  28759. var self = this
  28760. this.$body
  28761. .find(this.selector)
  28762. .map(function () {
  28763. var $el = $(this)
  28764. var href = $el.data('target') || $el.attr('href')
  28765. var $href = /^#./.test(href) && $(href)
  28766. return ($href
  28767. && $href.length
  28768. && $href.is(':visible')
  28769. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  28770. })
  28771. .sort(function (a, b) { return a[0] - b[0] })
  28772. .each(function () {
  28773. self.offsets.push(this[0])
  28774. self.targets.push(this[1])
  28775. })
  28776. }
  28777. ScrollSpy.prototype.process = function () {
  28778. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  28779. var scrollHeight = this.getScrollHeight()
  28780. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  28781. var offsets = this.offsets
  28782. var targets = this.targets
  28783. var activeTarget = this.activeTarget
  28784. var i
  28785. if (this.scrollHeight != scrollHeight) {
  28786. this.refresh()
  28787. }
  28788. if (scrollTop >= maxScroll) {
  28789. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  28790. }
  28791. if (activeTarget && scrollTop <= offsets[0]) {
  28792. return activeTarget != (i = targets[0]) && this.activate(i)
  28793. }
  28794. for (i = offsets.length; i--;) {
  28795. activeTarget != targets[i]
  28796. && scrollTop >= offsets[i]
  28797. && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
  28798. && this.activate(targets[i])
  28799. }
  28800. }
  28801. ScrollSpy.prototype.activate = function (target) {
  28802. this.activeTarget = target
  28803. $(this.selector)
  28804. .parentsUntil(this.options.target, '.active')
  28805. .removeClass('active')
  28806. var selector = this.selector +
  28807. '[data-target="' + target + '"],' +
  28808. this.selector + '[href="' + target + '"]'
  28809. var active = $(selector)
  28810. .parents('li')
  28811. .addClass('active')
  28812. if (active.parent('.dropdown-menu').length) {
  28813. active = active
  28814. .closest('li.dropdown')
  28815. .addClass('active')
  28816. }
  28817. active.trigger('activate.bs.scrollspy')
  28818. }
  28819. // SCROLLSPY PLUGIN DEFINITION
  28820. // ===========================
  28821. function Plugin(option) {
  28822. return this.each(function () {
  28823. var $this = $(this)
  28824. var data = $this.data('bs.scrollspy')
  28825. var options = typeof option == 'object' && option
  28826. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  28827. if (typeof option == 'string') data[option]()
  28828. })
  28829. }
  28830. var old = $.fn.scrollspy
  28831. $.fn.scrollspy = Plugin
  28832. $.fn.scrollspy.Constructor = ScrollSpy
  28833. // SCROLLSPY NO CONFLICT
  28834. // =====================
  28835. $.fn.scrollspy.noConflict = function () {
  28836. $.fn.scrollspy = old
  28837. return this
  28838. }
  28839. // SCROLLSPY DATA-API
  28840. // ==================
  28841. $(window).on('load.bs.scrollspy.data-api', function () {
  28842. $('[data-spy="scroll"]').each(function () {
  28843. var $spy = $(this)
  28844. Plugin.call($spy, $spy.data())
  28845. })
  28846. })
  28847. }(jQuery);
  28848. /* ========================================================================
  28849. * Bootstrap: tab.js v3.2.0
  28850. * http://getbootstrap.com/javascript/#tabs
  28851. * ========================================================================
  28852. * Copyright 2011-2014 Twitter, Inc.
  28853. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28854. * ======================================================================== */
  28855. +function ($) {
  28856. 'use strict';
  28857. // TAB CLASS DEFINITION
  28858. // ====================
  28859. var Tab = function (element) {
  28860. this.element = $(element)
  28861. }
  28862. Tab.VERSION = '3.2.0'
  28863. Tab.prototype.show = function () {
  28864. var $this = this.element
  28865. var $ul = $this.closest('ul:not(.dropdown-menu)')
  28866. var selector = $this.data('target')
  28867. if (!selector) {
  28868. selector = $this.attr('href')
  28869. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  28870. }
  28871. if ($this.parent('li').hasClass('active')) return
  28872. var previous = $ul.find('.active:last a')[0]
  28873. var e = $.Event('show.bs.tab', {
  28874. relatedTarget: previous
  28875. })
  28876. $this.trigger(e)
  28877. if (e.isDefaultPrevented()) return
  28878. var $target = $(selector)
  28879. this.activate($this.closest('li'), $ul)
  28880. this.activate($target, $target.parent(), function () {
  28881. $this.trigger({
  28882. type: 'shown.bs.tab',
  28883. relatedTarget: previous
  28884. })
  28885. })
  28886. }
  28887. Tab.prototype.activate = function (element, container, callback) {
  28888. var $active = container.find('> .active')
  28889. var transition = callback
  28890. && $.support.transition
  28891. && $active.hasClass('fade')
  28892. function next() {
  28893. $active
  28894. .removeClass('active')
  28895. .find('> .dropdown-menu > .active')
  28896. .removeClass('active')
  28897. element.addClass('active')
  28898. if (transition) {
  28899. element[0].offsetWidth // reflow for transition
  28900. element.addClass('in')
  28901. } else {
  28902. element.removeClass('fade')
  28903. }
  28904. if (element.parent('.dropdown-menu')) {
  28905. element.closest('li.dropdown').addClass('active')
  28906. }
  28907. callback && callback()
  28908. }
  28909. transition ?
  28910. $active
  28911. .one('bsTransitionEnd', next)
  28912. .emulateTransitionEnd(150) :
  28913. next()
  28914. $active.removeClass('in')
  28915. }
  28916. // TAB PLUGIN DEFINITION
  28917. // =====================
  28918. function Plugin(option) {
  28919. return this.each(function () {
  28920. var $this = $(this)
  28921. var data = $this.data('bs.tab')
  28922. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  28923. if (typeof option == 'string') data[option]()
  28924. })
  28925. }
  28926. var old = $.fn.tab
  28927. $.fn.tab = Plugin
  28928. $.fn.tab.Constructor = Tab
  28929. // TAB NO CONFLICT
  28930. // ===============
  28931. $.fn.tab.noConflict = function () {
  28932. $.fn.tab = old
  28933. return this
  28934. }
  28935. // TAB DATA-API
  28936. // ============
  28937. $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
  28938. e.preventDefault()
  28939. Plugin.call($(this), 'show')
  28940. })
  28941. }(jQuery);
  28942. /* ========================================================================
  28943. * Bootstrap: tooltip.js v3.2.0
  28944. * http://getbootstrap.com/javascript/#tooltip
  28945. * Inspired by the original jQuery.tipsy by Jason Frame
  28946. * ========================================================================
  28947. * Copyright 2011-2014 Twitter, Inc.
  28948. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  28949. * ======================================================================== */
  28950. +function ($) {
  28951. 'use strict';
  28952. // TOOLTIP PUBLIC CLASS DEFINITION
  28953. // ===============================
  28954. var Tooltip = function (element, options) {
  28955. this.type =
  28956. this.options =
  28957. this.enabled =
  28958. this.timeout =
  28959. this.hoverState =
  28960. this.$element = null
  28961. this.init('tooltip', element, options)
  28962. }
  28963. Tooltip.VERSION = '3.2.0'
  28964. Tooltip.DEFAULTS = {
  28965. animation: true,
  28966. placement: 'top',
  28967. selector: false,
  28968. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  28969. trigger: 'hover focus',
  28970. title: '',
  28971. delay: 0,
  28972. html: false,
  28973. container: false,
  28974. viewport: {
  28975. selector: 'body',
  28976. padding: 0
  28977. }
  28978. }
  28979. Tooltip.prototype.init = function (type, element, options) {
  28980. this.enabled = true
  28981. this.type = type
  28982. this.$element = $(element)
  28983. this.options = this.getOptions(options)
  28984. this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
  28985. var triggers = this.options.trigger.split(' ')
  28986. for (var i = triggers.length; i--;) {
  28987. var trigger = triggers[i]
  28988. if (trigger == 'click') {
  28989. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  28990. } else if (trigger != 'manual') {
  28991. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  28992. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  28993. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  28994. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  28995. }
  28996. }
  28997. this.options.selector ?
  28998. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  28999. this.fixTitle()
  29000. }
  29001. Tooltip.prototype.getDefaults = function () {
  29002. return Tooltip.DEFAULTS
  29003. }
  29004. Tooltip.prototype.getOptions = function (options) {
  29005. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  29006. if (options.delay && typeof options.delay == 'number') {
  29007. options.delay = {
  29008. show: options.delay,
  29009. hide: options.delay
  29010. }
  29011. }
  29012. return options
  29013. }
  29014. Tooltip.prototype.getDelegateOptions = function () {
  29015. var options = {}
  29016. var defaults = this.getDefaults()
  29017. this._options && $.each(this._options, function (key, value) {
  29018. if (defaults[key] != value) options[key] = value
  29019. })
  29020. return options
  29021. }
  29022. Tooltip.prototype.enter = function (obj) {
  29023. var self = obj instanceof this.constructor ?
  29024. obj : $(obj.currentTarget).data('bs.' + this.type)
  29025. if (!self) {
  29026. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  29027. $(obj.currentTarget).data('bs.' + this.type, self)
  29028. }
  29029. clearTimeout(self.timeout)
  29030. self.hoverState = 'in'
  29031. if (!self.options.delay || !self.options.delay.show) return self.show()
  29032. self.timeout = setTimeout(function () {
  29033. if (self.hoverState == 'in') self.show()
  29034. }, self.options.delay.show)
  29035. }
  29036. Tooltip.prototype.leave = function (obj) {
  29037. var self = obj instanceof this.constructor ?
  29038. obj : $(obj.currentTarget).data('bs.' + this.type)
  29039. if (!self) {
  29040. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  29041. $(obj.currentTarget).data('bs.' + this.type, self)
  29042. }
  29043. clearTimeout(self.timeout)
  29044. self.hoverState = 'out'
  29045. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  29046. self.timeout = setTimeout(function () {
  29047. if (self.hoverState == 'out') self.hide()
  29048. }, self.options.delay.hide)
  29049. }
  29050. Tooltip.prototype.show = function () {
  29051. var e = $.Event('show.bs.' + this.type)
  29052. if (this.hasContent() && this.enabled) {
  29053. this.$element.trigger(e)
  29054. var inDom = $.contains(document.documentElement, this.$element[0])
  29055. if (e.isDefaultPrevented() || !inDom) return
  29056. var that = this
  29057. var $tip = this.tip()
  29058. var tipId = this.getUID(this.type)
  29059. this.setContent()
  29060. $tip.attr('id', tipId)
  29061. this.$element.attr('aria-describedby', tipId)
  29062. if (this.options.animation) $tip.addClass('fade')
  29063. var placement = typeof this.options.placement == 'function' ?
  29064. this.options.placement.call(this, $tip[0], this.$element[0]) :
  29065. this.options.placement
  29066. var autoToken = /\s?auto?\s?/i
  29067. var autoPlace = autoToken.test(placement)
  29068. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  29069. $tip
  29070. .detach()
  29071. .css({ top: 0, left: 0, display: 'block' })
  29072. .addClass(placement)
  29073. .data('bs.' + this.type, this)
  29074. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  29075. var pos = this.getPosition()
  29076. var actualWidth = $tip[0].offsetWidth
  29077. var actualHeight = $tip[0].offsetHeight
  29078. if (autoPlace) {
  29079. var orgPlacement = placement
  29080. var $parent = this.$element.parent()
  29081. var parentDim = this.getPosition($parent)
  29082. placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
  29083. placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
  29084. placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
  29085. placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
  29086. placement
  29087. $tip
  29088. .removeClass(orgPlacement)
  29089. .addClass(placement)
  29090. }
  29091. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  29092. this.applyPlacement(calculatedOffset, placement)
  29093. var complete = function () {
  29094. that.$element.trigger('shown.bs.' + that.type)
  29095. that.hoverState = null
  29096. }
  29097. $.support.transition && this.$tip.hasClass('fade') ?
  29098. $tip
  29099. .one('bsTransitionEnd', complete)
  29100. .emulateTransitionEnd(150) :
  29101. complete()
  29102. }
  29103. }
  29104. Tooltip.prototype.applyPlacement = function (offset, placement) {
  29105. var $tip = this.tip()
  29106. var width = $tip[0].offsetWidth
  29107. var height = $tip[0].offsetHeight
  29108. // manually read margins because getBoundingClientRect includes difference
  29109. var marginTop = parseInt($tip.css('margin-top'), 10)
  29110. var marginLeft = parseInt($tip.css('margin-left'), 10)
  29111. // we must check for NaN for ie 8/9
  29112. if (isNaN(marginTop)) marginTop = 0
  29113. if (isNaN(marginLeft)) marginLeft = 0
  29114. offset.top = offset.top + marginTop
  29115. offset.left = offset.left + marginLeft
  29116. // $.fn.offset doesn't round pixel values
  29117. // so we use setOffset directly with our own function B-0
  29118. $.offset.setOffset($tip[0], $.extend({
  29119. using: function (props) {
  29120. $tip.css({
  29121. top: Math.round(props.top),
  29122. left: Math.round(props.left)
  29123. })
  29124. }
  29125. }, offset), 0)
  29126. $tip.addClass('in')
  29127. // check to see if placing tip in new offset caused the tip to resize itself
  29128. var actualWidth = $tip[0].offsetWidth
  29129. var actualHeight = $tip[0].offsetHeight
  29130. if (placement == 'top' && actualHeight != height) {
  29131. offset.top = offset.top + height - actualHeight
  29132. }
  29133. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  29134. if (delta.left) offset.left += delta.left
  29135. else offset.top += delta.top
  29136. var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  29137. var arrowPosition = delta.left ? 'left' : 'top'
  29138. var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
  29139. $tip.offset(offset)
  29140. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
  29141. }
  29142. Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
  29143. this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
  29144. }
  29145. Tooltip.prototype.setContent = function () {
  29146. var $tip = this.tip()
  29147. var title = this.getTitle()
  29148. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  29149. $tip.removeClass('fade in top bottom left right')
  29150. }
  29151. Tooltip.prototype.hide = function () {
  29152. var that = this
  29153. var $tip = this.tip()
  29154. var e = $.Event('hide.bs.' + this.type)
  29155. this.$element.removeAttr('aria-describedby')
  29156. function complete() {
  29157. if (that.hoverState != 'in') $tip.detach()
  29158. that.$element.trigger('hidden.bs.' + that.type)
  29159. }
  29160. this.$element.trigger(e)
  29161. if (e.isDefaultPrevented()) return
  29162. $tip.removeClass('in')
  29163. $.support.transition && this.$tip.hasClass('fade') ?
  29164. $tip
  29165. .one('bsTransitionEnd', complete)
  29166. .emulateTransitionEnd(150) :
  29167. complete()
  29168. this.hoverState = null
  29169. return this
  29170. }
  29171. Tooltip.prototype.fixTitle = function () {
  29172. var $e = this.$element
  29173. if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
  29174. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  29175. }
  29176. }
  29177. Tooltip.prototype.hasContent = function () {
  29178. return this.getTitle()
  29179. }
  29180. Tooltip.prototype.getPosition = function ($element) {
  29181. $element = $element || this.$element
  29182. var el = $element[0]
  29183. var isBody = el.tagName == 'BODY'
  29184. return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
  29185. scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
  29186. width: isBody ? $(window).width() : $element.outerWidth(),
  29187. height: isBody ? $(window).height() : $element.outerHeight()
  29188. }, isBody ? { top: 0, left: 0 } : $element.offset())
  29189. }
  29190. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  29191. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  29192. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  29193. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  29194. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  29195. }
  29196. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  29197. var delta = { top: 0, left: 0 }
  29198. if (!this.$viewport) return delta
  29199. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  29200. var viewportDimensions = this.getPosition(this.$viewport)
  29201. if (/right|left/.test(placement)) {
  29202. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  29203. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  29204. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  29205. delta.top = viewportDimensions.top - topEdgeOffset
  29206. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  29207. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  29208. }
  29209. } else {
  29210. var leftEdgeOffset = pos.left - viewportPadding
  29211. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  29212. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  29213. delta.left = viewportDimensions.left - leftEdgeOffset
  29214. } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
  29215. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  29216. }
  29217. }
  29218. return delta
  29219. }
  29220. Tooltip.prototype.getTitle = function () {
  29221. var title
  29222. var $e = this.$element
  29223. var o = this.options
  29224. title = $e.attr('data-original-title')
  29225. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  29226. return title
  29227. }
  29228. Tooltip.prototype.getUID = function (prefix) {
  29229. do prefix += ~~(Math.random() * 1000000)
  29230. while (document.getElementById(prefix))
  29231. return prefix
  29232. }
  29233. Tooltip.prototype.tip = function () {
  29234. return (this.$tip = this.$tip || $(this.options.template))
  29235. }
  29236. Tooltip.prototype.arrow = function () {
  29237. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  29238. }
  29239. Tooltip.prototype.validate = function () {
  29240. if (!this.$element[0].parentNode) {
  29241. this.hide()
  29242. this.$element = null
  29243. this.options = null
  29244. }
  29245. }
  29246. Tooltip.prototype.enable = function () {
  29247. this.enabled = true
  29248. }
  29249. Tooltip.prototype.disable = function () {
  29250. this.enabled = false
  29251. }
  29252. Tooltip.prototype.toggleEnabled = function () {
  29253. this.enabled = !this.enabled
  29254. }
  29255. Tooltip.prototype.toggle = function (e) {
  29256. var self = this
  29257. if (e) {
  29258. self = $(e.currentTarget).data('bs.' + this.type)
  29259. if (!self) {
  29260. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  29261. $(e.currentTarget).data('bs.' + this.type, self)
  29262. }
  29263. }
  29264. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  29265. }
  29266. Tooltip.prototype.destroy = function () {
  29267. clearTimeout(this.timeout)
  29268. this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
  29269. }
  29270. // TOOLTIP PLUGIN DEFINITION
  29271. // =========================
  29272. function Plugin(option) {
  29273. return this.each(function () {
  29274. var $this = $(this)
  29275. var data = $this.data('bs.tooltip')
  29276. var options = typeof option == 'object' && option
  29277. if (!data && option == 'destroy') return
  29278. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  29279. if (typeof option == 'string') data[option]()
  29280. })
  29281. }
  29282. var old = $.fn.tooltip
  29283. $.fn.tooltip = Plugin
  29284. $.fn.tooltip.Constructor = Tooltip
  29285. // TOOLTIP NO CONFLICT
  29286. // ===================
  29287. $.fn.tooltip.noConflict = function () {
  29288. $.fn.tooltip = old
  29289. return this
  29290. }
  29291. }(jQuery);
  29292. /* ========================================================================
  29293. * Bootstrap: popover.js v3.2.0
  29294. * http://getbootstrap.com/javascript/#popovers
  29295. * ========================================================================
  29296. * Copyright 2011-2014 Twitter, Inc.
  29297. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  29298. * ======================================================================== */
  29299. +function ($) {
  29300. 'use strict';
  29301. // POPOVER PUBLIC CLASS DEFINITION
  29302. // ===============================
  29303. var Popover = function (element, options) {
  29304. this.init('popover', element, options)
  29305. }
  29306. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  29307. Popover.VERSION = '3.2.0'
  29308. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  29309. placement: 'right',
  29310. trigger: 'click',
  29311. content: '',
  29312. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  29313. })
  29314. // NOTE: POPOVER EXTENDS tooltip.js
  29315. // ================================
  29316. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  29317. Popover.prototype.constructor = Popover
  29318. Popover.prototype.getDefaults = function () {
  29319. return Popover.DEFAULTS
  29320. }
  29321. Popover.prototype.setContent = function () {
  29322. var $tip = this.tip()
  29323. var title = this.getTitle()
  29324. var content = this.getContent()
  29325. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  29326. $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
  29327. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  29328. ](content)
  29329. $tip.removeClass('fade top bottom left right in')
  29330. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  29331. // this manually by checking the contents.
  29332. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  29333. }
  29334. Popover.prototype.hasContent = function () {
  29335. return this.getTitle() || this.getContent()
  29336. }
  29337. Popover.prototype.getContent = function () {
  29338. var $e = this.$element
  29339. var o = this.options
  29340. return $e.attr('data-content')
  29341. || (typeof o.content == 'function' ?
  29342. o.content.call($e[0]) :
  29343. o.content)
  29344. }
  29345. Popover.prototype.arrow = function () {
  29346. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  29347. }
  29348. Popover.prototype.tip = function () {
  29349. if (!this.$tip) this.$tip = $(this.options.template)
  29350. return this.$tip
  29351. }
  29352. // POPOVER PLUGIN DEFINITION
  29353. // =========================
  29354. function Plugin(option) {
  29355. return this.each(function () {
  29356. var $this = $(this)
  29357. var data = $this.data('bs.popover')
  29358. var options = typeof option == 'object' && option
  29359. if (!data && option == 'destroy') return
  29360. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  29361. if (typeof option == 'string') data[option]()
  29362. })
  29363. }
  29364. var old = $.fn.popover
  29365. $.fn.popover = Plugin
  29366. $.fn.popover.Constructor = Popover
  29367. // POPOVER NO CONFLICT
  29368. // ===================
  29369. $.fn.popover.noConflict = function () {
  29370. $.fn.popover = old
  29371. return this
  29372. }
  29373. }(jQuery);
  29374. /*!
  29375. * typeahead.js 0.10.5
  29376. * https://github.com/twitter/typeahead.js
  29377. * Copyright 2013-2014 Twitter, Inc. and other contributors; Licensed MIT
  29378. */
  29379. (function($) {
  29380. var _ = function() {
  29381. "use strict";
  29382. return {
  29383. isMsie: function() {
  29384. return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false;
  29385. },
  29386. isBlankString: function(str) {
  29387. return !str || /^\s*$/.test(str);
  29388. },
  29389. escapeRegExChars: function(str) {
  29390. return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
  29391. },
  29392. isString: function(obj) {
  29393. return typeof obj === "string";
  29394. },
  29395. isNumber: function(obj) {
  29396. return typeof obj === "number";
  29397. },
  29398. isArray: $.isArray,
  29399. isFunction: $.isFunction,
  29400. isObject: $.isPlainObject,
  29401. isUndefined: function(obj) {
  29402. return typeof obj === "undefined";
  29403. },
  29404. toStr: function toStr(s) {
  29405. return _.isUndefined(s) || s === null ? "" : s + "";
  29406. },
  29407. bind: $.proxy,
  29408. each: function(collection, cb) {
  29409. $.each(collection, reverseArgs);
  29410. function reverseArgs(index, value) {
  29411. return cb(value, index);
  29412. }
  29413. },
  29414. map: $.map,
  29415. filter: $.grep,
  29416. every: function(obj, test) {
  29417. var result = true;
  29418. if (!obj) {
  29419. return result;
  29420. }
  29421. $.each(obj, function(key, val) {
  29422. if (!(result = test.call(null, val, key, obj))) {
  29423. return false;
  29424. }
  29425. });
  29426. return !!result;
  29427. },
  29428. some: function(obj, test) {
  29429. var result = false;
  29430. if (!obj) {
  29431. return result;
  29432. }
  29433. $.each(obj, function(key, val) {
  29434. if (result = test.call(null, val, key, obj)) {
  29435. return false;
  29436. }
  29437. });
  29438. return !!result;
  29439. },
  29440. mixin: $.extend,
  29441. getUniqueId: function() {
  29442. var counter = 0;
  29443. return function() {
  29444. return counter++;
  29445. };
  29446. }(),
  29447. templatify: function templatify(obj) {
  29448. return $.isFunction(obj) ? obj : template;
  29449. function template() {
  29450. return String(obj);
  29451. }
  29452. },
  29453. defer: function(fn) {
  29454. setTimeout(fn, 0);
  29455. },
  29456. debounce: function(func, wait, immediate) {
  29457. var timeout, result;
  29458. return function() {
  29459. var context = this, args = arguments, later, callNow;
  29460. later = function() {
  29461. timeout = null;
  29462. if (!immediate) {
  29463. result = func.apply(context, args);
  29464. }
  29465. };
  29466. callNow = immediate && !timeout;
  29467. clearTimeout(timeout);
  29468. timeout = setTimeout(later, wait);
  29469. if (callNow) {
  29470. result = func.apply(context, args);
  29471. }
  29472. return result;
  29473. };
  29474. },
  29475. throttle: function(func, wait) {
  29476. var context, args, timeout, result, previous, later;
  29477. previous = 0;
  29478. later = function() {
  29479. previous = new Date();
  29480. timeout = null;
  29481. result = func.apply(context, args);
  29482. };
  29483. return function() {
  29484. var now = new Date(), remaining = wait - (now - previous);
  29485. context = this;
  29486. args = arguments;
  29487. if (remaining <= 0) {
  29488. clearTimeout(timeout);
  29489. timeout = null;
  29490. previous = now;
  29491. result = func.apply(context, args);
  29492. } else if (!timeout) {
  29493. timeout = setTimeout(later, remaining);
  29494. }
  29495. return result;
  29496. };
  29497. },
  29498. noop: function() {}
  29499. };
  29500. }();
  29501. var VERSION = "0.10.5";
  29502. var tokenizers = function() {
  29503. "use strict";
  29504. return {
  29505. nonword: nonword,
  29506. whitespace: whitespace,
  29507. obj: {
  29508. nonword: getObjTokenizer(nonword),
  29509. whitespace: getObjTokenizer(whitespace)
  29510. }
  29511. };
  29512. function whitespace(str) {
  29513. str = _.toStr(str);
  29514. return str ? str.split(/\s+/) : [];
  29515. }
  29516. function nonword(str) {
  29517. str = _.toStr(str);
  29518. return str ? str.split(/\W+/) : [];
  29519. }
  29520. function getObjTokenizer(tokenizer) {
  29521. return function setKey() {
  29522. var args = [].slice.call(arguments, 0);
  29523. return function tokenize(o) {
  29524. var tokens = [];
  29525. _.each(args, function(k) {
  29526. tokens = tokens.concat(tokenizer(_.toStr(o[k])));
  29527. });
  29528. return tokens;
  29529. };
  29530. };
  29531. }
  29532. }();
  29533. var LruCache = function() {
  29534. "use strict";
  29535. function LruCache(maxSize) {
  29536. this.maxSize = _.isNumber(maxSize) ? maxSize : 100;
  29537. this.reset();
  29538. if (this.maxSize <= 0) {
  29539. this.set = this.get = $.noop;
  29540. }
  29541. }
  29542. _.mixin(LruCache.prototype, {
  29543. set: function set(key, val) {
  29544. var tailItem = this.list.tail, node;
  29545. if (this.size >= this.maxSize) {
  29546. this.list.remove(tailItem);
  29547. delete this.hash[tailItem.key];
  29548. }
  29549. if (node = this.hash[key]) {
  29550. node.val = val;
  29551. this.list.moveToFront(node);
  29552. } else {
  29553. node = new Node(key, val);
  29554. this.list.add(node);
  29555. this.hash[key] = node;
  29556. this.size++;
  29557. }
  29558. },
  29559. get: function get(key) {
  29560. var node = this.hash[key];
  29561. if (node) {
  29562. this.list.moveToFront(node);
  29563. return node.val;
  29564. }
  29565. },
  29566. reset: function reset() {
  29567. this.size = 0;
  29568. this.hash = {};
  29569. this.list = new List();
  29570. }
  29571. });
  29572. function List() {
  29573. this.head = this.tail = null;
  29574. }
  29575. _.mixin(List.prototype, {
  29576. add: function add(node) {
  29577. if (this.head) {
  29578. node.next = this.head;
  29579. this.head.prev = node;
  29580. }
  29581. this.head = node;
  29582. this.tail = this.tail || node;
  29583. },
  29584. remove: function remove(node) {
  29585. node.prev ? node.prev.next = node.next : this.head = node.next;
  29586. node.next ? node.next.prev = node.prev : this.tail = node.prev;
  29587. },
  29588. moveToFront: function(node) {
  29589. this.remove(node);
  29590. this.add(node);
  29591. }
  29592. });
  29593. function Node(key, val) {
  29594. this.key = key;
  29595. this.val = val;
  29596. this.prev = this.next = null;
  29597. }
  29598. return LruCache;
  29599. }();
  29600. var PersistentStorage = function() {
  29601. "use strict";
  29602. var ls, methods;
  29603. try {
  29604. ls = window.localStorage;
  29605. ls.setItem("~~~", "!");
  29606. ls.removeItem("~~~");
  29607. } catch (err) {
  29608. ls = null;
  29609. }
  29610. function PersistentStorage(namespace) {
  29611. this.prefix = [ "__", namespace, "__" ].join("");
  29612. this.ttlKey = "__ttl__";
  29613. this.keyMatcher = new RegExp("^" + _.escapeRegExChars(this.prefix));
  29614. }
  29615. if (ls && window.JSON) {
  29616. methods = {
  29617. _prefix: function(key) {
  29618. return this.prefix + key;
  29619. },
  29620. _ttlKey: function(key) {
  29621. return this._prefix(key) + this.ttlKey;
  29622. },
  29623. get: function(key) {
  29624. if (this.isExpired(key)) {
  29625. this.remove(key);
  29626. }
  29627. return decode(ls.getItem(this._prefix(key)));
  29628. },
  29629. set: function(key, val, ttl) {
  29630. if (_.isNumber(ttl)) {
  29631. ls.setItem(this._ttlKey(key), encode(now() + ttl));
  29632. } else {
  29633. ls.removeItem(this._ttlKey(key));
  29634. }
  29635. return ls.setItem(this._prefix(key), encode(val));
  29636. },
  29637. remove: function(key) {
  29638. ls.removeItem(this._ttlKey(key));
  29639. ls.removeItem(this._prefix(key));
  29640. return this;
  29641. },
  29642. clear: function() {
  29643. var i, key, keys = [], len = ls.length;
  29644. for (i = 0; i < len; i++) {
  29645. if ((key = ls.key(i)).match(this.keyMatcher)) {
  29646. keys.push(key.replace(this.keyMatcher, ""));
  29647. }
  29648. }
  29649. for (i = keys.length; i--; ) {
  29650. this.remove(keys[i]);
  29651. }
  29652. return this;
  29653. },
  29654. isExpired: function(key) {
  29655. var ttl = decode(ls.getItem(this._ttlKey(key)));
  29656. return _.isNumber(ttl) && now() > ttl ? true : false;
  29657. }
  29658. };
  29659. } else {
  29660. methods = {
  29661. get: _.noop,
  29662. set: _.noop,
  29663. remove: _.noop,
  29664. clear: _.noop,
  29665. isExpired: _.noop
  29666. };
  29667. }
  29668. _.mixin(PersistentStorage.prototype, methods);
  29669. return PersistentStorage;
  29670. function now() {
  29671. return new Date().getTime();
  29672. }
  29673. function encode(val) {
  29674. return JSON.stringify(_.isUndefined(val) ? null : val);
  29675. }
  29676. function decode(val) {
  29677. return JSON.parse(val);
  29678. }
  29679. }();
  29680. var Transport = function() {
  29681. "use strict";
  29682. var pendingRequestsCount = 0, pendingRequests = {}, maxPendingRequests = 6, sharedCache = new LruCache(10);
  29683. function Transport(o) {
  29684. o = o || {};
  29685. this.cancelled = false;
  29686. this.lastUrl = null;
  29687. this._send = o.transport ? callbackToDeferred(o.transport) : $.ajax;
  29688. this._get = o.rateLimiter ? o.rateLimiter(this._get) : this._get;
  29689. this._cache = o.cache === false ? new LruCache(0) : sharedCache;
  29690. }
  29691. Transport.setMaxPendingRequests = function setMaxPendingRequests(num) {
  29692. maxPendingRequests = num;
  29693. };
  29694. Transport.resetCache = function resetCache() {
  29695. sharedCache.reset();
  29696. };
  29697. _.mixin(Transport.prototype, {
  29698. _get: function(url, o, cb) {
  29699. var that = this, jqXhr;
  29700. if (this.cancelled || url !== this.lastUrl) {
  29701. return;
  29702. }
  29703. if (jqXhr = pendingRequests[url]) {
  29704. jqXhr.done(done).fail(fail);
  29705. } else if (pendingRequestsCount < maxPendingRequests) {
  29706. pendingRequestsCount++;
  29707. pendingRequests[url] = this._send(url, o).done(done).fail(fail).always(always);
  29708. } else {
  29709. this.onDeckRequestArgs = [].slice.call(arguments, 0);
  29710. }
  29711. function done(resp) {
  29712. cb && cb(null, resp);
  29713. that._cache.set(url, resp);
  29714. }
  29715. function fail() {
  29716. cb && cb(true);
  29717. }
  29718. function always() {
  29719. pendingRequestsCount--;
  29720. delete pendingRequests[url];
  29721. if (that.onDeckRequestArgs) {
  29722. that._get.apply(that, that.onDeckRequestArgs);
  29723. that.onDeckRequestArgs = null;
  29724. }
  29725. }
  29726. },
  29727. get: function(url, o, cb) {
  29728. var resp;
  29729. if (_.isFunction(o)) {
  29730. cb = o;
  29731. o = {};
  29732. }
  29733. this.cancelled = false;
  29734. this.lastUrl = url;
  29735. if (resp = this._cache.get(url)) {
  29736. _.defer(function() {
  29737. cb && cb(null, resp);
  29738. });
  29739. } else {
  29740. this._get(url, o, cb);
  29741. }
  29742. return !!resp;
  29743. },
  29744. cancel: function() {
  29745. this.cancelled = true;
  29746. }
  29747. });
  29748. return Transport;
  29749. function callbackToDeferred(fn) {
  29750. return function customSendWrapper(url, o) {
  29751. var deferred = $.Deferred();
  29752. fn(url, o, onSuccess, onError);
  29753. return deferred;
  29754. function onSuccess(resp) {
  29755. _.defer(function() {
  29756. deferred.resolve(resp);
  29757. });
  29758. }
  29759. function onError(err) {
  29760. _.defer(function() {
  29761. deferred.reject(err);
  29762. });
  29763. }
  29764. };
  29765. }
  29766. }();
  29767. var SearchIndex = function() {
  29768. "use strict";
  29769. function SearchIndex(o) {
  29770. o = o || {};
  29771. if (!o.datumTokenizer || !o.queryTokenizer) {
  29772. $.error("datumTokenizer and queryTokenizer are both required");
  29773. }
  29774. this.datumTokenizer = o.datumTokenizer;
  29775. this.queryTokenizer = o.queryTokenizer;
  29776. this.reset();
  29777. }
  29778. _.mixin(SearchIndex.prototype, {
  29779. bootstrap: function bootstrap(o) {
  29780. this.datums = o.datums;
  29781. this.trie = o.trie;
  29782. },
  29783. add: function(data) {
  29784. var that = this;
  29785. data = _.isArray(data) ? data : [ data ];
  29786. _.each(data, function(datum) {
  29787. var id, tokens;
  29788. id = that.datums.push(datum) - 1;
  29789. tokens = normalizeTokens(that.datumTokenizer(datum));
  29790. _.each(tokens, function(token) {
  29791. var node, chars, ch;
  29792. node = that.trie;
  29793. chars = token.split("");
  29794. while (ch = chars.shift()) {
  29795. node = node.children[ch] || (node.children[ch] = newNode());
  29796. node.ids.push(id);
  29797. }
  29798. });
  29799. });
  29800. },
  29801. get: function get(query) {
  29802. var that = this, tokens, matches;
  29803. tokens = normalizeTokens(this.queryTokenizer(query));
  29804. _.each(tokens, function(token) {
  29805. var node, chars, ch, ids;
  29806. if (matches && matches.length === 0) {
  29807. return false;
  29808. }
  29809. node = that.trie;
  29810. chars = token.split("");
  29811. while (node && (ch = chars.shift())) {
  29812. node = node.children[ch];
  29813. }
  29814. if (node && chars.length === 0) {
  29815. ids = node.ids.slice(0);
  29816. matches = matches ? getIntersection(matches, ids) : ids;
  29817. } else {
  29818. matches = [];
  29819. return false;
  29820. }
  29821. });
  29822. return matches ? _.map(unique(matches), function(id) {
  29823. return that.datums[id];
  29824. }) : [];
  29825. },
  29826. reset: function reset() {
  29827. this.datums = [];
  29828. this.trie = newNode();
  29829. },
  29830. serialize: function serialize() {
  29831. return {
  29832. datums: this.datums,
  29833. trie: this.trie
  29834. };
  29835. }
  29836. });
  29837. return SearchIndex;
  29838. function normalizeTokens(tokens) {
  29839. tokens = _.filter(tokens, function(token) {
  29840. return !!token;
  29841. });
  29842. tokens = _.map(tokens, function(token) {
  29843. return token.toLowerCase();
  29844. });
  29845. return tokens;
  29846. }
  29847. function newNode() {
  29848. return {
  29849. ids: [],
  29850. children: {}
  29851. };
  29852. }
  29853. function unique(array) {
  29854. var seen = {}, uniques = [];
  29855. for (var i = 0, len = array.length; i < len; i++) {
  29856. if (!seen[array[i]]) {
  29857. seen[array[i]] = true;
  29858. uniques.push(array[i]);
  29859. }
  29860. }
  29861. return uniques;
  29862. }
  29863. function getIntersection(arrayA, arrayB) {
  29864. var ai = 0, bi = 0, intersection = [];
  29865. arrayA = arrayA.sort(compare);
  29866. arrayB = arrayB.sort(compare);
  29867. var lenArrayA = arrayA.length, lenArrayB = arrayB.length;
  29868. while (ai < lenArrayA && bi < lenArrayB) {
  29869. if (arrayA[ai] < arrayB[bi]) {
  29870. ai++;
  29871. } else if (arrayA[ai] > arrayB[bi]) {
  29872. bi++;
  29873. } else {
  29874. intersection.push(arrayA[ai]);
  29875. ai++;
  29876. bi++;
  29877. }
  29878. }
  29879. return intersection;
  29880. function compare(a, b) {
  29881. return a - b;
  29882. }
  29883. }
  29884. }();
  29885. var oParser = function() {
  29886. "use strict";
  29887. return {
  29888. local: getLocal,
  29889. prefetch: getPrefetch,
  29890. remote: getRemote
  29891. };
  29892. function getLocal(o) {
  29893. return o.local || null;
  29894. }
  29895. function getPrefetch(o) {
  29896. var prefetch, defaults;
  29897. defaults = {
  29898. url: null,
  29899. thumbprint: "",
  29900. ttl: 24 * 60 * 60 * 1e3,
  29901. filter: null,
  29902. ajax: {}
  29903. };
  29904. if (prefetch = o.prefetch || null) {
  29905. prefetch = _.isString(prefetch) ? {
  29906. url: prefetch
  29907. } : prefetch;
  29908. prefetch = _.mixin(defaults, prefetch);
  29909. prefetch.thumbprint = VERSION + prefetch.thumbprint;
  29910. prefetch.ajax.type = prefetch.ajax.type || "GET";
  29911. prefetch.ajax.dataType = prefetch.ajax.dataType || "json";
  29912. !prefetch.url && $.error("prefetch requires url to be set");
  29913. }
  29914. return prefetch;
  29915. }
  29916. function getRemote(o) {
  29917. var remote, defaults;
  29918. defaults = {
  29919. url: null,
  29920. cache: true,
  29921. wildcard: "%QUERY",
  29922. replace: null,
  29923. rateLimitBy: "debounce",
  29924. rateLimitWait: 300,
  29925. send: null,
  29926. filter: null,
  29927. ajax: {}
  29928. };
  29929. if (remote = o.remote || null) {
  29930. remote = _.isString(remote) ? {
  29931. url: remote
  29932. } : remote;
  29933. remote = _.mixin(defaults, remote);
  29934. remote.rateLimiter = /^throttle$/i.test(remote.rateLimitBy) ? byThrottle(remote.rateLimitWait) : byDebounce(remote.rateLimitWait);
  29935. remote.ajax.type = remote.ajax.type || "GET";
  29936. remote.ajax.dataType = remote.ajax.dataType || "json";
  29937. delete remote.rateLimitBy;
  29938. delete remote.rateLimitWait;
  29939. !remote.url && $.error("remote requires url to be set");
  29940. }
  29941. return remote;
  29942. function byDebounce(wait) {
  29943. return function(fn) {
  29944. return _.debounce(fn, wait);
  29945. };
  29946. }
  29947. function byThrottle(wait) {
  29948. return function(fn) {
  29949. return _.throttle(fn, wait);
  29950. };
  29951. }
  29952. }
  29953. }();
  29954. (function(root) {
  29955. "use strict";
  29956. var old, keys;
  29957. old = root.Bloodhound;
  29958. keys = {
  29959. data: "data",
  29960. protocol: "protocol",
  29961. thumbprint: "thumbprint"
  29962. };
  29963. root.Bloodhound = Bloodhound;
  29964. function Bloodhound(o) {
  29965. if (!o || !o.local && !o.prefetch && !o.remote) {
  29966. $.error("one of local, prefetch, or remote is required");
  29967. }
  29968. this.limit = o.limit || 5;
  29969. this.sorter = getSorter(o.sorter);
  29970. this.dupDetector = o.dupDetector || ignoreDuplicates;
  29971. this.local = oParser.local(o);
  29972. this.prefetch = oParser.prefetch(o);
  29973. this.remote = oParser.remote(o);
  29974. this.cacheKey = this.prefetch ? this.prefetch.cacheKey || this.prefetch.url : null;
  29975. this.index = new SearchIndex({
  29976. datumTokenizer: o.datumTokenizer,
  29977. queryTokenizer: o.queryTokenizer
  29978. });
  29979. this.storage = this.cacheKey ? new PersistentStorage(this.cacheKey) : null;
  29980. }
  29981. Bloodhound.noConflict = function noConflict() {
  29982. root.Bloodhound = old;
  29983. return Bloodhound;
  29984. };
  29985. Bloodhound.tokenizers = tokenizers;
  29986. _.mixin(Bloodhound.prototype, {
  29987. _loadPrefetch: function loadPrefetch(o) {
  29988. var that = this, serialized, deferred;
  29989. if (serialized = this._readFromStorage(o.thumbprint)) {
  29990. this.index.bootstrap(serialized);
  29991. deferred = $.Deferred().resolve();
  29992. } else {
  29993. deferred = $.ajax(o.url, o.ajax).done(handlePrefetchResponse);
  29994. }
  29995. return deferred;
  29996. function handlePrefetchResponse(resp) {
  29997. that.clear();
  29998. that.add(o.filter ? o.filter(resp) : resp);
  29999. that._saveToStorage(that.index.serialize(), o.thumbprint, o.ttl);
  30000. }
  30001. },
  30002. _getFromRemote: function getFromRemote(query, cb) {
  30003. var that = this, url, uriEncodedQuery;
  30004. if (!this.transport) {
  30005. return;
  30006. }
  30007. query = query || "";
  30008. uriEncodedQuery = encodeURIComponent(query);
  30009. url = this.remote.replace ? this.remote.replace(this.remote.url, query) : this.remote.url.replace(this.remote.wildcard, uriEncodedQuery);
  30010. return this.transport.get(url, this.remote.ajax, handleRemoteResponse);
  30011. function handleRemoteResponse(err, resp) {
  30012. err ? cb([]) : cb(that.remote.filter ? that.remote.filter(resp) : resp);
  30013. }
  30014. },
  30015. _cancelLastRemoteRequest: function cancelLastRemoteRequest() {
  30016. this.transport && this.transport.cancel();
  30017. },
  30018. _saveToStorage: function saveToStorage(data, thumbprint, ttl) {
  30019. if (this.storage) {
  30020. this.storage.set(keys.data, data, ttl);
  30021. this.storage.set(keys.protocol, location.protocol, ttl);
  30022. this.storage.set(keys.thumbprint, thumbprint, ttl);
  30023. }
  30024. },
  30025. _readFromStorage: function readFromStorage(thumbprint) {
  30026. var stored = {}, isExpired;
  30027. if (this.storage) {
  30028. stored.data = this.storage.get(keys.data);
  30029. stored.protocol = this.storage.get(keys.protocol);
  30030. stored.thumbprint = this.storage.get(keys.thumbprint);
  30031. }
  30032. isExpired = stored.thumbprint !== thumbprint || stored.protocol !== location.protocol;
  30033. return stored.data && !isExpired ? stored.data : null;
  30034. },
  30035. _initialize: function initialize() {
  30036. var that = this, local = this.local, deferred;
  30037. deferred = this.prefetch ? this._loadPrefetch(this.prefetch) : $.Deferred().resolve();
  30038. local && deferred.done(addLocalToIndex);
  30039. this.transport = this.remote ? new Transport(this.remote) : null;
  30040. return this.initPromise = deferred.promise();
  30041. function addLocalToIndex() {
  30042. that.add(_.isFunction(local) ? local() : local);
  30043. }
  30044. },
  30045. initialize: function initialize(force) {
  30046. return !this.initPromise || force ? this._initialize() : this.initPromise;
  30047. },
  30048. add: function add(data) {
  30049. this.index.add(data);
  30050. },
  30051. get: function get(query, cb) {
  30052. var that = this, matches = [], cacheHit = false;
  30053. matches = this.index.get(query);
  30054. matches = this.sorter(matches).slice(0, this.limit);
  30055. matches.length < this.limit ? cacheHit = this._getFromRemote(query, returnRemoteMatches) : this._cancelLastRemoteRequest();
  30056. if (!cacheHit) {
  30057. (matches.length > 0 || !this.transport) && cb && cb(matches);
  30058. }
  30059. function returnRemoteMatches(remoteMatches) {
  30060. var matchesWithBackfill = matches.slice(0);
  30061. _.each(remoteMatches, function(remoteMatch) {
  30062. var isDuplicate;
  30063. isDuplicate = _.some(matchesWithBackfill, function(match) {
  30064. return that.dupDetector(remoteMatch, match);
  30065. });
  30066. !isDuplicate && matchesWithBackfill.push(remoteMatch);
  30067. return matchesWithBackfill.length < that.limit;
  30068. });
  30069. cb && cb(that.sorter(matchesWithBackfill));
  30070. }
  30071. },
  30072. clear: function clear() {
  30073. this.index.reset();
  30074. },
  30075. clearPrefetchCache: function clearPrefetchCache() {
  30076. this.storage && this.storage.clear();
  30077. },
  30078. clearRemoteCache: function clearRemoteCache() {
  30079. this.transport && Transport.resetCache();
  30080. },
  30081. ttAdapter: function ttAdapter() {
  30082. return _.bind(this.get, this);
  30083. }
  30084. });
  30085. return Bloodhound;
  30086. function getSorter(sortFn) {
  30087. return _.isFunction(sortFn) ? sort : noSort;
  30088. function sort(array) {
  30089. return array.sort(sortFn);
  30090. }
  30091. function noSort(array) {
  30092. return array;
  30093. }
  30094. }
  30095. function ignoreDuplicates() {
  30096. return false;
  30097. }
  30098. })(this);
  30099. var html = function() {
  30100. return {
  30101. wrapper: '<span class="twitter-typeahead"></span>',
  30102. dropdown: '<span class="tt-dropdown-menu"></span>',
  30103. dataset: '<div class="tt-dataset-%CLASS%"></div>',
  30104. suggestions: '<span class="tt-suggestions"></span>',
  30105. suggestion: '<div class="tt-suggestion"></div>'
  30106. };
  30107. }();
  30108. var css = function() {
  30109. "use strict";
  30110. var css = {
  30111. wrapper: {
  30112. position: "relative",
  30113. display: "inline-block"
  30114. },
  30115. hint: {
  30116. position: "absolute",
  30117. top: "0",
  30118. left: "0",
  30119. borderColor: "transparent",
  30120. boxShadow: "none",
  30121. opacity: "1"
  30122. },
  30123. input: {
  30124. position: "relative",
  30125. verticalAlign: "top",
  30126. backgroundColor: "transparent"
  30127. },
  30128. inputWithNoHint: {
  30129. position: "relative",
  30130. verticalAlign: "top"
  30131. },
  30132. dropdown: {
  30133. position: "absolute",
  30134. top: "100%",
  30135. left: "0",
  30136. zIndex: "100",
  30137. display: "none"
  30138. },
  30139. suggestions: {
  30140. display: "block"
  30141. },
  30142. suggestion: {
  30143. whiteSpace: "nowrap",
  30144. cursor: "pointer"
  30145. },
  30146. suggestionChild: {
  30147. whiteSpace: "normal"
  30148. },
  30149. ltr: {
  30150. left: "0",
  30151. right: "auto"
  30152. },
  30153. rtl: {
  30154. left: "auto",
  30155. right: " 0"
  30156. }
  30157. };
  30158. if (_.isMsie()) {
  30159. _.mixin(css.input, {
  30160. backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"
  30161. });
  30162. }
  30163. if (_.isMsie() && _.isMsie() <= 7) {
  30164. _.mixin(css.input, {
  30165. marginTop: "-1px"
  30166. });
  30167. }
  30168. return css;
  30169. }();
  30170. var EventBus = function() {
  30171. "use strict";
  30172. var namespace = "typeahead:";
  30173. function EventBus(o) {
  30174. if (!o || !o.el) {
  30175. $.error("EventBus initialized without el");
  30176. }
  30177. this.$el = $(o.el);
  30178. }
  30179. _.mixin(EventBus.prototype, {
  30180. trigger: function(type) {
  30181. var args = [].slice.call(arguments, 1);
  30182. this.$el.trigger(namespace + type, args);
  30183. }
  30184. });
  30185. return EventBus;
  30186. }();
  30187. var EventEmitter = function() {
  30188. "use strict";
  30189. var splitter = /\s+/, nextTick = getNextTick();
  30190. return {
  30191. onSync: onSync,
  30192. onAsync: onAsync,
  30193. off: off,
  30194. trigger: trigger
  30195. };
  30196. function on(method, types, cb, context) {
  30197. var type;
  30198. if (!cb) {
  30199. return this;
  30200. }
  30201. types = types.split(splitter);
  30202. cb = context ? bindContext(cb, context) : cb;
  30203. this._callbacks = this._callbacks || {};
  30204. while (type = types.shift()) {
  30205. this._callbacks[type] = this._callbacks[type] || {
  30206. sync: [],
  30207. async: []
  30208. };
  30209. this._callbacks[type][method].push(cb);
  30210. }
  30211. return this;
  30212. }
  30213. function onAsync(types, cb, context) {
  30214. return on.call(this, "async", types, cb, context);
  30215. }
  30216. function onSync(types, cb, context) {
  30217. return on.call(this, "sync", types, cb, context);
  30218. }
  30219. function off(types) {
  30220. var type;
  30221. if (!this._callbacks) {
  30222. return this;
  30223. }
  30224. types = types.split(splitter);
  30225. while (type = types.shift()) {
  30226. delete this._callbacks[type];
  30227. }
  30228. return this;
  30229. }
  30230. function trigger(types) {
  30231. var type, callbacks, args, syncFlush, asyncFlush;
  30232. if (!this._callbacks) {
  30233. return this;
  30234. }
  30235. types = types.split(splitter);
  30236. args = [].slice.call(arguments, 1);
  30237. while ((type = types.shift()) && (callbacks = this._callbacks[type])) {
  30238. syncFlush = getFlush(callbacks.sync, this, [ type ].concat(args));
  30239. asyncFlush = getFlush(callbacks.async, this, [ type ].concat(args));
  30240. syncFlush() && nextTick(asyncFlush);
  30241. }
  30242. return this;
  30243. }
  30244. function getFlush(callbacks, context, args) {
  30245. return flush;
  30246. function flush() {
  30247. var cancelled;
  30248. for (var i = 0, len = callbacks.length; !cancelled && i < len; i += 1) {
  30249. cancelled = callbacks[i].apply(context, args) === false;
  30250. }
  30251. return !cancelled;
  30252. }
  30253. }
  30254. function getNextTick() {
  30255. var nextTickFn;
  30256. if (window.setImmediate) {
  30257. nextTickFn = function nextTickSetImmediate(fn) {
  30258. setImmediate(function() {
  30259. fn();
  30260. });
  30261. };
  30262. } else {
  30263. nextTickFn = function nextTickSetTimeout(fn) {
  30264. setTimeout(function() {
  30265. fn();
  30266. }, 0);
  30267. };
  30268. }
  30269. return nextTickFn;
  30270. }
  30271. function bindContext(fn, context) {
  30272. return fn.bind ? fn.bind(context) : function() {
  30273. fn.apply(context, [].slice.call(arguments, 0));
  30274. };
  30275. }
  30276. }();
  30277. var highlight = function(doc) {
  30278. "use strict";
  30279. var defaults = {
  30280. node: null,
  30281. pattern: null,
  30282. tagName: "strong",
  30283. className: null,
  30284. wordsOnly: false,
  30285. caseSensitive: false
  30286. };
  30287. return function hightlight(o) {
  30288. var regex;
  30289. o = _.mixin({}, defaults, o);
  30290. if (!o.node || !o.pattern) {
  30291. return;
  30292. }
  30293. o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ];
  30294. regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
  30295. traverse(o.node, hightlightTextNode);
  30296. function hightlightTextNode(textNode) {
  30297. var match, patternNode, wrapperNode;
  30298. if (match = regex.exec(textNode.data)) {
  30299. wrapperNode = doc.createElement(o.tagName);
  30300. o.className && (wrapperNode.className = o.className);
  30301. patternNode = textNode.splitText(match.index);
  30302. patternNode.splitText(match[0].length);
  30303. wrapperNode.appendChild(patternNode.cloneNode(true));
  30304. textNode.parentNode.replaceChild(wrapperNode, patternNode);
  30305. }
  30306. return !!match;
  30307. }
  30308. function traverse(el, hightlightTextNode) {
  30309. var childNode, TEXT_NODE_TYPE = 3;
  30310. for (var i = 0; i < el.childNodes.length; i++) {
  30311. childNode = el.childNodes[i];
  30312. if (childNode.nodeType === TEXT_NODE_TYPE) {
  30313. i += hightlightTextNode(childNode) ? 1 : 0;
  30314. } else {
  30315. traverse(childNode, hightlightTextNode);
  30316. }
  30317. }
  30318. }
  30319. };
  30320. function getRegex(patterns, caseSensitive, wordsOnly) {
  30321. var escapedPatterns = [], regexStr;
  30322. for (var i = 0, len = patterns.length; i < len; i++) {
  30323. escapedPatterns.push(_.escapeRegExChars(patterns[i]));
  30324. }
  30325. regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")";
  30326. return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i");
  30327. }
  30328. }(window.document);
  30329. var Input = function() {
  30330. "use strict";
  30331. var specialKeyCodeMap;
  30332. specialKeyCodeMap = {
  30333. 9: "tab",
  30334. 27: "esc",
  30335. 37: "left",
  30336. 39: "right",
  30337. 13: "enter",
  30338. 38: "up",
  30339. 40: "down"
  30340. };
  30341. function Input(o) {
  30342. var that = this, onBlur, onFocus, onKeydown, onInput;
  30343. o = o || {};
  30344. if (!o.input) {
  30345. $.error("input is missing");
  30346. }
  30347. onBlur = _.bind(this._onBlur, this);
  30348. onFocus = _.bind(this._onFocus, this);
  30349. onKeydown = _.bind(this._onKeydown, this);
  30350. onInput = _.bind(this._onInput, this);
  30351. this.$hint = $(o.hint);
  30352. this.$input = $(o.input).on("blur.tt", onBlur).on("focus.tt", onFocus).on("keydown.tt", onKeydown);
  30353. if (this.$hint.length === 0) {
  30354. this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop;
  30355. }
  30356. if (!_.isMsie()) {
  30357. this.$input.on("input.tt", onInput);
  30358. } else {
  30359. this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function($e) {
  30360. if (specialKeyCodeMap[$e.which || $e.keyCode]) {
  30361. return;
  30362. }
  30363. _.defer(_.bind(that._onInput, that, $e));
  30364. });
  30365. }
  30366. this.query = this.$input.val();
  30367. this.$overflowHelper = buildOverflowHelper(this.$input);
  30368. }
  30369. Input.normalizeQuery = function(str) {
  30370. return (str || "").replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
  30371. };
  30372. _.mixin(Input.prototype, EventEmitter, {
  30373. _onBlur: function onBlur() {
  30374. this.resetInputValue();
  30375. this.trigger("blurred");
  30376. },
  30377. _onFocus: function onFocus() {
  30378. this.trigger("focused");
  30379. },
  30380. _onKeydown: function onKeydown($e) {
  30381. var keyName = specialKeyCodeMap[$e.which || $e.keyCode];
  30382. this._managePreventDefault(keyName, $e);
  30383. if (keyName && this._shouldTrigger(keyName, $e)) {
  30384. this.trigger(keyName + "Keyed", $e);
  30385. }
  30386. },
  30387. _onInput: function onInput() {
  30388. this._checkInputValue();
  30389. },
  30390. _managePreventDefault: function managePreventDefault(keyName, $e) {
  30391. var preventDefault, hintValue, inputValue;
  30392. switch (keyName) {
  30393. case "tab":
  30394. hintValue = this.getHint();
  30395. inputValue = this.getInputValue();
  30396. preventDefault = hintValue && hintValue !== inputValue && !withModifier($e);
  30397. break;
  30398. case "up":
  30399. case "down":
  30400. preventDefault = !withModifier($e);
  30401. break;
  30402. default:
  30403. preventDefault = false;
  30404. }
  30405. preventDefault && $e.preventDefault();
  30406. },
  30407. _shouldTrigger: function shouldTrigger(keyName, $e) {
  30408. var trigger;
  30409. switch (keyName) {
  30410. case "tab":
  30411. trigger = !withModifier($e);
  30412. break;
  30413. default:
  30414. trigger = true;
  30415. }
  30416. return trigger;
  30417. },
  30418. _checkInputValue: function checkInputValue() {
  30419. var inputValue, areEquivalent, hasDifferentWhitespace;
  30420. inputValue = this.getInputValue();
  30421. areEquivalent = areQueriesEquivalent(inputValue, this.query);
  30422. hasDifferentWhitespace = areEquivalent ? this.query.length !== inputValue.length : false;
  30423. this.query = inputValue;
  30424. if (!areEquivalent) {
  30425. this.trigger("queryChanged", this.query);
  30426. } else if (hasDifferentWhitespace) {
  30427. this.trigger("whitespaceChanged", this.query);
  30428. }
  30429. },
  30430. focus: function focus() {
  30431. this.$input.focus();
  30432. },
  30433. blur: function blur() {
  30434. this.$input.blur();
  30435. },
  30436. getQuery: function getQuery() {
  30437. return this.query;
  30438. },
  30439. setQuery: function setQuery(query) {
  30440. this.query = query;
  30441. },
  30442. getInputValue: function getInputValue() {
  30443. return this.$input.val();
  30444. },
  30445. setInputValue: function setInputValue(value, silent) {
  30446. this.$input.val(value);
  30447. silent ? this.clearHint() : this._checkInputValue();
  30448. },
  30449. resetInputValue: function resetInputValue() {
  30450. this.setInputValue(this.query, true);
  30451. },
  30452. getHint: function getHint() {
  30453. return this.$hint.val();
  30454. },
  30455. setHint: function setHint(value) {
  30456. this.$hint.val(value);
  30457. },
  30458. clearHint: function clearHint() {
  30459. this.setHint("");
  30460. },
  30461. clearHintIfInvalid: function clearHintIfInvalid() {
  30462. var val, hint, valIsPrefixOfHint, isValid;
  30463. val = this.getInputValue();
  30464. hint = this.getHint();
  30465. valIsPrefixOfHint = val !== hint && hint.indexOf(val) === 0;
  30466. isValid = val !== "" && valIsPrefixOfHint && !this.hasOverflow();
  30467. !isValid && this.clearHint();
  30468. },
  30469. getLanguageDirection: function getLanguageDirection() {
  30470. return (this.$input.css("direction") || "ltr").toLowerCase();
  30471. },
  30472. hasOverflow: function hasOverflow() {
  30473. var constraint = this.$input.width() - 2;
  30474. this.$overflowHelper.text(this.getInputValue());
  30475. return this.$overflowHelper.width() >= constraint;
  30476. },
  30477. isCursorAtEnd: function() {
  30478. var valueLength, selectionStart, range;
  30479. valueLength = this.$input.val().length;
  30480. selectionStart = this.$input[0].selectionStart;
  30481. if (_.isNumber(selectionStart)) {
  30482. return selectionStart === valueLength;
  30483. } else if (document.selection) {
  30484. range = document.selection.createRange();
  30485. range.moveStart("character", -valueLength);
  30486. return valueLength === range.text.length;
  30487. }
  30488. return true;
  30489. },
  30490. destroy: function destroy() {
  30491. this.$hint.off(".tt");
  30492. this.$input.off(".tt");
  30493. this.$hint = this.$input = this.$overflowHelper = null;
  30494. }
  30495. });
  30496. return Input;
  30497. function buildOverflowHelper($input) {
  30498. return $('<pre aria-hidden="true"></pre>').css({
  30499. position: "absolute",
  30500. visibility: "hidden",
  30501. whiteSpace: "pre",
  30502. fontFamily: $input.css("font-family"),
  30503. fontSize: $input.css("font-size"),
  30504. fontStyle: $input.css("font-style"),
  30505. fontVariant: $input.css("font-variant"),
  30506. fontWeight: $input.css("font-weight"),
  30507. wordSpacing: $input.css("word-spacing"),
  30508. letterSpacing: $input.css("letter-spacing"),
  30509. textIndent: $input.css("text-indent"),
  30510. textRendering: $input.css("text-rendering"),
  30511. textTransform: $input.css("text-transform")
  30512. }).insertAfter($input);
  30513. }
  30514. function areQueriesEquivalent(a, b) {
  30515. return Input.normalizeQuery(a) === Input.normalizeQuery(b);
  30516. }
  30517. function withModifier($e) {
  30518. return $e.altKey || $e.ctrlKey || $e.metaKey || $e.shiftKey;
  30519. }
  30520. }();
  30521. var Dataset = function() {
  30522. "use strict";
  30523. var datasetKey = "ttDataset", valueKey = "ttValue", datumKey = "ttDatum";
  30524. function Dataset(o) {
  30525. o = o || {};
  30526. o.templates = o.templates || {};
  30527. if (!o.source) {
  30528. $.error("missing source");
  30529. }
  30530. if (o.name && !isValidName(o.name)) {
  30531. $.error("invalid dataset name: " + o.name);
  30532. }
  30533. this.query = null;
  30534. this.highlight = !!o.highlight;
  30535. this.name = o.name || _.getUniqueId();
  30536. this.source = o.source;
  30537. this.displayFn = getDisplayFn(o.display || o.displayKey);
  30538. this.templates = getTemplates(o.templates, this.displayFn);
  30539. this.$el = $(html.dataset.replace("%CLASS%", this.name));
  30540. }
  30541. Dataset.extractDatasetName = function extractDatasetName(el) {
  30542. return $(el).data(datasetKey);
  30543. };
  30544. Dataset.extractValue = function extractDatum(el) {
  30545. return $(el).data(valueKey);
  30546. };
  30547. Dataset.extractDatum = function extractDatum(el) {
  30548. return $(el).data(datumKey);
  30549. };
  30550. _.mixin(Dataset.prototype, EventEmitter, {
  30551. _render: function render(query, suggestions) {
  30552. if (!this.$el) {
  30553. return;
  30554. }
  30555. var that = this, hasSuggestions;
  30556. this.$el.empty();
  30557. hasSuggestions = suggestions && suggestions.length;
  30558. if (!hasSuggestions && this.templates.empty) {
  30559. this.$el.html(getEmptyHtml()).prepend(that.templates.header ? getHeaderHtml() : null).append(that.templates.footer ? getFooterHtml() : null);
  30560. } else if (hasSuggestions) {
  30561. this.$el.html(getSuggestionsHtml()).prepend(that.templates.header ? getHeaderHtml() : null).append(that.templates.footer ? getFooterHtml() : null);
  30562. }
  30563. this.trigger("rendered");
  30564. function getEmptyHtml() {
  30565. return that.templates.empty({
  30566. query: query,
  30567. isEmpty: true
  30568. });
  30569. }
  30570. function getSuggestionsHtml() {
  30571. var $suggestions, nodes;
  30572. $suggestions = $(html.suggestions).css(css.suggestions);
  30573. nodes = _.map(suggestions, getSuggestionNode);
  30574. $suggestions.append.apply($suggestions, nodes);
  30575. that.highlight && highlight({
  30576. className: "tt-highlight",
  30577. node: $suggestions[0],
  30578. pattern: query
  30579. });
  30580. return $suggestions;
  30581. function getSuggestionNode(suggestion) {
  30582. var $el;
  30583. $el = $(html.suggestion).append(that.templates.suggestion(suggestion)).data(datasetKey, that.name).data(valueKey, that.displayFn(suggestion)).data(datumKey, suggestion);
  30584. $el.children().each(function() {
  30585. $(this).css(css.suggestionChild);
  30586. });
  30587. return $el;
  30588. }
  30589. }
  30590. function getHeaderHtml() {
  30591. return that.templates.header({
  30592. query: query,
  30593. isEmpty: !hasSuggestions
  30594. });
  30595. }
  30596. function getFooterHtml() {
  30597. return that.templates.footer({
  30598. query: query,
  30599. isEmpty: !hasSuggestions
  30600. });
  30601. }
  30602. },
  30603. getRoot: function getRoot() {
  30604. return this.$el;
  30605. },
  30606. update: function update(query) {
  30607. var that = this;
  30608. this.query = query;
  30609. this.canceled = false;
  30610. this.source(query, render);
  30611. function render(suggestions) {
  30612. if (!that.canceled && query === that.query) {
  30613. that._render(query, suggestions);
  30614. }
  30615. }
  30616. },
  30617. cancel: function cancel() {
  30618. this.canceled = true;
  30619. },
  30620. clear: function clear() {
  30621. this.cancel();
  30622. this.$el.empty();
  30623. this.trigger("rendered");
  30624. },
  30625. isEmpty: function isEmpty() {
  30626. return this.$el.is(":empty");
  30627. },
  30628. destroy: function destroy() {
  30629. this.$el = null;
  30630. }
  30631. });
  30632. return Dataset;
  30633. function getDisplayFn(display) {
  30634. display = display || "value";
  30635. return _.isFunction(display) ? display : displayFn;
  30636. function displayFn(obj) {
  30637. return obj[display];
  30638. }
  30639. }
  30640. function getTemplates(templates, displayFn) {
  30641. return {
  30642. empty: templates.empty && _.templatify(templates.empty),
  30643. header: templates.header && _.templatify(templates.header),
  30644. footer: templates.footer && _.templatify(templates.footer),
  30645. suggestion: templates.suggestion || suggestionTemplate
  30646. };
  30647. function suggestionTemplate(context) {
  30648. return "<p>" + displayFn(context) + "</p>";
  30649. }
  30650. }
  30651. function isValidName(str) {
  30652. return /^[_a-zA-Z0-9-]+$/.test(str);
  30653. }
  30654. }();
  30655. var Dropdown = function() {
  30656. "use strict";
  30657. function Dropdown(o) {
  30658. var that = this, onSuggestionClick, onSuggestionMouseEnter, onSuggestionMouseLeave;
  30659. o = o || {};
  30660. if (!o.menu) {
  30661. $.error("menu is required");
  30662. }
  30663. this.isOpen = false;
  30664. this.isEmpty = true;
  30665. this.datasets = _.map(o.datasets, initializeDataset);
  30666. onSuggestionClick = _.bind(this._onSuggestionClick, this);
  30667. onSuggestionMouseEnter = _.bind(this._onSuggestionMouseEnter, this);
  30668. onSuggestionMouseLeave = _.bind(this._onSuggestionMouseLeave, this);
  30669. this.$menu = $(o.menu).on("click.tt", ".tt-suggestion", onSuggestionClick).on("mouseenter.tt", ".tt-suggestion", onSuggestionMouseEnter).on("mouseleave.tt", ".tt-suggestion", onSuggestionMouseLeave);
  30670. _.each(this.datasets, function(dataset) {
  30671. that.$menu.append(dataset.getRoot());
  30672. dataset.onSync("rendered", that._onRendered, that);
  30673. });
  30674. }
  30675. _.mixin(Dropdown.prototype, EventEmitter, {
  30676. _onSuggestionClick: function onSuggestionClick($e) {
  30677. this.trigger("suggestionClicked", $($e.currentTarget));
  30678. },
  30679. _onSuggestionMouseEnter: function onSuggestionMouseEnter($e) {
  30680. this._removeCursor();
  30681. this._setCursor($($e.currentTarget), true);
  30682. },
  30683. _onSuggestionMouseLeave: function onSuggestionMouseLeave() {
  30684. this._removeCursor();
  30685. },
  30686. _onRendered: function onRendered() {
  30687. this.isEmpty = _.every(this.datasets, isDatasetEmpty);
  30688. this.isEmpty ? this._hide() : this.isOpen && this._show();
  30689. this.trigger("datasetRendered");
  30690. function isDatasetEmpty(dataset) {
  30691. return dataset.isEmpty();
  30692. }
  30693. },
  30694. _hide: function() {
  30695. this.$menu.hide();
  30696. },
  30697. _show: function() {
  30698. this.$menu.css("display", "block");
  30699. },
  30700. _getSuggestions: function getSuggestions() {
  30701. return this.$menu.find(".tt-suggestion");
  30702. },
  30703. _getCursor: function getCursor() {
  30704. return this.$menu.find(".tt-cursor").first();
  30705. },
  30706. _setCursor: function setCursor($el, silent) {
  30707. $el.first().addClass("tt-cursor");
  30708. !silent && this.trigger("cursorMoved");
  30709. },
  30710. _removeCursor: function removeCursor() {
  30711. this._getCursor().removeClass("tt-cursor");
  30712. },
  30713. _moveCursor: function moveCursor(increment) {
  30714. var $suggestions, $oldCursor, newCursorIndex, $newCursor;
  30715. if (!this.isOpen) {
  30716. return;
  30717. }
  30718. $oldCursor = this._getCursor();
  30719. $suggestions = this._getSuggestions();
  30720. this._removeCursor();
  30721. newCursorIndex = $suggestions.index($oldCursor) + increment;
  30722. newCursorIndex = (newCursorIndex + 1) % ($suggestions.length + 1) - 1;
  30723. if (newCursorIndex === -1) {
  30724. this.trigger("cursorRemoved");
  30725. return;
  30726. } else if (newCursorIndex < -1) {
  30727. newCursorIndex = $suggestions.length - 1;
  30728. }
  30729. this._setCursor($newCursor = $suggestions.eq(newCursorIndex));
  30730. this._ensureVisible($newCursor);
  30731. },
  30732. _ensureVisible: function ensureVisible($el) {
  30733. var elTop, elBottom, menuScrollTop, menuHeight;
  30734. elTop = $el.position().top;
  30735. elBottom = elTop + $el.outerHeight(true);
  30736. menuScrollTop = this.$menu.scrollTop();
  30737. menuHeight = this.$menu.height() + parseInt(this.$menu.css("paddingTop"), 10) + parseInt(this.$menu.css("paddingBottom"), 10);
  30738. if (elTop < 0) {
  30739. this.$menu.scrollTop(menuScrollTop + elTop);
  30740. } else if (menuHeight < elBottom) {
  30741. this.$menu.scrollTop(menuScrollTop + (elBottom - menuHeight));
  30742. }
  30743. },
  30744. close: function close() {
  30745. if (this.isOpen) {
  30746. this.isOpen = false;
  30747. this._removeCursor();
  30748. this._hide();
  30749. this.trigger("closed");
  30750. }
  30751. },
  30752. open: function open() {
  30753. if (!this.isOpen) {
  30754. this.isOpen = true;
  30755. !this.isEmpty && this._show();
  30756. this.trigger("opened");
  30757. }
  30758. },
  30759. setLanguageDirection: function setLanguageDirection(dir) {
  30760. this.$menu.css(dir === "ltr" ? css.ltr : css.rtl);
  30761. },
  30762. moveCursorUp: function moveCursorUp() {
  30763. this._moveCursor(-1);
  30764. },
  30765. moveCursorDown: function moveCursorDown() {
  30766. this._moveCursor(+1);
  30767. },
  30768. getDatumForSuggestion: function getDatumForSuggestion($el) {
  30769. var datum = null;
  30770. if ($el.length) {
  30771. datum = {
  30772. raw: Dataset.extractDatum($el),
  30773. value: Dataset.extractValue($el),
  30774. datasetName: Dataset.extractDatasetName($el)
  30775. };
  30776. }
  30777. return datum;
  30778. },
  30779. getDatumForCursor: function getDatumForCursor() {
  30780. return this.getDatumForSuggestion(this._getCursor().first());
  30781. },
  30782. getDatumForTopSuggestion: function getDatumForTopSuggestion() {
  30783. return this.getDatumForSuggestion(this._getSuggestions().first());
  30784. },
  30785. update: function update(query) {
  30786. _.each(this.datasets, updateDataset);
  30787. function updateDataset(dataset) {
  30788. dataset.update(query);
  30789. }
  30790. },
  30791. empty: function empty() {
  30792. _.each(this.datasets, clearDataset);
  30793. this.isEmpty = true;
  30794. function clearDataset(dataset) {
  30795. dataset.clear();
  30796. }
  30797. },
  30798. isVisible: function isVisible() {
  30799. return this.isOpen && !this.isEmpty;
  30800. },
  30801. destroy: function destroy() {
  30802. this.$menu.off(".tt");
  30803. this.$menu = null;
  30804. _.each(this.datasets, destroyDataset);
  30805. function destroyDataset(dataset) {
  30806. dataset.destroy();
  30807. }
  30808. }
  30809. });
  30810. return Dropdown;
  30811. function initializeDataset(oDataset) {
  30812. return new Dataset(oDataset);
  30813. }
  30814. }();
  30815. var Typeahead = function() {
  30816. "use strict";
  30817. var attrsKey = "ttAttrs";
  30818. function Typeahead(o) {
  30819. var $menu, $input, $hint;
  30820. o = o || {};
  30821. if (!o.input) {
  30822. $.error("missing input");
  30823. }
  30824. this.isActivated = false;
  30825. this.autoselect = !!o.autoselect;
  30826. this.minLength = _.isNumber(o.minLength) ? o.minLength : 1;
  30827. this.$node = buildDom(o.input, o.withHint);
  30828. $menu = this.$node.find(".tt-dropdown-menu");
  30829. $input = this.$node.find(".tt-input");
  30830. $hint = this.$node.find(".tt-hint");
  30831. $input.on("blur.tt", function($e) {
  30832. var active, isActive, hasActive;
  30833. active = document.activeElement;
  30834. isActive = $menu.is(active);
  30835. hasActive = $menu.has(active).length > 0;
  30836. if (_.isMsie() && (isActive || hasActive)) {
  30837. $e.preventDefault();
  30838. $e.stopImmediatePropagation();
  30839. _.defer(function() {
  30840. $input.focus();
  30841. });
  30842. }
  30843. });
  30844. $menu.on("mousedown.tt", function($e) {
  30845. $e.preventDefault();
  30846. });
  30847. this.eventBus = o.eventBus || new EventBus({
  30848. el: $input
  30849. });
  30850. this.dropdown = new Dropdown({
  30851. menu: $menu,
  30852. datasets: o.datasets
  30853. }).onSync("suggestionClicked", this._onSuggestionClicked, this).onSync("cursorMoved", this._onCursorMoved, this).onSync("cursorRemoved", this._onCursorRemoved, this).onSync("opened", this._onOpened, this).onSync("closed", this._onClosed, this).onAsync("datasetRendered", this._onDatasetRendered, this);
  30854. this.input = new Input({
  30855. input: $input,
  30856. hint: $hint
  30857. }).onSync("focused", this._onFocused, this).onSync("blurred", this._onBlurred, this).onSync("enterKeyed", this._onEnterKeyed, this).onSync("tabKeyed", this._onTabKeyed, this).onSync("escKeyed", this._onEscKeyed, this).onSync("upKeyed", this._onUpKeyed, this).onSync("downKeyed", this._onDownKeyed, this).onSync("leftKeyed", this._onLeftKeyed, this).onSync("rightKeyed", this._onRightKeyed, this).onSync("queryChanged", this._onQueryChanged, this).onSync("whitespaceChanged", this._onWhitespaceChanged, this);
  30858. this._setLanguageDirection();
  30859. }
  30860. _.mixin(Typeahead.prototype, {
  30861. _onSuggestionClicked: function onSuggestionClicked(type, $el) {
  30862. var datum;
  30863. if (datum = this.dropdown.getDatumForSuggestion($el)) {
  30864. this._select(datum);
  30865. }
  30866. },
  30867. _onCursorMoved: function onCursorMoved() {
  30868. var datum = this.dropdown.getDatumForCursor();
  30869. this.input.setInputValue(datum.value, true);
  30870. this.eventBus.trigger("cursorchanged", datum.raw, datum.datasetName);
  30871. },
  30872. _onCursorRemoved: function onCursorRemoved() {
  30873. this.input.resetInputValue();
  30874. this._updateHint();
  30875. },
  30876. _onDatasetRendered: function onDatasetRendered() {
  30877. this._updateHint();
  30878. },
  30879. _onOpened: function onOpened() {
  30880. this._updateHint();
  30881. this.eventBus.trigger("opened");
  30882. },
  30883. _onClosed: function onClosed() {
  30884. this.input.clearHint();
  30885. this.eventBus.trigger("closed");
  30886. },
  30887. _onFocused: function onFocused() {
  30888. this.isActivated = true;
  30889. this.dropdown.open();
  30890. },
  30891. _onBlurred: function onBlurred() {
  30892. this.isActivated = false;
  30893. this.dropdown.empty();
  30894. this.dropdown.close();
  30895. },
  30896. _onEnterKeyed: function onEnterKeyed(type, $e) {
  30897. var cursorDatum, topSuggestionDatum;
  30898. cursorDatum = this.dropdown.getDatumForCursor();
  30899. topSuggestionDatum = this.dropdown.getDatumForTopSuggestion();
  30900. if (cursorDatum) {
  30901. this._select(cursorDatum);
  30902. $e.preventDefault();
  30903. } else if (this.autoselect && topSuggestionDatum) {
  30904. this._select(topSuggestionDatum);
  30905. $e.preventDefault();
  30906. }
  30907. },
  30908. _onTabKeyed: function onTabKeyed(type, $e) {
  30909. var datum;
  30910. if (datum = this.dropdown.getDatumForCursor()) {
  30911. this._select(datum);
  30912. $e.preventDefault();
  30913. } else {
  30914. this._autocomplete(true);
  30915. }
  30916. },
  30917. _onEscKeyed: function onEscKeyed() {
  30918. this.dropdown.close();
  30919. this.input.resetInputValue();
  30920. },
  30921. _onUpKeyed: function onUpKeyed() {
  30922. var query = this.input.getQuery();
  30923. this.dropdown.isEmpty && query.length >= this.minLength ? this.dropdown.update(query) : this.dropdown.moveCursorUp();
  30924. this.dropdown.open();
  30925. },
  30926. _onDownKeyed: function onDownKeyed() {
  30927. var query = this.input.getQuery();
  30928. this.dropdown.isEmpty && query.length >= this.minLength ? this.dropdown.update(query) : this.dropdown.moveCursorDown();
  30929. this.dropdown.open();
  30930. },
  30931. _onLeftKeyed: function onLeftKeyed() {
  30932. this.dir === "rtl" && this._autocomplete();
  30933. },
  30934. _onRightKeyed: function onRightKeyed() {
  30935. this.dir === "ltr" && this._autocomplete();
  30936. },
  30937. _onQueryChanged: function onQueryChanged(e, query) {
  30938. this.input.clearHintIfInvalid();
  30939. query.length >= this.minLength ? this.dropdown.update(query) : this.dropdown.empty();
  30940. this.dropdown.open();
  30941. this._setLanguageDirection();
  30942. },
  30943. _onWhitespaceChanged: function onWhitespaceChanged() {
  30944. this._updateHint();
  30945. this.dropdown.open();
  30946. },
  30947. _setLanguageDirection: function setLanguageDirection() {
  30948. var dir;
  30949. if (this.dir !== (dir = this.input.getLanguageDirection())) {
  30950. this.dir = dir;
  30951. this.$node.css("direction", dir);
  30952. this.dropdown.setLanguageDirection(dir);
  30953. }
  30954. },
  30955. _updateHint: function updateHint() {
  30956. var datum, val, query, escapedQuery, frontMatchRegEx, match;
  30957. datum = this.dropdown.getDatumForTopSuggestion();
  30958. if (datum && this.dropdown.isVisible() && !this.input.hasOverflow()) {
  30959. val = this.input.getInputValue();
  30960. query = Input.normalizeQuery(val);
  30961. escapedQuery = _.escapeRegExChars(query);
  30962. frontMatchRegEx = new RegExp("^(?:" + escapedQuery + ")(.+$)", "i");
  30963. match = frontMatchRegEx.exec(datum.value);
  30964. match ? this.input.setHint(val + match[1]) : this.input.clearHint();
  30965. } else {
  30966. this.input.clearHint();
  30967. }
  30968. },
  30969. _autocomplete: function autocomplete(laxCursor) {
  30970. var hint, query, isCursorAtEnd, datum;
  30971. hint = this.input.getHint();
  30972. query = this.input.getQuery();
  30973. isCursorAtEnd = laxCursor || this.input.isCursorAtEnd();
  30974. if (hint && query !== hint && isCursorAtEnd) {
  30975. datum = this.dropdown.getDatumForTopSuggestion();
  30976. datum && this.input.setInputValue(datum.value);
  30977. this.eventBus.trigger("autocompleted", datum.raw, datum.datasetName);
  30978. }
  30979. },
  30980. _select: function select(datum) {
  30981. this.input.setQuery(datum.value);
  30982. this.input.setInputValue(datum.value, true);
  30983. this._setLanguageDirection();
  30984. this.eventBus.trigger("selected", datum.raw, datum.datasetName);
  30985. this.dropdown.close();
  30986. _.defer(_.bind(this.dropdown.empty, this.dropdown));
  30987. },
  30988. open: function open() {
  30989. this.dropdown.open();
  30990. },
  30991. close: function close() {
  30992. this.dropdown.close();
  30993. },
  30994. setVal: function setVal(val) {
  30995. val = _.toStr(val);
  30996. if (this.isActivated) {
  30997. this.input.setInputValue(val);
  30998. } else {
  30999. this.input.setQuery(val);
  31000. this.input.setInputValue(val, true);
  31001. }
  31002. this._setLanguageDirection();
  31003. },
  31004. getVal: function getVal() {
  31005. return this.input.getQuery();
  31006. },
  31007. destroy: function destroy() {
  31008. this.input.destroy();
  31009. this.dropdown.destroy();
  31010. destroyDomStructure(this.$node);
  31011. this.$node = null;
  31012. }
  31013. });
  31014. return Typeahead;
  31015. function buildDom(input, withHint) {
  31016. var $input, $wrapper, $dropdown, $hint;
  31017. $input = $(input);
  31018. $wrapper = $(html.wrapper).css(css.wrapper);
  31019. $dropdown = $(html.dropdown).css(css.dropdown);
  31020. $hint = $input.clone().css(css.hint).css(getBackgroundStyles($input));
  31021. $hint.val("").removeData().addClass("tt-hint").removeAttr("id name placeholder required").prop("readonly", true).attr({
  31022. autocomplete: "off",
  31023. spellcheck: "false",
  31024. tabindex: -1
  31025. });
  31026. $input.data(attrsKey, {
  31027. dir: $input.attr("dir"),
  31028. autocomplete: $input.attr("autocomplete"),
  31029. spellcheck: $input.attr("spellcheck"),
  31030. style: $input.attr("style")
  31031. });
  31032. $input.addClass("tt-input").attr({
  31033. autocomplete: "off",
  31034. spellcheck: false
  31035. }).css(withHint ? css.input : css.inputWithNoHint);
  31036. try {
  31037. !$input.attr("dir") && $input.attr("dir", "auto");
  31038. } catch (e) {}
  31039. return $input.wrap($wrapper).parent().prepend(withHint ? $hint : null).append($dropdown);
  31040. }
  31041. function getBackgroundStyles($el) {
  31042. return {
  31043. backgroundAttachment: $el.css("background-attachment"),
  31044. backgroundClip: $el.css("background-clip"),
  31045. backgroundColor: $el.css("background-color"),
  31046. backgroundImage: $el.css("background-image"),
  31047. backgroundOrigin: $el.css("background-origin"),
  31048. backgroundPosition: $el.css("background-position"),
  31049. backgroundRepeat: $el.css("background-repeat"),
  31050. backgroundSize: $el.css("background-size")
  31051. };
  31052. }
  31053. function destroyDomStructure($node) {
  31054. var $input = $node.find(".tt-input");
  31055. _.each($input.data(attrsKey), function(val, key) {
  31056. _.isUndefined(val) ? $input.removeAttr(key) : $input.attr(key, val);
  31057. });
  31058. $input.detach().removeData(attrsKey).removeClass("tt-input").insertAfter($node);
  31059. $node.remove();
  31060. }
  31061. }();
  31062. (function() {
  31063. "use strict";
  31064. var old, typeaheadKey, methods;
  31065. old = $.fn.typeahead;
  31066. typeaheadKey = "ttTypeahead";
  31067. methods = {
  31068. initialize: function initialize(o, datasets) {
  31069. datasets = _.isArray(datasets) ? datasets : [].slice.call(arguments, 1);
  31070. o = o || {};
  31071. return this.each(attach);
  31072. function attach() {
  31073. var $input = $(this), eventBus, typeahead;
  31074. _.each(datasets, function(d) {
  31075. d.highlight = !!o.highlight;
  31076. });
  31077. typeahead = new Typeahead({
  31078. input: $input,
  31079. eventBus: eventBus = new EventBus({
  31080. el: $input
  31081. }),
  31082. withHint: _.isUndefined(o.hint) ? true : !!o.hint,
  31083. minLength: o.minLength,
  31084. autoselect: o.autoselect,
  31085. datasets: datasets
  31086. });
  31087. $input.data(typeaheadKey, typeahead);
  31088. }
  31089. },
  31090. open: function open() {
  31091. return this.each(openTypeahead);
  31092. function openTypeahead() {
  31093. var $input = $(this), typeahead;
  31094. if (typeahead = $input.data(typeaheadKey)) {
  31095. typeahead.open();
  31096. }
  31097. }
  31098. },
  31099. close: function close() {
  31100. return this.each(closeTypeahead);
  31101. function closeTypeahead() {
  31102. var $input = $(this), typeahead;
  31103. if (typeahead = $input.data(typeaheadKey)) {
  31104. typeahead.close();
  31105. }
  31106. }
  31107. },
  31108. val: function val(newVal) {
  31109. return !arguments.length ? getVal(this.first()) : this.each(setVal);
  31110. function setVal() {
  31111. var $input = $(this), typeahead;
  31112. if (typeahead = $input.data(typeaheadKey)) {
  31113. typeahead.setVal(newVal);
  31114. }
  31115. }
  31116. function getVal($input) {
  31117. var typeahead, query;
  31118. if (typeahead = $input.data(typeaheadKey)) {
  31119. query = typeahead.getVal();
  31120. }
  31121. return query;
  31122. }
  31123. },
  31124. destroy: function destroy() {
  31125. return this.each(unattach);
  31126. function unattach() {
  31127. var $input = $(this), typeahead;
  31128. if (typeahead = $input.data(typeaheadKey)) {
  31129. typeahead.destroy();
  31130. $input.removeData(typeaheadKey);
  31131. }
  31132. }
  31133. }
  31134. };
  31135. $.fn.typeahead = function(method) {
  31136. var tts;
  31137. if (methods[method] && method !== "initialize") {
  31138. tts = this.filter(function() {
  31139. return !!$(this).data(typeaheadKey);
  31140. });
  31141. return methods[method].apply(tts, [].slice.call(arguments, 1));
  31142. } else {
  31143. return methods.initialize.apply(this, arguments);
  31144. }
  31145. };
  31146. $.fn.typeahead.noConflict = function noConflict() {
  31147. $.fn.typeahead = old;
  31148. return this;
  31149. };
  31150. })();
  31151. })(window.jQuery);
  31152. (function() {
  31153. $(document).on('rails_admin.dom_ready', function(e, content) {
  31154. var $editors, array, config_options, goBootstrapWysihtml5s, goCkeditors, goCodeMirrors, goFroalaWysiwygs, options;
  31155. content = content ? content : $('form');
  31156. if (content.length) {
  31157. content.find('[data-color]').each(function() {
  31158. var that;
  31159. that = this;
  31160. return $(this).ColorPicker({
  31161. color: $(that).val(),
  31162. onShow: function(el) {
  31163. $(el).fadeIn(500);
  31164. return false;
  31165. },
  31166. onHide: function(el) {
  31167. $(el).fadeOut(500);
  31168. return false;
  31169. },
  31170. onChange: function(hsb, hex, rgb) {
  31171. $(that).val(hex);
  31172. return $(that).css('backgroundColor', '#' + hex);
  31173. }
  31174. });
  31175. });
  31176. $.fn.datetimepicker.defaults.icons = {
  31177. time: 'fa fa-clock-o',
  31178. date: 'fa fa-calendar',
  31179. up: 'fa fa-chevron-up',
  31180. down: 'fa fa-chevron-down',
  31181. previous: 'fa fa-angle-double-left',
  31182. next: 'fa fa-angle-double-right',
  31183. today: 'fa fa-dot-circle-o',
  31184. clear: 'fa fa-trash',
  31185. close: 'fa fa-times'
  31186. };
  31187. content.find('[data-datetimepicker]').each(function() {
  31188. var options;
  31189. options = $(this).data('options');
  31190. $.extend(options, {
  31191. locale: RailsAdmin.I18n.locale
  31192. });
  31193. return $(this).datetimepicker(options);
  31194. });
  31195. content.find('[data-enumeration]').each(function() {
  31196. if ($(this).is('[multiple]')) {
  31197. return $(this).filteringMultiselect($(this).data('options'));
  31198. } else {
  31199. return $(this).filteringSelect($(this).data('options'));
  31200. }
  31201. });
  31202. content.find('[data-fileupload]').each(function() {
  31203. var input;
  31204. input = this;
  31205. return $(this).on('click', ".delete input[type='checkbox']", function() {
  31206. return $(input).children('.toggle').toggle('slow');
  31207. });
  31208. });
  31209. content.find('[data-fileupload]').change(function() {
  31210. var ext, image_container, input, reader;
  31211. input = this;
  31212. image_container = $("#" + input.id).parent().children(".preview");
  31213. if (!image_container.length) {
  31214. image_container = $("#" + input.id).parent().prepend($('<img />').addClass('preview').addClass('img-thumbnail')).find('img.preview');
  31215. image_container.parent().find('img:not(.preview)').hide();
  31216. }
  31217. ext = $("#" + input.id).val().split('.').pop().toLowerCase();
  31218. if (input.files && input.files[0] && $.inArray(ext, ['gif', 'png', 'jpg', 'jpeg', 'bmp']) !== -1) {
  31219. reader = new FileReader();
  31220. reader.onload = function(e) {
  31221. return image_container.attr("src", e.target.result);
  31222. };
  31223. reader.readAsDataURL(input.files[0]);
  31224. return image_container.show();
  31225. } else {
  31226. return image_container.hide();
  31227. }
  31228. });
  31229. content.find('[data-filteringmultiselect]').each(function() {
  31230. $(this).filteringMultiselect($(this).data('options'));
  31231. if ($(this).parents("#modal").length) {
  31232. return $(this).siblings('.btn').remove();
  31233. } else {
  31234. return $(this).parents('.control-group').first().remoteForm();
  31235. }
  31236. });
  31237. content.find('[data-filteringselect]').each(function() {
  31238. $(this).filteringSelect($(this).data('options'));
  31239. if ($(this).parents("#modal").length) {
  31240. return $(this).siblings('.btn').remove();
  31241. } else {
  31242. return $(this).parents('.control-group').first().remoteForm();
  31243. }
  31244. });
  31245. content.find('[data-nestedmany]').each(function() {
  31246. var field, nav, tab_content, toggler;
  31247. field = $(this).parents('.control-group').first();
  31248. nav = field.find('> .controls > .nav');
  31249. tab_content = field.find('> .tab-content');
  31250. toggler = field.find('> .controls > .btn-group > .toggler');
  31251. tab_content.children('.fields:not(.tab-pane)').addClass('tab-pane').each(function() {
  31252. $(this).attr('id', 'unique-id-' + (new Date().getTime()) + Math.floor(Math.random() * 100000));
  31253. return nav.append('<li><a data-toggle="tab" href="#' + this.id + '">' + $(this).children('.object-infos').data('object-label') + '</a></li>');
  31254. });
  31255. if (nav.find("> li.active").length === 0) {
  31256. nav.find("> li > a[data-toggle='tab']:first").tab('show');
  31257. }
  31258. if (nav.children().length === 0) {
  31259. nav.hide();
  31260. tab_content.hide();
  31261. return toggler.addClass('disabled').removeClass('active').children('i').addClass('icon-chevron-right');
  31262. } else {
  31263. if (toggler.hasClass('active')) {
  31264. nav.show();
  31265. tab_content.show();
  31266. return toggler.children('i').addClass('icon-chevron-down');
  31267. } else {
  31268. nav.hide();
  31269. tab_content.hide();
  31270. return toggler.children('i').addClass('icon-chevron-right');
  31271. }
  31272. }
  31273. });
  31274. content.find('[data-nestedone]').each(function() {
  31275. var field, first_tab, nav, tab_content, toggler;
  31276. field = $(this).parents('.control-group').first();
  31277. nav = field.find("> .controls > .nav");
  31278. tab_content = field.find("> .tab-content");
  31279. toggler = field.find('> .controls > .btn-group > .toggler');
  31280. tab_content.children(".fields:not(.tab-pane)").addClass('tab-pane active').each(function() {
  31281. field.find('> .controls .add_nested_fields').removeClass('add_nested_fields').html($(this).children('.object-infos').data('object-label'));
  31282. return nav.append('<li><a data-toggle="tab" href="#' + this.id + '">' + $(this).children('.object-infos').data('object-label') + '</a></li>');
  31283. });
  31284. first_tab = nav.find("> li > a[data-toggle='tab']:first");
  31285. first_tab.tab('show');
  31286. field.find("> .controls > [data-target]:first").html('<i class="icon-white"></i> ' + first_tab.html());
  31287. nav.hide();
  31288. if (nav.children().length === 0) {
  31289. nav.hide();
  31290. tab_content.hide();
  31291. return toggler.addClass('disabled').removeClass('active').children('i').addClass('icon-chevron-right');
  31292. } else {
  31293. if (toggler.hasClass('active')) {
  31294. toggler.children('i').addClass('icon-chevron-down');
  31295. return tab_content.show();
  31296. } else {
  31297. toggler.children('i').addClass('icon-chevron-right');
  31298. return tab_content.hide();
  31299. }
  31300. }
  31301. });
  31302. content.find('[data-polymorphic]').each(function() {
  31303. var field, object_select, type_select, urls;
  31304. type_select = $(this);
  31305. field = type_select.parents('.control-group').first();
  31306. object_select = field.find('select').last();
  31307. urls = type_select.data('urls');
  31308. return type_select.on('change', function(e) {
  31309. if ($(this).val() === '') {
  31310. return object_select.html('<option value=""></option>');
  31311. } else {
  31312. return $.ajax({
  31313. url: urls[type_select.val()],
  31314. data: {
  31315. compact: true,
  31316. all: true
  31317. },
  31318. beforeSend: function(xhr) {
  31319. return xhr.setRequestHeader("Accept", "application/json");
  31320. },
  31321. success: function(data, status, xhr) {
  31322. var html;
  31323. html = $('<option></option>');
  31324. $(data).each(function(i, el) {
  31325. var option;
  31326. option = $('<option></option>');
  31327. option.attr('value', el.id);
  31328. option.text(el.label);
  31329. return html = html.add(option);
  31330. });
  31331. return object_select.html(html);
  31332. }
  31333. });
  31334. }
  31335. });
  31336. });
  31337. goCkeditors = function() {
  31338. return content.find('[data-richtext=ckeditor]').not('.ckeditored').each(function(index, domEle) {
  31339. var instance;
  31340. try {
  31341. if (instance = window.CKEDITOR.instances[this.id]) {
  31342. instance.destroy(true);
  31343. }
  31344. } catch (error1) {}
  31345. window.CKEDITOR.replace(this, $(this).data('options'));
  31346. return $(this).addClass('ckeditored');
  31347. });
  31348. };
  31349. $editors = content.find('[data-richtext=ckeditor]').not('.ckeditored');
  31350. if ($editors.length) {
  31351. if (!window.CKEDITOR) {
  31352. options = $editors.first().data('options');
  31353. window.CKEDITOR_BASEPATH = options['base_location'];
  31354. $.getScript(options['jspath'], (function(_this) {
  31355. return function(script, textStatus, jqXHR) {
  31356. return goCkeditors();
  31357. };
  31358. })(this));
  31359. } else {
  31360. goCkeditors();
  31361. }
  31362. }
  31363. goCodeMirrors = (function(_this) {
  31364. return function(array) {
  31365. return array.each(function(index, domEle) {
  31366. var textarea;
  31367. options = $(this).data('options');
  31368. textarea = this;
  31369. return $.getScript(options['locations']['mode'], function(script, textStatus, jqXHR) {
  31370. $('head').append('<link href="' + options['locations']['theme'] + '" rel="stylesheet" media="all" type="text\/css">');
  31371. CodeMirror.fromTextArea(textarea, options['options']);
  31372. return $(textarea).addClass('codemirrored');
  31373. });
  31374. });
  31375. };
  31376. })(this);
  31377. array = content.find('[data-richtext=codemirror]').not('.codemirrored');
  31378. if (array.length) {
  31379. this.array = array;
  31380. if (!window.CodeMirror) {
  31381. options = $(array[0]).data('options');
  31382. $('head').append('<link href="' + options['csspath'] + '" rel="stylesheet" media="all" type="text\/css">');
  31383. $.getScript(options['jspath'], (function(_this) {
  31384. return function(script, textStatus, jqXHR) {
  31385. return goCodeMirrors(_this.array);
  31386. };
  31387. })(this));
  31388. } else {
  31389. goCodeMirrors(this.array);
  31390. }
  31391. }
  31392. goBootstrapWysihtml5s = (function(_this) {
  31393. return function(array, config_options) {
  31394. return array.each(function() {
  31395. $(this).addClass('bootstrap-wysihtml5ed');
  31396. $(this).closest('.controls').addClass('well');
  31397. return $(this).wysihtml5(config_options);
  31398. });
  31399. };
  31400. })(this);
  31401. array = content.find('[data-richtext=bootstrap-wysihtml5]').not('.bootstrap-wysihtml5ed');
  31402. if (array.length) {
  31403. this.array = array;
  31404. options = $(array[0]).data('options');
  31405. config_options = $.parseJSON(options['config_options']);
  31406. if (!window.wysihtml5) {
  31407. $('head').append('<link href="' + options['csspath'] + '" rel="stylesheet" media="all" type="text\/css">');
  31408. $.getScript(options['jspath'], (function(_this) {
  31409. return function(script, textStatus, jqXHR) {
  31410. return goBootstrapWysihtml5s(_this.array, config_options);
  31411. };
  31412. })(this));
  31413. } else {
  31414. goBootstrapWysihtml5s(this.array, config_options);
  31415. }
  31416. }
  31417. goFroalaWysiwygs = (function(_this) {
  31418. return function(array) {
  31419. return array.each(function() {
  31420. var uploadEnabled;
  31421. options = $(this).data('options');
  31422. config_options = $.parseJSON(options['config_options']);
  31423. if (config_options) {
  31424. if (!config_options['inlineMode']) {
  31425. config_options['inlineMode'] = false;
  31426. }
  31427. } else {
  31428. config_options = {
  31429. inlineMode: false
  31430. };
  31431. }
  31432. uploadEnabled = config_options['imageUploadURL'] ? config_options['imageUploadParams'] = {
  31433. authenticity_token: $('meta[name=csrf-token]').attr('content')
  31434. } : void 0;
  31435. $(this).addClass('froala-wysiwyged');
  31436. $(this).editable(config_options);
  31437. if (uploadEnabled) {
  31438. return $(this).on('editable.imageError', function(e, editor, error) {
  31439. alert("error uploading image: " + error.message);
  31440. if (error.code === 0) {
  31441. } else if (error.code === 1) {
  31442. } else if (error.code === 2) {
  31443. } else if (error.code === 3) {
  31444. } else if (error.code === 4) {
  31445. } else if (error.code === 5) {
  31446. } else if (error.code === 6) {
  31447. } else if (error.code === 7) {
  31448. } else {
  31449. }
  31450. }).on('editable.afterRemoveImage', function(e, editor, $img) {
  31451. editor.options.imageDeleteParams = {
  31452. src: $img.attr('src'),
  31453. authenticity_token: $('meta[name=csrf-token]').attr('content')
  31454. };
  31455. editor.deleteImage($img);
  31456. }).on('editable.imageDeleteSuccess', function(e, editor, data) {}).on('editable.imageDeleteError', function(e, editor, error) {
  31457. return alert("error deleting image: " + error.message);
  31458. });
  31459. }
  31460. });
  31461. };
  31462. })(this);
  31463. array = content.find('[data-richtext=froala-wysiwyg]').not('.froala-wysiwyged');
  31464. if (array.length) {
  31465. options = $(array[0]).data('options');
  31466. if (!$.isFunction($.fn.editable)) {
  31467. $('head').append('<link href="' + options['csspath'] + '" rel="stylesheet" media="all" type="text\/css">');
  31468. return $.getScript(options['jspath'], (function(_this) {
  31469. return function(script, textStatus, jqXHR) {
  31470. return goFroalaWysiwygs(array);
  31471. };
  31472. })(this));
  31473. } else {
  31474. return goFroalaWysiwygs(array);
  31475. }
  31476. }
  31477. }
  31478. });
  31479. }).call(this);
  31480. (function() {
  31481. var $;
  31482. $ = jQuery;
  31483. $(document).on("click", "#list input.toggle", function() {
  31484. return $("#list [name='bulk_ids[]']").prop("checked", $(this).is(":checked"));
  31485. });
  31486. $(document).on('click', '.pjax', function(event) {
  31487. if (event.which > 1 || event.metaKey || event.ctrlKey) {
  31488. } else if ($.support.pjax) {
  31489. event.preventDefault();
  31490. return $.pjax({
  31491. container: $(this).data('pjax-container') || '[data-pjax-container]',
  31492. url: $(this).data('href') || $(this).attr('href'),
  31493. timeout: 2000
  31494. });
  31495. } else if ($(this).data('href')) {
  31496. return window.location = $(this).data('href');
  31497. }
  31498. });
  31499. $(document).on('submit', '.pjax-form', function(event) {
  31500. if ($.support.pjax) {
  31501. event.preventDefault();
  31502. return $.pjax({
  31503. container: $(this).data('pjax-container') || '[data-pjax-container]',
  31504. url: this.action + (this.action.indexOf('?') !== -1 ? '&' : '?') + $(this).serialize(),
  31505. timeout: 2000
  31506. });
  31507. }
  31508. });
  31509. $(document).on('pjax:start', function() {
  31510. return $('#loading').show();
  31511. }).on('pjax:end', function() {
  31512. return $('#loading').hide();
  31513. });
  31514. $(document).on('click', '[data-target]', function() {
  31515. if (!$(this).hasClass('disabled')) {
  31516. if ($(this).has('i.icon-chevron-down').length) {
  31517. $(this).removeClass('active').children('i').toggleClass('icon-chevron-down icon-chevron-right');
  31518. return $($(this).data('target')).select(':visible').hide('slow');
  31519. } else {
  31520. if ($(this).has('i.icon-chevron-right').length) {
  31521. $(this).addClass('active').children('i').toggleClass('icon-chevron-down icon-chevron-right');
  31522. return $($(this).data('target')).select(':hidden').show('slow');
  31523. }
  31524. }
  31525. }
  31526. });
  31527. $(document).on('click', '.form-horizontal legend', function() {
  31528. if ($(this).has('i.icon-chevron-down').length) {
  31529. $(this).siblings('.control-group:visible').hide('slow');
  31530. return $(this).children('i').toggleClass('icon-chevron-down icon-chevron-right');
  31531. } else {
  31532. if ($(this).has('i.icon-chevron-right').length) {
  31533. $(this).siblings('.control-group:hidden').show('slow');
  31534. return $(this).children('i').toggleClass('icon-chevron-down icon-chevron-right');
  31535. }
  31536. }
  31537. });
  31538. $(document).on('click', 'form .tab-content .tab-pane a.remove_nested_one_fields', function() {
  31539. return $(this).children('input[type="hidden"]').val($(this).hasClass('active')).siblings('i').toggleClass('icon-check icon-trash');
  31540. });
  31541. $(document).ready(function() {
  31542. return $(document).trigger('rails_admin.dom_ready');
  31543. });
  31544. $(document).on('pjax:end', function() {
  31545. return $(document).trigger('rails_admin.dom_ready');
  31546. });
  31547. $(document).on('rails_admin.dom_ready', function() {
  31548. $('.animate-width-to').each(function() {
  31549. var length, width;
  31550. length = $(this).data("animate-length");
  31551. width = $(this).data("animate-width-to");
  31552. return $(this).animate({
  31553. width: width
  31554. }, length, 'easeOutQuad');
  31555. });
  31556. $('.form-horizontal legend').has('i.icon-chevron-right').each(function() {
  31557. return $(this).siblings('.control-group').hide();
  31558. });
  31559. $(".table").tooltip({
  31560. selector: "th[rel=tooltip]"
  31561. });
  31562. return $('[formnovalidate]').on('click', function() {
  31563. return $(this).closest('form').attr('novalidate', true);
  31564. });
  31565. });
  31566. $(document).on('click', '#fields_to_export label input#check_all', function() {
  31567. var elems;
  31568. elems = $('#fields_to_export label input');
  31569. if ($('#fields_to_export label input#check_all').is(':checked')) {
  31570. return $(elems).prop('checked', true);
  31571. } else {
  31572. return $(elems).prop('checked', false);
  31573. }
  31574. });
  31575. $(document).on('pjax:popstate', function() {
  31576. $(document).one('pjax:end', function(event) {
  31577. $(event.target).find('script').each(function() {
  31578. $.globalEval(this.text || this.textContent || this.innerHTML || '');
  31579. });
  31580. });
  31581. });
  31582. $(document).on('click', "#remove_filter", function(event) {
  31583. event.preventDefault();
  31584. $("#filters_box").html("");
  31585. $("hr.filters_box").hide();
  31586. $(this).parent().siblings("input[type='search']").val("");
  31587. return $(this).parents("form").submit();
  31588. });
  31589. }).call(this);
  31590. (function() {
  31591. $(document).ready(function() {
  31592. return $(document).on('mousedown', '.save-action', function(e) {
  31593. var editor, instance;
  31594. for (instance in CKEDITOR.instances) {
  31595. editor = CKEDITOR.instances[instance];
  31596. if (editor.checkDirty()) {
  31597. editor.updateElement();
  31598. }
  31599. }
  31600. return true;
  31601. });
  31602. });
  31603. }).call(this);