jquery-3.5.0.js 393 KB

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