jquery-3.5.1.js 286 KB

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