jquery-3.1.1.js 261 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221
  1. /*!
  2. * jQuery JavaScript Library v3.1.1
  3. * https://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * https://sizzlejs.com/
  7. *
  8. * Copyright jQuery Foundation and other contributors
  9. * Released under the MIT license
  10. * https://jquery.org/license
  11. *
  12. * Date: 2016-09-22T22:30Z
  13. */
  14. ( function( global, factory ) {
  15. "use strict";
  16. if ( typeof module === "object" && typeof module.exports === "object" ) {
  17. // For CommonJS and CommonJS-like environments where a proper `window`
  18. // is present, execute the factory and get jQuery.
  19. // For environments that do not have a `window` with a `document`
  20. // (such as Node.js), expose a factory as module.exports.
  21. // This accentuates the need for the creation of a real `window`.
  22. // e.g. var jQuery = require("jquery")(window);
  23. // See ticket #14549 for more info.
  24. module.exports = global.document ?
  25. factory( global, true ) :
  26. function( w ) {
  27. if ( !w.document ) {
  28. throw new Error( "jQuery requires a window with a document" );
  29. }
  30. return factory( w );
  31. };
  32. } else {
  33. factory( global );
  34. }
  35. // Pass this if window is not defined yet
  36. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  37. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  38. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  39. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  40. // enough that all such attempts are guarded in a try block.
  41. "use strict";
  42. var arr = [];
  43. var document = window.document;
  44. var getProto = Object.getPrototypeOf;
  45. var slice = arr.slice;
  46. var concat = arr.concat;
  47. var push = arr.push;
  48. var indexOf = arr.indexOf;
  49. var class2type = {};
  50. var toString = class2type.toString;
  51. var hasOwn = class2type.hasOwnProperty;
  52. var fnToString = hasOwn.toString;
  53. var ObjectFunctionString = fnToString.call( Object );
  54. var support = {};
  55. function DOMEval( code, doc ) {
  56. doc = doc || document;
  57. var script = doc.createElement( "script" );
  58. script.text = code;
  59. doc.head.appendChild( script ).parentNode.removeChild( script );
  60. }
  61. /* global Symbol */
  62. // Defining this global in .eslintrc.json would create a danger of using the global
  63. // unguarded in another place, it seems safer to define global only for this module
  64. var
  65. version = "3.1.1",
  66. // Define a local copy of jQuery
  67. jQuery = function( selector, context ) {
  68. // The jQuery object is actually just the init constructor 'enhanced'
  69. // Need init if jQuery is called (just allow error to be thrown if not included)
  70. return new jQuery.fn.init( selector, context );
  71. },
  72. // Support: Android <=4.0 only
  73. // Make sure we trim BOM and NBSP
  74. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  75. // Matches dashed string for camelizing
  76. rmsPrefix = /^-ms-/,
  77. rdashAlpha = /-([a-z])/g,
  78. // Used by jQuery.camelCase as callback to replace()
  79. fcamelCase = function( all, letter ) {
  80. return letter.toUpperCase();
  81. };
  82. jQuery.fn = jQuery.prototype = {
  83. // The current version of jQuery being used
  84. jquery: version,
  85. constructor: jQuery,
  86. // The default length of a jQuery object is 0
  87. length: 0,
  88. toArray: function() {
  89. return slice.call( this );
  90. },
  91. // Get the Nth element in the matched element set OR
  92. // Get the whole matched element set as a clean array
  93. get: function( num ) {
  94. // Return all the elements in a clean array
  95. if ( num == null ) {
  96. return slice.call( this );
  97. }
  98. // Return just the one element from the set
  99. return num < 0 ? this[ num + this.length ] : this[ num ];
  100. },
  101. // Take an array of elements and push it onto the stack
  102. // (returning the new matched element set)
  103. pushStack: function( elems ) {
  104. // Build a new jQuery matched element set
  105. var ret = jQuery.merge( this.constructor(), elems );
  106. // Add the old object onto the stack (as a reference)
  107. ret.prevObject = this;
  108. // Return the newly-formed element set
  109. return ret;
  110. },
  111. // Execute a callback for every element in the matched set.
  112. each: function( callback ) {
  113. return jQuery.each( this, callback );
  114. },
  115. map: function( callback ) {
  116. return this.pushStack( jQuery.map( this, function( elem, i ) {
  117. return callback.call( elem, i, elem );
  118. } ) );
  119. },
  120. slice: function() {
  121. return this.pushStack( slice.apply( this, arguments ) );
  122. },
  123. first: function() {
  124. return this.eq( 0 );
  125. },
  126. last: function() {
  127. return this.eq( -1 );
  128. },
  129. eq: function( i ) {
  130. var len = this.length,
  131. j = +i + ( i < 0 ? len : 0 );
  132. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  133. },
  134. end: function() {
  135. return this.prevObject || this.constructor();
  136. },
  137. // For internal use only.
  138. // Behaves like an Array's method, not like a jQuery method.
  139. push: push,
  140. sort: arr.sort,
  141. splice: arr.splice
  142. };
  143. jQuery.extend = jQuery.fn.extend = function() {
  144. var options, name, src, copy, copyIsArray, clone,
  145. target = arguments[ 0 ] || {},
  146. i = 1,
  147. length = arguments.length,
  148. deep = false;
  149. // Handle a deep copy situation
  150. if ( typeof target === "boolean" ) {
  151. deep = target;
  152. // Skip the boolean and the target
  153. target = arguments[ i ] || {};
  154. i++;
  155. }
  156. // Handle case when target is a string or something (possible in deep copy)
  157. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  158. target = {};
  159. }
  160. // Extend jQuery itself if only one argument is passed
  161. if ( i === length ) {
  162. target = this;
  163. i--;
  164. }
  165. for ( ; i < length; i++ ) {
  166. // Only deal with non-null/undefined values
  167. if ( ( options = arguments[ i ] ) != null ) {
  168. // Extend the base object
  169. for ( name in options ) {
  170. src = target[ name ];
  171. copy = options[ name ];
  172. // Prevent never-ending loop
  173. if ( target === copy ) {
  174. continue;
  175. }
  176. // Recurse if we're merging plain objects or arrays
  177. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  178. ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
  179. if ( copyIsArray ) {
  180. copyIsArray = false;
  181. clone = src && jQuery.isArray( src ) ? src : [];
  182. } else {
  183. clone = src && jQuery.isPlainObject( src ) ? src : {};
  184. }
  185. // Never move original objects, clone them
  186. target[ name ] = jQuery.extend( deep, clone, copy );
  187. // Don't bring in undefined values
  188. } else if ( copy !== undefined ) {
  189. target[ name ] = copy;
  190. }
  191. }
  192. }
  193. }
  194. // Return the modified object
  195. return target;
  196. };
  197. jQuery.extend( {
  198. // Unique for each copy of jQuery on the pages
  199. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  200. // Assume jQuery is ready without the ready module
  201. isReady: true,
  202. error: function( msg ) {
  203. throw new Error( msg );
  204. },
  205. noop: function() {},
  206. isFunction: function( obj ) {
  207. return jQuery.type( obj ) === "function";
  208. },
  209. isArray: Array.isArray,
  210. isWindow: function( obj ) {
  211. return obj != null && obj === obj.window;
  212. },
  213. isNumeric: function( obj ) {
  214. // As of jQuery 3.0, isNumeric is limited to
  215. // strings and numbers (primitives or objects)
  216. // that can be coerced to finite numbers (gh-2662)
  217. var type = jQuery.type( obj );
  218. return ( type === "number" || type === "string" ) &&
  219. // parseFloat NaNs numeric-cast false positives ("")
  220. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  221. // subtraction forces infinities to NaN
  222. !isNaN( obj - parseFloat( obj ) );
  223. },
  224. isPlainObject: function( obj ) {
  225. var proto, Ctor;
  226. // Detect obvious negatives
  227. // Use toString instead of jQuery.type to catch host objects
  228. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  229. return false;
  230. }
  231. proto = getProto( obj );
  232. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  233. if ( !proto ) {
  234. return true;
  235. }
  236. // Objects with prototype are plain iff they were constructed by a global Object function
  237. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  238. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  239. },
  240. isEmptyObject: function( obj ) {
  241. /* eslint-disable no-unused-vars */
  242. // See https://github.com/eslint/eslint/issues/6125
  243. var name;
  244. for ( name in obj ) {
  245. return false;
  246. }
  247. return true;
  248. },
  249. type: function( obj ) {
  250. if ( obj == null ) {
  251. return obj + "";
  252. }
  253. // Support: Android <=2.3 only (functionish RegExp)
  254. return typeof obj === "object" || typeof obj === "function" ?
  255. class2type[ toString.call( obj ) ] || "object" :
  256. typeof obj;
  257. },
  258. // Evaluates a script in a global context
  259. globalEval: function( code ) {
  260. DOMEval( code );
  261. },
  262. // Convert dashed to camelCase; used by the css and data modules
  263. // Support: IE <=9 - 11, Edge 12 - 13
  264. // Microsoft forgot to hump their vendor prefix (#9572)
  265. camelCase: function( string ) {
  266. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  267. },
  268. nodeName: function( elem, name ) {
  269. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  270. },
  271. each: function( obj, callback ) {
  272. var length, i = 0;
  273. if ( isArrayLike( obj ) ) {
  274. length = obj.length;
  275. for ( ; i < length; i++ ) {
  276. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  277. break;
  278. }
  279. }
  280. } else {
  281. for ( i in obj ) {
  282. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  283. break;
  284. }
  285. }
  286. }
  287. return obj;
  288. },
  289. // Support: Android <=4.0 only
  290. trim: function( text ) {
  291. return text == null ?
  292. "" :
  293. ( text + "" ).replace( rtrim, "" );
  294. },
  295. // results is for internal usage only
  296. makeArray: function( arr, results ) {
  297. var ret = results || [];
  298. if ( arr != null ) {
  299. if ( isArrayLike( Object( arr ) ) ) {
  300. jQuery.merge( ret,
  301. typeof arr === "string" ?
  302. [ arr ] : arr
  303. );
  304. } else {
  305. push.call( ret, arr );
  306. }
  307. }
  308. return ret;
  309. },
  310. inArray: function( elem, arr, i ) {
  311. return arr == null ? -1 : indexOf.call( arr, elem, i );
  312. },
  313. // Support: Android <=4.0 only, PhantomJS 1 only
  314. // push.apply(_, arraylike) throws on ancient WebKit
  315. merge: function( first, second ) {
  316. var len = +second.length,
  317. j = 0,
  318. i = first.length;
  319. for ( ; j < len; j++ ) {
  320. first[ i++ ] = second[ j ];
  321. }
  322. first.length = i;
  323. return first;
  324. },
  325. grep: function( elems, callback, invert ) {
  326. var callbackInverse,
  327. matches = [],
  328. i = 0,
  329. length = elems.length,
  330. callbackExpect = !invert;
  331. // Go through the array, only saving the items
  332. // that pass the validator function
  333. for ( ; i < length; i++ ) {
  334. callbackInverse = !callback( elems[ i ], i );
  335. if ( callbackInverse !== callbackExpect ) {
  336. matches.push( elems[ i ] );
  337. }
  338. }
  339. return matches;
  340. },
  341. // arg is for internal usage only
  342. map: function( elems, callback, arg ) {
  343. var length, value,
  344. i = 0,
  345. ret = [];
  346. // Go through the array, translating each of the items to their new values
  347. if ( isArrayLike( elems ) ) {
  348. length = elems.length;
  349. for ( ; i < length; i++ ) {
  350. value = callback( elems[ i ], i, arg );
  351. if ( value != null ) {
  352. ret.push( value );
  353. }
  354. }
  355. // Go through every key on the object,
  356. } else {
  357. for ( i in elems ) {
  358. value = callback( elems[ i ], i, arg );
  359. if ( value != null ) {
  360. ret.push( value );
  361. }
  362. }
  363. }
  364. // Flatten any nested arrays
  365. return concat.apply( [], ret );
  366. },
  367. // A global GUID counter for objects
  368. guid: 1,
  369. // Bind a function to a context, optionally partially applying any
  370. // arguments.
  371. proxy: function( fn, context ) {
  372. var tmp, args, proxy;
  373. if ( typeof context === "string" ) {
  374. tmp = fn[ context ];
  375. context = fn;
  376. fn = tmp;
  377. }
  378. // Quick check to determine if target is callable, in the spec
  379. // this throws a TypeError, but we will just return undefined.
  380. if ( !jQuery.isFunction( fn ) ) {
  381. return undefined;
  382. }
  383. // Simulated bind
  384. args = slice.call( arguments, 2 );
  385. proxy = function() {
  386. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  387. };
  388. // Set the guid of unique handler to the same of original handler, so it can be removed
  389. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  390. return proxy;
  391. },
  392. now: Date.now,
  393. // jQuery.support is not used in Core but other projects attach their
  394. // properties to it so it needs to exist.
  395. support: support
  396. } );
  397. if ( typeof Symbol === "function" ) {
  398. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  399. }
  400. // Populate the class2type map
  401. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  402. function( i, name ) {
  403. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  404. } );
  405. function isArrayLike( obj ) {
  406. // Support: real iOS 8.2 only (not reproducible in simulator)
  407. // `in` check used to prevent JIT error (gh-2145)
  408. // hasOwn isn't used here due to false negatives
  409. // regarding Nodelist length in IE
  410. var length = !!obj && "length" in obj && obj.length,
  411. type = jQuery.type( obj );
  412. if ( type === "function" || jQuery.isWindow( obj ) ) {
  413. return false;
  414. }
  415. return type === "array" || length === 0 ||
  416. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  417. }
  418. var Sizzle =
  419. /*!
  420. * Sizzle CSS Selector Engine v2.3.3
  421. * https://sizzlejs.com/
  422. *
  423. * Copyright jQuery Foundation and other contributors
  424. * Released under the MIT license
  425. * http://jquery.org/license
  426. *
  427. * Date: 2016-08-08
  428. */
  429. (function( window ) {
  430. var i,
  431. support,
  432. Expr,
  433. getText,
  434. isXML,
  435. tokenize,
  436. compile,
  437. select,
  438. outermostContext,
  439. sortInput,
  440. hasDuplicate,
  441. // Local document vars
  442. setDocument,
  443. document,
  444. docElem,
  445. documentIsHTML,
  446. rbuggyQSA,
  447. rbuggyMatches,
  448. matches,
  449. contains,
  450. // Instance-specific data
  451. expando = "sizzle" + 1 * new Date(),
  452. preferredDoc = window.document,
  453. dirruns = 0,
  454. done = 0,
  455. classCache = createCache(),
  456. tokenCache = createCache(),
  457. compilerCache = createCache(),
  458. sortOrder = function( a, b ) {
  459. if ( a === b ) {
  460. hasDuplicate = true;
  461. }
  462. return 0;
  463. },
  464. // Instance methods
  465. hasOwn = ({}).hasOwnProperty,
  466. arr = [],
  467. pop = arr.pop,
  468. push_native = arr.push,
  469. push = arr.push,
  470. slice = arr.slice,
  471. // Use a stripped-down indexOf as it's faster than native
  472. // https://jsperf.com/thor-indexof-vs-for/5
  473. indexOf = function( list, elem ) {
  474. var i = 0,
  475. len = list.length;
  476. for ( ; i < len; i++ ) {
  477. if ( list[i] === elem ) {
  478. return i;
  479. }
  480. }
  481. return -1;
  482. },
  483. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  484. // Regular expressions
  485. // http://www.w3.org/TR/css3-selectors/#whitespace
  486. whitespace = "[\\x20\\t\\r\\n\\f]",
  487. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  488. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  489. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  490. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  491. // Operator (capture 2)
  492. "*([*^$|!~]?=)" + whitespace +
  493. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  494. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  495. "*\\]",
  496. pseudos = ":(" + identifier + ")(?:\\((" +
  497. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  498. // 1. quoted (capture 3; capture 4 or capture 5)
  499. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  500. // 2. simple (capture 6)
  501. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  502. // 3. anything else (capture 2)
  503. ".*" +
  504. ")\\)|)",
  505. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  506. rwhitespace = new RegExp( whitespace + "+", "g" ),
  507. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  508. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  509. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  510. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  511. rpseudo = new RegExp( pseudos ),
  512. ridentifier = new RegExp( "^" + identifier + "$" ),
  513. matchExpr = {
  514. "ID": new RegExp( "^#(" + identifier + ")" ),
  515. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  516. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  517. "ATTR": new RegExp( "^" + attributes ),
  518. "PSEUDO": new RegExp( "^" + pseudos ),
  519. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  520. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  521. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  522. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  523. // For use in libraries implementing .is()
  524. // We use this for POS matching in `select`
  525. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  526. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  527. },
  528. rinputs = /^(?:input|select|textarea|button)$/i,
  529. rheader = /^h\d$/i,
  530. rnative = /^[^{]+\{\s*\[native \w/,
  531. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  532. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  533. rsibling = /[+~]/,
  534. // CSS escapes
  535. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  536. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  537. funescape = function( _, escaped, escapedWhitespace ) {
  538. var high = "0x" + escaped - 0x10000;
  539. // NaN means non-codepoint
  540. // Support: Firefox<24
  541. // Workaround erroneous numeric interpretation of +"0x"
  542. return high !== high || escapedWhitespace ?
  543. escaped :
  544. high < 0 ?
  545. // BMP codepoint
  546. String.fromCharCode( high + 0x10000 ) :
  547. // Supplemental Plane codepoint (surrogate pair)
  548. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  549. },
  550. // CSS string/identifier serialization
  551. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  552. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  553. fcssescape = function( ch, asCodePoint ) {
  554. if ( asCodePoint ) {
  555. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  556. if ( ch === "\0" ) {
  557. return "\uFFFD";
  558. }
  559. // Control characters and (dependent upon position) numbers get escaped as code points
  560. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  561. }
  562. // Other potentially-special ASCII characters get backslash-escaped
  563. return "\\" + ch;
  564. },
  565. // Used for iframes
  566. // See setDocument()
  567. // Removing the function wrapper causes a "Permission Denied"
  568. // error in IE
  569. unloadHandler = function() {
  570. setDocument();
  571. },
  572. disabledAncestor = addCombinator(
  573. function( elem ) {
  574. return elem.disabled === true && ("form" in elem || "label" in elem);
  575. },
  576. { dir: "parentNode", next: "legend" }
  577. );
  578. // Optimize for push.apply( _, NodeList )
  579. try {
  580. push.apply(
  581. (arr = slice.call( preferredDoc.childNodes )),
  582. preferredDoc.childNodes
  583. );
  584. // Support: Android<4.0
  585. // Detect silently failing push.apply
  586. arr[ preferredDoc.childNodes.length ].nodeType;
  587. } catch ( e ) {
  588. push = { apply: arr.length ?
  589. // Leverage slice if possible
  590. function( target, els ) {
  591. push_native.apply( target, slice.call(els) );
  592. } :
  593. // Support: IE<9
  594. // Otherwise append directly
  595. function( target, els ) {
  596. var j = target.length,
  597. i = 0;
  598. // Can't trust NodeList.length
  599. while ( (target[j++] = els[i++]) ) {}
  600. target.length = j - 1;
  601. }
  602. };
  603. }
  604. function Sizzle( selector, context, results, seed ) {
  605. var m, i, elem, nid, match, groups, newSelector,
  606. newContext = context && context.ownerDocument,
  607. // nodeType defaults to 9, since context defaults to document
  608. nodeType = context ? context.nodeType : 9;
  609. results = results || [];
  610. // Return early from calls with invalid selector or context
  611. if ( typeof selector !== "string" || !selector ||
  612. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  613. return results;
  614. }
  615. // Try to shortcut hujie operations (as opposed to filters) in HTML documents
  616. if ( !seed ) {
  617. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  618. setDocument( context );
  619. }
  620. context = context || document;
  621. if ( documentIsHTML ) {
  622. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  623. // (excepting DocumentFragment context, where the methods don't exist)
  624. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  625. // ID selector
  626. if ( (m = match[1]) ) {
  627. // Document context
  628. if ( nodeType === 9 ) {
  629. if ( (elem = context.getElementById( m )) ) {
  630. // Support: IE, Opera, Webkit
  631. // TODO: identify versions
  632. // getElementById can match elements by name instead of ID
  633. if ( elem.id === m ) {
  634. results.push( elem );
  635. return results;
  636. }
  637. } else {
  638. return results;
  639. }
  640. // Element context
  641. } else {
  642. // Support: IE, Opera, Webkit
  643. // TODO: identify versions
  644. // getElementById can match elements by name instead of ID
  645. if ( newContext && (elem = newContext.getElementById( m )) &&
  646. contains( context, elem ) &&
  647. elem.id === m ) {
  648. results.push( elem );
  649. return results;
  650. }
  651. }
  652. // Type selector
  653. } else if ( match[2] ) {
  654. push.apply( results, context.getElementsByTagName( selector ) );
  655. return results;
  656. // Class selector
  657. } else if ( (m = match[3]) && support.getElementsByClassName &&
  658. context.getElementsByClassName ) {
  659. push.apply( results, context.getElementsByClassName( m ) );
  660. return results;
  661. }
  662. }
  663. // Take advantage of querySelectorAll
  664. if ( support.qsa &&
  665. !compilerCache[ selector + " " ] &&
  666. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  667. if ( nodeType !== 1 ) {
  668. newContext = context;
  669. newSelector = selector;
  670. // qSA looks outside Element context, which is not what we want
  671. // Thanks to Andrew Dupont for this workaround technique
  672. // Support: IE <=8
  673. // Exclude object elements
  674. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  675. // Capture the context ID, setting it first if necessary
  676. if ( (nid = context.getAttribute( "id" )) ) {
  677. nid = nid.replace( rcssescape, fcssescape );
  678. } else {
  679. context.setAttribute( "id", (nid = expando) );
  680. }
  681. // Prefix every selector in the list
  682. groups = tokenize( selector );
  683. i = groups.length;
  684. while ( i-- ) {
  685. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  686. }
  687. newSelector = groups.join( "," );
  688. // Expand context for sibling selectors
  689. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  690. context;
  691. }
  692. if ( newSelector ) {
  693. try {
  694. push.apply( results,
  695. newContext.querySelectorAll( newSelector )
  696. );
  697. return results;
  698. } catch ( qsaError ) {
  699. } finally {
  700. if ( nid === expando ) {
  701. context.removeAttribute( "id" );
  702. }
  703. }
  704. }
  705. }
  706. }
  707. }
  708. // All others
  709. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  710. }
  711. /**
  712. * Create key-value caches of limited size
  713. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  714. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  715. * deleting the oldest entry
  716. */
  717. function createCache() {
  718. var keys = [];
  719. function cache( key, value ) {
  720. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  721. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  722. // Only keep the most recent entries
  723. delete cache[ keys.shift() ];
  724. }
  725. return (cache[ key + " " ] = value);
  726. }
  727. return cache;
  728. }
  729. /**
  730. * Mark a function for special use by Sizzle
  731. * @param {Function} fn The function to mark
  732. */
  733. function markFunction( fn ) {
  734. fn[ expando ] = true;
  735. return fn;
  736. }
  737. /**
  738. * Support testing using an element
  739. * @param {Function} fn Passed the created element and returns a boolean result
  740. */
  741. function assert( fn ) {
  742. var el = document.createElement("fieldset");
  743. try {
  744. return !!fn( el );
  745. } catch (e) {
  746. return false;
  747. } finally {
  748. // Remove from its parent by default
  749. if ( el.parentNode ) {
  750. el.parentNode.removeChild( el );
  751. }
  752. // release memory in IE
  753. el = null;
  754. }
  755. }
  756. /**
  757. * Adds the same handler for all of the specified attrs
  758. * @param {String} attrs Pipe-separated list of attributes
  759. * @param {Function} handler The method that will be applied
  760. */
  761. function addHandle( attrs, handler ) {
  762. var arr = attrs.split("|"),
  763. i = arr.length;
  764. while ( i-- ) {
  765. Expr.attrHandle[ arr[i] ] = handler;
  766. }
  767. }
  768. /**
  769. * Checks document custom of two siblings
  770. * @param {Element} a
  771. * @param {Element} b
  772. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  773. */
  774. function siblingCheck( a, b ) {
  775. var cur = b && a,
  776. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  777. a.sourceIndex - b.sourceIndex;
  778. // Use IE sourceIndex if available on both nodes
  779. if ( diff ) {
  780. return diff;
  781. }
  782. // Check if b follows a
  783. if ( cur ) {
  784. while ( (cur = cur.nextSibling) ) {
  785. if ( cur === b ) {
  786. return -1;
  787. }
  788. }
  789. }
  790. return a ? 1 : -1;
  791. }
  792. /**
  793. * Returns a function to use in pseudos for input types
  794. * @param {String} type
  795. */
  796. function createInputPseudo( type ) {
  797. return function( elem ) {
  798. var name = elem.nodeName.toLowerCase();
  799. return name === "input" && elem.type === type;
  800. };
  801. }
  802. /**
  803. * Returns a function to use in pseudos for buttons
  804. * @param {String} type
  805. */
  806. function createButtonPseudo( type ) {
  807. return function( elem ) {
  808. var name = elem.nodeName.toLowerCase();
  809. return (name === "input" || name === "button") && elem.type === type;
  810. };
  811. }
  812. /**
  813. * Returns a function to use in pseudos for :enabled/:disabled
  814. * @param {Boolean} disabled true for :disabled; false for :enabled
  815. */
  816. function createDisabledPseudo( disabled ) {
  817. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  818. return function( elem ) {
  819. // Only certain elements can match :enabled or :disabled
  820. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  821. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  822. if ( "form" in elem ) {
  823. // Check for inherited disabledness on relevant non-disabled elements:
  824. // * listed form-associated elements in a disabled fieldset
  825. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  826. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  827. // * option elements in a disabled optgroup
  828. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  829. // All such elements have a "form" property.
  830. if ( elem.parentNode && elem.disabled === false ) {
  831. // Option elements defer to a parent optgroup if present
  832. if ( "label" in elem ) {
  833. if ( "label" in elem.parentNode ) {
  834. return elem.parentNode.disabled === disabled;
  835. } else {
  836. return elem.disabled === disabled;
  837. }
  838. }
  839. // Support: IE 6 - 11
  840. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  841. return elem.isDisabled === disabled ||
  842. // Where there is no isDisabled, check manually
  843. /* jshint -W018 */
  844. elem.isDisabled !== !disabled &&
  845. disabledAncestor( elem ) === disabled;
  846. }
  847. return elem.disabled === disabled;
  848. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  849. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  850. // even exist on them, let alone have a boolean value.
  851. } else if ( "label" in elem ) {
  852. return elem.disabled === disabled;
  853. }
  854. // Remaining elements are neither :enabled nor :disabled
  855. return false;
  856. };
  857. }
  858. /**
  859. * Returns a function to use in pseudos for positionals
  860. * @param {Function} fn
  861. */
  862. function createPositionalPseudo( fn ) {
  863. return markFunction(function( argument ) {
  864. argument = +argument;
  865. return markFunction(function( seed, matches ) {
  866. var j,
  867. matchIndexes = fn( [], seed.length, argument ),
  868. i = matchIndexes.length;
  869. // Match elements found at the specified indexes
  870. while ( i-- ) {
  871. if ( seed[ (j = matchIndexes[i]) ] ) {
  872. seed[j] = !(matches[j] = seed[j]);
  873. }
  874. }
  875. });
  876. });
  877. }
  878. /**
  879. * Checks a node for validity as a Sizzle context
  880. * @param {Element|Object=} context
  881. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  882. */
  883. function testContext( context ) {
  884. return context && typeof context.getElementsByTagName !== "undefined" && context;
  885. }
  886. // Expose support vars for convenience
  887. support = Sizzle.support = {};
  888. /**
  889. * Detects XML nodes
  890. * @param {Element|Object} elem An element or a document
  891. * @returns {Boolean} True iff elem is a non-HTML XML node
  892. */
  893. isXML = Sizzle.isXML = function( elem ) {
  894. // documentElement is verified for cases where it doesn't yet exist
  895. // (such as loading iframes in IE - #4833)
  896. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  897. return documentElement ? documentElement.nodeName !== "HTML" : false;
  898. };
  899. /**
  900. * Sets document-related variables once based on the current document
  901. * @param {Element|Object} [doc] An element or document object to use to set the document
  902. * @returns {Object} Returns the current document
  903. */
  904. setDocument = Sizzle.setDocument = function( node ) {
  905. var hasCompare, subWindow,
  906. doc = node ? node.ownerDocument || node : preferredDoc;
  907. // Return early if doc is invalid or already selected
  908. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  909. return document;
  910. }
  911. // Update global variables
  912. document = doc;
  913. docElem = document.documentElement;
  914. documentIsHTML = !isXML( document );
  915. // Support: IE 9-11, Edge
  916. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  917. if ( preferredDoc !== document &&
  918. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  919. // Support: IE 11, Edge
  920. if ( subWindow.addEventListener ) {
  921. subWindow.addEventListener( "unload", unloadHandler, false );
  922. // Support: IE 9 - 10 only
  923. } else if ( subWindow.attachEvent ) {
  924. subWindow.attachEvent( "onunload", unloadHandler );
  925. }
  926. }
  927. /* Attributes
  928. ---------------------------------------------------------------------- */
  929. // Support: IE<8
  930. // Verify that getAttribute really returns attributes and not properties
  931. // (excepting IE8 booleans)
  932. support.attributes = assert(function( el ) {
  933. el.className = "i";
  934. return !el.getAttribute("className");
  935. });
  936. /* getElement(s)By*
  937. ---------------------------------------------------------------------- */
  938. // Check if getElementsByTagName("*") returns only elements
  939. support.getElementsByTagName = assert(function( el ) {
  940. el.appendChild( document.createComment("") );
  941. return !el.getElementsByTagName("*").length;
  942. });
  943. // Support: IE<9
  944. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  945. // Support: IE<10
  946. // Check if getElementById returns elements by name
  947. // The broken getElementById methods don't pick up programmatically-set names,
  948. // so use a roundabout getElementsByName test
  949. support.getById = assert(function( el ) {
  950. docElem.appendChild( el ).id = expando;
  951. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  952. });
  953. // ID filter and hujie
  954. if ( support.getById ) {
  955. Expr.filter["ID"] = function( id ) {
  956. var attrId = id.replace( runescape, funescape );
  957. return function( elem ) {
  958. return elem.getAttribute("id") === attrId;
  959. };
  960. };
  961. Expr.find["ID"] = function( id, context ) {
  962. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  963. var elem = context.getElementById( id );
  964. return elem ? [ elem ] : [];
  965. }
  966. };
  967. } else {
  968. Expr.filter["ID"] = function( id ) {
  969. var attrId = id.replace( runescape, funescape );
  970. return function( elem ) {
  971. var node = typeof elem.getAttributeNode !== "undefined" &&
  972. elem.getAttributeNode("id");
  973. return node && node.value === attrId;
  974. };
  975. };
  976. // Support: IE 6 - 7 only
  977. // getElementById is not reliable as a hujie shortcut
  978. Expr.find["ID"] = function( id, context ) {
  979. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  980. var node, i, elems,
  981. elem = context.getElementById( id );
  982. if ( elem ) {
  983. // Verify the id attribute
  984. node = elem.getAttributeNode("id");
  985. if ( node && node.value === id ) {
  986. return [ elem ];
  987. }
  988. // Fall back on getElementsByName
  989. elems = context.getElementsByName( id );
  990. i = 0;
  991. while ( (elem = elems[i++]) ) {
  992. node = elem.getAttributeNode("id");
  993. if ( node && node.value === id ) {
  994. return [ elem ];
  995. }
  996. }
  997. }
  998. return [];
  999. }
  1000. };
  1001. }
  1002. // Tag
  1003. Expr.find["TAG"] = support.getElementsByTagName ?
  1004. function( tag, context ) {
  1005. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1006. return context.getElementsByTagName( tag );
  1007. // DocumentFragment nodes don't have gEBTN
  1008. } else if ( support.qsa ) {
  1009. return context.querySelectorAll( tag );
  1010. }
  1011. } :
  1012. function( tag, context ) {
  1013. var elem,
  1014. tmp = [],
  1015. i = 0,
  1016. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  1017. results = context.getElementsByTagName( tag );
  1018. // Filter out possible comments
  1019. if ( tag === "*" ) {
  1020. while ( (elem = results[i++]) ) {
  1021. if ( elem.nodeType === 1 ) {
  1022. tmp.push( elem );
  1023. }
  1024. }
  1025. return tmp;
  1026. }
  1027. return results;
  1028. };
  1029. // Class
  1030. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  1031. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1032. return context.getElementsByClassName( className );
  1033. }
  1034. };
  1035. /* QSA/matchesSelector
  1036. ---------------------------------------------------------------------- */
  1037. // QSA and matchesSelector support
  1038. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1039. rbuggyMatches = [];
  1040. // qSa(:focus) reports false when true (Chrome 21)
  1041. // We allow this because of a bug in IE8/9 that throws an error
  1042. // whenever `document.activeElement` is accessed on an iframe
  1043. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1044. // See https://bugs.jquery.com/ticket/13378
  1045. rbuggyQSA = [];
  1046. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1047. // Build QSA regex
  1048. // Regex strategy adopted from Diego Perini
  1049. assert(function( el ) {
  1050. // Select is set to empty string on purpose
  1051. // This is to test IE's treatment of not explicitly
  1052. // setting a boolean content attribute,
  1053. // since its presence should be enough
  1054. // https://bugs.jquery.com/ticket/12359
  1055. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1056. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1057. "<option selected=''></option></select>";
  1058. // Support: IE8, Opera 11-12.16
  1059. // Nothing should be selected when empty strings follow ^= or $= or *=
  1060. // The test attribute must be unknown in Opera but "safe" for WinRT
  1061. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1062. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1063. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1064. }
  1065. // Support: IE8
  1066. // Boolean attributes and "value" are not treated correctly
  1067. if ( !el.querySelectorAll("[selected]").length ) {
  1068. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1069. }
  1070. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1071. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1072. rbuggyQSA.push("~=");
  1073. }
  1074. // Webkit/Opera - :checked should return selected option elements
  1075. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1076. // IE8 throws error here and will not see later tests
  1077. if ( !el.querySelectorAll(":checked").length ) {
  1078. rbuggyQSA.push(":checked");
  1079. }
  1080. // Support: Safari 8+, iOS 8+
  1081. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1082. // In-pages `selector#id sibling-combinator selector` fails
  1083. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1084. rbuggyQSA.push(".#.+[+~]");
  1085. }
  1086. });
  1087. assert(function( el ) {
  1088. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1089. "<select disabled='disabled'><option/></select>";
  1090. // Support: Windows 8 Native Apps
  1091. // The type and name attributes are restricted during .innerHTML assignment
  1092. var input = document.createElement("input");
  1093. input.setAttribute( "type", "hidden" );
  1094. el.appendChild( input ).setAttribute( "name", "D" );
  1095. // Support: IE8
  1096. // Enforce case-sensitivity of name attribute
  1097. if ( el.querySelectorAll("[name=d]").length ) {
  1098. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1099. }
  1100. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1101. // IE8 throws error here and will not see later tests
  1102. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1103. rbuggyQSA.push( ":enabled", ":disabled" );
  1104. }
  1105. // Support: IE9-11+
  1106. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1107. docElem.appendChild( el ).disabled = true;
  1108. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1109. rbuggyQSA.push( ":enabled", ":disabled" );
  1110. }
  1111. // Opera 10-11 does not throw on post-comma invalid pseudos
  1112. el.querySelectorAll("*,:x");
  1113. rbuggyQSA.push(",.*:");
  1114. });
  1115. }
  1116. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1117. docElem.webkitMatchesSelector ||
  1118. docElem.mozMatchesSelector ||
  1119. docElem.oMatchesSelector ||
  1120. docElem.msMatchesSelector) )) ) {
  1121. assert(function( el ) {
  1122. // Check to see if it's possible to do matchesSelector
  1123. // on a disconnected node (IE 9)
  1124. support.disconnectedMatch = matches.call( el, "*" );
  1125. // This should fail with an exception
  1126. // Gecko does not error, returns false instead
  1127. matches.call( el, "[s!='']:x" );
  1128. rbuggyMatches.push( "!=", pseudos );
  1129. });
  1130. }
  1131. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1132. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1133. /* Contains
  1134. ---------------------------------------------------------------------- */
  1135. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1136. // Element contains another
  1137. // Purposefully self-exclusive
  1138. // As in, an element does not contain itself
  1139. contains = hasCompare || rnative.test( docElem.contains ) ?
  1140. function( a, b ) {
  1141. var adown = a.nodeType === 9 ? a.documentElement : a,
  1142. bup = b && b.parentNode;
  1143. return a === bup || !!( bup && bup.nodeType === 1 && (
  1144. adown.contains ?
  1145. adown.contains( bup ) :
  1146. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1147. ));
  1148. } :
  1149. function( a, b ) {
  1150. if ( b ) {
  1151. while ( (b = b.parentNode) ) {
  1152. if ( b === a ) {
  1153. return true;
  1154. }
  1155. }
  1156. }
  1157. return false;
  1158. };
  1159. /* Sorting
  1160. ---------------------------------------------------------------------- */
  1161. // Document custom sorting
  1162. sortOrder = hasCompare ?
  1163. function( a, b ) {
  1164. // Flag for duplicate removal
  1165. if ( a === b ) {
  1166. hasDuplicate = true;
  1167. return 0;
  1168. }
  1169. // Sort on method existence if only one input has compareDocumentPosition
  1170. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1171. if ( compare ) {
  1172. return compare;
  1173. }
  1174. // Calculate position if both inputs belong to the same document
  1175. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1176. a.compareDocumentPosition( b ) :
  1177. // Otherwise we know they are disconnected
  1178. 1;
  1179. // Disconnected nodes
  1180. if ( compare & 1 ||
  1181. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1182. // Choose the first element that is related to our preferred document
  1183. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1184. return -1;
  1185. }
  1186. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1187. return 1;
  1188. }
  1189. // Maintain original custom
  1190. return sortInput ?
  1191. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1192. 0;
  1193. }
  1194. return compare & 4 ? -1 : 1;
  1195. } :
  1196. function( a, b ) {
  1197. // Exit early if the nodes are identical
  1198. if ( a === b ) {
  1199. hasDuplicate = true;
  1200. return 0;
  1201. }
  1202. var cur,
  1203. i = 0,
  1204. aup = a.parentNode,
  1205. bup = b.parentNode,
  1206. ap = [ a ],
  1207. bp = [ b ];
  1208. // Parentless nodes are either documents or disconnected
  1209. if ( !aup || !bup ) {
  1210. return a === document ? -1 :
  1211. b === document ? 1 :
  1212. aup ? -1 :
  1213. bup ? 1 :
  1214. sortInput ?
  1215. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1216. 0;
  1217. // If the nodes are siblings, we can do a quick check
  1218. } else if ( aup === bup ) {
  1219. return siblingCheck( a, b );
  1220. }
  1221. // Otherwise we need full lists of their ancestors for comparison
  1222. cur = a;
  1223. while ( (cur = cur.parentNode) ) {
  1224. ap.unshift( cur );
  1225. }
  1226. cur = b;
  1227. while ( (cur = cur.parentNode) ) {
  1228. bp.unshift( cur );
  1229. }
  1230. // Walk down the tree looking for a discrepancy
  1231. while ( ap[i] === bp[i] ) {
  1232. i++;
  1233. }
  1234. return i ?
  1235. // Do a sibling check if the nodes have a common ancestor
  1236. siblingCheck( ap[i], bp[i] ) :
  1237. // Otherwise nodes in our document sort first
  1238. ap[i] === preferredDoc ? -1 :
  1239. bp[i] === preferredDoc ? 1 :
  1240. 0;
  1241. };
  1242. return document;
  1243. };
  1244. Sizzle.matches = function( expr, elements ) {
  1245. return Sizzle( expr, null, null, elements );
  1246. };
  1247. Sizzle.matchesSelector = function( elem, expr ) {
  1248. // Set document vars if needed
  1249. if ( ( elem.ownerDocument || elem ) !== document ) {
  1250. setDocument( elem );
  1251. }
  1252. // Make sure that attribute selectors are quoted
  1253. expr = expr.replace( rattributeQuotes, "='$1']" );
  1254. if ( support.matchesSelector && documentIsHTML &&
  1255. !compilerCache[ expr + " " ] &&
  1256. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1257. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1258. try {
  1259. var ret = matches.call( elem, expr );
  1260. // IE 9's matchesSelector returns false on disconnected nodes
  1261. if ( ret || support.disconnectedMatch ||
  1262. // As well, disconnected nodes are said to be in a document
  1263. // fragment in IE 9
  1264. elem.document && elem.document.nodeType !== 11 ) {
  1265. return ret;
  1266. }
  1267. } catch (e) {}
  1268. }
  1269. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1270. };
  1271. Sizzle.contains = function( context, elem ) {
  1272. // Set document vars if needed
  1273. if ( ( context.ownerDocument || context ) !== document ) {
  1274. setDocument( context );
  1275. }
  1276. return contains( context, elem );
  1277. };
  1278. Sizzle.attr = function( elem, name ) {
  1279. // Set document vars if needed
  1280. if ( ( elem.ownerDocument || elem ) !== document ) {
  1281. setDocument( elem );
  1282. }
  1283. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1284. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1285. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1286. fn( elem, name, !documentIsHTML ) :
  1287. undefined;
  1288. return val !== undefined ?
  1289. val :
  1290. support.attributes || !documentIsHTML ?
  1291. elem.getAttribute( name ) :
  1292. (val = elem.getAttributeNode(name)) && val.specified ?
  1293. val.value :
  1294. null;
  1295. };
  1296. Sizzle.escape = function( sel ) {
  1297. return (sel + "").replace( rcssescape, fcssescape );
  1298. };
  1299. Sizzle.error = function( msg ) {
  1300. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1301. };
  1302. /**
  1303. * Document sorting and removing duplicates
  1304. * @param {ArrayLike} results
  1305. */
  1306. Sizzle.uniqueSort = function( results ) {
  1307. var elem,
  1308. duplicates = [],
  1309. j = 0,
  1310. i = 0;
  1311. // Unless we *know* we can detect duplicates, assume their presence
  1312. hasDuplicate = !support.detectDuplicates;
  1313. sortInput = !support.sortStable && results.slice( 0 );
  1314. results.sort( sortOrder );
  1315. if ( hasDuplicate ) {
  1316. while ( (elem = results[i++]) ) {
  1317. if ( elem === results[ i ] ) {
  1318. j = duplicates.push( i );
  1319. }
  1320. }
  1321. while ( j-- ) {
  1322. results.splice( duplicates[ j ], 1 );
  1323. }
  1324. }
  1325. // Clear input after sorting to release objects
  1326. // See https://github.com/jquery/sizzle/pull/225
  1327. sortInput = null;
  1328. return results;
  1329. };
  1330. /**
  1331. * Utility function for retrieving the text value of an array of DOM nodes
  1332. * @param {Array|Element} elem
  1333. */
  1334. getText = Sizzle.getText = function( elem ) {
  1335. var node,
  1336. ret = "",
  1337. i = 0,
  1338. nodeType = elem.nodeType;
  1339. if ( !nodeType ) {
  1340. // If no nodeType, this is expected to be an array
  1341. while ( (node = elem[i++]) ) {
  1342. // Do not traverse comment nodes
  1343. ret += getText( node );
  1344. }
  1345. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1346. // Use textContent for elements
  1347. // innerText usage removed for consistency of new lines (jQuery #11153)
  1348. if ( typeof elem.textContent === "string" ) {
  1349. return elem.textContent;
  1350. } else {
  1351. // Traverse its children
  1352. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1353. ret += getText( elem );
  1354. }
  1355. }
  1356. } else if ( nodeType === 3 || nodeType === 4 ) {
  1357. return elem.nodeValue;
  1358. }
  1359. // Do not include comment or processing instruction nodes
  1360. return ret;
  1361. };
  1362. Expr = Sizzle.selectors = {
  1363. // Can be adjusted by the user
  1364. cacheLength: 50,
  1365. createPseudo: markFunction,
  1366. match: matchExpr,
  1367. attrHandle: {},
  1368. find: {},
  1369. relative: {
  1370. ">": { dir: "parentNode", first: true },
  1371. " ": { dir: "parentNode" },
  1372. "+": { dir: "previousSibling", first: true },
  1373. "~": { dir: "previousSibling" }
  1374. },
  1375. preFilter: {
  1376. "ATTR": function( match ) {
  1377. match[1] = match[1].replace( runescape, funescape );
  1378. // Move the given value to match[3] whether quoted or unquoted
  1379. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1380. if ( match[2] === "~=" ) {
  1381. match[3] = " " + match[3] + " ";
  1382. }
  1383. return match.slice( 0, 4 );
  1384. },
  1385. "CHILD": function( match ) {
  1386. /* matches from matchExpr["CHILD"]
  1387. 1 type (only|nth|...)
  1388. 2 what (child|of-type)
  1389. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1390. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1391. 5 sign of xn-component
  1392. 6 x of xn-component
  1393. 7 sign of y-component
  1394. 8 y of y-component
  1395. */
  1396. match[1] = match[1].toLowerCase();
  1397. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1398. // nth-* requires argument
  1399. if ( !match[3] ) {
  1400. Sizzle.error( match[0] );
  1401. }
  1402. // numeric x and y parameters for Expr.filter.CHILD
  1403. // remember that false/true cast respectively to 0/1
  1404. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1405. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1406. // other types prohibit arguments
  1407. } else if ( match[3] ) {
  1408. Sizzle.error( match[0] );
  1409. }
  1410. return match;
  1411. },
  1412. "PSEUDO": function( match ) {
  1413. var excess,
  1414. unquoted = !match[6] && match[2];
  1415. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1416. return null;
  1417. }
  1418. // Accept quoted arguments as-is
  1419. if ( match[3] ) {
  1420. match[2] = match[4] || match[5] || "";
  1421. // Strip excess characters from unquoted arguments
  1422. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1423. // Get excess from tokenize (recursively)
  1424. (excess = tokenize( unquoted, true )) &&
  1425. // advance to the next closing parenthesis
  1426. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1427. // excess is a negative index
  1428. match[0] = match[0].slice( 0, excess );
  1429. match[2] = unquoted.slice( 0, excess );
  1430. }
  1431. // Return only captures needed by the pseudo filter method (type and argument)
  1432. return match.slice( 0, 3 );
  1433. }
  1434. },
  1435. filter: {
  1436. "TAG": function( nodeNameSelector ) {
  1437. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1438. return nodeNameSelector === "*" ?
  1439. function() { return true; } :
  1440. function( elem ) {
  1441. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1442. };
  1443. },
  1444. "CLASS": function( className ) {
  1445. var pattern = classCache[ className + " " ];
  1446. return pattern ||
  1447. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1448. classCache( className, function( elem ) {
  1449. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1450. });
  1451. },
  1452. "ATTR": function( name, operator, check ) {
  1453. return function( elem ) {
  1454. var result = Sizzle.attr( elem, name );
  1455. if ( result == null ) {
  1456. return operator === "!=";
  1457. }
  1458. if ( !operator ) {
  1459. return true;
  1460. }
  1461. result += "";
  1462. return operator === "=" ? result === check :
  1463. operator === "!=" ? result !== check :
  1464. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1465. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1466. operator === "$=" ? check && result.slice( -check.length ) === check :
  1467. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1468. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1469. false;
  1470. };
  1471. },
  1472. "CHILD": function( type, what, argument, first, last ) {
  1473. var simple = type.slice( 0, 3 ) !== "nth",
  1474. forward = type.slice( -4 ) !== "last",
  1475. ofType = what === "of-type";
  1476. return first === 1 && last === 0 ?
  1477. // Shortcut for :nth-*(n)
  1478. function( elem ) {
  1479. return !!elem.parentNode;
  1480. } :
  1481. function( elem, context, xml ) {
  1482. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1483. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1484. parent = elem.parentNode,
  1485. name = ofType && elem.nodeName.toLowerCase(),
  1486. useCache = !xml && !ofType,
  1487. diff = false;
  1488. if ( parent ) {
  1489. // :(first|last|only)-(child|of-type)
  1490. if ( simple ) {
  1491. while ( dir ) {
  1492. node = elem;
  1493. while ( (node = node[ dir ]) ) {
  1494. if ( ofType ?
  1495. node.nodeName.toLowerCase() === name :
  1496. node.nodeType === 1 ) {
  1497. return false;
  1498. }
  1499. }
  1500. // Reverse direction for :only-* (if we haven't yet done so)
  1501. start = dir = type === "only" && !start && "nextSibling";
  1502. }
  1503. return true;
  1504. }
  1505. start = [ forward ? parent.firstChild : parent.lastChild ];
  1506. // non-xml :nth-child(...) stores cache data on `parent`
  1507. if ( forward && useCache ) {
  1508. // Seek `elem` from a previously-cached index
  1509. // ...in a gzip-friendly way
  1510. node = parent;
  1511. outerCache = node[ expando ] || (node[ expando ] = {});
  1512. // Support: IE <9 only
  1513. // Defend against cloned attroperties (jQuery gh-1709)
  1514. uniqueCache = outerCache[ node.uniqueID ] ||
  1515. (outerCache[ node.uniqueID ] = {});
  1516. cache = uniqueCache[ type ] || [];
  1517. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1518. diff = nodeIndex && cache[ 2 ];
  1519. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1520. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1521. // Fallback to seeking `elem` from the start
  1522. (diff = nodeIndex = 0) || start.pop()) ) {
  1523. // When found, cache indexes on `parent` and break
  1524. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1525. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1526. break;
  1527. }
  1528. }
  1529. } else {
  1530. // Use previously-cached element index if available
  1531. if ( useCache ) {
  1532. // ...in a gzip-friendly way
  1533. node = elem;
  1534. outerCache = node[ expando ] || (node[ expando ] = {});
  1535. // Support: IE <9 only
  1536. // Defend against cloned attroperties (jQuery gh-1709)
  1537. uniqueCache = outerCache[ node.uniqueID ] ||
  1538. (outerCache[ node.uniqueID ] = {});
  1539. cache = uniqueCache[ type ] || [];
  1540. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1541. diff = nodeIndex;
  1542. }
  1543. // xml :nth-child(...)
  1544. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1545. if ( diff === false ) {
  1546. // Use the same loop as above to seek `elem` from the start
  1547. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1548. (diff = nodeIndex = 0) || start.pop()) ) {
  1549. if ( ( ofType ?
  1550. node.nodeName.toLowerCase() === name :
  1551. node.nodeType === 1 ) &&
  1552. ++diff ) {
  1553. // Cache the index of each encountered element
  1554. if ( useCache ) {
  1555. outerCache = node[ expando ] || (node[ expando ] = {});
  1556. // Support: IE <9 only
  1557. // Defend against cloned attroperties (jQuery gh-1709)
  1558. uniqueCache = outerCache[ node.uniqueID ] ||
  1559. (outerCache[ node.uniqueID ] = {});
  1560. uniqueCache[ type ] = [ dirruns, diff ];
  1561. }
  1562. if ( node === elem ) {
  1563. break;
  1564. }
  1565. }
  1566. }
  1567. }
  1568. }
  1569. // Incorporate the offset, then check against cycle size
  1570. diff -= last;
  1571. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1572. }
  1573. };
  1574. },
  1575. "PSEUDO": function( pseudo, argument ) {
  1576. // pseudo-class names are case-insensitive
  1577. // http://www.w3.org/TR/selectors/#pseudo-classes
  1578. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1579. // Remember that setFilters inherits from pseudos
  1580. var args,
  1581. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1582. Sizzle.error( "unsupported pseudo: " + pseudo );
  1583. // The user may use createPseudo to indicate that
  1584. // arguments are needed to create the filter function
  1585. // just as Sizzle does
  1586. if ( fn[ expando ] ) {
  1587. return fn( argument );
  1588. }
  1589. // But maintain support for old signatures
  1590. if ( fn.length > 1 ) {
  1591. args = [ pseudo, pseudo, "", argument ];
  1592. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1593. markFunction(function( seed, matches ) {
  1594. var idx,
  1595. matched = fn( seed, argument ),
  1596. i = matched.length;
  1597. while ( i-- ) {
  1598. idx = indexOf( seed, matched[i] );
  1599. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1600. }
  1601. }) :
  1602. function( elem ) {
  1603. return fn( elem, 0, args );
  1604. };
  1605. }
  1606. return fn;
  1607. }
  1608. },
  1609. pseudos: {
  1610. // Potentially complex pseudos
  1611. "not": markFunction(function( selector ) {
  1612. // Trim the selector passed to compile
  1613. // to avoid treating leading and trailing
  1614. // spaces as combinators
  1615. var input = [],
  1616. results = [],
  1617. matcher = compile( selector.replace( rtrim, "$1" ) );
  1618. return matcher[ expando ] ?
  1619. markFunction(function( seed, matches, context, xml ) {
  1620. var elem,
  1621. unmatched = matcher( seed, null, xml, [] ),
  1622. i = seed.length;
  1623. // Match elements unmatched by `matcher`
  1624. while ( i-- ) {
  1625. if ( (elem = unmatched[i]) ) {
  1626. seed[i] = !(matches[i] = elem);
  1627. }
  1628. }
  1629. }) :
  1630. function( elem, context, xml ) {
  1631. input[0] = elem;
  1632. matcher( input, null, xml, results );
  1633. // Don't keep the element (issue #299)
  1634. input[0] = null;
  1635. return !results.pop();
  1636. };
  1637. }),
  1638. "has": markFunction(function( selector ) {
  1639. return function( elem ) {
  1640. return Sizzle( selector, elem ).length > 0;
  1641. };
  1642. }),
  1643. "contains": markFunction(function( text ) {
  1644. text = text.replace( runescape, funescape );
  1645. return function( elem ) {
  1646. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1647. };
  1648. }),
  1649. // "Whether an element is represented by a :lang() selector
  1650. // is based solely on the element's language value
  1651. // being equal to the identifier C,
  1652. // or beginning with the identifier C immediately followed by "-".
  1653. // The matching of C against the element's language value is performed case-insensitively.
  1654. // The identifier C does not have to be a valid language name."
  1655. // http://www.w3.org/TR/selectors/#lang-pseudo
  1656. "lang": markFunction( function( lang ) {
  1657. // lang value must be a valid identifier
  1658. if ( !ridentifier.test(lang || "") ) {
  1659. Sizzle.error( "unsupported lang: " + lang );
  1660. }
  1661. lang = lang.replace( runescape, funescape ).toLowerCase();
  1662. return function( elem ) {
  1663. var elemLang;
  1664. do {
  1665. if ( (elemLang = documentIsHTML ?
  1666. elem.lang :
  1667. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1668. elemLang = elemLang.toLowerCase();
  1669. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1670. }
  1671. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1672. return false;
  1673. };
  1674. }),
  1675. // Miscellaneous
  1676. "target": function( elem ) {
  1677. var hash = window.location && window.location.hash;
  1678. return hash && hash.slice( 1 ) === elem.id;
  1679. },
  1680. "root": function( elem ) {
  1681. return elem === docElem;
  1682. },
  1683. "focus": function( elem ) {
  1684. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1685. },
  1686. // Boolean properties
  1687. "enabled": createDisabledPseudo( false ),
  1688. "disabled": createDisabledPseudo( true ),
  1689. "checked": function( elem ) {
  1690. // In CSS3, :checked should return both checked and selected elements
  1691. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1692. var nodeName = elem.nodeName.toLowerCase();
  1693. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1694. },
  1695. "selected": function( elem ) {
  1696. // Accessing this property makes selected-by-default
  1697. // options in Safari work properly
  1698. if ( elem.parentNode ) {
  1699. elem.parentNode.selectedIndex;
  1700. }
  1701. return elem.selected === true;
  1702. },
  1703. // Contents
  1704. "empty": function( elem ) {
  1705. // http://www.w3.org/TR/selectors/#empty-pseudo
  1706. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1707. // but not by others (comment: 8; processing instruction: 7; etc.)
  1708. // nodeType < 6 works because attributes (2) do not appear as children
  1709. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1710. if ( elem.nodeType < 6 ) {
  1711. return false;
  1712. }
  1713. }
  1714. return true;
  1715. },
  1716. "parent": function( elem ) {
  1717. return !Expr.pseudos["empty"]( elem );
  1718. },
  1719. // Element/input types
  1720. "header": function( elem ) {
  1721. return rheader.test( elem.nodeName );
  1722. },
  1723. "input": function( elem ) {
  1724. return rinputs.test( elem.nodeName );
  1725. },
  1726. "button": function( elem ) {
  1727. var name = elem.nodeName.toLowerCase();
  1728. return name === "input" && elem.type === "button" || name === "button";
  1729. },
  1730. "text": function( elem ) {
  1731. var attr;
  1732. return elem.nodeName.toLowerCase() === "input" &&
  1733. elem.type === "text" &&
  1734. // Support: IE<8
  1735. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1736. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1737. },
  1738. // Position-in-collection
  1739. "first": createPositionalPseudo(function() {
  1740. return [ 0 ];
  1741. }),
  1742. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1743. return [ length - 1 ];
  1744. }),
  1745. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1746. return [ argument < 0 ? argument + length : argument ];
  1747. }),
  1748. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1749. var i = 0;
  1750. for ( ; i < length; i += 2 ) {
  1751. matchIndexes.push( i );
  1752. }
  1753. return matchIndexes;
  1754. }),
  1755. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1756. var i = 1;
  1757. for ( ; i < length; i += 2 ) {
  1758. matchIndexes.push( i );
  1759. }
  1760. return matchIndexes;
  1761. }),
  1762. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1763. var i = argument < 0 ? argument + length : argument;
  1764. for ( ; --i >= 0; ) {
  1765. matchIndexes.push( i );
  1766. }
  1767. return matchIndexes;
  1768. }),
  1769. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1770. var i = argument < 0 ? argument + length : argument;
  1771. for ( ; ++i < length; ) {
  1772. matchIndexes.push( i );
  1773. }
  1774. return matchIndexes;
  1775. })
  1776. }
  1777. };
  1778. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1779. // Add button/input type pseudos
  1780. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1781. Expr.pseudos[ i ] = createInputPseudo( i );
  1782. }
  1783. for ( i in { submit: true, reset: true } ) {
  1784. Expr.pseudos[ i ] = createButtonPseudo( i );
  1785. }
  1786. // Easy API for creating new setFilters
  1787. function setFilters() {}
  1788. setFilters.prototype = Expr.filters = Expr.pseudos;
  1789. Expr.setFilters = new setFilters();
  1790. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1791. var matched, match, tokens, type,
  1792. soFar, groups, preFilters,
  1793. cached = tokenCache[ selector + " " ];
  1794. if ( cached ) {
  1795. return parseOnly ? 0 : cached.slice( 0 );
  1796. }
  1797. soFar = selector;
  1798. groups = [];
  1799. preFilters = Expr.preFilter;
  1800. while ( soFar ) {
  1801. // Comma and first run
  1802. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1803. if ( match ) {
  1804. // Don't consume trailing commas as valid
  1805. soFar = soFar.slice( match[0].length ) || soFar;
  1806. }
  1807. groups.push( (tokens = []) );
  1808. }
  1809. matched = false;
  1810. // Combinators
  1811. if ( (match = rcombinators.exec( soFar )) ) {
  1812. matched = match.shift();
  1813. tokens.push({
  1814. value: matched,
  1815. // Cast descendant combinators to space
  1816. type: match[0].replace( rtrim, " " )
  1817. });
  1818. soFar = soFar.slice( matched.length );
  1819. }
  1820. // Filters
  1821. for ( type in Expr.filter ) {
  1822. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1823. (match = preFilters[ type ]( match ))) ) {
  1824. matched = match.shift();
  1825. tokens.push({
  1826. value: matched,
  1827. type: type,
  1828. matches: match
  1829. });
  1830. soFar = soFar.slice( matched.length );
  1831. }
  1832. }
  1833. if ( !matched ) {
  1834. break;
  1835. }
  1836. }
  1837. // Return the length of the invalid excess
  1838. // if we're just parsing
  1839. // Otherwise, throw an error or return tokens
  1840. return parseOnly ?
  1841. soFar.length :
  1842. soFar ?
  1843. Sizzle.error( selector ) :
  1844. // Cache the tokens
  1845. tokenCache( selector, groups ).slice( 0 );
  1846. };
  1847. function toSelector( tokens ) {
  1848. var i = 0,
  1849. len = tokens.length,
  1850. selector = "";
  1851. for ( ; i < len; i++ ) {
  1852. selector += tokens[i].value;
  1853. }
  1854. return selector;
  1855. }
  1856. function addCombinator( matcher, combinator, base ) {
  1857. var dir = combinator.dir,
  1858. skip = combinator.next,
  1859. key = skip || dir,
  1860. checkNonElements = base && key === "parentNode",
  1861. doneName = done++;
  1862. return combinator.first ?
  1863. // Check against closest ancestor/preceding element
  1864. function( elem, context, xml ) {
  1865. while ( (elem = elem[ dir ]) ) {
  1866. if ( elem.nodeType === 1 || checkNonElements ) {
  1867. return matcher( elem, context, xml );
  1868. }
  1869. }
  1870. return false;
  1871. } :
  1872. // Check against all ancestor/preceding elements
  1873. function( elem, context, xml ) {
  1874. var oldCache, uniqueCache, outerCache,
  1875. newCache = [ dirruns, doneName ];
  1876. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1877. if ( xml ) {
  1878. while ( (elem = elem[ dir ]) ) {
  1879. if ( elem.nodeType === 1 || checkNonElements ) {
  1880. if ( matcher( elem, context, xml ) ) {
  1881. return true;
  1882. }
  1883. }
  1884. }
  1885. } else {
  1886. while ( (elem = elem[ dir ]) ) {
  1887. if ( elem.nodeType === 1 || checkNonElements ) {
  1888. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1889. // Support: IE <9 only
  1890. // Defend against cloned attroperties (jQuery gh-1709)
  1891. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1892. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  1893. elem = elem[ dir ] || elem;
  1894. } else if ( (oldCache = uniqueCache[ key ]) &&
  1895. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1896. // Assign to newCache so results back-propagate to previous elements
  1897. return (newCache[ 2 ] = oldCache[ 2 ]);
  1898. } else {
  1899. // Reuse newcache so results back-propagate to previous elements
  1900. uniqueCache[ key ] = newCache;
  1901. // A match means we're done; a fail means we have to keep checking
  1902. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1903. return true;
  1904. }
  1905. }
  1906. }
  1907. }
  1908. }
  1909. return false;
  1910. };
  1911. }
  1912. function elementMatcher( matchers ) {
  1913. return matchers.length > 1 ?
  1914. function( elem, context, xml ) {
  1915. var i = matchers.length;
  1916. while ( i-- ) {
  1917. if ( !matchers[i]( elem, context, xml ) ) {
  1918. return false;
  1919. }
  1920. }
  1921. return true;
  1922. } :
  1923. matchers[0];
  1924. }
  1925. function multipleContexts( selector, contexts, results ) {
  1926. var i = 0,
  1927. len = contexts.length;
  1928. for ( ; i < len; i++ ) {
  1929. Sizzle( selector, contexts[i], results );
  1930. }
  1931. return results;
  1932. }
  1933. function condense( unmatched, map, filter, context, xml ) {
  1934. var elem,
  1935. newUnmatched = [],
  1936. i = 0,
  1937. len = unmatched.length,
  1938. mapped = map != null;
  1939. for ( ; i < len; i++ ) {
  1940. if ( (elem = unmatched[i]) ) {
  1941. if ( !filter || filter( elem, context, xml ) ) {
  1942. newUnmatched.push( elem );
  1943. if ( mapped ) {
  1944. map.push( i );
  1945. }
  1946. }
  1947. }
  1948. }
  1949. return newUnmatched;
  1950. }
  1951. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1952. if ( postFilter && !postFilter[ expando ] ) {
  1953. postFilter = setMatcher( postFilter );
  1954. }
  1955. if ( postFinder && !postFinder[ expando ] ) {
  1956. postFinder = setMatcher( postFinder, postSelector );
  1957. }
  1958. return markFunction(function( seed, results, context, xml ) {
  1959. var temp, i, elem,
  1960. preMap = [],
  1961. postMap = [],
  1962. preexisting = results.length,
  1963. // Get initial elements from seed or context
  1964. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1965. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1966. matcherIn = preFilter && ( seed || !selector ) ?
  1967. condense( elems, preMap, preFilter, context, xml ) :
  1968. elems,
  1969. matcherOut = matcher ?
  1970. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1971. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1972. // ...intermediate processing is necessary
  1973. [] :
  1974. // ...otherwise use results directly
  1975. results :
  1976. matcherIn;
  1977. // Find primary matches
  1978. if ( matcher ) {
  1979. matcher( matcherIn, matcherOut, context, xml );
  1980. }
  1981. // Apply postFilter
  1982. if ( postFilter ) {
  1983. temp = condense( matcherOut, postMap );
  1984. postFilter( temp, [], context, xml );
  1985. // Un-match failing elements by moving them back to matcherIn
  1986. i = temp.length;
  1987. while ( i-- ) {
  1988. if ( (elem = temp[i]) ) {
  1989. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1990. }
  1991. }
  1992. }
  1993. if ( seed ) {
  1994. if ( postFinder || preFilter ) {
  1995. if ( postFinder ) {
  1996. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1997. temp = [];
  1998. i = matcherOut.length;
  1999. while ( i-- ) {
  2000. if ( (elem = matcherOut[i]) ) {
  2001. // Restore matcherIn since elem is not yet a final match
  2002. temp.push( (matcherIn[i] = elem) );
  2003. }
  2004. }
  2005. postFinder( null, (matcherOut = []), temp, xml );
  2006. }
  2007. // Move matched elements from seed to results to keep them synchronized
  2008. i = matcherOut.length;
  2009. while ( i-- ) {
  2010. if ( (elem = matcherOut[i]) &&
  2011. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  2012. seed[temp] = !(results[temp] = elem);
  2013. }
  2014. }
  2015. }
  2016. // Add elements to results, through postFinder if defined
  2017. } else {
  2018. matcherOut = condense(
  2019. matcherOut === results ?
  2020. matcherOut.splice( preexisting, matcherOut.length ) :
  2021. matcherOut
  2022. );
  2023. if ( postFinder ) {
  2024. postFinder( null, results, matcherOut, xml );
  2025. } else {
  2026. push.apply( results, matcherOut );
  2027. }
  2028. }
  2029. });
  2030. }
  2031. function matcherFromTokens( tokens ) {
  2032. var checkContext, matcher, j,
  2033. len = tokens.length,
  2034. leadingRelative = Expr.relative[ tokens[0].type ],
  2035. implicitRelative = leadingRelative || Expr.relative[" "],
  2036. i = leadingRelative ? 1 : 0,
  2037. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2038. matchContext = addCombinator( function( elem ) {
  2039. return elem === checkContext;
  2040. }, implicitRelative, true ),
  2041. matchAnyContext = addCombinator( function( elem ) {
  2042. return indexOf( checkContext, elem ) > -1;
  2043. }, implicitRelative, true ),
  2044. matchers = [ function( elem, context, xml ) {
  2045. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2046. (checkContext = context).nodeType ?
  2047. matchContext( elem, context, xml ) :
  2048. matchAnyContext( elem, context, xml ) );
  2049. // Avoid hanging onto element (issue #299)
  2050. checkContext = null;
  2051. return ret;
  2052. } ];
  2053. for ( ; i < len; i++ ) {
  2054. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2055. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2056. } else {
  2057. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2058. // Return special upon seeing a positional matcher
  2059. if ( matcher[ expando ] ) {
  2060. // Find the next relative operator (if any) for proper handling
  2061. j = ++i;
  2062. for ( ; j < len; j++ ) {
  2063. if ( Expr.relative[ tokens[j].type ] ) {
  2064. break;
  2065. }
  2066. }
  2067. return setMatcher(
  2068. i > 1 && elementMatcher( matchers ),
  2069. i > 1 && toSelector(
  2070. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2071. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2072. ).replace( rtrim, "$1" ),
  2073. matcher,
  2074. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2075. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2076. j < len && toSelector( tokens )
  2077. );
  2078. }
  2079. matchers.push( matcher );
  2080. }
  2081. }
  2082. return elementMatcher( matchers );
  2083. }
  2084. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2085. var bySet = setMatchers.length > 0,
  2086. byElement = elementMatchers.length > 0,
  2087. superMatcher = function( seed, context, xml, results, outermost ) {
  2088. var elem, j, matcher,
  2089. matchedCount = 0,
  2090. i = "0",
  2091. unmatched = seed && [],
  2092. setMatched = [],
  2093. contextBackup = outermostContext,
  2094. // We must always have either seed elements or outermost context
  2095. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2096. // Use integer dirruns iff this is the outermost matcher
  2097. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2098. len = elems.length;
  2099. if ( outermost ) {
  2100. outermostContext = context === document || context || outermost;
  2101. }
  2102. // Add elements passing elementMatchers directly to results
  2103. // Support: IE<9, Safari
  2104. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2105. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2106. if ( byElement && elem ) {
  2107. j = 0;
  2108. if ( !context && elem.ownerDocument !== document ) {
  2109. setDocument( elem );
  2110. xml = !documentIsHTML;
  2111. }
  2112. while ( (matcher = elementMatchers[j++]) ) {
  2113. if ( matcher( elem, context || document, xml) ) {
  2114. results.push( elem );
  2115. break;
  2116. }
  2117. }
  2118. if ( outermost ) {
  2119. dirruns = dirrunsUnique;
  2120. }
  2121. }
  2122. // Track unmatched elements for set filters
  2123. if ( bySet ) {
  2124. // They will have gone through all possible matchers
  2125. if ( (elem = !matcher && elem) ) {
  2126. matchedCount--;
  2127. }
  2128. // Lengthen the array for every element, matched or not
  2129. if ( seed ) {
  2130. unmatched.push( elem );
  2131. }
  2132. }
  2133. }
  2134. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2135. // makes the latter nonnegative.
  2136. matchedCount += i;
  2137. // Apply set filters to unmatched elements
  2138. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2139. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2140. // no element matchers and no seed.
  2141. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2142. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2143. // numerically zero.
  2144. if ( bySet && i !== matchedCount ) {
  2145. j = 0;
  2146. while ( (matcher = setMatchers[j++]) ) {
  2147. matcher( unmatched, setMatched, context, xml );
  2148. }
  2149. if ( seed ) {
  2150. // Reintegrate element matches to eliminate the need for sorting
  2151. if ( matchedCount > 0 ) {
  2152. while ( i-- ) {
  2153. if ( !(unmatched[i] || setMatched[i]) ) {
  2154. setMatched[i] = pop.call( results );
  2155. }
  2156. }
  2157. }
  2158. // Discard index placeholder values to get only actual matches
  2159. setMatched = condense( setMatched );
  2160. }
  2161. // Add matches to results
  2162. push.apply( results, setMatched );
  2163. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2164. if ( outermost && !seed && setMatched.length > 0 &&
  2165. ( matchedCount + setMatchers.length ) > 1 ) {
  2166. Sizzle.uniqueSort( results );
  2167. }
  2168. }
  2169. // Override manipulation of globals by nested matchers
  2170. if ( outermost ) {
  2171. dirruns = dirrunsUnique;
  2172. outermostContext = contextBackup;
  2173. }
  2174. return unmatched;
  2175. };
  2176. return bySet ?
  2177. markFunction( superMatcher ) :
  2178. superMatcher;
  2179. }
  2180. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2181. var i,
  2182. setMatchers = [],
  2183. elementMatchers = [],
  2184. cached = compilerCache[ selector + " " ];
  2185. if ( !cached ) {
  2186. // Generate a function of recursive functions that can be used to check each element
  2187. if ( !match ) {
  2188. match = tokenize( selector );
  2189. }
  2190. i = match.length;
  2191. while ( i-- ) {
  2192. cached = matcherFromTokens( match[i] );
  2193. if ( cached[ expando ] ) {
  2194. setMatchers.push( cached );
  2195. } else {
  2196. elementMatchers.push( cached );
  2197. }
  2198. }
  2199. // Cache the compiled function
  2200. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2201. // Save selector and tokenization
  2202. cached.selector = selector;
  2203. }
  2204. return cached;
  2205. };
  2206. /**
  2207. * A low-level selection function that works with Sizzle's compiled
  2208. * selector functions
  2209. * @param {String|Function} selector A selector or a pre-compiled
  2210. * selector function built with Sizzle.compile
  2211. * @param {Element} context
  2212. * @param {Array} [results]
  2213. * @param {Array} [seed] A set of elements to match against
  2214. */
  2215. select = Sizzle.select = function( selector, context, results, seed ) {
  2216. var i, tokens, token, type, find,
  2217. compiled = typeof selector === "function" && selector,
  2218. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2219. results = results || [];
  2220. // Try to minimize operations if there is only one selector in the list and no seed
  2221. // (the latter of which guarantees us context)
  2222. if ( match.length === 1 ) {
  2223. // Reduce context if the leading compound selector is an ID
  2224. tokens = match[0] = match[0].slice( 0 );
  2225. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2226. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  2227. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2228. if ( !context ) {
  2229. return results;
  2230. // Precompiled matchers will still verify ancestry, so step up a level
  2231. } else if ( compiled ) {
  2232. context = context.parentNode;
  2233. }
  2234. selector = selector.slice( tokens.shift().value.length );
  2235. }
  2236. // Fetch a seed set for right-to-left matching
  2237. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2238. while ( i-- ) {
  2239. token = tokens[i];
  2240. // Abort if we hit a combinator
  2241. if ( Expr.relative[ (type = token.type) ] ) {
  2242. break;
  2243. }
  2244. if ( (find = Expr.find[ type ]) ) {
  2245. // Search, expanding context for leading sibling combinators
  2246. if ( (seed = find(
  2247. token.matches[0].replace( runescape, funescape ),
  2248. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2249. )) ) {
  2250. // If seed is empty or no tokens remain, we can return early
  2251. tokens.splice( i, 1 );
  2252. selector = seed.length && toSelector( tokens );
  2253. if ( !selector ) {
  2254. push.apply( results, seed );
  2255. return results;
  2256. }
  2257. break;
  2258. }
  2259. }
  2260. }
  2261. }
  2262. // Compile and execute a filtering function if one is not provided
  2263. // Provide `match` to avoid retokenization if we modified the selector above
  2264. ( compiled || compile( selector, match ) )(
  2265. seed,
  2266. context,
  2267. !documentIsHTML,
  2268. results,
  2269. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2270. );
  2271. return results;
  2272. };
  2273. // One-time assignments
  2274. // Sort stability
  2275. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2276. // Support: Chrome 14-35+
  2277. // Always assume duplicates if they aren't passed to the comparison function
  2278. support.detectDuplicates = !!hasDuplicate;
  2279. // Initialize against the default document
  2280. setDocument();
  2281. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2282. // Detached nodes confoundingly follow *each other*
  2283. support.sortDetached = assert(function( el ) {
  2284. // Should return 1, but returns 4 (following)
  2285. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  2286. });
  2287. // Support: IE<8
  2288. // Prevent attribute/property "interpolation"
  2289. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2290. if ( !assert(function( el ) {
  2291. el.innerHTML = "<a href='#'></a>";
  2292. return el.firstChild.getAttribute("href") === "#" ;
  2293. }) ) {
  2294. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2295. if ( !isXML ) {
  2296. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2297. }
  2298. });
  2299. }
  2300. // Support: IE<9
  2301. // Use defaultValue in place of getAttribute("value")
  2302. if ( !support.attributes || !assert(function( el ) {
  2303. el.innerHTML = "<input/>";
  2304. el.firstChild.setAttribute( "value", "" );
  2305. return el.firstChild.getAttribute( "value" ) === "";
  2306. }) ) {
  2307. addHandle( "value", function( elem, name, isXML ) {
  2308. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2309. return elem.defaultValue;
  2310. }
  2311. });
  2312. }
  2313. // Support: IE<9
  2314. // Use getAttributeNode to fetch booleans when getAttribute lies
  2315. if ( !assert(function( el ) {
  2316. return el.getAttribute("disabled") == null;
  2317. }) ) {
  2318. addHandle( booleans, function( elem, name, isXML ) {
  2319. var val;
  2320. if ( !isXML ) {
  2321. return elem[ name ] === true ? name.toLowerCase() :
  2322. (val = elem.getAttributeNode( name )) && val.specified ?
  2323. val.value :
  2324. null;
  2325. }
  2326. });
  2327. }
  2328. return Sizzle;
  2329. })( window );
  2330. jQuery.find = Sizzle;
  2331. jQuery.expr = Sizzle.selectors;
  2332. // Deprecated
  2333. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2334. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2335. jQuery.text = Sizzle.getText;
  2336. jQuery.isXMLDoc = Sizzle.isXML;
  2337. jQuery.contains = Sizzle.contains;
  2338. jQuery.escapeSelector = Sizzle.escape;
  2339. var dir = function( elem, dir, until ) {
  2340. var matched = [],
  2341. truncate = until !== undefined;
  2342. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2343. if ( elem.nodeType === 1 ) {
  2344. if ( truncate && jQuery( elem ).is( until ) ) {
  2345. break;
  2346. }
  2347. matched.push( elem );
  2348. }
  2349. }
  2350. return matched;
  2351. };
  2352. var siblings = function( n, elem ) {
  2353. var matched = [];
  2354. for ( ; n; n = n.nextSibling ) {
  2355. if ( n.nodeType === 1 && n !== elem ) {
  2356. matched.push( n );
  2357. }
  2358. }
  2359. return matched;
  2360. };
  2361. var rneedsContext = jQuery.expr.match.needsContext;
  2362. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2363. var risSimple = /^.[^:#\[\.,]*$/;
  2364. // Implement the identical functionality for filter and not
  2365. function winnow( elements, qualifier, not ) {
  2366. if ( jQuery.isFunction( qualifier ) ) {
  2367. return jQuery.grep( elements, function( elem, i ) {
  2368. return !!qualifier.call( elem, i, elem ) !== not;
  2369. } );
  2370. }
  2371. // Single element
  2372. if ( qualifier.nodeType ) {
  2373. return jQuery.grep( elements, function( elem ) {
  2374. return ( elem === qualifier ) !== not;
  2375. } );
  2376. }
  2377. // Arraylike of elements (jQuery, arguments, Array)
  2378. if ( typeof qualifier !== "string" ) {
  2379. return jQuery.grep( elements, function( elem ) {
  2380. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2381. } );
  2382. }
  2383. // Simple selector that can be filtered directly, removing non-Elements
  2384. if ( risSimple.test( qualifier ) ) {
  2385. return jQuery.filter( qualifier, elements, not );
  2386. }
  2387. // Complex selector, compare the two sets, removing non-Elements
  2388. qualifier = jQuery.filter( qualifier, elements );
  2389. return jQuery.grep( elements, function( elem ) {
  2390. return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
  2391. } );
  2392. }
  2393. jQuery.filter = function( expr, elems, not ) {
  2394. var elem = elems[ 0 ];
  2395. if ( not ) {
  2396. expr = ":not(" + expr + ")";
  2397. }
  2398. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2399. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2400. }
  2401. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2402. return elem.nodeType === 1;
  2403. } ) );
  2404. };
  2405. jQuery.fn.extend( {
  2406. find: function( selector ) {
  2407. var i, ret,
  2408. len = this.length,
  2409. self = this;
  2410. if ( typeof selector !== "string" ) {
  2411. return this.pushStack( jQuery( selector ).filter( function() {
  2412. for ( i = 0; i < len; i++ ) {
  2413. if ( jQuery.contains( self[ i ], this ) ) {
  2414. return true;
  2415. }
  2416. }
  2417. } ) );
  2418. }
  2419. ret = this.pushStack( [] );
  2420. for ( i = 0; i < len; i++ ) {
  2421. jQuery.find( selector, self[ i ], ret );
  2422. }
  2423. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2424. },
  2425. filter: function( selector ) {
  2426. return this.pushStack( winnow( this, selector || [], false ) );
  2427. },
  2428. not: function( selector ) {
  2429. return this.pushStack( winnow( this, selector || [], true ) );
  2430. },
  2431. is: function( selector ) {
  2432. return !!winnow(
  2433. this,
  2434. // If this is a positional/relative selector, check membership in the returned set
  2435. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2436. typeof selector === "string" && rneedsContext.test( selector ) ?
  2437. jQuery( selector ) :
  2438. selector || [],
  2439. false
  2440. ).length;
  2441. }
  2442. } );
  2443. // Initialize a jQuery object
  2444. // A central reference to the root jQuery(document)
  2445. var rootjQuery,
  2446. // A simple way to check for HTML strings
  2447. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2448. // Strict HTML recognition (#11290: must start with <)
  2449. // Shortcut simple #id case for speed
  2450. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2451. init = jQuery.fn.init = function( selector, context, root ) {
  2452. var match, elem;
  2453. // HANDLE: $(""), $(null), $(undefined), $(false)
  2454. if ( !selector ) {
  2455. return this;
  2456. }
  2457. // Method init() accepts an alternate rootjQuery
  2458. // so migrate can support jQuery.sub (gh-2101)
  2459. root = root || rootjQuery;
  2460. // Handle HTML strings
  2461. if ( typeof selector === "string" ) {
  2462. if ( selector[ 0 ] === "<" &&
  2463. selector[ selector.length - 1 ] === ">" &&
  2464. selector.length >= 3 ) {
  2465. // Assume that strings that start and end with <> are HTML and skip the regex check
  2466. match = [ null, selector, null ];
  2467. } else {
  2468. match = rquickExpr.exec( selector );
  2469. }
  2470. // Match html or make sure no context is specified for #id
  2471. if ( match && ( match[ 1 ] || !context ) ) {
  2472. // HANDLE: $(html) -> $(array)
  2473. if ( match[ 1 ] ) {
  2474. context = context instanceof jQuery ? context[ 0 ] : context;
  2475. // Option to run scripts is true for back-compat
  2476. // Intentionally let the error be thrown if parseHTML is not present
  2477. jQuery.merge( this, jQuery.parseHTML(
  2478. match[ 1 ],
  2479. context && context.nodeType ? context.ownerDocument || context : document,
  2480. true
  2481. ) );
  2482. // HANDLE: $(html, props)
  2483. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2484. for ( match in context ) {
  2485. // Properties of context are called as methods if possible
  2486. if ( jQuery.isFunction( this[ match ] ) ) {
  2487. this[ match ]( context[ match ] );
  2488. // ...and otherwise set as attributes
  2489. } else {
  2490. this.attr( match, context[ match ] );
  2491. }
  2492. }
  2493. }
  2494. return this;
  2495. // HANDLE: $(#id)
  2496. } else {
  2497. elem = document.getElementById( match[ 2 ] );
  2498. if ( elem ) {
  2499. // Inject the element directly into the jQuery object
  2500. this[ 0 ] = elem;
  2501. this.length = 1;
  2502. }
  2503. return this;
  2504. }
  2505. // HANDLE: $(expr, $(...))
  2506. } else if ( !context || context.jquery ) {
  2507. return ( context || root ).find( selector );
  2508. // HANDLE: $(expr, context)
  2509. // (which is just equivalent to: $(context).hujie(expr)
  2510. } else {
  2511. return this.constructor( context ).find( selector );
  2512. }
  2513. // HANDLE: $(DOMElement)
  2514. } else if ( selector.nodeType ) {
  2515. this[ 0 ] = selector;
  2516. this.length = 1;
  2517. return this;
  2518. // HANDLE: $(function)
  2519. // Shortcut for document ready
  2520. } else if ( jQuery.isFunction( selector ) ) {
  2521. return root.ready !== undefined ?
  2522. root.ready( selector ) :
  2523. // Execute immediately if ready is not present
  2524. selector( jQuery );
  2525. }
  2526. return jQuery.makeArray( selector, this );
  2527. };
  2528. // Give the init function the jQuery prototype for later instantiation
  2529. init.prototype = jQuery.fn;
  2530. // Initialize central reference
  2531. rootjQuery = jQuery( document );
  2532. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2533. // Methods guaranteed to produce a unique set when starting from a unique set
  2534. guaranteedUnique = {
  2535. children: true,
  2536. contents: true,
  2537. next: true,
  2538. prev: true
  2539. };
  2540. jQuery.fn.extend( {
  2541. has: function( target ) {
  2542. var targets = jQuery( target, this ),
  2543. l = targets.length;
  2544. return this.filter( function() {
  2545. var i = 0;
  2546. for ( ; i < l; i++ ) {
  2547. if ( jQuery.contains( this, targets[ i ] ) ) {
  2548. return true;
  2549. }
  2550. }
  2551. } );
  2552. },
  2553. closest: function( selectors, context ) {
  2554. var cur,
  2555. i = 0,
  2556. l = this.length,
  2557. matched = [],
  2558. targets = typeof selectors !== "string" && jQuery( selectors );
  2559. // Positional selectors never match, since there's no _selection_ context
  2560. if ( !rneedsContext.test( selectors ) ) {
  2561. for ( ; i < l; i++ ) {
  2562. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2563. // Always skip document fragments
  2564. if ( cur.nodeType < 11 && ( targets ?
  2565. targets.index( cur ) > -1 :
  2566. // Don't pass non-elements to Sizzle
  2567. cur.nodeType === 1 &&
  2568. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2569. matched.push( cur );
  2570. break;
  2571. }
  2572. }
  2573. }
  2574. }
  2575. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2576. },
  2577. // Determine the position of an element within the set
  2578. index: function( elem ) {
  2579. // No argument, return index in parent
  2580. if ( !elem ) {
  2581. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2582. }
  2583. // Index in selector
  2584. if ( typeof elem === "string" ) {
  2585. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2586. }
  2587. // Locate the position of the desired element
  2588. return indexOf.call( this,
  2589. // If it receives a jQuery object, the first element is used
  2590. elem.jquery ? elem[ 0 ] : elem
  2591. );
  2592. },
  2593. add: function( selector, context ) {
  2594. return this.pushStack(
  2595. jQuery.uniqueSort(
  2596. jQuery.merge( this.get(), jQuery( selector, context ) )
  2597. )
  2598. );
  2599. },
  2600. addBack: function( selector ) {
  2601. return this.add( selector == null ?
  2602. this.prevObject : this.prevObject.filter( selector )
  2603. );
  2604. }
  2605. } );
  2606. function sibling( cur, dir ) {
  2607. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  2608. return cur;
  2609. }
  2610. jQuery.each( {
  2611. parent: function( elem ) {
  2612. var parent = elem.parentNode;
  2613. return parent && parent.nodeType !== 11 ? parent : null;
  2614. },
  2615. parents: function( elem ) {
  2616. return dir( elem, "parentNode" );
  2617. },
  2618. parentsUntil: function( elem, i, until ) {
  2619. return dir( elem, "parentNode", until );
  2620. },
  2621. next: function( elem ) {
  2622. return sibling( elem, "nextSibling" );
  2623. },
  2624. prev: function( elem ) {
  2625. return sibling( elem, "previousSibling" );
  2626. },
  2627. nextAll: function( elem ) {
  2628. return dir( elem, "nextSibling" );
  2629. },
  2630. prevAll: function( elem ) {
  2631. return dir( elem, "previousSibling" );
  2632. },
  2633. nextUntil: function( elem, i, until ) {
  2634. return dir( elem, "nextSibling", until );
  2635. },
  2636. prevUntil: function( elem, i, until ) {
  2637. return dir( elem, "previousSibling", until );
  2638. },
  2639. siblings: function( elem ) {
  2640. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2641. },
  2642. children: function( elem ) {
  2643. return siblings( elem.firstChild );
  2644. },
  2645. contents: function( elem ) {
  2646. return elem.contentDocument || jQuery.merge( [], elem.childNodes );
  2647. }
  2648. }, function( name, fn ) {
  2649. jQuery.fn[ name ] = function( until, selector ) {
  2650. var matched = jQuery.map( this, fn, until );
  2651. if ( name.slice( -5 ) !== "Until" ) {
  2652. selector = until;
  2653. }
  2654. if ( selector && typeof selector === "string" ) {
  2655. matched = jQuery.filter( selector, matched );
  2656. }
  2657. if ( this.length > 1 ) {
  2658. // Remove duplicates
  2659. if ( !guaranteedUnique[ name ] ) {
  2660. jQuery.uniqueSort( matched );
  2661. }
  2662. // Reverse custom for parents* and prev-derivatives
  2663. if ( rparentsprev.test( name ) ) {
  2664. matched.reverse();
  2665. }
  2666. }
  2667. return this.pushStack( matched );
  2668. };
  2669. } );
  2670. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  2671. // Convert String-formatted options into Object-formatted ones
  2672. function createOptions( options ) {
  2673. var object = {};
  2674. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  2675. object[ flag ] = true;
  2676. } );
  2677. return object;
  2678. }
  2679. /*
  2680. * Create a callback list using the following parameters:
  2681. *
  2682. * options: an optional list of space-separated options that will change how
  2683. * the callback list behaves or a more traditional option object
  2684. *
  2685. * By default a callback list will act like an event callback list and can be
  2686. * "fired" multiple times.
  2687. *
  2688. * Possible options:
  2689. *
  2690. * once: will ensure the callback list can only be fired once (like a Deferred)
  2691. *
  2692. * memory: will keep track of previous values and will call any callback added
  2693. * after the list has been fired right away with the latest "memorized"
  2694. * values (like a Deferred)
  2695. *
  2696. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2697. *
  2698. * stopOnFalse: interrupt callings when a callback returns false
  2699. *
  2700. */
  2701. jQuery.Callbacks = function( options ) {
  2702. // Convert options from String-formatted to Object-formatted if needed
  2703. // (we check in cache first)
  2704. options = typeof options === "string" ?
  2705. createOptions( options ) :
  2706. jQuery.extend( {}, options );
  2707. var // Flag to know if list is currently firing
  2708. firing,
  2709. // Last fire value for non-forgettable lists
  2710. memory,
  2711. // Flag to know if list was already fired
  2712. fired,
  2713. // Flag to prevent firing
  2714. locked,
  2715. // Actual callback list
  2716. list = [],
  2717. // Queue of execution data for repeatable lists
  2718. queue = [],
  2719. // Index of currently firing callback (modified by add/remove as needed)
  2720. firingIndex = -1,
  2721. // Fire callbacks
  2722. fire = function() {
  2723. // Enforce single-firing
  2724. locked = options.once;
  2725. // Execute callbacks for all pending executions,
  2726. // respecting firingIndex overrides and runtime changes
  2727. fired = firing = true;
  2728. for ( ; queue.length; firingIndex = -1 ) {
  2729. memory = queue.shift();
  2730. while ( ++firingIndex < list.length ) {
  2731. // Run callback and check for early termination
  2732. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2733. options.stopOnFalse ) {
  2734. // Jump to end and forget the data so .add doesn't re-fire
  2735. firingIndex = list.length;
  2736. memory = false;
  2737. }
  2738. }
  2739. }
  2740. // Forget the data if we're done with it
  2741. if ( !options.memory ) {
  2742. memory = false;
  2743. }
  2744. firing = false;
  2745. // Clean up if we're done firing for good
  2746. if ( locked ) {
  2747. // Keep an empty list if we have data for future add calls
  2748. if ( memory ) {
  2749. list = [];
  2750. // Otherwise, this object is spent
  2751. } else {
  2752. list = "";
  2753. }
  2754. }
  2755. },
  2756. // Actual Callbacks object
  2757. self = {
  2758. // Add a callback or a collection of callbacks to the list
  2759. add: function() {
  2760. if ( list ) {
  2761. // If we have memory from a past run, we should fire after adding
  2762. if ( memory && !firing ) {
  2763. firingIndex = list.length - 1;
  2764. queue.push( memory );
  2765. }
  2766. ( function add( args ) {
  2767. jQuery.each( args, function( _, arg ) {
  2768. if ( jQuery.isFunction( arg ) ) {
  2769. if ( !options.unique || !self.has( arg ) ) {
  2770. list.push( arg );
  2771. }
  2772. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  2773. // Inspect recursively
  2774. add( arg );
  2775. }
  2776. } );
  2777. } )( arguments );
  2778. if ( memory && !firing ) {
  2779. fire();
  2780. }
  2781. }
  2782. return this;
  2783. },
  2784. // Remove a callback from the list
  2785. remove: function() {
  2786. jQuery.each( arguments, function( _, arg ) {
  2787. var index;
  2788. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2789. list.splice( index, 1 );
  2790. // Handle firing indexes
  2791. if ( index <= firingIndex ) {
  2792. firingIndex--;
  2793. }
  2794. }
  2795. } );
  2796. return this;
  2797. },
  2798. // Check if a given callback is in the list.
  2799. // If no argument is given, return whether or not list has callbacks attached.
  2800. has: function( fn ) {
  2801. return fn ?
  2802. jQuery.inArray( fn, list ) > -1 :
  2803. list.length > 0;
  2804. },
  2805. // Remove all callbacks from the list
  2806. empty: function() {
  2807. if ( list ) {
  2808. list = [];
  2809. }
  2810. return this;
  2811. },
  2812. // Disable .fire and .add
  2813. // Abort any current/pending executions
  2814. // Clear all callbacks and values
  2815. disable: function() {
  2816. locked = queue = [];
  2817. list = memory = "";
  2818. return this;
  2819. },
  2820. disabled: function() {
  2821. return !list;
  2822. },
  2823. // Disable .fire
  2824. // Also disable .add unless we have memory (since it would have no effect)
  2825. // Abort any pending executions
  2826. lock: function() {
  2827. locked = queue = [];
  2828. if ( !memory && !firing ) {
  2829. list = memory = "";
  2830. }
  2831. return this;
  2832. },
  2833. locked: function() {
  2834. return !!locked;
  2835. },
  2836. // Call all callbacks with the given context and arguments
  2837. fireWith: function( context, args ) {
  2838. if ( !locked ) {
  2839. args = args || [];
  2840. args = [ context, args.slice ? args.slice() : args ];
  2841. queue.push( args );
  2842. if ( !firing ) {
  2843. fire();
  2844. }
  2845. }
  2846. return this;
  2847. },
  2848. // Call all the callbacks with the given arguments
  2849. fire: function() {
  2850. self.fireWith( this, arguments );
  2851. return this;
  2852. },
  2853. // To know if the callbacks have already been called at least once
  2854. fired: function() {
  2855. return !!fired;
  2856. }
  2857. };
  2858. return self;
  2859. };
  2860. function Identity( v ) {
  2861. return v;
  2862. }
  2863. function Thrower( ex ) {
  2864. throw ex;
  2865. }
  2866. function adoptValue( value, resolve, reject ) {
  2867. var method;
  2868. try {
  2869. // Check for promise aspect first to privilege synchronous behavior
  2870. if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
  2871. method.call( value ).done( resolve ).fail( reject );
  2872. // Other thenables
  2873. } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
  2874. method.call( value, resolve, reject );
  2875. // Other non-thenables
  2876. } else {
  2877. // Support: Android 4.0 only
  2878. // Strict mode functions invoked without .call/.apply get global-object context
  2879. resolve.call( undefined, value );
  2880. }
  2881. // For Promises/A+, convert exceptions into rejections
  2882. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  2883. // Deferred#then to conditionally suppress rejection.
  2884. } catch ( value ) {
  2885. // Support: Android 4.0 only
  2886. // Strict mode functions invoked without .call/.apply get global-object context
  2887. reject.call( undefined, value );
  2888. }
  2889. }
  2890. jQuery.extend( {
  2891. Deferred: function( func ) {
  2892. var tuples = [
  2893. // action, add listener, callbacks,
  2894. // ... .then handlers, argument index, [final state]
  2895. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  2896. jQuery.Callbacks( "memory" ), 2 ],
  2897. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  2898. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  2899. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  2900. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  2901. ],
  2902. state = "pending",
  2903. promise = {
  2904. state: function() {
  2905. return state;
  2906. },
  2907. always: function() {
  2908. deferred.done( arguments ).fail( arguments );
  2909. return this;
  2910. },
  2911. "catch": function( fn ) {
  2912. return promise.then( null, fn );
  2913. },
  2914. // Keep pipe for back-compat
  2915. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  2916. var fns = arguments;
  2917. return jQuery.Deferred( function( newDefer ) {
  2918. jQuery.each( tuples, function( i, tuple ) {
  2919. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  2920. var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  2921. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  2922. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  2923. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  2924. deferred[ tuple[ 1 ] ]( function() {
  2925. var returned = fn && fn.apply( this, arguments );
  2926. if ( returned && jQuery.isFunction( returned.promise ) ) {
  2927. returned.promise()
  2928. .progress( newDefer.notify )
  2929. .done( newDefer.resolve )
  2930. .fail( newDefer.reject );
  2931. } else {
  2932. newDefer[ tuple[ 0 ] + "With" ](
  2933. this,
  2934. fn ? [ returned ] : arguments
  2935. );
  2936. }
  2937. } );
  2938. } );
  2939. fns = null;
  2940. } ).promise();
  2941. },
  2942. then: function( onFulfilled, onRejected, onProgress ) {
  2943. var maxDepth = 0;
  2944. function resolve( depth, deferred, handler, special ) {
  2945. return function() {
  2946. var that = this,
  2947. args = arguments,
  2948. mightThrow = function() {
  2949. var returned, then;
  2950. // Support: Promises/A+ section 2.3.3.3.3
  2951. // https://promisesaplus.com/#point-59
  2952. // Ignore double-resolution attempts
  2953. if ( depth < maxDepth ) {
  2954. return;
  2955. }
  2956. returned = handler.apply( that, args );
  2957. // Support: Promises/A+ section 2.3.1
  2958. // https://promisesaplus.com/#point-48
  2959. if ( returned === deferred.promise() ) {
  2960. throw new TypeError( "Thenable self-resolution" );
  2961. }
  2962. // Support: Promises/A+ sections 2.3.3.1, 3.5
  2963. // https://promisesaplus.com/#point-54
  2964. // https://promisesaplus.com/#point-75
  2965. // Retrieve `then` only once
  2966. then = returned &&
  2967. // Support: Promises/A+ section 2.3.4
  2968. // https://promisesaplus.com/#point-64
  2969. // Only check objects and functions for thenability
  2970. ( typeof returned === "object" ||
  2971. typeof returned === "function" ) &&
  2972. returned.then;
  2973. // Handle a returned thenable
  2974. if ( jQuery.isFunction( then ) ) {
  2975. // Special processors (notify) just wait for resolution
  2976. if ( special ) {
  2977. then.call(
  2978. returned,
  2979. resolve( maxDepth, deferred, Identity, special ),
  2980. resolve( maxDepth, deferred, Thrower, special )
  2981. );
  2982. // Normal processors (resolve) also hook into progress
  2983. } else {
  2984. // ...and disregard older resolution values
  2985. maxDepth++;
  2986. then.call(
  2987. returned,
  2988. resolve( maxDepth, deferred, Identity, special ),
  2989. resolve( maxDepth, deferred, Thrower, special ),
  2990. resolve( maxDepth, deferred, Identity,
  2991. deferred.notifyWith )
  2992. );
  2993. }
  2994. // Handle all other returned values
  2995. } else {
  2996. // Only substitute handlers pass on context
  2997. // and multiple values (non-spec behavior)
  2998. if ( handler !== Identity ) {
  2999. that = undefined;
  3000. args = [ returned ];
  3001. }
  3002. // Process the value(s)
  3003. // Default process is resolve
  3004. ( special || deferred.resolveWith )( that, args );
  3005. }
  3006. },
  3007. // Only normal processors (resolve) catch and reject exceptions
  3008. process = special ?
  3009. mightThrow :
  3010. function() {
  3011. try {
  3012. mightThrow();
  3013. } catch ( e ) {
  3014. if ( jQuery.Deferred.exceptionHook ) {
  3015. jQuery.Deferred.exceptionHook( e,
  3016. process.stackTrace );
  3017. }
  3018. // Support: Promises/A+ section 2.3.3.3.4.1
  3019. // https://promisesaplus.com/#point-61
  3020. // Ignore post-resolution exceptions
  3021. if ( depth + 1 >= maxDepth ) {
  3022. // Only substitute handlers pass on context
  3023. // and multiple values (non-spec behavior)
  3024. if ( handler !== Thrower ) {
  3025. that = undefined;
  3026. args = [ e ];
  3027. }
  3028. deferred.rejectWith( that, args );
  3029. }
  3030. }
  3031. };
  3032. // Support: Promises/A+ section 2.3.3.3.1
  3033. // https://promisesaplus.com/#point-57
  3034. // Re-resolve promises immediately to dodge false rejection from
  3035. // subsequent errors
  3036. if ( depth ) {
  3037. process();
  3038. } else {
  3039. // Call an optional hook to record the stack, in case of exception
  3040. // since it's otherwise lost when execution goes async
  3041. if ( jQuery.Deferred.getStackHook ) {
  3042. process.stackTrace = jQuery.Deferred.getStackHook();
  3043. }
  3044. window.setTimeout( process );
  3045. }
  3046. };
  3047. }
  3048. return jQuery.Deferred( function( newDefer ) {
  3049. // progress_handlers.add( ... )
  3050. tuples[ 0 ][ 3 ].add(
  3051. resolve(
  3052. 0,
  3053. newDefer,
  3054. jQuery.isFunction( onProgress ) ?
  3055. onProgress :
  3056. Identity,
  3057. newDefer.notifyWith
  3058. )
  3059. );
  3060. // fulfilled_handlers.add( ... )
  3061. tuples[ 1 ][ 3 ].add(
  3062. resolve(
  3063. 0,
  3064. newDefer,
  3065. jQuery.isFunction( onFulfilled ) ?
  3066. onFulfilled :
  3067. Identity
  3068. )
  3069. );
  3070. // rejected_handlers.add( ... )
  3071. tuples[ 2 ][ 3 ].add(
  3072. resolve(
  3073. 0,
  3074. newDefer,
  3075. jQuery.isFunction( onRejected ) ?
  3076. onRejected :
  3077. Thrower
  3078. )
  3079. );
  3080. } ).promise();
  3081. },
  3082. // Get a promise for this deferred
  3083. // If obj is provided, the promise aspect is added to the object
  3084. promise: function( obj ) {
  3085. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3086. }
  3087. },
  3088. deferred = {};
  3089. // Add list-specific methods
  3090. jQuery.each( tuples, function( i, tuple ) {
  3091. var list = tuple[ 2 ],
  3092. stateString = tuple[ 5 ];
  3093. // promise.progress = list.add
  3094. // promise.done = list.add
  3095. // promise.fail = list.add
  3096. promise[ tuple[ 1 ] ] = list.add;
  3097. // Handle state
  3098. if ( stateString ) {
  3099. list.add(
  3100. function() {
  3101. // state = "resolved" (i.e., fulfilled)
  3102. // state = "rejected"
  3103. state = stateString;
  3104. },
  3105. // rejected_callbacks.disable
  3106. // fulfilled_callbacks.disable
  3107. tuples[ 3 - i ][ 2 ].disable,
  3108. // progress_callbacks.lock
  3109. tuples[ 0 ][ 2 ].lock
  3110. );
  3111. }
  3112. // progress_handlers.fire
  3113. // fulfilled_handlers.fire
  3114. // rejected_handlers.fire
  3115. list.add( tuple[ 3 ].fire );
  3116. // deferred.notify = function() { deferred.notifyWith(...) }
  3117. // deferred.resolve = function() { deferred.resolveWith(...) }
  3118. // deferred.reject = function() { deferred.rejectWith(...) }
  3119. deferred[ tuple[ 0 ] ] = function() {
  3120. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3121. return this;
  3122. };
  3123. // deferred.notifyWith = list.fireWith
  3124. // deferred.resolveWith = list.fireWith
  3125. // deferred.rejectWith = list.fireWith
  3126. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3127. } );
  3128. // Make the deferred a promise
  3129. promise.promise( deferred );
  3130. // Call given func if any
  3131. if ( func ) {
  3132. func.call( deferred, deferred );
  3133. }
  3134. // All done!
  3135. return deferred;
  3136. },
  3137. // Deferred helper
  3138. when: function( singleValue ) {
  3139. var
  3140. // count of uncompleted subordinates
  3141. remaining = arguments.length,
  3142. // count of unprocessed arguments
  3143. i = remaining,
  3144. // subordinate fulfillment data
  3145. resolveContexts = Array( i ),
  3146. resolveValues = slice.call( arguments ),
  3147. // the master Deferred
  3148. master = jQuery.Deferred(),
  3149. // subordinate callback factory
  3150. updateFunc = function( i ) {
  3151. return function( value ) {
  3152. resolveContexts[ i ] = this;
  3153. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3154. if ( !( --remaining ) ) {
  3155. master.resolveWith( resolveContexts, resolveValues );
  3156. }
  3157. };
  3158. };
  3159. // Single- and empty arguments are adopted like Promise.resolve
  3160. if ( remaining <= 1 ) {
  3161. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );
  3162. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3163. if ( master.state() === "pending" ||
  3164. jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3165. return master.then();
  3166. }
  3167. }
  3168. // Multiple arguments are aggregated like Promise.all array elements
  3169. while ( i-- ) {
  3170. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3171. }
  3172. return master.promise();
  3173. }
  3174. } );
  3175. // These usually indicate a programmer mistake during development,
  3176. // warn about them ASAP rather than swallowing them by default.
  3177. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3178. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3179. // Support: IE 8 - 9 only
  3180. // Console exists when dev tools are open, which can happen at any time
  3181. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3182. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3183. }
  3184. };
  3185. jQuery.readyException = function( error ) {
  3186. window.setTimeout( function() {
  3187. throw error;
  3188. } );
  3189. };
  3190. // The deferred used on DOM ready
  3191. var readyList = jQuery.Deferred();
  3192. jQuery.fn.ready = function( fn ) {
  3193. readyList
  3194. .then( fn )
  3195. // Wrap jQuery.readyException in a function so that the lookup
  3196. // happens at the time of error handling instead of callback
  3197. // registration.
  3198. .catch( function( error ) {
  3199. jQuery.readyException( error );
  3200. } );
  3201. return this;
  3202. };
  3203. jQuery.extend( {
  3204. // Is the DOM ready to be used? Set to true once it occurs.
  3205. isReady: false,
  3206. // A counter to track how many items to wait for before
  3207. // the ready event fires. See #6781
  3208. readyWait: 1,
  3209. // Hold (or release) the ready event
  3210. holdReady: function( hold ) {
  3211. if ( hold ) {
  3212. jQuery.readyWait++;
  3213. } else {
  3214. jQuery.ready( true );
  3215. }
  3216. },
  3217. // Handle when the DOM is ready
  3218. ready: function( wait ) {
  3219. // Abort if there are pending holds or we're already ready
  3220. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3221. return;
  3222. }
  3223. // Remember that the DOM is ready
  3224. jQuery.isReady = true;
  3225. // If a normal DOM Ready event fired, decrement, and wait if need be
  3226. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3227. return;
  3228. }
  3229. // If there are functions bound, to execute
  3230. readyList.resolveWith( document, [ jQuery ] );
  3231. }
  3232. } );
  3233. jQuery.ready.then = readyList.then;
  3234. // The ready event handler and self cleanup method
  3235. function completed() {
  3236. document.removeEventListener( "DOMContentLoaded", completed );
  3237. window.removeEventListener( "load", completed );
  3238. jQuery.ready();
  3239. }
  3240. // Catch cases where $(document).ready() is called
  3241. // after the browser event has already occurred.
  3242. // Support: IE <=9 - 10 only
  3243. // Older IE sometimes signals "interactive" too soon
  3244. if ( document.readyState === "complete" ||
  3245. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3246. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3247. window.setTimeout( jQuery.ready );
  3248. } else {
  3249. // Use the handy event callback
  3250. document.addEventListener( "DOMContentLoaded", completed );
  3251. // A fallback to window.onload, that will always work
  3252. window.addEventListener( "load", completed );
  3253. }
  3254. // Multifunctional method to get and set values of a collection
  3255. // The value/s can optionally be executed if it's a function
  3256. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3257. var i = 0,
  3258. len = elems.length,
  3259. bulk = key == null;
  3260. // Sets many values
  3261. if ( jQuery.type( key ) === "object" ) {
  3262. chainable = true;
  3263. for ( i in key ) {
  3264. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3265. }
  3266. // Sets one value
  3267. } else if ( value !== undefined ) {
  3268. chainable = true;
  3269. if ( !jQuery.isFunction( value ) ) {
  3270. raw = true;
  3271. }
  3272. if ( bulk ) {
  3273. // Bulk operations run against the entire set
  3274. if ( raw ) {
  3275. fn.call( elems, value );
  3276. fn = null;
  3277. // ...except when executing function values
  3278. } else {
  3279. bulk = fn;
  3280. fn = function( elem, key, value ) {
  3281. return bulk.call( jQuery( elem ), value );
  3282. };
  3283. }
  3284. }
  3285. if ( fn ) {
  3286. for ( ; i < len; i++ ) {
  3287. fn(
  3288. elems[ i ], key, raw ?
  3289. value :
  3290. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3291. );
  3292. }
  3293. }
  3294. }
  3295. if ( chainable ) {
  3296. return elems;
  3297. }
  3298. // Gets
  3299. if ( bulk ) {
  3300. return fn.call( elems );
  3301. }
  3302. return len ? fn( elems[ 0 ], key ) : emptyGet;
  3303. };
  3304. var acceptData = function( owner ) {
  3305. // Accepts only:
  3306. // - Node
  3307. // - Node.ELEMENT_NODE
  3308. // - Node.DOCUMENT_NODE
  3309. // - Object
  3310. // - Any
  3311. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3312. };
  3313. function Data() {
  3314. this.expando = jQuery.expando + Data.uid++;
  3315. }
  3316. Data.uid = 1;
  3317. Data.prototype = {
  3318. cache: function( owner ) {
  3319. // Check if the owner object already has a cache
  3320. var value = owner[ this.expando ];
  3321. // If not, create one
  3322. if ( !value ) {
  3323. value = {};
  3324. // We can accept data for non-element nodes in modern browsers,
  3325. // but we should not, see #8335.
  3326. // Always return an empty object.
  3327. if ( acceptData( owner ) ) {
  3328. // If it is a node unlikely to be stringify-ed or looped over
  3329. // use plain assignment
  3330. if ( owner.nodeType ) {
  3331. owner[ this.expando ] = value;
  3332. // Otherwise secure it in a non-enumerable property
  3333. // configurable must be true to allow the property to be
  3334. // deleted when data is removed
  3335. } else {
  3336. Object.defineProperty( owner, this.expando, {
  3337. value: value,
  3338. configurable: true
  3339. } );
  3340. }
  3341. }
  3342. }
  3343. return value;
  3344. },
  3345. set: function( owner, data, value ) {
  3346. var prop,
  3347. cache = this.cache( owner );
  3348. // Handle: [ owner, key, value ] args
  3349. // Always use camelCase key (gh-2257)
  3350. if ( typeof data === "string" ) {
  3351. cache[ jQuery.camelCase( data ) ] = value;
  3352. // Handle: [ owner, { properties } ] args
  3353. } else {
  3354. // Copy the properties one-by-one to the cache object
  3355. for ( prop in data ) {
  3356. cache[ jQuery.camelCase( prop ) ] = data[ prop ];
  3357. }
  3358. }
  3359. return cache;
  3360. },
  3361. get: function( owner, key ) {
  3362. return key === undefined ?
  3363. this.cache( owner ) :
  3364. // Always use camelCase key (gh-2257)
  3365. owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
  3366. },
  3367. access: function( owner, key, value ) {
  3368. // In cases where either:
  3369. //
  3370. // 1. No key was specified
  3371. // 2. A string key was specified, but no value provided
  3372. //
  3373. // Take the "read" path and allow the get method to determine
  3374. // which value to return, respectively either:
  3375. //
  3376. // 1. The entire cache object
  3377. // 2. The data stored at the key
  3378. //
  3379. if ( key === undefined ||
  3380. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  3381. return this.get( owner, key );
  3382. }
  3383. // When the key is not a string, or both a key and value
  3384. // are specified, set or extend (existing objects) with either:
  3385. //
  3386. // 1. An object of properties
  3387. // 2. A key and value
  3388. //
  3389. this.set( owner, key, value );
  3390. // Since the "set" path can have two possible entry points
  3391. // return the expected data based on which path was taken[*]
  3392. return value !== undefined ? value : key;
  3393. },
  3394. remove: function( owner, key ) {
  3395. var i,
  3396. cache = owner[ this.expando ];
  3397. if ( cache === undefined ) {
  3398. return;
  3399. }
  3400. if ( key !== undefined ) {
  3401. // Support array or space separated string of keys
  3402. if ( jQuery.isArray( key ) ) {
  3403. // If key is an array of keys...
  3404. // We always set camelCase keys, so remove that.
  3405. key = key.map( jQuery.camelCase );
  3406. } else {
  3407. key = jQuery.camelCase( key );
  3408. // If a key with the spaces exists, use it.
  3409. // Otherwise, create an array by matching non-whitespace
  3410. key = key in cache ?
  3411. [ key ] :
  3412. ( key.match( rnothtmlwhite ) || [] );
  3413. }
  3414. i = key.length;
  3415. while ( i-- ) {
  3416. delete cache[ key[ i ] ];
  3417. }
  3418. }
  3419. // Remove the expando if there's no more data
  3420. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  3421. // Support: Chrome <=35 - 45
  3422. // Webkit & Blink performance suffers when deleting properties
  3423. // from DOM nodes, so set to undefined instead
  3424. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  3425. if ( owner.nodeType ) {
  3426. owner[ this.expando ] = undefined;
  3427. } else {
  3428. delete owner[ this.expando ];
  3429. }
  3430. }
  3431. },
  3432. hasData: function( owner ) {
  3433. var cache = owner[ this.expando ];
  3434. return cache !== undefined && !jQuery.isEmptyObject( cache );
  3435. }
  3436. };
  3437. var dataPriv = new Data();
  3438. var dataUser = new Data();
  3439. // Implementation Summary
  3440. //
  3441. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3442. // 2. Improve the module's maintainability by reducing the storage
  3443. // paths to a single mechanism.
  3444. // 3. Use the same single mechanism to support "private" and "user" data.
  3445. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3446. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3447. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3448. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3449. rmultiDash = /[A-Z]/g;
  3450. function getData( data ) {
  3451. if ( data === "true" ) {
  3452. return true;
  3453. }
  3454. if ( data === "false" ) {
  3455. return false;
  3456. }
  3457. if ( data === "null" ) {
  3458. return null;
  3459. }
  3460. // Only convert to a number if it doesn't change the string
  3461. if ( data === +data + "" ) {
  3462. return +data;
  3463. }
  3464. if ( rbrace.test( data ) ) {
  3465. return JSON.parse( data );
  3466. }
  3467. return data;
  3468. }
  3469. function dataAttr( elem, key, data ) {
  3470. var name;
  3471. // If nothing was found internally, try to fetch any
  3472. // data from the HTML5 data-* attribute
  3473. if ( data === undefined && elem.nodeType === 1 ) {
  3474. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  3475. data = elem.getAttribute( name );
  3476. if ( typeof data === "string" ) {
  3477. try {
  3478. data = getData( data );
  3479. } catch ( e ) {}
  3480. // Make sure we set the data so it isn't changed later
  3481. dataUser.set( elem, key, data );
  3482. } else {
  3483. data = undefined;
  3484. }
  3485. }
  3486. return data;
  3487. }
  3488. jQuery.extend( {
  3489. hasData: function( elem ) {
  3490. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  3491. },
  3492. data: function( elem, name, data ) {
  3493. return dataUser.access( elem, name, data );
  3494. },
  3495. removeData: function( elem, name ) {
  3496. dataUser.remove( elem, name );
  3497. },
  3498. // TODO: Now that all calls to _data and _removeData have been replaced
  3499. // with direct calls to dataPriv methods, these can be deprecated.
  3500. _data: function( elem, name, data ) {
  3501. return dataPriv.access( elem, name, data );
  3502. },
  3503. _removeData: function( elem, name ) {
  3504. dataPriv.remove( elem, name );
  3505. }
  3506. } );
  3507. jQuery.fn.extend( {
  3508. data: function( key, value ) {
  3509. var i, name, data,
  3510. elem = this[ 0 ],
  3511. attrs = elem && elem.attributes;
  3512. // Gets all values
  3513. if ( key === undefined ) {
  3514. if ( this.length ) {
  3515. data = dataUser.get( elem );
  3516. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  3517. i = attrs.length;
  3518. while ( i-- ) {
  3519. // Support: IE 11 only
  3520. // The attrs elements can be null (#14894)
  3521. if ( attrs[ i ] ) {
  3522. name = attrs[ i ].name;
  3523. if ( name.indexOf( "data-" ) === 0 ) {
  3524. name = jQuery.camelCase( name.slice( 5 ) );
  3525. dataAttr( elem, name, data[ name ] );
  3526. }
  3527. }
  3528. }
  3529. dataPriv.set( elem, "hasDataAttrs", true );
  3530. }
  3531. }
  3532. return data;
  3533. }
  3534. // Sets multiple values
  3535. if ( typeof key === "object" ) {
  3536. return this.each( function() {
  3537. dataUser.set( this, key );
  3538. } );
  3539. }
  3540. return access( this, function( value ) {
  3541. var data;
  3542. // The calling jQuery object (element matches) is not empty
  3543. // (and therefore has an element appears at this[ 0 ]) and the
  3544. // `value` parameter was not undefined. An empty jQuery object
  3545. // will result in `undefined` for elem = this[ 0 ] which will
  3546. // throw an exception if an attempt to read a data cache is made.
  3547. if ( elem && value === undefined ) {
  3548. // Attempt to get data from the cache
  3549. // The key will always be camelCased in Data
  3550. data = dataUser.get( elem, key );
  3551. if ( data !== undefined ) {
  3552. return data;
  3553. }
  3554. // Attempt to "discover" the data in
  3555. // HTML5 custom data-* attrs
  3556. data = dataAttr( elem, key );
  3557. if ( data !== undefined ) {
  3558. return data;
  3559. }
  3560. // We tried really hard, but the data doesn't exist.
  3561. return;
  3562. }
  3563. // Set the data...
  3564. this.each( function() {
  3565. // We always store the camelCased key
  3566. dataUser.set( this, key, value );
  3567. } );
  3568. }, null, value, arguments.length > 1, null, true );
  3569. },
  3570. removeData: function( key ) {
  3571. return this.each( function() {
  3572. dataUser.remove( this, key );
  3573. } );
  3574. }
  3575. } );
  3576. jQuery.extend( {
  3577. queue: function( elem, type, data ) {
  3578. var queue;
  3579. if ( elem ) {
  3580. type = ( type || "fx" ) + "queue";
  3581. queue = dataPriv.get( elem, type );
  3582. // Speed up dequeue by getting out quickly if this is just a lookup
  3583. if ( data ) {
  3584. if ( !queue || jQuery.isArray( data ) ) {
  3585. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  3586. } else {
  3587. queue.push( data );
  3588. }
  3589. }
  3590. return queue || [];
  3591. }
  3592. },
  3593. dequeue: function( elem, type ) {
  3594. type = type || "fx";
  3595. var queue = jQuery.queue( elem, type ),
  3596. startLength = queue.length,
  3597. fn = queue.shift(),
  3598. hooks = jQuery._queueHooks( elem, type ),
  3599. next = function() {
  3600. jQuery.dequeue( elem, type );
  3601. };
  3602. // If the fx queue is dequeued, always remove the progress sentinel
  3603. if ( fn === "inprogress" ) {
  3604. fn = queue.shift();
  3605. startLength--;
  3606. }
  3607. if ( fn ) {
  3608. // Add a progress sentinel to prevent the fx queue from being
  3609. // automatically dequeued
  3610. if ( type === "fx" ) {
  3611. queue.unshift( "inprogress" );
  3612. }
  3613. // Clear up the last queue stop function
  3614. delete hooks.stop;
  3615. fn.call( elem, next, hooks );
  3616. }
  3617. if ( !startLength && hooks ) {
  3618. hooks.empty.fire();
  3619. }
  3620. },
  3621. // Not public - generate a queueHooks object, or return the current one
  3622. _queueHooks: function( elem, type ) {
  3623. var key = type + "queueHooks";
  3624. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  3625. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3626. dataPriv.remove( elem, [ type + "queue", key ] );
  3627. } )
  3628. } );
  3629. }
  3630. } );
  3631. jQuery.fn.extend( {
  3632. queue: function( type, data ) {
  3633. var setter = 2;
  3634. if ( typeof type !== "string" ) {
  3635. data = type;
  3636. type = "fx";
  3637. setter--;
  3638. }
  3639. if ( arguments.length < setter ) {
  3640. return jQuery.queue( this[ 0 ], type );
  3641. }
  3642. return data === undefined ?
  3643. this :
  3644. this.each( function() {
  3645. var queue = jQuery.queue( this, type, data );
  3646. // Ensure a hooks for this queue
  3647. jQuery._queueHooks( this, type );
  3648. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3649. jQuery.dequeue( this, type );
  3650. }
  3651. } );
  3652. },
  3653. dequeue: function( type ) {
  3654. return this.each( function() {
  3655. jQuery.dequeue( this, type );
  3656. } );
  3657. },
  3658. clearQueue: function( type ) {
  3659. return this.queue( type || "fx", [] );
  3660. },
  3661. // Get a promise resolved when queues of a certain type
  3662. // are emptied (fx is the type by default)
  3663. promise: function( type, obj ) {
  3664. var tmp,
  3665. count = 1,
  3666. defer = jQuery.Deferred(),
  3667. elements = this,
  3668. i = this.length,
  3669. resolve = function() {
  3670. if ( !( --count ) ) {
  3671. defer.resolveWith( elements, [ elements ] );
  3672. }
  3673. };
  3674. if ( typeof type !== "string" ) {
  3675. obj = type;
  3676. type = undefined;
  3677. }
  3678. type = type || "fx";
  3679. while ( i-- ) {
  3680. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  3681. if ( tmp && tmp.empty ) {
  3682. count++;
  3683. tmp.empty.add( resolve );
  3684. }
  3685. }
  3686. resolve();
  3687. return defer.promise( obj );
  3688. }
  3689. } );
  3690. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3691. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3692. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3693. var isHiddenWithinTree = function( elem, el ) {
  3694. // isHiddenWithinTree might be called from jQuery#filter function;
  3695. // in that case, element will be second argument
  3696. elem = el || elem;
  3697. // Inline style trumps all
  3698. return elem.style.display === "none" ||
  3699. elem.style.display === "" &&
  3700. // Otherwise, check computed style
  3701. // Support: Firefox <=43 - 45
  3702. // Disconnected elements can have computed display: none, so first confirm that elem is
  3703. // in the document.
  3704. jQuery.contains( elem.ownerDocument, elem ) &&
  3705. jQuery.css( elem, "display" ) === "none";
  3706. };
  3707. var swap = function( elem, options, callback, args ) {
  3708. var ret, name,
  3709. old = {};
  3710. // Remember the old values, and insert the new ones
  3711. for ( name in options ) {
  3712. old[ name ] = elem.style[ name ];
  3713. elem.style[ name ] = options[ name ];
  3714. }
  3715. ret = callback.apply( elem, args || [] );
  3716. // Revert the old values
  3717. for ( name in options ) {
  3718. elem.style[ name ] = old[ name ];
  3719. }
  3720. return ret;
  3721. };
  3722. function adjustCSS( elem, prop, valueParts, tween ) {
  3723. var adjusted,
  3724. scale = 1,
  3725. maxIterations = 20,
  3726. currentValue = tween ?
  3727. function() {
  3728. return tween.cur();
  3729. } :
  3730. function() {
  3731. return jQuery.css( elem, prop, "" );
  3732. },
  3733. initial = currentValue(),
  3734. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3735. // Starting value computation is required for potential unit mismatches
  3736. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3737. rcssNum.exec( jQuery.css( elem, prop ) );
  3738. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3739. // Trust units reported by jQuery.css
  3740. unit = unit || initialInUnit[ 3 ];
  3741. // Make sure we update the tween properties later on
  3742. valueParts = valueParts || [];
  3743. // Iteratively approximate from a nonzero starting point
  3744. initialInUnit = +initial || 1;
  3745. do {
  3746. // If previous iteration zeroed out, double until we get *something*.
  3747. // Use string for doubling so we don't accidentally see scale as unchanged below
  3748. scale = scale || ".5";
  3749. // Adjust and apply
  3750. initialInUnit = initialInUnit / scale;
  3751. jQuery.style( elem, prop, initialInUnit + unit );
  3752. // Update scale, tolerating zero or NaN from tween.cur()
  3753. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  3754. } while (
  3755. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  3756. );
  3757. }
  3758. if ( valueParts ) {
  3759. initialInUnit = +initialInUnit || +initial || 0;
  3760. // Apply relative offset (+=/-=) if specified
  3761. adjusted = valueParts[ 1 ] ?
  3762. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3763. +valueParts[ 2 ];
  3764. if ( tween ) {
  3765. tween.unit = unit;
  3766. tween.start = initialInUnit;
  3767. tween.end = adjusted;
  3768. }
  3769. }
  3770. return adjusted;
  3771. }
  3772. var defaultDisplayMap = {};
  3773. function getDefaultDisplay( elem ) {
  3774. var temp,
  3775. doc = elem.ownerDocument,
  3776. nodeName = elem.nodeName,
  3777. display = defaultDisplayMap[ nodeName ];
  3778. if ( display ) {
  3779. return display;
  3780. }
  3781. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  3782. display = jQuery.css( temp, "display" );
  3783. temp.parentNode.removeChild( temp );
  3784. if ( display === "none" ) {
  3785. display = "block";
  3786. }
  3787. defaultDisplayMap[ nodeName ] = display;
  3788. return display;
  3789. }
  3790. function showHide( elements, show ) {
  3791. var display, elem,
  3792. values = [],
  3793. index = 0,
  3794. length = elements.length;
  3795. // Determine new display value for elements that need to change
  3796. for ( ; index < length; index++ ) {
  3797. elem = elements[ index ];
  3798. if ( !elem.style ) {
  3799. continue;
  3800. }
  3801. display = elem.style.display;
  3802. if ( show ) {
  3803. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  3804. // check is required in this first loop unless we have a nonempty display value (either
  3805. // inline or about-to-be-restored)
  3806. if ( display === "none" ) {
  3807. values[ index ] = dataPriv.get( elem, "display" ) || null;
  3808. if ( !values[ index ] ) {
  3809. elem.style.display = "";
  3810. }
  3811. }
  3812. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  3813. values[ index ] = getDefaultDisplay( elem );
  3814. }
  3815. } else {
  3816. if ( display !== "none" ) {
  3817. values[ index ] = "none";
  3818. // Remember what we're overwriting
  3819. dataPriv.set( elem, "display", display );
  3820. }
  3821. }
  3822. }
  3823. // Set the display of the elements in a second loop to avoid constant reflow
  3824. for ( index = 0; index < length; index++ ) {
  3825. if ( values[ index ] != null ) {
  3826. elements[ index ].style.display = values[ index ];
  3827. }
  3828. }
  3829. return elements;
  3830. }
  3831. jQuery.fn.extend( {
  3832. show: function() {
  3833. return showHide( this, true );
  3834. },
  3835. hide: function() {
  3836. return showHide( this );
  3837. },
  3838. toggle: function( state ) {
  3839. if ( typeof state === "boolean" ) {
  3840. return state ? this.show() : this.hide();
  3841. }
  3842. return this.each( function() {
  3843. if ( isHiddenWithinTree( this ) ) {
  3844. jQuery( this ).show();
  3845. } else {
  3846. jQuery( this ).hide();
  3847. }
  3848. } );
  3849. }
  3850. } );
  3851. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3852. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  3853. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  3854. // We have to close these tags to support XHTML (#13200)
  3855. var wrapMap = {
  3856. // Support: IE <=9 only
  3857. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3858. // XHTML parsers do not magically insert elements in the
  3859. // same way that tag soup parsers do. So we cannot shorten
  3860. // this by omitting <tbody> or other required elements.
  3861. thead: [ 1, "<table>", "</table>" ],
  3862. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  3863. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3864. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3865. _default: [ 0, "", "" ]
  3866. };
  3867. // Support: IE <=9 only
  3868. wrapMap.optgroup = wrapMap.option;
  3869. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3870. wrapMap.th = wrapMap.td;
  3871. function getAll( context, tag ) {
  3872. // Support: IE <=9 - 11 only
  3873. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  3874. var ret;
  3875. if ( typeof context.getElementsByTagName !== "undefined" ) {
  3876. ret = context.getElementsByTagName( tag || "*" );
  3877. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  3878. ret = context.querySelectorAll( tag || "*" );
  3879. } else {
  3880. ret = [];
  3881. }
  3882. if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) {
  3883. return jQuery.merge( [ context ], ret );
  3884. }
  3885. return ret;
  3886. }
  3887. // Mark scripts as having already been evaluated
  3888. function setGlobalEval( elems, refElements ) {
  3889. var i = 0,
  3890. l = elems.length;
  3891. for ( ; i < l; i++ ) {
  3892. dataPriv.set(
  3893. elems[ i ],
  3894. "globalEval",
  3895. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  3896. );
  3897. }
  3898. }
  3899. var rhtml = /<|&#?\w+;/;
  3900. function buildFragment( elems, context, scripts, selection, ignored ) {
  3901. var elem, tmp, tag, wrap, contains, j,
  3902. fragment = context.createDocumentFragment(),
  3903. nodes = [],
  3904. i = 0,
  3905. l = elems.length;
  3906. for ( ; i < l; i++ ) {
  3907. elem = elems[ i ];
  3908. if ( elem || elem === 0 ) {
  3909. // Add nodes directly
  3910. if ( jQuery.type( elem ) === "object" ) {
  3911. // Support: Android <=4.0 only, PhantomJS 1 only
  3912. // push.apply(_, arraylike) throws on ancient WebKit
  3913. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  3914. // Convert non-html into a text node
  3915. } else if ( !rhtml.test( elem ) ) {
  3916. nodes.push( context.createTextNode( elem ) );
  3917. // Convert html into DOM nodes
  3918. } else {
  3919. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  3920. // Deserialize a standard representation
  3921. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  3922. wrap = wrapMap[ tag ] || wrapMap._default;
  3923. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  3924. // Descend through wrappers to the right content
  3925. j = wrap[ 0 ];
  3926. while ( j-- ) {
  3927. tmp = tmp.lastChild;
  3928. }
  3929. // Support: Android <=4.0 only, PhantomJS 1 only
  3930. // push.apply(_, arraylike) throws on ancient WebKit
  3931. jQuery.merge( nodes, tmp.childNodes );
  3932. // Remember the top-level container
  3933. tmp = fragment.firstChild;
  3934. // Ensure the created nodes are orphaned (#12392)
  3935. tmp.textContent = "";
  3936. }
  3937. }
  3938. }
  3939. // Remove wrapper from fragment
  3940. fragment.textContent = "";
  3941. i = 0;
  3942. while ( ( elem = nodes[ i++ ] ) ) {
  3943. // Skip elements already in the context collection (trac-4087)
  3944. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  3945. if ( ignored ) {
  3946. ignored.push( elem );
  3947. }
  3948. continue;
  3949. }
  3950. contains = jQuery.contains( elem.ownerDocument, elem );
  3951. // Append to fragment
  3952. tmp = getAll( fragment.appendChild( elem ), "script" );
  3953. // Preserve script evaluation history
  3954. if ( contains ) {
  3955. setGlobalEval( tmp );
  3956. }
  3957. // Capture executables
  3958. if ( scripts ) {
  3959. j = 0;
  3960. while ( ( elem = tmp[ j++ ] ) ) {
  3961. if ( rscriptType.test( elem.type || "" ) ) {
  3962. scripts.push( elem );
  3963. }
  3964. }
  3965. }
  3966. }
  3967. return fragment;
  3968. }
  3969. ( function() {
  3970. var fragment = document.createDocumentFragment(),
  3971. div = fragment.appendChild( document.createElement( "div" ) ),
  3972. input = document.createElement( "input" );
  3973. // Support: Android 4.0 - 4.3 only
  3974. // Check state lost if the name is set (#11217)
  3975. // Support: Windows Web Apps (WWA)
  3976. // `name` and `type` must use .setAttribute for WWA (#14901)
  3977. input.setAttribute( "type", "radio" );
  3978. input.setAttribute( "checked", "checked" );
  3979. input.setAttribute( "name", "t" );
  3980. div.appendChild( input );
  3981. // Support: Android <=4.1 only
  3982. // Older WebKit doesn't clone checked state correctly in fragments
  3983. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3984. // Support: IE <=11 only
  3985. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3986. div.innerHTML = "<textarea>x</textarea>";
  3987. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3988. } )();
  3989. var documentElement = document.documentElement;
  3990. var
  3991. rkeyEvent = /^key/,
  3992. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3993. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3994. function returnTrue() {
  3995. return true;
  3996. }
  3997. function returnFalse() {
  3998. return false;
  3999. }
  4000. // Support: IE <=9 only
  4001. // See #13393 for more info
  4002. function safeActiveElement() {
  4003. try {
  4004. return document.activeElement;
  4005. } catch ( err ) { }
  4006. }
  4007. function on( elem, types, selector, data, fn, one ) {
  4008. var origFn, type;
  4009. // Types can be a map of types/handlers
  4010. if ( typeof types === "object" ) {
  4011. // ( types-Object, selector, data )
  4012. if ( typeof selector !== "string" ) {
  4013. // ( types-Object, data )
  4014. data = data || selector;
  4015. selector = undefined;
  4016. }
  4017. for ( type in types ) {
  4018. on( elem, type, selector, data, types[ type ], one );
  4019. }
  4020. return elem;
  4021. }
  4022. if ( data == null && fn == null ) {
  4023. // ( types, fn )
  4024. fn = selector;
  4025. data = selector = undefined;
  4026. } else if ( fn == null ) {
  4027. if ( typeof selector === "string" ) {
  4028. // ( types, selector, fn )
  4029. fn = data;
  4030. data = undefined;
  4031. } else {
  4032. // ( types, data, fn )
  4033. fn = data;
  4034. data = selector;
  4035. selector = undefined;
  4036. }
  4037. }
  4038. if ( fn === false ) {
  4039. fn = returnFalse;
  4040. } else if ( !fn ) {
  4041. return elem;
  4042. }
  4043. if ( one === 1 ) {
  4044. origFn = fn;
  4045. fn = function( event ) {
  4046. // Can use an empty set, since event contains the info
  4047. jQuery().off( event );
  4048. return origFn.apply( this, arguments );
  4049. };
  4050. // Use same guid so caller can remove using origFn
  4051. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4052. }
  4053. return elem.each( function() {
  4054. jQuery.event.add( this, types, fn, data, selector );
  4055. } );
  4056. }
  4057. /*
  4058. * Helper functions for managing events -- not part of the public interface.
  4059. * Props to Dean Edwards' addEvent library for many of the ideas.
  4060. */
  4061. jQuery.event = {
  4062. global: {},
  4063. add: function( elem, types, handler, data, selector ) {
  4064. var handleObjIn, eventHandle, tmp,
  4065. events, t, handleObj,
  4066. special, handlers, type, namespaces, origType,
  4067. elemData = dataPriv.get( elem );
  4068. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4069. if ( !elemData ) {
  4070. return;
  4071. }
  4072. // Caller can pass in an object of custom data in lieu of the handler
  4073. if ( handler.handler ) {
  4074. handleObjIn = handler;
  4075. handler = handleObjIn.handler;
  4076. selector = handleObjIn.selector;
  4077. }
  4078. // Ensure that invalid selectors throw exceptions at attach time
  4079. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4080. if ( selector ) {
  4081. jQuery.find.matchesSelector( documentElement, selector );
  4082. }
  4083. // Make sure that the handler has a unique ID, used to hujie/remove it later
  4084. if ( !handler.guid ) {
  4085. handler.guid = jQuery.guid++;
  4086. }
  4087. // Init the element's event structure and main handler, if this is the first
  4088. if ( !( events = elemData.events ) ) {
  4089. events = elemData.events = {};
  4090. }
  4091. if ( !( eventHandle = elemData.handle ) ) {
  4092. eventHandle = elemData.handle = function( e ) {
  4093. // Discard the second event of a jQuery.event.trigger() and
  4094. // when an event is called after a pages has unloaded
  4095. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4096. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4097. };
  4098. }
  4099. // Handle multiple events separated by a space
  4100. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4101. t = types.length;
  4102. while ( t-- ) {
  4103. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4104. type = origType = tmp[ 1 ];
  4105. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4106. // There *must* be a type, no attaching namespace-only handlers
  4107. if ( !type ) {
  4108. continue;
  4109. }
  4110. // If event changes its type, use the special event handlers for the changed type
  4111. special = jQuery.event.special[ type ] || {};
  4112. // If selector defined, determine special event api type, otherwise given type
  4113. type = ( selector ? special.delegateType : special.bindType ) || type;
  4114. // Update special based on newly reset type
  4115. special = jQuery.event.special[ type ] || {};
  4116. // handleObj is passed to all event handlers
  4117. handleObj = jQuery.extend( {
  4118. type: type,
  4119. origType: origType,
  4120. data: data,
  4121. handler: handler,
  4122. guid: handler.guid,
  4123. selector: selector,
  4124. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4125. namespace: namespaces.join( "." )
  4126. }, handleObjIn );
  4127. // Init the event handler queue if we're the first
  4128. if ( !( handlers = events[ type ] ) ) {
  4129. handlers = events[ type ] = [];
  4130. handlers.delegateCount = 0;
  4131. // Only use addEventListener if the special events handler returns false
  4132. if ( !special.setup ||
  4133. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4134. if ( elem.addEventListener ) {
  4135. elem.addEventListener( type, eventHandle );
  4136. }
  4137. }
  4138. }
  4139. if ( special.add ) {
  4140. special.add.call( elem, handleObj );
  4141. if ( !handleObj.handler.guid ) {
  4142. handleObj.handler.guid = handler.guid;
  4143. }
  4144. }
  4145. // Add to the element's handler list, delegates in front
  4146. if ( selector ) {
  4147. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4148. } else {
  4149. handlers.push( handleObj );
  4150. }
  4151. // Keep track of which events have ever been used, for event optimization
  4152. jQuery.event.global[ type ] = true;
  4153. }
  4154. },
  4155. // Detach an event or set of events from an element
  4156. remove: function( elem, types, handler, selector, mappedTypes ) {
  4157. var j, origCount, tmp,
  4158. events, t, handleObj,
  4159. special, handlers, type, namespaces, origType,
  4160. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4161. if ( !elemData || !( events = elemData.events ) ) {
  4162. return;
  4163. }
  4164. // Once for each type.namespace in types; type may be omitted
  4165. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4166. t = types.length;
  4167. while ( t-- ) {
  4168. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4169. type = origType = tmp[ 1 ];
  4170. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4171. // Unbind all events (on this namespace, if provided) for the element
  4172. if ( !type ) {
  4173. for ( type in events ) {
  4174. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4175. }
  4176. continue;
  4177. }
  4178. special = jQuery.event.special[ type ] || {};
  4179. type = ( selector ? special.delegateType : special.bindType ) || type;
  4180. handlers = events[ type ] || [];
  4181. tmp = tmp[ 2 ] &&
  4182. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4183. // Remove matching events
  4184. origCount = j = handlers.length;
  4185. while ( j-- ) {
  4186. handleObj = handlers[ j ];
  4187. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4188. ( !handler || handler.guid === handleObj.guid ) &&
  4189. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4190. ( !selector || selector === handleObj.selector ||
  4191. selector === "**" && handleObj.selector ) ) {
  4192. handlers.splice( j, 1 );
  4193. if ( handleObj.selector ) {
  4194. handlers.delegateCount--;
  4195. }
  4196. if ( special.remove ) {
  4197. special.remove.call( elem, handleObj );
  4198. }
  4199. }
  4200. }
  4201. // Remove generic event handler if we removed something and no more handlers exist
  4202. // (avoids potential for endless recursion during removal of special event handlers)
  4203. if ( origCount && !handlers.length ) {
  4204. if ( !special.teardown ||
  4205. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4206. jQuery.removeEvent( elem, type, elemData.handle );
  4207. }
  4208. delete events[ type ];
  4209. }
  4210. }
  4211. // Remove data and the expando if it's no longer used
  4212. if ( jQuery.isEmptyObject( events ) ) {
  4213. dataPriv.remove( elem, "handle events" );
  4214. }
  4215. },
  4216. dispatch: function( nativeEvent ) {
  4217. // Make a writable jQuery.Event from the native event object
  4218. var event = jQuery.event.fix( nativeEvent );
  4219. var i, j, ret, matched, handleObj, handlerQueue,
  4220. args = new Array( arguments.length ),
  4221. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  4222. special = jQuery.event.special[ event.type ] || {};
  4223. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4224. args[ 0 ] = event;
  4225. for ( i = 1; i < arguments.length; i++ ) {
  4226. args[ i ] = arguments[ i ];
  4227. }
  4228. event.delegateTarget = this;
  4229. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4230. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4231. return;
  4232. }
  4233. // Determine handlers
  4234. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4235. // Run delegates first; they may want to stop propagation beneath us
  4236. i = 0;
  4237. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4238. event.currentTarget = matched.elem;
  4239. j = 0;
  4240. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4241. !event.isImmediatePropagationStopped() ) {
  4242. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4243. // a subset or equal to those in the bound event (both can have no namespace).
  4244. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4245. event.handleObj = handleObj;
  4246. event.data = handleObj.data;
  4247. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4248. handleObj.handler ).apply( matched.elem, args );
  4249. if ( ret !== undefined ) {
  4250. if ( ( event.result = ret ) === false ) {
  4251. event.preventDefault();
  4252. event.stopPropagation();
  4253. }
  4254. }
  4255. }
  4256. }
  4257. }
  4258. // Call the postDispatch hook for the mapped type
  4259. if ( special.postDispatch ) {
  4260. special.postDispatch.call( this, event );
  4261. }
  4262. return event.result;
  4263. },
  4264. handlers: function( event, handlers ) {
  4265. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4266. handlerQueue = [],
  4267. delegateCount = handlers.delegateCount,
  4268. cur = event.target;
  4269. // Find delegate handlers
  4270. if ( delegateCount &&
  4271. // Support: IE <=9
  4272. // Black-hole SVG <use> instance trees (trac-13180)
  4273. cur.nodeType &&
  4274. // Support: Firefox <=42
  4275. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4276. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4277. // Support: IE 11 only
  4278. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4279. !( event.type === "click" && event.button >= 1 ) ) {
  4280. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4281. // Don't check non-elements (#13208)
  4282. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4283. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  4284. matchedHandlers = [];
  4285. matchedSelectors = {};
  4286. for ( i = 0; i < delegateCount; i++ ) {
  4287. handleObj = handlers[ i ];
  4288. // Don't conflict with Object.prototype properties (#13203)
  4289. sel = handleObj.selector + " ";
  4290. if ( matchedSelectors[ sel ] === undefined ) {
  4291. matchedSelectors[ sel ] = handleObj.needsContext ?
  4292. jQuery( sel, this ).index( cur ) > -1 :
  4293. jQuery.find( sel, this, null, [ cur ] ).length;
  4294. }
  4295. if ( matchedSelectors[ sel ] ) {
  4296. matchedHandlers.push( handleObj );
  4297. }
  4298. }
  4299. if ( matchedHandlers.length ) {
  4300. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  4301. }
  4302. }
  4303. }
  4304. }
  4305. // Add the remaining (directly-bound) handlers
  4306. cur = this;
  4307. if ( delegateCount < handlers.length ) {
  4308. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  4309. }
  4310. return handlerQueue;
  4311. },
  4312. addProp: function( name, hook ) {
  4313. Object.defineProperty( jQuery.Event.prototype, name, {
  4314. enumerable: true,
  4315. configurable: true,
  4316. get: jQuery.isFunction( hook ) ?
  4317. function() {
  4318. if ( this.originalEvent ) {
  4319. return hook( this.originalEvent );
  4320. }
  4321. } :
  4322. function() {
  4323. if ( this.originalEvent ) {
  4324. return this.originalEvent[ name ];
  4325. }
  4326. },
  4327. set: function( value ) {
  4328. Object.defineProperty( this, name, {
  4329. enumerable: true,
  4330. configurable: true,
  4331. writable: true,
  4332. value: value
  4333. } );
  4334. }
  4335. } );
  4336. },
  4337. fix: function( originalEvent ) {
  4338. return originalEvent[ jQuery.expando ] ?
  4339. originalEvent :
  4340. new jQuery.Event( originalEvent );
  4341. },
  4342. special: {
  4343. load: {
  4344. // Prevent triggered image.load events from bubbling to window.load
  4345. noBubble: true
  4346. },
  4347. focus: {
  4348. // Fire native event if possible so blur/focus sequence is correct
  4349. trigger: function() {
  4350. if ( this !== safeActiveElement() && this.focus ) {
  4351. this.focus();
  4352. return false;
  4353. }
  4354. },
  4355. delegateType: "focusin"
  4356. },
  4357. blur: {
  4358. trigger: function() {
  4359. if ( this === safeActiveElement() && this.blur ) {
  4360. this.blur();
  4361. return false;
  4362. }
  4363. },
  4364. delegateType: "focusout"
  4365. },
  4366. click: {
  4367. // For checkbox, fire native event so checked state will be right
  4368. trigger: function() {
  4369. if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
  4370. this.click();
  4371. return false;
  4372. }
  4373. },
  4374. // For cross-browser consistency, don't fire native .click() on links
  4375. _default: function( event ) {
  4376. return jQuery.nodeName( event.target, "a" );
  4377. }
  4378. },
  4379. beforeunload: {
  4380. postDispatch: function( event ) {
  4381. // Support: Firefox 20+
  4382. // Firefox doesn't alert if the returnValue field is not set.
  4383. if ( event.result !== undefined && event.originalEvent ) {
  4384. event.originalEvent.returnValue = event.result;
  4385. }
  4386. }
  4387. }
  4388. }
  4389. };
  4390. jQuery.removeEvent = function( elem, type, handle ) {
  4391. // This "if" is needed for plain objects
  4392. if ( elem.removeEventListener ) {
  4393. elem.removeEventListener( type, handle );
  4394. }
  4395. };
  4396. jQuery.Event = function( src, props ) {
  4397. // Allow instantiation without the 'new' keyword
  4398. if ( !( this instanceof jQuery.Event ) ) {
  4399. return new jQuery.Event( src, props );
  4400. }
  4401. // Event object
  4402. if ( src && src.type ) {
  4403. this.originalEvent = src;
  4404. this.type = src.type;
  4405. // Events bubbling up the document may have been marked as prevented
  4406. // by a handler lower down the tree; reflect the correct value.
  4407. this.isDefaultPrevented = src.defaultPrevented ||
  4408. src.defaultPrevented === undefined &&
  4409. // Support: Android <=2.3 only
  4410. src.returnValue === false ?
  4411. returnTrue :
  4412. returnFalse;
  4413. // Create target properties
  4414. // Support: Safari <=6 - 7 only
  4415. // Target should not be a text node (#504, #13143)
  4416. this.target = ( src.target && src.target.nodeType === 3 ) ?
  4417. src.target.parentNode :
  4418. src.target;
  4419. this.currentTarget = src.currentTarget;
  4420. this.relatedTarget = src.relatedTarget;
  4421. // Event type
  4422. } else {
  4423. this.type = src;
  4424. }
  4425. // Put explicitly provided properties onto the event object
  4426. if ( props ) {
  4427. jQuery.extend( this, props );
  4428. }
  4429. // Create a timestamp if incoming event doesn't have one
  4430. this.timeStamp = src && src.timeStamp || jQuery.now();
  4431. // Mark it as fixed
  4432. this[ jQuery.expando ] = true;
  4433. };
  4434. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4435. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4436. jQuery.Event.prototype = {
  4437. constructor: jQuery.Event,
  4438. isDefaultPrevented: returnFalse,
  4439. isPropagationStopped: returnFalse,
  4440. isImmediatePropagationStopped: returnFalse,
  4441. isSimulated: false,
  4442. preventDefault: function() {
  4443. var e = this.originalEvent;
  4444. this.isDefaultPrevented = returnTrue;
  4445. if ( e && !this.isSimulated ) {
  4446. e.preventDefault();
  4447. }
  4448. },
  4449. stopPropagation: function() {
  4450. var e = this.originalEvent;
  4451. this.isPropagationStopped = returnTrue;
  4452. if ( e && !this.isSimulated ) {
  4453. e.stopPropagation();
  4454. }
  4455. },
  4456. stopImmediatePropagation: function() {
  4457. var e = this.originalEvent;
  4458. this.isImmediatePropagationStopped = returnTrue;
  4459. if ( e && !this.isSimulated ) {
  4460. e.stopImmediatePropagation();
  4461. }
  4462. this.stopPropagation();
  4463. }
  4464. };
  4465. // Includes all common event props including KeyEvent and MouseEvent specific props
  4466. jQuery.each( {
  4467. altKey: true,
  4468. bubbles: true,
  4469. cancelable: true,
  4470. changedTouches: true,
  4471. ctrlKey: true,
  4472. detail: true,
  4473. eventPhase: true,
  4474. metaKey: true,
  4475. pageX: true,
  4476. pageY: true,
  4477. shiftKey: true,
  4478. view: true,
  4479. "char": true,
  4480. charCode: true,
  4481. key: true,
  4482. keyCode: true,
  4483. button: true,
  4484. buttons: true,
  4485. clientX: true,
  4486. clientY: true,
  4487. offsetX: true,
  4488. offsetY: true,
  4489. pointerId: true,
  4490. pointerType: true,
  4491. screenX: true,
  4492. screenY: true,
  4493. targetTouches: true,
  4494. toElement: true,
  4495. touches: true,
  4496. which: function( event ) {
  4497. var button = event.button;
  4498. // Add which for key events
  4499. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  4500. return event.charCode != null ? event.charCode : event.keyCode;
  4501. }
  4502. // Add which for click: 1 === left; 2 === middle; 3 === right
  4503. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  4504. if ( button & 1 ) {
  4505. return 1;
  4506. }
  4507. if ( button & 2 ) {
  4508. return 3;
  4509. }
  4510. if ( button & 4 ) {
  4511. return 2;
  4512. }
  4513. return 0;
  4514. }
  4515. return event.which;
  4516. }
  4517. }, jQuery.event.addProp );
  4518. // Create mouseenter/leave events using mouseover/out and event-time checks
  4519. // so that event delegation works in jQuery.
  4520. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4521. //
  4522. // Support: Safari 7 only
  4523. // Safari sends mouseenter too often; see:
  4524. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  4525. // for the description of the bug (it existed in older Chrome versions as well).
  4526. jQuery.each( {
  4527. mouseenter: "mouseover",
  4528. mouseleave: "mouseout",
  4529. pointerenter: "pointerover",
  4530. pointerleave: "pointerout"
  4531. }, function( orig, fix ) {
  4532. jQuery.event.special[ orig ] = {
  4533. delegateType: fix,
  4534. bindType: fix,
  4535. handle: function( event ) {
  4536. var ret,
  4537. target = this,
  4538. related = event.relatedTarget,
  4539. handleObj = event.handleObj;
  4540. // For mouseenter/leave call the handler if related is outside the target.
  4541. // NB: No relatedTarget if the mouse left/entered the browser window
  4542. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4543. event.type = handleObj.origType;
  4544. ret = handleObj.handler.apply( this, arguments );
  4545. event.type = fix;
  4546. }
  4547. return ret;
  4548. }
  4549. };
  4550. } );
  4551. jQuery.fn.extend( {
  4552. on: function( types, selector, data, fn ) {
  4553. return on( this, types, selector, data, fn );
  4554. },
  4555. one: function( types, selector, data, fn ) {
  4556. return on( this, types, selector, data, fn, 1 );
  4557. },
  4558. off: function( types, selector, fn ) {
  4559. var handleObj, type;
  4560. if ( types && types.preventDefault && types.handleObj ) {
  4561. // ( event ) dispatched jQuery.Event
  4562. handleObj = types.handleObj;
  4563. jQuery( types.delegateTarget ).off(
  4564. handleObj.namespace ?
  4565. handleObj.origType + "." + handleObj.namespace :
  4566. handleObj.origType,
  4567. handleObj.selector,
  4568. handleObj.handler
  4569. );
  4570. return this;
  4571. }
  4572. if ( typeof types === "object" ) {
  4573. // ( types-object [, selector] )
  4574. for ( type in types ) {
  4575. this.off( type, selector, types[ type ] );
  4576. }
  4577. return this;
  4578. }
  4579. if ( selector === false || typeof selector === "function" ) {
  4580. // ( types [, fn] )
  4581. fn = selector;
  4582. selector = undefined;
  4583. }
  4584. if ( fn === false ) {
  4585. fn = returnFalse;
  4586. }
  4587. return this.each( function() {
  4588. jQuery.event.remove( this, types, fn, selector );
  4589. } );
  4590. }
  4591. } );
  4592. var
  4593. /* eslint-disable max-len */
  4594. // See https://github.com/eslint/eslint/issues/3229
  4595. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  4596. /* eslint-enable */
  4597. // Support: IE <=10 - 11, Edge 12 - 13
  4598. // In IE/Edge using regex groups here causes severe slowdowns.
  4599. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4600. rnoInnerhtml = /<script|<style|<link/i,
  4601. // checked="checked" or checked
  4602. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4603. rscriptTypeMasked = /^true\/(.*)/,
  4604. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4605. function manipulationTarget( elem, content ) {
  4606. if ( jQuery.nodeName( elem, "table" ) &&
  4607. jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  4608. return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
  4609. }
  4610. return elem;
  4611. }
  4612. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4613. function disableScript( elem ) {
  4614. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  4615. return elem;
  4616. }
  4617. function restoreScript( elem ) {
  4618. var match = rscriptTypeMasked.exec( elem.type );
  4619. if ( match ) {
  4620. elem.type = match[ 1 ];
  4621. } else {
  4622. elem.removeAttribute( "type" );
  4623. }
  4624. return elem;
  4625. }
  4626. function cloneCopyEvent( src, dest ) {
  4627. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4628. if ( dest.nodeType !== 1 ) {
  4629. return;
  4630. }
  4631. // 1. Copy private data: events, handlers, etc.
  4632. if ( dataPriv.hasData( src ) ) {
  4633. pdataOld = dataPriv.access( src );
  4634. pdataCur = dataPriv.set( dest, pdataOld );
  4635. events = pdataOld.events;
  4636. if ( events ) {
  4637. delete pdataCur.handle;
  4638. pdataCur.events = {};
  4639. for ( type in events ) {
  4640. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4641. jQuery.event.add( dest, type, events[ type ][ i ] );
  4642. }
  4643. }
  4644. }
  4645. }
  4646. // 2. Copy user data
  4647. if ( dataUser.hasData( src ) ) {
  4648. udataOld = dataUser.access( src );
  4649. udataCur = jQuery.extend( {}, udataOld );
  4650. dataUser.set( dest, udataCur );
  4651. }
  4652. }
  4653. // Fix IE bugs, see support tests
  4654. function fixInput( src, dest ) {
  4655. var nodeName = dest.nodeName.toLowerCase();
  4656. // Fails to persist the checked state of a cloned checkbox or radio button.
  4657. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4658. dest.checked = src.checked;
  4659. // Fails to return the selected option to the default selected state when cloning options
  4660. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4661. dest.defaultValue = src.defaultValue;
  4662. }
  4663. }
  4664. function domManip( collection, args, callback, ignored ) {
  4665. // Flatten any nested arrays
  4666. args = concat.apply( [], args );
  4667. var fragment, first, scripts, hasScripts, node, doc,
  4668. i = 0,
  4669. l = collection.length,
  4670. iNoClone = l - 1,
  4671. value = args[ 0 ],
  4672. isFunction = jQuery.isFunction( value );
  4673. // We can't cloneNode fragments that contain checked, in WebKit
  4674. if ( isFunction ||
  4675. ( l > 1 && typeof value === "string" &&
  4676. !support.checkClone && rchecked.test( value ) ) ) {
  4677. return collection.each( function( index ) {
  4678. var self = collection.eq( index );
  4679. if ( isFunction ) {
  4680. args[ 0 ] = value.call( this, index, self.html() );
  4681. }
  4682. domManip( self, args, callback, ignored );
  4683. } );
  4684. }
  4685. if ( l ) {
  4686. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4687. first = fragment.firstChild;
  4688. if ( fragment.childNodes.length === 1 ) {
  4689. fragment = first;
  4690. }
  4691. // Require either new content or an interest in ignored elements to invoke the callback
  4692. if ( first || ignored ) {
  4693. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4694. hasScripts = scripts.length;
  4695. // Use the original fragment for the last item
  4696. // instead of the first because it can end up
  4697. // being emptied incorrectly in certain situations (#8070).
  4698. for ( ; i < l; i++ ) {
  4699. node = fragment;
  4700. if ( i !== iNoClone ) {
  4701. node = jQuery.clone( node, true, true );
  4702. // Keep references to cloned scripts for later restoration
  4703. if ( hasScripts ) {
  4704. // Support: Android <=4.0 only, PhantomJS 1 only
  4705. // push.apply(_, arraylike) throws on ancient WebKit
  4706. jQuery.merge( scripts, getAll( node, "script" ) );
  4707. }
  4708. }
  4709. callback.call( collection[ i ], node, i );
  4710. }
  4711. if ( hasScripts ) {
  4712. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4713. // Reenable scripts
  4714. jQuery.map( scripts, restoreScript );
  4715. // Evaluate executable scripts on first document insertion
  4716. for ( i = 0; i < hasScripts; i++ ) {
  4717. node = scripts[ i ];
  4718. if ( rscriptType.test( node.type || "" ) &&
  4719. !dataPriv.access( node, "globalEval" ) &&
  4720. jQuery.contains( doc, node ) ) {
  4721. if ( node.src ) {
  4722. // Optional AJAX dependency, but won't run scripts if not present
  4723. if ( jQuery._evalUrl ) {
  4724. jQuery._evalUrl( node.src );
  4725. }
  4726. } else {
  4727. DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
  4728. }
  4729. }
  4730. }
  4731. }
  4732. }
  4733. }
  4734. return collection;
  4735. }
  4736. function remove( elem, selector, keepData ) {
  4737. var node,
  4738. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  4739. i = 0;
  4740. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  4741. if ( !keepData && node.nodeType === 1 ) {
  4742. jQuery.cleanData( getAll( node ) );
  4743. }
  4744. if ( node.parentNode ) {
  4745. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  4746. setGlobalEval( getAll( node, "script" ) );
  4747. }
  4748. node.parentNode.removeChild( node );
  4749. }
  4750. }
  4751. return elem;
  4752. }
  4753. jQuery.extend( {
  4754. htmlPrefilter: function( html ) {
  4755. return html.replace( rxhtmlTag, "<$1></$2>" );
  4756. },
  4757. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4758. var i, l, srcElements, destElements,
  4759. clone = elem.cloneNode( true ),
  4760. inPage = jQuery.contains( elem.ownerDocument, elem );
  4761. // Fix IE cloning issues
  4762. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  4763. !jQuery.isXMLDoc( elem ) ) {
  4764. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  4765. destElements = getAll( clone );
  4766. srcElements = getAll( elem );
  4767. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4768. fixInput( srcElements[ i ], destElements[ i ] );
  4769. }
  4770. }
  4771. // Copy the events from the original to the clone
  4772. if ( dataAndEvents ) {
  4773. if ( deepDataAndEvents ) {
  4774. srcElements = srcElements || getAll( elem );
  4775. destElements = destElements || getAll( clone );
  4776. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4777. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  4778. }
  4779. } else {
  4780. cloneCopyEvent( elem, clone );
  4781. }
  4782. }
  4783. // Preserve script evaluation history
  4784. destElements = getAll( clone, "script" );
  4785. if ( destElements.length > 0 ) {
  4786. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  4787. }
  4788. // Return the cloned set
  4789. return clone;
  4790. },
  4791. cleanData: function( elems ) {
  4792. var data, elem, type,
  4793. special = jQuery.event.special,
  4794. i = 0;
  4795. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  4796. if ( acceptData( elem ) ) {
  4797. if ( ( data = elem[ dataPriv.expando ] ) ) {
  4798. if ( data.events ) {
  4799. for ( type in data.events ) {
  4800. if ( special[ type ] ) {
  4801. jQuery.event.remove( elem, type );
  4802. // This is a shortcut to avoid jQuery.event.remove's overhead
  4803. } else {
  4804. jQuery.removeEvent( elem, type, data.handle );
  4805. }
  4806. }
  4807. }
  4808. // Support: Chrome <=35 - 45+
  4809. // Assign undefined instead of using delete, see Data#remove
  4810. elem[ dataPriv.expando ] = undefined;
  4811. }
  4812. if ( elem[ dataUser.expando ] ) {
  4813. // Support: Chrome <=35 - 45+
  4814. // Assign undefined instead of using delete, see Data#remove
  4815. elem[ dataUser.expando ] = undefined;
  4816. }
  4817. }
  4818. }
  4819. }
  4820. } );
  4821. jQuery.fn.extend( {
  4822. detach: function( selector ) {
  4823. return remove( this, selector, true );
  4824. },
  4825. remove: function( selector ) {
  4826. return remove( this, selector );
  4827. },
  4828. text: function( value ) {
  4829. return access( this, function( value ) {
  4830. return value === undefined ?
  4831. jQuery.text( this ) :
  4832. this.empty().each( function() {
  4833. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4834. this.textContent = value;
  4835. }
  4836. } );
  4837. }, null, value, arguments.length );
  4838. },
  4839. append: function() {
  4840. return domManip( this, arguments, function( elem ) {
  4841. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4842. var target = manipulationTarget( this, elem );
  4843. target.appendChild( elem );
  4844. }
  4845. } );
  4846. },
  4847. prepend: function() {
  4848. return domManip( this, arguments, function( elem ) {
  4849. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4850. var target = manipulationTarget( this, elem );
  4851. target.insertBefore( elem, target.firstChild );
  4852. }
  4853. } );
  4854. },
  4855. before: function() {
  4856. return domManip( this, arguments, function( elem ) {
  4857. if ( this.parentNode ) {
  4858. this.parentNode.insertBefore( elem, this );
  4859. }
  4860. } );
  4861. },
  4862. after: function() {
  4863. return domManip( this, arguments, function( elem ) {
  4864. if ( this.parentNode ) {
  4865. this.parentNode.insertBefore( elem, this.nextSibling );
  4866. }
  4867. } );
  4868. },
  4869. empty: function() {
  4870. var elem,
  4871. i = 0;
  4872. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  4873. if ( elem.nodeType === 1 ) {
  4874. // Prevent memory leaks
  4875. jQuery.cleanData( getAll( elem, false ) );
  4876. // Remove any remaining nodes
  4877. elem.textContent = "";
  4878. }
  4879. }
  4880. return this;
  4881. },
  4882. clone: function( dataAndEvents, deepDataAndEvents ) {
  4883. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4884. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4885. return this.map( function() {
  4886. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4887. } );
  4888. },
  4889. html: function( value ) {
  4890. return access( this, function( value ) {
  4891. var elem = this[ 0 ] || {},
  4892. i = 0,
  4893. l = this.length;
  4894. if ( value === undefined && elem.nodeType === 1 ) {
  4895. return elem.innerHTML;
  4896. }
  4897. // See if we can take a shortcut and just use innerHTML
  4898. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  4899. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  4900. value = jQuery.htmlPrefilter( value );
  4901. try {
  4902. for ( ; i < l; i++ ) {
  4903. elem = this[ i ] || {};
  4904. // Remove element nodes and prevent memory leaks
  4905. if ( elem.nodeType === 1 ) {
  4906. jQuery.cleanData( getAll( elem, false ) );
  4907. elem.innerHTML = value;
  4908. }
  4909. }
  4910. elem = 0;
  4911. // If using innerHTML throws an exception, use the fallback method
  4912. } catch ( e ) {}
  4913. }
  4914. if ( elem ) {
  4915. this.empty().append( value );
  4916. }
  4917. }, null, value, arguments.length );
  4918. },
  4919. replaceWith: function() {
  4920. var ignored = [];
  4921. // Make the changes, replacing each non-ignored context element with the new content
  4922. return domManip( this, arguments, function( elem ) {
  4923. var parent = this.parentNode;
  4924. if ( jQuery.inArray( this, ignored ) < 0 ) {
  4925. jQuery.cleanData( getAll( this ) );
  4926. if ( parent ) {
  4927. parent.replaceChild( elem, this );
  4928. }
  4929. }
  4930. // Force callback invocation
  4931. }, ignored );
  4932. }
  4933. } );
  4934. jQuery.each( {
  4935. appendTo: "append",
  4936. prependTo: "prepend",
  4937. insertBefore: "before",
  4938. insertAfter: "after",
  4939. replaceAll: "replaceWith"
  4940. }, function( name, original ) {
  4941. jQuery.fn[ name ] = function( selector ) {
  4942. var elems,
  4943. ret = [],
  4944. insert = jQuery( selector ),
  4945. last = insert.length - 1,
  4946. i = 0;
  4947. for ( ; i <= last; i++ ) {
  4948. elems = i === last ? this : this.clone( true );
  4949. jQuery( insert[ i ] )[ original ]( elems );
  4950. // Support: Android <=4.0 only, PhantomJS 1 only
  4951. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  4952. push.apply( ret, elems.get() );
  4953. }
  4954. return this.pushStack( ret );
  4955. };
  4956. } );
  4957. var rmargin = ( /^margin/ );
  4958. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  4959. var getStyles = function( elem ) {
  4960. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  4961. // IE throws on elements created in popups
  4962. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  4963. var view = elem.ownerDocument.defaultView;
  4964. if ( !view || !view.opener ) {
  4965. view = window;
  4966. }
  4967. return view.getComputedStyle( elem );
  4968. };
  4969. ( function() {
  4970. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  4971. // so they're executed at the same time to save the second computation.
  4972. function computeStyleTests() {
  4973. // This is a singleton, we need to execute it only once
  4974. if ( !div ) {
  4975. return;
  4976. }
  4977. div.style.cssText =
  4978. "box-sizing:border-box;" +
  4979. "position:relative;display:block;" +
  4980. "margin:auto;border:1px;padding:1px;" +
  4981. "top:1%;width:50%";
  4982. div.innerHTML = "";
  4983. documentElement.appendChild( container );
  4984. var divStyle = window.getComputedStyle( div );
  4985. pixelPositionVal = divStyle.top !== "1%";
  4986. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  4987. reliableMarginLeftVal = divStyle.marginLeft === "2px";
  4988. boxSizingReliableVal = divStyle.width === "4px";
  4989. // Support: Android 4.0 - 4.3 only
  4990. // Some styles come back with percentage values, even though they shouldn't
  4991. div.style.marginRight = "50%";
  4992. pixelMarginRightVal = divStyle.marginRight === "4px";
  4993. documentElement.removeChild( container );
  4994. // Nullify the div so it wouldn't be stored in the memory and
  4995. // it will also be a sign that checks already performed
  4996. div = null;
  4997. }
  4998. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
  4999. container = document.createElement( "div" ),
  5000. div = document.createElement( "div" );
  5001. // Finish early in limited (non-browser) environments
  5002. if ( !div.style ) {
  5003. return;
  5004. }
  5005. // Support: IE <=9 - 11 only
  5006. // Style of cloned element affects source element cloned (#8908)
  5007. div.style.backgroundClip = "content-box";
  5008. div.cloneNode( true ).style.backgroundClip = "";
  5009. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5010. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  5011. "padding:0;margin-top:1px;position:absolute";
  5012. container.appendChild( div );
  5013. jQuery.extend( support, {
  5014. pixelPosition: function() {
  5015. computeStyleTests();
  5016. return pixelPositionVal;
  5017. },
  5018. boxSizingReliable: function() {
  5019. computeStyleTests();
  5020. return boxSizingReliableVal;
  5021. },
  5022. pixelMarginRight: function() {
  5023. computeStyleTests();
  5024. return pixelMarginRightVal;
  5025. },
  5026. reliableMarginLeft: function() {
  5027. computeStyleTests();
  5028. return reliableMarginLeftVal;
  5029. }
  5030. } );
  5031. } )();
  5032. function curCSS( elem, name, computed ) {
  5033. var width, minWidth, maxWidth, ret,
  5034. style = elem.style;
  5035. computed = computed || getStyles( elem );
  5036. // Support: IE <=9 only
  5037. // getPropertyValue is only needed for .css('filter') (#12537)
  5038. if ( computed ) {
  5039. ret = computed.getPropertyValue( name ) || computed[ name ];
  5040. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5041. ret = jQuery.style( elem, name );
  5042. }
  5043. // A tribute to the "awesome hack by Dean Edwards"
  5044. // Android Browser returns percentage for some values,
  5045. // but width seems to be reliably pixels.
  5046. // This is against the CSSOM draft spec:
  5047. // https://drafts.csswg.org/cssom/#resolved-values
  5048. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  5049. // Remember the original values
  5050. width = style.width;
  5051. minWidth = style.minWidth;
  5052. maxWidth = style.maxWidth;
  5053. // Put in the new values to get a computed value out
  5054. style.minWidth = style.maxWidth = style.width = ret;
  5055. ret = computed.width;
  5056. // Revert the changed values
  5057. style.width = width;
  5058. style.minWidth = minWidth;
  5059. style.maxWidth = maxWidth;
  5060. }
  5061. }
  5062. return ret !== undefined ?
  5063. // Support: IE <=9 - 11 only
  5064. // IE returns zIndex value as an integer.
  5065. ret + "" :
  5066. ret;
  5067. }
  5068. function addGetHookIf( conditionFn, hookFn ) {
  5069. // Define the hook, we'll check on the first run if it's really needed.
  5070. return {
  5071. get: function() {
  5072. if ( conditionFn() ) {
  5073. // Hook not needed (or it's not possible to use it due
  5074. // to missing dependency), remove it.
  5075. delete this.get;
  5076. return;
  5077. }
  5078. // Hook needed; redefine it so that the support test is not executed again.
  5079. return ( this.get = hookFn ).apply( this, arguments );
  5080. }
  5081. };
  5082. }
  5083. var
  5084. // Swappable if display is none or starts with table
  5085. // except "table", "table-cell", or "table-caption"
  5086. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5087. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5088. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5089. cssNormalTransform = {
  5090. letterSpacing: "0",
  5091. fontWeight: "400"
  5092. },
  5093. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5094. emptyStyle = document.createElement( "div" ).style;
  5095. // Return a css property mapped to a potentially vendor prefixed property
  5096. function vendorPropName( name ) {
  5097. // Shortcut for names that are not vendor prefixed
  5098. if ( name in emptyStyle ) {
  5099. return name;
  5100. }
  5101. // Check for vendor prefixed names
  5102. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5103. i = cssPrefixes.length;
  5104. while ( i-- ) {
  5105. name = cssPrefixes[ i ] + capName;
  5106. if ( name in emptyStyle ) {
  5107. return name;
  5108. }
  5109. }
  5110. }
  5111. function setPositiveNumber( elem, value, subtract ) {
  5112. // Any relative (+/-) values have already been
  5113. // normalized at this point
  5114. var matches = rcssNum.exec( value );
  5115. return matches ?
  5116. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5117. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5118. value;
  5119. }
  5120. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  5121. var i,
  5122. val = 0;
  5123. // If we already have the right measurement, avoid augmentation
  5124. if ( extra === ( isBorderBox ? "border" : "content" ) ) {
  5125. i = 4;
  5126. // Otherwise initialize for horizontal or vertical properties
  5127. } else {
  5128. i = name === "width" ? 1 : 0;
  5129. }
  5130. for ( ; i < 4; i += 2 ) {
  5131. // Both box models exclude margin, so add it if we want it
  5132. if ( extra === "margin" ) {
  5133. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  5134. }
  5135. if ( isBorderBox ) {
  5136. // border-box includes padding, so remove it if we want content
  5137. if ( extra === "content" ) {
  5138. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5139. }
  5140. // At this point, extra isn't border nor margin, so remove border
  5141. if ( extra !== "margin" ) {
  5142. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5143. }
  5144. } else {
  5145. // At this point, extra isn't content, so add padding
  5146. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5147. // At this point, extra isn't content nor padding, so add border
  5148. if ( extra !== "padding" ) {
  5149. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5150. }
  5151. }
  5152. }
  5153. return val;
  5154. }
  5155. function getWidthOrHeight( elem, name, extra ) {
  5156. // Start with offset property, which is equivalent to the border-box value
  5157. var val,
  5158. valueIsBorderBox = true,
  5159. styles = getStyles( elem ),
  5160. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5161. // Support: IE <=11 only
  5162. // Running getBoundingClientRect on a disconnected node
  5163. // in IE throws an error.
  5164. if ( elem.getClientRects().length ) {
  5165. val = elem.getBoundingClientRect()[ name ];
  5166. }
  5167. // Some non-html elements return undefined for offsetWidth, so check for null/undefined
  5168. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  5169. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  5170. if ( val <= 0 || val == null ) {
  5171. // Fall back to computed then uncomputed css if necessary
  5172. val = curCSS( elem, name, styles );
  5173. if ( val < 0 || val == null ) {
  5174. val = elem.style[ name ];
  5175. }
  5176. // Computed unit is not pixels. Stop here and return.
  5177. if ( rnumnonpx.test( val ) ) {
  5178. return val;
  5179. }
  5180. // Check for style in case a browser which returns unreliable values
  5181. // for getComputedStyle silently falls back to the reliable elem.style
  5182. valueIsBorderBox = isBorderBox &&
  5183. ( support.boxSizingReliable() || val === elem.style[ name ] );
  5184. // Normalize "", auto, and prepare for extra
  5185. val = parseFloat( val ) || 0;
  5186. }
  5187. // Use the active box-sizing model to add/subtract irrelevant styles
  5188. return ( val +
  5189. augmentWidthOrHeight(
  5190. elem,
  5191. name,
  5192. extra || ( isBorderBox ? "border" : "content" ),
  5193. valueIsBorderBox,
  5194. styles
  5195. )
  5196. ) + "px";
  5197. }
  5198. jQuery.extend( {
  5199. // Add in style property hooks for overriding the default
  5200. // behavior of getting and setting a style property
  5201. cssHooks: {
  5202. opacity: {
  5203. get: function( elem, computed ) {
  5204. if ( computed ) {
  5205. // We should always get a number back from opacity
  5206. var ret = curCSS( elem, "opacity" );
  5207. return ret === "" ? "1" : ret;
  5208. }
  5209. }
  5210. }
  5211. },
  5212. // Don't automatically add "px" to these possibly-unitless properties
  5213. cssNumber: {
  5214. "animationIterationCount": true,
  5215. "columnCount": true,
  5216. "fillOpacity": true,
  5217. "flexGrow": true,
  5218. "flexShrink": true,
  5219. "fontWeight": true,
  5220. "lineHeight": true,
  5221. "opacity": true,
  5222. "order": true,
  5223. "orphans": true,
  5224. "widows": true,
  5225. "zIndex": true,
  5226. "zoom": true
  5227. },
  5228. // Add in properties whose names you wish to fix before
  5229. // setting or getting the value
  5230. cssProps: {
  5231. "float": "cssFloat"
  5232. },
  5233. // Get and set the style property on a DOM Node
  5234. style: function( elem, name, value, extra ) {
  5235. // Don't set styles on text and comment nodes
  5236. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5237. return;
  5238. }
  5239. // Make sure that we're working with the right name
  5240. var ret, type, hooks,
  5241. origName = jQuery.camelCase( name ),
  5242. style = elem.style;
  5243. name = jQuery.cssProps[ origName ] ||
  5244. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  5245. // Gets hook for the prefixed version, then unprefixed version
  5246. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5247. // Check if we're setting a value
  5248. if ( value !== undefined ) {
  5249. type = typeof value;
  5250. // Convert "+=" or "-=" to relative numbers (#7345)
  5251. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5252. value = adjustCSS( elem, name, ret );
  5253. // Fixes bug #9237
  5254. type = "number";
  5255. }
  5256. // Make sure that null and NaN values aren't set (#7116)
  5257. if ( value == null || value !== value ) {
  5258. return;
  5259. }
  5260. // If a number was passed in, add the unit (except for certain CSS properties)
  5261. if ( type === "number" ) {
  5262. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5263. }
  5264. // background-* props affect original clone's values
  5265. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5266. style[ name ] = "inherit";
  5267. }
  5268. // If a hook was provided, use that value, otherwise just set the specified value
  5269. if ( !hooks || !( "set" in hooks ) ||
  5270. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5271. style[ name ] = value;
  5272. }
  5273. } else {
  5274. // If a hook was provided get the non-computed value from there
  5275. if ( hooks && "get" in hooks &&
  5276. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5277. return ret;
  5278. }
  5279. // Otherwise just get the value from the style object
  5280. return style[ name ];
  5281. }
  5282. },
  5283. css: function( elem, name, extra, styles ) {
  5284. var val, num, hooks,
  5285. origName = jQuery.camelCase( name );
  5286. // Make sure that we're working with the right name
  5287. name = jQuery.cssProps[ origName ] ||
  5288. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  5289. // Try prefixed name followed by the unprefixed name
  5290. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5291. // If a hook was provided get the computed value from there
  5292. if ( hooks && "get" in hooks ) {
  5293. val = hooks.get( elem, true, extra );
  5294. }
  5295. // Otherwise, if a way to get the computed value exists, use that
  5296. if ( val === undefined ) {
  5297. val = curCSS( elem, name, styles );
  5298. }
  5299. // Convert "normal" to computed value
  5300. if ( val === "normal" && name in cssNormalTransform ) {
  5301. val = cssNormalTransform[ name ];
  5302. }
  5303. // Make numeric if forced or a qualifier was provided and val looks numeric
  5304. if ( extra === "" || extra ) {
  5305. num = parseFloat( val );
  5306. return extra === true || isFinite( num ) ? num || 0 : val;
  5307. }
  5308. return val;
  5309. }
  5310. } );
  5311. jQuery.each( [ "height", "width" ], function( i, name ) {
  5312. jQuery.cssHooks[ name ] = {
  5313. get: function( elem, computed, extra ) {
  5314. if ( computed ) {
  5315. // Certain elements can have dimension info if we invisibly show them
  5316. // but it must have a current display style that would benefit
  5317. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5318. // Support: Safari 8+
  5319. // Table columns in Safari have non-zero offsetWidth & zero
  5320. // getBoundingClientRect().width unless display is changed.
  5321. // Support: IE <=11 only
  5322. // Running getBoundingClientRect on a disconnected node
  5323. // in IE throws an error.
  5324. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  5325. swap( elem, cssShow, function() {
  5326. return getWidthOrHeight( elem, name, extra );
  5327. } ) :
  5328. getWidthOrHeight( elem, name, extra );
  5329. }
  5330. },
  5331. set: function( elem, value, extra ) {
  5332. var matches,
  5333. styles = extra && getStyles( elem ),
  5334. subtract = extra && augmentWidthOrHeight(
  5335. elem,
  5336. name,
  5337. extra,
  5338. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5339. styles
  5340. );
  5341. // Convert to pixels if value adjustment is needed
  5342. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  5343. ( matches[ 3 ] || "px" ) !== "px" ) {
  5344. elem.style[ name ] = value;
  5345. value = jQuery.css( elem, name );
  5346. }
  5347. return setPositiveNumber( elem, value, subtract );
  5348. }
  5349. };
  5350. } );
  5351. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5352. function( elem, computed ) {
  5353. if ( computed ) {
  5354. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5355. elem.getBoundingClientRect().left -
  5356. swap( elem, { marginLeft: 0 }, function() {
  5357. return elem.getBoundingClientRect().left;
  5358. } )
  5359. ) + "px";
  5360. }
  5361. }
  5362. );
  5363. // These hooks are used by animate to expand properties
  5364. jQuery.each( {
  5365. margin: "",
  5366. padding: "",
  5367. border: "Width"
  5368. }, function( prefix, suffix ) {
  5369. jQuery.cssHooks[ prefix + suffix ] = {
  5370. expand: function( value ) {
  5371. var i = 0,
  5372. expanded = {},
  5373. // Assumes a single number if not a string
  5374. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5375. for ( ; i < 4; i++ ) {
  5376. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5377. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5378. }
  5379. return expanded;
  5380. }
  5381. };
  5382. if ( !rmargin.test( prefix ) ) {
  5383. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5384. }
  5385. } );
  5386. jQuery.fn.extend( {
  5387. css: function( name, value ) {
  5388. return access( this, function( elem, name, value ) {
  5389. var styles, len,
  5390. map = {},
  5391. i = 0;
  5392. if ( jQuery.isArray( name ) ) {
  5393. styles = getStyles( elem );
  5394. len = name.length;
  5395. for ( ; i < len; i++ ) {
  5396. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5397. }
  5398. return map;
  5399. }
  5400. return value !== undefined ?
  5401. jQuery.style( elem, name, value ) :
  5402. jQuery.css( elem, name );
  5403. }, name, value, arguments.length > 1 );
  5404. }
  5405. } );
  5406. function Tween( elem, options, prop, end, easing ) {
  5407. return new Tween.prototype.init( elem, options, prop, end, easing );
  5408. }
  5409. jQuery.Tween = Tween;
  5410. Tween.prototype = {
  5411. constructor: Tween,
  5412. init: function( elem, options, prop, end, easing, unit ) {
  5413. this.elem = elem;
  5414. this.prop = prop;
  5415. this.easing = easing || jQuery.easing._default;
  5416. this.options = options;
  5417. this.start = this.now = this.cur();
  5418. this.end = end;
  5419. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  5420. },
  5421. cur: function() {
  5422. var hooks = Tween.propHooks[ this.prop ];
  5423. return hooks && hooks.get ?
  5424. hooks.get( this ) :
  5425. Tween.propHooks._default.get( this );
  5426. },
  5427. run: function( percent ) {
  5428. var eased,
  5429. hooks = Tween.propHooks[ this.prop ];
  5430. if ( this.options.duration ) {
  5431. this.pos = eased = jQuery.easing[ this.easing ](
  5432. percent, this.options.duration * percent, 0, 1, this.options.duration
  5433. );
  5434. } else {
  5435. this.pos = eased = percent;
  5436. }
  5437. this.now = ( this.end - this.start ) * eased + this.start;
  5438. if ( this.options.step ) {
  5439. this.options.step.call( this.elem, this.now, this );
  5440. }
  5441. if ( hooks && hooks.set ) {
  5442. hooks.set( this );
  5443. } else {
  5444. Tween.propHooks._default.set( this );
  5445. }
  5446. return this;
  5447. }
  5448. };
  5449. Tween.prototype.init.prototype = Tween.prototype;
  5450. Tween.propHooks = {
  5451. _default: {
  5452. get: function( tween ) {
  5453. var result;
  5454. // Use a property on the element directly when it is not a DOM element,
  5455. // or when there is no matching style property that exists.
  5456. if ( tween.elem.nodeType !== 1 ||
  5457. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  5458. return tween.elem[ tween.prop ];
  5459. }
  5460. // Passing an empty string as a 3rd parameter to .css will automatically
  5461. // attempt a parseFloat and fallback to a string if the parse fails.
  5462. // Simple values such as "10px" are parsed to Float;
  5463. // complex values such as "rotate(1rad)" are returned as-is.
  5464. result = jQuery.css( tween.elem, tween.prop, "" );
  5465. // Empty strings, null, undefined and "auto" are converted to 0.
  5466. return !result || result === "auto" ? 0 : result;
  5467. },
  5468. set: function( tween ) {
  5469. // Use step hook for back compat.
  5470. // Use cssHook if its there.
  5471. // Use .style if available and use plain properties where available.
  5472. if ( jQuery.fx.step[ tween.prop ] ) {
  5473. jQuery.fx.step[ tween.prop ]( tween );
  5474. } else if ( tween.elem.nodeType === 1 &&
  5475. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  5476. jQuery.cssHooks[ tween.prop ] ) ) {
  5477. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  5478. } else {
  5479. tween.elem[ tween.prop ] = tween.now;
  5480. }
  5481. }
  5482. }
  5483. };
  5484. // Support: IE <=9 only
  5485. // Panic based approach to setting things on disconnected nodes
  5486. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5487. set: function( tween ) {
  5488. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  5489. tween.elem[ tween.prop ] = tween.now;
  5490. }
  5491. }
  5492. };
  5493. jQuery.easing = {
  5494. linear: function( p ) {
  5495. return p;
  5496. },
  5497. swing: function( p ) {
  5498. return 0.5 - Math.cos( p * Math.PI ) / 2;
  5499. },
  5500. _default: "swing"
  5501. };
  5502. jQuery.fx = Tween.prototype.init;
  5503. // Back compat <1.8 extension point
  5504. jQuery.fx.step = {};
  5505. var
  5506. fxNow, timerId,
  5507. rfxtypes = /^(?:toggle|show|hide)$/,
  5508. rrun = /queueHooks$/;
  5509. function raf() {
  5510. if ( timerId ) {
  5511. window.requestAnimationFrame( raf );
  5512. jQuery.fx.tick();
  5513. }
  5514. }
  5515. // Animations created synchronously will run synchronously
  5516. function createFxNow() {
  5517. window.setTimeout( function() {
  5518. fxNow = undefined;
  5519. } );
  5520. return ( fxNow = jQuery.now() );
  5521. }
  5522. // Generate parameters to create a standard animation
  5523. function genFx( type, includeWidth ) {
  5524. var which,
  5525. i = 0,
  5526. attrs = { height: type };
  5527. // If we include width, step value is 1 to do all cssExpand values,
  5528. // otherwise step value is 2 to skip over Left and Right
  5529. includeWidth = includeWidth ? 1 : 0;
  5530. for ( ; i < 4; i += 2 - includeWidth ) {
  5531. which = cssExpand[ i ];
  5532. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  5533. }
  5534. if ( includeWidth ) {
  5535. attrs.opacity = attrs.width = type;
  5536. }
  5537. return attrs;
  5538. }
  5539. function createTween( value, prop, animation ) {
  5540. var tween,
  5541. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  5542. index = 0,
  5543. length = collection.length;
  5544. for ( ; index < length; index++ ) {
  5545. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  5546. // We're done with this property
  5547. return tween;
  5548. }
  5549. }
  5550. }
  5551. function defaultPrefilter( elem, props, opts ) {
  5552. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  5553. isBox = "width" in props || "height" in props,
  5554. anim = this,
  5555. orig = {},
  5556. style = elem.style,
  5557. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  5558. dataShow = dataPriv.get( elem, "fxshow" );
  5559. // Queue-skipping animations hijack the fx hooks
  5560. if ( !opts.queue ) {
  5561. hooks = jQuery._queueHooks( elem, "fx" );
  5562. if ( hooks.unqueued == null ) {
  5563. hooks.unqueued = 0;
  5564. oldfire = hooks.empty.fire;
  5565. hooks.empty.fire = function() {
  5566. if ( !hooks.unqueued ) {
  5567. oldfire();
  5568. }
  5569. };
  5570. }
  5571. hooks.unqueued++;
  5572. anim.always( function() {
  5573. // Ensure the complete handler is called before this completes
  5574. anim.always( function() {
  5575. hooks.unqueued--;
  5576. if ( !jQuery.queue( elem, "fx" ).length ) {
  5577. hooks.empty.fire();
  5578. }
  5579. } );
  5580. } );
  5581. }
  5582. // Detect show/hide animations
  5583. for ( prop in props ) {
  5584. value = props[ prop ];
  5585. if ( rfxtypes.test( value ) ) {
  5586. delete props[ prop ];
  5587. toggle = toggle || value === "toggle";
  5588. if ( value === ( hidden ? "hide" : "show" ) ) {
  5589. // Pretend to be hidden if this is a "show" and
  5590. // there is still data from a stopped show/hide
  5591. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  5592. hidden = true;
  5593. // Ignore all other no-op show/hide data
  5594. } else {
  5595. continue;
  5596. }
  5597. }
  5598. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  5599. }
  5600. }
  5601. // Bail out if this is a no-op like .hide().hide()
  5602. propTween = !jQuery.isEmptyObject( props );
  5603. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  5604. return;
  5605. }
  5606. // Restrict "overflow" and "display" styles during box animations
  5607. if ( isBox && elem.nodeType === 1 ) {
  5608. // Support: IE <=9 - 11, Edge 12 - 13
  5609. // Record all 3 overflow attributes because IE does not infer the shorthand
  5610. // from identically-valued overflowX and overflowY
  5611. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  5612. // Identify a display type, preferring old show/hide data over the CSS cascade
  5613. restoreDisplay = dataShow && dataShow.display;
  5614. if ( restoreDisplay == null ) {
  5615. restoreDisplay = dataPriv.get( elem, "display" );
  5616. }
  5617. display = jQuery.css( elem, "display" );
  5618. if ( display === "none" ) {
  5619. if ( restoreDisplay ) {
  5620. display = restoreDisplay;
  5621. } else {
  5622. // Get nonempty value(s) by temporarily forcing visibility
  5623. showHide( [ elem ], true );
  5624. restoreDisplay = elem.style.display || restoreDisplay;
  5625. display = jQuery.css( elem, "display" );
  5626. showHide( [ elem ] );
  5627. }
  5628. }
  5629. // Animate inline elements as inline-block
  5630. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  5631. if ( jQuery.css( elem, "float" ) === "none" ) {
  5632. // Restore the original display value at the end of pure show/hide animations
  5633. if ( !propTween ) {
  5634. anim.done( function() {
  5635. style.display = restoreDisplay;
  5636. } );
  5637. if ( restoreDisplay == null ) {
  5638. display = style.display;
  5639. restoreDisplay = display === "none" ? "" : display;
  5640. }
  5641. }
  5642. style.display = "inline-block";
  5643. }
  5644. }
  5645. }
  5646. if ( opts.overflow ) {
  5647. style.overflow = "hidden";
  5648. anim.always( function() {
  5649. style.overflow = opts.overflow[ 0 ];
  5650. style.overflowX = opts.overflow[ 1 ];
  5651. style.overflowY = opts.overflow[ 2 ];
  5652. } );
  5653. }
  5654. // Implement show/hide animations
  5655. propTween = false;
  5656. for ( prop in orig ) {
  5657. // General show/hide setup for this element animation
  5658. if ( !propTween ) {
  5659. if ( dataShow ) {
  5660. if ( "hidden" in dataShow ) {
  5661. hidden = dataShow.hidden;
  5662. }
  5663. } else {
  5664. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  5665. }
  5666. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  5667. if ( toggle ) {
  5668. dataShow.hidden = !hidden;
  5669. }
  5670. // Show elements before animating them
  5671. if ( hidden ) {
  5672. showHide( [ elem ], true );
  5673. }
  5674. /* eslint-disable no-loop-func */
  5675. anim.done( function() {
  5676. /* eslint-enable no-loop-func */
  5677. // The final step of a "hide" animation is actually hiding the element
  5678. if ( !hidden ) {
  5679. showHide( [ elem ] );
  5680. }
  5681. dataPriv.remove( elem, "fxshow" );
  5682. for ( prop in orig ) {
  5683. jQuery.style( elem, prop, orig[ prop ] );
  5684. }
  5685. } );
  5686. }
  5687. // Per-property setup
  5688. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  5689. if ( !( prop in dataShow ) ) {
  5690. dataShow[ prop ] = propTween.start;
  5691. if ( hidden ) {
  5692. propTween.end = propTween.start;
  5693. propTween.start = 0;
  5694. }
  5695. }
  5696. }
  5697. }
  5698. function propFilter( props, specialEasing ) {
  5699. var index, name, easing, value, hooks;
  5700. // camelCase, specialEasing and expand cssHook pass
  5701. for ( index in props ) {
  5702. name = jQuery.camelCase( index );
  5703. easing = specialEasing[ name ];
  5704. value = props[ index ];
  5705. if ( jQuery.isArray( value ) ) {
  5706. easing = value[ 1 ];
  5707. value = props[ index ] = value[ 0 ];
  5708. }
  5709. if ( index !== name ) {
  5710. props[ name ] = value;
  5711. delete props[ index ];
  5712. }
  5713. hooks = jQuery.cssHooks[ name ];
  5714. if ( hooks && "expand" in hooks ) {
  5715. value = hooks.expand( value );
  5716. delete props[ name ];
  5717. // Not quite $.extend, this won't overwrite existing keys.
  5718. // Reusing 'index' because we have the correct "name"
  5719. for ( index in value ) {
  5720. if ( !( index in props ) ) {
  5721. props[ index ] = value[ index ];
  5722. specialEasing[ index ] = easing;
  5723. }
  5724. }
  5725. } else {
  5726. specialEasing[ name ] = easing;
  5727. }
  5728. }
  5729. }
  5730. function Animation( elem, properties, options ) {
  5731. var result,
  5732. stopped,
  5733. index = 0,
  5734. length = Animation.prefilters.length,
  5735. deferred = jQuery.Deferred().always( function() {
  5736. // Don't match elem in the :animated selector
  5737. delete tick.elem;
  5738. } ),
  5739. tick = function() {
  5740. if ( stopped ) {
  5741. return false;
  5742. }
  5743. var currentTime = fxNow || createFxNow(),
  5744. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  5745. // Support: Android 2.3 only
  5746. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  5747. temp = remaining / animation.duration || 0,
  5748. percent = 1 - temp,
  5749. index = 0,
  5750. length = animation.tweens.length;
  5751. for ( ; index < length; index++ ) {
  5752. animation.tweens[ index ].run( percent );
  5753. }
  5754. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  5755. if ( percent < 1 && length ) {
  5756. return remaining;
  5757. } else {
  5758. deferred.resolveWith( elem, [ animation ] );
  5759. return false;
  5760. }
  5761. },
  5762. animation = deferred.promise( {
  5763. elem: elem,
  5764. props: jQuery.extend( {}, properties ),
  5765. opts: jQuery.extend( true, {
  5766. specialEasing: {},
  5767. easing: jQuery.easing._default
  5768. }, options ),
  5769. originalProperties: properties,
  5770. originalOptions: options,
  5771. startTime: fxNow || createFxNow(),
  5772. duration: options.duration,
  5773. tweens: [],
  5774. createTween: function( prop, end ) {
  5775. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  5776. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  5777. animation.tweens.push( tween );
  5778. return tween;
  5779. },
  5780. stop: function( gotoEnd ) {
  5781. var index = 0,
  5782. // If we are going to the end, we want to run all the tweens
  5783. // otherwise we skip this part
  5784. length = gotoEnd ? animation.tweens.length : 0;
  5785. if ( stopped ) {
  5786. return this;
  5787. }
  5788. stopped = true;
  5789. for ( ; index < length; index++ ) {
  5790. animation.tweens[ index ].run( 1 );
  5791. }
  5792. // Resolve when we played the last frame; otherwise, reject
  5793. if ( gotoEnd ) {
  5794. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  5795. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  5796. } else {
  5797. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  5798. }
  5799. return this;
  5800. }
  5801. } ),
  5802. props = animation.props;
  5803. propFilter( props, animation.opts.specialEasing );
  5804. for ( ; index < length; index++ ) {
  5805. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  5806. if ( result ) {
  5807. if ( jQuery.isFunction( result.stop ) ) {
  5808. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  5809. jQuery.proxy( result.stop, result );
  5810. }
  5811. return result;
  5812. }
  5813. }
  5814. jQuery.map( props, createTween, animation );
  5815. if ( jQuery.isFunction( animation.opts.start ) ) {
  5816. animation.opts.start.call( elem, animation );
  5817. }
  5818. jQuery.fx.timer(
  5819. jQuery.extend( tick, {
  5820. elem: elem,
  5821. anim: animation,
  5822. queue: animation.opts.queue
  5823. } )
  5824. );
  5825. // attach callbacks from options
  5826. return animation.progress( animation.opts.progress )
  5827. .done( animation.opts.done, animation.opts.complete )
  5828. .fail( animation.opts.fail )
  5829. .always( animation.opts.always );
  5830. }
  5831. jQuery.Animation = jQuery.extend( Animation, {
  5832. tweeners: {
  5833. "*": [ function( prop, value ) {
  5834. var tween = this.createTween( prop, value );
  5835. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  5836. return tween;
  5837. } ]
  5838. },
  5839. tweener: function( props, callback ) {
  5840. if ( jQuery.isFunction( props ) ) {
  5841. callback = props;
  5842. props = [ "*" ];
  5843. } else {
  5844. props = props.match( rnothtmlwhite );
  5845. }
  5846. var prop,
  5847. index = 0,
  5848. length = props.length;
  5849. for ( ; index < length; index++ ) {
  5850. prop = props[ index ];
  5851. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  5852. Animation.tweeners[ prop ].unshift( callback );
  5853. }
  5854. },
  5855. prefilters: [ defaultPrefilter ],
  5856. prefilter: function( callback, prepend ) {
  5857. if ( prepend ) {
  5858. Animation.prefilters.unshift( callback );
  5859. } else {
  5860. Animation.prefilters.push( callback );
  5861. }
  5862. }
  5863. } );
  5864. jQuery.speed = function( speed, easing, fn ) {
  5865. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  5866. complete: fn || !fn && easing ||
  5867. jQuery.isFunction( speed ) && speed,
  5868. duration: speed,
  5869. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  5870. };
  5871. // Go to the end state if fx are off or if document is hidden
  5872. if ( jQuery.fx.off || document.hidden ) {
  5873. opt.duration = 0;
  5874. } else {
  5875. if ( typeof opt.duration !== "number" ) {
  5876. if ( opt.duration in jQuery.fx.speeds ) {
  5877. opt.duration = jQuery.fx.speeds[ opt.duration ];
  5878. } else {
  5879. opt.duration = jQuery.fx.speeds._default;
  5880. }
  5881. }
  5882. }
  5883. // Normalize opt.queue - true/undefined/null -> "fx"
  5884. if ( opt.queue == null || opt.queue === true ) {
  5885. opt.queue = "fx";
  5886. }
  5887. // Queueing
  5888. opt.old = opt.complete;
  5889. opt.complete = function() {
  5890. if ( jQuery.isFunction( opt.old ) ) {
  5891. opt.old.call( this );
  5892. }
  5893. if ( opt.queue ) {
  5894. jQuery.dequeue( this, opt.queue );
  5895. }
  5896. };
  5897. return opt;
  5898. };
  5899. jQuery.fn.extend( {
  5900. fadeTo: function( speed, to, easing, callback ) {
  5901. // Show any hidden elements after setting opacity to 0
  5902. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  5903. // Animate to the value specified
  5904. .end().animate( { opacity: to }, speed, easing, callback );
  5905. },
  5906. animate: function( prop, speed, easing, callback ) {
  5907. var empty = jQuery.isEmptyObject( prop ),
  5908. optall = jQuery.speed( speed, easing, callback ),
  5909. doAnimation = function() {
  5910. // Operate on a copy of prop so per-property easing won't be lost
  5911. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  5912. // Empty animations, or finishing resolves immediately
  5913. if ( empty || dataPriv.get( this, "finish" ) ) {
  5914. anim.stop( true );
  5915. }
  5916. };
  5917. doAnimation.finish = doAnimation;
  5918. return empty || optall.queue === false ?
  5919. this.each( doAnimation ) :
  5920. this.queue( optall.queue, doAnimation );
  5921. },
  5922. stop: function( type, clearQueue, gotoEnd ) {
  5923. var stopQueue = function( hooks ) {
  5924. var stop = hooks.stop;
  5925. delete hooks.stop;
  5926. stop( gotoEnd );
  5927. };
  5928. if ( typeof type !== "string" ) {
  5929. gotoEnd = clearQueue;
  5930. clearQueue = type;
  5931. type = undefined;
  5932. }
  5933. if ( clearQueue && type !== false ) {
  5934. this.queue( type || "fx", [] );
  5935. }
  5936. return this.each( function() {
  5937. var dequeue = true,
  5938. index = type != null && type + "queueHooks",
  5939. timers = jQuery.timers,
  5940. data = dataPriv.get( this );
  5941. if ( index ) {
  5942. if ( data[ index ] && data[ index ].stop ) {
  5943. stopQueue( data[ index ] );
  5944. }
  5945. } else {
  5946. for ( index in data ) {
  5947. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  5948. stopQueue( data[ index ] );
  5949. }
  5950. }
  5951. }
  5952. for ( index = timers.length; index--; ) {
  5953. if ( timers[ index ].elem === this &&
  5954. ( type == null || timers[ index ].queue === type ) ) {
  5955. timers[ index ].anim.stop( gotoEnd );
  5956. dequeue = false;
  5957. timers.splice( index, 1 );
  5958. }
  5959. }
  5960. // Start the next in the queue if the last step wasn't forced.
  5961. // Timers currently will call their complete callbacks, which
  5962. // will dequeue but only if they were gotoEnd.
  5963. if ( dequeue || !gotoEnd ) {
  5964. jQuery.dequeue( this, type );
  5965. }
  5966. } );
  5967. },
  5968. finish: function( type ) {
  5969. if ( type !== false ) {
  5970. type = type || "fx";
  5971. }
  5972. return this.each( function() {
  5973. var index,
  5974. data = dataPriv.get( this ),
  5975. queue = data[ type + "queue" ],
  5976. hooks = data[ type + "queueHooks" ],
  5977. timers = jQuery.timers,
  5978. length = queue ? queue.length : 0;
  5979. // Enable finishing flag on private data
  5980. data.finish = true;
  5981. // Empty the queue first
  5982. jQuery.queue( this, type, [] );
  5983. if ( hooks && hooks.stop ) {
  5984. hooks.stop.call( this, true );
  5985. }
  5986. // Look for any active animations, and finish them
  5987. for ( index = timers.length; index--; ) {
  5988. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  5989. timers[ index ].anim.stop( true );
  5990. timers.splice( index, 1 );
  5991. }
  5992. }
  5993. // Look for any animations in the old queue and finish them
  5994. for ( index = 0; index < length; index++ ) {
  5995. if ( queue[ index ] && queue[ index ].finish ) {
  5996. queue[ index ].finish.call( this );
  5997. }
  5998. }
  5999. // Turn off finishing flag
  6000. delete data.finish;
  6001. } );
  6002. }
  6003. } );
  6004. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6005. var cssFn = jQuery.fn[ name ];
  6006. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6007. return speed == null || typeof speed === "boolean" ?
  6008. cssFn.apply( this, arguments ) :
  6009. this.animate( genFx( name, true ), speed, easing, callback );
  6010. };
  6011. } );
  6012. // Generate shortcuts for custom animations
  6013. jQuery.each( {
  6014. slideDown: genFx( "show" ),
  6015. slideUp: genFx( "hide" ),
  6016. slideToggle: genFx( "toggle" ),
  6017. fadeIn: { opacity: "show" },
  6018. fadeOut: { opacity: "hide" },
  6019. fadeToggle: { opacity: "toggle" }
  6020. }, function( name, props ) {
  6021. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6022. return this.animate( props, speed, easing, callback );
  6023. };
  6024. } );
  6025. jQuery.timers = [];
  6026. jQuery.fx.tick = function() {
  6027. var timer,
  6028. i = 0,
  6029. timers = jQuery.timers;
  6030. fxNow = jQuery.now();
  6031. for ( ; i < timers.length; i++ ) {
  6032. timer = timers[ i ];
  6033. // Checks the timer has not already been removed
  6034. if ( !timer() && timers[ i ] === timer ) {
  6035. timers.splice( i--, 1 );
  6036. }
  6037. }
  6038. if ( !timers.length ) {
  6039. jQuery.fx.stop();
  6040. }
  6041. fxNow = undefined;
  6042. };
  6043. jQuery.fx.timer = function( timer ) {
  6044. jQuery.timers.push( timer );
  6045. if ( timer() ) {
  6046. jQuery.fx.start();
  6047. } else {
  6048. jQuery.timers.pop();
  6049. }
  6050. };
  6051. jQuery.fx.interval = 13;
  6052. jQuery.fx.start = function() {
  6053. if ( !timerId ) {
  6054. timerId = window.requestAnimationFrame ?
  6055. window.requestAnimationFrame( raf ) :
  6056. window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
  6057. }
  6058. };
  6059. jQuery.fx.stop = function() {
  6060. if ( window.cancelAnimationFrame ) {
  6061. window.cancelAnimationFrame( timerId );
  6062. } else {
  6063. window.clearInterval( timerId );
  6064. }
  6065. timerId = null;
  6066. };
  6067. jQuery.fx.speeds = {
  6068. slow: 600,
  6069. fast: 200,
  6070. // Default speed
  6071. _default: 400
  6072. };
  6073. // Based off of the plugin by Clint Helfers, with permission.
  6074. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6075. jQuery.fn.delay = function( time, type ) {
  6076. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6077. type = type || "fx";
  6078. return this.queue( type, function( next, hooks ) {
  6079. var timeout = window.setTimeout( next, time );
  6080. hooks.stop = function() {
  6081. window.clearTimeout( timeout );
  6082. };
  6083. } );
  6084. };
  6085. ( function() {
  6086. var input = document.createElement( "input" ),
  6087. select = document.createElement( "select" ),
  6088. opt = select.appendChild( document.createElement( "option" ) );
  6089. input.type = "checkbox";
  6090. // Support: Android <=4.3 only
  6091. // Default value for a checkbox should be "on"
  6092. support.checkOn = input.value !== "";
  6093. // Support: IE <=11 only
  6094. // Must access selectedIndex to make default options select
  6095. support.optSelected = opt.selected;
  6096. // Support: IE <=11 only
  6097. // An input loses its value after becoming a radio
  6098. input = document.createElement( "input" );
  6099. input.value = "t";
  6100. input.type = "radio";
  6101. support.radioValue = input.value === "t";
  6102. } )();
  6103. var boolHook,
  6104. attrHandle = jQuery.expr.attrHandle;
  6105. jQuery.fn.extend( {
  6106. attr: function( name, value ) {
  6107. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6108. },
  6109. removeAttr: function( name ) {
  6110. return this.each( function() {
  6111. jQuery.removeAttr( this, name );
  6112. } );
  6113. }
  6114. } );
  6115. jQuery.extend( {
  6116. attr: function( elem, name, value ) {
  6117. var ret, hooks,
  6118. nType = elem.nodeType;
  6119. // Don't get/set attributes on text, comment and attribute nodes
  6120. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6121. return;
  6122. }
  6123. // Fallback to prop when attributes are not supported
  6124. if ( typeof elem.getAttribute === "undefined" ) {
  6125. return jQuery.prop( elem, name, value );
  6126. }
  6127. // Attribute hooks are determined by the lowercase version
  6128. // Grab necessary hook if one is defined
  6129. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6130. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  6131. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  6132. }
  6133. if ( value !== undefined ) {
  6134. if ( value === null ) {
  6135. jQuery.removeAttr( elem, name );
  6136. return;
  6137. }
  6138. if ( hooks && "set" in hooks &&
  6139. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6140. return ret;
  6141. }
  6142. elem.setAttribute( name, value + "" );
  6143. return value;
  6144. }
  6145. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6146. return ret;
  6147. }
  6148. ret = jQuery.find.attr( elem, name );
  6149. // Non-existent attributes return null, we normalize to undefined
  6150. return ret == null ? undefined : ret;
  6151. },
  6152. attrHooks: {
  6153. type: {
  6154. set: function( elem, value ) {
  6155. if ( !support.radioValue && value === "radio" &&
  6156. jQuery.nodeName( elem, "input" ) ) {
  6157. var val = elem.value;
  6158. elem.setAttribute( "type", value );
  6159. if ( val ) {
  6160. elem.value = val;
  6161. }
  6162. return value;
  6163. }
  6164. }
  6165. }
  6166. },
  6167. removeAttr: function( elem, value ) {
  6168. var name,
  6169. i = 0,
  6170. // Attribute names can contain non-HTML whitespace characters
  6171. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  6172. attrNames = value && value.match( rnothtmlwhite );
  6173. if ( attrNames && elem.nodeType === 1 ) {
  6174. while ( ( name = attrNames[ i++ ] ) ) {
  6175. elem.removeAttribute( name );
  6176. }
  6177. }
  6178. }
  6179. } );
  6180. // Hooks for boolean attributes
  6181. boolHook = {
  6182. set: function( elem, value, name ) {
  6183. if ( value === false ) {
  6184. // Remove boolean attributes when set to false
  6185. jQuery.removeAttr( elem, name );
  6186. } else {
  6187. elem.setAttribute( name, name );
  6188. }
  6189. return name;
  6190. }
  6191. };
  6192. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6193. var getter = attrHandle[ name ] || jQuery.find.attr;
  6194. attrHandle[ name ] = function( elem, name, isXML ) {
  6195. var ret, handle,
  6196. lowercaseName = name.toLowerCase();
  6197. if ( !isXML ) {
  6198. // Avoid an infinite loop by temporarily removing this function from the getter
  6199. handle = attrHandle[ lowercaseName ];
  6200. attrHandle[ lowercaseName ] = ret;
  6201. ret = getter( elem, name, isXML ) != null ?
  6202. lowercaseName :
  6203. null;
  6204. attrHandle[ lowercaseName ] = handle;
  6205. }
  6206. return ret;
  6207. };
  6208. } );
  6209. var rfocusable = /^(?:input|select|textarea|button)$/i,
  6210. rclickable = /^(?:a|area)$/i;
  6211. jQuery.fn.extend( {
  6212. prop: function( name, value ) {
  6213. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  6214. },
  6215. removeProp: function( name ) {
  6216. return this.each( function() {
  6217. delete this[ jQuery.propFix[ name ] || name ];
  6218. } );
  6219. }
  6220. } );
  6221. jQuery.extend( {
  6222. prop: function( elem, name, value ) {
  6223. var ret, hooks,
  6224. nType = elem.nodeType;
  6225. // Don't get/set properties on text, comment and attribute nodes
  6226. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6227. return;
  6228. }
  6229. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6230. // Fix name and attach hooks
  6231. name = jQuery.propFix[ name ] || name;
  6232. hooks = jQuery.propHooks[ name ];
  6233. }
  6234. if ( value !== undefined ) {
  6235. if ( hooks && "set" in hooks &&
  6236. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6237. return ret;
  6238. }
  6239. return ( elem[ name ] = value );
  6240. }
  6241. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6242. return ret;
  6243. }
  6244. return elem[ name ];
  6245. },
  6246. propHooks: {
  6247. tabIndex: {
  6248. get: function( elem ) {
  6249. // Support: IE <=9 - 11 only
  6250. // elem.tabIndex doesn't always return the
  6251. // correct value when it hasn't been explicitly set
  6252. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  6253. // Use proper attribute retrieval(#12072)
  6254. var tabindex = jQuery.find.attr( elem, "tabindex" );
  6255. if ( tabindex ) {
  6256. return parseInt( tabindex, 10 );
  6257. }
  6258. if (
  6259. rfocusable.test( elem.nodeName ) ||
  6260. rclickable.test( elem.nodeName ) &&
  6261. elem.href
  6262. ) {
  6263. return 0;
  6264. }
  6265. return -1;
  6266. }
  6267. }
  6268. },
  6269. propFix: {
  6270. "for": "htmlFor",
  6271. "class": "className"
  6272. }
  6273. } );
  6274. // Support: IE <=11 only
  6275. // Accessing the selectedIndex property
  6276. // forces the browser to respect setting selected
  6277. // on the option
  6278. // The getter ensures a default option is selected
  6279. // when in an optgroup
  6280. // eslint rule "no-unused-expressions" is disabled for this code
  6281. // since it considers such accessions noop
  6282. if ( !support.optSelected ) {
  6283. jQuery.propHooks.selected = {
  6284. get: function( elem ) {
  6285. /* eslint no-unused-expressions: "off" */
  6286. var parent = elem.parentNode;
  6287. if ( parent && parent.parentNode ) {
  6288. parent.parentNode.selectedIndex;
  6289. }
  6290. return null;
  6291. },
  6292. set: function( elem ) {
  6293. /* eslint no-unused-expressions: "off" */
  6294. var parent = elem.parentNode;
  6295. if ( parent ) {
  6296. parent.selectedIndex;
  6297. if ( parent.parentNode ) {
  6298. parent.parentNode.selectedIndex;
  6299. }
  6300. }
  6301. }
  6302. };
  6303. }
  6304. jQuery.each( [
  6305. "tabIndex",
  6306. "readOnly",
  6307. "maxLength",
  6308. "cellSpacing",
  6309. "cellPadding",
  6310. "rowSpan",
  6311. "colSpan",
  6312. "useMap",
  6313. "frameBorder",
  6314. "contentEditable"
  6315. ], function() {
  6316. jQuery.propFix[ this.toLowerCase() ] = this;
  6317. } );
  6318. // Strip and collapse whitespace according to HTML spec
  6319. // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
  6320. function stripAndCollapse( value ) {
  6321. var tokens = value.match( rnothtmlwhite ) || [];
  6322. return tokens.join( " " );
  6323. }
  6324. function getClass( elem ) {
  6325. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  6326. }
  6327. jQuery.fn.extend( {
  6328. addClass: function( value ) {
  6329. var classes, elem, cur, curValue, clazz, j, finalValue,
  6330. i = 0;
  6331. if ( jQuery.isFunction( value ) ) {
  6332. return this.each( function( j ) {
  6333. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  6334. } );
  6335. }
  6336. if ( typeof value === "string" && value ) {
  6337. classes = value.match( rnothtmlwhite ) || [];
  6338. while ( ( elem = this[ i++ ] ) ) {
  6339. curValue = getClass( elem );
  6340. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6341. if ( cur ) {
  6342. j = 0;
  6343. while ( ( clazz = classes[ j++ ] ) ) {
  6344. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  6345. cur += clazz + " ";
  6346. }
  6347. }
  6348. // Only assign if different to avoid unneeded rendering.
  6349. finalValue = stripAndCollapse( cur );
  6350. if ( curValue !== finalValue ) {
  6351. elem.setAttribute( "class", finalValue );
  6352. }
  6353. }
  6354. }
  6355. }
  6356. return this;
  6357. },
  6358. removeClass: function( value ) {
  6359. var classes, elem, cur, curValue, clazz, j, finalValue,
  6360. i = 0;
  6361. if ( jQuery.isFunction( value ) ) {
  6362. return this.each( function( j ) {
  6363. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  6364. } );
  6365. }
  6366. if ( !arguments.length ) {
  6367. return this.attr( "class", "" );
  6368. }
  6369. if ( typeof value === "string" && value ) {
  6370. classes = value.match( rnothtmlwhite ) || [];
  6371. while ( ( elem = this[ i++ ] ) ) {
  6372. curValue = getClass( elem );
  6373. // This expression is here for better compressibility (see addClass)
  6374. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6375. if ( cur ) {
  6376. j = 0;
  6377. while ( ( clazz = classes[ j++ ] ) ) {
  6378. // Remove *all* instances
  6379. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  6380. cur = cur.replace( " " + clazz + " ", " " );
  6381. }
  6382. }
  6383. // Only assign if different to avoid unneeded rendering.
  6384. finalValue = stripAndCollapse( cur );
  6385. if ( curValue !== finalValue ) {
  6386. elem.setAttribute( "class", finalValue );
  6387. }
  6388. }
  6389. }
  6390. }
  6391. return this;
  6392. },
  6393. toggleClass: function( value, stateVal ) {
  6394. var type = typeof value;
  6395. if ( typeof stateVal === "boolean" && type === "string" ) {
  6396. return stateVal ? this.addClass( value ) : this.removeClass( value );
  6397. }
  6398. if ( jQuery.isFunction( value ) ) {
  6399. return this.each( function( i ) {
  6400. jQuery( this ).toggleClass(
  6401. value.call( this, i, getClass( this ), stateVal ),
  6402. stateVal
  6403. );
  6404. } );
  6405. }
  6406. return this.each( function() {
  6407. var className, i, self, classNames;
  6408. if ( type === "string" ) {
  6409. // Toggle individual class names
  6410. i = 0;
  6411. self = jQuery( this );
  6412. classNames = value.match( rnothtmlwhite ) || [];
  6413. while ( ( className = classNames[ i++ ] ) ) {
  6414. // Check each className given, space separated list
  6415. if ( self.hasClass( className ) ) {
  6416. self.removeClass( className );
  6417. } else {
  6418. self.addClass( className );
  6419. }
  6420. }
  6421. // Toggle whole class name
  6422. } else if ( value === undefined || type === "boolean" ) {
  6423. className = getClass( this );
  6424. if ( className ) {
  6425. // Store className if set
  6426. dataPriv.set( this, "__className__", className );
  6427. }
  6428. // If the element has a class name or if we're passed `false`,
  6429. // then remove the whole classname (if there was one, the above saved it).
  6430. // Otherwise bring back whatever was previously saved (if anything),
  6431. // falling back to the empty string if nothing was stored.
  6432. if ( this.setAttribute ) {
  6433. this.setAttribute( "class",
  6434. className || value === false ?
  6435. "" :
  6436. dataPriv.get( this, "__className__" ) || ""
  6437. );
  6438. }
  6439. }
  6440. } );
  6441. },
  6442. hasClass: function( selector ) {
  6443. var className, elem,
  6444. i = 0;
  6445. className = " " + selector + " ";
  6446. while ( ( elem = this[ i++ ] ) ) {
  6447. if ( elem.nodeType === 1 &&
  6448. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  6449. return true;
  6450. }
  6451. }
  6452. return false;
  6453. }
  6454. } );
  6455. var rreturn = /\r/g;
  6456. jQuery.fn.extend( {
  6457. val: function( value ) {
  6458. var hooks, ret, isFunction,
  6459. elem = this[ 0 ];
  6460. if ( !arguments.length ) {
  6461. if ( elem ) {
  6462. hooks = jQuery.valHooks[ elem.type ] ||
  6463. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6464. if ( hooks &&
  6465. "get" in hooks &&
  6466. ( ret = hooks.get( elem, "value" ) ) !== undefined
  6467. ) {
  6468. return ret;
  6469. }
  6470. ret = elem.value;
  6471. // Handle most common string cases
  6472. if ( typeof ret === "string" ) {
  6473. return ret.replace( rreturn, "" );
  6474. }
  6475. // Handle cases where value is null/undef or number
  6476. return ret == null ? "" : ret;
  6477. }
  6478. return;
  6479. }
  6480. isFunction = jQuery.isFunction( value );
  6481. return this.each( function( i ) {
  6482. var val;
  6483. if ( this.nodeType !== 1 ) {
  6484. return;
  6485. }
  6486. if ( isFunction ) {
  6487. val = value.call( this, i, jQuery( this ).val() );
  6488. } else {
  6489. val = value;
  6490. }
  6491. // Treat null/undefined as ""; convert numbers to string
  6492. if ( val == null ) {
  6493. val = "";
  6494. } else if ( typeof val === "number" ) {
  6495. val += "";
  6496. } else if ( jQuery.isArray( val ) ) {
  6497. val = jQuery.map( val, function( value ) {
  6498. return value == null ? "" : value + "";
  6499. } );
  6500. }
  6501. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6502. // If set returns undefined, fall back to normal setting
  6503. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  6504. this.value = val;
  6505. }
  6506. } );
  6507. }
  6508. } );
  6509. jQuery.extend( {
  6510. valHooks: {
  6511. option: {
  6512. get: function( elem ) {
  6513. var val = jQuery.find.attr( elem, "value" );
  6514. return val != null ?
  6515. val :
  6516. // Support: IE <=10 - 11 only
  6517. // option.text throws exceptions (#14686, #14858)
  6518. // Strip and collapse whitespace
  6519. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  6520. stripAndCollapse( jQuery.text( elem ) );
  6521. }
  6522. },
  6523. select: {
  6524. get: function( elem ) {
  6525. var value, option, i,
  6526. options = elem.options,
  6527. index = elem.selectedIndex,
  6528. one = elem.type === "select-one",
  6529. values = one ? null : [],
  6530. max = one ? index + 1 : options.length;
  6531. if ( index < 0 ) {
  6532. i = max;
  6533. } else {
  6534. i = one ? index : 0;
  6535. }
  6536. // Loop through all the selected options
  6537. for ( ; i < max; i++ ) {
  6538. option = options[ i ];
  6539. // Support: IE <=9 only
  6540. // IE8-9 doesn't update selected after form reset (#2551)
  6541. if ( ( option.selected || i === index ) &&
  6542. // Don't return options that are disabled or in a disabled optgroup
  6543. !option.disabled &&
  6544. ( !option.parentNode.disabled ||
  6545. !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
  6546. // Get the specific value for the option
  6547. value = jQuery( option ).val();
  6548. // We don't need an array for one selects
  6549. if ( one ) {
  6550. return value;
  6551. }
  6552. // Multi-Selects return an array
  6553. values.push( value );
  6554. }
  6555. }
  6556. return values;
  6557. },
  6558. set: function( elem, value ) {
  6559. var optionSet, option,
  6560. options = elem.options,
  6561. values = jQuery.makeArray( value ),
  6562. i = options.length;
  6563. while ( i-- ) {
  6564. option = options[ i ];
  6565. /* eslint-disable no-cond-assign */
  6566. if ( option.selected =
  6567. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  6568. ) {
  6569. optionSet = true;
  6570. }
  6571. /* eslint-enable no-cond-assign */
  6572. }
  6573. // Force browsers to behave consistently when non-matching value is set
  6574. if ( !optionSet ) {
  6575. elem.selectedIndex = -1;
  6576. }
  6577. return values;
  6578. }
  6579. }
  6580. }
  6581. } );
  6582. // Radios and checkboxes getter/setter
  6583. jQuery.each( [ "radio", "checkbox" ], function() {
  6584. jQuery.valHooks[ this ] = {
  6585. set: function( elem, value ) {
  6586. if ( jQuery.isArray( value ) ) {
  6587. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  6588. }
  6589. }
  6590. };
  6591. if ( !support.checkOn ) {
  6592. jQuery.valHooks[ this ].get = function( elem ) {
  6593. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  6594. };
  6595. }
  6596. } );
  6597. // Return jQuery for attributes-only inclusion
  6598. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  6599. jQuery.extend( jQuery.event, {
  6600. trigger: function( event, data, elem, onlyHandlers ) {
  6601. var i, cur, tmp, bubbleType, ontype, handle, special,
  6602. eventPath = [ elem || document ],
  6603. type = hasOwn.call( event, "type" ) ? event.type : event,
  6604. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  6605. cur = tmp = elem = elem || document;
  6606. // Don't do events on text and comment nodes
  6607. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  6608. return;
  6609. }
  6610. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6611. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  6612. return;
  6613. }
  6614. if ( type.indexOf( "." ) > -1 ) {
  6615. // Namespaced trigger; create a regexp to match event type in handle()
  6616. namespaces = type.split( "." );
  6617. type = namespaces.shift();
  6618. namespaces.sort();
  6619. }
  6620. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  6621. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6622. event = event[ jQuery.expando ] ?
  6623. event :
  6624. new jQuery.Event( type, typeof event === "object" && event );
  6625. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6626. event.isTrigger = onlyHandlers ? 2 : 3;
  6627. event.namespace = namespaces.join( "." );
  6628. event.rnamespace = event.namespace ?
  6629. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  6630. null;
  6631. // Clean up the event in case it is being reused
  6632. event.result = undefined;
  6633. if ( !event.target ) {
  6634. event.target = elem;
  6635. }
  6636. // Clone any incoming data and prepend the event, creating the handler arg list
  6637. data = data == null ?
  6638. [ event ] :
  6639. jQuery.makeArray( data, [ event ] );
  6640. // Allow special events to draw outside the lines
  6641. special = jQuery.event.special[ type ] || {};
  6642. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  6643. return;
  6644. }
  6645. // Determine event propagation path in advance, per W3C events spec (#9951)
  6646. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6647. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  6648. bubbleType = special.delegateType || type;
  6649. if ( !rfocusMorph.test( bubbleType + type ) ) {
  6650. cur = cur.parentNode;
  6651. }
  6652. for ( ; cur; cur = cur.parentNode ) {
  6653. eventPath.push( cur );
  6654. tmp = cur;
  6655. }
  6656. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6657. if ( tmp === ( elem.ownerDocument || document ) ) {
  6658. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  6659. }
  6660. }
  6661. // Fire handlers on the event path
  6662. i = 0;
  6663. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  6664. event.type = i > 1 ?
  6665. bubbleType :
  6666. special.bindType || type;
  6667. // jQuery handler
  6668. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  6669. dataPriv.get( cur, "handle" );
  6670. if ( handle ) {
  6671. handle.apply( cur, data );
  6672. }
  6673. // Native handler
  6674. handle = ontype && cur[ ontype ];
  6675. if ( handle && handle.apply && acceptData( cur ) ) {
  6676. event.result = handle.apply( cur, data );
  6677. if ( event.result === false ) {
  6678. event.preventDefault();
  6679. }
  6680. }
  6681. }
  6682. event.type = type;
  6683. // If nobody prevented the default action, do it now
  6684. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  6685. if ( ( !special._default ||
  6686. special._default.apply( eventPath.pop(), data ) === false ) &&
  6687. acceptData( elem ) ) {
  6688. // Call a native DOM method on the target with the same name as the event.
  6689. // Don't do default actions on window, that's where global variables be (#6170)
  6690. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  6691. // Don't re-trigger an onFOO event when we call its FOO() method
  6692. tmp = elem[ ontype ];
  6693. if ( tmp ) {
  6694. elem[ ontype ] = null;
  6695. }
  6696. // Prevent re-triggering of the same event, since we already bubbled it above
  6697. jQuery.event.triggered = type;
  6698. elem[ type ]();
  6699. jQuery.event.triggered = undefined;
  6700. if ( tmp ) {
  6701. elem[ ontype ] = tmp;
  6702. }
  6703. }
  6704. }
  6705. }
  6706. return event.result;
  6707. },
  6708. // Piggyback on a donor event to simulate a different one
  6709. // Used only for `focus(in | out)` events
  6710. simulate: function( type, elem, event ) {
  6711. var e = jQuery.extend(
  6712. new jQuery.Event(),
  6713. event,
  6714. {
  6715. type: type,
  6716. isSimulated: true
  6717. }
  6718. );
  6719. jQuery.event.trigger( e, null, elem );
  6720. }
  6721. } );
  6722. jQuery.fn.extend( {
  6723. trigger: function( type, data ) {
  6724. return this.each( function() {
  6725. jQuery.event.trigger( type, data, this );
  6726. } );
  6727. },
  6728. triggerHandler: function( type, data ) {
  6729. var elem = this[ 0 ];
  6730. if ( elem ) {
  6731. return jQuery.event.trigger( type, data, elem, true );
  6732. }
  6733. }
  6734. } );
  6735. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  6736. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  6737. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  6738. function( i, name ) {
  6739. // Handle event binding
  6740. jQuery.fn[ name ] = function( data, fn ) {
  6741. return arguments.length > 0 ?
  6742. this.on( name, null, data, fn ) :
  6743. this.trigger( name );
  6744. };
  6745. } );
  6746. jQuery.fn.extend( {
  6747. hover: function( fnOver, fnOut ) {
  6748. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  6749. }
  6750. } );
  6751. support.focusin = "onfocusin" in window;
  6752. // Support: Firefox <=44
  6753. // Firefox doesn't have focus(in | out) events
  6754. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6755. //
  6756. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  6757. // focus(in | out) events fire after focus & blur events,
  6758. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6759. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  6760. if ( !support.focusin ) {
  6761. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  6762. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6763. var handler = function( event ) {
  6764. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  6765. };
  6766. jQuery.event.special[ fix ] = {
  6767. setup: function() {
  6768. var doc = this.ownerDocument || this,
  6769. attaches = dataPriv.access( doc, fix );
  6770. if ( !attaches ) {
  6771. doc.addEventListener( orig, handler, true );
  6772. }
  6773. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  6774. },
  6775. teardown: function() {
  6776. var doc = this.ownerDocument || this,
  6777. attaches = dataPriv.access( doc, fix ) - 1;
  6778. if ( !attaches ) {
  6779. doc.removeEventListener( orig, handler, true );
  6780. dataPriv.remove( doc, fix );
  6781. } else {
  6782. dataPriv.access( doc, fix, attaches );
  6783. }
  6784. }
  6785. };
  6786. } );
  6787. }
  6788. var location = window.location;
  6789. var nonce = jQuery.now();
  6790. var rquery = ( /\?/ );
  6791. // Cross-browser xml parsing
  6792. jQuery.parseXML = function( data ) {
  6793. var xml;
  6794. if ( !data || typeof data !== "string" ) {
  6795. return null;
  6796. }
  6797. // Support: IE 9 - 11 only
  6798. // IE throws on parseFromString with invalid input.
  6799. try {
  6800. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  6801. } catch ( e ) {
  6802. xml = undefined;
  6803. }
  6804. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  6805. jQuery.error( "Invalid XML: " + data );
  6806. }
  6807. return xml;
  6808. };
  6809. var
  6810. rbracket = /\[\]$/,
  6811. rCRLF = /\r?\n/g,
  6812. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6813. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6814. function buildParams( prefix, obj, traditional, add ) {
  6815. var name;
  6816. if ( jQuery.isArray( obj ) ) {
  6817. // Serialize array item.
  6818. jQuery.each( obj, function( i, v ) {
  6819. if ( traditional || rbracket.test( prefix ) ) {
  6820. // Treat each array item as a scalar.
  6821. add( prefix, v );
  6822. } else {
  6823. // Item is non-scalar (array or object), encode its numeric index.
  6824. buildParams(
  6825. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  6826. v,
  6827. traditional,
  6828. add
  6829. );
  6830. }
  6831. } );
  6832. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  6833. // Serialize object item.
  6834. for ( name in obj ) {
  6835. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  6836. }
  6837. } else {
  6838. // Serialize scalar item.
  6839. add( prefix, obj );
  6840. }
  6841. }
  6842. // Serialize an array of form elements or a set of
  6843. // key/values into a query string
  6844. jQuery.param = function( a, traditional ) {
  6845. var prefix,
  6846. s = [],
  6847. add = function( key, valueOrFunction ) {
  6848. // If value is a function, invoke it and use its return value
  6849. var value = jQuery.isFunction( valueOrFunction ) ?
  6850. valueOrFunction() :
  6851. valueOrFunction;
  6852. s[ s.length ] = encodeURIComponent( key ) + "=" +
  6853. encodeURIComponent( value == null ? "" : value );
  6854. };
  6855. // If an array was passed in, assume that it is an array of form elements.
  6856. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  6857. // Serialize the form elements
  6858. jQuery.each( a, function() {
  6859. add( this.name, this.value );
  6860. } );
  6861. } else {
  6862. // If traditional, encode the "old" way (the way 1.3.2 or older
  6863. // did it), otherwise encode params recursively.
  6864. for ( prefix in a ) {
  6865. buildParams( prefix, a[ prefix ], traditional, add );
  6866. }
  6867. }
  6868. // Return the resulting serialization
  6869. return s.join( "&" );
  6870. };
  6871. jQuery.fn.extend( {
  6872. serialize: function() {
  6873. return jQuery.param( this.serializeArray() );
  6874. },
  6875. serializeArray: function() {
  6876. return this.map( function() {
  6877. // Can add propHook for "elements" to filter or add form elements
  6878. var elements = jQuery.prop( this, "elements" );
  6879. return elements ? jQuery.makeArray( elements ) : this;
  6880. } )
  6881. .filter( function() {
  6882. var type = this.type;
  6883. // Use .is( ":disabled" ) so that fieldset[disabled] works
  6884. return this.name && !jQuery( this ).is( ":disabled" ) &&
  6885. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  6886. ( this.checked || !rcheckableType.test( type ) );
  6887. } )
  6888. .map( function( i, elem ) {
  6889. var val = jQuery( this ).val();
  6890. if ( val == null ) {
  6891. return null;
  6892. }
  6893. if ( jQuery.isArray( val ) ) {
  6894. return jQuery.map( val, function( val ) {
  6895. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6896. } );
  6897. }
  6898. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6899. } ).get();
  6900. }
  6901. } );
  6902. var
  6903. r20 = /%20/g,
  6904. rhash = /#.*$/,
  6905. rantiCache = /([?&])_=[^&]*/,
  6906. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  6907. // #7653, #8125, #8152: local protocol detection
  6908. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  6909. rnoContent = /^(?:GET|HEAD)$/,
  6910. rprotocol = /^\/\//,
  6911. /* Prefilters
  6912. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  6913. * 2) These are called:
  6914. * - BEFORE asking for a transport
  6915. * - AFTER param serialization (s.data is a string if s.processData is true)
  6916. * 3) key is the dataType
  6917. * 4) the catchall symbol "*" can be used
  6918. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  6919. */
  6920. prefilters = {},
  6921. /* Transports bindings
  6922. * 1) key is the dataType
  6923. * 2) the catchall symbol "*" can be used
  6924. * 3) selection will start with transport dataType and THEN go to "*" if needed
  6925. */
  6926. transports = {},
  6927. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  6928. allTypes = "*/".concat( "*" ),
  6929. // Anchor tag for parsing the document origin
  6930. originAnchor = document.createElement( "a" );
  6931. originAnchor.href = location.href;
  6932. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  6933. function addToPrefiltersOrTransports( structure ) {
  6934. // dataTypeExpression is optional and defaults to "*"
  6935. return function( dataTypeExpression, func ) {
  6936. if ( typeof dataTypeExpression !== "string" ) {
  6937. func = dataTypeExpression;
  6938. dataTypeExpression = "*";
  6939. }
  6940. var dataType,
  6941. i = 0,
  6942. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  6943. if ( jQuery.isFunction( func ) ) {
  6944. // For each dataType in the dataTypeExpression
  6945. while ( ( dataType = dataTypes[ i++ ] ) ) {
  6946. // Prepend if requested
  6947. if ( dataType[ 0 ] === "+" ) {
  6948. dataType = dataType.slice( 1 ) || "*";
  6949. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  6950. // Otherwise append
  6951. } else {
  6952. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  6953. }
  6954. }
  6955. }
  6956. };
  6957. }
  6958. // Base inspection function for prefilters and transports
  6959. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  6960. var inspected = {},
  6961. seekingTransport = ( structure === transports );
  6962. function inspect( dataType ) {
  6963. var selected;
  6964. inspected[ dataType ] = true;
  6965. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  6966. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  6967. if ( typeof dataTypeOrTransport === "string" &&
  6968. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  6969. options.dataTypes.unshift( dataTypeOrTransport );
  6970. inspect( dataTypeOrTransport );
  6971. return false;
  6972. } else if ( seekingTransport ) {
  6973. return !( selected = dataTypeOrTransport );
  6974. }
  6975. } );
  6976. return selected;
  6977. }
  6978. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  6979. }
  6980. // A special extend for ajax options
  6981. // that takes "flat" options (not to be deep extended)
  6982. // Fixes #9887
  6983. function ajaxExtend( target, src ) {
  6984. var key, deep,
  6985. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  6986. for ( key in src ) {
  6987. if ( src[ key ] !== undefined ) {
  6988. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  6989. }
  6990. }
  6991. if ( deep ) {
  6992. jQuery.extend( true, target, deep );
  6993. }
  6994. return target;
  6995. }
  6996. /* Handles responses to an ajax request:
  6997. * - finds the right dataType (mediates between content-type and expected dataType)
  6998. * - returns the corresponding response
  6999. */
  7000. function ajaxHandleResponses( s, jqXHR, responses ) {
  7001. var ct, type, finalDataType, firstDataType,
  7002. contents = s.contents,
  7003. dataTypes = s.dataTypes;
  7004. // Remove auto dataType and get content-type in the process
  7005. while ( dataTypes[ 0 ] === "*" ) {
  7006. dataTypes.shift();
  7007. if ( ct === undefined ) {
  7008. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7009. }
  7010. }
  7011. // Check if we're dealing with a known content-type
  7012. if ( ct ) {
  7013. for ( type in contents ) {
  7014. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7015. dataTypes.unshift( type );
  7016. break;
  7017. }
  7018. }
  7019. }
  7020. // Check to see if we have a response for the expected dataType
  7021. if ( dataTypes[ 0 ] in responses ) {
  7022. finalDataType = dataTypes[ 0 ];
  7023. } else {
  7024. // Try convertible dataTypes
  7025. for ( type in responses ) {
  7026. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7027. finalDataType = type;
  7028. break;
  7029. }
  7030. if ( !firstDataType ) {
  7031. firstDataType = type;
  7032. }
  7033. }
  7034. // Or just use first one
  7035. finalDataType = finalDataType || firstDataType;
  7036. }
  7037. // If we found a dataType
  7038. // We add the dataType to the list if needed
  7039. // and return the corresponding response
  7040. if ( finalDataType ) {
  7041. if ( finalDataType !== dataTypes[ 0 ] ) {
  7042. dataTypes.unshift( finalDataType );
  7043. }
  7044. return responses[ finalDataType ];
  7045. }
  7046. }
  7047. /* Chain conversions given the request and the original response
  7048. * Also sets the responseXXX fields on the jqXHR instance
  7049. */
  7050. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7051. var conv2, current, conv, tmp, prev,
  7052. converters = {},
  7053. // Work with a copy of dataTypes in case we need to modify it for conversion
  7054. dataTypes = s.dataTypes.slice();
  7055. // Create converters map with lowercased keys
  7056. if ( dataTypes[ 1 ] ) {
  7057. for ( conv in s.converters ) {
  7058. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7059. }
  7060. }
  7061. current = dataTypes.shift();
  7062. // Convert to each sequential dataType
  7063. while ( current ) {
  7064. if ( s.responseFields[ current ] ) {
  7065. jqXHR[ s.responseFields[ current ] ] = response;
  7066. }
  7067. // Apply the dataFilter if provided
  7068. if ( !prev && isSuccess && s.dataFilter ) {
  7069. response = s.dataFilter( response, s.dataType );
  7070. }
  7071. prev = current;
  7072. current = dataTypes.shift();
  7073. if ( current ) {
  7074. // There's only work to do if current dataType is non-auto
  7075. if ( current === "*" ) {
  7076. current = prev;
  7077. // Convert response if prev dataType is non-auto and differs from current
  7078. } else if ( prev !== "*" && prev !== current ) {
  7079. // Seek a direct converter
  7080. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7081. // If none found, seek a pair
  7082. if ( !conv ) {
  7083. for ( conv2 in converters ) {
  7084. // If conv2 outputs current
  7085. tmp = conv2.split( " " );
  7086. if ( tmp[ 1 ] === current ) {
  7087. // If prev can be converted to accepted input
  7088. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7089. converters[ "* " + tmp[ 0 ] ];
  7090. if ( conv ) {
  7091. // Condense equivalence converters
  7092. if ( conv === true ) {
  7093. conv = converters[ conv2 ];
  7094. // Otherwise, insert the intermediate dataType
  7095. } else if ( converters[ conv2 ] !== true ) {
  7096. current = tmp[ 0 ];
  7097. dataTypes.unshift( tmp[ 1 ] );
  7098. }
  7099. break;
  7100. }
  7101. }
  7102. }
  7103. }
  7104. // Apply converter (if not an equivalence)
  7105. if ( conv !== true ) {
  7106. // Unless errors are allowed to bubble, catch and return them
  7107. if ( conv && s.throws ) {
  7108. response = conv( response );
  7109. } else {
  7110. try {
  7111. response = conv( response );
  7112. } catch ( e ) {
  7113. return {
  7114. state: "parsererror",
  7115. error: conv ? e : "No conversion from " + prev + " to " + current
  7116. };
  7117. }
  7118. }
  7119. }
  7120. }
  7121. }
  7122. }
  7123. return { state: "success", data: response };
  7124. }
  7125. jQuery.extend( {
  7126. // Counter for holding the number of active queries
  7127. active: 0,
  7128. // Last-Modified header cache for next request
  7129. lastModified: {},
  7130. etag: {},
  7131. ajaxSettings: {
  7132. url: location.href,
  7133. type: "GET",
  7134. isLocal: rlocalProtocol.test( location.protocol ),
  7135. global: true,
  7136. processData: true,
  7137. async: true,
  7138. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7139. /*
  7140. timeout: 0,
  7141. data: null,
  7142. dataType: null,
  7143. username: null,
  7144. password: null,
  7145. cache: null,
  7146. throws: false,
  7147. traditional: false,
  7148. headers: {},
  7149. */
  7150. accepts: {
  7151. "*": allTypes,
  7152. text: "text/plain",
  7153. html: "text/html",
  7154. xml: "application/xml, text/xml",
  7155. json: "application/json, text/javascript"
  7156. },
  7157. contents: {
  7158. xml: /\bxml\b/,
  7159. html: /\bhtml/,
  7160. json: /\bjson\b/
  7161. },
  7162. responseFields: {
  7163. xml: "responseXML",
  7164. text: "responseText",
  7165. json: "responseJSON"
  7166. },
  7167. // Data converters
  7168. // Keys separate source (or catchall "*") and destination types with a single space
  7169. converters: {
  7170. // Convert anything to text
  7171. "* text": String,
  7172. // Text to html (true = no transformation)
  7173. "text html": true,
  7174. // Evaluate text as a json expression
  7175. "text json": JSON.parse,
  7176. // Parse text as xml
  7177. "text xml": jQuery.parseXML
  7178. },
  7179. // For options that shouldn't be deep extended:
  7180. // you can add your own custom options here if
  7181. // and when you create one that shouldn't be
  7182. // deep extended (see ajaxExtend)
  7183. flatOptions: {
  7184. url: true,
  7185. context: true
  7186. }
  7187. },
  7188. // Creates a full fledged settings object into target
  7189. // with both ajaxSettings and settings fields.
  7190. // If target is omitted, writes into ajaxSettings.
  7191. ajaxSetup: function( target, settings ) {
  7192. return settings ?
  7193. // Building a settings object
  7194. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7195. // Extending ajaxSettings
  7196. ajaxExtend( jQuery.ajaxSettings, target );
  7197. },
  7198. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7199. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7200. // Main method
  7201. ajax: function( url, options ) {
  7202. // If url is an object, simulate pre-1.5 signature
  7203. if ( typeof url === "object" ) {
  7204. options = url;
  7205. url = undefined;
  7206. }
  7207. // Force options to be an object
  7208. options = options || {};
  7209. var transport,
  7210. // URL without anti-cache param
  7211. cacheURL,
  7212. // Response headers
  7213. responseHeadersString,
  7214. responseHeaders,
  7215. // timeout handle
  7216. timeoutTimer,
  7217. // Url cleanup var
  7218. urlAnchor,
  7219. // Request state (becomes false upon send and true upon completion)
  7220. completed,
  7221. // To know if global events are to be dispatched
  7222. fireGlobals,
  7223. // Loop variable
  7224. i,
  7225. // uncached part of the url
  7226. uncached,
  7227. // Create the final options object
  7228. s = jQuery.ajaxSetup( {}, options ),
  7229. // Callbacks context
  7230. callbackContext = s.context || s,
  7231. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7232. globalEventContext = s.context &&
  7233. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7234. jQuery( callbackContext ) :
  7235. jQuery.event,
  7236. // Deferreds
  7237. deferred = jQuery.Deferred(),
  7238. completeDeferred = jQuery.Callbacks( "once memory" ),
  7239. // Status-dependent callbacks
  7240. statusCode = s.statusCode || {},
  7241. // Headers (they are sent all at once)
  7242. requestHeaders = {},
  7243. requestHeadersNames = {},
  7244. // Default abort message
  7245. strAbort = "canceled",
  7246. // Fake xhr
  7247. jqXHR = {
  7248. readyState: 0,
  7249. // Builds headers hashtable if needed
  7250. getResponseHeader: function( key ) {
  7251. var match;
  7252. if ( completed ) {
  7253. if ( !responseHeaders ) {
  7254. responseHeaders = {};
  7255. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  7256. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  7257. }
  7258. }
  7259. match = responseHeaders[ key.toLowerCase() ];
  7260. }
  7261. return match == null ? null : match;
  7262. },
  7263. // Raw string
  7264. getAllResponseHeaders: function() {
  7265. return completed ? responseHeadersString : null;
  7266. },
  7267. // Caches the header
  7268. setRequestHeader: function( name, value ) {
  7269. if ( completed == null ) {
  7270. name = requestHeadersNames[ name.toLowerCase() ] =
  7271. requestHeadersNames[ name.toLowerCase() ] || name;
  7272. requestHeaders[ name ] = value;
  7273. }
  7274. return this;
  7275. },
  7276. // Overrides response content-type header
  7277. overrideMimeType: function( type ) {
  7278. if ( completed == null ) {
  7279. s.mimeType = type;
  7280. }
  7281. return this;
  7282. },
  7283. // Status-dependent callbacks
  7284. statusCode: function( map ) {
  7285. var code;
  7286. if ( map ) {
  7287. if ( completed ) {
  7288. // Execute the appropriate callbacks
  7289. jqXHR.always( map[ jqXHR.status ] );
  7290. } else {
  7291. // Lazy-add the new callbacks in a way that preserves old ones
  7292. for ( code in map ) {
  7293. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7294. }
  7295. }
  7296. }
  7297. return this;
  7298. },
  7299. // Cancel the request
  7300. abort: function( statusText ) {
  7301. var finalText = statusText || strAbort;
  7302. if ( transport ) {
  7303. transport.abort( finalText );
  7304. }
  7305. done( 0, finalText );
  7306. return this;
  7307. }
  7308. };
  7309. // Attach deferreds
  7310. deferred.promise( jqXHR );
  7311. // Add protocol if not provided (prefilters might expect it)
  7312. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7313. // We also use the url parameter if available
  7314. s.url = ( ( url || s.url || location.href ) + "" )
  7315. .replace( rprotocol, location.protocol + "//" );
  7316. // Alias method option to type as per ticket #12004
  7317. s.type = options.method || options.type || s.method || s.type;
  7318. // Extract dataTypes list
  7319. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  7320. // A cross-domain request is in custom when the origin doesn't match the current origin.
  7321. if ( s.crossDomain == null ) {
  7322. urlAnchor = document.createElement( "a" );
  7323. // Support: IE <=8 - 11, Edge 12 - 13
  7324. // IE throws exception on accessing the href property if url is malformed,
  7325. // e.g. http://example.com:80x/
  7326. try {
  7327. urlAnchor.href = s.url;
  7328. // Support: IE <=8 - 11 only
  7329. // Anchor's host property isn't correctly set when s.url is relative
  7330. urlAnchor.href = urlAnchor.href;
  7331. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  7332. urlAnchor.protocol + "//" + urlAnchor.host;
  7333. } catch ( e ) {
  7334. // If there is an error parsing the URL, assume it is crossDomain,
  7335. // it can be rejected by the transport if it is invalid
  7336. s.crossDomain = true;
  7337. }
  7338. }
  7339. // Convert data if not already a string
  7340. if ( s.data && s.processData && typeof s.data !== "string" ) {
  7341. s.data = jQuery.param( s.data, s.traditional );
  7342. }
  7343. // Apply prefilters
  7344. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  7345. // If request was aborted inside a prefilter, stop there
  7346. if ( completed ) {
  7347. return jqXHR;
  7348. }
  7349. // We can fire global events as of now if asked to
  7350. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  7351. fireGlobals = jQuery.event && s.global;
  7352. // Watch for a new set of requests
  7353. if ( fireGlobals && jQuery.active++ === 0 ) {
  7354. jQuery.event.trigger( "ajaxStart" );
  7355. }
  7356. // Uppercase the type
  7357. s.type = s.type.toUpperCase();
  7358. // Determine if request has content
  7359. s.hasContent = !rnoContent.test( s.type );
  7360. // Save the URL in case we're toying with the If-Modified-Since
  7361. // and/or If-None-Match header later on
  7362. // Remove hash to simplify url manipulation
  7363. cacheURL = s.url.replace( rhash, "" );
  7364. // More options handling for requests with no content
  7365. if ( !s.hasContent ) {
  7366. // Remember the hash so we can put it back
  7367. uncached = s.url.slice( cacheURL.length );
  7368. // If data is available, append data to url
  7369. if ( s.data ) {
  7370. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  7371. // #9682: remove data so that it's not used in an eventual retry
  7372. delete s.data;
  7373. }
  7374. // Add or update anti-cache param if needed
  7375. if ( s.cache === false ) {
  7376. cacheURL = cacheURL.replace( rantiCache, "$1" );
  7377. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  7378. }
  7379. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  7380. s.url = cacheURL + uncached;
  7381. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  7382. } else if ( s.data && s.processData &&
  7383. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  7384. s.data = s.data.replace( r20, "+" );
  7385. }
  7386. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7387. if ( s.ifModified ) {
  7388. if ( jQuery.lastModified[ cacheURL ] ) {
  7389. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  7390. }
  7391. if ( jQuery.etag[ cacheURL ] ) {
  7392. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  7393. }
  7394. }
  7395. // Set the correct header, if data is being sent
  7396. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  7397. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  7398. }
  7399. // Set the Accepts header for the server, depending on the dataType
  7400. jqXHR.setRequestHeader(
  7401. "Accept",
  7402. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  7403. s.accepts[ s.dataTypes[ 0 ] ] +
  7404. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  7405. s.accepts[ "*" ]
  7406. );
  7407. // Check for headers option
  7408. for ( i in s.headers ) {
  7409. jqXHR.setRequestHeader( i, s.headers[ i ] );
  7410. }
  7411. // Allow custom headers/mimetypes and early abort
  7412. if ( s.beforeSend &&
  7413. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  7414. // Abort if not done already and return
  7415. return jqXHR.abort();
  7416. }
  7417. // Aborting is no longer a cancellation
  7418. strAbort = "abort";
  7419. // Install callbacks on deferreds
  7420. completeDeferred.add( s.complete );
  7421. jqXHR.done( s.success );
  7422. jqXHR.fail( s.error );
  7423. // Get transport
  7424. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  7425. // If no transport, we auto-abort
  7426. if ( !transport ) {
  7427. done( -1, "No Transport" );
  7428. } else {
  7429. jqXHR.readyState = 1;
  7430. // Send global event
  7431. if ( fireGlobals ) {
  7432. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  7433. }
  7434. // If request was aborted inside ajaxSend, stop there
  7435. if ( completed ) {
  7436. return jqXHR;
  7437. }
  7438. // Timeout
  7439. if ( s.async && s.timeout > 0 ) {
  7440. timeoutTimer = window.setTimeout( function() {
  7441. jqXHR.abort( "timeout" );
  7442. }, s.timeout );
  7443. }
  7444. try {
  7445. completed = false;
  7446. transport.send( requestHeaders, done );
  7447. } catch ( e ) {
  7448. // Rethrow post-completion exceptions
  7449. if ( completed ) {
  7450. throw e;
  7451. }
  7452. // Propagate others as results
  7453. done( -1, e );
  7454. }
  7455. }
  7456. // Callback for when everything is done
  7457. function done( status, nativeStatusText, responses, headers ) {
  7458. var isSuccess, success, error, response, modified,
  7459. statusText = nativeStatusText;
  7460. // Ignore repeat invocations
  7461. if ( completed ) {
  7462. return;
  7463. }
  7464. completed = true;
  7465. // Clear timeout if it exists
  7466. if ( timeoutTimer ) {
  7467. window.clearTimeout( timeoutTimer );
  7468. }
  7469. // Dereference transport for early garbage collection
  7470. // (no matter how long the jqXHR object will be used)
  7471. transport = undefined;
  7472. // Cache response headers
  7473. responseHeadersString = headers || "";
  7474. // Set readyState
  7475. jqXHR.readyState = status > 0 ? 4 : 0;
  7476. // Determine if successful
  7477. isSuccess = status >= 200 && status < 300 || status === 304;
  7478. // Get response data
  7479. if ( responses ) {
  7480. response = ajaxHandleResponses( s, jqXHR, responses );
  7481. }
  7482. // Convert no matter what (that way responseXXX fields are always set)
  7483. response = ajaxConvert( s, response, jqXHR, isSuccess );
  7484. // If successful, handle type chaining
  7485. if ( isSuccess ) {
  7486. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7487. if ( s.ifModified ) {
  7488. modified = jqXHR.getResponseHeader( "Last-Modified" );
  7489. if ( modified ) {
  7490. jQuery.lastModified[ cacheURL ] = modified;
  7491. }
  7492. modified = jqXHR.getResponseHeader( "etag" );
  7493. if ( modified ) {
  7494. jQuery.etag[ cacheURL ] = modified;
  7495. }
  7496. }
  7497. // if no content
  7498. if ( status === 204 || s.type === "HEAD" ) {
  7499. statusText = "nocontent";
  7500. // if not modified
  7501. } else if ( status === 304 ) {
  7502. statusText = "notmodified";
  7503. // If we have data, let's convert it
  7504. } else {
  7505. statusText = response.state;
  7506. success = response.data;
  7507. error = response.error;
  7508. isSuccess = !error;
  7509. }
  7510. } else {
  7511. // Extract error from statusText and normalize for non-aborts
  7512. error = statusText;
  7513. if ( status || !statusText ) {
  7514. statusText = "error";
  7515. if ( status < 0 ) {
  7516. status = 0;
  7517. }
  7518. }
  7519. }
  7520. // Set data for the fake xhr object
  7521. jqXHR.status = status;
  7522. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  7523. // Success/Error
  7524. if ( isSuccess ) {
  7525. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  7526. } else {
  7527. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  7528. }
  7529. // Status-dependent callbacks
  7530. jqXHR.statusCode( statusCode );
  7531. statusCode = undefined;
  7532. if ( fireGlobals ) {
  7533. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  7534. [ jqXHR, s, isSuccess ? success : error ] );
  7535. }
  7536. // Complete
  7537. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  7538. if ( fireGlobals ) {
  7539. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  7540. // Handle the global AJAX counter
  7541. if ( !( --jQuery.active ) ) {
  7542. jQuery.event.trigger( "ajaxStop" );
  7543. }
  7544. }
  7545. }
  7546. return jqXHR;
  7547. },
  7548. getJSON: function( url, data, callback ) {
  7549. return jQuery.get( url, data, callback, "json" );
  7550. },
  7551. getScript: function( url, callback ) {
  7552. return jQuery.get( url, undefined, callback, "script" );
  7553. }
  7554. } );
  7555. jQuery.each( [ "get", "post" ], function( i, method ) {
  7556. jQuery[ method ] = function( url, data, callback, type ) {
  7557. // Shift arguments if data argument was omitted
  7558. if ( jQuery.isFunction( data ) ) {
  7559. type = type || callback;
  7560. callback = data;
  7561. data = undefined;
  7562. }
  7563. // The url can be an options object (which then must have .url)
  7564. return jQuery.ajax( jQuery.extend( {
  7565. url: url,
  7566. type: method,
  7567. dataType: type,
  7568. data: data,
  7569. success: callback
  7570. }, jQuery.isPlainObject( url ) && url ) );
  7571. };
  7572. } );
  7573. jQuery._evalUrl = function( url ) {
  7574. return jQuery.ajax( {
  7575. url: url,
  7576. // Make this explicit, since user can override this through ajaxSetup (#11264)
  7577. type: "GET",
  7578. dataType: "script",
  7579. cache: true,
  7580. async: false,
  7581. global: false,
  7582. "throws": true
  7583. } );
  7584. };
  7585. jQuery.fn.extend( {
  7586. wrapAll: function( html ) {
  7587. var wrap;
  7588. if ( this[ 0 ] ) {
  7589. if ( jQuery.isFunction( html ) ) {
  7590. html = html.call( this[ 0 ] );
  7591. }
  7592. // The elements to wrap the target around
  7593. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  7594. if ( this[ 0 ].parentNode ) {
  7595. wrap.insertBefore( this[ 0 ] );
  7596. }
  7597. wrap.map( function() {
  7598. var elem = this;
  7599. while ( elem.firstElementChild ) {
  7600. elem = elem.firstElementChild;
  7601. }
  7602. return elem;
  7603. } ).append( this );
  7604. }
  7605. return this;
  7606. },
  7607. wrapInner: function( html ) {
  7608. if ( jQuery.isFunction( html ) ) {
  7609. return this.each( function( i ) {
  7610. jQuery( this ).wrapInner( html.call( this, i ) );
  7611. } );
  7612. }
  7613. return this.each( function() {
  7614. var self = jQuery( this ),
  7615. contents = self.contents();
  7616. if ( contents.length ) {
  7617. contents.wrapAll( html );
  7618. } else {
  7619. self.append( html );
  7620. }
  7621. } );
  7622. },
  7623. wrap: function( html ) {
  7624. var isFunction = jQuery.isFunction( html );
  7625. return this.each( function( i ) {
  7626. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  7627. } );
  7628. },
  7629. unwrap: function( selector ) {
  7630. this.parent( selector ).not( "body" ).each( function() {
  7631. jQuery( this ).replaceWith( this.childNodes );
  7632. } );
  7633. return this;
  7634. }
  7635. } );
  7636. jQuery.expr.pseudos.hidden = function( elem ) {
  7637. return !jQuery.expr.pseudos.visible( elem );
  7638. };
  7639. jQuery.expr.pseudos.visible = function( elem ) {
  7640. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  7641. };
  7642. jQuery.ajaxSettings.xhr = function() {
  7643. try {
  7644. return new window.XMLHttpRequest();
  7645. } catch ( e ) {}
  7646. };
  7647. var xhrSuccessStatus = {
  7648. // File protocol always yields status code 0, assume 200
  7649. 0: 200,
  7650. // Support: IE <=9 only
  7651. // #1450: sometimes IE returns 1223 when it should be 204
  7652. 1223: 204
  7653. },
  7654. xhrSupported = jQuery.ajaxSettings.xhr();
  7655. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  7656. support.ajax = xhrSupported = !!xhrSupported;
  7657. jQuery.ajaxTransport( function( options ) {
  7658. var callback, errorCallback;
  7659. // Cross domain only allowed if supported through XMLHttpRequest
  7660. if ( support.cors || xhrSupported && !options.crossDomain ) {
  7661. return {
  7662. send: function( headers, complete ) {
  7663. var i,
  7664. xhr = options.xhr();
  7665. xhr.open(
  7666. options.type,
  7667. options.url,
  7668. options.async,
  7669. options.username,
  7670. options.password
  7671. );
  7672. // Apply custom fields if provided
  7673. if ( options.xhrFields ) {
  7674. for ( i in options.xhrFields ) {
  7675. xhr[ i ] = options.xhrFields[ i ];
  7676. }
  7677. }
  7678. // Override mime type if needed
  7679. if ( options.mimeType && xhr.overrideMimeType ) {
  7680. xhr.overrideMimeType( options.mimeType );
  7681. }
  7682. // X-Requested-With header
  7683. // For cross-domain requests, seeing as conditions for a preflight are
  7684. // akin to a jigsaw puzzle, we simply never set it to be sure.
  7685. // (it can always be set on a per-request basis or even using ajaxSetup)
  7686. // For same-domain requests, won't change header if already provided.
  7687. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  7688. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  7689. }
  7690. // Set headers
  7691. for ( i in headers ) {
  7692. xhr.setRequestHeader( i, headers[ i ] );
  7693. }
  7694. // Callback
  7695. callback = function( type ) {
  7696. return function() {
  7697. if ( callback ) {
  7698. callback = errorCallback = xhr.onload =
  7699. xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  7700. if ( type === "abort" ) {
  7701. xhr.abort();
  7702. } else if ( type === "error" ) {
  7703. // Support: IE <=9 only
  7704. // On a manual native abort, IE9 throws
  7705. // errors on any property access that is not readyState
  7706. if ( typeof xhr.status !== "number" ) {
  7707. complete( 0, "error" );
  7708. } else {
  7709. complete(
  7710. // File: protocol always yields status 0; see #8605, #14207
  7711. xhr.status,
  7712. xhr.statusText
  7713. );
  7714. }
  7715. } else {
  7716. complete(
  7717. xhrSuccessStatus[ xhr.status ] || xhr.status,
  7718. xhr.statusText,
  7719. // Support: IE <=9 only
  7720. // IE9 has no XHR2 but throws on binary (trac-11426)
  7721. // For XHR2 non-text, let the caller handle it (gh-2498)
  7722. ( xhr.responseType || "text" ) !== "text" ||
  7723. typeof xhr.responseText !== "string" ?
  7724. { binary: xhr.response } :
  7725. { text: xhr.responseText },
  7726. xhr.getAllResponseHeaders()
  7727. );
  7728. }
  7729. }
  7730. };
  7731. };
  7732. // Listen to events
  7733. xhr.onload = callback();
  7734. errorCallback = xhr.onerror = callback( "error" );
  7735. // Support: IE 9 only
  7736. // Use onreadystatechange to replace onabort
  7737. // to handle uncaught aborts
  7738. if ( xhr.onabort !== undefined ) {
  7739. xhr.onabort = errorCallback;
  7740. } else {
  7741. xhr.onreadystatechange = function() {
  7742. // Check readyState before timeout as it changes
  7743. if ( xhr.readyState === 4 ) {
  7744. // Allow onerror to be called first,
  7745. // but that will not handle a native abort
  7746. // Also, save errorCallback to a variable
  7747. // as xhr.onerror cannot be accessed
  7748. window.setTimeout( function() {
  7749. if ( callback ) {
  7750. errorCallback();
  7751. }
  7752. } );
  7753. }
  7754. };
  7755. }
  7756. // Create the abort callback
  7757. callback = callback( "abort" );
  7758. try {
  7759. // Do send the request (this may raise an exception)
  7760. xhr.send( options.hasContent && options.data || null );
  7761. } catch ( e ) {
  7762. // #14683: Only rethrow if this hasn't been notified as an error yet
  7763. if ( callback ) {
  7764. throw e;
  7765. }
  7766. }
  7767. },
  7768. abort: function() {
  7769. if ( callback ) {
  7770. callback();
  7771. }
  7772. }
  7773. };
  7774. }
  7775. } );
  7776. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  7777. jQuery.ajaxPrefilter( function( s ) {
  7778. if ( s.crossDomain ) {
  7779. s.contents.script = false;
  7780. }
  7781. } );
  7782. // Install script dataType
  7783. jQuery.ajaxSetup( {
  7784. accepts: {
  7785. script: "text/javascript, application/javascript, " +
  7786. "application/ecmascript, application/x-ecmascript"
  7787. },
  7788. contents: {
  7789. script: /\b(?:java|ecma)script\b/
  7790. },
  7791. converters: {
  7792. "text script": function( text ) {
  7793. jQuery.globalEval( text );
  7794. return text;
  7795. }
  7796. }
  7797. } );
  7798. // Handle cache's special case and crossDomain
  7799. jQuery.ajaxPrefilter( "script", function( s ) {
  7800. if ( s.cache === undefined ) {
  7801. s.cache = false;
  7802. }
  7803. if ( s.crossDomain ) {
  7804. s.type = "GET";
  7805. }
  7806. } );
  7807. // Bind script tag hack transport
  7808. jQuery.ajaxTransport( "script", function( s ) {
  7809. // This transport only deals with cross domain requests
  7810. if ( s.crossDomain ) {
  7811. var script, callback;
  7812. return {
  7813. send: function( _, complete ) {
  7814. script = jQuery( "<script>" ).prop( {
  7815. charset: s.scriptCharset,
  7816. src: s.url
  7817. } ).on(
  7818. "load error",
  7819. callback = function( evt ) {
  7820. script.remove();
  7821. callback = null;
  7822. if ( evt ) {
  7823. complete( evt.type === "error" ? 404 : 200, evt.type );
  7824. }
  7825. }
  7826. );
  7827. // Use native DOM manipulation to avoid our domManip AJAX trickery
  7828. document.head.appendChild( script[ 0 ] );
  7829. },
  7830. abort: function() {
  7831. if ( callback ) {
  7832. callback();
  7833. }
  7834. }
  7835. };
  7836. }
  7837. } );
  7838. var oldCallbacks = [],
  7839. rjsonp = /(=)\?(?=&|$)|\?\?/;
  7840. // Default jsonp settings
  7841. jQuery.ajaxSetup( {
  7842. jsonp: "callback",
  7843. jsonpCallback: function() {
  7844. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  7845. this[ callback ] = true;
  7846. return callback;
  7847. }
  7848. } );
  7849. // Detect, normalize options and install callbacks for jsonp requests
  7850. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  7851. var callbackName, overwritten, responseContainer,
  7852. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  7853. "url" :
  7854. typeof s.data === "string" &&
  7855. ( s.contentType || "" )
  7856. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  7857. rjsonp.test( s.data ) && "data"
  7858. );
  7859. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  7860. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  7861. // Get callback name, remembering preexisting value associated with it
  7862. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  7863. s.jsonpCallback() :
  7864. s.jsonpCallback;
  7865. // Insert callback into url or form data
  7866. if ( jsonProp ) {
  7867. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  7868. } else if ( s.jsonp !== false ) {
  7869. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  7870. }
  7871. // Use data converter to retrieve json after script execution
  7872. s.converters[ "script json" ] = function() {
  7873. if ( !responseContainer ) {
  7874. jQuery.error( callbackName + " was not called" );
  7875. }
  7876. return responseContainer[ 0 ];
  7877. };
  7878. // Force json dataType
  7879. s.dataTypes[ 0 ] = "json";
  7880. // Install callback
  7881. overwritten = window[ callbackName ];
  7882. window[ callbackName ] = function() {
  7883. responseContainer = arguments;
  7884. };
  7885. // Clean-up function (fires after converters)
  7886. jqXHR.always( function() {
  7887. // If previous value didn't exist - remove it
  7888. if ( overwritten === undefined ) {
  7889. jQuery( window ).removeProp( callbackName );
  7890. // Otherwise restore preexisting value
  7891. } else {
  7892. window[ callbackName ] = overwritten;
  7893. }
  7894. // Save back as free
  7895. if ( s[ callbackName ] ) {
  7896. // Make sure that re-using the options doesn't screw things around
  7897. s.jsonpCallback = originalSettings.jsonpCallback;
  7898. // Save the callback name for future use
  7899. oldCallbacks.push( callbackName );
  7900. }
  7901. // Call if it was a function and we have a response
  7902. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  7903. overwritten( responseContainer[ 0 ] );
  7904. }
  7905. responseContainer = overwritten = undefined;
  7906. } );
  7907. // Delegate to script
  7908. return "script";
  7909. }
  7910. } );
  7911. // Support: Safari 8 only
  7912. // In Safari 8 documents created via document.implementation.createHTMLDocument
  7913. // collapse sibling forms: the second one becomes a child of the first one.
  7914. // Because of that, this security measure has to be disabled in Safari 8.
  7915. // https://bugs.webkit.org/show_bug.cgi?id=137337
  7916. support.createHTMLDocument = ( function() {
  7917. var body = document.implementation.createHTMLDocument( "" ).body;
  7918. body.innerHTML = "<form></form><form></form>";
  7919. return body.childNodes.length === 2;
  7920. } )();
  7921. // Argument "data" should be string of html
  7922. // context (optional): If specified, the fragment will be created in this context,
  7923. // defaults to document
  7924. // keepScripts (optional): If true, will include scripts passed in the html string
  7925. jQuery.parseHTML = function( data, context, keepScripts ) {
  7926. if ( typeof data !== "string" ) {
  7927. return [];
  7928. }
  7929. if ( typeof context === "boolean" ) {
  7930. keepScripts = context;
  7931. context = false;
  7932. }
  7933. var base, parsed, scripts;
  7934. if ( !context ) {
  7935. // Stop scripts or inline event handlers from being executed immediately
  7936. // by using document.implementation
  7937. if ( support.createHTMLDocument ) {
  7938. context = document.implementation.createHTMLDocument( "" );
  7939. // Set the base href for the created document
  7940. // so any parsed elements with URLs
  7941. // are based on the document's URL (gh-2965)
  7942. base = context.createElement( "base" );
  7943. base.href = document.location.href;
  7944. context.head.appendChild( base );
  7945. } else {
  7946. context = document;
  7947. }
  7948. }
  7949. parsed = rsingleTag.exec( data );
  7950. scripts = !keepScripts && [];
  7951. // Single tag
  7952. if ( parsed ) {
  7953. return [ context.createElement( parsed[ 1 ] ) ];
  7954. }
  7955. parsed = buildFragment( [ data ], context, scripts );
  7956. if ( scripts && scripts.length ) {
  7957. jQuery( scripts ).remove();
  7958. }
  7959. return jQuery.merge( [], parsed.childNodes );
  7960. };
  7961. /**
  7962. * Load a url into a pages
  7963. */
  7964. jQuery.fn.load = function( url, params, callback ) {
  7965. var selector, type, response,
  7966. self = this,
  7967. off = url.indexOf( " " );
  7968. if ( off > -1 ) {
  7969. selector = stripAndCollapse( url.slice( off ) );
  7970. url = url.slice( 0, off );
  7971. }
  7972. // If it's a function
  7973. if ( jQuery.isFunction( params ) ) {
  7974. // We assume that it's the callback
  7975. callback = params;
  7976. params = undefined;
  7977. // Otherwise, build a param string
  7978. } else if ( params && typeof params === "object" ) {
  7979. type = "POST";
  7980. }
  7981. // If we have elements to modify, make the request
  7982. if ( self.length > 0 ) {
  7983. jQuery.ajax( {
  7984. url: url,
  7985. // If "type" variable is undefined, then "GET" method will be used.
  7986. // Make value of this field explicit since
  7987. // user can override it through ajaxSetup method
  7988. type: type || "GET",
  7989. dataType: "html",
  7990. data: params
  7991. } ).done( function( responseText ) {
  7992. // Save response for use in complete callback
  7993. response = arguments;
  7994. self.html( selector ?
  7995. // If a selector was specified, locate the right elements in a dummy div
  7996. // Exclude scripts to avoid IE 'Permission Denied' errors
  7997. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  7998. // Otherwise use the full result
  7999. responseText );
  8000. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8001. // but they are ignored because response was set above.
  8002. // If it fails, this function gets "jqXHR", "status", "error"
  8003. } ).always( callback && function( jqXHR, status ) {
  8004. self.each( function() {
  8005. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8006. } );
  8007. } );
  8008. }
  8009. return this;
  8010. };
  8011. // Attach a bunch of functions for handling common AJAX events
  8012. jQuery.each( [
  8013. "ajaxStart",
  8014. "ajaxStop",
  8015. "ajaxComplete",
  8016. "ajaxError",
  8017. "ajaxSuccess",
  8018. "ajaxSend"
  8019. ], function( i, type ) {
  8020. jQuery.fn[ type ] = function( fn ) {
  8021. return this.on( type, fn );
  8022. };
  8023. } );
  8024. jQuery.expr.pseudos.animated = function( elem ) {
  8025. return jQuery.grep( jQuery.timers, function( fn ) {
  8026. return elem === fn.elem;
  8027. } ).length;
  8028. };
  8029. /**
  8030. * Gets a window from an element
  8031. */
  8032. function getWindow( elem ) {
  8033. return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
  8034. }
  8035. jQuery.offset = {
  8036. setOffset: function( elem, options, i ) {
  8037. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8038. position = jQuery.css( elem, "position" ),
  8039. curElem = jQuery( elem ),
  8040. props = {};
  8041. // Set position first, in-case top/left are set even on static elem
  8042. if ( position === "static" ) {
  8043. elem.style.position = "relative";
  8044. }
  8045. curOffset = curElem.offset();
  8046. curCSSTop = jQuery.css( elem, "top" );
  8047. curCSSLeft = jQuery.css( elem, "left" );
  8048. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8049. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8050. // Need to be able to calculate position if either
  8051. // top or left is auto and position is either absolute or fixed
  8052. if ( calculatePosition ) {
  8053. curPosition = curElem.position();
  8054. curTop = curPosition.top;
  8055. curLeft = curPosition.left;
  8056. } else {
  8057. curTop = parseFloat( curCSSTop ) || 0;
  8058. curLeft = parseFloat( curCSSLeft ) || 0;
  8059. }
  8060. if ( jQuery.isFunction( options ) ) {
  8061. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8062. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8063. }
  8064. if ( options.top != null ) {
  8065. props.top = ( options.top - curOffset.top ) + curTop;
  8066. }
  8067. if ( options.left != null ) {
  8068. props.left = ( options.left - curOffset.left ) + curLeft;
  8069. }
  8070. if ( "using" in options ) {
  8071. options.using.call( elem, props );
  8072. } else {
  8073. curElem.css( props );
  8074. }
  8075. }
  8076. };
  8077. jQuery.fn.extend( {
  8078. offset: function( options ) {
  8079. // Preserve chaining for setter
  8080. if ( arguments.length ) {
  8081. return options === undefined ?
  8082. this :
  8083. this.each( function( i ) {
  8084. jQuery.offset.setOffset( this, options, i );
  8085. } );
  8086. }
  8087. var docElem, win, rect, doc,
  8088. elem = this[ 0 ];
  8089. if ( !elem ) {
  8090. return;
  8091. }
  8092. // Support: IE <=11 only
  8093. // Running getBoundingClientRect on a
  8094. // disconnected node in IE throws an error
  8095. if ( !elem.getClientRects().length ) {
  8096. return { top: 0, left: 0 };
  8097. }
  8098. rect = elem.getBoundingClientRect();
  8099. // Make sure element is not hidden (display: none)
  8100. if ( rect.width || rect.height ) {
  8101. doc = elem.ownerDocument;
  8102. win = getWindow( doc );
  8103. docElem = doc.documentElement;
  8104. return {
  8105. top: rect.top + win.pageYOffset - docElem.clientTop,
  8106. left: rect.left + win.pageXOffset - docElem.clientLeft
  8107. };
  8108. }
  8109. // Return zeros for disconnected and hidden elements (gh-2310)
  8110. return rect;
  8111. },
  8112. position: function() {
  8113. if ( !this[ 0 ] ) {
  8114. return;
  8115. }
  8116. var offsetParent, offset,
  8117. elem = this[ 0 ],
  8118. parentOffset = { top: 0, left: 0 };
  8119. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  8120. // because it is its only offset parent
  8121. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8122. // Assume getBoundingClientRect is there when computed position is fixed
  8123. offset = elem.getBoundingClientRect();
  8124. } else {
  8125. // Get *real* offsetParent
  8126. offsetParent = this.offsetParent();
  8127. // Get correct offsets
  8128. offset = this.offset();
  8129. if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
  8130. parentOffset = offsetParent.offset();
  8131. }
  8132. // Add offsetParent borders
  8133. parentOffset = {
  8134. top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
  8135. left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
  8136. };
  8137. }
  8138. // Subtract parent offsets and element margins
  8139. return {
  8140. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8141. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8142. };
  8143. },
  8144. // This method will return documentElement in the following cases:
  8145. // 1) For the element inside the iframe without offsetParent, this method will return
  8146. // documentElement of the parent window
  8147. // 2) For the hidden or detached element
  8148. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8149. //
  8150. // but those exceptions were never presented as a real life use-cases
  8151. // and might be considered as more preferable results.
  8152. //
  8153. // This logic, however, is not guaranteed and can change at any point in the future
  8154. offsetParent: function() {
  8155. return this.map( function() {
  8156. var offsetParent = this.offsetParent;
  8157. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8158. offsetParent = offsetParent.offsetParent;
  8159. }
  8160. return offsetParent || documentElement;
  8161. } );
  8162. }
  8163. } );
  8164. // Create scrollLeft and scrollTop methods
  8165. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8166. var top = "pageYOffset" === prop;
  8167. jQuery.fn[ method ] = function( val ) {
  8168. return access( this, function( elem, method, val ) {
  8169. var win = getWindow( elem );
  8170. if ( val === undefined ) {
  8171. return win ? win[ prop ] : elem[ method ];
  8172. }
  8173. if ( win ) {
  8174. win.scrollTo(
  8175. !top ? val : win.pageXOffset,
  8176. top ? val : win.pageYOffset
  8177. );
  8178. } else {
  8179. elem[ method ] = val;
  8180. }
  8181. }, method, val, arguments.length );
  8182. };
  8183. } );
  8184. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8185. // Add the top/left cssHooks using jQuery.fn.position
  8186. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8187. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8188. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8189. // rather than make the css module depend on the offset module, just check for it here
  8190. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8191. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8192. function( elem, computed ) {
  8193. if ( computed ) {
  8194. computed = curCSS( elem, prop );
  8195. // If curCSS returns percentage, fallback to offset
  8196. return rnumnonpx.test( computed ) ?
  8197. jQuery( elem ).position()[ prop ] + "px" :
  8198. computed;
  8199. }
  8200. }
  8201. );
  8202. } );
  8203. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8204. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8205. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8206. function( defaultExtra, funcName ) {
  8207. // Margin is only for outerHeight, outerWidth
  8208. jQuery.fn[ funcName ] = function( margin, value ) {
  8209. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8210. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8211. return access( this, function( elem, type, value ) {
  8212. var doc;
  8213. if ( jQuery.isWindow( elem ) ) {
  8214. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8215. return funcName.indexOf( "outer" ) === 0 ?
  8216. elem[ "inner" + name ] :
  8217. elem.document.documentElement[ "client" + name ];
  8218. }
  8219. // Get document width or height
  8220. if ( elem.nodeType === 9 ) {
  8221. doc = elem.documentElement;
  8222. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8223. // whichever is greatest
  8224. return Math.max(
  8225. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8226. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8227. doc[ "client" + name ]
  8228. );
  8229. }
  8230. return value === undefined ?
  8231. // Get width or height on the element, requesting but not forcing parseFloat
  8232. jQuery.css( elem, type, extra ) :
  8233. // Set width or height on the element
  8234. jQuery.style( elem, type, value, extra );
  8235. }, type, chainable ? margin : undefined, chainable );
  8236. };
  8237. } );
  8238. } );
  8239. jQuery.fn.extend( {
  8240. bind: function( types, data, fn ) {
  8241. return this.on( types, null, data, fn );
  8242. },
  8243. unbind: function( types, fn ) {
  8244. return this.off( types, null, fn );
  8245. },
  8246. delegate: function( selector, types, data, fn ) {
  8247. return this.on( types, selector, data, fn );
  8248. },
  8249. undelegate: function( selector, types, fn ) {
  8250. // ( namespace ) or ( selector, types [, fn] )
  8251. return arguments.length === 1 ?
  8252. this.off( selector, "**" ) :
  8253. this.off( types, selector || "**", fn );
  8254. }
  8255. } );
  8256. jQuery.parseJSON = JSON.parse;
  8257. // Register as a named AMD module, since jQuery can be concatenated with other
  8258. // files that may use define, but not via a proper concatenation script that
  8259. // understands anonymous AMD modules. A named AMD is safest and most robust
  8260. // way to register. Lowercase jquery is used because AMD module names are
  8261. // derived from file names, and jQuery is normally delivered in a lowercase
  8262. // file name. Do this after creating the global so that if an AMD module wants
  8263. // to call noConflict to hide this version of jQuery, it will work.
  8264. // Note that for maximum portability, libraries that are not jQuery should
  8265. // declare themselves as anonymous modules, and avoid setting a global if an
  8266. // AMD loader is present. jQuery is a special case. For more information, see
  8267. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8268. if ( typeof define === "function" && define.amd ) {
  8269. define( "jquery", [], function() {
  8270. return jQuery;
  8271. } );
  8272. }
  8273. var
  8274. // Map over jQuery in case of overwrite
  8275. _jQuery = window.jQuery,
  8276. // Map over the $ in case of overwrite
  8277. _$ = window.$;
  8278. jQuery.noConflict = function( deep ) {
  8279. if ( window.$ === jQuery ) {
  8280. window.$ = _$;
  8281. }
  8282. if ( deep && window.jQuery === jQuery ) {
  8283. window.jQuery = _jQuery;
  8284. }
  8285. return jQuery;
  8286. };
  8287. // Expose jQuery and $ identifiers, even in AMD
  8288. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8289. // and CommonJS for browser emulators (#13566)
  8290. if ( !noGlobal ) {
  8291. window.jQuery = window.$ = jQuery;
  8292. }
  8293. return jQuery;
  8294. } );