jquery.slim.js 227 KB

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