vendor.js 291 KB

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